From e5916c411f7e83e4f4dde34e728b093d83e76870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 15 Nov 2016 16:33:33 -0500 Subject: [PATCH 01/51] update changelog for 1.20.0 --- CHANGELOG.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e8ad5556c0..f9db358d7e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,44 @@ https://github.com/plotly/plotly.js/compare/vX.Y.Z...master where X.Y.Z is the semver of most recent plotly.js release. + +## [1.20.0] -- 2016-11-15 + +### Added +- Allow date string inputs for axis ranges, `tick0`, `dtick`, annotation / image + positions, histogram bins [#1078, #1150] +- Add special `dtick` values for log axes [#1078] +- Add `visible` attribute to annotations, shapes and images items [#1110] +- Expose events on slider start/change/end [#1126] +- Expose event on updatemenu button click [#1128] +- Allow custom transform module to have supply layout default handler [#1122] + +### Changed +- Increase `scattergl` precision [#1114] +- Use `topojson-client` to convert topojson to geojson [#1147] + +### Fixed +- Fix hover labels for multi-trace `scattergl` graphs (bug introduced in + `1.18.0`) [#1148] +- Fix date format on hover on full hour [#1078] +- Fix bar labels for non-zero `base` values [#1142] +- Scatter colorscale now yield correct colors when cmin and cmax ashow re equal + [#1112] +- Fix `filter` transform for categorical `target` arrays with range operations + [#1120] +- Make sure frames with `null` values clear array containers [#1118] +- Fix animations involving trace `opacity` [#1146] +- Fix fallback for non-animatable trace modules (bug introduced in `1.18.1`) + [#1141] +- Fix race condition in animation resolution when coupled with `relayout` + [#1108] +- Enforce casting requested frame names to strings [#1124] +- `Plotly.animte` no longer breaks when passing `null` frames [#1121] +- `Plotly.PlotSchema.get` now correctly list rangeslider and rangeselector under + `xaxis` only [#1144] +- `Plotly.relayout` correctly updates arbitrary layout attributes [#1133] + + ## [1.19.2] -- 2016-11-02 ### Fixed From d48c310687141d7ee57559847ed8dadd77498ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 15 Nov 2016 16:39:14 -0500 Subject: [PATCH 02/51] 1.20.0 --- dist/README.md | 48 +- dist/npm-ls.json | 97 +- dist/plotly-basic.js | 3533 +++++++++++----------- dist/plotly-basic.min.js | 42 +- dist/plotly-cartesian.js | 4140 ++++++++++++++------------ dist/plotly-cartesian.min.js | 46 +- dist/plotly-finance.js | 3756 +++++++++++++----------- dist/plotly-finance.min.js | 44 +- dist/plotly-geo-assets.js | 4 +- dist/plotly-geo.js | 4025 +++++++++++++------------ dist/plotly-geo.min.js | 44 +- dist/plotly-gl2d.js | 4103 ++++++++++++++------------ dist/plotly-gl2d.min.js | 62 +- dist/plotly-gl3d.js | 3598 ++++++++++++----------- dist/plotly-gl3d.min.js | 68 +- dist/plotly-mapbox.js | 3516 +++++++++++----------- dist/plotly-mapbox.min.js | 52 +- dist/plotly-with-meta.js | 5355 ++++++++++++++++++---------------- dist/plotly.js | 5156 +++++++++++++++++--------------- dist/plotly.min.js | 106 +- package.json | 2 +- src/assets/geo_assets.js | 2 +- src/core.js | 2 +- 23 files changed, 20228 insertions(+), 17573 deletions(-) diff --git a/dist/README.md b/dist/README.md index c8ec3b83c68..f2203cb86c6 100644 --- a/dist/README.md +++ b/dist/README.md @@ -37,11 +37,11 @@ The main plotly.js bundle includes all the official (non-beta) trace modules. It be can imported as minified javascript - using dist file `dist/plotly.min.js` -- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.min.js OR https://cdn.plot.ly/plotly-plotly-1.19.2.min.js +- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.min.js OR https://cdn.plot.ly/plotly-plotly-1.20.0.min.js or as raw javascript: - using dist file `dist/plotly.js` -- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.js OR https://cdn.plot.ly/plotly-plotly-1.19.2.js +- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.js OR https://cdn.plot.ly/plotly-plotly-1.20.0.js - using CommonJS with `require('plotly.js')` If you would like to have access to the attribute meta information (including attribute descriptions as on the [schema reference page](https://plot.ly/javascript/reference/)), use dist file `dist/plotly-with-meta.js` @@ -50,7 +50,7 @@ The main plotly.js bundle weights in at: | plotly.js | plotly.min.js | plotly.min.js + gzip | plotly-with-meta.js | |-----------|---------------|----------------------|---------------------| -| 4.2 MB | 1.7 MB | 525.1 kB | 4.3 MB | +| 4.2 MB | 1.7 MB | 526.2 kB | 4.3 MB | ## Partial bundles @@ -74,13 +74,13 @@ The `basic` partial bundle contains the `scatter`, `bar` and `pie` trace modules | dist bundle (minified) | `dist/plotly-basic.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-basic-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-basic-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-basic-1.19.2.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-basic-1.19.2.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-basic-1.20.0.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-basic-1.20.0.min.js | | CommonJS | `require('plotly.js/lib/index-basic')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.6 MB | 605.4 kB | 196.1 kB | +| 1.6 MB | 606.4 kB | 196.5 kB | ### plotly.js cartesian @@ -92,13 +92,13 @@ The `cartesian` partial bundle contains the `scatter`, `bar`, `box`, `heatmap`, | dist bundle (minified) | `dist/plotly-cartesian.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-cartesian-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-cartesian-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-cartesian-1.19.2.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-cartesian-1.19.2.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-cartesian-1.20.0.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-cartesian-1.20.0.min.js | | CommonJS | `require('plotly.js/lib/index-cartesian')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.7 MB | 674.9 kB | 216.9 kB | +| 1.8 MB | 677.1 kB | 217.7 kB | ### plotly.js geo @@ -110,13 +110,13 @@ The `geo` partial bundle contains the `scatter`, `scattergeo` and `choropleth` t | dist bundle (minified) | `dist/plotly-geo.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-geo-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-geo-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-geo-1.19.2.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-geo-1.19.2.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-geo-1.20.0.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-geo-1.20.0.min.js | | CommonJS | `require('plotly.js/lib/index-geo')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.6 MB | 633.4 kB | 206.7 kB | +| 1.6 MB | 634.9 kB | 207.1 kB | ### plotly.js gl3d @@ -128,13 +128,13 @@ The `gl3d` partial bundle contains the `scatter`, `scatter3d`, `surface` and `me | dist bundle (minified) | `dist/plotly-gl3d.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-gl3d-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-gl3d-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl3d-1.19.2.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl3d-1.19.2.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl3d-1.20.0.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl3d-1.20.0.min.js | | CommonJS | `require('plotly.js/lib/index-gl3d')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.4 MB | 1 MB | 327.4 kB | +| 2.5 MB | 1 MB | 327.9 kB | ### plotly.js gl2d @@ -146,13 +146,13 @@ The `gl2d` partial bundle contains the `scatter`, `scattergl`, `pointcloud`, `he | dist bundle (minified) | `dist/plotly-gl2d.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-gl2d-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-gl2d-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl2d-1.19.2.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl2d-1.19.2.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl2d-1.20.0.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl2d-1.20.0.min.js | | CommonJS | `require('plotly.js/lib/index-gl2d')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.2 MB | 926.3 kB | 289.8 kB | +| 2.2 MB | 928.8 kB | 290.7 kB | ### plotly.js mapbox @@ -164,13 +164,13 @@ The `mapbox` partial bundle contains the `scatter` and `scattermapbox` trace mod | dist bundle (minified) | `dist/plotly-mapbox.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-mapbox-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-mapbox-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-mapbox-1.19.2.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-mapbox-1.19.2.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-mapbox-1.20.0.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-mapbox-1.20.0.min.js | | CommonJS | `require('plotly.js/lib/index-mapbox')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.6 MB | 1 MB | 310.1 kB | +| 2.6 MB | 1 MB | 310.6 kB | ### plotly.js finance @@ -182,13 +182,13 @@ The `finance` partial bundle contains the `scatter`, `bar`, `histogram`, `pie`, | dist bundle (minified) | `dist/plotly-finance.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-finance-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-finance-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-finance-1.19.2.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-finance-1.19.2.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-finance-1.20.0.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-finance-1.20.0.min.js | | CommonJS | `require('plotly.js/lib/index-finance')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.6 MB | 629.9 kB | 202.7 kB | +| 1.6 MB | 631.6 kB | 203.4 kB | ---------------- diff --git a/dist/npm-ls.json b/dist/npm-ls.json index 040448cc38b..40c0d9b1795 100644 --- a/dist/npm-ls.json +++ b/dist/npm-ls.json @@ -1,6 +1,6 @@ { "name": "plotly.js", - "version": "1.19.2", + "version": "1.20.0", "dependencies": { "3d-view": { "version": "2.0.0", @@ -577,11 +577,6 @@ "version": "0.6.2", "from": "colors@>=0.6.0-1 <0.7.0", "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz" - }, - "commander": { - "version": "2.1.0", - "from": "commander@>=2.1.0 <2.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.1.0.tgz" } } }, @@ -865,9 +860,9 @@ } }, "gl-error2d": { - "version": "1.2.0", - "from": "gl-error2d@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/gl-error2d/-/gl-error2d-1.2.0.tgz", + "version": "1.2.1", + "from": "gl-error2d@>=1.2.1 <2.0.0", + "resolved": "https://registry.npmjs.org/gl-error2d/-/gl-error2d-1.2.1.tgz", "dependencies": { "glslify": { "version": "2.3.1", @@ -945,9 +940,9 @@ } }, "gl-line2d": { - "version": "1.4.0", - "from": "gl-line2d@>=1.4.0 <2.0.0", - "resolved": "https://registry.npmjs.org/gl-line2d/-/gl-line2d-1.4.0.tgz", + "version": "1.4.1", + "from": "gl-line2d@>=1.4.1 <2.0.0", + "resolved": "https://registry.npmjs.org/gl-line2d/-/gl-line2d-1.4.1.tgz", "dependencies": { "glslify": { "version": "2.3.1", @@ -1358,9 +1353,9 @@ } }, "gl-scatter2d": { - "version": "1.2.0", - "from": "gl-scatter2d@>=1.0.5 <2.0.0", - "resolved": "https://registry.npmjs.org/gl-scatter2d/-/gl-scatter2d-1.2.0.tgz", + "version": "1.2.2", + "from": "gl-scatter2d@1.2.2", + "resolved": "https://registry.npmjs.org/gl-scatter2d/-/gl-scatter2d-1.2.2.tgz", "dependencies": { "binary-search-bounds": { "version": "2.0.3", @@ -1397,9 +1392,9 @@ } }, "gl-scatter2d-fancy": { - "version": "1.2.0", - "from": "gl-scatter2d-fancy@>=1.2.0 <2.0.0", - "resolved": "https://registry.npmjs.org/gl-scatter2d-fancy/-/gl-scatter2d-fancy-1.2.0.tgz", + "version": "1.2.1", + "from": "gl-scatter2d-fancy@>=1.2.1 <2.0.0", + "resolved": "https://registry.npmjs.org/gl-scatter2d-fancy/-/gl-scatter2d-fancy-1.2.1.tgz", "dependencies": { "gl-shader": { "version": "4.2.1", @@ -2633,9 +2628,9 @@ } }, "uglify-js": { - "version": "2.7.3", - "from": "uglify-js@>=2.6.0 <3.0.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.7.3.tgz", + "version": "2.7.4", + "from": "uglify-js@2.7.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.7.4.tgz", "dependencies": { "async": { "version": "0.2.10", @@ -2700,6 +2695,11 @@ "version": "0.1.3", "from": "right-align@>=0.1.1 <0.2.0", "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz" + }, + "wordwrap": { + "version": "0.0.2", + "from": "wordwrap@0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz" } } }, @@ -2823,54 +2823,15 @@ "from": "tinycolor2@>=1.3.0 <2.0.0", "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz" }, - "topojson": { - "version": "1.6.27", - "from": "topojson@>=1.6.20 <2.0.0", - "resolved": "https://registry.npmjs.org/topojson/-/topojson-1.6.27.tgz", + "topojson-client": { + "version": "2.1.0", + "from": "topojson-client@latest", + "resolved": "https://registry.npmjs.org/topojson-client/-/topojson-client-2.1.0.tgz", "dependencies": { - "d3-geo-projection": { - "version": "0.2.16", - "from": "d3-geo-projection@>=0.2.0 <0.3.0", - "resolved": "https://registry.npmjs.org/d3-geo-projection/-/d3-geo-projection-0.2.16.tgz" - }, - "d3-queue": { - "version": "2.0.3", - "from": "d3-queue@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/d3-queue/-/d3-queue-2.0.3.tgz" - }, - "optimist": { - "version": "0.3.7", - "from": "optimist@>=0.3.0 <0.4.0", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz", - "dependencies": { - "wordwrap": { - "version": "0.0.2", - "from": "wordwrap@0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz" - } - } - }, - "shapefile": { - "version": "0.3.1", - "from": "shapefile@>=0.3.0 <0.4.0", - "resolved": "https://registry.npmjs.org/shapefile/-/shapefile-0.3.1.tgz", - "dependencies": { - "iconv-lite": { - "version": "0.2.11", - "from": "iconv-lite@>=0.2.0 <0.3.0", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz" - }, - "d3-queue": { - "version": "1.2.3", - "from": "d3-queue@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/d3-queue/-/d3-queue-1.2.3.tgz" - } - } - }, - "rw": { - "version": "1.3.2", - "from": "rw@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.2.tgz" + "commander": { + "version": "2.1.0", + "from": "commander@>=2.1.0 <2.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.1.0.tgz" } } }, diff --git a/dist/plotly-basic.js b/dist/plotly-basic.js index 4514e4cad5a..e3bd15bfa18 100644 --- a/dist/plotly-basic.js +++ b/dist/plotly-basic.js @@ -1,5 +1,5 @@ /** -* plotly.js (basic) v1.19.2 +* plotly.js (basic) v1.20.0 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -68,7 +68,7 @@ for(var selector in rules) { Lib.addStyleRule(fullSelector, rules[selector]); } -},{"../src/lib":113}],2:[function(require,module,exports){ +},{"../src/lib":115}],2:[function(require,module,exports){ 'use strict'; module.exports = { @@ -201,7 +201,7 @@ module.exports = { module.exports = require('../src/traces/bar'); -},{"../src/traces/bar":185}],4:[function(require,module,exports){ +},{"../src/traces/bar":187}],4:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -247,7 +247,7 @@ module.exports = Plotly; module.exports = require('../src/traces/pie'); -},{"../src/traces/pie":198}],7:[function(require,module,exports){ +},{"../src/traces/pie":200}],7:[function(require,module,exports){ !function() { var d3 = { version: "3.5.17" @@ -12766,13 +12766,18 @@ var Axes = require('../../plots/cartesian/axes'); var attributes = require('./attributes'); -module.exports = function handleAnnotationDefaults(annIn, fullLayout) { - var annOut = {}; +module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, opts, itemOpts) { + opts = opts || {}; + itemOpts = itemOpts || {}; function coerce(attr, dflt) { return Lib.coerce(annIn, annOut, attributes, attr, dflt); } + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + + if(!visible) return annOut; + coerce('opacity'); coerce('align'); coerce('bgcolor'); @@ -12785,74 +12790,61 @@ module.exports = function handleAnnotationDefaults(annIn, fullLayout) { var borderWidth = coerce('borderwidth'); var showArrow = coerce('showarrow'); - if(showArrow) { - coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); - coerce('arrowhead'); - coerce('arrowsize'); - coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); - coerce('ax'); - coerce('ay'); - coerce('axref'); - coerce('ayref'); - - // if you have one part of arrow length you should have both - Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); - } - coerce('text', showArrow ? ' ' : 'new text'); coerce('textangle'); Lib.coerceFont(coerce, 'font', fullLayout.font); // positioning - var axLetters = ['x', 'y']; + var axLetters = ['x', 'y'], + arrowPosDflt = [-10, -30], + gdMock = {_fullLayout: fullLayout}; for(var i = 0; i < 2; i++) { - var axLetter = axLetters[i], - tdMock = {_fullLayout: fullLayout}; + var axLetter = axLetters[i]; // xref, yref - var axRef = Axes.coerceRef(annIn, annOut, tdMock, axLetter); - - // TODO: should be refactored in conjunction with Axes axref, ayref - var aaxRef = Axes.coerceARef(annIn, annOut, tdMock, axLetter); + var axRef = Axes.coerceRef(annIn, annOut, gdMock, axLetter, '', 'paper'); // x, y - var defaultPosition = 0.5; - if(axRef !== 'paper') { - var ax = Axes.getFromId(tdMock, axRef); - defaultPosition = ax.range[0] + defaultPosition * (ax.range[1] - ax.range[0]); - - // convert date or category strings to numbers - if(['date', 'category'].indexOf(ax.type) !== -1 && - typeof annIn[axLetter] === 'string') { - var newval; - if(ax.type === 'date') { - newval = Lib.dateTime2ms(annIn[axLetter]); - if(newval !== false) annIn[axLetter] = newval; - - if(aaxRef === axRef) { - var newvalB = Lib.dateTime2ms(annIn['a' + axLetter]); - if(newvalB !== false) annIn['a' + axLetter] = newvalB; - } - } - else if((ax._categories || []).length) { - newval = ax._categories.indexOf(annIn[axLetter]); - if(newval !== -1) annIn[axLetter] = newval; - } + Axes.coercePosition(annOut, gdMock, coerce, axRef, axLetter, 0.5); + + if(showArrow) { + var arrowPosAttr = 'a' + axLetter, + // axref, ayref + aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + + // for now the arrow can only be on the same axis or specified as pixels + // TODO: sometime it might be interesting to allow it to be on *any* axis + // but that would require updates to drawing & autorange code and maybe more + if(aaxRef !== 'pixel' && aaxRef !== axRef) { + aaxRef = annOut[arrowPosAttr] = 'pixel'; } + + // ax, ay + var aDflt = (aaxRef === 'pixel') ? arrowPosDflt[i] : 0.4; + Axes.coercePosition(annOut, gdMock, coerce, aaxRef, arrowPosAttr, aDflt); } - coerce(axLetter, defaultPosition); // xanchor, yanchor - if(!showArrow) coerce(axLetter + 'anchor'); + else coerce(axLetter + 'anchor'); } // if you have one coordinate you should have both Lib.noneOrAll(annIn, annOut, ['x', 'y']); + if(showArrow) { + coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); + coerce('arrowhead'); + coerce('arrowsize'); + coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); + + // if you have one part of arrow length you should have both + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); + } + return annOut; }; -},{"../../lib":113,"../../plots/cartesian/axes":139,"../color":23,"./attributes":16}],15:[function(require,module,exports){ +},{"../../lib":115,"../../plots/cartesian/axes":142,"../color":23,"./attributes":16}],15:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -12932,7 +12924,14 @@ var extendFlat = require('../../lib/extend').extendFlat; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'annotation', + + visible: { + valType: 'boolean', + + dflt: true, + + }, text: { valType: 'string', @@ -13023,14 +13022,12 @@ module.exports = { }, ax: { - valType: 'number', - dflt: -10, + valType: 'any', }, ay: { - valType: 'number', - dflt: -30, + valType: 'any', }, @@ -13065,7 +13062,7 @@ module.exports = { }, x: { - valType: 'number', + valType: 'any', }, @@ -13086,7 +13083,7 @@ module.exports = { }, y: { - valType: 'number', + valType: 'any', }, @@ -13107,7 +13104,7 @@ module.exports = { } }; -},{"../../lib/extend":111,"../../plots/cartesian/constants":145,"../../plots/font_attributes":160,"./arrow_paths":15}],17:[function(require,module,exports){ +},{"../../lib/extend":112,"../../plots/cartesian/constants":147,"../../plots/font_attributes":162,"./arrow_paths":15}],17:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -13127,7 +13124,7 @@ var draw = require('./draw').draw; module.exports = function calcAutorange(gd) { var fullLayout = gd._fullLayout, - annotationList = fullLayout.annotations; + annotationList = Lib.filterVisible(fullLayout.annotations); if(!annotationList.length || !gd._fullData.length) return; @@ -13179,14 +13176,14 @@ function annAutorange(gd) { } if(xa && xa.autorange) { - Axes.expand(xa, [xa.l2c(ann.x)], { + Axes.expand(xa, [xa.l2c(xa.r2l(ann.x))], { ppadplus: rightSize, ppadminus: leftSize }); } if(ya && ya.autorange) { - Axes.expand(ya, [ya.l2c(ann.y)], { + Axes.expand(ya, [ya.l2c(ya.r2l(ann.y))], { ppadplus: bottomSize, ppadminus: topSize }); @@ -13194,7 +13191,7 @@ function annAutorange(gd) { }); } -},{"../../lib":113,"../../plots/cartesian/axes":139,"./draw":19}],18:[function(require,module,exports){ +},{"../../lib":115,"../../plots/cartesian/axes":142,"./draw":19}],18:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -13206,22 +13203,20 @@ function annAutorange(gd) { 'use strict'; +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var handleAnnotationDefaults = require('./annotation_defaults'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - var containerIn = layoutIn.annotations || [], - containerOut = layoutOut.annotations = []; - - for(var i = 0; i < containerIn.length; i++) { - var annIn = containerIn[i] || {}, - annOut = handleAnnotationDefaults(annIn, layoutOut); + var opts = { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults + }; - containerOut.push(annOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"./annotation_defaults":14}],19:[function(require,module,exports){ +},{"../../plots/array_container_defaults":139,"./annotation_defaults":14}],19:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -13271,7 +13266,9 @@ function draw(gd) { fullLayout._infolayer.selectAll('.annotation').remove(); for(var i = 0; i < fullLayout.annotations.length; i++) { - drawOne(gd, i); + if(fullLayout.annotations[i].visible) { + drawOne(gd, i); + } } return Plots.previousPromises(gd); @@ -13364,8 +13361,6 @@ function drawOne(gd, index, opt, value) { // where we fail here when they add/remove annotations if(!optionsIn) return; - var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; - // alter the input annotation as requested var optionsEdit = {}; if(typeof opt === 'string' && opt) optionsEdit[opt] = value; @@ -13377,7 +13372,11 @@ function drawOne(gd, index, opt, value) { Lib.nestedProperty(optionsIn, k).set(optionsEdit[k]); } + // return early in visible: false updates + if(optionsIn.visible === false) return; + var gs = fullLayout._size; + var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; var axLetters = ['x', 'y']; for(i = 0; i < 2; i++) { @@ -13392,12 +13391,19 @@ function drawOne(gd, index, opt, value) { continue; } - var axOld = Axes.getFromId(gd, Axes.coerceRef(oldRef, {}, gd, axLetter)), - axNew = Axes.getFromId(gd, Axes.coerceRef(optionsIn, {}, gd, axLetter)), + var axOld = Axes.getFromId(gd, Axes.coerceRef(oldRef, {}, gd, axLetter, '', 'paper')), + axNew = Axes.getFromId(gd, Axes.coerceRef(optionsIn, {}, gd, axLetter, '', 'paper')), position = optionsIn[axLetter], axTypeOld = oldPrivate['_' + axLetter + 'type']; if(optionsEdit[axLetter + 'ref'] !== undefined) { + + // TODO: include ax / ay / axref / ayref here if not 'pixel' + // or even better, move all of this machinery out of here and into + // streambed as extra attributes to a regular relayout call + // we should do this after v2.0 when it can work equivalently for + // annotations, shapes, and images. + var autoAnchor = optionsIn[axLetter + 'anchor'] === 'auto', plotSize = (axLetter === 'x' ? gs.w : gs.h), halfSizeFrac = (oldPrivate['_' + axLetter + 'size'] || 0) / @@ -13406,18 +13412,11 @@ function drawOne(gd, index, opt, value) { // go to the same fraction of the axis length // whether or not these axes share a domain - // first convert to fraction of the axis - position = (position - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); - - // then convert to new data coordinates at the same fraction - position = axNew.range[0] + - position * (axNew.range[1] - axNew.range[0]); + position = axNew.fraction2r(axOld.r2fraction(position)); } else if(axOld) { // data -> paper // first convert to fraction of the axis - position = (position - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + position = axOld.r2fraction(position); // next scale the axis to the whole plot position = axOld.domain[0] + @@ -13445,8 +13444,7 @@ function drawOne(gd, index, opt, value) { (axNew.domain[1] - axNew.domain[0]); // finally convert to data coordinates - position = axNew.range[0] + - position * (axNew.range[1] - axNew.range[0]); + position = axNew.fraction2r(position); } } @@ -13463,7 +13461,8 @@ function drawOne(gd, index, opt, value) { optionsIn[axLetter] = position; } - var options = handleAnnotationDefaults(optionsIn, fullLayout); + var options = {}; + handleAnnotationDefaults(optionsIn, options, fullLayout); fullLayout.annotations[index] = options; var xa = Axes.getFromId(gd, options.xref), @@ -13577,20 +13576,21 @@ function drawOne(gd, index, opt, value) { // outside the visible plot (as long as the axis // isn't autoranged - then we need to draw it // anyway to get its bounding box) - if(!ax.autorange && ((options[axLetter] - ax.range[0]) * - (options[axLetter] - ax.range[1]) > 0)) { + var posFraction = ax.r2fraction(options[axLetter]); + if(!ax.autorange && (posFraction < 0 || posFraction > 1)) { if(options['a' + axLetter + 'ref'] === axRef) { - if((options['a' + axLetter] - ax.range[0]) * - (options['a' + axLetter] - ax.range[1]) > 0) { + posFraction = ax.r2fraction(options['a' + axLetter]); + if(posFraction < 0 || posFraction > 1) { annotationIsOffscreen = true; } - } else { + } + else { annotationIsOffscreen = true; } if(annotationIsOffscreen) return; } - annPosPx[axLetter] = ax._offset + ax.l2p(options[axLetter]); + annPosPx[axLetter] = ax._offset + ax.r2p(options[axLetter]); alignPosition = 0.5; } else { @@ -13603,7 +13603,7 @@ function drawOne(gd, index, opt, value) { var alignShift = 0; if(options['a' + axLetter + 'ref'] === axRef) { - annPosPx['aa' + axLetter] = ax._offset + ax.l2p(options['a' + axLetter]); + annPosPx['aa' + axLetter] = ax._offset + ax.r2p(options['a' + axLetter]); } else { if(options.showarrow) { alignShift = options['a' + axLetter]; @@ -13803,22 +13803,22 @@ function drawOne(gd, index, opt, value) { ann.call(Lib.setTranslate, xcenter, ycenter); update[annbase + '.x'] = xa ? - (options.x + dx / xa._m) : + xa.p2r(xa.r2p(options.x) + dx) : ((arrowX + dx - gs.l) / gs.w); update[annbase + '.y'] = ya ? - (options.y + dy / ya._m) : + ya.p2r(ya.r2p(options.y) + dy) : (1 - ((arrowY + dy - gs.t) / gs.h)); if(options.axref === options.xref) { update[annbase + '.ax'] = xa ? - (options.ax + dx / xa._m) : - ((arrowX + dx - gs.l) / gs.w); + xa.p2r(xa.r2p(options.ax) + dx) : + ((arrowX + dx - gs.l) / gs.w); } if(options.ayref === options.yref) { update[annbase + '.ay'] = ya ? - (options.ay + dy / ya._m) : - (1 - ((arrowY + dy - gs.t) / gs.h)); + ya.p2r(ya.r2p(options.ay) + dy) : + (1 - ((arrowY + dy - gs.t) / gs.h)); } anng.attr({ @@ -13864,13 +13864,13 @@ function drawOne(gd, index, opt, value) { var csr = 'pointer'; if(options.showarrow) { if(options.axref === options.xref) { - update[annbase + '.ax'] = xa.p2l(xa.l2p(options.ax) + dx); + update[annbase + '.ax'] = xa.p2r(xa.r2p(options.ax) + dx); } else { update[annbase + '.ax'] = options.ax + dx; } if(options.ayref === options.yref) { - update[annbase + '.ay'] = ya.p2l(ya.l2p(options.ay) + dy); + update[annbase + '.ay'] = ya.p2r(ya.r2p(options.ay) + dy); } else { update[annbase + '.ay'] = options.ay + dy; } @@ -13976,7 +13976,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":113,"../../lib/setcursor":123,"../../lib/svg_text_utils":125,"../../plotly":135,"../../plots/cartesian/axes":139,"../../plots/plots":164,"../color":23,"../dragelement":45,"../drawing":47,"./annotation_defaults":14,"./defaults":18,"./draw_arrow_head":20,"d3":7,"fast-isnumeric":10}],20:[function(require,module,exports){ +},{"../../lib":115,"../../lib/setcursor":125,"../../lib/svg_text_utils":127,"../../plotly":137,"../../plots/cartesian/axes":142,"../../plots/plots":166,"../color":23,"../dragelement":44,"../drawing":46,"./annotation_defaults":14,"./defaults":18,"./draw_arrow_head":20,"d3":7,"fast-isnumeric":10}],20:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14095,7 +14095,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { if(doEnd) drawhead(end, endRot); }; -},{"../color":23,"../drawing":47,"./arrow_paths":15,"d3":7,"fast-isnumeric":10}],21:[function(require,module,exports){ +},{"../color":23,"../drawing":46,"./arrow_paths":15,"d3":7,"fast-isnumeric":10}],21:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14107,33 +14107,21 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { 'use strict'; -var Plotly = require('../../plotly'); - -exports.moduleType = 'component'; - -exports.name = 'annotations'; - -exports.ARROWPATHS = require('./arrow_paths'); - -exports.layoutAttributes = require('./attributes'); - -exports.supplyLayoutDefaults = require('./defaults'); - -exports.calcAutorange = require('./calc_autorange'); - -exports.arrowhead = require('./draw_arrow_head'); - var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; -exports.add = function(gd) { - var nextAnn = gd._fullLayout.annotations.length; +module.exports = { + moduleType: 'component', + name: 'annotations', + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), - Plotly.relayout(gd, 'annotations[' + nextAnn + ']', 'add'); + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne }; -},{"../../plotly":135,"./arrow_paths":15,"./attributes":16,"./calc_autorange":17,"./defaults":18,"./draw":19,"./draw_arrow_head":20}],22:[function(require,module,exports){ +},{"./attributes":16,"./calc_autorange":17,"./defaults":18,"./draw":19}],22:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14486,7 +14474,7 @@ module.exports = { } }; -},{"../../lib/extend":111,"../../plots/cartesian/layout_attributes":149,"../../plots/font_attributes":160}],25:[function(require,module,exports){ +},{"../../lib/extend":112,"../../plots/cartesian/layout_attributes":151,"../../plots/font_attributes":162}],25:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14553,7 +14541,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":113,"../../plots/cartesian/tick_label_defaults":155,"../../plots/cartesian/tick_mark_defaults":156,"../../plots/cartesian/tick_value_defaults":157,"./attributes":24}],26:[function(require,module,exports){ +},{"../../lib":115,"../../plots/cartesian/tick_label_defaults":157,"../../plots/cartesian/tick_mark_defaults":158,"../../plots/cartesian/tick_value_defaults":159,"./attributes":24}],26:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15185,7 +15173,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":113,"../../lib/extend":111,"../../lib/setcursor":123,"../../plotly":135,"../../plots/cartesian/axes":139,"../../plots/cartesian/axis_defaults":141,"../../plots/cartesian/layout_attributes":149,"../../plots/cartesian/position_defaults":152,"../../plots/plots":164,"../../registry":171,"../color":23,"../dragelement":45,"../drawing":47,"../titles":98,"./attributes":24,"d3":7,"tinycolor2":13}],27:[function(require,module,exports){ +},{"../../lib":115,"../../lib/extend":112,"../../lib/setcursor":125,"../../plotly":137,"../../plots/cartesian/axes":142,"../../plots/cartesian/axis_defaults":144,"../../plots/cartesian/layout_attributes":151,"../../plots/cartesian/position_defaults":154,"../../plots/plots":166,"../../registry":173,"../color":23,"../dragelement":44,"../drawing":46,"../titles":97,"./attributes":24,"d3":7,"tinycolor2":13}],27:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15204,28 +15192,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":113}],28:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -exports.attributes = require('./attributes'); - -exports.supplyDefaults = require('./defaults'); - -exports.draw = require('./draw'); - -exports.hasColorbar = require('./has_colorbar'); - -},{"./attributes":24,"./defaults":25,"./draw":26,"./has_colorbar":27}],29:[function(require,module,exports){ +},{"../../lib":115}],28:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15280,7 +15247,7 @@ module.exports = { } }; -},{}],30:[function(require,module,exports){ +},{}],29:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15346,7 +15313,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":113,"./flip_scale":35,"./scales":42}],31:[function(require,module,exports){ +},{"../../lib":115,"./flip_scale":34,"./scales":41}],30:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15390,7 +15357,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":111,"./attributes":29,"./scales.js":42}],32:[function(require,module,exports){ +},{"../../lib/extend":112,"./attributes":28,"./scales.js":41}],31:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15406,7 +15373,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":42}],33:[function(require,module,exports){ +},{"./scales":41}],32:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15470,7 +15437,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":113,"../colorbar/defaults":25,"../colorbar/has_colorbar":27,"./flip_scale":35,"./is_valid_scale":39,"fast-isnumeric":10}],34:[function(require,module,exports){ +},{"../../lib":115,"../colorbar/defaults":25,"../colorbar/has_colorbar":27,"./flip_scale":34,"./is_valid_scale":38,"fast-isnumeric":10}],33:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15507,7 +15474,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],35:[function(require,module,exports){ +},{}],34:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15532,7 +15499,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],36:[function(require,module,exports){ +},{}],35:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15572,7 +15539,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":32,"./is_valid_scale_array":40,"./scales":42}],37:[function(require,module,exports){ +},{"./default_scale":31,"./is_valid_scale_array":39,"./scales":41}],36:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15618,7 +15585,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":113,"./is_valid_scale":39,"fast-isnumeric":10}],38:[function(require,module,exports){ +},{"../../lib":115,"./is_valid_scale":38,"fast-isnumeric":10}],37:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15652,7 +15619,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":29,"./calc":30,"./default_scale":32,"./defaults":33,"./extract_scale":34,"./flip_scale":35,"./get_scale":36,"./has_colorscale":37,"./is_valid_scale":39,"./make_color_scale_func":41,"./scales":42}],39:[function(require,module,exports){ +},{"./attributes":28,"./calc":29,"./default_scale":31,"./defaults":32,"./extract_scale":33,"./flip_scale":34,"./get_scale":35,"./has_colorscale":36,"./is_valid_scale":38,"./make_color_scale_func":40,"./scales":41}],38:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15673,7 +15640,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":40,"./scales":42}],40:[function(require,module,exports){ +},{"./is_valid_scale_array":39,"./scales":41}],39:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15710,7 +15677,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":13}],41:[function(require,module,exports){ +},{"tinycolor2":13}],40:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15806,7 +15773,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":23,"d3":7,"fast-isnumeric":10,"tinycolor2":13}],42:[function(require,module,exports){ +},{"../color":23,"d3":7,"fast-isnumeric":10,"tinycolor2":13}],41:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15937,7 +15904,7 @@ module.exports = { ] }; -},{}],43:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15970,7 +15937,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],44:[function(require,module,exports){ +},{}],43:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16008,7 +15975,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":113}],45:[function(require,module,exports){ +},{"../../lib":115}],44:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16195,7 +16162,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../lib":113,"../../plotly":135,"../../plots/cartesian/constants":145,"./align":43,"./cursor":44,"./unhover":46}],46:[function(require,module,exports){ +},{"../../lib":115,"../../plotly":137,"../../plots/cartesian/constants":147,"./align":42,"./cursor":43,"./unhover":45}],45:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16246,7 +16213,7 @@ unhover.raw = function unhoverRaw(gd, evt) { gd._hoverdata = undefined; }; -},{"../../lib/events":110}],47:[function(require,module,exports){ +},{"../../lib/events":111}],46:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16324,14 +16291,14 @@ drawing.getPx = function(s, styleAttr) { return Number(s.style(styleAttr).replace(/px$/, '')); }; -drawing.crispRound = function(td, lineWidth, dflt) { +drawing.crispRound = function(gd, lineWidth, dflt) { // for lines that disable antialiasing we want to // make sure the width is an integer, and at least 1 if it's nonzero if(!lineWidth || !isNumeric(lineWidth)) return dflt || 0; // but not for static plots - these don't get antialiased anyway. - if(td._context.staticPlot) return lineWidth; + if(gd._context.staticPlot) return lineWidth; if(lineWidth < 1) return 1; return Math.round(lineWidth); @@ -16525,9 +16492,8 @@ drawing.singlePointStyle = function(d, sel, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); singlePointStyle(d, sel, trace, markerScale, lineScale, marker, markerLine); @@ -16539,50 +16505,22 @@ drawing.pointStyle = function(s, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales var marker = trace.marker; - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale); }); }; -// for a given color attribute (ie m -> mc = marker.color) look to see if we -// have a colorscale for it (ie mscl, mcmin, mcmax) - if we do, translate -// all numeric color values according to that scale -drawing.tryColorscale = function(cont, contIn, prefix) { - var colorArray = Lib.nestedProperty(cont, prefix + 'color').get(), - scl = Lib.nestedProperty(cont, prefix + 'colorscale').get(), - auto = Lib.nestedProperty(cont, prefix + 'cauto').get(), - minProp = Lib.nestedProperty(cont, prefix + 'cmin'), - maxProp = Lib.nestedProperty(cont, prefix + 'cmax'), - min = minProp.get(), - max = maxProp.get(); +drawing.tryColorscale = function(marker, prefix) { + var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker, + scl = cont.colorscale, + colorArray = cont.color; - // TODO handle this in Colorscale.calc if(scl && Array.isArray(colorArray)) { - if(auto || !isNumeric(min) || !isNumeric(max)) { - min = Infinity; - max = -Infinity; - colorArray.forEach(function(color) { - if(isNumeric(color)) { - if(min > color) min = +color; - if(max < color) max = +color; - } - }); - if(min > max) { - min = 0; - max = 1; - } - minProp.set(min); - maxProp.set(max); - Lib.nestedProperty(contIn, prefix + 'cmin').set(min); - Lib.nestedProperty(contIn, prefix + 'cmax').set(max); - } - return Colorscale.makeColorScaleFunc( - Colorscale.extractScale(scl, min, max) + Colorscale.extractScale(scl, cont.cmin, cont.cmax) ); } else return Lib.identity; @@ -16850,7 +16788,7 @@ drawing.setClipUrl = function(s, localId) { s.attr('clip-path', 'url(' + url + ')'); }; -},{"../../constants/xmlns_namespaces":105,"../../lib":113,"../../lib/svg_text_utils":125,"../../registry":171,"../../traces/scatter/make_bubble_size_func":220,"../../traces/scatter/subtypes":225,"../color":23,"../colorscale":38,"./symbol_defs":48,"d3":7,"fast-isnumeric":10}],48:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":105,"../../lib":115,"../../lib/svg_text_utils":127,"../../registry":173,"../../traces/scatter/make_bubble_size_func":222,"../../traces/scatter/subtypes":227,"../color":23,"../colorscale":37,"./symbol_defs":47,"d3":7,"fast-isnumeric":10}],47:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17326,7 +17264,7 @@ module.exports = { } }; -},{"d3":7}],49:[function(require,module,exports){ +},{"d3":7}],48:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17425,7 +17363,7 @@ module.exports = { } }; -},{}],50:[function(require,module,exports){ +},{}],49:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17488,7 +17426,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":139,"../../registry":171,"./compute_error":51,"fast-isnumeric":10}],51:[function(require,module,exports){ +},{"../../plots/cartesian/axes":142,"../../registry":173,"./compute_error":50,"fast-isnumeric":10}],50:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17584,7 +17522,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],52:[function(require,module,exports){ +},{}],51:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17661,7 +17599,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":113,"../../registry":171,"./attributes":49,"fast-isnumeric":10}],53:[function(require,module,exports){ +},{"../../lib":115,"../../registry":173,"./attributes":48,"fast-isnumeric":10}],52:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17720,7 +17658,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":49,"./calc":50,"./defaults":52,"./plot":54,"./style":55}],54:[function(require,module,exports){ +},{"./attributes":48,"./calc":49,"./defaults":51,"./plot":53,"./style":54}],53:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17884,7 +17822,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":225,"d3":7,"fast-isnumeric":10}],55:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":227,"d3":7,"fast-isnumeric":10}],54:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17921,7 +17859,7 @@ module.exports = function style(traces) { }); }; -},{"../color":23,"d3":7}],56:[function(require,module,exports){ +},{"../color":23,"d3":7}],55:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17936,7 +17874,14 @@ var cartesianConstants = require('../../plots/cartesian/constants'); module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'image', + + visible: { + valType: 'boolean', + + dflt: true, + + }, source: { valType: 'string', @@ -17984,14 +17929,14 @@ module.exports = { }, x: { - valType: 'number', + valType: 'any', dflt: 0, }, y: { - valType: 'number', + valType: 'any', dflt: 0, @@ -18036,7 +17981,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":145}],57:[function(require,module,exports){ +},{"../../plots/cartesian/constants":147}],56:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18047,40 +17992,34 @@ module.exports = { 'use strict'; -var Axes = require('../../plots/cartesian/axes'); var Lib = require('../../lib'); -var attributes = require('./attributes'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var attributes = require('./attributes'); +var name = 'images'; module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { + var opts = { + name: name, + handleItemDefaults: imageDefaults + }; - if(!layoutIn.images || !Array.isArray(layoutIn.images)) return; - - - var containerIn = layoutIn.images, - containerOut = layoutOut.images = []; - - - for(var i = 0; i < containerIn.length; i++) { - var image = containerIn[i]; - - if(!image.source) continue; - - var defaulted = imageDefaults(containerIn[i] || {}, containerOut[i] || {}, layoutOut); - containerOut.push(defaulted); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function imageDefaults(imageIn, imageOut, fullLayout) { - imageOut = imageOut || {}; - function coerce(attr, dflt) { return Lib.coerce(imageIn, imageOut, attributes, attr, dflt); } - coerce('source'); + var source = coerce('source'); + var visible = coerce('visible', !!source); + + if(!visible) return imageOut; + coerce('layer'); coerce('x'); coerce('y'); @@ -18091,18 +18030,18 @@ function imageDefaults(imageIn, imageOut, fullLayout) { coerce('sizing'); coerce('opacity'); - for(var i = 0; i < 2; i++) { - var tdMock = { _fullLayout: fullLayout }, - axLetter = ['x', 'y'][i]; + var gdMock = { _fullLayout: fullLayout }, + axLetters = ['x', 'y']; + for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref - Axes.coerceRef(imageIn, imageOut, tdMock, axLetter, 'paper'); + Axes.coerceRef(imageIn, imageOut, gdMock, axLetters[i], 'paper'); } return imageOut; } -},{"../../lib":113,"../../plots/cartesian/axes":139,"./attributes":56}],58:[function(require,module,exports){ +},{"../../lib":115,"../../plots/array_container_defaults":139,"../../plots/cartesian/axes":142,"./attributes":55}],57:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18119,25 +18058,23 @@ var Axes = require('../../plots/cartesian/axes'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, imageDataAbove = [], imageDataSubplot = [], imageDataBelow = []; - if(!fullLayout.images) return; - - // Sort into top, subplot, and bottom layers for(var i = 0; i < fullLayout.images.length; i++) { var img = fullLayout.images[i]; - if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - imageDataSubplot.push(img); - } else if(img.layer === 'above') { - imageDataAbove.push(img); - } else { - imageDataBelow.push(img); + if(img.visible) { + if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { + imageDataSubplot.push(img); + } else if(img.layer === 'above') { + imageDataAbove.push(img); + } else { + imageDataBelow.push(img); + } } } @@ -18206,12 +18143,12 @@ module.exports = function draw(gd) { var thisImage = d3.select(this); // Axes if specified - var xref = Axes.getFromId(gd, d.xref), - yref = Axes.getFromId(gd, d.yref); + var xa = Axes.getFromId(gd, d.xref), + ya = Axes.getFromId(gd, d.yref); var size = fullLayout._size, - width = xref ? Math.abs(xref.l2p(d.sizex) - xref.l2p(0)) : d.sizex * size.w, - height = yref ? Math.abs(yref.l2p(d.sizey) - yref.l2p(0)) : d.sizey * size.h; + width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w, + height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset, @@ -18220,8 +18157,8 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xref ? xref.l2p(d.x) + xref._offset : d.x * size.w + size.l) + xOffset, - yPos = (yref ? yref.l2p(d.y) + yref._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset, + yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; // Construct the proper aspectRatio attribute @@ -18246,8 +18183,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xref ? xref._id : '', - yId = yref ? yref._id : '', + var xId = xa ? xa._id : '', + yId = ya ? ya._id : '', clipAxes = xId + yId; if(clipAxes) { @@ -18284,7 +18221,7 @@ module.exports = function draw(gd) { }); }; -},{"../../constants/xmlns_namespaces":105,"../../plots/cartesian/axes":139,"../drawing":47,"d3":7}],59:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":105,"../../plots/cartesian/axes":142,"../drawing":46,"d3":7}],58:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18295,21 +18232,17 @@ module.exports = function draw(gd) { 'use strict'; - -var draw = require('./draw'); -var supplyLayoutDefaults = require('./defaults'); -var attributes = require('./attributes'); - - module.exports = { moduleType: 'component', name: 'images', - draw: draw, - layoutAttributes: attributes, - supplyLayoutDefaults: supplyLayoutDefaults + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), + + draw: require('./draw') }; -},{"./attributes":56,"./defaults":57,"./draw":58}],60:[function(require,module,exports){ +},{"./attributes":55,"./defaults":56,"./draw":57}],59:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18358,7 +18291,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],61:[function(require,module,exports){ +},{}],60:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18449,7 +18382,7 @@ module.exports = { } }; -},{"../../lib/extend":111,"../../plots/font_attributes":160,"../color/attributes":22}],62:[function(require,module,exports){ +},{"../../lib/extend":112,"../../plots/font_attributes":162,"../color/attributes":22}],61:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18467,7 +18400,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],63:[function(require,module,exports){ +},{}],62:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18560,7 +18493,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":113,"../../plots/layout_attributes":162,"../../registry":171,"./attributes":61,"./helpers":66}],64:[function(require,module,exports){ +},{"../../lib":115,"../../plots/layout_attributes":164,"../../registry":173,"./attributes":60,"./helpers":65}],63:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19276,7 +19209,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../lib":113,"../../lib/svg_text_utils":125,"../../plotly":135,"../../plots/plots":164,"../../registry":171,"../color":23,"../dragelement":45,"../drawing":47,"./anchor_utils":60,"./constants":62,"./get_legend_data":65,"./helpers":66,"./style":68,"d3":7}],65:[function(require,module,exports){ +},{"../../lib":115,"../../lib/svg_text_utils":127,"../../plotly":137,"../../plots/plots":166,"../../registry":173,"../color":23,"../dragelement":44,"../drawing":46,"./anchor_utils":59,"./constants":61,"./get_legend_data":64,"./helpers":65,"./style":67,"d3":7}],64:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19381,7 +19314,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":171,"./helpers":66}],66:[function(require,module,exports){ +},{"../../registry":173,"./helpers":65}],65:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19412,7 +19345,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":171}],67:[function(require,module,exports){ +},{"../../registry":173}],66:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19425,22 +19358,18 @@ exports.isReversed = function isReversed(legendLayout) { 'use strict'; -var legend = module.exports = {}; - - -legend.moduleType = 'component'; - -legend.name = 'legend'; - -legend.layoutAttributes = require('./attributes'); - -legend.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'legend', -legend.draw = require('./draw'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -legend.style = require('./style'); + draw: require('./draw'), + style: require('./style') +}; -},{"./attributes":61,"./defaults":63,"./draw":64,"./style":68}],68:[function(require,module,exports){ +},{"./attributes":60,"./defaults":62,"./draw":63,"./style":67}],67:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19662,7 +19591,7 @@ function stylePies(d) { if(pts.size()) pts.call(stylePie, d[0], trace); } -},{"../../lib":113,"../../registry":171,"../../traces/pie/style_one":203,"../../traces/scatter/subtypes":225,"../color":23,"../drawing":47,"d3":7}],69:[function(require,module,exports){ +},{"../../lib":115,"../../registry":173,"../../traces/pie/style_one":205,"../../traces/scatter/subtypes":227,"../color":23,"../drawing":46,"d3":7}],68:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20172,7 +20101,7 @@ modeBarButtons.resetViews = { } }; -},{"../../../build/ploticon":2,"../../lib":113,"../../plotly":135,"../../plots/cartesian/axes":139,"../../plots/plots":164,"../../snapshot/download":173}],70:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":115,"../../plotly":137,"../../plots/cartesian/axes":142,"../../plots/plots":166,"../../snapshot/download":175}],69:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20186,7 +20115,7 @@ modeBarButtons.resetViews = { exports.manage = require('./manage'); -},{"./manage":71}],71:[function(require,module,exports){ +},{"./manage":70}],70:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20414,7 +20343,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":139,"../../traces/scatter/subtypes":225,"./buttons":69,"./modebar":72}],72:[function(require,module,exports){ +},{"../../plots/cartesian/axes":142,"../../traces/scatter/subtypes":227,"./buttons":68,"./modebar":71}],71:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20704,7 +20633,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":113,"d3":7}],73:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":115,"d3":7}],72:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20721,7 +20650,8 @@ var extendFlat = require('../../lib/extend').extendFlat; var buttonAttrs = require('./button_attributes'); buttonAttrs = extendFlat(buttonAttrs, { - _isLinkedToArray: true, + _isLinkedToArray: 'button', + }); @@ -20793,7 +20723,7 @@ module.exports = { } }; -},{"../../lib/extend":111,"../../plots/font_attributes":160,"../color/attributes":22,"./button_attributes":74}],74:[function(require,module,exports){ +},{"../../lib/extend":112,"../../plots/font_attributes":162,"../color/attributes":22,"./button_attributes":73}],73:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20834,7 +20764,7 @@ module.exports = { } }; -},{}],75:[function(require,module,exports){ +},{}],74:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20863,7 +20793,7 @@ module.exports = { darkAmount: 10 }; -},{}],76:[function(require,module,exports){ +},{}],75:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20956,7 +20886,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":113,"../color":23,"./attributes":73,"./button_attributes":74,"./constants":75}],77:[function(require,module,exports){ +},{"../../lib":115,"../color":23,"./attributes":72,"./button_attributes":73,"./constants":74}],76:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21231,7 +21161,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":125,"../../plotly":135,"../../plots/cartesian/axis_ids":142,"../../plots/plots":164,"../color":23,"../drawing":47,"../legend/anchor_utils":60,"./constants":75,"./get_update_object":78,"d3":7}],78:[function(require,module,exports){ +},{"../../lib/svg_text_utils":127,"../../plotly":137,"../../plots/cartesian/axis_ids":145,"../../plots/plots":166,"../color":23,"../drawing":46,"../legend/anchor_utils":59,"./constants":74,"./get_update_object":77,"d3":7}],77:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21245,6 +21175,8 @@ function reposition(gd, buttons, opts, axName) { var d3 = require('d3'); +var Lib = require('../../lib'); + module.exports = function getUpdateObject(axisLayout, buttonLayout) { var axName = axisLayout._name; @@ -21265,7 +21197,7 @@ module.exports = function getUpdateObject(axisLayout, buttonLayout) { function getXRange(axisLayout, buttonLayout) { var currentRange = axisLayout.range; - var base = new Date(currentRange[1]); + var base = new Date(Lib.dateTime2ms(currentRange[1])); var step = buttonLayout.step, count = buttonLayout.count; @@ -21274,13 +21206,13 @@ function getXRange(axisLayout, buttonLayout) { switch(buttonLayout.stepmode) { case 'backward': - range0 = d3.time[step].offset(base, -count).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].offset(base, -count)); break; case 'todate': - var base2 = d3.time[step].offset(base, -(count - 1)); + var base2 = d3.time[step].offset(base, -count); - range0 = d3.time[step].floor(base2).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].ceil(base2)); break; } @@ -21289,7 +21221,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":7}],79:[function(require,module,exports){ +},{"../../lib":115,"d3":7}],78:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21300,18 +21232,18 @@ function getXRange(axisLayout, buttonLayout) { 'use strict'; +module.exports = { + moduleType: 'component', + name: 'rangeselector', -exports.moduleType = 'component'; - -exports.name = 'rangeselector'; - -exports.layoutAttributes = require('./attributes'); - -exports.handleDefaults = require('./defaults'); + layoutNodes: ['xaxis.'], + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":73,"./defaults":76,"./draw":77}],80:[function(require,module,exports){ +},{"./attributes":72,"./defaults":75,"./draw":76}],79:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21348,8 +21280,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -21369,7 +21301,7 @@ module.exports = { } }; -},{"../color/attributes":22}],81:[function(require,module,exports){ +},{"../color/attributes":22}],80:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21422,7 +21354,7 @@ module.exports = { handleStroke: '#666', }; -},{}],82:[function(require,module,exports){ +},{}],81:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21446,7 +21378,8 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe } var containerIn = layoutIn[axName].rangeslider, - containerOut = layoutOut[axName].rangeslider = {}; + axOut = layoutOut[axName], + containerOut = axOut.rangeslider = {}; function coerce(attr, dflt) { return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); @@ -21460,14 +21393,16 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe coerce('range'); // Expand slider range to the axis range - if(containerOut.range && !layoutOut[axName].autorange) { + if(containerOut.range && !axOut.autorange) { var outRange = containerOut.range, - axRange = layoutOut[axName].range; + axRange = axOut.range, + l2r = axOut.l2r, + r2l = axOut.r2l; - outRange[0] = Math.min(outRange[0], axRange[0]); - outRange[1] = Math.max(outRange[1], axRange[1]); + outRange[0] = l2r(Math.min(r2l(outRange[0]), r2l(axRange[0]))); + outRange[1] = l2r(Math.max(r2l(outRange[1]), r2l(axRange[1]))); } else { - layoutOut[axName]._needsExpand = true; + axOut._needsExpand = true; } if(containerOut.visible) { @@ -21482,7 +21417,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe containerOut._input = containerIn; }; -},{"../../lib":113,"./attributes":80}],83:[function(require,module,exports){ +},{"../../lib":115,"./attributes":79}],82:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21589,20 +21524,10 @@ module.exports = function(gd) { rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); - // update inner nodes - - rangeSlider - .call(drawBg, gd, axisOpts, opts) - .call(addClipPath, gd, axisOpts, opts) - .call(drawRangePlot, gd, axisOpts, opts) - .call(drawMasks, gd, axisOpts, opts) - .call(drawSlideBox, gd, axisOpts, opts) - .call(drawGrabbers, gd, axisOpts, opts); - // update data <--> pixel coordinate conversion methods - var range0 = opts.range[0], - range1 = opts.range[1], + var range0 = axisOpts.r2l(opts.range[0]), + range1 = axisOpts.r2l(opts.range[1]), dist = range1 - range0; opts.p2d = function(v) { @@ -21613,6 +21538,18 @@ module.exports = function(gd) { return (v - range0) / dist * opts._width; }; + opts._rl = [range0, range1]; + + // update inner nodes + + rangeSlider + .call(drawBg, gd, axisOpts, opts) + .call(addClipPath, gd, axisOpts, opts) + .call(drawRangePlot, gd, axisOpts, opts) + .call(drawMasks, gd, axisOpts, opts) + .call(drawSlideBox, gd, axisOpts, opts) + .call(drawGrabbers, gd, axisOpts, opts); + // setup drag element setupDragElement(rangeSlider, gd, axisOpts, opts); @@ -21650,8 +21587,8 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { target = event.target, startX = event.clientX, offsetX = startX - rangeSlider.node().getBoundingClientRect().left, - minVal = opts.d2p(axisOpts.range[0]), - maxVal = opts.d2p(axisOpts.range[1]); + minVal = opts.d2p(axisOpts._rl[0]), + maxVal = opts.d2p(axisOpts._rl[1]); var dragCover = dragElement.coverSlip(); @@ -21712,7 +21649,7 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { function setDataRange(rangeSlider, gd, axisOpts, opts) { function clamp(v) { - return Lib.constrain(v, opts.range[0], opts.range[1]); + return axisOpts.l2r(Lib.constrain(v, opts._rl[0], opts._rl[1])); } var dataMin = clamp(opts.p2d(opts._pixelMin)), @@ -21729,8 +21666,8 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts) { return Lib.constrain(v, 0, opts._width); } - var pixelMin = clamp(opts.d2p(axisOpts.range[0])), - pixelMax = clamp(opts.d2p(axisOpts.range[1])); + var pixelMin = clamp(opts.d2p(axisOpts._rl[0])), + pixelMax = clamp(opts.d2p(axisOpts._rl[1])); rangeSlider.select('rect.' + constants.slideBoxClassName) .attr('x', pixelMin) @@ -21823,6 +21760,7 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) { data: [], layout: { xaxis: { + type: axisOpts.type, domain: [0, 1], range: opts.range.slice() }, @@ -22004,7 +21942,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":113,"../../lib/setcursor":123,"../../plotly":135,"../../plots/cartesian":148,"../../plots/cartesian/axes":139,"../../plots/plots":164,"../color":23,"../dragelement":45,"../drawing":47,"./constants":81,"d3":7}],84:[function(require,module,exports){ +},{"../../lib":115,"../../lib/setcursor":125,"../../plotly":137,"../../plots/cartesian":150,"../../plots/cartesian/axes":142,"../../plots/plots":166,"../color":23,"../dragelement":44,"../drawing":46,"./constants":80,"d3":7}],83:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22018,12 +21956,15 @@ function clearPushMargins(gd) { module.exports = { moduleType: 'component', name: 'rangeslider', + + layoutNodes: ['xaxis.'], layoutAttributes: require('./attributes'), handleDefaults: require('./defaults'), + draw: require('./draw') }; -},{"./attributes":80,"./defaults":82,"./draw":83}],85:[function(require,module,exports){ +},{"./attributes":79,"./defaults":81,"./draw":82}],84:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22041,7 +21982,14 @@ var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'shape', + + visible: { + valType: 'boolean', + + dflt: true, + + }, type: { valType: 'enumerated', @@ -22114,7 +22062,7 @@ module.exports = { } }; -},{"../../lib/extend":111,"../../traces/scatter/attributes":205,"../annotations/attributes":16}],86:[function(require,module,exports){ +},{"../../lib/extend":112,"../../traces/scatter/attributes":207,"../annotations/attributes":16}],85:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22126,6 +22074,7 @@ module.exports = { 'use strict'; +var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); var constants = require('./constants'); @@ -22134,7 +22083,7 @@ var helpers = require('./helpers'); module.exports = function calcAutorange(gd) { var fullLayout = gd._fullLayout, - shapeList = fullLayout.shapes; + shapeList = Lib.filterVisible(fullLayout.shapes); if(!shapeList.length || !gd._fullData.length) return; @@ -22190,7 +22139,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../plots/cartesian/axes":139,"./constants":87,"./helpers":90}],87:[function(require,module,exports){ +},{"../../lib":115,"../../plots/cartesian/axes":142,"./constants":86,"./helpers":89}],86:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22254,7 +22203,7 @@ module.exports = { } }; -},{}],88:[function(require,module,exports){ +},{}],87:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22266,22 +22215,20 @@ module.exports = { 'use strict'; +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var handleShapeDefaults = require('./shape_defaults'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - var containerIn = layoutIn.shapes || [], - containerOut = layoutOut.shapes = []; - - for(var i = 0; i < containerIn.length; i++) { - var shapeIn = containerIn[i] || {}, - shapeOut = handleShapeDefaults(shapeIn, layoutOut); + var opts = { + name: 'shapes', + handleItemDefaults: handleShapeDefaults + }; - containerOut.push(shapeOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"./shape_defaults":92}],89:[function(require,module,exports){ +},{"../../plots/array_container_defaults":139,"./shape_defaults":91}],88:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22333,7 +22280,9 @@ function draw(gd) { fullLayout._shapeSubplotLayer.selectAll('path').remove(); for(var i = 0; i < fullLayout.shapes.length; i++) { - drawOne(gd, i); + if(fullLayout.shapes[i].visible) { + drawOne(gd, i); + } } // may need to resurrect this if we put text (LaTeX) in shapes @@ -22453,8 +22402,6 @@ function updateShape(gd, index, opt, value) { // TODO: clean this up and remove it. if(!optionsIn) return; - var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; - // alter the input shape as requested var optionsEdit = {}; if(typeof opt === 'string' && opt) optionsEdit[opt] = value; @@ -22466,7 +22413,12 @@ function updateShape(gd, index, opt, value) { Lib.nestedProperty(optionsIn, k).set(optionsEdit[k]); } - var posAttrs = ['x0', 'x1', 'y0', 'y1']; + // return early in visible: false updates + if(optionsIn.visible === false) return; + + var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}, + posAttrs = ['x0', 'x1', 'y0', 'y1']; + for(i = 0; i < 4; i++) { var posAttr = posAttrs[i]; // if we don't have an explicit position already, @@ -22481,18 +22433,17 @@ function updateShape(gd, index, opt, value) { var axLetter = posAttr.charAt(0), axOld = Axes.getFromId(gd, - Axes.coerceRef(oldRef, {}, gd, axLetter)), + Axes.coerceRef(oldRef, {}, gd, axLetter, '', 'paper')), axNew = Axes.getFromId(gd, - Axes.coerceRef(optionsIn, {}, gd, axLetter)), + Axes.coerceRef(optionsIn, {}, gd, axLetter, '', 'paper')), position = optionsIn[posAttr], - linearizedPosition; + rangePosition; if(optionsEdit[axLetter + 'ref'] !== undefined) { // first convert to fraction of the axis if(axOld) { - linearizedPosition = helpers.dataToLinear(axOld)(position); - position = (linearizedPosition - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + rangePosition = helpers.shapePositionToRange(axOld)(position); + position = axOld.r2fraction(rangePosition); } else { position = (position - axNew.domain[0]) / (axNew.domain[1] - axNew.domain[0]); @@ -22500,9 +22451,8 @@ function updateShape(gd, index, opt, value) { if(axNew) { // then convert to new data coordinates at the same fraction - linearizedPosition = axNew.range[0] + position * - (axNew.range[1] - axNew.range[0]); - position = helpers.linearToData(axNew)(linearizedPosition); + rangePosition = axNew.fraction2r(position); + position = helpers.rangeToShapePosition(axNew)(rangePosition); } else { // or scale to the whole plot position = axOld.domain[0] + @@ -22513,7 +22463,8 @@ function updateShape(gd, index, opt, value) { optionsIn[posAttr] = position; } - var options = handleShapeDefaults(optionsIn, gd._fullLayout); + var options = {}; + handleShapeDefaults(optionsIn, options, gd._fullLayout); gd._fullLayout.shapes[index] = options; var clipAxes; @@ -22747,22 +22698,22 @@ function getPathString(gd, options) { xa = Axes.getFromId(gd, options.xref), ya = Axes.getFromId(gd, options.yref), gs = gd._fullLayout._size, - x2l, + x2r, x2p, - y2l, + y2r, y2p; if(xa) { - x2l = helpers.dataToLinear(xa); - x2p = function(v) { return xa._offset + xa.l2p(x2l(v, true)); }; + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2l = helpers.dataToLinear(ya); - y2p = function(v) { return ya._offset + ya.l2p(y2l(v, true)); }; + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; @@ -22844,7 +22795,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":113,"../../lib/setcursor":123,"../../plotly":135,"../../plots/cartesian/axes":139,"../color":23,"../dragelement":45,"../drawing":47,"./constants":87,"./defaults":88,"./helpers":90,"./shape_defaults":92,"fast-isnumeric":10}],90:[function(require,module,exports){ +},{"../../lib":115,"../../lib/setcursor":125,"../../plotly":137,"../../plots/cartesian/axes":142,"../color":23,"../dragelement":44,"../drawing":46,"./constants":86,"./defaults":87,"./helpers":89,"./shape_defaults":91,"fast-isnumeric":10}],89:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22861,16 +22812,16 @@ function movePath(pathIn, moveX, moveY) { // so these have to be specified in terms of the category serial numbers, // but can take fractional values. Other axis types we specify position based on // the actual data values. -// TODO: this should really be part of axes, but for now it's only used here. -// eventually annotations and axis ranges will use this too. -// what should we do, invent a new letter for "data except if it's category"? +// TODO: in V2.0 (when log axis ranges are in data units) range and shape position +// will be identical, so rangeToShapePosition and shapePositionToRange can be +// removed entirely. -exports.dataToLinear = function(ax) { - return ax.type === 'category' ? ax.c2l : ax.d2l; +exports.rangeToShapePosition = function(ax) { + return (ax.type === 'log') ? ax.r2d : function(v) { return v; }; }; -exports.linearToData = function(ax) { - return ax.type === 'category' ? ax.l2c : ax.l2d; +exports.shapePositionToRange = function(ax) { + return (ax.type === 'log') ? ax.d2r : function(v) { return v; }; }; exports.decodeDate = function(convertToPx) { @@ -22889,10 +22840,10 @@ exports.getDataToPixel = function(gd, axis, isVertical) { dataToPixel; if(axis) { - var d2l = exports.dataToLinear(axis); + var d2r = exports.shapePositionToRange(axis); dataToPixel = function(v) { - return axis._offset + axis.l2p(d2l(v, true)); + return axis._offset + axis.r2p(d2r(v, true)); }; if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); @@ -22912,8 +22863,8 @@ exports.getPixelToData = function(gd, axis, isVertical) { pixelToData; if(axis) { - var l2d = exports.linearToData(axis); - pixelToData = function(p) { return l2d(axis.p2l(p - axis._offset)); }; + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; @@ -22925,7 +22876,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],91:[function(require,module,exports){ +},{}],90:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22937,21 +22888,21 @@ exports.getPixelToData = function(gd, axis, isVertical) { 'use strict'; -exports.moduleType = 'component'; - -exports.name = 'shapes'; - -exports.layoutAttributes = require('./attributes'); +var drawModule = require('./draw'); -exports.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'shapes', -exports.calcAutorange = require('./calc_autorange'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne +}; -},{"./attributes":85,"./calc_autorange":86,"./defaults":88,"./draw":89}],92:[function(require,module,exports){ +},{"./attributes":84,"./calc_autorange":85,"./defaults":87,"./draw":88}],91:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22969,13 +22920,19 @@ var Axes = require('../../plots/cartesian/axes'); var attributes = require('./attributes'); var helpers = require('./helpers'); -module.exports = function handleShapeDefaults(shapeIn, fullLayout) { - var shapeOut = {}; + +module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opts, itemOpts) { + opts = opts || {}; + itemOpts = itemOpts || {}; function coerce(attr, dflt) { return Lib.coerce(shapeIn, shapeOut, attributes, attr, dflt); } + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + + if(!visible) return shapeOut; + coerce('layer'); coerce('opacity'); coerce('fillcolor'); @@ -22990,39 +22947,61 @@ module.exports = function handleShapeDefaults(shapeIn, fullLayout) { var axLetters = ['x', 'y']; for(var i = 0; i < 2; i++) { var axLetter = axLetters[i], - tdMock = {_fullLayout: fullLayout}; + gdMock = {_fullLayout: fullLayout}; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, tdMock, axLetter); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); if(shapeType !== 'path') { var dflt0 = 0.25, - dflt1 = 0.75; + dflt1 = 0.75, + ax, + pos2r, + r2pos; if(axRef !== 'paper') { - var ax = Axes.getFromId(tdMock, axRef), - convertFn = helpers.linearToData(ax); - - dflt0 = convertFn(ax.range[0] + dflt0 * (ax.range[1] - ax.range[0])); - dflt1 = convertFn(ax.range[0] + dflt1 * (ax.range[1] - ax.range[0])); + ax = Axes.getFromId(gdMock, axRef); + r2pos = helpers.rangeToShapePosition(ax); + pos2r = helpers.shapePositionToRange(ax); + } + else { + pos2r = r2pos = Lib.identity; } + // hack until V2.0 when log has regular range behavior - make it look like other + // ranges to send to coerce, then put it back after + // this is all to give reasonable default position behavior on log axes, which is + // a pretty unimportant edge case so we could just ignore this. + var attr0 = axLetter + '0', + attr1 = axLetter + '1', + in0 = shapeIn[attr0], + in1 = shapeIn[attr1]; + shapeIn[attr0] = pos2r(shapeIn[attr0], true); + shapeIn[attr1] = pos2r(shapeIn[attr1], true); + // x0, x1 (and y0, y1) - coerce(axLetter + '0', dflt0); - coerce(axLetter + '1', dflt1); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr0, dflt0); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr1, dflt1); + + // hack part 2 + shapeOut[attr0] = r2pos(shapeOut[attr0]); + shapeOut[attr1] = r2pos(shapeOut[attr1]); + shapeIn[attr0] = in0; + shapeIn[attr1] = in1; } } if(shapeType === 'path') { coerce('path'); - } else { + } + else { Lib.noneOrAll(shapeIn, shapeOut, ['x0', 'x1', 'y0', 'y1']); } return shapeOut; }; -},{"../../lib":113,"../../plots/cartesian/axes":139,"./attributes":85,"./helpers":90}],93:[function(require,module,exports){ +},{"../../lib":115,"../../plots/cartesian/axes":142,"./attributes":84,"./helpers":89}],92:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23041,7 +23020,7 @@ var animationAttrs = require('../../plots/animation_attributes'); var constants = require('./constants'); var stepsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'step', method: { valType: 'enumerated', @@ -23074,6 +23053,8 @@ var stepsAttrs = { }; module.exports = { + _isLinkedToArray: 'slider', + visible: { valType: 'boolean', @@ -23254,7 +23235,7 @@ module.exports = { }, }; -},{"../../lib/extend":111,"../../plots/animation_attributes":136,"../../plots/font_attributes":160,"../../plots/pad_attributes":163,"./constants":94}],94:[function(require,module,exports){ +},{"../../lib/extend":112,"../../plots/animation_attributes":138,"../../plots/font_attributes":162,"../../plots/pad_attributes":165,"./constants":93}],93:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23269,9 +23250,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'sliders', - itemName: 'slider', // class names containerClassName: 'slider-container', @@ -23352,7 +23332,7 @@ module.exports = { currentValueInset: 0, }; -},{}],95:[function(require,module,exports){ +},{}],94:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23364,6 +23344,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -23373,23 +23354,12 @@ var stepAttrs = attributes.steps; module.exports = function slidersDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var sliderIn = contIn[i] || {}, - sliderOut = {}; - - sliderDefaults(sliderIn, sliderOut, layoutOut); - - // used on button click to update the 'active' field - sliderOut._input = sliderIn; - - // used to determine object constancy - sliderOut._index = i; + var opts = { + name: name, + handleItemDefaults: sliderDefaults + }; - contOut.push(sliderOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function sliderDefaults(sliderIn, sliderOut, layoutOut) { @@ -23475,7 +23445,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":113,"./attributes":93,"./constants":94}],96:[function(require,module,exports){ +},{"../../lib":115,"../../plots/array_container_defaults":139,"./attributes":92,"./constants":93}],95:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23844,6 +23814,7 @@ function handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, doTransiti } function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) { + var previousActive = sliderOpts.active; sliderOpts._input.active = sliderOpts.active = index; var step = sliderOpts.steps[sliderOpts.active]; @@ -23851,6 +23822,13 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) sliderGroup.call(setGripPosition, sliderOpts, sliderOpts.active / (sliderOpts.steps.length - 1), doTransition); sliderGroup.call(drawCurrentValue, sliderOpts); + gd.emit('plotly_sliderchange', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active], + interaction: doCallback, + previousActive: previousActive + }); + if(step && step.method && doCallback) { if(sliderGroup._nextMethod) { // If we've already queued up an update, just overwrite it with the most recent: @@ -23877,6 +23855,8 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { var $gd = d3.select(gd); item.on('mousedown', function() { + gd.emit('plotly_sliderstart', {slider: sliderOpts}); + var grip = sliderGroup.select('.' + constants.gripRectClass); d3.event.stopPropagation(); @@ -23897,6 +23877,11 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { grip.call(Color.fill, sliderOpts.bgcolor); $gd.on('mouseup', null); $gd.on('mousemove', null); + + gd.emit('plotly_sliderend', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active] + }); }); }); } @@ -24034,7 +24019,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":113,"../../lib/svg_text_utils":125,"../../plots/plots":164,"../color":23,"../drawing":47,"../legend/anchor_utils":60,"./constants":94,"d3":7}],97:[function(require,module,exports){ +},{"../../lib":115,"../../lib/svg_text_utils":127,"../../plots/plots":166,"../color":23,"../drawing":46,"../legend/anchor_utils":59,"./constants":93,"d3":7}],96:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24045,18 +24030,19 @@ function clearPushMargins(gd) { 'use strict'; +var constants = require('./constants'); -exports.moduleType = 'component'; - -exports.name = 'sliders'; - -exports.layoutAttributes = require('./attributes'); +module.exports = { + moduleType: 'component', + name: constants.name, -exports.supplyLayoutDefaults = require('./defaults'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":93,"./defaults":95,"./draw":96}],98:[function(require,module,exports){ +},{"./attributes":92,"./constants":93,"./defaults":94,"./draw":95}],97:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24286,7 +24272,7 @@ Titles.draw = function(gd, titleClass, options) { el.classed('js-placeholder', isplaceholder); }; -},{"../../lib":113,"../../lib/svg_text_utils":125,"../../plotly":135,"../../plots/plots":164,"../color":23,"../drawing":47,"d3":7,"fast-isnumeric":10}],99:[function(require,module,exports){ +},{"../../lib":115,"../../lib/svg_text_utils":127,"../../plotly":137,"../../plots/plots":166,"../color":23,"../drawing":46,"d3":7,"fast-isnumeric":10}],98:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24303,7 +24289,7 @@ var extendFlat = require('../../lib/extend').extendFlat; var padAttrs = require('../../plots/pad_attributes'); var buttonsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'button', method: { valType: 'enumerated', @@ -24332,7 +24318,7 @@ var buttonsAttrs = { }; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'updatemenu', visible: { valType: 'boolean', @@ -24432,7 +24418,7 @@ module.exports = { } }; -},{"../../lib/extend":111,"../../plots/font_attributes":160,"../../plots/pad_attributes":163,"../color/attributes":22}],100:[function(require,module,exports){ +},{"../../lib/extend":112,"../../plots/font_attributes":162,"../../plots/pad_attributes":165,"../color/attributes":22}],99:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24447,9 +24433,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'updatemenus', - itemName: 'updatemenu', // class names containerClassName: 'updatemenu-container', @@ -24509,7 +24494,7 @@ module.exports = { hoverColor: '#F4FAFF' }; -},{}],101:[function(require,module,exports){ +},{}],100:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24521,6 +24506,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -24530,23 +24516,12 @@ var buttonAttrs = attributes.buttons; module.exports = function updateMenusDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var menuIn = contIn[i] || {}, - menuOut = {}; - - menuDefaults(menuIn, menuOut, layoutOut); - - // used on button click to update the 'active' field - menuOut._input = menuIn; - - // used to determine object constancy - menuOut._index = i; + var opts = { + name: name, + handleItemDefaults: menuDefaults + }; - contOut.push(menuOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function menuDefaults(menuIn, menuOut, layoutOut) { @@ -24613,7 +24588,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":113,"./attributes":99,"./constants":100}],102:[function(require,module,exports){ +},{"../../lib":115,"../../plots/array_container_defaults":139,"./attributes":98,"./constants":99}],101:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24915,6 +24890,8 @@ function drawButtons(gd, gHeader, gButton, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, buttonIndex); Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + + gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); button.on('mouseover', function() { @@ -25194,7 +25171,9 @@ function clearPushMargins(gd) { } } -},{"../../lib":113,"../../lib/svg_text_utils":125,"../../plots/plots":164,"../color":23,"../drawing":47,"../legend/anchor_utils":60,"./constants":100,"d3":7}],103:[function(require,module,exports){ +},{"../../lib":115,"../../lib/svg_text_utils":127,"../../plots/plots":166,"../color":23,"../drawing":46,"../legend/anchor_utils":59,"./constants":99,"d3":7}],102:[function(require,module,exports){ +arguments[4][96][0].apply(exports,arguments) +},{"./attributes":98,"./constants":99,"./defaults":100,"./draw":101,"dup":96}],103:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25206,17 +25185,37 @@ function clearPushMargins(gd) { 'use strict'; -exports.moduleType = 'component'; - -exports.name = 'updatemenus'; - -exports.layoutAttributes = require('./attributes'); +module.exports = { + /** + * Standardize all missing data in calcdata to use undefined + * never null or NaN. + * That way we can use !==undefined, or !== BADNUM, + * to test for real data + */ + BADNUM: undefined, -exports.supplyLayoutDefaults = require('./defaults'); + /* + * Limit certain operations to well below floating point max value + * to avoid glitches: Make sure that even when you multiply it by the + * number of pixels on a giant screen it still works + */ + FP_SAFE: Number.MAX_VALUE / 10000, -exports.draw = require('./draw'); + /* + * conversion of date units to milliseconds + * year and month constants are marked "AVG" + * to remind us that not all years and months + * have the same length + */ + ONEAVGYEAR: 31557600000, // 365.25 days + ONEAVGMONTH: 2629800000, // 1/12 of ONEAVGYEAR + ONEDAY: 86400000, + ONEHOUR: 3600000, + ONEMIN: 60000, + ONESEC: 1000 +}; -},{"./attributes":99,"./defaults":101,"./draw":102}],104:[function(require,module,exports){ +},{}],104:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25296,7 +25295,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.19.2'; +exports.version = '1.20.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -25357,7 +25356,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":21,"./components/images":59,"./components/legend":67,"./components/rangeselector":79,"./components/rangeslider":84,"./components/shapes":91,"./components/sliders":97,"./components/updatemenus":103,"./fonts/mathjax_config":107,"./lib/queue":121,"./plot_api/plot_schema":129,"./plot_api/register":130,"./plot_api/set_plot_config":131,"./plot_api/to_image":133,"./plot_api/validate":134,"./plotly":135,"./snapshot":176,"./snapshot/download":173,"./traces/scatter":215,"d3":7,"es6-promise":8}],107:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":21,"./components/images":58,"./components/legend":66,"./components/rangeselector":78,"./components/rangeslider":83,"./components/shapes":90,"./components/sliders":96,"./components/updatemenus":102,"./fonts/mathjax_config":107,"./lib/queue":123,"./plot_api/plot_schema":131,"./plot_api/register":132,"./plot_api/set_plot_config":133,"./plot_api/to_image":135,"./plot_api/validate":136,"./plotly":137,"./snapshot":178,"./snapshot/download":175,"./traces/scatter":217,"d3":7,"es6-promise":8}],107:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25400,22 +25399,50 @@ if(typeof MathJax !== 'undefined') { */ +'use strict'; + +var isNumeric = require('fast-isnumeric'); + +var BADNUM = require('../constants/numerical').BADNUM; + +// precompile these regex's for speed +var FRONTJUNK = /^['"%,$#\s']+/; +var ENDJUNK = /['"%,$#\s']+$/; + +/** + * cleanNumber: remove common leading and trailing cruft + * Always returns either a number or BADNUM. + */ +module.exports = function cleanNumber(v) { + if(typeof v === 'string') { + v = v.replace(FRONTJUNK, '').replace(ENDJUNK, ''); + } + + if(isNumeric(v)) return Number(v); + + return BADNUM; +}; + +},{"../constants/numerical":103,"fast-isnumeric":10}],109:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + 'use strict'; var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); -var nestedProperty = require('./nested_property'); -var isPlainObject = require('./is_plain_object'); -var filterUnique = require('./filter_unique'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); +var nestedProperty = require('./nested_property'); -var idRegex = /^([2-9]|[1-9][0-9]+)$/; - -function isValObject(obj) { - return obj && obj.valType !== undefined; -} +var ID_REGEX = /^([2-9]|[1-9][0-9]+)$/; exports.valObjects = { data_array: { @@ -25526,7 +25553,7 @@ exports.valObjects = { coerceFunction: function(v, propOut, dflt) { var dlen = dflt.length; if(typeof v === 'string' && v.substr(0, dlen) === dflt && - idRegex.test(v.substr(dlen))) { + ID_REGEX.test(v.substr(dlen))) { propOut.set(v); return; } @@ -25538,7 +25565,7 @@ exports.valObjects = { if(v === dflt) return true; if(typeof v !== 'string') return false; - if(v.substr(0, dlen) === dflt && idRegex.test(v.substr(dlen))) { + if(v.substr(0, dlen) === dflt && ID_REGEX.test(v.substr(dlen))) { return true; } @@ -25706,129 +25733,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -/* - * returns true for a valid value object and false for tree nodes in the attribute hierarchy - */ -exports.isValObject = isValObject; - -exports.IS_SUBPLOT_OBJ = '_isSubplotObj'; -exports.IS_LINKED_TO_ARRAY = '_isLinkedToArray'; -exports.DEPRECATED = '_deprecated'; - -// list of underscore attributes to keep in schema as is -exports.UNDERSCORE_ATTRS = [exports.IS_SUBPLOT_OBJ, exports.IS_LINKED_TO_ARRAY, exports.DEPRECATED]; - -/** - * Crawl the attribute tree, recursively calling a callback function - * - * @param {object} attrs - * The node of the attribute tree (e.g. the root) from which recursion originates - * @param {Function} callback - * A callback function with the signature: - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * @param {Number} [specifiedLevel] - * The level in the tree, in order to let the callback function detect descend or backtrack, - * typically unsupplied (implied 0), just used by the self-recursive call. - * The necessity arises because the tree traversal is not controlled by callback return values. - * The decision to not use callback return values for controlling tree pruning arose from - * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions - * precedes the callback call. - * - * @return {object} transformOut - * copy of transformIn that contains attribute defaults - */ -exports.crawl = function(attrs, callback, specifiedLevel) { - var level = specifiedLevel || 0; - Object.keys(attrs).forEach(function(attrName) { - var attr = attrs[attrName]; - - if(exports.UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - - callback(attr, attrName, attrs, level); - - if(isValObject(attr)) return; - if(isPlainObject(attr)) exports.crawl(attr, callback, level + 1); - }); -}; - -/** - * Find all data array attributes in a given trace object - including - * `arrayOk` attributes. - * - * @param {object} trace - * full trace object that contains a reference to `_module.attributes` - * - * @return {array} arrayAttributes - * list of array attributes for the given trace - */ -exports.findArrayAttributes = function(trace) { - var arrayAttributes = [], - stack = []; - - /** - * A closure that gathers attribute paths into its enclosed arraySplitAttributes - * Attribute paths are collected iff their leaf node is a splittable attribute - * - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * - * @closureVariable {String[][]} arrayAttributes the set of gathered attributes - * Example of filled closure variable (expected to be initialized to []): - * [["marker","size"],["marker","line","width"],["marker","line","color"]] - */ - function callback(attr, attrName, attrs, level) { - stack = stack.slice(0, level).concat([attrName]); - - var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; - if(!splittableAttr) return; - - var astr = toAttrString(stack); - var val = nestedProperty(trace, astr).get(); - if(!Array.isArray(val)) return; - - arrayAttributes.push(astr); - } - - function toAttrString(stack) { - return stack.join('.'); - } - - exports.crawl(trace._module.attributes, callback); - - if(trace.transforms) { - var transforms = trace.transforms; - - for(var i = 0; i < transforms.length; i++) { - var transform = transforms[i]; - - stack = ['transforms[' + i + ']']; - exports.crawl(transform._module.attributes, callback, 1); - } - } - - // Look into the fullInput module attributes for array attributes - // to make sure that 'custom' array attributes are detected. - // - // At the moment, we need this block to make sure that - // ohlc and candlestick 'open', 'high', 'low', 'close' can be - // used with filter ang groupby transforms. - if(trace._fullInput) { - exports.crawl(trace._fullInput._module.attributes, callback); - - arrayAttributes = filterUnique(arrayAttributes); - } - - return arrayAttributes; -}; - -},{"../components/colorscale/get_scale":36,"../components/colorscale/scales":42,"./filter_unique":112,"./is_plain_object":115,"./nested_property":118,"fast-isnumeric":10,"tinycolor2":13}],109:[function(require,module,exports){ +},{"../components/colorscale/get_scale":35,"../components/colorscale/scales":41,"./nested_property":120,"fast-isnumeric":10,"tinycolor2":13}],110:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25843,6 +25748,24 @@ exports.findArrayAttributes = function(trace) { var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); +var logError = require('./loggers').error; + +var constants = require('../constants/numerical'); +var BADNUM = constants.BADNUM; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + +// is an object a javascript date? +exports.isJSDate = function(v) { + return typeof v === 'object' && v !== null && typeof v.getTime === 'function'; +}; + +// The absolute limits of our date-time system +// This is a little weird: we use MIN_MS and MAX_MS in dateTime2ms +// but we use dateTime2ms to calculate them (after defining it!) +var MIN_MS, MAX_MS; /** * dateTime2ms - turn a date object or string s of the form @@ -25850,7 +25773,13 @@ var isNumeric = require('fast-isnumeric'); * per javascript standard) * may truncate after any full field, and sss can be any length * even >3 digits, though javascript dates truncate to milliseconds - * returns false if it doesn't find a date + * returns BADNUM if it doesn't find a date + * + * Expanded to support negative years to -9999 but you must always + * give 4 digits, except for 2-digit positive years which we assume are + * near the present time. + * Note that we follow ISO 8601:2004: there *is* a year 0, which + * is 1BC/BCE, and -1===2BC etc. * * 2-digit to 4-digit year conversion, where to cut off? * from http://support.microsoft.com/kb/244664: @@ -25858,85 +25787,123 @@ var isNumeric = require('fast-isnumeric'); * but in my mac chrome from eg. d=new Date(Date.parse('8/19/50')): * 1950-2049 * by Java, from http://stackoverflow.com/questions/2024273/: - * now-80 - now+20 + * now-80 - now+19 * or FileMaker Pro, from * http://www.filemaker.com/12help/html/add_view_data.4.21.html: - * now-70 - now+30 + * now-70 - now+29 * but python strptime etc, via * http://docs.python.org/py3k/library/time.html: * 1969-2068 (super forward-looking, but static, not sliding!) * - * lets go with now-70 to now+30, and if anyone runs into this problem + * lets go with now-70 to now+29, and if anyone runs into this problem * they can learn the hard way not to use 2-digit years, as no choice we * make now will cover all possibilities. mostly this will all be taken * care of in initial parsing, should only be an issue for hand-entered data - * currently (2012) this range is: - * 1942-2041 + * currently (2016) this range is: + * 1946-2045 */ exports.dateTime2ms = function(s) { // first check if s is a date object - try { - if(s.getTime) return +s; - } - catch(e) { - return false; + if(exports.isJSDate(s)) { + s = Number(s); + if(s >= MIN_MS && s <= MAX_MS) return s; + return BADNUM; } + // otherwise only accept strings and numbers + if(typeof s !== 'string' && typeof s !== 'number') return BADNUM; var y, m, d, h; // split date and time parts - var datetime = String(s).split(' '); - if(datetime.length > 2) return false; + // TODO: we strip leading/trailing whitespace but not other + // characters like we do for numbers - do we want to? + var datetime = String(s).trim().split(' '); + if(datetime.length > 2) return BADNUM; var p = datetime[0].split('-'); // date part - if(p.length > 3 || (p.length !== 3 && datetime[1])) return false; + + var CE = true; // common era, ie positive year + if(p[0] === '') { + // first part is blank: year starts with a minus sign + CE = false; + p.splice(0, 1); + } + + var plen = p.length; + if(plen > 3 || (plen !== 3 && datetime[1]) || !plen) return BADNUM; // year if(p[0].length === 4) y = Number(p[0]); else if(p[0].length === 2) { + if(!CE) return BADNUM; var yNow = new Date().getFullYear(); y = ((Number(p[0]) - yNow + 70) % 100 + 200) % 100 + yNow - 70; } - else return false; - if(!isNumeric(y)) return false; - if(p.length === 1) return new Date(y, 0, 1).getTime(); // year only + else return BADNUM; + if(!isNumeric(y)) return BADNUM; + + // javascript takes new Date(0..99,m,d) to mean 1900-1999, so + // to support years 0-99 we need to use setFullYear explicitly + var baseDate = new Date(0, 0, 1); + baseDate.setFullYear(CE ? y : -y); + if(p.length > 1) { + + // month - may be 1 or 2 digits + m = Number(p[1]) - 1; // new Date() uses zero-based months + if(p[1].length > 2 || !(m >= 0 && m <= 11)) return BADNUM; + baseDate.setMonth(m); + + if(p.length > 2) { - // month - m = Number(p[1]) - 1; // new Date() uses zero-based months - if(p[1].length > 2 || !(m >= 0 && m <= 11)) return false; - if(p.length === 2) return new Date(y, m, 1).getTime(); // year-month + // day - may be 1 or 2 digits + d = Number(p[2]); + if(p[2].length > 2 || !(d >= 1 && d <= 31)) return BADNUM; + baseDate.setDate(d); - // day - d = Number(p[2]); - if(p[2].length > 2 || !(d >= 1 && d <= 31)) return false; + // does that date exist in this month? + if(baseDate.getDate() !== d) return BADNUM; - // now save the date part - d = new Date(y, m, d).getTime(); - if(!datetime[1]) return d; // year-month-day - p = datetime[1].split(':'); - if(p.length > 3) return false; + if(datetime[1]) { - // hour - h = Number(p[0]); - if(p[0].length > 2 || !(h >= 0 && h <= 23)) return false; - d += 3600000 * h; - if(p.length === 1) return d; + p = datetime[1].split(':'); + if(p.length > 3) return BADNUM; - // minute - m = Number(p[1]); - if(p[1].length > 2 || !(m >= 0 && m <= 59)) return false; - d += 60000 * m; - if(p.length === 2) return d; + // hour - may be 1 or 2 digits + h = Number(p[0]); + if(p[0].length > 2 || !p[0].length || !(h >= 0 && h <= 23)) return BADNUM; + baseDate.setHours(h); - // second - s = Number(p[2]); - if(!(s >= 0 && s < 60)) return false; - return d + s * 1000; + // does that hour exist in this day? (Daylight time!) + // (TODO: remove this check when we move to UTC) + if(baseDate.getHours() !== h) return BADNUM; + + if(p.length > 1) { + d = baseDate.getTime(); + + // minute - must be 2 digits + m = Number(p[1]); + if(p[1].length !== 2 || !(m >= 0 && m <= 59)) return BADNUM; + d += ONEMIN * m; + if(p.length === 2) return d; + + // second (and milliseconds) - must have 2-digit seconds + if(p[2].split('.')[0].length !== 2) return BADNUM; + s = Number(p[2]); + if(!(s >= 0 && s < 60)) return BADNUM; + return d + s * ONESEC; + } + } + } + } + return baseDate.getTime(); }; +MIN_MS = exports.MIN_MS = exports.dateTime2ms('-9999'); +MAX_MS = exports.MAX_MS = exports.dateTime2ms('9999-12-31 23:59:59.9999'); + // is string s a date? (see above) exports.isDateTime = function(s) { - return (exports.dateTime2ms(s) !== false); + return (exports.dateTime2ms(s) !== BADNUM); }; // pad a number with zeroes, to given # of digits before the decimal point @@ -25945,224 +25912,68 @@ function lpad(val, digits) { } /** - * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.sss - * Crop any trailing zeros in time, but always leave full date - * (we could choose to crop '-01' from date too)... + * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.ssss + * Crop any trailing zeros in time, except never stop right after hours + * (we could choose to crop '-01' from date too but for now we always + * show the whole date) * Optional range r is the data range that applies, also in ms. * If rng is big, the later parts of time will be omitted */ +var NINETYDAYS = 90 * ONEDAY; +var THREEHOURS = 3 * ONEHOUR; +var FIVEMIN = 5 * ONEMIN; exports.ms2DateTime = function(ms, r) { + if(typeof ms !== 'number' || !(ms >= MIN_MS && ms <= MAX_MS)) return BADNUM; + if(!r) r = 0; - var d = new Date(ms), - s = d3.time.format('%Y-%m-%d')(d); - - if(r < 7776000000) { - // <90 days: add hours - s += ' ' + lpad(d.getHours(), 2); - if(r < 432000000) { - // <5 days: add minutes - s += ':' + lpad(d.getMinutes(), 2); - if(r < 10800000) { - // <3 hours: add seconds - s += ':' + lpad(d.getSeconds(), 2); - if(r < 300000) { - // <5 minutes: add ms - s += '.' + lpad(d.getMilliseconds(), 3); + var d = new Date(Math.floor(ms)), + dateStr = d3.time.format('%Y-%m-%d')(d), + // <90 days: add hours and minutes - never *only* add hours + h = (r < NINETYDAYS) ? d.getHours() : 0, + m = (r < NINETYDAYS) ? d.getMinutes() : 0, + // <3 hours: add seconds + s = (r < THREEHOURS) ? d.getSeconds() : 0, + // <5 minutes: add ms (plus one extra digit, this is msec*10) + msec10 = (r < FIVEMIN) ? Math.round((d.getMilliseconds() + (((ms % 1) + 1) % 1)) * 10) : 0; + + // include each part that has nonzero data in or after it + if(h || m || s || msec10) { + dateStr += ' ' + lpad(h, 2) + ':' + lpad(m, 2); + if(s || msec10) { + dateStr += ':' + lpad(s, 2); + if(msec10) { + var digits = 4; + while(msec10 % 10 === 0) { + digits -= 1; + msec10 /= 10; } + dateStr += '.' + lpad(msec10, digits); } } - // strip trailing zeros - return s.replace(/([:\s]00)*\.?[0]*$/, ''); } - return s; -}; - -/** - * parseDate: forgiving attempt to turn any date string - * into a javascript date object - * - * first collate all the date formats we want to support, precompiled - * to d3 format objects see below for the string cleaning that happens - * before this separate out 2-digit (y) and 4-digit-year (Y) formats, - * formats with month names (b), and formats with am/pm (I) or no time (D) - * (also includes hour only, as the test is really for a colon) so we can - * cut down the number of tests we need to run for any given string - * (right now all are between 15 and 32 tests) - */ - -// TODO: this is way out of date vs. the server-side version -var timeFormats = { - // 24 hour - H: ['%H:%M:%S~%L', '%H:%M:%S', '%H:%M'], - // with am/pm - I: ['%I:%M:%S~%L%p', '%I:%M:%S%p', '%I:%M%p'], - // no colon, ie only date or date with hour (could also support eg 12h34m?) - D: ['%H', '%I%p', '%Hh'] -}; - -var dateFormats = { - Y: [ - '%Y~%m~%d', - '%Y%m%d', - '%y%m%d', // YYMMDD, has 6 digits together so will match Y, not y - '%m~%d~%Y', // MM/DD/YYYY has first precedence - '%d~%m~%Y' // then DD/MM/YYYY - ], - Yb: [ - '%b~%d~%Y', // eg nov 21 2013 - '%d~%b~%Y', // eg 21 nov 2013 - '%Y~%d~%b', // eg 2013 21 nov (or 2013 q3, after replacement) - '%Y~%b~%d' // eg 2013 nov 21 - ], - /** - * the two-digit year cases have so many potential ambiguities - * it's not even funny, but we'll try them anyway. - */ - y: [ - '%m~%d~%y', - '%d~%m~%y', - '%y~%m~%d' - ], - yb: [ - '%b~%d~%y', - '%d~%b~%y', - '%y~%d~%b', - '%y~%b~%d' - ] + return dateStr; }; -// use utc formatter since we're ignoring timezone info -var formatter = d3.time.format.utc; - -/** - * ISO8601 and YYYYMMDDHHMMSS are the only ones where date and time - * are not separated by a space, so they get inserted specially here. - * Also a couple formats with no day (so time makes no sense) - */ -var dateTimeFormats = { - Y: { - H: ['%Y~%m~%dT%H:%M:%S', '%Y~%m~%dT%H:%M:%S~%L'].map(formatter), - I: [], - D: ['%Y%m%d%H%M%S', '%Y~%m', '%m~%Y'].map(formatter) - }, - Yb: {H: [], I: [], D: ['%Y~%b', '%b~%Y'].map(formatter)}, - y: {H: [], I: [], D: []}, - yb: {H: [], I: [], D: []} -}; -// all others get inserted in all possible combinations from dateFormats and timeFormats -['Y', 'Yb', 'y', 'yb'].forEach(function(dateType) { - dateFormats[dateType].forEach(function(dateFormat) { - // just a date (don't do just a time) - dateTimeFormats[dateType].D.push(formatter(dateFormat)); - ['H', 'I', 'D'].forEach(function(timeType) { - timeFormats[timeType].forEach(function(timeFormat) { - var a = dateTimeFormats[dateType][timeType]; - - // 'date time', then 'time date' - a.push(formatter(dateFormat + '~' + timeFormat)); - a.push(formatter(timeFormat + '~' + dateFormat)); - }); - }); - }); -}); - -// precompiled regexps for performance -var matchword = /[a-z]*/g, - shortenword = function(m) { return m.substr(0, 3); }, - weekdaymatch = /(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g, - separatormatch = /[\s,\/\-\.\(\)]+/g, - ampmmatch = /~?([ap])~?m(~|$)/, - replaceampm = function(m, ap) { return ap + 'm '; }, - match4Y = /\d\d\d\d/, - matchMonthName = /(^|~)[a-z]{3}/, - matchAMPM = /[ap]m/, - matchcolon = /:/, - matchquarter = /q([1-4])/, - quarters = ['31~mar', '30~jun', '30~sep', '31~dec'], - replacequarter = function(m, n) { return quarters[n - 1]; }, - matchTZ = / ?([+\-]\d\d:?\d\d|Z)$/; - -function getDateType(v) { - var dateType; - dateType = (match4Y.test(v) ? 'Y' : 'y'); - dateType = dateType + (matchMonthName.test(v) ? 'b' : ''); - return dateType; -} - -function getTimeType(v) { - var timeType; - timeType = matchcolon.test(v) ? (matchAMPM.test(v) ? 'I' : 'H') : 'D'; - return timeType; -} - -exports.parseDate = function(v) { - // is it already a date? just return it - if(v.getTime) return v; - /** - * otherwise, if it's not a string, return nothing - * the case of numbers that just have years will get - * dealt with elsewhere. - */ - if(typeof v !== 'string') return false; - - // first clean up the string a bit to reduce the number of formats we have to test - v = v.toLowerCase() - /** - * cut all words down to 3 characters - this will result in - * some spurious matches, ie whenever the first three characters - * of a word match a month or weekday but that seems more likely - * to fix typos than to make dates where they shouldn't be... - * and then we can omit the long form of months from our testing - */ - .replace(matchword, shortenword) - /** - * remove weekday names, as they get overridden anyway if they're - * inconsistent also removes a few more words - * (ie "tuesday the 26th of november") - * TODO: language support? - * for months too, but these seem to be built into d3 - */ - .replace(weekdaymatch, '') - /** - * collapse all separators one ~ at a time, except : which seems - * pretty consistent for the time part use ~ instead of space or - * something since d3 can eat a space as padding on 1-digit numbers - */ - .replace(separatormatch, '~') - // in case of a.m. or p.m. (also take off any space before am/pm) - .replace(ampmmatch, replaceampm) - // turn quarters Q1-4 into dates (quarter ends) - .replace(matchquarter, replacequarter) - .trim() - // also try to ignore timezone info, at least for now - .replace(matchTZ, ''); - - // now test against the various formats that might match - var out = null, - dateType = getDateType(v), - timeType = getTimeType(v), - formatList, - len; - - formatList = dateTimeFormats[dateType][timeType]; - len = formatList.length; - - for(var i = 0; i < len; i++) { - out = formatList[i].parse(v); - if(out) break; +// normalize date format to date string, in case it starts as +// a Date object or milliseconds +// optional dflt is the return value if cleaning fails +exports.cleanDate = function(v, dflt) { + if(exports.isJSDate(v) || typeof v === 'number') { + // NOTE: if someone puts in a year as a number rather than a string, + // this will mistakenly convert it thinking it's milliseconds from 1970 + // that is: '2012' -> Jan. 1, 2012, but 2012 -> 2012 epoch milliseconds + v = exports.ms2DateTime(+v); + if(!v && dflt !== undefined) return dflt; } - - // If not an instance of Date at this point, just return it. - if(!(out instanceof Date)) return false; - // parse() method interprets arguments with local time zone. - var tzoff = out.getTimezoneOffset(); - // In general (default) this is not what we want, so force into UTC: - out.setTime(out.getTime() + tzoff * 60 * 1000); - return out; + else if(!exports.isDateTime(v)) { + logError('unrecognized date', v); + return dflt; + } + return v; }; -},{"d3":7,"fast-isnumeric":10}],110:[function(require,module,exports){ +},{"../constants/numerical":103,"./loggers":118,"d3":7,"fast-isnumeric":10}],111:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26328,7 +26139,7 @@ var Events = { module.exports = Events; -},{"events":9}],111:[function(require,module,exports){ +},{"events":9}],112:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26442,7 +26253,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":115}],112:[function(require,module,exports){ +},{"./is_plain_object.js":117}],113:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26493,7 +26304,38 @@ module.exports = function filterUnique(array) { return out; }; -},{}],113:[function(require,module,exports){ +},{}],114:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +/** Filter out object items with visible !== true + * insider array container. + * + * @param {array of objects} container + * @return {array of objects} of length <= container + * + */ +module.exports = function filterVisible(container) { + var out = []; + + for(var i = 0; i < container.length; i++) { + var item = container[i]; + + if(item.visible === true) out.push(item); + } + + return out; +}; + +},{}],115:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26519,19 +26361,15 @@ lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; lib.validate = coerceModule.validate; -lib.isValObject = coerceModule.isValObject; -lib.crawl = coerceModule.crawl; -lib.findArrayAttributes = coerceModule.findArrayAttributes; -lib.IS_SUBPLOT_OBJ = coerceModule.IS_SUBPLOT_OBJ; -lib.IS_LINKED_TO_ARRAY = coerceModule.IS_LINKED_TO_ARRAY; -lib.DEPRECATED = coerceModule.DEPRECATED; -lib.UNDERSCORE_ATTRS = coerceModule.UNDERSCORE_ATTRS; var datesModule = require('./dates'); lib.dateTime2ms = datesModule.dateTime2ms; lib.isDateTime = datesModule.isDateTime; lib.ms2DateTime = datesModule.ms2DateTime; -lib.parseDate = datesModule.parseDate; +lib.cleanDate = datesModule.cleanDate; +lib.isJSDate = datesModule.isJSDate; +lib.MIN_MS = datesModule.MIN_MS; +lib.MAX_MS = datesModule.MAX_MS; var searchModule = require('./search'); lib.findBin = searchModule.findBin; @@ -26572,6 +26410,10 @@ lib.error = loggersModule.error; lib.notifier = require('./notifier'); lib.filterUnique = require('./filter_unique'); +lib.filterVisible = require('./filter_visible'); + + +lib.cleanNumber = require('./clean_number'); /** * swap x and y of the same attribute in container cont @@ -26748,7 +26590,7 @@ lib.smooth = function(arrayIn, FWHM) { * as long as its returns are not promises (ie have no .then) * includes one argument arg to send to all functions... * this is mainly just to prevent us having to make wrapper functions - * when the only purpose of the wrapper is to reference gd / td + * when the only purpose of the wrapper is to reference gd * and a final step to be executed at the end * TODO: if there's an error and everything is sync, * this doesn't happen yet because we want to make sure @@ -27221,7 +27063,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./coerce":108,"./dates":109,"./extend":111,"./filter_unique":112,"./is_array":114,"./is_plain_object":115,"./loggers":116,"./matrix":117,"./nested_property":118,"./notifier":119,"./search":122,"./stats":124,"d3":7}],114:[function(require,module,exports){ +},{"./clean_number":108,"./coerce":109,"./dates":110,"./extend":112,"./filter_unique":113,"./filter_visible":114,"./is_array":116,"./is_plain_object":117,"./loggers":118,"./matrix":119,"./nested_property":120,"./notifier":121,"./search":124,"./stats":126,"d3":7}],116:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27239,7 +27081,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ArrayBuffer.isView(a); }; -},{}],115:[function(require,module,exports){ +},{}],117:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27268,7 +27110,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],116:[function(require,module,exports){ +},{}],118:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27335,7 +27177,7 @@ loggers.error = function() { } }; -},{"../plot_api/plot_config":128}],117:[function(require,module,exports){ +},{"../plot_api/plot_config":130}],119:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27445,7 +27287,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],118:[function(require,module,exports){ +},{}],120:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27702,7 +27544,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./is_array":114,"fast-isnumeric":10}],119:[function(require,module,exports){ +},{"./is_array":116,"fast-isnumeric":10}],121:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27779,7 +27621,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":7,"fast-isnumeric":10}],120:[function(require,module,exports){ +},{"d3":7,"fast-isnumeric":10}],122:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28019,7 +27861,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"./matrix":117}],121:[function(require,module,exports){ +},{"./matrix":119}],123:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28230,7 +28072,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":113,"../plot_api/plot_config":128}],122:[function(require,module,exports){ +},{"../lib":115,"../plot_api/plot_config":130}],124:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28341,7 +28183,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":116,"fast-isnumeric":10}],123:[function(require,module,exports){ +},{"./loggers":118,"fast-isnumeric":10}],125:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28364,7 +28206,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],124:[function(require,module,exports){ +},{}],126:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28460,7 +28302,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":10}],125:[function(require,module,exports){ +},{"fast-isnumeric":10}],127:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28574,8 +28416,8 @@ exports.convertToTspans = function(_context, _callback) { } if(tex) { - var td = Lib.getPlotDiv(that.node()); - ((td && td._promises) || []).push(new Promise(function(resolve) { + var gd = Lib.getPlotDiv(that.node()); + ((gd && gd._promises) || []).push(new Promise(function(resolve) { that.style({visibility: 'hidden'}); var config = {fontSize: parseInt(that.style('font-size'), 10)}; @@ -28987,7 +28829,7 @@ exports.makeEditable = function(context, _delegate, options) { return d3.rebind(this, dispatch, 'on'); }; -},{"../constants/string_mappings":104,"../constants/xmlns_namespaces":105,"../lib":113,"d3":7}],126:[function(require,module,exports){ +},{"../constants/string_mappings":104,"../constants/xmlns_namespaces":105,"../lib":115,"d3":7}],128:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -29092,13 +28934,12 @@ exports.cleanLayout = function(layout) { } } - if(layout.annotations !== undefined && !Array.isArray(layout.annotations)) { - Lib.warn('Annotations must be an array.'); - delete layout.annotations; - } - var annotationsLen = (layout.annotations || []).length; + var annotationsLen = Array.isArray(layout.annotations) ? layout.annotations.length : 0; for(i = 0; i < annotationsLen; i++) { var ann = layout.annotations[i]; + + if(!Lib.isPlainObject(ann)) continue; + if(ann.ref) { if(ann.ref === 'paper') { ann.xref = 'paper'; @@ -29110,17 +28951,17 @@ exports.cleanLayout = function(layout) { } delete ann.ref; } + cleanAxRef(ann, 'xref'); cleanAxRef(ann, 'yref'); } - if(layout.shapes !== undefined && !Array.isArray(layout.shapes)) { - Lib.warn('Shapes must be an array.'); - delete layout.shapes; - } - var shapesLen = (layout.shapes || []).length; + var shapesLen = Array.isArray(layout.shapes) ? layout.shapes.length : 0; for(i = 0; i < shapesLen; i++) { var shape = layout.shapes[i]; + + if(!Lib.isPlainObject(shape)) continue; + cleanAxRef(shape, 'xref'); cleanAxRef(shape, 'yref'); } @@ -29469,7 +29310,7 @@ exports.manageArrayContainers = function(np, newVal, undoit) { } }; -},{"../components/color":23,"../lib":113,"../plots/cartesian/axes":139,"../plots/plots":164,"../registry":171,"fast-isnumeric":10,"gl-mat4/fromQuat":11}],127:[function(require,module,exports){ +},{"../components/color":23,"../lib":115,"../plots/cartesian/axes":142,"../plots/plots":166,"../registry":173,"fast-isnumeric":10,"gl-mat4/fromQuat":11}],129:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -31389,13 +31230,14 @@ function _relayout(gd, aobj) { objList = layout[objType] || [], obji = objList[objNum] || {}; - // new API, remove annotation / shape with `null` - if(vi === null) aobj[ai] = 'remove'; - // if p.parts is just an annotation number, and val is either // 'add' or an entire annotation to add, the undo is 'remove' // if val is 'remove' then undo is the whole annotation object if(p.parts.length === 2) { + + // new API, remove annotation / shape with `null` + if(vi === null) aobj[ai] = 'remove'; + if(aobj[ai] === 'add' || Lib.isPlainObject(aobj[ai])) { undoit[ai] = 'remove'; } @@ -31430,6 +31272,7 @@ function _relayout(gd, aobj) { } // alter gd.layout else { + var pp1 = String(p.parts[1] || ''); // check whether we can short-circuit a full redraw // 3d or geo at this point just needs to redraw. if(p.parts[0].indexOf('scene') === 0) flags.doplot = true; @@ -31444,17 +31287,17 @@ function _relayout(gd, aobj) { else if(ai.indexOf('title') !== -1) flags.doticks = true; else if(p.parts[0].indexOf('bgcolor') !== -1) flags.dolayoutstyle = true; else if(p.parts.length > 1 && - Lib.containsAny(p.parts[1], ['tick', 'exponent', 'grid', 'zeroline'])) { + Lib.containsAny(pp1, ['tick', 'exponent', 'grid', 'zeroline'])) { flags.doticks = true; } else if(ai.indexOf('.linewidth') !== -1 && ai.indexOf('axis') !== -1) { flags.doticks = flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1].indexOf('line') !== -1) { + else if(p.parts.length > 1 && pp1.indexOf('line') !== -1) { flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1] === 'mirror') { + else if(p.parts.length > 1 && pp1 === 'mirror') { flags.doticks = flags.dolayoutstyle = true; } else if(ai === 'margin.pad') { @@ -31476,7 +31319,7 @@ function _relayout(gd, aobj) { */ else if(['hovermode', 'dragmode'].indexOf(ai) !== -1) flags.domodebar = true; else if(['hovermode', 'dragmode', 'height', - 'width', 'autosize'].indexOf(ai) === -1) { + 'width', 'autosize'].indexOf(ai) === -1) { flags.doplot = true; } @@ -31685,6 +31528,20 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } } + // Execute a callback after the wrapper function has been called n times. + // This is used to defer the resolution until a transition has resovled *and* + // the frame has completed. If it's not done this way, then we get a race + // condition in which the animation might resolve before a transition is complete + // or vice versa. + function callbackOnNthTime(cb, n) { + var cnt = 0; + return function() { + if(cb && ++cnt === n) { + return cb(); + } + }; + } + return new Promise(function(resolve, reject) { function discardExistingFrames() { if(trans._frameQueue.length === 0) { @@ -31729,14 +31586,13 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { frameOpts: frameOpts, transitionOpts: transitionOpts, }; - if(i === frameList.length - 1) { // The last frame in this .animate call stores the promise resolve // and reject callbacks. This is how we ensure that the animation // loop (which may exist as a result of a *different* .animate call) // still resolves or rejecdts this .animate call's promise. once it's // complete. - nextFrame.onComplete = resolve; + nextFrame.onComplete = callbackOnNthTime(resolve, 2); nextFrame.onInterrupt = reject; } @@ -31774,7 +31630,6 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { // Execute the callback and unset it to ensure it doesn't // accidentally get called twice trans._currentFrame.onComplete(); - trans._currentFrame.onComplete = null; } var newFrame = trans._currentFrame = trans._frameQueue.shift(); @@ -31794,7 +31649,12 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { helpers.coerceTraceIndices(gd, newFrame.frame.traces), newFrame.frameOpts, newFrame.transitionOpts - ); + ).then(function() { + if(newFrame.onComplete) { + newFrame.onComplete(); + } + + }); gd.emit('plotly_animatingframe', { name: newFrame.name, @@ -31870,6 +31730,8 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { for(i = 0; i < trans._frames.length; i++) { frame = trans._frames[i]; + if(!frame) continue; + if(allFrames || frame.group === frameOrGroupNameOrFrameList) { frameList.push({ type: 'byname', @@ -31881,14 +31743,15 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } else if(isFrameArray) { for(i = 0; i < frameOrGroupNameOrFrameList.length; i++) { var frameOrName = frameOrGroupNameOrFrameList[i]; - if(typeof frameOrName === 'string') { + if(['number', 'string'].indexOf(typeof frameOrName) !== -1) { + frameOrName = String(frameOrName); // In this case, there's an array and this frame is a string name: frameList.push({ type: 'byname', name: frameOrName, data: setTransitionConfig({name: frameOrName}) }); - } else { + } else if(Lib.isPlainObject(frameOrName)) { frameList.push({ type: 'object', data: setTransitionConfig(Lib.extendFlat({}, frameOrName)) @@ -32032,7 +31895,7 @@ Plotly.addFrames = function(gd, frameList, indices) { if(_hash[frame.name]) { // If frame is present, overwrite its definition: for(j = 0; j < _frames.length; j++) { - if(_frames[j].name === frame.name) break; + if((_frames[j] || {}).name === frame.name) break; } ops.push({type: 'replace', index: j, value: frame}); revops.unshift({type: 'replace', index: j, value: _frames[j]}); @@ -32232,7 +32095,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":47,"../components/errorbars":53,"../constants/xmlns_namespaces":105,"../lib":113,"../lib/events":110,"../lib/queue":121,"../lib/svg_text_utils":125,"../plotly":135,"../plots/cartesian/graph_interact":147,"../plots/plots":164,"../plots/polar":167,"../registry":171,"./helpers":126,"./subroutines":132,"d3":7,"fast-isnumeric":10}],128:[function(require,module,exports){ +},{"../components/drawing":46,"../components/errorbars":52,"../constants/xmlns_namespaces":105,"../lib":115,"../lib/events":111,"../lib/queue":123,"../lib/svg_text_utils":127,"../plotly":137,"../plots/cartesian/graph_interact":149,"../plots/plots":166,"../plots/polar":169,"../registry":173,"./helpers":128,"./subroutines":134,"d3":7,"fast-isnumeric":10}],130:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -32352,7 +32215,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],129:[function(require,module,exports){ +},{}],131:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -32364,185 +32227,287 @@ function defaultSetBackground(gd, bgColor) { 'use strict'; -var Plotly = require('../plotly'); var Registry = require('../registry'); -var Plots = require('../plots/plots'); var Lib = require('../lib'); -// FIXME polar attribute are not part of Plotly yet +var baseAttributes = require('../plots/attributes'); +var baseLayoutAttributes = require('../plots/layout_attributes'); +var frameAttributes = require('../plots/frame_attributes'); +var animationAttributes = require('../plots/animation_attributes'); + +// polar attributes are not part of the Registry yet var polarAreaAttrs = require('../plots/polar/area_attributes'); var polarAxisAttrs = require('../plots/polar/axis_attributes'); var extendFlat = Lib.extendFlat; var extendDeep = Lib.extendDeep; -var extendDeepAll = Lib.extendDeepAll; -var NESTED_MODULE = '_nestedModules', - COMPOSED_MODULE = '_composedModules'; +var IS_SUBPLOT_OBJ = '_isSubplotObj'; +var IS_LINKED_TO_ARRAY = '_isLinkedToArray'; +var DEPRECATED = '_deprecated'; +var UNDERSCORE_ATTRS = [IS_SUBPLOT_OBJ, IS_LINKED_TO_ARRAY, DEPRECATED]; -var plotSchema = { - traces: {}, - layout: {}, - transforms: {}, - defs: {} -}; +exports.IS_SUBPLOT_OBJ = IS_SUBPLOT_OBJ; +exports.IS_LINKED_TO_ARRAY = IS_LINKED_TO_ARRAY; +exports.DEPRECATED = DEPRECATED; +exports.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS; +/** Outputs the full plotly.js plot schema + * + * @return {object} + * - defs + * - traces + * - layout + * - transforms + * - frames + * - animations + * - config (coming soon ...) + */ +exports.get = function() { + var traces = {}; -var PlotSchema = module.exports = {}; + Registry.allTypes.concat('area').forEach(function(type) { + traces[type] = getTraceAttributes(type); + }); + var transforms = {}; -PlotSchema.get = function() { - Registry.allTypes - .concat('area') // FIXME polar 'area' attributes - .forEach(getTraceAttributes); + Object.keys(Registry.transformsRegistry).forEach(function(type) { + transforms[type] = getTransformAttributes(type); + }); - getLayoutAttributes(); + return { + defs: { + valObjects: Lib.valObjects, + metaKeys: UNDERSCORE_ATTRS.concat['description', 'role'] + }, - Object.keys(Registry.transformsRegistry).forEach(getTransformAttributes); + traces: traces, + layout: getLayoutAttributes(), - getDefs(); + transforms: transforms, - return plotSchema; + frames: formatAttributes(frameAttributes), + animation: formatAttributes(animationAttributes) + }; }; -PlotSchema.crawl = Lib.crawl; +/** + * Crawl the attribute tree, recursively calling a callback function + * + * @param {object} attrs + * The node of the attribute tree (e.g. the root) from which recursion originates + * @param {Function} callback + * A callback function with the signature: + * @callback callback + * @param {object} attr an attribute + * @param {String} attrName name string + * @param {object[]} attrs all the attributes + * @param {Number} level the recursion level, 0 at the root + * @param {Number} [specifiedLevel] + * The level in the tree, in order to let the callback function detect descend or backtrack, + * typically unsupplied (implied 0), just used by the self-recursive call. + * The necessity arises because the tree traversal is not controlled by callback return values. + * The decision to not use callback return values for controlling tree pruning arose from + * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions + * precedes the callback call. + * + * @return {object} transformOut + * copy of transformIn that contains attribute defaults + */ +exports.crawl = function(attrs, callback, specifiedLevel) { + var level = specifiedLevel || 0; -PlotSchema.isValObject = Lib.isValObject; + Object.keys(attrs).forEach(function(attrName) { + var attr = attrs[attrName]; -function getTraceAttributes(type) { - var globalAttributes = Plots.attributes, - _module = getModule({type: type}), - meta = getMeta(type), - subplotRegistry = getSubplotRegistry(type); + if(UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - var attributes = {}, - layoutAttributes = {}; + callback(attr, attrName, attrs, level); - // make 'type' the first attribute in the object - attributes.type = null; + if(exports.isValObject(attr)) return; - // global attributes (same for all trace types) - extendDeep(attributes, globalAttributes); + if(Lib.isPlainObject(attr)) exports.crawl(attr, callback, level + 1); + }); +}; - // module attributes (+ nested + composed) - attributes = coupleAttrs( - _module.attributes, attributes, 'attributes', type - ); +/** Is object a value object (or a container object)? + * + * @param {object} obj + * @return {boolean} + * returns true for a valid value object and + * false for tree nodes in the attribute hierarchy + */ +exports.isValObject = function(obj) { + return obj && obj.valType !== undefined; +}; - // subplot attributes - if(subplotRegistry.attributes !== undefined) { - extendDeep(attributes, subplotRegistry.attributes); +/** + * Find all data array attributes in a given trace object - including + * `arrayOk` attributes. + * + * @param {object} trace + * full trace object that contains a reference to `_module.attributes` + * + * @return {array} arrayAttributes + * list of array attributes for the given trace + */ +exports.findArrayAttributes = function(trace) { + var arrayAttributes = [], + stack = []; + + function callback(attr, attrName, attrs, level) { + stack = stack.slice(0, level).concat([attrName]); + + var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; + if(!splittableAttr) return; + + var astr = toAttrString(stack); + var val = Lib.nestedProperty(trace, astr).get(); + if(!Array.isArray(val)) return; + + arrayAttributes.push(astr); } - // 'type' gets overwritten by globalAttributes; reset it here - attributes.type = type; + function toAttrString(stack) { + return stack.join('.'); + } - attributes = removeUnderscoreAttrs(attributes); - mergeValTypeAndRole(attributes); - plotSchema.traces[type] = extendFlat({}, - meta, - { attributes: attributes } - ); + exports.crawl(trace._module.attributes, callback); - // trace-specific layout attributes - if(_module.layoutAttributes !== undefined) { - layoutAttributes = coupleAttrs( - _module.layoutAttributes, layoutAttributes, 'layoutAttributes', type - ); + if(trace.transforms) { + var transforms = trace.transforms; - mergeValTypeAndRole(layoutAttributes); - plotSchema.traces[type].layoutAttributes = layoutAttributes; + for(var i = 0; i < transforms.length; i++) { + var transform = transforms[i]; + + stack = ['transforms[' + i + ']']; + exports.crawl(transform._module.attributes, callback, 1); + } } -} -function getLayoutAttributes() { - var globalLayoutAttributes = Plots.layoutAttributes, - layoutAttributes = {}; + // Look into the fullInput module attributes for array attributes + // to make sure that 'custom' array attributes are detected. + // + // At the moment, we need this block to make sure that + // ohlc and candlestick 'open', 'high', 'low', 'close' can be + // used with filter ang groupby transforms. + if(trace._fullInput) { + exports.crawl(trace._fullInput._module.attributes, callback); - // layout module attributes (+ nested + composed) - layoutAttributes = coupleAttrs( - globalLayoutAttributes, layoutAttributes, 'layoutAttributes', '*' - ); + arrayAttributes = Lib.filterUnique(arrayAttributes); + } - // FIXME polar layout attributes - layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); + return arrayAttributes; +}; - // add crawler.IS_SUBPLOT_OBJ attribute - layoutAttributes = handleSubplotObjs(layoutAttributes); +function getTraceAttributes(type) { + var _module, basePlotModule; - layoutAttributes = removeUnderscoreAttrs(layoutAttributes); - mergeValTypeAndRole(layoutAttributes); + if(type === 'area') { + _module = { attributes: polarAreaAttrs }; + basePlotModule = {}; + } + else { + _module = Registry.modules[type]._module, + basePlotModule = _module.basePlotModule; + } - // generate crawler.IS_LINKED_TO_ARRAY structure - handleLinkedToArray(layoutAttributes); + var attributes = {}; - plotSchema.layout = { layoutAttributes: layoutAttributes }; -} + // make 'type' the first attribute in the object + attributes.type = null; -function getTransformAttributes(name) { - var _module = Registry.transformsRegistry[name], - _schema = {}; + // base attributes (same for all trace types) + extendDeep(attributes, baseAttributes); - _schema = coupleAttrs(_schema, _module.attributes || {}, 'attributes', '*'); - _schema = removeUnderscoreAttrs(_schema); - mergeValTypeAndRole(_schema); - handleLinkedToArray(_schema); + // module attributes + extendDeep(attributes, _module.attributes); - plotSchema.transforms[name] = { attributes: _schema }; -} + // subplot attributes + if(basePlotModule.attributes) { + extendDeep(attributes, basePlotModule.attributes); + } -function getDefs() { - plotSchema.defs = { - valObjects: Lib.valObjects, - metaKeys: Lib.UNDERSCORE_ATTRS.concat(['description', 'role']) + // 'type' gets overwritten by baseAttributes; reset it here + attributes.type = type; + + var out = { + meta: _module.meta || {}, + attributes: formatAttributes(attributes), }; + + // trace-specific layout attributes + if(_module.layoutAttributes) { + var layoutAttributes = {}; + + extendDeep(layoutAttributes, _module.layoutAttributes); + out.layoutAttributes = formatAttributes(layoutAttributes); + } + + return out; } -function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) { - var nestedModule, nestedAttrs, nestedReference, - composedModule, composedAttrs; +function getLayoutAttributes() { + var layoutAttributes = {}; - Object.keys(attrsIn).forEach(function(k) { + // global layout attributes + extendDeep(layoutAttributes, baseLayoutAttributes); - if(k === NESTED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - nestedModule = getModule({_module: attrsIn[k][kk]}); - if(nestedModule === undefined) return; + // add base plot module layout attributes + Object.keys(Registry.subplotsRegistry).forEach(function(k) { + var _module = Registry.subplotsRegistry[k]; - nestedAttrs = nestedModule[whichAttrs]; - nestedReference = coupleAttrs( - nestedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - Lib.nestedProperty(attrsOut, kk) - .set(extendDeep({}, nestedReference)); - }); - return; + if(_module.name === 'cartesian') { + handleBasePlotModule(layoutAttributes, _module, 'xaxis'); + handleBasePlotModule(layoutAttributes, _module, 'yaxis'); } + else { + var astr = _module.attr === 'subplot' ? _module.name : _module.attr; - if(k === COMPOSED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - if(kk !== type) return; + handleBasePlotModule(layoutAttributes, _module, astr); + } + }); - composedModule = getModule({_module: attrsIn[k][kk]}); - if(composedModule === undefined) return; + // polar layout attributes + layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); + + // add registered components layout attribute + Object.keys(Registry.componentsRegistry).forEach(function(k) { + var _module = Registry.componentsRegistry[k]; - composedAttrs = composedModule[whichAttrs]; - composedAttrs = coupleAttrs( - composedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - extendDeepAll(attrsOut, composedAttrs); + if(Array.isArray(_module.layoutNodes)) { + _module.layoutNodes.forEach(function(v) { + handleRegisteredComponent(layoutAttributes, _module, v + _module.name); }); - return; } - - attrsOut[k] = Lib.isPlainObject(attrsIn[k]) ? - extendDeepAll({}, attrsIn[k]) : - attrsIn[k]; + else { + handleRegisteredComponent(layoutAttributes, _module, _module.name); + } }); - return attrsOut; + return { + layoutAttributes: formatAttributes(layoutAttributes) + }; +} + +function getTransformAttributes(type) { + var _module = Registry.transformsRegistry[type]; + + return { + attributes: formatAttributes(_module.attributes) + }; +} + +function formatAttributes(attrs) { + mergeValTypeAndRole(attrs); + formatArrayContainers(attrs); + + return attrs; } function mergeValTypeAndRole(attrs) { @@ -32556,7 +32521,7 @@ function mergeValTypeAndRole(attrs) { } function callback(attr, attrName, attrs) { - if(PlotSchema.isValObject(attr)) { + if(exports.isValObject(attr)) { if(attr.valType === 'data_array') { // all 'data_array' attrs have role 'data' attr.role = 'data'; @@ -32574,40 +32539,26 @@ function mergeValTypeAndRole(attrs) { } } - Lib.crawl(attrs, callback); + exports.crawl(attrs, callback); } -// helper methods +function formatArrayContainers(attrs) { -function getModule(arg) { - if('type' in arg) { - return (arg.type === 'area') ? // FIXME - { attributes: polarAreaAttrs } : - Registry.getModule({type: arg.type}); - } + function callback(attr, attrName, attrs) { + if(!attr) return; - var subplotsRegistry = Registry.subplotsRegistry, - componentsRegistry = Registry.componentsRegistry, - _module = arg._module; + var itemName = attr[IS_LINKED_TO_ARRAY]; - if(subplotsRegistry[_module]) return subplotsRegistry[_module]; - else if(componentsRegistry[_module]) return componentsRegistry[_module]; + if(!itemName) return; - // look it internal Plotly if all previous attempts fail - return Plotly[_module]; -} + delete attr[IS_LINKED_TO_ARRAY]; -function removeUnderscoreAttrs(attributes) { - Object.keys(attributes).forEach(function(k) { - if(k.charAt(0) === '_' && - Lib.UNDERSCORE_ATTRS.indexOf(k) === -1) delete attributes[k]; - }); - return attributes; -} + attrs[attrName] = { items: {} }; + attrs[attrName].items[itemName] = attr; + attrs[attrName].role = 'object'; + } -function getMeta(type) { - if(type === 'area') return {}; // FIXME - return Registry.modules[type].meta || {}; + exports.crawl(attrs, callback); } function assignPolarLayoutAttrs(layoutAttributes) { @@ -32618,68 +32569,25 @@ function assignPolarLayoutAttrs(layoutAttributes) { extendFlat(layoutAttributes, polarAxisAttrs.layout); - return layoutAttributes; // FIXME -} - -function getSubplotRegistry(traceType) { - if(traceType === 'area') return {}; // FIXME - - var subplotsRegistry = Registry.subplotsRegistry, - subplotType = Object.keys(subplotsRegistry).filter(function(subplotType) { - return Registry.traceIs({type: traceType}, subplotType); - })[0]; - - if(subplotType === undefined) return {}; - - return subplotsRegistry[subplotType]; -} - -function handleSubplotObjs(layoutAttributes) { - var subplotsRegistry = Registry.subplotsRegistry; - - Object.keys(layoutAttributes).forEach(function(k) { - Object.keys(subplotsRegistry).forEach(function(subplotType) { - var subplotRegistry = subplotsRegistry[subplotType], - isSubplotObj; - - if(!subplotRegistry.attrRegex) return; - - if(subplotType === 'cartesian' || subplotType === 'gl2d') { - isSubplotObj = ( - subplotRegistry.attrRegex.x.test(k) || - subplotRegistry.attrRegex.y.test(k) - ); - } - else { - isSubplotObj = subplotRegistry.attrRegex.test(k); - } - - if(isSubplotObj) layoutAttributes[k][Lib.IS_SUBPLOT_OBJ] = true; - }); - }); - return layoutAttributes; } -function handleLinkedToArray(layoutAttributes) { - - function callback(attr, attrName, attrs) { - if(attr[Lib.IS_LINKED_TO_ARRAY] !== true) return; - - // TODO more robust logic - var itemName = attrName.substr(0, attrName.length - 1); +function handleBasePlotModule(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep({}, _module.layoutAttributes); - delete attr[Lib.IS_LINKED_TO_ARRAY]; + attrs[IS_SUBPLOT_OBJ] = true; + np.set(attrs); +} - attrs[attrName] = { items: {} }; - attrs[attrName].items[itemName] = attr; - attrs[attrName].role = 'object'; - } +function handleRegisteredComponent(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep(np.get() || {}, _module.layoutAttributes); - Lib.crawl(layoutAttributes, callback); + np.set(attrs); } -},{"../lib":113,"../plotly":135,"../plots/plots":164,"../plots/polar/area_attributes":165,"../plots/polar/axis_attributes":166,"../registry":171}],130:[function(require,module,exports){ +},{"../lib":115,"../plots/animation_attributes":138,"../plots/attributes":140,"../plots/frame_attributes":163,"../plots/layout_attributes":164,"../plots/polar/area_attributes":167,"../plots/polar/axis_attributes":168,"../registry":173}],132:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -32771,10 +32679,14 @@ function registerTransformModule(newModule) { } function registerComponentModule(newModule) { - Registry.componentsRegistry[newModule.name] = newModule; + if(typeof newModule.name !== 'string') { + throw new Error('Component module *name* must be a string.'); + } + + Registry.registerComponent(newModule); } -},{"../lib":113,"../registry":171}],131:[function(require,module,exports){ +},{"../lib":115,"../registry":173}],133:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -32800,7 +32712,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":113,"../plotly":135}],132:[function(require,module,exports){ +},{"../lib":115,"../plotly":137}],134:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33122,7 +33034,7 @@ exports.doModeBar = function(gd) { return Plots.previousPromises(gd); }; -},{"../components/color":23,"../components/drawing":47,"../components/modebar":70,"../components/titles":98,"../lib":113,"../plotly":135,"../plots/plots":164,"../registry":171}],133:[function(require,module,exports){ +},{"../components/color":23,"../components/drawing":46,"../components/modebar":69,"../components/titles":97,"../lib":115,"../plotly":137,"../plots/plots":166,"../registry":173}],135:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33177,7 +33089,7 @@ function toImage(gd, opts) { // first clone the GD so we can operate in a clean environment var clone = clonePlot(gd, {format: 'png', height: opts.height, width: opts.width}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -33232,7 +33144,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":113,"../plotly":135,"../snapshot/cloneplot":172,"../snapshot/helpers":175,"../snapshot/svgtoimg":177,"../snapshot/tosvg":179,"fast-isnumeric":10}],134:[function(require,module,exports){ +},{"../lib":115,"../plotly":137,"../snapshot/cloneplot":174,"../snapshot/helpers":177,"../snapshot/svgtoimg":179,"../snapshot/tosvg":181,"fast-isnumeric":10}],136:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33408,7 +33320,8 @@ function crawl(objIn, objOut, schema, list, base, path) { crawl(valIn, valOut, nestedSchema, list, base, p); } else if(nestedSchema.items && !isInfoArray && isArray(valIn)) { - var itemName = k.substr(0, k.length - 1), + var items = nestedSchema.items, + _nestedSchema = items[Object.keys(items)[0]], indexList = []; var j, _p; @@ -33416,8 +33329,7 @@ function crawl(objIn, objOut, schema, list, base, path) { // loop over valOut items while keeping track of their // corresponding input container index (given by _index) for(j = 0; j < valOut.length; j++) { - var _nestedSchema = nestedSchema.items[itemName], - _index = valOut[j]._index || j; + var _index = valOut[j]._index || j; _p = p.slice(); _p.push(_index); @@ -33602,7 +33514,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":113,"../plots/plots":164,"./plot_schema":129}],135:[function(require,module,exports){ +},{"../lib":115,"../plots/plots":166,"./plot_schema":131}],137:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33630,25 +33542,12 @@ exports.defaultConfig = require('./plot_api/plot_config'); exports.Plots = require('./plots/plots'); exports.Axes = require('./plots/cartesian/axes'); exports.Fx = require('./plots/cartesian/graph_interact'); - -// components -exports.Color = require('./components/color'); -exports.Drawing = require('./components/drawing'); -exports.Colorscale = require('./components/colorscale'); -exports.Colorbar = require('./components/colorbar'); -exports.ErrorBars = require('./components/errorbars'); -exports.Annotations = require('./components/annotations'); -exports.Shapes = require('./components/shapes'); -exports.Legend = require('./components/legend'); -exports.Images = require('./components/images'); -exports.UpdateMenus = require('./components/updatemenus'); -exports.Sliders = require('./components/sliders'); exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/annotations":21,"./components/color":23,"./components/colorbar":28,"./components/colorscale":38,"./components/drawing":47,"./components/errorbars":53,"./components/images":59,"./components/legend":67,"./components/modebar":70,"./components/shapes":91,"./components/sliders":97,"./components/updatemenus":103,"./plot_api/plot_api":127,"./plot_api/plot_config":128,"./plots/cartesian/axes":139,"./plots/cartesian/graph_interact":147,"./plots/plots":164}],136:[function(require,module,exports){ +},{"./components/modebar":69,"./plot_api/plot_api":129,"./plot_api/plot_config":130,"./plots/cartesian/axes":142,"./plots/cartesian/graph_interact":149,"./plots/plots":166}],138:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33750,7 +33649,76 @@ module.exports = { } }; -},{}],137:[function(require,module,exports){ +},{}],139:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var Lib = require('../lib'); + + +/** Convenience wrapper for making array container logic DRY and consistent + * + * @param {object} parentObjIn + * user input object where the container in question is linked + * (i.e. either a user trace object or the user layout object) + * + * @param {object} parentObjOut + * full object where the coerced container will be linked + * (i.e. either a full trace object or the full layout object) + * + * @param {object} opts + * options object: + * - name {string} + * name of the key linking the container in question + * - handleItemDefaults {function} + * defaults method to be called on each item in the array container in question + * + * Its arguments are: + * - itemIn {object} item in user layout + * - itemOut {object} item in full layout + * - parentObj {object} (as in closure) + * - opts {object} (as in closure) + * - itemOpts {object} + * - itemIsNotPlainObject {boolean} + * N.B. + * + * - opts is passed to handleItemDefaults so it can also store + * links to supplementary data (e.g. fullData for layout components) + * + */ +module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut, opts) { + var name = opts.name; + + var contIn = Array.isArray(parentObjIn[name]) ? parentObjIn[name] : [], + contOut = parentObjOut[name] = []; + + for(var i = 0; i < contIn.length; i++) { + var itemIn = contIn[i], + itemOut = {}, + itemOpts = {}; + + if(!Lib.isPlainObject(itemIn)) { + itemOpts.itemIsNotPlainObject = true; + itemIn = {}; + } + + opts.handleItemDefaults(itemIn, itemOut, parentObjOut, opts, itemOpts); + + itemOut._input = itemIn; + itemOut._index = i; + + contOut.push(itemOut); + } +}; + +},{"../lib":115}],140:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33833,7 +33801,7 @@ module.exports = { } }; -},{}],138:[function(require,module,exports){ +},{}],141:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33860,7 +33828,7 @@ module.exports = { } }; -},{}],139:[function(require,module,exports){ +},{}],142:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33882,6 +33850,15 @@ var Titles = require('../../components/titles'); var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); +var constants = require('../../constants/numerical'); +var FP_SAFE = constants.FP_SAFE; +var ONEAVGYEAR = constants.ONEAVGYEAR; +var ONEAVGMONTH = constants.ONEAVGMONTH; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + var axes = module.exports = {}; @@ -33899,43 +33876,88 @@ axes.getFromId = axisIds.getFromId; axes.getFromTrace = axisIds.getFromTrace; -// find the list of possible axes to reference with an xref or yref attribute -// and coerce it to that list -axes.coerceRef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = axLetter + 'ref', +/* + * find the list of possible axes to reference with an xref or yref attribute + * and coerce it to that list + * + * attr: the attribute we're generating a reference for. Should end in 'x' or 'y' + * but can be prefixed, like 'ax' for annotation's arrow x + * dflt: the default to coerce to, or blank to use the first axis (falling back on + * extraOption if there is no axis) + * extraOption: aside from existing axes with this letter, what non-axis value is allowed? + * Only required if it's different from `dflt` + */ +axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption) { + var axLetter = attr.charAt(attr.length - 1), + axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), + refAttr = attr + 'ref', attrDef = {}; + if(!dflt) dflt = axlist[0] || extraOption; + if(!extraOption) extraOption = dflt; + // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(['paper']), - dflt: dflt || axlist[0] || 'paper' + values: axlist.concat(extraOption ? [extraOption] : []), + dflt: dflt }; // xref, yref return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; -// todo: duplicated per github PR 610. Should be consolidated with axes.coerceRef. -// find the list of possible axes to reference with an axref or ayref attribute -// and coerce it to that list -axes.coerceARef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = 'a' + axLetter + 'ref', - attrDef = {}; +/* + * coerce position attributes (range-type) that can be either on axes or absolute + * (paper or pixel) referenced. The biggest complication here is that we don't know + * before looking at the axis whether the value must be a number or not (it may be + * a date string), so we can't use the regular valType='number' machinery + * + * axRef (string): the axis this position is referenced to, or: + * paper: fraction of the plot area + * pixel: pixels relative to some starting position + * attr (string): the attribute in containerOut we are coercing + * dflt (number): the default position, as a fraction or pixels. If the attribute + * is to be axis-referenced, this will be converted to an axis data value + * + * Also cleans the values, since the attribute definition itself has to say + * valType: 'any' to handle date axes. This allows us to accept: + * - for category axes: category names, and convert them here into serial numbers. + * Note that this will NOT work for axis range endpoints, because we don't know + * the category list yet (it's set by ax.makeCalcdata during calc) + * but it works for component (note, shape, images) positions. + * - for date axes: JS Dates or milliseconds, and convert to date strings + * - for other types: coerce them to numbers + */ +axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { + var pos, + newPos; - // data-ref annotations are not supported in gl2d yet + if(axRef === 'paper' || axRef === 'pixel') { + pos = coerce(attr, dflt); + } + else { + var ax = axes.getFromId(gd, axRef); - attrDef[refAttr] = { - valType: 'enumerated', - values: axlist.concat(['pixel']), - dflt: dflt || 'pixel' || axlist[0] - }; + dflt = ax.fraction2r(dflt); + pos = coerce(attr, dflt); - // axref, ayref - return Lib.coerce(containerIn, containerOut, attrDef, refAttr); + if(ax.type === 'category') { + // if position is given as a category name, convert it to a number + if(typeof pos === 'string' && (ax._categories || []).length) { + newPos = ax._categories.indexOf(pos); + containerOut[attr] = (newPos !== -1) ? dflt : newPos; + return; + } + } + else if(ax.type === 'date') { + containerOut[attr] = Lib.cleanDate(pos); + return; + } + } + // finally make sure we have a number (unless date type already returned a string) + containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; }; // empty out types for all axes containing these traces @@ -33961,14 +33983,16 @@ axes.counterLetter = function(id) { // incorporate a new minimum difference and first tick into // forced +// note that _forceTick0 is linearized, so needs to be turned into +// a range value for setting tick0 axes.minDtick = function(ax, newDiff, newFirst, allow) { // doesn't make sense to do forced min dTick on log or category axes, // and the plot itself may decide to cancel (ie non-grouped bars) if(['log', 'category'].indexOf(ax.type) !== -1 || !allow) { ax._minDtick = 0; } - // null means there's nothing there yet - else if(ax._minDtick === null) { + // undefined means there's nothing there yet + else if(ax._minDtick === undefined) { ax._minDtick = newDiff; ax._forceTick0 = newFirst; } @@ -33993,6 +34017,19 @@ axes.minDtick = function(ax, newDiff, newFirst, allow) { } }; +// Find the autorange for this axis +// +// assumes ax._min and ax._max have already been set by calling axes.expand +// using calcdata from all traces. These are arrays of: +// {val: calcdata value, pad: extra pixels beyond this value} +// +// Returns an array of [min, max]. These are calcdata for log and category axes +// and data for linear and date axes. +// +// TODO: we want to change log to data as well, but it's hard to do this +// maintaining backward compatibility. category will always have to use calcdata +// though, because otherwise values between categories (or outside all categories) +// would be impossible. axes.getAutoRange = function(ax) { var newRange = []; @@ -34011,7 +34048,12 @@ axes.getAutoRange = function(ax) { var j, minpt, maxpt, minbest, maxbest, dp, dv, mbest = 0, - axReverse = (ax.range && ax.range[1] < ax.range[0]); + axReverse = false; + + if(ax.range) { + var rng = ax.range.map(ax.r2l); + axReverse = rng[1] < rng[0]; + } // one-time setting to easily reverse the axis // when plotting from code @@ -34100,11 +34142,9 @@ axes.getAutoRange = function(ax) { } // maintain reversal - if(axReverse) { - newRange.reverse(); - } + if(axReverse) newRange.reverse(); - return newRange; + return newRange.map(ax.l2r || Number); }; axes.doAutoRange = function(ax) { @@ -34167,7 +34207,6 @@ axes.saveRangeInitial = function(gd, overwrite) { // (unless one end is overridden by tozero) // tozero: (boolean) make sure to include zero if axis is linear, // and make it a tight bound if possible -var FP_SAFE = Number.MAX_VALUE / 2; axes.expand = function(ax, data, options) { if(!(ax.autorange || ax._needsExpand) || !data) return; if(!ax._min) ax._min = []; @@ -34306,10 +34345,24 @@ axes.autoBin = function(data, ax, nbins, is2d) { } // piggyback off autotick code to make "nice" bin sizes - var dummyax = { - type: ax.type === 'log' ? 'linear' : ax.type, - range: [datamin, datamax] - }; + var dummyax; + if(ax.type === 'log') { + dummyax = { + type: 'linear', + range: [datamin, datamax], + r2l: Number + }; + } + else { + dummyax = { + type: ax.type, + // conversion below would be ax.c2r but that's only different from l2r + // for log, and this is the only place (so far?) we would want c2r. + range: [datamin, datamax].map(ax.l2r), + r2l: ax.r2l + }; + } + axes.autoTicks(dummyax, size0); var binstart = axes.tickIncrement( axes.tickFirst(dummyax), dummyax.dtick, 'reverse'), @@ -34373,8 +34426,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { } return { - start: binstart, - end: binend, + start: ax.c2r(binstart), + end: ax.c2r(binend), size: dummyax.dtick }; }; @@ -34391,6 +34444,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { axes.calcTicks = function calcTicks(ax) { if(ax.tickmode === 'array') return arrayTicks(ax); + var rng = ax.range.map(ax.r2l); + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks, @@ -34405,18 +34460,17 @@ axes.calcTicks = function calcTicks(ax) { nt = Lib.constrain(ax._length / minPx, 4, 9) + 1; } } - axes.autoTicks(ax, Math.abs(ax.range[1] - ax.range[0]) / nt); + axes.autoTicks(ax, Math.abs(rng[1] - rng[0]) / nt); // check for a forced minimum dtick if(ax._minDtick > 0 && ax.dtick < ax._minDtick * 2) { ax.dtick = ax._minDtick; - ax.tick0 = ax._forceTick0; + ax.tick0 = ax.l2r(ax._forceTick0); } } // check for missing tick0 if(!ax.tick0) { - ax.tick0 = (ax.type === 'date') ? - new Date(2000, 0, 1).getTime() : 0; + ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; } // now figure out rounding of tick values @@ -34426,12 +34480,12 @@ axes.calcTicks = function calcTicks(ax) { ax._tmin = axes.tickFirst(ax); // check for reversed axis - var axrev = (ax.range[1] < ax.range[0]); + var axrev = (rng[1] < rng[0]); // return the full set of tick vals var vals = [], // add a tiny bit so we get ticks which may have rounded out - endtick = ax.range[1] * 1.0001 - ax.range[0] * 0.0001; + endtick = rng[1] * 1.0001 - rng[0] * 0.0001; if(ax.type === 'category') { endtick = (axrev) ? Math.max(-0.5, endtick) : Math.min(ax._categories.length - 0.5, endtick); @@ -34449,9 +34503,18 @@ axes.calcTicks = function calcTicks(ax) { // show the exponent only on the last one ax._tmax = vals[vals.length - 1]; + // for showing date suffixes: ax._prevSuffix holds what we showed most + // recently. Start with it cleared and mark that we're in calcTicks (ie + // calculating a whole string of these so we should care what the previous + // suffix was!) + ax._prevSuffix = ''; + ax._inCalcTicks = true; + var ticksOut = new Array(vals.length); for(var i = 0; i < vals.length; i++) ticksOut[i] = axes.tickText(ax, vals[i]); + ax._inCalcTicks = false; + return ticksOut; }; @@ -34459,15 +34522,15 @@ function arrayTicks(ax) { var vals = ax.tickvals, text = ax.ticktext, ticksOut = new Array(vals.length), - r0expanded = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, - r1expanded = ax.range[1] * 1.0001 - ax.range[0] * 0.0001, + rng = ax.range.map(ax.r2l), + r0expanded = rng[0] * 1.0001 - rng[1] * 0.0001, + r1expanded = rng[1] * 1.0001 - rng[0] * 0.0001, tickMin = Math.min(r0expanded, r1expanded), tickMax = Math.max(r0expanded, r1expanded), vali, i, j = 0; - // without a text array, just format the given values as any other ticks // except with more precision to the numbers if(!Array.isArray(text)) text = []; @@ -34507,7 +34570,7 @@ function roundDTick(roughDTick, base, roundingSet) { // outputs (into ax): // tick0: starting point for ticks (not necessarily on the graph) // usually 0 for numeric (=10^0=1 for log) or jan 1, 2000 for dates -// dtick: the actual, nice round tick spacing, somewhat larger than roughDTick +// dtick: the actual, nice round tick spacing, usually a little larger than roughDTick // if the ticks are spaced linearly (linear scale, categories, // log with only full powers, date ticks < month), // this will just be a number @@ -34520,36 +34583,35 @@ axes.autoTicks = function(ax, roughDTick) { var base; if(ax.type === 'date') { - ax.tick0 = new Date(2000, 0, 1).getTime(); + ax.tick0 = '2000-01-01'; + // the criteria below are all based on the rough spacing we calculate + // being > half of the final unit - so precalculate twice the rough val + var roughX2 = 2 * roughDTick; - if(roughDTick > 15778800000) { - // years if roughDTick > 6mo - roughDTick /= 31557600000; + if(roughX2 > ONEAVGYEAR) { + roughDTick /= ONEAVGYEAR; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'M' + (12 * roundDTick(roughDTick, base, roundBase10)); } - else if(roughDTick > 1209600000) { - // months if roughDTick > 2wk - roughDTick /= 2629800000; + else if(roughX2 > ONEAVGMONTH) { + roughDTick /= ONEAVGMONTH; ax.dtick = 'M' + roundDTick(roughDTick, 1, roundBase24); } - else if(roughDTick > 43200000) { - // days if roughDTick > 12h - ax.dtick = roundDTick(roughDTick, 86400000, roundDays); + else if(roughX2 > ONEDAY) { + ax.dtick = roundDTick(roughDTick, ONEDAY, roundDays); // get week ticks on sunday - ax.tick0 = new Date(2000, 0, 2).getTime(); + // this will also move the base tick off 2000-01-01 if dtick is + // 2 or 3 days... but that's a weird enough case that we'll ignore it. + ax.tick0 = '2000-01-02'; } - else if(roughDTick > 1800000) { - // hours if roughDTick > 30m - ax.dtick = roundDTick(roughDTick, 3600000, roundBase24); + else if(roughX2 > ONEHOUR) { + ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } - else if(roughDTick > 30000) { - // minutes if roughDTick > 30sec - ax.dtick = roundDTick(roughDTick, 60000, roundBase60); + else if(roughX2 > ONEMIN) { + ax.dtick = roundDTick(roughDTick, ONEMIN, roundBase60); } - else if(roughDTick > 500) { - // seconds if roughDTick > 0.5sec - ax.dtick = roundDTick(roughDTick, 1000, roundBase60); + else if(roughX2 > ONESEC) { + ax.dtick = roundDTick(roughDTick, ONESEC, roundBase60); } else { // milliseconds @@ -34559,16 +34621,19 @@ axes.autoTicks = function(ax, roughDTick) { } else if(ax.type === 'log') { ax.tick0 = 0; + var rng = ax.range.map(ax.r2l); - // only show powers of 10 - if(roughDTick > 0.7) ax.dtick = Math.ceil(roughDTick); - else if(Math.abs(ax.range[1] - ax.range[0]) < 1) { + if(roughDTick > 0.7) { + // only show powers of 10 + ax.dtick = Math.ceil(roughDTick); + } + else if(Math.abs(rng[1] - rng[0]) < 1) { // span is less than one power of 10 - var nt = 1.5 * Math.abs((ax.range[1] - ax.range[0]) / roughDTick); + var nt = 1.5 * Math.abs((rng[1] - rng[0]) / roughDTick); // ticks on a linear scale, labeled fully - roughDTick = Math.abs(Math.pow(10, ax.range[1]) - - Math.pow(10, ax.range[0])) / nt; + roughDTick = Math.abs(Math.pow(10, rng[1]) - + Math.pow(10, rng[0])) / nt; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'L' + roundDTick(roughDTick, base, roundBase10); } @@ -34607,41 +34672,59 @@ axes.autoTicks = function(ax, roughDTick) { // for date ticks, the last date part to show (y,m,d,H,M,S) // or an integer # digits past seconds function autoTickRound(ax) { - var dtick = ax.dtick, - maxend; + var dtick = ax.dtick; ax._tickexponent = 0; - if(!isNumeric(dtick) && typeof dtick !== 'string') dtick = 1; + if(!isNumeric(dtick) && typeof dtick !== 'string') { + dtick = 1; + } - if(ax.type === 'category') ax._tickround = null; - else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { - if(ax.type === 'date') { - if(dtick >= 86400000) ax._tickround = 'd'; - else if(dtick >= 3600000) ax._tickround = 'H'; - else if(dtick >= 60000) ax._tickround = 'M'; - else if(dtick >= 1000) ax._tickround = 'S'; - else ax._tickround = 3 - Math.round(Math.log(dtick / 2) / Math.LN10); - } + if(ax.type === 'category') { + ax._tickround = null; + } + if(ax.type === 'date') { + // If tick0 is unusual, give tickround a bit more information + // not necessarily *all* the information in tick0 though, if it's really odd + // minimal string length for tick0: 'd' is 10, 'M' is 16, 'S' is 19 + // take off a leading minus (year < 0 so length is consistent) + var tick0ms = Lib.dateTime2ms(ax.tick0), + tick0str = Lib.ms2DateTime(tick0ms).replace(/^-/, ''), + tick0len = tick0str.length; + + if(String(dtick).charAt(0) === 'M') { + // any tick0 more specific than a year: alway show the full date + if(tick0len > 10 || tick0str.substr(5) !== '01-01') ax._tickround = 'd'; + // show the month unless ticks are full multiples of a year + else ax._tickround = (+(dtick.substr(1)) % 12 === 0) ? 'y' : 'm'; + } + else if((dtick >= ONEDAY && tick0len <= 10) || (dtick >= ONEDAY * 15)) ax._tickround = 'd'; + else if((dtick >= ONEMIN && tick0len <= 16) || (dtick >= ONEHOUR)) ax._tickround = 'M'; + else if((dtick >= ONESEC && tick0len <= 19) || (dtick >= ONEMIN)) ax._tickround = 'S'; else { - if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); - // 2 digits past largest digit of dtick - ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); + // of any two adjacent ticks, at least one will have the maximum fractional digits + // of all possible ticks - so take the max. length of tick0 and the next one + var tick1len = Lib.ms2DateTime(tick0ms + dtick).replace(/^-/, '').length; + ax._tickround = Math.max(tick0len, tick1len) - 20; + } + } + else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { + // linear or log (except D1, D2) + var rng = ax.range.map(ax.r2d || Number); + if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); + // 2 digits past largest digit of dtick + ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); - if(ax.type === 'log') { - maxend = Math.pow(10, Math.max(ax.range[0], ax.range[1])); - } - else maxend = Math.max(Math.abs(ax.range[0]), Math.abs(ax.range[1])); + var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); - var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { - if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { - ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); - } - else ax._tickexponent = rangeexp; + var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); + if(Math.abs(rangeexp) > 3) { + if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { + ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } + else ax._tickexponent = rangeexp; } } - else if(dtick.charAt(0) === 'M') ax._tickround = (dtick.length === 2) ? 'm' : 'y'; + // D1 or D2 (log) else ax._tickround = null; } @@ -34686,13 +34769,16 @@ axes.tickIncrement = function(x, dtick, axrev) { // calculate the first tick on an axis axes.tickFirst = function(ax) { - var axrev = ax.range[1] < ax.range[0], + var r2l = ax.r2l || Number, + rng = ax.range.map(r2l), + axrev = rng[1] < rng[0], sRound = axrev ? Math.floor : Math.ceil, // add a tiny extra bit to make sure we get ticks // that may have been rounded out - r0 = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, + r0 = rng[0] * 1.0001 - rng[1] * 0.0001, dtick = ax.dtick, - tick0 = ax.tick0; + tick0 = r2l(ax.tick0); + if(isNumeric(dtick)) { var tmin = sRound((r0 - tick0) / dtick) * dtick + tick0; @@ -34742,7 +34828,7 @@ axes.tickFirst = function(ax) { var yearFormat = d3.time.format('%Y'), monthFormat = d3.time.format('%b %Y'), dayFormat = d3.time.format('%b %-d'), - hourFormat = d3.time.format('%b %-d %Hh'), + yearMonthDayFormat = d3.time.format('%b %-d, %Y'), minuteFormat = d3.time.format('%H:%M'), secondFormat = d3.time.format(':%S'); @@ -34778,7 +34864,8 @@ axes.tickText = function(ax, x, hover) { i; if(arrayMode && Array.isArray(ax.ticktext)) { - var minDiff = Math.abs(ax.range[1] - ax.range[0]) / 10000; + var rng = ax.range.map(ax.r2l), + minDiff = Math.abs(rng[1] - rng[0]) / 10000; for(i = 0; i < ax.ticktext.length; i++) { if(Math.abs(x - ax.d2l(ax.tickvals[i])) < minDiff) break; } @@ -34833,10 +34920,12 @@ function tickTextObj(ax, x, text) { function formatDate(ax, out, hover, extraPrecision) { var x = out.x, tr = ax._tickround, + trOriginal = tr, d = new Date(x), // suffix completes the full date info, to be included - // with only the first tick - suffix = '', + // with only the first tick or if any info before what's + // shown has changed + suffix, tt; if(hover && ax.hoverformat) { tt = modDateFormat(ax.hoverformat, x); @@ -34849,34 +34938,40 @@ function formatDate(ax, out, hover, extraPrecision) { else { if(extraPrecision) { if(isNumeric(tr)) tr += 2; - else tr = {y: 'm', m: 'd', d: 'H', H: 'M', M: 'S', S: 2}[tr]; + else tr = {y: 'm', m: 'd', d: 'M', M: 'S', S: 2}[tr]; } if(tr === 'y') tt = yearFormat(d); else if(tr === 'm') tt = monthFormat(d); else { - if(x === ax._tmin && !hover) { - suffix = '
' + yearFormat(d); - } + if(tr === 'd') { + if(!hover) suffix = '
' + yearFormat(d); - if(tr === 'd') tt = dayFormat(d); - else if(tr === 'H') tt = hourFormat(d); + tt = dayFormat(d); + } else { - if(x === ax._tmin && !hover) { - suffix = '
' + dayFormat(d) + ', ' + yearFormat(d); - } + if(!hover) suffix = '
' + yearMonthDayFormat(d); tt = minuteFormat(d); if(tr !== 'M') { tt += secondFormat(d); if(tr !== 'S') { - tt += numFormat(mod(x / 1000, 1), ax, 'none', hover) + tt += numFormat(d3.round(mod(x / 1000, 1), 4), ax, 'none', hover) .substr(1); } } + else if(trOriginal === 'd') { + // for hover on axes with day ticks, minuteFormat (which + // only includes %H:%M) isn't enough, you want the date too + tt = dayFormat(d) + ' ' + tt; + } } } } - out.text = tt + suffix; + if(suffix && (!ax._inCalcTicks || (suffix !== ax._prevSuffix))) { + tt += suffix; + ax._prevSuffix = suffix; + } + out.text = tt; } function formatLog(ax, out, hover, extraPrecision, hideexp) { @@ -34968,7 +35063,7 @@ function numFormat(v, ax, fmtoverride, hover) { (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent // from what we calculate - range: ax.showexponent === 'none' ? ax.range : [0, v || 1] + range: ax.showexponent === 'none' ? ax.range.map(ax.r2d) : [0, v || 1] }; autoTickRound(ah); tickRound = (Number(ah._tickround) || 0) + 4; @@ -35216,8 +35311,9 @@ axes.makeClipPaths = function(gd) { // doTicks: draw ticks, grids, and tick labels // axid: 'x', 'y', 'x2' etc, // blank to do all, -// 'redraw' to force full redraw, and reset ax._r -// (stored range for use by zoom/pan) +// 'redraw' to force full redraw, and reset: +// ax._r (stored range for use by zoom/pan) +// ax._rl (stored linearized range for use by zoom/pan) // or can pass in an axis object directly axes.doTicks = function(gd, axid, skipTitle) { var fullLayout = gd._fullLayout, @@ -35255,7 +35351,10 @@ axes.doTicks = function(gd, axid, skipTitle) { return function() { if(!ax._id) return; var axDone = axes.doTicks(gd, ax._id); - if(axid === 'redraw') ax._r = ax.range.slice(); + if(axid === 'redraw') { + ax._r = ax.range.slice(); + ax._rl = ax._r.map(ax.r2l); + } return axDone; }; })); @@ -35273,9 +35372,6 @@ axes.doTicks = function(gd, axid, skipTitle) { } } - // in case a val turns into string somehow - ax.range = [+ax.range[0], +ax.range[1]]; - // set scaling to pixels ax.setScale(); @@ -35664,7 +35760,8 @@ axes.doTicks = function(gd, axid, skipTitle) { break; } } - var showZl = (ax.range[0] * ax.range[1] <= 0) && ax.zeroline && + var rng = ax.range.map(ax.r2l), + showZl = (rng[0] * rng[1] <= 0) && ax.zeroline && (ax.type === 'linear' || ax.type === '-') && gridvals.length && (hasBarsOrFill || clipEnds({x: 0}) || !ax.showline); var zl = zlcontainer.selectAll('path.' + zcls) @@ -35888,7 +35985,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { // rather than built-in % which gives a negative value for negative v function mod(v, d) { return ((v % d) + d) % d; } -},{"../../components/color":23,"../../components/drawing":47,"../../components/titles":98,"../../lib":113,"../../lib/svg_text_utils":125,"../../registry":171,"./axis_ids":142,"./layout_attributes":149,"./layout_defaults":150,"./set_convert":154,"d3":7,"fast-isnumeric":10}],140:[function(require,module,exports){ +},{"../../components/color":23,"../../components/drawing":46,"../../components/titles":97,"../../constants/numerical":103,"../../lib":115,"../../lib/svg_text_utils":127,"../../registry":173,"./axis_ids":145,"./layout_attributes":151,"./layout_defaults":152,"./set_convert":156,"d3":7,"fast-isnumeric":10}],143:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -35903,7 +36000,7 @@ function mod(v, d) { return ((v % d) + d) % d; } var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); -var cleanDatum = require('./clean_datum'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function autoType(array) { if(moreDates(array)) return 'date'; @@ -35945,7 +36042,7 @@ function moreDates(a) { return (dcnt > ncnt * 2); } -// are the (x,y)-values in td.data mostly text? +// are the (x,y)-values in gd.data mostly text? // require twice as many categories as numbers function category(a) { // test at most 1000 points @@ -35955,15 +36052,15 @@ function category(a) { ai; for(var i = 0; i < a.length; i += inc) { - ai = cleanDatum(a[Math.round(i)]); - if(isNumeric(ai)) curvenums++; + ai = a[Math.round(i)]; + if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; else if(typeof ai === 'string' && ai !== '' && ai !== 'None') curvecats++; } return curvecats > curvenums * 2; } -},{"../../lib":113,"./clean_datum":144,"fast-isnumeric":10}],141:[function(require,module,exports){ +},{"../../constants/numerical":103,"../../lib":115,"fast-isnumeric":10}],144:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36056,17 +36153,15 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var validRange = ( (containerIn.range || []).length === 2 && - isNumeric(containerIn.range[0]) && - isNumeric(containerIn.range[1]) + isNumeric(containerOut.r2l(containerIn.range[0])) && + isNumeric(containerOut.r2l(containerIn.range[1])) ); var autoRange = coerce('autorange', !validRange); if(autoRange) coerce('rangemode'); - var range = coerce('range', [-1, letter === 'x' ? 6 : 4]); - if(range[0] === range[1]) { - containerOut.range = [range[0] - 1, range[0] + 1]; - } - Lib.noneOrAll(containerIn.range, containerOut.range, [0, 1]); + + coerce('range'); + containerOut.cleanRange(); coerce('fixedrange'); @@ -36188,7 +36283,7 @@ function getFirstNonEmptyTrace(data, id, axLetter) { } } -},{"../../components/color/attributes":22,"../../lib":113,"../../registry":171,"./axis_autotype":140,"./axis_ids":142,"./category_order_defaults":143,"./layout_attributes":149,"./ordered_categories":151,"./set_convert":154,"./tick_label_defaults":155,"./tick_mark_defaults":156,"./tick_value_defaults":157,"fast-isnumeric":10,"tinycolor2":13}],142:[function(require,module,exports){ +},{"../../components/color/attributes":22,"../../lib":115,"../../registry":173,"./axis_autotype":143,"./axis_ids":145,"./category_order_defaults":146,"./layout_attributes":151,"./ordered_categories":153,"./set_convert":156,"./tick_label_defaults":157,"./tick_mark_defaults":158,"./tick_value_defaults":159,"fast-isnumeric":10,"tinycolor2":13}],145:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36310,7 +36405,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":113,"../../registry":171,"../plots":164,"./constants":145}],143:[function(require,module,exports){ +},{"../../lib":115,"../../registry":173,"../plots":166,"./constants":147}],146:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36344,46 +36439,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],144:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = require('fast-isnumeric'); - -var Lib = require('../../lib'); - - -/** - * cleanDatum: removes characters - * same replace criteria used in the grid.js:scrapeCol - * but also handling dates, numbers, and NaN, null, Infinity etc - */ -module.exports = function cleanDatum(c) { - try { - if(typeof c === 'object' && c !== null && c.getTime) { - return Lib.ms2DateTime(c); - } - if(typeof c !== 'string' && !isNumeric(c)) { - return ''; - } - c = c.toString().replace(/['"%,$# ]/g, ''); - } - catch(e) { - Lib.error(e, c); - } - - return c; -}; - -},{"../../lib":113,"fast-isnumeric":10}],145:[function(require,module,exports){ +},{}],147:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36407,14 +36463,6 @@ module.exports = { y: /^yaxis([2-9]|[1-9][0-9]+)?$/ }, - /** - * standardize all missing data in calcdata to use undefined - * never null or NaN. - * that way we can use !==undefined, or !== BADNUM, - * to test for real data - */ - BADNUM: undefined, - // axis match regular expression xAxisMatch: /^xaxis[0-9]*$/, yAxisMatch: /^yaxis[0-9]*$/, @@ -36458,10 +36506,15 @@ module.exports = { BENDPX: 1.5, // delay before a redraw (relayout) after smooth panning and zooming - REDRAWDELAY: 50 + REDRAWDELAY: 50, + + // last resort axis ranges for x, y, and date axes if we have no data + DFLTRANGEX: [-1, 6], + DFLTRANGEY: [-1, 4], + DFLTRANGEDATE: ['2000-01-01', '2001-01-01'], }; -},{}],146:[function(require,module,exports){ +},{}],148:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36562,11 +36615,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { return dragger; } - function forceNumbers(axRange) { - axRange[0] = Number(axRange[0]); - axRange[1] = Number(axRange[1]); - } - var dragOptions = { element: dragger, gd: gd, @@ -36677,7 +36725,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { .attr('d', 'M0,0Z'); clearSelect(); - for(var i = 0; i < allaxes.length; i++) forceNumbers(allaxes[i].range); } function clearSelect() { @@ -36768,16 +36815,16 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomAxRanges(axList, r0Fraction, r1Fraction) { var i, axi, - axRange; + axRangeLinear; for(i = 0; i < axList.length; i++) { axi = axList[i]; if(axi.fixedrange) continue; - axRange = axi.range; + axRangeLinear = axi.range.map(axi.r2l); axi.range = [ - axRange[0] + (axRange[1] - axRange[0]) * r0Fraction, - axRange[0] + (axRange[1] - axRange[0]) * r1Fraction + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r0Fraction), + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r1Fraction) ]; } } @@ -36831,7 +36878,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { verticalAlign: vAlign }) .on('edit', function(text) { - var v = ax.type === 'category' ? ax.c2l(text) : ax.d2l(text); + var v = ax.d2r(text); if(v !== undefined) { Plotly.relayout(gd, attrStr, v); } @@ -36891,10 +36938,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomWheelOneAxis(ax, centerFraction, zoom) { if(ax.fixedrange) return; - forceNumbers(ax.range); - var axRange = ax.range, + + var axRange = ax.range.map(ax.r2l), v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; - ax.range = [v0 + (axRange[0] - v0) * zoom, v0 + (axRange[1] - v0) * zoom]; + function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); } + ax.range = axRange.map(doZoom); } if(ew) { @@ -36942,7 +36990,10 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { for(var i = 0; i < axList.length; i++) { var axi = axList[i]; if(!axi.fixedrange) { - axi.range = [axi._r[0] - pix / axi._m, axi._r[1] - pix / axi._m]; + axi.range = [ + axi.l2r(axi._rl[0] - pix / axi._m), + axi.l2r(axi._rl[1] - pix / axi._m) + ]; } } } @@ -36965,23 +37016,29 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { 1 / (1 / Math.max(d, -0.3) + 3.222)); } - // dz: set a new value for one end (0 or 1) of an axis array ax, + // dz: set a new value for one end (0 or 1) of an axis array axArray, // and return a pixel shift for that end for the viewbox // based on pixel drag distance d // TODO: this makes (generally non-fatal) errors when you get // near floating point limits - function dz(ax, end, d) { + function dz(axArray, end, d) { var otherEnd = 1 - end, - movedi = 0; - for(var i = 0; i < ax.length; i++) { - var axi = ax[i]; + movedAx, + newLinearizedEnd; + for(var i = 0; i < axArray.length; i++) { + var axi = axArray[i]; if(axi.fixedrange) continue; - movedi = i; - axi.range[end] = axi._r[otherEnd] + - (axi._r[end] - axi._r[otherEnd]) / dZoom(d / axi._length); + movedAx = axi; + newLinearizedEnd = axi._rl[otherEnd] + + (axi._rl[end] - axi._rl[otherEnd]) / dZoom(d / axi._length); + var newEnd = axi.l2r(newLinearizedEnd); + + // if l2r comes back false or undefined, it means we've dragged off + // the end of valid ranges - so stop. + if(newEnd !== false && newEnd !== undefined) axi.range[end] = newEnd; } - return ax[movedi]._length * (ax[movedi]._r[end] - ax[movedi].range[end]) / - (ax[movedi]._r[end] - ax[movedi]._r[otherEnd]); + return movedAx._length * (movedAx._rl[end] - newLinearizedEnd) / + (movedAx._rl[end] - movedAx._rl[otherEnd]); } if(xActive === 'w') dx = dz(xa, 0, dx); @@ -37183,8 +37240,10 @@ function getEndText(ax, end) { diff = Math.abs(initialVal - ax.range[1 - end]), dig; + // TODO: this should basically be ax.r2d but we're doing extra + // rounding here... can we clean up at all? if(ax.type === 'date') { - return Lib.ms2DateTime(initialVal, diff); + return initialVal; } else if(ax.type === 'log') { dig = Math.ceil(Math.max(0, -Math.log(diff) / Math.LN10)) + 3; @@ -37218,7 +37277,7 @@ function isSelectOrLasso(dragmode) { return modes.indexOf(dragmode) !== -1; } -},{"../../components/color":23,"../../components/dragelement":45,"../../components/drawing":47,"../../lib":113,"../../lib/setcursor":123,"../../lib/svg_text_utils":125,"../../plotly":135,"../../registry":171,"./axes":139,"./constants":145,"./select":153,"d3":7,"tinycolor2":13}],147:[function(require,module,exports){ +},{"../../components/color":23,"../../components/dragelement":44,"../../components/drawing":46,"../../lib":115,"../../lib/setcursor":125,"../../lib/svg_text_utils":127,"../../plotly":137,"../../registry":173,"./axes":142,"./constants":147,"./select":155,"d3":7,"tinycolor2":13}],149:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -37244,6 +37303,7 @@ var dragElement = require('../../components/dragelement'); var Axes = require('./axes'); var constants = require('./constants'); var dragBox = require('./dragbox'); +var layoutAttributes = require('../layout_attributes'); var fx = module.exports = {}; @@ -37253,24 +37313,12 @@ var fx = module.exports = {}; fx.unhover = dragElement.unhover; fx.layoutAttributes = { - dragmode: { - valType: 'enumerated', - - values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], - dflt: 'zoom', - - }, - hovermode: { - valType: 'enumerated', - - values: ['x', 'y', 'closest', false], - - } }; fx.supplyLayoutDefaults = function(layoutIn, layoutOut, fullData) { + function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, fx.layoutAttributes, attr, dflt); + return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } coerce('dragmode'); @@ -38573,7 +38621,7 @@ fx.inbox = function(v0, v1) { return Infinity; }; -},{"../../components/color":23,"../../components/dragelement":45,"../../components/drawing":47,"../../lib":113,"../../lib/events":110,"../../lib/svg_text_utils":125,"./axes":139,"./constants":145,"./dragbox":146,"d3":7,"fast-isnumeric":10,"tinycolor2":13}],148:[function(require,module,exports){ +},{"../../components/color":23,"../../components/dragelement":44,"../../components/drawing":46,"../../lib":115,"../../lib/events":111,"../../lib/svg_text_utils":127,"../layout_attributes":164,"./axes":142,"./constants":147,"./dragbox":148,"d3":7,"fast-isnumeric":10,"tinycolor2":13}],150:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -38603,6 +38651,8 @@ exports.attrRegex = constants.attrRegex; exports.attributes = require('./attributes'); +exports.layoutAttributes = require('./layout_attributes'); + exports.transitionAxes = require('./transition_axes'); exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) { @@ -38945,7 +38995,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":113,"../plots":164,"./attributes":138,"./axes":139,"./constants":145,"./transition_axes":158,"d3":7}],149:[function(require,module,exports){ +},{"../../lib":115,"../plots":166,"./attributes":141,"./axes":142,"./constants":147,"./layout_attributes":151,"./transition_axes":160,"d3":7}],151:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -38981,8 +39031,8 @@ module.exports = { type: { valType: 'enumerated', // '-' means we haven't yet run autotype or couldn't find any data - // it gets turned into linear in td._fullLayout but not copied back - // to td.data like the others are. + // it gets turned into linear in gd._fullLayout but not copied back + // to gd.data like the others are. values: ['-', 'linear', 'log', 'date', 'category'], dflt: '-', @@ -39006,8 +39056,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -39033,14 +39083,12 @@ module.exports = { }, tick0: { - valType: 'number', - dflt: 0, + valType: 'any', }, dtick: { valType: 'any', - dflt: 1, }, @@ -39281,11 +39329,6 @@ module.exports = { }, - _nestedModules: { - 'rangeslider': 'rangeslider', - 'rangeselector': 'rangeselector', - }, - _deprecated: { autotick: { valType: 'boolean', @@ -39295,7 +39338,7 @@ module.exports = { } }; -},{"../../components/color/attributes":22,"../../lib/extend":111,"../font_attributes":160,"./constants":145}],150:[function(require,module,exports){ +},{"../../components/color/attributes":22,"../../lib/extend":112,"../font_attributes":162,"./constants":147}],152:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39469,7 +39512,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { }); }; -},{"../../components/color":23,"../../lib":113,"../../registry":171,"../layout_attributes":162,"./axis_defaults":141,"./axis_ids":142,"./constants":145,"./layout_attributes":149,"./position_defaults":152}],151:[function(require,module,exports){ +},{"../../components/color":23,"../../lib":115,"../../registry":173,"../layout_attributes":164,"./axis_defaults":144,"./axis_ids":145,"./constants":147,"./layout_attributes":151,"./position_defaults":154}],153:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39548,7 +39591,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":7}],152:[function(require,module,exports){ +},{"d3":7}],154:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39613,7 +39656,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":113,"fast-isnumeric":10}],153:[function(require,module,exports){ +},{"../../lib":115,"fast-isnumeric":10}],155:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39813,7 +39856,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":23,"../../lib/polygon":120,"./axes":139,"./constants":145}],154:[function(require,module,exports){ +},{"../../components/color":23,"../../lib/polygon":122,"./axes":142,"./constants":147}],156:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39829,27 +39872,38 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); +var numConstants = require('../../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var constants = require('./constants'); -var cleanDatum = require('./clean_datum'); var axisIds = require('./axis_ids'); /** - * Define the conversion functions for an axis data is used in 4 ways: + * Define the conversion functions for an axis data is used in 5 ways: * * d: data, in whatever form it's provided * c: calcdata: turned into numbers, but not linearized - * l: linearized - same as c except for log axes (and other - * mappings later?) this is used by ranges, and when we - * need to know if it's *possible* to show some data on - * this axis, without caring about the current range + * l: linearized - same as c except for log axes (and other nonlinear + * mappings later?) this is used when we need to know if it's + * *possible* to show some data on this axis, without caring about + * the current range * p: pixel value - mapped to the screen with current size and zoom + * r: ranges, tick0, and annotation positions match one of the above + * but are handled differently for different types: + * - linear and date: data format (d) + * - category: calcdata format (c), and will stay that way because + * the data format has no continuous mapping + * - log: linearized (l) format + * TODO: in v2.0 we plan to change it to data format. At that point + * shapes will work the same way as ranges, tick0, and annotations + * so they can use this conversion too. * - * Creates/updates these conversion functions + * Creates/updates these conversion functions, as well as cleaner functions: + * ax.d2d and ax.clean2r * also clears the autorange bounds ._min and ._max - * and the autotick constraints ._minDtick, ._forceTick0, - * and looks for date ranges that aren't yet in numeric format + * and the autotick constraints ._minDtick, ._forceTick0 */ module.exports = function setConvert(ax) { @@ -39869,20 +39923,119 @@ module.exports = function setConvert(ax) { return 0.5 * (r0 + r1 - 3 * clipMult * Math.abs(r0 - r1)); } - else return constants.BADNUM; + else return BADNUM; + } + + function fromLog(v) { + return Math.pow(10, v); + } + + function num(v) { + if(!isNumeric(v)) return BADNUM; + v = Number(v); + if(v < -FP_SAFE || v > FP_SAFE) return BADNUM; + return isNumeric(v) ? Number(v) : BADNUM; } - function fromLog(v) { return Math.pow(10, v); } - function num(v) { return isNumeric(v) ? Number(v) : constants.BADNUM; } ax.c2l = (ax.type === 'log') ? toLog : num; ax.l2c = (ax.type === 'log') ? fromLog : num; ax.l2d = function(v) { return ax.c2d(ax.l2c(v)); }; ax.p2d = function(v) { return ax.l2d(ax.p2l(v)); }; + /* + * fn to make sure range is a couplet of valid & distinct values + * keep numbers away from the limits of floating point numbers, + * and dates away from the ends of our date system (+/- 9999 years) + * + * optional param rangeAttr: operate on a different attribute, like + * ax._r, rather than ax.range + */ + ax.cleanRange = function(rangeAttr) { + if(!rangeAttr) rangeAttr = 'range'; + var range = ax[rangeAttr], + axLetter = (ax._id || 'x').charAt(0), + i, dflt; + + if(ax.type === 'date') dflt = constants.DFLTRANGEDATE; + else if(axLetter === 'y') dflt = constants.DFLTRANGEY; + else dflt = constants.DFLTRANGEX; + + // make sure we don't later mutate the defaults + dflt = dflt.slice(); + + if(!range || range.length !== 2) { + ax[rangeAttr] = dflt; + return; + } + + if(ax.type === 'date') { + // check if milliseconds or js date objects are provided for range + // and convert to date strings + range[0] = Lib.cleanDate(range[0]); + range[1] = Lib.cleanDate(range[1]); + } + + for(i = 0; i < 2; i++) { + if(ax.type === 'date') { + if(!Lib.isDateTime(range[i])) { + ax[rangeAttr] = dflt; + break; + } + + if(range[i] < Lib.MIN_MS) range[i] = Lib.MIN_MS; + if(range[i] > Lib.MAX_MS) range[i] = Lib.MAX_MS; + + if(ax.r2l(range[0]) === ax.r2l(range[1])) { + // split by +/- 1 second + var linCenter = Lib.constrain(ax.r2l(range[0]), + Lib.MIN_MS + 1000, Lib.MAX_MS - 1000); + range[0] = ax.l2r(linCenter - 1000); + range[1] = ax.l2r(linCenter + 1000); + break; + } + } + else { + if(!isNumeric(range[i])) { + if(isNumeric(range[1 - i])) { + range[i] = range[1 - i] * (i ? 10 : 0.1); + } + else { + ax[rangeAttr] = dflt; + break; + } + } + + if(range[i] < -FP_SAFE) range[i] = -FP_SAFE; + else if(range[i] > FP_SAFE) range[i] = FP_SAFE; + + if(range[0] === range[1]) { + // somewhat arbitrary: split by 1 or 1ppm, whichever is bigger + var inc = Math.max(1, Math.abs(range[0] * 1e-6)); + range[0] -= inc; + range[1] += inc; + } + } + } + }; + + // find the range value at the specified (linear) fraction of the axis + ax.fraction2r = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return ax.l2r(rl0 + v * (rl1 - rl0)); + }; + + // find the fraction of the range at the specified range value + ax.r2fraction = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return (ax.r2l(v) - rl0) / (rl1 - rl0); + }; + // set scaling to pixels ax.setScale = function(usePrivateRange) { var gs = ax._gd._fullLayout._size, - i; + axLetter = ax._id.charAt(0); // TODO cleaner way to handle this case if(!ax._categories) ax._categories = []; @@ -39898,40 +40051,23 @@ module.exports = function setConvert(ax) { // issue if we transform the drawn layer *and* use the new axis range to // draw the data. This allows us to construct setConvert using the pre- // interaction values of the range: - var range = (usePrivateRange && ax._r) ? ax._r : ax.range; - - // make sure we have a range (linearized data values) - // and that it stays away from the limits of javascript numbers - if(!range || range.length !== 2 || range[0] === range[1]) { - range = [-1, 1]; - } - for(i = 0; i < 2; i++) { - if(!isNumeric(range[i])) { - range[i] = isNumeric(range[1 - i]) ? - (range[1 - i] * (i ? 10 : 0.1)) : - (i ? 1 : -1); - } + var rangeAttr = (usePrivateRange && ax._r) ? '_r' : 'range'; + ax.cleanRange(rangeAttr); - if(range[i] < -(Number.MAX_VALUE / 2)) { - range[i] = -(Number.MAX_VALUE / 2); - } - else if(range[i] > Number.MAX_VALUE / 2) { - range[i] = Number.MAX_VALUE / 2; - } + var rl0 = ax.r2l(ax[rangeAttr][0]), + rl1 = ax.r2l(ax[rangeAttr][1]); - } - - if(ax._id.charAt(0) === 'y') { + if(axLetter === 'y') { ax._offset = gs.t + (1 - ax.domain[1]) * gs.h; ax._length = gs.h * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[0] - range[1]); - ax._b = -ax._m * range[1]; + ax._m = ax._length / (rl0 - rl1); + ax._b = -ax._m * rl1; } else { ax._offset = gs.l + ax.domain[0] * gs.w; ax._length = gs.w * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[1] - range[0]); - ax._b = -ax._m * range[0]; + ax._m = ax._length / (rl1 - rl0); + ax._b = -ax._m * rl0; } if(!isFinite(ax._m) || !isFinite(ax._b)) { @@ -39944,7 +40080,7 @@ module.exports = function setConvert(ax) { }; ax.l2p = function(v) { - if(!isNumeric(v)) return constants.BADNUM; + if(!isNumeric(v)) return BADNUM; // include 2 fractional digits on pixel, for PDF zooming etc return d3.round(ax._b + ax._m * v, 2); @@ -39955,42 +40091,62 @@ module.exports = function setConvert(ax) { ax.c2p = function(v, clip) { return ax.l2p(ax.c2l(v, clip)); }; ax.p2c = function(px) { return ax.l2c(ax.p2l(px)); }; + // clip doesn't do anything here yet, but in v2.0 when log axes get + // refactored it will... so including it now so we don't forget. + ax.r2p = function(v, clip) { return ax.l2p(ax.r2l(v, clip)); }; + ax.p2r = function(px) { return ax.l2r(ax.p2l(px)); }; + + ax.r2c = function(v) { return ax.l2c(ax.r2l(v)); }; + ax.c2r = function(v) { return ax.l2r(ax.c2l(v)); }; + if(['linear', 'log', '-'].indexOf(ax.type) !== -1) { ax.c2d = num; - ax.d2c = function(v) { - v = cleanDatum(v); - return isNumeric(v) ? Number(v) : constants.BADNUM; - }; - ax.d2l = function(v, clip) { - if(ax.type === 'log') return ax.c2l(ax.d2c(v), clip); - else return ax.d2c(v); - }; + ax.d2c = Lib.cleanNumber; + if(ax.type === 'log') { + ax.d2l = function(v, clip) { + return ax.c2l(ax.d2c(v), clip); + }; + ax.d2r = ax.d2l; + ax.r2d = ax.l2d; + } + else { + ax.d2l = Lib.cleanNumber; + ax.d2r = Lib.cleanNumber; + ax.r2d = num; + } + ax.r2l = num; + ax.l2r = num; } else if(ax.type === 'date') { - ax.c2d = function(v) { - return isNumeric(v) ? Lib.ms2DateTime(v) : constants.BADNUM; - }; + ax.c2d = Lib.ms2DateTime; ax.d2c = function(v) { - return (isNumeric(v)) ? Number(v) : Lib.dateTime2ms(v); + // NOTE: Changed this behavior: previously we took any numeric value + // to be a ms, even if it was a string that could be a bare year. + // Now we convert it as a date if at all possible, and only try + // as ms if that fails. + var ms = Lib.dateTime2ms(v); + if(ms === BADNUM) { + if(isNumeric(v)) ms = Number(v); + else return BADNUM; + } + return Lib.constrain(ms, Lib.MIN_MS, Lib.MAX_MS); }; ax.d2l = ax.d2c; - - // check if date strings or js date objects are provided for range - // and convert to ms - if(ax.range && ax.range.length > 1) { - try { - var ar1 = ax.range.map(Lib.dateTime2ms); - if(!isNumeric(ax.range[0]) && isNumeric(ar1[0])) { - ax.range[0] = ar1[0]; - } - if(!isNumeric(ax.range[1]) && isNumeric(ar1[1])) { - ax.range[1] = ar1[1]; - } - } - catch(e) { Lib.error(e, ax.range); } - } + ax.r2l = ax.d2c; + ax.l2r = ax.c2d; + ax.d2r = Lib.identity; + ax.r2d = Lib.identity; + ax.cleanr = function(v) { + /* + * If v is already a date string this is a noop, but running it + * through d2c and back validates the value: + * normalizes Date objects, milliseconds, and out-of-bounds dates + * so we always end up with either a clean date string or BADNUM + */ + return ax.c2d(ax.d2c(v)); + }; } else if(ax.type === 'category') { @@ -40013,38 +40169,42 @@ module.exports = function setConvert(ax) { } var c = ax._categories.indexOf(v); - return c === -1 ? constants.BADNUM : c; + return c === -1 ? BADNUM : c; }; ax.d2l = ax.d2c; + ax.r2l = num; + ax.l2r = num; + ax.d2r = ax.d2c; + ax.r2d = ax.c2d; } // makeCalcdata: takes an x or y array and converts it // to a position on the axis object "ax" // inputs: - // tdc - a data object from td.data - // axletter - a string, either 'x' or 'y', for which item + // trace - a data object from gd.data + // axLetter - a string, either 'x' or 'y', for which item // to convert (TODO: is this now always the same as // the first letter of ax._id?) // in case the expected data isn't there, make a list of // integers based on the opposite data - ax.makeCalcdata = function(tdc, axletter) { + ax.makeCalcdata = function(trace, axLetter) { var arrayIn, arrayOut, i; - if(axletter in tdc) { - arrayIn = tdc[axletter]; + if(axLetter in trace) { + arrayIn = trace[axLetter]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = ax.d2c(arrayIn[i]); } else { - var v0 = ((axletter + '0') in tdc) ? - ax.d2c(tdc[axletter + '0']) : 0, - dv = (tdc['d' + axletter]) ? - Number(tdc['d' + axletter]) : 1; + var v0 = ((axLetter + '0') in trace) ? + ax.d2c(trace[axLetter + '0']) : 0, + dv = (trace['d' + axLetter]) ? + Number(trace['d' + axLetter]) : 1; // the opposing data, for size if we have x and dx etc - arrayIn = tdc[{x: 'y', y: 'x'}[axletter]]; + arrayIn = trace[{x: 'y', y: 'x'}[axLetter]]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = v0 + i * dv; @@ -40059,11 +40219,11 @@ module.exports = function setConvert(ax) { ax._max = []; // and for bar charts and box plots: reset forced minimum tick spacing - ax._minDtick = null; - ax._forceTick0 = null; + delete ax._minDtick; + delete ax._forceTick0; }; -},{"../../lib":113,"./axis_ids":142,"./clean_datum":144,"./constants":145,"d3":7,"fast-isnumeric":10}],155:[function(require,module,exports){ +},{"../../constants/numerical":103,"../../lib":115,"./axis_ids":145,"./constants":147,"d3":7,"fast-isnumeric":10}],157:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40133,8 +40293,8 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe */ function getShowAttrDflt(containerIn) { var showAttrsAll = ['showexponent', - 'showtickprefix', - 'showticksuffix'], + 'showtickprefix', + 'showticksuffix'], showAttrs = showAttrsAll.filter(function(a) { return containerIn[a] !== undefined; }), @@ -40147,7 +40307,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":113}],156:[function(require,module,exports){ +},{"../../lib":115}],158:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40180,7 +40340,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":113,"./layout_attributes":149}],157:[function(require,module,exports){ +},{"../../lib":115,"./layout_attributes":151}],159:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40193,6 +40353,8 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, 'use strict'; var isNumeric = require('fast-isnumeric'); +var Lib = require('../../lib'); +var ONEDAY = require('../../constants/numerical').ONEDAY; module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType) { @@ -40204,15 +40366,56 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } if(Array.isArray(containerIn.tickvals)) tickmodeDefault = 'array'; - else if(containerIn.dtick && isNumeric(containerIn.dtick)) { + else if(containerIn.dtick) { tickmodeDefault = 'linear'; } var tickmode = coerce('tickmode', tickmodeDefault); if(tickmode === 'auto') coerce('nticks'); else if(tickmode === 'linear') { - coerce('tick0'); - coerce('dtick'); + // dtick is usually a positive number, but there are some + // special strings available for log or date axes + // default is 1 day for dates, otherwise 1 + var dtickDflt = (axType === 'date') ? ONEDAY : 1; + var dtick = coerce('dtick', dtickDflt); + if(isNumeric(dtick)) { + containerOut.dtick = (dtick > 0) ? Number(dtick) : dtickDflt; + } + else if(typeof dtick !== 'string') { + containerOut.dtick = dtickDflt; + } + else { + // date and log special cases are all one character plus a number + var prefix = dtick.charAt(0), + dtickNum = dtick.substr(1); + + dtickNum = isNumeric(dtickNum) ? Number(dtickNum) : 0; + if((dtickNum <= 0) || !( + // "M" gives ticks every (integer) n months + (axType === 'date' && prefix === 'M' && dtickNum === Math.round(dtickNum)) || + // "L" gives ticks linearly spaced in data (not in position) every (float) f + (axType === 'log' && prefix === 'L') || + // "D1" gives powers of 10 with all small digits between, "D2" gives only 2 and 5 + (axType === 'log' && prefix === 'D' && (dtickNum === 1 || dtickNum === 2)) + )) { + containerOut.dtick = dtickDflt; + } + } + + // tick0 can have different valType for different axis types, so + // validate that now. Also for dates, change milliseconds to date strings + var tick0Dflt = (axType === 'date') ? '2000-01-01' : 0; + var tick0 = coerce('tick0', tick0Dflt); + if(axType === 'date') { + containerOut.tick0 = Lib.cleanDate(tick0, tick0Dflt); + } + // Aside from date axes, dtick must be numeric; D1 and D2 modes ignore tick0 entirely + else if(isNumeric(tick0) && dtick !== 'D1' && dtick !== 'D2') { + containerOut.tick0 = Number(tick0); + } + else { + containerOut.tick0 = tick0Dflt; + } } else { var tickvals = coerce('tickvals'); @@ -40221,7 +40424,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"fast-isnumeric":10}],158:[function(require,module,exports){ +},{"../../constants/numerical":103,"../../lib":115,"fast-isnumeric":10}],160:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40533,7 +40736,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../lib":113,"../../plotly":135,"../../registry":171,"./axes":139,"d3":7}],159:[function(require,module,exports){ +},{"../../lib":115,"../../plotly":137,"../../registry":173,"./axes":142,"d3":7}],161:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40945,7 +41148,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":113,"../plotly":135}],160:[function(require,module,exports){ +},{"../lib":115,"../plotly":137}],162:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40976,7 +41179,7 @@ module.exports = { } }; -},{}],161:[function(require,module,exports){ +},{}],163:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41017,7 +41220,7 @@ module.exports = { } }; -},{}],162:[function(require,module,exports){ +},{}],164:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41159,28 +41362,22 @@ module.exports = { }, - _composedModules: { - '*': 'Fx' + dragmode: { + valType: 'enumerated', + + values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], + dflt: 'zoom', + }, - - _nestedModules: { - 'xaxis': 'Axes', - 'yaxis': 'Axes', - 'scene': 'gl3d', - 'geo': 'geo', - 'ternary': 'ternary', - 'mapbox': 'mapbox', - - 'legend': 'legend', - 'annotations': 'annotations', - 'shapes': 'shapes', - 'images': 'images', - 'updatemenus': 'updatemenus', - 'sliders': 'sliders' + hovermode: { + valType: 'enumerated', + + values: ['x', 'y', 'closest', false], + } }; -},{"../components/color/attributes":22,"../lib":113,"./font_attributes":160}],163:[function(require,module,exports){ +},{"../components/color/attributes":22,"../lib":115,"./font_attributes":162}],165:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41218,7 +41415,7 @@ module.exports = { } }; -},{}],164:[function(require,module,exports){ +},{}],166:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41585,6 +41782,9 @@ plots.sendDataToCloud = function(gd) { // gd._fullLayout._basePlotModules // is a list of all the plot modules required to draw the plot. // +// gd._fullLayout._transformModules +// is a list of all the transform modules invoked. +// plots.supplyDefaults = function(gd) { var oldFullLayout = gd._fullLayout || {}, newFullLayout = gd._fullLayout = {}, @@ -41596,6 +41796,9 @@ plots.supplyDefaults = function(gd) { var i; + // Create all the storage space for frames, but only if doesn't already exist + if(!gd._transitionData) plots.createTransitionData(gd); + // first fill in what we can of layout without looking at data // because fullData needs a few things from layout @@ -41656,7 +41859,7 @@ plots.supplyDefaults = function(gd) { } // finally, fill in the pieces of layout that may need to look at data - plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData); + plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData); // TODO remove in v2.0.0 // add has-plot-type refs to fullLayout for backward compatibility @@ -41695,12 +41898,6 @@ plots.supplyDefaults = function(gd) { (gd.calcdata[i][0] || {}).trace = trace; } } - - // Create all the storage space for frames, but only if doesn't already - // exist: - if(!gd._transitionData) { - plots.createTransitionData(gd); - } }; // Create storage for all of the data related to frames and transitions: @@ -41867,6 +42064,8 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) { basePlotModules = fullLayout._basePlotModules = [], cnt = 0; + fullLayout._transformModules = []; + function pushModule(fullTrace) { dataOut.push(fullTrace); @@ -42084,6 +42283,8 @@ function supplyTransformDefaults(traceIn, traceOut, layout) { transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn); transformOut.type = type; transformOut._module = _module; + + Lib.pushUnique(layout._transformModules, _module); } else { transformOut = Lib.extendFlat({}, transformIn); @@ -42253,7 +42454,7 @@ function calculateReservedMargins(margins) { return resultingMargin; } -plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { +plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, transitionData) { var i, _module; // can't be be part of basePlotModules loop @@ -42284,6 +42485,16 @@ plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { } } + // transform module layout defaults + var transformModules = layoutOut._transformModules; + for(i = 0; i < transformModules.length; i++) { + _module = transformModules[i]; + + if(_module.supplyLayoutDefaults) { + _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData, transitionData); + } + } + // should FX be a component? Plotly.Fx.supplyLayoutDefaults(layoutIn, layoutOut, fullData); @@ -42311,8 +42522,16 @@ plots.purge = function(gd) { // remove modebar if(fullLayout._modeBar) fullLayout._modeBar.destroy(); - if(gd._transitionData && gd._transitionData._animationRaf) { - window.cancelAnimationFrame(gd._transitionData._animationRaf); + if(gd._transitionData) { + // Ensure any dangling callbacks are simply dropped if the plot is purged. + // This is more or less only actually important for testing. + if(gd._transitionData._interruptCallbacks) { + gd._transitionData._interruptCallbacks.length = 0; + } + + if(gd._transitionData._animationRaf) { + window.cancelAnimationFrame(gd._transitionData._animationRaf); + } } // data and layout @@ -42589,9 +42808,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { // convert native dates to date strings... // mostly for external users exporting to plotly - if(d && d.getTime) { - return Lib.ms2DateTime(d); - } + if(Lib.isJSDate(d)) return Lib.ms2DateTime(+d); return d; } @@ -42636,7 +42853,7 @@ plots.modifyFrames = function(gd, operations) { break;*/ case 'replace': frame = op.value; - var oldName = _frames[op.index].name; + var oldName = (_frames[op.index] || {}).name; var newName = frame.name; _frames[op.index] = _hash[newName] = frame; @@ -42770,8 +42987,14 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { for(i = 0; i < containerPaths.length; i++) { containerProp = Lib.nestedProperty(expandedObj, containerPaths[i]); containerVal = containerProp.get(); - containerProp.set(null); - Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + + if(containerVal === undefined) { + Lib.nestedProperty(containerObj, containerPaths[i]).set(null); + } + else { + containerProp.set(null); + Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + } } } @@ -42785,15 +43008,20 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { if(!srcContainer) continue; destProp = Lib.nestedProperty(dest, containerPaths[i]); - destContainer = destProp.get(); + if(!Array.isArray(destContainer)) { destContainer = []; destProp.set(destContainer); } for(j = 0; j < srcContainer.length; j++) { - destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcContainer[j]); + var srcObj = srcContainer[j]; + + if(srcObj === null) destContainer[j] = null; + else { + destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcObj); + } } destProp.set(destContainer); @@ -42804,7 +43032,7 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { }; plots.dataArrayContainers = ['transforms']; -plots.layoutArrayContainers = ['annotations', 'shapes', 'images', 'sliders', 'updatemenus']; +plots.layoutArrayContainers = Registry.layoutArrayContainers; /* * Extend a trace definition. This method: @@ -42863,11 +43091,15 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var trace = gd._fullData[traceIdx]; var module = trace._module; - if(!module || !module.animatable) { - continue; - } + // There's nothing to do if this module is not defined: + if(!module) continue; - transitionedTraces.push(traceIdx); + // Don't register the trace as transitioned if it doens't know what to do. + // If it *is* registered, it will receive a callback that it's responsible + // for calling in order to register the transition as having completed. + if(module.animatable) { + transitionedTraces.push(traceIdx); + } gd.data[traceIndices[i]] = plots.extendTrace(gd.data[traceIndices[i]], data[i]); } @@ -42921,6 +43153,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var aborted = false; function executeTransitions() { + + gd.emit('plotly_transitioning', []); + return new Promise(function(resolve) { // This flag is used to disabled things like autorange: gd._transitioning = true; @@ -43005,6 +43240,11 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function completeTransition(callback) { + // This a simple workaround for tests which purge the graph before animations + // have completed. That's not a very common case, so this is the simplest + // fix. + if(!gd._transitionData) return; + flushCallbacks(gd._transitionData._interruptCallbacks); return Promise.resolve().then(function() { @@ -43022,6 +43262,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function interruptPreviousTransitions() { + // Fail-safe against purged plot: + if(!gd._transitionData) return; + // If a transition is interrupted, set this to false. At the moment, the only thing that would // interrupt a transition is another transition, so that it will momentarily be set to true // again, but this determines whether autorange or dragbox work, so it's for the sake of @@ -43049,13 +43292,13 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var seq = [plots.previousPromises, interruptPreviousTransitions, prepareTransitions, executeTransitions]; - var transitionStarting = Lib.syncOrAsync(seq, gd); - if(!transitionStarting || !transitionStarting.then) transitionStarting = Promise.resolve(); + if(!transitionStarting || !transitionStarting.then) { + transitionStarting = Promise.resolve(); + } return transitionStarting.then(function() { - gd.emit('plotly_transitioning', []); return gd; }); }; @@ -43158,7 +43401,7 @@ plots.doCalcdata = function(gd, traces) { } }; -},{"../components/color":23,"../components/errorbars":53,"../lib":113,"../plotly":135,"../registry":171,"./animation_attributes":136,"./attributes":137,"./command":159,"./font_attributes":160,"./frame_attributes":161,"./layout_attributes":162,"d3":7,"fast-isnumeric":10}],165:[function(require,module,exports){ +},{"../components/color":23,"../components/errorbars":52,"../lib":115,"../plotly":137,"../registry":173,"./animation_attributes":138,"./attributes":140,"./command":161,"./font_attributes":162,"./frame_attributes":163,"./layout_attributes":164,"d3":7,"fast-isnumeric":10}],167:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43183,7 +43426,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":205}],166:[function(require,module,exports){ +},{"../../traces/scatter/attributes":207}],168:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43298,7 +43541,7 @@ module.exports = { } }; -},{"../../lib/extend":111,"../cartesian/layout_attributes":149}],167:[function(require,module,exports){ +},{"../../lib/extend":112,"../cartesian/layout_attributes":151}],169:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43313,7 +43556,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":168,"./micropolar_manager":169}],168:[function(require,module,exports){ +},{"./micropolar":170,"./micropolar_manager":171}],170:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44732,7 +44975,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":113,"d3":7}],169:[function(require,module,exports){ +},{"../../lib":115,"d3":7}],171:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44818,7 +45061,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":23,"../../lib":113,"./micropolar":168,"./undo_manager":170,"d3":7}],170:[function(require,module,exports){ +},{"../../components/color":23,"../../lib":115,"./micropolar":170,"./undo_manager":172,"d3":7}],172:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44884,7 +45127,7 @@ module.exports = function UndoManager() { }; }; -},{}],171:[function(require,module,exports){ +},{}],173:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44900,11 +45143,12 @@ var Lib = require('./lib'); var basePlotAttributes = require('./plots/attributes'); exports.modules = {}; -exports.allTypes = []; exports.allCategories = {}; +exports.allTypes = []; exports.subplotsRegistry = {}; exports.transformsRegistry = {}; exports.componentsRegistry = {}; +exports.layoutArrayContainers = []; /** * register a module as the handler for a trace type @@ -44970,6 +45214,16 @@ exports.registerSubplot = function(_module) { exports.subplotsRegistry[plotType] = _module; }; +exports.registerComponent = function(_module) { + var name = _module.name; + + exports.componentsRegistry[name] = _module; + + if(_module.layoutAttributes && _module.layoutAttributes._isLinkedToArray) { + Lib.pushUnique(exports.layoutArrayContainers, name); + } +}; + /** * Get registered module using trace object or trace type * @@ -45041,7 +45295,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib":113,"./plots/attributes":137}],172:[function(require,module,exports){ +},{"./lib":115,"./plots/attributes":140}],174:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45168,11 +45422,12 @@ module.exports = function clonePlot(graphObj, options) { } } - var td = document.createElement('div'); - if(options.tileClass) td.className = options.tileClass; + var gd = document.createElement('div'); + if(options.tileClass) gd.className = options.tileClass; var plotTile = { - td: td, + gd: gd, + td: gd, // for external (image server) compatibility layout: newLayout, data: newData, config: { @@ -45192,13 +45447,13 @@ module.exports = function clonePlot(graphObj, options) { plotTile.config.setBackground = options.setBackground || 'opaque'; } - // attaching the default Layout the td, so you can grab it later - plotTile.td.defaultLayout = cloneLayoutOverride(options.tileClass); + // attaching the default Layout the gd, so you can grab it later + plotTile.gd.defaultLayout = cloneLayoutOverride(options.tileClass); return plotTile; }; -},{"../lib":113,"../plots/plots":164}],173:[function(require,module,exports){ +},{"../lib":115,"../plots/plots":166}],175:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45264,7 +45519,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":113,"../plot_api/to_image":133,"./filesaver":174}],174:[function(require,module,exports){ +},{"../lib":115,"../plot_api/to_image":135,"./filesaver":176}],176:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45332,7 +45587,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],175:[function(require,module,exports){ +},{}],177:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45365,7 +45620,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],176:[function(require,module,exports){ +},{}],178:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45391,7 +45646,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":172,"./download":173,"./helpers":175,"./svgtoimg":177,"./toimage":178,"./tosvg":179}],177:[function(require,module,exports){ +},{"./cloneplot":174,"./download":175,"./helpers":177,"./svgtoimg":179,"./toimage":180,"./tosvg":181}],179:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45522,7 +45777,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":113,"events":9}],178:[function(require,module,exports){ +},{"../lib":115,"events":9}],180:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45555,7 +45810,7 @@ function toImage(gd, opts) { var ev = new EventEmitter(); var clone = clonePlot(gd, {format: 'png'}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -45602,7 +45857,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":113,"../plotly":135,"./cloneplot":172,"./helpers":175,"./svgtoimg":177,"./tosvg":179,"events":9}],179:[function(require,module,exports){ +},{"../lib":115,"../plotly":137,"./cloneplot":174,"./helpers":177,"./svgtoimg":179,"./tosvg":181,"events":9}],181:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45721,7 +45976,7 @@ module.exports = function toSVG(gd, format) { return s; }; -},{"../components/color":23,"../components/drawing":47,"../constants/xmlns_namespaces":105,"../lib/svg_text_utils":125,"d3":7}],180:[function(require,module,exports){ +},{"../components/color":23,"../components/drawing":46,"../constants/xmlns_namespaces":105,"../lib/svg_text_utils":127,"d3":7}],182:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45753,7 +46008,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":113}],181:[function(require,module,exports){ +},{"../../lib":115}],183:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45766,6 +46021,9 @@ module.exports = function arraysToCalcdata(cd) { var scatterAttrs = require('../scatter/attributes'); var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; var scatterMarkerAttrs = scatterAttrs.marker; @@ -45779,9 +46037,11 @@ var markerLine = extendFlat({}, { }, colorAttributes('marker.line')); var marker = extendFlat({}, { - showscale: scatterMarkerAttrs.showscale, line: markerLine -}, colorAttributes('marker')); +}, colorAttributes('marker'), { + showscale: scatterMarkerAttrs.showscale, + colorbar: colorbarAttrs +}); module.exports = { @@ -45830,11 +46090,8 @@ module.exports = { r: scatterAttrs.r, t: scatterAttrs.t, - _nestedModules: { // nested module coupling - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - }, + error_y: errorBarAttrs, + error_x: errorBarAttrs, _deprecated: { bardir: { @@ -45846,7 +46103,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":31,"../../lib/extend":111,"../scatter/attributes":205}],182:[function(require,module,exports){ +},{"../../components/colorbar/attributes":24,"../../components/colorscale/color_attributes":30,"../../components/errorbars/attributes":48,"../../lib/extend":112,"../scatter/attributes":207}],184:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45942,7 +46199,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":30,"../../components/colorscale/has_colorscale":37,"../../plots/cartesian/axes":139,"fast-isnumeric":10}],183:[function(require,module,exports){ +},{"../../components/colorscale/calc":29,"../../components/colorscale/has_colorscale":36,"../../plots/cartesian/axes":142,"fast-isnumeric":10}],185:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45987,7 +46244,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":23,"../../components/errorbars/defaults":52,"../../lib":113,"../bar/style_defaults":192,"../scatter/xy_defaults":227,"./attributes":181}],184:[function(require,module,exports){ +},{"../../components/color":23,"../../components/errorbars/defaults":51,"../../lib":115,"../bar/style_defaults":194,"../scatter/xy_defaults":229,"./attributes":183}],186:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46057,7 +46314,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { if(trace.orientation === 'h') { pointData.x0 = pointData.x1 = xa.c2p(di.x, true); - pointData.xLabelVal = di.s; + pointData.xLabelVal = di.b + di.s; pointData.y0 = ya.c2p(barPos(di) - barDelta, true); pointData.y1 = ya.c2p(barPos(di) + barDelta, true); @@ -46065,7 +46322,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } else { pointData.y0 = pointData.y1 = ya.c2p(di.y, true); - pointData.yLabelVal = di.s; + pointData.yLabelVal = di.b + di.s; pointData.x0 = xa.c2p(barPos(di) - barDelta, true); pointData.x1 = xa.c2p(barPos(di) + barDelta, true); @@ -46079,7 +46336,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return [pointData]; }; -},{"../../components/color":23,"../../components/errorbars":53,"../../plots/cartesian/graph_interact":147}],185:[function(require,module,exports){ +},{"../../components/color":23,"../../components/errorbars":52,"../../plots/cartesian/graph_interact":149}],187:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46115,7 +46372,7 @@ Bar.meta = { module.exports = Bar; -},{"../../plots/cartesian":148,"../scatter/colorbar":208,"./arrays_to_calcdata":180,"./attributes":181,"./calc":182,"./defaults":183,"./hover":184,"./layout_attributes":186,"./layout_defaults":187,"./plot":188,"./set_positions":189,"./style":191}],186:[function(require,module,exports){ +},{"../../plots/cartesian":150,"../scatter/colorbar":210,"./arrays_to_calcdata":182,"./attributes":183,"./calc":184,"./defaults":185,"./hover":186,"./layout_attributes":188,"./layout_defaults":189,"./plot":190,"./set_positions":191,"./style":193}],188:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46159,7 +46416,7 @@ module.exports = { } }; -},{}],187:[function(require,module,exports){ +},{}],189:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46217,7 +46474,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":113,"../../plots/cartesian/axes":139,"../../registry":171,"./layout_attributes":186}],188:[function(require,module,exports){ +},{"../../lib":115,"../../plots/cartesian/axes":142,"../../registry":173,"./layout_attributes":188}],190:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46338,7 +46595,7 @@ module.exports = function plot(gd, plotinfo, cdbar) { }; -},{"../../components/color":23,"../../components/errorbars":53,"../../lib":113,"./arrays_to_calcdata":180,"d3":7,"fast-isnumeric":10}],189:[function(require,module,exports){ +},{"../../components/color":23,"../../components/errorbars":52,"../../lib":115,"./arrays_to_calcdata":182,"d3":7,"fast-isnumeric":10}],191:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46826,8 +47083,8 @@ function stackBars(gd, sa, sieve) { if(!isNumeric(bar.s)) continue; // stack current bar and get previous sum - var barBase = sieve.put(bar.p, bar.s), - barTop = barBase + bar.s; + var barBase = sieve.put(bar.p, bar.b + bar.s), + barTop = barBase + bar.b + bar.s; // store the bar base and top in each calcdata item bar.b = barBase; @@ -46865,7 +47122,7 @@ function sieveBars(gd, sa, sieve) { for(var j = 0; j < trace.length; j++) { var bar = trace[j]; - if(isNumeric(bar.s)) sieve.put(bar.p, bar.s); + if(isNumeric(bar.s)) sieve.put(bar.p, bar.b + bar.s); } } } @@ -46934,7 +47191,7 @@ function getAxisLetter(ax) { return ax._id.charAt(0); } -},{"../../plots/cartesian/axes":139,"../../registry":171,"./sieve.js":190,"fast-isnumeric":10}],190:[function(require,module,exports){ +},{"../../plots/cartesian/axes":142,"../../registry":173,"./sieve.js":192,"fast-isnumeric":10}],192:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47035,7 +47292,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../lib":113}],191:[function(require,module,exports){ +},{"../../lib":115}],193:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47079,9 +47336,8 @@ module.exports = function style(gd) { var trace = d[0].trace, marker = trace.marker, markerLine = marker.line, - markerIn = (trace._input || {}).marker || {}, - markerScale = Drawing.tryColorscale(marker, markerIn, ''), - lineScale = Drawing.tryColorscale(marker, markerIn, 'line.'); + markerScale = Drawing.tryColorscale(marker, ''), + lineScale = Drawing.tryColorscale(marker, 'line'); d3.select(this).selectAll('path').each(function(d) { // allow all marker and marker line colors to be scaled @@ -47114,7 +47370,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/color":23,"../../components/drawing":47,"../../components/errorbars":53,"d3":7}],192:[function(require,module,exports){ +},{"../../components/color":23,"../../components/drawing":46,"../../components/errorbars":52,"d3":7}],194:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47151,7 +47407,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('marker.line.width'); }; -},{"../../components/color":23,"../../components/colorscale/defaults":33,"../../components/colorscale/has_colorscale":37}],193:[function(require,module,exports){ +},{"../../components/color":23,"../../components/colorscale/defaults":32,"../../components/colorscale/has_colorscale":36}],195:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47371,7 +47627,7 @@ module.exports = { } }; -},{"../../components/color/attributes":22,"../../lib/extend":111,"../../plots/attributes":137,"../../plots/font_attributes":160}],194:[function(require,module,exports){ +},{"../../components/color/attributes":22,"../../lib/extend":112,"../../plots/attributes":140,"../../plots/font_attributes":162}],196:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47418,7 +47674,7 @@ function getCdModule(calcdata, _module) { return cdModule; } -},{"../../registry":171}],195:[function(require,module,exports){ +},{"../../registry":173}],197:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47570,7 +47826,7 @@ function nextDefaultColor(index) { return pieDefaultColors[index % pieDefaultColors.length]; } -},{"../../components/color":23,"./helpers":197,"fast-isnumeric":10,"tinycolor2":13}],196:[function(require,module,exports){ +},{"../../components/color":23,"./helpers":199,"fast-isnumeric":10,"tinycolor2":13}],198:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47654,7 +47910,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pull'); }; -},{"../../lib":113,"./attributes":193}],197:[function(require,module,exports){ +},{"../../lib":115,"./attributes":195}],199:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47683,7 +47939,7 @@ exports.formatPieValue = function formatPieValue(v, separators) { return Lib.numSeparate(vRounded, separators); }; -},{"../../lib":113}],198:[function(require,module,exports){ +},{"../../lib":115}],200:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47715,7 +47971,7 @@ Pie.meta = { module.exports = Pie; -},{"./attributes":193,"./base_plot":194,"./calc":195,"./defaults":196,"./layout_attributes":199,"./layout_defaults":200,"./plot":201,"./style":202,"./style_one":203}],199:[function(require,module,exports){ +},{"./attributes":195,"./base_plot":196,"./calc":197,"./defaults":198,"./layout_attributes":201,"./layout_defaults":202,"./plot":203,"./style":204,"./style_one":205}],201:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47735,7 +47991,7 @@ module.exports = { hiddenlabels: {valType: 'data_array'} }; -},{}],200:[function(require,module,exports){ +},{}],202:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47757,7 +48013,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('hiddenlabels'); }; -},{"../../lib":113,"./layout_attributes":199}],201:[function(require,module,exports){ +},{"../../lib":115,"./layout_attributes":201}],203:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48452,7 +48708,7 @@ function maxExtent(tilt, tiltAxisFraction, depth) { 2 * Math.sqrt(1 - sinTilt * sinTilt * tiltAxisFraction * tiltAxisFraction)); } -},{"../../components/color":23,"../../components/drawing":47,"../../lib/svg_text_utils":125,"../../plots/cartesian/graph_interact":147,"./helpers":197,"d3":7}],202:[function(require,module,exports){ +},{"../../components/color":23,"../../components/drawing":46,"../../lib/svg_text_utils":127,"../../plots/cartesian/graph_interact":149,"./helpers":199,"d3":7}],204:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48481,7 +48737,7 @@ module.exports = function style(gd) { }); }; -},{"./style_one":203,"d3":7}],203:[function(require,module,exports){ +},{"./style_one":205,"d3":7}],205:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48508,7 +48764,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":23}],204:[function(require,module,exports){ +},{"../../components/color":23}],206:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48546,7 +48802,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":113}],205:[function(require,module,exports){ +},{"../../lib":115}],207:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48558,11 +48814,11 @@ module.exports = function arraysToCalcdata(cd) { 'use strict'; var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var Drawing = require('../../components/drawing'); - var constants = require('./constants'); - var extendFlat = require('../../lib/extend').extendFlat; module.exports = { @@ -48738,12 +48994,15 @@ module.exports = { }, + showscale: { valType: 'boolean', dflt: false, }, + colorbar: colorbarAttrs, + line: extendFlat({}, { width: { valType: 'number', @@ -48791,6 +49050,7 @@ module.exports = { }, }, + r: { valType: 'data_array', @@ -48799,14 +49059,12 @@ module.exports = { valType: 'data_array', }, - _nestedModules: { // nested module coupling - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_y: errorBarAttrs, + error_x: errorBarAttrs }; -},{"../../components/colorscale/color_attributes":31,"../../components/drawing":47,"../../lib/extend":111,"./constants":210}],206:[function(require,module,exports){ +},{"../../components/colorbar/attributes":24,"../../components/colorscale/color_attributes":30,"../../components/drawing":46,"../../components/errorbars/attributes":48,"../../lib/extend":112,"./constants":212}],208:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48937,7 +49195,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":113,"../../plots/cartesian/axes":139,"./colorscale_calc":209,"./subtypes":225,"fast-isnumeric":10}],207:[function(require,module,exports){ +},{"../../lib":115,"../../plots/cartesian/axes":142,"./colorscale_calc":211,"./subtypes":227,"fast-isnumeric":10}],209:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48976,7 +49234,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],208:[function(require,module,exports){ +},{}],210:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49033,7 +49291,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":26,"../../components/colorscale":38,"../../lib":113,"../../plots/plots":164,"fast-isnumeric":10}],209:[function(require,module,exports){ +},{"../../components/colorbar/draw":26,"../../components/colorscale":37,"../../lib":115,"../../plots/plots":166,"fast-isnumeric":10}],211:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49066,7 +49324,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":30,"../../components/colorscale/has_colorscale":37,"./subtypes":225}],210:[function(require,module,exports){ +},{"../../components/colorscale/calc":29,"../../components/colorscale/has_colorscale":36,"./subtypes":227}],212:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49082,7 +49340,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],211:[function(require,module,exports){ +},{}],213:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49162,7 +49420,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":52,"../../lib":113,"./attributes":205,"./constants":210,"./fillcolor_defaults":212,"./line_defaults":216,"./line_shape_defaults":218,"./marker_defaults":221,"./subtypes":225,"./text_defaults":226,"./xy_defaults":227}],212:[function(require,module,exports){ +},{"../../components/errorbars/defaults":51,"../../lib":115,"./attributes":207,"./constants":212,"./fillcolor_defaults":214,"./line_defaults":218,"./line_shape_defaults":220,"./marker_defaults":223,"./subtypes":227,"./text_defaults":228,"./xy_defaults":229}],214:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49200,7 +49458,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":23}],213:[function(require,module,exports){ +},{"../../components/color":23}],215:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49253,7 +49511,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":23,"./subtypes":225}],214:[function(require,module,exports){ +},{"../../components/color":23,"./subtypes":227}],216:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49422,7 +49680,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":23,"../../components/errorbars":53,"../../lib":113,"../../plots/cartesian/constants":145,"../../plots/cartesian/graph_interact":147,"./get_trace_color":213}],215:[function(require,module,exports){ +},{"../../components/color":23,"../../components/errorbars":52,"../../lib":115,"../../plots/cartesian/constants":147,"../../plots/cartesian/graph_interact":149,"./get_trace_color":215}],217:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49466,7 +49724,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":148,"./arrays_to_calcdata":204,"./attributes":205,"./calc":206,"./clean_data":207,"./colorbar":208,"./defaults":211,"./hover":214,"./plot":222,"./select":223,"./style":224,"./subtypes":225}],216:[function(require,module,exports){ +},{"../../plots/cartesian":150,"./arrays_to_calcdata":206,"./attributes":207,"./calc":208,"./clean_data":209,"./colorbar":210,"./defaults":213,"./hover":216,"./plot":224,"./select":225,"./style":226,"./subtypes":227}],218:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49499,7 +49757,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce('line.dash'); }; -},{"../../components/colorscale/defaults":33,"../../components/colorscale/has_colorscale":37}],217:[function(require,module,exports){ +},{"../../components/colorscale/defaults":32,"../../components/colorscale/has_colorscale":36}],219:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49511,7 +49769,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, 'use strict'; -var Axes = require('../../plots/cartesian/axes'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function linePoints(d, opts) { @@ -49522,7 +49780,6 @@ module.exports = function linePoints(d, opts) { baseTolerance = opts.baseTolerance, linear = opts.linear, segments = [], - badnum = Axes.BADNUM, minTolerance = 0.2, // fraction of tolerance "so close we don't even consider it a new point" pts = new Array(d.length), pti = 0, @@ -49559,7 +49816,7 @@ module.exports = function linePoints(d, opts) { function getPt(index) { var x = xa.c2p(d[index].x), y = ya.c2p(d[index].y); - if(x === badnum || y === badnum) return false; + if(x === BADNUM || y === BADNUM) return false; return [x, y]; } @@ -49673,7 +49930,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../plots/cartesian/axes":139}],218:[function(require,module,exports){ +},{"../../constants/numerical":103}],220:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49692,7 +49949,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],219:[function(require,module,exports){ +},{}],221:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49733,7 +49990,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],220:[function(require,module,exports){ +},{}],222:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49775,7 +50032,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":10}],221:[function(require,module,exports){ +},{"fast-isnumeric":10}],223:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49835,7 +50092,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":23,"../../components/colorscale/defaults":33,"../../components/colorscale/has_colorscale":37,"./subtypes":225}],222:[function(require,module,exports){ +},{"../../components/color":23,"../../components/colorscale/defaults":32,"../../components/colorscale/has_colorscale":36,"./subtypes":227}],224:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50007,6 +50264,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.visible !== true) return; + transition(tr).style('opacity', trace.opacity); + // BUILD LINES AND FILLS var ownFillEl3, tonext; var ownFillDir = trace.fill.charAt(trace.fill.length - 1); @@ -50332,8 +50591,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { var xa = plotinfo.xaxis, ya = plotinfo.yaxis, - xr = d3.extent(xa.range.map(xa.l2c)), - yr = d3.extent(ya.range.map(ya.l2c)); + xr = d3.extent(xa.range.map(xa.r2l).map(xa.l2c)), + yr = d3.extent(ya.range.map(ya.r2l).map(ya.l2c)); var trace = cdscatter[0].trace; if(!subTypes.hasMarkers(trace)) return; @@ -50371,7 +50630,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":47,"../../components/errorbars":53,"../../lib":113,"../../lib/polygon":120,"./arrays_to_calcdata":204,"./line_points":217,"./link_traces":219,"./subtypes":225,"d3":7}],223:[function(require,module,exports){ +},{"../../components/drawing":46,"../../components/errorbars":52,"../../lib":115,"../../lib/polygon":122,"./arrays_to_calcdata":206,"./line_points":219,"./link_traces":221,"./subtypes":227,"d3":7}],225:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50443,7 +50702,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":225}],224:[function(require,module,exports){ +},{"./subtypes":227}],226:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50485,7 +50744,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":47,"../../components/errorbars":53,"d3":7}],225:[function(require,module,exports){ +},{"../../components/drawing":46,"../../components/errorbars":52,"d3":7}],227:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50521,7 +50780,7 @@ module.exports = { } }; -},{"../../lib":113}],226:[function(require,module,exports){ +},{"../../lib":115}],228:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50542,7 +50801,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":113}],227:[function(require,module,exports){ +},{"../../lib":115}],229:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. diff --git a/dist/plotly-basic.min.js b/dist/plotly-basic.min.js index c1f141e3d19..ba227c7b66a 100644 --- a/dist/plotly-basic.min.js +++ b/dist/plotly-basic.min.js @@ -1,26 +1,26 @@ /** -* plotly.js (basic - minified) v1.19.2 +* plotly.js (basic - minified) v1.20.0 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function t(e,n,r){function a(i,l){if(!n[i]){if(!e[i]){var s="function"==typeof require&&require;if(!l&&s)return s(i,!0);if(o)return o(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[i]={exports:{}};e[i][0].call(u.exports,function(t){var n=e[i][1][t];return a(n?n:t)},u,u.exports,t,e,n,r)}return n[i].exports}for(var o="function"==typeof require&&require,i=0;ie?1:t>=e?0:NaN}function o(t){return null===t?NaN:+t}function i(t){return!isNaN(t)}function l(t){return{left:function(e,n,r,a){for(arguments.length<3&&(r=0),arguments.length<4&&(a=e.length);r>>1;t(e[o],n)<0?r=o+1:a=o}return r},right:function(e,n,r,a){for(arguments.length<3&&(r=0),arguments.length<4&&(a=e.length);r>>1;t(e[o],n)>0?a=o:r=o+1}return r}}}function s(t){return t.length}function c(t){for(var e=1;t*e%1;)e*=10;return e}function u(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function f(){this._=Object.create(null)}function d(t){return(t+="")===_i||t[0]===wi?wi+t:t}function h(t){return(t+="")[0]===wi?t.slice(1):t}function p(t){return d(t)in this._}function g(t){return(t=d(t))in this._&&delete this._[t]}function v(){var t=[];for(var e in this._)t.push(h(e));return t}function m(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function x(){this._=Object.create(null)}function b(t){return t}function _(t,e,n){return function(){var r=n.apply(e,arguments);return r===e?t:r}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,r=ki.length;n=e&&(e=a+1);!(i=l[e])&&++e0&&(t=t.slice(0,l));var c=Di.get(t);return c&&(t=c,s=Q),l?e?a:r:e?k:o}function W(t,e){return function(n){var r=ui.event;ui.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{ui.event=r}}}function Q(t,e){var n=W(t,e);return function(t){var e=this,r=t.relatedTarget;r&&(r===e||8&r.compareDocumentPosition(e))||n.call(e,t)}}function $(t){var n=".dragsuppress-"+ ++Ni,a="click"+n,o=ui.select(r(t)).on("touchmove"+n,T).on("dragstart"+n,T).on("selectstart"+n,T);if(null==Ei&&(Ei=!("onselectstart"in t)&&w(t.style,"userSelect")),Ei){var i=e(t).style,l=i[Ei];i[Ei]="none"}return function(t){if(o.on(n,null),Ei&&(i[Ei]=l),t){var e=function(){o.on(a,null)};o.on(a,function(){T(),e()},!0),setTimeout(e,0)}}}function J(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var a=n.createSVGPoint();if(Ii<0){var o=r(t);if(o.scrollX||o.scrollY){n=ui.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var i=n[0][0].getScreenCTM();Ii=!(i.f||i.e),n.remove()}}return Ii?(a.x=e.pageX,a.y=e.pageY):(a.x=e.clientX,a.y=e.clientY),a=a.matrixTransform(t.getScreenCTM().inverse()),[a.x,a.y]}var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}function K(){return ui.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function nt(t){return t>1?0:t<-1?Fi:Math.acos(t)}function rt(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function at(t){return((t=Math.exp(t))-1/t)/2}function ot(t){return((t=Math.exp(t))+1/t)/2}function it(t){return((t=Math.exp(2*t))-1)/(t+1)}function lt(t){return(t=Math.sin(t/2))*t}function st(){}function ct(t,e,n){return this instanceof ct?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof ct?new ct(t.h,t.s,t.l):kt(""+t,Mt,ct):new ct(t,e,n)}function ut(t,e,n){function r(t){return t>360?t-=360:t<0&&(t+=360),t<60?o+(i-o)*t/60:t<180?i:t<240?o+(i-o)*(240-t)/60:o}function a(t){return Math.round(255*r(t))}var o,i;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=n<0?0:n>1?1:n,i=n<=.5?n*(1+e):n+e-n*e,o=2*n-i,new xt(a(t+120),a(t),a(t-120))}function ft(t,e,n){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof ht?gt(t.l,t.a,t.b):gt((t=At((t=ui.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,n)}function dt(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new ht(n,Math.cos(t*=Vi)*e,Math.sin(t)*e)}function ht(t,e,n){return this instanceof ht?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof ht?new ht(t.l,t.a,t.b):t instanceof ft?dt(t.h,t.c,t.l):At((t=xt(t)).r,t.g,t.b):new ht(t,e,n)}function pt(t,e,n){var r=(t+16)/116,a=r+e/500,o=r-n/200;return a=vt(a)*tl,r=vt(r)*el,o=vt(o)*nl,new xt(yt(3.2404542*a-1.5371385*r-.4985314*o),yt(-.969266*a+1.8760108*r+.041556*o),yt(.0556434*a-.2040259*r+1.0572252*o))}function gt(t,e,n){return t>0?new ft(Math.atan2(n,e)*Yi,Math.sqrt(e*e+n*n),t):new ft(NaN,NaN,t)}function vt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function mt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function xt(t,e,n){return this instanceof xt?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof xt?new xt(t.r,t.g,t.b):kt(""+t,xt,ut):new xt(t,e,n)}function bt(t){return new xt(t>>16,t>>8&255,255&t)}function _t(t){return bt(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function kt(t,e,n){var r,a,o,i=0,l=0,s=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=r[2].split(","),r[1]){case"hsl":return n(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(Lt(a[0]),Lt(a[1]),Lt(a[2]))}return(o=ol.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(i=(3840&o)>>4,i=i>>4|i,l=240&o,l=l>>4|l,s=15&o,s=s<<4|s):7===t.length&&(i=(16711680&o)>>16,l=(65280&o)>>8,s=255&o)),e(i,l,s))}function Mt(t,e,n){var r,a,o=Math.min(t/=255,e/=255,n/=255),i=Math.max(t,e,n),l=i-o,s=(i+o)/2;return l?(a=s<.5?l/(i+o):l/(2-i-o),r=t==i?(e-n)/l+(e0&&s<1?0:r),new ct(r,a,s)}function At(t,e,n){t=Tt(t),e=Tt(e),n=Tt(n);var r=mt((.4124564*t+.3575761*e+.1804375*n)/tl),a=mt((.2126729*t+.7151522*e+.072175*n)/el),o=mt((.0193339*t+.119192*e+.9503041*n)/nl);return ht(116*a-16,500*(r-a),200*(a-o))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Lt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Ct(t){return"function"==typeof t?t:function(){return t}}function St(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),zt(e,n,t,r)}}function zt(t,e,n,r){function a(){var t,e=s.status;if(!e&&Pt(s)||e>=200&&e<300||304===e){try{t=n.call(o,s)}catch(t){return void i.error.call(o,t)}i.load.call(o,t)}else i.error.call(o,s)}var o={},i=ui.dispatch("beforesend","progress","load","error"),l={},s=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in s||!/^(http(s)?:)?\/\//.test(t)||(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=a:s.onreadystatechange=function(){s.readyState>3&&a()},s.onprogress=function(t){var e=ui.event;ui.event=t;try{i.progress.call(o,s)}finally{ui.event=e}},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?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return n=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(di(arguments)))}}),o.send=function(n,r,a){if(2===arguments.length&&"function"==typeof r&&(a=r,r=null),s.open(n,t,!0),null==e||"accept"in l||(l.accept=e+",*/*"),s.setRequestHeader)for(var u in l)s.setRequestHeader(u,l[u]);return null!=e&&s.overrideMimeType&&s.overrideMimeType(e),null!=c&&(s.responseType=c),null!=a&&o.on("error",a).on("load",function(t){a(null,t)}),i.beforesend.call(o,s),s.send(null==r?null:r),o},o.abort=function(){return s.abort(),o},ui.rebind(o,i,"on"),null==r?o:o.get(Ot(r))}function Ot(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}function Pt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Dt(t,e,n){var r=arguments.length;r<2&&(e=0),r<3&&(n=Date.now());var a=n+e,o={c:t,t:a,n:null};return ll?ll.n=o:il=o,ll=o,sl||(cl=clearTimeout(cl),sl=1,ul(Et)),o}function Et(){var t=Nt(),e=It()-t;e>24?(isFinite(e)&&(clearTimeout(cl),cl=setTimeout(Et,e)),sl=0):(sl=1,ul(Et))}function Nt(){for(var t=Date.now(),e=il;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function It(){for(var t,e=il,n=1/0;e;)e.c?(e.t8?function(t){return t/n}:function(t){return t*n},symbol:t}}function Ft(t){var e=t.decimal,n=t.thousands,r=t.grouping,a=t.currency,o=r&&n?function(t,e){for(var a=t.length,o=[],i=0,l=r[0],s=0;a>0&&l>0&&(s+l+1>e&&(l=Math.max(1,e-s)),o.push(t.substring(a-=l,a+l)),!((s+=l+1)>e));)l=r[i=(i+1)%r.length];return o.reverse().join(n)}:b;return function(t){var n=dl.exec(t),r=n[1]||" ",i=n[2]||">",l=n[3]||"-",s=n[4]||"",c=n[5],u=+n[6],f=n[7],d=n[8],h=n[9],p=1,g="",v="",m=!1,y=!0;switch(d&&(d=+d.substring(1)),(c||"0"===r&&"="===i)&&(c=r="0",i="="),h){case"n":f=!0,h="g";break;case"%":p=100,v="%",h="f";break;case"p":p=100,v="%",h="r";break;case"b":case"o":case"x":case"X":"#"===s&&(g="0"+h.toLowerCase());case"c":y=!1;case"d":m=!0,d=0;break;case"s":p=-1,h="r"}"$"===s&&(g=a[0],v=a[1]),"r"!=h||d||(h="g"),null!=d&&("g"==h?d=Math.max(1,Math.min(21,d)):"e"!=h&&"f"!=h||(d=Math.max(0,Math.min(20,d)))),h=hl.get(h)||Bt;var x=c&&f;return function(t){var n=v;if(m&&t%1)return"";var a=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===l?"":l;if(p<0){var s=ui.formatPrefix(t,d);t=s.scale(t),n=s.symbol+v}else t*=p;t=h(t,d);var b,_,w=t.lastIndexOf(".");if(w<0){var k=y?t.lastIndexOf("e"):-1;k<0?(b=t,_=""):(b=t.substring(0,k),_=t.substring(k))}else b=t.substring(0,w),_=e+t.substring(w+1);!c&&f&&(b=o(b,1/0));var M=g.length+b.length+_.length+(x?0:a.length),A=M"===i?A+a+t:"^"===i?A.substring(0,M>>=1)+a+t+A.substring(M):a+(x?t:A+t))+n}}}function Bt(t){return t+""}function qt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ht(t,e,n){function r(e){var n=t(e),r=o(n,1);return e-n1)for(;i=c)return-1;if(a=e.charCodeAt(l++),37===a){if(i=e.charAt(l++),o=S[i in ml?e.charAt(l++):i],!o||(r=o(t,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}function r(t,e,n){w.lastIndex=0;var r=w.exec(e.slice(n));return r?(t.w=k.get(r[0].toLowerCase()),n+r[0].length):-1}function a(t,e,n){b.lastIndex=0;var r=b.exec(e.slice(n));return r?(t.w=_.get(r[0].toLowerCase()),n+r[0].length):-1}function o(t,e,n){T.lastIndex=0;var r=T.exec(e.slice(n));return r?(t.m=L.get(r[0].toLowerCase()),n+r[0].length):-1}function i(t,e,n){M.lastIndex=0;var r=M.exec(e.slice(n));return r?(t.m=A.get(r[0].toLowerCase()),n+r[0].length):-1}function l(t,e,r){return n(t,C.c.toString(),e,r)}function s(t,e,r){return n(t,C.x.toString(),e,r)}function c(t,e,r){return n(t,C.X.toString(),e,r)}function u(t,e,n){var r=x.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)}var f=t.dateTime,d=t.date,h=t.time,p=t.periods,g=t.days,v=t.shortDays,m=t.months,y=t.shortMonths;e.utc=function(t){function n(t){try{gl=qt;var e=new gl;return e._=t,r(e)}finally{gl=Date}}var r=e(t);return n.parse=function(t){try{gl=qt;var e=r.parse(t);return e&&e._}finally{gl=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=ue;var x=ui.map(),b=Xt(g),_=Zt(g),w=Xt(v),k=Zt(v),M=Xt(m),A=Zt(m),T=Xt(y),L=Zt(y);p.forEach(function(t,e){x.set(t.toLowerCase(),e)});var C={a:function(t){return v[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return m[t.getMonth()]},c:e(f),d:function(t,e){return Ut(t.getDate(),e,2)},e:function(t,e){return Ut(t.getDate(),e,2)},H:function(t,e){return Ut(t.getHours(),e,2)},I:function(t,e){return Ut(t.getHours()%12||12,e,2)},j:function(t,e){return Ut(1+pl.dayOfYear(t),e,3)},L:function(t,e){return Ut(t.getMilliseconds(),e,3)},m:function(t,e){return Ut(t.getMonth()+1,e,2)},M:function(t,e){return Ut(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Ut(t.getSeconds(),e,2)},U:function(t,e){return Ut(pl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ut(pl.mondayOfYear(t),e,2)},x:e(d),X:e(h),y:function(t,e){return Ut(t.getFullYear()%100,e,2)},Y:function(t,e){return Ut(t.getFullYear()%1e4,e,4)},Z:se,"%":function(){return"%"}},S={a:r,A:a,b:o,B:i,c:l,d:ne,e:ne,H:ae,I:ae,j:re,L:le,m:ee,M:oe,p:u,S:ie,U:Wt,w:Gt,W:Qt,x:s,X:c,y:Jt,Y:$t,Z:Kt,"%":ce};return e}function Ut(t,e,n){var r=t<0?"-":"",a=(r?-t:t)+"",o=a.length;return r+(o68?1900:2e3)}function ee(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ne(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function re(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function ae(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function oe(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ie(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function le(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function se(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=bi(e)/60|0,a=bi(e)%60;return n+Ut(r,"0",2)+Ut(a,"0",2)}function ce(t,e,n){xl.lastIndex=0;var r=xl.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function ue(t){for(var e=t.length,n=-1;++n=0?1:-1,l=i*n,s=Math.cos(e),c=Math.sin(e),u=o*c,f=a*s+u*Math.cos(l),d=u*i*Math.sin(l);Al.add(Math.atan2(d,f)),r=t,a=s,o=c}var e,n,r,a,o;Tl.point=function(i,l){Tl.point=t,r=(e=i)*Vi,a=Math.cos(l=(n=l)*Vi/2+Fi/4),o=Math.sin(l)},Tl.lineEnd=function(){t(e,n)}}function me(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 be(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function ke(t){return[Math.atan2(t[1],t[0]),rt(t[2])]}function Me(t,e){return bi(t[0]-e[0])=0;--l)a.point((f=u[l])[0],f[1])}else r(h.x,h.p.x,-1,a);h=h.p}h=h.o,u=h.z,p=!p}while(!h.v);a.lineEnd()}}}function De(t){if(e=t.length){for(var e,n,r=0,a=t[0];++r0){for(_||(o.polygonStart(),_=!0),o.lineStart();++i1&&2&e&&n.push(n.pop().concat(n.shift())),h.push(n.filter(Ie))}var h,p,g,v=e(o),m=a.invert(r[0],r[1]),y={point:i,lineStart:s,lineEnd:c,polygonStart:function(){y.point=u,y.lineStart=f,y.lineEnd=d,h=[],p=[]},polygonEnd:function(){y.point=i,y.lineStart=s,y.lineEnd=c,h=ui.merge(h);var t=He(m,p);h.length?(_||(o.polygonStart(),_=!0),Pe(h,je,t,n,o)):t&&(_||(o.polygonStart(),_=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),_&&(o.polygonEnd(),_=!1),h=p=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}},x=Re(),b=e(x),_=!1;return y}}function Ie(t){return t.length>1}function Re(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:k,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function je(t,e){return((t=t.x)[0]<0?t[1]-Hi-Ri:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-Ri:Hi-e[1])}function Fe(t){var e,n=NaN,r=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,i){var l=o>0?Fi:-Fi,s=bi(o-n);bi(s-Fi)0?Hi:-Hi),t.point(a,r),t.lineEnd(),t.lineStart(),t.point(l,r),t.point(o,r),e=0):a!==l&&s>=Fi&&(bi(n-a)Ri?Math.atan((Math.sin(e)*(o=Math.cos(r))*Math.sin(n)-Math.sin(r)*(a=Math.cos(e))*Math.sin(t))/(a*o*i)):(e+r)/2}function qe(t,e,n,r){var a;if(null==t)a=n*Hi,r.point(-Fi,a),r.point(0,a),r.point(Fi,a),r.point(Fi,0),r.point(Fi,-a),r.point(0,-a),r.point(-Fi,-a),r.point(-Fi,0),r.point(-Fi,a);else if(bi(t[0]-e[0])>Ri){var o=t[0]=0?1:-1,k=w*_,M=k>Fi,A=p*x;if(Al.add(Math.atan2(A*w*Math.sin(k),g*b+A*Math.cos(k))),o+=M?_+w*Bi:_,M^d>=n^m>=n){var T=xe(me(f),me(t));we(T);var L=xe(a,T);we(L);var C=(M^_>=0?-1:1)*rt(L[2]);(r>C||r===C&&(T[0]||T[1]))&&(i+=M^_>=0?1:-1)}if(!v++)break;d=m,p=x,g=b,f=t}}return(o<-Ri||oo}function n(t){var n,o,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var h,p=[f,d],g=e(f,d),v=i?g?0:a(f,d):g?a(f+(f<0?Fi:-Fi),d):0;if(!n&&(c=s=g)&&t.lineStart(),g!==s&&(h=r(n,p),(Me(n,h)||Me(p,h))&&(p[0]+=Ri,p[1]+=Ri,g=e(p[0],p[1]))),g!==s)u=0,g?(t.lineStart(),h=r(p,n),t.point(h[0],h[1])):(h=r(n,p),t.point(h[0],h[1]),t.lineEnd()),n=h;else if(l&&n&&i^g){var m;v&o||!(m=r(p,n,!0))||(u=0,i?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||n&&Me(n,p)||t.point(p[0],p[1]),n=p,s=g,o=v},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return u|(c&&s)<<1}}}function r(t,e,n){var r=me(t),a=me(e),i=[1,0,0],l=xe(r,a),s=ye(l,l),c=l[0],u=s-c*c;if(!u)return!n&&t;var f=o*s/u,d=-o*c/u,h=xe(i,l),p=_e(i,f),g=_e(l,d);be(p,g);var v=h,m=ye(p,v),y=ye(v,v),x=m*m-y*(ye(p,p)-1);if(!(x<0)){var b=Math.sqrt(x),_=_e(v,(-m-b)/y);if(be(_,p),_=ke(_),!n)return _;var w,k=t[0],M=e[0],A=t[1],T=e[1];M0^_[1]<(bi(_[0]-k)Fi^(k<=_[0]&&_[0]<=M)){var z=_e(v,(-m+b)/y);return be(z,p),[_,ke(z)]}}}function a(e,n){var r=i?t:Fi-t,a=0;return e<-r?a|=1:e>r&&(a|=2),n<-r?a|=4:n>r&&(a|=8),a}var o=Math.cos(t),i=o>0,l=bi(o)>Ri,s=mn(t,6*Vi);return Ne(e,n,s,i?[0,-t]:[-Fi,t-Fi])}function Ye(t,e,n,r){return function(a){var o,i=a.a,l=a.b,s=i.x,c=i.y,u=l.x,f=l.y,d=0,h=1,p=u-s,g=f-c;if(o=t-s,p||!(o>0)){if(o/=p,p<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=n-s,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>d&&(d=o)}else if(p>0){if(o0)){if(o/=g,g<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=r-c,g||!(o<0)){if(o/=g,g<0){if(o>h)return;o>d&&(d=o)}else if(g>0){if(o0&&(a.a={x:s+d*p,y:c+d*g}),h<1&&(a.b={x:s+h*p,y:c+h*g}),a}}}}}}function Ue(t,e,n,r){function a(r,a){return bi(r[0]-t)0?0:3:bi(r[0]-n)0?2:1:bi(r[1]-e)0?1:0:a>0?3:2}function o(t,e){return i(t.x,e.x)}function i(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(l){function s(t){for(var e=0,n=v.length,r=t[1],a=0;ar&&et(c,o,t)>0&&++e:o[1]<=r&&et(c,o,t)<0&&--e,c=o;return 0!==e}function c(o,l,s,c){var u=0,f=0;if(null==o||(u=a(o,s))!==(f=a(l,s))||i(o,l)<0^s>0){do c.point(0===u||3===u?t:n,u>1?r:e);while((u=(u+s+4)%4)!==f)}else c.point(l[0],l[1])}function u(a,o){return t<=a&&a<=n&&e<=o&&o<=r}function f(t,e){u(t,e)&&l.point(t,e)}function d(){S.point=p,v&&v.push(m=[]),M=!0,k=!1,_=w=NaN}function h(){g&&(p(y,x),b&&k&&L.rejoin(),g.push(L.buffer())),S.point=f,k&&l.lineEnd()}function p(t,e){t=Math.max(-Bl,Math.min(Bl,t)),e=Math.max(-Bl,Math.min(Bl,e));var n=u(t,e);if(v&&m.push([t,e]),M)y=t,x=e,b=n,M=!1,n&&(l.lineStart(),l.point(t,e));else if(n&&k)l.point(t,e);else{var r={a:{x:_,y:w},b:{x:t,y:e}};C(r)?(k||(l.lineStart(),l.point(r.a.x,r.a.y)),l.point(r.b.x,r.b.y),n||l.lineEnd(),A=!1):n&&(l.lineStart(),l.point(t,e),A=!1)}_=t,w=e,k=n}var g,v,m,y,x,b,_,w,k,M,A,T=l,L=Re(),C=Ye(t,e,n,r),S={point:f,lineStart:d,lineEnd:h,polygonStart:function(){l=L,g=[],v=[],A=!0},polygonEnd:function(){l=T,g=ui.merge(g);var e=s([t,r]),n=A&&e,a=g.length;(n||a)&&(l.polygonStart(),n&&(l.lineStart(),c(null,null,1,l),l.lineEnd()),a&&Pe(g,o,e,c,l),l.polygonEnd()),g=v=m=null}};return S}}function Xe(t){var e=0,n=Fi/3,r=cn(t),a=r(e,n);return a.parallels=function(t){return arguments.length?r(e=t[0]*Fi/180,n=t[1]*Fi/180):[e/Fi*180,n/Fi*180]},a}function Ze(t,e){function n(t,e){var n=Math.sqrt(o-2*a*Math.sin(e))/a;return[n*Math.sin(t*=a),i-n*Math.cos(t)]}var r=Math.sin(t),a=(r+Math.sin(e))/2,o=1+r*(2*a-r),i=Math.sqrt(o)/a;return n.invert=function(t,e){var n=i-e;return[Math.atan2(t,n)/a,rt((o-(t*t+n*n)*a*a)/(2*a))]},n}function Ge(){function t(t,e){Hl+=a*t-r*e,r=t,a=e}var e,n,r,a;Zl.point=function(o,i){Zl.point=t,e=r=o,n=a=i},Zl.lineEnd=function(){t(e,n)}}function We(t,e){tUl&&(Ul=t),eXl&&(Xl=e)}function Qe(){function t(t,e){i.push("M",t,",",e,o)}function e(t,e){i.push("M",t,",",e),l.point=n}function n(t,e){i.push("L",t,",",e)}function r(){l.point=t}function a(){i.push("Z")}var o=$e(4.5),i=[],l={point:t,lineStart:function(){l.point=e},lineEnd:r,polygonStart:function(){l.lineEnd=a},polygonEnd:function(){l.lineEnd=r,l.point=t},pointRadius:function(t){return o=$e(t),l},result:function(){if(i.length){var t=i.join("");return i=[],t}}};return l}function $e(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Je(t,e){Sl+=t,zl+=e,++Ol}function Ke(){function t(t,r){var a=t-e,o=r-n,i=Math.sqrt(a*a+o*o);Pl+=i*(e+t)/2,Dl+=i*(n+r)/2,El+=i,Je(e=t,n=r)}var e,n;Wl.point=function(r,a){Wl.point=t,Je(e=r,n=a)}}function tn(){Wl.point=Je}function en(){function t(t,e){var n=t-r,o=e-a,i=Math.sqrt(n*n+o*o);Pl+=i*(r+t)/2,Dl+=i*(a+e)/2,El+=i,i=a*t-r*e,Nl+=i*(r+t),Il+=i*(a+e),Rl+=3*i,Je(r=t,a=e)}var e,n,r,a;Wl.point=function(o,i){Wl.point=t,Je(e=r=o,n=a=i)},Wl.lineEnd=function(){t(e,n)}}function nn(t){function e(e,n){t.moveTo(e+i,n),t.arc(e,n,i,0,Bi)}function n(e,n){t.moveTo(e,n),l.point=r}function r(e,n){t.lineTo(e,n)}function a(){l.point=e}function o(){t.closePath()}var i=4.5,l={point:e,lineStart:function(){l.point=n},lineEnd:a,polygonStart:function(){l.lineEnd=o},polygonEnd:function(){l.lineEnd=a,l.point=e},pointRadius:function(t){return i=t,l},result:k};return l}function rn(t){function e(t){return(l?r:n)(t)}function n(e){return ln(e,function(n,r){n=t(n,r),e.point(n[0],n[1])})}function r(e){function n(n,r){n=t(n,r),e.point(n[0],n[1])}function r(){x=NaN,M.point=o,e.lineStart()}function o(n,r){var o=me([n,r]),i=t(n,r);a(x,b,y,_,w,k,x=i[0],b=i[1],y=n,_=o[0],w=o[1],k=o[2],l,e),e.point(x,b)}function i(){M.point=n,e.lineEnd()}function s(){r(),M.point=c,M.lineEnd=u}function c(t,e){o(f=t,d=e),h=x,p=b,g=_,v=w,m=k,M.point=o}function u(){a(x,b,y,_,w,k,h,p,f,g,v,m,l,e),M.lineEnd=i,i()}var f,d,h,p,g,v,m,y,x,b,_,w,k,M={point:n,lineStart:r,lineEnd:i,polygonStart:function(){e.polygonStart(),M.lineStart=s},polygonEnd:function(){e.polygonEnd(),M.lineStart=r}};return M}function a(e,n,r,l,s,c,u,f,d,h,p,g,v,m){var y=u-e,x=f-n,b=y*y+x*x;if(b>4*o&&v--){var _=l+h,w=s+p,k=c+g,M=Math.sqrt(_*_+w*w+k*k),A=Math.asin(k/=M),T=bi(bi(k)-1)o||bi((y*z+x*O)/b-.5)>.3||l*h+s*p+c*g0&&16,e):Math.sqrt(o)},e}function an(t){var e=rn(function(e,n){return t([e*Yi,n*Yi])});return function(t){return un(e(t))}}function on(t){this.stream=t}function ln(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 sn(t){return cn(function(){return t})()}function cn(t){function e(t){return t=l(t[0]*Vi,t[1]*Vi),[t[0]*d+s,c-t[1]*d]}function n(t){return t=l.invert((t[0]-s)/d,(c-t[1])/d),t&&[t[0]*Yi,t[1]*Yi]}function r(){l=ze(i=hn(m,y,x),o);var t=o(g,v);return s=h-t[0]*d,c=p+t[1]*d,a()}function a(){return u&&(u.valid=!1,u=null),e}var o,i,l,s,c,u,f=rn(function(t,e){return t=o(t,e),[t[0]*d+s,c-t[1]*d]}),d=150,h=480,p=250,g=0,v=0,m=0,y=0,x=0,_=Fl,w=b,k=null,M=null;return e.stream=function(t){return u&&(u.valid=!1),u=un(_(i,f(w(t)))),u.valid=!0,u},e.clipAngle=function(t){return arguments.length?(_=null==t?(k=t,Fl):Ve((k=+t)*Vi),a()):k},e.clipExtent=function(t){return arguments.length?(M=t,w=t?Ue(t[0][0],t[0][1],t[1][0],t[1][1]):b,a()):M},e.scale=function(t){return arguments.length?(d=+t,r()):d},e.translate=function(t){return arguments.length?(h=+t[0],p=+t[1],r()):[h,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Vi,v=t[1]%360*Vi,r()):[g*Yi,v*Yi]},e.rotate=function(t){return arguments.length?(m=t[0]%360*Vi,y=t[1]%360*Vi,x=t.length>2?t[2]%360*Vi:0,r()):[m*Yi,y*Yi,x*Yi]},ui.rebind(e,f,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&n,r()}}function un(t){return ln(t,function(e,n){t.point(e*Vi,n*Vi)})}function fn(t,e){return[t,e]}function dn(t,e){return[t>Fi?t-Bi:t<-Fi?t+Bi:t,e]}function hn(t,e,n){return t?e||n?ze(gn(t),vn(e,n)):gn(t):e||n?vn(e,n):dn}function pn(t){return function(e,n){return e+=t,[e>Fi?e-Bi:e<-Fi?e+Bi:e,n]}}function gn(t){var e=pn(t);return e.invert=pn(-t),e}function vn(t,e){function n(t,e){var n=Math.cos(e),l=Math.cos(t)*n,s=Math.sin(t)*n,c=Math.sin(e),u=c*r+l*a;return[Math.atan2(s*o-u*i,l*r-c*a),rt(u*o+s*i)]}var r=Math.cos(t),a=Math.sin(t),o=Math.cos(e),i=Math.sin(e);return n.invert=function(t,e){var n=Math.cos(e),l=Math.cos(t)*n,s=Math.sin(t)*n,c=Math.sin(e),u=c*o-s*i;return[Math.atan2(s*o+c*i,l*r+u*a),rt(u*r-l*a)]},n}function mn(t,e){var n=Math.cos(t),r=Math.sin(t);return function(a,o,i,l){var s=i*e;null!=a?(a=yn(n,a),o=yn(n,o),(i>0?ao)&&(a+=i*Bi)):(a=t+i*Bi,o=t-.5*s);for(var c,u=a;i>0?u>o:u0?e<-Hi+Ri&&(e=-Hi+Ri):e>Hi-Ri&&(e=Hi-Ri);var n=i/Math.pow(a(e),o);return[n*Math.sin(o*t),i-n*Math.cos(o*t)]}var r=Math.cos(t),a=function(t){return Math.tan(Fi/4+t/2)},o=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(a(e)/a(t)),i=r*Math.pow(a(t),o)/o;return o?(n.invert=function(t,e){var n=i-e,r=tt(o)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/o,2*Math.atan(Math.pow(i/r,1/o))-Hi]},n):Cn}function Ln(t,e){function n(t,e){var n=o-e;return[n*Math.sin(a*t),o-n*Math.cos(a*t)]}var r=Math.cos(t),a=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),o=r/a+t;return bi(a)1&&et(t[n[r-2]],t[n[r-1]],t[a])<=0;)--r;n[r++]=a}return n.slice(0,r)}function En(t,e){return t[0]-e[0]||t[1]-e[1]}function Nn(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function In(t,e,n,r){var a=t[0],o=n[0],i=e[0]-a,l=r[0]-o,s=t[1],c=n[1],u=e[1]-s,f=r[1]-c,d=(l*(s-c)-f*(a-o))/(f*i-l*u);return[a+d*i,s+d*u]}function Rn(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function jn(){or(this),this.edge=this.site=this.circle=null}function Fn(t){var e=cs.pop()||new jn;return e.site=t,e}function Bn(t){Qn(t),is.remove(t),cs.push(t),or(t)}function qn(t){var e=t.circle,n=e.x,r=e.cy,a={x:n,y:r},o=t.P,i=t.N,l=[t];Bn(t);for(var s=o;s.circle&&bi(n-s.circle.x)Ri)l=l.L;else{if(a=o-Yn(l,i),!(a>Ri)){r>-Ri?(e=l.P,n=l):a>-Ri?(e=l,n=l.N):e=n=l;break}if(!l.R){e=l;break}l=l.R}var s=Fn(t);if(is.insert(e,s),e||n){if(e===n)return Qn(e),n=Fn(e.site),is.insert(s,n),s.edge=n.edge=tr(e.site,s.site),Wn(e),void Wn(n);if(!n)return void(s.edge=tr(e.site,s.site));Qn(e),Qn(n);var c=e.site,u=c.x,f=c.y,d=t.x-u,h=t.y-f,p=n.site,g=p.x-u,v=p.y-f,m=2*(d*v-h*g),y=d*d+h*h,x=g*g+v*v,b={x:(v*y-h*x)/m+u,y:(d*x-g*y)/m+f};nr(n.edge,c,p,b),s.edge=tr(c,t,null,b),n.edge=tr(t,p,null,b),Wn(e),Wn(n)}}function Vn(t,e){var n=t.site,r=n.x,a=n.y,o=a-e;if(!o)return r;var i=t.P;if(!i)return-(1/0);n=i.site;var l=n.x,s=n.y,c=s-e;if(!c)return l;var u=l-r,f=1/o-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-o/2)))/f+r:(r+l)/2}function Yn(t,e){var n=t.N;if(n)return Vn(n,e);var r=t.site;return r.y===e?r.x:1/0}function Un(t){this.site=t,this.edges=[]}function Xn(t){for(var e,n,r,a,o,i,l,s,c,u,f=t[0][0],d=t[1][0],h=t[0][1],p=t[1][1],g=os,v=g.length;v--;)if(o=g[v],o&&o.prepare())for(l=o.edges,s=l.length,i=0;iRi||bi(a-n)>Ri)&&(l.splice(i,0,new rr(er(o.site,u,bi(r-f)Ri?{x:f,y:bi(e-f)Ri?{x:bi(n-p)Ri?{x:d,y:bi(e-d)Ri?{x:bi(n-h)=-ji)){var h=s*s+c*c,p=u*u+f*f,g=(f*h-c*p)/d,v=(s*p-u*h)/d,f=v+l,m=us.pop()||new Gn;m.arc=t,m.site=a,m.x=g+i,m.y=f+Math.sqrt(g*g+v*v),m.cy=f,t.circle=m;for(var y=null,x=ss._;x;)if(m.y=l)return;if(d>p){if(o){if(o.y>=c)return}else o={x:v,y:s};n={x:v,y:c}}else{if(o){if(o.y1)if(d>p){if(o){if(o.y>=c)return}else o={x:(s-a)/r,y:s};n={x:(c-a)/r,y:c}}else{if(o){if(o.y=l)return}else o={x:i,y:r*i+a};n={x:l,y:r*l+a}}else{if(o){if(o.xo||f>i||d=b,k=n>=_,M=k<<1|w,A=M+4;Mo&&(a=e.slice(o,a),l[i]?l[i]+=a:l[++i]=a),(n=n[0])===(r=r[0])?l[i]?l[i]+=r:l[++i]=r:(l[++i]=null,s.push({i:i,x:xr(n,r)})),o=hs.lastIndex;return o=0&&!(n=ui.interpolators[r](t,e)););return n}function wr(t,e){var n,r=[],a=[],o=t.length,i=e.length,l=Math.min(t.length,e.length);for(n=0;n=1?1:t(e)}}function Mr(t){return function(e){return 1-t(1-e)}}function Ar(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tr(t){return t*t}function Lr(t){return t*t*t}function Cr(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function Sr(t){return function(e){return Math.pow(e,t)}}function zr(t){return 1-Math.cos(t*Hi)}function Or(t){return Math.pow(2,10*(t-1))}function Pr(t){return 1-Math.sqrt(1-t*t)}function Dr(t,e){var n;return arguments.length<2&&(e=.45),arguments.length?n=e/Bi*Math.asin(1/t):(t=1,n=e/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-n)*Bi/e)}}function Er(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Nr(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 Ir(t,e){t=ui.hcl(t),e=ui.hcl(e);var n=t.h,r=t.c,a=t.l,o=e.h-n,i=e.c-r,l=e.l-a;return isNaN(i)&&(i=0,r=isNaN(r)?e.c:r),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360),function(t){return dt(n+o*t,r+i*t,a+l*t)+""}}function Rr(t,e){t=ui.hsl(t),e=ui.hsl(e);var n=t.h,r=t.s,a=t.l,o=e.h-n,i=e.s-r,l=e.l-a;return isNaN(i)&&(i=0,r=isNaN(r)?e.s:r),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360),function(t){return ut(n+o*t,r+i*t,a+l*t)+""}}function jr(t,e){t=ui.lab(t),e=ui.lab(e);var n=t.l,r=t.a,a=t.b,o=e.l-n,i=e.a-r,l=e.b-a;return function(t){return pt(n+o*t,r+i*t,a+l*t)+""}}function Fr(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function Br(t){var e=[t.a,t.b],n=[t.c,t.d],r=Hr(e),a=qr(e,n),o=Hr(Vr(n,e,-a))||0;e[0]*n[1]180?e+=360:e-t>180&&(t+=360),r.push({i:n.push(Yr(n)+"rotate(",null,")")-2,x:xr(t,e)})):e&&n.push(Yr(n)+"rotate("+e+")")}function Zr(t,e,n,r){t!==e?r.push({i:n.push(Yr(n)+"skewX(",null,")")-2,x:xr(t,e)}):e&&n.push(Yr(n)+"skewX("+e+")")}function Gr(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var a=n.push(Yr(n)+"scale(",null,",",null,")");r.push({i:a-4,x:xr(t[0],e[0])},{i:a-2,x:xr(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(Yr(n)+"scale("+e+")")}function Wr(t,e){var n=[],r=[];return t=ui.transform(t),e=ui.transform(e),Ur(t.translate,e.translate,n,r),Xr(t.rotate,e.rotate,n,r),Zr(t.skew,e.skew,n,r),Gr(t.scale,e.scale,n,r),t=e=null,function(t){for(var e,a=-1,o=r.length;++a=0;)n.push(a[r])}function sa(t,e){for(var n=[t],r=[];null!=(t=n.pop());)if(r.push(t),(o=t.children)&&(a=o.length))for(var a,o,i=-1;++ia&&(r=n,a=e);return r}function xa(t){return t.reduce(ba,0)}function ba(t,e){return t+e[1]}function _a(t,e){return wa(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wa(t,e){for(var n=-1,r=+t[0],a=(t[1]-r)/e,o=[];++n<=e;)o[n]=a*n+r;return o}function ka(t){return[ui.min(t),ui.max(t)]}function Ma(t,e){return t.value-e.value}function Aa(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Ta(t,e){t._pack_next=e,e._pack_prev=t}function La(t,e){var n=e.x-t.x,r=e.y-t.y,a=t.r+e.r;return.999*a*a>n*n+r*r}function Ca(t){function e(t){u=Math.min(t.x-t.r,u),f=Math.max(t.x+t.r,f),d=Math.min(t.y-t.r,d),h=Math.max(t.y+t.r,h)}if((n=t.children)&&(c=n.length)){var n,r,a,o,i,l,s,c,u=1/0,f=-(1/0),d=1/0,h=-(1/0);if(n.forEach(Sa),r=n[0],r.x=-r.r,r.y=0,e(r),c>1&&(a=n[1],a.x=a.r,a.y=0,e(a),c>2))for(o=n[2],Pa(r,a,o),e(o),Aa(r,o),r._pack_prev=o,Aa(o,a),a=r._pack_next,i=3;i=0;)e=a[o],e.z+=n,e.m+=n,n+=e.s+(r+=e.c)}function ja(t,e,n){return t.a.parent===e.parent?t.a:n}function Fa(t){return 1+ui.max(t,function(t){return t.y})}function Ba(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function qa(t){var e=t.children;return e&&e.length?qa(e[0]):t}function Ha(t){var e,n=t.children;return n&&(e=n.length)?Ha(n[e-1]):t}function Va(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Ya(t,e){var n=t.x+e[3],r=t.y+e[0],a=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return a<0&&(n+=a/2,a=0),o<0&&(r+=o/2,o=0),{x:n,y:r,dx:a,dy:o}}function Ua(t){var e=t[0],n=t[t.length-1];return e2?Qa:Za,s=r?$r:Qr;return i=a(t,e,s,n),l=a(e,t,s,_r),o}function o(t){return i(t)}var i,l;return o.invert=function(t){return l(t)},o.domain=function(e){return arguments.length?(t=e.map(Number),a()):t},o.range=function(t){return arguments.length?(e=t,a()):e},o.rangeRound=function(t){return o.range(t).interpolate(Fr)},o.clamp=function(t){return arguments.length?(r=t,a()):r},o.interpolate=function(t){return arguments.length?(n=t,a()):n},o.ticks=function(e){return eo(t,e)},o.tickFormat=function(e,n){return no(t,e,n)},o.nice=function(e){return Ka(t,e),a()},o.copy=function(){return $a(t,e,n,r)},a()}function Ja(t,e){return ui.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ka(t,e){return Ga(t,Wa(to(t,e)[2])),Ga(t,Wa(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var n=Ua(t),r=n[1]-n[0],a=Math.pow(10,Math.floor(Math.log(r/e)/Math.LN10)),o=e/r*a;return o<=.15?a*=10:o<=.35?a*=5:o<=.75&&(a*=2),n[0]=Math.ceil(n[0]/a)*a,n[1]=Math.floor(n[1]/a)*a+.5*a,n[2]=a,n}function eo(t,e){return ui.range.apply(ui,to(t,e))}function no(t,e,n){var r=to(t,e);if(n){var a=dl.exec(n);if(a.shift(),"s"===a[8]){var o=ui.formatPrefix(Math.max(bi(r[0]),bi(r[1])));return a[7]||(a[7]="."+ro(o.scale(r[2]))),a[8]="f",n=ui.format(a.join("")),function(t){return n(o.scale(t))+o.symbol}}a[7]||(a[7]="."+ao(a[8],r)),n=a.join("")}else n=",."+ro(r[2])+"f";return ui.format(n)}function ro(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ao(t,e){var n=ro(e[2]);return t in As?Math.abs(n-ro(Math.max(bi(e[0]),bi(e[1]))))+ +("e"!==t):n-2*("%"===t)}function oo(t,e,n,r){function a(t){return(n?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return n?Math.pow(e,t):-Math.pow(e,-t)}function i(e){return t(a(e))}return i.invert=function(e){return o(t.invert(e))},i.domain=function(e){return arguments.length?(n=e[0]>=0,t.domain((r=e.map(Number)).map(a)),i):r},i.base=function(n){return arguments.length?(e=+n,t.domain(r.map(a)),i):e},i.nice=function(){var e=Ga(r.map(a),n?Math:Ls);return t.domain(e),r=e.map(o),i},i.ticks=function(){var t=Ua(r),i=[],l=t[0],s=t[1],c=Math.floor(a(l)),u=Math.ceil(a(s)),f=e%1?2:e;if(isFinite(u-c)){if(n){for(;c0;d--)i.push(o(c)*d);for(c=0;i[c]s;u--);i=i.slice(c,u)}return i},i.tickFormat=function(t,n){if(!arguments.length)return Ts;arguments.length<2?n=Ts:"function"!=typeof n&&(n=ui.format(n));var r=Math.max(1,e*t/i.ticks().length);return function(t){var i=t/o(Math.round(a(t)));return i*e0?l[n-1]:t[0],n0?0:1}function _o(t,e,n,r,a){var o=t[0]-e[0],i=t[1]-e[1],l=(a?r:-r)/Math.sqrt(o*o+i*i),s=l*i,c=-l*o,u=t[0]+s,f=t[1]+c,d=e[0]+s,h=e[1]+c,p=(u+d)/2,g=(f+h)/2,v=d-u,m=h-f,y=v*v+m*m,x=n-r,b=u*h-d*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*m-v*_)/y,k=(-b*v-m*_)/y,M=(b*m+v*_)/y,A=(-b*v+m*_)/y,T=w-p,L=k-g,C=M-p,S=A-g;return T*T+L*L>C*C+S*S&&(w=M,k=A),[[w-s,k-c],[w*n/x,k*n/x]]}function wo(t){function e(e){function i(){c.push("M",o(t(u),l))}for(var s,c=[],u=[],f=-1,d=e.length,h=Ct(n),p=Ct(r);++f1?t.join("L"):t+"Z"}function Mo(t){return t.join("L")+"Z"}function Ao(t){for(var e=0,n=t.length,r=t[0],a=[r[0],",",r[1]];++e1&&a.push("H",r[0]),a.join("")}function To(t){for(var e=0,n=t.length,r=t[0],a=[r[0],",",r[1]];++e1){l=e[1],o=t[s],s++,r+="C"+(a[0]+i[0])+","+(a[1]+i[1])+","+(o[0]-l[0])+","+(o[1]-l[1])+","+o[0]+","+o[1];for(var c=2;c9&&(a=3*e/Math.sqrt(a),i[l]=a*n,i[l+1]=a*r));for(l=-1;++l<=s;)a=(t[Math.min(s,l+1)][0]-t[Math.max(0,l-1)][0])/(6*(1+i[l]*i[l])),o.push([a||0,i[l]*a||0]);return o}function Ho(t){return t.length<3?ko(t):t[0]+Oo(t,qo(t))}function Vo(t){for(var e,n,r,a=-1,o=t.length;++a0;)h[--l].call(t,i);if(o>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[r]:delete t[n],1}var s,c,u,d,h,p=t[n]||(t[n]={active:0,count:0}),g=p[r];g||(s=a.time,c=Dt(o,0,s),g=p[r]={tween:new f,time:s,timer:c,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++p.count)}function ri(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate("+(isFinite(r)?r:n(t))+",0)"})}function ai(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate(0,"+(isFinite(r)?r:n(t))+")"})}function oi(t){return t.toISOString()}function ii(t,e,n){function r(e){return t(e)}function a(t,n){var r=t[1]-t[0],a=r/n,o=ui.bisect(Js,a);return o==Js.length?[e.year,to(t.map(function(t){return t/31536e6}),n)[2]]:o?e[a/Js[o-1]1?{floor:function(e){for(;n(e=t.floor(e));)e=li(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=li(+e+1);return e}}:t))},r.ticks=function(t,e){var n=Ua(r.domain()),o=null==t?a(n,10):"number"==typeof t?a(n,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(n[0],li(+n[1]+1),e<1?1:e)},r.tickFormat=function(){return n},r.copy=function(){return ii(t.copy(),e,n)},Ja(r,t)}function li(t){return new Date(t)}function si(t){return JSON.parse(t.responseText)}function ci(t){var e=hi.createRange();return e.selectNode(hi.body),e.createContextualFragment(t.responseText)}var ui={version:"3.5.17"},fi=[].slice,di=function(t){return fi.call(t)},hi=this.document;if(hi)try{di(hi.documentElement.childNodes)[0].nodeType}catch(t){di=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),hi)try{hi.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var pi=this.Element.prototype,gi=pi.setAttribute,vi=pi.setAttributeNS,mi=this.CSSStyleDeclaration.prototype,yi=mi.setProperty;pi.setAttribute=function(t,e){gi.call(this,t,e+"")},pi.setAttributeNS=function(t,e,n){vi.call(this,t,e,n+"")},mi.setProperty=function(t,e,n){yi.call(this,t,e+"",n)}}ui.ascending=a,ui.descending=function(t,e){return et?1:e>=t?0:NaN},ui.min=function(t,e){var n,r,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=r;break}for(;++ar&&(n=r)}else{for(;++a=r){n=r;break}for(;++ar&&(n=r)}return n},ui.max=function(t,e){var n,r,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=r;break}for(;++an&&(n=r)}else{for(;++a=r){n=r;break}for(;++an&&(n=r)}return n},ui.extent=function(t,e){var n,r,a,o=-1,i=t.length;if(1===arguments.length){for(;++o=r){n=a=r;break}for(;++or&&(n=r),a=r){n=a=r;break}for(;++or&&(n=r),a1)return s/(u-1)},ui.deviation=function(){var t=ui.variance.apply(this,arguments);return t?Math.sqrt(t):t};var xi=l(a);ui.bisectLeft=xi.left,ui.bisect=ui.bisectRight=xi.right,ui.bisector=function(t){return l(1===t.length?function(e,n){return a(t(e),n)}:t)},ui.shuffle=function(t,e,n){(o=arguments.length)<3&&(n=t.length,o<2&&(e=0));for(var r,a,o=n-e;o;)a=Math.random()*o--|0,r=t[o+e],t[o+e]=t[a+e],t[a+e]=r;return t},ui.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r},ui.pairs=function(t){for(var e,n=0,r=t.length-1,a=t[0],o=new Array(r<0?0:r);n=0;)for(r=t[a],e=r.length;--e>=0;)n[--i]=r[e];return n};var bi=Math.abs;ui.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n===1/0)throw new Error("infinite range");var r,a=[],o=c(bi(n)),i=-1;if(t*=o,e*=o,n*=o,n<0)for(;(r=t+n*++i)>e;)a.push(r/o);else for(;(r=t+n*++i)=o.length)return r?r.call(a,i):n?i.sort(n):i;for(var s,c,u,d,h=-1,p=i.length,g=o[l++],v=new f;++h=o.length)return t;var r=[],a=i[n++];return t.forEach(function(t,a){r.push({key:t,values:e(a,n)})}),a?r.sort(function(t,e){return a(t.key,e.key)}):r}var n,r,a={},o=[],i=[];return a.map=function(e,n){return t(n,e,0)},a.entries=function(n){return e(t(ui.map,n,0),0)},a.key=function(t){return o.push(t),a},a.sortKeys=function(t){return i[o.length-1]=t,a},a.sortValues=function(t){return n=t,a},a.rollup=function(t){return r=t,a},a},ui.set=function(t){var e=new x;if(t)for(var n=0,r=t.length;n=0&&(r=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},ui.event=null,ui.requote=function(t){return t.replace(Mi,"\\$&")};var Mi=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ai={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},Ti=function(t,e){return e.querySelector(t)},Li=function(t,e){return e.querySelectorAll(t)},Ci=function(t,e){var n=t.matches||t[w(t,"matchesSelector")];return(Ci=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Ti=function(t,e){return Sizzle(t,e)[0]||null},Li=Sizzle,Ci=Sizzle.matchesSelector),ui.selection=function(){return ui.select(hi.documentElement)};var Si=ui.selection.prototype=[];Si.select=function(t){var e,n,r,a,o=[];t=z(t);for(var i=-1,l=this.length;++i=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Oi.hasOwnProperty(n)?{space:Oi[n],local:t}:t}},Si.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();return t=ui.ns.qualify(t),t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(P(e,t[e]));return this}return this.each(P(t,e))},Si.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=N(t)).length,a=-1;if(e=n.classList){for(;++a=0;)(n=r[a])&&(o&&o!==n.nextSibling&&o.parentNode.insertBefore(n,o),o=n);return this},Si.sort=function(t){t=Y.apply(this,arguments);for(var e=-1,n=this.length;++e0&&(e=e.transition().duration(S)),e.call(t.event)}function l(){_&&_.domain(b.range().map(function(t){return(t-M.x)/M.k}).map(b.invert)),k&&k.domain(w.range().map(function(t){return(t-M.y)/M.k}).map(w.invert))}function s(t){z++||t({type:"zoomstart"})}function c(t){l(),t({type:"zoom",scale:M.k,translate:[M.x,M.y]})}function u(t){--z||(t({type:"zoomend"}),v=null)}function f(){function t(){l=1,o(ui.mouse(a),d),c(i)}function n(){f.on(P,null).on(D,null),h(l),u(i)}var a=this,i=N.of(a,arguments),l=0,f=ui.select(r(a)).on(P,t).on(D,n),d=e(ui.mouse(a)),h=$(a);Hs.call(a),s(i)}function d(){function t(){var t=ui.touches(p);return h=M.k,t.forEach(function(t){t.identifier in v&&(v[t.identifier]=e(t))}),t}function n(){var e=ui.event.target;ui.select(e).on(b,r).on(_,l),w.push(e);for(var n=ui.event.changedTouches,a=0,o=n.length;a1){ -var u=s[0],f=s[1],d=u[0]-f[0],h=u[1]-f[1];m=d*d+h*h}}function r(){var t,e,n,r,i=ui.touches(p);Hs.call(p);for(var l=0,s=i.length;l=c)return i;if(a)return a=!1,o;var e=u;if(34===t.charCodeAt(e)){for(var n=e;n++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,hl=ui.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=ui.round(t,Rt(t,e))).toFixed(Math.max(0,Math.min(20,Rt(t*(1+1e-15),e))))}}),pl=ui.time={},gl=Date;qt.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(){vl.setUTCDate.apply(this._,arguments)},setDay:function(){vl.setUTCDay.apply(this._,arguments)},setFullYear:function(){vl.setUTCFullYear.apply(this._,arguments)},setHours:function(){vl.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){vl.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){vl.setUTCMinutes.apply(this._,arguments)},setMonth:function(){vl.setUTCMonth.apply(this._,arguments)},setSeconds:function(){vl.setUTCSeconds.apply(this._,arguments)},setTime:function(){vl.setTime.apply(this._,arguments)}};var vl=Date.prototype;pl.year=Ht(function(t){return t=pl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),pl.years=pl.year.range,pl.years.utc=pl.year.utc.range,pl.day=Ht(function(t){var e=new gl(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),pl.days=pl.day.range,pl.days.utc=pl.day.utc.range,pl.dayOfYear=function(t){var e=pl.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=pl[t]=Ht(function(t){return(t=pl.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});pl[t+"s"]=n.range,pl[t+"s"].utc=n.utc.range,pl[t+"OfYear"]=function(t){var n=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(n+e)%7)/7)}}),pl.week=pl.sunday,pl.weeks=pl.sunday.range,pl.weeks.utc=pl.sunday.utc.range,pl.weekOfYear=pl.sundayOfYear;var ml={"-":"",_:" ",0:"0"},yl=/^\s*\d+/,xl=/^%/;ui.locale=function(t){return{numberFormat:Ft(t),timeFormat:Yt(t)}};var bl=ui.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"]});ui.format=bl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,_l),de(_l.s,this.s,this),this.s?this.t+=_l.t:this.s=_l.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _l=new fe;ui.geo.stream=function(t,e){t&&wl.hasOwnProperty(t.type)?wl[t.type](t,e):he(t,e)};var wl={Feature:function(t,e){he(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,a=n.length;++rh&&(h=e)}function e(e,n){var r=me([e*Vi,n*Vi]);if(m){var a=xe(m,r),o=[a[1],-a[0],0],i=xe(o,a);we(i),i=ke(i);var s=e-p,c=s>0?1:-1,g=i[0]*Yi*c,v=bi(s)>180;if(v^(c*ph&&(h=y)}else if(g=(g+360)%360-180,v^(c*ph&&(h=n);v?el(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e):d>=u?(ed&&(d=e)):e>p?l(u,e)>l(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e)}else t(e,n);m=r,p=e}function n(){_.point=e}function r(){b[0]=u,b[1]=d,_.point=t,m=null}function a(t,n){if(m){var r=t-p;y+=bi(r)>180?r+(r>0?360:-360):r}else g=t,v=n;Tl.point(t,n),e(t,n)}function o(){Tl.lineStart()}function i(){a(g,v),Tl.lineEnd(),bi(y)>Ri&&(u=-(d=180)),b[0]=u,b[1]=d,m=null}function l(t,e){return(e-=t)<0?e+360:e}function s(t,e){return t[0]-e[0]}function c(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tRi?h=90:y<-Ri&&(f=-90),b[0]=u,b[1]=d}};return function(t){h=d=-(u=f=1/0),x=[],ui.geo.stream(t,_);var e=x.length;if(e){x.sort(s);for(var n,r=1,a=x[0],o=[a];rl(a[0],a[1])&&(a[1]=n[1]),l(n[0],a[1])>l(a[0],a[1])&&(a[0]=n[0])):o.push(a=n);for(var i,n,p=-(1/0),e=o.length-1,r=0,a=o[e];r<=e;a=n,++r)n=o[r],(i=l(a[1],n[0]))>p&&(p=i,u=n[0],d=a[1])}return x=b=null,u===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[u,f],[d,h]]}}(),ui.geo.centroid=function(t){Ll=Cl=Sl=zl=Ol=Pl=Dl=El=Nl=Il=Rl=0,ui.geo.stream(t,jl);var e=Nl,n=Il,r=Rl,a=e*e+n*n+r*r;return a=.12&&a<.234&&r>=-.425&&r<-.214?i:a>=.166&&a<.234&&r>=-.214&&r<-.115?l:o).invert(t)},t.stream=function(t){var e=o.stream(t),n=i.stream(t),r=l.stream(t);return{point:function(t,a){e.point(t,a),n.point(t,a),r.point(t,a)},sphere:function(){e.sphere(),n.sphere(),r.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),i.precision(e),l.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),i.scale(.35*e),l.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var c=o.scale(),u=+e[0],f=+e[1];return n=o.translate(e).clipExtent([[u-.455*c,f-.238*c],[u+.455*c,f+.238*c]]).stream(s).point,r=i.translate([u-.307*c,f+.201*c]).clipExtent([[u-.425*c+Ri,f+.12*c+Ri],[u-.214*c-Ri,f+.234*c-Ri]]).stream(s).point,a=l.translate([u-.205*c,f+.212*c]).clipExtent([[u-.214*c+Ri,f+.166*c+Ri],[u-.115*c-Ri,f+.234*c-Ri]]).stream(s).point,t},t.scale(1070)};var ql,Hl,Vl,Yl,Ul,Xl,Zl={point:k,lineStart:k,lineEnd:k,polygonStart:function(){Hl=0,Zl.lineStart=Ge},polygonEnd:function(){Zl.lineStart=Zl.lineEnd=Zl.point=k,ql+=bi(Hl/2)}},Gl={point:We,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Wl={point:Je,lineStart:Ke,lineEnd:tn,polygonStart:function(){Wl.lineStart=en},polygonEnd:function(){Wl.point=Je,Wl.lineStart=Ke,Wl.lineEnd=tn}};ui.geo.path=function(){function t(t){return t&&("function"==typeof l&&o.pointRadius(+l.apply(this,arguments)),i&&i.valid||(i=a(o)),ui.geo.stream(t,i)),o.result()}function e(){return i=null,t}var n,r,a,o,i,l=4.5;return t.area=function(t){return ql=0,ui.geo.stream(t,a(Zl)),ql},t.centroid=function(t){return Sl=zl=Ol=Pl=Dl=El=Nl=Il=Rl=0,ui.geo.stream(t,a(Wl)),Rl?[Nl/Rl,Il/Rl]:El?[Pl/El,Dl/El]:Ol?[Sl/Ol,zl/Ol]:[NaN,NaN]},t.bounds=function(t){return Ul=Xl=-(Vl=Yl=1/0),ui.geo.stream(t,a(Gl)),[[Vl,Yl],[Ul,Xl]]},t.projection=function(t){return arguments.length?(a=(n=t)?t.stream||an(t):b,e()):n},t.context=function(t){return arguments.length?(o=null==(r=t)?new Qe:new nn(t),"function"!=typeof l&&o.pointRadius(l),e()):r},t.pointRadius=function(e){return arguments.length?(l="function"==typeof e?e:(o.pointRadius(+e),+e),t):l},t.projection(ui.geo.albersUsa()).context(null)},ui.geo.transform=function(t){return{stream:function(e){var n=new on(e);for(var r in t)n[r]=t[r];return n}}},on.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()}},ui.geo.projection=sn,ui.geo.projectionMutator=cn,(ui.geo.equirectangular=function(){return sn(fn)}).raw=fn.invert=fn,ui.geo.rotation=function(t){function e(e){return e=t(e[0]*Vi,e[1]*Vi),e[0]*=Yi,e[1]*=Yi,e}return t=hn(t[0]%360*Vi,t[1]*Vi,t.length>2?t[2]*Vi:0),e.invert=function(e){return e=t.invert(e[0]*Vi,e[1]*Vi),e[0]*=Yi,e[1]*=Yi,e},e},dn.invert=fn,ui.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,e=hn(-t[0]*Vi,-t[1]*Vi,0).invert,a=[];return n(null,null,1,{point:function(t,n){a.push(t=e(t,n)),t[0]*=Yi,t[1]*=Yi}}),{type:"Polygon",coordinates:[a]}}var e,n,r=[0,0],a=6;return t.origin=function(e){return arguments.length?(r=e,t):r},t.angle=function(r){return arguments.length?(n=mn((e=+r)*Vi,a*Vi),t):e},t.precision=function(r){return arguments.length?(n=mn(e*Vi,(a=+r)*Vi),t):a},t.angle(90)},ui.geo.distance=function(t,e){var n,r=(e[0]-t[0])*Vi,a=t[1]*Vi,o=e[1]*Vi,i=Math.sin(r),l=Math.cos(r),s=Math.sin(a),c=Math.cos(a),u=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((n=f*i)*n+(n=c*u-s*f*l)*n),s*u+c*f*l)},ui.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return ui.range(Math.ceil(o/v)*v,a,v).map(d).concat(ui.range(Math.ceil(c/m)*m,s,m).map(h)).concat(ui.range(Math.ceil(r/p)*p,n,p).filter(function(t){return bi(t%v)>Ri}).map(u)).concat(ui.range(Math.ceil(l/g)*g,i,g).filter(function(t){return bi(t%m)>Ri}).map(f))}var n,r,a,o,i,l,s,c,u,f,d,h,p=10,g=p,v=90,m=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[d(o).concat(h(s).slice(1),d(a).reverse().slice(1),h(c).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],a=+e[1][0],c=+e[0][1],s=+e[1][1],o>a&&(e=o,o=a,a=e),c>s&&(e=c,c=s,s=e),t.precision(y)):[[o,c],[a,s]]},t.minorExtent=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],l=+e[0][1],i=+e[1][1],r>n&&(e=r,r=n,n=e),l>i&&(e=l,l=i,i=e),t.precision(y)):[[r,l],[n,i]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(v=+e[0],m=+e[1],t):[v,m]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,u=xn(l,i,90),f=bn(r,n,y),d=xn(c,s,90),h=bn(o,a,y),t):y},t.majorExtent([[-180,-90+Ri],[180,90-Ri]]).minorExtent([[-180,-80-Ri],[180,80+Ri]])},ui.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||r.apply(this,arguments),n||a.apply(this,arguments)]}}var e,n,r=_n,a=wn;return t.distance=function(){return ui.geo.distance(e||r.apply(this,arguments),n||a.apply(this,arguments))},t.source=function(n){return arguments.length?(r=n,e="function"==typeof n?null:n,t):r},t.target=function(e){return arguments.length?(a=e,n="function"==typeof e?null:e,t):a},t.precision=function(){return arguments.length?t:0},t},ui.geo.interpolate=function(t,e){return kn(t[0]*Vi,t[1]*Vi,e[0]*Vi,e[1]*Vi)},ui.geo.length=function(t){return Ql=0,ui.geo.stream(t,$l),Ql};var Ql,$l={sphere:k,point:k,lineStart:Mn,lineEnd:k,polygonStart:k,polygonEnd:k},Jl=An(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return sn(Jl)}).raw=Jl;var Kl=An(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return sn(Kl)}).raw=Kl,(ui.geo.conicConformal=function(){return Xe(Tn)}).raw=Tn,(ui.geo.conicEquidistant=function(){return Xe(Ln)}).raw=Ln;var ts=An(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return sn(ts)}).raw=ts,Cn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return Sn(Cn)}).raw=Cn;var es=An(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return sn(es)}).raw=es;var ns=An(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return sn(ns)}).raw=ns,zn.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Hi]},(ui.geo.transverseMercator=function(){var t=Sn(zn),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):(t=n(),[t[0],t[1],t[2]-90])},n([0,0,90])}).raw=zn,ui.geom={},ui.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,a=Ct(n),o=Ct(r),i=t.length,l=[],s=[];for(e=0;e=0;--e)h.push(t[l[c[e]][2]]);for(e=+f;e=r&&c.x<=o&&c.y>=a&&c.y<=i?[[r,i],[o,i],[o,a],[r,a]]:[];u.point=t[l]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Ri)*Ri,y:Math.round(i(t,e)/Ri)*Ri,i:e}})}var r=On,a=Pn,o=r,i=a,l=fs;return t?e(t):(e.links=function(t){return cr(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return cr(n(t)).cells.forEach(function(n,r){for(var a,o,i=n.site,l=n.edges.sort(Zn),s=-1,c=l.length,u=l[c-1].edge,f=u.l===i?u.r:u.l;++s=c,d=r>=u,h=d<<1|f;t.leaf=!1,t=t.nodes[h]||(t.nodes[h]=pr()),f?a=c:l=c,d?i=u:s=u,o(t,e,n,r,a,i,l,s)}var u,f,d,h,p,g,v,m,y,x=Ct(l),b=Ct(s);if(null!=e)g=e,v=n,m=r,y=a;else if(m=y=-(g=v=1/0),f=[],d=[],p=t.length,i)for(h=0;hm&&(m=u.x),u.y>y&&(y=u.y),f.push(u.x),d.push(u.y);else for(h=0;hm&&(m=_),w>y&&(y=w),f.push(_),d.push(w)}var k=m-g,M=y-v;k>M?y=v+k:m=g+M;var A=pr();if(A.add=function(t){o(A,t,+x(t,++h),+b(t,h),g,v,m,y)},A.visit=function(t){gr(t,A,g,v,m,y)},A.find=function(t){return vr(A,t[0],t[1],g,v,m,y)},h=-1,null==e){for(;++h=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=gs.get(n)||ps,r=vs.get(r)||b,kr(r(n.apply(null,fi.call(arguments,1))))},ui.interpolateHcl=Ir,ui.interpolateHsl=Rr,ui.interpolateLab=jr,ui.interpolateRound=Fr,ui.transform=function(t){var e=hi.createElementNS(ui.ns.prefix.svg,"g");return(ui.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new Br(n?n.matrix:ms)})(t)},Br.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ms={a:1,b:0,c:0,d:1,e:0,f:0};ui.interpolateTransform=Wr,ui.layout={},ui.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++n0?a=t:(n.c=null,n.t=NaN,n=null,c.end({type:"end",alpha:a=0})):t>0&&(c.start({type:"start",alpha:a=t}),n=Dt(s.tick)),s):a},s.start=function(){function t(t,r){if(!n){for(n=new Array(a),s=0;s=0;)i.push(u=c[s]),u.parent=o,u.depth=o.depth+1;r&&(o.value=0),o.children=c}else r&&(o.value=+r.call(t,o,o.depth)||0),delete o.children;return sa(a,function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)}),l}var e=fa,n=ca,r=ua;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(r=e,t):r},t.revalue=function(e){return r&&(la(e,function(t){t.children&&(t.value=0)}),sa(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},ui.layout.partition=function(){function t(e,n,r,a){var o=e.children;if(e.x=n,e.y=e.depth*a,e.dx=r,e.dy=a,o&&(i=o.length)){var i,l,s,c=-1;for(r=e.value?r/e.value:0;++cl&&(l=r),i.push(r)}for(n=0;n0)for(o=-1;++o=u[0]&&l<=u[1]&&(i=s[ui.bisect(f,l,1,h)-1],i.y+=p,i.push(t[o]));return s}var e=!0,n=Number,r=ka,a=_a;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(r=Ct(e),t):r},t.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return wa(t,e)}:Ct(e),t):a},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},ui.layout.pack=function(){function t(t,o){var i=n.call(this,t,o),l=i[0],s=a[0],c=a[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(l.x=l.y=0,sa(l,function(t){t.r=+u(t.value)}),sa(l,Ca),r){var f=r*(e?1:Math.max(2*l.r/s,2*l.r/c))/2;sa(l,function(t){t.r+=f}),sa(l,Ca),sa(l,function(t){t.r-=f})}return Oa(l,s/2,c/2,e?1:1/Math.max(2*l.r/s,2*l.r/c)),i}var e,n=ui.layout.hierarchy().sort(Ma),r=0,a=[1,1];return t.size=function(e){return arguments.length?(a=e,t):a},t.radius=function(n){return arguments.length?(e=null==n||"function"==typeof n?n:+n,t):e},t.padding=function(e){return arguments.length?(r=+e,t):r},ia(t,n)},ui.layout.tree=function(){function t(t,a){var u=i.call(this,t,a),f=u[0],d=e(f);if(sa(d,n),d.parent.m=-d.z,la(d,r),c)la(f,o);else{var h=f,p=f,g=f;la(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var v=l(h,p)/2-h.x,m=s[0]/(p.x+l(p,h)/2+v),y=s[1]/(g.depth||1);la(f,function(t){t.x=(t.x+v)*m,t.y=t.depth*y})}return u}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var a,o=e.children,i=0,l=o.length;i0&&(Ia(ja(i,t,n),t,r),c+=r,u+=r),f+=i.m,c+=a.m,d+=s.m,u+=o.m;i&&!Na(o)&&(o.t=i,o.m+=f-u),a&&!Ea(s)&&(s.t=a,s.m+=c-d,n=t)}return n}function o(t){t.x*=s[0],t.y=t.depth*s[1]}var i=ui.layout.hierarchy().sort(null).value(null),l=Da,s=[1,1],c=null;return t.separation=function(e){return arguments.length?(l=e,t):l},t.size=function(e){return arguments.length?(c=null==(s=e)?o:null,t):c?null:s},t.nodeSize=function(e){return arguments.length?(c=null==(s=e)?null:o,t):c?s:null},ia(t,i)},ui.layout.cluster=function(){function t(t,o){var i,l=e.call(this,t,o),s=l[0],c=0;sa(s,function(t){var e=t.children;e&&e.length?(t.x=Ba(e),t.y=Fa(e)):(t.x=i?c+=n(t,i):0,t.y=0,i=t)});var u=qa(s),f=Ha(s),d=u.x-n(u,f)/2,h=f.x+n(f,u)/2;return sa(s,a?function(t){t.x=(t.x-s.x)*r[0],t.y=(s.y-t.y)*r[1]}:function(t){t.x=(t.x-d)/(h-d)*r[0],t.y=(1-(s.y?t.y/s.y:1))*r[1]}),l}var e=ui.layout.hierarchy().sort(null).value(null),n=Da,r=[1,1],a=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(a=null==(r=e),t):a?null:r},t.nodeSize=function(e){return arguments.length?(a=null!=(r=e),t):a?r:null},ia(t,e)},ui.layout.treemap=function(){function t(t,e){for(var n,r,a=-1,o=t.length;++a0;)u.push(i=d[s-1]),u.area+=i.area,"squarify"!==h||(l=r(u,g))<=p?(d.pop(),p=l):(u.area-=u.pop().area,a(u,g,c,!1),g=Math.min(c.dx,c.dy),u.length=u.area=0,p=1/0);u.length&&(a(u,g,c,!0),u.length=u.area=0),o.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var o,i=f(e),l=r.slice(),s=[];for(t(l,i.dx*i.dy/e.value),s.area=0;o=l.pop();)s.push(o),s.area+=o.area,null!=o.z&&(a(s,o.z?i.dx:i.dy,i,!l.length),s.length=s.area=0);r.forEach(n)}}function r(t,e){for(var n,r=t.area,a=0,o=1/0,i=-1,l=t.length;++ia&&(a=n));return r*=r,e*=e,r?Math.max(e*a*p/r,r/(e*o*p)):1/0}function a(t,e,n,r){var a,o=-1,i=t.length,l=n.x,c=n.y,u=e?s(t.area/e):0;if(e==n.dx){for((r||u>n.dy)&&(u=n.dy);++on.dx)&&(u=n.dx);++o1);return t+e*n*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=ui.random.normal.apply(ui,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ui.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;nf?0:1;if(c=qi)return e(c,h)+(t?e(t,1-h):"")+"Z";var p,g,v,m,y,x,b,_,w,k,M,A,T=0,L=0,C=[];if((m=(+s.apply(this,arguments)||0)/2)&&(v=o===Ps?Math.sqrt(t*t+c*c):+o.apply(this,arguments),h||(L*=-1),c&&(L=rt(v/c*Math.sin(m))),t&&(T=rt(v/t*Math.sin(m)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var S=Math.abs(f-u-2*L)<=Fi?0:1;if(L&&bo(y,x,b,_)===h^S){var z=(u+f)/2;y=c*Math.cos(z),x=c*Math.sin(z),b=_=null}}else y=x=0;if(t){w=t*Math.cos(f-T),k=t*Math.sin(f-T),M=t*Math.cos(u+T),A=t*Math.sin(u+T);var O=Math.abs(u-f+2*T)<=Fi?0:1;if(T&&bo(w,k,M,A)===1-h^O){var P=(u+f)/2;w=t*Math.cos(P),k=t*Math.sin(P),M=A=null}}else w=k=0;if(d>Ri&&(p=Math.min(Math.abs(c-t)/2,+a.apply(this,arguments)))>.001){g=tFi)+",1 "+e}function a(t,e,n,r){return"Q 0,0 "+r}var o=_n,i=wn,l=Uo,s=mo,c=yo;return t.radius=function(e){return arguments.length?(l=Ct(e),t):l},t.source=function(e){return arguments.length?(o=Ct(e),t):o},t.target=function(e){return arguments.length?(i=Ct(e),t):i},t.startAngle=function(e){return arguments.length?(s=Ct(e),t):s},t.endAngle=function(e){return arguments.length?(c=Ct(e),t):c},t},ui.svg.diagonal=function(){function t(t,a){var o=e.call(this,t,a),i=n.call(this,t,a),l=(o.y+i.y)/2,s=[o,{x:o.x,y:l},{x:i.x,y:l},i];return s=s.map(r),"M"+s[0]+"C"+s[1]+" "+s[2]+" "+s[3]}var e=_n,n=wn,r=Xo;return t.source=function(n){return arguments.length?(e=Ct(n),t):e},t.target=function(e){return arguments.length?(n=Ct(e),t):n},t.projection=function(e){return arguments.length?(r=e,t):r},t},ui.svg.diagonal.radial=function(){var t=ui.svg.diagonal(),e=Xo,n=t.projection;return t.projection=function(t){return arguments.length?n(Zo(e=t)):e},t},ui.svg.symbol=function(){function t(t,r){return(Rs.get(e.call(this,t,r))||Qo)(n.call(this,t,r))}var e=Wo,n=Go;return t.type=function(n){return arguments.length?(e=Ct(n),t):e},t.size=function(e){return arguments.length?(n=Ct(e),t):n},t};var Rs=ui.map({circle:Qo,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Fs)),n=e*Fs;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",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/js),n=e*js/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/js),n=e*js/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});ui.svg.symbolTypes=Rs.keys();var js=Math.sqrt(3),Fs=Math.tan(30*Vi);Si.transition=function(t){for(var e,n,r=Bs||++Ys,a=ei(t),o=[],i=qs||{time:Date.now(),ease:Cr,delay:0,duration:250},l=-1,s=this.length;++lrect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",d[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==ui.event.keyCode&&(S||(x=null,O[0]-=f[1],O[1]-=d[1],S=2),T())}function g(){32==ui.event.keyCode&&2==S&&(O[0]+=f[1],O[1]+=d[1],S=0,T())}function v(){var t=ui.mouse(_),r=!1;b&&(t[0]+=b[0],t[1]+=b[1]),S||(ui.event.altKey?(x||(x=[(f[0]+f[1])/2,(d[0]+d[1])/2]),O[0]=f[+(t[0]0&&this._events[t].length>n&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!a(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,l;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||a(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(n)){for(l=o;l-- >0;)if(n[l]===e||n[l].listener&&n[l].listener===e){r=l;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;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(n=this._events[t],a(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],10:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;r13)&&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}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return t-t<1}},{}],11:[function(t,e,n){function r(t,e){var n=e[0],r=e[1],a=e[2],o=e[3],i=n+n,l=r+r,s=a+a,c=n*i,u=r*i,f=r*l,d=a*i,h=a*l,p=a*s,g=o*i,v=o*l,m=o*s;return t[0]=1-f-p,t[1]=u+m,t[2]=d-v,t[3]=0,t[4]=u-m,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+v,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=r},{}],12:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function i(t){if(d===clearTimeout)return clearTimeout(t);if((d===a||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{return d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}function l(){v&&p&&(v=!1,p.length?g=p.concat(g):m=-1,g.length&&s())}function s(){if(!v){var t=o(l);v=!0;for(var e=g.length;e;){for(p=g,g=[];++m1)for(var n=1;n.5?s/(2-o-i):s/(o+i),o){case t:r=(e-n)/s+(e1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var a,o,i;if(t=C(t,360),e=C(e,100),n=C(n,100),0===e)a=o=i=n;else{var l=n<.5?n*(1+e):n+e-n*e,s=2*n-l;a=r(s,l,t+1/3),o=r(s,l,t),i=r(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function s(t,e,n){t=C(t,255),e=C(e,255),n=C(n,255);var r,a,o=U(t,e,n),i=Y(t,e,n),l=o,s=o-i;if(a=0===o?0:s/o,o==i)r=0;else{switch(o){case t:r=(e-n)/s+(e>1)+720)%360;--e;)a.h=(a.h+o)%360,i.push(r(a));return i}function A(t,e){e=e||6;for(var n=r(t).toHsv(),a=n.h,o=n.s,i=n.v,l=[],s=1/e;e--;)l.push(r({h:a,s:o,v:i})),i=(i+s)%1;return l}function T(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function C(t,n){O(t)&&(t="100%");var r=P(t);return t=Y(n,U(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function S(t){return Y(1,U(0,t))}function z(t){return parseInt(t,16)}function O(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function P(t){return"string"==typeof t&&t.indexOf("%")!=-1}function D(t){return 1==t.length?"0"+t:""+t}function E(t){return t<=1&&(t=100*t+"%"),t}function N(t){return e.round(255*parseFloat(t)).toString(16)}function I(t){return z(t)/255}function R(t){return!!W.CSS_UNIT.exec(t)}function j(t){t=t.replace(B,"").replace(q,"").toLowerCase();var e=!1;if(Z[t])t=Z[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=W.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=W.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=W.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=W.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=W.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=W.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=W.hex8.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),a:I(n[4]),format:e?"name":"hex8"}:(n=W.hex6.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),format:e?"name":"hex"}:(n=W.hex4.exec(t))?{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),a:I(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=W.hex3.exec(t))&&{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),format:e?"name":"hex"}}function F(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var B=/^\s+/,q=/\s+$/,H=0,V=e.round,Y=e.min,U=e.max,X=e.random;r.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,a,o,i,l=this.toRgb();return t=l.r/255,n=l.g/255,r=l.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),i=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),.2126*a+.7152*o+.0722*i},setAlpha:function(t){return this._a=L(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*C(this._r,255))+"%",g:V(100*C(this._g,255))+"%",b:V(100*C(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%)":"rgba("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(G[u(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),n=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=r(t);n="#"+d(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,a=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return r(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(v,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},r.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?n[a]=t[a]:n[a]=E(t[a]));t=n}return r(t,e)},r.equals=function(t,e){return!(!t||!e)&&r(t).toRgbString()==r(e).toRgbString()},r.random=function(){return r.fromRatio({r:X(),g:X(),b:X()})},r.mix=function(t,e,n){n=0===n?0:n||50;var a=r(t).toRgb(),o=r(e).toRgb(),i=n/100,l={r:(o.r-a.r)*i+a.r,g:(o.g-a.g)*i+a.g,b:(o.b-a.b)*i+a.b,a:(o.a-a.a)*i+a.a};return r(l)},r.readability=function(t,n){var a=r(t),o=r(n);return(e.max(a.getLuminance(),o.getLuminance())+.05)/(e.min(a.getLuminance(),o.getLuminance())+.05)},r.isReadable=function(t,e,n){var a,o,i=r.readability(t,e);switch(o=!1,a=F(n),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},r.mostReadable=function(t,e,n){var a,o,i,l,s=null,c=0;n=n||{},o=n.includeFallbackColors,i=n.level,l=n.size;for(var u=0;uc&&(c=a,s=r(e[u]));return r.isReadable(t,s,{level:i,size:l})||!o?s:(n.includeFallbackColors=!1,r.mostReadable(t,["#fff","#000"],n))};var Z=r.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"},G=r.hexNames=T(Z),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+r),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})$/}}();"undefined"!=typeof n&&n.exports?n.exports=r:"function"==typeof t&&t.amd?t(function(){return r}):window.tinycolor=r}(Math)},{}],14:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../color"),o=t("../../plots/cartesian/axes"),i=t("./attributes");e.exports=function(t,e){function n(e,n){return r.coerce(t,l,i,e,n)}var l={};n("opacity"),n("align"),n("bgcolor");var s=n("bordercolor"),c=a.opacity(s);n("borderpad");var u=n("borderwidth"),f=n("showarrow");f&&(n("arrowcolor",c?l.bordercolor:a.defaultLine),n("arrowhead"),n("arrowsize"),n("arrowwidth",2*(c&&u||1)),n("ax"),n("ay"),n("axref"),n("ayref"),r.noneOrAll(t,l,["ax","ay"])),n("text",f?" ":"new text"),n("textangle"),r.coerceFont(n,"font",e.font);for(var d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:e},v=o.coerceRef(t,l,g,p),m=o.coerceARef(t,l,g,p),y=.5;if("paper"!==v){var x=o.getFromId(g,v);if(y=x.range[0]+y*(x.range[1]-x.range[0]),["date","category"].indexOf(x.type)!==-1&&"string"==typeof t[p]){var b;if("date"===x.type){if(b=r.dateTime2ms(t[p]),b!==!1&&(t[p]=b),m===v){var _=r.dateTime2ms(t["a"+p]);_!==!1&&(t["a"+p]=_)}}else(x._categories||[]).length&&(b=x._categories.indexOf(t[p]),b!==-1&&(t[p]=b))}}n(p,y),f||n(p+"anchor")}return r.noneOrAll(t,l,["x","y"]),l}},{"../../lib":113,"../../plots/cartesian/axes":139,"../color":23, -"./attributes":16}],15:[function(t,e,n){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],16:[function(t,e,n){"use strict";var r=t("./arrow_paths"),a=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),i=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:i({},a,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:r.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":111,"../../plots/cartesian/constants":145,"../../plots/font_attributes":160,"./arrow_paths":15}],17:[function(t,e,n){"use strict";function r(t){var e=t._fullLayout;e.annotations.forEach(function(e){var n=o.getFromId(t,e.xref),r=o.getFromId(t,e.yref);if(n||r){var a=(e._xsize||0)/2,i=e._xshift||0,l=(e._ysize||0)/2,s=e._yshift||0,c=a-i,u=a+i,f=l-s,d=l+s;if(e.showarrow){var h=3*e.arrowsize*e.arrowwidth;c=Math.max(c,h),u=Math.max(u,h),f=Math.max(f,h),d=Math.max(d,h)}n&&n.autorange&&o.expand(n,[n.l2c(e.x)],{ppadplus:u,ppadminus:c}),r&&r.autorange&&o.expand(r,[r.l2c(e.y)],{ppadplus:d,ppadminus:f})}})}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,n=e.annotations;if(n.length&&t._fullData.length){var l={};n.forEach(function(t){l[t.xref]=!0,l[t.yref]=!0});var s=o.list(t).filter(function(t){return t.autorange&&l[t._id]});if(s.length)return a.syncOrAsync([i,r],t)}}},{"../../lib":113,"../../plots/cartesian/axes":139,"./draw":19}],18:[function(t,e,n){"use strict";var r=t("./annotation_defaults");e.exports=function(t,e){for(var n=t.annotations||[],a=e.annotations=[],o=0;o2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}rt.selectAll("tspan.line").attr({y:0,x:0});var r=$.select(".annotation-math-group"),a=!r.empty(),l=h.bBox((a?r:rt).node()),c=l.width,p=l.height,m=Math.round(c+2*tt),y=Math.round(p+2*tt);Y._w=c,Y._h=p;var b=!1;if(["x","y"].forEach(function(e){var r,a=Y[e+"ref"]||e,o=f.getFromId(t,a),i=(G+("x"===e?0:90))*Math.PI/180,l=m*Math.abs(Math.cos(i))+y*Math.abs(Math.sin(i)),s=Y[e+"anchor"];if(o){if(!o.autorange&&(Y[e]-o.range[0])*(Y[e]-o.range[1])>0&&(Y["a"+e+"ref"]===a?(Y["a"+e]-o.range[0])*(Y["a"+e]-o.range[1])>0&&(b=!0):b=!0,b))return;Z[e]=o._offset+o.l2p(Y[e]),r=.5}else r=Y[e],"y"===e&&(r=1-r),Z[e]="x"===e?P.l+P.w*r:P.t+P.h*r;var c=0;Y["a"+e+"ref"]===a?Z["aa"+e]=o._offset+o.l2p(Y["a"+e]):(c=Y.showarrow?Y["a"+e]:l*n(r,s),Z[e]+=c),Y["_"+e+"type"]=o&&o.type,Y["_"+e+"size"]=l,Y["_"+e+"shift"]=c}),b)return void $.remove();var _,w;Y.showarrow&&(_=Y.axref===Y.xref?Z.x:u.constrain(Z.x-Y.ax,1,M.width-1),w=Y.ayref===Y.yref?Z.y:u.constrain(Z.y-Y.ay,1,M.height-1)),Z.x=u.constrain(Z.x,1,M.width-1),Z.y=u.constrain(Z.y,1,M.height-1);var k=tt-l.top,A=tt-l.left;a?r.select("svg").attr({x:tt-1,y:tt}):(rt.attr({x:A,y:k}),rt.selectAll("tspan.line").attr({y:k,x:A})),et.call(h.setRect,J/2,J/2,m-J,y-J);var T=0,L=0;T=Y.axref===Y.xref?Math.round(Z.aax-m/2):Math.round(Z.x-m/2),L=Y.ayref===Y.yref?Math.round(Z.aay-y/2):Math.round(Z.y-y/2),$.call(u.setTranslate,T,L);var C="annotations["+e+"]",S=function(n,r){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=Y.axref===Y.xref?Z.aax+n:Z.x+n,l=Y.ayref===Y.yref?Z.aay+r:Z.y+r;var c=u.rotationXYMatrix(G,a,l),f=u.apply2DTransform(c),h=u.apply2DTransform2(c),p=et.attr("width")/2,g=et.attr("height")/2,m=[[a-p,l-g,a-p,l+g],[a-p,l+g,a+p,l+g],[a+p,l+g,a+p,l-g],[a+p,l-g,a-p,l-g]].map(h);if(!m.reduce(function(t,e){return t^!!o(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){m.forEach(function(t){var e=o(a,l,_,w,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var y=Y.arrowwidth,b=Y.arrowcolor,k=W.append("g").style({opacity:d.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=k.append("path").attr("d","M"+a+","+l+"L"+_+","+w).style("stroke-width",y+"px").call(d.stroke,d.rgb(b));x(M,Y.arrowhead,"end",Y.arrowsize);var A=k.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-_)+","+(l-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,S;v.init({element:A.node(),prepFn:function(){var t=u.getTranslate($);L=t.x,S=t.y,T={},U&&U.autorange&&(T[U._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){k.attr("transform","translate("+t+","+e+")");var n=f(L,S),r=n[0]+t,a=n[1]+e;$.call(u.setTranslate,r,a),T[C+".x"]=U?Y.x+t/U._m:(_+t-P.l)/P.w,T[C+".y"]=X?Y.y+e/X._m:1-(w+e-P.t)/P.h,Y.axref===Y.xref&&(T[C+".ax"]=U?Y.ax+t/U._m:(_+t-P.l)/P.w),Y.ayref===Y.yref&&(T[C+".ay"]=X?Y.ay+e/X._m:1-(w+e-P.t)/P.h),Q.attr({transform:"rotate("+G+","+r+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};Y.showarrow&&S(0,0);var z=u.rotationXYMatrix(G,Z.x,Z.y),O=u.apply2DTransform(z);if(t._context.editable){var D,E,N;v.init({element:$.node(),prepFn:function(){var t=u.getTranslate($);D=t.x,E=t.y,N={}},moveFn:function(t,e){$.call(u.setTranslate,D+t,E+e);var n="pointer";if(Y.showarrow)Y.axref===Y.xref?N[C+".ax"]=U.p2l(U.l2p(Y.ax)+t):N[C+".ax"]=Y.ax+t,Y.ayref===Y.yref?N[C+".ay"]=X.p2l(X.l2p(Y.ay)+e):N[C+".ay"]=Y.ay+e,S(t,e);else{if(U)N[C+".x"]=Y.x+t/U._m;else{var r=Y._xsize/P.w,a=Y.x+Y._xshift/P.w-r/2;N[C+".x"]=v.align(a+t/P.w,r,0,1,Y.xanchor)}if(X)N[C+".y"]=Y.y+e/X._m;else{var o=Y._ysize/P.h,i=Y.y-Y._yshift/P.h-o/2;N[C+".y"]=v.align(i-e/P.h,o,0,1,Y.yanchor)}U&&X||(n=v.getCursor(U?.5:N[C+".x"],X?.5:N[C+".y"],Y.xanchor,Y.yanchor))}var l=O(D,E),s=l[0]+t,c=l[1]+e;$.call(u.setTranslate,D+t,E+e),Q.attr({transform:"rotate("+G+","+s+","+c+")"}),g($,n)},doneFn:function(e){if(g($),e){s.relayout(t,N);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var w,k=t.layout,M=t._fullLayout;if(!l(e)||e===-1){if(!e&&Array.isArray(c))return k.annotations=c,y(k,M),void r(t);if("remove"===c)return delete k.annotations,M.annotations=[],void r(t);if(n&&"add"!==c){for(w=0;we;w--)M._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),a(t,w)}}M._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=k.annotations[e],L=M.annotations[e];if(T){var C={xref:T.xref,yref:T.yref},S={};"string"==typeof n&&n?S[n]=c:u.isPlainObject(n)&&(S=n);var z=Object.keys(S);for(w=0;w4/3&&(R=H)}}else I&&(F&&(R<1/3?R+=q:R>2/3&&(R-=q)),R=(R-I.domain[0])/(I.domain[1]-I.domain[0]),R=I.range[0]+R*(I.range[1]-I.range[0]))}I&&I===N&&j&&("log"===j&&"log"!==I.type?R=Math.pow(10,R):"log"!==j&&"log"===I.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),T[E]=R}}var Y=m(T,M);M.annotations[e]=Y;var U=f.getFromId(t,Y.xref),X=f.getFromId(t,Y.yref),Z={x:0,y:0},G=+Y.textangle||0,W=M._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",Y.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:Y})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),J=Y.borderwidth,K=Y.borderpad,tt=J+K,et=$.append("rect").attr("class","bg").style("stroke-width",J+"px").call(d.stroke,Y.bordercolor).call(d.fill,Y.bgcolor),nt=Y.font,rt=$.append("text").classed("annotation",!0).attr("data-unformatted",Y.text).text(Y.text);t._context.editable?rt.call(p.makeEditable,$).call(b).on("edit",function(n){Y.text=n,this.attr({"data-unformatted":Y.text}),this.call(b);var r={};r["annotations["+e+"].text"]=Y.text,U&&U.autorange&&(r[U._name+".autorange"]=!0),X&&X.autorange&&(r[X._name+".autorange"]=!0),s.relayout(t,r)}):rt.call(b),Q.attr({transform:"rotate("+G+","+Z.x+","+Z.y+")"}).call(h.setPosition,Z.x,Z.y)}}function o(t,e,n,r,a,o,i,l){var s=n-t,c=a-t,u=i-a,f=r-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,v=(c*f-s*d)/p;return v<0||v>1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:r,drawOne:a}},{"../../lib":113,"../../lib/setcursor":123,"../../lib/svg_text_utils":125,"../../plotly":135,"../../plots/cartesian/axes":139,"../../plots/plots":164,"../color":23,"../dragelement":45,"../drawing":47,"./annotation_defaults":14,"./defaults":18,"./draw_arrow_head":20,d3:7,"fast-isnumeric":10}],20:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../color"),i=t("../drawing"),l=t("./arrow_paths");e.exports=function(t,e,n,s){a(s)||(s=1);var c=t.node(),u=l[e||0];if(u){"string"==typeof n&&n||(n="end");var f,d,h,p,g=(i.getPx(t,"stroke-width")||1)*s,v=t.style("stroke")||o.defaultLine,m=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,b=u.backoff*g;if("line"===c.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},d={x:+t.attr("x2"),y:+t.attr("y2")},h=Math.atan2(f.y-d.y,f.x-d.x),p=h+Math.PI,b){var _=b*Math.cos(h),w=b*Math.sin(h);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(d.x+=_,d.y+=w,t.attr({x2:d.x,y2:d.y}))}}else if("path"===c.nodeName){var k=c.getTotalLength(),M="";if(y){var A=c.getPointAtLength(0),T=c.getPointAtLength(.1);h=Math.atan2(A.y-T.y,A.x-T.x),f=c.getPointAtLength(Math.min(b,k)),b&&(M="0px,"+b+"px,")}if(x){var L=c.getPointAtLength(k),C=c.getPointAtLength(k-.1);if(p=Math.atan2(L.y-C.y,L.x-C.x),d=c.getPointAtLength(Math.max(0,k-b)),b){var S=M?2*b:b;M+=k-S+"px,"+k+"px"}}else M&&(M+=k+"px");M&&t.style("stroke-dasharray",M)}var z=function(n,a){e>5&&(a=0),r.select(c.parentElement).append("path").attr({class:t.attr("class"),d:u.path,transform:"translate("+n.x+","+n.y+")rotate("+180*a/Math.PI+")scale("+g+")"}).style({fill:v,opacity:m,"stroke-width":0})};y&&z(f,h),x&&z(d,p)}}},{"../color":23,"../drawing":47,"./arrow_paths":15,d3:7,"fast-isnumeric":10}],21:[function(t,e,n){"use strict";var r=t("../../plotly");n.moduleType="component",n.name="annotations",n.ARROWPATHS=t("./arrow_paths"),n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.calcAutorange=t("./calc_autorange"),n.arrowhead=t("./draw_arrow_head");var a=t("./draw");n.draw=a.draw,n.drawOne=a.drawOne,n.add=function(t){var e=t._fullLayout.annotations.length;r.relayout(t,"annotations["+e+"]","add")}},{"../../plotly":135,"./arrow_paths":15,"./attributes":16,"./calc_autorange":17,"./defaults":18,"./draw":19,"./draw_arrow_head":20}],22:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],23:[function(t,e,n){"use strict";function r(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===r.length;if(!a&&3!==r.length)return t;for(var i=0;i=0))return t;if(3===i)r[i]>1&&(r[i]=1);else if(r[i]>=1)return t}var l=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return a?"rgba("+l+", "+r[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var n=a(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},i.combine=function(t,e){var n=a(t).toRgb();if(1===n.a)return a(t).toRgbString();var r=a(e||i.background).toRgb(),o=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},l={r:o.r*(1-n.a)+n.r*n.a,g:o.g*(1-n.a)+n.g*n.a,b:o.b*(1-n.a)+n.b*n.a};return a(l).toRgbString()},i.contrast=function(t,e,n){var r=a(t),o=r.isLight()?r.darken(n):r.lighten(e);return o.toString()},i.stroke=function(t,e){var n=a(e);t.style({stroke:i.tinyRGB(n),"stroke-opacity":n.getAlpha()})},i.fill=function(t,e){var n=a(e);t.style({fill:i.tinyRGB(n),"fill-opacity":n.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,n,a,o,l=Object.keys(t);for(e=0;el&&(o[1]-=(lt-l)/2)):n.node()&&!n.classed("js-placeholder")&&(lt=h.bBox(e.node()).height),lt){if(lt+=5,"top"===_.titleside)K.domain[1]-=lt/T.h,o[1]*=-1;else{K.domain[0]+=lt/T.h;var c=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),K.setScale()}}ot.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-K.domain[1]))+")");var f=ot.select(".cbfills").selectAll("rect.cbfill").data(z);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?C[0]:(z[e]+z[e-1])/2,e===z.length-1?C[1]:(z[e]+z[e+1])/2].map(K.c2p).map(Math.round);e!==z.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=P(t).replace("e-",""),i=a(o).toHexString();r.select(this).attr({x:Z,width:Math.max(B,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var d=ot.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){r.select(this).attr("d","M"+Z+","+(Math.round(K.c2p(t))+_.line.width/2%1)+"h"+B).call(h.lineGroupStyle,_.line.width,O(t),_.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=Z+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=K.titlefont.size,n=K._offset+K._length/2,a=T.l+(K.position||0)*T.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));k("h"+K._id+"title",{avoid:{selection:r.select(t).selectAll("g."+K._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:A.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function k(e,n){var r,a=b();r=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:K,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:ot.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;ot.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,n||{}))}function M(){var n=B+_.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(R=it.select("text"),R.node()&&!R.classed("js-placeholder")){var r,a=it.select(".h"+K._id+"title-math-group").node();r=a&&["top","bottom"].indexOf(_.titleside)!==-1?h.bBox(a).width:h.bBox(it.node()).right-Z-T.l,n=Math.max(n,r)}var o=2*_.xpad+n+_.borderwidth+_.outlinewidth/2,l=Q-$;ot.select(".cbbg").attr({x:Z-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-U,width:Math.max(o,2),height:Math.max(l+2*U,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),ot.selectAll(".cboutline").attr({x:Z,y:$+_.ypad+("top"===_.titleside?lt:0),width:Math.max(B,2),height:Math.max(l-2*_.ypad-lt,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var s=({center:.5,right:1}[_.xanchor]||0)*o;ot.attr("transform","translate("+(T.l-s)+","+T.t+")"),i.autoMargin(t,e,{x:_.x,y:_.y,l:o*({right:1,center:.5}[_.xanchor]||0),r:o*({left:1,center:.5}[_.xanchor]||0),t:l*({bottom:1,middle:.5}[_.yanchor]||0),b:l*({top:1,middle:.5}[_.yanchor]||0)})}var A=t._fullLayout,T=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var L,C=r.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],z=[],O="function"==typeof _.line.color?_.line.color:function(){return _.line.color},P="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},D=_.levels.end+_.levels.size/100,E=_.levels.size,N=1.001*C[0]-.001*C[1],I=1.001*C[1]-.001*C[0];for(L=_.levels.start;(L-D)*E<0;L+=E)L>N&&LC[0]&&L1){var at=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));et*=at*u.roundUp(rt/at,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+X,W+V-X],K.setScale();var ot=A._infolayer.selectAll("g."+e).data([0]);ot.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),ot.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var it=ot.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");K._axislayer=ot.select(".cbaxis");var lt=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var st,ct=T.l+(_.x+Y)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-X))*T.h+T.t+3+.75*ut:(1-(W+X))*T.h+T.t-3-.25*ut,k(K._id+"title",{attributes:{x:ct,y:st,"text-anchor":"start"}})}var ft=u.syncOrAsync([i.previousPromises,w,i.previousPromises,M],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var dt,ht,pt;c.init({element:ot.node(),prepFn:function(){dt=ot.attr("transform"),d(ot)},moveFn:function(t,e){ot.attr("transform",dt+" translate("+t+","+e+")"),ht=c.align(G+t/T.w,q,0,1,_.xanchor),pt=c.align(W-e/T.h,V,0,1,_.yanchor);var n=c.getCursor(ht,pt,_.xanchor,_.yanchor);d(ot,n)},doneFn:function(e){d(ot),e&&void 0!==ht&&void 0!==pt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":pt},b().index)}})}return ft}function b(){var n,r,a=e.substr(2);for(n=0;n=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":113,"./flip_scale":35,"./scales":42}],31:[function(t,e,n){"use strict";var r=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},r.colorscale,{}),cauto:a({},r.zauto,{}),cmax:a({},r.zmax,{}),cmin:a({},r.zmin,{}),autocolorscale:a({},r.autocolorscale,{}),reversescale:a({},r.reversescale,{})}}},{"../../lib/extend":111,"./attributes":29,"./scales.js":42}],32:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":42}],33:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,n,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,v=p[d+"min"],m=p[d+"max"],y=p.colorscale,x=r(v)&&r(m)&&v=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],36:[function(t,e,n){"use strict";var r=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=a),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":32,"./is_valid_scale_array":40,"./scales":42}],37:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?a.nestedProperty(t,e).get()||{}:t,i=n.color,l=!1;if(Array.isArray(i))for(var s=0;s4/3-l?i:l}},{}],44:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":113}],45:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},v=1,m=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=r},{"../../lib":113,"../../plotly":135,"../../plots/cartesian/constants":145,"./align":43,"./cursor":44,"./unhover":46}],46:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":110}],47:[function(t,e,n){"use strict";function r(t,e,n,r,a,o,i){if(l.traceIs(n,"symbols")){var c=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(n)?c(t.ms):(o.size||6)/2,t.mrc=e;var r=g.symbolNumber(t.mx||o.symbol)||0,a=r%100;return t.om=r%200>=100,g.symbolFuncs[a](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=r(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,n,r){var a=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(s.fill,r)},g.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},g.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},g.setRect=function(t,e,n,r,a){t.call(g.setPosition,e,n).call(g.setSize,r,a)},g.translatePoint=function(t,e,n,r){var a=t.xp||n.c2p(t.x),o=t.yp||r.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,n,r){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,n,r)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,n){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},g.singleLineStyle=function(t,e,n,r,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=n||o.width||0,l=a||o.dash||"";s.stroke(e,r||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=r||a.dash||"";o.select(this).call(s.stroke,n||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=o.select(this);try{n.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),n.remove()}})};var v=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,n){var a=n.marker,o=a.line,i=(n._input||{}).marker||{},l=g.tryColorscale(a,i,""),s=g.tryColorscale(a,i,"line.");r(t,e,n,l,s,a,o)},g.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=(e._input||{}).marker||{},a=g.tryColorscale(n,r,""),i=g.tryColorscale(n,r,"line.");t.each(function(t){g.singlePointStyle(t,o.select(this),e,a,i)})}},g.tryColorscale=function(t,e,n){var r=u.nestedProperty(t,n+"color").get(),a=u.nestedProperty(t,n+"colorscale").get(),o=u.nestedProperty(t,n+"cauto").get(),l=u.nestedProperty(t,n+"cmin"),s=u.nestedProperty(t,n+"cmax"),f=l.get(),d=s.get();return a&&Array.isArray(r)?(!o&&i(f)&&i(d)||(f=1/0,d=-(1/0),r.forEach(function(t){i(t)&&(f>t&&(f=+t),dd&&(f=0,d=1),l.set(f),s.set(d),u.nestedProperty(e,n+"cmin").set(f),u.nestedProperty(e,n+"cmax").set(d)),c.makeColorScaleFunc(c.extractScale(a,f,d))):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var n=o.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,n.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(f.convertToTspans);var d=o.select(this.parentNode),h=n.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,v=x[s]*u,m=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+v+","+m+")"),p>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],o=[];for(n=1;n=A&&(o.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=o.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":105,"../../lib":113,"../../lib/svg_text_utils":125,"../../registry":171,"../../traces/scatter/make_bubble_size_func":220,"../../traces/scatter/subtypes":225,"../color":23,"../colorscale":38,"./symbol_defs":48,d3:7,"fast-isnumeric":10}],48:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:7}],49:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],50:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&["linear","log"].indexOf(n.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);u&&v.style("opacity",0).transition().duration(n.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=r(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");l=!v.size(),l?v=e.append("path").classed("yerror",!0):u&&(v=v.transition().duration(n.duration).ease(n.easing)),v.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var m=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-m)+"v"+2*m+"m0,-"+m+"H"+i.xs,i.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":225,d3:7,"fast-isnumeric":10}],55:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":23,d3:7}],56:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":145}],57:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}e=e||{},r("source"),r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var l=0;l<2;l++){var s={_fullLayout:n},c=["x","y"][l];a.coerceRef(t,e,s,c,"paper")}return e}var a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var n=t.images,a=e.images=[],o=0;o=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],61:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine -},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":111,"../../plots/font_attributes":160,"../color/attributes":22}],62:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],63:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",v),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":113,"../../plots/layout_attributes":162,"../../registry":171,"./attributes":61,"./helpers":66}],64:[function(t,e,n){"use strict";function r(t,e){function n(n){m.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(m.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,v+=m,a.height=a.height+m,m=0),f.setTranslate(this,o+x,5+o+e.height/2+v),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,m=Math.max(e.height,m)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,F,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:m.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var m=n.legend,_=n.showlegend&&x(t.calcdata,m),k=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=n._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=M.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=L.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var z=S.selectAll("g.traces").data(f.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,S,z),l(t));var P=0,D=n.width,E=0,N=n.height;i(t,S,z),m.height>N?s(t):l(t);var I=n._size,R=I.l+I.w*m.x,j=I.t+I.h*(1-m.y);w.isRightAnchor(m)?R-=m.width:w.isCenterAnchor(m)&&(R-=m.width/2),w.isBottomAnchor(m)?j-=m.height:w.isMiddleAnchor(m)&&(j-=m.height/2);var F=m.width,B=I.w;F>B?(R=I.l,F=B):(R+F>D&&(R=D-F),RH?(j=I.t,q=H):(j+q>N&&(j=N-q),jn[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var v=s.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(l?r:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=v.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":113,"../../registry":171,"../../traces/pie/style_one":203,"../../traces/scatter/subtypes":225,"../color":23,"../drawing":47,d3:7}],69:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(v,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var m=a(l),y=[];return((c||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||m||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(v,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var v=u("bgcolor");u("activecolor",i.contrast(v,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":113,"../color":23,"./attributes":73,"./button_attributes":74,"./constants":75}],77:[function(t,e,n){"use strict";function r(t){for(var e=m.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../plots/cartesian/axes"),o=t("./constants"),i=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=e.shapes;if(n.length&&t._fullData.length)for(var i=0;ie;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},a=S.line.width?S.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",S.opacity).call(_.stroke,a).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);z&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&f(t,o,S,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={xref:l.xref,yref:l.yref},c={};"string"==typeof n&&n?c[n]=r:x.isPlainObject(n)&&(c=n);var u=Object.keys(c);for(o=0;oX&&r>Z&&!t.shiftKey?k.getCursor(a/n,1-o/r):"move";M(e,i),U=i.split("-")[0]}function o(e){F=b.getFromId(t,n.xref),B=b.getFromId(t,n.yref),q=T.getDataToPixel(t,F),H=T.getDataToPixel(t,B,!0),V=T.getPixelToData(t,F),Y=T.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(R=n.path,j=o+".path"):(u=q(n.x0),f=H(n.y0),d=q(n.x1),h=H(n.y1),g=o+".x0",m=o+".y0",x=o+".x1",_=o+".y1"),uZ&&(c[S]=n[D]=Y(l),c[z]=n[E]=Y(s)),f-u>X&&(c[O]=n[N]=V(u),c[P]=n[I]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,m,x,_,w,A,L,C,S,z,O,P,D,E,N,I,R,j,F,B,q,H,V,Y,U,X=10,Z=10,G={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=G.element.getBoundingClientRect();k.init(G)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.dataToLinear(l),r=function(t){return l._offset+l.l2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.dataToLinear(s),o=function(t){return s._offset+s.l2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,v=(d+h)/2,m=Math.abs(p-u),y=Math.abs(v-d),x="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function v(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var m=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults");e.exports={draw:r,drawOne:a}},{"../../lib":113,"../../lib/setcursor":123,"../../plotly":135,"../../plots/cartesian/axes":139,"../color":23,"../dragelement":45,"../drawing":47,"./constants":87,"./defaults":88,"./helpers":90,"./shape_defaults":92,"fast-isnumeric":10}],90:[function(t,e,n){"use strict";n.dataToLinear=function(t){return"category"===t.type?t.c2l:t.d2l},n.linearToData=function(t){return"category"===t.type?t.l2c:t.l2d},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.dataToLinear(e);a=function(t){return e._offset+e.l2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.linearToData(e);a=function(t){return i(e.p2l(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],91:[function(t,e,n){"use strict";n.moduleType="component",n.name="shapes",n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.calcAutorange=t("./calc_autorange");var r=t("./draw");n.draw=r.draw,n.drawOne=r.drawOne},{"./attributes":85,"./calc_autorange":86,"./defaults":88,"./draw":89}],92:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e){function n(e,n){return r.coerce(t,l,o,e,n)}var l={};n("layer"),n("opacity"),n("fillcolor"),n("line.color"),n("line.width"),n("line.dash");for(var s=t.path?"path":"rect",c=n("type",s),u=["x","y"],f=0;f<2;f++){var d=u[f],h={_fullLayout:e},p=a.coerceRef(t,l,h,d);if("path"!==c){var g=.25,v=.75;if("paper"!==p){var m=a.getFromId(h,p),y=i.linearToData(m);g=y(m.range[0]+g*(m.range[1]-m.range[0])),v=y(m.range[0]+v*(m.range[1]-m.range[0]))}n(d+"0",g),n(d+"1",v)}}return"path"===c?n("path"):r.noneOrAll(t,l,["x0","x1","y0","y1"]),l}},{"../../lib":113,"../../plots/cartesian/axes":139,"./attributes":85,"./helpers":90}],93:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":111,"../../plots/animation_attributes":136,"../../plots/font_attributes":160,"../../plots/pad_attributes":163,"./constants":94}],94:[function(t,e,n){"use strict";e.exports={name:"sliders",itemName:"slider",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],95:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}var l=a(t,e),s=r("visible",l.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,c,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+S.railTouchRectClass).data([0]);r.enter().append("rect").classed(S.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"), -r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,S.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),M.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+S.railRectClass).data([0]);n.enter().append("rect").classed(S.railRectClass,!0);var r=e.inputAreaLength-2*S.railInset;n.attr({width:r,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(n,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+S.groupClassName).data(n,a);s.enter().append("g").classed(S.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,S=O,k._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,v=n.propName,m=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(S).attr("class",e),z.attr({"data-unformatted":S}).call(f);var O="Click to enter "+y+" title";t._context.editable?(S||p(),z.call(u.makeEditable).on("edit",function(e){void 0!==m?o.restyle(t,v,e,m):o.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",C)}},{"../../lib":113,"../../lib/svg_text_utils":125,"../../plotly":135,"../../plots/plots":164,"../color":23,"../drawing":47,d3:7,"fast-isnumeric":10}],99:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":111,"../../plots/font_attributes":160,"../../plots/pad_attributes":163,"../color/attributes":22}],100:[function(t,e,n){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],101:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}var l=a(t,e),s=r("visible",l.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,c,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],105:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],106:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.19.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":21,"./components/images":59,"./components/legend":67,"./components/rangeselector":79,"./components/rangeslider":84,"./components/shapes":91,"./components/sliders":97,"./components/updatemenus":103,"./fonts/mathjax_config":107,"./lib/queue":121,"./plot_api/plot_schema":129,"./plot_api/register":130,"./plot_api/set_plot_config":131,"./plot_api/to_image":133,"./plot_api/validate":134,"./plotly":135,"./snapshot":176,"./snapshot/download":173,"./traces/scatter":215,d3:7,"es6-promise":8}],107:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],108:[function(t,e,n){"use strict";function r(t){return t&&void 0!==t.valType}var a=t("fast-isnumeric"),o=t("tinycolor2"),i=t("./nested_property"),l=t("./is_plain_object"),s=t("./filter_unique"),c=t("../components/colorscale/get_scale"),u=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,r){!a(t)||void 0!==r.min&&tr.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,r){t%1||!a(t)||void 0!==r.min&&tr.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){o(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(c(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):a(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&u.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!u.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o2)return!1;var i=o[0].split("-");if(i.length>3||3!==i.length&&o[1])return!1;if(4===i[0].length)e=Number(i[0]);else{if(2!==i[0].length)return!1;var s=(new Date).getFullYear();e=((Number(i[0])-s+70)%100+200)%100+s-70}return!!l(e)&&(1===i.length?new Date(e,0,1).getTime():(n=Number(i[1])-1,!(i[1].length>2)&&n>=0&&n<=11&&(2===i.length?new Date(e,n,1).getTime():(r=Number(i[2]),!(i[2].length>2)&&r>=1&&r<=31&&(r=new Date(e,n,r).getTime(),o[1]?(i=o[1].split(":"),!(i.length>3)&&(a=Number(i[0]),!(i[0].length>2)&&a>=0&&a<=23&&(r+=36e5*a,1===i.length?r:(n=Number(i[1]),!(i[1].length>2)&&n>=0&&n<=59&&(r+=6e4*n,2===i.length?r:(t=Number(i[2]),t>=0&&t<60&&r+1e3*t)))))):r)))))},n.isDateTime=function(t){return n.dateTime2ms(t)!==!1},n.ms2DateTime=function(t,e){e||(e=0);var n=new Date(t),a=i.time.format("%Y-%m-%d")(n);return e<7776e6?(a+=" "+r(n.getHours(),2),e<432e6&&(a+=":"+r(n.getMinutes(),2),e<108e5&&(a+=":"+r(n.getSeconds(),2),e<3e5&&(a+="."+r(n.getMilliseconds(),3)))),a.replace(/([:\s]00)*\.?[0]*$/,"")):a};var s={H:["%H:%M:%S~%L","%H:%M:%S","%H:%M"],I:["%I:%M:%S~%L%p","%I:%M:%S%p","%I:%M%p"],D:["%H","%I%p","%Hh"]},c={Y:["%Y~%m~%d","%Y%m%d","%y%m%d","%m~%d~%Y","%d~%m~%Y"],Yb:["%b~%d~%Y","%d~%b~%Y","%Y~%d~%b","%Y~%b~%d"],y:["%m~%d~%y","%d~%m~%y","%y~%m~%d"],yb:["%b~%d~%y","%d~%b~%y","%y~%d~%b","%y~%b~%d"]},u=i.time.format.utc,f={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(u),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(u)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(u)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){f[t].D.push(u(e)),["H","I","D"].forEach(function(n){s[n].forEach(function(r){var a=f[t][n];a.push(u(e+"~"+r)),a.push(u(r+"~"+e))})})})});var d=/[a-z]*/g,h=function(t){return t.substr(0,3)},p=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,g=/[\s,\/\-\.\(\)]+/g,v=/~?([ap])~?m(~|$)/,m=function(t,e){return e+"m "},y=/\d\d\d\d/,x=/(^|~)[a-z]{3}/,b=/[ap]m/,_=/:/,w=/q([1-4])/,k=["31~mar","30~jun","30~sep","31~dec"],M=function(t,e){return k[e-1]},A=/ ?([+\-]\d\d:?\d\d|Z)$/;n.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(d,h).replace(p,"").replace(g,"~").replace(v,m).replace(w,M).trim().replace(A,"");var e,n,r=null,i=a(t),l=o(t);e=f[i][l],n=e.length;for(var s=0;sn?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"./coerce":108,"./dates":109,"./extend":111,"./filter_unique":112,"./is_array":114,"./is_plain_object":115,"./loggers":116,"./matrix":117,"./nested_property":118,"./notifier":119,"./search":122,"./stats":124,d3:7}],114:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],115:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],116:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],i=!1,d(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");lo||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],s=t[1];if(no||sl)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],v=r[0][1],m=0;for(c=1;cMath.max(u,g)||s>Math.max(f,v)))if(su||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":117}],121:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;f90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":10}],125:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,v.indexOf(u.protocol)===-1?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var v=d.getPlotDiv(l.node());(v&&v._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],v=parseInt(l.style("font-size"),10)||r(l,"height"),m=-v/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,m-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:m-d/2}):"a"===p[0]?s.attr({x:0,y:m}):s.attr({x:g,y:+l.attr("y")+m-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(m," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":104,"../constants/xmlns_namespaces":105,"../lib":113,d3:7}],126:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function a(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var a=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=u.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&l(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sO.range[0]?[1,2]:[2,1]);else{var P=O.range[0],D=O.range[1];"log"===b?(P<=0&&D<=0&&n(L+".autorange",!0),P<=0?P=D/1e6:D<=0&&(D=P/1e6),n(L+".range[0]",Math.log(P)/Math.LN10),n(L+".range[1]",Math.log(D)/Math.LN10)):(n(L+".range[0]",Math.pow(10,P)),n(L+".range[1]",Math.pow(10,D)))}else n(L+".autorange",!0)}if("reverse"===A)C.range?C.range.reverse():(n(L+".autorange",!0),C.range=[1,0]),S.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var E=m.parts[1],N=m.parts[0],I=o[N]||[],R=I[E]||{};null===b&&(e[v]="remove"),2===m.parts.length&&("add"===e[v]||x.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?E===-1?(g[N]=I,delete g[v]):g[v]=R:x.log("???",e)),!r(R,"x")&&!r(R,"y")||x.containsAny(v,["color","opacity","align","dash"])||(h.docalc=!0);var j=w.getComponentMethod(N,"drawOne");j(t,E,m.parts.slice(2).join("."),e[v]),delete e[v]}else k.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1]?(z.manageArrayContainers(m,b,g),h.doplot=!0):(0===m.parts[0].indexOf("scene")?h.doplot=!0:0===m.parts[0].indexOf("geo")?h.doplot=!0:0===m.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===v?h.doplot=!0:!i._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?h.docalc=!0:m.parts[0].indexOf("legend")!==-1?h.dolegend=!0:v.indexOf("title")!==-1?h.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:m.parts.length>1&&x.containsAny(m.parts[1],["tick","exponent","grid","zeroline"])?h.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:m.parts.length>1&&m.parts[1].indexOf("line")!==-1?h.dolayoutstyle=!0:m.parts.length>1&&"mirror"===m.parts[1]?h.doticks=h.dolayoutstyle=!0:"margin.pad"===v?h.doticks=h.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(h.doplot=!0):h.doplot=!0,m.set(b))}}var F=t._fullLayout.width,B=t._fullLayout.height;k.supplyDefaults(t),t.layout.autosize&&k.plotAutoSize(t,t.layout,t._fullLayout);var q=e.height||e.width||t._fullLayout.width!==F||t._fullLayout.height!==B;return q&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=v.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];v.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(C.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var o=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=o.append("g").classed("imagelayer",!0),n._shapeUpperLayer=o.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),k=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),C=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),z=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,n,r){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=P._basePlotModules,n=0;n=i.length?i[0]:i[t]:i}function a(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}if(t=z.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),n=k.supplyAnimationDefaults(n);var i=n.transition,l=n.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,s){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function u(e){if(0!==e.length){for(var i=0;io._timeToNext&&d()};e()}function p(t){return Array.isArray(i)?m>=i.length?t.transitionOpts=i[m]:t.transitionOpts=i[0]:t.transitionOpts=i,m++,t}var g,v,m=0,y=[],b=void 0===e||null===e,_=Array.isArray(e),w=!b&&!_&&x.isPlainObject(e);if(w)y.push({type:"object",data:p(x.extendFlat({},e))});else if(b||"string"==typeof e)for(g=0;g0&&TT)&&L.push(v);y=L}}y.length>0?u(y):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,n){if(t=z.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,a,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(r=e.length-1;r>=0;r--)u.push({frame:k.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:c+r});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(a=u[r].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=k.modifyFrames,s=k.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),k.modifyFrames(t,o)},y.purge=function(t){t=z.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return k.cleanPlot([],{},n,e),k.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":47,"../components/errorbars":53,"../constants/xmlns_namespaces":105,"../lib":113,"../lib/events":110,"../lib/queue":121,"../lib/svg_text_utils":125,"../plotly":135,"../plots/cartesian/graph_interact":147,"../plots/plots":164,"../plots/polar":167,"../registry":171,"./helpers":126,"./subroutines":132,d3:7,"fast-isnumeric":10}],128:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],129:[function(t,e,n){"use strict";function r(t){var e=y.attributes,n=c({type:t}),r=f(t),a=h(t),o={},i={};o.type=null,k(o,e),o=l(n.attributes,o,"attributes",t),void 0!==a.attributes&&k(o,a.attributes),o.type=t,o=u(o),s(o),L.traces[t]=w({},r,{attributes:o}),void 0!==n.layoutAttributes&&(i=l(n.layoutAttributes,i,"layoutAttributes",t),s(i),L.traces[t].layoutAttributes=i)}function a(){var t=y.layoutAttributes,e={};e=l(t,e,"layoutAttributes","*"),e=d(e),e=p(e),e=u(e),s(e),g(e),L.layout={layoutAttributes:e}}function o(t){var e=m.transformsRegistry[t],n={};n=l(n,e.attributes||{},"attributes","*"),n=u(n),s(n),g(n),L.transforms[t]={attributes:n}}function i(){L.defs={valObjects:x.valObjects,metaKeys:x.UNDERSCORE_ATTRS.concat(["description","role"])}}function l(t,e,n,r){var a,o,i,s,u;return Object.keys(t).forEach(function(f){return f===A?void Object.keys(t[f]).forEach(function(s){a=c({_module:t[f][s]}),void 0!==a&&(o=a[n],i=l(o,{},n,r),x.nestedProperty(e,s).set(k({},i)))}):f===T?void Object.keys(t[f]).forEach(function(a){a===r&&(s=c({_module:t[f][a]}),void 0!==s&&(u=s[n],u=l(u,{},n,r),M(e,u)))}):void(e[f]=x.isPlainObject(t[f])?M({},t[f]):t[f])}),e}function s(t){function e(t){return{valType:"string"}}function n(t,n,r){C.isValObject(t)?"data_array"===t.valType?(t.role="data",r[n+"src"]=e(n)):t.arrayOk===!0&&(r[n+"src"]=e(n)):x.isPlainObject(t)&&(t.role="object")}x.crawl(t,n)}function c(t){if("type"in t)return"area"===t.type?{attributes:b}:m.getModule({type:t.type});var e=m.subplotsRegistry,n=m.componentsRegistry,r=t._module;return e[r]?e[r]:n[r]?n[r]:v[r]}function u(t){return Object.keys(t).forEach(function(e){"_"===e.charAt(0)&&x.UNDERSCORE_ATTRS.indexOf(e)===-1&&delete t[e]}),t}function f(t){return"area"===t?{}:m.modules[t].meta||{}}function d(t){return w(t,{radialaxis:_.radialaxis,angularaxis:_.angularaxis}),w(t,_.layout),t}function h(t){if("area"===t)return{};var e=m.subplotsRegistry,n=Object.keys(e).filter(function(e){return m.traceIs({type:t},e)})[0];return void 0===n?{}:e[n]}function p(t){var e=m.subplotsRegistry;return Object.keys(t).forEach(function(n){Object.keys(e).forEach(function(r){var a,o=e[r];o.attrRegex&&(a="cartesian"===r||"gl2d"===r?o.attrRegex.x.test(n)||o.attrRegex.y.test(n):o.attrRegex.test(n),a&&(t[n][x.IS_SUBPLOT_OBJ]=!0))})}),t}function g(t){function e(t,e,n){if(t[x.IS_LINKED_TO_ARRAY]===!0){var r=e.substr(0,e.length-1);delete t[x.IS_LINKED_TO_ARRAY],n[e]={items:{}},n[e].items[r]=t,n[e].role="object"}}x.crawl(t,e)}var v=t("../plotly"),m=t("../registry"),y=t("../plots/plots"),x=t("../lib"),b=t("../plots/polar/area_attributes"),_=t("../plots/polar/axis_attributes"),w=x.extendFlat,k=x.extendDeep,M=x.extendDeepAll,A="_nestedModules",T="_composedModules",L={traces:{},layout:{},transforms:{},defs:{}},C=e.exports={};C.get=function(){return m.allTypes.concat("area").forEach(r),a(),Object.keys(m.transformsRegistry).forEach(o),i(),L},C.crawl=x.crawl,C.isValObject=x.isValObject},{"../lib":113,"../plotly":135,"../plots/plots":164,"../plots/polar/area_attributes":165,"../plots/polar/axis_attributes":166,"../registry":171}],130:[function(t,e,n){"use strict";function r(t){i.register(t,t.name,t.categories,t.meta),i.subplotsRegistry[t.basePlotModule.name]||i.registerSubplot(t.basePlotModule)}function a(t){if("string"!=typeof t.name)throw new Error("Transform module *name* must be a string.");var e="Transform module "+t.name,n="function"==typeof t.transform,r="function"==typeof t.calcTransform;if(!n&&!r)throw new Error(e+" is missing a *transform* or *calcTransform* method.");n&&r&&l.log([e+" has both a *transform* and *calcTransform* methods.","Please note that all *transform* methods are executed","before all *calcTransform* methods."].join(" ")),l.isPlainObject(t.attributes)||l.log(e+" registered without an *attributes* object."),"function"!=typeof t.supplyDefaults&&l.log(e+" registered without a *supplyDefaults* method."),i.transformsRegistry[t.name]=t}function o(t){i.componentsRegistry[t.name]=t}var i=t("../registry"),l=t("../lib");e.exports=function(t){if(!t)throw new Error("No argument passed to Plotly.register.");t&&!Array.isArray(t)&&(t=[t]);for(var e=0;e1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.td;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":113,"../plotly":135,"../snapshot/cloneplot":172,"../snapshot/helpers":175,"../snapshot/svgtoimg":177,"../snapshot/tosvg":179,"fast-isnumeric":10}],134:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,v=n.length,m=0;mc&&e=864e5?t._tickround="d":n>=36e5?t._tickround="H":n>=6e4?t._tickround="M":n>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(n/2)/Math.LN10);else{x(n)||(n=Number(n.substr(1))),t._tickround=2-Math.floor(Math.log(n)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var r=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(r)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((r-1)/3):t._tickexponent=r)}else"M"===n.charAt(0)?t._tickround=2===n.length?"m":"y":t._tickround=null}function i(t,e){var n=t.match(q),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(q,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o=e.x,l=t._tickround,s=new Date(o),c="";n&&t.hoverformat?a=i(t.hoverformat,o):t.tickformat?a=i(t.tickformat,o):(r&&(x(l)?l+=2:l={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[l]),"y"===l?a=N(s):"m"===l?a=I(s):(o!==t._tmin||n||(c="
"+N(s)),"d"===l?a=R(s):"H"===l?a=j(s):(o!==t._tmin||n||(c="
"+R(s)+", "+N(s)),a=F(s),"M"!==l&&(a+=B(s),"S"!==l&&(a+=d(m(o/1e3,1),t,"none",n).substr(1)))))),e.text=a+c}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&m(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,m(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=t<0,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=H[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var p=r-1,g=r+1;n="tozero"===t.rangemode?r<0?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var n=T.list(t,"",!0),r=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,v=e.length,m=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=v-1;o>5;o--)a(o)}},T.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[o,i]};T.autoTicks(f,l);var d,h=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var a=t.range[1]=l:s<=l)&&(i.push(s),!(i.length>1e3));s=T.tickIncrement(s,t.dtick,a));t._tmax=i[i.length-1];for(var c=new Array(i.length),u=0;u157788e5?(e/=315576e5,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,S)):e>12096e5?(e/=26298e5,t.dtick="M"+a(e,1,z)):e>432e5?(t.dtick=a(e,864e5,P),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=a(e,36e5,z):e>3e4?t.dtick=a(e,6e4,O):e>500?t.dtick=a(e,1e3,O):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var r=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/r,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,S)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?E:D,s=t+.01*r,c=_.roundUp(m(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]r:c1&&e2*r}function o(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("./clean_datum");e.exports=function(t){return a(t)?"date":o(t)?"category":r(t)?"linear":"-"}},{"../../lib":113,"./clean_datum":144,"fast-isnumeric":10}],141:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var l=i(e,n,r);if(l){if("histogram"===l.type&&r==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,r)){for(var s,u=a(l),f=[],d=0;d0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],144:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return a.ms2DateTime(t);if("string"!=typeof t&&!r(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){a.error(e,t)}return t}},{"../../lib":113,"fast-isnumeric":10}],145:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],146:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?f.ms2DateTime(r,a):"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,n,l,_,w,k,M){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+vt+", "+mt+")").attr("d",ut+"Z"),pt=gt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+vt+", "+mt+")").attr("d","M0,0Z"),S();for(var o=0;o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),pt.transition().style("opacity",1).duration(200),ft=!0)}function O(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),b=!1)))}function D(e,n){var a=1===(k+M).length;if(e)j();else if(2!==n||a){if(1===n&&a){var o=k?V[0]:H[0],i="s"===k||"w"===M?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",f="middle";if(o.fixedrange)return;k?(f="n"===k?"top":"bottom","right"===o.side&&(u="right")):"e"===M&&(u="right"),rt.call(d.makeEditable,null,{immediate:!0,background:B.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var n="category"===o.type?o.c2l(e):o.d2l(e);void 0!==n&&c.relayout(t,l,n)})}}else R()}function E(e){function n(t,e,n){if(!t.fixedrange){T(t.range);var r=t.range,a=r[0]+(r[1]-r[0])*e;t.range=[a+(r[0]-a)*n,a+(r[1]-a)*n]}}if(t._context.scrollZoom||B._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(L(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(xt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=_t.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=yt[0]+yt[2]*s,u=(l.bottom-e.clientY)/l.height,d=yt[1]+yt[3]*(1-u);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,n){for(var r=1-e,o=0,i=0;i0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rG.width||Z<0||Z>G.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:M[0]._length/2,Z="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?r(o,e.xval):a(M,X),P="yval"in e?r(o,e.yval):a(A,Z),!g(O[0])||!g(P[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(E=0;E1||I.hoverinfo.indexOf("name")!==-1?I.name:void 0,index:!1,distance:Math.min(W,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[R]&&(H.subplot=i[R]._subplot),V=Y.length,"array"===F){var Q=e[E];"pointNumber"in Q?(H.index=Q.pointNumber,F="closest"):(F="","xval"in Q&&(B=Q.xval,F="x"),"yval"in Q&&(q=Q.yval,F=F?"closest":"y"))}else B=O[j],q=P[j];if(I._module&&I._module.hoverPoints){var $=I._module.hoverPoints(H,B,q,F);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&Y.push(s(J,z))}else v.log("Unrecognized trace type in hover:",I);"closest"===z&&Y.length>V&&(Y.splice(0,V),W=Y[0].distance)}if(0===Y.length)return _.unhoverRaw(t,e);var tt="y"===z&&U.length>1;Y.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),nt={hovermode:z,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},rt=c(Y,nt);u(Y,tt?"xa":"ya"),f(rt,tt);var at=t._hoverdata,ot=[];for(D=0;D128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),v=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),v=d.node().getBoundingClientRect().width+2*P):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var m,k,L=f.node().getBoundingClientRect(),C=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),D=Math.abs(t.y1-t.y0),E=L.width+O+P+v;t.ty0=_-L.top,t.bx=L.width+2*P,t.by=L.height+2*P,t.anchor="start",t.txwidth=L.width,t.tx2width=v,t.offset=0,o?(t.pos=C,m=S+D/2+E<=M,k=S-D/2-E>=0,"top"!==t.idealAlign&&m||!k?m?(S+=D/2,t.anchor="start"):t.anchor="middle":(S-=D/2,t.anchor="end")):(t.pos=S,m=C+z/2+E<=w,k=C-z/2-E>=0,"left"!==t.idealAlign&&m||!k?m?(C+=z/2,t.anchor="start"):t.anchor="middle":(C-=z/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+C+","+S+")"+(o?"rotate("+T+")":""))}),S}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?C:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var v=f[i];for(l=v.length-1;l>=0;l--){var m=v[l],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(O+P),l=i+o*(t.txwidth+P),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-z,s=t.offset*S),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*O+s)+","+(O+c)+"v"+(t.by/2-O)+"h"+r*t.bx+"v-"+t.by+"H"+(r*O+s)+"V"+(c-O)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*P+s,c+t.ty0-t.by/2+P),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=e.exports={};A.unhover=_.unhover,A.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},A.supplyLayoutDefaults=function(t,e,n){function r(n,r){return v.coerce(t,e,A.layoutAttributes,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=A.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},A.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+k.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},A.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},A.getClosest=function(t,e,n){if(n.index!==!1)n.index>=0&&n.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":113,"fast-isnumeric":10}],153:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,v=a.element.getBoundingClientRect(),m=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-v.left,b=n-v.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),C=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",k+"Z");var z,O,P,D,E,N=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,j=[];for(z=0;z0)return Math.log(e)/Math.LN10;if(e<=0&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*u*Math.abs(r-a))}return i.BADNUM}function n(t){return Math.pow(10,t)}function c(t){return a(t)?Number(t):i.BADNUM}var u=10;if(t.c2l="log"===t.type?e:c,t.l2c="log"===t.type?n:c,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(e){var n,r=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var i=s.getFromId(t._gd,t.overlaying);t.domain=i.domain}var l=e&&t._r?t._r:t.range;for(l&&2===l.length&&l[0]!==l[1]||(l=[-1,1]),n=0;n<2;n++)a(l[n])||(l[n]=a(l[1-n])?l[1-n]*(n?10:.1):n?1:-1),l[n]<-(Number.MAX_VALUE/2)?l[n]=-(Number.MAX_VALUE/2):l[n]>Number.MAX_VALUE/2&&(l[n]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l[0]-l[1]),t._b=-t._m*l[1]):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l[1]-l[0]),t._b=-t._m*l[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):i.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},["linear","log","-"].indexOf(t.type)!==-1)t.c2d=c,t.d2c=function(t){return t=l(t),a(t)?Number(t):i.BADNUM},t.d2l=function(e,n){return"log"===t.type?t.c2l(t.d2c(e),n):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return a(t)?o.ms2DateTime(t):i.BADNUM},t.d2c=function(t){return a(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(o.dateTime2ms);!a(t.range[0])&&a(f[0])&&(t.range[0]=f[0]),!a(t.range[1])&&a(f[1])&&(t.range[1]=f[1])}catch(e){o.error(e,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var n=t._categories.indexOf(e);return n===-1?i.BADNUM:n},t.d2l=t.d2c);t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;on.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var k;c&&(k=c());var M,A,T,L=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),M=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":113,"../../plotly":135,"../../registry":171,"./axes":139,d3:7}],159:[function(t,e,n){"use strict";function r(t,e,n){var r,a,o,i=!1;if("data"===e.type)r=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;r=t._fullLayout}return a=c.nestedProperty(r,e.prop).get(),o=n[e.type]=n[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var n=[],r=e[0],a={};if("string"==typeof r)a[r]=e[1];else{if(!c.isPlainObject(r))return n;a=r}return l(a,function(t,e,r){n.push({type:"layout",prop:t,value:r})},"",0),n}function i(t,e){var n,r,a,o,i=[];if(r=e[0],a=e[1],n=e[2],o={},"string"==typeof r)o[r]=a;else{if(!c.isPlainObject(r))return i;o=r,void 0===n&&(n=a)}return void 0===n&&(n=null),l(o,function(e,r,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);n&&(l=Math.min(l,n.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,r+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");n.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=n.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){r(t,s,i.cache),i.check=function(){if(l){var e=r(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(n._initialAutoSizeIsDone){var c=n.width,f=n.height;p.supplyLayoutGlobalDefaults(o,r),o.width||(r.width=c),o.height||(r.height=f)}else{p.supplyLayoutGlobalDefaults(o,r);var d=!o.width||!o.height,h=r.autosize,g=t._context&&t._context.autosizable,v=d&&(h||g);v?p.plotAutoSize(t,o,r):d&&p.sanitizeMargins(t),!h&&d&&(o.width=r.width,o.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=s.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,r),r._has=p._hasPlotType.bind(r);var m=r._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,v=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(g*(v.width-f)),a=Math.round(g*(v.height-h))}else{var m=s?window.getComputedStyle(t):{};r=parseFloat(m.width)||n.width,a=parseFloat(m.height)||n.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;r1,_=!e.height&&Math.abs(n.height-a)>1;(_||b)&&(b&&(n.width=r),_&&(n.height=a)),t._initialAutoSize||(t._initialAutoSize={width:r,height:a}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n){var r,a;u.Axes.supplyLayoutDefaults(t,e,n);var o=e._basePlotModules;for(r=0;r.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var v=s[t].t.val,m=s[t].t.size;if(v>d){var y=(h*v+(m-e.height)*d)/(v-d),x=(m*(1-d)+(h-e.height)*(1-v))/(v-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!t._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):t&&t.getTime?d.ms2DateTime(t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var n,r,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(n=0;n0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(n)for(l=0;l=0,S=C?f.angularAxis.domain:r.extent(M),z=Math.abs(M[1]-M[0]);T&&!A&&(z=0);var O=S.slice();L&&A&&(O[1]+=z);var P=f.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),f.angularAxis.ticksStep&&(P=(O[1]-O[0])/P);var D=f.angularAxis.ticksStep||(O[1]-O[0])/(P*(f.minorTicks+1));k&&(D=Math.max(Math.round(D),1)),O[2]||(O[2]=D);var E=r.range.apply(this,O);if(E=E.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=r.scale.linear().domain(O.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?z:0,e=r.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var N="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(N,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=r.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var j,F=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},q={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){j=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=i.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});i.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},i.Legend.defaultConfig().legendConfig,{container:j,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=j.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],a.range([0,x]),u.layout.radialAxis.domain=a.domain(),j.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else j=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var Y=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(Y[0]=Math.max(0,Y[0]),Y[1]=Math.max(0,Y[1]),e.select(".outer-group").attr("transform","translate("+Y+")"),f.title){var U=e.select("g.title-group text").style(q).text(f.title),X=U.node().getBBox();U.attr({x:_[0]-X.width/2,y:_[1]-x-20})}var Z=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var G=Z.selectAll("circle.grid-circle").data(a.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(B),G.attr("r",a),G.exit().remove()}Z.select("circle.outside-circle").attr({r:x}).style(B);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=r.svg.axis().scale(a).ticks(5).tickSize(5);Z.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Z.selectAll(".domain").style(B),Z.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(q).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,q["font-size"]]+")":"translate("+[0,q["font-size"]]+")"}}),Z.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(E),J=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),J.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(q);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?n<270&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(n<=180&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(q);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=r.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=a,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=r.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return o(i[n].defaultConfig(),t)});i[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=i.tooltipPanel().config({container:ct,fontSize:8})(),ft=i.tooltipPanel().config({container:ct,fontSize:8})(),dt=i.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var n=i.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=i.util.convertToCartesian(x+12,n+180);ut.text(i.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var n=i.util.getMousePos(W).radius;pt.attr({r:n}).style({opacity:.5}),lt=a.invert(i.util.getMousePos(W).radius);var r=i.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(i.util.round(lt)).move([r[0]+_[0],r[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var a=r.select(this),o=a.style("fill"),l="black",s=a.style("opacity")||1;if(a.attr({"data-opacity":s}),"none"!=o){a.attr({"data-fill":o}),l=r.hsl(o).darker().toString(),a.style({fill:l,opacity:1});var c={t:i.util.round(t[0]),r:i.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-Y[0]-d.left,f.top+f.height/2-Y[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else o=a.style("stroke"),a.attr({"data-stroke":o}),l=r.hsl(o).darker().toString(),a.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==r.event.which&&void(r.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=r.select(this),a=n.attr("data-fill");a?n.style({fill:a,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,a,l,s={data:[],layout:{}},c={},u={},f=r.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=i.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),o(s.data[e],i.Axis.defaultConfig().data[0]),o(s.data[e],t)}),o(s.layout,i.Axis.defaultConfig().layout),o(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},r.rebind(d,f,"on"),d},i.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:r.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},i.util={},i.DATAEXTENT="dataExtent",i.AREA="AreaChart",i.LINE="LinePlot",i.DOT="DotPlot",i.BAR="BarChart",i.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},i.util._extend=function(t,e){for(var n in t)e[n]=t[n]},i.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},i.util.dataFromEquation2=function(t,e){var n=e||6,a=r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return a},i.util.dataFromEquation=function(t,e,n){var a=e||6,o=[],i=[];r.range(0,360+a,a).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},i.util.ensureArray=function(t,e){if("undefined"==typeof t)return null; -var n=[].concat(t);return r.range(e).map(function(t,e){return n[e]||n[0]})},i.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=i.util.ensureArray(t[e],n)}),t},i.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},i.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},i.util.sumArrays=function(t,e){return r.zip(t,e).map(function(t,e){return r.sum(t)})},i.util.arrayLast=function(t){return t[t.length-1]},i.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return n===-2},i.util.flattenArray=function(t){for(var e=[];!i.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},i.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},i.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},i.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},i.util.getMousePos=function(t){var e=r.mouse(t.node()),n=e[0],a=e[1],o={};return o.x=n,o.y=a,o.pos=e,o.angle=180*(Math.atan2(a,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+a*a),o},i.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;a0)){var l=r.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(n,a,o)},"fill-opacity":0,stroke:function(t,e){return v.stroke(n,a,o)},"stroke-width":function(t,e){return v["stroke-width"](n,a,o)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](n,a,o)},opacity:function(t,e){return v.opacity(n,a,o)},display:function(t,e){return v.display(n,a,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=r.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,a){r.select(this).attr({class:"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var v={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},m=r.select(this).selectAll("g.layer").data(s);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,n=[i.PolyChart.defaultConfig()],a=r.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),o(n[e],i.PolyChart.defaultConfig()),o(n[e],t)}),this):n},t.getColorScale=function(){return e},r.rebind(t,a,"on"),t},i.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}};return t},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},i.Legend=function(){function t(){var n=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=o({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),i=r.merge(a);i=i.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(i=i.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=r.select(l));var s=i.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof i[0]:n.isContinuous,f=u?n.height:c*i.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=r.range(i.length),v=r.scale[u?"linear":"ordinal"]().domain(g).range(s),m=r.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":r.svg.symbolTypes.indexOf(t)!=-1?r.svg.symbol().type(t).size(n)():r.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(i);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,m(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return v(e)}}),b.exit().remove()}var _=r.svg.axis().scale(m).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return i[e].name}),t}var e=i.Legend.defaultConfig(),n=r.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},r.rebind(t,n,"on"),t},i.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},i.tooltipPanel=function(){var t,e,n,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=10,c=function(){t=a.container.selectAll("g."+l).data([0]);var r=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=r.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=r.append("text").attr({dx:a.padding+s,dy:.3*+a.fontSize}),c};return c.text=function(o){var i=r.hsl(a.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var d=a.padding,h=e.node().getBBox(),p={fill:a.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,v=h.height+2*d;return n.attr({d:"M"+[[s,-v/2],[s,-v/4],[a.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-v/2+2*d]+")"}),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 o(a,t),c},c},i.tooltipPanel.uid=1,i.adapter={},i.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=o({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var r=a.indexOf(t.geometry);r!=-1&&(n.data[e].groupId=r)})}if(t.layout){var l=o({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};r.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../lib":113,d3:7}],169:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../lib"),o=t("../../components/color"),i=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){function e(e,a){return a&&(f=a),r.select(r.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?s(n,e):e,o||(o=i.Axis()),u=i.adapter.plotly().convert(n),o.config(u).render(f),t.data=n.data,t.layout=n.layout,c.fillLayout(t),n}var n,a,o,u,f,d=new l;return e.isPolar=!0,e.svg=function(){return o.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return i.adapter.plotly().convert(o.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:o.angularScale(),r:o.radialScale()}},e.setUndoPoint=function(){var t=this,e=i.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,a),a=i.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},c.fillLayout=function(t){var e=r.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:o.background,_container:e,_paperdiv:n,_paper:a};t._fullLayout=s(i,t.layout)}},{"../../components/color":23,"../../lib":113,"./micropolar":168,"./undo_manager":170,d3:7}],170:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return r!==-1},hasRedo:function(){return r-1}var o=t("../lib"),i=t("../plots/plots"),l=o.extendFlat,s=o.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,o=t.data,c=t.layout,u=s([],o),f=s({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;n=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var v,m,y,x,b=e.p+(h?d[n]:d),_=b+(g?p[n]:p),w=e.b,k=w+e.s;if("h"===l.orientation?(y=u.c2p(b,!0),x=u.c2p(_,!0),v=c.c2p(w,!0),m=c.c2p(k,!0)):(v=c.c2p(b,!0),m=c.c2p(_,!0),y=u.c2p(w,!0),x=u.c2p(k,!0)),!(a(v)&&a(m)&&a(y)&&a(x)&&v!==m&&y!==x))return void r.select(this).remove();var M=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,A=r.round(M/2%1,2);if(!t._context.staticPlot){var T=i.opacity(e.mc||l.marker.color),L=T<1||M>.01?o:s;v=L(v,m),m=L(m,v),y=L(y,x),x=L(x,y)}r.select(this).attr("d","M"+v+","+y+"V"+x+"H"+m+"V"+y+"Z")})}),d.call(l.plot,e)}},{"../../components/color":23,"../../components/errorbars":53,"../../lib":113,"./arrays_to_calcdata":180,d3:7,"fast-isnumeric":10}],189:[function(t,e,n){"use strict";function r(t,e,n,r){if(r.length){var l,s,c,u,f,d=t._fullLayout.barmode,h="overlay"===d,p="group"===d;if(h)a(t,e,n,r);else if(p){for(l=[],s=[],c=0;cs+i&&(c=!0,s=y)),m(e.c2l(g))&&(gs+i&&(c=!0,s=g))}}x.expand(e,[l,s],{tozero:!0,padded:c})}function v(t){return t._id.charAt(0)}var m=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var n,a=e.xaxis,o=e.yaxis,i=t._fullData,l=t.calcdata,s=[],c=[];for(n=0;n1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&r.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,n=e.marker,i=n.line,l=(e._input||{}).marker||{},s=o.tryColorscale(n,l,""),c=o.tryColorscale(n,l,"line.");r.select(this).selectAll("path").each(function(t){var e,o,l=(t.mlw+1||i.width+1)-1,u=r.select(this);e="mc"in t?t.mcc=s(t.mc):Array.isArray(n.color)?a.defaultLine:n.color,u.style("stroke-width",l+"px").call(a.fill,e),l&&(o="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":23,"../../components/drawing":47,"../../components/errorbars":53,d3:7}],192:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,n,i,l){n("marker.color",i),a(t,"marker")&&o(t,e,l,n,{prefix:"marker.",cLetter:"c"}),n("marker.line.color",r.defaultLine),a(t,"marker.line")&&o(t,e,l,n,{prefix:"marker.line.",cLetter:"c"}),n("marker.line.width")}},{"../../components/color":23,"../../components/colorscale/defaults":33,"../../components/colorscale/has_colorscale":37}],193:[function(t,e,n){"use strict";var r=t("../../components/color/attributes"),a=t("../../plots/font_attributes"),o=t("../../plots/attributes"),i=t("../../lib/extend").extendFlat;e.exports={labels:{valType:"data_array"},label0:{valType:"number",dflt:0},dlabel:{valType:"number",dflt:1},values:{valType:"data_array"},marker:{colors:{valType:"data_array"},line:{color:{valType:"color",dflt:r.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},scalegroup:{valType:"string",dflt:""},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"]},hoverinfo:i({},o.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0},textfont:i({},a,{}),insidetextfont:i({},a,{}),outsidetextfont:i({},a,{}),domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},hole:{valType:"number",min:0,max:1,dflt:0},sort:{valType:"boolean",dflt:!0},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise"},rotation:{valType:"number",min:-360,max:360,dflt:0},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0}}},{"../../components/color/attributes":22,"../../lib/extend":111,"../../plots/attributes":137,"../../plots/font_attributes":160}],194:[function(t,e,n){"use strict";function r(t,e){for(var n=[],r=0;r")}return g};var s},{"../../components/color":23,"./helpers":197,"fast-isnumeric":10,tinycolor2:13}],196:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(n,o){return r.coerce(t,e,a,n,o)}var l=r.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,v=g||"inside"===p,m=g||"outside"===p;if(v||m){var y=l(i,"textfont",o.font);v&&l(i,"insidetextfont",y),m&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":113,"./attributes":193}],197:[function(t,e,n){"use strict";var r=t("../../lib");n.formatPiePercent=function(t,e){var n=(100*t).toPrecision(3);return n.lastIndexOf(".")!==-1&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)+"%"},n.formatPieValue=function(t,e){var n=t.toPrecision(10);return n.lastIndexOf(".")!==-1&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)}},{"../../lib":113}],198:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.layoutAttributes=t("./layout_attributes"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.styleOne=t("./style_one"),r.moduleType="trace",r.name="pie",r.basePlotModule=t("./base_plot"),r.categories=["pie","showLegend"],r.meta={},e.exports=r},{"./attributes":193,"./base_plot":194,"./calc":195,"./defaults":196,"./layout_attributes":199,"./layout_defaults":200,"./plot":201,"./style":202,"./style_one":203}],199:[function(t,e,n){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],200:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function n(n,o){return r.coerce(t,e,a,n,o)}n("hiddenlabels")}},{"../../lib":113,"./layout_attributes":199}],201:[function(t,e,n){"use strict";function r(t,e,n){var r=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/n.vTotal,.5),l=1-n.trace.hole,s=a(e,n),c={scale:s*n.r*2/r,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=n.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/n.r)-f*o/n.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=n.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),v={scale:2*g/t.width,rCenter:Math.cos(g/n.r)-g/o/n.r,rotate:(180/Math.PI*e.midangle+810)%180-90},m=v.scale>d.scale?v:d;return c.scale<1&&m.scale>c.scale?m:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var n=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(n)),(1-e.trace.hole)/2)}function o(t,e){var n=e.pxmid[0],r=e.pxmid[1],a=t.width/2,o=t.height/2;return n<0&&(a*=-1),r<0&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+n*n/(r*r)),outside:!0}}function i(t,e){function n(t,e){return t.pxmid[1]-e.pxmid[1]}function r(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,n){n||(n={});var r,a,o,l,d,h,g=n.labelExtraY+(i?n.yLabelMax:n.yLabelMin),v=i?t.yLabelMin:t.yLabelMax,m=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-v;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-v-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(m+t.labelExtraY-y)*f>0&&(r=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+r-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,v,m;for(i=0;i<2;i++)for(l=i?n:r,c=i?Math.max:Math.min,f=i?1:-1,o=0;o<2;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),v=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(n/c(l.tilt,Math.sin(s),l.depth),r/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&h.indexOf(l.scalegroup)===-1&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,n){if(!t)return 1;var r=Math.sin(t*Math.PI/180);return Math.max(.01,n*r*Math.abs(e)+2*Math.sqrt(1-r*r*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var n=t._fullLayout;l(e,n._size);var c=n._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],v=c.trace,m=0,y=(v.depth||0)*c.r*Math.sin(m)/2,x=v.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(m),k=l.selectAll("g.part").data(v.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],m=!1;l.each(function(i){function l(e){var r=t._fullLayout,o=t._fullData[v.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&r.hovermode!==!1&&"none"!==l&&"skip"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=n.separators,p=[];l.indexOf("label")!==-1&&p.push(i.label),o.text&&o.text[i.i]&&l.indexOf("text")!==-1&&p.push(o.text[i.i]),l.indexOf("value")!==-1&&p.push(g.formatPieValue(i.v,h)),l.indexOf("percent")!==-1&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:l.indexOf("name")!==-1?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:r._hoverlayer.node(),outerContainer:r._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(n._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],t._hoverdata.trace=e.trace,f.click(t,{target:!0})}function b(t,e,n,r){return"a"+r*c.r+","+r*w+" "+x+" "+i.largeArc+(n?" 1 ":" 0 ")+r*(e[0]-t[0])+","+r*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y),v.pull){var C=+(Array.isArray(v.pull)?v.pull[i.i]:v.pull)||0;C>0&&(k+=C*i.pxmid[0],M+=C*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var S=v.hole;if(i.v===c.vTotal){var z="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";S?T.attr("d","M"+(k+S*i.px0[0])+","+(M+S*i.px0[1])+b(i.px0,i.pxmid,!1,S)+b(i.pxmid,i.px0,!1,S)+"Z"+z):T.attr("d",z)}else{var O=b(i.px0,i.px1,!0,1);if(S){var P=1-S;T.attr("d","M"+(k+S*i.px1[0])+","+(M+S*i.px1[1])+b(i.px1,i.px0,!1,S)+"l"+P*i.px0[0]+","+P*i.px0[1]+O+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+O+"Z")}var D=Array.isArray(v.textposition)?v.textposition[i.i]:v.textposition,E=A.selectAll("g.slicetext").data(i.text&&"none"!==D?[0]:[]);E.enter().append("g").classed("slicetext",!0),E.exit().remove(),E.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===D?v.outsidetextfont:v.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,n=h.bBox(t.node());"outside"===D?e=o(n,i):(e=r(n,i,c),"auto"===D&&e.scale<1&&(t.call(h.font,v.outsidetextfont),v.outsidetextfont.family===v.insidetextfont.family&&v.outsidetextfont.size===v.insidetextfont.size||(t.attr({"data-bb":""}),n=h.bBox(t.node())),e=o(n,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-n.height/2,i.yLabelMid=l,i.yLabelMax=l+n.height/2,i.labelExtraX=0,i.labelExtraY=0,m=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(n.left+n.right)/2+","+-(n.top+n.bottom)/2+")")})}),m&&i(s,v),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),n=e.select("g.slicetext text");n.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+n.attr("transform"));var r=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+r+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(r+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,v.outsidetextfont.color).attr({"stroke-width":Math.min(2,v.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":23,"../../components/drawing":47,"../../lib/svg_text_utils":125,"../../plots/cartesian/graph_interact":147,"./helpers":197,d3:7}],202:[function(t,e,n){"use strict";var r=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],n=e.trace,o=r.select(this);o.style({opacity:n.opacity}),o.selectAll(".top path.surface").each(function(t){r.select(this).call(a,t,n)})})}},{"./style_one":203,d3:7}],203:[function(t,e,n){"use strict";var r=t("../../components/color");e.exports=function(t,e,n){var a=n.marker.line.color;Array.isArray(a)&&(a=a[e.i]||r.defaultLine);var o=n.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(r.stroke,a)}},{"../../components/color":23}],204:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t){var e=t[0].trace,n=e.marker;if(r.mergeArray(e.text,t,"tx"),r.mergeArray(e.textposition,t,"tp"),e.textfont&&(r.mergeArray(e.textfont.size,t,"ts"),r.mergeArray(e.textfont.color,t,"tc"),r.mergeArray(e.textfont.family,t,"tf")),n&&n.line){var a=n.line;r.mergeArray(n.opacity,t,"mo"),r.mergeArray(n.symbol,t,"mx"),r.mergeArray(n.color,t,"mc"),r.mergeArray(a.color,t,"mlc"),r.mergeArray(a.width,t,"mlw")}}},{"../../lib":113}],205:[function(t,e,n){"use strict";var r=t("../../components/colorscale/color_attributes"),a=t("../../components/drawing"),o=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},ids:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"},simplify:{valType:"boolean",dflt:!0}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:o({},{symbol:{valType:"enumerated",values:a.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:o({},{width:{valType:"number",min:0,arrayOk:!0}},r("marker.line"))},r("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":31,"../../components/drawing":47,"../../lib/extend":111,"./constants":210}],206:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var n,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},v={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var m={type:"linear"};a.setConvert(m),s=m.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=v.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,a.expand(u,d,g),a.expand(f,h,v);var b=new Array(p);for(c=0;c=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}}}}},{}],208:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,s=n.marker,c="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===s||!s.showscale)return void o.autoMargin(t,c);var u=s.color,f=s.cmin,d=s.cmax;r(f)||(f=a.aggNums(Math.min,null,u)),r(d)||(d=a.aggNums(Math.max,null,u));var h=e[0].t.cb=l(t,c),p=i.makeColorScaleFunc(i.extractScale(s.colorscale,f,d),{noNumericCheck:!0});h.fillcolor(p).filllevels({start:f,end:d,size:(d-f)/254}).options(s.colorbar)()}},{"../../components/colorbar/draw":26,"../../components/colorscale":38,"../../lib":113,"../../plots/plots":164,"fast-isnumeric":10}],209:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":30,"../../components/colorscale/has_colorscale":37,"./subtypes":225}],210:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],211:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var v=l(t,e,g),m=vq!=D>=q&&(z=C[T-1][0],O=C[T][0],S=z+(O-z)*(q-P)/(D-P),R=Math.min(R,S),j=Math.max(j,S));R=Math.max(R,0),j=Math.min(j,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:j,y0:q,y1:q,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":23,"../../components/errorbars":53,"../../lib":113,"../../plots/cartesian/constants":145,"../../plots/cartesian/graph_interact":147,"./get_trace_color":213}],215:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.animatable=!0,r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":148,"./arrays_to_calcdata":204, -"./attributes":205,"./calc":206,"./clean_data":207,"./colorbar":208,"./defaults":211,"./hover":214,"./plot":222,"./select":223,"./style":224,"./subtypes":225}],216:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=!Array.isArray(l)&&l||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":33,"../../components/colorscale/has_colorscale":37}],217:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),r=k.c2p(t[e].y);return n!==S&&r!==S&&[n,r]}function a(t){var e=t[0]/w._length,n=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*T}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,v,m,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.simplify,A=e.connectGaps,T=e.baseTolerance,L=e.linear,C=[],S=r.BADNUM,z=.2,O=new Array(t.length),P=0;for(M||(T=z=-1),i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,c=f,h=!1):y=t.length||!f)break;O[P++]=f,l=f}}else O[P++]=c}C.push(O.slice(0,P))}return C}},{"../../plots/cartesian/axes":139}],218:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],219:[function(t,e,n){"use strict";e.exports=function(t,e,n){for(var r,a,o=null,i=0;i0?Math.max(e,a):0}}},{"fast-isnumeric":10}],221:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":23,"../../components/colorscale/defaults":33,"../../components/colorscale/has_colorscale":37,"./subtypes":225}],222:[function(t,e,n){"use strict";function r(t,e){var n;e.selectAll("g.trace").each(function(t){var e=i.select(this);if(n=t[0].trace,n._nexttrace){if(n._nextFill=e.select(".js-fill.js-tonext"),!n._nextFill.size()){var r=":first-child";e.select(".js-fill.js-tozero").size()&&(r+=" + *"),n._nextFill=e.insert("path",r).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),n._nextFill=null;n.fill&&("tozero"===n.fill.substr(0,6)||"toself"===n.fill||"to"===n.fill.substr(0,2)&&!n._prevtrace)?(n._ownFill=e.select(".js-fill.js-tozero"),n._ownFill.size()||(n._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),n._ownFill=null)})}function a(t,e,n,r,a,h,g){function v(t){return M?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,n,r=t[0].trace,a=i.select(this),o=u.hasMarkers(r),c=u.hasText(r),f=x(r),d=b,h=b;o&&(d=r.marker.maxdisplayed?m:l.identity),c&&(h=r.marker.maxdisplayed?m:l.identity),n=a.selectAll("path.point"),e=n.data(d,f);var p=e.enter().append("path").classed("point",!0);p.call(s.pointStyle,r).call(s.translatePoints,A,T,r),M&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=v(i.select(this));s.translatePoint(t,e,A,T),s.singlePointStyle(t,e,r)}),M?e.exit().transition().style("opacity",0).remove():e.exit().remove(),n=a.selectAll("g"),e=n.data(h,f),e.enter().append("g").append("text"),e.each(function(t){var e=v(i.select(this).select("text"));s.translatePoint(t,e,A,T)}),e.selectAll("text").call(s.textPointStyle,r).each(function(t){var e=t.xp||A.c2p(t.x),n=t.yp||T.c2p(t.y);i.select(this).selectAll("tspan").each(function(){v(i.select(this)).attr({x:e,y:n})})}),e.exit().remove()}var w,k;o(t,e,n,r,a);var M=!!g&&g.duration>0,A=n.xaxis,T=n.yaxis,L=r[0].trace,C=L.line,S=i.select(h);if(S.call(c.plot,n,g),L.visible===!0){var z,O,P=L.fill.charAt(L.fill.length-1);"x"!==P&&"y"!==P&&(P=""),r[0].node3=S,f(r);var D="",E=[],N=L._prevtrace;N&&(D=N._prevRevpath||"",O=N._nextFill,E=N._polygons);var I,R,j,F,B,q,H,V,Y,U="",X="",Z=[],G=[],W=l.noop;if(z=L._ownFill,u.hasLines(L)||"none"!==L.fill){for(O&&O.datum(r),["hv","vh","hvh","vhv"].indexOf(C.shape)!==-1?(j=s.steps(C.shape),F=s.steps(C.shape.split("").reverse().join(""))):j=F="spline"===C.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?s.smoothclosed(t.slice(1),C.smoothing):s.smoothopen(t,C.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return F(t.reverse())},Z=d(r,{xaxis:A,yaxis:T,connectGaps:L.connectgaps,baseTolerance:Math.max(C.width||1,3)/4,linear:"linear"===C.shape,simplify:C.simplify}),Y=L._polygons=new Array(Z.length),k=0;k1}),W=function(t){return function(e){if(I=j(e),R=B(e),U?P?(U+="L"+I.substr(1),X=R+("L"+X.substr(1))):(U+="Z"+I,X=R+"Z"+X):(U=I,X=R),u.hasLines(L)&&e.length>1){var n=i.select(this);if(n.datum(r),t)v(n.style("opacity",0).attr("d",I).call(s.lineGroupStyle)).style("opacity",1);else{var a=v(n);a.attr("d",I),s.singleLineStyle(r,a)}}}}}var Q=S.selectAll(".js-line").data(G);v(Q.exit()).style("opacity",0).remove(),Q.each(W(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(W(!0)),Z.length&&(z?q&&V&&(P?("y"===P?q[1]=V[1]=T.c2p(0,!0):"x"===P&&(q[0]=V[0]=A.c2p(0,!0)),v(z).attr("d","M"+V+"L"+q+"L"+U.substr(1))):v(z).attr("d",U+"Z")):"tonext"===L.fill.substr(0,6)&&U&&D&&("tonext"===L.fill?v(O).attr("d",U+"Z"+D+"Z"):v(O).attr("d",U+"L"+D.substr(1)+"Z"),L._polygons=L._polygons.concat(E)),L._prevRevpath=X,L._prevPolygons=Y);var $=S.selectAll(".points");w=$.data([r]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function o(t,e,n,r,a){var o=n.xaxis,l=n.yaxis,s=i.extent(o.range.map(o.l2c)),c=i.extent(l.range.map(l.l2c)),f=r[0].trace;if(u.hasMarkers(f)){var d=f.marker.maxdisplayed;if(0!==d){var h=r.filter(function(t){return t.x>=s[0]&&t.x<=s[1]&&t.y>=c[0]&&t.y<=c[1]}),p=Math.ceil(h.length/d),g=0;a.forEach(function(t,n){var r=t[0].trace;u.hasMarkers(r)&&r.marker.maxdisplayed>0&&n0;for(u=p.selectAll("g.trace"),f=u.data(n,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),h(t,e,n),r(t,p),s=0,c=[];sr?1:-1}),v){l&&(d=l());var m=i.transition().duration(o.duration).ease(o.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()});m.each(function(){p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)})})}else p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":47,"../../components/errorbars":53,"../../lib":113,"../../lib/polygon":120,"./arrays_to_calcdata":204,"./line_points":217,"./link_traces":219,"./subtypes":225,d3:7}],223:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;ne?1:t>=e?0:NaN}function o(t){return null===t?NaN:+t}function i(t){return!isNaN(t)}function l(t){return{left:function(e,n,r,a){for(arguments.length<3&&(r=0),arguments.length<4&&(a=e.length);r>>1;t(e[o],n)<0?r=o+1:a=o}return r},right:function(e,n,r,a){for(arguments.length<3&&(r=0),arguments.length<4&&(a=e.length);r>>1;t(e[o],n)>0?a=o:r=o+1}return r}}}function s(t){return t.length}function c(t){for(var e=1;t*e%1;)e*=10;return e}function u(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function f(){this._=Object.create(null)}function d(t){return(t+="")===_i||t[0]===wi?wi+t:t}function h(t){return(t+="")[0]===wi?t.slice(1):t}function p(t){return d(t)in this._}function g(t){return(t=d(t))in this._&&delete this._[t]}function v(){var t=[];for(var e in this._)t.push(h(e));return t}function m(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function x(){this._=Object.create(null)}function b(t){return t}function _(t,e,n){return function(){var r=n.apply(e,arguments);return r===e?t:r}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,r=ki.length;n=e&&(e=a+1);!(i=l[e])&&++e0&&(t=t.slice(0,l));var c=Di.get(t);return c&&(t=c,s=Q),l?e?a:r:e?k:o}function W(t,e){return function(n){var r=ui.event;ui.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{ui.event=r}}}function Q(t,e){var n=W(t,e);return function(t){var e=this,r=t.relatedTarget;r&&(r===e||8&r.compareDocumentPosition(e))||n.call(e,t)}}function $(t){var n=".dragsuppress-"+ ++Ei,a="click"+n,o=ui.select(r(t)).on("touchmove"+n,T).on("dragstart"+n,T).on("selectstart"+n,T);if(null==Ni&&(Ni=!("onselectstart"in t)&&w(t.style,"userSelect")),Ni){var i=e(t).style,l=i[Ni];i[Ni]="none"}return function(t){if(o.on(n,null),Ni&&(i[Ni]=l),t){var e=function(){o.on(a,null)};o.on(a,function(){T(),e()},!0),setTimeout(e,0)}}}function J(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var a=n.createSVGPoint();if(Ii<0){var o=r(t);if(o.scrollX||o.scrollY){n=ui.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var i=n[0][0].getScreenCTM();Ii=!(i.f||i.e),n.remove()}}return Ii?(a.x=e.pageX,a.y=e.pageY):(a.x=e.clientX,a.y=e.clientY),a=a.matrixTransform(t.getScreenCTM().inverse()),[a.x,a.y]}var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}function K(){return ui.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function nt(t){return t>1?0:t<-1?ji:Math.acos(t)}function rt(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function at(t){return((t=Math.exp(t))-1/t)/2}function ot(t){return((t=Math.exp(t))+1/t)/2}function it(t){return((t=Math.exp(2*t))-1)/(t+1)}function lt(t){return(t=Math.sin(t/2))*t}function st(){}function ct(t,e,n){return this instanceof ct?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof ct?new ct(t.h,t.s,t.l):kt(""+t,Mt,ct):new ct(t,e,n)}function ut(t,e,n){function r(t){return t>360?t-=360:t<0&&(t+=360),t<60?o+(i-o)*t/60:t<180?i:t<240?o+(i-o)*(240-t)/60:o}function a(t){return Math.round(255*r(t))}var o,i;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=n<0?0:n>1?1:n,i=n<=.5?n*(1+e):n+e-n*e,o=2*n-i,new xt(a(t+120),a(t),a(t-120))}function ft(t,e,n){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof ht?gt(t.l,t.a,t.b):gt((t=At((t=ui.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,n)}function dt(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new ht(n,Math.cos(t*=Vi)*e,Math.sin(t)*e)}function ht(t,e,n){return this instanceof ht?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof ht?new ht(t.l,t.a,t.b):t instanceof ft?dt(t.h,t.c,t.l):At((t=xt(t)).r,t.g,t.b):new ht(t,e,n)}function pt(t,e,n){var r=(t+16)/116,a=r+e/500,o=r-n/200;return a=vt(a)*tl,r=vt(r)*el,o=vt(o)*nl,new xt(yt(3.2404542*a-1.5371385*r-.4985314*o),yt(-.969266*a+1.8760108*r+.041556*o),yt(.0556434*a-.2040259*r+1.0572252*o))}function gt(t,e,n){return t>0?new ft(Math.atan2(n,e)*Xi,Math.sqrt(e*e+n*n),t):new ft(NaN,NaN,t)}function vt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function mt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function xt(t,e,n){return this instanceof xt?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof xt?new xt(t.r,t.g,t.b):kt(""+t,xt,ut):new xt(t,e,n)}function bt(t){return new xt(t>>16,t>>8&255,255&t)}function _t(t){return bt(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function kt(t,e,n){var r,a,o,i=0,l=0,s=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=r[2].split(","),r[1]){case"hsl":return n(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(Lt(a[0]),Lt(a[1]),Lt(a[2]))}return(o=ol.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(i=(3840&o)>>4,i|=i>>4,l=240&o,l|=l>>4,s=15&o,s|=s<<4):7===t.length&&(i=(16711680&o)>>16,l=(65280&o)>>8,s=255&o)),e(i,l,s))}function Mt(t,e,n){var r,a,o=Math.min(t/=255,e/=255,n/=255),i=Math.max(t,e,n),l=i-o,s=(i+o)/2;return l?(a=s<.5?l/(i+o):l/(2-i-o),r=t==i?(e-n)/l+(e0&&s<1?0:r),new ct(r,a,s)}function At(t,e,n){t=Tt(t),e=Tt(e),n=Tt(n);var r=mt((.4124564*t+.3575761*e+.1804375*n)/tl),a=mt((.2126729*t+.7151522*e+.072175*n)/el),o=mt((.0193339*t+.119192*e+.9503041*n)/nl);return ht(116*a-16,500*(r-a),200*(a-o))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Lt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Ct(t){return"function"==typeof t?t:function(){return t}}function St(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),zt(e,n,t,r)}}function zt(t,e,n,r){function a(){var t,e=s.status;if(!e&&Pt(s)||e>=200&&e<300||304===e){try{t=n.call(o,s)}catch(t){return void i.error.call(o,t)}i.load.call(o,t)}else i.error.call(o,s)}var o={},i=ui.dispatch("beforesend","progress","load","error"),l={},s=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in s||!/^(http(s)?:)?\/\//.test(t)||(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=a:s.onreadystatechange=function(){s.readyState>3&&a()},s.onprogress=function(t){var e=ui.event;ui.event=t;try{i.progress.call(o,s)}finally{ui.event=e}},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?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return n=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(di(arguments)))}}),o.send=function(n,r,a){if(2===arguments.length&&"function"==typeof r&&(a=r,r=null),s.open(n,t,!0),null==e||"accept"in l||(l.accept=e+",*/*"),s.setRequestHeader)for(var u in l)s.setRequestHeader(u,l[u]);return null!=e&&s.overrideMimeType&&s.overrideMimeType(e),null!=c&&(s.responseType=c),null!=a&&o.on("error",a).on("load",function(t){a(null,t)}),i.beforesend.call(o,s),s.send(null==r?null:r),o},o.abort=function(){return s.abort(),o},ui.rebind(o,i,"on"),null==r?o:o.get(Ot(r))}function Ot(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}function Pt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Dt(t,e,n){var r=arguments.length;r<2&&(e=0),r<3&&(n=Date.now());var a=n+e,o={c:t,t:a,n:null};return ll?ll.n=o:il=o,ll=o,sl||(cl=clearTimeout(cl),sl=1,ul(Nt)),o}function Nt(){var t=Et(),e=It()-t;e>24?(isFinite(e)&&(clearTimeout(cl),cl=setTimeout(Nt,e)),sl=0):(sl=1,ul(Nt))}function Et(){for(var t=Date.now(),e=il;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function It(){for(var t,e=il,n=1/0;e;)e.c?(e.t8?function(t){return t/n}:function(t){return t*n},symbol:t}}function jt(t){var e=t.decimal,n=t.thousands,r=t.grouping,a=t.currency,o=r&&n?function(t,e){for(var a=t.length,o=[],i=0,l=r[0],s=0;a>0&&l>0&&(s+l+1>e&&(l=Math.max(1,e-s)),o.push(t.substring(a-=l,a+l)),!((s+=l+1)>e));)l=r[i=(i+1)%r.length];return o.reverse().join(n)}:b;return function(t){var n=dl.exec(t),r=n[1]||" ",i=n[2]||">",l=n[3]||"-",s=n[4]||"",c=n[5],u=+n[6],f=n[7],d=n[8],h=n[9],p=1,g="",v="",m=!1,y=!0;switch(d&&(d=+d.substring(1)),(c||"0"===r&&"="===i)&&(c=r="0",i="="),h){case"n":f=!0,h="g";break;case"%":p=100,v="%",h="f";break;case"p":p=100,v="%",h="r";break;case"b":case"o":case"x":case"X":"#"===s&&(g="0"+h.toLowerCase());case"c":y=!1;case"d":m=!0,d=0;break;case"s":p=-1,h="r"}"$"===s&&(g=a[0],v=a[1]),"r"!=h||d||(h="g"),null!=d&&("g"==h?d=Math.max(1,Math.min(21,d)):"e"!=h&&"f"!=h||(d=Math.max(0,Math.min(20,d)))),h=hl.get(h)||Bt;var x=c&&f;return function(t){var n=v;if(m&&t%1)return"";var a=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===l?"":l;if(p<0){var s=ui.formatPrefix(t,d);t=s.scale(t),n=s.symbol+v}else t*=p;t=h(t,d);var b,_,w=t.lastIndexOf(".");if(w<0){var k=y?t.lastIndexOf("e"):-1;k<0?(b=t,_=""):(b=t.substring(0,k),_=t.substring(k))}else b=t.substring(0,w),_=e+t.substring(w+1);!c&&f&&(b=o(b,1/0));var M=g.length+b.length+_.length+(x?0:a.length),A=M"===i?A+a+t:"^"===i?A.substring(0,M>>=1)+a+t+A.substring(M):a+(x?t:A+t))+n}}}function Bt(t){return t+""}function qt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ht(t,e,n){function r(e){var n=t(e),r=o(n,1);return e-n1)for(;i=c)return-1;if(a=e.charCodeAt(l++),37===a){if(i=e.charAt(l++),o=S[i in ml?e.charAt(l++):i],!o||(r=o(t,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}function r(t,e,n){w.lastIndex=0;var r=w.exec(e.slice(n));return r?(t.w=k.get(r[0].toLowerCase()),n+r[0].length):-1}function a(t,e,n){b.lastIndex=0;var r=b.exec(e.slice(n));return r?(t.w=_.get(r[0].toLowerCase()),n+r[0].length):-1}function o(t,e,n){T.lastIndex=0;var r=T.exec(e.slice(n));return r?(t.m=L.get(r[0].toLowerCase()),n+r[0].length):-1}function i(t,e,n){M.lastIndex=0;var r=M.exec(e.slice(n));return r?(t.m=A.get(r[0].toLowerCase()),n+r[0].length):-1}function l(t,e,r){return n(t,C.c.toString(),e,r)}function s(t,e,r){return n(t,C.x.toString(),e,r)}function c(t,e,r){return n(t,C.X.toString(),e,r)}function u(t,e,n){var r=x.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)}var f=t.dateTime,d=t.date,h=t.time,p=t.periods,g=t.days,v=t.shortDays,m=t.months,y=t.shortMonths;e.utc=function(t){function n(t){try{gl=qt;var e=new gl;return e._=t,r(e)}finally{gl=Date}}var r=e(t);return n.parse=function(t){try{gl=qt;var e=r.parse(t);return e&&e._}finally{gl=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=ue;var x=ui.map(),b=Zt(g),_=Gt(g),w=Zt(v),k=Gt(v),M=Zt(m),A=Gt(m),T=Zt(y),L=Gt(y);p.forEach(function(t,e){x.set(t.toLowerCase(),e)});var C={a:function(t){return v[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return m[t.getMonth()]},c:e(f),d:function(t,e){return Ut(t.getDate(),e,2)},e:function(t,e){return Ut(t.getDate(),e,2)},H:function(t,e){return Ut(t.getHours(),e,2)},I:function(t,e){return Ut(t.getHours()%12||12,e,2)},j:function(t,e){return Ut(1+pl.dayOfYear(t),e,3)},L:function(t,e){return Ut(t.getMilliseconds(),e,3)},m:function(t,e){return Ut(t.getMonth()+1,e,2)},M:function(t,e){return Ut(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Ut(t.getSeconds(),e,2)},U:function(t,e){return Ut(pl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ut(pl.mondayOfYear(t),e,2)},x:e(d),X:e(h),y:function(t,e){return Ut(t.getFullYear()%100,e,2)},Y:function(t,e){return Ut(t.getFullYear()%1e4,e,4)},Z:se,"%":function(){return"%"}},S={a:r,A:a,b:o,B:i,c:l,d:ne,e:ne,H:ae,I:ae,j:re,L:le,m:ee,M:oe,p:u,S:ie,U:Wt,w:Yt,W:Qt,x:s,X:c,y:Jt,Y:$t,Z:Kt,"%":ce};return e}function Ut(t,e,n){var r=t<0?"-":"",a=(r?-t:t)+"",o=a.length;return r+(o68?1900:2e3)}function ee(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ne(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function re(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function ae(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function oe(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ie(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function le(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function se(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=bi(e)/60|0,a=bi(e)%60;return n+Ut(r,"0",2)+Ut(a,"0",2)}function ce(t,e,n){xl.lastIndex=0;var r=xl.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function ue(t){for(var e=t.length,n=-1;++n=0?1:-1,l=i*n,s=Math.cos(e),c=Math.sin(e),u=o*c,f=a*s+u*Math.cos(l),d=u*i*Math.sin(l);Al.add(Math.atan2(d,f)),r=t,a=s,o=c}var e,n,r,a,o;Tl.point=function(i,l){Tl.point=t,r=(e=i)*Vi,a=Math.cos(l=(n=l)*Vi/2+ji/4),o=Math.sin(l)},Tl.lineEnd=function(){t(e,n)}}function me(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 be(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function ke(t){return[Math.atan2(t[1],t[0]),rt(t[2])]}function Me(t,e){return bi(t[0]-e[0])=0;--l)a.point((f=u[l])[0],f[1])}else r(h.x,h.p.x,-1,a);h=h.p}h=h.o,u=h.z,p=!p}while(!h.v);a.lineEnd()}}}function De(t){if(e=t.length){for(var e,n,r=0,a=t[0];++r0){for(_||(o.polygonStart(),_=!0),o.lineStart();++i1&&2&e&&n.push(n.pop().concat(n.shift())),h.push(n.filter(Ie))}var h,p,g,v=e(o),m=a.invert(r[0],r[1]),y={point:i,lineStart:s,lineEnd:c,polygonStart:function(){y.point=u,y.lineStart=f,y.lineEnd=d,h=[],p=[]},polygonEnd:function(){y.point=i,y.lineStart=s,y.lineEnd=c,h=ui.merge(h);var t=He(m,p);h.length?(_||(o.polygonStart(),_=!0),Pe(h,Fe,t,n,o)):t&&(_||(o.polygonStart(),_=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),_&&(o.polygonEnd(),_=!1),h=p=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}},x=Re(),b=e(x),_=!1;return y}}function Ie(t){return t.length>1}function Re(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:k,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Fe(t,e){return((t=t.x)[0]<0?t[1]-Hi-Ri:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-Ri:Hi-e[1])}function je(t){var e,n=NaN,r=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,i){var l=o>0?ji:-ji,s=bi(o-n);bi(s-ji)0?Hi:-Hi),t.point(a,r),t.lineEnd(),t.lineStart(),t.point(l,r),t.point(o,r),e=0):a!==l&&s>=ji&&(bi(n-a)Ri?Math.atan((Math.sin(e)*(o=Math.cos(r))*Math.sin(n)-Math.sin(r)*(a=Math.cos(e))*Math.sin(t))/(a*o*i)):(e+r)/2}function qe(t,e,n,r){var a;if(null==t)a=n*Hi,r.point(-ji,a),r.point(0,a),r.point(ji,a),r.point(ji,0),r.point(ji,-a),r.point(0,-a),r.point(-ji,-a),r.point(-ji,0),r.point(-ji,a);else if(bi(t[0]-e[0])>Ri){var o=t[0]=0?1:-1,k=w*_,M=k>ji,A=p*x;if(Al.add(Math.atan2(A*w*Math.sin(k),g*b+A*Math.cos(k))),o+=M?_+w*Bi:_,M^d>=n^m>=n){var T=xe(me(f),me(t));we(T);var L=xe(a,T);we(L);var C=(M^_>=0?-1:1)*rt(L[2]);(r>C||r===C&&(T[0]||T[1]))&&(i+=M^_>=0?1:-1)}if(!v++)break;d=m,p=x,g=b,f=t}}return(o<-Ri||oo}function n(t){var n,o,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var h,p=[f,d],g=e(f,d),v=i?g?0:a(f,d):g?a(f+(f<0?ji:-ji),d):0;if(!n&&(c=s=g)&&t.lineStart(),g!==s&&(h=r(n,p),(Me(n,h)||Me(p,h))&&(p[0]+=Ri,p[1]+=Ri,g=e(p[0],p[1]))),g!==s)u=0,g?(t.lineStart(),h=r(p,n),t.point(h[0],h[1])):(h=r(n,p),t.point(h[0],h[1]),t.lineEnd()),n=h;else if(l&&n&&i^g){var m;v&o||!(m=r(p,n,!0))||(u=0,i?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||n&&Me(n,p)||t.point(p[0],p[1]),n=p,s=g,o=v},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return u|(c&&s)<<1}}}function r(t,e,n){var r=me(t),a=me(e),i=[1,0,0],l=xe(r,a),s=ye(l,l),c=l[0],u=s-c*c;if(!u)return!n&&t;var f=o*s/u,d=-o*c/u,h=xe(i,l),p=_e(i,f),g=_e(l,d);be(p,g);var v=h,m=ye(p,v),y=ye(v,v),x=m*m-y*(ye(p,p)-1);if(!(x<0)){var b=Math.sqrt(x),_=_e(v,(-m-b)/y);if(be(_,p),_=ke(_),!n)return _;var w,k=t[0],M=e[0],A=t[1],T=e[1];M0^_[1]<(bi(_[0]-k)ji^(k<=_[0]&&_[0]<=M)){var z=_e(v,(-m+b)/y);return be(z,p),[_,ke(z)]}}}function a(e,n){var r=i?t:ji-t,a=0;return e<-r?a|=1:e>r&&(a|=2),n<-r?a|=4:n>r&&(a|=8),a}var o=Math.cos(t),i=o>0,l=bi(o)>Ri,s=mn(t,6*Vi);return Ee(e,n,s,i?[0,-t]:[-ji,t-ji])}function Xe(t,e,n,r){return function(a){var o,i=a.a,l=a.b,s=i.x,c=i.y,u=l.x,f=l.y,d=0,h=1,p=u-s,g=f-c;if(o=t-s,p||!(o>0)){if(o/=p,p<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=n-s,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>d&&(d=o)}else if(p>0){if(o0)){if(o/=g,g<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=r-c,g||!(o<0)){if(o/=g,g<0){if(o>h)return;o>d&&(d=o)}else if(g>0){if(o0&&(a.a={x:s+d*p,y:c+d*g}),h<1&&(a.b={x:s+h*p,y:c+h*g}),a}}}}}}function Ue(t,e,n,r){function a(r,a){return bi(r[0]-t)0?0:3:bi(r[0]-n)0?2:1:bi(r[1]-e)0?1:0:a>0?3:2}function o(t,e){return i(t.x,e.x)}function i(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(l){function s(t){for(var e=0,n=v.length,r=t[1],a=0;ar&&et(c,o,t)>0&&++e:o[1]<=r&&et(c,o,t)<0&&--e,c=o;return 0!==e}function c(o,l,s,c){var u=0,f=0;if(null==o||(u=a(o,s))!==(f=a(l,s))||i(o,l)<0^s>0){do c.point(0===u||3===u?t:n,u>1?r:e);while((u=(u+s+4)%4)!==f)}else c.point(l[0],l[1])}function u(a,o){return t<=a&&a<=n&&e<=o&&o<=r}function f(t,e){u(t,e)&&l.point(t,e)}function d(){S.point=p,v&&v.push(m=[]),M=!0,k=!1,_=w=NaN}function h(){g&&(p(y,x),b&&k&&L.rejoin(),g.push(L.buffer())),S.point=f,k&&l.lineEnd()}function p(t,e){t=Math.max(-Bl,Math.min(Bl,t)),e=Math.max(-Bl,Math.min(Bl,e));var n=u(t,e);if(v&&m.push([t,e]),M)y=t,x=e,b=n,M=!1,n&&(l.lineStart(),l.point(t,e));else if(n&&k)l.point(t,e);else{var r={a:{x:_,y:w},b:{x:t,y:e}};C(r)?(k||(l.lineStart(),l.point(r.a.x,r.a.y)),l.point(r.b.x,r.b.y),n||l.lineEnd(),A=!1):n&&(l.lineStart(),l.point(t,e),A=!1)}_=t,w=e,k=n}var g,v,m,y,x,b,_,w,k,M,A,T=l,L=Re(),C=Xe(t,e,n,r),S={point:f,lineStart:d,lineEnd:h,polygonStart:function(){l=L,g=[],v=[],A=!0},polygonEnd:function(){l=T,g=ui.merge(g);var e=s([t,r]),n=A&&e,a=g.length;(n||a)&&(l.polygonStart(),n&&(l.lineStart(),c(null,null,1,l),l.lineEnd()),a&&Pe(g,o,e,c,l),l.polygonEnd()),g=v=m=null}};return S}}function Ze(t){var e=0,n=ji/3,r=cn(t),a=r(e,n);return a.parallels=function(t){return arguments.length?r(e=t[0]*ji/180,n=t[1]*ji/180):[e/ji*180,n/ji*180]},a}function Ge(t,e){function n(t,e){var n=Math.sqrt(o-2*a*Math.sin(e))/a;return[n*Math.sin(t*=a),i-n*Math.cos(t)]}var r=Math.sin(t),a=(r+Math.sin(e))/2,o=1+r*(2*a-r),i=Math.sqrt(o)/a;return n.invert=function(t,e){var n=i-e;return[Math.atan2(t,n)/a,rt((o-(t*t+n*n)*a*a)/(2*a))]},n}function Ye(){function t(t,e){Hl+=a*t-r*e,r=t,a=e}var e,n,r,a;Gl.point=function(o,i){Gl.point=t,e=r=o,n=a=i},Gl.lineEnd=function(){t(e,n)}}function We(t,e){tUl&&(Ul=t),eZl&&(Zl=e)}function Qe(){function t(t,e){i.push("M",t,",",e,o)}function e(t,e){i.push("M",t,",",e),l.point=n}function n(t,e){i.push("L",t,",",e)}function r(){l.point=t}function a(){i.push("Z")}var o=$e(4.5),i=[],l={point:t,lineStart:function(){l.point=e},lineEnd:r,polygonStart:function(){l.lineEnd=a},polygonEnd:function(){l.lineEnd=r,l.point=t},pointRadius:function(t){return o=$e(t),l},result:function(){if(i.length){var t=i.join("");return i=[],t}}};return l}function $e(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Je(t,e){Sl+=t,zl+=e,++Ol}function Ke(){function t(t,r){var a=t-e,o=r-n,i=Math.sqrt(a*a+o*o);Pl+=i*(e+t)/2,Dl+=i*(n+r)/2,Nl+=i,Je(e=t,n=r)}var e,n;Wl.point=function(r,a){Wl.point=t,Je(e=r,n=a)}}function tn(){Wl.point=Je}function en(){function t(t,e){var n=t-r,o=e-a,i=Math.sqrt(n*n+o*o);Pl+=i*(r+t)/2,Dl+=i*(a+e)/2,Nl+=i,i=a*t-r*e,El+=i*(r+t),Il+=i*(a+e),Rl+=3*i,Je(r=t,a=e)}var e,n,r,a;Wl.point=function(o,i){Wl.point=t,Je(e=r=o,n=a=i)},Wl.lineEnd=function(){t(e,n)}}function nn(t){function e(e,n){t.moveTo(e+i,n),t.arc(e,n,i,0,Bi)}function n(e,n){t.moveTo(e,n),l.point=r}function r(e,n){t.lineTo(e,n)}function a(){l.point=e}function o(){t.closePath()}var i=4.5,l={point:e,lineStart:function(){l.point=n},lineEnd:a,polygonStart:function(){l.lineEnd=o},polygonEnd:function(){l.lineEnd=a,l.point=e},pointRadius:function(t){return i=t,l},result:k};return l}function rn(t){function e(t){return(l?r:n)(t)}function n(e){return ln(e,function(n,r){n=t(n,r),e.point(n[0],n[1])})}function r(e){function n(n,r){n=t(n,r),e.point(n[0],n[1])}function r(){x=NaN,M.point=o,e.lineStart()}function o(n,r){var o=me([n,r]),i=t(n,r);a(x,b,y,_,w,k,x=i[0],b=i[1],y=n,_=o[0],w=o[1],k=o[2],l,e),e.point(x,b)}function i(){M.point=n,e.lineEnd()}function s(){r(),M.point=c,M.lineEnd=u}function c(t,e){o(f=t,d=e),h=x,p=b,g=_,v=w,m=k,M.point=o}function u(){a(x,b,y,_,w,k,h,p,f,g,v,m,l,e),M.lineEnd=i,i()}var f,d,h,p,g,v,m,y,x,b,_,w,k,M={point:n,lineStart:r,lineEnd:i,polygonStart:function(){e.polygonStart(),M.lineStart=s},polygonEnd:function(){e.polygonEnd(),M.lineStart=r}};return M}function a(e,n,r,l,s,c,u,f,d,h,p,g,v,m){var y=u-e,x=f-n,b=y*y+x*x;if(b>4*o&&v--){var _=l+h,w=s+p,k=c+g,M=Math.sqrt(_*_+w*w+k*k),A=Math.asin(k/=M),T=bi(bi(k)-1)o||bi((y*z+x*O)/b-.5)>.3||l*h+s*p+c*g0&&16,e):Math.sqrt(o)},e}function an(t){var e=rn(function(e,n){return t([e*Xi,n*Xi])});return function(t){return un(e(t))}}function on(t){this.stream=t}function ln(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 sn(t){return cn(function(){return t})()}function cn(t){function e(t){return t=l(t[0]*Vi,t[1]*Vi),[t[0]*d+s,c-t[1]*d]}function n(t){return t=l.invert((t[0]-s)/d,(c-t[1])/d),t&&[t[0]*Xi,t[1]*Xi]}function r(){l=ze(i=hn(m,y,x),o);var t=o(g,v);return s=h-t[0]*d,c=p+t[1]*d,a()}function a(){return u&&(u.valid=!1,u=null),e}var o,i,l,s,c,u,f=rn(function(t,e){return t=o(t,e),[t[0]*d+s,c-t[1]*d]}),d=150,h=480,p=250,g=0,v=0,m=0,y=0,x=0,_=jl,w=b,k=null,M=null;return e.stream=function(t){return u&&(u.valid=!1),u=un(_(i,f(w(t)))),u.valid=!0,u},e.clipAngle=function(t){return arguments.length?(_=null==t?(k=t,jl):Ve((k=+t)*Vi),a()):k},e.clipExtent=function(t){return arguments.length?(M=t,w=t?Ue(t[0][0],t[0][1],t[1][0],t[1][1]):b,a()):M},e.scale=function(t){return arguments.length?(d=+t,r()):d},e.translate=function(t){return arguments.length?(h=+t[0],p=+t[1],r()):[h,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Vi,v=t[1]%360*Vi,r()):[g*Xi,v*Xi]},e.rotate=function(t){return arguments.length?(m=t[0]%360*Vi,y=t[1]%360*Vi,x=t.length>2?t[2]%360*Vi:0,r()):[m*Xi,y*Xi,x*Xi]},ui.rebind(e,f,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&n,r()}}function un(t){return ln(t,function(e,n){t.point(e*Vi,n*Vi)})}function fn(t,e){return[t,e]}function dn(t,e){return[t>ji?t-Bi:t<-ji?t+Bi:t,e]}function hn(t,e,n){return t?e||n?ze(gn(t),vn(e,n)):gn(t):e||n?vn(e,n):dn}function pn(t){return function(e,n){return e+=t,[e>ji?e-Bi:e<-ji?e+Bi:e,n]}}function gn(t){var e=pn(t);return e.invert=pn(-t),e}function vn(t,e){function n(t,e){var n=Math.cos(e),l=Math.cos(t)*n,s=Math.sin(t)*n,c=Math.sin(e),u=c*r+l*a;return[Math.atan2(s*o-u*i,l*r-c*a),rt(u*o+s*i)]}var r=Math.cos(t),a=Math.sin(t),o=Math.cos(e),i=Math.sin(e);return n.invert=function(t,e){var n=Math.cos(e),l=Math.cos(t)*n,s=Math.sin(t)*n,c=Math.sin(e),u=c*o-s*i;return[Math.atan2(s*o+c*i,l*r+u*a),rt(u*r-l*a)]},n}function mn(t,e){var n=Math.cos(t),r=Math.sin(t);return function(a,o,i,l){var s=i*e;null!=a?(a=yn(n,a),o=yn(n,o),(i>0?ao)&&(a+=i*Bi)):(a=t+i*Bi,o=t-.5*s);for(var c,u=a;i>0?u>o:u0?e<-Hi+Ri&&(e=-Hi+Ri):e>Hi-Ri&&(e=Hi-Ri);var n=i/Math.pow(a(e),o);return[n*Math.sin(o*t),i-n*Math.cos(o*t)]}var r=Math.cos(t),a=function(t){return Math.tan(ji/4+t/2)},o=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(a(e)/a(t)),i=r*Math.pow(a(t),o)/o;return o?(n.invert=function(t,e){var n=i-e,r=tt(o)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/o,2*Math.atan(Math.pow(i/r,1/o))-Hi]},n):Cn}function Ln(t,e){function n(t,e){var n=o-e;return[n*Math.sin(a*t),o-n*Math.cos(a*t)]}var r=Math.cos(t),a=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),o=r/a+t;return bi(a)1&&et(t[n[r-2]],t[n[r-1]],t[a])<=0;)--r;n[r++]=a}return n.slice(0,r)}function Nn(t,e){return t[0]-e[0]||t[1]-e[1]}function En(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function In(t,e,n,r){var a=t[0],o=n[0],i=e[0]-a,l=r[0]-o,s=t[1],c=n[1],u=e[1]-s,f=r[1]-c,d=(l*(s-c)-f*(a-o))/(f*i-l*u);return[a+d*i,s+d*u]}function Rn(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function Fn(){or(this),this.edge=this.site=this.circle=null}function jn(t){var e=cs.pop()||new Fn;return e.site=t,e}function Bn(t){Qn(t),is.remove(t),cs.push(t),or(t)}function qn(t){var e=t.circle,n=e.x,r=e.cy,a={x:n,y:r},o=t.P,i=t.N,l=[t];Bn(t);for(var s=o;s.circle&&bi(n-s.circle.x)Ri)l=l.L;else{if(a=o-Xn(l,i),!(a>Ri)){r>-Ri?(e=l.P,n=l):a>-Ri?(e=l,n=l.N):e=n=l;break}if(!l.R){e=l;break}l=l.R}var s=jn(t);if(is.insert(e,s),e||n){if(e===n)return Qn(e),n=jn(e.site),is.insert(s,n),s.edge=n.edge=tr(e.site,s.site),Wn(e),void Wn(n);if(!n)return void(s.edge=tr(e.site,s.site));Qn(e),Qn(n);var c=e.site,u=c.x,f=c.y,d=t.x-u,h=t.y-f,p=n.site,g=p.x-u,v=p.y-f,m=2*(d*v-h*g),y=d*d+h*h,x=g*g+v*v,b={x:(v*y-h*x)/m+u,y:(d*x-g*y)/m+f};nr(n.edge,c,p,b),s.edge=tr(c,t,null,b),n.edge=tr(t,p,null,b),Wn(e),Wn(n)}}function Vn(t,e){var n=t.site,r=n.x,a=n.y,o=a-e;if(!o)return r;var i=t.P;if(!i)return-(1/0);n=i.site;var l=n.x,s=n.y,c=s-e;if(!c)return l;var u=l-r,f=1/o-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-o/2)))/f+r:(r+l)/2}function Xn(t,e){var n=t.N;if(n)return Vn(n,e);var r=t.site;return r.y===e?r.x:1/0}function Un(t){this.site=t,this.edges=[]}function Zn(t){for(var e,n,r,a,o,i,l,s,c,u,f=t[0][0],d=t[1][0],h=t[0][1],p=t[1][1],g=os,v=g.length;v--;)if(o=g[v],o&&o.prepare())for(l=o.edges,s=l.length,i=0;iRi||bi(a-n)>Ri)&&(l.splice(i,0,new rr(er(o.site,u,bi(r-f)Ri?{x:f,y:bi(e-f)Ri?{x:bi(n-p)Ri?{x:d,y:bi(e-d)Ri?{x:bi(n-h)=-Fi)){var h=s*s+c*c,p=u*u+f*f,g=(f*h-c*p)/d,v=(s*p-u*h)/d,f=v+l,m=us.pop()||new Yn;m.arc=t,m.site=a,m.x=g+i,m.y=f+Math.sqrt(g*g+v*v),m.cy=f,t.circle=m;for(var y=null,x=ss._;x;)if(m.y=l)return;if(d>p){if(o){if(o.y>=c)return}else o={x:v,y:s};n={x:v,y:c}}else{if(o){if(o.y1)if(d>p){if(o){if(o.y>=c)return}else o={x:(s-a)/r,y:s};n={x:(c-a)/r,y:c}}else{if(o){if(o.y=l)return}else o={x:i,y:r*i+a};n={x:l,y:r*l+a}}else{if(o){if(o.xo||f>i||d=b,k=n>=_,M=k<<1|w,A=M+4;Mo&&(a=e.slice(o,a),l[i]?l[i]+=a:l[++i]=a),(n=n[0])===(r=r[0])?l[i]?l[i]+=r:l[++i]=r:(l[++i]=null,s.push({i:i,x:xr(n,r)})),o=hs.lastIndex;return o=0&&!(n=ui.interpolators[r](t,e)););return n}function wr(t,e){var n,r=[],a=[],o=t.length,i=e.length,l=Math.min(t.length,e.length);for(n=0;n=1?1:t(e)}}function Mr(t){return function(e){return 1-t(1-e)}}function Ar(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tr(t){return t*t}function Lr(t){return t*t*t}function Cr(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function Sr(t){return function(e){return Math.pow(e,t)}}function zr(t){return 1-Math.cos(t*Hi)}function Or(t){return Math.pow(2,10*(t-1))}function Pr(t){return 1-Math.sqrt(1-t*t)}function Dr(t,e){var n;return arguments.length<2&&(e=.45),arguments.length?n=e/Bi*Math.asin(1/t):(t=1,n=e/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-n)*Bi/e)}}function Nr(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Er(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 Ir(t,e){t=ui.hcl(t),e=ui.hcl(e);var n=t.h,r=t.c,a=t.l,o=e.h-n,i=e.c-r,l=e.l-a;return isNaN(i)&&(i=0,r=isNaN(r)?e.c:r),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360),function(t){return dt(n+o*t,r+i*t,a+l*t)+""}}function Rr(t,e){t=ui.hsl(t),e=ui.hsl(e);var n=t.h,r=t.s,a=t.l,o=e.h-n,i=e.s-r,l=e.l-a;return isNaN(i)&&(i=0,r=isNaN(r)?e.s:r),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360),function(t){return ut(n+o*t,r+i*t,a+l*t)+""}}function Fr(t,e){t=ui.lab(t),e=ui.lab(e);var n=t.l,r=t.a,a=t.b,o=e.l-n,i=e.a-r,l=e.b-a;return function(t){return pt(n+o*t,r+i*t,a+l*t)+""}}function jr(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function Br(t){var e=[t.a,t.b],n=[t.c,t.d],r=Hr(e),a=qr(e,n),o=Hr(Vr(n,e,-a))||0;e[0]*n[1]180?e+=360:e-t>180&&(t+=360),r.push({i:n.push(Xr(n)+"rotate(",null,")")-2,x:xr(t,e)})):e&&n.push(Xr(n)+"rotate("+e+")")}function Gr(t,e,n,r){t!==e?r.push({i:n.push(Xr(n)+"skewX(",null,")")-2,x:xr(t,e)}):e&&n.push(Xr(n)+"skewX("+e+")")}function Yr(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var a=n.push(Xr(n)+"scale(",null,",",null,")");r.push({i:a-4,x:xr(t[0],e[0])},{i:a-2,x:xr(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(Xr(n)+"scale("+e+")")}function Wr(t,e){var n=[],r=[];return t=ui.transform(t),e=ui.transform(e),Ur(t.translate,e.translate,n,r),Zr(t.rotate,e.rotate,n,r),Gr(t.skew,e.skew,n,r),Yr(t.scale,e.scale,n,r),t=e=null,function(t){for(var e,a=-1,o=r.length;++a=0;)n.push(a[r])}function sa(t,e){for(var n=[t],r=[];null!=(t=n.pop());)if(r.push(t),(o=t.children)&&(a=o.length))for(var a,o,i=-1;++ia&&(r=n,a=e);return r}function xa(t){return t.reduce(ba,0)}function ba(t,e){return t+e[1]}function _a(t,e){return wa(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wa(t,e){for(var n=-1,r=+t[0],a=(t[1]-r)/e,o=[];++n<=e;)o[n]=a*n+r;return o}function ka(t){return[ui.min(t),ui.max(t)]}function Ma(t,e){return t.value-e.value}function Aa(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Ta(t,e){t._pack_next=e,e._pack_prev=t}function La(t,e){var n=e.x-t.x,r=e.y-t.y,a=t.r+e.r;return.999*a*a>n*n+r*r}function Ca(t){function e(t){u=Math.min(t.x-t.r,u),f=Math.max(t.x+t.r,f),d=Math.min(t.y-t.r,d),h=Math.max(t.y+t.r,h)}if((n=t.children)&&(c=n.length)){var n,r,a,o,i,l,s,c,u=1/0,f=-(1/0),d=1/0,h=-(1/0);if(n.forEach(Sa),r=n[0],r.x=-r.r,r.y=0,e(r),c>1&&(a=n[1],a.x=a.r,a.y=0,e(a),c>2))for(o=n[2],Pa(r,a,o),e(o),Aa(r,o),r._pack_prev=o,Aa(o,a),a=r._pack_next,i=3;i=0;)e=a[o],e.z+=n,e.m+=n,n+=e.s+(r+=e.c)}function Fa(t,e,n){return t.a.parent===e.parent?t.a:n}function ja(t){return 1+ui.max(t,function(t){return t.y})}function Ba(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function qa(t){var e=t.children;return e&&e.length?qa(e[0]):t}function Ha(t){var e,n=t.children;return n&&(e=n.length)?Ha(n[e-1]):t}function Va(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Xa(t,e){var n=t.x+e[3],r=t.y+e[0],a=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return a<0&&(n+=a/2,a=0),o<0&&(r+=o/2,o=0),{x:n,y:r,dx:a,dy:o}}function Ua(t){var e=t[0],n=t[t.length-1];return e2?Qa:Ga,s=r?$r:Qr;return i=a(t,e,s,n),l=a(e,t,s,_r),o}function o(t){return i(t)}var i,l;return o.invert=function(t){return l(t)},o.domain=function(e){return arguments.length?(t=e.map(Number),a()):t},o.range=function(t){return arguments.length?(e=t,a()):e},o.rangeRound=function(t){return o.range(t).interpolate(jr)},o.clamp=function(t){return arguments.length?(r=t,a()):r},o.interpolate=function(t){return arguments.length?(n=t,a()):n},o.ticks=function(e){return eo(t,e)},o.tickFormat=function(e,n){return no(t,e,n)},o.nice=function(e){return Ka(t,e),a()},o.copy=function(){return $a(t,e,n,r)},a()}function Ja(t,e){return ui.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ka(t,e){return Ya(t,Wa(to(t,e)[2])),Ya(t,Wa(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var n=Ua(t),r=n[1]-n[0],a=Math.pow(10,Math.floor(Math.log(r/e)/Math.LN10)),o=e/r*a;return o<=.15?a*=10:o<=.35?a*=5:o<=.75&&(a*=2),n[0]=Math.ceil(n[0]/a)*a,n[1]=Math.floor(n[1]/a)*a+.5*a,n[2]=a,n}function eo(t,e){return ui.range.apply(ui,to(t,e))}function no(t,e,n){var r=to(t,e);if(n){var a=dl.exec(n);if(a.shift(),"s"===a[8]){var o=ui.formatPrefix(Math.max(bi(r[0]),bi(r[1])));return a[7]||(a[7]="."+ro(o.scale(r[2]))),a[8]="f",n=ui.format(a.join("")),function(t){return n(o.scale(t))+o.symbol}}a[7]||(a[7]="."+ao(a[8],r)),n=a.join("")}else n=",."+ro(r[2])+"f";return ui.format(n)}function ro(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ao(t,e){var n=ro(e[2]);return t in As?Math.abs(n-ro(Math.max(bi(e[0]),bi(e[1]))))+ +("e"!==t):n-2*("%"===t)}function oo(t,e,n,r){function a(t){return(n?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return n?Math.pow(e,t):-Math.pow(e,-t)}function i(e){return t(a(e))}return i.invert=function(e){return o(t.invert(e))},i.domain=function(e){return arguments.length?(n=e[0]>=0,t.domain((r=e.map(Number)).map(a)),i):r},i.base=function(n){return arguments.length?(e=+n,t.domain(r.map(a)),i):e},i.nice=function(){var e=Ya(r.map(a),n?Math:Ls);return t.domain(e),r=e.map(o),i},i.ticks=function(){var t=Ua(r),i=[],l=t[0],s=t[1],c=Math.floor(a(l)),u=Math.ceil(a(s)),f=e%1?2:e;if(isFinite(u-c)){if(n){for(;c0;d--)i.push(o(c)*d);for(c=0;i[c]s;u--);i=i.slice(c,u)}return i},i.tickFormat=function(t,n){if(!arguments.length)return Ts;arguments.length<2?n=Ts:"function"!=typeof n&&(n=ui.format(n));var r=Math.max(1,e*t/i.ticks().length);return function(t){var i=t/o(Math.round(a(t)));return i*e0?l[n-1]:t[0],n0?0:1}function _o(t,e,n,r,a){var o=t[0]-e[0],i=t[1]-e[1],l=(a?r:-r)/Math.sqrt(o*o+i*i),s=l*i,c=-l*o,u=t[0]+s,f=t[1]+c,d=e[0]+s,h=e[1]+c,p=(u+d)/2,g=(f+h)/2,v=d-u,m=h-f,y=v*v+m*m,x=n-r,b=u*h-d*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*m-v*_)/y,k=(-b*v-m*_)/y,M=(b*m+v*_)/y,A=(-b*v+m*_)/y,T=w-p,L=k-g,C=M-p,S=A-g;return T*T+L*L>C*C+S*S&&(w=M,k=A),[[w-s,k-c],[w*n/x,k*n/x]]}function wo(t){function e(e){function i(){c.push("M",o(t(u),l))}for(var s,c=[],u=[],f=-1,d=e.length,h=Ct(n),p=Ct(r);++f1?t.join("L"):t+"Z"}function Mo(t){return t.join("L")+"Z"}function Ao(t){for(var e=0,n=t.length,r=t[0],a=[r[0],",",r[1]];++e1&&a.push("H",r[0]),a.join("")}function To(t){for(var e=0,n=t.length,r=t[0],a=[r[0],",",r[1]];++e1){l=e[1],o=t[s],s++,r+="C"+(a[0]+i[0])+","+(a[1]+i[1])+","+(o[0]-l[0])+","+(o[1]-l[1])+","+o[0]+","+o[1];for(var c=2;c9&&(a=3*e/Math.sqrt(a),i[l]=a*n,i[l+1]=a*r));for(l=-1;++l<=s;)a=(t[Math.min(s,l+1)][0]-t[Math.max(0,l-1)][0])/(6*(1+i[l]*i[l])),o.push([a||0,i[l]*a||0]);return o}function Ho(t){return t.length<3?ko(t):t[0]+Oo(t,qo(t))}function Vo(t){for(var e,n,r,a=-1,o=t.length;++a0;)h[--l].call(t,i);if(o>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[r]:delete t[n],1}var s,c,u,d,h,p=t[n]||(t[n]={active:0,count:0}),g=p[r];g||(s=a.time,c=Dt(o,0,s),g=p[r]={tween:new f,time:s,timer:c,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++p.count)}function ri(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate("+(isFinite(r)?r:n(t))+",0)"})}function ai(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate(0,"+(isFinite(r)?r:n(t))+")"})}function oi(t){return t.toISOString()}function ii(t,e,n){function r(e){return t(e)}function a(t,n){var r=t[1]-t[0],a=r/n,o=ui.bisect(Js,a);return o==Js.length?[e.year,to(t.map(function(t){return t/31536e6}),n)[2]]:o?e[a/Js[o-1]1?{floor:function(e){for(;n(e=t.floor(e));)e=li(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=li(+e+1);return e}}:t))},r.ticks=function(t,e){var n=Ua(r.domain()),o=null==t?a(n,10):"number"==typeof t?a(n,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(n[0],li(+n[1]+1),e<1?1:e)},r.tickFormat=function(){return n},r.copy=function(){return ii(t.copy(),e,n)},Ja(r,t)}function li(t){return new Date(t)}function si(t){return JSON.parse(t.responseText)}function ci(t){var e=hi.createRange();return e.selectNode(hi.body),e.createContextualFragment(t.responseText)}var ui={version:"3.5.17"},fi=[].slice,di=function(t){return fi.call(t)},hi=this.document;if(hi)try{di(hi.documentElement.childNodes)[0].nodeType}catch(t){di=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),hi)try{hi.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var pi=this.Element.prototype,gi=pi.setAttribute,vi=pi.setAttributeNS,mi=this.CSSStyleDeclaration.prototype,yi=mi.setProperty;pi.setAttribute=function(t,e){gi.call(this,t,e+"")},pi.setAttributeNS=function(t,e,n){vi.call(this,t,e,n+"")},mi.setProperty=function(t,e,n){yi.call(this,t,e+"",n)}}ui.ascending=a,ui.descending=function(t,e){return et?1:e>=t?0:NaN},ui.min=function(t,e){var n,r,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=r;break}for(;++ar&&(n=r)}else{for(;++a=r){n=r;break}for(;++ar&&(n=r)}return n},ui.max=function(t,e){var n,r,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=r;break}for(;++an&&(n=r)}else{for(;++a=r){n=r;break}for(;++an&&(n=r)}return n},ui.extent=function(t,e){var n,r,a,o=-1,i=t.length;if(1===arguments.length){for(;++o=r){n=a=r;break}for(;++or&&(n=r),a=r){n=a=r;break}for(;++or&&(n=r),a1)return s/(u-1)},ui.deviation=function(){var t=ui.variance.apply(this,arguments);return t?Math.sqrt(t):t};var xi=l(a);ui.bisectLeft=xi.left,ui.bisect=ui.bisectRight=xi.right,ui.bisector=function(t){return l(1===t.length?function(e,n){return a(t(e),n)}:t)},ui.shuffle=function(t,e,n){(o=arguments.length)<3&&(n=t.length,o<2&&(e=0));for(var r,a,o=n-e;o;)a=Math.random()*o--|0,r=t[o+e],t[o+e]=t[a+e],t[a+e]=r;return t},ui.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r},ui.pairs=function(t){for(var e,n=0,r=t.length-1,a=t[0],o=new Array(r<0?0:r);n=0;)for(r=t[a],e=r.length;--e>=0;)n[--i]=r[e];return n};var bi=Math.abs;ui.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n===1/0)throw new Error("infinite range");var r,a=[],o=c(bi(n)),i=-1;if(t*=o,e*=o,n*=o,n<0)for(;(r=t+n*++i)>e;)a.push(r/o);else for(;(r=t+n*++i)=o.length)return r?r.call(a,i):n?i.sort(n):i;for(var s,c,u,d,h=-1,p=i.length,g=o[l++],v=new f;++h=o.length)return t;var r=[],a=i[n++];return t.forEach(function(t,a){r.push({key:t,values:e(a,n)})}),a?r.sort(function(t,e){return a(t.key,e.key)}):r}var n,r,a={},o=[],i=[];return a.map=function(e,n){return t(n,e,0)},a.entries=function(n){return e(t(ui.map,n,0),0)},a.key=function(t){return o.push(t),a},a.sortKeys=function(t){return i[o.length-1]=t,a},a.sortValues=function(t){return n=t,a},a.rollup=function(t){return r=t,a},a},ui.set=function(t){var e=new x;if(t)for(var n=0,r=t.length;n=0&&(r=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},ui.event=null,ui.requote=function(t){return t.replace(Mi,"\\$&")};var Mi=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ai={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},Ti=function(t,e){return e.querySelector(t)},Li=function(t,e){return e.querySelectorAll(t)},Ci=function(t,e){var n=t.matches||t[w(t,"matchesSelector")];return(Ci=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Ti=function(t,e){return Sizzle(t,e)[0]||null},Li=Sizzle,Ci=Sizzle.matchesSelector),ui.selection=function(){return ui.select(hi.documentElement)};var Si=ui.selection.prototype=[];Si.select=function(t){var e,n,r,a,o=[];t=z(t);for(var i=-1,l=this.length;++i=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Oi.hasOwnProperty(n)?{space:Oi[n],local:t}:t}},Si.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();return t=ui.ns.qualify(t),t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(P(e,t[e]));return this}return this.each(P(t,e))},Si.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=E(t)).length,a=-1;if(e=n.classList){for(;++a=0;)(n=r[a])&&(o&&o!==n.nextSibling&&o.parentNode.insertBefore(n,o),o=n);return this},Si.sort=function(t){t=X.apply(this,arguments);for(var e=-1,n=this.length;++e0&&(e=e.transition().duration(S)),e.call(t.event)}function l(){_&&_.domain(b.range().map(function(t){return(t-M.x)/M.k}).map(b.invert)),k&&k.domain(w.range().map(function(t){return(t-M.y)/M.k}).map(w.invert))}function s(t){z++||t({type:"zoomstart"})}function c(t){l(),t({type:"zoom",scale:M.k,translate:[M.x,M.y]})}function u(t){--z||(t({type:"zoomend"}),v=null)}function f(){function t(){l=1,o(ui.mouse(a),d),c(i)}function n(){f.on(P,null).on(D,null),h(l),u(i)}var a=this,i=E.of(a,arguments),l=0,f=ui.select(r(a)).on(P,t).on(D,n),d=e(ui.mouse(a)),h=$(a);Hs.call(a),s(i)}function d(){function t(){var t=ui.touches(p);return h=M.k,t.forEach(function(t){t.identifier in v&&(v[t.identifier]=e(t))}),t}function n(){var e=ui.event.target;ui.select(e).on(b,r).on(_,l),w.push(e);for(var n=ui.event.changedTouches,a=0,o=n.length;a1){ +var u=s[0],f=s[1],d=u[0]-f[0],h=u[1]-f[1];m=d*d+h*h}}function r(){var t,e,n,r,i=ui.touches(p);Hs.call(p);for(var l=0,s=i.length;l=c)return i;if(a)return a=!1,o;var e=u;if(34===t.charCodeAt(e)){for(var n=e;n++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,hl=ui.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=ui.round(t,Rt(t,e))).toFixed(Math.max(0,Math.min(20,Rt(t*(1+1e-15),e))))}}),pl=ui.time={},gl=Date;qt.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(){vl.setUTCDate.apply(this._,arguments)},setDay:function(){vl.setUTCDay.apply(this._,arguments)},setFullYear:function(){vl.setUTCFullYear.apply(this._,arguments)},setHours:function(){vl.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){vl.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){vl.setUTCMinutes.apply(this._,arguments)},setMonth:function(){vl.setUTCMonth.apply(this._,arguments)},setSeconds:function(){vl.setUTCSeconds.apply(this._,arguments)},setTime:function(){vl.setTime.apply(this._,arguments)}};var vl=Date.prototype;pl.year=Ht(function(t){return t=pl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),pl.years=pl.year.range,pl.years.utc=pl.year.utc.range,pl.day=Ht(function(t){var e=new gl(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),pl.days=pl.day.range,pl.days.utc=pl.day.utc.range,pl.dayOfYear=function(t){var e=pl.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=pl[t]=Ht(function(t){return(t=pl.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});pl[t+"s"]=n.range,pl[t+"s"].utc=n.utc.range,pl[t+"OfYear"]=function(t){var n=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(n+e)%7)/7)}}),pl.week=pl.sunday,pl.weeks=pl.sunday.range,pl.weeks.utc=pl.sunday.utc.range,pl.weekOfYear=pl.sundayOfYear;var ml={"-":"",_:" ",0:"0"},yl=/^\s*\d+/,xl=/^%/;ui.locale=function(t){return{numberFormat:jt(t),timeFormat:Xt(t)}};var bl=ui.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"]});ui.format=bl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,_l),de(_l.s,this.s,this),this.s?this.t+=_l.t:this.s=_l.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _l=new fe;ui.geo.stream=function(t,e){t&&wl.hasOwnProperty(t.type)?wl[t.type](t,e):he(t,e)};var wl={Feature:function(t,e){he(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,a=n.length;++rh&&(h=e)}function e(e,n){var r=me([e*Vi,n*Vi]);if(m){var a=xe(m,r),o=[a[1],-a[0],0],i=xe(o,a);we(i),i=ke(i);var s=e-p,c=s>0?1:-1,g=i[0]*Xi*c,v=bi(s)>180;if(v^(c*ph&&(h=y)}else if(g=(g+360)%360-180,v^(c*ph&&(h=n);v?el(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e):d>=u?(ed&&(d=e)):e>p?l(u,e)>l(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e)}else t(e,n);m=r,p=e}function n(){_.point=e}function r(){b[0]=u,b[1]=d,_.point=t,m=null}function a(t,n){if(m){var r=t-p;y+=bi(r)>180?r+(r>0?360:-360):r}else g=t,v=n;Tl.point(t,n),e(t,n)}function o(){Tl.lineStart()}function i(){a(g,v),Tl.lineEnd(),bi(y)>Ri&&(u=-(d=180)),b[0]=u,b[1]=d,m=null}function l(t,e){return(e-=t)<0?e+360:e}function s(t,e){return t[0]-e[0]}function c(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tRi?h=90:y<-Ri&&(f=-90),b[0]=u,b[1]=d}};return function(t){h=d=-(u=f=1/0),x=[],ui.geo.stream(t,_);var e=x.length;if(e){x.sort(s);for(var n,r=1,a=x[0],o=[a];rl(a[0],a[1])&&(a[1]=n[1]),l(n[0],a[1])>l(a[0],a[1])&&(a[0]=n[0])):o.push(a=n);for(var i,n,p=-(1/0),e=o.length-1,r=0,a=o[e];r<=e;a=n,++r)n=o[r],(i=l(a[1],n[0]))>p&&(p=i,u=n[0],d=a[1])}return x=b=null,u===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[u,f],[d,h]]}}(),ui.geo.centroid=function(t){Ll=Cl=Sl=zl=Ol=Pl=Dl=Nl=El=Il=Rl=0,ui.geo.stream(t,Fl);var e=El,n=Il,r=Rl,a=e*e+n*n+r*r;return a=.12&&a<.234&&r>=-.425&&r<-.214?i:a>=.166&&a<.234&&r>=-.214&&r<-.115?l:o).invert(t)},t.stream=function(t){var e=o.stream(t),n=i.stream(t),r=l.stream(t);return{point:function(t,a){e.point(t,a),n.point(t,a),r.point(t,a)},sphere:function(){e.sphere(),n.sphere(),r.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),i.precision(e),l.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),i.scale(.35*e),l.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var c=o.scale(),u=+e[0],f=+e[1];return n=o.translate(e).clipExtent([[u-.455*c,f-.238*c],[u+.455*c,f+.238*c]]).stream(s).point,r=i.translate([u-.307*c,f+.201*c]).clipExtent([[u-.425*c+Ri,f+.12*c+Ri],[u-.214*c-Ri,f+.234*c-Ri]]).stream(s).point,a=l.translate([u-.205*c,f+.212*c]).clipExtent([[u-.214*c+Ri,f+.166*c+Ri],[u-.115*c-Ri,f+.234*c-Ri]]).stream(s).point,t},t.scale(1070)};var ql,Hl,Vl,Xl,Ul,Zl,Gl={point:k,lineStart:k,lineEnd:k,polygonStart:function(){Hl=0,Gl.lineStart=Ye},polygonEnd:function(){Gl.lineStart=Gl.lineEnd=Gl.point=k,ql+=bi(Hl/2)}},Yl={point:We,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Wl={point:Je,lineStart:Ke,lineEnd:tn,polygonStart:function(){Wl.lineStart=en},polygonEnd:function(){Wl.point=Je,Wl.lineStart=Ke,Wl.lineEnd=tn}};ui.geo.path=function(){function t(t){return t&&("function"==typeof l&&o.pointRadius(+l.apply(this,arguments)),i&&i.valid||(i=a(o)),ui.geo.stream(t,i)),o.result()}function e(){return i=null,t}var n,r,a,o,i,l=4.5;return t.area=function(t){return ql=0,ui.geo.stream(t,a(Gl)),ql},t.centroid=function(t){return Sl=zl=Ol=Pl=Dl=Nl=El=Il=Rl=0,ui.geo.stream(t,a(Wl)),Rl?[El/Rl,Il/Rl]:Nl?[Pl/Nl,Dl/Nl]:Ol?[Sl/Ol,zl/Ol]:[NaN,NaN]},t.bounds=function(t){return Ul=Zl=-(Vl=Xl=1/0),ui.geo.stream(t,a(Yl)),[[Vl,Xl],[Ul,Zl]]},t.projection=function(t){return arguments.length?(a=(n=t)?t.stream||an(t):b,e()):n},t.context=function(t){return arguments.length?(o=null==(r=t)?new Qe:new nn(t),"function"!=typeof l&&o.pointRadius(l),e()):r},t.pointRadius=function(e){return arguments.length?(l="function"==typeof e?e:(o.pointRadius(+e),+e),t):l},t.projection(ui.geo.albersUsa()).context(null)},ui.geo.transform=function(t){return{stream:function(e){var n=new on(e);for(var r in t)n[r]=t[r];return n}}},on.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()}},ui.geo.projection=sn,ui.geo.projectionMutator=cn,(ui.geo.equirectangular=function(){return sn(fn)}).raw=fn.invert=fn,ui.geo.rotation=function(t){function e(e){return e=t(e[0]*Vi,e[1]*Vi),e[0]*=Xi,e[1]*=Xi,e}return t=hn(t[0]%360*Vi,t[1]*Vi,t.length>2?t[2]*Vi:0),e.invert=function(e){return e=t.invert(e[0]*Vi,e[1]*Vi),e[0]*=Xi,e[1]*=Xi,e},e},dn.invert=fn,ui.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,e=hn(-t[0]*Vi,-t[1]*Vi,0).invert,a=[];return n(null,null,1,{point:function(t,n){a.push(t=e(t,n)),t[0]*=Xi,t[1]*=Xi}}),{type:"Polygon",coordinates:[a]}}var e,n,r=[0,0],a=6;return t.origin=function(e){return arguments.length?(r=e,t):r},t.angle=function(r){return arguments.length?(n=mn((e=+r)*Vi,a*Vi),t):e},t.precision=function(r){return arguments.length?(n=mn(e*Vi,(a=+r)*Vi),t):a},t.angle(90)},ui.geo.distance=function(t,e){var n,r=(e[0]-t[0])*Vi,a=t[1]*Vi,o=e[1]*Vi,i=Math.sin(r),l=Math.cos(r),s=Math.sin(a),c=Math.cos(a),u=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((n=f*i)*n+(n=c*u-s*f*l)*n),s*u+c*f*l)},ui.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return ui.range(Math.ceil(o/v)*v,a,v).map(d).concat(ui.range(Math.ceil(c/m)*m,s,m).map(h)).concat(ui.range(Math.ceil(r/p)*p,n,p).filter(function(t){return bi(t%v)>Ri}).map(u)).concat(ui.range(Math.ceil(l/g)*g,i,g).filter(function(t){return bi(t%m)>Ri}).map(f))}var n,r,a,o,i,l,s,c,u,f,d,h,p=10,g=p,v=90,m=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[d(o).concat(h(s).slice(1),d(a).reverse().slice(1),h(c).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],a=+e[1][0],c=+e[0][1],s=+e[1][1],o>a&&(e=o,o=a,a=e),c>s&&(e=c,c=s,s=e),t.precision(y)):[[o,c],[a,s]]},t.minorExtent=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],l=+e[0][1],i=+e[1][1],r>n&&(e=r,r=n,n=e),l>i&&(e=l,l=i,i=e),t.precision(y)):[[r,l],[n,i]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(v=+e[0],m=+e[1],t):[v,m]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,u=xn(l,i,90),f=bn(r,n,y),d=xn(c,s,90),h=bn(o,a,y),t):y},t.majorExtent([[-180,-90+Ri],[180,90-Ri]]).minorExtent([[-180,-80-Ri],[180,80+Ri]])},ui.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||r.apply(this,arguments),n||a.apply(this,arguments)]}}var e,n,r=_n,a=wn;return t.distance=function(){return ui.geo.distance(e||r.apply(this,arguments),n||a.apply(this,arguments))},t.source=function(n){return arguments.length?(r=n,e="function"==typeof n?null:n,t):r},t.target=function(e){return arguments.length?(a=e,n="function"==typeof e?null:e,t):a},t.precision=function(){return arguments.length?t:0},t},ui.geo.interpolate=function(t,e){return kn(t[0]*Vi,t[1]*Vi,e[0]*Vi,e[1]*Vi)},ui.geo.length=function(t){return Ql=0,ui.geo.stream(t,$l),Ql};var Ql,$l={sphere:k,point:k,lineStart:Mn,lineEnd:k,polygonStart:k,polygonEnd:k},Jl=An(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return sn(Jl)}).raw=Jl;var Kl=An(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return sn(Kl)}).raw=Kl,(ui.geo.conicConformal=function(){return Ze(Tn)}).raw=Tn,(ui.geo.conicEquidistant=function(){return Ze(Ln)}).raw=Ln;var ts=An(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return sn(ts)}).raw=ts,Cn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return Sn(Cn)}).raw=Cn;var es=An(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return sn(es)}).raw=es;var ns=An(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return sn(ns)}).raw=ns,zn.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Hi]},(ui.geo.transverseMercator=function(){var t=Sn(zn),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):(t=n(),[t[0],t[1],t[2]-90])},n([0,0,90])}).raw=zn,ui.geom={},ui.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,a=Ct(n),o=Ct(r),i=t.length,l=[],s=[];for(e=0;e=0;--e)h.push(t[l[c[e]][2]]);for(e=+f;e=r&&c.x<=o&&c.y>=a&&c.y<=i?[[r,i],[o,i],[o,a],[r,a]]:[];u.point=t[l]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Ri)*Ri,y:Math.round(i(t,e)/Ri)*Ri,i:e}})}var r=On,a=Pn,o=r,i=a,l=fs;return t?e(t):(e.links=function(t){return cr(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return cr(n(t)).cells.forEach(function(n,r){for(var a,o,i=n.site,l=n.edges.sort(Gn),s=-1,c=l.length,u=l[c-1].edge,f=u.l===i?u.r:u.l;++s=c,d=r>=u,h=d<<1|f;t.leaf=!1,t=t.nodes[h]||(t.nodes[h]=pr()),f?a=c:l=c,d?i=u:s=u,o(t,e,n,r,a,i,l,s)}var u,f,d,h,p,g,v,m,y,x=Ct(l),b=Ct(s);if(null!=e)g=e,v=n,m=r,y=a;else if(m=y=-(g=v=1/0),f=[],d=[],p=t.length,i)for(h=0;hm&&(m=u.x),u.y>y&&(y=u.y),f.push(u.x),d.push(u.y);else for(h=0;hm&&(m=_),w>y&&(y=w),f.push(_),d.push(w)}var k=m-g,M=y-v;k>M?y=v+k:m=g+M;var A=pr();if(A.add=function(t){o(A,t,+x(t,++h),+b(t,h),g,v,m,y)},A.visit=function(t){gr(t,A,g,v,m,y)},A.find=function(t){return vr(A,t[0],t[1],g,v,m,y)},h=-1,null==e){for(;++h=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=gs.get(n)||ps,r=vs.get(r)||b,kr(r(n.apply(null,fi.call(arguments,1))))},ui.interpolateHcl=Ir,ui.interpolateHsl=Rr,ui.interpolateLab=Fr,ui.interpolateRound=jr,ui.transform=function(t){var e=hi.createElementNS(ui.ns.prefix.svg,"g");return(ui.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new Br(n?n.matrix:ms)})(t)},Br.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ms={a:1,b:0,c:0,d:1,e:0,f:0};ui.interpolateTransform=Wr,ui.layout={},ui.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++n0?a=t:(n.c=null,n.t=NaN,n=null,c.end({type:"end",alpha:a=0})):t>0&&(c.start({type:"start",alpha:a=t}),n=Dt(s.tick)),s):a},s.start=function(){function t(t,r){if(!n){for(n=new Array(a),s=0;s=0;)i.push(u=c[s]),u.parent=o,u.depth=o.depth+1;r&&(o.value=0),o.children=c}else r&&(o.value=+r.call(t,o,o.depth)||0),delete o.children;return sa(a,function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)}),l}var e=fa,n=ca,r=ua;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(r=e,t):r},t.revalue=function(e){return r&&(la(e,function(t){t.children&&(t.value=0)}),sa(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},ui.layout.partition=function(){function t(e,n,r,a){var o=e.children;if(e.x=n,e.y=e.depth*a,e.dx=r,e.dy=a,o&&(i=o.length)){var i,l,s,c=-1;for(r=e.value?r/e.value:0;++cl&&(l=r),i.push(r)}for(n=0;n0)for(o=-1;++o=u[0]&&l<=u[1]&&(i=s[ui.bisect(f,l,1,h)-1],i.y+=p,i.push(t[o]));return s}var e=!0,n=Number,r=ka,a=_a;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(r=Ct(e),t):r},t.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return wa(t,e)}:Ct(e),t):a},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},ui.layout.pack=function(){function t(t,o){var i=n.call(this,t,o),l=i[0],s=a[0],c=a[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(l.x=l.y=0,sa(l,function(t){t.r=+u(t.value)}),sa(l,Ca),r){var f=r*(e?1:Math.max(2*l.r/s,2*l.r/c))/2;sa(l,function(t){t.r+=f}),sa(l,Ca),sa(l,function(t){t.r-=f})}return Oa(l,s/2,c/2,e?1:1/Math.max(2*l.r/s,2*l.r/c)),i}var e,n=ui.layout.hierarchy().sort(Ma),r=0,a=[1,1];return t.size=function(e){return arguments.length?(a=e,t):a},t.radius=function(n){return arguments.length?(e=null==n||"function"==typeof n?n:+n,t):e},t.padding=function(e){return arguments.length?(r=+e,t):r},ia(t,n)},ui.layout.tree=function(){function t(t,a){var u=i.call(this,t,a),f=u[0],d=e(f);if(sa(d,n),d.parent.m=-d.z,la(d,r),c)la(f,o);else{var h=f,p=f,g=f;la(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var v=l(h,p)/2-h.x,m=s[0]/(p.x+l(p,h)/2+v),y=s[1]/(g.depth||1);la(f,function(t){t.x=(t.x+v)*m,t.y=t.depth*y})}return u}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var a,o=e.children,i=0,l=o.length;i0&&(Ia(Fa(i,t,n),t,r),c+=r,u+=r),f+=i.m,c+=a.m,d+=s.m,u+=o.m;i&&!Ea(o)&&(o.t=i,o.m+=f-u),a&&!Na(s)&&(s.t=a,s.m+=c-d,n=t)}return n}function o(t){t.x*=s[0],t.y=t.depth*s[1]}var i=ui.layout.hierarchy().sort(null).value(null),l=Da,s=[1,1],c=null;return t.separation=function(e){return arguments.length?(l=e,t):l},t.size=function(e){return arguments.length?(c=null==(s=e)?o:null,t):c?null:s},t.nodeSize=function(e){return arguments.length?(c=null==(s=e)?null:o,t):c?s:null},ia(t,i)},ui.layout.cluster=function(){function t(t,o){var i,l=e.call(this,t,o),s=l[0],c=0;sa(s,function(t){var e=t.children;e&&e.length?(t.x=Ba(e),t.y=ja(e)):(t.x=i?c+=n(t,i):0,t.y=0,i=t)});var u=qa(s),f=Ha(s),d=u.x-n(u,f)/2,h=f.x+n(f,u)/2;return sa(s,a?function(t){t.x=(t.x-s.x)*r[0],t.y=(s.y-t.y)*r[1]}:function(t){t.x=(t.x-d)/(h-d)*r[0],t.y=(1-(s.y?t.y/s.y:1))*r[1]}),l}var e=ui.layout.hierarchy().sort(null).value(null),n=Da,r=[1,1],a=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(a=null==(r=e),t):a?null:r},t.nodeSize=function(e){return arguments.length?(a=null!=(r=e),t):a?r:null},ia(t,e)},ui.layout.treemap=function(){function t(t,e){for(var n,r,a=-1,o=t.length;++a0;)u.push(i=d[s-1]),u.area+=i.area,"squarify"!==h||(l=r(u,g))<=p?(d.pop(),p=l):(u.area-=u.pop().area,a(u,g,c,!1),g=Math.min(c.dx,c.dy),u.length=u.area=0,p=1/0);u.length&&(a(u,g,c,!0),u.length=u.area=0),o.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var o,i=f(e),l=r.slice(),s=[];for(t(l,i.dx*i.dy/e.value),s.area=0;o=l.pop();)s.push(o),s.area+=o.area,null!=o.z&&(a(s,o.z?i.dx:i.dy,i,!l.length),s.length=s.area=0);r.forEach(n)}}function r(t,e){for(var n,r=t.area,a=0,o=1/0,i=-1,l=t.length;++ia&&(a=n));return r*=r,e*=e,r?Math.max(e*a*p/r,r/(e*o*p)):1/0}function a(t,e,n,r){var a,o=-1,i=t.length,l=n.x,c=n.y,u=e?s(t.area/e):0;if(e==n.dx){for((r||u>n.dy)&&(u=n.dy);++on.dx)&&(u=n.dx);++o1);return t+e*n*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=ui.random.normal.apply(ui,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ui.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;nf?0:1;if(c=qi)return e(c,h)+(t?e(t,1-h):"")+"Z";var p,g,v,m,y,x,b,_,w,k,M,A,T=0,L=0,C=[];if((m=(+s.apply(this,arguments)||0)/2)&&(v=o===Ps?Math.sqrt(t*t+c*c):+o.apply(this,arguments),h||(L*=-1),c&&(L=rt(v/c*Math.sin(m))),t&&(T=rt(v/t*Math.sin(m)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var S=Math.abs(f-u-2*L)<=ji?0:1;if(L&&bo(y,x,b,_)===h^S){var z=(u+f)/2;y=c*Math.cos(z),x=c*Math.sin(z),b=_=null}}else y=x=0;if(t){w=t*Math.cos(f-T),k=t*Math.sin(f-T),M=t*Math.cos(u+T),A=t*Math.sin(u+T);var O=Math.abs(u-f+2*T)<=ji?0:1;if(T&&bo(w,k,M,A)===1-h^O){var P=(u+f)/2;w=t*Math.cos(P),k=t*Math.sin(P),M=A=null}}else w=k=0;if(d>Ri&&(p=Math.min(Math.abs(c-t)/2,+a.apply(this,arguments)))>.001){g=tji)+",1 "+e}function a(t,e,n,r){return"Q 0,0 "+r}var o=_n,i=wn,l=Uo,s=mo,c=yo;return t.radius=function(e){return arguments.length?(l=Ct(e),t):l},t.source=function(e){return arguments.length?(o=Ct(e),t):o},t.target=function(e){return arguments.length?(i=Ct(e),t):i},t.startAngle=function(e){return arguments.length?(s=Ct(e),t):s},t.endAngle=function(e){return arguments.length?(c=Ct(e),t):c},t},ui.svg.diagonal=function(){function t(t,a){var o=e.call(this,t,a),i=n.call(this,t,a),l=(o.y+i.y)/2,s=[o,{x:o.x,y:l},{x:i.x,y:l},i];return s=s.map(r),"M"+s[0]+"C"+s[1]+" "+s[2]+" "+s[3]}var e=_n,n=wn,r=Zo;return t.source=function(n){return arguments.length?(e=Ct(n),t):e},t.target=function(e){return arguments.length?(n=Ct(e),t):n},t.projection=function(e){return arguments.length?(r=e,t):r},t},ui.svg.diagonal.radial=function(){var t=ui.svg.diagonal(),e=Zo,n=t.projection;return t.projection=function(t){return arguments.length?n(Go(e=t)):e},t},ui.svg.symbol=function(){function t(t,r){return(Rs.get(e.call(this,t,r))||Qo)(n.call(this,t,r))}var e=Wo,n=Yo;return t.type=function(n){return arguments.length?(e=Ct(n),t):e},t.size=function(e){return arguments.length?(n=Ct(e),t):n},t};var Rs=ui.map({circle:Qo,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*js)),n=e*js;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",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/Fs),n=e*Fs/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Fs),n=e*Fs/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});ui.svg.symbolTypes=Rs.keys();var Fs=Math.sqrt(3),js=Math.tan(30*Vi);Si.transition=function(t){for(var e,n,r=Bs||++Xs,a=ei(t),o=[],i=qs||{time:Date.now(),ease:Cr,delay:0,duration:250},l=-1,s=this.length;++lrect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",d[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==ui.event.keyCode&&(S||(x=null,O[0]-=f[1],O[1]-=d[1],S=2),T())}function g(){32==ui.event.keyCode&&2==S&&(O[0]+=f[1],O[1]+=d[1],S=0,T())}function v(){var t=ui.mouse(_),r=!1;b&&(t[0]+=b[0],t[1]+=b[1]),S||(ui.event.altKey?(x||(x=[(f[0]+f[1])/2,(d[0]+d[1])/2]),O[0]=f[+(t[0]0&&this._events[t].length>n&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!a(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,l;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||a(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(n)){for(l=o;l-- >0;)if(n[l]===e||n[l].listener&&n[l].listener===e){r=l;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;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(n=this._events[t],a(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],10:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;r13)&&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}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return t-t<1}},{}],11:[function(t,e,n){function r(t,e){var n=e[0],r=e[1],a=e[2],o=e[3],i=n+n,l=r+r,s=a+a,c=n*i,u=r*i,f=r*l,d=a*i,h=a*l,p=a*s,g=o*i,v=o*l,m=o*s;return t[0]=1-f-p,t[1]=u+m,t[2]=d-v,t[3]=0,t[4]=u-m,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+v,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=r},{}],12:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function i(t){if(d===clearTimeout)return clearTimeout(t);if((d===a||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{return d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}function l(){v&&p&&(v=!1,p.length?g=p.concat(g):m=-1,g.length&&s())}function s(){if(!v){var t=o(l);v=!0;for(var e=g.length;e;){for(p=g,g=[];++m1)for(var n=1;n.5?s/(2-o-i):s/(o+i),o){case t:r=(e-n)/s+(e1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var a,o,i;if(t=C(t,360),e=C(e,100),n=C(n,100),0===e)a=o=i=n;else{var l=n<.5?n*(1+e):n+e-n*e,s=2*n-l;a=r(s,l,t+1/3),o=r(s,l,t),i=r(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function s(t,e,n){t=C(t,255),e=C(e,255),n=C(n,255);var r,a,o=U(t,e,n),i=X(t,e,n),l=o,s=o-i;if(a=0===o?0:s/o,o==i)r=0;else{switch(o){case t:r=(e-n)/s+(e>1)+720)%360;--e;)a.h=(a.h+o)%360,i.push(r(a));return i}function A(t,e){e=e||6;for(var n=r(t).toHsv(),a=n.h,o=n.s,i=n.v,l=[],s=1/e;e--;)l.push(r({h:a,s:o,v:i})),i=(i+s)%1;return l}function T(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function C(t,n){O(t)&&(t="100%");var r=P(t);return t=X(n,U(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function S(t){return X(1,U(0,t))}function z(t){return parseInt(t,16)}function O(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function P(t){return"string"==typeof t&&t.indexOf("%")!=-1}function D(t){return 1==t.length?"0"+t:""+t}function N(t){return t<=1&&(t=100*t+"%"),t}function E(t){return e.round(255*parseFloat(t)).toString(16)}function I(t){return z(t)/255}function R(t){return!!W.CSS_UNIT.exec(t)}function F(t){t=t.replace(B,"").replace(q,"").toLowerCase();var e=!1;if(G[t])t=G[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=W.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=W.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=W.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=W.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=W.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=W.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=W.hex8.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),a:I(n[4]),format:e?"name":"hex8"}:(n=W.hex6.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),format:e?"name":"hex"}:(n=W.hex4.exec(t))?{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),a:I(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=W.hex3.exec(t))&&{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),format:e?"name":"hex"}}function j(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var B=/^\s+/,q=/\s+$/,H=0,V=e.round,X=e.min,U=e.max,Z=e.random;r.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,a,o,i,l=this.toRgb();return t=l.r/255,n=l.g/255,r=l.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),i=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),.2126*a+.7152*o+.0722*i},setAlpha:function(t){return this._a=L(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*C(this._r,255))+"%",g:V(100*C(this._g,255))+"%",b:V(100*C(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%)":"rgba("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[u(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),n=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=r(t);n="#"+d(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,a=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return r(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(v,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},r.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?n[a]=t[a]:n[a]=N(t[a]));t=n}return r(t,e)},r.equals=function(t,e){return!(!t||!e)&&r(t).toRgbString()==r(e).toRgbString()},r.random=function(){return r.fromRatio({r:Z(),g:Z(),b:Z()})},r.mix=function(t,e,n){n=0===n?0:n||50;var a=r(t).toRgb(),o=r(e).toRgb(),i=n/100,l={r:(o.r-a.r)*i+a.r,g:(o.g-a.g)*i+a.g,b:(o.b-a.b)*i+a.b,a:(o.a-a.a)*i+a.a};return r(l)},r.readability=function(t,n){var a=r(t),o=r(n);return(e.max(a.getLuminance(),o.getLuminance())+.05)/(e.min(a.getLuminance(),o.getLuminance())+.05)},r.isReadable=function(t,e,n){var a,o,i=r.readability(t,e);switch(o=!1,a=j(n),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},r.mostReadable=function(t,e,n){var a,o,i,l,s=null,c=0;n=n||{},o=n.includeFallbackColors,i=n.level,l=n.size;for(var u=0;uc&&(c=a,s=r(e[u]));return r.isReadable(t,s,{level:i,size:l})||!o?s:(n.includeFallbackColors=!1,r.mostReadable(t,["#fff","#000"],n))};var G=r.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=r.hexNames=T(G),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+r),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})$/}}();"undefined"!=typeof n&&n.exports?n.exports=r:"function"==typeof t&&t.amd?t(function(){return r}):window.tinycolor=r}(Math)},{}],14:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../color"),o=t("../../plots/cartesian/axes"),i=t("./attributes");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,i,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("opacity"),c("align"),c("bgcolor");var f=c("bordercolor"),d=a.opacity(f);c("borderpad");var h=c("borderwidth"),p=c("showarrow");c("text",p?" ":"new text"),c("textangle"),r.coerceFont(c,"font",n.font);for(var g=["x","y"],v=[-10,-30],m={_fullLayout:n},y=0;y<2;y++){var x=g[y],b=o.coerceRef(t,e,m,x,"","paper");if(o.coercePosition(e,m,c,b,x,.5),p){var _="a"+x,w=o.coerceRef(t,e,m,_,"pixel");"pixel"!==w&&w!==b&&(w=e[_]="pixel");var k="pixel"===w?v[y]:.4;o.coercePosition(e,m,c,w,_,k)}else c(x+"anchor")}return r.noneOrAll(t,e,["x","y"]),p&&(c("arrowcolor",d?e.bordercolor:a.defaultLine),c("arrowhead"),c("arrowsize"),c("arrowwidth",2*(d&&h||1)),r.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":115,"../../plots/cartesian/axes":142,"../color":23,"./attributes":16}],15:[function(t,e,n){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z", +backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],16:[function(t,e,n){"use strict";var r=t("./arrow_paths"),a=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),i=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:i({},a,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:r.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":112,"../../plots/cartesian/constants":147,"../../plots/font_attributes":162,"./arrow_paths":15}],17:[function(t,e,n){"use strict";function r(t){var e=t._fullLayout;e.annotations.forEach(function(e){var n=o.getFromId(t,e.xref),r=o.getFromId(t,e.yref);if(n||r){var a=(e._xsize||0)/2,i=e._xshift||0,l=(e._ysize||0)/2,s=e._yshift||0,c=a-i,u=a+i,f=l-s,d=l+s;if(e.showarrow){var h=3*e.arrowsize*e.arrowwidth;c=Math.max(c,h),u=Math.max(u,h),f=Math.max(f,h),d=Math.max(d,h)}n&&n.autorange&&o.expand(n,[n.l2c(n.r2l(e.x))],{ppadplus:u,ppadminus:c}),r&&r.autorange&&o.expand(r,[r.l2c(r.r2l(e.y))],{ppadplus:d,ppadminus:f})}})}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.annotations);if(n.length&&t._fullData.length){var l={};n.forEach(function(t){l[t.xref]=!0,l[t.yref]=!0});var s=o.list(t).filter(function(t){return t.autorange&&l[t._id]});if(s.length)return a.syncOrAsync([i,r],t)}}},{"../../lib":115,"../../plots/cartesian/axes":142,"./draw":19}],18:[function(t,e,n){"use strict";var r=t("../../plots/array_container_defaults"),a=t("./annotation_defaults");e.exports=function(t,e){var n={name:"annotations",handleItemDefaults:a};r(t,e,n)}},{"../../plots/array_container_defaults":139,"./annotation_defaults":14}],19:[function(t,e,n){"use strict";function r(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var n=0;n2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}rt.selectAll("tspan.line").attr({y:0,x:0});var r=$.select(".annotation-math-group"),a=!r.empty(),l=h.bBox((a?r:rt).node()),c=l.width,p=l.height,m=Math.round(c+2*tt),y=Math.round(p+2*tt);X._w=c,X._h=p;var b=!1;if(["x","y"].forEach(function(e){var r,a=X[e+"ref"]||e,o=f.getFromId(t,a),i=(Y+("x"===e?0:90))*Math.PI/180,l=m*Math.abs(Math.cos(i))+y*Math.abs(Math.sin(i)),s=X[e+"anchor"];if(o){var c=o.r2fraction(X[e]);if(!o.autorange&&(c<0||c>1)&&(X["a"+e+"ref"]===a?(c=o.r2fraction(X["a"+e]),(c<0||c>1)&&(b=!0)):b=!0,b))return;G[e]=o._offset+o.r2p(X[e]),r=.5}else r=X[e],"y"===e&&(r=1-r),G[e]="x"===e?O.l+O.w*r:O.t+O.h*r;var u=0;X["a"+e+"ref"]===a?G["aa"+e]=o._offset+o.r2p(X["a"+e]):(u=X.showarrow?X["a"+e]:l*n(r,s),G[e]+=u),X["_"+e+"type"]=o&&o.type,X["_"+e+"size"]=l,X["_"+e+"shift"]=u}),b)return void $.remove();var _,w;X.showarrow&&(_=X.axref===X.xref?G.x:u.constrain(G.x-X.ax,1,M.width-1),w=X.ayref===X.yref?G.y:u.constrain(G.y-X.ay,1,M.height-1)),G.x=u.constrain(G.x,1,M.width-1),G.y=u.constrain(G.y,1,M.height-1);var k=tt-l.top,A=tt-l.left;a?r.select("svg").attr({x:tt-1,y:tt}):(rt.attr({x:A,y:k}),rt.selectAll("tspan.line").attr({y:k,x:A})),et.call(h.setRect,J/2,J/2,m-J,y-J);var T=0,L=0;T=X.axref===X.xref?Math.round(G.aax-m/2):Math.round(G.x-m/2),L=X.ayref===X.yref?Math.round(G.aay-y/2):Math.round(G.y-y/2),$.call(u.setTranslate,T,L);var C="annotations["+e+"]",S=function(n,r){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=X.axref===X.xref?G.aax+n:G.x+n,l=X.ayref===X.yref?G.aay+r:G.y+r;var c=u.rotationXYMatrix(Y,a,l),f=u.apply2DTransform(c),h=u.apply2DTransform2(c),p=et.attr("width")/2,g=et.attr("height")/2,m=[[a-p,l-g,a-p,l+g],[a-p,l+g,a+p,l+g],[a+p,l+g,a+p,l-g],[a+p,l-g,a-p,l-g]].map(h);if(!m.reduce(function(t,e){return t^!!o(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){m.forEach(function(t){var e=o(a,l,_,w,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var y=X.arrowwidth,b=X.arrowcolor,k=W.append("g").style({opacity:d.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=k.append("path").attr("d","M"+a+","+l+"L"+_+","+w).style("stroke-width",y+"px").call(d.stroke,d.rgb(b));x(M,X.arrowhead,"end",X.arrowsize);var A=k.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-_)+","+(l-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,S;v.init({element:A.node(),prepFn:function(){var t=u.getTranslate($);L=t.x,S=t.y,T={},U&&U.autorange&&(T[U._name+".autorange"]=!0),Z&&Z.autorange&&(T[Z._name+".autorange"]=!0)},moveFn:function(t,e){k.attr("transform","translate("+t+","+e+")");var n=f(L,S),r=n[0]+t,a=n[1]+e;$.call(u.setTranslate,r,a),T[C+".x"]=U?U.p2r(U.r2p(X.x)+t):(_+t-O.l)/O.w,T[C+".y"]=Z?Z.p2r(Z.r2p(X.y)+e):1-(w+e-O.t)/O.h,X.axref===X.xref&&(T[C+".ax"]=U?U.p2r(U.r2p(X.ax)+t):(_+t-O.l)/O.w),X.ayref===X.yref&&(T[C+".ay"]=Z?Z.p2r(Z.r2p(X.ay)+e):1-(w+e-O.t)/O.h),Q.attr({transform:"rotate("+Y+","+r+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};X.showarrow&&S(0,0);var z=u.rotationXYMatrix(Y,G.x,G.y),P=u.apply2DTransform(z);if(t._context.editable){var D,N,E;v.init({element:$.node(),prepFn:function(){var t=u.getTranslate($);D=t.x,N=t.y,E={}},moveFn:function(t,e){$.call(u.setTranslate,D+t,N+e);var n="pointer";if(X.showarrow)X.axref===X.xref?E[C+".ax"]=U.p2r(U.r2p(X.ax)+t):E[C+".ax"]=X.ax+t,X.ayref===X.yref?E[C+".ay"]=Z.p2r(Z.r2p(X.ay)+e):E[C+".ay"]=X.ay+e,S(t,e);else{if(U)E[C+".x"]=X.x+t/U._m;else{var r=X._xsize/O.w,a=X.x+X._xshift/O.w-r/2;E[C+".x"]=v.align(a+t/O.w,r,0,1,X.xanchor)}if(Z)E[C+".y"]=X.y+e/Z._m;else{var o=X._ysize/O.h,i=X.y-X._yshift/O.h-o/2;E[C+".y"]=v.align(i-e/O.h,o,0,1,X.yanchor)}U&&Z||(n=v.getCursor(U?.5:E[C+".x"],Z?.5:E[C+".y"],X.xanchor,X.yanchor))}var l=P(D,N),s=l[0]+t,c=l[1]+e;$.call(u.setTranslate,D+t,N+e),Q.attr({transform:"rotate("+Y+","+s+","+c+")"}),g($,n)},doneFn:function(e){if(g($),e){s.relayout(t,E);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var w,k=t.layout,M=t._fullLayout;if(!l(e)||e===-1){if(!e&&Array.isArray(c))return k.annotations=c,y(k,M),void r(t);if("remove"===c)return delete k.annotations,M.annotations=[],void r(t);if(n&&"add"!==c){for(w=0;we;w--)M._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),a(t,w)}}M._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=k.annotations[e],L=M.annotations[e];if(T){var C={};"string"==typeof n&&n?C[n]=c:u.isPlainObject(n)&&(C=n);var S=Object.keys(C);for(w=0;w4/3&&(R=H)}}else I&&(j&&(R<1/3?R+=q:R>2/3&&(R-=q)),R=(R-I.domain[0])/(I.domain[1]-I.domain[0]),R=I.fraction2r(R))}I&&I===E&&F&&("log"===F&&"log"!==I.type?R=Math.pow(10,R):"log"!==F&&"log"===I.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),T[N]=R}}var X={};m(T,X,M),M.annotations[e]=X;var U=f.getFromId(t,X.xref),Z=f.getFromId(t,X.yref),G={x:0,y:0},Y=+X.textangle||0,W=M._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",X.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:X})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),J=X.borderwidth,K=X.borderpad,tt=J+K,et=$.append("rect").attr("class","bg").style("stroke-width",J+"px").call(d.stroke,X.bordercolor).call(d.fill,X.bgcolor),nt=X.font,rt=$.append("text").classed("annotation",!0).attr("data-unformatted",X.text).text(X.text);t._context.editable?rt.call(p.makeEditable,$).call(b).on("edit",function(n){X.text=n,this.attr({"data-unformatted":X.text}),this.call(b);var r={};r["annotations["+e+"].text"]=X.text,U&&U.autorange&&(r[U._name+".autorange"]=!0),Z&&Z.autorange&&(r[Z._name+".autorange"]=!0),s.relayout(t,r)}):rt.call(b),Q.attr({transform:"rotate("+Y+","+G.x+","+G.y+")"}).call(h.setPosition,G.x,G.y)}}}function o(t,e,n,r,a,o,i,l){var s=n-t,c=a-t,u=i-a,f=r-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,v=(c*f-s*d)/p;return v<0||v>1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:r,drawOne:a}},{"../../lib":115,"../../lib/setcursor":125,"../../lib/svg_text_utils":127,"../../plotly":137,"../../plots/cartesian/axes":142,"../../plots/plots":166,"../color":23,"../dragelement":44,"../drawing":46,"./annotation_defaults":14,"./defaults":18,"./draw_arrow_head":20,d3:7,"fast-isnumeric":10}],20:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../color"),i=t("../drawing"),l=t("./arrow_paths");e.exports=function(t,e,n,s){a(s)||(s=1);var c=t.node(),u=l[e||0];if(u){"string"==typeof n&&n||(n="end");var f,d,h,p,g=(i.getPx(t,"stroke-width")||1)*s,v=t.style("stroke")||o.defaultLine,m=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,b=u.backoff*g;if("line"===c.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},d={x:+t.attr("x2"),y:+t.attr("y2")},h=Math.atan2(f.y-d.y,f.x-d.x),p=h+Math.PI,b){var _=b*Math.cos(h),w=b*Math.sin(h);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(d.x+=_,d.y+=w,t.attr({x2:d.x,y2:d.y}))}}else if("path"===c.nodeName){var k=c.getTotalLength(),M="";if(y){var A=c.getPointAtLength(0),T=c.getPointAtLength(.1);h=Math.atan2(A.y-T.y,A.x-T.x),f=c.getPointAtLength(Math.min(b,k)),b&&(M="0px,"+b+"px,")}if(x){var L=c.getPointAtLength(k),C=c.getPointAtLength(k-.1);if(p=Math.atan2(L.y-C.y,L.x-C.x),d=c.getPointAtLength(Math.max(0,k-b)),b){var S=M?2*b:b;M+=k-S+"px,"+k+"px"}}else M&&(M+=k+"px");M&&t.style("stroke-dasharray",M)}var z=function(n,a){e>5&&(a=0),r.select(c.parentElement).append("path").attr({class:t.attr("class"),d:u.path,transform:"translate("+n.x+","+n.y+")rotate("+180*a/Math.PI+")scale("+g+")"}).style({fill:v,opacity:m,"stroke-width":0})};y&&z(f,h),x&&z(d,p)}}},{"../color":23,"../drawing":46,"./arrow_paths":15,d3:7,"fast-isnumeric":10}],21:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":16,"./calc_autorange":17,"./defaults":18,"./draw":19}],22:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],23:[function(t,e,n){"use strict";function r(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===r.length;if(!a&&3!==r.length)return t;for(var i=0;i=0))return t;if(3===i)r[i]>1&&(r[i]=1);else if(r[i]>=1)return t}var l=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return a?"rgba("+l+", "+r[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var n=a(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},i.combine=function(t,e){var n=a(t).toRgb();if(1===n.a)return a(t).toRgbString();var r=a(e||i.background).toRgb(),o=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},l={r:o.r*(1-n.a)+n.r*n.a,g:o.g*(1-n.a)+n.g*n.a,b:o.b*(1-n.a)+n.b*n.a};return a(l).toRgbString()},i.contrast=function(t,e,n){var r=a(t),o=r.isLight()?r.darken(n):r.lighten(e);return o.toString()},i.stroke=function(t,e){var n=a(e);t.style({stroke:i.tinyRGB(n),"stroke-opacity":n.getAlpha()})},i.fill=function(t,e){var n=a(e);t.style({fill:i.tinyRGB(n),"fill-opacity":n.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,n,a,o,l=Object.keys(t);for(e=0;el&&(o[1]-=(lt-l)/2)):n.node()&&!n.classed("js-placeholder")&&(lt=h.bBox(e.node()).height),lt){if(lt+=5,"top"===_.titleside)K.domain[1]-=lt/T.h,o[1]*=-1;else{K.domain[0]+=lt/T.h;var c=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),K.setScale()}}ot.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-K.domain[1]))+")");var f=ot.select(".cbfills").selectAll("rect.cbfill").data(z);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?C[0]:(z[e]+z[e-1])/2,e===z.length-1?C[1]:(z[e]+z[e+1])/2].map(K.c2p).map(Math.round);e!==z.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=P(t).replace("e-",""),i=a(o).toHexString();r.select(this).attr({x:G,width:Math.max(B,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var d=ot.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){r.select(this).attr("d","M"+G+","+(Math.round(K.c2p(t))+_.line.width/2%1)+"h"+B).call(h.lineGroupStyle,_.line.width,O(t),_.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=G+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=K.titlefont.size,n=K._offset+K._length/2,a=T.l+(K.position||0)*T.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));k("h"+K._id+"title",{avoid:{selection:r.select(t).selectAll("g."+K._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:A.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function k(e,n){var r,a=b();r=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:K,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:ot.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;ot.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,n||{}))}function M(){var n=B+_.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(R=it.select("text"),R.node()&&!R.classed("js-placeholder")){var r,a=it.select(".h"+K._id+"title-math-group").node();r=a&&["top","bottom"].indexOf(_.titleside)!==-1?h.bBox(a).width:h.bBox(it.node()).right-G-T.l,n=Math.max(n,r)}var o=2*_.xpad+n+_.borderwidth+_.outlinewidth/2,l=Q-$;ot.select(".cbbg").attr({x:G-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-U,width:Math.max(o,2),height:Math.max(l+2*U,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),ot.selectAll(".cboutline").attr({x:G,y:$+_.ypad+("top"===_.titleside?lt:0),width:Math.max(B,2),height:Math.max(l-2*_.ypad-lt,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var s=({center:.5,right:1}[_.xanchor]||0)*o;ot.attr("transform","translate("+(T.l-s)+","+T.t+")"),i.autoMargin(t,e,{x:_.x,y:_.y,l:o*({right:1,center:.5}[_.xanchor]||0),r:o*({left:1,center:.5}[_.xanchor]||0),t:l*({bottom:1,middle:.5}[_.yanchor]||0),b:l*({top:1,middle:.5}[_.yanchor]||0)})}var A=t._fullLayout,T=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var L,C=r.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],z=[],O="function"==typeof _.line.color?_.line.color:function(){return _.line.color},P="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},D=_.levels.end+_.levels.size/100,N=_.levels.size,E=1.001*C[0]-.001*C[1],I=1.001*C[1]-.001*C[0];for(L=_.levels.start;(L-D)*N<0;L+=N)L>E&&LC[0]&&L1){var at=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));et*=at*u.roundUp(rt/at,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+Z,W+V-Z],K.setScale();var ot=A._infolayer.selectAll("g."+e).data([0]);ot.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),ot.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var it=ot.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");K._axislayer=ot.select(".cbaxis");var lt=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var st,ct=T.l+(_.x+X)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-Z))*T.h+T.t+3+.75*ut:(1-(W+Z))*T.h+T.t-3-.25*ut,k(K._id+"title",{attributes:{x:ct,y:st,"text-anchor":"start"}})}var ft=u.syncOrAsync([i.previousPromises,w,i.previousPromises,M],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var dt,ht,pt;c.init({element:ot.node(),prepFn:function(){dt=ot.attr("transform"),d(ot)},moveFn:function(t,e){ot.attr("transform",dt+" translate("+t+","+e+")"),ht=c.align(Y+t/T.w,q,0,1,_.xanchor),pt=c.align(W-e/T.h,V,0,1,_.yanchor);var n=c.getCursor(ht,pt,_.xanchor,_.yanchor);d(ot,n)},doneFn:function(e){d(ot),e&&void 0!==ht&&void 0!==pt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":pt},b().index)}})}return ft}function b(){var n,r,a=e.substr(2);for(n=0;n=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":115,"./flip_scale":34,"./scales":41}],30:[function(t,e,n){"use strict";var r=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},r.colorscale,{}),cauto:a({},r.zauto,{}),cmax:a({},r.zmax,{}),cmin:a({},r.zmin,{}),autocolorscale:a({},r.autocolorscale,{}),reversescale:a({},r.reversescale,{})}}},{"../../lib/extend":112,"./attributes":28,"./scales.js":41}],31:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":41}],32:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,n,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,v=p[d+"min"],m=p[d+"max"],y=p.colorscale,x=r(v)&&r(m)&&v=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],35:[function(t,e,n){"use strict";var r=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=a),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":31,"./is_valid_scale_array":39,"./scales":41}],36:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?a.nestedProperty(t,e).get()||{}:t,i=n.color,l=!1;if(Array.isArray(i))for(var s=0;s4/3-l?i:l}},{}],43:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":115}],44:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},v=1,m=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=r},{"../../lib":115,"../../plotly":137,"../../plots/cartesian/constants":147,"./align":42,"./cursor":43,"./unhover":45}],45:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":111}],46:[function(t,e,n){"use strict";function r(t,e,n,r,a,o,i){if(l.traceIs(n,"symbols")){var c=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(n)?c(t.ms):(o.size||6)/2,t.mrc=e;var r=g.symbolNumber(t.mx||o.symbol)||0,a=r%100;return t.om=r%200>=100,g.symbolFuncs[a](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=r(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,n,r){var a=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(s.fill,r)},g.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},g.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},g.setRect=function(t,e,n,r,a){t.call(g.setPosition,e,n).call(g.setSize,r,a)},g.translatePoint=function(t,e,n,r){var a=t.xp||n.c2p(t.x),o=t.yp||r.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,n,r){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,n,r)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,n){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},g.singleLineStyle=function(t,e,n,r,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=n||o.width||0,l=a||o.dash||"";s.stroke(e,r||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=r||a.dash||"";o.select(this).call(s.stroke,n||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=o.select(this);try{n.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),n.remove()}})};var v=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,n){var a=n.marker,o=a.line,i=g.tryColorscale(a,""),l=g.tryColorscale(a,"line");r(t,e,n,i,l,a,o)},g.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=g.tryColorscale(n,""),a=g.tryColorscale(n,"line");t.each(function(t){g.singlePointStyle(t,o.select(this),e,r,a)})}},g.tryColorscale=function(t,e){var n=e?u.nestedProperty(t,e).get():t,r=n.colorscale,a=n.color;return r&&Array.isArray(a)?c.makeColorScaleFunc(c.extractScale(r,n.cmin,n.cmax)):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var n=o.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,n.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(f.convertToTspans);var d=o.select(this.parentNode),h=n.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,v=x[s]*u,m=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+v+","+m+")"),p>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],o=[];for(n=1;n=A&&(o.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=o.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":105,"../../lib":115,"../../lib/svg_text_utils":127,"../../registry":173,"../../traces/scatter/make_bubble_size_func":222,"../../traces/scatter/subtypes":227,"../color":23,"../colorscale":37,"./symbol_defs":47,d3:7,"fast-isnumeric":10}],47:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:7}],48:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],49:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&["linear","log"].indexOf(n.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);u&&v.style("opacity",0).transition().duration(n.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=r(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");l=!v.size(),l?v=e.append("path").classed("yerror",!0):u&&(v=v.transition().duration(n.duration).ease(n.easing)),v.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var m=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-m)+"v"+2*m+"m0,-"+m+"H"+i.xs,i.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":227,d3:7,"fast-isnumeric":10}],54:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":23,d3:7}],55:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":147}],56:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,l,n,r)}var i=r("source"),s=r("visible",!!i);if(!s)return e;r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var c={_fullLayout:n},u=["x","y"],f=0;f<2;f++)o.coerceRef(t,e,c,u[f],"paper");return e}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("../../plots/array_container_defaults"),l=t("./attributes"),s="images";e.exports=function(t,e){var n={name:s,handleItemDefaults:r};i(t,e,n)}},{"../../lib":115,"../../plots/array_container_defaults":139,"../../plots/cartesian/axes":142,"./attributes":55}],57:[function(t,e,n){"use strict";var r=t("d3"),a=t("../drawing"),o=t("../../plots/cartesian/axes"),i=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var n=r.select(this);if(!this.img||this.img.src!==e.source){n.attr("xmlns",i.svg);var a=new Promise(function(t){function r(){n.remove(),t()}var a=new Image;this.img=a,a.setAttribute("crossOrigin","anonymous"),a.onerror=r,a.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var r=t.toDataURL("image/png");n.attr("xlink:href",r)},n.on("error",r),n.on("load",t),a.src=e.source}.bind(this));t._promises.push(a)}}function n(e){var n=r.select(this),i=o.getFromId(t,e.xref),s=o.getFromId(t,e.yref),c=l._size,u=i?Math.abs(i.l2p(e.sizex)-i.l2p(0)):e.sizex*c.w,f=s?Math.abs(s.l2p(e.sizey)-s.l2p(0)):e.sizey*c.h,d=u*h.x[e.xanchor].offset,p=f*h.y[e.yanchor].offset,g=h.x[e.xanchor].sizing+h.y[e.yanchor].sizing,v=(i?i.r2p(e.x)+i._offset:e.x*c.w+c.l)+d,m=(s?s.r2p(e.y)+s._offset:c.h-e.y*c.h+c.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}n.attr({x:v,y:m,width:u,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=i?i._id:"",x=s?s._id:"",b=y+x;b&&n.call(a.setClipUrl,"clip"+l._uid+b)}for(var l=t._fullLayout,s=[],c=[],u=[],f=0;f=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],60:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":112,"../../plots/font_attributes":162,"../color/attributes":22}],61:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],62:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",v),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":115,"../../plots/layout_attributes":164,"../../registry":173,"./attributes":60,"./helpers":65}],63:[function(t,e,n){"use strict";function r(t,e){function n(n){m.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(m.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,v+=m,a.height=a.height+m,m=0),f.setTranslate(this,o+x,5+o+e.height/2+v),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,m=Math.max(e.height,m)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,j,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:m.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var m=n.legend,_=n.showlegend&&x(t.calcdata,m),k=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=n._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=M.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=L.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var z=S.selectAll("g.traces").data(f.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,S,z),l(t));var P=0,D=n.width,N=0,E=n.height;i(t,S,z),m.height>E?s(t):l(t);var I=n._size,R=I.l+I.w*m.x,F=I.t+I.h*(1-m.y);w.isRightAnchor(m)?R-=m.width:w.isCenterAnchor(m)&&(R-=m.width/2),w.isBottomAnchor(m)?F-=m.height:w.isMiddleAnchor(m)&&(F-=m.height/2);var j=m.width,B=I.w;j>B?(R=I.l,j=B):(R+j>D&&(R=D-j),RH?(F=I.t,q=H):(F+q>E&&(F=E-q),Fn[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var v=s.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(l?r:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=v.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":115,"../../registry":173,"../../traces/pie/style_one":205,"../../traces/scatter/subtypes":227,"../color":23,"../drawing":46,d3:7}],68:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(v,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var m=a(l),y=[];return((c||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||m||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(v,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var v=u("bgcolor");u("activecolor",i.contrast(v,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":115,"../color":23,"./attributes":72,"./button_attributes":73,"./constants":74}],76:[function(t,e,n){"use strict";function r(t){for(var e=m.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},a=S.line.width?S.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",S.opacity).call(_.stroke,a).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);z&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&f(t,o,S,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof n&&n?s[n]=r:x.isPlainObject(n)&&(s=n);var c=Object.keys(s);for(o=0;oZ&&r>G&&!t.shiftKey?k.getCursor(a/n,1-o/r):"move";M(e,i),U=i.split("-")[0]}function o(e){j=b.getFromId(t,n.xref),B=b.getFromId(t,n.yref),q=T.getDataToPixel(t,j),H=T.getDataToPixel(t,B,!0),V=T.getPixelToData(t,j),X=T.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(R=n.path,F=o+".path"):(u=q(n.x0),f=H(n.y0),d=q(n.x1),h=H(n.y1),g=o+".x0",m=o+".y0",x=o+".x1",_=o+".y1"),uG&&(c[S]=n[D]=X(l),c[z]=n[N]=X(s)),f-u>Z&&(c[O]=n[E]=V(u),c[P]=n[I]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,m,x,_,w,A,L,C,S,z,O,P,D,N,E,I,R,F,j,B,q,H,V,X,U,Z=10,G=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();k.init(Y)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,v=(d+h)/2,m=Math.abs(p-u),y=Math.abs(v-d),x="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function v(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var m=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults");e.exports={draw:r,drawOne:a}},{"../../lib":115,"../../lib/setcursor":125,"../../plotly":137,"../../plots/cartesian/axes":142,"../color":23,"../dragelement":44,"../drawing":46,"./constants":86,"./defaults":87,"./helpers":89,"./shape_defaults":91,"fast-isnumeric":10}],89:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],90:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":84,"./calc_autorange":85,"./defaults":87,"./draw":88}],91:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],v={_fullLayout:n},m=a.coerceRef(t,e,v,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==m?(y=a.getFromId(v,m),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=r.identity;var k=g+"0",M=g+"1",A=t[k],T=t[M];t[k]=x(t[k],!0),t[M]=x(t[M],!0),a.coercePosition(e,v,c,m,k,_),a.coercePosition(e,v,c,m,M,w),e[k]=b(e[k]),e[M]=b(e[M]),t[k]=A,t[M]=T}}return"path"===d?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":115,"../../plots/cartesian/axes":142,"./attributes":84,"./helpers":89}],92:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":112,"../../plots/animation_attributes":138,"../../plots/font_attributes":162,"../../plots/pad_attributes":165,"./constants":93}],93:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],94:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+S.railTouchRectClass).data([0]);r.enter().append("rect").classed(S.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,S.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0), +M.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+S.railRectClass).data([0]);n.enter().append("rect").classed(S.railRectClass,!0);var r=e.inputAreaLength-2*S.railInset;n.attr({width:r,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(n,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+S.groupClassName).data(n,a);s.enter().append("g").classed(S.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,S=O,k._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,v=n.propName,m=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(S).attr("class",e),z.attr({"data-unformatted":S}).call(f);var O="Click to enter "+y+" title";t._context.editable?(S||p(),z.call(u.makeEditable).on("edit",function(e){void 0!==m?o.restyle(t,v,e,m):o.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",C)}},{"../../lib":115,"../../lib/svg_text_utils":127,"../../plotly":137,"../../plots/plots":166,"../color":23,"../drawing":46,d3:7,"fast-isnumeric":10}],98:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":112,"../../plots/font_attributes":162,"../../plots/pad_attributes":165,"../color/attributes":22}],99:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],100:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],105:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],106:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":21,"./components/images":58,"./components/legend":66,"./components/rangeselector":78,"./components/rangeslider":83,"./components/shapes":90,"./components/sliders":96,"./components/updatemenus":102,"./fonts/mathjax_config":107,"./lib/queue":123,"./plot_api/plot_schema":131,"./plot_api/register":132,"./plot_api/set_plot_config":133,"./plot_api/to_image":135,"./plot_api/validate":136,"./plotly":137,"./snapshot":178,"./snapshot/download":175,"./traces/scatter":217,d3:7,"es6-promise":8}],107:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],108:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":103,"fast-isnumeric":10}],109:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(o(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,r,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var v=(new Date).getFullYear();e=((Number(c[0])-v+70)%100+200)%100+v-70}if(!o(e))return s;var m=new Date(0,0,1);if(m.setFullYear(u?e:-e),c.length>1){if(r=Number(c[1])-1,c[1].length>2||!(r>=0&&r<=11))return s;if(m.setMonth(r),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(m.setDate(a),m.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(m.setHours(i),m.getHours()!==i)return s;if(c.length>1)return a=m.getTime(),r=Number(c[1]),2===c[1].length&&r>=0&&r<=59?(a+=f*r,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return m.getTime()},h=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==s};var g=90*c,v=3*u,m=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var n=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(n),i=en?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"./clean_number":108,"./coerce":109,"./dates":110,"./extend":112,"./filter_unique":113,"./filter_visible":114,"./is_array":116,"./is_plain_object":117,"./loggers":118,"./matrix":119,"./nested_property":120,"./notifier":121,"./search":124,"./stats":126,d3:7}],116:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],117:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],118:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],i=!1,d(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");lo||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],s=t[1];if(no||sl)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],v=r[0][1],m=0;for(c=1;cMath.max(u,g)||s>Math.max(f,v)))if(su||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":119}],123:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;f90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":10}],127:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,v.indexOf(u.protocol)===-1?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var v=d.getPlotDiv(l.node());(v&&v._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],v=parseInt(l.style("font-size"),10)||r(l,"height"),m=-v/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,m-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:m-d/2}):"a"===p[0]?s.attr({x:0,y:m}):s.attr({x:g,y:+l.attr("y")+m-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(m," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":104,"../constants/xmlns_namespaces":105,"../lib":115,d3:7}],128:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function a(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var a=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=u.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&l(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sO.range[0]?[1,2]:[2,1]);else{var P=O.range[0],D=O.range[1];"log"===b?(P<=0&&D<=0&&n(L+".autorange",!0),P<=0?P=D/1e6:D<=0&&(D=P/1e6),n(L+".range[0]",Math.log(P)/Math.LN10),n(L+".range[1]",Math.log(D)/Math.LN10)):(n(L+".range[0]",Math.pow(10,P)),n(L+".range[1]",Math.pow(10,D)))}else n(L+".autorange",!0)}if("reverse"===A)C.range?C.range.reverse():(n(L+".autorange",!0),C.range=[1,0]),S.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var N=m.parts[1],E=m.parts[0],I=o[E]||[],R=I[N]||{};2===m.parts.length&&(null===b&&(e[v]="remove"),"add"===e[v]||x.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?N===-1?(g[E]=I,delete g[v]):g[v]=R:x.log("???",e)),!r(R,"x")&&!r(R,"y")||x.containsAny(v,["color","opacity","align","dash"])||(h.docalc=!0);var F=w.getComponentMethod(E,"drawOne");F(t,N,m.parts.slice(2).join("."),e[v]),delete e[v]}else if(k.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1])z.manageArrayContainers(m,b,g),h.doplot=!0;else{var j=String(m.parts[1]||"");0===m.parts[0].indexOf("scene")?h.doplot=!0:0===m.parts[0].indexOf("geo")?h.doplot=!0:0===m.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===v?h.doplot=!0:!i._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?h.docalc=!0:m.parts[0].indexOf("legend")!==-1?h.dolegend=!0:v.indexOf("title")!==-1?h.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:m.parts.length>1&&x.containsAny(j,["tick","exponent","grid","zeroline"])?h.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:m.parts.length>1&&j.indexOf("line")!==-1?h.dolayoutstyle=!0:m.parts.length>1&&"mirror"===j?h.doticks=h.dolayoutstyle=!0:"margin.pad"===v?h.doticks=h.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(h.doplot=!0):h.doplot=!0,m.set(b)}}}var B=t._fullLayout.width,q=t._fullLayout.height;k.supplyDefaults(t),t.layout.autosize&&k.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==q;return H&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=v.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];v.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(C.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var o=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=o.append("g").classed("imagelayer",!0),n._shapeUpperLayer=o.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),k=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),C=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),z=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,n,r){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=P._basePlotModules,n=0;n=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=z.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),n=k.supplyAnimationDefaults(n);var l=n.transition,s=n.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){if(0!==i._frameQueue.length){for(;i._frameQueue.length;){var e=i._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var l=0;li._timeToNext&&h()};e()}function g(t){return Array.isArray(l)?y>=l.length?t.transitionOpts=l[y]:t.transitionOpts=l[0]:t.transitionOpts=l,y++,t}var v,m,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&x.isPlainObject(e);if(M)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(v=0;v0&&LL)&&C.push(m);b=C}}b.length>0?f(b):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,n){if(t=z.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,a,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(r=e.length-1;r>=0;r--)u.push({frame:k.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:c+r});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(a=u[r].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=k.modifyFrames,s=k.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),k.modifyFrames(t,o)},y.purge=function(t){t=z.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return k.cleanPlot([],{},n,e),k.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":46,"../components/errorbars":52,"../constants/xmlns_namespaces":105,"../lib":115,"../lib/events":111,"../lib/queue":123,"../lib/svg_text_utils":127,"../plotly":137,"../plots/cartesian/graph_interact":149,"../plots/plots":166,"../plots/polar":169,"../registry":173,"./helpers":128,"./subroutines":134,d3:7,"fast-isnumeric":10}],130:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],131:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:y},n={}):(e=d.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,_(r,p),_(r,e.attributes),n.attributes&&_(r,n.attributes),r.type=t;var a={meta:e.meta||{},attributes:i(r)};if(e.layoutAttributes){var o={};_(o,e.layoutAttributes),a.layoutAttributes=i(o)}return a}function a(){var t={};return _(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var n=d.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)u(t,n,"xaxis"),u(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;u(t,n,r)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.layoutAttributes&&(Array.isArray(n.layoutNodes)?n.layoutNodes.forEach(function(e){f(t,n,e+n.name)}):f(t,n,n.name))}),{layoutAttributes:i(t)}}function o(t){var e=d.transformsRegistry[t];return{attributes:i(e.attributes)}}function i(t){return l(t),s(t),t}function l(t){function e(t){return{valType:"string"}}function r(t,r,a){n.isValObject(t)?"data_array"===t.valType?(t.role="data",a[r+"src"]=e(r)):t.arrayOk===!0&&(a[r+"src"]=e(r)):h.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function s(t){function e(t,e,n){if(t){var r=t[k];r&&(delete t[k],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function c(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function u(t,e,n){var r=h.nestedProperty(t,n),a=_({},e.layoutAttributes);a[w]=!0,r.set(a)}function f(t,e,n){var r=h.nestedProperty(t,n),a=_(r.get()||{},e.layoutAttributes);r.set(a)}var d=t("../registry"),h=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),m=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=h.extendFlat,_=h.extendDeep,w="_isSubplotObj",k="_isLinkedToArray",M="_deprecated",A=[w,k,M];n.IS_SUBPLOT_OBJ=w,n.IS_LINKED_TO_ARRAY=k,n.DEPRECATED=M,n.UNDERSCORE_ATTRS=A,n.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:h.valObjects,metaKeys:A.concat.role},traces:t,layout:a(),transforms:e,frames:i(v),animation:i(m)}},n.crawl=function(t,e,r){var a=r||0;Object.keys(t).forEach(function(r){var o=t[r];A.indexOf(r)===-1&&(e(o,r,t,a),n.isValObject(o)||h.isPlainObject(o)&&n.crawl(o,e,a+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,i,l){o=o.slice(0,l).concat([n]);var s="data_array"===e.valType||e.arrayOk===!0;if(s){var c=r(o),u=h.nestedProperty(t,c).get();Array.isArray(u)&&a.push(c)}}function r(t){return t.join(".")}var a=[],o=[];if(n.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":115,"../plotly":137,"../snapshot/cloneplot":174,"../snapshot/helpers":177,"../snapshot/svgtoimg":179,"../snapshot/tosvg":181,"fast-isnumeric":10}],136:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,v=n.length,m=0;mu&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=z&&a<=10||e>=15*z)t._tickround="d";else if(e>=P&&a<=16||e>=O)t._tickround="M";else if(e>=D&&a<=19||e>=P)t._tickround="S";else{var o=_.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var n=t.match(Y),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);n&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(r&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(n||(a="
"+H(u)),o=X(u)):(n||(a="
"+U(u)),o=Z(u),"M"!==s?(o+=G(u),"S"!==s&&(o+=d(y.round(m(l/1e3,1),4),t,"none",n).substr(1))):"d"===c&&(o=X(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&m(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,m(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=t<0,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var g=r-1,v=r+1;n="tozero"===t.rangemode?r<0?[g,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,v)]:[g,v]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n.map(t.l2r||Number)},N.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=N.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},N.saveRangeInitial=function(t,e){for(var n=N.list(t,"",!0),r=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,v=e.length,m=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=v-1;o>5;o--)a(o)}},N.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},N.autoTicks(f,l);var d,h=N.tickIncrement(N.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=N.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=N.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fC?(e/=C,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,I)):r>S?(e/=S,t.dtick="M"+a(e,1,R)):r>z?(t.dtick=a(e,z,j),t.tick0="2000-01-02"):r>O?t.dtick=a(e,O,R):r>P?t.dtick=a(e,P,F):r>D?t.dtick=a(e,D,F):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,I)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},N.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?q:B,s=t+.01*r,c=_.roundUp(m(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]o:f1&&e2*r}function o(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("../../constants/numerical").BADNUM;e.exports=function(t){return a(t)?"date":o(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":103,"../../lib":115,"fast-isnumeric":10}],144:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var l=i(e,n,r);if(l){if("histogram"===l.type&&r==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,r)){for(var s,u=a(l),f=[],d=0;d0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],147:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],148:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?r:"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,n,l,_,w,k,M){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+vt+")").attr("d",ct+"Z"),ht=pt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+vt+")").attr("d","M0,0Z"),C()}function C(){pt.selectAll(".select-outline").remove()}function S(e,n){if(t._transitioningWithDuration)return!1;var r=Math.max(0,Math.min(V,e+ot)),a=Math.max(0,Math.min(X,n+it)),o=Math.abs(r-ot),i=Math.abs(a-it),l=Math.floor(Math.min(i,o,Z)/2);lt.l=Math.min(ot,r),lt.r=Math.max(ot,r),lt.t=Math.min(it,a),lt.b=Math.max(it,a),!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function z(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),b=!1)))}function P(e,n){var a=1===(k+M).length;if(e)R();else if(2!==n||a){if(1===n&&a){var o=k?H[0]:q[0],i="s"===k||"w"===M?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",f="middle";if(o.fixedrange)return;k?(f="n"===k?"top":"bottom","right"===o.side&&(u="right")):"e"===M&&(u="right"),nt.call(d.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var n=o.d2r(e);void 0!==n&&c.relayout(t,l,n)})}}else I()}function D(e){function n(t,e,n){function r(e){return t.l2r(o+(e-o)*n)}if(!t.fixedrange){var a=t.range.map(t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(r)}}if(t._context.scrollZoom||j._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(T(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(yt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=mt[0]+mt[2]*s,u=(l.bottom-e.clientY)/l.height,d=mt[1]+mt[3]*(1-u);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,n){for(var r,o,i=1-e,l=0;l0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rY.width||G<0||G>Y.height)return _.unhoverRaw(t,e)}else Z="xpx"in e?e.xpx:M[0]._length/2,G="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?r(o,e.xval):a(M,Z),P="yval"in e?r(o,e.yval):a(A,G),!g(O[0])||!g(P[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(N=0;N1||I.hoverinfo.indexOf("name")!==-1?I.name:void 0,index:!1,distance:Math.min(W,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[R]&&(H.subplot=i[R]._subplot),V=X.length,"array"===j){var Q=e[N];"pointNumber"in Q?(H.index=Q.pointNumber,j="closest"):(j="","xval"in Q&&(B=Q.xval,j="x"),"yval"in Q&&(q=Q.yval,j=j?"closest":"y"))}else B=O[F],q=P[F];if(I._module&&I._module.hoverPoints){var $=I._module.hoverPoints(H,B,q,j);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&X.push(s(J,z))}else v.log("Unrecognized trace type in hover:",I);"closest"===z&&X.length>V&&(X.splice(0,V),W=X[0].distance)}if(0===X.length)return _.unhoverRaw(t,e);var tt="y"===z&&U.length>1;X.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),nt={hovermode:z,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},rt=c(X,nt);u(X,tt?"xa":"ya"),f(rt,tt);var at=t._hoverdata,ot=[];for(D=0;D128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),v=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),v=d.node().getBoundingClientRect().width+2*D):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var m,k,T=f.node().getBoundingClientRect(),C=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),N=T.width+P+D+v;t.ty0=_-T.top,t.bx=T.width+2*D,t.by=T.height+2*D,t.anchor="start",t.txwidth=T.width,t.tx2width=v,t.offset=0,o?(t.pos=C,m=S+O/2+N<=M,k=S-O/2-N>=0,"top"!==t.idealAlign&&m||!k?m?(S+=O/2,t.anchor="start"):t.anchor="middle":(S-=O/2,t.anchor="end")):(t.pos=S,m=C+z/2+N<=w,k=C-z/2-N>=0,"left"!==t.idealAlign&&m||!k?m?(C+=z/2,t.anchor="start"):t.anchor="middle":(C-=z/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+C+","+S+")"+(o?"rotate("+L+")":""))}),S}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?S:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var v=f[i];for(l=v.length-1;l>=0;l--){var m=v[l],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(P+D),l=i+o*(t.txwidth+D),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-O,s=t.offset*z),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*P+s)+","+(P+c)+"v"+(t.by/2-P)+"h"+r*t.bx+"v-"+t.by+"H"+(r*P+s)+"V"+(c-P)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+D).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*D+s,c+t.ty0-t.by/2+D),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,n){function r(n,r){return v.coerce(t,e,A,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=T.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},T.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+k.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},T.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},T.getClosest=function(t,e,n){ +if(n.index!==!1)n.index>=0&&n.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":115,"fast-isnumeric":10}],155:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,v=a.element.getBoundingClientRect(),m=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-v.left,b=n-v.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),C=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",k+"Z");var z,O,P,D,N,E=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,F=[];for(z=0;z0)return Math.log(e)/Math.LN10;if(e<=0&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*f*Math.abs(r-a))}return s}function n(t){return Math.pow(10,t)}function i(t){return a(t)?(t=Number(t),t<-l||t>l?s:a(t)?Number(t):s):s}var f=10;t.c2l="log"===t.type?e:i,t.l2c="log"===t.type?n:i,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var n,r,i=t[e],s=(t._id||"x").charAt(0);if(r="date"===t.type?c.DFLTRANGEDATE:"y"===s?c.DFLTRANGEY:c.DFLTRANGEX,r=r.slice(),!i||2!==i.length)return void(t[e]=r);for("date"===t.type&&(i[0]=o.cleanDate(i[0]),i[1]=o.cleanDate(i[1])),n=0;n<2;n++)if("date"===t.type){if(!o.isDateTime(i[n])){t[e]=r;break}if(i[n]o.MAX_MS&&(i[n]=o.MAX_MS),t.r2l(i[0])===t.r2l(i[1])){var u=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(u-1e3),i[1]=t.l2r(u+1e3);break}}else{if(!a(i[n])){if(!a(i[1-n])){t[e]=r;break}i[n]=i[1-n]*(n?10:.1)}if(i[n]<-l?i[n]=-l:i[n]>l&&(i[n]=l),i[0]===i[1]){var f=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=f,i[1]+=f}}},t.fraction2r=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return t.l2r(n+e*(r-n))},t.r2fraction=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return(t.r2l(e)-n)/(r-n)},t.setScale=function(e){var n=t._gd._fullLayout._size,r=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var a=u.getFromId(t._gd,t.overlaying);t.domain=a.domain}var i=e&&t._r?"_r":"range";t.cleanRange(i);var l=t.r2l(t[i][0]),s=t.r2l(t[i][1]);if("y"===r?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):s},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,n){return t.l2p(t.r2l(e,n))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=i,t.d2c=o.cleanNumber,"log"===t.type?(t.d2l=function(e,n){return t.c2l(t.d2c(e),n)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=o.cleanNumber,t.d2r=o.cleanNumber,t.r2d=i),t.r2l=i,t.l2r=i):"date"===t.type?(t.c2d=o.ms2DateTime,t.d2c=function(t){var e=o.dateTime2ms(t);if(e===s){if(!a(t))return s;e=Number(t)}return o.constrain(e,o.MIN_MS,o.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=o.identity,t.r2d=o.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var n=t._categories.indexOf(e);return n===-1?s:n},t.d2l=t.d2c,t.r2l=i,t.l2r=i,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;o0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var f=u.charAt(0),d=u.substr(1);d=r(d)?Number(d):0,(d<=0||!("date"===i&&"M"===f&&d===Math.round(d)||"log"===i&&"L"===f||"log"===i&&"D"===f&&(1===d||2===d)))&&(e.dtick=c)}var h="date"===i?"2000-01-01":0,p=n("tick0",h);"date"===i?e.tick0=a.cleanDate(p,h):r(p)&&"D1"!==u&&"D2"!==u?e.tick0=Number(p):e.tick0=h}else{var g=n("tickvals");void 0===g?e.tickmode="auto":n("ticktext")}}},{"../../constants/numerical":103,"../../lib":115,"fast-isnumeric":10}],160:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../lib"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,n,c){function u(t){var e,n,r,a,o,i={};for(e in t)if(n=e.split("."),r=n[0].match(s)){var l=r[1],c=l+"axis";if(a=y[c],o={},Array.isArray(t[e])?o.to=t[e].slice(0):Array.isArray(t[e].range)&&(o.to=t[e].range.slice(0)),!o.to)continue;o.axisName=c,o.length=a._length,x.push(l),i[l]=o}return i}function f(t,e,n){var r,a,o,i=t._plots,l=[];for(r in i){var s=i[r];if(l.indexOf(s)===-1){var c=s.xaxis._id,u=s.yaxis._id,f=s.xaxis.range,d=s.yaxis.range;s.xaxis._r=s.xaxis.range.slice(),s.yaxis._r=s.yaxis.range.slice(),a=n[c]?n[c].to:f,o=n[u]?n[u].to:d,f[0]===a[0]&&f[1]===a[1]&&d[0]===o[0]&&d[1]===o[1]||e.indexOf(c)===-1&&e.indexOf(u)===-1||l.push(s)}}return l}function d(e,n){function r(e,n){for(a=0;an.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var k;c&&(k=c());var M,A,T,L=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),M=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":115,"../../plotly":137,"../../registry":173,"./axes":142,d3:7}],161:[function(t,e,n){"use strict";function r(t,e,n){var r,a,o,i=!1;if("data"===e.type)r=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;r=t._fullLayout}return a=c.nestedProperty(r,e.prop).get(),o=n[e.type]=n[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var n=[],r=e[0],a={};if("string"==typeof r)a[r]=e[1];else{if(!c.isPlainObject(r))return n;a=r}return l(a,function(t,e,r){n.push({type:"layout",prop:t,value:r})},"",0),n}function i(t,e){var n,r,a,o,i=[];if(r=e[0],a=e[1],n=e[2],o={},"string"==typeof r)o[r]=a;else{if(!c.isPlainObject(r))return i;o=r,void 0===n&&(n=a)}return void 0===n&&(n=null),l(o,function(e,r,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);n&&(l=Math.min(l,n.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,r+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");n.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=n.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){r(t,s,i.cache),i.check=function(){if(l){var e=r(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),n._initialAutoSizeIsDone){var c=n.width,f=n.height;p.supplyLayoutGlobalDefaults(o,r),o.width||(r.width=c),o.height||(r.height=f)}else{p.supplyLayoutGlobalDefaults(o,r);var d=!o.width||!o.height,h=r.autosize,g=t._context&&t._context.autosizable,v=d&&(h||g);v?p.plotAutoSize(t,o,r):d&&p.sanitizeMargins(t),!h&&d&&(o.width=r.width,o.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=s.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,r),r._has=p._hasPlotType.bind(r);var m=r._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,v=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(g*(v.width-f)),a=Math.round(g*(v.height-h))}else{var m=s?window.getComputedStyle(t):{};r=parseFloat(m.width)||n.width,a=parseFloat(m.height)||n.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;r1,_=!e.height&&Math.abs(n.height-a)>1;(_||b)&&(b&&(n.width=r),_&&(n.height=a)),t._initialAutoSize||(t._initialAutoSize={width:r,height:a}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n,r){var a,o;u.Axes.supplyLayoutDefaults(t,e,n);var i=e._basePlotModules;for(a=0;a.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var v=s[t].t.val,m=s[t].t.size;if(v>d){var y=(h*v+(m-e.height)*d)/(v-d),x=(m*(1-d)+(h-e.height)*(1-v))/(v-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!t._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):d.isJSDate(t)?d.ms2DateTime(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var n,r,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(n=0;n0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(n)for(l=0;l=0,S=C?f.angularAxis.domain:r.extent(M),z=Math.abs(M[1]-M[0]);T&&!A&&(z=0);var O=S.slice();L&&A&&(O[1]+=z);var P=f.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),f.angularAxis.ticksStep&&(P=(O[1]-O[0])/P);var D=f.angularAxis.ticksStep||(O[1]-O[0])/(P*(f.minorTicks+1));k&&(D=Math.max(Math.round(D),1)),O[2]||(O[2]=D);var N=r.range.apply(this,O);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=r.scale.linear().domain(O.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?z:0,e=r.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var E="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(E,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=r.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,j=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},q={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=i.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});i.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},i.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],a.range([0,x]),u.layout.radialAxis.domain=a.domain(),F.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),j.attr("transform","translate("+_+")").style({cursor:"crosshair"});var X=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(X[0]=Math.max(0,X[0]),X[1]=Math.max(0,X[1]),e.select(".outer-group").attr("transform","translate("+X+")"),f.title){var U=e.select("g.title-group text").style(q).text(f.title),Z=U.node().getBBox();U.attr({x:_[0]-Z.width/2,y:_[1]-x-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=G.selectAll("circle.grid-circle").data(a.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(B),Y.attr("r",a),Y.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(B);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=r.svg.axis().scale(a).ticks(5).tickSize(5);G.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(B),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(q).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,q["font-size"]]+")":"translate("+[0,q["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),J=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),J.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(q);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?n<270&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(n<=180&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(q);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=r.max(j.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=a,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=r.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return o(i[n].defaultConfig(),t)});i[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=i.tooltipPanel().config({container:ct,fontSize:8})(),ft=i.tooltipPanel().config({container:ct,fontSize:8})(),dt=i.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});j.on("mousemove.angular-guide",function(t,e){var n=i.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=i.util.convertToCartesian(x+12,n+180);ut.text(i.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});j.on("mousemove.radial-guide",function(t,e){var n=i.util.getMousePos(W).radius;pt.attr({r:n}).style({opacity:.5}),lt=a.invert(i.util.getMousePos(W).radius);var r=i.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(i.util.round(lt)).move([r[0]+_[0],r[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var a=r.select(this),o=a.style("fill"),l="black",s=a.style("opacity")||1;if(a.attr({"data-opacity":s}),"none"!=o){a.attr({"data-fill":o}),l=r.hsl(o).darker().toString(),a.style({fill:l,opacity:1});var c={t:i.util.round(t[0]),r:i.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-X[0]-d.left,f.top+f.height/2-X[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else o=a.style("stroke"),a.attr({"data-stroke":o}),l=r.hsl(o).darker().toString(),a.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==r.event.which&&void(r.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=r.select(this),a=n.attr("data-fill");a?n.style({fill:a,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,a,l,s={data:[],layout:{}},c={},u={},f=r.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=i.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),o(s.data[e],i.Axis.defaultConfig().data[0]),o(s.data[e],t)}),o(s.layout,i.Axis.defaultConfig().layout),o(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},r.rebind(d,f,"on"),d},i.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:r.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},i.util={},i.DATAEXTENT="dataExtent",i.AREA="AreaChart",i.LINE="LinePlot",i.DOT="DotPlot",i.BAR="BarChart",i.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},i.util._extend=function(t,e){for(var n in t)e[n]=t[n]},i.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},i.util.dataFromEquation2=function(t,e){var n=e||6,a=r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return a},i.util.dataFromEquation=function(t,e,n){var a=e||6,o=[],i=[];r.range(0,360+a,a).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},i.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return r.range(e).map(function(t,e){return n[e]||n[0]})},i.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=i.util.ensureArray(t[e],n)}),t},i.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},i.util.validateKeys=function(t,e){ +"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},i.util.sumArrays=function(t,e){return r.zip(t,e).map(function(t,e){return r.sum(t)})},i.util.arrayLast=function(t){return t[t.length-1]},i.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return n===-2},i.util.flattenArray=function(t){for(var e=[];!i.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},i.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},i.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},i.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},i.util.getMousePos=function(t){var e=r.mouse(t.node()),n=e[0],a=e[1],o={};return o.x=n,o.y=a,o.pos=e,o.angle=180*(Math.atan2(a,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+a*a),o},i.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;a0)){var l=r.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(n,a,o)},"fill-opacity":0,stroke:function(t,e){return v.stroke(n,a,o)},"stroke-width":function(t,e){return v["stroke-width"](n,a,o)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](n,a,o)},opacity:function(t,e){return v.opacity(n,a,o)},display:function(t,e){return v.display(n,a,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=r.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,a){r.select(this).attr({class:"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var v={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},m=r.select(this).selectAll("g.layer").data(s);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,n=[i.PolyChart.defaultConfig()],a=r.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),o(n[e],i.PolyChart.defaultConfig()),o(n[e],t)}),this):n},t.getColorScale=function(){return e},r.rebind(t,a,"on"),t},i.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}};return t},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},i.Legend=function(){function t(){var n=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=o({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),i=r.merge(a);i=i.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(i=i.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=r.select(l));var s=i.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof i[0]:n.isContinuous,f=u?n.height:c*i.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=r.range(i.length),v=r.scale[u?"linear":"ordinal"]().domain(g).range(s),m=r.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":r.svg.symbolTypes.indexOf(t)!=-1?r.svg.symbol().type(t).size(n)():r.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(i);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,m(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return v(e)}}),b.exit().remove()}var _=r.svg.axis().scale(m).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return i[e].name}),t}var e=i.Legend.defaultConfig(),n=r.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},r.rebind(t,n,"on"),t},i.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},i.tooltipPanel=function(){var t,e,n,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=10,c=function(){t=a.container.selectAll("g."+l).data([0]);var r=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=r.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=r.append("text").attr({dx:a.padding+s,dy:.3*+a.fontSize}),c};return c.text=function(o){var i=r.hsl(a.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var d=a.padding,h=e.node().getBBox(),p={fill:a.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,v=h.height+2*d;return n.attr({d:"M"+[[s,-v/2],[s,-v/4],[a.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-v/2+2*d]+")"}),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 o(a,t),c},c},i.tooltipPanel.uid=1,i.adapter={},i.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=o({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var r=a.indexOf(t.geometry);r!=-1&&(n.data[e].groupId=r)})}if(t.layout){var l=o({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};r.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../lib":115,d3:7}],171:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../lib"),o=t("../../components/color"),i=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){function e(e,a){return a&&(f=a),r.select(r.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?s(n,e):e,o||(o=i.Axis()),u=i.adapter.plotly().convert(n),o.config(u).render(f),t.data=n.data,t.layout=n.layout,c.fillLayout(t),n}var n,a,o,u,f,d=new l;return e.isPolar=!0,e.svg=function(){return o.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return i.adapter.plotly().convert(o.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:o.angularScale(),r:o.radialScale()}},e.setUndoPoint=function(){var t=this,e=i.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,a),a=i.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},c.fillLayout=function(t){var e=r.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:o.background,_container:e,_paperdiv:n,_paper:a};t._fullLayout=s(i,t.layout)}},{"../../components/color":23,"../../lib":115,"./micropolar":170,"./undo_manager":172,d3:7}],172:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return r!==-1},hasRedo:function(){return r-1}var o=t("../lib"),i=t("../plots/plots"),l=o.extendFlat,s=o.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,o=t.data,c=t.layout,u=s([],o),f=s({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;n=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var v,m,y,x,b=e.p+(h?d[n]:d),_=b+(g?p[n]:p),w=e.b,k=w+e.s;if("h"===l.orientation?(y=u.c2p(b,!0),x=u.c2p(_,!0),v=c.c2p(w,!0),m=c.c2p(k,!0)):(v=c.c2p(b,!0),m=c.c2p(_,!0),y=u.c2p(w,!0),x=u.c2p(k,!0)),!(a(v)&&a(m)&&a(y)&&a(x)&&v!==m&&y!==x))return void r.select(this).remove();var M=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,A=r.round(M/2%1,2);if(!t._context.staticPlot){var T=i.opacity(e.mc||l.marker.color),L=T<1||M>.01?o:s;v=L(v,m),m=L(m,v),y=L(y,x),x=L(x,y)}r.select(this).attr("d","M"+v+","+y+"V"+x+"H"+m+"V"+y+"Z")})}),d.call(l.plot,e)}},{"../../components/color":23,"../../components/errorbars":52,"../../lib":115,"./arrays_to_calcdata":182,d3:7,"fast-isnumeric":10}],191:[function(t,e,n){"use strict";function r(t,e,n,r){if(r.length){var l,s,c,u,f,d=t._fullLayout.barmode,h="overlay"===d,p="group"===d;if(h)a(t,e,n,r);else if(p){for(l=[], +s=[],c=0;cs+i&&(c=!0,s=y)),m(e.c2l(g))&&(gs+i&&(c=!0,s=g))}}x.expand(e,[l,s],{tozero:!0,padded:c})}function v(t){return t._id.charAt(0)}var m=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var n,a=e.xaxis,o=e.yaxis,i=t._fullData,l=t.calcdata,s=[],c=[];for(n=0;n1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&r.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,n=e.marker,i=n.line,l=o.tryColorscale(n,""),s=o.tryColorscale(n,"line");r.select(this).selectAll("path").each(function(t){var e,o,c=(t.mlw+1||i.width+1)-1,u=r.select(this);e="mc"in t?t.mcc=l(t.mc):Array.isArray(n.color)?a.defaultLine:n.color,u.style("stroke-width",c+"px").call(a.fill,e),c&&(o="mlc"in t?t.mlcc=s(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":23,"../../components/drawing":46,"../../components/errorbars":52,d3:7}],194:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,n,i,l){n("marker.color",i),a(t,"marker")&&o(t,e,l,n,{prefix:"marker.",cLetter:"c"}),n("marker.line.color",r.defaultLine),a(t,"marker.line")&&o(t,e,l,n,{prefix:"marker.line.",cLetter:"c"}),n("marker.line.width")}},{"../../components/color":23,"../../components/colorscale/defaults":32,"../../components/colorscale/has_colorscale":36}],195:[function(t,e,n){"use strict";var r=t("../../components/color/attributes"),a=t("../../plots/font_attributes"),o=t("../../plots/attributes"),i=t("../../lib/extend").extendFlat;e.exports={labels:{valType:"data_array"},label0:{valType:"number",dflt:0},dlabel:{valType:"number",dflt:1},values:{valType:"data_array"},marker:{colors:{valType:"data_array"},line:{color:{valType:"color",dflt:r.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},scalegroup:{valType:"string",dflt:""},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"]},hoverinfo:i({},o.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0},textfont:i({},a,{}),insidetextfont:i({},a,{}),outsidetextfont:i({},a,{}),domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},hole:{valType:"number",min:0,max:1,dflt:0},sort:{valType:"boolean",dflt:!0},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise"},rotation:{valType:"number",min:-360,max:360,dflt:0},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0}}},{"../../components/color/attributes":22,"../../lib/extend":112,"../../plots/attributes":140,"../../plots/font_attributes":162}],196:[function(t,e,n){"use strict";function r(t,e){for(var n=[],r=0;r")}return g};var s},{"../../components/color":23,"./helpers":199,"fast-isnumeric":10,tinycolor2:13}],198:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(n,o){return r.coerce(t,e,a,n,o)}var l=r.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,v=g||"inside"===p,m=g||"outside"===p;if(v||m){var y=l(i,"textfont",o.font);v&&l(i,"insidetextfont",y),m&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":115,"./attributes":195}],199:[function(t,e,n){"use strict";var r=t("../../lib");n.formatPiePercent=function(t,e){var n=(100*t).toPrecision(3);return n.lastIndexOf(".")!==-1&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)+"%"},n.formatPieValue=function(t,e){var n=t.toPrecision(10);return n.lastIndexOf(".")!==-1&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)}},{"../../lib":115}],200:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.layoutAttributes=t("./layout_attributes"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.styleOne=t("./style_one"),r.moduleType="trace",r.name="pie",r.basePlotModule=t("./base_plot"),r.categories=["pie","showLegend"],r.meta={},e.exports=r},{"./attributes":195,"./base_plot":196,"./calc":197,"./defaults":198,"./layout_attributes":201,"./layout_defaults":202,"./plot":203,"./style":204,"./style_one":205}],201:[function(t,e,n){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],202:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function n(n,o){return r.coerce(t,e,a,n,o)}n("hiddenlabels")}},{"../../lib":115,"./layout_attributes":201}],203:[function(t,e,n){"use strict";function r(t,e,n){var r=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/n.vTotal,.5),l=1-n.trace.hole,s=a(e,n),c={scale:s*n.r*2/r,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=n.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/n.r)-f*o/n.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=n.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),v={scale:2*g/t.width,rCenter:Math.cos(g/n.r)-g/o/n.r,rotate:(180/Math.PI*e.midangle+810)%180-90},m=v.scale>d.scale?v:d;return c.scale<1&&m.scale>c.scale?m:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var n=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(n)),(1-e.trace.hole)/2)}function o(t,e){var n=e.pxmid[0],r=e.pxmid[1],a=t.width/2,o=t.height/2;return n<0&&(a*=-1),r<0&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+n*n/(r*r)),outside:!0}}function i(t,e){function n(t,e){return t.pxmid[1]-e.pxmid[1]}function r(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,n){n||(n={});var r,a,o,l,d,h,g=n.labelExtraY+(i?n.yLabelMax:n.yLabelMin),v=i?t.yLabelMin:t.yLabelMax,m=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-v;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-v-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(m+t.labelExtraY-y)*f>0&&(r=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+r-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,v,m;for(i=0;i<2;i++)for(l=i?n:r,c=i?Math.max:Math.min,f=i?1:-1,o=0;o<2;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),v=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(n/c(l.tilt,Math.sin(s),l.depth),r/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&h.indexOf(l.scalegroup)===-1&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,n){if(!t)return 1;var r=Math.sin(t*Math.PI/180);return Math.max(.01,n*r*Math.abs(e)+2*Math.sqrt(1-r*r*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var n=t._fullLayout;l(e,n._size);var c=n._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],v=c.trace,m=0,y=(v.depth||0)*c.r*Math.sin(m)/2,x=v.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(m),k=l.selectAll("g.part").data(v.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],m=!1;l.each(function(i){function l(e){var r=t._fullLayout,o=t._fullData[v.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&r.hovermode!==!1&&"none"!==l&&"skip"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=n.separators,p=[];l.indexOf("label")!==-1&&p.push(i.label),o.text&&o.text[i.i]&&l.indexOf("text")!==-1&&p.push(o.text[i.i]),l.indexOf("value")!==-1&&p.push(g.formatPieValue(i.v,h)),l.indexOf("percent")!==-1&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:l.indexOf("name")!==-1?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:r._hoverlayer.node(),outerContainer:r._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(n._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],t._hoverdata.trace=e.trace,f.click(t,{target:!0})}function b(t,e,n,r){return"a"+r*c.r+","+r*w+" "+x+" "+i.largeArc+(n?" 1 ":" 0 ")+r*(e[0]-t[0])+","+r*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y),v.pull){var C=+(Array.isArray(v.pull)?v.pull[i.i]:v.pull)||0;C>0&&(k+=C*i.pxmid[0],M+=C*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var S=v.hole;if(i.v===c.vTotal){var z="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";S?T.attr("d","M"+(k+S*i.px0[0])+","+(M+S*i.px0[1])+b(i.px0,i.pxmid,!1,S)+b(i.pxmid,i.px0,!1,S)+"Z"+z):T.attr("d",z)}else{var O=b(i.px0,i.px1,!0,1);if(S){var P=1-S;T.attr("d","M"+(k+S*i.px1[0])+","+(M+S*i.px1[1])+b(i.px1,i.px0,!1,S)+"l"+P*i.px0[0]+","+P*i.px0[1]+O+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+O+"Z")}var D=Array.isArray(v.textposition)?v.textposition[i.i]:v.textposition,N=A.selectAll("g.slicetext").data(i.text&&"none"!==D?[0]:[]);N.enter().append("g").classed("slicetext",!0),N.exit().remove(),N.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===D?v.outsidetextfont:v.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,n=h.bBox(t.node());"outside"===D?e=o(n,i):(e=r(n,i,c),"auto"===D&&e.scale<1&&(t.call(h.font,v.outsidetextfont),v.outsidetextfont.family===v.insidetextfont.family&&v.outsidetextfont.size===v.insidetextfont.size||(t.attr({"data-bb":""}),n=h.bBox(t.node())),e=o(n,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-n.height/2,i.yLabelMid=l,i.yLabelMax=l+n.height/2,i.labelExtraX=0,i.labelExtraY=0,m=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(n.left+n.right)/2+","+-(n.top+n.bottom)/2+")")})}),m&&i(s,v),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),n=e.select("g.slicetext text");n.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+n.attr("transform"));var r=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+r+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(r+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,v.outsidetextfont.color).attr({"stroke-width":Math.min(2,v.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":23,"../../components/drawing":46,"../../lib/svg_text_utils":127,"../../plots/cartesian/graph_interact":149,"./helpers":199,d3:7}],204:[function(t,e,n){"use strict";var r=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],n=e.trace,o=r.select(this);o.style({opacity:n.opacity}),o.selectAll(".top path.surface").each(function(t){r.select(this).call(a,t,n)})})}},{"./style_one":205,d3:7}],205:[function(t,e,n){"use strict";var r=t("../../components/color");e.exports=function(t,e,n){var a=n.marker.line.color;Array.isArray(a)&&(a=a[e.i]||r.defaultLine);var o=n.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(r.stroke,a)}},{"../../components/color":23}],206:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t){var e=t[0].trace,n=e.marker;if(r.mergeArray(e.text,t,"tx"),r.mergeArray(e.textposition,t,"tp"),e.textfont&&(r.mergeArray(e.textfont.size,t,"ts"),r.mergeArray(e.textfont.color,t,"tc"),r.mergeArray(e.textfont.family,t,"tf")),n&&n.line){var a=n.line;r.mergeArray(n.opacity,t,"mo"),r.mergeArray(n.symbol,t,"mx"),r.mergeArray(n.color,t,"mc"),r.mergeArray(a.color,t,"mlc"),r.mergeArray(a.width,t,"mlw")}}},{"../../lib":115}],207:[function(t,e,n){"use strict";var r=t("../../components/colorscale/color_attributes"),a=t("../../components/errorbars/attributes"),o=t("../../components/colorbar/attributes"),i=t("../../components/drawing"),l=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},ids:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"},simplify:{valType:"boolean",dflt:!0}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:l({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},colorbar:o,line:l({},{width:{valType:"number",min:0,arrayOk:!0}},r("marker.line"))},r("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},error_y:a,error_x:a}},{"../../components/colorbar/attributes":24,"../../components/colorscale/color_attributes":30,"../../components/drawing":46,"../../components/errorbars/attributes":48,"../../lib/extend":112,"./constants":212}],208:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var n,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},v={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var m={type:"linear"};a.setConvert(m),s=m.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=v.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,a.expand(u,d,g),a.expand(f,h,v);var b=new Array(p);for(c=0;c=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}}}}},{}],210:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,s=n.marker,c="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===s||!s.showscale)return void o.autoMargin(t,c);var u=s.color,f=s.cmin,d=s.cmax;r(f)||(f=a.aggNums(Math.min,null,u)),r(d)||(d=a.aggNums(Math.max,null,u));var h=e[0].t.cb=l(t,c),p=i.makeColorScaleFunc(i.extractScale(s.colorscale,f,d),{noNumericCheck:!0});h.fillcolor(p).filllevels({start:f,end:d,size:(d-f)/254}).options(s.colorbar)()}},{"../../components/colorbar/draw":26,"../../components/colorscale":37,"../../lib":115,"../../plots/plots":166,"fast-isnumeric":10}],211:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":29,"../../components/colorscale/has_colorscale":36,"./subtypes":227}],212:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],213:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var v=l(t,e,g),m=vq!=D>=q&&(z=C[T-1][0],O=C[T][0],S=z+(O-z)*(q-P)/(D-P),R=Math.min(R,S),F=Math.max(F,S));R=Math.max(R,0),F=Math.min(F,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:F,y0:q,y1:q,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":23,"../../components/errorbars":52,"../../lib":115,"../../plots/cartesian/constants":147,"../../plots/cartesian/graph_interact":149,"./get_trace_color":215}],217:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.animatable=!0,r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"), +r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":150,"./arrays_to_calcdata":206,"./attributes":207,"./calc":208,"./clean_data":209,"./colorbar":210,"./defaults":213,"./hover":216,"./plot":224,"./select":225,"./style":226,"./subtypes":227}],218:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=!Array.isArray(l)&&l||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":32,"../../components/colorscale/has_colorscale":36}],219:[function(t,e,n){"use strict";var r=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),a=k.c2p(t[e].y);return n!==r&&a!==r&&[n,a]}function a(t){var e=t[0]/w._length,n=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*T}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,v,m,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.simplify,A=e.connectGaps,T=e.baseTolerance,L=e.linear,C=[],S=.2,z=new Array(t.length),O=0;for(M||(T=S=-1),i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,c=f,h=!1):y=t.length||!f)break;z[O++]=f,l=f}}else z[O++]=c}C.push(z.slice(0,O))}return C}},{"../../constants/numerical":103}],220:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],221:[function(t,e,n){"use strict";e.exports=function(t,e,n){for(var r,a,o=null,i=0;i0?Math.max(e,a):0}}},{"fast-isnumeric":10}],223:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":23,"../../components/colorscale/defaults":32,"../../components/colorscale/has_colorscale":36,"./subtypes":227}],224:[function(t,e,n){"use strict";function r(t,e){var n;e.selectAll("g.trace").each(function(t){var e=i.select(this);if(n=t[0].trace,n._nexttrace){if(n._nextFill=e.select(".js-fill.js-tonext"),!n._nextFill.size()){var r=":first-child";e.select(".js-fill.js-tozero").size()&&(r+=" + *"),n._nextFill=e.insert("path",r).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),n._nextFill=null;n.fill&&("tozero"===n.fill.substr(0,6)||"toself"===n.fill||"to"===n.fill.substr(0,2)&&!n._prevtrace)?(n._ownFill=e.select(".js-fill.js-tozero"),n._ownFill.size()||(n._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),n._ownFill=null)})}function a(t,e,n,r,a,h,g){function v(t){return M?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,n,r=t[0].trace,a=i.select(this),o=u.hasMarkers(r),c=u.hasText(r),f=x(r),d=b,h=b;o&&(d=r.marker.maxdisplayed?m:l.identity),c&&(h=r.marker.maxdisplayed?m:l.identity),n=a.selectAll("path.point"),e=n.data(d,f);var p=e.enter().append("path").classed("point",!0);p.call(s.pointStyle,r).call(s.translatePoints,A,T,r),M&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=v(i.select(this));s.translatePoint(t,e,A,T),s.singlePointStyle(t,e,r)}),M?e.exit().transition().style("opacity",0).remove():e.exit().remove(),n=a.selectAll("g"),e=n.data(h,f),e.enter().append("g").append("text"),e.each(function(t){var e=v(i.select(this).select("text"));s.translatePoint(t,e,A,T)}),e.selectAll("text").call(s.textPointStyle,r).each(function(t){var e=t.xp||A.c2p(t.x),n=t.yp||T.c2p(t.y);i.select(this).selectAll("tspan").each(function(){v(i.select(this)).attr({x:e,y:n})})}),e.exit().remove()}var w,k;o(t,e,n,r,a);var M=!!g&&g.duration>0,A=n.xaxis,T=n.yaxis,L=r[0].trace,C=L.line,S=i.select(h);if(S.call(c.plot,n,g),L.visible===!0){v(S).style("opacity",L.opacity);var z,O,P=L.fill.charAt(L.fill.length-1);"x"!==P&&"y"!==P&&(P=""),r[0].node3=S,f(r);var D="",N=[],E=L._prevtrace;E&&(D=E._prevRevpath||"",O=E._nextFill,N=E._polygons);var I,R,F,j,B,q,H,V,X,U="",Z="",G=[],Y=[],W=l.noop;if(z=L._ownFill,u.hasLines(L)||"none"!==L.fill){for(O&&O.datum(r),["hv","vh","hvh","vhv"].indexOf(C.shape)!==-1?(F=s.steps(C.shape),j=s.steps(C.shape.split("").reverse().join(""))):F=j="spline"===C.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?s.smoothclosed(t.slice(1),C.smoothing):s.smoothopen(t,C.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return j(t.reverse())},G=d(r,{xaxis:A,yaxis:T,connectGaps:L.connectgaps,baseTolerance:Math.max(C.width||1,3)/4,linear:"linear"===C.shape,simplify:C.simplify}),X=L._polygons=new Array(G.length),k=0;k1}),W=function(t){return function(e){if(I=F(e),R=B(e),U?P?(U+="L"+I.substr(1),Z=R+("L"+Z.substr(1))):(U+="Z"+I,Z=R+"Z"+Z):(U=I,Z=R),u.hasLines(L)&&e.length>1){var n=i.select(this);if(n.datum(r),t)v(n.style("opacity",0).attr("d",I).call(s.lineGroupStyle)).style("opacity",1);else{var a=v(n);a.attr("d",I),s.singleLineStyle(r,a)}}}}}var Q=S.selectAll(".js-line").data(Y);v(Q.exit()).style("opacity",0).remove(),Q.each(W(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(W(!0)),G.length&&(z?q&&V&&(P?("y"===P?q[1]=V[1]=T.c2p(0,!0):"x"===P&&(q[0]=V[0]=A.c2p(0,!0)),v(z).attr("d","M"+V+"L"+q+"L"+U.substr(1))):v(z).attr("d",U+"Z")):"tonext"===L.fill.substr(0,6)&&U&&D&&("tonext"===L.fill?v(O).attr("d",U+"Z"+D+"Z"):v(O).attr("d",U+"L"+D.substr(1)+"Z"),L._polygons=L._polygons.concat(N)),L._prevRevpath=Z,L._prevPolygons=X);var $=S.selectAll(".points");w=$.data([r]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function o(t,e,n,r,a){var o=n.xaxis,l=n.yaxis,s=i.extent(o.range.map(o.r2l).map(o.l2c)),c=i.extent(l.range.map(l.r2l).map(l.l2c)),f=r[0].trace;if(u.hasMarkers(f)){var d=f.marker.maxdisplayed;if(0!==d){var h=r.filter(function(t){return t.x>=s[0]&&t.x<=s[1]&&t.y>=c[0]&&t.y<=c[1]}),p=Math.ceil(h.length/d),g=0;a.forEach(function(t,n){var r=t[0].trace;u.hasMarkers(r)&&r.marker.maxdisplayed>0&&n0;for(u=p.selectAll("g.trace"),f=u.data(n,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),h(t,e,n),r(t,p),s=0,c=[];sr?1:-1}),v){l&&(d=l());var m=i.transition().duration(o.duration).ease(o.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()});m.each(function(){p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)})})}else p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":46,"../../components/errorbars":52,"../../lib":115,"../../lib/polygon":122,"./arrays_to_calcdata":206,"./line_points":219,"./link_traces":221,"./subtypes":227,d3:7}],225:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;n paper // first convert to fraction of the axis - position = (position - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + position = axOld.r2fraction(position); // next scale the axis to the whole plot position = axOld.domain[0] + @@ -13543,8 +13542,7 @@ function drawOne(gd, index, opt, value) { (axNew.domain[1] - axNew.domain[0]); // finally convert to data coordinates - position = axNew.range[0] + - position * (axNew.range[1] - axNew.range[0]); + position = axNew.fraction2r(position); } } @@ -13561,7 +13559,8 @@ function drawOne(gd, index, opt, value) { optionsIn[axLetter] = position; } - var options = handleAnnotationDefaults(optionsIn, fullLayout); + var options = {}; + handleAnnotationDefaults(optionsIn, options, fullLayout); fullLayout.annotations[index] = options; var xa = Axes.getFromId(gd, options.xref), @@ -13675,20 +13674,21 @@ function drawOne(gd, index, opt, value) { // outside the visible plot (as long as the axis // isn't autoranged - then we need to draw it // anyway to get its bounding box) - if(!ax.autorange && ((options[axLetter] - ax.range[0]) * - (options[axLetter] - ax.range[1]) > 0)) { + var posFraction = ax.r2fraction(options[axLetter]); + if(!ax.autorange && (posFraction < 0 || posFraction > 1)) { if(options['a' + axLetter + 'ref'] === axRef) { - if((options['a' + axLetter] - ax.range[0]) * - (options['a' + axLetter] - ax.range[1]) > 0) { + posFraction = ax.r2fraction(options['a' + axLetter]); + if(posFraction < 0 || posFraction > 1) { annotationIsOffscreen = true; } - } else { + } + else { annotationIsOffscreen = true; } if(annotationIsOffscreen) return; } - annPosPx[axLetter] = ax._offset + ax.l2p(options[axLetter]); + annPosPx[axLetter] = ax._offset + ax.r2p(options[axLetter]); alignPosition = 0.5; } else { @@ -13701,7 +13701,7 @@ function drawOne(gd, index, opt, value) { var alignShift = 0; if(options['a' + axLetter + 'ref'] === axRef) { - annPosPx['aa' + axLetter] = ax._offset + ax.l2p(options['a' + axLetter]); + annPosPx['aa' + axLetter] = ax._offset + ax.r2p(options['a' + axLetter]); } else { if(options.showarrow) { alignShift = options['a' + axLetter]; @@ -13901,22 +13901,22 @@ function drawOne(gd, index, opt, value) { ann.call(Lib.setTranslate, xcenter, ycenter); update[annbase + '.x'] = xa ? - (options.x + dx / xa._m) : + xa.p2r(xa.r2p(options.x) + dx) : ((arrowX + dx - gs.l) / gs.w); update[annbase + '.y'] = ya ? - (options.y + dy / ya._m) : + ya.p2r(ya.r2p(options.y) + dy) : (1 - ((arrowY + dy - gs.t) / gs.h)); if(options.axref === options.xref) { update[annbase + '.ax'] = xa ? - (options.ax + dx / xa._m) : - ((arrowX + dx - gs.l) / gs.w); + xa.p2r(xa.r2p(options.ax) + dx) : + ((arrowX + dx - gs.l) / gs.w); } if(options.ayref === options.yref) { update[annbase + '.ay'] = ya ? - (options.ay + dy / ya._m) : - (1 - ((arrowY + dy - gs.t) / gs.h)); + ya.p2r(ya.r2p(options.ay) + dy) : + (1 - ((arrowY + dy - gs.t) / gs.h)); } anng.attr({ @@ -13962,13 +13962,13 @@ function drawOne(gd, index, opt, value) { var csr = 'pointer'; if(options.showarrow) { if(options.axref === options.xref) { - update[annbase + '.ax'] = xa.p2l(xa.l2p(options.ax) + dx); + update[annbase + '.ax'] = xa.p2r(xa.r2p(options.ax) + dx); } else { update[annbase + '.ax'] = options.ax + dx; } if(options.ayref === options.yref) { - update[annbase + '.ay'] = ya.p2l(ya.l2p(options.ay) + dy); + update[annbase + '.ay'] = ya.p2r(ya.r2p(options.ay) + dy); } else { update[annbase + '.ay'] = options.ay + dy; } @@ -14074,7 +14074,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":121,"../../lib/setcursor":131,"../../lib/svg_text_utils":133,"../../plotly":143,"../../plots/cartesian/axes":147,"../../plots/plots":172,"../color":30,"../dragelement":52,"../drawing":54,"./annotation_defaults":21,"./defaults":25,"./draw_arrow_head":27,"d3":14,"fast-isnumeric":17}],27:[function(require,module,exports){ +},{"../../lib":122,"../../lib/setcursor":132,"../../lib/svg_text_utils":134,"../../plotly":144,"../../plots/cartesian/axes":149,"../../plots/plots":173,"../color":30,"../dragelement":51,"../drawing":53,"./annotation_defaults":21,"./defaults":25,"./draw_arrow_head":27,"d3":14,"fast-isnumeric":17}],27:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14193,7 +14193,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { if(doEnd) drawhead(end, endRot); }; -},{"../color":30,"../drawing":54,"./arrow_paths":22,"d3":14,"fast-isnumeric":17}],28:[function(require,module,exports){ +},{"../color":30,"../drawing":53,"./arrow_paths":22,"d3":14,"fast-isnumeric":17}],28:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14205,33 +14205,21 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { 'use strict'; -var Plotly = require('../../plotly'); - -exports.moduleType = 'component'; - -exports.name = 'annotations'; - -exports.ARROWPATHS = require('./arrow_paths'); - -exports.layoutAttributes = require('./attributes'); - -exports.supplyLayoutDefaults = require('./defaults'); - -exports.calcAutorange = require('./calc_autorange'); - -exports.arrowhead = require('./draw_arrow_head'); - var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; -exports.add = function(gd) { - var nextAnn = gd._fullLayout.annotations.length; +module.exports = { + moduleType: 'component', + name: 'annotations', + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), - Plotly.relayout(gd, 'annotations[' + nextAnn + ']', 'add'); + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne }; -},{"../../plotly":143,"./arrow_paths":22,"./attributes":23,"./calc_autorange":24,"./defaults":25,"./draw":26,"./draw_arrow_head":27}],29:[function(require,module,exports){ +},{"./attributes":23,"./calc_autorange":24,"./defaults":25,"./draw":26}],29:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14584,7 +14572,7 @@ module.exports = { } }; -},{"../../lib/extend":118,"../../plots/cartesian/layout_attributes":157,"../../plots/font_attributes":168}],32:[function(require,module,exports){ +},{"../../lib/extend":119,"../../plots/cartesian/layout_attributes":158,"../../plots/font_attributes":169}],32:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14651,7 +14639,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":121,"../../plots/cartesian/tick_label_defaults":163,"../../plots/cartesian/tick_mark_defaults":164,"../../plots/cartesian/tick_value_defaults":165,"./attributes":31}],33:[function(require,module,exports){ +},{"../../lib":122,"../../plots/cartesian/tick_label_defaults":164,"../../plots/cartesian/tick_mark_defaults":165,"../../plots/cartesian/tick_value_defaults":166,"./attributes":31}],33:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15283,7 +15271,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":121,"../../lib/extend":118,"../../lib/setcursor":131,"../../plotly":143,"../../plots/cartesian/axes":147,"../../plots/cartesian/axis_defaults":149,"../../plots/cartesian/layout_attributes":157,"../../plots/cartesian/position_defaults":160,"../../plots/plots":172,"../../registry":187,"../color":30,"../dragelement":52,"../drawing":54,"../titles":105,"./attributes":31,"d3":14,"tinycolor2":20}],34:[function(require,module,exports){ +},{"../../lib":122,"../../lib/extend":119,"../../lib/setcursor":132,"../../plotly":144,"../../plots/cartesian/axes":149,"../../plots/cartesian/axis_defaults":151,"../../plots/cartesian/layout_attributes":158,"../../plots/cartesian/position_defaults":161,"../../plots/plots":173,"../../registry":188,"../color":30,"../dragelement":51,"../drawing":53,"../titles":104,"./attributes":31,"d3":14,"tinycolor2":20}],34:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15302,28 +15290,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":121}],35:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -exports.attributes = require('./attributes'); - -exports.supplyDefaults = require('./defaults'); - -exports.draw = require('./draw'); - -exports.hasColorbar = require('./has_colorbar'); - -},{"./attributes":31,"./defaults":32,"./draw":33,"./has_colorbar":34}],36:[function(require,module,exports){ +},{"../../lib":122}],35:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15378,7 +15345,7 @@ module.exports = { } }; -},{}],37:[function(require,module,exports){ +},{}],36:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15444,7 +15411,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":121,"./flip_scale":42,"./scales":49}],38:[function(require,module,exports){ +},{"../../lib":122,"./flip_scale":41,"./scales":48}],37:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15488,7 +15455,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":118,"./attributes":36,"./scales.js":49}],39:[function(require,module,exports){ +},{"../../lib/extend":119,"./attributes":35,"./scales.js":48}],38:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15504,7 +15471,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":49}],40:[function(require,module,exports){ +},{"./scales":48}],39:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15568,7 +15535,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":121,"../colorbar/defaults":32,"../colorbar/has_colorbar":34,"./flip_scale":42,"./is_valid_scale":46,"fast-isnumeric":17}],41:[function(require,module,exports){ +},{"../../lib":122,"../colorbar/defaults":32,"../colorbar/has_colorbar":34,"./flip_scale":41,"./is_valid_scale":45,"fast-isnumeric":17}],40:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15605,7 +15572,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],42:[function(require,module,exports){ +},{}],41:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15630,7 +15597,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],43:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15670,7 +15637,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":39,"./is_valid_scale_array":47,"./scales":49}],44:[function(require,module,exports){ +},{"./default_scale":38,"./is_valid_scale_array":46,"./scales":48}],43:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15716,7 +15683,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":121,"./is_valid_scale":46,"fast-isnumeric":17}],45:[function(require,module,exports){ +},{"../../lib":122,"./is_valid_scale":45,"fast-isnumeric":17}],44:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15750,7 +15717,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":36,"./calc":37,"./default_scale":39,"./defaults":40,"./extract_scale":41,"./flip_scale":42,"./get_scale":43,"./has_colorscale":44,"./is_valid_scale":46,"./make_color_scale_func":48,"./scales":49}],46:[function(require,module,exports){ +},{"./attributes":35,"./calc":36,"./default_scale":38,"./defaults":39,"./extract_scale":40,"./flip_scale":41,"./get_scale":42,"./has_colorscale":43,"./is_valid_scale":45,"./make_color_scale_func":47,"./scales":48}],45:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15771,7 +15738,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":47,"./scales":49}],47:[function(require,module,exports){ +},{"./is_valid_scale_array":46,"./scales":48}],46:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15808,7 +15775,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":20}],48:[function(require,module,exports){ +},{"tinycolor2":20}],47:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15904,7 +15871,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":30,"d3":14,"fast-isnumeric":17,"tinycolor2":20}],49:[function(require,module,exports){ +},{"../color":30,"d3":14,"fast-isnumeric":17,"tinycolor2":20}],48:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16035,7 +16002,7 @@ module.exports = { ] }; -},{}],50:[function(require,module,exports){ +},{}],49:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16068,7 +16035,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],51:[function(require,module,exports){ +},{}],50:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16106,7 +16073,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":121}],52:[function(require,module,exports){ +},{"../../lib":122}],51:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16293,7 +16260,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../lib":121,"../../plotly":143,"../../plots/cartesian/constants":153,"./align":50,"./cursor":51,"./unhover":53}],53:[function(require,module,exports){ +},{"../../lib":122,"../../plotly":144,"../../plots/cartesian/constants":154,"./align":49,"./cursor":50,"./unhover":52}],52:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16344,7 +16311,7 @@ unhover.raw = function unhoverRaw(gd, evt) { gd._hoverdata = undefined; }; -},{"../../lib/events":117}],54:[function(require,module,exports){ +},{"../../lib/events":118}],53:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16422,14 +16389,14 @@ drawing.getPx = function(s, styleAttr) { return Number(s.style(styleAttr).replace(/px$/, '')); }; -drawing.crispRound = function(td, lineWidth, dflt) { +drawing.crispRound = function(gd, lineWidth, dflt) { // for lines that disable antialiasing we want to // make sure the width is an integer, and at least 1 if it's nonzero if(!lineWidth || !isNumeric(lineWidth)) return dflt || 0; // but not for static plots - these don't get antialiased anyway. - if(td._context.staticPlot) return lineWidth; + if(gd._context.staticPlot) return lineWidth; if(lineWidth < 1) return 1; return Math.round(lineWidth); @@ -16623,9 +16590,8 @@ drawing.singlePointStyle = function(d, sel, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); singlePointStyle(d, sel, trace, markerScale, lineScale, marker, markerLine); @@ -16637,50 +16603,22 @@ drawing.pointStyle = function(s, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales var marker = trace.marker; - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale); }); }; -// for a given color attribute (ie m -> mc = marker.color) look to see if we -// have a colorscale for it (ie mscl, mcmin, mcmax) - if we do, translate -// all numeric color values according to that scale -drawing.tryColorscale = function(cont, contIn, prefix) { - var colorArray = Lib.nestedProperty(cont, prefix + 'color').get(), - scl = Lib.nestedProperty(cont, prefix + 'colorscale').get(), - auto = Lib.nestedProperty(cont, prefix + 'cauto').get(), - minProp = Lib.nestedProperty(cont, prefix + 'cmin'), - maxProp = Lib.nestedProperty(cont, prefix + 'cmax'), - min = minProp.get(), - max = maxProp.get(); +drawing.tryColorscale = function(marker, prefix) { + var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker, + scl = cont.colorscale, + colorArray = cont.color; - // TODO handle this in Colorscale.calc if(scl && Array.isArray(colorArray)) { - if(auto || !isNumeric(min) || !isNumeric(max)) { - min = Infinity; - max = -Infinity; - colorArray.forEach(function(color) { - if(isNumeric(color)) { - if(min > color) min = +color; - if(max < color) max = +color; - } - }); - if(min > max) { - min = 0; - max = 1; - } - minProp.set(min); - maxProp.set(max); - Lib.nestedProperty(contIn, prefix + 'cmin').set(min); - Lib.nestedProperty(contIn, prefix + 'cmax').set(max); - } - return Colorscale.makeColorScaleFunc( - Colorscale.extractScale(scl, min, max) + Colorscale.extractScale(scl, cont.cmin, cont.cmax) ); } else return Lib.identity; @@ -16948,7 +16886,7 @@ drawing.setClipUrl = function(s, localId) { s.attr('clip-path', 'url(' + url + ')'); }; -},{"../../constants/xmlns_namespaces":112,"../../lib":121,"../../lib/svg_text_utils":133,"../../registry":187,"../../traces/scatter/make_bubble_size_func":284,"../../traces/scatter/subtypes":289,"../color":30,"../colorscale":45,"./symbol_defs":55,"d3":14,"fast-isnumeric":17}],55:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":112,"../../lib":122,"../../lib/svg_text_utils":134,"../../registry":188,"../../traces/scatter/make_bubble_size_func":286,"../../traces/scatter/subtypes":291,"../color":30,"../colorscale":44,"./symbol_defs":54,"d3":14,"fast-isnumeric":17}],54:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17424,7 +17362,7 @@ module.exports = { } }; -},{"d3":14}],56:[function(require,module,exports){ +},{"d3":14}],55:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17523,7 +17461,7 @@ module.exports = { } }; -},{}],57:[function(require,module,exports){ +},{}],56:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17586,7 +17524,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":147,"../../registry":187,"./compute_error":58,"fast-isnumeric":17}],58:[function(require,module,exports){ +},{"../../plots/cartesian/axes":149,"../../registry":188,"./compute_error":57,"fast-isnumeric":17}],57:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17682,7 +17620,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],59:[function(require,module,exports){ +},{}],58:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17759,7 +17697,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":121,"../../registry":187,"./attributes":56,"fast-isnumeric":17}],60:[function(require,module,exports){ +},{"../../lib":122,"../../registry":188,"./attributes":55,"fast-isnumeric":17}],59:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17818,7 +17756,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":56,"./calc":57,"./defaults":59,"./plot":61,"./style":62}],61:[function(require,module,exports){ +},{"./attributes":55,"./calc":56,"./defaults":58,"./plot":60,"./style":61}],60:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17982,7 +17920,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":289,"d3":14,"fast-isnumeric":17}],62:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":291,"d3":14,"fast-isnumeric":17}],61:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18019,7 +17957,7 @@ module.exports = function style(traces) { }); }; -},{"../color":30,"d3":14}],63:[function(require,module,exports){ +},{"../color":30,"d3":14}],62:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18034,7 +17972,14 @@ var cartesianConstants = require('../../plots/cartesian/constants'); module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'image', + + visible: { + valType: 'boolean', + + dflt: true, + + }, source: { valType: 'string', @@ -18082,14 +18027,14 @@ module.exports = { }, x: { - valType: 'number', + valType: 'any', dflt: 0, }, y: { - valType: 'number', + valType: 'any', dflt: 0, @@ -18134,7 +18079,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":153}],64:[function(require,module,exports){ +},{"../../plots/cartesian/constants":154}],63:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18145,40 +18090,34 @@ module.exports = { 'use strict'; -var Axes = require('../../plots/cartesian/axes'); var Lib = require('../../lib'); -var attributes = require('./attributes'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var attributes = require('./attributes'); +var name = 'images'; module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { + var opts = { + name: name, + handleItemDefaults: imageDefaults + }; - if(!layoutIn.images || !Array.isArray(layoutIn.images)) return; - - - var containerIn = layoutIn.images, - containerOut = layoutOut.images = []; - - - for(var i = 0; i < containerIn.length; i++) { - var image = containerIn[i]; - - if(!image.source) continue; - - var defaulted = imageDefaults(containerIn[i] || {}, containerOut[i] || {}, layoutOut); - containerOut.push(defaulted); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function imageDefaults(imageIn, imageOut, fullLayout) { - imageOut = imageOut || {}; - function coerce(attr, dflt) { return Lib.coerce(imageIn, imageOut, attributes, attr, dflt); } - coerce('source'); + var source = coerce('source'); + var visible = coerce('visible', !!source); + + if(!visible) return imageOut; + coerce('layer'); coerce('x'); coerce('y'); @@ -18189,18 +18128,18 @@ function imageDefaults(imageIn, imageOut, fullLayout) { coerce('sizing'); coerce('opacity'); - for(var i = 0; i < 2; i++) { - var tdMock = { _fullLayout: fullLayout }, - axLetter = ['x', 'y'][i]; + var gdMock = { _fullLayout: fullLayout }, + axLetters = ['x', 'y']; + for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref - Axes.coerceRef(imageIn, imageOut, tdMock, axLetter, 'paper'); + Axes.coerceRef(imageIn, imageOut, gdMock, axLetters[i], 'paper'); } return imageOut; } -},{"../../lib":121,"../../plots/cartesian/axes":147,"./attributes":63}],65:[function(require,module,exports){ +},{"../../lib":122,"../../plots/array_container_defaults":146,"../../plots/cartesian/axes":149,"./attributes":62}],64:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18217,25 +18156,23 @@ var Axes = require('../../plots/cartesian/axes'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, imageDataAbove = [], imageDataSubplot = [], imageDataBelow = []; - if(!fullLayout.images) return; - - // Sort into top, subplot, and bottom layers for(var i = 0; i < fullLayout.images.length; i++) { var img = fullLayout.images[i]; - if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - imageDataSubplot.push(img); - } else if(img.layer === 'above') { - imageDataAbove.push(img); - } else { - imageDataBelow.push(img); + if(img.visible) { + if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { + imageDataSubplot.push(img); + } else if(img.layer === 'above') { + imageDataAbove.push(img); + } else { + imageDataBelow.push(img); + } } } @@ -18304,12 +18241,12 @@ module.exports = function draw(gd) { var thisImage = d3.select(this); // Axes if specified - var xref = Axes.getFromId(gd, d.xref), - yref = Axes.getFromId(gd, d.yref); + var xa = Axes.getFromId(gd, d.xref), + ya = Axes.getFromId(gd, d.yref); var size = fullLayout._size, - width = xref ? Math.abs(xref.l2p(d.sizex) - xref.l2p(0)) : d.sizex * size.w, - height = yref ? Math.abs(yref.l2p(d.sizey) - yref.l2p(0)) : d.sizey * size.h; + width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w, + height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset, @@ -18318,8 +18255,8 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xref ? xref.l2p(d.x) + xref._offset : d.x * size.w + size.l) + xOffset, - yPos = (yref ? yref.l2p(d.y) + yref._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset, + yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; // Construct the proper aspectRatio attribute @@ -18344,8 +18281,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xref ? xref._id : '', - yId = yref ? yref._id : '', + var xId = xa ? xa._id : '', + yId = ya ? ya._id : '', clipAxes = xId + yId; if(clipAxes) { @@ -18382,7 +18319,7 @@ module.exports = function draw(gd) { }); }; -},{"../../constants/xmlns_namespaces":112,"../../plots/cartesian/axes":147,"../drawing":54,"d3":14}],66:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":112,"../../plots/cartesian/axes":149,"../drawing":53,"d3":14}],65:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18393,21 +18330,17 @@ module.exports = function draw(gd) { 'use strict'; - -var draw = require('./draw'); -var supplyLayoutDefaults = require('./defaults'); -var attributes = require('./attributes'); - - module.exports = { moduleType: 'component', name: 'images', - draw: draw, - layoutAttributes: attributes, - supplyLayoutDefaults: supplyLayoutDefaults + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), + + draw: require('./draw') }; -},{"./attributes":63,"./defaults":64,"./draw":65}],67:[function(require,module,exports){ +},{"./attributes":62,"./defaults":63,"./draw":64}],66:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18456,7 +18389,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],68:[function(require,module,exports){ +},{}],67:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18547,7 +18480,7 @@ module.exports = { } }; -},{"../../lib/extend":118,"../../plots/font_attributes":168,"../color/attributes":29}],69:[function(require,module,exports){ +},{"../../lib/extend":119,"../../plots/font_attributes":169,"../color/attributes":29}],68:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18565,7 +18498,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],70:[function(require,module,exports){ +},{}],69:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18658,7 +18591,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":121,"../../plots/layout_attributes":170,"../../registry":187,"./attributes":68,"./helpers":73}],71:[function(require,module,exports){ +},{"../../lib":122,"../../plots/layout_attributes":171,"../../registry":188,"./attributes":67,"./helpers":72}],70:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19374,7 +19307,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../lib":121,"../../lib/svg_text_utils":133,"../../plotly":143,"../../plots/plots":172,"../../registry":187,"../color":30,"../dragelement":52,"../drawing":54,"./anchor_utils":67,"./constants":69,"./get_legend_data":72,"./helpers":73,"./style":75,"d3":14}],72:[function(require,module,exports){ +},{"../../lib":122,"../../lib/svg_text_utils":134,"../../plotly":144,"../../plots/plots":173,"../../registry":188,"../color":30,"../dragelement":51,"../drawing":53,"./anchor_utils":66,"./constants":68,"./get_legend_data":71,"./helpers":72,"./style":74,"d3":14}],71:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19479,7 +19412,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":187,"./helpers":73}],73:[function(require,module,exports){ +},{"../../registry":188,"./helpers":72}],72:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19510,7 +19443,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":187}],74:[function(require,module,exports){ +},{"../../registry":188}],73:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19523,22 +19456,18 @@ exports.isReversed = function isReversed(legendLayout) { 'use strict'; -var legend = module.exports = {}; - - -legend.moduleType = 'component'; - -legend.name = 'legend'; - -legend.layoutAttributes = require('./attributes'); - -legend.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'legend', -legend.draw = require('./draw'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -legend.style = require('./style'); + draw: require('./draw'), + style: require('./style') +}; -},{"./attributes":68,"./defaults":70,"./draw":71,"./style":75}],75:[function(require,module,exports){ +},{"./attributes":67,"./defaults":69,"./draw":70,"./style":74}],74:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19760,7 +19689,7 @@ function stylePies(d) { if(pts.size()) pts.call(stylePie, d[0], trace); } -},{"../../lib":121,"../../registry":187,"../../traces/pie/style_one":267,"../../traces/scatter/subtypes":289,"../color":30,"../drawing":54,"d3":14}],76:[function(require,module,exports){ +},{"../../lib":122,"../../registry":188,"../../traces/pie/style_one":269,"../../traces/scatter/subtypes":291,"../color":30,"../drawing":53,"d3":14}],75:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20270,7 +20199,7 @@ modeBarButtons.resetViews = { } }; -},{"../../../build/ploticon":2,"../../lib":121,"../../plotly":143,"../../plots/cartesian/axes":147,"../../plots/plots":172,"../../snapshot/download":189}],77:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":122,"../../plotly":144,"../../plots/cartesian/axes":149,"../../plots/plots":173,"../../snapshot/download":190}],76:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20284,7 +20213,7 @@ modeBarButtons.resetViews = { exports.manage = require('./manage'); -},{"./manage":78}],78:[function(require,module,exports){ +},{"./manage":77}],77:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20512,7 +20441,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":147,"../../traces/scatter/subtypes":289,"./buttons":76,"./modebar":79}],79:[function(require,module,exports){ +},{"../../plots/cartesian/axes":149,"../../traces/scatter/subtypes":291,"./buttons":75,"./modebar":78}],78:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20802,7 +20731,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":121,"d3":14}],80:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":122,"d3":14}],79:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20819,7 +20748,8 @@ var extendFlat = require('../../lib/extend').extendFlat; var buttonAttrs = require('./button_attributes'); buttonAttrs = extendFlat(buttonAttrs, { - _isLinkedToArray: true, + _isLinkedToArray: 'button', + }); @@ -20891,7 +20821,7 @@ module.exports = { } }; -},{"../../lib/extend":118,"../../plots/font_attributes":168,"../color/attributes":29,"./button_attributes":81}],81:[function(require,module,exports){ +},{"../../lib/extend":119,"../../plots/font_attributes":169,"../color/attributes":29,"./button_attributes":80}],80:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20932,7 +20862,7 @@ module.exports = { } }; -},{}],82:[function(require,module,exports){ +},{}],81:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20961,7 +20891,7 @@ module.exports = { darkAmount: 10 }; -},{}],83:[function(require,module,exports){ +},{}],82:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21054,7 +20984,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":121,"../color":30,"./attributes":80,"./button_attributes":81,"./constants":82}],84:[function(require,module,exports){ +},{"../../lib":122,"../color":30,"./attributes":79,"./button_attributes":80,"./constants":81}],83:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21329,7 +21259,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":133,"../../plotly":143,"../../plots/cartesian/axis_ids":150,"../../plots/plots":172,"../color":30,"../drawing":54,"../legend/anchor_utils":67,"./constants":82,"./get_update_object":85,"d3":14}],85:[function(require,module,exports){ +},{"../../lib/svg_text_utils":134,"../../plotly":144,"../../plots/cartesian/axis_ids":152,"../../plots/plots":173,"../color":30,"../drawing":53,"../legend/anchor_utils":66,"./constants":81,"./get_update_object":84,"d3":14}],84:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21343,6 +21273,8 @@ function reposition(gd, buttons, opts, axName) { var d3 = require('d3'); +var Lib = require('../../lib'); + module.exports = function getUpdateObject(axisLayout, buttonLayout) { var axName = axisLayout._name; @@ -21363,7 +21295,7 @@ module.exports = function getUpdateObject(axisLayout, buttonLayout) { function getXRange(axisLayout, buttonLayout) { var currentRange = axisLayout.range; - var base = new Date(currentRange[1]); + var base = new Date(Lib.dateTime2ms(currentRange[1])); var step = buttonLayout.step, count = buttonLayout.count; @@ -21372,13 +21304,13 @@ function getXRange(axisLayout, buttonLayout) { switch(buttonLayout.stepmode) { case 'backward': - range0 = d3.time[step].offset(base, -count).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].offset(base, -count)); break; case 'todate': - var base2 = d3.time[step].offset(base, -(count - 1)); + var base2 = d3.time[step].offset(base, -count); - range0 = d3.time[step].floor(base2).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].ceil(base2)); break; } @@ -21387,7 +21319,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":14}],86:[function(require,module,exports){ +},{"../../lib":122,"d3":14}],85:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21398,18 +21330,18 @@ function getXRange(axisLayout, buttonLayout) { 'use strict'; +module.exports = { + moduleType: 'component', + name: 'rangeselector', -exports.moduleType = 'component'; - -exports.name = 'rangeselector'; - -exports.layoutAttributes = require('./attributes'); - -exports.handleDefaults = require('./defaults'); + layoutNodes: ['xaxis.'], + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":80,"./defaults":83,"./draw":84}],87:[function(require,module,exports){ +},{"./attributes":79,"./defaults":82,"./draw":83}],86:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21446,8 +21378,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -21467,7 +21399,7 @@ module.exports = { } }; -},{"../color/attributes":29}],88:[function(require,module,exports){ +},{"../color/attributes":29}],87:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21520,7 +21452,7 @@ module.exports = { handleStroke: '#666', }; -},{}],89:[function(require,module,exports){ +},{}],88:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21544,7 +21476,8 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe } var containerIn = layoutIn[axName].rangeslider, - containerOut = layoutOut[axName].rangeslider = {}; + axOut = layoutOut[axName], + containerOut = axOut.rangeslider = {}; function coerce(attr, dflt) { return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); @@ -21558,14 +21491,16 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe coerce('range'); // Expand slider range to the axis range - if(containerOut.range && !layoutOut[axName].autorange) { + if(containerOut.range && !axOut.autorange) { var outRange = containerOut.range, - axRange = layoutOut[axName].range; + axRange = axOut.range, + l2r = axOut.l2r, + r2l = axOut.r2l; - outRange[0] = Math.min(outRange[0], axRange[0]); - outRange[1] = Math.max(outRange[1], axRange[1]); + outRange[0] = l2r(Math.min(r2l(outRange[0]), r2l(axRange[0]))); + outRange[1] = l2r(Math.max(r2l(outRange[1]), r2l(axRange[1]))); } else { - layoutOut[axName]._needsExpand = true; + axOut._needsExpand = true; } if(containerOut.visible) { @@ -21580,7 +21515,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe containerOut._input = containerIn; }; -},{"../../lib":121,"./attributes":87}],90:[function(require,module,exports){ +},{"../../lib":122,"./attributes":86}],89:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21687,20 +21622,10 @@ module.exports = function(gd) { rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); - // update inner nodes - - rangeSlider - .call(drawBg, gd, axisOpts, opts) - .call(addClipPath, gd, axisOpts, opts) - .call(drawRangePlot, gd, axisOpts, opts) - .call(drawMasks, gd, axisOpts, opts) - .call(drawSlideBox, gd, axisOpts, opts) - .call(drawGrabbers, gd, axisOpts, opts); - // update data <--> pixel coordinate conversion methods - var range0 = opts.range[0], - range1 = opts.range[1], + var range0 = axisOpts.r2l(opts.range[0]), + range1 = axisOpts.r2l(opts.range[1]), dist = range1 - range0; opts.p2d = function(v) { @@ -21711,6 +21636,18 @@ module.exports = function(gd) { return (v - range0) / dist * opts._width; }; + opts._rl = [range0, range1]; + + // update inner nodes + + rangeSlider + .call(drawBg, gd, axisOpts, opts) + .call(addClipPath, gd, axisOpts, opts) + .call(drawRangePlot, gd, axisOpts, opts) + .call(drawMasks, gd, axisOpts, opts) + .call(drawSlideBox, gd, axisOpts, opts) + .call(drawGrabbers, gd, axisOpts, opts); + // setup drag element setupDragElement(rangeSlider, gd, axisOpts, opts); @@ -21748,8 +21685,8 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { target = event.target, startX = event.clientX, offsetX = startX - rangeSlider.node().getBoundingClientRect().left, - minVal = opts.d2p(axisOpts.range[0]), - maxVal = opts.d2p(axisOpts.range[1]); + minVal = opts.d2p(axisOpts._rl[0]), + maxVal = opts.d2p(axisOpts._rl[1]); var dragCover = dragElement.coverSlip(); @@ -21810,7 +21747,7 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { function setDataRange(rangeSlider, gd, axisOpts, opts) { function clamp(v) { - return Lib.constrain(v, opts.range[0], opts.range[1]); + return axisOpts.l2r(Lib.constrain(v, opts._rl[0], opts._rl[1])); } var dataMin = clamp(opts.p2d(opts._pixelMin)), @@ -21827,8 +21764,8 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts) { return Lib.constrain(v, 0, opts._width); } - var pixelMin = clamp(opts.d2p(axisOpts.range[0])), - pixelMax = clamp(opts.d2p(axisOpts.range[1])); + var pixelMin = clamp(opts.d2p(axisOpts._rl[0])), + pixelMax = clamp(opts.d2p(axisOpts._rl[1])); rangeSlider.select('rect.' + constants.slideBoxClassName) .attr('x', pixelMin) @@ -21921,6 +21858,7 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) { data: [], layout: { xaxis: { + type: axisOpts.type, domain: [0, 1], range: opts.range.slice() }, @@ -22102,7 +22040,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":121,"../../lib/setcursor":131,"../../plotly":143,"../../plots/cartesian":156,"../../plots/cartesian/axes":147,"../../plots/plots":172,"../color":30,"../dragelement":52,"../drawing":54,"./constants":88,"d3":14}],91:[function(require,module,exports){ +},{"../../lib":122,"../../lib/setcursor":132,"../../plotly":144,"../../plots/cartesian":157,"../../plots/cartesian/axes":149,"../../plots/plots":173,"../color":30,"../dragelement":51,"../drawing":53,"./constants":87,"d3":14}],90:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22116,12 +22054,15 @@ function clearPushMargins(gd) { module.exports = { moduleType: 'component', name: 'rangeslider', + + layoutNodes: ['xaxis.'], layoutAttributes: require('./attributes'), handleDefaults: require('./defaults'), + draw: require('./draw') }; -},{"./attributes":87,"./defaults":89,"./draw":90}],92:[function(require,module,exports){ +},{"./attributes":86,"./defaults":88,"./draw":89}],91:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22139,7 +22080,14 @@ var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'shape', + + visible: { + valType: 'boolean', + + dflt: true, + + }, type: { valType: 'enumerated', @@ -22212,7 +22160,7 @@ module.exports = { } }; -},{"../../lib/extend":118,"../../traces/scatter/attributes":269,"../annotations/attributes":23}],93:[function(require,module,exports){ +},{"../../lib/extend":119,"../../traces/scatter/attributes":271,"../annotations/attributes":23}],92:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22224,6 +22172,7 @@ module.exports = { 'use strict'; +var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); var constants = require('./constants'); @@ -22232,7 +22181,7 @@ var helpers = require('./helpers'); module.exports = function calcAutorange(gd) { var fullLayout = gd._fullLayout, - shapeList = fullLayout.shapes; + shapeList = Lib.filterVisible(fullLayout.shapes); if(!shapeList.length || !gd._fullData.length) return; @@ -22288,7 +22237,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../plots/cartesian/axes":147,"./constants":94,"./helpers":97}],94:[function(require,module,exports){ +},{"../../lib":122,"../../plots/cartesian/axes":149,"./constants":93,"./helpers":96}],93:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22352,7 +22301,7 @@ module.exports = { } }; -},{}],95:[function(require,module,exports){ +},{}],94:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22364,22 +22313,20 @@ module.exports = { 'use strict'; +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var handleShapeDefaults = require('./shape_defaults'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - var containerIn = layoutIn.shapes || [], - containerOut = layoutOut.shapes = []; - - for(var i = 0; i < containerIn.length; i++) { - var shapeIn = containerIn[i] || {}, - shapeOut = handleShapeDefaults(shapeIn, layoutOut); + var opts = { + name: 'shapes', + handleItemDefaults: handleShapeDefaults + }; - containerOut.push(shapeOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"./shape_defaults":99}],96:[function(require,module,exports){ +},{"../../plots/array_container_defaults":146,"./shape_defaults":98}],95:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22431,7 +22378,9 @@ function draw(gd) { fullLayout._shapeSubplotLayer.selectAll('path').remove(); for(var i = 0; i < fullLayout.shapes.length; i++) { - drawOne(gd, i); + if(fullLayout.shapes[i].visible) { + drawOne(gd, i); + } } // may need to resurrect this if we put text (LaTeX) in shapes @@ -22551,8 +22500,6 @@ function updateShape(gd, index, opt, value) { // TODO: clean this up and remove it. if(!optionsIn) return; - var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; - // alter the input shape as requested var optionsEdit = {}; if(typeof opt === 'string' && opt) optionsEdit[opt] = value; @@ -22564,7 +22511,12 @@ function updateShape(gd, index, opt, value) { Lib.nestedProperty(optionsIn, k).set(optionsEdit[k]); } - var posAttrs = ['x0', 'x1', 'y0', 'y1']; + // return early in visible: false updates + if(optionsIn.visible === false) return; + + var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}, + posAttrs = ['x0', 'x1', 'y0', 'y1']; + for(i = 0; i < 4; i++) { var posAttr = posAttrs[i]; // if we don't have an explicit position already, @@ -22579,18 +22531,17 @@ function updateShape(gd, index, opt, value) { var axLetter = posAttr.charAt(0), axOld = Axes.getFromId(gd, - Axes.coerceRef(oldRef, {}, gd, axLetter)), + Axes.coerceRef(oldRef, {}, gd, axLetter, '', 'paper')), axNew = Axes.getFromId(gd, - Axes.coerceRef(optionsIn, {}, gd, axLetter)), + Axes.coerceRef(optionsIn, {}, gd, axLetter, '', 'paper')), position = optionsIn[posAttr], - linearizedPosition; + rangePosition; if(optionsEdit[axLetter + 'ref'] !== undefined) { // first convert to fraction of the axis if(axOld) { - linearizedPosition = helpers.dataToLinear(axOld)(position); - position = (linearizedPosition - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + rangePosition = helpers.shapePositionToRange(axOld)(position); + position = axOld.r2fraction(rangePosition); } else { position = (position - axNew.domain[0]) / (axNew.domain[1] - axNew.domain[0]); @@ -22598,9 +22549,8 @@ function updateShape(gd, index, opt, value) { if(axNew) { // then convert to new data coordinates at the same fraction - linearizedPosition = axNew.range[0] + position * - (axNew.range[1] - axNew.range[0]); - position = helpers.linearToData(axNew)(linearizedPosition); + rangePosition = axNew.fraction2r(position); + position = helpers.rangeToShapePosition(axNew)(rangePosition); } else { // or scale to the whole plot position = axOld.domain[0] + @@ -22611,7 +22561,8 @@ function updateShape(gd, index, opt, value) { optionsIn[posAttr] = position; } - var options = handleShapeDefaults(optionsIn, gd._fullLayout); + var options = {}; + handleShapeDefaults(optionsIn, options, gd._fullLayout); gd._fullLayout.shapes[index] = options; var clipAxes; @@ -22845,22 +22796,22 @@ function getPathString(gd, options) { xa = Axes.getFromId(gd, options.xref), ya = Axes.getFromId(gd, options.yref), gs = gd._fullLayout._size, - x2l, + x2r, x2p, - y2l, + y2r, y2p; if(xa) { - x2l = helpers.dataToLinear(xa); - x2p = function(v) { return xa._offset + xa.l2p(x2l(v, true)); }; + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2l = helpers.dataToLinear(ya); - y2p = function(v) { return ya._offset + ya.l2p(y2l(v, true)); }; + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; @@ -22942,7 +22893,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":121,"../../lib/setcursor":131,"../../plotly":143,"../../plots/cartesian/axes":147,"../color":30,"../dragelement":52,"../drawing":54,"./constants":94,"./defaults":95,"./helpers":97,"./shape_defaults":99,"fast-isnumeric":17}],97:[function(require,module,exports){ +},{"../../lib":122,"../../lib/setcursor":132,"../../plotly":144,"../../plots/cartesian/axes":149,"../color":30,"../dragelement":51,"../drawing":53,"./constants":93,"./defaults":94,"./helpers":96,"./shape_defaults":98,"fast-isnumeric":17}],96:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22959,16 +22910,16 @@ function movePath(pathIn, moveX, moveY) { // so these have to be specified in terms of the category serial numbers, // but can take fractional values. Other axis types we specify position based on // the actual data values. -// TODO: this should really be part of axes, but for now it's only used here. -// eventually annotations and axis ranges will use this too. -// what should we do, invent a new letter for "data except if it's category"? +// TODO: in V2.0 (when log axis ranges are in data units) range and shape position +// will be identical, so rangeToShapePosition and shapePositionToRange can be +// removed entirely. -exports.dataToLinear = function(ax) { - return ax.type === 'category' ? ax.c2l : ax.d2l; +exports.rangeToShapePosition = function(ax) { + return (ax.type === 'log') ? ax.r2d : function(v) { return v; }; }; -exports.linearToData = function(ax) { - return ax.type === 'category' ? ax.l2c : ax.l2d; +exports.shapePositionToRange = function(ax) { + return (ax.type === 'log') ? ax.d2r : function(v) { return v; }; }; exports.decodeDate = function(convertToPx) { @@ -22987,10 +22938,10 @@ exports.getDataToPixel = function(gd, axis, isVertical) { dataToPixel; if(axis) { - var d2l = exports.dataToLinear(axis); + var d2r = exports.shapePositionToRange(axis); dataToPixel = function(v) { - return axis._offset + axis.l2p(d2l(v, true)); + return axis._offset + axis.r2p(d2r(v, true)); }; if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); @@ -23010,8 +22961,8 @@ exports.getPixelToData = function(gd, axis, isVertical) { pixelToData; if(axis) { - var l2d = exports.linearToData(axis); - pixelToData = function(p) { return l2d(axis.p2l(p - axis._offset)); }; + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; @@ -23023,7 +22974,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],98:[function(require,module,exports){ +},{}],97:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23035,21 +22986,21 @@ exports.getPixelToData = function(gd, axis, isVertical) { 'use strict'; -exports.moduleType = 'component'; - -exports.name = 'shapes'; - -exports.layoutAttributes = require('./attributes'); +var drawModule = require('./draw'); -exports.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'shapes', -exports.calcAutorange = require('./calc_autorange'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne +}; -},{"./attributes":92,"./calc_autorange":93,"./defaults":95,"./draw":96}],99:[function(require,module,exports){ +},{"./attributes":91,"./calc_autorange":92,"./defaults":94,"./draw":95}],98:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23067,13 +23018,19 @@ var Axes = require('../../plots/cartesian/axes'); var attributes = require('./attributes'); var helpers = require('./helpers'); -module.exports = function handleShapeDefaults(shapeIn, fullLayout) { - var shapeOut = {}; + +module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opts, itemOpts) { + opts = opts || {}; + itemOpts = itemOpts || {}; function coerce(attr, dflt) { return Lib.coerce(shapeIn, shapeOut, attributes, attr, dflt); } + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + + if(!visible) return shapeOut; + coerce('layer'); coerce('opacity'); coerce('fillcolor'); @@ -23088,39 +23045,61 @@ module.exports = function handleShapeDefaults(shapeIn, fullLayout) { var axLetters = ['x', 'y']; for(var i = 0; i < 2; i++) { var axLetter = axLetters[i], - tdMock = {_fullLayout: fullLayout}; + gdMock = {_fullLayout: fullLayout}; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, tdMock, axLetter); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); if(shapeType !== 'path') { var dflt0 = 0.25, - dflt1 = 0.75; + dflt1 = 0.75, + ax, + pos2r, + r2pos; if(axRef !== 'paper') { - var ax = Axes.getFromId(tdMock, axRef), - convertFn = helpers.linearToData(ax); - - dflt0 = convertFn(ax.range[0] + dflt0 * (ax.range[1] - ax.range[0])); - dflt1 = convertFn(ax.range[0] + dflt1 * (ax.range[1] - ax.range[0])); + ax = Axes.getFromId(gdMock, axRef); + r2pos = helpers.rangeToShapePosition(ax); + pos2r = helpers.shapePositionToRange(ax); + } + else { + pos2r = r2pos = Lib.identity; } + // hack until V2.0 when log has regular range behavior - make it look like other + // ranges to send to coerce, then put it back after + // this is all to give reasonable default position behavior on log axes, which is + // a pretty unimportant edge case so we could just ignore this. + var attr0 = axLetter + '0', + attr1 = axLetter + '1', + in0 = shapeIn[attr0], + in1 = shapeIn[attr1]; + shapeIn[attr0] = pos2r(shapeIn[attr0], true); + shapeIn[attr1] = pos2r(shapeIn[attr1], true); + // x0, x1 (and y0, y1) - coerce(axLetter + '0', dflt0); - coerce(axLetter + '1', dflt1); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr0, dflt0); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr1, dflt1); + + // hack part 2 + shapeOut[attr0] = r2pos(shapeOut[attr0]); + shapeOut[attr1] = r2pos(shapeOut[attr1]); + shapeIn[attr0] = in0; + shapeIn[attr1] = in1; } } if(shapeType === 'path') { coerce('path'); - } else { + } + else { Lib.noneOrAll(shapeIn, shapeOut, ['x0', 'x1', 'y0', 'y1']); } return shapeOut; }; -},{"../../lib":121,"../../plots/cartesian/axes":147,"./attributes":92,"./helpers":97}],100:[function(require,module,exports){ +},{"../../lib":122,"../../plots/cartesian/axes":149,"./attributes":91,"./helpers":96}],99:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23139,7 +23118,7 @@ var animationAttrs = require('../../plots/animation_attributes'); var constants = require('./constants'); var stepsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'step', method: { valType: 'enumerated', @@ -23172,6 +23151,8 @@ var stepsAttrs = { }; module.exports = { + _isLinkedToArray: 'slider', + visible: { valType: 'boolean', @@ -23352,7 +23333,7 @@ module.exports = { }, }; -},{"../../lib/extend":118,"../../plots/animation_attributes":144,"../../plots/font_attributes":168,"../../plots/pad_attributes":171,"./constants":101}],101:[function(require,module,exports){ +},{"../../lib/extend":119,"../../plots/animation_attributes":145,"../../plots/font_attributes":169,"../../plots/pad_attributes":172,"./constants":100}],100:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23367,9 +23348,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'sliders', - itemName: 'slider', // class names containerClassName: 'slider-container', @@ -23450,7 +23430,7 @@ module.exports = { currentValueInset: 0, }; -},{}],102:[function(require,module,exports){ +},{}],101:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23462,6 +23442,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -23471,23 +23452,12 @@ var stepAttrs = attributes.steps; module.exports = function slidersDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var sliderIn = contIn[i] || {}, - sliderOut = {}; - - sliderDefaults(sliderIn, sliderOut, layoutOut); - - // used on button click to update the 'active' field - sliderOut._input = sliderIn; - - // used to determine object constancy - sliderOut._index = i; + var opts = { + name: name, + handleItemDefaults: sliderDefaults + }; - contOut.push(sliderOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function sliderDefaults(sliderIn, sliderOut, layoutOut) { @@ -23573,7 +23543,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":121,"./attributes":100,"./constants":101}],103:[function(require,module,exports){ +},{"../../lib":122,"../../plots/array_container_defaults":146,"./attributes":99,"./constants":100}],102:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23942,6 +23912,7 @@ function handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, doTransiti } function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) { + var previousActive = sliderOpts.active; sliderOpts._input.active = sliderOpts.active = index; var step = sliderOpts.steps[sliderOpts.active]; @@ -23949,6 +23920,13 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) sliderGroup.call(setGripPosition, sliderOpts, sliderOpts.active / (sliderOpts.steps.length - 1), doTransition); sliderGroup.call(drawCurrentValue, sliderOpts); + gd.emit('plotly_sliderchange', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active], + interaction: doCallback, + previousActive: previousActive + }); + if(step && step.method && doCallback) { if(sliderGroup._nextMethod) { // If we've already queued up an update, just overwrite it with the most recent: @@ -23975,6 +23953,8 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { var $gd = d3.select(gd); item.on('mousedown', function() { + gd.emit('plotly_sliderstart', {slider: sliderOpts}); + var grip = sliderGroup.select('.' + constants.gripRectClass); d3.event.stopPropagation(); @@ -23995,6 +23975,11 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { grip.call(Color.fill, sliderOpts.bgcolor); $gd.on('mouseup', null); $gd.on('mousemove', null); + + gd.emit('plotly_sliderend', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active] + }); }); }); } @@ -24132,7 +24117,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":121,"../../lib/svg_text_utils":133,"../../plots/plots":172,"../color":30,"../drawing":54,"../legend/anchor_utils":67,"./constants":101,"d3":14}],104:[function(require,module,exports){ +},{"../../lib":122,"../../lib/svg_text_utils":134,"../../plots/plots":173,"../color":30,"../drawing":53,"../legend/anchor_utils":66,"./constants":100,"d3":14}],103:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24143,18 +24128,19 @@ function clearPushMargins(gd) { 'use strict'; +var constants = require('./constants'); -exports.moduleType = 'component'; - -exports.name = 'sliders'; - -exports.layoutAttributes = require('./attributes'); +module.exports = { + moduleType: 'component', + name: constants.name, -exports.supplyLayoutDefaults = require('./defaults'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":100,"./defaults":102,"./draw":103}],105:[function(require,module,exports){ +},{"./attributes":99,"./constants":100,"./defaults":101,"./draw":102}],104:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24384,7 +24370,7 @@ Titles.draw = function(gd, titleClass, options) { el.classed('js-placeholder', isplaceholder); }; -},{"../../lib":121,"../../lib/svg_text_utils":133,"../../plotly":143,"../../plots/plots":172,"../color":30,"../drawing":54,"d3":14,"fast-isnumeric":17}],106:[function(require,module,exports){ +},{"../../lib":122,"../../lib/svg_text_utils":134,"../../plotly":144,"../../plots/plots":173,"../color":30,"../drawing":53,"d3":14,"fast-isnumeric":17}],105:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24401,7 +24387,7 @@ var extendFlat = require('../../lib/extend').extendFlat; var padAttrs = require('../../plots/pad_attributes'); var buttonsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'button', method: { valType: 'enumerated', @@ -24430,7 +24416,7 @@ var buttonsAttrs = { }; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'updatemenu', visible: { valType: 'boolean', @@ -24530,7 +24516,7 @@ module.exports = { } }; -},{"../../lib/extend":118,"../../plots/font_attributes":168,"../../plots/pad_attributes":171,"../color/attributes":29}],107:[function(require,module,exports){ +},{"../../lib/extend":119,"../../plots/font_attributes":169,"../../plots/pad_attributes":172,"../color/attributes":29}],106:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24545,9 +24531,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'updatemenus', - itemName: 'updatemenu', // class names containerClassName: 'updatemenu-container', @@ -24607,7 +24592,7 @@ module.exports = { hoverColor: '#F4FAFF' }; -},{}],108:[function(require,module,exports){ +},{}],107:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24619,6 +24604,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -24628,23 +24614,12 @@ var buttonAttrs = attributes.buttons; module.exports = function updateMenusDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var menuIn = contIn[i] || {}, - menuOut = {}; - - menuDefaults(menuIn, menuOut, layoutOut); - - // used on button click to update the 'active' field - menuOut._input = menuIn; - - // used to determine object constancy - menuOut._index = i; + var opts = { + name: name, + handleItemDefaults: menuDefaults + }; - contOut.push(menuOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function menuDefaults(menuIn, menuOut, layoutOut) { @@ -24711,7 +24686,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":121,"./attributes":106,"./constants":107}],109:[function(require,module,exports){ +},{"../../lib":122,"../../plots/array_container_defaults":146,"./attributes":105,"./constants":106}],108:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25013,6 +24988,8 @@ function drawButtons(gd, gHeader, gButton, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, buttonIndex); Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + + gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); button.on('mouseover', function() { @@ -25292,7 +25269,9 @@ function clearPushMargins(gd) { } } -},{"../../lib":121,"../../lib/svg_text_utils":133,"../../plots/plots":172,"../color":30,"../drawing":54,"../legend/anchor_utils":67,"./constants":107,"d3":14}],110:[function(require,module,exports){ +},{"../../lib":122,"../../lib/svg_text_utils":134,"../../plots/plots":173,"../color":30,"../drawing":53,"../legend/anchor_utils":66,"./constants":106,"d3":14}],109:[function(require,module,exports){ +arguments[4][103][0].apply(exports,arguments) +},{"./attributes":105,"./constants":106,"./defaults":107,"./draw":108,"dup":103}],110:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25304,17 +25283,37 @@ function clearPushMargins(gd) { 'use strict'; -exports.moduleType = 'component'; - -exports.name = 'updatemenus'; - -exports.layoutAttributes = require('./attributes'); +module.exports = { + /** + * Standardize all missing data in calcdata to use undefined + * never null or NaN. + * That way we can use !==undefined, or !== BADNUM, + * to test for real data + */ + BADNUM: undefined, -exports.supplyLayoutDefaults = require('./defaults'); + /* + * Limit certain operations to well below floating point max value + * to avoid glitches: Make sure that even when you multiply it by the + * number of pixels on a giant screen it still works + */ + FP_SAFE: Number.MAX_VALUE / 10000, -exports.draw = require('./draw'); + /* + * conversion of date units to milliseconds + * year and month constants are marked "AVG" + * to remind us that not all years and months + * have the same length + */ + ONEAVGYEAR: 31557600000, // 365.25 days + ONEAVGMONTH: 2629800000, // 1/12 of ONEAVGYEAR + ONEDAY: 86400000, + ONEHOUR: 3600000, + ONEMIN: 60000, + ONESEC: 1000 +}; -},{"./attributes":106,"./defaults":108,"./draw":109}],111:[function(require,module,exports){ +},{}],111:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25394,7 +25393,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.19.2'; +exports.version = '1.20.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -25455,7 +25454,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":28,"./components/images":66,"./components/legend":74,"./components/rangeselector":86,"./components/rangeslider":91,"./components/shapes":98,"./components/sliders":104,"./components/updatemenus":110,"./fonts/mathjax_config":114,"./lib/queue":129,"./plot_api/plot_schema":137,"./plot_api/register":138,"./plot_api/set_plot_config":139,"./plot_api/to_image":141,"./plot_api/validate":142,"./plotly":143,"./snapshot":192,"./snapshot/download":189,"./traces/scatter":279,"d3":14,"es6-promise":15}],114:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":28,"./components/images":65,"./components/legend":73,"./components/rangeselector":85,"./components/rangeslider":90,"./components/shapes":97,"./components/sliders":103,"./components/updatemenus":109,"./fonts/mathjax_config":114,"./lib/queue":130,"./plot_api/plot_schema":138,"./plot_api/register":139,"./plot_api/set_plot_config":140,"./plot_api/to_image":142,"./plot_api/validate":143,"./plotly":144,"./snapshot":193,"./snapshot/download":190,"./traces/scatter":281,"d3":14,"es6-promise":15}],114:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25498,22 +25497,50 @@ if(typeof MathJax !== 'undefined') { */ +'use strict'; + +var isNumeric = require('fast-isnumeric'); + +var BADNUM = require('../constants/numerical').BADNUM; + +// precompile these regex's for speed +var FRONTJUNK = /^['"%,$#\s']+/; +var ENDJUNK = /['"%,$#\s']+$/; + +/** + * cleanNumber: remove common leading and trailing cruft + * Always returns either a number or BADNUM. + */ +module.exports = function cleanNumber(v) { + if(typeof v === 'string') { + v = v.replace(FRONTJUNK, '').replace(ENDJUNK, ''); + } + + if(isNumeric(v)) return Number(v); + + return BADNUM; +}; + +},{"../constants/numerical":110,"fast-isnumeric":17}],116:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + 'use strict'; var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); -var nestedProperty = require('./nested_property'); -var isPlainObject = require('./is_plain_object'); -var filterUnique = require('./filter_unique'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); +var nestedProperty = require('./nested_property'); -var idRegex = /^([2-9]|[1-9][0-9]+)$/; - -function isValObject(obj) { - return obj && obj.valType !== undefined; -} +var ID_REGEX = /^([2-9]|[1-9][0-9]+)$/; exports.valObjects = { data_array: { @@ -25624,7 +25651,7 @@ exports.valObjects = { coerceFunction: function(v, propOut, dflt) { var dlen = dflt.length; if(typeof v === 'string' && v.substr(0, dlen) === dflt && - idRegex.test(v.substr(dlen))) { + ID_REGEX.test(v.substr(dlen))) { propOut.set(v); return; } @@ -25636,7 +25663,7 @@ exports.valObjects = { if(v === dflt) return true; if(typeof v !== 'string') return false; - if(v.substr(0, dlen) === dflt && idRegex.test(v.substr(dlen))) { + if(v.substr(0, dlen) === dflt && ID_REGEX.test(v.substr(dlen))) { return true; } @@ -25804,129 +25831,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -/* - * returns true for a valid value object and false for tree nodes in the attribute hierarchy - */ -exports.isValObject = isValObject; - -exports.IS_SUBPLOT_OBJ = '_isSubplotObj'; -exports.IS_LINKED_TO_ARRAY = '_isLinkedToArray'; -exports.DEPRECATED = '_deprecated'; - -// list of underscore attributes to keep in schema as is -exports.UNDERSCORE_ATTRS = [exports.IS_SUBPLOT_OBJ, exports.IS_LINKED_TO_ARRAY, exports.DEPRECATED]; - -/** - * Crawl the attribute tree, recursively calling a callback function - * - * @param {object} attrs - * The node of the attribute tree (e.g. the root) from which recursion originates - * @param {Function} callback - * A callback function with the signature: - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * @param {Number} [specifiedLevel] - * The level in the tree, in order to let the callback function detect descend or backtrack, - * typically unsupplied (implied 0), just used by the self-recursive call. - * The necessity arises because the tree traversal is not controlled by callback return values. - * The decision to not use callback return values for controlling tree pruning arose from - * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions - * precedes the callback call. - * - * @return {object} transformOut - * copy of transformIn that contains attribute defaults - */ -exports.crawl = function(attrs, callback, specifiedLevel) { - var level = specifiedLevel || 0; - Object.keys(attrs).forEach(function(attrName) { - var attr = attrs[attrName]; - - if(exports.UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - - callback(attr, attrName, attrs, level); - - if(isValObject(attr)) return; - if(isPlainObject(attr)) exports.crawl(attr, callback, level + 1); - }); -}; - -/** - * Find all data array attributes in a given trace object - including - * `arrayOk` attributes. - * - * @param {object} trace - * full trace object that contains a reference to `_module.attributes` - * - * @return {array} arrayAttributes - * list of array attributes for the given trace - */ -exports.findArrayAttributes = function(trace) { - var arrayAttributes = [], - stack = []; - - /** - * A closure that gathers attribute paths into its enclosed arraySplitAttributes - * Attribute paths are collected iff their leaf node is a splittable attribute - * - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * - * @closureVariable {String[][]} arrayAttributes the set of gathered attributes - * Example of filled closure variable (expected to be initialized to []): - * [["marker","size"],["marker","line","width"],["marker","line","color"]] - */ - function callback(attr, attrName, attrs, level) { - stack = stack.slice(0, level).concat([attrName]); - - var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; - if(!splittableAttr) return; - - var astr = toAttrString(stack); - var val = nestedProperty(trace, astr).get(); - if(!Array.isArray(val)) return; - - arrayAttributes.push(astr); - } - - function toAttrString(stack) { - return stack.join('.'); - } - - exports.crawl(trace._module.attributes, callback); - - if(trace.transforms) { - var transforms = trace.transforms; - - for(var i = 0; i < transforms.length; i++) { - var transform = transforms[i]; - - stack = ['transforms[' + i + ']']; - exports.crawl(transform._module.attributes, callback, 1); - } - } - - // Look into the fullInput module attributes for array attributes - // to make sure that 'custom' array attributes are detected. - // - // At the moment, we need this block to make sure that - // ohlc and candlestick 'open', 'high', 'low', 'close' can be - // used with filter ang groupby transforms. - if(trace._fullInput) { - exports.crawl(trace._fullInput._module.attributes, callback); - - arrayAttributes = filterUnique(arrayAttributes); - } - - return arrayAttributes; -}; - -},{"../components/colorscale/get_scale":43,"../components/colorscale/scales":49,"./filter_unique":119,"./is_plain_object":123,"./nested_property":126,"fast-isnumeric":17,"tinycolor2":20}],116:[function(require,module,exports){ +},{"../components/colorscale/get_scale":42,"../components/colorscale/scales":48,"./nested_property":127,"fast-isnumeric":17,"tinycolor2":20}],117:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25941,6 +25846,24 @@ exports.findArrayAttributes = function(trace) { var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); +var logError = require('./loggers').error; + +var constants = require('../constants/numerical'); +var BADNUM = constants.BADNUM; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + +// is an object a javascript date? +exports.isJSDate = function(v) { + return typeof v === 'object' && v !== null && typeof v.getTime === 'function'; +}; + +// The absolute limits of our date-time system +// This is a little weird: we use MIN_MS and MAX_MS in dateTime2ms +// but we use dateTime2ms to calculate them (after defining it!) +var MIN_MS, MAX_MS; /** * dateTime2ms - turn a date object or string s of the form @@ -25948,7 +25871,13 @@ var isNumeric = require('fast-isnumeric'); * per javascript standard) * may truncate after any full field, and sss can be any length * even >3 digits, though javascript dates truncate to milliseconds - * returns false if it doesn't find a date + * returns BADNUM if it doesn't find a date + * + * Expanded to support negative years to -9999 but you must always + * give 4 digits, except for 2-digit positive years which we assume are + * near the present time. + * Note that we follow ISO 8601:2004: there *is* a year 0, which + * is 1BC/BCE, and -1===2BC etc. * * 2-digit to 4-digit year conversion, where to cut off? * from http://support.microsoft.com/kb/244664: @@ -25956,85 +25885,123 @@ var isNumeric = require('fast-isnumeric'); * but in my mac chrome from eg. d=new Date(Date.parse('8/19/50')): * 1950-2049 * by Java, from http://stackoverflow.com/questions/2024273/: - * now-80 - now+20 + * now-80 - now+19 * or FileMaker Pro, from * http://www.filemaker.com/12help/html/add_view_data.4.21.html: - * now-70 - now+30 + * now-70 - now+29 * but python strptime etc, via * http://docs.python.org/py3k/library/time.html: * 1969-2068 (super forward-looking, but static, not sliding!) * - * lets go with now-70 to now+30, and if anyone runs into this problem + * lets go with now-70 to now+29, and if anyone runs into this problem * they can learn the hard way not to use 2-digit years, as no choice we * make now will cover all possibilities. mostly this will all be taken * care of in initial parsing, should only be an issue for hand-entered data - * currently (2012) this range is: - * 1942-2041 + * currently (2016) this range is: + * 1946-2045 */ exports.dateTime2ms = function(s) { // first check if s is a date object - try { - if(s.getTime) return +s; - } - catch(e) { - return false; + if(exports.isJSDate(s)) { + s = Number(s); + if(s >= MIN_MS && s <= MAX_MS) return s; + return BADNUM; } + // otherwise only accept strings and numbers + if(typeof s !== 'string' && typeof s !== 'number') return BADNUM; var y, m, d, h; // split date and time parts - var datetime = String(s).split(' '); - if(datetime.length > 2) return false; + // TODO: we strip leading/trailing whitespace but not other + // characters like we do for numbers - do we want to? + var datetime = String(s).trim().split(' '); + if(datetime.length > 2) return BADNUM; var p = datetime[0].split('-'); // date part - if(p.length > 3 || (p.length !== 3 && datetime[1])) return false; + + var CE = true; // common era, ie positive year + if(p[0] === '') { + // first part is blank: year starts with a minus sign + CE = false; + p.splice(0, 1); + } + + var plen = p.length; + if(plen > 3 || (plen !== 3 && datetime[1]) || !plen) return BADNUM; // year if(p[0].length === 4) y = Number(p[0]); else if(p[0].length === 2) { + if(!CE) return BADNUM; var yNow = new Date().getFullYear(); y = ((Number(p[0]) - yNow + 70) % 100 + 200) % 100 + yNow - 70; } - else return false; - if(!isNumeric(y)) return false; - if(p.length === 1) return new Date(y, 0, 1).getTime(); // year only + else return BADNUM; + if(!isNumeric(y)) return BADNUM; + + // javascript takes new Date(0..99,m,d) to mean 1900-1999, so + // to support years 0-99 we need to use setFullYear explicitly + var baseDate = new Date(0, 0, 1); + baseDate.setFullYear(CE ? y : -y); + if(p.length > 1) { - // month - m = Number(p[1]) - 1; // new Date() uses zero-based months - if(p[1].length > 2 || !(m >= 0 && m <= 11)) return false; - if(p.length === 2) return new Date(y, m, 1).getTime(); // year-month + // month - may be 1 or 2 digits + m = Number(p[1]) - 1; // new Date() uses zero-based months + if(p[1].length > 2 || !(m >= 0 && m <= 11)) return BADNUM; + baseDate.setMonth(m); - // day - d = Number(p[2]); - if(p[2].length > 2 || !(d >= 1 && d <= 31)) return false; + if(p.length > 2) { - // now save the date part - d = new Date(y, m, d).getTime(); - if(!datetime[1]) return d; // year-month-day - p = datetime[1].split(':'); - if(p.length > 3) return false; + // day - may be 1 or 2 digits + d = Number(p[2]); + if(p[2].length > 2 || !(d >= 1 && d <= 31)) return BADNUM; + baseDate.setDate(d); - // hour - h = Number(p[0]); - if(p[0].length > 2 || !(h >= 0 && h <= 23)) return false; - d += 3600000 * h; - if(p.length === 1) return d; + // does that date exist in this month? + if(baseDate.getDate() !== d) return BADNUM; - // minute - m = Number(p[1]); - if(p[1].length > 2 || !(m >= 0 && m <= 59)) return false; - d += 60000 * m; - if(p.length === 2) return d; + if(datetime[1]) { - // second - s = Number(p[2]); - if(!(s >= 0 && s < 60)) return false; - return d + s * 1000; + p = datetime[1].split(':'); + if(p.length > 3) return BADNUM; + + // hour - may be 1 or 2 digits + h = Number(p[0]); + if(p[0].length > 2 || !p[0].length || !(h >= 0 && h <= 23)) return BADNUM; + baseDate.setHours(h); + + // does that hour exist in this day? (Daylight time!) + // (TODO: remove this check when we move to UTC) + if(baseDate.getHours() !== h) return BADNUM; + + if(p.length > 1) { + d = baseDate.getTime(); + + // minute - must be 2 digits + m = Number(p[1]); + if(p[1].length !== 2 || !(m >= 0 && m <= 59)) return BADNUM; + d += ONEMIN * m; + if(p.length === 2) return d; + + // second (and milliseconds) - must have 2-digit seconds + if(p[2].split('.')[0].length !== 2) return BADNUM; + s = Number(p[2]); + if(!(s >= 0 && s < 60)) return BADNUM; + return d + s * ONESEC; + } + } + } + } + return baseDate.getTime(); }; +MIN_MS = exports.MIN_MS = exports.dateTime2ms('-9999'); +MAX_MS = exports.MAX_MS = exports.dateTime2ms('9999-12-31 23:59:59.9999'); + // is string s a date? (see above) exports.isDateTime = function(s) { - return (exports.dateTime2ms(s) !== false); + return (exports.dateTime2ms(s) !== BADNUM); }; // pad a number with zeroes, to given # of digits before the decimal point @@ -26043,224 +26010,68 @@ function lpad(val, digits) { } /** - * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.sss - * Crop any trailing zeros in time, but always leave full date - * (we could choose to crop '-01' from date too)... + * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.ssss + * Crop any trailing zeros in time, except never stop right after hours + * (we could choose to crop '-01' from date too but for now we always + * show the whole date) * Optional range r is the data range that applies, also in ms. * If rng is big, the later parts of time will be omitted */ +var NINETYDAYS = 90 * ONEDAY; +var THREEHOURS = 3 * ONEHOUR; +var FIVEMIN = 5 * ONEMIN; exports.ms2DateTime = function(ms, r) { + if(typeof ms !== 'number' || !(ms >= MIN_MS && ms <= MAX_MS)) return BADNUM; + if(!r) r = 0; - var d = new Date(ms), - s = d3.time.format('%Y-%m-%d')(d); - - if(r < 7776000000) { - // <90 days: add hours - s += ' ' + lpad(d.getHours(), 2); - if(r < 432000000) { - // <5 days: add minutes - s += ':' + lpad(d.getMinutes(), 2); - if(r < 10800000) { - // <3 hours: add seconds - s += ':' + lpad(d.getSeconds(), 2); - if(r < 300000) { - // <5 minutes: add ms - s += '.' + lpad(d.getMilliseconds(), 3); + var d = new Date(Math.floor(ms)), + dateStr = d3.time.format('%Y-%m-%d')(d), + // <90 days: add hours and minutes - never *only* add hours + h = (r < NINETYDAYS) ? d.getHours() : 0, + m = (r < NINETYDAYS) ? d.getMinutes() : 0, + // <3 hours: add seconds + s = (r < THREEHOURS) ? d.getSeconds() : 0, + // <5 minutes: add ms (plus one extra digit, this is msec*10) + msec10 = (r < FIVEMIN) ? Math.round((d.getMilliseconds() + (((ms % 1) + 1) % 1)) * 10) : 0; + + // include each part that has nonzero data in or after it + if(h || m || s || msec10) { + dateStr += ' ' + lpad(h, 2) + ':' + lpad(m, 2); + if(s || msec10) { + dateStr += ':' + lpad(s, 2); + if(msec10) { + var digits = 4; + while(msec10 % 10 === 0) { + digits -= 1; + msec10 /= 10; } + dateStr += '.' + lpad(msec10, digits); } } - // strip trailing zeros - return s.replace(/([:\s]00)*\.?[0]*$/, ''); } - return s; + return dateStr; }; -/** - * parseDate: forgiving attempt to turn any date string - * into a javascript date object - * - * first collate all the date formats we want to support, precompiled - * to d3 format objects see below for the string cleaning that happens - * before this separate out 2-digit (y) and 4-digit-year (Y) formats, - * formats with month names (b), and formats with am/pm (I) or no time (D) - * (also includes hour only, as the test is really for a colon) so we can - * cut down the number of tests we need to run for any given string - * (right now all are between 15 and 32 tests) - */ - -// TODO: this is way out of date vs. the server-side version -var timeFormats = { - // 24 hour - H: ['%H:%M:%S~%L', '%H:%M:%S', '%H:%M'], - // with am/pm - I: ['%I:%M:%S~%L%p', '%I:%M:%S%p', '%I:%M%p'], - // no colon, ie only date or date with hour (could also support eg 12h34m?) - D: ['%H', '%I%p', '%Hh'] -}; - -var dateFormats = { - Y: [ - '%Y~%m~%d', - '%Y%m%d', - '%y%m%d', // YYMMDD, has 6 digits together so will match Y, not y - '%m~%d~%Y', // MM/DD/YYYY has first precedence - '%d~%m~%Y' // then DD/MM/YYYY - ], - Yb: [ - '%b~%d~%Y', // eg nov 21 2013 - '%d~%b~%Y', // eg 21 nov 2013 - '%Y~%d~%b', // eg 2013 21 nov (or 2013 q3, after replacement) - '%Y~%b~%d' // eg 2013 nov 21 - ], - /** - * the two-digit year cases have so many potential ambiguities - * it's not even funny, but we'll try them anyway. - */ - y: [ - '%m~%d~%y', - '%d~%m~%y', - '%y~%m~%d' - ], - yb: [ - '%b~%d~%y', - '%d~%b~%y', - '%y~%d~%b', - '%y~%b~%d' - ] -}; - -// use utc formatter since we're ignoring timezone info -var formatter = d3.time.format.utc; - -/** - * ISO8601 and YYYYMMDDHHMMSS are the only ones where date and time - * are not separated by a space, so they get inserted specially here. - * Also a couple formats with no day (so time makes no sense) - */ -var dateTimeFormats = { - Y: { - H: ['%Y~%m~%dT%H:%M:%S', '%Y~%m~%dT%H:%M:%S~%L'].map(formatter), - I: [], - D: ['%Y%m%d%H%M%S', '%Y~%m', '%m~%Y'].map(formatter) - }, - Yb: {H: [], I: [], D: ['%Y~%b', '%b~%Y'].map(formatter)}, - y: {H: [], I: [], D: []}, - yb: {H: [], I: [], D: []} -}; -// all others get inserted in all possible combinations from dateFormats and timeFormats -['Y', 'Yb', 'y', 'yb'].forEach(function(dateType) { - dateFormats[dateType].forEach(function(dateFormat) { - // just a date (don't do just a time) - dateTimeFormats[dateType].D.push(formatter(dateFormat)); - ['H', 'I', 'D'].forEach(function(timeType) { - timeFormats[timeType].forEach(function(timeFormat) { - var a = dateTimeFormats[dateType][timeType]; - - // 'date time', then 'time date' - a.push(formatter(dateFormat + '~' + timeFormat)); - a.push(formatter(timeFormat + '~' + dateFormat)); - }); - }); - }); -}); - -// precompiled regexps for performance -var matchword = /[a-z]*/g, - shortenword = function(m) { return m.substr(0, 3); }, - weekdaymatch = /(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g, - separatormatch = /[\s,\/\-\.\(\)]+/g, - ampmmatch = /~?([ap])~?m(~|$)/, - replaceampm = function(m, ap) { return ap + 'm '; }, - match4Y = /\d\d\d\d/, - matchMonthName = /(^|~)[a-z]{3}/, - matchAMPM = /[ap]m/, - matchcolon = /:/, - matchquarter = /q([1-4])/, - quarters = ['31~mar', '30~jun', '30~sep', '31~dec'], - replacequarter = function(m, n) { return quarters[n - 1]; }, - matchTZ = / ?([+\-]\d\d:?\d\d|Z)$/; - -function getDateType(v) { - var dateType; - dateType = (match4Y.test(v) ? 'Y' : 'y'); - dateType = dateType + (matchMonthName.test(v) ? 'b' : ''); - return dateType; -} - -function getTimeType(v) { - var timeType; - timeType = matchcolon.test(v) ? (matchAMPM.test(v) ? 'I' : 'H') : 'D'; - return timeType; -} - -exports.parseDate = function(v) { - // is it already a date? just return it - if(v.getTime) return v; - /** - * otherwise, if it's not a string, return nothing - * the case of numbers that just have years will get - * dealt with elsewhere. - */ - if(typeof v !== 'string') return false; - - // first clean up the string a bit to reduce the number of formats we have to test - v = v.toLowerCase() - /** - * cut all words down to 3 characters - this will result in - * some spurious matches, ie whenever the first three characters - * of a word match a month or weekday but that seems more likely - * to fix typos than to make dates where they shouldn't be... - * and then we can omit the long form of months from our testing - */ - .replace(matchword, shortenword) - /** - * remove weekday names, as they get overridden anyway if they're - * inconsistent also removes a few more words - * (ie "tuesday the 26th of november") - * TODO: language support? - * for months too, but these seem to be built into d3 - */ - .replace(weekdaymatch, '') - /** - * collapse all separators one ~ at a time, except : which seems - * pretty consistent for the time part use ~ instead of space or - * something since d3 can eat a space as padding on 1-digit numbers - */ - .replace(separatormatch, '~') - // in case of a.m. or p.m. (also take off any space before am/pm) - .replace(ampmmatch, replaceampm) - // turn quarters Q1-4 into dates (quarter ends) - .replace(matchquarter, replacequarter) - .trim() - // also try to ignore timezone info, at least for now - .replace(matchTZ, ''); - - // now test against the various formats that might match - var out = null, - dateType = getDateType(v), - timeType = getTimeType(v), - formatList, - len; - - formatList = dateTimeFormats[dateType][timeType]; - len = formatList.length; - - for(var i = 0; i < len; i++) { - out = formatList[i].parse(v); - if(out) break; +// normalize date format to date string, in case it starts as +// a Date object or milliseconds +// optional dflt is the return value if cleaning fails +exports.cleanDate = function(v, dflt) { + if(exports.isJSDate(v) || typeof v === 'number') { + // NOTE: if someone puts in a year as a number rather than a string, + // this will mistakenly convert it thinking it's milliseconds from 1970 + // that is: '2012' -> Jan. 1, 2012, but 2012 -> 2012 epoch milliseconds + v = exports.ms2DateTime(+v); + if(!v && dflt !== undefined) return dflt; } - - // If not an instance of Date at this point, just return it. - if(!(out instanceof Date)) return false; - // parse() method interprets arguments with local time zone. - var tzoff = out.getTimezoneOffset(); - // In general (default) this is not what we want, so force into UTC: - out.setTime(out.getTime() + tzoff * 60 * 1000); - return out; + else if(!exports.isDateTime(v)) { + logError('unrecognized date', v); + return dflt; + } + return v; }; -},{"d3":14,"fast-isnumeric":17}],117:[function(require,module,exports){ +},{"../constants/numerical":110,"./loggers":125,"d3":14,"fast-isnumeric":17}],118:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26426,7 +26237,7 @@ var Events = { module.exports = Events; -},{"events":16}],118:[function(require,module,exports){ +},{"events":16}],119:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26540,7 +26351,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":123}],119:[function(require,module,exports){ +},{"./is_plain_object.js":124}],120:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26591,7 +26402,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],120:[function(require,module,exports){ +},{}],121:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26603,19 +26414,26 @@ module.exports = function filterUnique(array) { 'use strict'; -module.exports = function filterVisible(dataIn) { - var dataOut = []; +/** Filter out object items with visible !== true + * insider array container. + * + * @param {array of objects} container + * @return {array of objects} of length <= container + * + */ +module.exports = function filterVisible(container) { + var out = []; - for(var i = 0; i < dataIn.length; i++) { - var trace = dataIn[i]; + for(var i = 0; i < container.length; i++) { + var item = container[i]; - if(trace.visible === true) dataOut.push(trace); + if(item.visible === true) out.push(item); } - return dataOut; + return out; }; -},{}],121:[function(require,module,exports){ +},{}],122:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26641,19 +26459,15 @@ lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; lib.validate = coerceModule.validate; -lib.isValObject = coerceModule.isValObject; -lib.crawl = coerceModule.crawl; -lib.findArrayAttributes = coerceModule.findArrayAttributes; -lib.IS_SUBPLOT_OBJ = coerceModule.IS_SUBPLOT_OBJ; -lib.IS_LINKED_TO_ARRAY = coerceModule.IS_LINKED_TO_ARRAY; -lib.DEPRECATED = coerceModule.DEPRECATED; -lib.UNDERSCORE_ATTRS = coerceModule.UNDERSCORE_ATTRS; var datesModule = require('./dates'); lib.dateTime2ms = datesModule.dateTime2ms; lib.isDateTime = datesModule.isDateTime; lib.ms2DateTime = datesModule.ms2DateTime; -lib.parseDate = datesModule.parseDate; +lib.cleanDate = datesModule.cleanDate; +lib.isJSDate = datesModule.isJSDate; +lib.MIN_MS = datesModule.MIN_MS; +lib.MAX_MS = datesModule.MAX_MS; var searchModule = require('./search'); lib.findBin = searchModule.findBin; @@ -26694,6 +26508,10 @@ lib.error = loggersModule.error; lib.notifier = require('./notifier'); lib.filterUnique = require('./filter_unique'); +lib.filterVisible = require('./filter_visible'); + + +lib.cleanNumber = require('./clean_number'); /** * swap x and y of the same attribute in container cont @@ -26870,7 +26688,7 @@ lib.smooth = function(arrayIn, FWHM) { * as long as its returns are not promises (ie have no .then) * includes one argument arg to send to all functions... * this is mainly just to prevent us having to make wrapper functions - * when the only purpose of the wrapper is to reference gd / td + * when the only purpose of the wrapper is to reference gd * and a final step to be executed at the end * TODO: if there's an error and everything is sync, * this doesn't happen yet because we want to make sure @@ -27343,7 +27161,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./coerce":115,"./dates":116,"./extend":118,"./filter_unique":119,"./is_array":122,"./is_plain_object":123,"./loggers":124,"./matrix":125,"./nested_property":126,"./notifier":127,"./search":130,"./stats":132,"d3":14}],122:[function(require,module,exports){ +},{"./clean_number":115,"./coerce":116,"./dates":117,"./extend":119,"./filter_unique":120,"./filter_visible":121,"./is_array":123,"./is_plain_object":124,"./loggers":125,"./matrix":126,"./nested_property":127,"./notifier":128,"./search":131,"./stats":133,"d3":14}],123:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27361,7 +27179,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ArrayBuffer.isView(a); }; -},{}],123:[function(require,module,exports){ +},{}],124:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27390,7 +27208,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],124:[function(require,module,exports){ +},{}],125:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27457,7 +27275,7 @@ loggers.error = function() { } }; -},{"../plot_api/plot_config":136}],125:[function(require,module,exports){ +},{"../plot_api/plot_config":137}],126:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27567,7 +27385,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],126:[function(require,module,exports){ +},{}],127:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27824,7 +27642,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./is_array":122,"fast-isnumeric":17}],127:[function(require,module,exports){ +},{"./is_array":123,"fast-isnumeric":17}],128:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27901,7 +27719,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":14,"fast-isnumeric":17}],128:[function(require,module,exports){ +},{"d3":14,"fast-isnumeric":17}],129:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28141,7 +27959,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"./matrix":125}],129:[function(require,module,exports){ +},{"./matrix":126}],130:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28352,7 +28170,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":121,"../plot_api/plot_config":136}],130:[function(require,module,exports){ +},{"../lib":122,"../plot_api/plot_config":137}],131:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28463,7 +28281,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":124,"fast-isnumeric":17}],131:[function(require,module,exports){ +},{"./loggers":125,"fast-isnumeric":17}],132:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28486,7 +28304,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],132:[function(require,module,exports){ +},{}],133:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28582,7 +28400,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":17}],133:[function(require,module,exports){ +},{"fast-isnumeric":17}],134:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28696,8 +28514,8 @@ exports.convertToTspans = function(_context, _callback) { } if(tex) { - var td = Lib.getPlotDiv(that.node()); - ((td && td._promises) || []).push(new Promise(function(resolve) { + var gd = Lib.getPlotDiv(that.node()); + ((gd && gd._promises) || []).push(new Promise(function(resolve) { that.style({visibility: 'hidden'}); var config = {fontSize: parseInt(that.style('font-size'), 10)}; @@ -29109,7 +28927,7 @@ exports.makeEditable = function(context, _delegate, options) { return d3.rebind(this, dispatch, 'on'); }; -},{"../constants/string_mappings":111,"../constants/xmlns_namespaces":112,"../lib":121,"d3":14}],134:[function(require,module,exports){ +},{"../constants/string_mappings":111,"../constants/xmlns_namespaces":112,"../lib":122,"d3":14}],135:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -29214,13 +29032,12 @@ exports.cleanLayout = function(layout) { } } - if(layout.annotations !== undefined && !Array.isArray(layout.annotations)) { - Lib.warn('Annotations must be an array.'); - delete layout.annotations; - } - var annotationsLen = (layout.annotations || []).length; + var annotationsLen = Array.isArray(layout.annotations) ? layout.annotations.length : 0; for(i = 0; i < annotationsLen; i++) { var ann = layout.annotations[i]; + + if(!Lib.isPlainObject(ann)) continue; + if(ann.ref) { if(ann.ref === 'paper') { ann.xref = 'paper'; @@ -29232,17 +29049,17 @@ exports.cleanLayout = function(layout) { } delete ann.ref; } + cleanAxRef(ann, 'xref'); cleanAxRef(ann, 'yref'); } - if(layout.shapes !== undefined && !Array.isArray(layout.shapes)) { - Lib.warn('Shapes must be an array.'); - delete layout.shapes; - } - var shapesLen = (layout.shapes || []).length; + var shapesLen = Array.isArray(layout.shapes) ? layout.shapes.length : 0; for(i = 0; i < shapesLen; i++) { var shape = layout.shapes[i]; + + if(!Lib.isPlainObject(shape)) continue; + cleanAxRef(shape, 'xref'); cleanAxRef(shape, 'yref'); } @@ -29591,7 +29408,7 @@ exports.manageArrayContainers = function(np, newVal, undoit) { } }; -},{"../components/color":30,"../lib":121,"../plots/cartesian/axes":147,"../plots/plots":172,"../registry":187,"fast-isnumeric":17,"gl-mat4/fromQuat":18}],135:[function(require,module,exports){ +},{"../components/color":30,"../lib":122,"../plots/cartesian/axes":149,"../plots/plots":173,"../registry":188,"fast-isnumeric":17,"gl-mat4/fromQuat":18}],136:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -31511,13 +31328,14 @@ function _relayout(gd, aobj) { objList = layout[objType] || [], obji = objList[objNum] || {}; - // new API, remove annotation / shape with `null` - if(vi === null) aobj[ai] = 'remove'; - // if p.parts is just an annotation number, and val is either // 'add' or an entire annotation to add, the undo is 'remove' // if val is 'remove' then undo is the whole annotation object if(p.parts.length === 2) { + + // new API, remove annotation / shape with `null` + if(vi === null) aobj[ai] = 'remove'; + if(aobj[ai] === 'add' || Lib.isPlainObject(aobj[ai])) { undoit[ai] = 'remove'; } @@ -31552,6 +31370,7 @@ function _relayout(gd, aobj) { } // alter gd.layout else { + var pp1 = String(p.parts[1] || ''); // check whether we can short-circuit a full redraw // 3d or geo at this point just needs to redraw. if(p.parts[0].indexOf('scene') === 0) flags.doplot = true; @@ -31566,17 +31385,17 @@ function _relayout(gd, aobj) { else if(ai.indexOf('title') !== -1) flags.doticks = true; else if(p.parts[0].indexOf('bgcolor') !== -1) flags.dolayoutstyle = true; else if(p.parts.length > 1 && - Lib.containsAny(p.parts[1], ['tick', 'exponent', 'grid', 'zeroline'])) { + Lib.containsAny(pp1, ['tick', 'exponent', 'grid', 'zeroline'])) { flags.doticks = true; } else if(ai.indexOf('.linewidth') !== -1 && ai.indexOf('axis') !== -1) { flags.doticks = flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1].indexOf('line') !== -1) { + else if(p.parts.length > 1 && pp1.indexOf('line') !== -1) { flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1] === 'mirror') { + else if(p.parts.length > 1 && pp1 === 'mirror') { flags.doticks = flags.dolayoutstyle = true; } else if(ai === 'margin.pad') { @@ -31598,7 +31417,7 @@ function _relayout(gd, aobj) { */ else if(['hovermode', 'dragmode'].indexOf(ai) !== -1) flags.domodebar = true; else if(['hovermode', 'dragmode', 'height', - 'width', 'autosize'].indexOf(ai) === -1) { + 'width', 'autosize'].indexOf(ai) === -1) { flags.doplot = true; } @@ -31807,6 +31626,20 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } } + // Execute a callback after the wrapper function has been called n times. + // This is used to defer the resolution until a transition has resovled *and* + // the frame has completed. If it's not done this way, then we get a race + // condition in which the animation might resolve before a transition is complete + // or vice versa. + function callbackOnNthTime(cb, n) { + var cnt = 0; + return function() { + if(cb && ++cnt === n) { + return cb(); + } + }; + } + return new Promise(function(resolve, reject) { function discardExistingFrames() { if(trans._frameQueue.length === 0) { @@ -31851,14 +31684,13 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { frameOpts: frameOpts, transitionOpts: transitionOpts, }; - if(i === frameList.length - 1) { // The last frame in this .animate call stores the promise resolve // and reject callbacks. This is how we ensure that the animation // loop (which may exist as a result of a *different* .animate call) // still resolves or rejecdts this .animate call's promise. once it's // complete. - nextFrame.onComplete = resolve; + nextFrame.onComplete = callbackOnNthTime(resolve, 2); nextFrame.onInterrupt = reject; } @@ -31896,7 +31728,6 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { // Execute the callback and unset it to ensure it doesn't // accidentally get called twice trans._currentFrame.onComplete(); - trans._currentFrame.onComplete = null; } var newFrame = trans._currentFrame = trans._frameQueue.shift(); @@ -31916,7 +31747,12 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { helpers.coerceTraceIndices(gd, newFrame.frame.traces), newFrame.frameOpts, newFrame.transitionOpts - ); + ).then(function() { + if(newFrame.onComplete) { + newFrame.onComplete(); + } + + }); gd.emit('plotly_animatingframe', { name: newFrame.name, @@ -31992,6 +31828,8 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { for(i = 0; i < trans._frames.length; i++) { frame = trans._frames[i]; + if(!frame) continue; + if(allFrames || frame.group === frameOrGroupNameOrFrameList) { frameList.push({ type: 'byname', @@ -32003,14 +31841,15 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } else if(isFrameArray) { for(i = 0; i < frameOrGroupNameOrFrameList.length; i++) { var frameOrName = frameOrGroupNameOrFrameList[i]; - if(typeof frameOrName === 'string') { + if(['number', 'string'].indexOf(typeof frameOrName) !== -1) { + frameOrName = String(frameOrName); // In this case, there's an array and this frame is a string name: frameList.push({ type: 'byname', name: frameOrName, data: setTransitionConfig({name: frameOrName}) }); - } else { + } else if(Lib.isPlainObject(frameOrName)) { frameList.push({ type: 'object', data: setTransitionConfig(Lib.extendFlat({}, frameOrName)) @@ -32154,7 +31993,7 @@ Plotly.addFrames = function(gd, frameList, indices) { if(_hash[frame.name]) { // If frame is present, overwrite its definition: for(j = 0; j < _frames.length; j++) { - if(_frames[j].name === frame.name) break; + if((_frames[j] || {}).name === frame.name) break; } ops.push({type: 'replace', index: j, value: frame}); revops.unshift({type: 'replace', index: j, value: _frames[j]}); @@ -32354,7 +32193,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":54,"../components/errorbars":60,"../constants/xmlns_namespaces":112,"../lib":121,"../lib/events":117,"../lib/queue":129,"../lib/svg_text_utils":133,"../plotly":143,"../plots/cartesian/graph_interact":155,"../plots/plots":172,"../plots/polar":175,"../registry":187,"./helpers":134,"./subroutines":140,"d3":14,"fast-isnumeric":17}],136:[function(require,module,exports){ +},{"../components/drawing":53,"../components/errorbars":59,"../constants/xmlns_namespaces":112,"../lib":122,"../lib/events":118,"../lib/queue":130,"../lib/svg_text_utils":134,"../plotly":144,"../plots/cartesian/graph_interact":156,"../plots/plots":173,"../plots/polar":176,"../registry":188,"./helpers":135,"./subroutines":141,"d3":14,"fast-isnumeric":17}],137:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -32474,7 +32313,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],137:[function(require,module,exports){ +},{}],138:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -32486,185 +32325,287 @@ function defaultSetBackground(gd, bgColor) { 'use strict'; -var Plotly = require('../plotly'); var Registry = require('../registry'); -var Plots = require('../plots/plots'); var Lib = require('../lib'); -// FIXME polar attribute are not part of Plotly yet +var baseAttributes = require('../plots/attributes'); +var baseLayoutAttributes = require('../plots/layout_attributes'); +var frameAttributes = require('../plots/frame_attributes'); +var animationAttributes = require('../plots/animation_attributes'); + +// polar attributes are not part of the Registry yet var polarAreaAttrs = require('../plots/polar/area_attributes'); var polarAxisAttrs = require('../plots/polar/axis_attributes'); var extendFlat = Lib.extendFlat; var extendDeep = Lib.extendDeep; -var extendDeepAll = Lib.extendDeepAll; -var NESTED_MODULE = '_nestedModules', - COMPOSED_MODULE = '_composedModules'; +var IS_SUBPLOT_OBJ = '_isSubplotObj'; +var IS_LINKED_TO_ARRAY = '_isLinkedToArray'; +var DEPRECATED = '_deprecated'; +var UNDERSCORE_ATTRS = [IS_SUBPLOT_OBJ, IS_LINKED_TO_ARRAY, DEPRECATED]; -var plotSchema = { - traces: {}, - layout: {}, - transforms: {}, - defs: {} -}; +exports.IS_SUBPLOT_OBJ = IS_SUBPLOT_OBJ; +exports.IS_LINKED_TO_ARRAY = IS_LINKED_TO_ARRAY; +exports.DEPRECATED = DEPRECATED; +exports.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS; +/** Outputs the full plotly.js plot schema + * + * @return {object} + * - defs + * - traces + * - layout + * - transforms + * - frames + * - animations + * - config (coming soon ...) + */ +exports.get = function() { + var traces = {}; -var PlotSchema = module.exports = {}; + Registry.allTypes.concat('area').forEach(function(type) { + traces[type] = getTraceAttributes(type); + }); + var transforms = {}; -PlotSchema.get = function() { - Registry.allTypes - .concat('area') // FIXME polar 'area' attributes - .forEach(getTraceAttributes); + Object.keys(Registry.transformsRegistry).forEach(function(type) { + transforms[type] = getTransformAttributes(type); + }); - getLayoutAttributes(); + return { + defs: { + valObjects: Lib.valObjects, + metaKeys: UNDERSCORE_ATTRS.concat['description', 'role'] + }, - Object.keys(Registry.transformsRegistry).forEach(getTransformAttributes); + traces: traces, + layout: getLayoutAttributes(), - getDefs(); + transforms: transforms, - return plotSchema; + frames: formatAttributes(frameAttributes), + animation: formatAttributes(animationAttributes) + }; }; -PlotSchema.crawl = Lib.crawl; +/** + * Crawl the attribute tree, recursively calling a callback function + * + * @param {object} attrs + * The node of the attribute tree (e.g. the root) from which recursion originates + * @param {Function} callback + * A callback function with the signature: + * @callback callback + * @param {object} attr an attribute + * @param {String} attrName name string + * @param {object[]} attrs all the attributes + * @param {Number} level the recursion level, 0 at the root + * @param {Number} [specifiedLevel] + * The level in the tree, in order to let the callback function detect descend or backtrack, + * typically unsupplied (implied 0), just used by the self-recursive call. + * The necessity arises because the tree traversal is not controlled by callback return values. + * The decision to not use callback return values for controlling tree pruning arose from + * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions + * precedes the callback call. + * + * @return {object} transformOut + * copy of transformIn that contains attribute defaults + */ +exports.crawl = function(attrs, callback, specifiedLevel) { + var level = specifiedLevel || 0; -PlotSchema.isValObject = Lib.isValObject; + Object.keys(attrs).forEach(function(attrName) { + var attr = attrs[attrName]; -function getTraceAttributes(type) { - var globalAttributes = Plots.attributes, - _module = getModule({type: type}), - meta = getMeta(type), - subplotRegistry = getSubplotRegistry(type); + if(UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - var attributes = {}, - layoutAttributes = {}; + callback(attr, attrName, attrs, level); - // make 'type' the first attribute in the object - attributes.type = null; + if(exports.isValObject(attr)) return; - // global attributes (same for all trace types) - extendDeep(attributes, globalAttributes); + if(Lib.isPlainObject(attr)) exports.crawl(attr, callback, level + 1); + }); +}; - // module attributes (+ nested + composed) - attributes = coupleAttrs( - _module.attributes, attributes, 'attributes', type - ); +/** Is object a value object (or a container object)? + * + * @param {object} obj + * @return {boolean} + * returns true for a valid value object and + * false for tree nodes in the attribute hierarchy + */ +exports.isValObject = function(obj) { + return obj && obj.valType !== undefined; +}; - // subplot attributes - if(subplotRegistry.attributes !== undefined) { - extendDeep(attributes, subplotRegistry.attributes); +/** + * Find all data array attributes in a given trace object - including + * `arrayOk` attributes. + * + * @param {object} trace + * full trace object that contains a reference to `_module.attributes` + * + * @return {array} arrayAttributes + * list of array attributes for the given trace + */ +exports.findArrayAttributes = function(trace) { + var arrayAttributes = [], + stack = []; + + function callback(attr, attrName, attrs, level) { + stack = stack.slice(0, level).concat([attrName]); + + var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; + if(!splittableAttr) return; + + var astr = toAttrString(stack); + var val = Lib.nestedProperty(trace, astr).get(); + if(!Array.isArray(val)) return; + + arrayAttributes.push(astr); } - // 'type' gets overwritten by globalAttributes; reset it here - attributes.type = type; + function toAttrString(stack) { + return stack.join('.'); + } - attributes = removeUnderscoreAttrs(attributes); - mergeValTypeAndRole(attributes); - plotSchema.traces[type] = extendFlat({}, - meta, - { attributes: attributes } - ); + exports.crawl(trace._module.attributes, callback); - // trace-specific layout attributes - if(_module.layoutAttributes !== undefined) { - layoutAttributes = coupleAttrs( - _module.layoutAttributes, layoutAttributes, 'layoutAttributes', type - ); + if(trace.transforms) { + var transforms = trace.transforms; + + for(var i = 0; i < transforms.length; i++) { + var transform = transforms[i]; - mergeValTypeAndRole(layoutAttributes); - plotSchema.traces[type].layoutAttributes = layoutAttributes; + stack = ['transforms[' + i + ']']; + exports.crawl(transform._module.attributes, callback, 1); + } } -} -function getLayoutAttributes() { - var globalLayoutAttributes = Plots.layoutAttributes, - layoutAttributes = {}; + // Look into the fullInput module attributes for array attributes + // to make sure that 'custom' array attributes are detected. + // + // At the moment, we need this block to make sure that + // ohlc and candlestick 'open', 'high', 'low', 'close' can be + // used with filter ang groupby transforms. + if(trace._fullInput) { + exports.crawl(trace._fullInput._module.attributes, callback); - // layout module attributes (+ nested + composed) - layoutAttributes = coupleAttrs( - globalLayoutAttributes, layoutAttributes, 'layoutAttributes', '*' - ); + arrayAttributes = Lib.filterUnique(arrayAttributes); + } - // FIXME polar layout attributes - layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); + return arrayAttributes; +}; - // add crawler.IS_SUBPLOT_OBJ attribute - layoutAttributes = handleSubplotObjs(layoutAttributes); +function getTraceAttributes(type) { + var _module, basePlotModule; - layoutAttributes = removeUnderscoreAttrs(layoutAttributes); - mergeValTypeAndRole(layoutAttributes); + if(type === 'area') { + _module = { attributes: polarAreaAttrs }; + basePlotModule = {}; + } + else { + _module = Registry.modules[type]._module, + basePlotModule = _module.basePlotModule; + } - // generate crawler.IS_LINKED_TO_ARRAY structure - handleLinkedToArray(layoutAttributes); + var attributes = {}; - plotSchema.layout = { layoutAttributes: layoutAttributes }; -} + // make 'type' the first attribute in the object + attributes.type = null; -function getTransformAttributes(name) { - var _module = Registry.transformsRegistry[name], - _schema = {}; + // base attributes (same for all trace types) + extendDeep(attributes, baseAttributes); - _schema = coupleAttrs(_schema, _module.attributes || {}, 'attributes', '*'); - _schema = removeUnderscoreAttrs(_schema); - mergeValTypeAndRole(_schema); - handleLinkedToArray(_schema); + // module attributes + extendDeep(attributes, _module.attributes); - plotSchema.transforms[name] = { attributes: _schema }; -} + // subplot attributes + if(basePlotModule.attributes) { + extendDeep(attributes, basePlotModule.attributes); + } -function getDefs() { - plotSchema.defs = { - valObjects: Lib.valObjects, - metaKeys: Lib.UNDERSCORE_ATTRS.concat(['description', 'role']) + // 'type' gets overwritten by baseAttributes; reset it here + attributes.type = type; + + var out = { + meta: _module.meta || {}, + attributes: formatAttributes(attributes), }; + + // trace-specific layout attributes + if(_module.layoutAttributes) { + var layoutAttributes = {}; + + extendDeep(layoutAttributes, _module.layoutAttributes); + out.layoutAttributes = formatAttributes(layoutAttributes); + } + + return out; } -function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) { - var nestedModule, nestedAttrs, nestedReference, - composedModule, composedAttrs; +function getLayoutAttributes() { + var layoutAttributes = {}; - Object.keys(attrsIn).forEach(function(k) { + // global layout attributes + extendDeep(layoutAttributes, baseLayoutAttributes); - if(k === NESTED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - nestedModule = getModule({_module: attrsIn[k][kk]}); - if(nestedModule === undefined) return; + // add base plot module layout attributes + Object.keys(Registry.subplotsRegistry).forEach(function(k) { + var _module = Registry.subplotsRegistry[k]; - nestedAttrs = nestedModule[whichAttrs]; - nestedReference = coupleAttrs( - nestedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - Lib.nestedProperty(attrsOut, kk) - .set(extendDeep({}, nestedReference)); - }); - return; + if(_module.name === 'cartesian') { + handleBasePlotModule(layoutAttributes, _module, 'xaxis'); + handleBasePlotModule(layoutAttributes, _module, 'yaxis'); + } + else { + var astr = _module.attr === 'subplot' ? _module.name : _module.attr; + + handleBasePlotModule(layoutAttributes, _module, astr); } + }); - if(k === COMPOSED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - if(kk !== type) return; + // polar layout attributes + layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); - composedModule = getModule({_module: attrsIn[k][kk]}); - if(composedModule === undefined) return; + // add registered components layout attribute + Object.keys(Registry.componentsRegistry).forEach(function(k) { + var _module = Registry.componentsRegistry[k]; - composedAttrs = composedModule[whichAttrs]; - composedAttrs = coupleAttrs( - composedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - extendDeepAll(attrsOut, composedAttrs); + if(Array.isArray(_module.layoutNodes)) { + _module.layoutNodes.forEach(function(v) { + handleRegisteredComponent(layoutAttributes, _module, v + _module.name); }); - return; } - - attrsOut[k] = Lib.isPlainObject(attrsIn[k]) ? - extendDeepAll({}, attrsIn[k]) : - attrsIn[k]; + else { + handleRegisteredComponent(layoutAttributes, _module, _module.name); + } }); - return attrsOut; + return { + layoutAttributes: formatAttributes(layoutAttributes) + }; +} + +function getTransformAttributes(type) { + var _module = Registry.transformsRegistry[type]; + + return { + attributes: formatAttributes(_module.attributes) + }; +} + +function formatAttributes(attrs) { + mergeValTypeAndRole(attrs); + formatArrayContainers(attrs); + + return attrs; } function mergeValTypeAndRole(attrs) { @@ -32678,7 +32619,7 @@ function mergeValTypeAndRole(attrs) { } function callback(attr, attrName, attrs) { - if(PlotSchema.isValObject(attr)) { + if(exports.isValObject(attr)) { if(attr.valType === 'data_array') { // all 'data_array' attrs have role 'data' attr.role = 'data'; @@ -32696,40 +32637,26 @@ function mergeValTypeAndRole(attrs) { } } - Lib.crawl(attrs, callback); + exports.crawl(attrs, callback); } -// helper methods +function formatArrayContainers(attrs) { -function getModule(arg) { - if('type' in arg) { - return (arg.type === 'area') ? // FIXME - { attributes: polarAreaAttrs } : - Registry.getModule({type: arg.type}); - } + function callback(attr, attrName, attrs) { + if(!attr) return; - var subplotsRegistry = Registry.subplotsRegistry, - componentsRegistry = Registry.componentsRegistry, - _module = arg._module; + var itemName = attr[IS_LINKED_TO_ARRAY]; - if(subplotsRegistry[_module]) return subplotsRegistry[_module]; - else if(componentsRegistry[_module]) return componentsRegistry[_module]; + if(!itemName) return; - // look it internal Plotly if all previous attempts fail - return Plotly[_module]; -} + delete attr[IS_LINKED_TO_ARRAY]; -function removeUnderscoreAttrs(attributes) { - Object.keys(attributes).forEach(function(k) { - if(k.charAt(0) === '_' && - Lib.UNDERSCORE_ATTRS.indexOf(k) === -1) delete attributes[k]; - }); - return attributes; -} + attrs[attrName] = { items: {} }; + attrs[attrName].items[itemName] = attr; + attrs[attrName].role = 'object'; + } -function getMeta(type) { - if(type === 'area') return {}; // FIXME - return Registry.modules[type].meta || {}; + exports.crawl(attrs, callback); } function assignPolarLayoutAttrs(layoutAttributes) { @@ -32740,68 +32667,25 @@ function assignPolarLayoutAttrs(layoutAttributes) { extendFlat(layoutAttributes, polarAxisAttrs.layout); - return layoutAttributes; // FIXME -} - -function getSubplotRegistry(traceType) { - if(traceType === 'area') return {}; // FIXME - - var subplotsRegistry = Registry.subplotsRegistry, - subplotType = Object.keys(subplotsRegistry).filter(function(subplotType) { - return Registry.traceIs({type: traceType}, subplotType); - })[0]; - - if(subplotType === undefined) return {}; - - return subplotsRegistry[subplotType]; -} - -function handleSubplotObjs(layoutAttributes) { - var subplotsRegistry = Registry.subplotsRegistry; - - Object.keys(layoutAttributes).forEach(function(k) { - Object.keys(subplotsRegistry).forEach(function(subplotType) { - var subplotRegistry = subplotsRegistry[subplotType], - isSubplotObj; - - if(!subplotRegistry.attrRegex) return; - - if(subplotType === 'cartesian' || subplotType === 'gl2d') { - isSubplotObj = ( - subplotRegistry.attrRegex.x.test(k) || - subplotRegistry.attrRegex.y.test(k) - ); - } - else { - isSubplotObj = subplotRegistry.attrRegex.test(k); - } - - if(isSubplotObj) layoutAttributes[k][Lib.IS_SUBPLOT_OBJ] = true; - }); - }); - return layoutAttributes; } -function handleLinkedToArray(layoutAttributes) { - - function callback(attr, attrName, attrs) { - if(attr[Lib.IS_LINKED_TO_ARRAY] !== true) return; +function handleBasePlotModule(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep({}, _module.layoutAttributes); - // TODO more robust logic - var itemName = attrName.substr(0, attrName.length - 1); + attrs[IS_SUBPLOT_OBJ] = true; + np.set(attrs); +} - delete attr[Lib.IS_LINKED_TO_ARRAY]; +function handleRegisteredComponent(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep(np.get() || {}, _module.layoutAttributes); - attrs[attrName] = { items: {} }; - attrs[attrName].items[itemName] = attr; - attrs[attrName].role = 'object'; - } - - Lib.crawl(layoutAttributes, callback); + np.set(attrs); } -},{"../lib":121,"../plotly":143,"../plots/plots":172,"../plots/polar/area_attributes":173,"../plots/polar/axis_attributes":174,"../registry":187}],138:[function(require,module,exports){ +},{"../lib":122,"../plots/animation_attributes":145,"../plots/attributes":147,"../plots/frame_attributes":170,"../plots/layout_attributes":171,"../plots/polar/area_attributes":174,"../plots/polar/axis_attributes":175,"../registry":188}],139:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -32893,10 +32777,14 @@ function registerTransformModule(newModule) { } function registerComponentModule(newModule) { - Registry.componentsRegistry[newModule.name] = newModule; + if(typeof newModule.name !== 'string') { + throw new Error('Component module *name* must be a string.'); + } + + Registry.registerComponent(newModule); } -},{"../lib":121,"../registry":187}],139:[function(require,module,exports){ +},{"../lib":122,"../registry":188}],140:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -32922,7 +32810,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":121,"../plotly":143}],140:[function(require,module,exports){ +},{"../lib":122,"../plotly":144}],141:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33244,7 +33132,7 @@ exports.doModeBar = function(gd) { return Plots.previousPromises(gd); }; -},{"../components/color":30,"../components/drawing":54,"../components/modebar":77,"../components/titles":105,"../lib":121,"../plotly":143,"../plots/plots":172,"../registry":187}],141:[function(require,module,exports){ +},{"../components/color":30,"../components/drawing":53,"../components/modebar":76,"../components/titles":104,"../lib":122,"../plotly":144,"../plots/plots":173,"../registry":188}],142:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33299,7 +33187,7 @@ function toImage(gd, opts) { // first clone the GD so we can operate in a clean environment var clone = clonePlot(gd, {format: 'png', height: opts.height, width: opts.width}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -33354,7 +33242,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":121,"../plotly":143,"../snapshot/cloneplot":188,"../snapshot/helpers":191,"../snapshot/svgtoimg":193,"../snapshot/tosvg":195,"fast-isnumeric":17}],142:[function(require,module,exports){ +},{"../lib":122,"../plotly":144,"../snapshot/cloneplot":189,"../snapshot/helpers":192,"../snapshot/svgtoimg":194,"../snapshot/tosvg":196,"fast-isnumeric":17}],143:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33530,7 +33418,8 @@ function crawl(objIn, objOut, schema, list, base, path) { crawl(valIn, valOut, nestedSchema, list, base, p); } else if(nestedSchema.items && !isInfoArray && isArray(valIn)) { - var itemName = k.substr(0, k.length - 1), + var items = nestedSchema.items, + _nestedSchema = items[Object.keys(items)[0]], indexList = []; var j, _p; @@ -33538,8 +33427,7 @@ function crawl(objIn, objOut, schema, list, base, path) { // loop over valOut items while keeping track of their // corresponding input container index (given by _index) for(j = 0; j < valOut.length; j++) { - var _nestedSchema = nestedSchema.items[itemName], - _index = valOut[j]._index || j; + var _index = valOut[j]._index || j; _p = p.slice(); _p.push(_index); @@ -33724,7 +33612,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":121,"../plots/plots":172,"./plot_schema":137}],143:[function(require,module,exports){ +},{"../lib":122,"../plots/plots":173,"./plot_schema":138}],144:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33752,25 +33640,12 @@ exports.defaultConfig = require('./plot_api/plot_config'); exports.Plots = require('./plots/plots'); exports.Axes = require('./plots/cartesian/axes'); exports.Fx = require('./plots/cartesian/graph_interact'); - -// components -exports.Color = require('./components/color'); -exports.Drawing = require('./components/drawing'); -exports.Colorscale = require('./components/colorscale'); -exports.Colorbar = require('./components/colorbar'); -exports.ErrorBars = require('./components/errorbars'); -exports.Annotations = require('./components/annotations'); -exports.Shapes = require('./components/shapes'); -exports.Legend = require('./components/legend'); -exports.Images = require('./components/images'); -exports.UpdateMenus = require('./components/updatemenus'); -exports.Sliders = require('./components/sliders'); exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/annotations":28,"./components/color":30,"./components/colorbar":35,"./components/colorscale":45,"./components/drawing":54,"./components/errorbars":60,"./components/images":66,"./components/legend":74,"./components/modebar":77,"./components/shapes":98,"./components/sliders":104,"./components/updatemenus":110,"./plot_api/plot_api":135,"./plot_api/plot_config":136,"./plots/cartesian/axes":147,"./plots/cartesian/graph_interact":155,"./plots/plots":172}],144:[function(require,module,exports){ +},{"./components/modebar":76,"./plot_api/plot_api":136,"./plot_api/plot_config":137,"./plots/cartesian/axes":149,"./plots/cartesian/graph_interact":156,"./plots/plots":173}],145:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33872,7 +33747,76 @@ module.exports = { } }; -},{}],145:[function(require,module,exports){ +},{}],146:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var Lib = require('../lib'); + + +/** Convenience wrapper for making array container logic DRY and consistent + * + * @param {object} parentObjIn + * user input object where the container in question is linked + * (i.e. either a user trace object or the user layout object) + * + * @param {object} parentObjOut + * full object where the coerced container will be linked + * (i.e. either a full trace object or the full layout object) + * + * @param {object} opts + * options object: + * - name {string} + * name of the key linking the container in question + * - handleItemDefaults {function} + * defaults method to be called on each item in the array container in question + * + * Its arguments are: + * - itemIn {object} item in user layout + * - itemOut {object} item in full layout + * - parentObj {object} (as in closure) + * - opts {object} (as in closure) + * - itemOpts {object} + * - itemIsNotPlainObject {boolean} + * N.B. + * + * - opts is passed to handleItemDefaults so it can also store + * links to supplementary data (e.g. fullData for layout components) + * + */ +module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut, opts) { + var name = opts.name; + + var contIn = Array.isArray(parentObjIn[name]) ? parentObjIn[name] : [], + contOut = parentObjOut[name] = []; + + for(var i = 0; i < contIn.length; i++) { + var itemIn = contIn[i], + itemOut = {}, + itemOpts = {}; + + if(!Lib.isPlainObject(itemIn)) { + itemOpts.itemIsNotPlainObject = true; + itemIn = {}; + } + + opts.handleItemDefaults(itemIn, itemOut, parentObjOut, opts, itemOpts); + + itemOut._input = itemIn; + itemOut._index = i; + + contOut.push(itemOut); + } +}; + +},{"../lib":122}],147:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33955,7 +33899,7 @@ module.exports = { } }; -},{}],146:[function(require,module,exports){ +},{}],148:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33982,7 +33926,7 @@ module.exports = { } }; -},{}],147:[function(require,module,exports){ +},{}],149:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -34004,6 +33948,15 @@ var Titles = require('../../components/titles'); var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); +var constants = require('../../constants/numerical'); +var FP_SAFE = constants.FP_SAFE; +var ONEAVGYEAR = constants.ONEAVGYEAR; +var ONEAVGMONTH = constants.ONEAVGMONTH; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + var axes = module.exports = {}; @@ -34021,43 +33974,88 @@ axes.getFromId = axisIds.getFromId; axes.getFromTrace = axisIds.getFromTrace; -// find the list of possible axes to reference with an xref or yref attribute -// and coerce it to that list -axes.coerceRef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = axLetter + 'ref', +/* + * find the list of possible axes to reference with an xref or yref attribute + * and coerce it to that list + * + * attr: the attribute we're generating a reference for. Should end in 'x' or 'y' + * but can be prefixed, like 'ax' for annotation's arrow x + * dflt: the default to coerce to, or blank to use the first axis (falling back on + * extraOption if there is no axis) + * extraOption: aside from existing axes with this letter, what non-axis value is allowed? + * Only required if it's different from `dflt` + */ +axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption) { + var axLetter = attr.charAt(attr.length - 1), + axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), + refAttr = attr + 'ref', attrDef = {}; + if(!dflt) dflt = axlist[0] || extraOption; + if(!extraOption) extraOption = dflt; + // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(['paper']), - dflt: dflt || axlist[0] || 'paper' + values: axlist.concat(extraOption ? [extraOption] : []), + dflt: dflt }; // xref, yref return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; -// todo: duplicated per github PR 610. Should be consolidated with axes.coerceRef. -// find the list of possible axes to reference with an axref or ayref attribute -// and coerce it to that list -axes.coerceARef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = 'a' + axLetter + 'ref', - attrDef = {}; +/* + * coerce position attributes (range-type) that can be either on axes or absolute + * (paper or pixel) referenced. The biggest complication here is that we don't know + * before looking at the axis whether the value must be a number or not (it may be + * a date string), so we can't use the regular valType='number' machinery + * + * axRef (string): the axis this position is referenced to, or: + * paper: fraction of the plot area + * pixel: pixels relative to some starting position + * attr (string): the attribute in containerOut we are coercing + * dflt (number): the default position, as a fraction or pixels. If the attribute + * is to be axis-referenced, this will be converted to an axis data value + * + * Also cleans the values, since the attribute definition itself has to say + * valType: 'any' to handle date axes. This allows us to accept: + * - for category axes: category names, and convert them here into serial numbers. + * Note that this will NOT work for axis range endpoints, because we don't know + * the category list yet (it's set by ax.makeCalcdata during calc) + * but it works for component (note, shape, images) positions. + * - for date axes: JS Dates or milliseconds, and convert to date strings + * - for other types: coerce them to numbers + */ +axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { + var pos, + newPos; - // data-ref annotations are not supported in gl2d yet + if(axRef === 'paper' || axRef === 'pixel') { + pos = coerce(attr, dflt); + } + else { + var ax = axes.getFromId(gd, axRef); - attrDef[refAttr] = { - valType: 'enumerated', - values: axlist.concat(['pixel']), - dflt: dflt || 'pixel' || axlist[0] - }; + dflt = ax.fraction2r(dflt); + pos = coerce(attr, dflt); - // axref, ayref - return Lib.coerce(containerIn, containerOut, attrDef, refAttr); + if(ax.type === 'category') { + // if position is given as a category name, convert it to a number + if(typeof pos === 'string' && (ax._categories || []).length) { + newPos = ax._categories.indexOf(pos); + containerOut[attr] = (newPos !== -1) ? dflt : newPos; + return; + } + } + else if(ax.type === 'date') { + containerOut[attr] = Lib.cleanDate(pos); + return; + } + } + // finally make sure we have a number (unless date type already returned a string) + containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; }; // empty out types for all axes containing these traces @@ -34083,14 +34081,16 @@ axes.counterLetter = function(id) { // incorporate a new minimum difference and first tick into // forced +// note that _forceTick0 is linearized, so needs to be turned into +// a range value for setting tick0 axes.minDtick = function(ax, newDiff, newFirst, allow) { // doesn't make sense to do forced min dTick on log or category axes, // and the plot itself may decide to cancel (ie non-grouped bars) if(['log', 'category'].indexOf(ax.type) !== -1 || !allow) { ax._minDtick = 0; } - // null means there's nothing there yet - else if(ax._minDtick === null) { + // undefined means there's nothing there yet + else if(ax._minDtick === undefined) { ax._minDtick = newDiff; ax._forceTick0 = newFirst; } @@ -34115,6 +34115,19 @@ axes.minDtick = function(ax, newDiff, newFirst, allow) { } }; +// Find the autorange for this axis +// +// assumes ax._min and ax._max have already been set by calling axes.expand +// using calcdata from all traces. These are arrays of: +// {val: calcdata value, pad: extra pixels beyond this value} +// +// Returns an array of [min, max]. These are calcdata for log and category axes +// and data for linear and date axes. +// +// TODO: we want to change log to data as well, but it's hard to do this +// maintaining backward compatibility. category will always have to use calcdata +// though, because otherwise values between categories (or outside all categories) +// would be impossible. axes.getAutoRange = function(ax) { var newRange = []; @@ -34133,7 +34146,12 @@ axes.getAutoRange = function(ax) { var j, minpt, maxpt, minbest, maxbest, dp, dv, mbest = 0, - axReverse = (ax.range && ax.range[1] < ax.range[0]); + axReverse = false; + + if(ax.range) { + var rng = ax.range.map(ax.r2l); + axReverse = rng[1] < rng[0]; + } // one-time setting to easily reverse the axis // when plotting from code @@ -34222,11 +34240,9 @@ axes.getAutoRange = function(ax) { } // maintain reversal - if(axReverse) { - newRange.reverse(); - } + if(axReverse) newRange.reverse(); - return newRange; + return newRange.map(ax.l2r || Number); }; axes.doAutoRange = function(ax) { @@ -34289,7 +34305,6 @@ axes.saveRangeInitial = function(gd, overwrite) { // (unless one end is overridden by tozero) // tozero: (boolean) make sure to include zero if axis is linear, // and make it a tight bound if possible -var FP_SAFE = Number.MAX_VALUE / 2; axes.expand = function(ax, data, options) { if(!(ax.autorange || ax._needsExpand) || !data) return; if(!ax._min) ax._min = []; @@ -34428,10 +34443,24 @@ axes.autoBin = function(data, ax, nbins, is2d) { } // piggyback off autotick code to make "nice" bin sizes - var dummyax = { - type: ax.type === 'log' ? 'linear' : ax.type, - range: [datamin, datamax] - }; + var dummyax; + if(ax.type === 'log') { + dummyax = { + type: 'linear', + range: [datamin, datamax], + r2l: Number + }; + } + else { + dummyax = { + type: ax.type, + // conversion below would be ax.c2r but that's only different from l2r + // for log, and this is the only place (so far?) we would want c2r. + range: [datamin, datamax].map(ax.l2r), + r2l: ax.r2l + }; + } + axes.autoTicks(dummyax, size0); var binstart = axes.tickIncrement( axes.tickFirst(dummyax), dummyax.dtick, 'reverse'), @@ -34495,8 +34524,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { } return { - start: binstart, - end: binend, + start: ax.c2r(binstart), + end: ax.c2r(binend), size: dummyax.dtick }; }; @@ -34513,6 +34542,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { axes.calcTicks = function calcTicks(ax) { if(ax.tickmode === 'array') return arrayTicks(ax); + var rng = ax.range.map(ax.r2l); + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks, @@ -34527,18 +34558,17 @@ axes.calcTicks = function calcTicks(ax) { nt = Lib.constrain(ax._length / minPx, 4, 9) + 1; } } - axes.autoTicks(ax, Math.abs(ax.range[1] - ax.range[0]) / nt); + axes.autoTicks(ax, Math.abs(rng[1] - rng[0]) / nt); // check for a forced minimum dtick if(ax._minDtick > 0 && ax.dtick < ax._minDtick * 2) { ax.dtick = ax._minDtick; - ax.tick0 = ax._forceTick0; + ax.tick0 = ax.l2r(ax._forceTick0); } } // check for missing tick0 if(!ax.tick0) { - ax.tick0 = (ax.type === 'date') ? - new Date(2000, 0, 1).getTime() : 0; + ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; } // now figure out rounding of tick values @@ -34548,12 +34578,12 @@ axes.calcTicks = function calcTicks(ax) { ax._tmin = axes.tickFirst(ax); // check for reversed axis - var axrev = (ax.range[1] < ax.range[0]); + var axrev = (rng[1] < rng[0]); // return the full set of tick vals var vals = [], // add a tiny bit so we get ticks which may have rounded out - endtick = ax.range[1] * 1.0001 - ax.range[0] * 0.0001; + endtick = rng[1] * 1.0001 - rng[0] * 0.0001; if(ax.type === 'category') { endtick = (axrev) ? Math.max(-0.5, endtick) : Math.min(ax._categories.length - 0.5, endtick); @@ -34571,9 +34601,18 @@ axes.calcTicks = function calcTicks(ax) { // show the exponent only on the last one ax._tmax = vals[vals.length - 1]; + // for showing date suffixes: ax._prevSuffix holds what we showed most + // recently. Start with it cleared and mark that we're in calcTicks (ie + // calculating a whole string of these so we should care what the previous + // suffix was!) + ax._prevSuffix = ''; + ax._inCalcTicks = true; + var ticksOut = new Array(vals.length); for(var i = 0; i < vals.length; i++) ticksOut[i] = axes.tickText(ax, vals[i]); + ax._inCalcTicks = false; + return ticksOut; }; @@ -34581,15 +34620,15 @@ function arrayTicks(ax) { var vals = ax.tickvals, text = ax.ticktext, ticksOut = new Array(vals.length), - r0expanded = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, - r1expanded = ax.range[1] * 1.0001 - ax.range[0] * 0.0001, + rng = ax.range.map(ax.r2l), + r0expanded = rng[0] * 1.0001 - rng[1] * 0.0001, + r1expanded = rng[1] * 1.0001 - rng[0] * 0.0001, tickMin = Math.min(r0expanded, r1expanded), tickMax = Math.max(r0expanded, r1expanded), vali, i, j = 0; - // without a text array, just format the given values as any other ticks // except with more precision to the numbers if(!Array.isArray(text)) text = []; @@ -34629,7 +34668,7 @@ function roundDTick(roughDTick, base, roundingSet) { // outputs (into ax): // tick0: starting point for ticks (not necessarily on the graph) // usually 0 for numeric (=10^0=1 for log) or jan 1, 2000 for dates -// dtick: the actual, nice round tick spacing, somewhat larger than roughDTick +// dtick: the actual, nice round tick spacing, usually a little larger than roughDTick // if the ticks are spaced linearly (linear scale, categories, // log with only full powers, date ticks < month), // this will just be a number @@ -34642,36 +34681,35 @@ axes.autoTicks = function(ax, roughDTick) { var base; if(ax.type === 'date') { - ax.tick0 = new Date(2000, 0, 1).getTime(); + ax.tick0 = '2000-01-01'; + // the criteria below are all based on the rough spacing we calculate + // being > half of the final unit - so precalculate twice the rough val + var roughX2 = 2 * roughDTick; - if(roughDTick > 15778800000) { - // years if roughDTick > 6mo - roughDTick /= 31557600000; + if(roughX2 > ONEAVGYEAR) { + roughDTick /= ONEAVGYEAR; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'M' + (12 * roundDTick(roughDTick, base, roundBase10)); } - else if(roughDTick > 1209600000) { - // months if roughDTick > 2wk - roughDTick /= 2629800000; + else if(roughX2 > ONEAVGMONTH) { + roughDTick /= ONEAVGMONTH; ax.dtick = 'M' + roundDTick(roughDTick, 1, roundBase24); } - else if(roughDTick > 43200000) { - // days if roughDTick > 12h - ax.dtick = roundDTick(roughDTick, 86400000, roundDays); + else if(roughX2 > ONEDAY) { + ax.dtick = roundDTick(roughDTick, ONEDAY, roundDays); // get week ticks on sunday - ax.tick0 = new Date(2000, 0, 2).getTime(); + // this will also move the base tick off 2000-01-01 if dtick is + // 2 or 3 days... but that's a weird enough case that we'll ignore it. + ax.tick0 = '2000-01-02'; } - else if(roughDTick > 1800000) { - // hours if roughDTick > 30m - ax.dtick = roundDTick(roughDTick, 3600000, roundBase24); + else if(roughX2 > ONEHOUR) { + ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } - else if(roughDTick > 30000) { - // minutes if roughDTick > 30sec - ax.dtick = roundDTick(roughDTick, 60000, roundBase60); + else if(roughX2 > ONEMIN) { + ax.dtick = roundDTick(roughDTick, ONEMIN, roundBase60); } - else if(roughDTick > 500) { - // seconds if roughDTick > 0.5sec - ax.dtick = roundDTick(roughDTick, 1000, roundBase60); + else if(roughX2 > ONESEC) { + ax.dtick = roundDTick(roughDTick, ONESEC, roundBase60); } else { // milliseconds @@ -34681,16 +34719,19 @@ axes.autoTicks = function(ax, roughDTick) { } else if(ax.type === 'log') { ax.tick0 = 0; + var rng = ax.range.map(ax.r2l); - // only show powers of 10 - if(roughDTick > 0.7) ax.dtick = Math.ceil(roughDTick); - else if(Math.abs(ax.range[1] - ax.range[0]) < 1) { + if(roughDTick > 0.7) { + // only show powers of 10 + ax.dtick = Math.ceil(roughDTick); + } + else if(Math.abs(rng[1] - rng[0]) < 1) { // span is less than one power of 10 - var nt = 1.5 * Math.abs((ax.range[1] - ax.range[0]) / roughDTick); + var nt = 1.5 * Math.abs((rng[1] - rng[0]) / roughDTick); // ticks on a linear scale, labeled fully - roughDTick = Math.abs(Math.pow(10, ax.range[1]) - - Math.pow(10, ax.range[0])) / nt; + roughDTick = Math.abs(Math.pow(10, rng[1]) - + Math.pow(10, rng[0])) / nt; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'L' + roundDTick(roughDTick, base, roundBase10); } @@ -34729,41 +34770,59 @@ axes.autoTicks = function(ax, roughDTick) { // for date ticks, the last date part to show (y,m,d,H,M,S) // or an integer # digits past seconds function autoTickRound(ax) { - var dtick = ax.dtick, - maxend; + var dtick = ax.dtick; ax._tickexponent = 0; - if(!isNumeric(dtick) && typeof dtick !== 'string') dtick = 1; + if(!isNumeric(dtick) && typeof dtick !== 'string') { + dtick = 1; + } - if(ax.type === 'category') ax._tickround = null; - else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { - if(ax.type === 'date') { - if(dtick >= 86400000) ax._tickround = 'd'; - else if(dtick >= 3600000) ax._tickround = 'H'; - else if(dtick >= 60000) ax._tickround = 'M'; - else if(dtick >= 1000) ax._tickround = 'S'; - else ax._tickround = 3 - Math.round(Math.log(dtick / 2) / Math.LN10); - } + if(ax.type === 'category') { + ax._tickround = null; + } + if(ax.type === 'date') { + // If tick0 is unusual, give tickround a bit more information + // not necessarily *all* the information in tick0 though, if it's really odd + // minimal string length for tick0: 'd' is 10, 'M' is 16, 'S' is 19 + // take off a leading minus (year < 0 so length is consistent) + var tick0ms = Lib.dateTime2ms(ax.tick0), + tick0str = Lib.ms2DateTime(tick0ms).replace(/^-/, ''), + tick0len = tick0str.length; + + if(String(dtick).charAt(0) === 'M') { + // any tick0 more specific than a year: alway show the full date + if(tick0len > 10 || tick0str.substr(5) !== '01-01') ax._tickround = 'd'; + // show the month unless ticks are full multiples of a year + else ax._tickround = (+(dtick.substr(1)) % 12 === 0) ? 'y' : 'm'; + } + else if((dtick >= ONEDAY && tick0len <= 10) || (dtick >= ONEDAY * 15)) ax._tickround = 'd'; + else if((dtick >= ONEMIN && tick0len <= 16) || (dtick >= ONEHOUR)) ax._tickround = 'M'; + else if((dtick >= ONESEC && tick0len <= 19) || (dtick >= ONEMIN)) ax._tickround = 'S'; else { - if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); - // 2 digits past largest digit of dtick - ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); + // of any two adjacent ticks, at least one will have the maximum fractional digits + // of all possible ticks - so take the max. length of tick0 and the next one + var tick1len = Lib.ms2DateTime(tick0ms + dtick).replace(/^-/, '').length; + ax._tickround = Math.max(tick0len, tick1len) - 20; + } + } + else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { + // linear or log (except D1, D2) + var rng = ax.range.map(ax.r2d || Number); + if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); + // 2 digits past largest digit of dtick + ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); - if(ax.type === 'log') { - maxend = Math.pow(10, Math.max(ax.range[0], ax.range[1])); - } - else maxend = Math.max(Math.abs(ax.range[0]), Math.abs(ax.range[1])); + var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); - var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { - if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { - ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); - } - else ax._tickexponent = rangeexp; + var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); + if(Math.abs(rangeexp) > 3) { + if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { + ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } + else ax._tickexponent = rangeexp; } } - else if(dtick.charAt(0) === 'M') ax._tickround = (dtick.length === 2) ? 'm' : 'y'; + // D1 or D2 (log) else ax._tickround = null; } @@ -34808,13 +34867,16 @@ axes.tickIncrement = function(x, dtick, axrev) { // calculate the first tick on an axis axes.tickFirst = function(ax) { - var axrev = ax.range[1] < ax.range[0], + var r2l = ax.r2l || Number, + rng = ax.range.map(r2l), + axrev = rng[1] < rng[0], sRound = axrev ? Math.floor : Math.ceil, // add a tiny extra bit to make sure we get ticks // that may have been rounded out - r0 = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, + r0 = rng[0] * 1.0001 - rng[1] * 0.0001, dtick = ax.dtick, - tick0 = ax.tick0; + tick0 = r2l(ax.tick0); + if(isNumeric(dtick)) { var tmin = sRound((r0 - tick0) / dtick) * dtick + tick0; @@ -34864,7 +34926,7 @@ axes.tickFirst = function(ax) { var yearFormat = d3.time.format('%Y'), monthFormat = d3.time.format('%b %Y'), dayFormat = d3.time.format('%b %-d'), - hourFormat = d3.time.format('%b %-d %Hh'), + yearMonthDayFormat = d3.time.format('%b %-d, %Y'), minuteFormat = d3.time.format('%H:%M'), secondFormat = d3.time.format(':%S'); @@ -34900,7 +34962,8 @@ axes.tickText = function(ax, x, hover) { i; if(arrayMode && Array.isArray(ax.ticktext)) { - var minDiff = Math.abs(ax.range[1] - ax.range[0]) / 10000; + var rng = ax.range.map(ax.r2l), + minDiff = Math.abs(rng[1] - rng[0]) / 10000; for(i = 0; i < ax.ticktext.length; i++) { if(Math.abs(x - ax.d2l(ax.tickvals[i])) < minDiff) break; } @@ -34955,10 +35018,12 @@ function tickTextObj(ax, x, text) { function formatDate(ax, out, hover, extraPrecision) { var x = out.x, tr = ax._tickround, + trOriginal = tr, d = new Date(x), // suffix completes the full date info, to be included - // with only the first tick - suffix = '', + // with only the first tick or if any info before what's + // shown has changed + suffix, tt; if(hover && ax.hoverformat) { tt = modDateFormat(ax.hoverformat, x); @@ -34971,34 +35036,40 @@ function formatDate(ax, out, hover, extraPrecision) { else { if(extraPrecision) { if(isNumeric(tr)) tr += 2; - else tr = {y: 'm', m: 'd', d: 'H', H: 'M', M: 'S', S: 2}[tr]; + else tr = {y: 'm', m: 'd', d: 'M', M: 'S', S: 2}[tr]; } if(tr === 'y') tt = yearFormat(d); else if(tr === 'm') tt = monthFormat(d); else { - if(x === ax._tmin && !hover) { - suffix = '
' + yearFormat(d); - } + if(tr === 'd') { + if(!hover) suffix = '
' + yearFormat(d); - if(tr === 'd') tt = dayFormat(d); - else if(tr === 'H') tt = hourFormat(d); + tt = dayFormat(d); + } else { - if(x === ax._tmin && !hover) { - suffix = '
' + dayFormat(d) + ', ' + yearFormat(d); - } + if(!hover) suffix = '
' + yearMonthDayFormat(d); tt = minuteFormat(d); if(tr !== 'M') { tt += secondFormat(d); if(tr !== 'S') { - tt += numFormat(mod(x / 1000, 1), ax, 'none', hover) + tt += numFormat(d3.round(mod(x / 1000, 1), 4), ax, 'none', hover) .substr(1); } } + else if(trOriginal === 'd') { + // for hover on axes with day ticks, minuteFormat (which + // only includes %H:%M) isn't enough, you want the date too + tt = dayFormat(d) + ' ' + tt; + } } } } - out.text = tt + suffix; + if(suffix && (!ax._inCalcTicks || (suffix !== ax._prevSuffix))) { + tt += suffix; + ax._prevSuffix = suffix; + } + out.text = tt; } function formatLog(ax, out, hover, extraPrecision, hideexp) { @@ -35090,7 +35161,7 @@ function numFormat(v, ax, fmtoverride, hover) { (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent // from what we calculate - range: ax.showexponent === 'none' ? ax.range : [0, v || 1] + range: ax.showexponent === 'none' ? ax.range.map(ax.r2d) : [0, v || 1] }; autoTickRound(ah); tickRound = (Number(ah._tickround) || 0) + 4; @@ -35338,8 +35409,9 @@ axes.makeClipPaths = function(gd) { // doTicks: draw ticks, grids, and tick labels // axid: 'x', 'y', 'x2' etc, // blank to do all, -// 'redraw' to force full redraw, and reset ax._r -// (stored range for use by zoom/pan) +// 'redraw' to force full redraw, and reset: +// ax._r (stored range for use by zoom/pan) +// ax._rl (stored linearized range for use by zoom/pan) // or can pass in an axis object directly axes.doTicks = function(gd, axid, skipTitle) { var fullLayout = gd._fullLayout, @@ -35377,7 +35449,10 @@ axes.doTicks = function(gd, axid, skipTitle) { return function() { if(!ax._id) return; var axDone = axes.doTicks(gd, ax._id); - if(axid === 'redraw') ax._r = ax.range.slice(); + if(axid === 'redraw') { + ax._r = ax.range.slice(); + ax._rl = ax._r.map(ax.r2l); + } return axDone; }; })); @@ -35395,9 +35470,6 @@ axes.doTicks = function(gd, axid, skipTitle) { } } - // in case a val turns into string somehow - ax.range = [+ax.range[0], +ax.range[1]]; - // set scaling to pixels ax.setScale(); @@ -35786,7 +35858,8 @@ axes.doTicks = function(gd, axid, skipTitle) { break; } } - var showZl = (ax.range[0] * ax.range[1] <= 0) && ax.zeroline && + var rng = ax.range.map(ax.r2l), + showZl = (rng[0] * rng[1] <= 0) && ax.zeroline && (ax.type === 'linear' || ax.type === '-') && gridvals.length && (hasBarsOrFill || clipEnds({x: 0}) || !ax.showline); var zl = zlcontainer.selectAll('path.' + zcls) @@ -36010,7 +36083,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { // rather than built-in % which gives a negative value for negative v function mod(v, d) { return ((v % d) + d) % d; } -},{"../../components/color":30,"../../components/drawing":54,"../../components/titles":105,"../../lib":121,"../../lib/svg_text_utils":133,"../../registry":187,"./axis_ids":150,"./layout_attributes":157,"./layout_defaults":158,"./set_convert":162,"d3":14,"fast-isnumeric":17}],148:[function(require,module,exports){ +},{"../../components/color":30,"../../components/drawing":53,"../../components/titles":104,"../../constants/numerical":110,"../../lib":122,"../../lib/svg_text_utils":134,"../../registry":188,"./axis_ids":152,"./layout_attributes":158,"./layout_defaults":159,"./set_convert":163,"d3":14,"fast-isnumeric":17}],150:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36025,7 +36098,7 @@ function mod(v, d) { return ((v % d) + d) % d; } var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); -var cleanDatum = require('./clean_datum'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function autoType(array) { if(moreDates(array)) return 'date'; @@ -36067,7 +36140,7 @@ function moreDates(a) { return (dcnt > ncnt * 2); } -// are the (x,y)-values in td.data mostly text? +// are the (x,y)-values in gd.data mostly text? // require twice as many categories as numbers function category(a) { // test at most 1000 points @@ -36077,15 +36150,15 @@ function category(a) { ai; for(var i = 0; i < a.length; i += inc) { - ai = cleanDatum(a[Math.round(i)]); - if(isNumeric(ai)) curvenums++; + ai = a[Math.round(i)]; + if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; else if(typeof ai === 'string' && ai !== '' && ai !== 'None') curvecats++; } return curvecats > curvenums * 2; } -},{"../../lib":121,"./clean_datum":152,"fast-isnumeric":17}],149:[function(require,module,exports){ +},{"../../constants/numerical":110,"../../lib":122,"fast-isnumeric":17}],151:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36178,17 +36251,15 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var validRange = ( (containerIn.range || []).length === 2 && - isNumeric(containerIn.range[0]) && - isNumeric(containerIn.range[1]) + isNumeric(containerOut.r2l(containerIn.range[0])) && + isNumeric(containerOut.r2l(containerIn.range[1])) ); var autoRange = coerce('autorange', !validRange); if(autoRange) coerce('rangemode'); - var range = coerce('range', [-1, letter === 'x' ? 6 : 4]); - if(range[0] === range[1]) { - containerOut.range = [range[0] - 1, range[0] + 1]; - } - Lib.noneOrAll(containerIn.range, containerOut.range, [0, 1]); + + coerce('range'); + containerOut.cleanRange(); coerce('fixedrange'); @@ -36310,7 +36381,7 @@ function getFirstNonEmptyTrace(data, id, axLetter) { } } -},{"../../components/color/attributes":29,"../../lib":121,"../../registry":187,"./axis_autotype":148,"./axis_ids":150,"./category_order_defaults":151,"./layout_attributes":157,"./ordered_categories":159,"./set_convert":162,"./tick_label_defaults":163,"./tick_mark_defaults":164,"./tick_value_defaults":165,"fast-isnumeric":17,"tinycolor2":20}],150:[function(require,module,exports){ +},{"../../components/color/attributes":29,"../../lib":122,"../../registry":188,"./axis_autotype":150,"./axis_ids":152,"./category_order_defaults":153,"./layout_attributes":158,"./ordered_categories":160,"./set_convert":163,"./tick_label_defaults":164,"./tick_mark_defaults":165,"./tick_value_defaults":166,"fast-isnumeric":17,"tinycolor2":20}],152:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36432,7 +36503,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":121,"../../registry":187,"../plots":172,"./constants":153}],151:[function(require,module,exports){ +},{"../../lib":122,"../../registry":188,"../plots":173,"./constants":154}],153:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36466,46 +36537,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],152:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = require('fast-isnumeric'); - -var Lib = require('../../lib'); - - -/** - * cleanDatum: removes characters - * same replace criteria used in the grid.js:scrapeCol - * but also handling dates, numbers, and NaN, null, Infinity etc - */ -module.exports = function cleanDatum(c) { - try { - if(typeof c === 'object' && c !== null && c.getTime) { - return Lib.ms2DateTime(c); - } - if(typeof c !== 'string' && !isNumeric(c)) { - return ''; - } - c = c.toString().replace(/['"%,$# ]/g, ''); - } - catch(e) { - Lib.error(e, c); - } - - return c; -}; - -},{"../../lib":121,"fast-isnumeric":17}],153:[function(require,module,exports){ +},{}],154:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36529,14 +36561,6 @@ module.exports = { y: /^yaxis([2-9]|[1-9][0-9]+)?$/ }, - /** - * standardize all missing data in calcdata to use undefined - * never null or NaN. - * that way we can use !==undefined, or !== BADNUM, - * to test for real data - */ - BADNUM: undefined, - // axis match regular expression xAxisMatch: /^xaxis[0-9]*$/, yAxisMatch: /^yaxis[0-9]*$/, @@ -36580,10 +36604,15 @@ module.exports = { BENDPX: 1.5, // delay before a redraw (relayout) after smooth panning and zooming - REDRAWDELAY: 50 + REDRAWDELAY: 50, + + // last resort axis ranges for x, y, and date axes if we have no data + DFLTRANGEX: [-1, 6], + DFLTRANGEY: [-1, 4], + DFLTRANGEDATE: ['2000-01-01', '2001-01-01'], }; -},{}],154:[function(require,module,exports){ +},{}],155:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36684,11 +36713,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { return dragger; } - function forceNumbers(axRange) { - axRange[0] = Number(axRange[0]); - axRange[1] = Number(axRange[1]); - } - var dragOptions = { element: dragger, gd: gd, @@ -36799,7 +36823,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { .attr('d', 'M0,0Z'); clearSelect(); - for(var i = 0; i < allaxes.length; i++) forceNumbers(allaxes[i].range); } function clearSelect() { @@ -36890,16 +36913,16 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomAxRanges(axList, r0Fraction, r1Fraction) { var i, axi, - axRange; + axRangeLinear; for(i = 0; i < axList.length; i++) { axi = axList[i]; if(axi.fixedrange) continue; - axRange = axi.range; + axRangeLinear = axi.range.map(axi.r2l); axi.range = [ - axRange[0] + (axRange[1] - axRange[0]) * r0Fraction, - axRange[0] + (axRange[1] - axRange[0]) * r1Fraction + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r0Fraction), + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r1Fraction) ]; } } @@ -36953,7 +36976,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { verticalAlign: vAlign }) .on('edit', function(text) { - var v = ax.type === 'category' ? ax.c2l(text) : ax.d2l(text); + var v = ax.d2r(text); if(v !== undefined) { Plotly.relayout(gd, attrStr, v); } @@ -37013,10 +37036,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomWheelOneAxis(ax, centerFraction, zoom) { if(ax.fixedrange) return; - forceNumbers(ax.range); - var axRange = ax.range, + + var axRange = ax.range.map(ax.r2l), v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; - ax.range = [v0 + (axRange[0] - v0) * zoom, v0 + (axRange[1] - v0) * zoom]; + function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); } + ax.range = axRange.map(doZoom); } if(ew) { @@ -37064,7 +37088,10 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { for(var i = 0; i < axList.length; i++) { var axi = axList[i]; if(!axi.fixedrange) { - axi.range = [axi._r[0] - pix / axi._m, axi._r[1] - pix / axi._m]; + axi.range = [ + axi.l2r(axi._rl[0] - pix / axi._m), + axi.l2r(axi._rl[1] - pix / axi._m) + ]; } } } @@ -37087,23 +37114,29 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { 1 / (1 / Math.max(d, -0.3) + 3.222)); } - // dz: set a new value for one end (0 or 1) of an axis array ax, + // dz: set a new value for one end (0 or 1) of an axis array axArray, // and return a pixel shift for that end for the viewbox // based on pixel drag distance d // TODO: this makes (generally non-fatal) errors when you get // near floating point limits - function dz(ax, end, d) { + function dz(axArray, end, d) { var otherEnd = 1 - end, - movedi = 0; - for(var i = 0; i < ax.length; i++) { - var axi = ax[i]; + movedAx, + newLinearizedEnd; + for(var i = 0; i < axArray.length; i++) { + var axi = axArray[i]; if(axi.fixedrange) continue; - movedi = i; - axi.range[end] = axi._r[otherEnd] + - (axi._r[end] - axi._r[otherEnd]) / dZoom(d / axi._length); + movedAx = axi; + newLinearizedEnd = axi._rl[otherEnd] + + (axi._rl[end] - axi._rl[otherEnd]) / dZoom(d / axi._length); + var newEnd = axi.l2r(newLinearizedEnd); + + // if l2r comes back false or undefined, it means we've dragged off + // the end of valid ranges - so stop. + if(newEnd !== false && newEnd !== undefined) axi.range[end] = newEnd; } - return ax[movedi]._length * (ax[movedi]._r[end] - ax[movedi].range[end]) / - (ax[movedi]._r[end] - ax[movedi]._r[otherEnd]); + return movedAx._length * (movedAx._rl[end] - newLinearizedEnd) / + (movedAx._rl[end] - movedAx._rl[otherEnd]); } if(xActive === 'w') dx = dz(xa, 0, dx); @@ -37305,8 +37338,10 @@ function getEndText(ax, end) { diff = Math.abs(initialVal - ax.range[1 - end]), dig; + // TODO: this should basically be ax.r2d but we're doing extra + // rounding here... can we clean up at all? if(ax.type === 'date') { - return Lib.ms2DateTime(initialVal, diff); + return initialVal; } else if(ax.type === 'log') { dig = Math.ceil(Math.max(0, -Math.log(diff) / Math.LN10)) + 3; @@ -37340,7 +37375,7 @@ function isSelectOrLasso(dragmode) { return modes.indexOf(dragmode) !== -1; } -},{"../../components/color":30,"../../components/dragelement":52,"../../components/drawing":54,"../../lib":121,"../../lib/setcursor":131,"../../lib/svg_text_utils":133,"../../plotly":143,"../../registry":187,"./axes":147,"./constants":153,"./select":161,"d3":14,"tinycolor2":20}],155:[function(require,module,exports){ +},{"../../components/color":30,"../../components/dragelement":51,"../../components/drawing":53,"../../lib":122,"../../lib/setcursor":132,"../../lib/svg_text_utils":134,"../../plotly":144,"../../registry":188,"./axes":149,"./constants":154,"./select":162,"d3":14,"tinycolor2":20}],156:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -37366,6 +37401,7 @@ var dragElement = require('../../components/dragelement'); var Axes = require('./axes'); var constants = require('./constants'); var dragBox = require('./dragbox'); +var layoutAttributes = require('../layout_attributes'); var fx = module.exports = {}; @@ -37375,24 +37411,12 @@ var fx = module.exports = {}; fx.unhover = dragElement.unhover; fx.layoutAttributes = { - dragmode: { - valType: 'enumerated', - - values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], - dflt: 'zoom', - - }, - hovermode: { - valType: 'enumerated', - - values: ['x', 'y', 'closest', false], - - } }; fx.supplyLayoutDefaults = function(layoutIn, layoutOut, fullData) { + function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, fx.layoutAttributes, attr, dflt); + return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } coerce('dragmode'); @@ -38695,7 +38719,7 @@ fx.inbox = function(v0, v1) { return Infinity; }; -},{"../../components/color":30,"../../components/dragelement":52,"../../components/drawing":54,"../../lib":121,"../../lib/events":117,"../../lib/svg_text_utils":133,"./axes":147,"./constants":153,"./dragbox":154,"d3":14,"fast-isnumeric":17,"tinycolor2":20}],156:[function(require,module,exports){ +},{"../../components/color":30,"../../components/dragelement":51,"../../components/drawing":53,"../../lib":122,"../../lib/events":118,"../../lib/svg_text_utils":134,"../layout_attributes":171,"./axes":149,"./constants":154,"./dragbox":155,"d3":14,"fast-isnumeric":17,"tinycolor2":20}],157:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -38725,6 +38749,8 @@ exports.attrRegex = constants.attrRegex; exports.attributes = require('./attributes'); +exports.layoutAttributes = require('./layout_attributes'); + exports.transitionAxes = require('./transition_axes'); exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) { @@ -39067,7 +39093,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":121,"../plots":172,"./attributes":146,"./axes":147,"./constants":153,"./transition_axes":166,"d3":14}],157:[function(require,module,exports){ +},{"../../lib":122,"../plots":173,"./attributes":148,"./axes":149,"./constants":154,"./layout_attributes":158,"./transition_axes":167,"d3":14}],158:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39103,8 +39129,8 @@ module.exports = { type: { valType: 'enumerated', // '-' means we haven't yet run autotype or couldn't find any data - // it gets turned into linear in td._fullLayout but not copied back - // to td.data like the others are. + // it gets turned into linear in gd._fullLayout but not copied back + // to gd.data like the others are. values: ['-', 'linear', 'log', 'date', 'category'], dflt: '-', @@ -39128,8 +39154,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -39155,14 +39181,12 @@ module.exports = { }, tick0: { - valType: 'number', - dflt: 0, + valType: 'any', }, dtick: { valType: 'any', - dflt: 1, }, @@ -39403,11 +39427,6 @@ module.exports = { }, - _nestedModules: { - 'rangeslider': 'rangeslider', - 'rangeselector': 'rangeselector', - }, - _deprecated: { autotick: { valType: 'boolean', @@ -39417,7 +39436,7 @@ module.exports = { } }; -},{"../../components/color/attributes":29,"../../lib/extend":118,"../font_attributes":168,"./constants":153}],158:[function(require,module,exports){ +},{"../../components/color/attributes":29,"../../lib/extend":119,"../font_attributes":169,"./constants":154}],159:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39591,7 +39610,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { }); }; -},{"../../components/color":30,"../../lib":121,"../../registry":187,"../layout_attributes":170,"./axis_defaults":149,"./axis_ids":150,"./constants":153,"./layout_attributes":157,"./position_defaults":160}],159:[function(require,module,exports){ +},{"../../components/color":30,"../../lib":122,"../../registry":188,"../layout_attributes":171,"./axis_defaults":151,"./axis_ids":152,"./constants":154,"./layout_attributes":158,"./position_defaults":161}],160:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39670,7 +39689,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":14}],160:[function(require,module,exports){ +},{"d3":14}],161:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39735,7 +39754,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":121,"fast-isnumeric":17}],161:[function(require,module,exports){ +},{"../../lib":122,"fast-isnumeric":17}],162:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39935,7 +39954,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":30,"../../lib/polygon":128,"./axes":147,"./constants":153}],162:[function(require,module,exports){ +},{"../../components/color":30,"../../lib/polygon":129,"./axes":149,"./constants":154}],163:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39951,27 +39970,38 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); +var numConstants = require('../../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var constants = require('./constants'); -var cleanDatum = require('./clean_datum'); var axisIds = require('./axis_ids'); /** - * Define the conversion functions for an axis data is used in 4 ways: + * Define the conversion functions for an axis data is used in 5 ways: * * d: data, in whatever form it's provided * c: calcdata: turned into numbers, but not linearized - * l: linearized - same as c except for log axes (and other - * mappings later?) this is used by ranges, and when we - * need to know if it's *possible* to show some data on - * this axis, without caring about the current range + * l: linearized - same as c except for log axes (and other nonlinear + * mappings later?) this is used when we need to know if it's + * *possible* to show some data on this axis, without caring about + * the current range * p: pixel value - mapped to the screen with current size and zoom + * r: ranges, tick0, and annotation positions match one of the above + * but are handled differently for different types: + * - linear and date: data format (d) + * - category: calcdata format (c), and will stay that way because + * the data format has no continuous mapping + * - log: linearized (l) format + * TODO: in v2.0 we plan to change it to data format. At that point + * shapes will work the same way as ranges, tick0, and annotations + * so they can use this conversion too. * - * Creates/updates these conversion functions + * Creates/updates these conversion functions, as well as cleaner functions: + * ax.d2d and ax.clean2r * also clears the autorange bounds ._min and ._max - * and the autotick constraints ._minDtick, ._forceTick0, - * and looks for date ranges that aren't yet in numeric format + * and the autotick constraints ._minDtick, ._forceTick0 */ module.exports = function setConvert(ax) { @@ -39991,20 +40021,119 @@ module.exports = function setConvert(ax) { return 0.5 * (r0 + r1 - 3 * clipMult * Math.abs(r0 - r1)); } - else return constants.BADNUM; + else return BADNUM; + } + + function fromLog(v) { + return Math.pow(10, v); + } + + function num(v) { + if(!isNumeric(v)) return BADNUM; + v = Number(v); + if(v < -FP_SAFE || v > FP_SAFE) return BADNUM; + return isNumeric(v) ? Number(v) : BADNUM; } - function fromLog(v) { return Math.pow(10, v); } - function num(v) { return isNumeric(v) ? Number(v) : constants.BADNUM; } ax.c2l = (ax.type === 'log') ? toLog : num; ax.l2c = (ax.type === 'log') ? fromLog : num; ax.l2d = function(v) { return ax.c2d(ax.l2c(v)); }; ax.p2d = function(v) { return ax.l2d(ax.p2l(v)); }; + /* + * fn to make sure range is a couplet of valid & distinct values + * keep numbers away from the limits of floating point numbers, + * and dates away from the ends of our date system (+/- 9999 years) + * + * optional param rangeAttr: operate on a different attribute, like + * ax._r, rather than ax.range + */ + ax.cleanRange = function(rangeAttr) { + if(!rangeAttr) rangeAttr = 'range'; + var range = ax[rangeAttr], + axLetter = (ax._id || 'x').charAt(0), + i, dflt; + + if(ax.type === 'date') dflt = constants.DFLTRANGEDATE; + else if(axLetter === 'y') dflt = constants.DFLTRANGEY; + else dflt = constants.DFLTRANGEX; + + // make sure we don't later mutate the defaults + dflt = dflt.slice(); + + if(!range || range.length !== 2) { + ax[rangeAttr] = dflt; + return; + } + + if(ax.type === 'date') { + // check if milliseconds or js date objects are provided for range + // and convert to date strings + range[0] = Lib.cleanDate(range[0]); + range[1] = Lib.cleanDate(range[1]); + } + + for(i = 0; i < 2; i++) { + if(ax.type === 'date') { + if(!Lib.isDateTime(range[i])) { + ax[rangeAttr] = dflt; + break; + } + + if(range[i] < Lib.MIN_MS) range[i] = Lib.MIN_MS; + if(range[i] > Lib.MAX_MS) range[i] = Lib.MAX_MS; + + if(ax.r2l(range[0]) === ax.r2l(range[1])) { + // split by +/- 1 second + var linCenter = Lib.constrain(ax.r2l(range[0]), + Lib.MIN_MS + 1000, Lib.MAX_MS - 1000); + range[0] = ax.l2r(linCenter - 1000); + range[1] = ax.l2r(linCenter + 1000); + break; + } + } + else { + if(!isNumeric(range[i])) { + if(isNumeric(range[1 - i])) { + range[i] = range[1 - i] * (i ? 10 : 0.1); + } + else { + ax[rangeAttr] = dflt; + break; + } + } + + if(range[i] < -FP_SAFE) range[i] = -FP_SAFE; + else if(range[i] > FP_SAFE) range[i] = FP_SAFE; + + if(range[0] === range[1]) { + // somewhat arbitrary: split by 1 or 1ppm, whichever is bigger + var inc = Math.max(1, Math.abs(range[0] * 1e-6)); + range[0] -= inc; + range[1] += inc; + } + } + } + }; + + // find the range value at the specified (linear) fraction of the axis + ax.fraction2r = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return ax.l2r(rl0 + v * (rl1 - rl0)); + }; + + // find the fraction of the range at the specified range value + ax.r2fraction = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return (ax.r2l(v) - rl0) / (rl1 - rl0); + }; + // set scaling to pixels ax.setScale = function(usePrivateRange) { var gs = ax._gd._fullLayout._size, - i; + axLetter = ax._id.charAt(0); // TODO cleaner way to handle this case if(!ax._categories) ax._categories = []; @@ -40020,40 +40149,23 @@ module.exports = function setConvert(ax) { // issue if we transform the drawn layer *and* use the new axis range to // draw the data. This allows us to construct setConvert using the pre- // interaction values of the range: - var range = (usePrivateRange && ax._r) ? ax._r : ax.range; - - // make sure we have a range (linearized data values) - // and that it stays away from the limits of javascript numbers - if(!range || range.length !== 2 || range[0] === range[1]) { - range = [-1, 1]; - } - for(i = 0; i < 2; i++) { - if(!isNumeric(range[i])) { - range[i] = isNumeric(range[1 - i]) ? - (range[1 - i] * (i ? 10 : 0.1)) : - (i ? 1 : -1); - } + var rangeAttr = (usePrivateRange && ax._r) ? '_r' : 'range'; + ax.cleanRange(rangeAttr); - if(range[i] < -(Number.MAX_VALUE / 2)) { - range[i] = -(Number.MAX_VALUE / 2); - } - else if(range[i] > Number.MAX_VALUE / 2) { - range[i] = Number.MAX_VALUE / 2; - } + var rl0 = ax.r2l(ax[rangeAttr][0]), + rl1 = ax.r2l(ax[rangeAttr][1]); - } - - if(ax._id.charAt(0) === 'y') { + if(axLetter === 'y') { ax._offset = gs.t + (1 - ax.domain[1]) * gs.h; ax._length = gs.h * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[0] - range[1]); - ax._b = -ax._m * range[1]; + ax._m = ax._length / (rl0 - rl1); + ax._b = -ax._m * rl1; } else { ax._offset = gs.l + ax.domain[0] * gs.w; ax._length = gs.w * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[1] - range[0]); - ax._b = -ax._m * range[0]; + ax._m = ax._length / (rl1 - rl0); + ax._b = -ax._m * rl0; } if(!isFinite(ax._m) || !isFinite(ax._b)) { @@ -40066,7 +40178,7 @@ module.exports = function setConvert(ax) { }; ax.l2p = function(v) { - if(!isNumeric(v)) return constants.BADNUM; + if(!isNumeric(v)) return BADNUM; // include 2 fractional digits on pixel, for PDF zooming etc return d3.round(ax._b + ax._m * v, 2); @@ -40077,42 +40189,62 @@ module.exports = function setConvert(ax) { ax.c2p = function(v, clip) { return ax.l2p(ax.c2l(v, clip)); }; ax.p2c = function(px) { return ax.l2c(ax.p2l(px)); }; + // clip doesn't do anything here yet, but in v2.0 when log axes get + // refactored it will... so including it now so we don't forget. + ax.r2p = function(v, clip) { return ax.l2p(ax.r2l(v, clip)); }; + ax.p2r = function(px) { return ax.l2r(ax.p2l(px)); }; + + ax.r2c = function(v) { return ax.l2c(ax.r2l(v)); }; + ax.c2r = function(v) { return ax.l2r(ax.c2l(v)); }; + if(['linear', 'log', '-'].indexOf(ax.type) !== -1) { ax.c2d = num; - ax.d2c = function(v) { - v = cleanDatum(v); - return isNumeric(v) ? Number(v) : constants.BADNUM; - }; - ax.d2l = function(v, clip) { - if(ax.type === 'log') return ax.c2l(ax.d2c(v), clip); - else return ax.d2c(v); - }; + ax.d2c = Lib.cleanNumber; + if(ax.type === 'log') { + ax.d2l = function(v, clip) { + return ax.c2l(ax.d2c(v), clip); + }; + ax.d2r = ax.d2l; + ax.r2d = ax.l2d; + } + else { + ax.d2l = Lib.cleanNumber; + ax.d2r = Lib.cleanNumber; + ax.r2d = num; + } + ax.r2l = num; + ax.l2r = num; } else if(ax.type === 'date') { - ax.c2d = function(v) { - return isNumeric(v) ? Lib.ms2DateTime(v) : constants.BADNUM; - }; + ax.c2d = Lib.ms2DateTime; ax.d2c = function(v) { - return (isNumeric(v)) ? Number(v) : Lib.dateTime2ms(v); + // NOTE: Changed this behavior: previously we took any numeric value + // to be a ms, even if it was a string that could be a bare year. + // Now we convert it as a date if at all possible, and only try + // as ms if that fails. + var ms = Lib.dateTime2ms(v); + if(ms === BADNUM) { + if(isNumeric(v)) ms = Number(v); + else return BADNUM; + } + return Lib.constrain(ms, Lib.MIN_MS, Lib.MAX_MS); }; ax.d2l = ax.d2c; - - // check if date strings or js date objects are provided for range - // and convert to ms - if(ax.range && ax.range.length > 1) { - try { - var ar1 = ax.range.map(Lib.dateTime2ms); - if(!isNumeric(ax.range[0]) && isNumeric(ar1[0])) { - ax.range[0] = ar1[0]; - } - if(!isNumeric(ax.range[1]) && isNumeric(ar1[1])) { - ax.range[1] = ar1[1]; - } - } - catch(e) { Lib.error(e, ax.range); } - } + ax.r2l = ax.d2c; + ax.l2r = ax.c2d; + ax.d2r = Lib.identity; + ax.r2d = Lib.identity; + ax.cleanr = function(v) { + /* + * If v is already a date string this is a noop, but running it + * through d2c and back validates the value: + * normalizes Date objects, milliseconds, and out-of-bounds dates + * so we always end up with either a clean date string or BADNUM + */ + return ax.c2d(ax.d2c(v)); + }; } else if(ax.type === 'category') { @@ -40135,38 +40267,42 @@ module.exports = function setConvert(ax) { } var c = ax._categories.indexOf(v); - return c === -1 ? constants.BADNUM : c; + return c === -1 ? BADNUM : c; }; ax.d2l = ax.d2c; + ax.r2l = num; + ax.l2r = num; + ax.d2r = ax.d2c; + ax.r2d = ax.c2d; } // makeCalcdata: takes an x or y array and converts it // to a position on the axis object "ax" // inputs: - // tdc - a data object from td.data - // axletter - a string, either 'x' or 'y', for which item + // trace - a data object from gd.data + // axLetter - a string, either 'x' or 'y', for which item // to convert (TODO: is this now always the same as // the first letter of ax._id?) // in case the expected data isn't there, make a list of // integers based on the opposite data - ax.makeCalcdata = function(tdc, axletter) { + ax.makeCalcdata = function(trace, axLetter) { var arrayIn, arrayOut, i; - if(axletter in tdc) { - arrayIn = tdc[axletter]; + if(axLetter in trace) { + arrayIn = trace[axLetter]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = ax.d2c(arrayIn[i]); } else { - var v0 = ((axletter + '0') in tdc) ? - ax.d2c(tdc[axletter + '0']) : 0, - dv = (tdc['d' + axletter]) ? - Number(tdc['d' + axletter]) : 1; + var v0 = ((axLetter + '0') in trace) ? + ax.d2c(trace[axLetter + '0']) : 0, + dv = (trace['d' + axLetter]) ? + Number(trace['d' + axLetter]) : 1; // the opposing data, for size if we have x and dx etc - arrayIn = tdc[{x: 'y', y: 'x'}[axletter]]; + arrayIn = trace[{x: 'y', y: 'x'}[axLetter]]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = v0 + i * dv; @@ -40181,11 +40317,11 @@ module.exports = function setConvert(ax) { ax._max = []; // and for bar charts and box plots: reset forced minimum tick spacing - ax._minDtick = null; - ax._forceTick0 = null; + delete ax._minDtick; + delete ax._forceTick0; }; -},{"../../lib":121,"./axis_ids":150,"./clean_datum":152,"./constants":153,"d3":14,"fast-isnumeric":17}],163:[function(require,module,exports){ +},{"../../constants/numerical":110,"../../lib":122,"./axis_ids":152,"./constants":154,"d3":14,"fast-isnumeric":17}],164:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40255,8 +40391,8 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe */ function getShowAttrDflt(containerIn) { var showAttrsAll = ['showexponent', - 'showtickprefix', - 'showticksuffix'], + 'showtickprefix', + 'showticksuffix'], showAttrs = showAttrsAll.filter(function(a) { return containerIn[a] !== undefined; }), @@ -40269,7 +40405,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":121}],164:[function(require,module,exports){ +},{"../../lib":122}],165:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40302,7 +40438,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":121,"./layout_attributes":157}],165:[function(require,module,exports){ +},{"../../lib":122,"./layout_attributes":158}],166:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40315,6 +40451,8 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, 'use strict'; var isNumeric = require('fast-isnumeric'); +var Lib = require('../../lib'); +var ONEDAY = require('../../constants/numerical').ONEDAY; module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType) { @@ -40326,15 +40464,56 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } if(Array.isArray(containerIn.tickvals)) tickmodeDefault = 'array'; - else if(containerIn.dtick && isNumeric(containerIn.dtick)) { + else if(containerIn.dtick) { tickmodeDefault = 'linear'; } var tickmode = coerce('tickmode', tickmodeDefault); if(tickmode === 'auto') coerce('nticks'); else if(tickmode === 'linear') { - coerce('tick0'); - coerce('dtick'); + // dtick is usually a positive number, but there are some + // special strings available for log or date axes + // default is 1 day for dates, otherwise 1 + var dtickDflt = (axType === 'date') ? ONEDAY : 1; + var dtick = coerce('dtick', dtickDflt); + if(isNumeric(dtick)) { + containerOut.dtick = (dtick > 0) ? Number(dtick) : dtickDflt; + } + else if(typeof dtick !== 'string') { + containerOut.dtick = dtickDflt; + } + else { + // date and log special cases are all one character plus a number + var prefix = dtick.charAt(0), + dtickNum = dtick.substr(1); + + dtickNum = isNumeric(dtickNum) ? Number(dtickNum) : 0; + if((dtickNum <= 0) || !( + // "M" gives ticks every (integer) n months + (axType === 'date' && prefix === 'M' && dtickNum === Math.round(dtickNum)) || + // "L" gives ticks linearly spaced in data (not in position) every (float) f + (axType === 'log' && prefix === 'L') || + // "D1" gives powers of 10 with all small digits between, "D2" gives only 2 and 5 + (axType === 'log' && prefix === 'D' && (dtickNum === 1 || dtickNum === 2)) + )) { + containerOut.dtick = dtickDflt; + } + } + + // tick0 can have different valType for different axis types, so + // validate that now. Also for dates, change milliseconds to date strings + var tick0Dflt = (axType === 'date') ? '2000-01-01' : 0; + var tick0 = coerce('tick0', tick0Dflt); + if(axType === 'date') { + containerOut.tick0 = Lib.cleanDate(tick0, tick0Dflt); + } + // Aside from date axes, dtick must be numeric; D1 and D2 modes ignore tick0 entirely + else if(isNumeric(tick0) && dtick !== 'D1' && dtick !== 'D2') { + containerOut.tick0 = Number(tick0); + } + else { + containerOut.tick0 = tick0Dflt; + } } else { var tickvals = coerce('tickvals'); @@ -40343,7 +40522,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"fast-isnumeric":17}],166:[function(require,module,exports){ +},{"../../constants/numerical":110,"../../lib":122,"fast-isnumeric":17}],167:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40655,7 +40834,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../lib":121,"../../plotly":143,"../../registry":187,"./axes":147,"d3":14}],167:[function(require,module,exports){ +},{"../../lib":122,"../../plotly":144,"../../registry":188,"./axes":149,"d3":14}],168:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41067,7 +41246,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":121,"../plotly":143}],168:[function(require,module,exports){ +},{"../lib":122,"../plotly":144}],169:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41098,7 +41277,7 @@ module.exports = { } }; -},{}],169:[function(require,module,exports){ +},{}],170:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41139,7 +41318,7 @@ module.exports = { } }; -},{}],170:[function(require,module,exports){ +},{}],171:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41281,28 +41460,22 @@ module.exports = { }, - _composedModules: { - '*': 'Fx' + dragmode: { + valType: 'enumerated', + + values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], + dflt: 'zoom', + }, - - _nestedModules: { - 'xaxis': 'Axes', - 'yaxis': 'Axes', - 'scene': 'gl3d', - 'geo': 'geo', - 'ternary': 'ternary', - 'mapbox': 'mapbox', - - 'legend': 'legend', - 'annotations': 'annotations', - 'shapes': 'shapes', - 'images': 'images', - 'updatemenus': 'updatemenus', - 'sliders': 'sliders' + hovermode: { + valType: 'enumerated', + + values: ['x', 'y', 'closest', false], + } }; -},{"../components/color/attributes":29,"../lib":121,"./font_attributes":168}],171:[function(require,module,exports){ +},{"../components/color/attributes":29,"../lib":122,"./font_attributes":169}],172:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41340,7 +41513,7 @@ module.exports = { } }; -},{}],172:[function(require,module,exports){ +},{}],173:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41707,6 +41880,9 @@ plots.sendDataToCloud = function(gd) { // gd._fullLayout._basePlotModules // is a list of all the plot modules required to draw the plot. // +// gd._fullLayout._transformModules +// is a list of all the transform modules invoked. +// plots.supplyDefaults = function(gd) { var oldFullLayout = gd._fullLayout || {}, newFullLayout = gd._fullLayout = {}, @@ -41718,6 +41894,9 @@ plots.supplyDefaults = function(gd) { var i; + // Create all the storage space for frames, but only if doesn't already exist + if(!gd._transitionData) plots.createTransitionData(gd); + // first fill in what we can of layout without looking at data // because fullData needs a few things from layout @@ -41778,7 +41957,7 @@ plots.supplyDefaults = function(gd) { } // finally, fill in the pieces of layout that may need to look at data - plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData); + plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData); // TODO remove in v2.0.0 // add has-plot-type refs to fullLayout for backward compatibility @@ -41817,12 +41996,6 @@ plots.supplyDefaults = function(gd) { (gd.calcdata[i][0] || {}).trace = trace; } } - - // Create all the storage space for frames, but only if doesn't already - // exist: - if(!gd._transitionData) { - plots.createTransitionData(gd); - } }; // Create storage for all of the data related to frames and transitions: @@ -41989,6 +42162,8 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) { basePlotModules = fullLayout._basePlotModules = [], cnt = 0; + fullLayout._transformModules = []; + function pushModule(fullTrace) { dataOut.push(fullTrace); @@ -42206,6 +42381,8 @@ function supplyTransformDefaults(traceIn, traceOut, layout) { transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn); transformOut.type = type; transformOut._module = _module; + + Lib.pushUnique(layout._transformModules, _module); } else { transformOut = Lib.extendFlat({}, transformIn); @@ -42375,7 +42552,7 @@ function calculateReservedMargins(margins) { return resultingMargin; } -plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { +plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, transitionData) { var i, _module; // can't be be part of basePlotModules loop @@ -42406,6 +42583,16 @@ plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { } } + // transform module layout defaults + var transformModules = layoutOut._transformModules; + for(i = 0; i < transformModules.length; i++) { + _module = transformModules[i]; + + if(_module.supplyLayoutDefaults) { + _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData, transitionData); + } + } + // should FX be a component? Plotly.Fx.supplyLayoutDefaults(layoutIn, layoutOut, fullData); @@ -42433,8 +42620,16 @@ plots.purge = function(gd) { // remove modebar if(fullLayout._modeBar) fullLayout._modeBar.destroy(); - if(gd._transitionData && gd._transitionData._animationRaf) { - window.cancelAnimationFrame(gd._transitionData._animationRaf); + if(gd._transitionData) { + // Ensure any dangling callbacks are simply dropped if the plot is purged. + // This is more or less only actually important for testing. + if(gd._transitionData._interruptCallbacks) { + gd._transitionData._interruptCallbacks.length = 0; + } + + if(gd._transitionData._animationRaf) { + window.cancelAnimationFrame(gd._transitionData._animationRaf); + } } // data and layout @@ -42711,9 +42906,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { // convert native dates to date strings... // mostly for external users exporting to plotly - if(d && d.getTime) { - return Lib.ms2DateTime(d); - } + if(Lib.isJSDate(d)) return Lib.ms2DateTime(+d); return d; } @@ -42758,7 +42951,7 @@ plots.modifyFrames = function(gd, operations) { break;*/ case 'replace': frame = op.value; - var oldName = _frames[op.index].name; + var oldName = (_frames[op.index] || {}).name; var newName = frame.name; _frames[op.index] = _hash[newName] = frame; @@ -42892,8 +43085,14 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { for(i = 0; i < containerPaths.length; i++) { containerProp = Lib.nestedProperty(expandedObj, containerPaths[i]); containerVal = containerProp.get(); - containerProp.set(null); - Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + + if(containerVal === undefined) { + Lib.nestedProperty(containerObj, containerPaths[i]).set(null); + } + else { + containerProp.set(null); + Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + } } } @@ -42907,15 +43106,20 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { if(!srcContainer) continue; destProp = Lib.nestedProperty(dest, containerPaths[i]); - destContainer = destProp.get(); + if(!Array.isArray(destContainer)) { destContainer = []; destProp.set(destContainer); } for(j = 0; j < srcContainer.length; j++) { - destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcContainer[j]); + var srcObj = srcContainer[j]; + + if(srcObj === null) destContainer[j] = null; + else { + destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcObj); + } } destProp.set(destContainer); @@ -42926,7 +43130,7 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { }; plots.dataArrayContainers = ['transforms']; -plots.layoutArrayContainers = ['annotations', 'shapes', 'images', 'sliders', 'updatemenus']; +plots.layoutArrayContainers = Registry.layoutArrayContainers; /* * Extend a trace definition. This method: @@ -42985,11 +43189,15 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var trace = gd._fullData[traceIdx]; var module = trace._module; - if(!module || !module.animatable) { - continue; - } + // There's nothing to do if this module is not defined: + if(!module) continue; - transitionedTraces.push(traceIdx); + // Don't register the trace as transitioned if it doens't know what to do. + // If it *is* registered, it will receive a callback that it's responsible + // for calling in order to register the transition as having completed. + if(module.animatable) { + transitionedTraces.push(traceIdx); + } gd.data[traceIndices[i]] = plots.extendTrace(gd.data[traceIndices[i]], data[i]); } @@ -43043,6 +43251,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var aborted = false; function executeTransitions() { + + gd.emit('plotly_transitioning', []); + return new Promise(function(resolve) { // This flag is used to disabled things like autorange: gd._transitioning = true; @@ -43127,6 +43338,11 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function completeTransition(callback) { + // This a simple workaround for tests which purge the graph before animations + // have completed. That's not a very common case, so this is the simplest + // fix. + if(!gd._transitionData) return; + flushCallbacks(gd._transitionData._interruptCallbacks); return Promise.resolve().then(function() { @@ -43144,6 +43360,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function interruptPreviousTransitions() { + // Fail-safe against purged plot: + if(!gd._transitionData) return; + // If a transition is interrupted, set this to false. At the moment, the only thing that would // interrupt a transition is another transition, so that it will momentarily be set to true // again, but this determines whether autorange or dragbox work, so it's for the sake of @@ -43171,13 +43390,13 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var seq = [plots.previousPromises, interruptPreviousTransitions, prepareTransitions, executeTransitions]; - var transitionStarting = Lib.syncOrAsync(seq, gd); - if(!transitionStarting || !transitionStarting.then) transitionStarting = Promise.resolve(); + if(!transitionStarting || !transitionStarting.then) { + transitionStarting = Promise.resolve(); + } return transitionStarting.then(function() { - gd.emit('plotly_transitioning', []); return gd; }); }; @@ -43280,7 +43499,7 @@ plots.doCalcdata = function(gd, traces) { } }; -},{"../components/color":30,"../components/errorbars":60,"../lib":121,"../plotly":143,"../registry":187,"./animation_attributes":144,"./attributes":145,"./command":167,"./font_attributes":168,"./frame_attributes":169,"./layout_attributes":170,"d3":14,"fast-isnumeric":17}],173:[function(require,module,exports){ +},{"../components/color":30,"../components/errorbars":59,"../lib":122,"../plotly":144,"../registry":188,"./animation_attributes":145,"./attributes":147,"./command":168,"./font_attributes":169,"./frame_attributes":170,"./layout_attributes":171,"d3":14,"fast-isnumeric":17}],174:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43305,7 +43524,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":269}],174:[function(require,module,exports){ +},{"../../traces/scatter/attributes":271}],175:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43420,7 +43639,7 @@ module.exports = { } }; -},{"../../lib/extend":118,"../cartesian/layout_attributes":157}],175:[function(require,module,exports){ +},{"../../lib/extend":119,"../cartesian/layout_attributes":158}],176:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43435,7 +43654,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":176,"./micropolar_manager":177}],176:[function(require,module,exports){ +},{"./micropolar":177,"./micropolar_manager":178}],177:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44854,7 +45073,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":121,"d3":14}],177:[function(require,module,exports){ +},{"../../lib":122,"d3":14}],178:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44940,7 +45159,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":30,"../../lib":121,"./micropolar":176,"./undo_manager":178,"d3":14}],178:[function(require,module,exports){ +},{"../../components/color":30,"../../lib":122,"./micropolar":177,"./undo_manager":179,"d3":14}],179:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45006,7 +45225,7 @@ module.exports = function UndoManager() { }; }; -},{}],179:[function(require,module,exports){ +},{}],180:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45081,7 +45300,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":121,"./plots":172}],180:[function(require,module,exports){ +},{"../lib":122,"./plots":173}],181:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45155,7 +45374,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/plots":172,"./layout/attributes":181,"./layout/defaults":184,"./layout/layout_attributes":185,"./ternary":186}],181:[function(require,module,exports){ +},{"../../plots/plots":173,"./layout/attributes":182,"./layout/defaults":185,"./layout/layout_attributes":186,"./ternary":187}],182:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45176,7 +45395,7 @@ module.exports = { } }; -},{}],182:[function(require,module,exports){ +},{}],183:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45236,7 +45455,7 @@ module.exports = { } }; -},{"../../../lib/extend":118,"../../cartesian/layout_attributes":157}],183:[function(require,module,exports){ +},{"../../../lib/extend":119,"../../cartesian/layout_attributes":158}],184:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45320,7 +45539,7 @@ module.exports = function supplyLayoutDefaults(containerIn, containerOut, option } }; -},{"../../../lib":121,"../../cartesian/tick_label_defaults":163,"../../cartesian/tick_mark_defaults":164,"../../cartesian/tick_value_defaults":165,"./axis_attributes":182,"tinycolor2":20}],184:[function(require,module,exports){ +},{"../../../lib":122,"../../cartesian/tick_label_defaults":164,"../../cartesian/tick_mark_defaults":165,"../../cartesian/tick_value_defaults":166,"./axis_attributes":183,"tinycolor2":20}],185:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45383,7 +45602,7 @@ function handleTernaryDefaults(ternaryLayoutIn, ternaryLayoutOut, coerce, option } } -},{"../../../components/color":30,"../../subplot_defaults":179,"./axis_defaults":183,"./layout_attributes":185}],185:[function(require,module,exports){ +},{"../../../components/color":30,"../../subplot_defaults":180,"./axis_defaults":184,"./layout_attributes":186}],186:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45439,7 +45658,7 @@ module.exports = { caxis: ternaryAxesAttrs }; -},{"../../../components/color/attributes":29,"./axis_attributes":182}],186:[function(require,module,exports){ +},{"../../../components/color/attributes":29,"./axis_attributes":183}],187:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45461,7 +45680,6 @@ var Drawing = require('../../components/drawing'); var setConvert = require('../cartesian/set_convert'); var extendFlat = require('../../lib/extend').extendFlat; var Axes = require('../cartesian/axes'); -var filterVisible = require('../../lib/filter_visible'); var dragElement = require('../../components/dragelement'); var Titles = require('../../components/titles'); var prepSelect = require('../cartesian/select'); @@ -45536,7 +45754,7 @@ proto.plot = function(ternaryData, fullLayout) { var moduleData = traceHash[moduleNames[i]]; var _module = moduleData[0]._module; - _module.plot(_this, filterVisible(moduleData), ternaryLayout); + _module.plot(_this, Lib.filterVisible(moduleData), ternaryLayout); } _this.traceHash = traceHash; @@ -46129,7 +46347,7 @@ function removeZoombox(gd) { .remove(); } -},{"../../components/color":30,"../../components/dragelement":52,"../../components/drawing":54,"../../components/titles":105,"../../lib":121,"../../lib/extend":118,"../../lib/filter_visible":120,"../../plotly":143,"../cartesian/axes":147,"../cartesian/constants":153,"../cartesian/graph_interact":155,"../cartesian/select":161,"../cartesian/set_convert":162,"d3":14,"tinycolor2":20}],187:[function(require,module,exports){ +},{"../../components/color":30,"../../components/dragelement":51,"../../components/drawing":53,"../../components/titles":104,"../../lib":122,"../../lib/extend":119,"../../plotly":144,"../cartesian/axes":149,"../cartesian/constants":154,"../cartesian/graph_interact":156,"../cartesian/select":162,"../cartesian/set_convert":163,"d3":14,"tinycolor2":20}],188:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46145,11 +46363,12 @@ var Lib = require('./lib'); var basePlotAttributes = require('./plots/attributes'); exports.modules = {}; -exports.allTypes = []; exports.allCategories = {}; +exports.allTypes = []; exports.subplotsRegistry = {}; exports.transformsRegistry = {}; exports.componentsRegistry = {}; +exports.layoutArrayContainers = []; /** * register a module as the handler for a trace type @@ -46215,6 +46434,16 @@ exports.registerSubplot = function(_module) { exports.subplotsRegistry[plotType] = _module; }; +exports.registerComponent = function(_module) { + var name = _module.name; + + exports.componentsRegistry[name] = _module; + + if(_module.layoutAttributes && _module.layoutAttributes._isLinkedToArray) { + Lib.pushUnique(exports.layoutArrayContainers, name); + } +}; + /** * Get registered module using trace object or trace type * @@ -46286,7 +46515,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib":121,"./plots/attributes":145}],188:[function(require,module,exports){ +},{"./lib":122,"./plots/attributes":147}],189:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46413,11 +46642,12 @@ module.exports = function clonePlot(graphObj, options) { } } - var td = document.createElement('div'); - if(options.tileClass) td.className = options.tileClass; + var gd = document.createElement('div'); + if(options.tileClass) gd.className = options.tileClass; var plotTile = { - td: td, + gd: gd, + td: gd, // for external (image server) compatibility layout: newLayout, data: newData, config: { @@ -46437,13 +46667,13 @@ module.exports = function clonePlot(graphObj, options) { plotTile.config.setBackground = options.setBackground || 'opaque'; } - // attaching the default Layout the td, so you can grab it later - plotTile.td.defaultLayout = cloneLayoutOverride(options.tileClass); + // attaching the default Layout the gd, so you can grab it later + plotTile.gd.defaultLayout = cloneLayoutOverride(options.tileClass); return plotTile; }; -},{"../lib":121,"../plots/plots":172}],189:[function(require,module,exports){ +},{"../lib":122,"../plots/plots":173}],190:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46509,7 +46739,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":121,"../plot_api/to_image":141,"./filesaver":190}],190:[function(require,module,exports){ +},{"../lib":122,"../plot_api/to_image":142,"./filesaver":191}],191:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46577,7 +46807,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],191:[function(require,module,exports){ +},{}],192:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46610,7 +46840,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],192:[function(require,module,exports){ +},{}],193:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46636,7 +46866,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":188,"./download":189,"./helpers":191,"./svgtoimg":193,"./toimage":194,"./tosvg":195}],193:[function(require,module,exports){ +},{"./cloneplot":189,"./download":190,"./helpers":192,"./svgtoimg":194,"./toimage":195,"./tosvg":196}],194:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46767,7 +46997,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":121,"events":16}],194:[function(require,module,exports){ +},{"../lib":122,"events":16}],195:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46800,7 +47030,7 @@ function toImage(gd, opts) { var ev = new EventEmitter(); var clone = clonePlot(gd, {format: 'png'}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -46847,7 +47077,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":121,"../plotly":143,"./cloneplot":188,"./helpers":191,"./svgtoimg":193,"./tosvg":195,"events":16}],195:[function(require,module,exports){ +},{"../lib":122,"../plotly":144,"./cloneplot":189,"./helpers":192,"./svgtoimg":194,"./tosvg":196,"events":16}],196:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46966,7 +47196,7 @@ module.exports = function toSVG(gd, format) { return s; }; -},{"../components/color":30,"../components/drawing":54,"../constants/xmlns_namespaces":112,"../lib/svg_text_utils":133,"d3":14}],196:[function(require,module,exports){ +},{"../components/color":30,"../components/drawing":53,"../constants/xmlns_namespaces":112,"../lib/svg_text_utils":134,"d3":14}],197:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46998,7 +47228,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":121}],197:[function(require,module,exports){ +},{"../../lib":122}],198:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47011,6 +47241,9 @@ module.exports = function arraysToCalcdata(cd) { var scatterAttrs = require('../scatter/attributes'); var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; var scatterMarkerAttrs = scatterAttrs.marker; @@ -47024,9 +47257,11 @@ var markerLine = extendFlat({}, { }, colorAttributes('marker.line')); var marker = extendFlat({}, { - showscale: scatterMarkerAttrs.showscale, line: markerLine -}, colorAttributes('marker')); +}, colorAttributes('marker'), { + showscale: scatterMarkerAttrs.showscale, + colorbar: colorbarAttrs +}); module.exports = { @@ -47075,11 +47310,8 @@ module.exports = { r: scatterAttrs.r, t: scatterAttrs.t, - _nestedModules: { // nested module coupling - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - }, + error_y: errorBarAttrs, + error_x: errorBarAttrs, _deprecated: { bardir: { @@ -47091,7 +47323,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":38,"../../lib/extend":118,"../scatter/attributes":269}],198:[function(require,module,exports){ +},{"../../components/colorbar/attributes":31,"../../components/colorscale/color_attributes":37,"../../components/errorbars/attributes":55,"../../lib/extend":119,"../scatter/attributes":271}],199:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47187,7 +47419,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":37,"../../components/colorscale/has_colorscale":44,"../../plots/cartesian/axes":147,"fast-isnumeric":17}],199:[function(require,module,exports){ +},{"../../components/colorscale/calc":36,"../../components/colorscale/has_colorscale":43,"../../plots/cartesian/axes":149,"fast-isnumeric":17}],200:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47232,7 +47464,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":30,"../../components/errorbars/defaults":59,"../../lib":121,"../bar/style_defaults":208,"../scatter/xy_defaults":291,"./attributes":197}],200:[function(require,module,exports){ +},{"../../components/color":30,"../../components/errorbars/defaults":58,"../../lib":122,"../bar/style_defaults":209,"../scatter/xy_defaults":293,"./attributes":198}],201:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47302,7 +47534,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { if(trace.orientation === 'h') { pointData.x0 = pointData.x1 = xa.c2p(di.x, true); - pointData.xLabelVal = di.s; + pointData.xLabelVal = di.b + di.s; pointData.y0 = ya.c2p(barPos(di) - barDelta, true); pointData.y1 = ya.c2p(barPos(di) + barDelta, true); @@ -47310,7 +47542,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } else { pointData.y0 = pointData.y1 = ya.c2p(di.y, true); - pointData.yLabelVal = di.s; + pointData.yLabelVal = di.b + di.s; pointData.x0 = xa.c2p(barPos(di) - barDelta, true); pointData.x1 = xa.c2p(barPos(di) + barDelta, true); @@ -47324,7 +47556,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return [pointData]; }; -},{"../../components/color":30,"../../components/errorbars":60,"../../plots/cartesian/graph_interact":155}],201:[function(require,module,exports){ +},{"../../components/color":30,"../../components/errorbars":59,"../../plots/cartesian/graph_interact":156}],202:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47360,7 +47592,7 @@ Bar.meta = { module.exports = Bar; -},{"../../plots/cartesian":156,"../scatter/colorbar":272,"./arrays_to_calcdata":196,"./attributes":197,"./calc":198,"./defaults":199,"./hover":200,"./layout_attributes":202,"./layout_defaults":203,"./plot":204,"./set_positions":205,"./style":207}],202:[function(require,module,exports){ +},{"../../plots/cartesian":157,"../scatter/colorbar":274,"./arrays_to_calcdata":197,"./attributes":198,"./calc":199,"./defaults":200,"./hover":201,"./layout_attributes":203,"./layout_defaults":204,"./plot":205,"./set_positions":206,"./style":208}],203:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47404,7 +47636,7 @@ module.exports = { } }; -},{}],203:[function(require,module,exports){ +},{}],204:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47462,7 +47694,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":121,"../../plots/cartesian/axes":147,"../../registry":187,"./layout_attributes":202}],204:[function(require,module,exports){ +},{"../../lib":122,"../../plots/cartesian/axes":149,"../../registry":188,"./layout_attributes":203}],205:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47583,7 +47815,7 @@ module.exports = function plot(gd, plotinfo, cdbar) { }; -},{"../../components/color":30,"../../components/errorbars":60,"../../lib":121,"./arrays_to_calcdata":196,"d3":14,"fast-isnumeric":17}],205:[function(require,module,exports){ +},{"../../components/color":30,"../../components/errorbars":59,"../../lib":122,"./arrays_to_calcdata":197,"d3":14,"fast-isnumeric":17}],206:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48071,8 +48303,8 @@ function stackBars(gd, sa, sieve) { if(!isNumeric(bar.s)) continue; // stack current bar and get previous sum - var barBase = sieve.put(bar.p, bar.s), - barTop = barBase + bar.s; + var barBase = sieve.put(bar.p, bar.b + bar.s), + barTop = barBase + bar.b + bar.s; // store the bar base and top in each calcdata item bar.b = barBase; @@ -48110,7 +48342,7 @@ function sieveBars(gd, sa, sieve) { for(var j = 0; j < trace.length; j++) { var bar = trace[j]; - if(isNumeric(bar.s)) sieve.put(bar.p, bar.s); + if(isNumeric(bar.s)) sieve.put(bar.p, bar.b + bar.s); } } } @@ -48179,7 +48411,7 @@ function getAxisLetter(ax) { return ax._id.charAt(0); } -},{"../../plots/cartesian/axes":147,"../../registry":187,"./sieve.js":206,"fast-isnumeric":17}],206:[function(require,module,exports){ +},{"../../plots/cartesian/axes":149,"../../registry":188,"./sieve.js":207,"fast-isnumeric":17}],207:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48280,7 +48512,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../lib":121}],207:[function(require,module,exports){ +},{"../../lib":122}],208:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48324,9 +48556,8 @@ module.exports = function style(gd) { var trace = d[0].trace, marker = trace.marker, markerLine = marker.line, - markerIn = (trace._input || {}).marker || {}, - markerScale = Drawing.tryColorscale(marker, markerIn, ''), - lineScale = Drawing.tryColorscale(marker, markerIn, 'line.'); + markerScale = Drawing.tryColorscale(marker, ''), + lineScale = Drawing.tryColorscale(marker, 'line'); d3.select(this).selectAll('path').each(function(d) { // allow all marker and marker line colors to be scaled @@ -48359,7 +48590,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/color":30,"../../components/drawing":54,"../../components/errorbars":60,"d3":14}],208:[function(require,module,exports){ +},{"../../components/color":30,"../../components/drawing":53,"../../components/errorbars":59,"d3":14}],209:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48396,7 +48627,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('marker.line.width'); }; -},{"../../components/color":30,"../../components/colorscale/defaults":40,"../../components/colorscale/has_colorscale":44}],209:[function(require,module,exports){ +},{"../../components/color":30,"../../components/colorscale/defaults":39,"../../components/colorscale/has_colorscale":43}],210:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48527,7 +48758,7 @@ module.exports = { fillcolor: scatterAttrs.fillcolor }; -},{"../../components/color/attributes":29,"../../lib/extend":118,"../scatter/attributes":269}],210:[function(require,module,exports){ +},{"../../components/color/attributes":29,"../../lib/extend":119,"../scatter/attributes":271}],211:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48676,7 +48907,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":121,"../../plots/cartesian/axes":147,"fast-isnumeric":17}],211:[function(require,module,exports){ +},{"../../lib":122,"../../plots/cartesian/axes":149,"fast-isnumeric":17}],212:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48745,7 +48976,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { } }; -},{"../../components/color":30,"../../lib":121,"./attributes":209}],212:[function(require,module,exports){ +},{"../../components/color":30,"../../lib":122,"./attributes":210}],213:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48854,7 +49085,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return closeData; }; -},{"../../components/color":30,"../../lib":121,"../../plots/cartesian/axes":147,"../../plots/cartesian/graph_interact":155}],213:[function(require,module,exports){ +},{"../../components/color":30,"../../lib":122,"../../plots/cartesian/axes":149,"../../plots/cartesian/graph_interact":156}],214:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48887,7 +49118,7 @@ Box.meta = { module.exports = Box; -},{"../../plots/cartesian":156,"./attributes":209,"./calc":210,"./defaults":211,"./hover":212,"./layout_attributes":214,"./layout_defaults":215,"./plot":216,"./set_positions":217,"./style":218}],214:[function(require,module,exports){ +},{"../../plots/cartesian":157,"./attributes":210,"./calc":211,"./defaults":212,"./hover":213,"./layout_attributes":215,"./layout_defaults":216,"./plot":217,"./set_positions":218,"./style":219}],215:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48925,7 +49156,7 @@ module.exports = { } }; -},{}],215:[function(require,module,exports){ +},{}],216:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48959,7 +49190,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { coerce('boxgroupgap'); }; -},{"../../lib":121,"../../registry":187,"./layout_attributes":214}],216:[function(require,module,exports){ +},{"../../lib":122,"../../registry":188,"./layout_attributes":215}],217:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49199,7 +49430,7 @@ module.exports = function plot(gd, plotinfo, cdbox) { }); }; -},{"../../components/drawing":54,"../../lib":121,"d3":14}],217:[function(require,module,exports){ +},{"../../components/drawing":53,"../../lib":122,"d3":14}],218:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49293,7 +49524,7 @@ module.exports = function setPositions(gd, plotinfo) { } }; -},{"../../lib":121,"../../plots/cartesian/axes":147,"../../registry":187}],218:[function(require,module,exports){ +},{"../../lib":122,"../../plots/cartesian/axes":149,"../../registry":188}],219:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49332,7 +49563,7 @@ module.exports = function style(gd) { }); }; -},{"../../components/color":30,"../../components/drawing":54,"d3":14}],219:[function(require,module,exports){ +},{"../../components/color":30,"../../components/drawing":53,"d3":14}],220:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49346,93 +49577,90 @@ module.exports = function style(gd) { var heatmapAttrs = require('../heatmap/attributes'); var scatterAttrs = require('../scatter/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line; -module.exports = extendFlat({}, - { - z: heatmapAttrs.z, - x: heatmapAttrs.x, - x0: heatmapAttrs.x0, - dx: heatmapAttrs.dx, - y: heatmapAttrs.y, - y0: heatmapAttrs.y0, - dy: heatmapAttrs.dy, - text: heatmapAttrs.text, - transpose: heatmapAttrs.transpose, - xtype: heatmapAttrs.xtype, - ytype: heatmapAttrs.ytype, - - connectgaps: heatmapAttrs.connectgaps, - - autocontour: { - valType: 'boolean', - dflt: true, +module.exports = extendFlat({}, { + z: heatmapAttrs.z, + x: heatmapAttrs.x, + x0: heatmapAttrs.x0, + dx: heatmapAttrs.dx, + y: heatmapAttrs.y, + y0: heatmapAttrs.y0, + dy: heatmapAttrs.dy, + text: heatmapAttrs.text, + transpose: heatmapAttrs.transpose, + xtype: heatmapAttrs.xtype, + ytype: heatmapAttrs.ytype, + + connectgaps: heatmapAttrs.connectgaps, + + autocontour: { + valType: 'boolean', + dflt: true, + + + }, + ncontours: { + valType: 'integer', + dflt: 0, + + + }, + + contours: { + start: { + valType: 'number', + dflt: null, }, - ncontours: { - valType: 'integer', - dflt: 0, + end: { + valType: 'number', + dflt: null, }, - - contours: { - start: { - valType: 'number', - dflt: null, - - - }, - end: { - valType: 'number', - dflt: null, - - - }, - size: { - valType: 'number', - dflt: null, - - - }, - coloring: { - valType: 'enumerated', - values: ['fill', 'heatmap', 'lines', 'none'], - dflt: 'fill', - - - }, - showlines: { - valType: 'boolean', - dflt: true, - - - } + size: { + valType: 'number', + dflt: null, + + }, - - line: { - color: extendFlat({}, scatterLineAttrs.color, { - - }), - width: scatterLineAttrs.width, - dash: scatterLineAttrs.dash, - smoothing: extendFlat({}, scatterLineAttrs.smoothing, { - - }) + coloring: { + valType: 'enumerated', + values: ['fill', 'heatmap', 'lines', 'none'], + dflt: 'fill', + + }, - - _nestedModules: { - 'colorbar': 'Colorbar' + showlines: { + valType: 'boolean', + dflt: true, + + } }, + + line: { + color: extendFlat({}, scatterLineAttrs.color, { + + }), + width: scatterLineAttrs.width, + dash: scatterLineAttrs.dash, + smoothing: extendFlat({}, scatterLineAttrs.smoothing, { + + }) + } +}, colorscaleAttrs, - {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} + { autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}) }, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":36,"../../lib/extend":118,"../heatmap/attributes":229,"../scatter/attributes":269}],220:[function(require,module,exports){ +},{"../../components/colorbar/attributes":31,"../../components/colorscale/attributes":35,"../../lib/extend":119,"../heatmap/attributes":230,"../scatter/attributes":271}],221:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49485,7 +49713,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../plots/cartesian/axes":147,"../heatmap/calc":230}],221:[function(require,module,exports){ +},{"../../plots/cartesian/axes":149,"../heatmap/calc":231}],222:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49546,7 +49774,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":33,"../../plots/plots":172,"./make_color_map":225}],222:[function(require,module,exports){ +},{"../../components/colorbar/draw":33,"../../plots/plots":173,"./make_color_map":226}],223:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49590,7 +49818,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":121,"../contour/style_defaults":228,"../heatmap/has_columns":234,"../heatmap/xyz_defaults":240,"./attributes":219}],223:[function(require,module,exports){ +},{"../../lib":122,"../contour/style_defaults":229,"../heatmap/has_columns":235,"../heatmap/xyz_defaults":241,"./attributes":220}],224:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49609,7 +49837,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return heatmapHoverPoints(pointData, xval, yval, hovermode, true); }; -},{"../heatmap/hover":235}],224:[function(require,module,exports){ +},{"../heatmap/hover":236}],225:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49641,7 +49869,7 @@ Contour.meta = { module.exports = Contour; -},{"../../plots/cartesian":156,"./attributes":219,"./calc":220,"./colorbar":221,"./defaults":222,"./hover":223,"./plot":226,"./style":227}],225:[function(require,module,exports){ +},{"../../plots/cartesian":157,"./attributes":220,"./calc":221,"./colorbar":222,"./defaults":223,"./hover":224,"./plot":227,"./style":228}],226:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49719,7 +49947,7 @@ module.exports = function makeColorMap(trace) { }); }; -},{"../../components/colorscale":45,"d3":14}],226:[function(require,module,exports){ +},{"../../components/colorscale":44,"d3":14}],227:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50042,7 +50270,7 @@ function makePath(pi, loc, edgeflag) { // even # of pts - average central two else { newpt = [(getpt(ptavg)[0] + getpt(ptavg + 1)[0]) / 2, - (getpt(ptavg)[1] + getpt(ptavg + 1)[1]) / 2]; + (getpt(ptavg)[1] + getpt(ptavg + 1)[1]) / 2]; } pts.splice(cnt2 + 1, cnt - cnt2 + 1, newpt); @@ -50180,12 +50408,12 @@ function getInterpPx(pi, loc, step) { if(step[1]) { var dx = (pi.level - zxy) / (pi.z[locy][locx + 1] - zxy); return [xa.c2p((1 - dx) * pi.x[locx] + dx * pi.x[locx + 1], true), - ya.c2p(pi.y[locy], true)]; + ya.c2p(pi.y[locy], true)]; } else { var dy = (pi.level - zxy) / (pi.z[locy + 1][locx] - zxy); return [xa.c2p(pi.x[locx], true), - ya.c2p((1 - dy) * pi.y[locy] + dy * pi.y[locy + 1], true)]; + ya.c2p((1 - dy) * pi.y[locy] + dy * pi.y[locy + 1], true)]; } } @@ -50429,7 +50657,7 @@ function makeClipMask(cd0) { return z; } -},{"../../components/drawing":54,"../../lib":121,"../heatmap/plot":238,"d3":14}],227:[function(require,module,exports){ +},{"../../components/drawing":53,"../../lib":122,"../heatmap/plot":239,"d3":14}],228:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50486,7 +50714,7 @@ module.exports = function style(gd) { heatmapStyle(gd); }; -},{"../../components/drawing":54,"../heatmap/style":239,"./make_color_map":225,"d3":14}],228:[function(require,module,exports){ +},{"../../components/drawing":53,"../heatmap/style":240,"./make_color_map":226,"d3":14}],229:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50522,7 +50750,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout) } }; -},{"../../components/colorscale/defaults":40}],229:[function(require,module,exports){ +},{"../../components/colorscale/defaults":39}],230:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50535,79 +50763,77 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout) var scatterAttrs = require('../scatter/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; -module.exports = extendFlat({}, - { - z: { - valType: 'data_array', - - }, - x: scatterAttrs.x, - x0: scatterAttrs.x0, - dx: scatterAttrs.dx, - y: scatterAttrs.y, - y0: scatterAttrs.y0, - dy: scatterAttrs.dy, - text: { - valType: 'data_array', - - }, - transpose: { - valType: 'boolean', - dflt: false, - - - }, - xtype: { - valType: 'enumerated', - values: ['array', 'scaled'], - - - }, - ytype: { - valType: 'enumerated', - values: ['array', 'scaled'], - - - }, - zsmooth: { - valType: 'enumerated', - values: ['fast', 'best', false], - dflt: false, - - - }, - connectgaps: { - valType: 'boolean', - dflt: false, - - - }, - xgap: { - valType: 'number', - dflt: 0, - min: 0, - - - }, - ygap: { - valType: 'number', - dflt: 0, - min: 0, - - - }, - _nestedModules: { - 'colorbar': 'Colorbar' - } +module.exports = extendFlat({}, { + z: { + valType: 'data_array', + }, + x: scatterAttrs.x, + x0: scatterAttrs.x0, + dx: scatterAttrs.dx, + y: scatterAttrs.y, + y0: scatterAttrs.y0, + dy: scatterAttrs.dy, + text: { + valType: 'data_array', + + }, + transpose: { + valType: 'boolean', + dflt: false, + + + }, + xtype: { + valType: 'enumerated', + values: ['array', 'scaled'], + + + }, + ytype: { + valType: 'enumerated', + values: ['array', 'scaled'], + + + }, + zsmooth: { + valType: 'enumerated', + values: ['fast', 'best', false], + dflt: false, + + + }, + connectgaps: { + valType: 'boolean', + dflt: false, + + + }, + xgap: { + valType: 'number', + dflt: 0, + min: 0, + + + }, + ygap: { + valType: 'number', + dflt: 0, + min: 0, + + + }, +}, colorscaleAttrs, - {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} + { autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}) }, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":36,"../../lib/extend":118,"../scatter/attributes":269}],230:[function(require,module,exports){ +},{"../../components/colorbar/attributes":31,"../../components/colorscale/attributes":35,"../../lib/extend":119,"../scatter/attributes":271}],231:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50718,9 +50944,9 @@ module.exports = function calc(gd, trace) { // create arrays of brick boundaries, to be used by autorange and heatmap.plot var xlen = maxRowLength(z), - xIn = trace.xtype === 'scaled' ? '' : trace.x, + xIn = trace.xtype === 'scaled' ? '' : x, xArray = makeBoundArray(trace, xIn, x0, dx, xlen, xa), - yIn = trace.ytype === 'scaled' ? '' : trace.y, + yIn = trace.ytype === 'scaled' ? '' : y, yArray = makeBoundArray(trace, yIn, y0, dy, z.length, ya); // handled in gl2d convert step @@ -50790,7 +51016,6 @@ function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) { var isArrayOfTwoItemsOrMore = Array.isArray(arrayIn) && arrayIn.length > 1; if(isArrayOfTwoItemsOrMore && !isHist && (ax.type !== 'category')) { - arrayIn = arrayIn.map(ax.d2c); var len = arrayIn.length; // given vals are brick centers @@ -50833,7 +51058,7 @@ function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) { else { dv = dvIn || 1; - if(isHist || ax.type === 'category') v0 = v0In || 0; + if(isHist || ax.type === 'category') v0 = ax.r2c(v0In) || 0; else if(Array.isArray(arrayIn) && arrayIn.length === 1) v0 = arrayIn[0]; else if(v0In === undefined) v0 = 0; else v0 = ax.d2c(v0In); @@ -51057,7 +51282,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../components/colorscale/calc":37,"../../lib":121,"../../plots/cartesian/axes":147,"../../registry":187,"../histogram2d/calc":250,"./convert_column_xyz":232,"./has_columns":234,"./max_row_length":237,"fast-isnumeric":17}],231:[function(require,module,exports){ +},{"../../components/colorscale/calc":36,"../../lib":122,"../../plots/cartesian/axes":149,"../../registry":188,"../histogram2d/calc":252,"./convert_column_xyz":233,"./has_columns":235,"./max_row_length":238,"fast-isnumeric":17}],232:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51108,7 +51333,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":33,"../../components/colorscale":45,"../../lib":121,"../../plots/plots":172,"fast-isnumeric":17}],232:[function(require,module,exports){ +},{"../../components/colorbar/draw":33,"../../components/colorscale":44,"../../lib":122,"../../plots/plots":173,"fast-isnumeric":17}],233:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51165,7 +51390,7 @@ module.exports = function convertColumnXYZ(trace, xa, ya) { if(hasColumnText) trace.text = text; }; -},{"../../lib":121}],233:[function(require,module,exports){ +},{"../../lib":122}],234:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51210,7 +51435,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":40,"../../lib":121,"./attributes":229,"./has_columns":234,"./xyz_defaults":240}],234:[function(require,module,exports){ +},{"../../components/colorscale/defaults":39,"../../lib":122,"./attributes":230,"./has_columns":235,"./xyz_defaults":241}],235:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51226,7 +51451,7 @@ module.exports = function(trace) { return !Array.isArray(trace.z[0]); }; -},{}],235:[function(require,module,exports){ +},{}],236:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51344,7 +51569,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, contour) })]; }; -},{"../../lib":121,"../../plots/cartesian/constants":153,"../../plots/cartesian/graph_interact":155}],236:[function(require,module,exports){ +},{"../../lib":122,"../../plots/cartesian/constants":154,"../../plots/cartesian/graph_interact":156}],237:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51376,7 +51601,7 @@ Heatmap.meta = { module.exports = Heatmap; -},{"../../plots/cartesian":156,"./attributes":229,"./calc":230,"./colorbar":231,"./defaults":233,"./hover":235,"./plot":238,"./style":239}],237:[function(require,module,exports){ +},{"../../plots/cartesian":157,"./attributes":230,"./calc":231,"./colorbar":232,"./defaults":234,"./hover":236,"./plot":239,"./style":240}],238:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51398,7 +51623,7 @@ module.exports = function maxRowLength(z) { return len; }; -},{}],238:[function(require,module,exports){ +},{}],239:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51848,7 +52073,7 @@ function plotOne(gd, plotinfo, cd) { image3.exit().remove(); } -},{"../../components/colorscale":45,"../../constants/xmlns_namespaces":112,"../../lib":121,"../../registry":187,"./max_row_length":237,"tinycolor2":20}],239:[function(require,module,exports){ +},{"../../components/colorscale":44,"../../constants/xmlns_namespaces":112,"../../lib":122,"../../registry":188,"./max_row_length":238,"tinycolor2":20}],240:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51869,7 +52094,7 @@ module.exports = function style(gd) { }); }; -},{"d3":14}],240:[function(require,module,exports){ +},{"d3":14}],241:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51958,7 +52183,7 @@ function isValidZ(z) { return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"./has_columns":234,"fast-isnumeric":17}],241:[function(require,module,exports){ +},{"./has_columns":235,"fast-isnumeric":17}],242:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52002,7 +52227,7 @@ module.exports = { autobinx: { valType: 'boolean', - dflt: true, + dflt: null, }, @@ -52017,7 +52242,7 @@ module.exports = { autobiny: { valType: 'boolean', - dflt: true, + dflt: null, }, @@ -52032,11 +52257,8 @@ module.exports = { marker: barAttrs.marker, - _nestedModules: { - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - }, + error_y: barAttrs.error_y, + error_x: barAttrs.error_x, _deprecated: { bardir: barAttrs._deprecated.bardir @@ -52046,27 +52268,27 @@ module.exports = { function makeBinsAttr(axLetter) { return { start: { - valType: 'number', + valType: 'any', // for date axes dflt: null, }, end: { - valType: 'number', + valType: 'any', // for date axes dflt: null, }, size: { valType: 'any', // for date axes - dflt: 1, + dflt: null, } }; } -},{"../bar/attributes":197}],242:[function(require,module,exports){ +},{"../bar/attributes":198}],243:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52092,7 +52314,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],243:[function(require,module,exports){ +},{}],244:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52109,20 +52331,23 @@ module.exports = function handleBinDefaults(traceIn, traceOut, coerce, binDirect coerce('histnorm'); binDirections.forEach(function(binDirection) { - // data being binned - note that even though it's a little weird, - // it's possible to have bins without data, if there's inferred data - var binstrt = coerce(binDirection + 'bins.start'), - binend = coerce(binDirection + 'bins.end'), - autobin = coerce('autobin' + binDirection, !(binstrt && binend)); - - if(autobin) coerce('nbins' + binDirection); - else coerce(binDirection + 'bins.size'); + /* + * Because date axes have string values for start and end, + * and string options for size, we cannot validate these attributes + * now. We will do this during calc (immediately prior to binning) + * in ./clean_bins, and push the cleaned values back to _fullData. + */ + coerce(binDirection + 'bins.start'); + coerce(binDirection + 'bins.end'); + coerce(binDirection + 'bins.size'); + coerce('autobin' + binDirection); + coerce('nbins' + binDirection); }); return traceOut; }; -},{}],244:[function(require,module,exports){ +},{}],245:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52196,7 +52421,7 @@ module.exports = { } }; -},{"fast-isnumeric":17}],245:[function(require,module,exports){ +},{"fast-isnumeric":17}],246:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52216,6 +52441,7 @@ var Axes = require('../../plots/cartesian/axes'); var binFunctions = require('./bin_functions'); var normFunctions = require('./norm_functions'); var doAvg = require('./average'); +var cleanBins = require('./clean_bins'); module.exports = function calc(gd, trace) { @@ -52232,6 +52458,8 @@ module.exports = function calc(gd, trace) { maindata = trace.orientation === 'h' ? 'y' : 'x', counterdata = {x: 'y', y: 'x'}[maindata]; + cleanBins(trace, pa, maindata); + // prepare the raw data var pos0 = pa.makeCalcdata(trace, maindata); // calculate the bins @@ -52270,10 +52498,11 @@ module.exports = function calc(gd, trace) { // create the bins (and any extra arrays needed) // assume more than 5000 bins is an error, so we don't crash the browser - i = binspec.start; + i = pa.r2c(binspec.start); + // decrease end a little in case of rounding errors - binend = binspec.end + - (binspec.start - Axes.tickIncrement(binspec.start, binspec.size)) / 1e6; + binend = pa.r2c(binspec.end) + (i - Axes.tickIncrement(i, binspec.size)) / 1e6; + while(i < binend && pos.length < 5000) { i2 = Axes.tickIncrement(i, binspec.size); pos.push((i + i2) / 2); @@ -52326,7 +52555,82 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":121,"../../plots/cartesian/axes":147,"./average":242,"./bin_functions":244,"./norm_functions":248,"fast-isnumeric":17}],246:[function(require,module,exports){ +},{"../../lib":122,"../../plots/cartesian/axes":149,"./average":243,"./bin_functions":245,"./clean_bins":247,"./norm_functions":250,"fast-isnumeric":17}],247:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; +var isNumeric = require('fast-isnumeric'); +var cleanDate = require('../../lib').cleanDate; +var ONEDAY = require('../../constants/numerical').ONEDAY; + +/* + * cleanBins: validate attributes autobin[xy] and [xy]bins.(start, end, size) + * Mutates trace so all these attributes are valid. + * + * Normally this kind of thing would happen during supplyDefaults, but + * in this case we need to know the axis type, and axis type isn't set until + * after trace supplyDefaults are completed. So this gets called during the + * calc step, when data are inserted into bins. + */ +module.exports = function cleanBins(trace, ax, binDirection) { + var axType = ax.type, + binAttr = binDirection + 'bins', + bins = trace[binAttr]; + + if(!bins) bins = trace[binAttr] = {}; + + var cleanBound = (axType === 'date') ? + function(v) { return (v || v === 0) ? cleanDate(v) : null; } : + function(v) { return isNumeric(v) ? Number(v) : null; }; + + bins.start = cleanBound(bins.start); + bins.end = cleanBound(bins.end); + + // logic for bin size is very similar to dtick (cartesian/tick_value_defaults) + // but without the extra string options for log axes + // ie the only strings we accept are M for months + var sizeDflt = (axType === 'date') ? ONEDAY : 1, + binSize = bins.size; + + if(isNumeric(binSize)) { + bins.size = (binSize > 0) ? Number(binSize) : sizeDflt; + } + else if(typeof binSize !== 'string') { + bins.size = sizeDflt; + } + else { + // date special case: "M" gives bins every (integer) n months + var prefix = binSize.charAt(0), + sizeNum = binSize.substr(1); + + sizeNum = isNumeric(sizeNum) ? Number(sizeNum) : 0; + if((sizeNum <= 0) || !( + axType === 'date' && prefix === 'M' && sizeNum === Math.round(sizeNum) + )) { + bins.size = sizeDflt; + } + } + + var autoBinAttr = 'autobin' + binDirection; + + if(typeof trace[autoBinAttr] !== 'boolean') { + trace[autoBinAttr] = !( + (bins.start || bins.start === 0) && + (bins.end || bins.end === 0) + ); + } + + if(!trace[autoBinAttr]) delete trace['nbins' + binDirection]; +}; + +},{"../../constants/numerical":110,"../../lib":122,"fast-isnumeric":17}],248:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52378,7 +52682,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":30,"../../components/errorbars/defaults":59,"../../lib":121,"../bar/style_defaults":208,"./attributes":241,"./bin_defaults":243}],247:[function(require,module,exports){ +},{"../../components/color":30,"../../components/errorbars/defaults":58,"../../lib":122,"../bar/style_defaults":209,"./attributes":242,"./bin_defaults":244}],249:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52427,7 +52731,7 @@ Histogram.meta = { module.exports = Histogram; -},{"../../plots/cartesian":156,"../bar/hover":200,"../bar/layout_attributes":202,"../bar/layout_defaults":203,"../bar/plot":204,"../bar/set_positions":205,"../bar/style":207,"../scatter/colorbar":272,"./attributes":241,"./calc":245,"./defaults":246}],248:[function(require,module,exports){ +},{"../../plots/cartesian":157,"../bar/hover":201,"../bar/layout_attributes":203,"../bar/layout_defaults":204,"../bar/plot":205,"../bar/set_positions":206,"../bar/style":208,"../scatter/colorbar":274,"./attributes":242,"./calc":246,"./defaults":248}],250:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52462,7 +52766,7 @@ module.exports = { } }; -},{}],249:[function(require,module,exports){ +},{}],251:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52476,6 +52780,7 @@ module.exports = { var histogramAttrs = require('../histogram/attributes'); var heatmapAttrs = require('../heatmap/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; @@ -52506,17 +52811,14 @@ module.exports = extendFlat({}, xgap: heatmapAttrs.xgap, ygap: heatmapAttrs.ygap, - zsmooth: heatmapAttrs.zsmooth, - - _nestedModules: { - 'colorbar': 'Colorbar' - } + zsmooth: heatmapAttrs.zsmooth }, colorscaleAttrs, - {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} + { autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}) }, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":36,"../../lib/extend":118,"../heatmap/attributes":229,"../histogram/attributes":241}],250:[function(require,module,exports){ +},{"../../components/colorbar/attributes":31,"../../components/colorscale/attributes":35,"../../lib/extend":119,"../heatmap/attributes":230,"../histogram/attributes":242}],252:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52534,6 +52836,7 @@ var Axes = require('../../plots/cartesian/axes'); var binFunctions = require('../histogram/bin_functions'); var normFunctions = require('../histogram/norm_functions'); var doAvg = require('../histogram/average'); +var cleanBins = require('../histogram/clean_bins'); module.exports = function calc(gd, trace) { @@ -52548,6 +52851,9 @@ module.exports = function calc(gd, trace) { z, i; + cleanBins(trace, xa, 'x'); + cleanBins(trace, ya, 'y'); + var serieslen = Math.min(x.length, y.length); if(x.length > serieslen) x.splice(serieslen, x.length - serieslen); if(y.length > serieslen) y.splice(serieslen, y.length - serieslen); @@ -52557,8 +52863,10 @@ module.exports = function calc(gd, trace) { if(trace.autobinx || !('xbins' in trace)) { trace.xbins = Axes.autoBin(x, xa, trace.nbinsx, '2d'); if(trace.type === 'histogram2dcontour') { - trace.xbins.start -= trace.xbins.size; - trace.xbins.end += trace.xbins.size; + // the "true" last argument reverses the tick direction (which we can't + // just do with a minus sign because of month bins) + trace.xbins.start = xa.c2r(Axes.tickIncrement(xa.r2c(trace.xbins.start), trace.xbins.size, true)); + trace.xbins.end = xa.c2r(Axes.tickIncrement(xa.r2c(trace.xbins.end), trace.xbins.size)); } // copy bin info back to the source data. @@ -52567,8 +52875,8 @@ module.exports = function calc(gd, trace) { if(trace.autobiny || !('ybins' in trace)) { trace.ybins = Axes.autoBin(y, ya, trace.nbinsy, '2d'); if(trace.type === 'histogram2dcontour') { - trace.ybins.start -= trace.ybins.size; - trace.ybins.end += trace.ybins.size; + trace.ybins.start = ya.c2r(Axes.tickIncrement(ya.r2c(trace.ybins.start), trace.ybins.size, true)); + trace.ybins.end = ya.c2r(Axes.tickIncrement(ya.r2c(trace.ybins.end), trace.ybins.size)); } trace._input.ybins = trace.ybins; } @@ -52610,11 +52918,11 @@ module.exports = function calc(gd, trace) { // decrease end a little in case of rounding errors var binspec = trace.xbins, - binend = binspec.end + - (binspec.start - Axes.tickIncrement(binspec.start, binspec.size)) / 1e6; + binStart = xa.r2c(binspec.start), + binEnd = xa.r2c(binspec.end) + + (binStart - Axes.tickIncrement(binStart, binspec.size)) / 1e6; - for(i = binspec.start; i < binend; - i = Axes.tickIncrement(i, binspec.size)) { + for(i = binStart; i < binEnd; i = Axes.tickIncrement(i, binspec.size)) { onecol.push(sizeinit); if(Array.isArray(xbins)) xbins.push(i); if(doavg) zerocol.push(0); @@ -52623,15 +52931,16 @@ module.exports = function calc(gd, trace) { var nx = onecol.length; x0 = trace.xbins.start; - dx = (i - x0) / nx; - x0 += dx / 2; + var x0c = xa.r2c(x0); + dx = (i - x0c) / nx; + x0 = xa.c2r(x0c + dx / 2); binspec = trace.ybins; - binend = binspec.end + - (binspec.start - Axes.tickIncrement(binspec.start, binspec.size)) / 1e6; + binStart = ya.r2c(binspec.start); + binEnd = ya.r2c(binspec.end) + + (binStart - Axes.tickIncrement(binStart, binspec.size)) / 1e6; - for(i = binspec.start; i < binend; - i = Axes.tickIncrement(i, binspec.size)) { + for(i = binStart; i < binEnd; i = Axes.tickIncrement(i, binspec.size)) { z.push(onecol.concat()); if(Array.isArray(ybins)) ybins.push(i); if(doavg) counts.push(zerocol.concat()); @@ -52640,8 +52949,9 @@ module.exports = function calc(gd, trace) { var ny = z.length; y0 = trace.ybins.start; - dy = (i - y0) / ny; - y0 += dy / 2; + var y0c = ya.r2c(y0); + dy = (i - y0c) / ny; + y0 = ya.c2r(y0c + dy / 2); if(densitynorm) { xinc = onecol.map(function(v, i) { @@ -52682,7 +52992,7 @@ module.exports = function calc(gd, trace) { }; }; -},{"../../lib":121,"../../plots/cartesian/axes":147,"../histogram/average":242,"../histogram/bin_functions":244,"../histogram/norm_functions":248}],251:[function(require,module,exports){ +},{"../../lib":122,"../../plots/cartesian/axes":149,"../histogram/average":243,"../histogram/bin_functions":245,"../histogram/clean_bins":247,"../histogram/norm_functions":250}],253:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52720,7 +53030,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, layout) { ); }; -},{"../../components/colorscale/defaults":40,"../../lib":121,"./attributes":249,"./sample_defaults":253}],252:[function(require,module,exports){ +},{"../../components/colorscale/defaults":39,"../../lib":122,"./attributes":251,"./sample_defaults":255}],254:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52753,7 +53063,7 @@ Histogram2D.meta = { module.exports = Histogram2D; -},{"../../plots/cartesian":156,"../heatmap/calc":230,"../heatmap/colorbar":231,"../heatmap/hover":235,"../heatmap/plot":238,"../heatmap/style":239,"./attributes":249,"./defaults":251}],253:[function(require,module,exports){ +},{"../../plots/cartesian":157,"../heatmap/calc":231,"../heatmap/colorbar":232,"../heatmap/hover":236,"../heatmap/plot":239,"../heatmap/style":240,"./attributes":251,"./defaults":253}],255:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52789,7 +53099,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce) { handleBinDefaults(traceIn, traceOut, coerce, binDirections); }; -},{"../histogram/bin_defaults":243}],254:[function(require,module,exports){ +},{"../histogram/bin_defaults":244}],256:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52803,6 +53113,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce) { var histogram2dAttrs = require('../histogram2d/attributes'); var contourAttrs = require('../contour/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; @@ -52824,16 +53135,13 @@ module.exports = extendFlat({}, { autocontour: contourAttrs.autocontour, ncontours: contourAttrs.ncontours, contours: contourAttrs.contours, - line: contourAttrs.line, - - _nestedModules: { - 'colorbar': 'Colorbar' - } + line: contourAttrs.line }, - colorscaleAttrs + colorscaleAttrs, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":36,"../../lib/extend":118,"../contour/attributes":219,"../histogram2d/attributes":249}],255:[function(require,module,exports){ +},{"../../components/colorbar/attributes":31,"../../components/colorscale/attributes":35,"../../lib/extend":119,"../contour/attributes":220,"../histogram2d/attributes":251}],257:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52869,7 +53177,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":121,"../contour/style_defaults":228,"../histogram2d/sample_defaults":253,"./attributes":254}],256:[function(require,module,exports){ +},{"../../lib":122,"../contour/style_defaults":229,"../histogram2d/sample_defaults":255,"./attributes":256}],258:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52902,7 +53210,7 @@ Histogram2dContour.meta = { module.exports = Histogram2dContour; -},{"../../plots/cartesian":156,"../contour/calc":220,"../contour/colorbar":221,"../contour/hover":223,"../contour/plot":226,"../contour/style":227,"./attributes":254,"./defaults":255}],257:[function(require,module,exports){ +},{"../../plots/cartesian":157,"../contour/calc":221,"../contour/colorbar":222,"../contour/hover":224,"../contour/plot":227,"../contour/style":228,"./attributes":256,"./defaults":257}],259:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53122,7 +53430,7 @@ module.exports = { } }; -},{"../../components/color/attributes":29,"../../lib/extend":118,"../../plots/attributes":145,"../../plots/font_attributes":168}],258:[function(require,module,exports){ +},{"../../components/color/attributes":29,"../../lib/extend":119,"../../plots/attributes":147,"../../plots/font_attributes":169}],260:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53169,7 +53477,7 @@ function getCdModule(calcdata, _module) { return cdModule; } -},{"../../registry":187}],259:[function(require,module,exports){ +},{"../../registry":188}],261:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53321,7 +53629,7 @@ function nextDefaultColor(index) { return pieDefaultColors[index % pieDefaultColors.length]; } -},{"../../components/color":30,"./helpers":261,"fast-isnumeric":17,"tinycolor2":20}],260:[function(require,module,exports){ +},{"../../components/color":30,"./helpers":263,"fast-isnumeric":17,"tinycolor2":20}],262:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53405,7 +53713,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pull'); }; -},{"../../lib":121,"./attributes":257}],261:[function(require,module,exports){ +},{"../../lib":122,"./attributes":259}],263:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53434,7 +53742,7 @@ exports.formatPieValue = function formatPieValue(v, separators) { return Lib.numSeparate(vRounded, separators); }; -},{"../../lib":121}],262:[function(require,module,exports){ +},{"../../lib":122}],264:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53466,7 +53774,7 @@ Pie.meta = { module.exports = Pie; -},{"./attributes":257,"./base_plot":258,"./calc":259,"./defaults":260,"./layout_attributes":263,"./layout_defaults":264,"./plot":265,"./style":266,"./style_one":267}],263:[function(require,module,exports){ +},{"./attributes":259,"./base_plot":260,"./calc":261,"./defaults":262,"./layout_attributes":265,"./layout_defaults":266,"./plot":267,"./style":268,"./style_one":269}],265:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53486,7 +53794,7 @@ module.exports = { hiddenlabels: {valType: 'data_array'} }; -},{}],264:[function(require,module,exports){ +},{}],266:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53508,7 +53816,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('hiddenlabels'); }; -},{"../../lib":121,"./layout_attributes":263}],265:[function(require,module,exports){ +},{"../../lib":122,"./layout_attributes":265}],267:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54203,7 +54511,7 @@ function maxExtent(tilt, tiltAxisFraction, depth) { 2 * Math.sqrt(1 - sinTilt * sinTilt * tiltAxisFraction * tiltAxisFraction)); } -},{"../../components/color":30,"../../components/drawing":54,"../../lib/svg_text_utils":133,"../../plots/cartesian/graph_interact":155,"./helpers":261,"d3":14}],266:[function(require,module,exports){ +},{"../../components/color":30,"../../components/drawing":53,"../../lib/svg_text_utils":134,"../../plots/cartesian/graph_interact":156,"./helpers":263,"d3":14}],268:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54232,7 +54540,7 @@ module.exports = function style(gd) { }); }; -},{"./style_one":267,"d3":14}],267:[function(require,module,exports){ +},{"./style_one":269,"d3":14}],269:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54259,7 +54567,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":30}],268:[function(require,module,exports){ +},{"../../components/color":30}],270:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54297,7 +54605,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":121}],269:[function(require,module,exports){ +},{"../../lib":122}],271:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54309,11 +54617,11 @@ module.exports = function arraysToCalcdata(cd) { 'use strict'; var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var Drawing = require('../../components/drawing'); - var constants = require('./constants'); - var extendFlat = require('../../lib/extend').extendFlat; module.exports = { @@ -54489,12 +54797,15 @@ module.exports = { }, + showscale: { valType: 'boolean', dflt: false, }, + colorbar: colorbarAttrs, + line: extendFlat({}, { width: { valType: 'number', @@ -54542,6 +54853,7 @@ module.exports = { }, }, + r: { valType: 'data_array', @@ -54550,14 +54862,12 @@ module.exports = { valType: 'data_array', }, - _nestedModules: { // nested module coupling - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_y: errorBarAttrs, + error_x: errorBarAttrs }; -},{"../../components/colorscale/color_attributes":38,"../../components/drawing":54,"../../lib/extend":118,"./constants":274}],270:[function(require,module,exports){ +},{"../../components/colorbar/attributes":31,"../../components/colorscale/color_attributes":37,"../../components/drawing":53,"../../components/errorbars/attributes":55,"../../lib/extend":119,"./constants":276}],272:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54688,7 +54998,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":121,"../../plots/cartesian/axes":147,"./colorscale_calc":273,"./subtypes":289,"fast-isnumeric":17}],271:[function(require,module,exports){ +},{"../../lib":122,"../../plots/cartesian/axes":149,"./colorscale_calc":275,"./subtypes":291,"fast-isnumeric":17}],273:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54727,7 +55037,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],272:[function(require,module,exports){ +},{}],274:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54784,7 +55094,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":33,"../../components/colorscale":45,"../../lib":121,"../../plots/plots":172,"fast-isnumeric":17}],273:[function(require,module,exports){ +},{"../../components/colorbar/draw":33,"../../components/colorscale":44,"../../lib":122,"../../plots/plots":173,"fast-isnumeric":17}],275:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54817,7 +55127,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":37,"../../components/colorscale/has_colorscale":44,"./subtypes":289}],274:[function(require,module,exports){ +},{"../../components/colorscale/calc":36,"../../components/colorscale/has_colorscale":43,"./subtypes":291}],276:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54833,7 +55143,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],275:[function(require,module,exports){ +},{}],277:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54913,7 +55223,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":59,"../../lib":121,"./attributes":269,"./constants":274,"./fillcolor_defaults":276,"./line_defaults":280,"./line_shape_defaults":282,"./marker_defaults":285,"./subtypes":289,"./text_defaults":290,"./xy_defaults":291}],276:[function(require,module,exports){ +},{"../../components/errorbars/defaults":58,"../../lib":122,"./attributes":271,"./constants":276,"./fillcolor_defaults":278,"./line_defaults":282,"./line_shape_defaults":284,"./marker_defaults":287,"./subtypes":291,"./text_defaults":292,"./xy_defaults":293}],278:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54951,7 +55261,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":30}],277:[function(require,module,exports){ +},{"../../components/color":30}],279:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55004,7 +55314,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":30,"./subtypes":289}],278:[function(require,module,exports){ +},{"../../components/color":30,"./subtypes":291}],280:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55173,7 +55483,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":30,"../../components/errorbars":60,"../../lib":121,"../../plots/cartesian/constants":153,"../../plots/cartesian/graph_interact":155,"./get_trace_color":277}],279:[function(require,module,exports){ +},{"../../components/color":30,"../../components/errorbars":59,"../../lib":122,"../../plots/cartesian/constants":154,"../../plots/cartesian/graph_interact":156,"./get_trace_color":279}],281:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55217,7 +55527,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":156,"./arrays_to_calcdata":268,"./attributes":269,"./calc":270,"./clean_data":271,"./colorbar":272,"./defaults":275,"./hover":278,"./plot":286,"./select":287,"./style":288,"./subtypes":289}],280:[function(require,module,exports){ +},{"../../plots/cartesian":157,"./arrays_to_calcdata":270,"./attributes":271,"./calc":272,"./clean_data":273,"./colorbar":274,"./defaults":277,"./hover":280,"./plot":288,"./select":289,"./style":290,"./subtypes":291}],282:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55250,7 +55560,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce('line.dash'); }; -},{"../../components/colorscale/defaults":40,"../../components/colorscale/has_colorscale":44}],281:[function(require,module,exports){ +},{"../../components/colorscale/defaults":39,"../../components/colorscale/has_colorscale":43}],283:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55262,7 +55572,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, 'use strict'; -var Axes = require('../../plots/cartesian/axes'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function linePoints(d, opts) { @@ -55273,7 +55583,6 @@ module.exports = function linePoints(d, opts) { baseTolerance = opts.baseTolerance, linear = opts.linear, segments = [], - badnum = Axes.BADNUM, minTolerance = 0.2, // fraction of tolerance "so close we don't even consider it a new point" pts = new Array(d.length), pti = 0, @@ -55310,7 +55619,7 @@ module.exports = function linePoints(d, opts) { function getPt(index) { var x = xa.c2p(d[index].x), y = ya.c2p(d[index].y); - if(x === badnum || y === badnum) return false; + if(x === BADNUM || y === BADNUM) return false; return [x, y]; } @@ -55424,7 +55733,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../plots/cartesian/axes":147}],282:[function(require,module,exports){ +},{"../../constants/numerical":110}],284:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55443,7 +55752,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],283:[function(require,module,exports){ +},{}],285:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55484,7 +55793,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],284:[function(require,module,exports){ +},{}],286:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55526,7 +55835,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":17}],285:[function(require,module,exports){ +},{"fast-isnumeric":17}],287:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55586,7 +55895,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":30,"../../components/colorscale/defaults":40,"../../components/colorscale/has_colorscale":44,"./subtypes":289}],286:[function(require,module,exports){ +},{"../../components/color":30,"../../components/colorscale/defaults":39,"../../components/colorscale/has_colorscale":43,"./subtypes":291}],288:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55758,6 +56067,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.visible !== true) return; + transition(tr).style('opacity', trace.opacity); + // BUILD LINES AND FILLS var ownFillEl3, tonext; var ownFillDir = trace.fill.charAt(trace.fill.length - 1); @@ -56083,8 +56394,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { var xa = plotinfo.xaxis, ya = plotinfo.yaxis, - xr = d3.extent(xa.range.map(xa.l2c)), - yr = d3.extent(ya.range.map(ya.l2c)); + xr = d3.extent(xa.range.map(xa.r2l).map(xa.l2c)), + yr = d3.extent(ya.range.map(ya.r2l).map(ya.l2c)); var trace = cdscatter[0].trace; if(!subTypes.hasMarkers(trace)) return; @@ -56122,7 +56433,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":54,"../../components/errorbars":60,"../../lib":121,"../../lib/polygon":128,"./arrays_to_calcdata":268,"./line_points":281,"./link_traces":283,"./subtypes":289,"d3":14}],287:[function(require,module,exports){ +},{"../../components/drawing":53,"../../components/errorbars":59,"../../lib":122,"../../lib/polygon":129,"./arrays_to_calcdata":270,"./line_points":283,"./link_traces":285,"./subtypes":291,"d3":14}],289:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56194,7 +56505,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":289}],288:[function(require,module,exports){ +},{"./subtypes":291}],290:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56236,7 +56547,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":54,"../../components/errorbars":60,"d3":14}],289:[function(require,module,exports){ +},{"../../components/drawing":53,"../../components/errorbars":59,"d3":14}],291:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56272,7 +56583,7 @@ module.exports = { } }; -},{"../../lib":121}],290:[function(require,module,exports){ +},{"../../lib":122}],292:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56293,7 +56604,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":121}],291:[function(require,module,exports){ +},{"../../lib":122}],293:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56338,7 +56649,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { return len; }; -},{}],292:[function(require,module,exports){ +},{}],294:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56352,6 +56663,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { var scatterAttrs = require('../scatter/attributes'); var plotAttrs = require('../../plots/attributes'); var colorAttributes = require('../../components/colorscale/color_attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; @@ -56405,26 +56717,24 @@ module.exports = { sizeref: scatterMarkerAttrs.sizeref, sizemin: scatterMarkerAttrs.sizemin, sizemode: scatterMarkerAttrs.sizemode, - showscale: scatterMarkerAttrs.showscale, line: extendFlat({}, {width: scatterMarkerLineAttrs.width}, colorAttributes('marker'.line) ) - }, - colorAttributes('marker') - ), + }, colorAttributes('marker'), { + showscale: scatterMarkerAttrs.showscale, + colorbar: colorbarAttrs + }), + textfont: scatterAttrs.textfont, textposition: scatterAttrs.textposition, hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['a', 'b', 'c', 'text', 'name'] }), hoveron: scatterAttrs.hoveron, - _nestedModules: { - 'marker.colorbar': 'Colorbar' - } }; -},{"../../components/colorscale/color_attributes":38,"../../lib/extend":118,"../../plots/attributes":145,"../scatter/attributes":269}],293:[function(require,module,exports){ +},{"../../components/colorbar/attributes":31,"../../components/colorscale/color_attributes":37,"../../lib/extend":119,"../../plots/attributes":147,"../scatter/attributes":271}],295:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56523,7 +56833,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":121,"../../plots/cartesian/axes":147,"../scatter/colorscale_calc":273,"../scatter/subtypes":289,"fast-isnumeric":17}],294:[function(require,module,exports){ +},{"../../lib":122,"../../plots/cartesian/axes":149,"../scatter/colorscale_calc":275,"../scatter/subtypes":291,"fast-isnumeric":17}],296:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56628,7 +56938,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hoveron', dfltHoverOn.join('+') || 'points'); }; -},{"../../lib":121,"../scatter/constants":274,"../scatter/fillcolor_defaults":276,"../scatter/line_defaults":280,"../scatter/line_shape_defaults":282,"../scatter/marker_defaults":285,"../scatter/subtypes":289,"../scatter/text_defaults":290,"./attributes":292}],295:[function(require,module,exports){ +},{"../../lib":122,"../scatter/constants":276,"../scatter/fillcolor_defaults":278,"../scatter/line_defaults":282,"../scatter/line_shape_defaults":284,"../scatter/marker_defaults":287,"../scatter/subtypes":291,"../scatter/text_defaults":292,"./attributes":294}],297:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56699,7 +57009,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../../plots/cartesian/axes":147,"../scatter/hover":278}],296:[function(require,module,exports){ +},{"../../plots/cartesian/axes":149,"../scatter/hover":280}],298:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56732,7 +57042,7 @@ ScatterTernary.meta = { module.exports = ScatterTernary; -},{"../../plots/ternary":180,"../scatter/colorbar":272,"./attributes":292,"./calc":293,"./defaults":294,"./hover":295,"./plot":297,"./select":298,"./style":299}],297:[function(require,module,exports){ +},{"../../plots/ternary":181,"../scatter/colorbar":274,"./attributes":294,"./calc":295,"./defaults":296,"./hover":297,"./plot":299,"./select":300,"./style":301}],299:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56778,7 +57088,7 @@ module.exports = function plot(ternary, data) { scatterPlot(ternary.graphDiv, plotinfo, calcdata); }; -},{"../scatter/plot":286}],298:[function(require,module,exports){ +},{"../scatter/plot":288}],300:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56813,7 +57123,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"../scatter/select":287}],299:[function(require,module,exports){ +},{"../scatter/select":289}],301:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56842,5 +57152,5 @@ module.exports = function style(gd) { scatterStyle(gd); }; -},{"../scatter/style":288}]},{},[11])(11) +},{"../scatter/style":290}]},{},[11])(11) }); \ No newline at end of file diff --git a/dist/plotly-cartesian.min.js b/dist/plotly-cartesian.min.js index ba37aac4886..e53c5c1e6e5 100644 --- a/dist/plotly-cartesian.min.js +++ b/dist/plotly-cartesian.min.js @@ -1,28 +1,28 @@ /** -* plotly.js (cartesian - minified) v1.19.2 +* plotly.js (cartesian - minified) v1.20.0 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function t(e,r,n){function a(i,l){if(!r[i]){if(!e[i]){var s="function"==typeof require&&require;if(!l&&s)return s(i,!0);if(o)return o(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[i]={exports:{}};e[i][0].call(u.exports,function(t){var r=e[i][1][t];return a(r?r:t)},u,u.exports,t,e,r,n)}return r[i].exports}for(var o="function"==typeof require&&require,i=0;ie?1:t>=e?0:NaN}function o(t){return null===t?NaN:+t}function i(t){return!isNaN(t)}function l(t){return{left:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[o],r)<0?n=o+1:a=o}return n},right:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[o],r)>0?a=o:n=o+1}return n}}}function s(t){return t.length}function c(t){for(var e=1;t*e%1;)e*=10;return e}function u(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function f(){this._=Object.create(null)}function d(t){return(t+="")===_i||t[0]===wi?wi+t:t}function h(t){return(t+="")[0]===wi?t.slice(1):t}function p(t){return d(t)in this._}function g(t){return(t=d(t))in this._&&delete this._[t]}function m(){var t=[];for(var e in this._)t.push(h(e));return t}function v(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function x(){this._=Object.create(null)}function b(t){return t}function _(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=ki.length;r=e&&(e=a+1);!(i=l[e])&&++e0&&(t=t.slice(0,l));var c=Pi.get(t);return c&&(t=c,s=Q),l?e?a:n:e?k:o}function W(t,e){return function(r){var n=ui.event;ui.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{ui.event=n}}}function Q(t,e){var r=W(t,e);return function(t){var e=this,n=t.relatedTarget;n&&(n===e||8&n.compareDocumentPosition(e))||r.call(e,t)}}function $(t){var r=".dragsuppress-"+ ++Ni,a="click"+r,o=ui.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Ei&&(Ei=!("onselectstart"in t)&&w(t.style,"userSelect")),Ei){var i=e(t).style,l=i[Ei];i[Ei]="none"}return function(t){if(o.on(r,null),Ei&&(i[Ei]=l),t){var e=function(){o.on(a,null)};o.on(a,function(){T(),e()},!0),setTimeout(e,0)}}}function J(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var a=r.createSVGPoint();if(Ii<0){var o=n(t);if(o.scrollX||o.scrollY){r=ui.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var i=r[0][0].getScreenCTM();Ii=!(i.f||i.e),r.remove()}}return Ii?(a.x=e.pageX,a.y=e.pageY):(a.x=e.clientX,a.y=e.clientY),a=a.matrixTransform(t.getScreenCTM().inverse()),[a.x,a.y]}var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}function K(){return ui.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function rt(t){return t>1?0:t<-1?Fi:Math.acos(t)}function nt(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function at(t){return((t=Math.exp(t))-1/t)/2}function ot(t){return((t=Math.exp(t))+1/t)/2}function it(t){return((t=Math.exp(2*t))-1)/(t+1)}function lt(t){return(t=Math.sin(t/2))*t}function st(){}function ct(t,e,r){return this instanceof ct?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof ct?new ct(t.h,t.s,t.l):kt(""+t,Mt,ct):new ct(t,e,r)}function ut(t,e,r){function n(t){return t>360?t-=360:t<0&&(t+=360),t<60?o+(i-o)*t/60:t<180?i:t<240?o+(i-o)*(240-t)/60:o}function a(t){return Math.round(255*n(t))}var o,i;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,i=r<=.5?r*(1+e):r+e-r*e,o=2*r-i,new xt(a(t+120),a(t),a(t-120))}function ft(t,e,r){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof ht?gt(t.l,t.a,t.b):gt((t=At((t=ui.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,r)}function dt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new ht(r,Math.cos(t*=Vi)*e,Math.sin(t)*e)}function ht(t,e,r){return this instanceof ht?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof ht?new ht(t.l,t.a,t.b):t instanceof ft?dt(t.h,t.c,t.l):At((t=xt(t)).r,t.g,t.b):new ht(t,e,r)}function pt(t,e,r){var n=(t+16)/116,a=n+e/500,o=n-r/200;return a=mt(a)*tl,n=mt(n)*el,o=mt(o)*rl,new xt(yt(3.2404542*a-1.5371385*n-.4985314*o),yt(-.969266*a+1.8760108*n+.041556*o),yt(.0556434*a-.2040259*n+1.0572252*o))}function gt(t,e,r){return t>0?new ft(Math.atan2(r,e)*Zi,Math.sqrt(e*e+r*r),t):new ft(NaN,NaN,t)}function mt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function vt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function xt(t,e,r){return this instanceof xt?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof xt?new xt(t.r,t.g,t.b):kt(""+t,xt,ut):new xt(t,e,r)}function bt(t){return new xt(t>>16,t>>8&255,255&t)}function _t(t){return bt(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function kt(t,e,r){var n,a,o,i=0,l=0,s=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(Lt(a[0]),Lt(a[1]),Lt(a[2]))}return(o=ol.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(i=(3840&o)>>4,i=i>>4|i,l=240&o,l=l>>4|l,s=15&o,s=s<<4|s):7===t.length&&(i=(16711680&o)>>16,l=(65280&o)>>8,s=255&o)),e(i,l,s))}function Mt(t,e,r){var n,a,o=Math.min(t/=255,e/=255,r/=255),i=Math.max(t,e,r),l=i-o,s=(i+o)/2;return l?(a=s<.5?l/(i+o):l/(2-i-o),n=t==i?(e-r)/l+(e0&&s<1?0:n),new ct(n,a,s)}function At(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=vt((.4124564*t+.3575761*e+.1804375*r)/tl),a=vt((.2126729*t+.7151522*e+.072175*r)/el),o=vt((.0193339*t+.119192*e+.9503041*r)/rl);return ht(116*a-16,500*(n-a),200*(a-o))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Lt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function zt(t){return"function"==typeof t?t:function(){return t}}function Ct(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),St(e,r,t,n)}}function St(t,e,r,n){function a(){var t,e=s.status;if(!e&&Dt(s)||e>=200&&e<300||304===e){try{t=r.call(o,s)}catch(t){return void i.error.call(o,t)}i.load.call(o,t)}else i.error.call(o,s)}var o={},i=ui.dispatch("beforesend","progress","load","error"),l={},s=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in s||!/^(http(s)?:)?\/\//.test(t)||(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=a:s.onreadystatechange=function(){s.readyState>3&&a()},s.onprogress=function(t){var e=ui.event;ui.event=t;try{i.progress.call(o,s)}finally{ui.event=e}},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?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return r=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(di(arguments)))}}),o.send=function(r,n,a){if(2===arguments.length&&"function"==typeof n&&(a=n,n=null),s.open(r,t,!0),null==e||"accept"in l||(l.accept=e+",*/*"),s.setRequestHeader)for(var u in l)s.setRequestHeader(u,l[u]);return null!=e&&s.overrideMimeType&&s.overrideMimeType(e),null!=c&&(s.responseType=c),null!=a&&o.on("error",a).on("load",function(t){a(null,t)}),i.beforesend.call(o,s),s.send(null==n?null:n),o},o.abort=function(){return s.abort(),o},ui.rebind(o,i,"on"),null==n?o:o.get(Ot(n))}function Ot(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function Dt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Pt(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var a=r+e,o={c:t,t:a,n:null};return ll?ll.n=o:il=o,ll=o,sl||(cl=clearTimeout(cl),sl=1,ul(Et)),o}function Et(){var t=Nt(),e=It()-t;e>24?(isFinite(e)&&(clearTimeout(cl),cl=setTimeout(Et,e)),sl=0):(sl=1,ul(Et))}function Nt(){for(var t=Date.now(),e=il;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function It(){for(var t,e=il,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Ft(t){var e=t.decimal,r=t.thousands,n=t.grouping,a=t.currency,o=n&&r?function(t,e){for(var a=t.length,o=[],i=0,l=n[0],s=0;a>0&&l>0&&(s+l+1>e&&(l=Math.max(1,e-s)),o.push(t.substring(a-=l,a+l)),!((s+=l+1)>e));)l=n[i=(i+1)%n.length];return o.reverse().join(r)}:b;return function(t){var r=dl.exec(t),n=r[1]||" ",i=r[2]||">",l=r[3]||"-",s=r[4]||"",c=r[5],u=+r[6],f=r[7],d=r[8],h=r[9],p=1,g="",m="",v=!1,y=!0;switch(d&&(d=+d.substring(1)),(c||"0"===n&&"="===i)&&(c=n="0",i="="),h){case"n":f=!0,h="g";break;case"%":p=100,m="%",h="f";break;case"p":p=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===s&&(g="0"+h.toLowerCase());case"c":y=!1;case"d":v=!0,d=0;break;case"s":p=-1,h="r"}"$"===s&&(g=a[0],m=a[1]),"r"!=h||d||(h="g"),null!=d&&("g"==h?d=Math.max(1,Math.min(21,d)):"e"!=h&&"f"!=h||(d=Math.max(0,Math.min(20,d)))),h=hl.get(h)||Bt;var x=c&&f;return function(t){var r=m;if(v&&t%1)return"";var a=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===l?"":l;if(p<0){var s=ui.formatPrefix(t,d);t=s.scale(t),r=s.symbol+m}else t*=p;t=h(t,d);var b,_,w=t.lastIndexOf(".");if(w<0){var k=y?t.lastIndexOf("e"):-1;k<0?(b=t,_=""):(b=t.substring(0,k),_=t.substring(k))}else b=t.substring(0,w),_=e+t.substring(w+1);!c&&f&&(b=o(b,1/0));var M=g.length+b.length+_.length+(x?0:a.length),A=M"===i?A+a+t:"^"===i?A.substring(0,M>>=1)+a+t+A.substring(M):a+(x?t:A+t))+r}}}function Bt(t){return t+""}function qt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ht(t,e,r){function n(e){var r=t(e),n=o(r,1);return e-r1)for(;i=c)return-1;if(a=e.charCodeAt(l++),37===a){if(i=e.charAt(l++),o=C[i in vl?e.charAt(l++):i],!o||(n=o(t,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}function n(t,e,r){w.lastIndex=0;var n=w.exec(e.slice(r));return n?(t.w=k.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){b.lastIndex=0;var n=b.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function o(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=L.get(n[0].toLowerCase()),r+n[0].length):-1}function i(t,e,r){M.lastIndex=0;var n=M.exec(e.slice(r));return n?(t.m=A.get(n[0].toLowerCase()),r+n[0].length):-1}function l(t,e,n){return r(t,z.c.toString(),e,n)}function s(t,e,n){return r(t,z.x.toString(),e,n)}function c(t,e,n){return r(t,z.X.toString(),e,n)}function u(t,e,r){var n=x.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)}var f=t.dateTime,d=t.date,h=t.time,p=t.periods,g=t.days,m=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{gl=qt;var e=new gl;return e._=t,n(e)}finally{gl=Date}}var n=e(t);return r.parse=function(t){try{gl=qt;var e=n.parse(t);return e&&e._}finally{gl=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ue;var x=ui.map(),b=Yt(g),_=Xt(g),w=Yt(m),k=Xt(m),M=Yt(v),A=Xt(v),T=Yt(y),L=Xt(y);p.forEach(function(t,e){x.set(t.toLowerCase(),e)});var z={a:function(t){return m[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(f),d:function(t,e){return Ut(t.getDate(),e,2)},e:function(t,e){return Ut(t.getDate(),e,2)},H:function(t,e){return Ut(t.getHours(),e,2)},I:function(t,e){return Ut(t.getHours()%12||12,e,2)},j:function(t,e){return Ut(1+pl.dayOfYear(t),e,3)},L:function(t,e){return Ut(t.getMilliseconds(),e,3)},m:function(t,e){return Ut(t.getMonth()+1,e,2)},M:function(t,e){return Ut(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Ut(t.getSeconds(),e,2)},U:function(t,e){return Ut(pl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ut(pl.mondayOfYear(t),e,2)},x:e(d),X:e(h),y:function(t,e){return Ut(t.getFullYear()%100,e,2)},Y:function(t,e){return Ut(t.getFullYear()%1e4,e,4)},Z:se,"%":function(){return"%"}},C={a:n,A:a,b:o,B:i,c:l,d:re,e:re,H:ae,I:ae,j:ne,L:le,m:ee,M:oe,p:u,S:ie,U:Wt,w:Gt,W:Qt,x:s,X:c,y:Jt,Y:$t,Z:Kt,"%":ce};return e}function Ut(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",o=a.length;return n+(o68?1900:2e3)}function ee(t,e,r){yl.lastIndex=0;var n=yl.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){yl.lastIndex=0;var n=yl.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1} -function ne(t,e,r){yl.lastIndex=0;var n=yl.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ae(t,e,r){yl.lastIndex=0;var n=yl.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function oe(t,e,r){yl.lastIndex=0;var n=yl.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function ie(t,e,r){yl.lastIndex=0;var n=yl.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function le(t,e,r){yl.lastIndex=0;var n=yl.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function se(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=bi(e)/60|0,a=bi(e)%60;return r+Ut(n,"0",2)+Ut(a,"0",2)}function ce(t,e,r){xl.lastIndex=0;var n=xl.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function ue(t){for(var e=t.length,r=-1;++r=0?1:-1,l=i*r,s=Math.cos(e),c=Math.sin(e),u=o*c,f=a*s+u*Math.cos(l),d=u*i*Math.sin(l);Al.add(Math.atan2(d,f)),n=t,a=s,o=c}var e,r,n,a,o;Tl.point=function(i,l){Tl.point=t,n=(e=i)*Vi,a=Math.cos(l=(r=l)*Vi/2+Fi/4),o=Math.sin(l)},Tl.lineEnd=function(){t(e,r)}}function ve(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 be(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function ke(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function Me(t,e){return bi(t[0]-e[0])=0;--l)a.point((f=u[l])[0],f[1])}else n(h.x,h.p.x,-1,a);h=h.p}h=h.o,u=h.z,p=!p}while(!h.v);a.lineEnd()}}}function Pe(t){if(e=t.length){for(var e,r,n=0,a=t[0];++n0){for(_||(o.polygonStart(),_=!0),o.lineStart();++i1&&2&e&&r.push(r.pop().concat(r.shift())),h.push(r.filter(Ie))}var h,p,g,m=e(o),v=a.invert(n[0],n[1]),y={point:i,lineStart:s,lineEnd:c,polygonStart:function(){y.point=u,y.lineStart=f,y.lineEnd=d,h=[],p=[]},polygonEnd:function(){y.point=i,y.lineStart=s,y.lineEnd=c,h=ui.merge(h);var t=He(v,p);h.length?(_||(o.polygonStart(),_=!0),De(h,je,t,r,o)):t&&(_||(o.polygonStart(),_=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),_&&(o.polygonEnd(),_=!1),h=p=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}},x=Re(),b=e(x),_=!1;return y}}function Ie(t){return t.length>1}function Re(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:k,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function je(t,e){return((t=t.x)[0]<0?t[1]-Hi-Ri:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-Ri:Hi-e[1])}function Fe(t){var e,r=NaN,n=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,i){var l=o>0?Fi:-Fi,s=bi(o-r);bi(s-Fi)0?Hi:-Hi),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(l,n),t.point(o,n),e=0):a!==l&&s>=Fi&&(bi(r-a)Ri?Math.atan((Math.sin(e)*(o=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(e))*Math.sin(t))/(a*o*i)):(e+n)/2}function qe(t,e,r,n){var a;if(null==t)a=r*Hi,n.point(-Fi,a),n.point(0,a),n.point(Fi,a),n.point(Fi,0),n.point(Fi,-a),n.point(0,-a),n.point(-Fi,-a),n.point(-Fi,0),n.point(-Fi,a);else if(bi(t[0]-e[0])>Ri){var o=t[0]=0?1:-1,k=w*_,M=k>Fi,A=p*x;if(Al.add(Math.atan2(A*w*Math.sin(k),g*b+A*Math.cos(k))),o+=M?_+w*Bi:_,M^d>=r^v>=r){var T=xe(ve(f),ve(t));we(T);var L=xe(a,T);we(L);var z=(M^_>=0?-1:1)*nt(L[2]);(n>z||n===z&&(T[0]||T[1]))&&(i+=M^_>=0?1:-1)}if(!m++)break;d=v,p=x,g=b,f=t}}return(o<-Ri||oo}function r(t){var r,o,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var h,p=[f,d],g=e(f,d),m=i?g?0:a(f,d):g?a(f+(f<0?Fi:-Fi),d):0;if(!r&&(c=s=g)&&t.lineStart(),g!==s&&(h=n(r,p),(Me(r,h)||Me(p,h))&&(p[0]+=Ri,p[1]+=Ri,g=e(p[0],p[1]))),g!==s)u=0,g?(t.lineStart(),h=n(p,r),t.point(h[0],h[1])):(h=n(r,p),t.point(h[0],h[1]),t.lineEnd()),r=h;else if(l&&r&&i^g){var v;m&o||!(v=n(p,r,!0))||(u=0,i?(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||r&&Me(r,p)||t.point(p[0],p[1]),r=p,s=g,o=m},lineEnd:function(){s&&t.lineEnd(),r=null},clean:function(){return u|(c&&s)<<1}}}function n(t,e,r){var n=ve(t),a=ve(e),i=[1,0,0],l=xe(n,a),s=ye(l,l),c=l[0],u=s-c*c;if(!u)return!r&&t;var f=o*s/u,d=-o*c/u,h=xe(i,l),p=_e(i,f),g=_e(l,d);be(p,g);var m=h,v=ye(p,m),y=ye(m,m),x=v*v-y*(ye(p,p)-1);if(!(x<0)){var b=Math.sqrt(x),_=_e(m,(-v-b)/y);if(be(_,p),_=ke(_),!r)return _;var w,k=t[0],M=e[0],A=t[1],T=e[1];M0^_[1]<(bi(_[0]-k)Fi^(k<=_[0]&&_[0]<=M)){var S=_e(m,(-v+b)/y);return be(S,p),[_,ke(S)]}}}function a(e,r){var n=i?t:Fi-t,a=0;return e<-n?a|=1:e>n&&(a|=2),r<-n?a|=4:r>n&&(a|=8),a}var o=Math.cos(t),i=o>0,l=bi(o)>Ri,s=mr(t,6*Vi);return Ne(e,r,s,i?[0,-t]:[-Fi,t-Fi])}function Ze(t,e,r,n){return function(a){var o,i=a.a,l=a.b,s=i.x,c=i.y,u=l.x,f=l.y,d=0,h=1,p=u-s,g=f-c;if(o=t-s,p||!(o>0)){if(o/=p,p<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=r-s,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>d&&(d=o)}else if(p>0){if(o0)){if(o/=g,g<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=n-c,g||!(o<0)){if(o/=g,g<0){if(o>h)return;o>d&&(d=o)}else if(g>0){if(o0&&(a.a={x:s+d*p,y:c+d*g}),h<1&&(a.b={x:s+h*p,y:c+h*g}),a}}}}}}function Ue(t,e,r,n){function a(n,a){return bi(n[0]-t)0?0:3:bi(n[0]-r)0?2:1:bi(n[1]-e)0?1:0:a>0?3:2}function o(t,e){return i(t.x,e.x)}function i(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]}return function(l){function s(t){for(var e=0,r=m.length,n=t[1],a=0;an&&et(c,o,t)>0&&++e:o[1]<=n&&et(c,o,t)<0&&--e,c=o;return 0!==e}function c(o,l,s,c){var u=0,f=0;if(null==o||(u=a(o,s))!==(f=a(l,s))||i(o,l)<0^s>0){do c.point(0===u||3===u?t:r,u>1?n:e);while((u=(u+s+4)%4)!==f)}else c.point(l[0],l[1])}function u(a,o){return t<=a&&a<=r&&e<=o&&o<=n}function f(t,e){u(t,e)&&l.point(t,e)}function d(){C.point=p,m&&m.push(v=[]),M=!0,k=!1,_=w=NaN}function h(){g&&(p(y,x),b&&k&&L.rejoin(),g.push(L.buffer())),C.point=f,k&&l.lineEnd()}function p(t,e){t=Math.max(-Bl,Math.min(Bl,t)),e=Math.max(-Bl,Math.min(Bl,e));var r=u(t,e);if(m&&v.push([t,e]),M)y=t,x=e,b=r,M=!1,r&&(l.lineStart(),l.point(t,e));else if(r&&k)l.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};z(n)?(k||(l.lineStart(),l.point(n.a.x,n.a.y)),l.point(n.b.x,n.b.y),r||l.lineEnd(),A=!1):r&&(l.lineStart(),l.point(t,e),A=!1)}_=t,w=e,k=r}var g,m,v,y,x,b,_,w,k,M,A,T=l,L=Re(),z=Ze(t,e,r,n),C={point:f,lineStart:d,lineEnd:h,polygonStart:function(){l=L,g=[],m=[],A=!0},polygonEnd:function(){l=T,g=ui.merge(g);var e=s([t,n]),r=A&&e,a=g.length;(r||a)&&(l.polygonStart(),r&&(l.lineStart(),c(null,null,1,l),l.lineEnd()),a&&De(g,o,e,c,l),l.polygonEnd()),g=m=v=null}};return C}}function Ye(t){var e=0,r=Fi/3,n=sr(t),a=n(e,r);return a.parallels=function(t){return arguments.length?n(e=t[0]*Fi/180,r=t[1]*Fi/180):[e/Fi*180,r/Fi*180]},a}function Xe(t,e){function r(t,e){var r=Math.sqrt(o-2*a*Math.sin(e))/a;return[r*Math.sin(t*=a),i-r*Math.cos(t)]}var n=Math.sin(t),a=(n+Math.sin(e))/2,o=1+n*(2*a-n),i=Math.sqrt(o)/a;return r.invert=function(t,e){var r=i-e;return[Math.atan2(t,r)/a,nt((o-(t*t+r*r)*a*a)/(2*a))]},r}function Ge(){function t(t,e){Hl+=a*t-n*e,n=t,a=e}var e,r,n,a;Xl.point=function(o,i){Xl.point=t,e=n=o,r=a=i},Xl.lineEnd=function(){t(e,r)}}function We(t,e){tUl&&(Ul=t),eYl&&(Yl=e)}function Qe(){function t(t,e){i.push("M",t,",",e,o)}function e(t,e){i.push("M",t,",",e),l.point=r}function r(t,e){i.push("L",t,",",e)}function n(){l.point=t}function a(){i.push("Z")}var o=$e(4.5),i=[],l={point:t,lineStart:function(){l.point=e},lineEnd:n,polygonStart:function(){l.lineEnd=a},polygonEnd:function(){l.lineEnd=n,l.point=t},pointRadius:function(t){return o=$e(t),l},result:function(){if(i.length){var t=i.join("");return i=[],t}}};return l}function $e(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Je(t,e){Cl+=t,Sl+=e,++Ol}function Ke(){function t(t,n){var a=t-e,o=n-r,i=Math.sqrt(a*a+o*o);Dl+=i*(e+t)/2,Pl+=i*(r+n)/2,El+=i,Je(e=t,r=n)}var e,r;Wl.point=function(n,a){Wl.point=t,Je(e=n,r=a)}}function tr(){Wl.point=Je}function er(){function t(t,e){var r=t-n,o=e-a,i=Math.sqrt(r*r+o*o);Dl+=i*(n+t)/2,Pl+=i*(a+e)/2,El+=i,i=a*t-n*e,Nl+=i*(n+t),Il+=i*(a+e),Rl+=3*i,Je(n=t,a=e)}var e,r,n,a;Wl.point=function(o,i){Wl.point=t,Je(e=n=o,r=a=i)},Wl.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+i,r),t.arc(e,r,i,0,Bi)}function r(e,r){t.moveTo(e,r),l.point=n}function n(e,r){t.lineTo(e,r)}function a(){l.point=e}function o(){t.closePath()}var i=4.5,l={point:e,lineStart:function(){l.point=r},lineEnd:a,polygonStart:function(){l.lineEnd=o},polygonEnd:function(){l.lineEnd=a,l.point=e},pointRadius:function(t){return i=t,l},result:k};return l}function nr(t){function e(t){return(l?n:r)(t)}function r(e){return ir(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})}function n(e){function r(r,n){r=t(r,n),e.point(r[0],r[1])}function n(){x=NaN,M.point=o,e.lineStart()}function o(r,n){var o=ve([r,n]),i=t(r,n);a(x,b,y,_,w,k,x=i[0],b=i[1],y=r,_=o[0],w=o[1],k=o[2],l,e),e.point(x,b)}function i(){M.point=r,e.lineEnd()}function s(){n(),M.point=c,M.lineEnd=u}function c(t,e){o(f=t,d=e),h=x,p=b,g=_,m=w,v=k,M.point=o}function u(){a(x,b,y,_,w,k,h,p,f,g,m,v,l,e),M.lineEnd=i,i()}var f,d,h,p,g,m,v,y,x,b,_,w,k,M={point:r,lineStart:n,lineEnd:i,polygonStart:function(){e.polygonStart(),M.lineStart=s},polygonEnd:function(){e.polygonEnd(),M.lineStart=n}};return M}function a(e,r,n,l,s,c,u,f,d,h,p,g,m,v){var y=u-e,x=f-r,b=y*y+x*x;if(b>4*o&&m--){var _=l+h,w=s+p,k=c+g,M=Math.sqrt(_*_+w*w+k*k),A=Math.asin(k/=M),T=bi(bi(k)-1)o||bi((y*S+x*O)/b-.5)>.3||l*h+s*p+c*g0&&16,e):Math.sqrt(o)},e}function ar(t){var e=nr(function(e,r){return t([e*Zi,r*Zi])});return function(t){return cr(e(t))}}function or(t){this.stream=t}function ir(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 lr(t){return sr(function(){return t})()}function sr(t){function e(t){return t=l(t[0]*Vi,t[1]*Vi),[t[0]*d+s,c-t[1]*d]}function r(t){return t=l.invert((t[0]-s)/d,(c-t[1])/d),t&&[t[0]*Zi,t[1]*Zi]}function n(){l=Se(i=dr(v,y,x),o);var t=o(g,m);return s=h-t[0]*d,c=p+t[1]*d,a()}function a(){return u&&(u.valid=!1,u=null),e}var o,i,l,s,c,u,f=nr(function(t,e){return t=o(t,e),[t[0]*d+s,c-t[1]*d]}),d=150,h=480,p=250,g=0,m=0,v=0,y=0,x=0,_=Fl,w=b,k=null,M=null;return e.stream=function(t){return u&&(u.valid=!1),u=cr(_(i,f(w(t)))),u.valid=!0,u},e.clipAngle=function(t){return arguments.length?(_=null==t?(k=t,Fl):Ve((k=+t)*Vi),a()):k},e.clipExtent=function(t){return arguments.length?(M=t,w=t?Ue(t[0][0],t[0][1],t[1][0],t[1][1]):b,a()):M},e.scale=function(t){return arguments.length?(d=+t,n()):d},e.translate=function(t){return arguments.length?(h=+t[0],p=+t[1],n()):[h,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Vi,m=t[1]%360*Vi,n()):[g*Zi,m*Zi]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Vi,y=t[1]%360*Vi,x=t.length>2?t[2]%360*Vi:0,n()):[v*Zi,y*Zi,x*Zi]},ui.rebind(e,f,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&r,n()}}function cr(t){return ir(t,function(e,r){t.point(e*Vi,r*Vi)})}function ur(t,e){return[t,e]}function fr(t,e){return[t>Fi?t-Bi:t<-Fi?t+Bi:t,e]}function dr(t,e,r){return t?e||r?Se(pr(t),gr(e,r)):pr(t):e||r?gr(e,r):fr}function hr(t){return function(e,r){return e+=t,[e>Fi?e-Bi:e<-Fi?e+Bi:e,r]}}function pr(t){var e=hr(t);return e.invert=hr(-t),e}function gr(t,e){function r(t,e){var r=Math.cos(e),l=Math.cos(t)*r,s=Math.sin(t)*r,c=Math.sin(e),u=c*n+l*a;return[Math.atan2(s*o-u*i,l*n-c*a),nt(u*o+s*i)]}var n=Math.cos(t),a=Math.sin(t),o=Math.cos(e),i=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),l=Math.cos(t)*r,s=Math.sin(t)*r,c=Math.sin(e),u=c*o-s*i;return[Math.atan2(s*o+c*i,l*n+u*a),nt(u*n-l*a)]},r}function mr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,o,i,l){var s=i*e;null!=a?(a=vr(r,a),o=vr(r,o),(i>0?ao)&&(a+=i*Bi)):(a=t+i*Bi,o=t-.5*s);for(var c,u=a;i>0?u>o:u0?e<-Hi+Ri&&(e=-Hi+Ri):e>Hi-Ri&&(e=Hi-Ri);var r=i/Math.pow(a(e),o);return[r*Math.sin(o*t),i-r*Math.cos(o*t)]}var n=Math.cos(t),a=function(t){return Math.tan(Fi/4+t/2)},o=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(a(e)/a(t)),i=n*Math.pow(a(t),o)/o;return o?(r.invert=function(t,e){var r=i-e,n=tt(o)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/o,2*Math.atan(Math.pow(i/n,1/o))-Hi]},r):Lr}function Tr(t,e){function r(t,e){var r=o-e;return[r*Math.sin(a*t),o-r*Math.cos(a*t)]}var n=Math.cos(t),a=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),o=n/a+t;return bi(a)1&&et(t[r[n-2]],t[r[n-1]],t[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function Pr(t,e){return t[0]-e[0]||t[1]-e[1]}function Er(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Nr(t,e,r,n){var a=t[0],o=r[0],i=e[0]-a,l=n[0]-o,s=t[1],c=r[1],u=e[1]-s,f=n[1]-c,d=(l*(s-c)-f*(a-o))/(f*i-l*u);return[a+d*i,s+d*u]}function Ir(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Rr(){an(this),this.edge=this.site=this.circle=null}function jr(t){var e=cs.pop()||new Rr;return e.site=t,e}function Fr(t){Wr(t),is.remove(t),cs.push(t),an(t)}function Br(t){var e=t.circle,r=e.x,n=e.cy,a={x:r,y:n},o=t.P,i=t.N,l=[t];Fr(t);for(var s=o;s.circle&&bi(r-s.circle.x)Ri)l=l.L;else{if(a=o-Vr(l,i),!(a>Ri)){n>-Ri?(e=l.P,r=l):a>-Ri?(e=l,r=l.N):e=r=l;break}if(!l.R){e=l;break}l=l.R}var s=jr(t);if(is.insert(e,s),e||r){if(e===r)return Wr(e),r=jr(e.site),is.insert(s,r),s.edge=r.edge=Kr(e.site,s.site),Gr(e),void Gr(r);if(!r)return void(s.edge=Kr(e.site,s.site));Wr(e),Wr(r);var c=e.site,u=c.x,f=c.y,d=t.x-u,h=t.y-f,p=r.site,g=p.x-u,m=p.y-f,v=2*(d*m-h*g),y=d*d+h*h,x=g*g+m*m,b={x:(m*y-h*x)/v+u,y:(d*x-g*y)/v+f};en(r.edge,c,p,b),s.edge=Kr(c,t,null,b),r.edge=Kr(t,p,null,b),Gr(e),Gr(r)}}function Hr(t,e){var r=t.site,n=r.x,a=r.y,o=a-e;if(!o)return n;var i=t.P;if(!i)return-(1/0);r=i.site;var l=r.x,s=r.y,c=s-e;if(!c)return l;var u=l-n,f=1/o-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-o/2)))/f+n:(n+l)/2}function Vr(t,e){var r=t.N;if(r)return Hr(r,e);var n=t.site;return n.y===e?n.x:1/0}function Zr(t){this.site=t,this.edges=[]}function Ur(t){for(var e,r,n,a,o,i,l,s,c,u,f=t[0][0],d=t[1][0],h=t[0][1],p=t[1][1],g=os,m=g.length;m--;)if(o=g[m],o&&o.prepare())for(l=o.edges,s=l.length,i=0;iRi||bi(a-r)>Ri)&&(l.splice(i,0,new rn(tn(o.site,u,bi(n-f)Ri?{x:f,y:bi(e-f)Ri?{x:bi(r-p)Ri?{x:d,y:bi(e-d)Ri?{x:bi(r-h)=-ji)){var h=s*s+c*c,p=u*u+f*f,g=(f*h-c*p)/d,m=(s*p-u*h)/d,f=m+l,v=us.pop()||new Xr;v.arc=t,v.site=a,v.x=g+i,v.y=f+Math.sqrt(g*g+m*m),v.cy=f,t.circle=v;for(var y=null,x=ss._;x;)if(v.y=l)return;if(d>p){if(o){if(o.y>=c)return}else o={x:m,y:s};r={x:m,y:c}}else{if(o){if(o.y1)if(d>p){if(o){if(o.y>=c)return}else o={x:(s-a)/n,y:s};r={x:(c-a)/n,y:c}}else{if(o){if(o.y=l)return}else o={x:i,y:n*i+a};r={x:l,y:n*l+a}}else{if(o){if(o.xo||f>i||d=b,k=r>=_,M=k<<1|w,A=M+4;Mo&&(a=e.slice(o,a),l[i]?l[i]+=a:l[++i]=a),(r=r[0])===(n=n[0])?l[i]?l[i]+=n:l[++i]=n:(l[++i]=null,s.push({i:i,x:xn(r,n)})),o=hs.lastIndex;return o=0&&!(r=ui.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],a=[],o=t.length,i=e.length,l=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function Mn(t){return function(e){return 1-t(1-e)}}function An(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function Ln(t){return t*t*t}function zn(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 Cn(t){return function(e){return Math.pow(e,t)}}function Sn(t){return 1-Math.cos(t*Hi)}function On(t){return Math.pow(2,10*(t-1))}function Dn(t){return 1-Math.sqrt(1-t*t)}function Pn(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Bi*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Bi/e)}}function En(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Nn(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 In(t,e){t=ui.hcl(t),e=ui.hcl(e);var r=t.h,n=t.c,a=t.l,o=e.h-r,i=e.c-n,l=e.l-a;return isNaN(i)&&(i=0,n=isNaN(n)?e.c:n),isNaN(o)?(o=0,r=isNaN(r)?e.h:r):o>180?o-=360:o<-180&&(o+=360),function(t){return dt(r+o*t,n+i*t,a+l*t)+""}}function Rn(t,e){t=ui.hsl(t),e=ui.hsl(e);var r=t.h,n=t.s,a=t.l,o=e.h-r,i=e.s-n,l=e.l-a;return isNaN(i)&&(i=0,n=isNaN(n)?e.s:n),isNaN(o)?(o=0,r=isNaN(r)?e.h:r):o>180?o-=360:o<-180&&(o+=360),function(t){return ut(r+o*t,n+i*t,a+l*t)+""}}function jn(t,e){t=ui.lab(t),e=ui.lab(e);var r=t.l,n=t.a,a=t.b,o=e.l-r,i=e.a-n,l=e.b-a;return function(t){return pt(r+o*t,n+i*t,a+l*t)+""}}function Fn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function Bn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Hn(e),a=qn(e,r),o=Hn(Vn(r,e,-a))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(Zn(r)+"rotate(",null,")")-2,x:xn(t,e)})):e&&r.push(Zn(r)+"rotate("+e+")")}function Xn(t,e,r,n){t!==e?n.push({i:r.push(Zn(r)+"skewX(",null,")")-2,x:xn(t,e)}):e&&r.push(Zn(r)+"skewX("+e+")")}function Gn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(Zn(r)+"scale(",null,",",null,")");n.push({i:a-4,x:xn(t[0],e[0])},{i:a-2,x:xn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(Zn(r)+"scale("+e+")")}function Wn(t,e){var r=[],n=[];return t=ui.transform(t),e=ui.transform(e),Un(t.translate,e.translate,r,n),Yn(t.rotate,e.rotate,r,n),Xn(t.skew,e.skew,r,n),Gn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,a=-1,o=n.length;++a=0;)r.push(a[n])}function sa(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(o=t.children)&&(a=o.length))for(var a,o,i=-1;++ia&&(n=r,a=e);return n}function xa(t){return t.reduce(ba,0)}function ba(t,e){return t+e[1]}function _a(t,e){return wa(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wa(t,e){for(var r=-1,n=+t[0],a=(t[1]-n)/e,o=[];++r<=e;)o[r]=a*r+n;return o}function ka(t){return[ui.min(t),ui.max(t)]}function Ma(t,e){return t.value-e.value}function Aa(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ta(t,e){t._pack_next=e,e._pack_prev=t}function La(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 za(t){function e(t){u=Math.min(t.x-t.r,u),f=Math.max(t.x+t.r,f),d=Math.min(t.y-t.r,d),h=Math.max(t.y+t.r,h)}if((r=t.children)&&(c=r.length)){var r,n,a,o,i,l,s,c,u=1/0,f=-(1/0),d=1/0,h=-(1/0); -if(r.forEach(Ca),n=r[0],n.x=-n.r,n.y=0,e(n),c>1&&(a=r[1],a.x=a.r,a.y=0,e(a),c>2))for(o=r[2],Da(n,a,o),e(o),Aa(n,o),n._pack_prev=o,Aa(o,a),a=n._pack_next,i=3;i=0;)e=a[o],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function ja(t,e,r){return t.a.parent===e.parent?t.a:r}function Fa(t){return 1+ui.max(t,function(t){return t.y})}function Ba(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function qa(t){var e=t.children;return e&&e.length?qa(e[0]):t}function Ha(t){var e,r=t.children;return r&&(e=r.length)?Ha(r[e-1]):t}function Va(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Za(t,e){var r=t.x+e[3],n=t.y+e[0],a=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return a<0&&(r+=a/2,a=0),o<0&&(n+=o/2,o=0),{x:r,y:n,dx:a,dy:o}}function Ua(t){var e=t[0],r=t[t.length-1];return e2?Qa:Xa,s=n?$n:Qn;return i=a(t,e,s,r),l=a(e,t,s,_n),o}function o(t){return i(t)}var i,l;return o.invert=function(t){return l(t)},o.domain=function(e){return arguments.length?(t=e.map(Number),a()):t},o.range=function(t){return arguments.length?(e=t,a()):e},o.rangeRound=function(t){return o.range(t).interpolate(Fn)},o.clamp=function(t){return arguments.length?(n=t,a()):n},o.interpolate=function(t){return arguments.length?(r=t,a()):r},o.ticks=function(e){return eo(t,e)},o.tickFormat=function(e,r){return ro(t,e,r)},o.nice=function(e){return Ka(t,e),a()},o.copy=function(){return $a(t,e,r,n)},a()}function Ja(t,e){return ui.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ka(t,e){return Ga(t,Wa(to(t,e)[2])),Ga(t,Wa(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var r=Ua(t),n=r[1]-r[0],a=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),o=e/n*a;return o<=.15?a*=10:o<=.35?a*=5:o<=.75&&(a*=2),r[0]=Math.ceil(r[0]/a)*a,r[1]=Math.floor(r[1]/a)*a+.5*a,r[2]=a,r}function eo(t,e){return ui.range.apply(ui,to(t,e))}function ro(t,e,r){var n=to(t,e);if(r){var a=dl.exec(r);if(a.shift(),"s"===a[8]){var o=ui.formatPrefix(Math.max(bi(n[0]),bi(n[1])));return a[7]||(a[7]="."+no(o.scale(n[2]))),a[8]="f",r=ui.format(a.join("")),function(t){return r(o.scale(t))+o.symbol}}a[7]||(a[7]="."+ao(a[8],n)),r=a.join("")}else r=",."+no(n[2])+"f";return ui.format(r)}function no(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ao(t,e){var r=no(e[2]);return t in As?Math.abs(r-no(Math.max(bi(e[0]),bi(e[1]))))+ +("e"!==t):r-2*("%"===t)}function oo(t,e,r,n){function a(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function i(e){return t(a(e))}return i.invert=function(e){return o(t.invert(e))},i.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(a)),i):n},i.base=function(r){return arguments.length?(e=+r,t.domain(n.map(a)),i):e},i.nice=function(){var e=Ga(n.map(a),r?Math:Ls);return t.domain(e),n=e.map(o),i},i.ticks=function(){var t=Ua(n),i=[],l=t[0],s=t[1],c=Math.floor(a(l)),u=Math.ceil(a(s)),f=e%1?2:e;if(isFinite(u-c)){if(r){for(;c0;d--)i.push(o(c)*d);for(c=0;i[c]s;u--);i=i.slice(c,u)}return i},i.tickFormat=function(t,r){if(!arguments.length)return Ts;arguments.length<2?r=Ts:"function"!=typeof r&&(r=ui.format(r));var n=Math.max(1,e*t/i.ticks().length);return function(t){var i=t/o(Math.round(a(t)));return i*e0?l[r-1]:t[0],r0?0:1}function _o(t,e,r,n,a){var o=t[0]-e[0],i=t[1]-e[1],l=(a?n:-n)/Math.sqrt(o*o+i*i),s=l*i,c=-l*o,u=t[0]+s,f=t[1]+c,d=e[0]+s,h=e[1]+c,p=(u+d)/2,g=(f+h)/2,m=d-u,v=h-f,y=m*m+v*v,x=r-n,b=u*h-d*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-p,L=k-g,z=M-p,C=A-g;return T*T+L*L>z*z+C*C&&(w=M,k=A),[[w-s,k-c],[w*r/x,k*r/x]]}function wo(t){function e(e){function i(){c.push("M",o(t(u),l))}for(var s,c=[],u=[],f=-1,d=e.length,h=zt(r),p=zt(n);++f1?t.join("L"):t+"Z"}function Mo(t){return t.join("L")+"Z"}function Ao(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1&&a.push("H",n[0]),a.join("")}function To(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1){l=e[1],o=t[s],s++,n+="C"+(a[0]+i[0])+","+(a[1]+i[1])+","+(o[0]-l[0])+","+(o[1]-l[1])+","+o[0]+","+o[1];for(var c=2;c9&&(a=3*e/Math.sqrt(a),i[l]=a*r,i[l+1]=a*n));for(l=-1;++l<=s;)a=(t[Math.min(s,l+1)][0]-t[Math.max(0,l-1)][0])/(6*(1+i[l]*i[l])),o.push([a||0,i[l]*a||0]);return o}function Ho(t){return t.length<3?ko(t):t[0]+Oo(t,qo(t))}function Vo(t){for(var e,r,n,a=-1,o=t.length;++a0;)h[--l].call(t,i);if(o>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var s,c,u,d,h,p=t[r]||(t[r]={active:0,count:0}),g=p[n];g||(s=a.time,c=Pt(o,0,s),g=p[n]={tween:new f,time:s,timer:c,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++p.count)}function ni(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function ai(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function oi(t){return t.toISOString()}function ii(t,e,r){function n(e){return t(e)}function a(t,r){var n=t[1]-t[0],a=n/r,o=ui.bisect(Js,a);return o==Js.length?[e.year,to(t.map(function(t){return t/31536e6}),r)[2]]:o?e[a/Js[o-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=li(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=li(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Ua(n.domain()),o=null==t?a(r,10):"number"==typeof t?a(r,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(r[0],li(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return ii(t.copy(),e,r)},Ja(n,t)}function li(t){return new Date(t)}function si(t){return JSON.parse(t.responseText)}function ci(t){var e=hi.createRange();return e.selectNode(hi.body),e.createContextualFragment(t.responseText)}var ui={version:"3.5.17"},fi=[].slice,di=function(t){return fi.call(t)},hi=this.document;if(hi)try{di(hi.documentElement.childNodes)[0].nodeType}catch(t){di=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}),hi)try{hi.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var pi=this.Element.prototype,gi=pi.setAttribute,mi=pi.setAttributeNS,vi=this.CSSStyleDeclaration.prototype,yi=vi.setProperty;pi.setAttribute=function(t,e){gi.call(this,t,e+"")},pi.setAttributeNS=function(t,e,r){mi.call(this,t,e,r+"")},vi.setProperty=function(t,e,r){yi.call(this,t,e+"",r)}}ui.ascending=a,ui.descending=function(t,e){return et?1:e>=t?0:NaN},ui.min=function(t,e){var r,n,a=-1,o=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},ui.max=function(t,e){var r,n,a=-1,o=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},ui.extent=function(t,e){var r,n,a,o=-1,i=t.length;if(1===arguments.length){for(;++o=n){r=a=n;break}for(;++on&&(r=n),a=n){r=a=n;break}for(;++on&&(r=n),a1)return s/(u-1)},ui.deviation=function(){var t=ui.variance.apply(this,arguments);return t?Math.sqrt(t):t};var xi=l(a);ui.bisectLeft=xi.left,ui.bisect=ui.bisectRight=xi.right,ui.bisector=function(t){return l(1===t.length?function(e,r){return a(t(e),r)}:t)},ui.shuffle=function(t,e,r){(o=arguments.length)<3&&(r=t.length,o<2&&(e=0));for(var n,a,o=r-e;o;)a=Math.random()*o--|0,n=t[o+e],t[o+e]=t[a+e],t[a+e]=n;return t},ui.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},ui.pairs=function(t){for(var e,r=0,n=t.length-1,a=t[0],o=new Array(n<0?0:n);r=0;)for(n=t[a],e=n.length;--e>=0;)r[--i]=n[e];return r};var bi=Math.abs;ui.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,a=[],o=c(bi(r)),i=-1;if(t*=o,e*=o,r*=o,r<0)for(;(n=t+r*++i)>e;)a.push(n/o);else for(;(n=t+r*++i)=o.length)return n?n.call(a,i):r?i.sort(r):i;for(var s,c,u,d,h=-1,p=i.length,g=o[l++],m=new f;++h=o.length)return t;var n=[],a=i[r++];return t.forEach(function(t,a){n.push({key:t,values:e(a,r)})}),a?n.sort(function(t,e){return a(t.key,e.key)}):n}var r,n,a={},o=[],i=[];return a.map=function(e,r){return t(r,e,0)},a.entries=function(r){return e(t(ui.map,r,0),0)},a.key=function(t){return o.push(t),a},a.sortKeys=function(t){return i[o.length-1]=t,a},a.sortValues=function(t){return r=t,a},a.rollup=function(t){return n=t,a},a},ui.set=function(t){var e=new x;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}},ui.event=null,ui.requote=function(t){return t.replace(Mi,"\\$&")};var Mi=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ai={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},Ti=function(t,e){return e.querySelector(t)},Li=function(t,e){return e.querySelectorAll(t)},zi=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(zi=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Ti=function(t,e){return Sizzle(t,e)[0]||null},Li=Sizzle,zi=Sizzle.matchesSelector),ui.selection=function(){return ui.select(hi.documentElement)};var Ci=ui.selection.prototype=[];Ci.select=function(t){var e,r,n,a,o=[];t=S(t);for(var i=-1,l=this.length;++i=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Oi.hasOwnProperty(r)?{space:Oi[r],local:t}:t}},Ci.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=ui.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(D(e,t[e]));return this}return this.each(D(t,e))},Ci.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=N(t)).length,a=-1;if(e=r.classList){for(;++a=0;)(r=n[a])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r);return this},Ci.sort=function(t){t=Z.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.transition().duration(C)),e.call(t.event)}function l(){_&&_.domain(b.range().map(function(t){return(t-M.x)/M.k}).map(b.invert)),k&&k.domain(w.range().map(function(t){return(t-M.y)/M.k}).map(w.invert))}function s(t){S++||t({type:"zoomstart"})}function c(t){l(),t({type:"zoom",scale:M.k,translate:[M.x,M.y]})}function u(t){--S||(t({type:"zoomend"}),m=null)}function f(){function t(){l=1,o(ui.mouse(a),d),c(i)}function r(){f.on(D,null).on(P,null),h(l),u(i)}var a=this,i=N.of(a,arguments),l=0,f=ui.select(n(a)).on(D,t).on(P,r),d=e(ui.mouse(a)),h=$(a);Hs.call(a),s(i)}function d(){function t(){var t=ui.touches(p);return h=M.k,t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))}),t}function r(){var e=ui.event.target;ui.select(e).on(b,n).on(_,l),w.push(e);for(var r=ui.event.changedTouches,a=0,o=r.length;a1){var u=s[0],f=s[1],d=u[0]-f[0],h=u[1]-f[1];v=d*d+h*h}}function n(){var t,e,r,n,i=ui.touches(p);Hs.call(p);for(var l=0,s=i.length;l=c)return i;if(a)return a=!1,o;var e=u;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,hl=ui.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=ui.round(t,Rt(t,e))).toFixed(Math.max(0,Math.min(20,Rt(t*(1+1e-15),e))))}}),pl=ui.time={},gl=Date;qt.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(){ml.setUTCDate.apply(this._,arguments)},setDay:function(){ml.setUTCDay.apply(this._,arguments)},setFullYear:function(){ml.setUTCFullYear.apply(this._,arguments)},setHours:function(){ml.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ml.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ml.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ml.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ml.setUTCSeconds.apply(this._,arguments)},setTime:function(){ml.setTime.apply(this._,arguments)}};var ml=Date.prototype;pl.year=Ht(function(t){return t=pl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),pl.years=pl.year.range,pl.years.utc=pl.year.utc.range,pl.day=Ht(function(t){var e=new gl(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),pl.days=pl.day.range,pl.days.utc=pl.day.utc.range,pl.dayOfYear=function(t){var e=pl.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var r=pl[t]=Ht(function(t){return(t=pl.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var r=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});pl[t+"s"]=r.range,pl[t+"s"].utc=r.utc.range,pl[t+"OfYear"]=function(t){var r=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(r+e)%7)/7)}}),pl.week=pl.sunday,pl.weeks=pl.sunday.range,pl.weeks.utc=pl.sunday.utc.range,pl.weekOfYear=pl.sundayOfYear;var vl={"-":"",_:" ",0:"0"},yl=/^\s*\d+/,xl=/^%/;ui.locale=function(t){return{numberFormat:Ft(t),timeFormat:Zt(t)}};var bl=ui.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"]});ui.format=bl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,_l),de(_l.s,this.s,this),this.s?this.t+=_l.t:this.s=_l.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _l=new fe;ui.geo.stream=function(t,e){t&&wl.hasOwnProperty(t.type)?wl[t.type](t,e):he(t,e)};var wl={Feature:function(t,e){he(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,a=r.length;++nh&&(h=e)}function e(e,r){var n=ve([e*Vi,r*Vi]);if(v){var a=xe(v,n),o=[a[1],-a[0],0],i=xe(o,a);we(i),i=ke(i);var s=e-p,c=s>0?1:-1,g=i[0]*Zi*c,m=bi(s)>180;if(m^(c*ph&&(h=y)}else if(g=(g+360)%360-180,m^(c*ph&&(h=r);m?el(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e):d>=u?(ed&&(d=e)):e>p?l(u,e)>l(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e)}else t(e,r);v=n,p=e}function r(){_.point=e}function n(){b[0]=u,b[1]=d,_.point=t,v=null}function a(t,r){if(v){var n=t-p;y+=bi(n)>180?n+(n>0?360:-360):n}else g=t,m=r;Tl.point(t,r),e(t,r)}function o(){Tl.lineStart()}function i(){a(g,m),Tl.lineEnd(),bi(y)>Ri&&(u=-(d=180)),b[0]=u,b[1]=d,v=null}function l(t,e){return(e-=t)<0?e+360:e}function s(t,e){return t[0]-e[0]}function c(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tRi?h=90:y<-Ri&&(f=-90),b[0]=u,b[1]=d}};return function(t){h=d=-(u=f=1/0),x=[],ui.geo.stream(t,_);var e=x.length;if(e){x.sort(s);for(var r,n=1,a=x[0],o=[a];nl(a[0],a[1])&&(a[1]=r[1]),l(r[0],a[1])>l(a[0],a[1])&&(a[0]=r[0])):o.push(a=r);for(var i,r,p=-(1/0),e=o.length-1,n=0,a=o[e];n<=e;a=r,++n)r=o[n],(i=l(a[1],r[0]))>p&&(p=i,u=r[0],d=a[1])}return x=b=null,u===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[u,f],[d,h]]}}(),ui.geo.centroid=function(t){Ll=zl=Cl=Sl=Ol=Dl=Pl=El=Nl=Il=Rl=0,ui.geo.stream(t,jl);var e=Nl,r=Il,n=Rl,a=e*e+r*r+n*n;return a=.12&&a<.234&&n>=-.425&&n<-.214?i:a>=.166&&a<.234&&n>=-.214&&n<-.115?l:o).invert(t)},t.stream=function(t){var e=o.stream(t),r=i.stream(t),n=l.stream(t);return{point:function(t,a){e.point(t,a),r.point(t,a),n.point(t,a)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),i.precision(e),l.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),i.scale(.35*e),l.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var c=o.scale(),u=+e[0],f=+e[1];return r=o.translate(e).clipExtent([[u-.455*c,f-.238*c],[u+.455*c,f+.238*c]]).stream(s).point,n=i.translate([u-.307*c,f+.201*c]).clipExtent([[u-.425*c+Ri,f+.12*c+Ri],[u-.214*c-Ri,f+.234*c-Ri]]).stream(s).point,a=l.translate([u-.205*c,f+.212*c]).clipExtent([[u-.214*c+Ri,f+.166*c+Ri],[u-.115*c-Ri,f+.234*c-Ri]]).stream(s).point,t},t.scale(1070)};var ql,Hl,Vl,Zl,Ul,Yl,Xl={point:k,lineStart:k,lineEnd:k,polygonStart:function(){Hl=0,Xl.lineStart=Ge},polygonEnd:function(){Xl.lineStart=Xl.lineEnd=Xl.point=k,ql+=bi(Hl/2)}},Gl={point:We,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Wl={point:Je,lineStart:Ke,lineEnd:tr,polygonStart:function(){Wl.lineStart=er},polygonEnd:function(){Wl.point=Je,Wl.lineStart=Ke,Wl.lineEnd=tr}};ui.geo.path=function(){function t(t){return t&&("function"==typeof l&&o.pointRadius(+l.apply(this,arguments)),i&&i.valid||(i=a(o)),ui.geo.stream(t,i)),o.result()}function e(){return i=null,t}var r,n,a,o,i,l=4.5;return t.area=function(t){return ql=0,ui.geo.stream(t,a(Xl)),ql},t.centroid=function(t){return Cl=Sl=Ol=Dl=Pl=El=Nl=Il=Rl=0,ui.geo.stream(t,a(Wl)),Rl?[Nl/Rl,Il/Rl]:El?[Dl/El,Pl/El]:Ol?[Cl/Ol,Sl/Ol]:[NaN,NaN]},t.bounds=function(t){return Ul=Yl=-(Vl=Zl=1/0),ui.geo.stream(t,a(Gl)),[[Vl,Zl],[Ul,Yl]]},t.projection=function(t){return arguments.length?(a=(r=t)?t.stream||ar(t):b,e()):r},t.context=function(t){return arguments.length?(o=null==(n=t)?new Qe:new rr(t),"function"!=typeof l&&o.pointRadius(l),e()):n},t.pointRadius=function(e){return arguments.length?(l="function"==typeof e?e:(o.pointRadius(+e),+e),t):l},t.projection(ui.geo.albersUsa()).context(null)},ui.geo.transform=function(t){return{stream:function(e){var r=new or(e);for(var n in t)r[n]=t[n];return r}}},or.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ui.geo.projection=lr,ui.geo.projectionMutator=sr,(ui.geo.equirectangular=function(){return lr(ur)}).raw=ur.invert=ur,ui.geo.rotation=function(t){function e(e){return e=t(e[0]*Vi,e[1]*Vi),e[0]*=Zi,e[1]*=Zi,e}return t=dr(t[0]%360*Vi,t[1]*Vi,t.length>2?t[2]*Vi:0),e.invert=function(e){return e=t.invert(e[0]*Vi,e[1]*Vi),e[0]*=Zi,e[1]*=Zi,e},e},fr.invert=ur,ui.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=dr(-t[0]*Vi,-t[1]*Vi,0).invert,a=[];return r(null,null,1,{point:function(t,r){a.push(t=e(t,r)),t[0]*=Zi,t[1]*=Zi}}),{type:"Polygon",coordinates:[a]}}var e,r,n=[0,0],a=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=mr((e=+n)*Vi,a*Vi),t):e},t.precision=function(n){return arguments.length?(r=mr(e*Vi,(a=+n)*Vi),t):a},t.angle(90)},ui.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Vi,a=t[1]*Vi,o=e[1]*Vi,i=Math.sin(n),l=Math.cos(n),s=Math.sin(a),c=Math.cos(a),u=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((r=f*i)*r+(r=c*u-s*f*l)*r),s*u+c*f*l)},ui.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return ui.range(Math.ceil(o/m)*m,a,m).map(d).concat(ui.range(Math.ceil(c/v)*v,s,v).map(h)).concat(ui.range(Math.ceil(n/p)*p,r,p).filter(function(t){return bi(t%m)>Ri}).map(u)).concat(ui.range(Math.ceil(l/g)*g,i,g).filter(function(t){return bi(t%v)>Ri}).map(f))}var r,n,a,o,i,l,s,c,u,f,d,h,p=10,g=p,m=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[d(o).concat(h(s).slice(1),d(a).reverse().slice(1),h(c).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],a=+e[1][0],c=+e[0][1],s=+e[1][1],o>a&&(e=o,o=a,a=e),c>s&&(e=c,c=s,s=e),t.precision(y)):[[o,c],[a,s]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],l=+e[0][1],i=+e[1][1],n>r&&(e=n,n=r,r=e),l>i&&(e=l,l=i,i=e),t.precision(y)):[[n,l],[r,i]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(m=+e[0],v=+e[1],t):[m,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,u=yr(l,i,90),f=xr(n,r,y),d=yr(c,s,90),h=xr(o,a,y),t):y},t.majorExtent([[-180,-90+Ri],[180,90-Ri]]).minorExtent([[-180,-80-Ri],[180,80+Ri]])},ui.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||a.apply(this,arguments)]}}var e,r,n=br,a=_r;return t.distance=function(){return ui.geo.distance(e||n.apply(this,arguments),r||a.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(a=e,r="function"==typeof e?null:e,t):a},t.precision=function(){return arguments.length?t:0},t},ui.geo.interpolate=function(t,e){return wr(t[0]*Vi,t[1]*Vi,e[0]*Vi,e[1]*Vi)},ui.geo.length=function(t){return Ql=0,ui.geo.stream(t,$l),Ql};var Ql,$l={sphere:k,point:k,lineStart:kr,lineEnd:k,polygonStart:k,polygonEnd:k},Jl=Mr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return lr(Jl)}).raw=Jl;var Kl=Mr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return lr(Kl)}).raw=Kl,(ui.geo.conicConformal=function(){return Ye(Ar)}).raw=Ar,(ui.geo.conicEquidistant=function(){return Ye(Tr)}).raw=Tr;var ts=Mr(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return lr(ts)}).raw=ts,Lr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return zr(Lr)}).raw=Lr;var es=Mr(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return lr(es)}).raw=es;var rs=Mr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return lr(rs)}).raw=rs,Cr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Hi]},(ui.geo.transverseMercator=function(){var t=zr(Cr),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=Cr,ui.geom={},ui.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,a=zt(r),o=zt(n),i=t.length,l=[],s=[];for(e=0;e=0;--e)h.push(t[l[c[e]][2]]);for(e=+f;e=n&&c.x<=o&&c.y>=a&&c.y<=i?[[n,i],[o,i],[o,a],[n,a]]:[];u.point=t[l]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Ri)*Ri,y:Math.round(i(t,e)/Ri)*Ri,i:e}})}var n=Sr,a=Or,o=n,i=a,l=fs;return t?e(t):(e.links=function(t){return cn(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return cn(r(t)).cells.forEach(function(r,n){for(var a,o,i=r.site,l=r.edges.sort(Yr),s=-1,c=l.length,u=l[c-1].edge,f=u.l===i?u.r:u.l;++s=c,d=n>=u,h=d<<1|f;t.leaf=!1,t=t.nodes[h]||(t.nodes[h]=pn()),f?a=c:l=c,d?i=u:s=u,o(t,e,r,n,a,i,l,s)}var u,f,d,h,p,g,m,v,y,x=zt(l),b=zt(s);if(null!=e)g=e,m=r,v=n,y=a;else if(v=y=-(g=m=1/0),f=[],d=[],p=t.length,i)for(h=0;hv&&(v=u.x),u.y>y&&(y=u.y),f.push(u.x),d.push(u.y);else for(h=0;hv&&(v=_),w>y&&(y=w),f.push(_),d.push(w)}var k=v-g,M=y-m;k>M?y=m+k:v=g+M;var A=pn();if(A.add=function(t){o(A,t,+x(t,++h),+b(t,h),g,m,v,y)},A.visit=function(t){gn(t,A,g,m,v,y)},A.find=function(t){return mn(A,t[0],t[1],g,m,v,y)},h=-1,null==e){for(;++h=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=gs.get(r)||ps,n=ms.get(n)||b,kn(n(r.apply(null,fi.call(arguments,1))))},ui.interpolateHcl=In,ui.interpolateHsl=Rn,ui.interpolateLab=jn,ui.interpolateRound=Fn,ui.transform=function(t){var e=hi.createElementNS(ui.ns.prefix.svg,"g");return(ui.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Bn(r?r.matrix:vs)})(t)},Bn.prototype.toString=function(){ -return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var vs={a:1,b:0,c:0,d:1,e:0,f:0};ui.interpolateTransform=Wn,ui.layout={},ui.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r0?a=t:(r.c=null,r.t=NaN,r=null,c.end({type:"end",alpha:a=0})):t>0&&(c.start({type:"start",alpha:a=t}),r=Pt(s.tick)),s):a},s.start=function(){function t(t,n){if(!r){for(r=new Array(a),s=0;s=0;)i.push(u=c[s]),u.parent=o,u.depth=o.depth+1;n&&(o.value=0),o.children=c}else n&&(o.value=+n.call(t,o,o.depth)||0),delete o.children;return sa(a,function(t){var r,a;e&&(r=t.children)&&r.sort(e),n&&(a=t.parent)&&(a.value+=t.value)}),l}var e=fa,r=ca,n=ua;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(la(e,function(t){t.children&&(t.value=0)}),sa(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0),(r=e.parent)&&(r.value+=e.value)})),e},t},ui.layout.partition=function(){function t(e,r,n,a){var o=e.children;if(e.x=r,e.y=e.depth*a,e.dx=n,e.dy=a,o&&(i=o.length)){var i,l,s,c=-1;for(n=e.value?n/e.value:0;++cl&&(l=n),i.push(n)}for(r=0;r0)for(o=-1;++o=u[0]&&l<=u[1]&&(i=s[ui.bisect(f,l,1,h)-1],i.y+=p,i.push(t[o]));return s}var e=!0,r=Number,n=ka,a=_a;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=zt(e),t):n},t.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return wa(t,e)}:zt(e),t):a},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},ui.layout.pack=function(){function t(t,o){var i=r.call(this,t,o),l=i[0],s=a[0],c=a[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(l.x=l.y=0,sa(l,function(t){t.r=+u(t.value)}),sa(l,za),n){var f=n*(e?1:Math.max(2*l.r/s,2*l.r/c))/2;sa(l,function(t){t.r+=f}),sa(l,za),sa(l,function(t){t.r-=f})}return Oa(l,s/2,c/2,e?1:1/Math.max(2*l.r/s,2*l.r/c)),i}var e,r=ui.layout.hierarchy().sort(Ma),n=0,a=[1,1];return t.size=function(e){return arguments.length?(a=e,t):a},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},ia(t,r)},ui.layout.tree=function(){function t(t,a){var u=i.call(this,t,a),f=u[0],d=e(f);if(sa(d,r),d.parent.m=-d.z,la(d,n),c)la(f,o);else{var h=f,p=f,g=f;la(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var m=l(h,p)/2-h.x,v=s[0]/(p.x+l(p,h)/2+m),y=s[1]/(g.depth||1);la(f,function(t){t.x=(t.x+m)*v,t.y=t.depth*y})}return u}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var a,o=e.children,i=0,l=o.length;i0&&(Ia(ja(i,t,r),t,n),c+=n,u+=n),f+=i.m,c+=a.m,d+=s.m,u+=o.m;i&&!Na(o)&&(o.t=i,o.m+=f-u),a&&!Ea(s)&&(s.t=a,s.m+=c-d,r=t)}return r}function o(t){t.x*=s[0],t.y=t.depth*s[1]}var i=ui.layout.hierarchy().sort(null).value(null),l=Pa,s=[1,1],c=null;return t.separation=function(e){return arguments.length?(l=e,t):l},t.size=function(e){return arguments.length?(c=null==(s=e)?o:null,t):c?null:s},t.nodeSize=function(e){return arguments.length?(c=null==(s=e)?null:o,t):c?s:null},ia(t,i)},ui.layout.cluster=function(){function t(t,o){var i,l=e.call(this,t,o),s=l[0],c=0;sa(s,function(t){var e=t.children;e&&e.length?(t.x=Ba(e),t.y=Fa(e)):(t.x=i?c+=r(t,i):0,t.y=0,i=t)});var u=qa(s),f=Ha(s),d=u.x-r(u,f)/2,h=f.x+r(f,u)/2;return sa(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-d)/(h-d)*n[0],t.y=(1-(s.y?t.y/s.y:1))*n[1]}),l}var e=ui.layout.hierarchy().sort(null).value(null),r=Pa,n=[1,1],a=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(a=null==(n=e),t):a?null:n},t.nodeSize=function(e){return arguments.length?(a=null!=(n=e),t):a?n:null},ia(t,e)},ui.layout.treemap=function(){function t(t,e){for(var r,n,a=-1,o=t.length;++a0;)u.push(i=d[s-1]),u.area+=i.area,"squarify"!==h||(l=n(u,g))<=p?(d.pop(),p=l):(u.area-=u.pop().area,a(u,g,c,!1),g=Math.min(c.dx,c.dy),u.length=u.area=0,p=1/0);u.length&&(a(u,g,c,!0),u.length=u.area=0),o.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var o,i=f(e),l=n.slice(),s=[];for(t(l,i.dx*i.dy/e.value),s.area=0;o=l.pop();)s.push(o),s.area+=o.area,null!=o.z&&(a(s,o.z?i.dx:i.dy,i,!l.length),s.length=s.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,a=0,o=1/0,i=-1,l=t.length;++ia&&(a=r));return n*=n,e*=e,n?Math.max(e*a*p/n,n/(e*o*p)):1/0}function a(t,e,r,n){var a,o=-1,i=t.length,l=r.x,c=r.y,u=e?s(t.area/e):0;if(e==r.dx){for((n||u>r.dy)&&(u=r.dy);++or.dx)&&(u=r.dx);++o1);return t+e*r*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=ui.random.normal.apply(ui,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ui.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;rf?0:1;if(c=qi)return e(c,h)+(t?e(t,1-h):"")+"Z";var p,g,m,v,y,x,b,_,w,k,M,A,T=0,L=0,z=[];if((v=(+s.apply(this,arguments)||0)/2)&&(m=o===Ds?Math.sqrt(t*t+c*c):+o.apply(this,arguments),h||(L*=-1),c&&(L=nt(m/c*Math.sin(v))),t&&(T=nt(m/t*Math.sin(v)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var C=Math.abs(f-u-2*L)<=Fi?0:1;if(L&&bo(y,x,b,_)===h^C){var S=(u+f)/2;y=c*Math.cos(S),x=c*Math.sin(S),b=_=null}}else y=x=0;if(t){w=t*Math.cos(f-T),k=t*Math.sin(f-T),M=t*Math.cos(u+T),A=t*Math.sin(u+T);var O=Math.abs(u-f+2*T)<=Fi?0:1;if(T&&bo(w,k,M,A)===1-h^O){var D=(u+f)/2;w=t*Math.cos(D),k=t*Math.sin(D),M=A=null}}else w=k=0;if(d>Ri&&(p=Math.min(Math.abs(c-t)/2,+a.apply(this,arguments)))>.001){g=tFi)+",1 "+e}function a(t,e,r,n){return"Q 0,0 "+n}var o=br,i=_r,l=Uo,s=vo,c=yo;return t.radius=function(e){return arguments.length?(l=zt(e),t):l},t.source=function(e){return arguments.length?(o=zt(e),t):o},t.target=function(e){return arguments.length?(i=zt(e),t):i},t.startAngle=function(e){return arguments.length?(s=zt(e),t):s},t.endAngle=function(e){return arguments.length?(c=zt(e),t):c},t},ui.svg.diagonal=function(){function t(t,a){var o=e.call(this,t,a),i=r.call(this,t,a),l=(o.y+i.y)/2,s=[o,{x:o.x,y:l},{x:i.x,y:l},i];return s=s.map(n),"M"+s[0]+"C"+s[1]+" "+s[2]+" "+s[3]}var e=br,r=_r,n=Yo;return t.source=function(r){return arguments.length?(e=zt(r),t):e},t.target=function(e){return arguments.length?(r=zt(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},ui.svg.diagonal.radial=function(){var t=ui.svg.diagonal(),e=Yo,r=t.projection;return t.projection=function(t){return arguments.length?r(Xo(e=t)):e},t},ui.svg.symbol=function(){function t(t,n){return(Rs.get(e.call(this,t,n))||Qo)(r.call(this,t,n))}var e=Wo,r=Go;return t.type=function(r){return arguments.length?(e=zt(r),t):e},t.size=function(e){return arguments.length?(r=zt(e),t):r},t};var Rs=ui.map({circle:Qo,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Fs)),r=e*Fs;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/js),r=e*js/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/js),r=e*js/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});ui.svg.symbolTypes=Rs.keys();var js=Math.sqrt(3),Fs=Math.tan(30*Vi);Ci.transition=function(t){for(var e,r,n=Bs||++Zs,a=ei(t),o=[],i=qs||{time:Date.now(),ease:zn,delay:0,duration:250},l=-1,s=this.length;++lrect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",d[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==ui.event.keyCode&&(C||(x=null,O[0]-=f[1],O[1]-=d[1],C=2),T())}function g(){32==ui.event.keyCode&&2==C&&(O[0]+=f[1],O[1]+=d[1],C=0,T())}function m(){var t=ui.mouse(_),n=!1;b&&(t[0]+=b[0],t[1]+=b[1]),C||(ui.event.altKey?(x||(x=[(f[0]+f[1])/2,(d[0]+d[1])/2]),O[0]=f[+(t[0]0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!a(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,o,l;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,n=-1,r===e||a(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(r)){for(l=o;l-- >0;)if(r[l]===e||r[l].listener&&r[l].listener===e){n=l;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(r=this._events[t],a(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],17:[function(t,e,r){"use strict";function n(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}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],18:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],a=e[2],o=e[3],i=r+r,l=n+n,s=a+a,c=r*i,u=n*i,f=n*l,d=a*i,h=a*l,p=a*s,g=o*i,m=o*l,v=o*s;return t[0]=1-f-p,t[1]=u+v,t[2]=d-m,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+m,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],19:[function(t,e,r){function n(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function i(t){if(d===clearTimeout)return clearTimeout(t);if((d===a||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{return d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}function l(){m&&p&&(m=!1,p.length?g=p.concat(g):v=-1,g.length&&s())}function s(){if(!m){var t=o(l);m=!0;for(var e=g.length;e;){for(p=g,g=[];++v1)for(var r=1;r.5?s/(2-o-i):s/(o+i),o){case t:n=(e-r)/s+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var a,o,i;if(t=z(t,360),e=z(e,100),r=z(r,100),0===e)a=o=i=r;else{var l=r<.5?r*(1+e):r+e-r*e,s=2*r-l;a=n(s,l,t+1/3),o=n(s,l,t),i=n(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function s(t,e,r){t=z(t,255),e=z(e,255),r=z(r,255);var n,a,o=U(t,e,r),i=Z(t,e,r),l=o,s=o-i;if(a=0===o?0:s/o,o==i)n=0;else{switch(o){case t:n=(e-r)/s+(e>1)+720)%360;--e;)a.h=(a.h+o)%360,i.push(n(a));return i}function A(t,e){e=e||6;for(var r=n(t).toHsv(),a=r.h,o=r.s,i=r.v,l=[],s=1/e;e--;)l.push(n({h:a,s:o,v:i})),i=(i+s)%1;return l}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function z(t,r){O(t)&&(t="100%");var n=D(t);return t=Z(r,U(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function C(t){return Z(1,U(0,t))}function S(t){return parseInt(t,16)}function O(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function D(t){return"string"==typeof t&&t.indexOf("%")!=-1}function P(t){return 1==t.length?"0"+t:""+t}function E(t){return t<=1&&(t=100*t+"%"),t}function N(t){return e.round(255*parseFloat(t)).toString(16)}function I(t){return S(t)/255}function R(t){return!!W.CSS_UNIT.exec(t)}function j(t){t=t.replace(B,"").replace(q,"").toLowerCase();var e=!1;if(X[t])t=X[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=W.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=W.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=W.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=W.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=W.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=W.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=W.hex8.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),a:I(r[4]),format:e?"name":"hex8"}:(r=W.hex6.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),format:e?"name":"hex"}:(r=W.hex4.exec(t))?{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),a:I(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=W.hex3.exec(t))&&{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),format:e?"name":"hex"}}function F(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var B=/^\s+/,q=/\s+$/,H=0,V=e.round,Z=e.min,U=e.max,Y=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,a,o,i,l=this.toRgb();return t=l.r/255,r=l.g/255,n=l.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),o=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),i=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*a+.7152*o+.0722*i},setAlpha:function(t){return this._a=L(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*z(this._r,255))+"%",g:V(100*z(this._g,255))+"%",b:V(100*z(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*z(this._r,255))+"%, "+V(100*z(this._g,255))+"%, "+V(100*z(this._b,255))+"%)":"rgba("+V(100*z(this._r,255))+"%, "+V(100*z(this._g,255))+"%, "+V(100*z(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(G[u(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),r=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=n(t);r="#"+d(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,a=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?r[a]=t[a]:r[a]=E(t[a]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:Y(),g:Y(),b:Y()})},n.mix=function(t,e,r){r=0===r?0:r||50;var a=n(t).toRgb(),o=n(e).toRgb(),i=r/100,l={r:(o.r-a.r)*i+a.r,g:(o.g-a.g)*i+a.g,b:(o.b-a.b)*i+a.b,a:(o.a-a.a)*i+a.a};return n(l)},n.readability=function(t,r){var a=n(t),o=n(r);return(e.max(a.getLuminance(),o.getLuminance())+.05)/(e.min(a.getLuminance(),o.getLuminance())+.05)},n.isReadable=function(t,e,r){var a,o,i=n.readability(t,e);switch(o=!1,a=F(r),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},n.mostReadable=function(t,e,r){var a,o,i,l,s=null,c=0;r=r||{},o=r.includeFallbackColors,i=r.level,l=r.size;for(var u=0;uc&&(c=a,s=n(e[u]));return n.isReadable(t,s,{level:i,size:l})||!o?s:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var X=n.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"},G=n.hexNames=T(X),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],21:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../color"),o=t("../../plots/cartesian/axes"),i=t("./attributes"); -e.exports=function(t,e){function r(e,r){return n.coerce(t,l,i,e,r)}var l={};r("opacity"),r("align"),r("bgcolor");var s=r("bordercolor"),c=a.opacity(s);r("borderpad");var u=r("borderwidth"),f=r("showarrow");f&&(r("arrowcolor",c?l.bordercolor:a.defaultLine),r("arrowhead"),r("arrowsize"),r("arrowwidth",2*(c&&u||1)),r("ax"),r("ay"),r("axref"),r("ayref"),n.noneOrAll(t,l,["ax","ay"])),r("text",f?" ":"new text"),r("textangle"),n.coerceFont(r,"font",e.font);for(var d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:e},m=o.coerceRef(t,l,g,p),v=o.coerceARef(t,l,g,p),y=.5;if("paper"!==m){var x=o.getFromId(g,m);if(y=x.range[0]+y*(x.range[1]-x.range[0]),["date","category"].indexOf(x.type)!==-1&&"string"==typeof t[p]){var b;if("date"===x.type){if(b=n.dateTime2ms(t[p]),b!==!1&&(t[p]=b),v===m){var _=n.dateTime2ms(t["a"+p]);_!==!1&&(t["a"+p]=_)}}else(x._categories||[]).length&&(b=x._categories.indexOf(t[p]),b!==-1&&(t[p]=b))}}r(p,y),f||r(p+"anchor")}return n.noneOrAll(t,l,["x","y"]),l}},{"../../lib":121,"../../plots/cartesian/axes":147,"../color":30,"./attributes":23}],22:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],23:[function(t,e,r){"use strict";var n=t("./arrow_paths"),a=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),i=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:i({},a,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":118,"../../plots/cartesian/constants":153,"../../plots/font_attributes":168,"./arrow_paths":22}],24:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=o.getFromId(t,e.xref),n=o.getFromId(t,e.yref);if(r||n){var a=(e._xsize||0)/2,i=e._xshift||0,l=(e._ysize||0)/2,s=e._yshift||0,c=a-i,u=a+i,f=l-s,d=l+s;if(e.showarrow){var h=3*e.arrowsize*e.arrowwidth;c=Math.max(c,h),u=Math.max(u,h),f=Math.max(f,h),d=Math.max(d,h)}r&&r.autorange&&o.expand(r,[r.l2c(e.x)],{ppadplus:u,ppadminus:c}),n&&n.autorange&&o.expand(n,[n.l2c(e.y)],{ppadplus:d,ppadminus:f})}})}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=e.annotations;if(r.length&&t._fullData.length){var l={};r.forEach(function(t){l[t.xref]=!0,l[t.yref]=!0});var s=o.list(t).filter(function(t){return t.autorange&&l[t._id]});if(s.length)return a.syncOrAsync([i,n],t)}}},{"../../lib":121,"../../plots/cartesian/axes":147,"./draw":26}],25:[function(t,e,r){"use strict";var n=t("./annotation_defaults");e.exports=function(t,e){for(var r=t.annotations||[],a=e.annotations=[],o=0;o2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=$.select(".annotation-math-group"),a=!n.empty(),l=h.bBox((a?n:nt).node()),c=l.width,p=l.height,v=Math.round(c+2*tt),y=Math.round(p+2*tt);Z._w=c,Z._h=p;var b=!1;if(["x","y"].forEach(function(e){var n,a=Z[e+"ref"]||e,o=f.getFromId(t,a),i=(G+("x"===e?0:90))*Math.PI/180,l=v*Math.abs(Math.cos(i))+y*Math.abs(Math.sin(i)),s=Z[e+"anchor"];if(o){if(!o.autorange&&(Z[e]-o.range[0])*(Z[e]-o.range[1])>0&&(Z["a"+e+"ref"]===a?(Z["a"+e]-o.range[0])*(Z["a"+e]-o.range[1])>0&&(b=!0):b=!0,b))return;X[e]=o._offset+o.l2p(Z[e]),n=.5}else n=Z[e],"y"===e&&(n=1-n),X[e]="x"===e?D.l+D.w*n:D.t+D.h*n;var c=0;Z["a"+e+"ref"]===a?X["aa"+e]=o._offset+o.l2p(Z["a"+e]):(c=Z.showarrow?Z["a"+e]:l*r(n,s),X[e]+=c),Z["_"+e+"type"]=o&&o.type,Z["_"+e+"size"]=l,Z["_"+e+"shift"]=c}),b)return void $.remove();var _,w;Z.showarrow&&(_=Z.axref===Z.xref?X.x:u.constrain(X.x-Z.ax,1,M.width-1),w=Z.ayref===Z.yref?X.y:u.constrain(X.y-Z.ay,1,M.height-1)),X.x=u.constrain(X.x,1,M.width-1),X.y=u.constrain(X.y,1,M.height-1);var k=tt-l.top,A=tt-l.left;a?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:A,y:k}),nt.selectAll("tspan.line").attr({y:k,x:A})),et.call(h.setRect,J/2,J/2,v-J,y-J);var T=0,L=0;T=Z.axref===Z.xref?Math.round(X.aax-v/2):Math.round(X.x-v/2),L=Z.ayref===Z.yref?Math.round(X.aay-y/2):Math.round(X.y-y/2),$.call(u.setTranslate,T,L);var z="annotations["+e+"]",C=function(r,n){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=Z.axref===Z.xref?X.aax+r:X.x+r,l=Z.ayref===Z.yref?X.aay+n:X.y+n;var c=u.rotationXYMatrix(G,a,l),f=u.apply2DTransform(c),h=u.apply2DTransform2(c),p=et.attr("width")/2,g=et.attr("height")/2,v=[[a-p,l-g,a-p,l+g],[a-p,l+g,a+p,l+g],[a+p,l+g,a+p,l-g],[a+p,l-g,a-p,l-g]].map(h);if(!v.reduce(function(t,e){return t^!!o(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=o(a,l,_,w,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var y=Z.arrowwidth,b=Z.arrowcolor,k=W.append("g").style({opacity:d.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=k.append("path").attr("d","M"+a+","+l+"L"+_+","+w).style("stroke-width",y+"px").call(d.stroke,d.rgb(b));x(M,Z.arrowhead,"end",Z.arrowsize);var A=k.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-_)+","+(l-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,C;m.init({element:A.node(),prepFn:function(){var t=u.getTranslate($);L=t.x,C=t.y,T={},U&&U.autorange&&(T[U._name+".autorange"]=!0),Y&&Y.autorange&&(T[Y._name+".autorange"]=!0)},moveFn:function(t,e){k.attr("transform","translate("+t+","+e+")");var r=f(L,C),n=r[0]+t,a=r[1]+e;$.call(u.setTranslate,n,a),T[z+".x"]=U?Z.x+t/U._m:(_+t-D.l)/D.w,T[z+".y"]=Y?Z.y+e/Y._m:1-(w+e-D.t)/D.h,Z.axref===Z.xref&&(T[z+".ax"]=U?Z.ax+t/U._m:(_+t-D.l)/D.w),Z.ayref===Z.yref&&(T[z+".ay"]=Y?Z.ay+e/Y._m:1-(w+e-D.t)/D.h),Q.attr({transform:"rotate("+G+","+n+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};Z.showarrow&&C(0,0);var S=u.rotationXYMatrix(G,X.x,X.y),O=u.apply2DTransform(S);if(t._context.editable){var P,E,N;m.init({element:$.node(),prepFn:function(){var t=u.getTranslate($);P=t.x,E=t.y,N={}},moveFn:function(t,e){$.call(u.setTranslate,P+t,E+e);var r="pointer";if(Z.showarrow)Z.axref===Z.xref?N[z+".ax"]=U.p2l(U.l2p(Z.ax)+t):N[z+".ax"]=Z.ax+t,Z.ayref===Z.yref?N[z+".ay"]=Y.p2l(Y.l2p(Z.ay)+e):N[z+".ay"]=Z.ay+e,C(t,e);else{if(U)N[z+".x"]=Z.x+t/U._m;else{var n=Z._xsize/D.w,a=Z.x+Z._xshift/D.w-n/2;N[z+".x"]=m.align(a+t/D.w,n,0,1,Z.xanchor)}if(Y)N[z+".y"]=Z.y+e/Y._m;else{var o=Z._ysize/D.h,i=Z.y-Z._yshift/D.h-o/2;N[z+".y"]=m.align(i-e/D.h,o,0,1,Z.yanchor)}U&&Y||(r=m.getCursor(U?.5:N[z+".x"],Y?.5:N[z+".y"],Z.xanchor,Z.yanchor))}var l=O(P,E),s=l[0]+t,c=l[1]+e;$.call(u.setTranslate,P+t,E+e),Q.attr({transform:"rotate("+G+","+s+","+c+")"}),g($,r)},doneFn:function(e){if(g($),e){s.relayout(t,N);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,k=t.layout,M=t._fullLayout;if(!l(e)||e===-1){if(!e&&Array.isArray(c))return k.annotations=c,y(k,M),void n(t);if("remove"===c)return delete k.annotations,M.annotations=[],void n(t);if(r&&"add"!==c){for(w=0;we;w--)M._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),a(t,w)}}M._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=k.annotations[e],L=M.annotations[e];if(T){var z={xref:T.xref,yref:T.yref},C={};"string"==typeof r&&r?C[r]=c:u.isPlainObject(r)&&(C=r);var S=Object.keys(C);for(w=0;w4/3&&(R=H)}}else I&&(F&&(R<1/3?R+=q:R>2/3&&(R-=q)),R=(R-I.domain[0])/(I.domain[1]-I.domain[0]),R=I.range[0]+R*(I.range[1]-I.range[0]))}I&&I===N&&j&&("log"===j&&"log"!==I.type?R=Math.pow(10,R):"log"!==j&&"log"===I.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),T[E]=R}}var Z=v(T,M);M.annotations[e]=Z;var U=f.getFromId(t,Z.xref),Y=f.getFromId(t,Z.yref),X={x:0,y:0},G=+Z.textangle||0,W=M._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",Z.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:Z})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),J=Z.borderwidth,K=Z.borderpad,tt=J+K,et=$.append("rect").attr("class","bg").style("stroke-width",J+"px").call(d.stroke,Z.bordercolor).call(d.fill,Z.bgcolor),rt=Z.font,nt=$.append("text").classed("annotation",!0).attr("data-unformatted",Z.text).text(Z.text);t._context.editable?nt.call(p.makeEditable,$).call(b).on("edit",function(r){Z.text=r,this.attr({"data-unformatted":Z.text}),this.call(b);var n={};n["annotations["+e+"].text"]=Z.text,U&&U.autorange&&(n[U._name+".autorange"]=!0),Y&&Y.autorange&&(n[Y._name+".autorange"]=!0),s.relayout(t,n)}):nt.call(b),Q.attr({transform:"rotate("+G+","+X.x+","+X.y+")"}).call(h.setPosition,X.x,X.y)}}function o(t,e,r,n,a,o,i,l){var s=r-t,c=a-t,u=i-a,f=n-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,m=(c*f-s*d)/p;return m<0||m>1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:n,drawOne:a}},{"../../lib":121,"../../lib/setcursor":131,"../../lib/svg_text_utils":133,"../../plotly":143,"../../plots/cartesian/axes":147,"../../plots/plots":172,"../color":30,"../dragelement":52,"../drawing":54,"./annotation_defaults":21,"./defaults":25,"./draw_arrow_head":27,d3:14,"fast-isnumeric":17}],27:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),o=t("../color"),i=t("../drawing"),l=t("./arrow_paths");e.exports=function(t,e,r,s){a(s)||(s=1);var c=t.node(),u=l[e||0];if(u){"string"==typeof r&&r||(r="end");var f,d,h,p,g=(i.getPx(t,"stroke-width")||1)*s,m=t.style("stroke")||o.defaultLine,v=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,x=r.indexOf("end")>=0,b=u.backoff*g;if("line"===c.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},d={x:+t.attr("x2"),y:+t.attr("y2")},h=Math.atan2(f.y-d.y,f.x-d.x),p=h+Math.PI,b){var _=b*Math.cos(h),w=b*Math.sin(h);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(d.x+=_,d.y+=w,t.attr({x2:d.x,y2:d.y}))}}else if("path"===c.nodeName){var k=c.getTotalLength(),M="";if(y){var A=c.getPointAtLength(0),T=c.getPointAtLength(.1);h=Math.atan2(A.y-T.y,A.x-T.x),f=c.getPointAtLength(Math.min(b,k)),b&&(M="0px,"+b+"px,")}if(x){var L=c.getPointAtLength(k),z=c.getPointAtLength(k-.1);if(p=Math.atan2(L.y-z.y,L.x-z.x),d=c.getPointAtLength(Math.max(0,k-b)),b){var C=M?2*b:b;M+=k-C+"px,"+k+"px"}}else M&&(M+=k+"px");M&&t.style("stroke-dasharray",M)}var S=function(r,a){e>5&&(a=0),n.select(c.parentElement).append("path").attr({class:t.attr("class"),d:u.path,transform:"translate("+r.x+","+r.y+")rotate("+180*a/Math.PI+")scale("+g+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&S(f,h),x&&S(d,p)}}},{"../color":30,"../drawing":54,"./arrow_paths":22,d3:14,"fast-isnumeric":17}],28:[function(t,e,r){"use strict";var n=t("../../plotly");r.moduleType="component",r.name="annotations",r.ARROWPATHS=t("./arrow_paths"),r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.calcAutorange=t("./calc_autorange"),r.arrowhead=t("./draw_arrow_head");var a=t("./draw");r.draw=a.draw,r.drawOne=a.drawOne,r.add=function(t){var e=t._fullLayout.annotations.length;n.relayout(t,"annotations["+e+"]","add")}},{"../../plotly":143,"./arrow_paths":22,"./attributes":23,"./calc_autorange":24,"./defaults":25,"./draw":26,"./draw_arrow_head":27}],29:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],30:[function(t,e,r){"use strict";function n(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===n.length;if(!a&&3!==n.length)return t;for(var i=0;i=0))return t;if(3===i)n[i]>1&&(n[i]=1);else if(n[i]>=1)return t}var l=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return a?"rgba("+l+", "+n[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var r=a(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},i.combine=function(t,e){var r=a(t).toRgb();if(1===r.a)return a(t).toRgbString();var n=a(e||i.background).toRgb(),o=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},l={r:o.r*(1-r.a)+r.r*r.a,g:o.g*(1-r.a)+r.g*r.a,b:o.b*(1-r.a)+r.b*r.a};return a(l).toRgbString()},i.contrast=function(t,e,r){var n=a(t),o=n.isLight()?n.darken(r):n.lighten(e);return o.toString()},i.stroke=function(t,e){var r=a(e);t.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(t,e){var r=a(e);t.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,r,a,o,l=Object.keys(t);for(e=0;el&&(o[1]-=(lt-l)/2)):r.node()&&!r.classed("js-placeholder")&&(lt=h.bBox(e.node()).height),lt){if(lt+=5,"top"===_.titleside)K.domain[1]-=lt/T.h,o[1]*=-1;else{K.domain[0]+=lt/T.h;var c=Math.max(1,r.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),K.setScale()}}ot.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-K.domain[1]))+")");var f=ot.select(".cbfills").selectAll("rect.cbfill").data(S);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?z[0]:(S[e]+S[e-1])/2,e===S.length-1?z[1]:(S[e]+S[e+1])/2].map(K.c2p).map(Math.round);e!==S.length-1&&(r[1]+=r[1]>r[0]?1:-1);var o=D(t).replace("e-",""),i=a(o).toHexString();n.select(this).attr({x:X,width:Math.max(B,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:i})});var d=ot.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?C:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){n.select(this).attr("d","M"+X+","+(Math.round(K.c2p(t))+_.line.width/2%1)+"h"+B).call(h.lineGroupStyle,_.line.width,O(t),_.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=X+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=K.titlefont.size,r=K._offset+K._length/2,a=T.l+(K.position||0)*T.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));k("h"+K._id+"title",{avoid:{selection:n.select(t).selectAll("g."+K._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:A.width},attributes:{x:a,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function k(e,r){var n,a=b();n=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:K,propName:n,traceIndex:a.index,dfltName:"colorscale",containerGroup:ot.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;ot.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,r||{}))}function M(){var r=B+_.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(R=it.select("text"),R.node()&&!R.classed("js-placeholder")){var n,a=it.select(".h"+K._id+"title-math-group").node();n=a&&["top","bottom"].indexOf(_.titleside)!==-1?h.bBox(a).width:h.bBox(it.node()).right-X-T.l,r=Math.max(r,n)}var o=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,l=Q-$;ot.select(".cbbg").attr({x:X-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-U,width:Math.max(o,2),height:Math.max(l+2*U,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),ot.selectAll(".cboutline").attr({x:X,y:$+_.ypad+("top"===_.titleside?lt:0),width:Math.max(B,2),height:Math.max(l-2*_.ypad-lt,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var s=({center:.5,right:1}[_.xanchor]||0)*o;ot.attr("transform","translate("+(T.l-s)+","+T.t+")"),i.autoMargin(t,e,{x:_.x,y:_.y,l:o*({right:1,center:.5}[_.xanchor]||0),r:o*({left:1,center:.5}[_.xanchor]||0),t:l*({bottom:1,middle:.5}[_.yanchor]||0),b:l*({top:1,middle:.5}[_.yanchor]||0)})}var A=t._fullLayout,T=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var L,z=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),C=[],S=[],O="function"==typeof _.line.color?_.line.color:function(){return _.line.color},D="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},P=_.levels.end+_.levels.size/100,E=_.levels.size,N=1.001*z[0]-.001*z[1],I=1.001*z[1]-.001*z[0];for(L=_.levels.start;(L-P)*E<0;L+=E)L>N&&Lz[0]&&L1){var at=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=at*u.roundUp(nt/at,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+Y,W+V-Y],K.setScale();var ot=A._infolayer.selectAll("g."+e).data([0]);ot.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),ot.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var it=ot.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");K._axislayer=ot.select(".cbaxis");var lt=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var st,ct=T.l+(_.x+Z)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-Y))*T.h+T.t+3+.75*ut:(1-(W+Y))*T.h+T.t-3-.25*ut,k(K._id+"title",{attributes:{x:ct,y:st,"text-anchor":"start"}})}var ft=u.syncOrAsync([i.previousPromises,w,i.previousPromises,M],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var dt,ht,pt;c.init({element:ot.node(),prepFn:function(){dt=ot.attr("transform"),d(ot)},moveFn:function(t,e){ot.attr("transform",dt+" translate("+t+","+e+")"),ht=c.align(G+t/T.w,q,0,1,_.xanchor),pt=c.align(W-e/T.h,V,0,1,_.yanchor);var r=c.getCursor(ht,pt,_.xanchor,_.yanchor);d(ot,r)},doneFn:function(e){d(ot),e&&void 0!==ht&&void 0!==pt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":pt},b().index)}})}return ft}function b(){var r,n,a=e.substr(2);for(r=0;r=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":121,"./flip_scale":42,"./scales":49}],38:[function(t,e,r){"use strict";var n=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},n.colorscale,{}),cauto:a({},n.zauto,{}),cmax:a({},n.zmax,{}),cmin:a({},n.zmin,{}),autocolorscale:a({},n.autocolorscale,{}),reversescale:a({},n.reversescale,{})}}},{"../../lib/extend":118,"./attributes":36,"./scales.js":49}],39:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":49}],40:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,r,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,m=p[d+"min"],v=p[d+"max"],y=p.colorscale,x=n(m)&&n(v)&&m=0;a--,o++)e=t[a],n[o]=[1-e[0],e[1]];return n}},{}],43:[function(t,e,r){"use strict";var n=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=a),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),o(t)?t:e):e}},{"./default_scale":39,"./is_valid_scale_array":47,"./scales":49}],44:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale"); -e.exports=function(t,e){var r=e?a.nestedProperty(t,e).get()||{}:t,i=r.color,l=!1;if(Array.isArray(i))for(var s=0;s4/3-l?i:l}},{}],51:[function(t,e,r){"use strict";var n=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,o){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:n.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":121}],52:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),h.dispatchEvent(r)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=n},{"../../lib":121,"../../plotly":143,"../../plots/cartesian/constants":153,"./align":50,"./cursor":51,"./unhover":53}],53:[function(t,e,r){"use strict";var n=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,r)},a.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":117}],54:[function(t,e,r){"use strict";function n(t,e,r,n,a,o,i){if(l.traceIs(r,"symbols")){var c=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(r)?c(t.ms):(o.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||o.symbol)||0,a=n%100;return t.om=n%200>=100,g.symbolFuncs[a](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=n(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,r,n){var a=t[0]-e[0],i=t[1]-e[1],l=r[0]-e[0],s=r[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*n,d=(u*u*i-c*c*s)*n,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,a){t.call(g.setPosition,e,r).call(g.setSize,n,a)},g.translatePoint=function(t,e,r,n){var a=t.xp||r.c2p(t.x),o=t.yp||n.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=r||o.width||0,l=a||o.dash||"";s.stroke(e,n||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=n||a.dash||"";o.select(this).call(s.stroke,r||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=o.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),r.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var a=r.marker,o=a.line,i=(r._input||{}).marker||{},l=g.tryColorscale(a,i,""),s=g.tryColorscale(a,i,"line.");n(t,e,r,l,s,a,o)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=(e._input||{}).marker||{},a=g.tryColorscale(r,n,""),i=g.tryColorscale(r,n,"line.");t.each(function(t){g.singlePointStyle(t,o.select(this),e,a,i)})}},g.tryColorscale=function(t,e,r){var n=u.nestedProperty(t,r+"color").get(),a=u.nestedProperty(t,r+"colorscale").get(),o=u.nestedProperty(t,r+"cauto").get(),l=u.nestedProperty(t,r+"cmin"),s=u.nestedProperty(t,r+"cmax"),f=l.get(),d=s.get();return a&&Array.isArray(n)?(!o&&i(f)&&i(d)||(f=1/0,d=-(1/0),n.forEach(function(t){i(t)&&(f>t&&(f=+t),dd&&(f=0,d=1),l.set(f),s.set(d),u.nestedProperty(e,r+"cmin").set(f),u.nestedProperty(e,r+"cmax").set(d)),c.makeColorScaleFunc(c.extractScale(a,f,d))):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=o.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,r.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(n).call(f.convertToTspans);var d=o.select(this.parentNode),h=r.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,m=x[s]*u,v=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+m+","+v+")"),p>1&&h.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],o=[];for(r=1;r=A&&(o.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=o.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":112,"../../lib":121,"../../lib/svg_text_utils":133,"../../registry":187,"../../traces/scatter/make_bubble_size_func":284,"../../traces/scatter/subtypes":289,"../color":30,"../colorscale":45,"./symbol_defs":55,d3:14,"fast-isnumeric":17}],55:[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,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+r+a+o+a+o+i+o+i+r+i+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),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(2*t/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(2*t/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(2*t/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(.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),a=n.round(-t,2),o=n.round(t*-.309,2),i=n.round(.809*t,2);return"M"+e+","+o+"L"+r+","+i+"H-"+r+"L-"+e+","+o+"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(.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),a=n.round(.951*e,2),o=n.round(.363*e,2),i=n.round(.588*e,2),l=n.round(-e,2),s=n.round(e*-.309,2),c=n.round(.118*e,2),u=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+r+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),a=n.round(.76*t,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(.8*t,2),a=n.round(1.6*t,2),o=n.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+r+i+e+","+r+i+"0,-"+a+i+"-"+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),a=n.round(1.6*t,2),o=n.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+r+i+"-"+e+",-"+r+i+"0,"+a+i+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,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(1.4*t,2),r=n.round(1.9*t,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:14}],56:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],57:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e["error_"+n]||{},s=o.visible&&["linear","log"].indexOf(r.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var m=g.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=n(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");l=!m.size(),l?m=e.append("path").classed("yerror",!0):u&&(m=m.transition().duration(r.duration).ease(r.easing)),m.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var v=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-v)+"v"+2*v+"m0,-"+v+"H"+i.xs,i.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":289,d3:14,"fast-isnumeric":17}],62:[function(t,e,r){"use strict";var n=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},o=e.error_x||{},i=n.select(this);i.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),o.copy_ystyle&&(o=r),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":30,d3:14}],63:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":153}],64:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,i,r,n)}e=e||{},n("source"),n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var l=0;l<2;l++){var s={_fullLayout:r},c=["x","y"][l];a.coerceRef(t,e,s,c,"paper")}return e}var a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var r=t.images,a=e.images=[],o=0;o=2/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},r.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},r.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],68:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":118,"../../plots/font_attributes":168,"../color/attributes":29}],69:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],70:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,r){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":121,"../../plots/layout_attributes":170,"../../registry":187,"./attributes":68,"./helpers":73}],71:[function(t,e,r){"use strict";function n(t,e){function r(r){v.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(o,e)})}var n=t.data()[0][0],a=e._fullLayout,i=n.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?n.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var a,o=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=n.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(r)}function a(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=r.indexOf(f);d===-1?r.push(f):r.splice(d,1),u.relayout(e,"hiddenlabels",r)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;r=l*d,n=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}r=Math.max(r,16)+3,a.height=r,a.width=n}function i(t,e,r){var n=t._fullLayout,a=n.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.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,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),r.each(function(e){var r=e[0],n=c.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:a.width)+40,r.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;un.width-(n.margin.r+n.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+r,a.height=Math.max(a.height,e.height),x+=i+r,v=Math.max(e.height,v)}),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],n=c.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:a.width,r.height)})}}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var a="top";w.isBottomAnchor(r)?a="bottom":w.isMiddleAnchor(r)&&(a="middle"),d.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[a]||0),t:r.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),d.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),z.call(g.setRect,F,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){var v=r.legend,_=r.showlegend&&x(t.calcdata,v),k=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=r._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var z=M.selectAll("rect.scrollbar").data([0]);z.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var C=L.selectAll("g.groups").data(_);C.enter().append("g").attr("class","groups"),C.exit().remove();var S=C.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,C,S),l(t));var D=0,P=r.width,E=0,N=r.height;i(t,C,S),v.height>N?s(t):l(t);var I=r._size,R=I.l+I.w*v.x,j=I.t+I.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?j-=v.height:w.isMiddleAnchor(v)&&(j-=v.height/2);var F=v.width,B=I.w;F>B?(R=I.l,F=B):(R+F>P&&(R=P-F),RH?(j=I.t,q=H):(j+q>N&&(j=N-q),jr[1])return r[1]}return a}function r(t){return t[0]}var n,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",r,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?n:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(n[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||n.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||r.color),e&&a.call(d.stroke,t.mlc||n.color)})}function i(t){var e=t[0].trace,r=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=s.select(this);n.style("stroke-width",r+"px").call(d.fill,t.fc||e.fillcolor),r&&n.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,r=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(n).each(a)}},{"../../lib":121,"../../registry":187,"../../traces/pie/style_one":267,"../../traces/scatter/subtypes":289,"../color":30,"../drawing":54,d3:14}],76:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),a=r.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===n){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),i(m,r);u&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),d&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!c&&!p||v||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):c?n(["hoverClosestCartesian","hoverCompareCartesian"]):h&&n(["hoverClosestPie"]),i(m,r)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=a(e,r,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",r.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":121,"../color":30,"./attributes":80,"./button_attributes":81,"./constants":82}],84:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../plots/cartesian/axes"),o=t("./constants"),i=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=e.shapes;if(r.length&&t._fullData.length)for(var i=0;ie;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,r,n){function a(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,C)},a=C.line.width?C.line.color:"rgba(0,0,0,0)",o=r.append("path").attr(n).style("opacity",C.opacity).call(_.stroke,a).call(_.fill,C.fillcolor).call(w.dashLine,C.line.dash,C.line.width);S&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+S),t._context.editable&&f(t,o,C,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={xref:l.xref,yref:l.yref},c={};"string"==typeof r&&r?c[r]=n:x.isPlainObject(r)&&(c=r);var u=Object.keys(c);for(o=0;oY&&n>X&&!t.shiftKey?k.getCursor(a/r,1-o/n):"move";M(e,i),U=i.split("-")[0]}function o(e){F=b.getFromId(t,r.xref),B=b.getFromId(t,r.yref),q=T.getDataToPixel(t,F),H=T.getDataToPixel(t,B,!0),V=T.getPixelToData(t,F),Z=T.getPixelToData(t,B,!0);var o="shapes["+n+"]";"path"===r.type?(R=r.path,j=o+".path"):(u=q(r.x0),f=H(r.y0),d=q(r.x1),h=H(r.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uX&&(c[C]=r[P]=Z(l),c[S]=r[E]=Z(s)),f-u>Y&&(c[O]=r[N]=V(u),c[D]=r[I]=V(f))}e.attr("d",p(t,r))}var c,u,f,d,h,g,v,x,_,w,A,L,z,C,S,O,D,P,E,N,I,R,j,F,B,q,H,V,Z,U,Y=10,X=10,G={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=G.element.getBoundingClientRect();k.init(G)}function d(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),n}function h(t,e,r){var n=b.getFromId(t,r.id,"x")._id,a=b.getFromId(t,r.id,"y")._id,o="below"===e.layer,i=n===e.xref||a===e.yref,l=!!r.shapelayer;return o&&i&&l}function p(t,e){var r,n,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=T.dataToLinear(l),n=function(t){return l._offset+l.l2p(r(t,!0))}):n=function(t){return c.l+c.w*t},s?(a=T.dataToLinear(s),o=function(t){return s._offset+s.l2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(n=T.decodeDate(n)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,n,o);var u=n(e.x0),f=n(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(A.segmentRE,function(t){var n=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[n]?t=e(t):i[n]&&(t=r(t)),n++,n>l&&(t="X"),t});return n>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,r){return t.replace(A.segmentRE,function(t){var n=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return n>=l?t:(o[n]?t=e(t):i[n]&&(t=r(t)),n++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),z=t("./defaults");e.exports={draw:n,drawOne:a}},{"../../lib":121,"../../lib/setcursor":131,"../../plotly":143,"../../plots/cartesian/axes":147,"../color":30,"../dragelement":52,"../drawing":54,"./constants":94,"./defaults":95,"./helpers":97,"./shape_defaults":99,"fast-isnumeric":17}],97:[function(t,e,r){"use strict";r.dataToLinear=function(t){return"category"===t.type?t.c2l:t.d2l},r.linearToData=function(t){return"category"===t.type?t.l2c:t.l2d},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var a,o=t._fullLayout._size;if(e){var i=r.dataToLinear(e);a=function(t){return e._offset+e.l2p(i(t,!0))},"date"===e.type&&(a=r.decodeDate(a))}else a=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},r.getPixelToData=function(t,e,n){var a,o=t._fullLayout._size;if(e){var i=r.linearToData(e);a=function(t){return i(e.p2l(t-e._offset))}}else a=n?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],98:[function(t,e,r){"use strict";r.moduleType="component",r.name="shapes",r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.calcAutorange=t("./calc_autorange");var n=t("./draw");r.draw=n.draw,r.drawOne=n.drawOne},{"./attributes":92,"./calc_autorange":93,"./defaults":95,"./draw":96}],99:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e){function r(e,r){return n.coerce(t,l,o,e,r)}var l={};r("layer"),r("opacity"),r("fillcolor"),r("line.color"),r("line.width"),r("line.dash");for(var s=t.path?"path":"rect",c=r("type",s),u=["x","y"],f=0;f<2;f++){var d=u[f],h={_fullLayout:e},p=a.coerceRef(t,l,h,d);if("path"!==c){var g=.25,m=.75;if("paper"!==p){var v=a.getFromId(h,p),y=i.linearToData(v);g=y(v.range[0]+g*(v.range[1]-v.range[0])),m=y(v.range[0]+m*(v.range[1]-v.range[0]))}r(d+"0",g),r(d+"1",m)}}return"path"===c?r("path"):n.noneOrAll(t,l,["x0","x1","y0","y1"]),l}},{"../../lib":121,"../../plots/cartesian/axes":147,"./attributes":92,"./helpers":97}],100:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},n,{})},font:o({},n,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":118,"../../plots/animation_attributes":144,"../../plots/font_attributes":168,"../../plots/pad_attributes":171,"./constants":101}],101:[function(t,e,r){"use strict";e.exports={name:"sliders",itemName:"slider",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],102:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,i,r,n)}var l=a(t,e),s=n("visible",l.length>0);if(s){n("active"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),o.coerceFont(n,"font",r.font);var c=n("currentvalue.visible");c&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),o.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function a(t,e){function r(t,e){return o.coerce(n,a,c,t,e)}for(var n,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+C.stepInset+(t.inputAreaLength-2*C.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-C.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*C.stepInset-2*t.inputAreaStart)))}function x(t,e,r){var n=t.selectAll("rect."+C.railTouchRectClass).data([0]);n.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,C.tickOffset+r.ticklen+r.labelHeight)}).call(A.fill,r.bgcolor).attr("opacity",0),M.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+C.railRectClass).data([0]);r.enter().append("rect").classed(C.railRectClass,!0);var n=e.inputAreaLength-2*C.railInset;r.attr({width:n,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(r,C.railInset,.5*(e.inputAreaWidth-C.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(l.enter().append("g").classed(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==r.length){var s=l.selectAll("g."+C.groupClassName).data(r,a);s.enter().append("g").classed(C.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,C.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,z=!0,C=O,k._infolayer.select("."+e).attr({"data-unformatted":C}).text(C).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,m=r.propName,v=r.traceIndex,y=r.dfltName,x=r.avoid||{},b=r.attributes,_=r.transform,w=r.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,z=!1,C=g.title.trim();""===C&&(L=0),C.match(/Click to enter .+ title/)&&(L=.2,z=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var S=w.selectAll("text").data([0]);S.enter().append("text"),S.text(C).attr("class",e),S.attr({"data-unformatted":C}).call(f);var O="Click to enter "+y+" title";t._context.editable?(C||p(),S.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):C&&!C.match(/Click to enter .+ title/)||S.remove(),S.classed("js-placeholder",z)}},{"../../lib":121,"../../lib/svg_text_utils":133,"../../plotly":143,"../../plots/plots":172,"../color":30,"../drawing":54,d3:14,"fast-isnumeric":17}],106:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},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:l,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:o({},i,{}),font:o({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":118,"../../plots/font_attributes":168,"../../plots/pad_attributes":171,"../color/attributes":29}],107:[function(t,e,r){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],108:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,i,r,n)}var l=a(t,e),s=n("visible",l.length>0);s&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),o.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function a(t,e){function r(t,e){return o.coerce(n,a,c,t,e)}for(var n,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==r.length){var u=c.selectAll("g."+T.headerGroupClassName).data(r,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],112:[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}},{}],113:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.19.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":28,"./components/images":66,"./components/legend":74,"./components/rangeselector":86,"./components/rangeslider":91,"./components/shapes":98,"./components/sliders":104,"./components/updatemenus":110,"./fonts/mathjax_config":114,"./lib/queue":129,"./plot_api/plot_schema":137,"./plot_api/register":138,"./plot_api/set_plot_config":139,"./plot_api/to_image":141,"./plot_api/validate":142,"./plotly":143,"./snapshot":192,"./snapshot/download":189,"./traces/scatter":279,d3:14,"es6-promise":15}],114:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],115:[function(t,e,r){"use strict";function n(t){return t&&void 0!==t.valType}var a=t("fast-isnumeric"),o=t("tinycolor2"),i=t("./nested_property"),l=t("./is_plain_object"),s=t("./filter_unique"),c=t("../components/colorscale/get_scale"),u=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,n){!a(t)||void 0!==n.min&&tn.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,n){t%1||!a(t)||void 0!==n.min&&tn.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;n.strict!==!0&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){o(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(c(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):a(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&u.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!u.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o2)return!1;var i=o[0].split("-");if(i.length>3||3!==i.length&&o[1])return!1;if(4===i[0].length)e=Number(i[0]);else{if(2!==i[0].length)return!1;var s=(new Date).getFullYear();e=((Number(i[0])-s+70)%100+200)%100+s-70}return!!l(e)&&(1===i.length?new Date(e,0,1).getTime():(r=Number(i[1])-1,!(i[1].length>2)&&r>=0&&r<=11&&(2===i.length?new Date(e,r,1).getTime():(n=Number(i[2]),!(i[2].length>2)&&n>=1&&n<=31&&(n=new Date(e,r,n).getTime(),o[1]?(i=o[1].split(":"),!(i.length>3)&&(a=Number(i[0]),!(i[0].length>2)&&a>=0&&a<=23&&(n+=36e5*a,1===i.length?n:(r=Number(i[1]),!(i[1].length>2)&&r>=0&&r<=59&&(n+=6e4*r,2===i.length?n:(t=Number(i[2]),t>=0&&t<60&&n+1e3*t)))))):n)))))},r.isDateTime=function(t){return r.dateTime2ms(t)!==!1},r.ms2DateTime=function(t,e){e||(e=0);var r=new Date(t),a=i.time.format("%Y-%m-%d")(r);return e<7776e6?(a+=" "+n(r.getHours(),2),e<432e6&&(a+=":"+n(r.getMinutes(),2),e<108e5&&(a+=":"+n(r.getSeconds(),2),e<3e5&&(a+="."+n(r.getMilliseconds(),3)))),a.replace(/([:\s]00)*\.?[0]*$/,"")):a};var s={H:["%H:%M:%S~%L","%H:%M:%S","%H:%M"],I:["%I:%M:%S~%L%p","%I:%M:%S%p","%I:%M%p"],D:["%H","%I%p","%Hh"]},c={Y:["%Y~%m~%d","%Y%m%d","%y%m%d","%m~%d~%Y","%d~%m~%Y"],Yb:["%b~%d~%Y","%d~%b~%Y","%Y~%d~%b","%Y~%b~%d"],y:["%m~%d~%y","%d~%m~%y","%y~%m~%d"],yb:["%b~%d~%y","%d~%b~%y","%y~%d~%b","%y~%b~%d"]},u=i.time.format.utc,f={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(u),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(u)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(u)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){f[t].D.push(u(e)),["H","I","D"].forEach(function(r){s[r].forEach(function(n){var a=f[t][r];a.push(u(e+"~"+n)),a.push(u(n+"~"+e))})})})});var d=/[a-z]*/g,h=function(t){return t.substr(0,3)},p=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,g=/[\s,\/\-\.\(\)]+/g,m=/~?([ap])~?m(~|$)/,v=function(t,e){return e+"m "},y=/\d\d\d\d/,x=/(^|~)[a-z]{3}/,b=/[ap]m/,_=/:/,w=/q([1-4])/,k=["31~mar","30~jun","30~sep","31~dec"],M=function(t,e){return k[e-1]},A=/ ?([+\-]\d\d:?\d\d|Z)$/;r.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(d,h).replace(p,"").replace(g,"~").replace(m,v).replace(w,M).trim().replace(A,"");var e,r,n=null,i=a(t),l=o(t);e=f[i][l],r=e.length;for(var s=0;sr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},a.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},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,r))/Math.log(n),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,r/a))/Math.log(n)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,r)?t(e,r,n):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[n];u[r]=o}return u},a.syncOrAsync=function(t,e,r){function n(){return a.syncOrAsync(t,e,r)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(n).then(void 0,a.promiseError);return r&&r(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,r){if(t){var n,a,o=!1,i=!0;for(n=0;n1?a+i[1]:"";if(o&&(i.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+o+"$2");return l+s}},{"./coerce":115,"./dates":116,"./extend":118,"./filter_unique":119,"./is_array":122,"./is_plain_object":123,"./loggers":124,"./matrix":125,"./nested_property":126,"./notifier":127,"./search":130,"./stats":132,d3:14}],122:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],123:[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}},{}],124:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],i=!1,d(n))for(r=n.length-1;r>=0;r--)c(n[r])?i?n[r]=void 0:n.pop():i=!0;else if("object"==typeof n&&null!==n)for(o=Object.keys(n),i=!1,r=o.length-1;r>=0;r--)c(n[o[r]])&&!a(n[o[r]],o[r])?delete n[o[r]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,a,i,l=0,s=e.split(".");lo||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],s=t[1];if(ro||sl)return!1;var c,u,f,d,h,p=n.length,g=n[0][0],m=n[0][1],v=0;for(c=1;cMath.max(u,g)||s>Math.max(f,m)))if(su||Math.abs(n(i,d))>a)return!0;return!1};a.filter=function(t,e){function r(r){t.push(r);var l=n.length,s=a;n.splice(i+1);for(var c=s+1;c1){var l=t.pop();r(l)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":125}],129:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");r.findBin=function(t,e,r){if(l(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?r?n:a:r?i:o;f90&&s.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,a=e[n]-e[0]||1,o=a/(n||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},r.roundUp=function(t,e,r){for(var n,a=0,o=e.length-1,i=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":17}],133:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,r){var n="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),r();else{var n=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,n)}o.remove()})}function i(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),a=g[n];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,m.indexOf(u.protocol)===-1?"":''}if("br"===n)return"
";if(o)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))n.push(a);var o=0;n.forEach(function(t){for(var r=t+o,n=e.slice(0,r),a="",i=n.length-1;i>=0;i--){var l=n[i].match(/<(\/?).*>/i);if(l&&"
"!==n[i]){l[1]||(a=n[i]);break}}a&&(e.splice(r+1,0,a),e.splice(r,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,r){var n,a,o,i=r.horizontalAlign,l=r.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-n.height}:"middle"===l?function(){return s.top+(s.height-n.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-n.width}:"center"===i?function(){return s.left+(s.width-n.width)/2}:function(){return s.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(d.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return r(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=n(s,"width"),d=n(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||n(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(v," ")},r.makeEditable=function(t,e,r){function n(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:r.fill||i.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||i.attr("data-unformatted")).call(u(i,e,r)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}r||(r={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),r.immediate?n():c.on("click",n),f.rebind(this,l,"on")}},{"../constants/string_mappings":111,"../constants/xmlns_namespaces":112,"../lib":121,d3:14}],134:[function(t,e,r){"use strict";function n(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=f.cleanId(r,n))}function a(t){var e="middle",r="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?r="left":t.indexOf("right")!==-1&&(r="right"),e+" "+r}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.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);var a=f.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=u.getSubplotIds(t,"gl3d");for(e=0;e=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 s(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&l(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&sO.range[0]?[1,2]:[2,1]);else{var D=O.range[0],P=O.range[1];"log"===b?(D<=0&&P<=0&&r(L+".autorange",!0),D<=0?D=P/1e6:P<=0&&(P=D/1e6),r(L+".range[0]",Math.log(D)/Math.LN10),r(L+".range[1]",Math.log(P)/Math.LN10)):(r(L+".range[0]",Math.pow(10,D)),r(L+".range[1]",Math.pow(10,P)))}else r(L+".autorange",!0)}if("reverse"===A)z.range?z.range.reverse():(r(L+".autorange",!0),z.range=[1,0]),C.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var E=v.parts[1],N=v.parts[0],I=o[N]||[],R=I[E]||{};null===b&&(e[m]="remove"),2===v.parts.length&&("add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?E===-1?(g[N]=I,delete g[m]):g[m]=R:x.log("???",e)),!n(R,"x")&&!n(R,"y")||x.containsAny(m,["color","opacity","align","dash"])||(h.docalc=!0);var j=w.getComponentMethod(N,"drawOne");j(t,E,v.parts.slice(2).join("."),e[m]),delete e[m]}else k.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1]?(S.manageArrayContainers(v,b,g),h.doplot=!0):(0===v.parts[0].indexOf("scene")?h.doplot=!0:0===v.parts[0].indexOf("geo")?h.doplot=!0:0===v.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===m?h.doplot=!0:!i._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?h.docalc=!0:v.parts[0].indexOf("legend")!==-1?h.dolegend=!0:m.indexOf("title")!==-1?h.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(v.parts[1],["tick","exponent","grid","zeroline"])?h.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:v.parts.length>1&&v.parts[1].indexOf("line")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&"mirror"===v.parts[1]?h.doticks=h.dolayoutstyle=!0:"margin.pad"===m?h.doticks=h.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(h.doplot=!0):h.doplot=!0,v.set(b))}}var F=t._fullLayout.width,B=t._fullLayout.height;k.supplyDefaults(t),t.layout.autosize&&k.plotAutoSize(t,t.layout,t._fullLayout);var q=e.height||e.width||t._fullLayout.width!==F||t._fullLayout.height!==B;return q&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];m.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=x.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(z.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var a=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=a.append("g").classed("imagelayer",!0),r._shapeLowerLayer=a.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var o=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=o.append("g").classed("imagelayer",!0),r._shapeUpperLayer=o.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),k=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),z=t("../constants/xmlns_namespaces"),C=t("../lib/svg_text_utils"),S=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,r,n){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=D._basePlotModules,r=0;r=i.length?i[0]:i[t]:i}function a(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}if(t=S.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=k.supplyAnimationDefaults(r);var i=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,s){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function u(e){if(0!==e.length){for(var i=0;io._timeToNext&&d()};e()}function p(t){return Array.isArray(i)?v>=i.length?t.transitionOpts=i[v]:t.transitionOpts=i[0]:t.transitionOpts=i,v++,t}var g,m,v=0,y=[],b=void 0===e||null===e,_=Array.isArray(e),w=!b&&!_&&x.isPlainObject(e);if(w)y.push({type:"object",data:p(x.extendFlat({},e))});else if(b||"string"==typeof e)for(g=0;g0&&TT)&&L.push(m);y=L}}y.length>0?u(y):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=S.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(n=e.length-1;n>=0;n--)u.push({frame:k.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:c+n});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(a=u[n].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;r--)n=e[r],o.push({type:"delete",index:n}),i.unshift({type:"insert",index:n,value:a[n]});var l=k.modifyFrames,s=k.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),k.modifyFrames(t,o)},y.purge=function(t){t=S.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return k.cleanPlot([],{},r,e),k.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":54,"../components/errorbars":60,"../constants/xmlns_namespaces":112,"../lib":121,"../lib/events":117,"../lib/queue":129,"../lib/svg_text_utils":133,"../plotly":143,"../plots/cartesian/graph_interact":155,"../plots/plots":172,"../plots/polar":175,"../registry":187,"./helpers":134,"./subroutines":140,d3:14,"fast-isnumeric":17}],136:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],137:[function(t,e,r){"use strict";function n(t){var e=y.attributes,r=c({type:t}),n=f(t),a=h(t),o={},i={};o.type=null,k(o,e),o=l(r.attributes,o,"attributes",t),void 0!==a.attributes&&k(o,a.attributes),o.type=t,o=u(o),s(o),L.traces[t]=w({},n,{attributes:o}),void 0!==r.layoutAttributes&&(i=l(r.layoutAttributes,i,"layoutAttributes",t),s(i),L.traces[t].layoutAttributes=i)}function a(){var t=y.layoutAttributes,e={};e=l(t,e,"layoutAttributes","*"),e=d(e),e=p(e),e=u(e),s(e),g(e),L.layout={layoutAttributes:e}}function o(t){var e=v.transformsRegistry[t],r={};r=l(r,e.attributes||{},"attributes","*"),r=u(r),s(r),g(r),L.transforms[t]={attributes:r}}function i(){L.defs={valObjects:x.valObjects,metaKeys:x.UNDERSCORE_ATTRS.concat(["description","role"])}}function l(t,e,r,n){var a,o,i,s,u;return Object.keys(t).forEach(function(f){return f===A?void Object.keys(t[f]).forEach(function(s){a=c({_module:t[f][s]}),void 0!==a&&(o=a[r],i=l(o,{},r,n),x.nestedProperty(e,s).set(k({},i)))}):f===T?void Object.keys(t[f]).forEach(function(a){a===n&&(s=c({_module:t[f][a]}),void 0!==s&&(u=s[r],u=l(u,{},r,n),M(e,u)))}):void(e[f]=x.isPlainObject(t[f])?M({},t[f]):t[f])}),e}function s(t){function e(t){return{valType:"string"}}function r(t,r,n){z.isValObject(t)?"data_array"===t.valType?(t.role="data",n[r+"src"]=e(r)):t.arrayOk===!0&&(n[r+"src"]=e(r)):x.isPlainObject(t)&&(t.role="object")}x.crawl(t,r)}function c(t){if("type"in t)return"area"===t.type?{attributes:b}:v.getModule({type:t.type});var e=v.subplotsRegistry,r=v.componentsRegistry,n=t._module;return e[n]?e[n]:r[n]?r[n]:m[n]}function u(t){return Object.keys(t).forEach(function(e){"_"===e.charAt(0)&&x.UNDERSCORE_ATTRS.indexOf(e)===-1&&delete t[e]}),t}function f(t){return"area"===t?{}:v.modules[t].meta||{}}function d(t){return w(t,{radialaxis:_.radialaxis,angularaxis:_.angularaxis}),w(t,_.layout),t}function h(t){if("area"===t)return{};var e=v.subplotsRegistry,r=Object.keys(e).filter(function(e){return v.traceIs({type:t},e)})[0];return void 0===r?{}:e[r]}function p(t){var e=v.subplotsRegistry;return Object.keys(t).forEach(function(r){Object.keys(e).forEach(function(n){var a,o=e[n];o.attrRegex&&(a="cartesian"===n||"gl2d"===n?o.attrRegex.x.test(r)||o.attrRegex.y.test(r):o.attrRegex.test(r),a&&(t[r][x.IS_SUBPLOT_OBJ]=!0))})}),t}function g(t){function e(t,e,r){if(t[x.IS_LINKED_TO_ARRAY]===!0){var n=e.substr(0,e.length-1);delete t[x.IS_LINKED_TO_ARRAY],r[e]={items:{}},r[e].items[n]=t,r[e].role="object"}}x.crawl(t,e)}var m=t("../plotly"),v=t("../registry"),y=t("../plots/plots"),x=t("../lib"),b=t("../plots/polar/area_attributes"),_=t("../plots/polar/axis_attributes"),w=x.extendFlat,k=x.extendDeep,M=x.extendDeepAll,A="_nestedModules",T="_composedModules",L={traces:{},layout:{},transforms:{},defs:{}},z=e.exports={};z.get=function(){return v.allTypes.concat("area").forEach(n),a(),Object.keys(v.transformsRegistry).forEach(o),i(),L},z.crawl=x.crawl,z.isValObject=x.isValObject},{"../lib":121,"../plotly":143,"../plots/plots":172,"../plots/polar/area_attributes":173,"../plots/polar/axis_attributes":174,"../registry":187}],138:[function(t,e,r){"use strict";function n(t){i.register(t,t.name,t.categories,t.meta),i.subplotsRegistry[t.basePlotModule.name]||i.registerSubplot(t.basePlotModule)}function a(t){if("string"!=typeof t.name)throw new Error("Transform module *name* must be a string.");var e="Transform module "+t.name,r="function"==typeof t.transform,n="function"==typeof t.calcTransform;if(!r&&!n)throw new Error(e+" is missing a *transform* or *calcTransform* method."); -r&&n&&l.log([e+" has both a *transform* and *calcTransform* methods.","Please note that all *transform* methods are executed","before all *calcTransform* methods."].join(" ")),l.isPlainObject(t.attributes)||l.log(e+" registered without an *attributes* object."),"function"!=typeof t.supplyDefaults&&l.log(e+" registered without a *supplyDefaults* method."),i.transformsRegistry[t.name]=t}function o(t){i.componentsRegistry[t.name]=t}var i=t("../registry"),l=t("../lib");e.exports=function(t){if(!t)throw new Error("No argument passed to Plotly.register.");t&&!Array.isArray(t)&&(t=[t]);for(var e=0;e1)};d(e.width)&&d(e.height)||n(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.td;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=n},{"../lib":121,"../plotly":143,"../snapshot/cloneplot":188,"../snapshot/helpers":191,"../snapshot/svgtoimg":193,"../snapshot/tosvg":195,"fast-isnumeric":17}],142:[function(t,e,r){"use strict";function n(t,e,r,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=r.length,v=0;vc&&e=864e5?t._tickround="d":r>=36e5?t._tickround="H":r>=6e4?t._tickround="M":r>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(r/2)/Math.LN10);else{x(r)||(r=Number(r.substr(1))),t._tickround=2-Math.floor(Math.log(r)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var n=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(n)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((n-1)/3):t._tickexponent=n)}else"M"===r.charAt(0)?t._tickround=2===r.length?"m":"y":t._tickround=null}function i(t,e){var r=t.match(q),n=new Date(e);if(r){var a=Math.min(+r[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(q,o))(n)}return y.time.format(t)(n)}function l(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function s(t,e,r,n){var a,o=e.x,l=t._tickround,s=new Date(o),c="";r&&t.hoverformat?a=i(t.hoverformat,o):t.tickformat?a=i(t.tickformat,o):(n&&(x(l)?l+=2:l={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[l]),"y"===l?a=N(s):"m"===l?a=I(s):(o!==t._tmin||r||(c="
"+N(s)),"d"===l?a=R(s):"H"===l?a=j(s):(o!==t._tmin||r||(c="
"+R(s)+", "+N(s)),a=F(s),"M"!==l&&(a+=B(s),"S"!==l&&(a+=d(v(o/1e3,1),t,"none",r).substr(1)))))),e.text=a+c}function c(t,e,r,n,a){var o=t.dtick,i=e.x;if(!n||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,n);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,n)}function d(t,e,r,n){var a=t<0,i=e._tickround,l=r||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=H[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var r,n,a=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,r=[],n=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(n===a){var p=n-1,g=n+1;r="tozero"===t.rangemode?n<0?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),r=[s.val-d*s.pad,c.val+d*c.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),h&&r.reverse(),r},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var r=T.list(t,"",!0),n=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(n(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),k=n(r.vpadminus||r.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},T.autoBin=function(t,e,r,n){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(r)l=(i-o)/r;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[o,i]};T.autoTicks(f,l);var d,h=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var a=t.range[1]=l:s<=l)&&(i.push(s),!(i.length>1e3));s=T.tickIncrement(s,t.dtick,a));t._tmax=i[i.length-1];for(var c=new Array(i.length),u=0;u157788e5?(e/=315576e5,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,r,C)):e>12096e5?(e/=26298e5,t.dtick="M"+a(e,1,S)):e>432e5?(t.dtick=a(e,864e5,D),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=a(e,36e5,S):e>3e4?t.dtick=a(e,6e4,O):e>500?t.dtick=a(e,1e3,O):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,r,C));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var n=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/n,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,r,C)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,r,C));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,r){var n=r?-1:1;if(x(e))return t+n*e;var a=e.charAt(0),o=n*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?E:P,s=t+.01*n,c=_.roundUp(v(s,1),l,r);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]n:c1&&e2*n}function o(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,a=0,o=0;o2*n}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("./clean_datum");e.exports=function(t){return a(t)?"date":o(t)?"category":n(t)?"linear":"-"}},{"../../lib":121,"./clean_datum":152,"fast-isnumeric":17}],149:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var l=i(e,r,n);if(l){if("histogram"===l.type&&n==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,n)){for(var s,u=a(l),f=[],d=0;d0;o&&(n="array");var i=r("categoryorder",n);"array"===i&&r("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],152:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return a.ms2DateTime(t);if("string"!=typeof t&&!n(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){a.error(e,t)}return t}},{"../../lib":121,"fast-isnumeric":17}],153:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],154:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],a=Math.abs(n-t.range[1-e]);return"date"===t.type?f.ms2DateTime(n,a):"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(r)+"g")(n))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,r,l,_,w,k,M){function A(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+mt+", "+vt+")").attr("d",ut+"Z"),pt=gt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+mt+", "+vt+")").attr("d","M0,0Z"),C();for(var o=0;o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),pt.transition().style("opacity",1).duration(200),ft=!0)}function O(t,e,r){var n,a,o;for(n=0;nzoom back out","long"),b=!1)))}function P(e,r){var a=1===(k+M).length;if(e)j();else if(2!==r||a){if(1===r&&a){var o=k?V[0]:H[0],i="s"===k||"w"===M?0:1,l=o._name+".range["+i+"]",s=n(o,i),u="left",f="middle";if(o.fixedrange)return;k?(f="n"===k?"top":"bottom","right"===o.side&&(u="right")):"e"===M&&(u="right"),nt.call(d.makeEditable,null,{immediate:!0,background:B.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var r="category"===o.type?o.c2l(e):o.d2l(e);void 0!==r&&c.relayout(t,l,r)})}}else R()}function E(e){function r(t,e,r){if(!t.fixedrange){T(t.range);var n=t.range,a=n[0]+(n[1]-n[0])*e;t.range=[a+(n[0]-a)*r,a+(n[1]-a)*r]}}if(t._context.scrollZoom||B._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(L(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(xt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=_t.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=yt[0]+yt[2]*s,u=(l.bottom-e.clientY)/l.height,d=yt[1]+yt[3]*(1-u);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,r){for(var n=1-e,o=0,i=0;i0;n--)r.push(e);return r}function a(t,e){for(var r=[],n=0;nG.width||X<0||X>G.height)return _.unhoverRaw(t,e)}else Y="xpx"in e?e.xpx:M[0]._length/2,X="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?n(o,e.xval):a(M,Y),D="yval"in e?n(o,e.yval):a(A,X),!g(O[0])||!g(D[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(E=0;E1||I.hoverinfo.indexOf("name")!==-1?I.name:void 0,index:!1,distance:Math.min(W,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[R]&&(H.subplot=i[R]._subplot),V=Z.length,"array"===F){var Q=e[E];"pointNumber"in Q?(H.index=Q.pointNumber,F="closest"):(F="","xval"in Q&&(B=Q.xval,F="x"),"yval"in Q&&(q=Q.yval,F=F?"closest":"y"))}else B=O[j],q=D[j];if(I._module&&I._module.hoverPoints){var $=I._module.hoverPoints(H,B,q,F);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&Z.push(s(J,S))}else m.log("Unrecognized trace type in hover:",I);"closest"===S&&Z.length>V&&(Z.splice(0,V),W=Z[0].distance)}if(0===Z.length)return _.unhoverRaw(t,e);var tt="y"===S&&U.length>1;Z.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),rt={hovermode:S,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},nt=c(Z,rt);u(Z,tt?"xa":"ya"),f(nt,tt);var at=t._hoverdata,ot=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,r=u.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?n=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),m=0;r&&r!==n?(d.style("fill",s).text(r).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),m=d.node().getBoundingClientRect().width+2*D):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var v,k,L=f.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,C=t.ya._offset+(t.y0+t.y1)/2,S=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),E=L.width+O+D+m;t.ty0=_-L.top,t.bx=L.width+2*D,t.by=L.height+2*D,t.anchor="start",t.txwidth=L.width,t.tx2width=m,t.offset=0,o?(t.pos=z,v=C+P/2+E<=M,k=C-P/2-E>=0,"top"!==t.idealAlign&&v||!k?v?(C+=P/2,t.anchor="start"):t.anchor="middle":(C-=P/2,t.anchor="end")):(t.pos=C,v=z+S/2+E<=w,k=z-S/2-E>=0,"left"!==t.idealAlign&&v||!k?v?(z+=S/2,t.anchor="start"):t.anchor="middle":(z-=S/2,t.anchor="end")),f.attr("text-anchor",t.anchor),m&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+C+")"+(o?"rotate("+T+")":""))}),C}function u(t,e){function r(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=r.pos+r.dp+r.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;n=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;n=!1}if(n){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var n,a,o,i,l,s,c,u=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?z:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&u<=t.length;){for(u++,n=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;n=!1}else i++}f.forEach(r)}for(i=f.length-1;i>=0;i--){var m=f[i];for(l=m.length-1;l>=0;l--){var v=m[l],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var r=h.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,a=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(O+D),l=i+o*(t.txwidth+D),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-S,s=t.offset*C),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*O+s)+","+(O+c)+"v"+(t.by/2-O)+"h"+n*t.bx+"v-"+t.by+"H"+(n*O+s)+"V"+(c-O)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+D).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(b.setPosition,l+o*D+s,c+t.ty0-t.by/2+D), -r.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],o=t._hoverdata[n];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=e.exports={};A.unhover=_.unhover,A.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},A.supplyLayoutDefaults=function(t,e,r){function n(r,n){return m.coerce(t,e,A.layoutAttributes,r,n)}n("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=A.isHoriz(r);a=o?"y":"x"}else a="closest";n("hovermode",a)},A.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+k.HOVERMINTIME?(i(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},A.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||o(e,r):"x"===t?e:r},A.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":121,"fast-isnumeric":17}],161:[function(t,e,r){"use strict";function n(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,r,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-m.left,b=r-m.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(n),L=a.yaxes.map(n),z=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var C=g.selectAll("path.select-outline").data([1,2]);C.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",k+"Z");var S,O,D,P,E,N=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,j=[];for(S=0;S0)return Math.log(e)/Math.LN10;if(e<=0&&r&&t.range&&2===t.range.length){var n=t.range[0],a=t.range[1];return.5*(n+a-3*u*Math.abs(n-a))}return i.BADNUM}function r(t){return Math.pow(10,t)}function c(t){return a(t)?Number(t):i.BADNUM}var u=10;if(t.c2l="log"===t.type?e:c,t.l2c="log"===t.type?r:c,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(e){var r,n=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var i=s.getFromId(t._gd,t.overlaying);t.domain=i.domain}var l=e&&t._r?t._r:t.range;for(l&&2===l.length&&l[0]!==l[1]||(l=[-1,1]),r=0;r<2;r++)a(l[r])||(l[r]=a(l[1-r])?l[1-r]*(r?10:.1):r?1:-1),l[r]<-(Number.MAX_VALUE/2)?l[r]=-(Number.MAX_VALUE/2):l[r]>Number.MAX_VALUE/2&&(l[r]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l[0]-l[1]),t._b=-t._m*l[1]):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l[1]-l[0]),t._b=-t._m*l[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?n.round(t._b+t._m*e,2):i.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},["linear","log","-"].indexOf(t.type)!==-1)t.c2d=c,t.d2c=function(t){return t=l(t),a(t)?Number(t):i.BADNUM},t.d2l=function(e,r){return"log"===t.type?t.c2l(t.d2c(e),r):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return a(t)?o.ms2DateTime(t):i.BADNUM},t.d2c=function(t){return a(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(o.dateTime2ms);!a(t.range[0])&&a(f[0])&&(t.range[0]=f[0]),!a(t.range[1])&&a(f[1])&&(t.range[1]=f[1])}catch(e){o.error(e,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?i.BADNUM:r},t.d2l=t.d2c);t.makeCalcdata=function(e,r){var n,a,o;if(r in e)for(n=e[r],a=new Array(n.length),o=0;or.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var k;c&&(k=c());var M,A,T,L=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),M=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":121,"../../plotly":143,"../../registry":187,"./axes":147,d3:14}],167:[function(t,e,r){"use strict";function n(t,e,r){var n,a,o,i=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return a=c.nestedProperty(n,e.prop).get(),o=r[e.type]=r[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var r=[],n=e[0],a={};if("string"==typeof n)a[n]=e[1];else{if(!c.isPlainObject(n))return r;a=n}return l(a,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function i(t,e){var r,n,a,o,i=[];if(n=e[0],a=e[1],r=e[2],o={},"string"==typeof n)o[n]=a;else{if(!c.isPlainObject(n))return i;o=n,void 0===r&&(r=a)}return void 0===r&&(r=null),l(o,function(e,n,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);r&&(l=Math.min(l,r.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,n+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");r.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=r.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){n(t,s,i.cache),i.check=function(){if(l){var e=n(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),r.attr(o);var i=r.select(".js-link-to-tool"),l=r.select(".js-link-spacer"),c=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=s.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=n.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(r._initialAutoSizeIsDone){var c=r.width,f=r.height;p.supplyLayoutGlobalDefaults(o,n),o.width||(n.width=c),o.height||(n.height=f)}else{p.supplyLayoutGlobalDefaults(o,n);var d=!o.width||!o.height,h=n.autosize,g=t._context&&t._context.autosizable,m=d&&(h||g);m?p.plotAutoSize(t,o,n):d&&p.sanitizeMargins(t),!h&&d&&(o.width=n.width,o.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=s.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,n),n._has=p._hasPlotType.bind(n);var v=n._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,m=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(m.width-f)),a=Math.round(g*(m.height-h))}else{var v=s?window.getComputedStyle(t):{};n=parseFloat(v.width)||r.width,a=parseFloat(v.height)||r.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-a)>1;(_||b)&&(b&&(r.width=n),_&&(r.height=a)),t._initialAutoSize||(t._initialAutoSize={width:n,height:a}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r){var n,a;u.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(n=0;n.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+a},r:{val:r.x,size:r.r+a},b:{val:r.y,size:r.b+a},t:{val:r.y,size:r.t+a}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var r=s[t].l||{},n=s[t].b||{},u=r.val,f=r.size,d=n.val,h=n.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var r=s[t].r.val,n=s[t].r.size;if(r>u){var p=(f*r+(n-e.width)*u)/(r-u),g=(n*(1-u)+(f-e.width)*(1-r))/(r-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var m=s[t].t.val,v=s[t].t.size;if(m>d){var y=(h*m+(v-e.height)*d)/(m-d),x=(v*(1-d)+(h-e.height)*(1-m))/(m-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),r.l=Math.round(a),r.r=Math.round(o),r.t=Math.round(i),r.b=Math.round(l),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,r,n,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,n,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):t&&t.getTime?d.ms2DateTime(t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===n?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var r,n,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(r=0;r0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(r)for(l=0;l=0,C=z?f.angularAxis.domain:n.extent(M),S=Math.abs(M[1]-M[0]);T&&!A&&(S=0);var O=C.slice();L&&A&&(O[1]+=S);var D=f.angularAxis.ticksCount||4;D>8&&(D=D/(D/8)+D%8),f.angularAxis.ticksStep&&(D=(O[1]-O[0])/D);var P=f.angularAxis.ticksStep||(O[1]-O[0])/(D*(f.minorTicks+1));k&&(P=Math.max(Math.round(P),1)),O[2]||(O[2]=P);var E=n.range.apply(this,O);if(E=E.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=n.scale.linear().domain(O.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?S:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var N="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(N,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=n.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var j,F=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},q={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){j=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var r=i.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});i.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},i.Legend.defaultConfig().legendConfig,{container:j,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=j.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],a.range([0,x]),u.layout.radialAxis.domain=a.domain(),j.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else j=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var Z=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(Z[0]=Math.max(0,Z[0]),Z[1]=Math.max(0,Z[1]),e.select(".outer-group").attr("transform","translate("+Z+")"),f.title){var U=e.select("g.title-group text").style(q).text(f.title),Y=U.node().getBBox();U.attr({x:_[0]-Y.width/2,y:_[1]-x-20})}var X=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var G=X.selectAll("circle.grid-circle").data(a.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(B),G.attr("r",a),G.exit().remove()}X.select("circle.outside-circle").attr({r:x}).style(B);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=n.svg.axis().scale(a).ticks(5).tickSize(5);X.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),X.selectAll(".domain").style(B),X.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(q).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,q["font-size"]]+")":"translate("+[0,q["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(E),J=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),J.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(q);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var r=s(t,e),n=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(q);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),h[0]||et){var nt=[];h.forEach(function(t,e){var r={};r.radialScale=a,r.angularScale=l,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var at=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return o(i[r].defaultConfig(),t)});i[r]().config(n)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=i.tooltipPanel().config({container:ct,fontSize:8})(),ft=i.tooltipPanel().config({container:ct,fontSize:8})(),dt=i.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var r=i.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;it=l.invert(n);var a=i.util.convertToCartesian(x+12,r+180);ut.text(i.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var r=i.util.getMousePos(W).radius;pt.attr({r:r}).style({opacity:.5}),lt=a.invert(i.util.getMousePos(W).radius);var n=i.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(i.util.round(lt)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var a=n.select(this),o=a.style("fill"),l="black",s=a.style("opacity")||1;if(a.attr({"data-opacity":s}),"none"!=o){a.attr({"data-fill":o}),l=n.hsl(o).darker().toString(),a.style({fill:l,opacity:1});var c={t:i.util.round(t[0]),r:i.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-Z[0]-d.left,f.top+f.height/2-Z[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else o=a.style("stroke"),a.attr({"data-stroke":o}),l=n.hsl(o).darker().toString(),a.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})}),d}var e,r,a,l,s={data:[],layout:{}},c={},u={},f=n.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=i.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),o(s.data[e],i.Axis.defaultConfig().data[0]),o(s.data[e],t)}),o(s.layout,i.Axis.defaultConfig().layout),o(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},n.rebind(d,f,"on"),d},i.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},i.util={},i.DATAEXTENT="dataExtent",i.AREA="AreaChart",i.LINE="LinePlot",i.DOT="DotPlot",i.BAR="BarChart",i.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},i.util._extend=function(t,e){for(var r in t)e[r]=t[r]},i.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},i.util.dataFromEquation2=function(t,e){var r=e||6,a=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,a=t(n);return[e,a]});return a},i.util.dataFromEquation=function(t,e,r){var a=e||6,o=[],i=[];n.range(0,360+a,a).forEach(function(e,r){var n=e*Math.PI/180,a=t(n);o.push(e),i.push(a)});var l={t:o,r:i};return r&&(l.name=r),l},i.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},i.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=i.util.ensureArray(t[e],r)}),t},i.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},i.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},i.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},i.util.arrayLast=function(t){return t[t.length-1]},i.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return r===-2},i.util.flattenArray=function(t){for(var e=[];!i.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},i.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},i.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),a=t*Math.sin(r);return[n,a]},i.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},i.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],a=e[1],o={};return o.x=r,o.y=a,o.pos=e,o.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,o.radius=Math.sqrt(r*r+a*a),o},i.util.duplicatesCount=function(t){for(var e,r={},n={},a=0,o=t.length;a0)){var l=n.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:d(i),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(r,a,o)},"fill-opacity":0,stroke:function(t,e){return m.stroke(r,a,o)},"stroke-width":function(t,e){return m["stroke-width"](r,a,o)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](r,a,o)},opacity:function(t,e){return m.opacity(r,a,o)},display:function(t,e){return m.display(r,a,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,a){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var m={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 l[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},v=n.select(this).selectAll("g.layer").data(s);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(m).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,r=[i.PolyChart.defaultConfig()],a=n.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),o(r[e],i.PolyChart.defaultConfig()),o(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,a,"on"),t},i.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},i.Legend=function(){function t(){var r=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var a=o({},r.elements[e]);return a.name=t,a.color=[].concat(r.elements[e].color)[n],a})}),i=n.merge(a);i=i.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(i=i.reverse());var l=r.container;("string"==typeof l||l.nodeName)&&(l=n.select(l));var s=i.map(function(t,e){return t.color}),c=r.fontSize,u=null==r.isContinuous?"number"==typeof i[0]:r.isContinuous,f=u?r.height:c*i.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(i.length),m=n.scale[u?"linear":"ordinal"]().domain(g).range(s),v=n.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(i);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,v(e)+c/2]+")"},d:function(t,e){var r=t.symbol;return y(r,c)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=n.svg.axis().scale(v).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?r.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return i[e].name}),t}var e=i.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},n.rebind(t,r,"on"),t},i.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},i.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=10,c=function(){t=a.container.selectAll("g."+l).data([0]);var n=t.enter().append("g").classed(l,!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+s,dy:.3*+a.fontSize}),c};return c.text=function(o){var i=n.hsl(a.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var d=a.padding,h=e.node().getBBox(),p={fill:a.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,m=h.height+2*d;return r.attr({d:"M"+[[s,-m/2],[s,-m/4],[a.hasTick?0:s,0],[s,m/4],[s,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-m/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){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 o(a,t),c},c},i.tooltipPanel.uid=1,i.adapter={},i.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=o({},t),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"]]];return a.forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=a.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var l=o({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};n.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),r.layout=l}return r},t}},{"../../lib":121,d3:14}],177:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),o=t("../../components/color"),i=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){function e(e,a){return a&&(f=a),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?s(r,e):e,o||(o=i.Axis()),u=i.adapter.plotly().convert(r),o.config(u).render(f),t.data=r.data,t.layout=r.layout,c.fillLayout(t),r}var r,a,o,u,f,d=new l;return e.isPolar=!0,e.svg=function(){return o.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return i.adapter.plotly().convert(o.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:o.angularScale(),r:o.radialScale()}},e.setUndoPoint=function(){var t=this,e=i.util.cloneJson(r);!function(e,r){d.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,a),a=i.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},c.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(),i={width:800,height:600,paper_bgcolor:o.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=s(i,t.layout)}},{"../../components/color":30,"../../lib":121,"./micropolar":176,"./undo_manager":178,d3:14}],178:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,r=[],n=-1,a=!1;return{add:function(t){return a?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=r[n];return a?(t(a,"undo"),n-=1,e&&e(a.undo),this):this},redo:function(){var a=r[n+1];return a?(t(a,"redo"),n+=1,e&&e(a.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n=i&&(h.min=0,p.min=0,g.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var a=t("../../../components/color"),o=t("../../subplot_defaults"),i=t("./layout_attributes"),l=t("./axis_defaults"),s=["aaxis","baxis","caxis"];e.exports=function(t,e,r){o(t,e,r,{type:"ternary",attributes:i,handleDefaults:n,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":30,"../../subplot_defaults":179,"./axis_defaults":183,"./layout_attributes":185}],185:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),a=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:a,baxis:a,caxis:a}},{"../../../components/color/attributes":29,"./axis_attributes":182}],186:[function(t,e,r){"use strict";function n(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework()}function a(t){o.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var o=t("d3"),i=t("tinycolor2"),l=t("../../plotly"),s=t("../../lib"),c=t("../../components/color"),u=t("../../components/drawing"),f=t("../cartesian/set_convert"),d=t("../../lib/extend").extendFlat,h=t("../cartesian/axes"),p=t("../../lib/filter_visible"),g=t("../../components/dragelement"),m=t("../../components/titles"),v=t("../cartesian/select"),y=t("../cartesian/constants"),x=t("../cartesian/graph_interact");e.exports=n;var b=n.prototype;b.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={}},b.plot=function(t,e){var r,n=this,a=e[n.id],o=e._size;s.getPlotDiv(n.plotContainer.node())!==n.graphDiv&&(n.init(n.graphDiv._fullLayout),n.makeFramework()),n.adjustLayout(a,o);var i=n.traceHash,l={};for(r=0;r_*y?(o=y,a=o*_):(a=v,o=a/_),i=g*a/v,l=m*o/y,r=e.l+e.w*h-a/2,n=e.t+e.h*(1-p)-o/2,s.x0=r,s.y0=n,s.w=a,s.h=o,s.sum=x,s.xaxis={type:"linear",range:[b+2*k-x,x-b-2*w],domain:[h-i/2,h+i/2],_id:"x",_gd:s.graphDiv},f(s.xaxis),s.xaxis.setScale(),s.yaxis={type:"linear",range:[b,x-w-k],domain:[p-l/2,p+l/2],_id:"y",_gd:s.graphDiv},f(s.yaxis),s.yaxis.setScale();var M=s.yaxis.domain[0],A=s.aaxis=d({},t.aaxis,{range:[b,x-w-k],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[M,M+l*_],_axislayer:s.layers.aaxis,_gridlayer:s.layers.agrid,_pos:0,_gd:s.graphDiv,_id:"y",_length:a,_gridpath:"M0,0l"+o+",-"+a/2});f(A);var T=s.baxis=d({},t.baxis,{range:[x-b-k,w],side:"bottom",_counterangle:30,domain:s.xaxis.domain,_axislayer:s.layers.baxis,_gridlayer:s.layers.bgrid,_counteraxis:s.aaxis,_pos:0,_gd:s.graphDiv,_id:"x",_length:a,_gridpath:"M0,0l-"+a/2+",-"+o});f(T),A._counteraxis=T;var L=s.caxis=d({},t.caxis,{range:[x-b-w,k],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[M,M+l*_],_axislayer:s.layers.caxis,_gridlayer:s.layers.cgrid,_counteraxis:s.baxis,_pos:0,_gd:s.graphDiv,_id:"y",_length:a,_gridpath:"M0,0l-"+o+","+a/2});f(L);var z="M"+r+","+(n+o)+"h"+a+"l-"+a/2+",-"+o+"Z";s.clipDef.select("path").attr("d",z),s.layers.plotbg.select("path").attr("d",z);var C="translate("+r+","+n+")";s.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",C);var S="translate("+r+","+(n+o)+")";s.layers.baxis.attr("transform",S),s.layers.bgrid.attr("transform",S);var O="translate("+(r+a/2)+","+n+")rotate(30)";s.layers.aaxis.attr("transform",O),s.layers.agrid.attr("transform",O);var D="translate("+(r+a/2)+","+n+")rotate(-30)";s.layers.caxis.attr("transform",D),s.layers.cgrid.attr("transform",D),s.drawAxes(!0),s.plotContainer.selectAll(".crisp").classed("crisp",!1);var P=s.layers.axlines;P.select(".aline").attr("d",A.showline?"M"+r+","+(n+o)+"l"+a/2+",-"+o:"M0,0").call(c.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),P.select(".bline").attr("d",T.showline?"M"+r+","+(n+o)+"h"+a:"M0,0").call(c.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),P.select(".cline").attr("d",L.showline?"M"+(r+a/2)+","+n+"l"+a/2+","+o:"M0,0").call(c.stroke,L.linecolor||"#000").style("stroke-width",(L.linewidth||0)+"px")},b.drawAxes=function(t){var e=this,r=e.graphDiv,n=e.id.substr(7)+"title",a=e.aaxis,o=e.baxis,i=e.caxis;if(h.doTicks(r,a,!0),h.doTicks(r,o,!0),h.doTicks(r,i,!0),t){var l=Math.max(a.showticklabels?a.tickfont.size/2:0,(i.showticklabels?.75*i.tickfont.size:0)+("outside"===i.ticks?.87*i.ticklen:0));m.draw(r,"a"+n,{propContainer:a,propName:e.id+".aaxis.title",dfltName:"Component A",attributes:{x:e.x0+e.w/2,y:e.y0-a.titlefont.size/3-l,"text-anchor":"middle"}});var s=(o.showticklabels?o.tickfont.size:0)+("outside"===o.ticks?o.ticklen:0)+3;m.draw(r,"b"+n,{propContainer:o,propName:e.id+".baxis.title",dfltName:"Component B",attributes:{x:e.x0-s,y:e.y0+e.h+.83*o.titlefont.size+s,"text-anchor":"middle"}}),m.draw(r,"c"+n,{propContainer:i,propName:e.id+".caxis.title",dfltName:"Component C",attributes:{x:e.x0+e.w+s,y:e.y0+e.h+.83*i.titlefont.size+s,"text-anchor":"middle"}})}};var w=y.MINZOOM/2+.87,k="m-0.87,.5h"+w+"v3h-"+(w+5.2)+"l"+(w/2+2.6)+",-"+(.87*w+4.5)+"l2.6,1.5l-"+w/2+","+.87*w+"Z",M="m0.87,.5h-"+w+"v3h"+(w+5.2)+"l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-2.6,1.5l"+w/2+","+.87*w+"Z",A="m0,1l"+w/2+","+.87*w+"l2.6,-1.5l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-"+(w/2+2.6)+","+(.87*w+4.5)+"l2.6,1.5l"+w/2+",-"+.87*w+"Z",T="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",L=!0;b.initInteractions=function(){function t(t,e,r){var n=R.getBoundingClientRect();b=e-n.left,w=r-n.top,z={a:I.aaxis.range[0],b:I.baxis.range[1],c:I.caxis.range[1]},S=z,C=I.aaxis.range[1]-z.a,O=i(I.graphDiv._fullLayout[I.id].bgcolor).getLuminance(),D="M0,"+I.h+"L"+I.w/2+", 0L"+I.w+","+I.h+"Z",P=!1,E=F.append("path").attr("class","zoombox").style({fill:O>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",D),N=F.append("path").attr("class","zoombox-corners").style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),p()}function e(t,e){return 1-e/I.h}function r(t,e){return 1-(t+(I.h-e)/Math.sqrt(3))/I.w}function n(t,e){return(t-(I.h-e)/Math.sqrt(3))/I.w}function o(t,a){var o=b+t,i=w+a,l=Math.max(0,Math.min(1,e(b,w),e(o,i))),s=Math.max(0,Math.min(1,r(b,w),r(o,i))),c=Math.max(0,Math.min(1,n(b,w),n(o,i))),u=(l/2+c)*I.w,f=(1-l/2-s)*I.w,d=(u+f)/2,h=f-u,p=(1-l)*I.h,g=p-h/_;h.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),N.transition().style("opacity",1).duration(200),P=!0)}function u(t,e){if(S===z)return 2===e&&m(),a(j);a(j);var r={};r[I.id+".aaxis.min"]=S.a,r[I.id+".baxis.min"]=S.b,r[I.id+".caxis.min"]=S.c,l.relayout(j,r),L&&j.data&&j._context.showTips&&(s.notifier("Double-click to
zoom back out","long"),L=!1)}function f(){z={a:I.aaxis.range[0],b:I.baxis.range[1],c:I.caxis.range[1]},S=z}function d(t,e){var r=t/I.xaxis._m,n=e/I.yaxis._m;S={a:z.a-n,b:z.b+(r+n)/2,c:z.c-(r-n)/2};var a=[S.a,S.b,S.c].sort(),o={a:a.indexOf(S.a),b:a.indexOf(S.b),c:a.indexOf(S.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),S={a:a[o.a],b:a[o.b],c:a[o.c]},e=(z.a-S.a)*I.yaxis._m,t=(z.c-S.c-z.b+S.b)*I.xaxis._m);var i="translate("+(I.x0+t)+","+(I.y0+e)+")";I.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",i),I.aaxis.range=[S.a,I.sum-S.b-S.c],I.baxis.range=[I.sum-S.a-S.c,S.b],I.caxis.range=[I.sum-S.a-S.b,S.c],I.drawAxes(!1),I.plotContainer.selectAll(".crisp").classed("crisp",!1)}function h(t,e){if(t){var r={};r[I.id+".aaxis.min"]=S.a,r[I.id+".baxis.min"]=S.b,r[I.id+".caxis.min"]=S.c,l.relayout(j,r)}else 2===e&&m()}function p(){I.plotContainer.selectAll(".select-outline").remove()}function m(){var t={};t[I.id+".aaxis.min"]=0,t[I.id+".baxis.min"]=0,t[I.id+".caxis.min"]=0,j.emit("plotly_doubleclick",null),l.relayout(j,t)}var b,w,z,C,S,O,D,P,E,N,I=this,R=I.layers.plotbg.select("path").node(),j=I.graphDiv,F=I.layers.zoom,B={element:R,gd:j,plotinfo:{plot:F},doubleclick:m,subplot:I.id,prepFn:function(e,r,n){B.xaxes=[I.xaxis],B.yaxes=[I.yaxis];var a=j._fullLayout.dragmode;e.shiftKey&&(a="pan"===a?"zoom":"pan"),"lasso"===a?B.minDrag=1:B.minDrag=void 0,"zoom"===a?(B.moveFn=o,B.doneFn=u,t(e,r,n)):"pan"===a?(B.moveFn=d,B.doneFn=h,f(),p()):"select"!==a&&"lasso"!==a||v(e,r,n,B,a)}};R.onmousemove=function(t){x.hover(j,t,I.id),j._fullLayout._lasthover=R,j._fullLayout._hoversubplot=I.id},R.onmouseout=function(t){j._dragging||g.unhover(j,t)},R.onclick=function(t){x.click(j,t)},g.init(B)}},{"../../components/color":30, -"../../components/dragelement":52,"../../components/drawing":54,"../../components/titles":105,"../../lib":121,"../../lib/extend":118,"../../lib/filter_visible":120,"../../plotly":143,"../cartesian/axes":147,"../cartesian/constants":153,"../cartesian/graph_interact":155,"../cartesian/select":161,"../cartesian/set_convert":162,d3:14,tinycolor2:20}],187:[function(t,e,r){"use strict";function n(t){return"object"==typeof t&&(t=t.type),t}var a=t("./lib"),o=t("./plots/attributes");r.modules={},r.allTypes=[],r.allCategories={},r.subplotsRegistry={},r.transformsRegistry={},r.componentsRegistry={},r.register=function(t,e,n,o){if(r.modules[e])return void a.log("Type "+e+" already registered");for(var i={},l=0;l-1}var o=t("../lib"),i=t("../plots/plots"),l=o.extendFlat,s=o.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,o=t.data,c=t.layout,u=s([],o),f=s({},c,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(r=0;r=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var m,v,y,x,b=e.p+(h?d[r]:d),_=b+(g?p[r]:p),w=e.b,k=w+e.s;if("h"===l.orientation?(y=u.c2p(b,!0),x=u.c2p(_,!0),m=c.c2p(w,!0),v=c.c2p(k,!0)):(m=c.c2p(b,!0),v=c.c2p(_,!0),y=u.c2p(w,!0),x=u.c2p(k,!0)),!(a(m)&&a(v)&&a(y)&&a(x)&&m!==v&&y!==x))return void n.select(this).remove();var M=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,A=n.round(M/2%1,2);if(!t._context.staticPlot){var T=i.opacity(e.mc||l.marker.color),L=T<1||M>.01?o:s;m=L(m,v),v=L(v,m),y=L(y,x),x=L(x,y)}n.select(this).attr("d","M"+m+","+y+"V"+x+"H"+v+"V"+y+"Z")})}),d.call(l.plot,e)}},{"../../components/color":30,"../../components/errorbars":60,"../../lib":121,"./arrays_to_calcdata":196,d3:14,"fast-isnumeric":17}],205:[function(t,e,r){"use strict";function n(t,e,r,n){if(n.length){var l,s,c,u,f,d=t._fullLayout.barmode,h="overlay"===d,p="group"===d;if(h)a(t,e,r,n);else if(p){for(l=[],s=[],c=0;cs+i&&(c=!0,s=y)),v(e.c2l(g))&&(gs+i&&(c=!0,s=g))}}x.expand(e,[l,s],{tozero:!0,padded:c})}function m(t){return t._id.charAt(0)}var v=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var r,a=e.xaxis,o=e.yaxis,i=t._fullData,l=t.calcdata,s=[],c=[];for(r=0;r1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,r=e.marker,i=r.line,l=(e._input||{}).marker||{},s=o.tryColorscale(r,l,""),c=o.tryColorscale(r,l,"line.");n.select(this).selectAll("path").each(function(t){var e,o,l=(t.mlw+1||i.width+1)-1,u=n.select(this);e="mc"in t?t.mcc=s(t.mc):Array.isArray(r.color)?a.defaultLine:r.color,u.style("stroke-width",l+"px").call(a.fill,e),l&&(o="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":30,"../../components/drawing":54,"../../components/errorbars":60,d3:14}],208:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,r,i,l){r("marker.color",i),a(t,"marker")&&o(t,e,l,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),a(t,"marker.line")&&o(t,e,l,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width")}},{"../../components/color":30,"../../components/colorscale/defaults":40,"../../components/colorscale/has_colorscale":44}],209:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),a=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,i=n.marker,l=i.line;e.exports={y:{valType:"data_array"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:o({},i.symbol,{arrayOk:!1}),opacity:o({},i.opacity,{arrayOk:!1,dflt:1}),size:o({},i.size,{arrayOk:!1}),color:o({},i.color,{arrayOk:!1}),line:{color:o({},l.color,{arrayOk:!1,dflt:a.defaultLine}),width:o({},l.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:n.fillcolor}},{"../../components/color/attributes":29,"../../lib/extend":118,"../scatter/attributes":269}],210:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(t,e,r,o,i){var l;return r in e?p=o.makeCalcdata(e,r):(l=r+"0"in e?e[r+"0"]:"name"in e&&("category"===o.type||n(e.name)&&["linear","log"].indexOf(o.type)!==-1||a.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,l=o.d2c(l),p=i.map(function(){return l})),p}function i(t,e,r,o,i){var l,s,c,u,f=o.length,d=e.length,h=[],p=[];for(l=0;l=0&&c1,v=r.dPos*(1-d.boxgap)*(1-d.boxgroupgap)/(m?t.numboxes:1),y=m?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-d.boxgap):0,x=v*g.whiskerwidth;return g.visible!==!0||r.emptybox?void o.select(this).remove():("h"===g.orientation?(s=p,f=h):(s=h,f=p),r.bPos=y,r.bdPos=v,n(),o.select(this).selectAll("path.box").data(i.identity).enter().append("path").attr("class","box").each(function(t){var e=s.c2p(t.pos+y,!0),r=s.c2p(t.pos+y-v,!0),n=s.c2p(t.pos+y+v,!0),a=s.c2p(t.pos+y-x,!0),l=s.c2p(t.pos+y+x,!0),c=f.c2p(t.q1,!0),u=f.c2p(t.q3,!0),d=i.constrain(f.c2p(t.med,!0),Math.min(c,u)+1,Math.max(c,u)-1),h=f.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=f.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?o.select(this).attr("d","M"+d+","+r+"V"+n+"M"+c+","+r+"V"+n+"H"+u+"V"+r+"ZM"+c+","+e+"H"+h+"M"+u+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+h+","+a+"V"+l+"M"+p+","+a+"V"+l)):o.select(this).attr("d","M"+r+","+d+"H"+n+"M"+r+","+c+"H"+n+"V"+u+"H"+r+"ZM"+e+","+c+"V"+h+"M"+e+","+u+"V"+p+(0===g.whiskerwidth?"":"M"+a+","+h+"H"+l+"M"+a+","+p+"H"+l))}),g.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,o,l,s,f,d="all"===g.boxpoints?t.val:t.val.filter(function(e){return et.uf}),h=Math.max((t.max-t.min)/10,t.q3-t.q1),p=1e-9*h,m=h*u,x=[],b=0;if(g.jitter){if(0===h)for(b=1,x=new Array(d.length),e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(l.translatePoints,h,p),void(g.boxmean&&o.select(this).selectAll("path.mean").data(i.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=s.c2p(t.pos+y,!0),r=s.c2p(t.pos+y-v,!0),n=s.c2p(t.pos+y+v,!0),a=f.c2p(t.mean,!0),i=f.c2p(t.mean-t.sd,!0),l=f.c2p(t.mean+t.sd,!0);"h"===g.orientation?o.select(this).attr("d","M"+a+","+r+"V"+n+("sd"!==g.boxmean?"":"m0,0L"+i+","+e+"L"+a+","+r+"L"+l+","+e+"Z")):o.select(this).attr("d","M"+r+","+a+"H"+n+("sd"!==g.boxmean?"":"m0,0L"+e+","+i+"L"+r+","+a+"L"+e+","+l+"Z")); -})))})}},{"../../components/drawing":54,"../../lib":121,d3:14}],217:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../plots/cartesian/axes"),o=t("../../lib");e.exports=function(t,e){var r,i,l,s,c=t._fullLayout,u=e.xaxis,f=e.yaxis,d=["v","h"];for(i=0;it?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===r||10===r){var n=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;return t>n?5===r?713:1114:5===r?104:208}return 15===r?0:r}function i(t){var e,r,n,a,i,l,s,c,u,f=t[0].z,d=f.length,h=f[0].length,p=2===d||2===h;for(r=0;r20?(l=C[l][(s[0]||s[1])<0?0:1],t.crossings[i]=S[l]):delete t.crossings[i],s=z[l],!s){_.log("Found bad marching index:",l,e,t.level);break}if(h.push(d(t,e,s)),e[0]+=s[0],e[1]+=s[1],u(h[h.length-1],h[h.length-2])&&h.pop(),i=e.join(","),i===o&&s.join(",")===p||r&&(s[0]&&(e[0]<0||e[0]>m-2)||s[1]&&(e[1]<0||e[1]>g-2)))break;l=t.crossings[i]}1e4===a&&_.log("Infinite loop in contour?");var v,y,x,b,w,k,M,A=u(h[0],h[h.length-1]),T=0,L=.2*t.smoothing,O=[],D=0;for(a=1;a=D;a--)if(v=O[a],v=D&&v+O[y]20&&e?208===t||1114===t?n=0===r[0]?1:-1:a=0===r[1]?1:-1:M.indexOf(t)!==-1?a=1:T.indexOf(t)!==-1?n=1:A.indexOf(t)!==-1?a=-1:n=-1,[n,a]}function u(t,e){return Math.abs(t[0]-e[0])<.01&&Math.abs(t[1]-e[1])<.01}function f(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function d(t,e,r){var n=e[0]+Math.max(r[0],0),a=e[1]+Math.max(r[1],0),o=t.z[a][n],i=t.xaxis,l=t.yaxis;if(r[1]){var s=(t.level-o)/(t.z[a][n+1]-o);return[i.c2p((1-s)*t.x[n]+s*t.x[n+1],!0),l.c2p(t.y[a],!0)]}var c=(t.level-o)/(t.z[a+1][n]-o);return[i.c2p(t.x[n],!0),l.c2p((1-c)*t.y[a]+c*t.y[a+1],!0)]}function h(t,e,r){var n=t.plot.select(".maplayer").selectAll("g.contour."+r).data(e);return n.enter().append("g").classed("contour",!0).classed(r,!0),n.exit().remove(),n}function p(t,e,r){var n=t.selectAll("g.contourbg").data([0]);n.enter().append("g").classed("contourbg",!0);var a=n.selectAll("path").data("fill"===r.coloring?[0]:[]);a.enter().append("path"),a.exit().remove(),a.attr("d","M"+e.join("L")+"Z").style("stroke","none")}function g(t,e,r,n){var a=t.selectAll("g.contourfill").data([0]);a.enter().append("g").classed("contourfill",!0);var o=a.selectAll("path").data("fill"===n.coloring?e:[]);o.enter().append("path"),o.exit().remove(),o.each(function(t){var e=m(t,r);e?b.select(this).attr("d",e).style("stroke","none"):b.select(this).remove()})}function m(t,e){function r(t){return Math.abs(t[1]-e[0][1])<.01}function n(t){return Math.abs(t[1]-e[2][1])<.01}function a(t){return Math.abs(t[0]-e[0][0])<.01}function o(t){return Math.abs(t[0]-e[2][0])<.01}for(var i,l,s,c,u,f,d=t.edgepaths.length||t.z[0][0]=0&&(l=m,c=u):Math.abs(i[1]-l[1])<.01?Math.abs(i[1]-m[1])<.01&&(m[0]-i[0])*(l[0]-m[0])>=0&&(l=m,c=u):_.log("endpt to newendpt is not vert. or horz.",i,l,m)}if(i=l,c>=0)break;d+="L"+l}if(c===t.edgepaths.length){_.log("unclosed perimeter path");break}h=c,g=p.indexOf(h)===-1,g&&(h=p[0],d+="Z")}for(h=0;h1;if(p&&!d&&"category"!==o.type){e=e.map(o.d2c);var g=e.length;if(!(g<=a))return f?e.slice(0,a):e.slice(0,a+1);if(f||h)c=e.slice(0,a);else if(1===a)c=[e[0]-.5,e[0]+.5];else{for(c=[1.5*e[0]-.5*e[1]],s=1;sy;n++)i=s(t,e,o(i));return i>y&&f.log("interp2d didn't converge quickly",i),t}function l(t){var e,r,n,a,o,i,l,s,c=[],u={},f=[],d=t[0],h=[],p=[0,0,0],g=v(t);for(r=0;r=0;o--)a=f[o],r=a[0],n=a[1],i=((u[[r-1,n]]||p)[2]+(u[[r+1,n]]||p)[2]+(u[[r,n-1]]||p)[2]+(u[[r,n+1]]||p)[2])/20,i&&(l[a]=[r,n,i],f.splice(o,1),s=!0);if(!s)throw"findEmpties iterated with no new neighbors";for(a in l)u[a]=l[a],c.push(l[a])}return c.sort(function(t,e){return e[2]-t[2]})}function s(t,e,r){var n,a,o,i,l,s,c,u,f,d,h,p,g,m=0;for(i=0;ip&&(m=Math.max(m,Math.abs(t[a][o]-h)/(g-p))))}return m}var c=t("fast-isnumeric"),u=t("../../registry"),f=t("../../lib"),d=t("../../plots/cartesian/axes"),h=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),m=t("./convert_column_xyz"),v=t("./max_row_length");e.exports=function(t,e){function r(t){z=e._input.zsmooth=e.zsmooth=!1,f.notifier("cannot fast-zsmooth: "+t)}var o,s,c,y,x,b,_,w,k=d.getFromId(t,e.xaxis||"x"),M=d.getFromId(t,e.yaxis||"y"),A=u.traceIs(e,"contour"),T=u.traceIs(e,"histogram"),L=u.traceIs(e,"gl2d"),z=A?"best":e.zsmooth;if(k._minDtick=0,M._minDtick=0,T){var C=h(t,e);o=C.x,s=C.x0,c=C.dx,y=C.y,x=C.y0,b=C.dy,_=C.z}else g(e)&&m(e,k,M),o=e.x?k.makeCalcdata(e,"x"):[],y=e.y?M.makeCalcdata(e,"y"):[],s=e.x0||0,c=e.dx||1,x=e.y0||0,b=e.dy||1,_=n(e),(A||e.connectgaps)&&(e._emptypoints=l(_),e._interpz=i(_,e._emptypoints,e._interpz));if("fast"===z)if("log"===k.type||"log"===M.type)r("log axis found");else if(!T){if(o.length){var S=(o[o.length-1]-o[0])/(o.length-1),O=Math.abs(S/100);for(w=0;wO){r("x scale is not linear");break}}if(y.length&&"fast"===z){var D=(y[y.length-1]-y[0])/(y.length-1),P=Math.abs(D/100);for(w=0;wP){r("y scale is not linear");break}}}var E=v(_),N="scaled"===e.xtype?"":e.x,I=a(e,N,s,c,E,k),R="scaled"===e.ytype?"":e.y,j=a(e,R,x,b,_.length,M);L||(d.expand(k,I),d.expand(M,j));var F={x:I,y:j,z:_};if(p(e,_,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var B="contour"===e.type?"heatmap":"histogram2d";F.xfill=a(B,N,s,c,E,k),F.yfill=a(B,R,x,b,_.length,M)}return[F]};var y=.01,x=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":37,"../../lib":121,"../../plots/cartesian/axes":147,"../../registry":187,"../histogram2d/calc":250,"./convert_column_xyz":232,"./has_columns":234,"./max_row_length":237,"fast-isnumeric":17}],231:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,s="cb"+r.uid,c=r.zmin,u=r.zmax;if(n(c)||(c=a.aggNums(Math.min,null,r.z)),n(u)||(u=a.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+s).remove(),!r.showscale)return void o.autoMargin(t,s);var f=e[0].t.cb=l(t,s),d=i.makeColorScaleFunc(i.extractScale(r.colorscale,c,u),{noNumericCheck:!0});f.fillcolor(d).filllevels({start:c,end:u,size:(u-c)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":33,"../../components/colorscale":45,"../../lib":121,"../../plots/plots":172,"fast-isnumeric":17}],232:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var a,o=t.x.slice(),i=t.y.slice(),l=t.z,s=t.text,c=Math.min(o.length,i.length,l.length),u=void 0!==s&&!Array.isArray(s[0]);for(c=y[0].length||f<0||f>y.length)return}else{if(n.inbox(e-m[0],e-m[m.length-1])>o||n.inbox(r-v[0],r-v[v.length-1])>o)return;if(l){var w;for(b=[2*m[0]-m[1]],w=1;w0&&o0&&l0;)_=m.c2p(L[A]),A--;for(_0;)M=v.c2p(z[A]),A--;if(M0&&(n=!0);for(var l=0;lo)return r[t]=o,o-r[t]}return 0},max:function(t,e,r,a){var o=a[e];if(n(o)){if(o=Number(o),!n(r[t]))return r[t]=o,o;if(r[t]=0&&vI;r--)if(u[r]){ -R=r;break}for(r=I;r<=R;r++)n(c[r])&&n(u[r])&&N.push({p:c[r],s:u[r],b:0});return N}}},{"../../lib":121,"../../plots/cartesian/axes":147,"./average":242,"./bin_functions":244,"./norm_functions":248,"fast-isnumeric":17}],246:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../components/color"),o=t("./bin_defaults"),i=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),s=t("./attributes");e.exports=function(t,e,r,c){function u(r,a){return n.coerce(t,e,s,r,a)}var f=u("x"),d=u("y");u("text");var h=u("orientation",d&&!f?"h":"v"),p=e["v"===h?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===h?"x":"y"];g&&u("histfunc");var m="h"===h?["y"]:["x"];o(t,e,u,m),i(t,e,u,r,c),l(t,e,a.defaultLine,{axis:"y"}),l(t,e,a.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":30,"../../components/errorbars/defaults":59,"../../lib":121,"../bar/style_defaults":208,"./attributes":241,"./bin_defaults":243}],247:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("../bar/layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("../bar/layout_defaults"),n.calc=t("./calc"),n.setPositions=t("../bar/set_positions"),n.plot=t("../bar/plot"),n.style=t("../bar/style"),n.colorbar=t("../scatter/colorbar"),n.hoverPoints=t("../bar/hover"),n.moduleType="trace",n.name="histogram",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":156,"../bar/hover":200,"../bar/layout_attributes":202,"../bar/layout_defaults":203,"../bar/plot":204,"../bar/set_positions":205,"../bar/style":207,"../scatter/colorbar":272,"./attributes":241,"./calc":245,"./defaults":246}],248:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,a=0;av&&p.splice(v,p.length-v),m.length>v&&m.splice(v,m.length-v),!e.autobinx&&"xbins"in e||(e.xbins=a.autoBin(p,h,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start-=e.xbins.size,e.xbins.end+=e.xbins.size),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=a.autoBin(m,g,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start-=e.ybins.size,e.ybins.end+=e.ybins.size),e._input.ybins=e.ybins),f=[];var y,x,b=[],_=[],w="string"==typeof e.xbins.size?[]:e.xbins,k="string"==typeof e.xbins.size?[]:e.ybins,M=0,A=[],T=e.histnorm,L=e.histfunc,z=T.indexOf("density")!==-1,C="max"===L||"min"===L,S=C?null:0,O=o.count,D=i[T],P=!1,E=[],N=[],I="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";I&&"count"!==L&&(P="avg"===L,O=o[L]);var R=e.xbins,j=R.end+(R.start-a.tickIncrement(R.start,R.size))/1e6;for(d=R.start;d=0&&y=0&&x")}return g};var s},{"../../components/color":30,"./helpers":261,"fast-isnumeric":17,tinycolor2:20}],260:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r,o){function i(r,o){return n.coerce(t,e,a,r,o)}var l=n.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,m=g||"inside"===p,v=g||"outside"===p;if(m||v){var y=l(i,"textfont",o.font);m&&l(i,"insidetextfont",y),v&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":121,"./attributes":257}],261:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return r.lastIndexOf(".")!==-1&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return r.lastIndexOf(".")!==-1&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":121}],262:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.layoutAttributes=t("./layout_attributes"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.styleOne=t("./style_one"),n.moduleType="trace",n.name="pie",n.basePlotModule=t("./base_plot"),n.categories=["pie","showLegend"],n.meta={},e.exports=n},{"./attributes":257,"./base_plot":258,"./calc":259,"./defaults":260,"./layout_attributes":263,"./layout_defaults":264,"./plot":265,"./style":266,"./style_one":267}],263:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],264:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function r(r,o){return n.coerce(t,e,a,r,o)}r("hiddenlabels")}},{"../../lib":121,"./layout_attributes":263}],265:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/r.vTotal,.5),l=1-r.trace.hole,s=a(e,r),c={scale:s*r.r*2/n,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=r.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/r.r)-f*o/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=r.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),m={scale:2*g/t.width,rCenter:Math.cos(g/r.r)-g/o/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>d.scale?m:d;return c.scale<1&&v.scale>c.scale?v:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var r=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(r)),(1-e.trace.hole)/2)}function o(t,e){var r=e.pxmid[0],n=e.pxmid[1],a=t.width/2,o=t.height/2;return r<0&&(a*=-1),n<0&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+r*r/(n*n)),outside:!0}}function i(t,e){function r(t,e){return t.pxmid[1]-e.pxmid[1]}function n(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,r){r||(r={});var n,a,o,l,d,h,g=r.labelExtraY+(i?r.yLabelMax:r.yLabelMin),m=i?t.yLabelMin:t.yLabelMax,v=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-m;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-m-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*f>0&&(n=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,m,v;for(i=0;i<2;i++)for(l=i?r:n,c=i?Math.max:Math.min,f=i?1:-1,o=0;o<2;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),m=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(r/c(l.tilt,Math.sin(s),l.depth),n/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&h.indexOf(l.scalegroup)===-1&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,r){if(!t)return 1;var n=Math.sin(t*Math.PI/180);return Math.max(.01,r*n*Math.abs(e)+2*Math.sqrt(1-n*n*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;l(e,r._size);var c=r._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],m=c.trace,v=0,y=(m.depth||0)*c.r*Math.sin(v)/2,x=m.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(v),k=l.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],v=!1;l.each(function(i){function l(e){var n=t._fullLayout,o=t._fullData[m.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&n.hovermode!==!1&&"none"!==l&&"skip"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=r.separators,p=[];l.indexOf("label")!==-1&&p.push(i.label),o.text&&o.text[i.i]&&l.indexOf("text")!==-1&&p.push(o.text[i.i]),l.indexOf("value")!==-1&&p.push(g.formatPieValue(i.v,h)),l.indexOf("percent")!==-1&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:l.indexOf("name")!==-1?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:n._hoverlayer.node(),outerContainer:n._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(r._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],t._hoverdata.trace=e.trace,f.click(t,{target:!0})}function b(t,e,r,n){return"a"+n*c.r+","+n*w+" "+x+" "+i.largeArc+(r?" 1 ":" 0 ")+n*(e[0]-t[0])+","+n*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y),m.pull){var z=+(Array.isArray(m.pull)?m.pull[i.i]:m.pull)||0;z>0&&(k+=z*i.pxmid[0],M+=z*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var C=m.hole;if(i.v===c.vTotal){var S="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";C?T.attr("d","M"+(k+C*i.px0[0])+","+(M+C*i.px0[1])+b(i.px0,i.pxmid,!1,C)+b(i.pxmid,i.px0,!1,C)+"Z"+S):T.attr("d",S)}else{var O=b(i.px0,i.px1,!0,1);if(C){var D=1-C;T.attr("d","M"+(k+C*i.px1[0])+","+(M+C*i.px1[1])+b(i.px1,i.px0,!1,C)+"l"+D*i.px0[0]+","+D*i.px0[1]+O+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+O+"Z")}var P=Array.isArray(m.textposition)?m.textposition[i.i]:m.textposition,E=A.selectAll("g.slicetext").data(i.text&&"none"!==P?[0]:[]);E.enter().append("g").classed("slicetext",!0),E.exit().remove(),E.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===P?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,r=h.bBox(t.node());"outside"===P?e=o(r,i):(e=n(r,i,c),"auto"===P&&e.scale<1&&(t.call(h.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),r=h.bBox(t.node())),e=o(r,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-r.height/2,i.yLabelMid=l,i.yLabelMax=l+r.height/2,i.labelExtraX=0,i.labelExtraY=0,v=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(r.left+r.right)/2+","+-(r.top+r.bottom)/2+")")})}),v&&i(s,m),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+n+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(n+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":30,"../../components/drawing":54,"../../lib/svg_text_utils":133,"../../plots/cartesian/graph_interact":155,"./helpers":261,d3:14}],266:[function(t,e,r){"use strict";var n=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],r=e.trace,o=n.select(this);o.style({opacity:r.opacity}),o.selectAll(".top path.surface").each(function(t){n.select(this).call(a,t,r)})})}},{"./style_one":267,d3:14}],267:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var a=r.marker.line.color;Array.isArray(a)&&(a=a[e.i]||n.defaultLine);var o=r.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(n.stroke,a)}},{"../../components/color":30}],268:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){var e=t[0].trace,r=e.marker;if(n.mergeArray(e.text,t,"tx"),n.mergeArray(e.textposition,t,"tp"),e.textfont&&(n.mergeArray(e.textfont.size,t,"ts"),n.mergeArray(e.textfont.color,t,"tc"),n.mergeArray(e.textfont.family,t,"tf")),r&&r.line){var a=r.line;n.mergeArray(r.opacity,t,"mo"),n.mergeArray(r.symbol,t,"mx"),n.mergeArray(r.color,t,"mc"),n.mergeArray(a.color,t,"mlc"),n.mergeArray(a.width,t,"mlw")}}},{"../../lib":121}],269:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),a=t("../../components/drawing"),o=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},ids:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"},simplify:{valType:"boolean",dflt:!0}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:o({},{symbol:{valType:"enumerated",values:a.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:o({},{width:{valType:"number",min:0,arrayOk:!0}},n("marker.line"))},n("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":38,"../../components/drawing":54,"../../lib/extend":118,"./constants":274}],270:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var r,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(r=e.marker,s=r.size,Array.isArray(s)){var v={type:"linear"};a.setConvert(v),s=v.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,a.expand(u,d,g),a.expand(f,h,m);var b=new Array(p);for(c=0;c=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}}}}},{}],272:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,s=r.marker,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===s||!s.showscale)return void o.autoMargin(t,c);var u=s.color,f=s.cmin,d=s.cmax;n(f)||(f=a.aggNums(Math.min,null,u)),n(d)||(d=a.aggNums(Math.max,null,u));var h=e[0].t.cb=l(t,c),p=i.makeColorScaleFunc(i.extractScale(s.colorscale,f,d),{noNumericCheck:!0});h.fillcolor(p).filllevels({start:f,end:d,size:(d-f)/254}).options(s.colorbar)()}},{"../../components/colorbar/draw":33,"../../components/colorscale":45,"../../lib":121,"../../plots/plots":172,"fast-isnumeric":17}],273:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&n(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(n(t,"marker")&&a(t,t.marker.color,"marker","c"),n(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":37,"../../components/colorscale/has_colorscale":44,"./subtypes":289}],274:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],275:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,o){return n.coerce(t,e,a,r,o)}var m=l(t,e,g),v=mq!=P>=q&&(S=z[T-1][0],O=z[T][0],C=S+(O-S)*(q-D)/(P-D),R=Math.min(R,C),j=Math.max(j,C));R=Math.max(R,0),j=Math.min(j,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),n.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:j,y0:q,y1:q,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":30,"../../components/errorbars":60,"../../lib":121,"../../plots/cartesian/constants":153,"../../plots/cartesian/graph_interact":155,"./get_trace_color":277}],279:[function(t,e,r){"use strict";var n={},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"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":156,"./arrays_to_calcdata":268,"./attributes":269,"./calc":270,"./clean_data":271,"./colorbar":272,"./defaults":275,"./hover":278,"./plot":286,"./select":287,"./style":288,"./subtypes":289}],280:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,i){var l=(t.marker||{}).color;if(i("line.color",r),n(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=!Array.isArray(l)&&l||r;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":40,"../../components/colorscale/has_colorscale":44}],281:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),n=k.c2p(t[e].y);return r!==C&&n!==C&&[r,n]}function a(t){var e=t[0]/w._length,r=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function o(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var i,l,s,c,u,f,d,h,p,g,m,v,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.simplify,A=e.connectGaps,T=e.baseTolerance,L=e.linear,z=[],C=n.BADNUM,S=.2,O=new Array(t.length),D=0;for(M||(T=S=-1),i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,c=f,h=!1):y=t.length||!f)break;O[D++]=f,l=f}}else O[D++]=c}z.push(O.slice(0,D))}return z}},{"../../plots/cartesian/axes":147}],282:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],283:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,a,o=null,i=0;i0?Math.max(e,a):0}}},{"fast-isnumeric":17}],285:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,r,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(r=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",r),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?n.background:n.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":30,"../../components/colorscale/defaults":40,"../../components/colorscale/has_colorscale":44,"./subtypes":289}],286:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=i.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function a(t,e,r,n,a,h,g){function m(t){return M?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,r,n=t[0].trace,a=i.select(this),o=u.hasMarkers(n),c=u.hasText(n),f=x(n),d=b,h=b;o&&(d=n.marker.maxdisplayed?v:l.identity),c&&(h=n.marker.maxdisplayed?v:l.identity),r=a.selectAll("path.point"),e=r.data(d,f);var p=e.enter().append("path").classed("point",!0);p.call(s.pointStyle,n).call(s.translatePoints,A,T,n),M&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=m(i.select(this));s.translatePoint(t,e,A,T),s.singlePointStyle(t,e,n)}),M?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=a.selectAll("g"),e=r.data(h,f),e.enter().append("g").append("text"),e.each(function(t){var e=m(i.select(this).select("text"));s.translatePoint(t,e,A,T)}),e.selectAll("text").call(s.textPointStyle,n).each(function(t){var e=t.xp||A.c2p(t.x),r=t.yp||T.c2p(t.y);i.select(this).selectAll("tspan").each(function(){m(i.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,k;o(t,e,r,n,a);var M=!!g&&g.duration>0,A=r.xaxis,T=r.yaxis,L=n[0].trace,z=L.line,C=i.select(h);if(C.call(c.plot,r,g),L.visible===!0){var S,O,D=L.fill.charAt(L.fill.length-1);"x"!==D&&"y"!==D&&(D=""),n[0].node3=C,f(n);var P="",E=[],N=L._prevtrace;N&&(P=N._prevRevpath||"",O=N._nextFill,E=N._polygons);var I,R,j,F,B,q,H,V,Z,U="",Y="",X=[],G=[],W=l.noop;if(S=L._ownFill,u.hasLines(L)||"none"!==L.fill){for(O&&O.datum(n),["hv","vh","hvh","vhv"].indexOf(z.shape)!==-1?(j=s.steps(z.shape),F=s.steps(z.shape.split("").reverse().join(""))):j=F="spline"===z.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?s.smoothclosed(t.slice(1),z.smoothing):s.smoothopen(t,z.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return F(t.reverse())},X=d(n,{xaxis:A,yaxis:T,connectGaps:L.connectgaps,baseTolerance:Math.max(z.width||1,3)/4,linear:"linear"===z.shape,simplify:z.simplify}),Z=L._polygons=new Array(X.length),k=0;k1}),W=function(t){return function(e){if(I=j(e),R=B(e),U?D?(U+="L"+I.substr(1),Y=R+("L"+Y.substr(1))):(U+="Z"+I,Y=R+"Z"+Y):(U=I,Y=R),u.hasLines(L)&&e.length>1){var r=i.select(this);if(r.datum(n),t)m(r.style("opacity",0).attr("d",I).call(s.lineGroupStyle)).style("opacity",1);else{var a=m(r);a.attr("d",I),s.singleLineStyle(n,a)}}}}}var Q=C.selectAll(".js-line").data(G);m(Q.exit()).style("opacity",0).remove(),Q.each(W(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(W(!0)),X.length&&(S?q&&V&&(D?("y"===D?q[1]=V[1]=T.c2p(0,!0):"x"===D&&(q[0]=V[0]=A.c2p(0,!0)),m(S).attr("d","M"+V+"L"+q+"L"+U.substr(1))):m(S).attr("d",U+"Z")):"tonext"===L.fill.substr(0,6)&&U&&P&&("tonext"===L.fill?m(O).attr("d",U+"Z"+P+"Z"):m(O).attr("d",U+"L"+P.substr(1)+"Z"),L._polygons=L._polygons.concat(E)),L._prevRevpath=Y,L._prevPolygons=Z);var $=C.selectAll(".points");w=$.data([n]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function o(t,e,r,n,a){var o=r.xaxis,l=r.yaxis,s=i.extent(o.range.map(o.l2c)),c=i.extent(l.range.map(l.l2c)),f=n[0].trace;if(u.hasMarkers(f)){var d=f.marker.maxdisplayed;if(0!==d){var h=n.filter(function(t){return t.x>=s[0]&&t.x<=s[1]&&t.y>=c[0]&&t.y<=c[1]}),p=Math.ceil(h.length/d),g=0;a.forEach(function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(u=p.selectAll("g.trace"),f=u.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),h(t,e,r),n(t,p),s=0,c=[];sn?1:-1}),m){l&&(d=l());var v=i.transition().duration(o.duration).ease(o.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()});v.each(function(){p.selectAll("g.trace").each(function(n,i){a(t,i,e,n,r,this,o)})})}else p.selectAll("g.trace").each(function(n,i){a(t,i,e,n,r,this,o)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":54,"../../components/errorbars":60,"../../lib":121,"../../lib/polygon":128,"./arrays_to_calcdata":268,"./line_points":281,"./link_traces":283,"./subtypes":289,d3:14}],287:[function(t,e,r){"use strict";var n=t("./subtypes"),a=.2;e.exports=function(t,e){var r,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!n.hasMarkers(d)&&!n.hasText(d);if(d.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;rM&&L.splice(M,L.length-M)}return l(e),"undefined"!=typeof L&&o.mergeArray(L,A,"ms"),A}},{"../../lib":121,"../../plots/cartesian/axes":147,"../scatter/colorscale_calc":273,"../scatter/subtypes":289,"fast-isnumeric":17}],294:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../scatter/constants"),o=t("../scatter/subtypes"),i=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),s=t("../scatter/line_shape_defaults"),c=t("../scatter/text_defaults"),u=t("../scatter/fillcolor_defaults"),f=t("./attributes");e.exports=function(t,e,r,d){function h(r,a){return n.coerce(t,e,f,r,a)}var p,g=h("a"),m=h("b"),v=h("c");if(g?(p=g.length,m?(p=Math.min(p,m.length),v&&(p=Math.min(p,v.length))):p=v?Math.min(p,v.length):0):m&&v&&(p=Math.min(m.length,v.length)),!p)return void(e.visible=!1);g&&p"),l}}},{"../../plots/cartesian/axes":147,"../scatter/hover":278}],296:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/ternary":180,"../scatter/colorbar":272,"./attributes":292,"./calc":293,"./defaults":294,"./hover":295,"./plot":297,"./select":298,"./style":299}],297:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e){var r=t.plotContainer;r.select(".scatterlayer").selectAll("*").remove();for(var a={xaxis:t.xaxis,yaxis:t.yaxis,plot:r},o=new Array(e.length),i=t.graphDiv.calcdata,l=0;le?1:t>=e?0:NaN}function o(t){return null===t?NaN:+t}function i(t){return!isNaN(t)}function l(t){return{left:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[o],r)<0?n=o+1:a=o}return n},right:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[o],r)>0?a=o:n=o+1}return n}}}function s(t){return t.length}function c(t){for(var e=1;t*e%1;)e*=10;return e}function u(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function f(){this._=Object.create(null)}function d(t){return(t+="")===_i||t[0]===wi?wi+t:t}function h(t){return(t+="")[0]===wi?t.slice(1):t}function p(t){return d(t)in this._}function g(t){return(t=d(t))in this._&&delete this._[t]}function m(){var t=[];for(var e in this._)t.push(h(e));return t}function v(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function x(){this._=Object.create(null)}function b(t){return t}function _(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=ki.length;r=e&&(e=a+1);!(i=l[e])&&++e0&&(t=t.slice(0,l));var c=Pi.get(t);return c&&(t=c,s=Q),l?e?a:n:e?k:o}function W(t,e){return function(r){var n=ui.event;ui.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{ui.event=n}}}function Q(t,e){var r=W(t,e);return function(t){var e=this,n=t.relatedTarget;n&&(n===e||8&n.compareDocumentPosition(e))||r.call(e,t)}}function $(t){var r=".dragsuppress-"+ ++Ei,a="click"+r,o=ui.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Ni&&(Ni=!("onselectstart"in t)&&w(t.style,"userSelect")),Ni){var i=e(t).style,l=i[Ni];i[Ni]="none"}return function(t){if(o.on(r,null),Ni&&(i[Ni]=l),t){var e=function(){o.on(a,null)};o.on(a,function(){T(),e()},!0),setTimeout(e,0)}}}function J(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var a=r.createSVGPoint();if(Ii<0){var o=n(t);if(o.scrollX||o.scrollY){r=ui.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var i=r[0][0].getScreenCTM();Ii=!(i.f||i.e),r.remove()}}return Ii?(a.x=e.pageX,a.y=e.pageY):(a.x=e.clientX,a.y=e.clientY),a=a.matrixTransform(t.getScreenCTM().inverse()),[a.x,a.y]}var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}function K(){return ui.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function rt(t){return t>1?0:t<-1?ji:Math.acos(t)}function nt(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function at(t){return((t=Math.exp(t))-1/t)/2}function ot(t){return((t=Math.exp(t))+1/t)/2}function it(t){return((t=Math.exp(2*t))-1)/(t+1)}function lt(t){return(t=Math.sin(t/2))*t}function st(){}function ct(t,e,r){return this instanceof ct?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof ct?new ct(t.h,t.s,t.l):kt(""+t,Mt,ct):new ct(t,e,r)}function ut(t,e,r){function n(t){return t>360?t-=360:t<0&&(t+=360),t<60?o+(i-o)*t/60:t<180?i:t<240?o+(i-o)*(240-t)/60:o}function a(t){return Math.round(255*n(t))}var o,i;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,i=r<=.5?r*(1+e):r+e-r*e,o=2*r-i,new xt(a(t+120),a(t),a(t-120))}function ft(t,e,r){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof ht?gt(t.l,t.a,t.b):gt((t=At((t=ui.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,r)}function dt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new ht(r,Math.cos(t*=Vi)*e,Math.sin(t)*e)}function ht(t,e,r){return this instanceof ht?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof ht?new ht(t.l,t.a,t.b):t instanceof ft?dt(t.h,t.c,t.l):At((t=xt(t)).r,t.g,t.b):new ht(t,e,r)}function pt(t,e,r){var n=(t+16)/116,a=n+e/500,o=n-r/200;return a=mt(a)*tl,n=mt(n)*el,o=mt(o)*rl,new xt(yt(3.2404542*a-1.5371385*n-.4985314*o),yt(-.969266*a+1.8760108*n+.041556*o),yt(.0556434*a-.2040259*n+1.0572252*o))}function gt(t,e,r){return t>0?new ft(Math.atan2(r,e)*Zi,Math.sqrt(e*e+r*r),t):new ft(NaN,NaN,t)}function mt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function vt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function xt(t,e,r){return this instanceof xt?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof xt?new xt(t.r,t.g,t.b):kt(""+t,xt,ut):new xt(t,e,r)}function bt(t){return new xt(t>>16,t>>8&255,255&t)}function _t(t){return bt(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function kt(t,e,r){var n,a,o,i=0,l=0,s=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(Lt(a[0]),Lt(a[1]),Lt(a[2]))}return(o=ol.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(i=(3840&o)>>4,i|=i>>4,l=240&o,l|=l>>4,s=15&o,s|=s<<4):7===t.length&&(i=(16711680&o)>>16,l=(65280&o)>>8,s=255&o)),e(i,l,s))}function Mt(t,e,r){var n,a,o=Math.min(t/=255,e/=255,r/=255),i=Math.max(t,e,r),l=i-o,s=(i+o)/2;return l?(a=s<.5?l/(i+o):l/(2-i-o),n=t==i?(e-r)/l+(e0&&s<1?0:n),new ct(n,a,s)}function At(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=vt((.4124564*t+.3575761*e+.1804375*r)/tl),a=vt((.2126729*t+.7151522*e+.072175*r)/el),o=vt((.0193339*t+.119192*e+.9503041*r)/rl);return ht(116*a-16,500*(n-a),200*(a-o))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Lt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function zt(t){return"function"==typeof t?t:function(){return t}}function Ct(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),St(e,r,t,n)}}function St(t,e,r,n){function a(){var t,e=s.status;if(!e&&Dt(s)||e>=200&&e<300||304===e){try{t=r.call(o,s)}catch(t){return void i.error.call(o,t)}i.load.call(o,t)}else i.error.call(o,s)}var o={},i=ui.dispatch("beforesend","progress","load","error"),l={},s=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in s||!/^(http(s)?:)?\/\//.test(t)||(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=a:s.onreadystatechange=function(){s.readyState>3&&a()},s.onprogress=function(t){var e=ui.event;ui.event=t;try{i.progress.call(o,s)}finally{ui.event=e}},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?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return r=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(di(arguments)))}}),o.send=function(r,n,a){if(2===arguments.length&&"function"==typeof n&&(a=n,n=null),s.open(r,t,!0),null==e||"accept"in l||(l.accept=e+",*/*"),s.setRequestHeader)for(var u in l)s.setRequestHeader(u,l[u]);return null!=e&&s.overrideMimeType&&s.overrideMimeType(e),null!=c&&(s.responseType=c),null!=a&&o.on("error",a).on("load",function(t){a(null,t)}),i.beforesend.call(o,s),s.send(null==n?null:n),o},o.abort=function(){return s.abort(),o},ui.rebind(o,i,"on"),null==n?o:o.get(Ot(n))}function Ot(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function Dt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Pt(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var a=r+e,o={c:t,t:a,n:null};return ll?ll.n=o:il=o,ll=o,sl||(cl=clearTimeout(cl),sl=1,ul(Nt)),o}function Nt(){var t=Et(),e=It()-t;e>24?(isFinite(e)&&(clearTimeout(cl),cl=setTimeout(Nt,e)),sl=0):(sl=1,ul(Nt))}function Et(){for(var t=Date.now(),e=il;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function It(){for(var t,e=il,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function jt(t){var e=t.decimal,r=t.thousands,n=t.grouping,a=t.currency,o=n&&r?function(t,e){for(var a=t.length,o=[],i=0,l=n[0],s=0;a>0&&l>0&&(s+l+1>e&&(l=Math.max(1,e-s)),o.push(t.substring(a-=l,a+l)),!((s+=l+1)>e));)l=n[i=(i+1)%n.length];return o.reverse().join(r)}:b;return function(t){var r=dl.exec(t),n=r[1]||" ",i=r[2]||">",l=r[3]||"-",s=r[4]||"",c=r[5],u=+r[6],f=r[7],d=r[8],h=r[9],p=1,g="",m="",v=!1,y=!0;switch(d&&(d=+d.substring(1)),(c||"0"===n&&"="===i)&&(c=n="0",i="="),h){case"n":f=!0,h="g";break;case"%":p=100,m="%",h="f";break;case"p":p=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===s&&(g="0"+h.toLowerCase());case"c":y=!1;case"d":v=!0,d=0;break;case"s":p=-1,h="r"}"$"===s&&(g=a[0],m=a[1]),"r"!=h||d||(h="g"),null!=d&&("g"==h?d=Math.max(1,Math.min(21,d)):"e"!=h&&"f"!=h||(d=Math.max(0,Math.min(20,d)))),h=hl.get(h)||qt;var x=c&&f;return function(t){var r=m;if(v&&t%1)return"";var a=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===l?"":l;if(p<0){var s=ui.formatPrefix(t,d);t=s.scale(t),r=s.symbol+m}else t*=p;t=h(t,d);var b,_,w=t.lastIndexOf(".");if(w<0){var k=y?t.lastIndexOf("e"):-1;k<0?(b=t,_=""):(b=t.substring(0,k),_=t.substring(k))}else b=t.substring(0,w),_=e+t.substring(w+1);!c&&f&&(b=o(b,1/0));var M=g.length+b.length+_.length+(x?0:a.length),A=M"===i?A+a+t:"^"===i?A.substring(0,M>>=1)+a+t+A.substring(M):a+(x?t:A+t))+r}}}function qt(t){return t+""}function Bt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ht(t,e,r){function n(e){var r=t(e),n=o(r,1);return e-r1)for(;i=c)return-1;if(a=e.charCodeAt(l++),37===a){if(i=e.charAt(l++),o=C[i in vl?e.charAt(l++):i],!o||(n=o(t,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}function n(t,e,r){w.lastIndex=0;var n=w.exec(e.slice(r));return n?(t.w=k.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){b.lastIndex=0;var n=b.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function o(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=L.get(n[0].toLowerCase()),r+n[0].length):-1}function i(t,e,r){M.lastIndex=0;var n=M.exec(e.slice(r));return n?(t.m=A.get(n[0].toLowerCase()),r+n[0].length):-1}function l(t,e,n){return r(t,z.c.toString(),e,n)}function s(t,e,n){return r(t,z.x.toString(),e,n)}function c(t,e,n){return r(t,z.X.toString(),e,n)}function u(t,e,r){var n=x.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)}var f=t.dateTime,d=t.date,h=t.time,p=t.periods,g=t.days,m=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{gl=Bt;var e=new gl;return e._=t,n(e)}finally{gl=Date}}var n=e(t);return r.parse=function(t){try{gl=Bt;var e=n.parse(t);return e&&e._}finally{gl=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ue;var x=ui.map(),b=Ut(g),_=Gt(g),w=Ut(m),k=Gt(m),M=Ut(v),A=Gt(v),T=Ut(y),L=Gt(y);p.forEach(function(t,e){x.set(t.toLowerCase(),e)});var z={a:function(t){return m[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(f),d:function(t,e){return Xt(t.getDate(),e,2)},e:function(t,e){return Xt(t.getDate(),e,2)},H:function(t,e){return Xt(t.getHours(),e,2)},I:function(t,e){return Xt(t.getHours()%12||12,e,2)},j:function(t,e){return Xt(1+pl.dayOfYear(t),e,3)},L:function(t,e){return Xt(t.getMilliseconds(),e,3)},m:function(t,e){return Xt(t.getMonth()+1,e,2)},M:function(t,e){return Xt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Xt(t.getSeconds(),e,2)},U:function(t,e){return Xt(pl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Xt(pl.mondayOfYear(t),e,2)},x:e(d),X:e(h),y:function(t,e){return Xt(t.getFullYear()%100,e,2)},Y:function(t,e){return Xt(t.getFullYear()%1e4,e,4)},Z:se,"%":function(){return"%"}},C={a:n,A:a,b:o,B:i,c:l,d:re,e:re,H:ae,I:ae,j:ne,L:le,m:ee,M:oe,p:u,S:ie,U:Wt,w:Yt,W:Qt,x:s,X:c,y:Jt,Y:$t,Z:Kt,"%":ce};return e}function Xt(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",o=a.length;return n+(o68?1900:2e3)}function ee(t,e,r){yl.lastIndex=0;var n=yl.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){yl.lastIndex=0;var n=yl.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){ +yl.lastIndex=0;var n=yl.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ae(t,e,r){yl.lastIndex=0;var n=yl.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function oe(t,e,r){yl.lastIndex=0;var n=yl.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function ie(t,e,r){yl.lastIndex=0;var n=yl.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function le(t,e,r){yl.lastIndex=0;var n=yl.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function se(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=bi(e)/60|0,a=bi(e)%60;return r+Xt(n,"0",2)+Xt(a,"0",2)}function ce(t,e,r){xl.lastIndex=0;var n=xl.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function ue(t){for(var e=t.length,r=-1;++r=0?1:-1,l=i*r,s=Math.cos(e),c=Math.sin(e),u=o*c,f=a*s+u*Math.cos(l),d=u*i*Math.sin(l);Al.add(Math.atan2(d,f)),n=t,a=s,o=c}var e,r,n,a,o;Tl.point=function(i,l){Tl.point=t,n=(e=i)*Vi,a=Math.cos(l=(r=l)*Vi/2+ji/4),o=Math.sin(l)},Tl.lineEnd=function(){t(e,r)}}function ve(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 be(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function ke(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function Me(t,e){return bi(t[0]-e[0])=0;--l)a.point((f=u[l])[0],f[1])}else n(h.x,h.p.x,-1,a);h=h.p}h=h.o,u=h.z,p=!p}while(!h.v);a.lineEnd()}}}function Pe(t){if(e=t.length){for(var e,r,n=0,a=t[0];++n0){for(_||(o.polygonStart(),_=!0),o.lineStart();++i1&&2&e&&r.push(r.pop().concat(r.shift())),h.push(r.filter(Ie))}var h,p,g,m=e(o),v=a.invert(n[0],n[1]),y={point:i,lineStart:s,lineEnd:c,polygonStart:function(){y.point=u,y.lineStart=f,y.lineEnd=d,h=[],p=[]},polygonEnd:function(){y.point=i,y.lineStart=s,y.lineEnd=c,h=ui.merge(h);var t=He(v,p);h.length?(_||(o.polygonStart(),_=!0),De(h,Fe,t,r,o)):t&&(_||(o.polygonStart(),_=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),_&&(o.polygonEnd(),_=!1),h=p=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}},x=Re(),b=e(x),_=!1;return y}}function Ie(t){return t.length>1}function Re(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:k,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Fe(t,e){return((t=t.x)[0]<0?t[1]-Hi-Ri:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-Ri:Hi-e[1])}function je(t){var e,r=NaN,n=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,i){var l=o>0?ji:-ji,s=bi(o-r);bi(s-ji)0?Hi:-Hi),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(l,n),t.point(o,n),e=0):a!==l&&s>=ji&&(bi(r-a)Ri?Math.atan((Math.sin(e)*(o=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(e))*Math.sin(t))/(a*o*i)):(e+n)/2}function Be(t,e,r,n){var a;if(null==t)a=r*Hi,n.point(-ji,a),n.point(0,a),n.point(ji,a),n.point(ji,0),n.point(ji,-a),n.point(0,-a),n.point(-ji,-a),n.point(-ji,0),n.point(-ji,a);else if(bi(t[0]-e[0])>Ri){var o=t[0]=0?1:-1,k=w*_,M=k>ji,A=p*x;if(Al.add(Math.atan2(A*w*Math.sin(k),g*b+A*Math.cos(k))),o+=M?_+w*qi:_,M^d>=r^v>=r){var T=xe(ve(f),ve(t));we(T);var L=xe(a,T);we(L);var z=(M^_>=0?-1:1)*nt(L[2]);(n>z||n===z&&(T[0]||T[1]))&&(i+=M^_>=0?1:-1)}if(!m++)break;d=v,p=x,g=b,f=t}}return(o<-Ri||oo}function r(t){var r,o,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var h,p=[f,d],g=e(f,d),m=i?g?0:a(f,d):g?a(f+(f<0?ji:-ji),d):0;if(!r&&(c=s=g)&&t.lineStart(),g!==s&&(h=n(r,p),(Me(r,h)||Me(p,h))&&(p[0]+=Ri,p[1]+=Ri,g=e(p[0],p[1]))),g!==s)u=0,g?(t.lineStart(),h=n(p,r),t.point(h[0],h[1])):(h=n(r,p),t.point(h[0],h[1]),t.lineEnd()),r=h;else if(l&&r&&i^g){var v;m&o||!(v=n(p,r,!0))||(u=0,i?(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||r&&Me(r,p)||t.point(p[0],p[1]),r=p,s=g,o=m},lineEnd:function(){s&&t.lineEnd(),r=null},clean:function(){return u|(c&&s)<<1}}}function n(t,e,r){var n=ve(t),a=ve(e),i=[1,0,0],l=xe(n,a),s=ye(l,l),c=l[0],u=s-c*c;if(!u)return!r&&t;var f=o*s/u,d=-o*c/u,h=xe(i,l),p=_e(i,f),g=_e(l,d);be(p,g);var m=h,v=ye(p,m),y=ye(m,m),x=v*v-y*(ye(p,p)-1);if(!(x<0)){var b=Math.sqrt(x),_=_e(m,(-v-b)/y);if(be(_,p),_=ke(_),!r)return _;var w,k=t[0],M=e[0],A=t[1],T=e[1];M0^_[1]<(bi(_[0]-k)ji^(k<=_[0]&&_[0]<=M)){var S=_e(m,(-v+b)/y);return be(S,p),[_,ke(S)]}}}function a(e,r){var n=i?t:ji-t,a=0;return e<-n?a|=1:e>n&&(a|=2),r<-n?a|=4:r>n&&(a|=8),a}var o=Math.cos(t),i=o>0,l=bi(o)>Ri,s=mr(t,6*Vi);return Ee(e,r,s,i?[0,-t]:[-ji,t-ji])}function Ze(t,e,r,n){return function(a){var o,i=a.a,l=a.b,s=i.x,c=i.y,u=l.x,f=l.y,d=0,h=1,p=u-s,g=f-c;if(o=t-s,p||!(o>0)){if(o/=p,p<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=r-s,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>d&&(d=o)}else if(p>0){if(o0)){if(o/=g,g<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=n-c,g||!(o<0)){if(o/=g,g<0){if(o>h)return;o>d&&(d=o)}else if(g>0){if(o0&&(a.a={x:s+d*p,y:c+d*g}),h<1&&(a.b={x:s+h*p,y:c+h*g}),a}}}}}}function Xe(t,e,r,n){function a(n,a){return bi(n[0]-t)0?0:3:bi(n[0]-r)0?2:1:bi(n[1]-e)0?1:0:a>0?3:2}function o(t,e){return i(t.x,e.x)}function i(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]}return function(l){function s(t){for(var e=0,r=m.length,n=t[1],a=0;an&&et(c,o,t)>0&&++e:o[1]<=n&&et(c,o,t)<0&&--e,c=o;return 0!==e}function c(o,l,s,c){var u=0,f=0;if(null==o||(u=a(o,s))!==(f=a(l,s))||i(o,l)<0^s>0){do c.point(0===u||3===u?t:r,u>1?n:e);while((u=(u+s+4)%4)!==f)}else c.point(l[0],l[1])}function u(a,o){return t<=a&&a<=r&&e<=o&&o<=n}function f(t,e){u(t,e)&&l.point(t,e)}function d(){C.point=p,m&&m.push(v=[]),M=!0,k=!1,_=w=NaN}function h(){g&&(p(y,x),b&&k&&L.rejoin(),g.push(L.buffer())),C.point=f,k&&l.lineEnd()}function p(t,e){t=Math.max(-ql,Math.min(ql,t)),e=Math.max(-ql,Math.min(ql,e));var r=u(t,e);if(m&&v.push([t,e]),M)y=t,x=e,b=r,M=!1,r&&(l.lineStart(),l.point(t,e));else if(r&&k)l.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};z(n)?(k||(l.lineStart(),l.point(n.a.x,n.a.y)),l.point(n.b.x,n.b.y),r||l.lineEnd(),A=!1):r&&(l.lineStart(),l.point(t,e),A=!1)}_=t,w=e,k=r}var g,m,v,y,x,b,_,w,k,M,A,T=l,L=Re(),z=Ze(t,e,r,n),C={point:f,lineStart:d,lineEnd:h,polygonStart:function(){l=L,g=[],m=[],A=!0},polygonEnd:function(){l=T,g=ui.merge(g);var e=s([t,n]),r=A&&e,a=g.length;(r||a)&&(l.polygonStart(),r&&(l.lineStart(),c(null,null,1,l),l.lineEnd()),a&&De(g,o,e,c,l),l.polygonEnd()),g=m=v=null}};return C}}function Ue(t){var e=0,r=ji/3,n=sr(t),a=n(e,r);return a.parallels=function(t){return arguments.length?n(e=t[0]*ji/180,r=t[1]*ji/180):[e/ji*180,r/ji*180]},a}function Ge(t,e){function r(t,e){var r=Math.sqrt(o-2*a*Math.sin(e))/a;return[r*Math.sin(t*=a),i-r*Math.cos(t)]}var n=Math.sin(t),a=(n+Math.sin(e))/2,o=1+n*(2*a-n),i=Math.sqrt(o)/a;return r.invert=function(t,e){var r=i-e;return[Math.atan2(t,r)/a,nt((o-(t*t+r*r)*a*a)/(2*a))]},r}function Ye(){function t(t,e){Hl+=a*t-n*e,n=t,a=e}var e,r,n,a;Gl.point=function(o,i){Gl.point=t,e=n=o,r=a=i},Gl.lineEnd=function(){t(e,r)}}function We(t,e){tXl&&(Xl=t),eUl&&(Ul=e)}function Qe(){function t(t,e){i.push("M",t,",",e,o)}function e(t,e){i.push("M",t,",",e),l.point=r}function r(t,e){i.push("L",t,",",e)}function n(){l.point=t}function a(){i.push("Z")}var o=$e(4.5),i=[],l={point:t,lineStart:function(){l.point=e},lineEnd:n,polygonStart:function(){l.lineEnd=a},polygonEnd:function(){l.lineEnd=n,l.point=t},pointRadius:function(t){return o=$e(t),l},result:function(){if(i.length){var t=i.join("");return i=[],t}}};return l}function $e(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Je(t,e){Cl+=t,Sl+=e,++Ol}function Ke(){function t(t,n){var a=t-e,o=n-r,i=Math.sqrt(a*a+o*o);Dl+=i*(e+t)/2,Pl+=i*(r+n)/2,Nl+=i,Je(e=t,r=n)}var e,r;Wl.point=function(n,a){Wl.point=t,Je(e=n,r=a)}}function tr(){Wl.point=Je}function er(){function t(t,e){var r=t-n,o=e-a,i=Math.sqrt(r*r+o*o);Dl+=i*(n+t)/2,Pl+=i*(a+e)/2,Nl+=i,i=a*t-n*e,El+=i*(n+t),Il+=i*(a+e),Rl+=3*i,Je(n=t,a=e)}var e,r,n,a;Wl.point=function(o,i){Wl.point=t,Je(e=n=o,r=a=i)},Wl.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+i,r),t.arc(e,r,i,0,qi)}function r(e,r){t.moveTo(e,r),l.point=n}function n(e,r){t.lineTo(e,r)}function a(){l.point=e}function o(){t.closePath()}var i=4.5,l={point:e,lineStart:function(){l.point=r},lineEnd:a,polygonStart:function(){l.lineEnd=o},polygonEnd:function(){l.lineEnd=a,l.point=e},pointRadius:function(t){return i=t,l},result:k};return l}function nr(t){function e(t){return(l?n:r)(t)}function r(e){return ir(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})}function n(e){function r(r,n){r=t(r,n),e.point(r[0],r[1])}function n(){x=NaN,M.point=o,e.lineStart()}function o(r,n){var o=ve([r,n]),i=t(r,n);a(x,b,y,_,w,k,x=i[0],b=i[1],y=r,_=o[0],w=o[1],k=o[2],l,e),e.point(x,b)}function i(){M.point=r,e.lineEnd()}function s(){n(),M.point=c,M.lineEnd=u}function c(t,e){o(f=t,d=e),h=x,p=b,g=_,m=w,v=k,M.point=o}function u(){a(x,b,y,_,w,k,h,p,f,g,m,v,l,e),M.lineEnd=i,i()}var f,d,h,p,g,m,v,y,x,b,_,w,k,M={point:r,lineStart:n,lineEnd:i,polygonStart:function(){e.polygonStart(),M.lineStart=s},polygonEnd:function(){e.polygonEnd(),M.lineStart=n}};return M}function a(e,r,n,l,s,c,u,f,d,h,p,g,m,v){var y=u-e,x=f-r,b=y*y+x*x;if(b>4*o&&m--){var _=l+h,w=s+p,k=c+g,M=Math.sqrt(_*_+w*w+k*k),A=Math.asin(k/=M),T=bi(bi(k)-1)o||bi((y*S+x*O)/b-.5)>.3||l*h+s*p+c*g0&&16,e):Math.sqrt(o)},e}function ar(t){var e=nr(function(e,r){return t([e*Zi,r*Zi])});return function(t){return cr(e(t))}}function or(t){this.stream=t}function ir(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 lr(t){return sr(function(){return t})()}function sr(t){function e(t){return t=l(t[0]*Vi,t[1]*Vi),[t[0]*d+s,c-t[1]*d]}function r(t){return t=l.invert((t[0]-s)/d,(c-t[1])/d),t&&[t[0]*Zi,t[1]*Zi]}function n(){l=Se(i=dr(v,y,x),o);var t=o(g,m);return s=h-t[0]*d,c=p+t[1]*d,a()}function a(){return u&&(u.valid=!1,u=null),e}var o,i,l,s,c,u,f=nr(function(t,e){return t=o(t,e),[t[0]*d+s,c-t[1]*d]}),d=150,h=480,p=250,g=0,m=0,v=0,y=0,x=0,_=jl,w=b,k=null,M=null;return e.stream=function(t){return u&&(u.valid=!1),u=cr(_(i,f(w(t)))),u.valid=!0,u},e.clipAngle=function(t){return arguments.length?(_=null==t?(k=t,jl):Ve((k=+t)*Vi),a()):k},e.clipExtent=function(t){return arguments.length?(M=t,w=t?Xe(t[0][0],t[0][1],t[1][0],t[1][1]):b,a()):M},e.scale=function(t){return arguments.length?(d=+t,n()):d},e.translate=function(t){return arguments.length?(h=+t[0],p=+t[1],n()):[h,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Vi,m=t[1]%360*Vi,n()):[g*Zi,m*Zi]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Vi,y=t[1]%360*Vi,x=t.length>2?t[2]%360*Vi:0,n()):[v*Zi,y*Zi,x*Zi]},ui.rebind(e,f,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&r,n()}}function cr(t){return ir(t,function(e,r){t.point(e*Vi,r*Vi)})}function ur(t,e){return[t,e]}function fr(t,e){return[t>ji?t-qi:t<-ji?t+qi:t,e]}function dr(t,e,r){return t?e||r?Se(pr(t),gr(e,r)):pr(t):e||r?gr(e,r):fr}function hr(t){return function(e,r){return e+=t,[e>ji?e-qi:e<-ji?e+qi:e,r]}}function pr(t){var e=hr(t);return e.invert=hr(-t),e}function gr(t,e){function r(t,e){var r=Math.cos(e),l=Math.cos(t)*r,s=Math.sin(t)*r,c=Math.sin(e),u=c*n+l*a;return[Math.atan2(s*o-u*i,l*n-c*a),nt(u*o+s*i)]}var n=Math.cos(t),a=Math.sin(t),o=Math.cos(e),i=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),l=Math.cos(t)*r,s=Math.sin(t)*r,c=Math.sin(e),u=c*o-s*i;return[Math.atan2(s*o+c*i,l*n+u*a),nt(u*n-l*a)]},r}function mr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,o,i,l){var s=i*e;null!=a?(a=vr(r,a),o=vr(r,o),(i>0?ao)&&(a+=i*qi)):(a=t+i*qi,o=t-.5*s);for(var c,u=a;i>0?u>o:u0?e<-Hi+Ri&&(e=-Hi+Ri):e>Hi-Ri&&(e=Hi-Ri);var r=i/Math.pow(a(e),o);return[r*Math.sin(o*t),i-r*Math.cos(o*t)]}var n=Math.cos(t),a=function(t){return Math.tan(ji/4+t/2)},o=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(a(e)/a(t)),i=n*Math.pow(a(t),o)/o;return o?(r.invert=function(t,e){var r=i-e,n=tt(o)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/o,2*Math.atan(Math.pow(i/n,1/o))-Hi]},r):Lr}function Tr(t,e){function r(t,e){var r=o-e;return[r*Math.sin(a*t),o-r*Math.cos(a*t)]}var n=Math.cos(t),a=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),o=n/a+t;return bi(a)1&&et(t[r[n-2]],t[r[n-1]],t[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function Pr(t,e){return t[0]-e[0]||t[1]-e[1]}function Nr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Er(t,e,r,n){var a=t[0],o=r[0],i=e[0]-a,l=n[0]-o,s=t[1],c=r[1],u=e[1]-s,f=n[1]-c,d=(l*(s-c)-f*(a-o))/(f*i-l*u);return[a+d*i,s+d*u]}function Ir(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Rr(){an(this),this.edge=this.site=this.circle=null}function Fr(t){var e=cs.pop()||new Rr;return e.site=t,e}function jr(t){Wr(t),is.remove(t),cs.push(t),an(t)}function qr(t){var e=t.circle,r=e.x,n=e.cy,a={x:r,y:n},o=t.P,i=t.N,l=[t];jr(t);for(var s=o;s.circle&&bi(r-s.circle.x)Ri)l=l.L;else{if(a=o-Vr(l,i),!(a>Ri)){n>-Ri?(e=l.P,r=l):a>-Ri?(e=l,r=l.N):e=r=l;break}if(!l.R){e=l;break}l=l.R}var s=Fr(t);if(is.insert(e,s),e||r){if(e===r)return Wr(e),r=Fr(e.site),is.insert(s,r),s.edge=r.edge=Kr(e.site,s.site),Yr(e),void Yr(r);if(!r)return void(s.edge=Kr(e.site,s.site));Wr(e),Wr(r);var c=e.site,u=c.x,f=c.y,d=t.x-u,h=t.y-f,p=r.site,g=p.x-u,m=p.y-f,v=2*(d*m-h*g),y=d*d+h*h,x=g*g+m*m,b={x:(m*y-h*x)/v+u,y:(d*x-g*y)/v+f};en(r.edge,c,p,b),s.edge=Kr(c,t,null,b),r.edge=Kr(t,p,null,b),Yr(e),Yr(r)}}function Hr(t,e){var r=t.site,n=r.x,a=r.y,o=a-e;if(!o)return n;var i=t.P;if(!i)return-(1/0);r=i.site;var l=r.x,s=r.y,c=s-e;if(!c)return l;var u=l-n,f=1/o-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-o/2)))/f+n:(n+l)/2}function Vr(t,e){var r=t.N;if(r)return Hr(r,e);var n=t.site;return n.y===e?n.x:1/0}function Zr(t){this.site=t,this.edges=[]}function Xr(t){for(var e,r,n,a,o,i,l,s,c,u,f=t[0][0],d=t[1][0],h=t[0][1],p=t[1][1],g=os,m=g.length;m--;)if(o=g[m],o&&o.prepare())for(l=o.edges,s=l.length,i=0;iRi||bi(a-r)>Ri)&&(l.splice(i,0,new rn(tn(o.site,u,bi(n-f)Ri?{x:f,y:bi(e-f)Ri?{x:bi(r-p)Ri?{x:d,y:bi(e-d)Ri?{x:bi(r-h)=-Fi)){var h=s*s+c*c,p=u*u+f*f,g=(f*h-c*p)/d,m=(s*p-u*h)/d,f=m+l,v=us.pop()||new Gr;v.arc=t,v.site=a,v.x=g+i,v.y=f+Math.sqrt(g*g+m*m),v.cy=f,t.circle=v;for(var y=null,x=ss._;x;)if(v.y=l)return;if(d>p){if(o){if(o.y>=c)return}else o={x:m,y:s};r={x:m,y:c}}else{if(o){if(o.y1)if(d>p){if(o){if(o.y>=c)return}else o={x:(s-a)/n,y:s};r={x:(c-a)/n,y:c}}else{if(o){if(o.y=l)return}else o={x:i,y:n*i+a};r={x:l,y:n*l+a}}else{if(o){if(o.xo||f>i||d=b,k=r>=_,M=k<<1|w,A=M+4;Mo&&(a=e.slice(o,a),l[i]?l[i]+=a:l[++i]=a),(r=r[0])===(n=n[0])?l[i]?l[i]+=n:l[++i]=n:(l[++i]=null,s.push({i:i,x:xn(r,n)})),o=hs.lastIndex;return o=0&&!(r=ui.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],a=[],o=t.length,i=e.length,l=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function Mn(t){return function(e){return 1-t(1-e)}}function An(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function Ln(t){return t*t*t}function zn(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 Cn(t){return function(e){return Math.pow(e,t)}}function Sn(t){return 1-Math.cos(t*Hi)}function On(t){return Math.pow(2,10*(t-1))}function Dn(t){return 1-Math.sqrt(1-t*t)}function Pn(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/qi*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*qi/e)}}function Nn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function En(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 In(t,e){t=ui.hcl(t),e=ui.hcl(e);var r=t.h,n=t.c,a=t.l,o=e.h-r,i=e.c-n,l=e.l-a;return isNaN(i)&&(i=0,n=isNaN(n)?e.c:n),isNaN(o)?(o=0,r=isNaN(r)?e.h:r):o>180?o-=360:o<-180&&(o+=360),function(t){return dt(r+o*t,n+i*t,a+l*t)+""}}function Rn(t,e){t=ui.hsl(t),e=ui.hsl(e);var r=t.h,n=t.s,a=t.l,o=e.h-r,i=e.s-n,l=e.l-a;return isNaN(i)&&(i=0,n=isNaN(n)?e.s:n),isNaN(o)?(o=0,r=isNaN(r)?e.h:r):o>180?o-=360:o<-180&&(o+=360),function(t){return ut(r+o*t,n+i*t,a+l*t)+""}}function Fn(t,e){t=ui.lab(t),e=ui.lab(e);var r=t.l,n=t.a,a=t.b,o=e.l-r,i=e.a-n,l=e.b-a;return function(t){return pt(r+o*t,n+i*t,a+l*t)+""}}function jn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function qn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Hn(e),a=Bn(e,r),o=Hn(Vn(r,e,-a))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(Zn(r)+"rotate(",null,")")-2,x:xn(t,e)})):e&&r.push(Zn(r)+"rotate("+e+")")}function Gn(t,e,r,n){t!==e?n.push({i:r.push(Zn(r)+"skewX(",null,")")-2,x:xn(t,e)}):e&&r.push(Zn(r)+"skewX("+e+")")}function Yn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(Zn(r)+"scale(",null,",",null,")");n.push({i:a-4,x:xn(t[0],e[0])},{i:a-2,x:xn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(Zn(r)+"scale("+e+")")}function Wn(t,e){var r=[],n=[];return t=ui.transform(t),e=ui.transform(e),Xn(t.translate,e.translate,r,n),Un(t.rotate,e.rotate,r,n),Gn(t.skew,e.skew,r,n),Yn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,a=-1,o=n.length;++a=0;)r.push(a[n])}function sa(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(o=t.children)&&(a=o.length))for(var a,o,i=-1;++ia&&(n=r,a=e);return n}function xa(t){return t.reduce(ba,0)}function ba(t,e){return t+e[1]}function _a(t,e){return wa(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wa(t,e){for(var r=-1,n=+t[0],a=(t[1]-n)/e,o=[];++r<=e;)o[r]=a*r+n;return o}function ka(t){return[ui.min(t),ui.max(t)]}function Ma(t,e){return t.value-e.value}function Aa(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ta(t,e){t._pack_next=e,e._pack_prev=t}function La(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 za(t){function e(t){u=Math.min(t.x-t.r,u),f=Math.max(t.x+t.r,f),d=Math.min(t.y-t.r,d),h=Math.max(t.y+t.r,h)}if((r=t.children)&&(c=r.length)){var r,n,a,o,i,l,s,c,u=1/0,f=-(1/0),d=1/0,h=-(1/0);if(r.forEach(Ca),n=r[0], +n.x=-n.r,n.y=0,e(n),c>1&&(a=r[1],a.x=a.r,a.y=0,e(a),c>2))for(o=r[2],Da(n,a,o),e(o),Aa(n,o),n._pack_prev=o,Aa(o,a),a=n._pack_next,i=3;i=0;)e=a[o],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function Fa(t,e,r){return t.a.parent===e.parent?t.a:r}function ja(t){return 1+ui.max(t,function(t){return t.y})}function qa(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ba(t){var e=t.children;return e&&e.length?Ba(e[0]):t}function Ha(t){var e,r=t.children;return r&&(e=r.length)?Ha(r[e-1]):t}function Va(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Za(t,e){var r=t.x+e[3],n=t.y+e[0],a=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return a<0&&(r+=a/2,a=0),o<0&&(n+=o/2,o=0),{x:r,y:n,dx:a,dy:o}}function Xa(t){var e=t[0],r=t[t.length-1];return e2?Qa:Ga,s=n?$n:Qn;return i=a(t,e,s,r),l=a(e,t,s,_n),o}function o(t){return i(t)}var i,l;return o.invert=function(t){return l(t)},o.domain=function(e){return arguments.length?(t=e.map(Number),a()):t},o.range=function(t){return arguments.length?(e=t,a()):e},o.rangeRound=function(t){return o.range(t).interpolate(jn)},o.clamp=function(t){return arguments.length?(n=t,a()):n},o.interpolate=function(t){return arguments.length?(r=t,a()):r},o.ticks=function(e){return eo(t,e)},o.tickFormat=function(e,r){return ro(t,e,r)},o.nice=function(e){return Ka(t,e),a()},o.copy=function(){return $a(t,e,r,n)},a()}function Ja(t,e){return ui.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ka(t,e){return Ya(t,Wa(to(t,e)[2])),Ya(t,Wa(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var r=Xa(t),n=r[1]-r[0],a=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),o=e/n*a;return o<=.15?a*=10:o<=.35?a*=5:o<=.75&&(a*=2),r[0]=Math.ceil(r[0]/a)*a,r[1]=Math.floor(r[1]/a)*a+.5*a,r[2]=a,r}function eo(t,e){return ui.range.apply(ui,to(t,e))}function ro(t,e,r){var n=to(t,e);if(r){var a=dl.exec(r);if(a.shift(),"s"===a[8]){var o=ui.formatPrefix(Math.max(bi(n[0]),bi(n[1])));return a[7]||(a[7]="."+no(o.scale(n[2]))),a[8]="f",r=ui.format(a.join("")),function(t){return r(o.scale(t))+o.symbol}}a[7]||(a[7]="."+ao(a[8],n)),r=a.join("")}else r=",."+no(n[2])+"f";return ui.format(r)}function no(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ao(t,e){var r=no(e[2]);return t in As?Math.abs(r-no(Math.max(bi(e[0]),bi(e[1]))))+ +("e"!==t):r-2*("%"===t)}function oo(t,e,r,n){function a(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function i(e){return t(a(e))}return i.invert=function(e){return o(t.invert(e))},i.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(a)),i):n},i.base=function(r){return arguments.length?(e=+r,t.domain(n.map(a)),i):e},i.nice=function(){var e=Ya(n.map(a),r?Math:Ls);return t.domain(e),n=e.map(o),i},i.ticks=function(){var t=Xa(n),i=[],l=t[0],s=t[1],c=Math.floor(a(l)),u=Math.ceil(a(s)),f=e%1?2:e;if(isFinite(u-c)){if(r){for(;c0;d--)i.push(o(c)*d);for(c=0;i[c]s;u--);i=i.slice(c,u)}return i},i.tickFormat=function(t,r){if(!arguments.length)return Ts;arguments.length<2?r=Ts:"function"!=typeof r&&(r=ui.format(r));var n=Math.max(1,e*t/i.ticks().length);return function(t){var i=t/o(Math.round(a(t)));return i*e0?l[r-1]:t[0],r0?0:1}function _o(t,e,r,n,a){var o=t[0]-e[0],i=t[1]-e[1],l=(a?n:-n)/Math.sqrt(o*o+i*i),s=l*i,c=-l*o,u=t[0]+s,f=t[1]+c,d=e[0]+s,h=e[1]+c,p=(u+d)/2,g=(f+h)/2,m=d-u,v=h-f,y=m*m+v*v,x=r-n,b=u*h-d*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-p,L=k-g,z=M-p,C=A-g;return T*T+L*L>z*z+C*C&&(w=M,k=A),[[w-s,k-c],[w*r/x,k*r/x]]}function wo(t){function e(e){function i(){c.push("M",o(t(u),l))}for(var s,c=[],u=[],f=-1,d=e.length,h=zt(r),p=zt(n);++f1?t.join("L"):t+"Z"}function Mo(t){return t.join("L")+"Z"}function Ao(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1&&a.push("H",n[0]),a.join("")}function To(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1){l=e[1],o=t[s],s++,n+="C"+(a[0]+i[0])+","+(a[1]+i[1])+","+(o[0]-l[0])+","+(o[1]-l[1])+","+o[0]+","+o[1];for(var c=2;c9&&(a=3*e/Math.sqrt(a),i[l]=a*r,i[l+1]=a*n));for(l=-1;++l<=s;)a=(t[Math.min(s,l+1)][0]-t[Math.max(0,l-1)][0])/(6*(1+i[l]*i[l])),o.push([a||0,i[l]*a||0]);return o}function Ho(t){return t.length<3?ko(t):t[0]+Oo(t,Bo(t))}function Vo(t){for(var e,r,n,a=-1,o=t.length;++a0;)h[--l].call(t,i);if(o>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var s,c,u,d,h,p=t[r]||(t[r]={active:0,count:0}),g=p[n];g||(s=a.time,c=Pt(o,0,s),g=p[n]={tween:new f,time:s,timer:c,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++p.count)}function ni(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function ai(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function oi(t){return t.toISOString()}function ii(t,e,r){function n(e){return t(e)}function a(t,r){var n=t[1]-t[0],a=n/r,o=ui.bisect(Js,a);return o==Js.length?[e.year,to(t.map(function(t){return t/31536e6}),r)[2]]:o?e[a/Js[o-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=li(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=li(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Xa(n.domain()),o=null==t?a(r,10):"number"==typeof t?a(r,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(r[0],li(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return ii(t.copy(),e,r)},Ja(n,t)}function li(t){return new Date(t)}function si(t){return JSON.parse(t.responseText)}function ci(t){var e=hi.createRange();return e.selectNode(hi.body),e.createContextualFragment(t.responseText)}var ui={version:"3.5.17"},fi=[].slice,di=function(t){return fi.call(t)},hi=this.document;if(hi)try{di(hi.documentElement.childNodes)[0].nodeType}catch(t){di=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}),hi)try{hi.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var pi=this.Element.prototype,gi=pi.setAttribute,mi=pi.setAttributeNS,vi=this.CSSStyleDeclaration.prototype,yi=vi.setProperty;pi.setAttribute=function(t,e){gi.call(this,t,e+"")},pi.setAttributeNS=function(t,e,r){mi.call(this,t,e,r+"")},vi.setProperty=function(t,e,r){yi.call(this,t,e+"",r)}}ui.ascending=a,ui.descending=function(t,e){return et?1:e>=t?0:NaN},ui.min=function(t,e){var r,n,a=-1,o=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},ui.max=function(t,e){var r,n,a=-1,o=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},ui.extent=function(t,e){var r,n,a,o=-1,i=t.length;if(1===arguments.length){for(;++o=n){r=a=n;break}for(;++on&&(r=n),a=n){r=a=n;break}for(;++on&&(r=n),a1)return s/(u-1)},ui.deviation=function(){var t=ui.variance.apply(this,arguments);return t?Math.sqrt(t):t};var xi=l(a);ui.bisectLeft=xi.left,ui.bisect=ui.bisectRight=xi.right,ui.bisector=function(t){return l(1===t.length?function(e,r){return a(t(e),r)}:t)},ui.shuffle=function(t,e,r){(o=arguments.length)<3&&(r=t.length,o<2&&(e=0));for(var n,a,o=r-e;o;)a=Math.random()*o--|0,n=t[o+e],t[o+e]=t[a+e],t[a+e]=n;return t},ui.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},ui.pairs=function(t){for(var e,r=0,n=t.length-1,a=t[0],o=new Array(n<0?0:n);r=0;)for(n=t[a],e=n.length;--e>=0;)r[--i]=n[e];return r};var bi=Math.abs;ui.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,a=[],o=c(bi(r)),i=-1;if(t*=o,e*=o,r*=o,r<0)for(;(n=t+r*++i)>e;)a.push(n/o);else for(;(n=t+r*++i)=o.length)return n?n.call(a,i):r?i.sort(r):i;for(var s,c,u,d,h=-1,p=i.length,g=o[l++],m=new f;++h=o.length)return t;var n=[],a=i[r++];return t.forEach(function(t,a){n.push({key:t,values:e(a,r)})}),a?n.sort(function(t,e){return a(t.key,e.key)}):n}var r,n,a={},o=[],i=[];return a.map=function(e,r){return t(r,e,0)},a.entries=function(r){return e(t(ui.map,r,0),0)},a.key=function(t){return o.push(t),a},a.sortKeys=function(t){return i[o.length-1]=t,a},a.sortValues=function(t){return r=t,a},a.rollup=function(t){return n=t,a},a},ui.set=function(t){var e=new x;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}},ui.event=null,ui.requote=function(t){return t.replace(Mi,"\\$&")};var Mi=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ai={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},Ti=function(t,e){return e.querySelector(t)},Li=function(t,e){return e.querySelectorAll(t)},zi=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(zi=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Ti=function(t,e){return Sizzle(t,e)[0]||null},Li=Sizzle,zi=Sizzle.matchesSelector),ui.selection=function(){return ui.select(hi.documentElement)};var Ci=ui.selection.prototype=[];Ci.select=function(t){var e,r,n,a,o=[];t=S(t);for(var i=-1,l=this.length;++i=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Oi.hasOwnProperty(r)?{space:Oi[r],local:t}:t}},Ci.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=ui.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(D(e,t[e]));return this}return this.each(D(t,e))},Ci.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=E(t)).length,a=-1;if(e=r.classList){for(;++a=0;)(r=n[a])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r);return this},Ci.sort=function(t){t=Z.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.transition().duration(C)),e.call(t.event)}function l(){_&&_.domain(b.range().map(function(t){return(t-M.x)/M.k}).map(b.invert)),k&&k.domain(w.range().map(function(t){return(t-M.y)/M.k}).map(w.invert))}function s(t){S++||t({type:"zoomstart"})}function c(t){l(),t({type:"zoom",scale:M.k,translate:[M.x,M.y]})}function u(t){--S||(t({type:"zoomend"}),m=null)}function f(){function t(){l=1,o(ui.mouse(a),d),c(i)}function r(){f.on(D,null).on(P,null),h(l),u(i)}var a=this,i=E.of(a,arguments),l=0,f=ui.select(n(a)).on(D,t).on(P,r),d=e(ui.mouse(a)),h=$(a);Hs.call(a),s(i)}function d(){function t(){var t=ui.touches(p);return h=M.k,t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))}),t}function r(){var e=ui.event.target;ui.select(e).on(b,n).on(_,l),w.push(e);for(var r=ui.event.changedTouches,a=0,o=r.length;a1){var u=s[0],f=s[1],d=u[0]-f[0],h=u[1]-f[1];v=d*d+h*h}}function n(){var t,e,r,n,i=ui.touches(p);Hs.call(p);for(var l=0,s=i.length;l=c)return i;if(a)return a=!1,o;var e=u;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,hl=ui.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=ui.round(t,Rt(t,e))).toFixed(Math.max(0,Math.min(20,Rt(t*(1+1e-15),e))))}}),pl=ui.time={},gl=Date;Bt.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(){ml.setUTCDate.apply(this._,arguments)},setDay:function(){ml.setUTCDay.apply(this._,arguments)},setFullYear:function(){ml.setUTCFullYear.apply(this._,arguments)},setHours:function(){ml.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ml.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ml.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ml.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ml.setUTCSeconds.apply(this._,arguments)},setTime:function(){ml.setTime.apply(this._,arguments)}};var ml=Date.prototype;pl.year=Ht(function(t){return t=pl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),pl.years=pl.year.range,pl.years.utc=pl.year.utc.range,pl.day=Ht(function(t){var e=new gl(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),pl.days=pl.day.range,pl.days.utc=pl.day.utc.range,pl.dayOfYear=function(t){var e=pl.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var r=pl[t]=Ht(function(t){return(t=pl.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var r=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});pl[t+"s"]=r.range,pl[t+"s"].utc=r.utc.range,pl[t+"OfYear"]=function(t){var r=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(r+e)%7)/7)}}),pl.week=pl.sunday,pl.weeks=pl.sunday.range,pl.weeks.utc=pl.sunday.utc.range,pl.weekOfYear=pl.sundayOfYear;var vl={"-":"",_:" ",0:"0"},yl=/^\s*\d+/,xl=/^%/;ui.locale=function(t){return{numberFormat:jt(t),timeFormat:Zt(t)}};var bl=ui.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"]});ui.format=bl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,_l),de(_l.s,this.s,this),this.s?this.t+=_l.t:this.s=_l.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _l=new fe;ui.geo.stream=function(t,e){t&&wl.hasOwnProperty(t.type)?wl[t.type](t,e):he(t,e)};var wl={Feature:function(t,e){he(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,a=r.length;++nh&&(h=e)}function e(e,r){var n=ve([e*Vi,r*Vi]);if(v){var a=xe(v,n),o=[a[1],-a[0],0],i=xe(o,a);we(i),i=ke(i);var s=e-p,c=s>0?1:-1,g=i[0]*Zi*c,m=bi(s)>180;if(m^(c*ph&&(h=y)}else if(g=(g+360)%360-180,m^(c*ph&&(h=r);m?el(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e):d>=u?(ed&&(d=e)):e>p?l(u,e)>l(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e)}else t(e,r);v=n,p=e}function r(){_.point=e}function n(){b[0]=u,b[1]=d,_.point=t,v=null}function a(t,r){if(v){var n=t-p;y+=bi(n)>180?n+(n>0?360:-360):n}else g=t,m=r;Tl.point(t,r),e(t,r)}function o(){Tl.lineStart()}function i(){a(g,m),Tl.lineEnd(),bi(y)>Ri&&(u=-(d=180)),b[0]=u,b[1]=d,v=null}function l(t,e){return(e-=t)<0?e+360:e}function s(t,e){return t[0]-e[0]}function c(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tRi?h=90:y<-Ri&&(f=-90),b[0]=u,b[1]=d}};return function(t){h=d=-(u=f=1/0),x=[],ui.geo.stream(t,_);var e=x.length;if(e){x.sort(s);for(var r,n=1,a=x[0],o=[a];nl(a[0],a[1])&&(a[1]=r[1]),l(r[0],a[1])>l(a[0],a[1])&&(a[0]=r[0])):o.push(a=r);for(var i,r,p=-(1/0),e=o.length-1,n=0,a=o[e];n<=e;a=r,++n)r=o[n],(i=l(a[1],r[0]))>p&&(p=i,u=r[0],d=a[1])}return x=b=null,u===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[u,f],[d,h]]}}(),ui.geo.centroid=function(t){Ll=zl=Cl=Sl=Ol=Dl=Pl=Nl=El=Il=Rl=0,ui.geo.stream(t,Fl);var e=El,r=Il,n=Rl,a=e*e+r*r+n*n;return a=.12&&a<.234&&n>=-.425&&n<-.214?i:a>=.166&&a<.234&&n>=-.214&&n<-.115?l:o).invert(t)},t.stream=function(t){var e=o.stream(t),r=i.stream(t),n=l.stream(t);return{point:function(t,a){e.point(t,a),r.point(t,a),n.point(t,a)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),i.precision(e),l.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),i.scale(.35*e),l.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var c=o.scale(),u=+e[0],f=+e[1];return r=o.translate(e).clipExtent([[u-.455*c,f-.238*c],[u+.455*c,f+.238*c]]).stream(s).point,n=i.translate([u-.307*c,f+.201*c]).clipExtent([[u-.425*c+Ri,f+.12*c+Ri],[u-.214*c-Ri,f+.234*c-Ri]]).stream(s).point,a=l.translate([u-.205*c,f+.212*c]).clipExtent([[u-.214*c+Ri,f+.166*c+Ri],[u-.115*c-Ri,f+.234*c-Ri]]).stream(s).point,t},t.scale(1070)};var Bl,Hl,Vl,Zl,Xl,Ul,Gl={point:k,lineStart:k,lineEnd:k,polygonStart:function(){Hl=0,Gl.lineStart=Ye},polygonEnd:function(){Gl.lineStart=Gl.lineEnd=Gl.point=k,Bl+=bi(Hl/2)}},Yl={point:We,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Wl={point:Je,lineStart:Ke,lineEnd:tr,polygonStart:function(){Wl.lineStart=er},polygonEnd:function(){Wl.point=Je,Wl.lineStart=Ke,Wl.lineEnd=tr}};ui.geo.path=function(){function t(t){return t&&("function"==typeof l&&o.pointRadius(+l.apply(this,arguments)),i&&i.valid||(i=a(o)),ui.geo.stream(t,i)),o.result()}function e(){return i=null,t}var r,n,a,o,i,l=4.5;return t.area=function(t){return Bl=0,ui.geo.stream(t,a(Gl)),Bl},t.centroid=function(t){return Cl=Sl=Ol=Dl=Pl=Nl=El=Il=Rl=0,ui.geo.stream(t,a(Wl)),Rl?[El/Rl,Il/Rl]:Nl?[Dl/Nl,Pl/Nl]:Ol?[Cl/Ol,Sl/Ol]:[NaN,NaN]},t.bounds=function(t){return Xl=Ul=-(Vl=Zl=1/0),ui.geo.stream(t,a(Yl)),[[Vl,Zl],[Xl,Ul]]},t.projection=function(t){return arguments.length?(a=(r=t)?t.stream||ar(t):b,e()):r},t.context=function(t){return arguments.length?(o=null==(n=t)?new Qe:new rr(t),"function"!=typeof l&&o.pointRadius(l),e()):n},t.pointRadius=function(e){return arguments.length?(l="function"==typeof e?e:(o.pointRadius(+e),+e),t):l},t.projection(ui.geo.albersUsa()).context(null)},ui.geo.transform=function(t){return{stream:function(e){var r=new or(e);for(var n in t)r[n]=t[n];return r}}},or.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ui.geo.projection=lr,ui.geo.projectionMutator=sr,(ui.geo.equirectangular=function(){return lr(ur)}).raw=ur.invert=ur,ui.geo.rotation=function(t){function e(e){return e=t(e[0]*Vi,e[1]*Vi),e[0]*=Zi,e[1]*=Zi,e}return t=dr(t[0]%360*Vi,t[1]*Vi,t.length>2?t[2]*Vi:0),e.invert=function(e){return e=t.invert(e[0]*Vi,e[1]*Vi),e[0]*=Zi,e[1]*=Zi,e},e},fr.invert=ur,ui.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=dr(-t[0]*Vi,-t[1]*Vi,0).invert,a=[];return r(null,null,1,{point:function(t,r){a.push(t=e(t,r)),t[0]*=Zi,t[1]*=Zi}}),{type:"Polygon",coordinates:[a]}}var e,r,n=[0,0],a=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=mr((e=+n)*Vi,a*Vi),t):e},t.precision=function(n){return arguments.length?(r=mr(e*Vi,(a=+n)*Vi),t):a},t.angle(90)},ui.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Vi,a=t[1]*Vi,o=e[1]*Vi,i=Math.sin(n),l=Math.cos(n),s=Math.sin(a),c=Math.cos(a),u=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((r=f*i)*r+(r=c*u-s*f*l)*r),s*u+c*f*l)},ui.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return ui.range(Math.ceil(o/m)*m,a,m).map(d).concat(ui.range(Math.ceil(c/v)*v,s,v).map(h)).concat(ui.range(Math.ceil(n/p)*p,r,p).filter(function(t){return bi(t%m)>Ri}).map(u)).concat(ui.range(Math.ceil(l/g)*g,i,g).filter(function(t){return bi(t%v)>Ri}).map(f))}var r,n,a,o,i,l,s,c,u,f,d,h,p=10,g=p,m=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[d(o).concat(h(s).slice(1),d(a).reverse().slice(1),h(c).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],a=+e[1][0],c=+e[0][1],s=+e[1][1],o>a&&(e=o,o=a,a=e),c>s&&(e=c,c=s,s=e),t.precision(y)):[[o,c],[a,s]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],l=+e[0][1],i=+e[1][1],n>r&&(e=n,n=r,r=e),l>i&&(e=l,l=i,i=e),t.precision(y)):[[n,l],[r,i]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(m=+e[0],v=+e[1],t):[m,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,u=yr(l,i,90),f=xr(n,r,y),d=yr(c,s,90),h=xr(o,a,y),t):y},t.majorExtent([[-180,-90+Ri],[180,90-Ri]]).minorExtent([[-180,-80-Ri],[180,80+Ri]])},ui.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||a.apply(this,arguments)]}}var e,r,n=br,a=_r;return t.distance=function(){return ui.geo.distance(e||n.apply(this,arguments),r||a.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(a=e,r="function"==typeof e?null:e,t):a},t.precision=function(){return arguments.length?t:0},t},ui.geo.interpolate=function(t,e){return wr(t[0]*Vi,t[1]*Vi,e[0]*Vi,e[1]*Vi)},ui.geo.length=function(t){return Ql=0,ui.geo.stream(t,$l),Ql};var Ql,$l={sphere:k,point:k,lineStart:kr,lineEnd:k,polygonStart:k,polygonEnd:k},Jl=Mr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return lr(Jl)}).raw=Jl;var Kl=Mr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return lr(Kl)}).raw=Kl,(ui.geo.conicConformal=function(){return Ue(Ar)}).raw=Ar,(ui.geo.conicEquidistant=function(){return Ue(Tr)}).raw=Tr;var ts=Mr(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return lr(ts)}).raw=ts,Lr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return zr(Lr)}).raw=Lr;var es=Mr(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return lr(es)}).raw=es;var rs=Mr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return lr(rs)}).raw=rs,Cr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Hi]},(ui.geo.transverseMercator=function(){var t=zr(Cr),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=Cr,ui.geom={},ui.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,a=zt(r),o=zt(n),i=t.length,l=[],s=[];for(e=0;e=0;--e)h.push(t[l[c[e]][2]]);for(e=+f;e=n&&c.x<=o&&c.y>=a&&c.y<=i?[[n,i],[o,i],[o,a],[n,a]]:[];u.point=t[l]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Ri)*Ri,y:Math.round(i(t,e)/Ri)*Ri,i:e}})}var n=Sr,a=Or,o=n,i=a,l=fs;return t?e(t):(e.links=function(t){return cn(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return cn(r(t)).cells.forEach(function(r,n){for(var a,o,i=r.site,l=r.edges.sort(Ur),s=-1,c=l.length,u=l[c-1].edge,f=u.l===i?u.r:u.l;++s=c,d=n>=u,h=d<<1|f;t.leaf=!1,t=t.nodes[h]||(t.nodes[h]=pn()),f?a=c:l=c,d?i=u:s=u,o(t,e,r,n,a,i,l,s)}var u,f,d,h,p,g,m,v,y,x=zt(l),b=zt(s);if(null!=e)g=e,m=r,v=n,y=a;else if(v=y=-(g=m=1/0),f=[],d=[],p=t.length,i)for(h=0;hv&&(v=u.x),u.y>y&&(y=u.y),f.push(u.x),d.push(u.y);else for(h=0;hv&&(v=_),w>y&&(y=w),f.push(_),d.push(w)}var k=v-g,M=y-m;k>M?y=m+k:v=g+M;var A=pn();if(A.add=function(t){o(A,t,+x(t,++h),+b(t,h),g,m,v,y)},A.visit=function(t){gn(t,A,g,m,v,y)},A.find=function(t){return mn(A,t[0],t[1],g,m,v,y)},h=-1,null==e){for(;++h=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=gs.get(r)||ps,n=ms.get(n)||b,kn(n(r.apply(null,fi.call(arguments,1))))},ui.interpolateHcl=In,ui.interpolateHsl=Rn,ui.interpolateLab=Fn,ui.interpolateRound=jn,ui.transform=function(t){var e=hi.createElementNS(ui.ns.prefix.svg,"g");return(ui.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new qn(r?r.matrix:vs)})(t)},qn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"; +};var vs={a:1,b:0,c:0,d:1,e:0,f:0};ui.interpolateTransform=Wn,ui.layout={},ui.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r0?a=t:(r.c=null,r.t=NaN,r=null,c.end({type:"end",alpha:a=0})):t>0&&(c.start({type:"start",alpha:a=t}),r=Pt(s.tick)),s):a},s.start=function(){function t(t,n){if(!r){for(r=new Array(a),s=0;s=0;)i.push(u=c[s]),u.parent=o,u.depth=o.depth+1;n&&(o.value=0),o.children=c}else n&&(o.value=+n.call(t,o,o.depth)||0),delete o.children;return sa(a,function(t){var r,a;e&&(r=t.children)&&r.sort(e),n&&(a=t.parent)&&(a.value+=t.value)}),l}var e=fa,r=ca,n=ua;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(la(e,function(t){t.children&&(t.value=0)}),sa(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0),(r=e.parent)&&(r.value+=e.value)})),e},t},ui.layout.partition=function(){function t(e,r,n,a){var o=e.children;if(e.x=r,e.y=e.depth*a,e.dx=n,e.dy=a,o&&(i=o.length)){var i,l,s,c=-1;for(n=e.value?n/e.value:0;++cl&&(l=n),i.push(n)}for(r=0;r0)for(o=-1;++o=u[0]&&l<=u[1]&&(i=s[ui.bisect(f,l,1,h)-1],i.y+=p,i.push(t[o]));return s}var e=!0,r=Number,n=ka,a=_a;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=zt(e),t):n},t.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return wa(t,e)}:zt(e),t):a},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},ui.layout.pack=function(){function t(t,o){var i=r.call(this,t,o),l=i[0],s=a[0],c=a[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(l.x=l.y=0,sa(l,function(t){t.r=+u(t.value)}),sa(l,za),n){var f=n*(e?1:Math.max(2*l.r/s,2*l.r/c))/2;sa(l,function(t){t.r+=f}),sa(l,za),sa(l,function(t){t.r-=f})}return Oa(l,s/2,c/2,e?1:1/Math.max(2*l.r/s,2*l.r/c)),i}var e,r=ui.layout.hierarchy().sort(Ma),n=0,a=[1,1];return t.size=function(e){return arguments.length?(a=e,t):a},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},ia(t,r)},ui.layout.tree=function(){function t(t,a){var u=i.call(this,t,a),f=u[0],d=e(f);if(sa(d,r),d.parent.m=-d.z,la(d,n),c)la(f,o);else{var h=f,p=f,g=f;la(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var m=l(h,p)/2-h.x,v=s[0]/(p.x+l(p,h)/2+m),y=s[1]/(g.depth||1);la(f,function(t){t.x=(t.x+m)*v,t.y=t.depth*y})}return u}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var a,o=e.children,i=0,l=o.length;i0&&(Ia(Fa(i,t,r),t,n),c+=n,u+=n),f+=i.m,c+=a.m,d+=s.m,u+=o.m;i&&!Ea(o)&&(o.t=i,o.m+=f-u),a&&!Na(s)&&(s.t=a,s.m+=c-d,r=t)}return r}function o(t){t.x*=s[0],t.y=t.depth*s[1]}var i=ui.layout.hierarchy().sort(null).value(null),l=Pa,s=[1,1],c=null;return t.separation=function(e){return arguments.length?(l=e,t):l},t.size=function(e){return arguments.length?(c=null==(s=e)?o:null,t):c?null:s},t.nodeSize=function(e){return arguments.length?(c=null==(s=e)?null:o,t):c?s:null},ia(t,i)},ui.layout.cluster=function(){function t(t,o){var i,l=e.call(this,t,o),s=l[0],c=0;sa(s,function(t){var e=t.children;e&&e.length?(t.x=qa(e),t.y=ja(e)):(t.x=i?c+=r(t,i):0,t.y=0,i=t)});var u=Ba(s),f=Ha(s),d=u.x-r(u,f)/2,h=f.x+r(f,u)/2;return sa(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-d)/(h-d)*n[0],t.y=(1-(s.y?t.y/s.y:1))*n[1]}),l}var e=ui.layout.hierarchy().sort(null).value(null),r=Pa,n=[1,1],a=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(a=null==(n=e),t):a?null:n},t.nodeSize=function(e){return arguments.length?(a=null!=(n=e),t):a?n:null},ia(t,e)},ui.layout.treemap=function(){function t(t,e){for(var r,n,a=-1,o=t.length;++a0;)u.push(i=d[s-1]),u.area+=i.area,"squarify"!==h||(l=n(u,g))<=p?(d.pop(),p=l):(u.area-=u.pop().area,a(u,g,c,!1),g=Math.min(c.dx,c.dy),u.length=u.area=0,p=1/0);u.length&&(a(u,g,c,!0),u.length=u.area=0),o.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var o,i=f(e),l=n.slice(),s=[];for(t(l,i.dx*i.dy/e.value),s.area=0;o=l.pop();)s.push(o),s.area+=o.area,null!=o.z&&(a(s,o.z?i.dx:i.dy,i,!l.length),s.length=s.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,a=0,o=1/0,i=-1,l=t.length;++ia&&(a=r));return n*=n,e*=e,n?Math.max(e*a*p/n,n/(e*o*p)):1/0}function a(t,e,r,n){var a,o=-1,i=t.length,l=r.x,c=r.y,u=e?s(t.area/e):0;if(e==r.dx){for((n||u>r.dy)&&(u=r.dy);++or.dx)&&(u=r.dx);++o1);return t+e*r*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=ui.random.normal.apply(ui,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ui.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;rf?0:1;if(c=Bi)return e(c,h)+(t?e(t,1-h):"")+"Z";var p,g,m,v,y,x,b,_,w,k,M,A,T=0,L=0,z=[];if((v=(+s.apply(this,arguments)||0)/2)&&(m=o===Ds?Math.sqrt(t*t+c*c):+o.apply(this,arguments),h||(L*=-1),c&&(L=nt(m/c*Math.sin(v))),t&&(T=nt(m/t*Math.sin(v)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var C=Math.abs(f-u-2*L)<=ji?0:1;if(L&&bo(y,x,b,_)===h^C){var S=(u+f)/2;y=c*Math.cos(S),x=c*Math.sin(S),b=_=null}}else y=x=0;if(t){w=t*Math.cos(f-T),k=t*Math.sin(f-T),M=t*Math.cos(u+T),A=t*Math.sin(u+T);var O=Math.abs(u-f+2*T)<=ji?0:1;if(T&&bo(w,k,M,A)===1-h^O){var D=(u+f)/2;w=t*Math.cos(D),k=t*Math.sin(D),M=A=null}}else w=k=0;if(d>Ri&&(p=Math.min(Math.abs(c-t)/2,+a.apply(this,arguments)))>.001){g=tji)+",1 "+e}function a(t,e,r,n){return"Q 0,0 "+n}var o=br,i=_r,l=Xo,s=vo,c=yo;return t.radius=function(e){return arguments.length?(l=zt(e),t):l},t.source=function(e){return arguments.length?(o=zt(e),t):o},t.target=function(e){return arguments.length?(i=zt(e),t):i},t.startAngle=function(e){return arguments.length?(s=zt(e),t):s},t.endAngle=function(e){return arguments.length?(c=zt(e),t):c},t},ui.svg.diagonal=function(){function t(t,a){var o=e.call(this,t,a),i=r.call(this,t,a),l=(o.y+i.y)/2,s=[o,{x:o.x,y:l},{x:i.x,y:l},i];return s=s.map(n),"M"+s[0]+"C"+s[1]+" "+s[2]+" "+s[3]}var e=br,r=_r,n=Uo;return t.source=function(r){return arguments.length?(e=zt(r),t):e},t.target=function(e){return arguments.length?(r=zt(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},ui.svg.diagonal.radial=function(){var t=ui.svg.diagonal(),e=Uo,r=t.projection;return t.projection=function(t){return arguments.length?r(Go(e=t)):e},t},ui.svg.symbol=function(){function t(t,n){return(Rs.get(e.call(this,t,n))||Qo)(r.call(this,t,n))}var e=Wo,r=Yo;return t.type=function(r){return arguments.length?(e=zt(r),t):e},t.size=function(e){return arguments.length?(r=zt(e),t):r},t};var Rs=ui.map({circle:Qo,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*js)),r=e*js;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/Fs),r=e*Fs/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Fs),r=e*Fs/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});ui.svg.symbolTypes=Rs.keys();var Fs=Math.sqrt(3),js=Math.tan(30*Vi);Ci.transition=function(t){for(var e,r,n=qs||++Zs,a=ei(t),o=[],i=Bs||{time:Date.now(),ease:zn,delay:0,duration:250},l=-1,s=this.length;++lrect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",d[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==ui.event.keyCode&&(C||(x=null,O[0]-=f[1],O[1]-=d[1],C=2),T())}function g(){32==ui.event.keyCode&&2==C&&(O[0]+=f[1],O[1]+=d[1],C=0,T())}function m(){var t=ui.mouse(_),n=!1;b&&(t[0]+=b[0],t[1]+=b[1]),C||(ui.event.altKey?(x||(x=[(f[0]+f[1])/2,(d[0]+d[1])/2]),O[0]=f[+(t[0]0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!a(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,o,l;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,n=-1,r===e||a(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(r)){for(l=o;l-- >0;)if(r[l]===e||r[l].listener&&r[l].listener===e){n=l;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(r=this._events[t],a(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],17:[function(t,e,r){"use strict";function n(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}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],18:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],a=e[2],o=e[3],i=r+r,l=n+n,s=a+a,c=r*i,u=n*i,f=n*l,d=a*i,h=a*l,p=a*s,g=o*i,m=o*l,v=o*s;return t[0]=1-f-p,t[1]=u+v,t[2]=d-m,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+m,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],19:[function(t,e,r){function n(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function i(t){if(d===clearTimeout)return clearTimeout(t);if((d===a||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{return d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}function l(){m&&p&&(m=!1,p.length?g=p.concat(g):v=-1,g.length&&s())}function s(){if(!m){var t=o(l);m=!0;for(var e=g.length;e;){for(p=g,g=[];++v1)for(var r=1;r.5?s/(2-o-i):s/(o+i),o){case t:n=(e-r)/s+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var a,o,i;if(t=z(t,360),e=z(e,100),r=z(r,100),0===e)a=o=i=r;else{var l=r<.5?r*(1+e):r+e-r*e,s=2*r-l;a=n(s,l,t+1/3),o=n(s,l,t),i=n(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function s(t,e,r){t=z(t,255),e=z(e,255),r=z(r,255);var n,a,o=X(t,e,r),i=Z(t,e,r),l=o,s=o-i;if(a=0===o?0:s/o,o==i)n=0;else{switch(o){case t:n=(e-r)/s+(e>1)+720)%360;--e;)a.h=(a.h+o)%360,i.push(n(a));return i}function A(t,e){e=e||6;for(var r=n(t).toHsv(),a=r.h,o=r.s,i=r.v,l=[],s=1/e;e--;)l.push(n({h:a,s:o,v:i})),i=(i+s)%1;return l}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function z(t,r){O(t)&&(t="100%");var n=D(t);return t=Z(r,X(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function C(t){return Z(1,X(0,t))}function S(t){return parseInt(t,16)}function O(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function D(t){return"string"==typeof t&&t.indexOf("%")!=-1}function P(t){return 1==t.length?"0"+t:""+t}function N(t){return t<=1&&(t=100*t+"%"),t}function E(t){return e.round(255*parseFloat(t)).toString(16)}function I(t){return S(t)/255}function R(t){return!!W.CSS_UNIT.exec(t)}function F(t){t=t.replace(q,"").replace(B,"").toLowerCase();var e=!1;if(G[t])t=G[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=W.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=W.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=W.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=W.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=W.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=W.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=W.hex8.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),a:I(r[4]),format:e?"name":"hex8"}:(r=W.hex6.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),format:e?"name":"hex"}:(r=W.hex4.exec(t))?{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),a:I(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=W.hex3.exec(t))&&{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),format:e?"name":"hex"}}function j(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var q=/^\s+/,B=/\s+$/,H=0,V=e.round,Z=e.min,X=e.max,U=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,a,o,i,l=this.toRgb();return t=l.r/255,r=l.g/255,n=l.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),o=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),i=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*a+.7152*o+.0722*i},setAlpha:function(t){return this._a=L(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*z(this._r,255))+"%",g:V(100*z(this._g,255))+"%",b:V(100*z(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*z(this._r,255))+"%, "+V(100*z(this._g,255))+"%, "+V(100*z(this._b,255))+"%)":"rgba("+V(100*z(this._r,255))+"%, "+V(100*z(this._g,255))+"%, "+V(100*z(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[u(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),r=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=n(t);r="#"+d(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,a=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?r[a]=t[a]:r[a]=N(t[a]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:U(),g:U(),b:U()})},n.mix=function(t,e,r){r=0===r?0:r||50;var a=n(t).toRgb(),o=n(e).toRgb(),i=r/100,l={r:(o.r-a.r)*i+a.r,g:(o.g-a.g)*i+a.g,b:(o.b-a.b)*i+a.b,a:(o.a-a.a)*i+a.a};return n(l)},n.readability=function(t,r){var a=n(t),o=n(r);return(e.max(a.getLuminance(),o.getLuminance())+.05)/(e.min(a.getLuminance(),o.getLuminance())+.05)},n.isReadable=function(t,e,r){var a,o,i=n.readability(t,e);switch(o=!1,a=j(r),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},n.mostReadable=function(t,e,r){var a,o,i,l,s=null,c=0;r=r||{},o=r.includeFallbackColors,i=r.level,l=r.size;for(var u=0;uc&&(c=a,s=n(e[u]));return n.isReadable(t,s,{level:i,size:l})||!o?s:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var G=n.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=n.hexNames=T(G),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],21:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../color"),o=t("../../plots/cartesian/axes"),i=t("./attributes");e.exports=function(t,e,r,l,s){function c(r,a){return n.coerce(t,e,i,r,a); +}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("opacity"),c("align"),c("bgcolor");var f=c("bordercolor"),d=a.opacity(f);c("borderpad");var h=c("borderwidth"),p=c("showarrow");c("text",p?" ":"new text"),c("textangle"),n.coerceFont(c,"font",r.font);for(var g=["x","y"],m=[-10,-30],v={_fullLayout:r},y=0;y<2;y++){var x=g[y],b=o.coerceRef(t,e,v,x,"","paper");if(o.coercePosition(e,v,c,b,x,.5),p){var _="a"+x,w=o.coerceRef(t,e,v,_,"pixel");"pixel"!==w&&w!==b&&(w=e[_]="pixel");var k="pixel"===w?m[y]:.4;o.coercePosition(e,v,c,w,_,k)}else c(x+"anchor")}return n.noneOrAll(t,e,["x","y"]),p&&(c("arrowcolor",d?e.bordercolor:a.defaultLine),c("arrowhead"),c("arrowsize"),c("arrowwidth",2*(d&&h||1)),n.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":122,"../../plots/cartesian/axes":149,"../color":30,"./attributes":23}],22:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],23:[function(t,e,r){"use strict";var n=t("./arrow_paths"),a=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),i=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:i({},a,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":119,"../../plots/cartesian/constants":154,"../../plots/font_attributes":169,"./arrow_paths":22}],24:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=o.getFromId(t,e.xref),n=o.getFromId(t,e.yref);if(r||n){var a=(e._xsize||0)/2,i=e._xshift||0,l=(e._ysize||0)/2,s=e._yshift||0,c=a-i,u=a+i,f=l-s,d=l+s;if(e.showarrow){var h=3*e.arrowsize*e.arrowwidth;c=Math.max(c,h),u=Math.max(u,h),f=Math.max(f,h),d=Math.max(d,h)}r&&r.autorange&&o.expand(r,[r.l2c(r.r2l(e.x))],{ppadplus:u,ppadminus:c}),n&&n.autorange&&o.expand(n,[n.l2c(n.r2l(e.y))],{ppadplus:d,ppadminus:f})}})}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.annotations);if(r.length&&t._fullData.length){var l={};r.forEach(function(t){l[t.xref]=!0,l[t.yref]=!0});var s=o.list(t).filter(function(t){return t.autorange&&l[t._id]});if(s.length)return a.syncOrAsync([i,n],t)}}},{"../../lib":122,"../../plots/cartesian/axes":149,"./draw":26}],25:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),a=t("./annotation_defaults");e.exports=function(t,e){var r={name:"annotations",handleItemDefaults:a};n(t,e,r)}},{"../../plots/array_container_defaults":146,"./annotation_defaults":21}],26:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=$.select(".annotation-math-group"),a=!n.empty(),l=h.bBox((a?n:nt).node()),c=l.width,p=l.height,v=Math.round(c+2*tt),y=Math.round(p+2*tt);Z._w=c,Z._h=p;var b=!1;if(["x","y"].forEach(function(e){var n,a=Z[e+"ref"]||e,o=f.getFromId(t,a),i=(Y+("x"===e?0:90))*Math.PI/180,l=v*Math.abs(Math.cos(i))+y*Math.abs(Math.sin(i)),s=Z[e+"anchor"];if(o){var c=o.r2fraction(Z[e]);if(!o.autorange&&(c<0||c>1)&&(Z["a"+e+"ref"]===a?(c=o.r2fraction(Z["a"+e]),(c<0||c>1)&&(b=!0)):b=!0,b))return;G[e]=o._offset+o.r2p(Z[e]),n=.5}else n=Z[e],"y"===e&&(n=1-n),G[e]="x"===e?O.l+O.w*n:O.t+O.h*n;var u=0;Z["a"+e+"ref"]===a?G["aa"+e]=o._offset+o.r2p(Z["a"+e]):(u=Z.showarrow?Z["a"+e]:l*r(n,s),G[e]+=u),Z["_"+e+"type"]=o&&o.type,Z["_"+e+"size"]=l,Z["_"+e+"shift"]=u}),b)return void $.remove();var _,w;Z.showarrow&&(_=Z.axref===Z.xref?G.x:u.constrain(G.x-Z.ax,1,M.width-1),w=Z.ayref===Z.yref?G.y:u.constrain(G.y-Z.ay,1,M.height-1)),G.x=u.constrain(G.x,1,M.width-1),G.y=u.constrain(G.y,1,M.height-1);var k=tt-l.top,A=tt-l.left;a?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:A,y:k}),nt.selectAll("tspan.line").attr({y:k,x:A})),et.call(h.setRect,J/2,J/2,v-J,y-J);var T=0,L=0;T=Z.axref===Z.xref?Math.round(G.aax-v/2):Math.round(G.x-v/2),L=Z.ayref===Z.yref?Math.round(G.aay-y/2):Math.round(G.y-y/2),$.call(u.setTranslate,T,L);var z="annotations["+e+"]",C=function(r,n){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=Z.axref===Z.xref?G.aax+r:G.x+r,l=Z.ayref===Z.yref?G.aay+n:G.y+n;var c=u.rotationXYMatrix(Y,a,l),f=u.apply2DTransform(c),h=u.apply2DTransform2(c),p=et.attr("width")/2,g=et.attr("height")/2,v=[[a-p,l-g,a-p,l+g],[a-p,l+g,a+p,l+g],[a+p,l+g,a+p,l-g],[a+p,l-g,a-p,l-g]].map(h);if(!v.reduce(function(t,e){return t^!!o(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=o(a,l,_,w,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var y=Z.arrowwidth,b=Z.arrowcolor,k=W.append("g").style({opacity:d.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=k.append("path").attr("d","M"+a+","+l+"L"+_+","+w).style("stroke-width",y+"px").call(d.stroke,d.rgb(b));x(M,Z.arrowhead,"end",Z.arrowsize);var A=k.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-_)+","+(l-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,C;m.init({element:A.node(),prepFn:function(){var t=u.getTranslate($);L=t.x,C=t.y,T={},X&&X.autorange&&(T[X._name+".autorange"]=!0),U&&U.autorange&&(T[U._name+".autorange"]=!0)},moveFn:function(t,e){k.attr("transform","translate("+t+","+e+")");var r=f(L,C),n=r[0]+t,a=r[1]+e;$.call(u.setTranslate,n,a),T[z+".x"]=X?X.p2r(X.r2p(Z.x)+t):(_+t-O.l)/O.w,T[z+".y"]=U?U.p2r(U.r2p(Z.y)+e):1-(w+e-O.t)/O.h,Z.axref===Z.xref&&(T[z+".ax"]=X?X.p2r(X.r2p(Z.ax)+t):(_+t-O.l)/O.w),Z.ayref===Z.yref&&(T[z+".ay"]=U?U.p2r(U.r2p(Z.ay)+e):1-(w+e-O.t)/O.h),Q.attr({transform:"rotate("+Y+","+n+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};Z.showarrow&&C(0,0);var S=u.rotationXYMatrix(Y,G.x,G.y),D=u.apply2DTransform(S);if(t._context.editable){var P,N,E;m.init({element:$.node(),prepFn:function(){var t=u.getTranslate($);P=t.x,N=t.y,E={}},moveFn:function(t,e){$.call(u.setTranslate,P+t,N+e);var r="pointer";if(Z.showarrow)Z.axref===Z.xref?E[z+".ax"]=X.p2r(X.r2p(Z.ax)+t):E[z+".ax"]=Z.ax+t,Z.ayref===Z.yref?E[z+".ay"]=U.p2r(U.r2p(Z.ay)+e):E[z+".ay"]=Z.ay+e,C(t,e);else{if(X)E[z+".x"]=Z.x+t/X._m;else{var n=Z._xsize/O.w,a=Z.x+Z._xshift/O.w-n/2;E[z+".x"]=m.align(a+t/O.w,n,0,1,Z.xanchor)}if(U)E[z+".y"]=Z.y+e/U._m;else{var o=Z._ysize/O.h,i=Z.y-Z._yshift/O.h-o/2;E[z+".y"]=m.align(i-e/O.h,o,0,1,Z.yanchor)}X&&U||(r=m.getCursor(X?.5:E[z+".x"],U?.5:E[z+".y"],Z.xanchor,Z.yanchor))}var l=D(P,N),s=l[0]+t,c=l[1]+e;$.call(u.setTranslate,P+t,N+e),Q.attr({transform:"rotate("+Y+","+s+","+c+")"}),g($,r)},doneFn:function(e){if(g($),e){s.relayout(t,E);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,k=t.layout,M=t._fullLayout;if(!l(e)||e===-1){if(!e&&Array.isArray(c))return k.annotations=c,y(k,M),void n(t);if("remove"===c)return delete k.annotations,M.annotations=[],void n(t);if(r&&"add"!==c){for(w=0;we;w--)M._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),a(t,w)}}M._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=k.annotations[e],L=M.annotations[e];if(T){var z={};"string"==typeof r&&r?z[r]=c:u.isPlainObject(r)&&(z=r);var C=Object.keys(z);for(w=0;w4/3&&(R=H)}}else I&&(j&&(R<1/3?R+=B:R>2/3&&(R-=B)),R=(R-I.domain[0])/(I.domain[1]-I.domain[0]),R=I.fraction2r(R))}I&&I===E&&F&&("log"===F&&"log"!==I.type?R=Math.pow(10,R):"log"!==F&&"log"===I.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),T[N]=R}}var Z={};v(T,Z,M),M.annotations[e]=Z;var X=f.getFromId(t,Z.xref),U=f.getFromId(t,Z.yref),G={x:0,y:0},Y=+Z.textangle||0,W=M._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",Z.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:Z})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),J=Z.borderwidth,K=Z.borderpad,tt=J+K,et=$.append("rect").attr("class","bg").style("stroke-width",J+"px").call(d.stroke,Z.bordercolor).call(d.fill,Z.bgcolor),rt=Z.font,nt=$.append("text").classed("annotation",!0).attr("data-unformatted",Z.text).text(Z.text);t._context.editable?nt.call(p.makeEditable,$).call(b).on("edit",function(r){Z.text=r,this.attr({"data-unformatted":Z.text}),this.call(b);var n={};n["annotations["+e+"].text"]=Z.text,X&&X.autorange&&(n[X._name+".autorange"]=!0),U&&U.autorange&&(n[U._name+".autorange"]=!0),s.relayout(t,n)}):nt.call(b),Q.attr({transform:"rotate("+Y+","+G.x+","+G.y+")"}).call(h.setPosition,G.x,G.y)}}}function o(t,e,r,n,a,o,i,l){var s=r-t,c=a-t,u=i-a,f=n-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,m=(c*f-s*d)/p;return m<0||m>1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:n,drawOne:a}},{"../../lib":122,"../../lib/setcursor":132,"../../lib/svg_text_utils":134,"../../plotly":144,"../../plots/cartesian/axes":149,"../../plots/plots":173,"../color":30,"../dragelement":51,"../drawing":53,"./annotation_defaults":21,"./defaults":25,"./draw_arrow_head":27,d3:14,"fast-isnumeric":17}],27:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),o=t("../color"),i=t("../drawing"),l=t("./arrow_paths");e.exports=function(t,e,r,s){a(s)||(s=1);var c=t.node(),u=l[e||0];if(u){"string"==typeof r&&r||(r="end");var f,d,h,p,g=(i.getPx(t,"stroke-width")||1)*s,m=t.style("stroke")||o.defaultLine,v=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,x=r.indexOf("end")>=0,b=u.backoff*g;if("line"===c.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},d={x:+t.attr("x2"),y:+t.attr("y2")},h=Math.atan2(f.y-d.y,f.x-d.x),p=h+Math.PI,b){var _=b*Math.cos(h),w=b*Math.sin(h);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(d.x+=_,d.y+=w,t.attr({x2:d.x,y2:d.y}))}}else if("path"===c.nodeName){var k=c.getTotalLength(),M="";if(y){var A=c.getPointAtLength(0),T=c.getPointAtLength(.1);h=Math.atan2(A.y-T.y,A.x-T.x),f=c.getPointAtLength(Math.min(b,k)),b&&(M="0px,"+b+"px,")}if(x){var L=c.getPointAtLength(k),z=c.getPointAtLength(k-.1);if(p=Math.atan2(L.y-z.y,L.x-z.x),d=c.getPointAtLength(Math.max(0,k-b)),b){var C=M?2*b:b;M+=k-C+"px,"+k+"px"}}else M&&(M+=k+"px");M&&t.style("stroke-dasharray",M)}var S=function(r,a){e>5&&(a=0),n.select(c.parentElement).append("path").attr({class:t.attr("class"),d:u.path,transform:"translate("+r.x+","+r.y+")rotate("+180*a/Math.PI+")scale("+g+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&S(f,h),x&&S(d,p)}}},{"../color":30,"../drawing":53,"./arrow_paths":22,d3:14,"fast-isnumeric":17}],28:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":23,"./calc_autorange":24,"./defaults":25,"./draw":26}],29:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],30:[function(t,e,r){"use strict";function n(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===n.length;if(!a&&3!==n.length)return t;for(var i=0;i=0))return t;if(3===i)n[i]>1&&(n[i]=1);else if(n[i]>=1)return t}var l=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return a?"rgba("+l+", "+n[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var r=a(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},i.combine=function(t,e){var r=a(t).toRgb();if(1===r.a)return a(t).toRgbString();var n=a(e||i.background).toRgb(),o=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},l={r:o.r*(1-r.a)+r.r*r.a,g:o.g*(1-r.a)+r.g*r.a,b:o.b*(1-r.a)+r.b*r.a};return a(l).toRgbString()},i.contrast=function(t,e,r){var n=a(t),o=n.isLight()?n.darken(r):n.lighten(e);return o.toString()},i.stroke=function(t,e){var r=a(e);t.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(t,e){var r=a(e);t.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,r,a,o,l=Object.keys(t);for(e=0;el&&(o[1]-=(lt-l)/2)):r.node()&&!r.classed("js-placeholder")&&(lt=h.bBox(e.node()).height),lt){if(lt+=5,"top"===_.titleside)K.domain[1]-=lt/T.h,o[1]*=-1;else{K.domain[0]+=lt/T.h;var c=Math.max(1,r.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),K.setScale()}}ot.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-K.domain[1]))+")");var f=ot.select(".cbfills").selectAll("rect.cbfill").data(S);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?z[0]:(S[e]+S[e-1])/2,e===S.length-1?z[1]:(S[e]+S[e+1])/2].map(K.c2p).map(Math.round);e!==S.length-1&&(r[1]+=r[1]>r[0]?1:-1);var o=D(t).replace("e-",""),i=a(o).toHexString();n.select(this).attr({x:G,width:Math.max(q,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:i})});var d=ot.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?C:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){n.select(this).attr("d","M"+G+","+(Math.round(K.c2p(t))+_.line.width/2%1)+"h"+q).call(h.lineGroupStyle,_.line.width,O(t),_.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=G+q+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=K.titlefont.size,r=K._offset+K._length/2,a=T.l+(K.position||0)*T.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));k("h"+K._id+"title",{avoid:{selection:n.select(t).selectAll("g."+K._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:A.width},attributes:{x:a,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function k(e,r){var n,a=b();n=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:K,propName:n,traceIndex:a.index,dfltName:"colorscale",containerGroup:ot.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;ot.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,r||{}))}function M(){var r=q+_.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(R=it.select("text"),R.node()&&!R.classed("js-placeholder")){var n,a=it.select(".h"+K._id+"title-math-group").node();n=a&&["top","bottom"].indexOf(_.titleside)!==-1?h.bBox(a).width:h.bBox(it.node()).right-G-T.l,r=Math.max(r,n)}var o=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,l=Q-$;ot.select(".cbbg").attr({x:G-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-X,width:Math.max(o,2),height:Math.max(l+2*X,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),ot.selectAll(".cboutline").attr({x:G,y:$+_.ypad+("top"===_.titleside?lt:0),width:Math.max(q,2),height:Math.max(l-2*_.ypad-lt,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var s=({center:.5,right:1}[_.xanchor]||0)*o;ot.attr("transform","translate("+(T.l-s)+","+T.t+")"),i.autoMargin(t,e,{x:_.x,y:_.y,l:o*({right:1,center:.5}[_.xanchor]||0),r:o*({left:1,center:.5}[_.xanchor]||0),t:l*({bottom:1,middle:.5}[_.yanchor]||0),b:l*({top:1,middle:.5}[_.yanchor]||0)})}var A=t._fullLayout,T=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var L,z=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),C=[],S=[],O="function"==typeof _.line.color?_.line.color:function(){return _.line.color},D="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},P=_.levels.end+_.levels.size/100,N=_.levels.size,E=1.001*z[0]-.001*z[1],I=1.001*z[1]-.001*z[0];for(L=_.levels.start;(L-P)*N<0;L+=N)L>E&&Lz[0]&&L1){var at=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=at*u.roundUp(nt/at,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+U,W+V-U],K.setScale();var ot=A._infolayer.selectAll("g."+e).data([0]);ot.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),ot.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var it=ot.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");K._axislayer=ot.select(".cbaxis");var lt=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var st,ct=T.l+(_.x+Z)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-U))*T.h+T.t+3+.75*ut:(1-(W+U))*T.h+T.t-3-.25*ut,k(K._id+"title",{attributes:{x:ct,y:st,"text-anchor":"start"}})}var ft=u.syncOrAsync([i.previousPromises,w,i.previousPromises,M],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var dt,ht,pt;c.init({element:ot.node(),prepFn:function(){dt=ot.attr("transform"),d(ot)},moveFn:function(t,e){ot.attr("transform",dt+" translate("+t+","+e+")"),ht=c.align(Y+t/T.w,B,0,1,_.xanchor),pt=c.align(W-e/T.h,V,0,1,_.yanchor);var r=c.getCursor(ht,pt,_.xanchor,_.yanchor);d(ot,r)},doneFn:function(e){d(ot),e&&void 0!==ht&&void 0!==pt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":pt},b().index)}})}return ft}function b(){var r,n,a=e.substr(2);for(r=0;r=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":122,"./flip_scale":41,"./scales":48}],37:[function(t,e,r){"use strict";var n=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},n.colorscale,{}),cauto:a({},n.zauto,{}),cmax:a({},n.zmax,{}),cmin:a({},n.zmin,{}),autocolorscale:a({},n.autocolorscale,{}),reversescale:a({},n.reversescale,{})}}},{"../../lib/extend":119,"./attributes":35,"./scales.js":48}],38:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":48}],39:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,r,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,m=p[d+"min"],v=p[d+"max"],y=p.colorscale,x=n(m)&&n(v)&&m=0;a--,o++)e=t[a],n[o]=[1-e[0],e[1]];return n}},{}],42:[function(t,e,r){"use strict";var n=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=a),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),o(t)?t:e):e}},{"./default_scale":38,"./is_valid_scale_array":46,"./scales":48}],43:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var r=e?a.nestedProperty(t,e).get()||{}:t,i=r.color,l=!1;if(Array.isArray(i))for(var s=0;s4/3-l?i:l}},{}],50:[function(t,e,r){"use strict";var n=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,o){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:n.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":122}],51:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),h.dispatchEvent(r)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=n},{"../../lib":122,"../../plotly":144,"../../plots/cartesian/constants":154,"./align":49,"./cursor":50,"./unhover":52}],52:[function(t,e,r){"use strict";var n=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,r)},a.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":118}],53:[function(t,e,r){"use strict";function n(t,e,r,n,a,o,i){if(l.traceIs(r,"symbols")){var c=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(r)?c(t.ms):(o.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||o.symbol)||0,a=n%100;return t.om=n%200>=100,g.symbolFuncs[a](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=n(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,r,n){var a=t[0]-e[0],i=t[1]-e[1],l=r[0]-e[0],s=r[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*n,d=(u*u*i-c*c*s)*n,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,a){t.call(g.setPosition,e,r).call(g.setSize,n,a)},g.translatePoint=function(t,e,r,n){var a=t.xp||r.c2p(t.x),o=t.yp||n.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=r||o.width||0,l=a||o.dash||"";s.stroke(e,n||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=n||a.dash||"";o.select(this).call(s.stroke,r||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=o.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),r.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var a=r.marker,o=a.line,i=g.tryColorscale(a,""),l=g.tryColorscale(a,"line");n(t,e,r,i,l,a,o)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),a=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,o.select(this),e,n,a)})}},g.tryColorscale=function(t,e){var r=e?u.nestedProperty(t,e).get():t,n=r.colorscale,a=r.color;return n&&Array.isArray(a)?c.makeColorScaleFunc(c.extractScale(n,r.cmin,r.cmax)):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=o.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,r.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(n).call(f.convertToTspans);var d=o.select(this.parentNode),h=r.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,m=x[s]*u,v=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+m+","+v+")"),p>1&&h.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],o=[];for(r=1;r=A&&(o.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=o.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":112,"../../lib":122,"../../lib/svg_text_utils":134,"../../registry":188,"../../traces/scatter/make_bubble_size_func":286,"../../traces/scatter/subtypes":291,"../color":30,"../colorscale":44,"./symbol_defs":54,d3:14,"fast-isnumeric":17}],54:[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,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+r+a+o+a+o+i+o+i+r+i+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),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(2*t/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(2*t/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(2*t/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(.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),a=n.round(-t,2),o=n.round(t*-.309,2),i=n.round(.809*t,2);return"M"+e+","+o+"L"+r+","+i+"H-"+r+"L-"+e+","+o+"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(.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),a=n.round(.951*e,2),o=n.round(.363*e,2),i=n.round(.588*e,2),l=n.round(-e,2),s=n.round(e*-.309,2),c=n.round(.118*e,2),u=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+r+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),a=n.round(.76*t,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(.8*t,2),a=n.round(1.6*t,2),o=n.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+r+i+e+","+r+i+"0,-"+a+i+"-"+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),a=n.round(1.6*t,2),o=n.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+r+i+"-"+e+",-"+r+i+"0,"+a+i+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,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(1.4*t,2),r=n.round(1.9*t,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:14}],55:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],56:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e["error_"+n]||{},s=o.visible&&["linear","log"].indexOf(r.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var m=g.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=n(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");l=!m.size(),l?m=e.append("path").classed("yerror",!0):u&&(m=m.transition().duration(r.duration).ease(r.easing)),m.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var v=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-v)+"v"+2*v+"m0,-"+v+"H"+i.xs,i.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":291,d3:14,"fast-isnumeric":17}],61:[function(t,e,r){"use strict";var n=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},o=e.error_x||{},i=n.select(this);i.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),o.copy_ystyle&&(o=r),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":30,d3:14}],62:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":154}],63:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,l,r,n)}var i=n("source"),s=n("visible",!!i);if(!s)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var c={_fullLayout:r},u=["x","y"],f=0;f<2;f++)o.coerceRef(t,e,c,u[f],"paper");return e}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("../../plots/array_container_defaults"),l=t("./attributes"),s="images";e.exports=function(t,e){var r={name:s,handleItemDefaults:n};i(t,e,r)}},{"../../lib":122,"../../plots/array_container_defaults":146,"../../plots/cartesian/axes":149,"./attributes":62}],64:[function(t,e,r){"use strict";var n=t("d3"),a=t("../drawing"),o=t("../../plots/cartesian/axes"),i=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",i.svg);var a=new Promise(function(t){function n(){r.remove(),t()}var a=new Image;this.img=a,a.setAttribute("crossOrigin","anonymous"),a.onerror=n,a.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),a.src=e.source}.bind(this));t._promises.push(a)}}function r(e){var r=n.select(this),i=o.getFromId(t,e.xref),s=o.getFromId(t,e.yref),c=l._size,u=i?Math.abs(i.l2p(e.sizex)-i.l2p(0)):e.sizex*c.w,f=s?Math.abs(s.l2p(e.sizey)-s.l2p(0)):e.sizey*c.h,d=u*h.x[e.xanchor].offset,p=f*h.y[e.yanchor].offset,g=h.x[e.xanchor].sizing+h.y[e.yanchor].sizing,m=(i?i.r2p(e.x)+i._offset:e.x*c.w+c.l)+d,v=(s?s.r2p(e.y)+s._offset:c.h-e.y*c.h+c.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:m,y:v,width:u,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=i?i._id:"",x=s?s._id:"",b=y+x;b&&r.call(a.setClipUrl,"clip"+l._uid+b)}for(var l=t._fullLayout,s=[],c=[],u=[],f=0;f=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}},{}],67:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat; +e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":119,"../../plots/font_attributes":169,"../color/attributes":29}],68:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],69:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,r){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":122,"../../plots/layout_attributes":171,"../../registry":188,"./attributes":67,"./helpers":72}],70:[function(t,e,r){"use strict";function n(t,e){function r(r){v.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(o,e)})}var n=t.data()[0][0],a=e._fullLayout,i=n.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?n.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var a,o=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=n.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(r)}function a(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=r.indexOf(f);d===-1?r.push(f):r.splice(d,1),u.relayout(e,"hiddenlabels",r)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;r=l*d,n=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}r=Math.max(r,16)+3,a.height=r,a.width=n}function i(t,e,r){var n=t._fullLayout,a=n.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.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,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),r.each(function(e){var r=e[0],n=c.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:a.width)+40,r.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;un.width-(n.margin.r+n.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+r,a.height=Math.max(a.height,e.height),x+=i+r,v=Math.max(e.height,v)}),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],n=c.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:a.width,r.height)})}}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var a="top";w.isBottomAnchor(r)?a="bottom":w.isMiddleAnchor(r)&&(a="middle"),d.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[a]||0),t:r.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),d.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),z.call(g.setRect,j,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){var v=r.legend,_=r.showlegend&&x(t.calcdata,v),k=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=r._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var z=M.selectAll("rect.scrollbar").data([0]);z.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var C=L.selectAll("g.groups").data(_);C.enter().append("g").attr("class","groups"),C.exit().remove();var S=C.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,C,S),l(t));var D=0,P=r.width,N=0,E=r.height;i(t,C,S),v.height>E?s(t):l(t);var I=r._size,R=I.l+I.w*v.x,F=I.t+I.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?F-=v.height:w.isMiddleAnchor(v)&&(F-=v.height/2);var j=v.width,q=I.w;j>q?(R=I.l,j=q):(R+j>P&&(R=P-j),RH?(F=I.t,B=H):(F+B>E&&(F=E-B),Fr[1])return r[1]}return a}function r(t){return t[0]}var n,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",r,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?n:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(n[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||n.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||r.color),e&&a.call(d.stroke,t.mlc||n.color)})}function i(t){var e=t[0].trace,r=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=s.select(this);n.style("stroke-width",r+"px").call(d.fill,t.fc||e.fillcolor),r&&n.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,r=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(n).each(a)}},{"../../lib":122,"../../registry":188,"../../traces/pie/style_one":269,"../../traces/scatter/subtypes":291,"../color":30,"../drawing":53,d3:14}],75:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),a=r.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===n){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),i(m,r);u&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),d&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!c&&!p||v||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):c?n(["hoverClosestCartesian","hoverCompareCartesian"]):h&&n(["hoverClosestPie"]),i(m,r)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=a(e,r,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",r.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":122,"../color":30,"./attributes":79,"./button_attributes":80,"./constants":81}],83:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,r,n){function a(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,C)},a=C.line.width?C.line.color:"rgba(0,0,0,0)",o=r.append("path").attr(n).style("opacity",C.opacity).call(_.stroke,a).call(_.fill,C.fillcolor).call(w.dashLine,C.line.dash,C.line.width);S&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+S),t._context.editable&&f(t,o,C,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof r&&r?s[r]=n:x.isPlainObject(r)&&(s=r);var c=Object.keys(s);for(o=0;oU&&n>G&&!t.shiftKey?k.getCursor(a/r,1-o/n):"move";M(e,i),X=i.split("-")[0]}function o(e){j=b.getFromId(t,r.xref),q=b.getFromId(t,r.yref),B=T.getDataToPixel(t,j),H=T.getDataToPixel(t,q,!0),V=T.getPixelToData(t,j),Z=T.getPixelToData(t,q,!0);var o="shapes["+n+"]";"path"===r.type?(R=r.path,F=o+".path"):(u=B(r.x0),f=H(r.y0),d=B(r.x1),h=H(r.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uG&&(c[C]=r[P]=Z(l),c[S]=r[N]=Z(s)),f-u>U&&(c[O]=r[E]=V(u),c[D]=r[I]=V(f))}e.attr("d",p(t,r))}var c,u,f,d,h,g,v,x,_,w,A,L,z,C,S,O,D,P,N,E,I,R,F,j,q,B,H,V,Z,X,U=10,G=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();k.init(Y)}function d(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),n}function h(t,e,r){var n=b.getFromId(t,r.id,"x")._id,a=b.getFromId(t,r.id,"y")._id,o="below"===e.layer,i=n===e.xref||a===e.yref,l=!!r.shapelayer;return o&&i&&l}function p(t,e){var r,n,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=T.shapePositionToRange(l),n=function(t){return l._offset+l.r2p(r(t,!0))}):n=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(n=T.decodeDate(n)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,n,o);var u=n(e.x0),f=n(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(A.segmentRE,function(t){var n=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[n]?t=e(t):i[n]&&(t=r(t)),n++,n>l&&(t="X"),t});return n>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,r){return t.replace(A.segmentRE,function(t){var n=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return n>=l?t:(o[n]?t=e(t):i[n]&&(t=r(t)),n++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),z=t("./defaults");e.exports={draw:n,drawOne:a}},{"../../lib":122,"../../lib/setcursor":132,"../../plotly":144,"../../plots/cartesian/axes":149,"../color":30,"../dragelement":51,"../drawing":53,"./constants":93,"./defaults":94,"./helpers":96,"./shape_defaults":98,"fast-isnumeric":17}],96:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var a,o=t._fullLayout._size;if(e){var i=r.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=r.decodeDate(a))}else a=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},r.getPixelToData=function(t,e,n){var a,o=t._fullLayout._size;if(e){var i=r.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=n?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],97:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":91,"./calc_autorange":92,"./defaults":94,"./draw":95}],98:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,r,l,s){function c(r,a){return n.coerce(t,e,o,r,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],m={_fullLayout:r},v=a.coerceRef(t,e,m,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==v?(y=a.getFromId(m,v),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=n.identity;var k=g+"0",M=g+"1",A=t[k],T=t[M];t[k]=x(t[k],!0),t[M]=x(t[M],!0),a.coercePosition(e,m,c,v,k,_),a.coercePosition(e,m,c,v,M,w),e[k]=b(e[k]),e[M]=b(e[M]),t[k]=A,t[M]=T}}return"path"===d?c("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":122,"../../plots/cartesian/axes":149,"./attributes":91,"./helpers":96}],99:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},n,{})},font:o({},n,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":119,"../../plots/animation_attributes":145,"../../plots/font_attributes":169,"../../plots/pad_attributes":172,"./constants":100}],100:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],101:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}var i=a(t,e),s=n("visible",i.length>0);if(s){n("active"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),o.coerceFont(n,"font",r.font);var c=n("currentvalue.visible");c&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),o.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function a(t,e){function r(t,e){return o.coerce(n,a,u,t,e)}for(var n,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+C.stepInset+(t.inputAreaLength-2*C.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-C.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*C.stepInset-2*t.inputAreaStart)))}function x(t,e,r){var n=t.selectAll("rect."+C.railTouchRectClass).data([0]);n.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,C.tickOffset+r.ticklen+r.labelHeight)}).call(A.fill,r.bgcolor).attr("opacity",0),M.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+C.railRectClass).data([0]);r.enter().append("rect").classed(C.railRectClass,!0);var n=e.inputAreaLength-2*C.railInset;r.attr({width:n,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(r,C.railInset,.5*(e.inputAreaWidth-C.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(l.enter().append("g").classed(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==r.length){var s=l.selectAll("g."+C.groupClassName).data(r,a);s.enter().append("g").classed(C.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,C.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,z=!0,C=O,k._infolayer.select("."+e).attr({"data-unformatted":C}).text(C).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,m=r.propName,v=r.traceIndex,y=r.dfltName,x=r.avoid||{},b=r.attributes,_=r.transform,w=r.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,z=!1,C=g.title.trim();""===C&&(L=0),C.match(/Click to enter .+ title/)&&(L=.2,z=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var S=w.selectAll("text").data([0]);S.enter().append("text"),S.text(C).attr("class",e),S.attr({"data-unformatted":C}).call(f);var O="Click to enter "+y+" title";t._context.editable?(C||p(),S.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):C&&!C.match(/Click to enter .+ title/)||S.remove(),S.classed("js-placeholder",z)}},{"../../lib":122,"../../lib/svg_text_utils":134,"../../plotly":144,"../../plots/plots":173,"../color":30,"../drawing":53,d3:14,"fast-isnumeric":17}],105:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":119,"../../plots/font_attributes":169,"../../plots/pad_attributes":172,"../color/attributes":29}],106:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],107:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}var i=a(t,e),s=n("visible",i.length>0);s&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),o.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function a(t,e){function r(t,e){return o.coerce(n,a,u,t,e)}for(var n,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==r.length){var u=c.selectAll("g."+T.headerGroupClassName).data(r,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],112:[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}},{}],113:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":28,"./components/images":65,"./components/legend":73,"./components/rangeselector":85,"./components/rangeslider":90,"./components/shapes":97,"./components/sliders":103,"./components/updatemenus":109,"./fonts/mathjax_config":114,"./lib/queue":130,"./plot_api/plot_schema":138,"./plot_api/register":139,"./plot_api/set_plot_config":140,"./plot_api/to_image":142,"./plot_api/validate":143,"./plotly":144,"./snapshot":193,"./snapshot/download":190,"./traces/scatter":281,d3:14,"es6-promise":15}],114:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],115:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),n(t)?Number(t):a}},{"../constants/numerical":110,"fast-isnumeric":17}],116:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,a){!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){t%1||!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;n.strict!==!0&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(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)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!l.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,n,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var m=(new Date).getFullYear();e=((Number(c[0])-m+70)%100+200)%100+m-70}if(!o(e))return s;var v=new Date(0,0,1);if(v.setFullYear(u?e:-e),c.length>1){if(n=Number(c[1])-1,c[1].length>2||!(n>=0&&n<=11))return s;if(v.setMonth(n),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(v.setDate(a),v.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(v.setHours(i),v.getHours()!==i)return s;if(c.length>1)return a=v.getTime(),n=Number(c[1]),2===c[1].length&&n>=0&&n<=59?(a+=f*n,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return v.getTime()},h=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==s};var g=90*c,m=3*u,v=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var r=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(r),i=er?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},a.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},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,r))/Math.log(n),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,r/a))/Math.log(n)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,r)?t(e,r,n):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[n];u[r]=o}return u},a.syncOrAsync=function(t,e,r){function n(){return a.syncOrAsync(t,e,r)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(n).then(void 0,a.promiseError);return r&&r(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,r){if(t){var n,a,o=!1,i=!0;for(n=0;n1?a+i[1]:"";if(o&&(i.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+o+"$2");return l+s}},{"./clean_number":115,"./coerce":116,"./dates":117,"./extend":119,"./filter_unique":120,"./filter_visible":121,"./is_array":123,"./is_plain_object":124,"./loggers":125,"./matrix":126,"./nested_property":127,"./notifier":128,"./search":131,"./stats":133,d3:14}],123:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],124:[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}},{}],125:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],i=!1,d(n))for(r=n.length-1;r>=0;r--)c(n[r])?i?n[r]=void 0:n.pop():i=!0;else if("object"==typeof n&&null!==n)for(o=Object.keys(n),i=!1,r=o.length-1;r>=0;r--)c(n[o[r]])&&!a(n[o[r]],o[r])?delete n[o[r]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,a,i,l=0,s=e.split(".");lo||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],s=t[1];if(ro||sl)return!1;var c,u,f,d,h,p=n.length,g=n[0][0],m=n[0][1],v=0;for(c=1;cMath.max(u,g)||s>Math.max(f,m)))if(su||Math.abs(n(i,d))>a)return!0;return!1};a.filter=function(t,e){function r(r){t.push(r);var l=n.length,s=a;n.splice(i+1);for(var c=s+1;c1){var l=t.pop();r(l)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":126}],130:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");r.findBin=function(t,e,r){if(l(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?r?n:a:r?i:o;f90&&s.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,a=e[n]-e[0]||1,o=a/(n||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},r.roundUp=function(t,e,r){for(var n,a=0,o=e.length-1,i=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":17}],134:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,r){var n="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),r();else{var n=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,n)}o.remove()})}function i(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),a=g[n];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,m.indexOf(u.protocol)===-1?"":''}if("br"===n)return"
";if(o)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))n.push(a);var o=0;n.forEach(function(t){for(var r=t+o,n=e.slice(0,r),a="",i=n.length-1;i>=0;i--){var l=n[i].match(/<(\/?).*>/i);if(l&&"
"!==n[i]){l[1]||(a=n[i]);break}}a&&(e.splice(r+1,0,a),e.splice(r,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,r){var n,a,o,i=r.horizontalAlign,l=r.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-n.height}:"middle"===l?function(){return s.top+(s.height-n.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-n.width}:"center"===i?function(){return s.left+(s.width-n.width)/2}:function(){return s.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(d.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return r(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=n(s,"width"),d=n(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||n(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(v," ")},r.makeEditable=function(t,e,r){function n(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:r.fill||i.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||i.attr("data-unformatted")).call(u(i,e,r)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}r||(r={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),r.immediate?n():c.on("click",n),f.rebind(this,l,"on")}},{"../constants/string_mappings":111,"../constants/xmlns_namespaces":112,"../lib":122,d3:14}],135:[function(t,e,r){"use strict";function n(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=f.cleanId(r,n))}function a(t){var e="middle",r="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?r="left":t.indexOf("right")!==-1&&(r="right"),e+" "+r}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.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);var a=f.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=u.getSubplotIds(t,"gl3d");for(e=0;e=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 s(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&l(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&sO.range[0]?[1,2]:[2,1]);else{var D=O.range[0],P=O.range[1];"log"===b?(D<=0&&P<=0&&r(L+".autorange",!0),D<=0?D=P/1e6:P<=0&&(P=D/1e6),r(L+".range[0]",Math.log(D)/Math.LN10),r(L+".range[1]",Math.log(P)/Math.LN10)):(r(L+".range[0]",Math.pow(10,D)),r(L+".range[1]",Math.pow(10,P)))}else r(L+".autorange",!0)}if("reverse"===A)z.range?z.range.reverse():(r(L+".autorange",!0),z.range=[1,0]),C.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var N=v.parts[1],E=v.parts[0],I=o[E]||[],R=I[N]||{};2===v.parts.length&&(null===b&&(e[m]="remove"),"add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?N===-1?(g[E]=I,delete g[m]):g[m]=R:x.log("???",e)),!n(R,"x")&&!n(R,"y")||x.containsAny(m,["color","opacity","align","dash"])||(h.docalc=!0);var F=w.getComponentMethod(E,"drawOne");F(t,N,v.parts.slice(2).join("."),e[m]),delete e[m]}else if(k.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])S.manageArrayContainers(v,b,g),h.doplot=!0;else{var j=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?h.doplot=!0:0===v.parts[0].indexOf("geo")?h.doplot=!0:0===v.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===m?h.doplot=!0:!i._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?h.docalc=!0:v.parts[0].indexOf("legend")!==-1?h.dolegend=!0:m.indexOf("title")!==-1?h.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(j,["tick","exponent","grid","zeroline"])?h.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:v.parts.length>1&&j.indexOf("line")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&"mirror"===j?h.doticks=h.dolayoutstyle=!0:"margin.pad"===m?h.doticks=h.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(h.doplot=!0):h.doplot=!0,v.set(b)}}}var q=t._fullLayout.width,B=t._fullLayout.height;k.supplyDefaults(t),t.layout.autosize&&k.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==q||t._fullLayout.height!==B;return H&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];m.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=x.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(z.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var a=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=a.append("g").classed("imagelayer",!0),r._shapeLowerLayer=a.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var o=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=o.append("g").classed("imagelayer",!0),r._shapeUpperLayer=o.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),k=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),z=t("../constants/xmlns_namespaces"),C=t("../lib/svg_text_utils"),S=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,r,n){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=D._basePlotModules,r=0;r=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=S.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),r=k.supplyAnimationDefaults(r);var l=r.transition,s=r.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){if(0!==i._frameQueue.length){for(;i._frameQueue.length;){var e=i._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var l=0;li._timeToNext&&h()};e()}function g(t){return Array.isArray(l)?y>=l.length?t.transitionOpts=l[y]:t.transitionOpts=l[0]:t.transitionOpts=l,y++,t}var m,v,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&x.isPlainObject(e);if(M)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&LL)&&z.push(v);b=z}}b.length>0?f(b):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,r){if(t=S.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(n=e.length-1;n>=0;n--)u.push({frame:k.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:c+n});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(a=u[n].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;r--)n=e[r],o.push({type:"delete",index:n}),i.unshift({type:"insert",index:n,value:a[n]});var l=k.modifyFrames,s=k.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),k.modifyFrames(t,o)},y.purge=function(t){t=S.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return k.cleanPlot([],{},r,e),k.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":53,"../components/errorbars":59,"../constants/xmlns_namespaces":112,"../lib":122,"../lib/events":118,"../lib/queue":130,"../lib/svg_text_utils":134,"../plotly":144,"../plots/cartesian/graph_interact":156,"../plots/plots":173,"../plots/polar":176,"../registry":188,"./helpers":135,"./subroutines":141,d3:14,"fast-isnumeric":17}],137:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],138:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=d.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var a={meta:e.meta||{},attributes:i(n)};if(e.layoutAttributes){var o={};_(o,e.layoutAttributes),a.layoutAttributes=i(o)}return a}function a(){var t={};return _(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var r=d.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)u(t,r,"xaxis"),u(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;u(t,r,n)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){f(t,r,e+r.name)}):f(t,r,r.name))}),{layoutAttributes:i(t)}}function o(t){var e=d.transformsRegistry[t];return{attributes:i(e.attributes)}}function i(t){return l(t),s(t),t}function l(t){function e(t){return{valType:"string"}}function n(t,n,a){r.isValObject(t)?"data_array"===t.valType?(t.role="data",a[n+"src"]=e(n)):t.arrayOk===!0&&(a[n+"src"]=e(n)):h.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function s(t){function e(t,e,r){if(t){var n=t[k];n&&(delete t[k],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function c(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function u(t,e,r){var n=h.nestedProperty(t,r),a=_({},e.layoutAttributes);a[w]=!0,n.set(a)}function f(t,e,r){var n=h.nestedProperty(t,r),a=_(n.get()||{},e.layoutAttributes);n.set(a)}var d=t("../registry"),h=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=h.extendFlat,_=h.extendDeep,w="_isSubplotObj",k="_isLinkedToArray",M="_deprecated",A=[w,k,M];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=k,r.DEPRECATED=M,r.UNDERSCORE_ATTRS=A,r.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:h.valObjects,metaKeys:A.concat.role},traces:t,layout:a(),transforms:e,frames:i(m),animation:i(v)}},r.crawl=function(t,e,n){var a=n||0;Object.keys(t).forEach(function(n){var o=t[n];A.indexOf(n)===-1&&(e(o,n,t,a),r.isValObject(o)||h.isPlainObject(o)&&r.crawl(o,e,a+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,i,l){o=o.slice(0,l).concat([r]);var s="data_array"===e.valType||e.arrayOk===!0;if(s){var c=n(o),u=h.nestedProperty(t,c).get();Array.isArray(u)&&a.push(c)}}function n(t){return t.join(".")}var a=[],o=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l1)};d(e.width)&&d(e.height)||n(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=n},{"../lib":122,"../plotly":144,"../snapshot/cloneplot":189,"../snapshot/helpers":192,"../snapshot/svgtoimg":194,"../snapshot/tosvg":196,"fast-isnumeric":17}],143:[function(t,e,r){"use strict";function n(t,e,r,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=r.length,v=0;vu&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=S&&a<=10||e>=15*S)t._tickround="d";else if(e>=D&&a<=16||e>=O)t._tickround="M";else if(e>=P&&a<=19||e>=D)t._tickround="S";else{var o=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var r=t.match(Y),n=new Date(e);if(r){var a=Math.min(+r[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(n)}return y.time.format(t)(n)}function l(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function s(t,e,r,n){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);r&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(n&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(r||(a="
"+H(u)),o=Z(u)):(r||(a="
"+X(u)),o=U(u),"M"!==s?(o+=G(u),"S"!==s&&(o+=d(y.round(v(l/1e3,1),4),t,"none",r).substr(1))):"d"===c&&(o=Z(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,r,n,a){var o=t.dtick,i=e.x;if(!n||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,n);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,n)}function d(t,e,r,n){var a=t<0,i=e._tickround,l=r||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var r,n,a=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.getAutoRange=function(t){var e,r=[],n=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(n===a){var g=n-1,m=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),r=[s.val-d*s.pad,c.val+d*c.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),h&&r.reverse(),r.map(t.l2r||Number)},N.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=N.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},N.saveRangeInitial=function(t,e){for(var r=N.list(t,"",!0),n=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(n(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),k=n(r.vpadminus||r.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},N.autoBin=function(t,e,r,n){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(r)l=(i-o)/r;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},N.autoTicks(f,l);var d,h=N.tickIncrement(N.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=N.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=N.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fz?(e/=z,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,r,I)):n>C?(e/=C,t.dtick="M"+a(e,1,R)):n>S?(t.dtick=a(e,S,j),t.tick0="2000-01-02"):n>O?t.dtick=a(e,O,R):n>D?t.dtick=a(e,D,F):n>P?t.dtick=a(e,P,F):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,r,I))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,r,I)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,r,I));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},N.tickIncrement=function(t,e,r){var n=r?-1:1;if(x(e))return t+n*e;var a=e.charAt(0),o=n*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?B:q,s=t+.01*n,c=_.roundUp(v(s,1),l,r);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]o:f1&&e2*n}function o(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,a=0,o=0;o2*n}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("../../constants/numerical").BADNUM;e.exports=function(t){return a(t)?"date":o(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":110,"../../lib":122,"fast-isnumeric":17}],151:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var l=i(e,r,n);if(l){if("histogram"===l.type&&n==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,n)){for(var s,u=a(l),f=[],d=0;d0;o&&(n="array");var i=r("categoryorder",n);"array"===i&&r("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],154:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],155:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],a=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(r)+"g")(n))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,r,l,_,w,k,M){function A(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+mt+")").attr("d",ct+"Z"),ht=pt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+mt+")").attr("d","M0,0Z"),z()}function z(){pt.selectAll(".select-outline").remove()}function C(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(V,e+ot)),a=Math.max(0,Math.min(Z,r+it)),o=Math.abs(n-ot),i=Math.abs(a-it),l=Math.floor(Math.min(i,o,U)/2);lt.l=Math.min(ot,n),lt.r=Math.max(ot,n),lt.t=Math.min(it,a),lt.b=Math.max(it,a),!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function S(t,e,r){var n,a,o;for(n=0;nzoom back out","long"),b=!1)))}function D(e,r){var a=1===(k+M).length;if(e)R();else if(2!==r||a){if(1===r&&a){var o=k?H[0]:B[0],i="s"===k||"w"===M?0:1,l=o._name+".range["+i+"]",s=n(o,i),u="left",f="middle";if(o.fixedrange)return;k?(f="n"===k?"top":"bottom","right"===o.side&&(u="right")):"e"===M&&(u="right"),rt.call(d.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var r=o.d2r(e);void 0!==r&&c.relayout(t,l,r)})}}else I()}function P(e){function r(t,e,r){function n(e){return t.l2r(o+(e-o)*r)}if(!t.fixedrange){var a=t.range.map(t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(n)}}if(t._context.scrollZoom||j._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=vt[0]+vt[2]*s,u=(l.bottom-e.clientY)/l.height,d=vt[1]+vt[3]*(1-u);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,r){for(var n,o,i=1-e,l=0;l0;n--)r.push(e);return r}function a(t,e){for(var r=[],n=0;nY.width||G<0||G>Y.height)return _.unhoverRaw(t,e)}else U="xpx"in e?e.xpx:M[0]._length/2,G="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?n(o,e.xval):a(M,U),D="yval"in e?n(o,e.yval):a(A,G),!g(O[0])||!g(D[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(N=0;N1||I.hoverinfo.indexOf("name")!==-1?I.name:void 0,index:!1,distance:Math.min(W,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[R]&&(H.subplot=i[R]._subplot),V=Z.length,"array"===j){var Q=e[N];"pointNumber"in Q?(H.index=Q.pointNumber,j="closest"):(j="","xval"in Q&&(q=Q.xval,j="x"),"yval"in Q&&(B=Q.yval,j=j?"closest":"y"))}else q=O[F],B=D[F];if(I._module&&I._module.hoverPoints){var $=I._module.hoverPoints(H,q,B,j);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&Z.push(s(J,S))}else m.log("Unrecognized trace type in hover:",I);"closest"===S&&Z.length>V&&(Z.splice(0,V),W=Z[0].distance)}if(0===Z.length)return _.unhoverRaw(t,e);var tt="y"===S&&X.length>1;Z.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),rt={hovermode:S,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},nt=c(Z,rt);u(Z,tt?"xa":"ya"),f(nt,tt);var at=t._hoverdata,ot=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,r=u.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?n=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),m=0;r&&r!==n?(d.style("fill",s).text(r).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),m=d.node().getBoundingClientRect().width+2*P):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var v,k,T=f.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,C=t.ya._offset+(t.y0+t.y1)/2,S=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),N=T.width+D+P+m;t.ty0=_-T.top,t.bx=T.width+2*P,t.by=T.height+2*P,t.anchor="start",t.txwidth=T.width,t.tx2width=m,t.offset=0,o?(t.pos=z,v=C+O/2+N<=M,k=C-O/2-N>=0,"top"!==t.idealAlign&&v||!k?v?(C+=O/2,t.anchor="start"):t.anchor="middle":(C-=O/2,t.anchor="end")):(t.pos=C,v=z+S/2+N<=w,k=z-S/2-N>=0,"left"!==t.idealAlign&&v||!k?v?(z+=S/2,t.anchor="start"):t.anchor="middle":(z-=S/2,t.anchor="end")),f.attr("text-anchor",t.anchor),m&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+C+")"+(o?"rotate("+L+")":""))}),C}function u(t,e){function r(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=r.pos+r.dp+r.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;n=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;n=!1}if(n){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var n,a,o,i,l,s,c,u=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?C:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&u<=t.length;){for(u++,n=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;n=!1}else i++}f.forEach(r)}for(i=f.length-1;i>=0;i--){var m=f[i];for(l=m.length-1;l>=0;l--){var v=m[l],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var r=h.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,a=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(D+P),l=i+o*(t.txwidth+P),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-O,s=t.offset*S),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*D+s)+","+(D+c)+"v"+(t.by/2-D)+"h"+n*t.bx+"v-"+t.by+"H"+(n*D+s)+"V"+(c-D)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(b.setPosition,l+o*P+s,c+t.ty0-t.by/2+P),r.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],o=t._hoverdata[n];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return m.coerce(t,e,A,r,n)}n("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=T.isHoriz(r);a=o?"y":"x"}else a="closest";n("hovermode",a)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+k.HOVERMINTIME?(i(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||o(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":122,"fast-isnumeric":17}],162:[function(t,e,r){"use strict";function n(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,r,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-m.left,b=r-m.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(n),L=a.yaxes.map(n),z=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var C=g.selectAll("path.select-outline").data([1,2]);C.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",k+"Z");var S,O,D,P,N,E=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,F=[];for(S=0;S0)return Math.log(e)/Math.LN10;if(e<=0&&r&&t.range&&2===t.range.length){var n=t.range[0],a=t.range[1];return.5*(n+a-3*f*Math.abs(n-a))}return s}function r(t){return Math.pow(10,t)}function i(t){return a(t)?(t=Number(t),t<-l||t>l?s:a(t)?Number(t):s):s}var f=10;t.c2l="log"===t.type?e:i,t.l2c="log"===t.type?r:i,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,i=t[e],s=(t._id||"x").charAt(0);if(n="date"===t.type?c.DFLTRANGEDATE:"y"===s?c.DFLTRANGEY:c.DFLTRANGEX,n=n.slice(),!i||2!==i.length)return void(t[e]=n);for("date"===t.type&&(i[0]=o.cleanDate(i[0]),i[1]=o.cleanDate(i[1])),r=0;r<2;r++)if("date"===t.type){if(!o.isDateTime(i[r])){t[e]=n;break}if(i[r]o.MAX_MS&&(i[r]=o.MAX_MS),t.r2l(i[0])===t.r2l(i[1])){var u=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(u-1e3),i[1]=t.l2r(u+1e3);break}}else{if(!a(i[r])){if(!a(i[1-r])){t[e]=n;break}i[r]=i[1-r]*(r?10:.1)}if(i[r]<-l?i[r]=-l:i[r]>l&&(i[r]=l),i[0]===i[1]){var f=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=f,i[1]+=f}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var a=u.getFromId(t._gd,t.overlaying);t.domain=a.domain}var i=e&&t._r?"_r":"range";t.cleanRange(i);var l=t.r2l(t[i][0]),s=t.r2l(t[i][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?n.round(t._b+t._m*e,2):s},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=i,t.d2c=o.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=o.cleanNumber,t.d2r=o.cleanNumber,t.r2d=i),t.r2l=i,t.l2r=i):"date"===t.type?(t.c2d=o.ms2DateTime,t.d2c=function(t){var e=o.dateTime2ms(t);if(e===s){if(!a(t))return s;e=Number(t)}return o.constrain(e,o.MIN_MS,o.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=o.identity,t.r2d=o.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?s:r},t.d2l=t.d2c,t.r2l=i,t.l2r=i,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,a,o;if(r in e)for(n=e[r],a=new Array(n.length),o=0;o0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var f=u.charAt(0),d=u.substr(1);d=n(d)?Number(d):0,(d<=0||!("date"===i&&"M"===f&&d===Math.round(d)||"log"===i&&"L"===f||"log"===i&&"D"===f&&(1===d||2===d)))&&(e.dtick=c)}var h="date"===i?"2000-01-01":0,p=r("tick0",h);"date"===i?e.tick0=a.cleanDate(p,h):n(p)&&"D1"!==u&&"D2"!==u?e.tick0=Number(p):e.tick0=h}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":110,"../../lib":122,"fast-isnumeric":17}],167:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../lib"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,c){function u(t){var e,r,n,a,o,i={};for(e in t)if(r=e.split("."),n=r[0].match(s)){var l=n[1],c=l+"axis";if(a=y[c],o={},Array.isArray(t[e])?o.to=t[e].slice(0):Array.isArray(t[e].range)&&(o.to=t[e].range.slice(0)),!o.to)continue;o.axisName=c,o.length=a._length,x.push(l),i[l]=o}return i}function f(t,e,r){var n,a,o,i=t._plots,l=[];for(n in i){var s=i[n];if(l.indexOf(s)===-1){var c=s.xaxis._id,u=s.yaxis._id,f=s.xaxis.range,d=s.yaxis.range;s.xaxis._r=s.xaxis.range.slice(),s.yaxis._r=s.yaxis.range.slice(),a=r[c]?r[c].to:f,o=r[u]?r[u].to:d,f[0]===a[0]&&f[1]===a[1]&&d[0]===o[0]&&d[1]===o[1]||e.indexOf(c)===-1&&e.indexOf(u)===-1||l.push(s)}}return l}function d(e,r){function n(e,r){for(a=0;ar.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var k;c&&(k=c());var M,A,T,L=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),M=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":122,"../../plotly":144,"../../registry":188,"./axes":149,d3:14}],168:[function(t,e,r){"use strict";function n(t,e,r){var n,a,o,i=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return a=c.nestedProperty(n,e.prop).get(),o=r[e.type]=r[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var r=[],n=e[0],a={};if("string"==typeof n)a[n]=e[1];else{if(!c.isPlainObject(n))return r;a=n}return l(a,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function i(t,e){var r,n,a,o,i=[];if(n=e[0],a=e[1],r=e[2],o={},"string"==typeof n)o[n]=a;else{if(!c.isPlainObject(n))return i;o=n,void 0===r&&(r=a)}return void 0===r&&(r=null),l(o,function(e,n,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);r&&(l=Math.min(l,r.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,n+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");r.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=r.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){n(t,s,i.cache),i.check=function(){if(l){var e=n(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),r.attr(o);var i=r.select(".js-link-to-tool"),l=r.select(".js-link-spacer"),c=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=s.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=n.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var c=r.width,f=r.height;p.supplyLayoutGlobalDefaults(o,n),o.width||(n.width=c),o.height||(n.height=f)}else{p.supplyLayoutGlobalDefaults(o,n);var d=!o.width||!o.height,h=n.autosize,g=t._context&&t._context.autosizable,m=d&&(h||g);m?p.plotAutoSize(t,o,n):d&&p.sanitizeMargins(t),!h&&d&&(o.width=n.width,o.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=s.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,n),n._has=p._hasPlotType.bind(n);var v=n._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,m=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(m.width-f)),a=Math.round(g*(m.height-h))}else{var v=s?window.getComputedStyle(t):{};n=parseFloat(v.width)||r.width,a=parseFloat(v.height)||r.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-a)>1;(_||b)&&(b&&(r.width=n),_&&(r.height=a)),t._initialAutoSize||(t._initialAutoSize={width:n,height:a}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var a,o;u.Axes.supplyLayoutDefaults(t,e,r);var i=e._basePlotModules;for(a=0;a.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+a},r:{val:r.x,size:r.r+a},b:{val:r.y,size:r.b+a},t:{val:r.y,size:r.t+a}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var r=s[t].l||{},n=s[t].b||{},u=r.val,f=r.size,d=n.val,h=n.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var r=s[t].r.val,n=s[t].r.size;if(r>u){var p=(f*r+(n-e.width)*u)/(r-u),g=(n*(1-u)+(f-e.width)*(1-r))/(r-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var m=s[t].t.val,v=s[t].t.size;if(m>d){var y=(h*m+(v-e.height)*d)/(m-d),x=(v*(1-d)+(h-e.height)*(1-m))/(m-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),r.l=Math.round(a),r.r=Math.round(o),r.t=Math.round(i),r.b=Math.round(l),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,r,n,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,n,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):d.isJSDate(t)?d.ms2DateTime(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===n?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var r,n,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(r=0;r0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(r)for(l=0;l=0,C=z?f.angularAxis.domain:n.extent(M),S=Math.abs(M[1]-M[0]);T&&!A&&(S=0);var O=C.slice();L&&A&&(O[1]+=S);var D=f.angularAxis.ticksCount||4;D>8&&(D=D/(D/8)+D%8),f.angularAxis.ticksStep&&(D=(O[1]-O[0])/D);var P=f.angularAxis.ticksStep||(O[1]-O[0])/(D*(f.minorTicks+1));k&&(P=Math.max(Math.round(P),1)),O[2]||(O[2]=P);var N=n.range.apply(this,O);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=n.scale.linear().domain(O.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?S:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var E="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(E,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=n.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,j=e.select(".chart-group"),q={fill:"none",stroke:f.tickColor},B={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var r=i.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});i.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},i.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],a.range([0,x]),u.layout.radialAxis.domain=a.domain(),F.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),j.attr("transform","translate("+_+")").style({cursor:"crosshair"});var Z=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(Z[0]=Math.max(0,Z[0]),Z[1]=Math.max(0,Z[1]),e.select(".outer-group").attr("transform","translate("+Z+")"),f.title){var X=e.select("g.title-group text").style(B).text(f.title),U=X.node().getBBox();X.attr({x:_[0]-U.width/2,y:_[1]-x-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=G.selectAll("circle.grid-circle").data(a.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(q),Y.attr("r",a),Y.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(q);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=n.svg.axis().scale(a).ticks(5).tickSize(5);G.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(q),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(B).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),J=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(q),J.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(B);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var r=s(t,e),n=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(B);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(j.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),h[0]||et){var nt=[];h.forEach(function(t,e){var r={};r.radialScale=a,r.angularScale=l,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var at=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return o(i[r].defaultConfig(),t)});i[r]().config(n)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=i.tooltipPanel().config({container:ct,fontSize:8})(),ft=i.tooltipPanel().config({container:ct,fontSize:8})(),dt=i.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});j.on("mousemove.angular-guide",function(t,e){var r=i.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;it=l.invert(n);var a=i.util.convertToCartesian(x+12,r+180);ut.text(i.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});j.on("mousemove.radial-guide",function(t,e){var r=i.util.getMousePos(W).radius;pt.attr({r:r}).style({opacity:.5}),lt=a.invert(i.util.getMousePos(W).radius);var n=i.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(i.util.round(lt)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var a=n.select(this),o=a.style("fill"),l="black",s=a.style("opacity")||1;if(a.attr({"data-opacity":s}),"none"!=o){a.attr({"data-fill":o}),l=n.hsl(o).darker().toString(),a.style({fill:l,opacity:1});var c={t:i.util.round(t[0]),r:i.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-Z[0]-d.left,f.top+f.height/2-Z[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else o=a.style("stroke"),a.attr({"data-stroke":o}),l=n.hsl(o).darker().toString(),a.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})}),d}var e,r,a,l,s={data:[],layout:{}},c={},u={},f=n.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=i.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),o(s.data[e],i.Axis.defaultConfig().data[0]),o(s.data[e],t)}),o(s.layout,i.Axis.defaultConfig().layout), +o(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},n.rebind(d,f,"on"),d},i.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},i.util={},i.DATAEXTENT="dataExtent",i.AREA="AreaChart",i.LINE="LinePlot",i.DOT="DotPlot",i.BAR="BarChart",i.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},i.util._extend=function(t,e){for(var r in t)e[r]=t[r]},i.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},i.util.dataFromEquation2=function(t,e){var r=e||6,a=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,a=t(n);return[e,a]});return a},i.util.dataFromEquation=function(t,e,r){var a=e||6,o=[],i=[];n.range(0,360+a,a).forEach(function(e,r){var n=e*Math.PI/180,a=t(n);o.push(e),i.push(a)});var l={t:o,r:i};return r&&(l.name=r),l},i.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},i.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=i.util.ensureArray(t[e],r)}),t},i.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},i.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},i.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},i.util.arrayLast=function(t){return t[t.length-1]},i.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return r===-2},i.util.flattenArray=function(t){for(var e=[];!i.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},i.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},i.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),a=t*Math.sin(r);return[n,a]},i.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},i.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],a=e[1],o={};return o.x=r,o.y=a,o.pos=e,o.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,o.radius=Math.sqrt(r*r+a*a),o},i.util.duplicatesCount=function(t){for(var e,r={},n={},a=0,o=t.length;a0)){var l=n.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:d(i),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(r,a,o)},"fill-opacity":0,stroke:function(t,e){return m.stroke(r,a,o)},"stroke-width":function(t,e){return m["stroke-width"](r,a,o)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](r,a,o)},opacity:function(t,e){return m.opacity(r,a,o)},display:function(t,e){return m.display(r,a,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,a){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var m={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 l[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},v=n.select(this).selectAll("g.layer").data(s);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(m).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,r=[i.PolyChart.defaultConfig()],a=n.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),o(r[e],i.PolyChart.defaultConfig()),o(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,a,"on"),t},i.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},i.Legend=function(){function t(){var r=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var a=o({},r.elements[e]);return a.name=t,a.color=[].concat(r.elements[e].color)[n],a})}),i=n.merge(a);i=i.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(i=i.reverse());var l=r.container;("string"==typeof l||l.nodeName)&&(l=n.select(l));var s=i.map(function(t,e){return t.color}),c=r.fontSize,u=null==r.isContinuous?"number"==typeof i[0]:r.isContinuous,f=u?r.height:c*i.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(i.length),m=n.scale[u?"linear":"ordinal"]().domain(g).range(s),v=n.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(i);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,v(e)+c/2]+")"},d:function(t,e){var r=t.symbol;return y(r,c)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=n.svg.axis().scale(v).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?r.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return i[e].name}),t}var e=i.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},n.rebind(t,r,"on"),t},i.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},i.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=10,c=function(){t=a.container.selectAll("g."+l).data([0]);var n=t.enter().append("g").classed(l,!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+s,dy:.3*+a.fontSize}),c};return c.text=function(o){var i=n.hsl(a.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var d=a.padding,h=e.node().getBBox(),p={fill:a.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,m=h.height+2*d;return r.attr({d:"M"+[[s,-m/2],[s,-m/4],[a.hasTick?0:s,0],[s,m/4],[s,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-m/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){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 o(a,t),c},c},i.tooltipPanel.uid=1,i.adapter={},i.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=o({},t),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"]]];return a.forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=a.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var l=o({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};n.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),r.layout=l}return r},t}},{"../../lib":122,d3:14}],178:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),o=t("../../components/color"),i=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){function e(e,a){return a&&(f=a),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?s(r,e):e,o||(o=i.Axis()),u=i.adapter.plotly().convert(r),o.config(u).render(f),t.data=r.data,t.layout=r.layout,c.fillLayout(t),r}var r,a,o,u,f,d=new l;return e.isPolar=!0,e.svg=function(){return o.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return i.adapter.plotly().convert(o.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:o.angularScale(),r:o.radialScale()}},e.setUndoPoint=function(){var t=this,e=i.util.cloneJson(r);!function(e,r){d.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,a),a=i.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},c.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(),i={width:800,height:600,paper_bgcolor:o.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=s(i,t.layout)}},{"../../components/color":30,"../../lib":122,"./micropolar":177,"./undo_manager":179,d3:14}],179:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,r=[],n=-1,a=!1;return{add:function(t){return a?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=r[n];return a?(t(a,"undo"),n-=1,e&&e(a.undo),this):this},redo:function(){var a=r[n+1];return a?(t(a,"redo"),n+=1,e&&e(a.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n=i&&(h.min=0,p.min=0,g.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var a=t("../../../components/color"),o=t("../../subplot_defaults"),i=t("./layout_attributes"),l=t("./axis_defaults"),s=["aaxis","baxis","caxis"];e.exports=function(t,e,r){o(t,e,r,{type:"ternary",attributes:i,handleDefaults:n,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":30,"../../subplot_defaults":180,"./axis_defaults":184,"./layout_attributes":186}],186:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),a=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:a,baxis:a,caxis:a}},{"../../../components/color/attributes":29,"./axis_attributes":183}],187:[function(t,e,r){"use strict";function n(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework()}function a(t){o.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var o=t("d3"),i=t("tinycolor2"),l=t("../../plotly"),s=t("../../lib"),c=t("../../components/color"),u=t("../../components/drawing"),f=t("../cartesian/set_convert"),d=t("../../lib/extend").extendFlat,h=t("../cartesian/axes"),p=t("../../components/dragelement"),g=t("../../components/titles"),m=t("../cartesian/select"),v=t("../cartesian/constants"),y=t("../cartesian/graph_interact");e.exports=n;var x=n.prototype;x.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={}},x.plot=function(t,e){var r,n=this,a=e[n.id],o=e._size;s.getPlotDiv(n.plotContainer.node())!==n.graphDiv&&(n.init(n.graphDiv._fullLayout),n.makeFramework()),n.adjustLayout(a,o);var i=n.traceHash,l={};for(r=0;rb*y?(o=y,a=o*b):(a=v,o=a/b),i=g*a/v,l=m*o/y,r=e.l+e.w*h-a/2,n=e.t+e.h*(1-p)-o/2,s.x0=r,s.y0=n,s.w=a,s.h=o,s.sum=x,s.xaxis={type:"linear",range:[_+2*k-x,x-_-2*w],domain:[h-i/2,h+i/2],_id:"x",_gd:s.graphDiv},f(s.xaxis),s.xaxis.setScale(),s.yaxis={type:"linear",range:[_,x-w-k],domain:[p-l/2,p+l/2],_id:"y",_gd:s.graphDiv},f(s.yaxis),s.yaxis.setScale();var M=s.yaxis.domain[0],A=s.aaxis=d({},t.aaxis,{range:[_,x-w-k],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[M,M+l*b],_axislayer:s.layers.aaxis,_gridlayer:s.layers.agrid,_pos:0,_gd:s.graphDiv,_id:"y",_length:a,_gridpath:"M0,0l"+o+",-"+a/2});f(A);var T=s.baxis=d({},t.baxis,{range:[x-_-k,w],side:"bottom",_counterangle:30,domain:s.xaxis.domain,_axislayer:s.layers.baxis,_gridlayer:s.layers.bgrid,_counteraxis:s.aaxis,_pos:0,_gd:s.graphDiv,_id:"x",_length:a,_gridpath:"M0,0l-"+a/2+",-"+o});f(T),A._counteraxis=T;var L=s.caxis=d({},t.caxis,{range:[x-_-w,k],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[M,M+l*b],_axislayer:s.layers.caxis,_gridlayer:s.layers.cgrid,_counteraxis:s.baxis,_pos:0,_gd:s.graphDiv,_id:"y",_length:a,_gridpath:"M0,0l-"+o+","+a/2});f(L);var z="M"+r+","+(n+o)+"h"+a+"l-"+a/2+",-"+o+"Z";s.clipDef.select("path").attr("d",z),s.layers.plotbg.select("path").attr("d",z);var C="translate("+r+","+n+")";s.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",C);var S="translate("+r+","+(n+o)+")";s.layers.baxis.attr("transform",S),s.layers.bgrid.attr("transform",S);var O="translate("+(r+a/2)+","+n+")rotate(30)";s.layers.aaxis.attr("transform",O),s.layers.agrid.attr("transform",O);var D="translate("+(r+a/2)+","+n+")rotate(-30)";s.layers.caxis.attr("transform",D),s.layers.cgrid.attr("transform",D),s.drawAxes(!0),s.plotContainer.selectAll(".crisp").classed("crisp",!1);var P=s.layers.axlines;P.select(".aline").attr("d",A.showline?"M"+r+","+(n+o)+"l"+a/2+",-"+o:"M0,0").call(c.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),P.select(".bline").attr("d",T.showline?"M"+r+","+(n+o)+"h"+a:"M0,0").call(c.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),P.select(".cline").attr("d",L.showline?"M"+(r+a/2)+","+n+"l"+a/2+","+o:"M0,0").call(c.stroke,L.linecolor||"#000").style("stroke-width",(L.linewidth||0)+"px")},x.drawAxes=function(t){var e=this,r=e.graphDiv,n=e.id.substr(7)+"title",a=e.aaxis,o=e.baxis,i=e.caxis;if(h.doTicks(r,a,!0),h.doTicks(r,o,!0),h.doTicks(r,i,!0),t){var l=Math.max(a.showticklabels?a.tickfont.size/2:0,(i.showticklabels?.75*i.tickfont.size:0)+("outside"===i.ticks?.87*i.ticklen:0));g.draw(r,"a"+n,{propContainer:a,propName:e.id+".aaxis.title",dfltName:"Component A",attributes:{x:e.x0+e.w/2,y:e.y0-a.titlefont.size/3-l,"text-anchor":"middle"}});var s=(o.showticklabels?o.tickfont.size:0)+("outside"===o.ticks?o.ticklen:0)+3;g.draw(r,"b"+n,{propContainer:o,propName:e.id+".baxis.title",dfltName:"Component B",attributes:{x:e.x0-s,y:e.y0+e.h+.83*o.titlefont.size+s,"text-anchor":"middle"}}),g.draw(r,"c"+n,{propContainer:i,propName:e.id+".caxis.title",dfltName:"Component C",attributes:{x:e.x0+e.w+s,y:e.y0+e.h+.83*i.titlefont.size+s,"text-anchor":"middle"}})}};var _=v.MINZOOM/2+.87,w="m-0.87,.5h"+_+"v3h-"+(_+5.2)+"l"+(_/2+2.6)+",-"+(.87*_+4.5)+"l2.6,1.5l-"+_/2+","+.87*_+"Z",k="m0.87,.5h-"+_+"v3h"+(_+5.2)+"l-"+(_/2+2.6)+",-"+(.87*_+4.5)+"l-2.6,1.5l"+_/2+","+.87*_+"Z",M="m0,1l"+_/2+","+.87*_+"l2.6,-1.5l-"+(_/2+2.6)+",-"+(.87*_+4.5)+"l-"+(_/2+2.6)+","+(.87*_+4.5)+"l2.6,1.5l"+_/2+",-"+.87*_+"Z",A="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",T=!0;x.initInteractions=function(){function t(t,e,r){var n=R.getBoundingClientRect();_=e-n.left,L=r-n.top,z={a:I.aaxis.range[0],b:I.baxis.range[1],c:I.caxis.range[1]},S=z,C=I.aaxis.range[1]-z.a,O=i(I.graphDiv._fullLayout[I.id].bgcolor).getLuminance(),D="M0,"+I.h+"L"+I.w/2+", 0L"+I.w+","+I.h+"Z",P=!1,N=j.append("path").attr("class","zoombox").style({fill:O>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",D),E=j.append("path").attr("class","zoombox-corners").style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),g()}function e(t,e){return 1-e/I.h}function r(t,e){return 1-(t+(I.h-e)/Math.sqrt(3))/I.w}function n(t,e){return(t-(I.h-e)/Math.sqrt(3))/I.w}function o(t,a){var o=_+t,i=L+a,l=Math.max(0,Math.min(1,e(_,L),e(o,i))),s=Math.max(0,Math.min(1,r(_,L),r(o,i))),c=Math.max(0,Math.min(1,n(_,L),n(o,i))),u=(l/2+c)*I.w,f=(1-l/2-s)*I.w,d=(u+f)/2,h=f-u,p=(1-l)*I.h,g=p-h/b;h.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),E.transition().style("opacity",1).duration(200),P=!0)}function u(t,e){if(S===z)return 2===e&&x(),a(F);a(F);var r={};r[I.id+".aaxis.min"]=S.a,r[I.id+".baxis.min"]=S.b,r[I.id+".caxis.min"]=S.c,l.relayout(F,r),T&&F.data&&F._context.showTips&&(s.notifier("Double-click to
zoom back out","long"),T=!1)}function f(){z={a:I.aaxis.range[0],b:I.baxis.range[1],c:I.caxis.range[1]},S=z}function d(t,e){var r=t/I.xaxis._m,n=e/I.yaxis._m;S={a:z.a-n,b:z.b+(r+n)/2,c:z.c-(r-n)/2};var a=[S.a,S.b,S.c].sort(),o={a:a.indexOf(S.a),b:a.indexOf(S.b),c:a.indexOf(S.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),S={a:a[o.a],b:a[o.b],c:a[o.c]},e=(z.a-S.a)*I.yaxis._m,t=(z.c-S.c-z.b+S.b)*I.xaxis._m);var i="translate("+(I.x0+t)+","+(I.y0+e)+")";I.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",i),I.aaxis.range=[S.a,I.sum-S.b-S.c],I.baxis.range=[I.sum-S.a-S.c,S.b],I.caxis.range=[I.sum-S.a-S.b,S.c],I.drawAxes(!1),I.plotContainer.selectAll(".crisp").classed("crisp",!1)}function h(t,e){if(t){var r={};r[I.id+".aaxis.min"]=S.a,r[I.id+".baxis.min"]=S.b,r[I.id+".caxis.min"]=S.c,l.relayout(F,r)}else 2===e&&x()}function g(){I.plotContainer.selectAll(".select-outline").remove()}function x(){var t={};t[I.id+".aaxis.min"]=0,t[I.id+".baxis.min"]=0,t[I.id+".caxis.min"]=0,F.emit("plotly_doubleclick",null),l.relayout(F,t)}var _,L,z,C,S,O,D,P,N,E,I=this,R=I.layers.plotbg.select("path").node(),F=I.graphDiv,j=I.layers.zoom,q={element:R,gd:F,plotinfo:{ +plot:j},doubleclick:x,subplot:I.id,prepFn:function(e,r,n){q.xaxes=[I.xaxis],q.yaxes=[I.yaxis];var a=F._fullLayout.dragmode;e.shiftKey&&(a="pan"===a?"zoom":"pan"),"lasso"===a?q.minDrag=1:q.minDrag=void 0,"zoom"===a?(q.moveFn=o,q.doneFn=u,t(e,r,n)):"pan"===a?(q.moveFn=d,q.doneFn=h,f(),g()):"select"!==a&&"lasso"!==a||m(e,r,n,q,a)}};R.onmousemove=function(t){y.hover(F,t,I.id),F._fullLayout._lasthover=R,F._fullLayout._hoversubplot=I.id},R.onmouseout=function(t){F._dragging||p.unhover(F,t)},R.onclick=function(t){y.click(F,t)},p.init(q)}},{"../../components/color":30,"../../components/dragelement":51,"../../components/drawing":53,"../../components/titles":104,"../../lib":122,"../../lib/extend":119,"../../plotly":144,"../cartesian/axes":149,"../cartesian/constants":154,"../cartesian/graph_interact":156,"../cartesian/select":162,"../cartesian/set_convert":163,d3:14,tinycolor2:20}],188:[function(t,e,r){"use strict";function n(t){return"object"==typeof t&&(t=t.type),t}var a=t("./lib"),o=t("./plots/attributes");r.modules={},r.allCategories={},r.allTypes=[],r.subplotsRegistry={},r.transformsRegistry={},r.componentsRegistry={},r.layoutArrayContainers=[],r.register=function(t,e,n,o){if(r.modules[e])return void a.log("Type "+e+" already registered");for(var i={},l=0;l-1}var o=t("../lib"),i=t("../plots/plots"),l=o.extendFlat,s=o.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,o=t.data,c=t.layout,u=s([],o),f=s({},c,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(r=0;r=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var m,v,y,x,b=e.p+(h?d[r]:d),_=b+(g?p[r]:p),w=e.b,k=w+e.s;if("h"===l.orientation?(y=u.c2p(b,!0),x=u.c2p(_,!0),m=c.c2p(w,!0),v=c.c2p(k,!0)):(m=c.c2p(b,!0),v=c.c2p(_,!0),y=u.c2p(w,!0),x=u.c2p(k,!0)),!(a(m)&&a(v)&&a(y)&&a(x)&&m!==v&&y!==x))return void n.select(this).remove();var M=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,A=n.round(M/2%1,2);if(!t._context.staticPlot){var T=i.opacity(e.mc||l.marker.color),L=T<1||M>.01?o:s;m=L(m,v),v=L(v,m),y=L(y,x),x=L(x,y)}n.select(this).attr("d","M"+m+","+y+"V"+x+"H"+v+"V"+y+"Z")})}),d.call(l.plot,e)}},{"../../components/color":30,"../../components/errorbars":59,"../../lib":122,"./arrays_to_calcdata":197,d3:14,"fast-isnumeric":17}],206:[function(t,e,r){"use strict";function n(t,e,r,n){if(n.length){var l,s,c,u,f,d=t._fullLayout.barmode,h="overlay"===d,p="group"===d;if(h)a(t,e,r,n);else if(p){for(l=[],s=[],c=0;cs+i&&(c=!0,s=y)),v(e.c2l(g))&&(gs+i&&(c=!0,s=g))}}x.expand(e,[l,s],{tozero:!0,padded:c})}function m(t){return t._id.charAt(0)}var v=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var r,a=e.xaxis,o=e.yaxis,i=t._fullData,l=t.calcdata,s=[],c=[];for(r=0;r1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,r=e.marker,i=r.line,l=o.tryColorscale(r,""),s=o.tryColorscale(r,"line");n.select(this).selectAll("path").each(function(t){var e,o,c=(t.mlw+1||i.width+1)-1,u=n.select(this);e="mc"in t?t.mcc=l(t.mc):Array.isArray(r.color)?a.defaultLine:r.color,u.style("stroke-width",c+"px").call(a.fill,e),c&&(o="mlc"in t?t.mlcc=s(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":30,"../../components/drawing":53,"../../components/errorbars":59,d3:14}],209:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,r,i,l){r("marker.color",i),a(t,"marker")&&o(t,e,l,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),a(t,"marker.line")&&o(t,e,l,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width")}},{"../../components/color":30,"../../components/colorscale/defaults":39,"../../components/colorscale/has_colorscale":43}],210:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),a=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,i=n.marker,l=i.line;e.exports={y:{valType:"data_array"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:o({},i.symbol,{arrayOk:!1}),opacity:o({},i.opacity,{arrayOk:!1,dflt:1}),size:o({},i.size,{arrayOk:!1}),color:o({},i.color,{arrayOk:!1}),line:{color:o({},l.color,{arrayOk:!1,dflt:a.defaultLine}),width:o({},l.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:n.fillcolor}},{"../../components/color/attributes":29,"../../lib/extend":119,"../scatter/attributes":271}],211:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(t,e,r,o,i){var l;return r in e?p=o.makeCalcdata(e,r):(l=r+"0"in e?e[r+"0"]:"name"in e&&("category"===o.type||n(e.name)&&["linear","log"].indexOf(o.type)!==-1||a.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,l=o.d2c(l),p=i.map(function(){return l})),p}function i(t,e,r,o,i){var l,s,c,u,f=o.length,d=e.length,h=[],p=[];for(l=0;l=0&&c1,v=r.dPos*(1-d.boxgap)*(1-d.boxgroupgap)/(m?t.numboxes:1),y=m?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-d.boxgap):0,x=v*g.whiskerwidth;return g.visible!==!0||r.emptybox?void o.select(this).remove():("h"===g.orientation?(s=p,f=h):(s=h,f=p),r.bPos=y,r.bdPos=v,n(),o.select(this).selectAll("path.box").data(i.identity).enter().append("path").attr("class","box").each(function(t){var e=s.c2p(t.pos+y,!0),r=s.c2p(t.pos+y-v,!0),n=s.c2p(t.pos+y+v,!0),a=s.c2p(t.pos+y-x,!0),l=s.c2p(t.pos+y+x,!0),c=f.c2p(t.q1,!0),u=f.c2p(t.q3,!0),d=i.constrain(f.c2p(t.med,!0),Math.min(c,u)+1,Math.max(c,u)-1),h=f.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=f.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?o.select(this).attr("d","M"+d+","+r+"V"+n+"M"+c+","+r+"V"+n+"H"+u+"V"+r+"ZM"+c+","+e+"H"+h+"M"+u+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+h+","+a+"V"+l+"M"+p+","+a+"V"+l)):o.select(this).attr("d","M"+r+","+d+"H"+n+"M"+r+","+c+"H"+n+"V"+u+"H"+r+"ZM"+e+","+c+"V"+h+"M"+e+","+u+"V"+p+(0===g.whiskerwidth?"":"M"+a+","+h+"H"+l+"M"+a+","+p+"H"+l))}),g.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,o,l,s,f,d="all"===g.boxpoints?t.val:t.val.filter(function(e){return et.uf}),h=Math.max((t.max-t.min)/10,t.q3-t.q1),p=1e-9*h,m=h*u,x=[],b=0;if(g.jitter){if(0===h)for(b=1,x=new Array(d.length),e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(l.translatePoints,h,p),void(g.boxmean&&o.select(this).selectAll("path.mean").data(i.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=s.c2p(t.pos+y,!0),r=s.c2p(t.pos+y-v,!0),n=s.c2p(t.pos+y+v,!0),a=f.c2p(t.mean,!0),i=f.c2p(t.mean-t.sd,!0),l=f.c2p(t.mean+t.sd,!0);"h"===g.orientation?o.select(this).attr("d","M"+a+","+r+"V"+n+("sd"!==g.boxmean?"":"m0,0L"+i+","+e+"L"+a+","+r+"L"+l+","+e+"Z")):o.select(this).attr("d","M"+r+","+a+"H"+n+("sd"!==g.boxmean?"":"m0,0L"+e+","+i+"L"+r+","+a+"L"+e+","+l+"Z"))})))})}},{"../../components/drawing":53,"../../lib":122,d3:14}],218:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../plots/cartesian/axes"),o=t("../../lib");e.exports=function(t,e){var r,i,l,s,c=t._fullLayout,u=e.xaxis,f=e.yaxis,d=["v","h"];for(i=0;it?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===r||10===r){var n=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;return t>n?5===r?713:1114:5===r?104:208}return 15===r?0:r}function i(t){var e,r,n,a,i,l,s,c,u,f=t[0].z,d=f.length,h=f[0].length,p=2===d||2===h;for(r=0;r20?(l=C[l][(s[0]||s[1])<0?0:1],t.crossings[i]=S[l]):delete t.crossings[i],s=z[l],!s){_.log("Found bad marching index:",l,e,t.level);break}if(h.push(d(t,e,s)),e[0]+=s[0],e[1]+=s[1],u(h[h.length-1],h[h.length-2])&&h.pop(),i=e.join(","),i===o&&s.join(",")===p||r&&(s[0]&&(e[0]<0||e[0]>m-2)||s[1]&&(e[1]<0||e[1]>g-2)))break;l=t.crossings[i]}1e4===a&&_.log("Infinite loop in contour?");var v,y,x,b,w,k,M,A=u(h[0],h[h.length-1]),T=0,L=.2*t.smoothing,O=[],D=0;for(a=1;a=D;a--)if(v=O[a],v=D&&v+O[y]20&&e?208===t||1114===t?n=0===r[0]?1:-1:a=0===r[1]?1:-1:M.indexOf(t)!==-1?a=1:T.indexOf(t)!==-1?n=1:A.indexOf(t)!==-1?a=-1:n=-1,[n,a]}function u(t,e){return Math.abs(t[0]-e[0])<.01&&Math.abs(t[1]-e[1])<.01}function f(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function d(t,e,r){var n=e[0]+Math.max(r[0],0),a=e[1]+Math.max(r[1],0),o=t.z[a][n],i=t.xaxis,l=t.yaxis;if(r[1]){var s=(t.level-o)/(t.z[a][n+1]-o);return[i.c2p((1-s)*t.x[n]+s*t.x[n+1],!0),l.c2p(t.y[a],!0)]}var c=(t.level-o)/(t.z[a+1][n]-o);return[i.c2p(t.x[n],!0),l.c2p((1-c)*t.y[a]+c*t.y[a+1],!0)]}function h(t,e,r){var n=t.plot.select(".maplayer").selectAll("g.contour."+r).data(e);return n.enter().append("g").classed("contour",!0).classed(r,!0),n.exit().remove(),n}function p(t,e,r){var n=t.selectAll("g.contourbg").data([0]);n.enter().append("g").classed("contourbg",!0);var a=n.selectAll("path").data("fill"===r.coloring?[0]:[]);a.enter().append("path"),a.exit().remove(),a.attr("d","M"+e.join("L")+"Z").style("stroke","none")}function g(t,e,r,n){var a=t.selectAll("g.contourfill").data([0]);a.enter().append("g").classed("contourfill",!0);var o=a.selectAll("path").data("fill"===n.coloring?e:[]);o.enter().append("path"),o.exit().remove(),o.each(function(t){var e=m(t,r);e?b.select(this).attr("d",e).style("stroke","none"):b.select(this).remove()})}function m(t,e){function r(t){return Math.abs(t[1]-e[0][1])<.01}function n(t){return Math.abs(t[1]-e[2][1])<.01}function a(t){return Math.abs(t[0]-e[0][0])<.01}function o(t){return Math.abs(t[0]-e[2][0])<.01}for(var i,l,s,c,u,f,d=t.edgepaths.length||t.z[0][0]=0&&(l=m,c=u):Math.abs(i[1]-l[1])<.01?Math.abs(i[1]-m[1])<.01&&(m[0]-i[0])*(l[0]-m[0])>=0&&(l=m,c=u):_.log("endpt to newendpt is not vert. or horz.",i,l,m)}if(i=l,c>=0)break;d+="L"+l}if(c===t.edgepaths.length){_.log("unclosed perimeter path");break}h=c,g=p.indexOf(h)===-1,g&&(h=p[0],d+="Z")}for(h=0;h1;if(p&&!d&&"category"!==o.type){var g=e.length;if(!(g<=a))return f?e.slice(0,a):e.slice(0,a+1);if(f||h)c=e.slice(0,a);else if(1===a)c=[e[0]-.5,e[0]+.5];else{for(c=[1.5*e[0]-.5*e[1]],s=1;sy;n++)i=s(t,e,o(i));return i>y&&f.log("interp2d didn't converge quickly",i),t}function l(t){var e,r,n,a,o,i,l,s,c=[],u={},f=[],d=t[0],h=[],p=[0,0,0],g=v(t);for(r=0;r=0;o--)a=f[o],r=a[0],n=a[1],i=((u[[r-1,n]]||p)[2]+(u[[r+1,n]]||p)[2]+(u[[r,n-1]]||p)[2]+(u[[r,n+1]]||p)[2])/20,i&&(l[a]=[r,n,i],f.splice(o,1),s=!0);if(!s)throw"findEmpties iterated with no new neighbors";for(a in l)u[a]=l[a],c.push(l[a])}return c.sort(function(t,e){return e[2]-t[2]})}function s(t,e,r){var n,a,o,i,l,s,c,u,f,d,h,p,g,m=0;for(i=0;ip&&(m=Math.max(m,Math.abs(t[a][o]-h)/(g-p))))}return m}var c=t("fast-isnumeric"),u=t("../../registry"),f=t("../../lib"),d=t("../../plots/cartesian/axes"),h=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),m=t("./convert_column_xyz"),v=t("./max_row_length");e.exports=function(t,e){function r(t){z=e._input.zsmooth=e.zsmooth=!1,f.notifier("cannot fast-zsmooth: "+t)}var o,s,c,y,x,b,_,w,k=d.getFromId(t,e.xaxis||"x"),M=d.getFromId(t,e.yaxis||"y"),A=u.traceIs(e,"contour"),T=u.traceIs(e,"histogram"),L=u.traceIs(e,"gl2d"),z=A?"best":e.zsmooth;if(k._minDtick=0,M._minDtick=0,T){var C=h(t,e);o=C.x,s=C.x0,c=C.dx,y=C.y,x=C.y0,b=C.dy,_=C.z}else g(e)&&m(e,k,M),o=e.x?k.makeCalcdata(e,"x"):[],y=e.y?M.makeCalcdata(e,"y"):[],s=e.x0||0,c=e.dx||1,x=e.y0||0,b=e.dy||1,_=n(e),(A||e.connectgaps)&&(e._emptypoints=l(_),e._interpz=i(_,e._emptypoints,e._interpz));if("fast"===z)if("log"===k.type||"log"===M.type)r("log axis found");else if(!T){if(o.length){var S=(o[o.length-1]-o[0])/(o.length-1),O=Math.abs(S/100);for(w=0;wO){r("x scale is not linear");break}}if(y.length&&"fast"===z){var D=(y[y.length-1]-y[0])/(y.length-1),P=Math.abs(D/100);for(w=0;wP){r("y scale is not linear");break}}}var N=v(_),E="scaled"===e.xtype?"":o,I=a(e,E,s,c,N,k),R="scaled"===e.ytype?"":y,F=a(e,R,x,b,_.length,M);L||(d.expand(k,I),d.expand(M,F));var j={x:I,y:F,z:_};if(p(e,_,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var q="contour"===e.type?"heatmap":"histogram2d";j.xfill=a(q,E,s,c,N,k),j.yfill=a(q,R,x,b,_.length,M)}return[j]};var y=.01,x=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":36,"../../lib":122,"../../plots/cartesian/axes":149,"../../registry":188,"../histogram2d/calc":252,"./convert_column_xyz":233,"./has_columns":235,"./max_row_length":238,"fast-isnumeric":17}],232:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,s="cb"+r.uid,c=r.zmin,u=r.zmax;if(n(c)||(c=a.aggNums(Math.min,null,r.z)),n(u)||(u=a.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+s).remove(),!r.showscale)return void o.autoMargin(t,s);var f=e[0].t.cb=l(t,s),d=i.makeColorScaleFunc(i.extractScale(r.colorscale,c,u),{noNumericCheck:!0});f.fillcolor(d).filllevels({start:c,end:u,size:(u-c)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":33,"../../components/colorscale":44,"../../lib":122,"../../plots/plots":173,"fast-isnumeric":17}],233:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var a,o=t.x.slice(),i=t.y.slice(),l=t.z,s=t.text,c=Math.min(o.length,i.length,l.length),u=void 0!==s&&!Array.isArray(s[0]);for(c=y[0].length||f<0||f>y.length)return}else{if(n.inbox(e-m[0],e-m[m.length-1])>o||n.inbox(r-v[0],r-v[v.length-1])>o)return;if(l){var w;for(b=[2*m[0]-m[1]],w=1;w0&&o0&&l0;)_=m.c2p(L[A]),A--;for(_0;)M=v.c2p(z[A]),A--;if(M0&&(n=!0);for(var l=0;lo)return r[t]=o,o-r[t]}return 0},max:function(t,e,r,a){var o=a[e];if(n(o)){if(o=Number(o),!n(r[t]))return r[t]=o,o;if(r[t]=0&&yR;r--)if(f[r]){F=r;break}for(r=R;r<=F;r++)n(u[r])&&n(f[r])&&I.push({p:u[r],s:f[r],b:0});return I}}},{"../../lib":122,"../../plots/cartesian/axes":149,"./average":243,"./bin_functions":245,"./clean_bins":247,"./norm_functions":250,"fast-isnumeric":17}],247:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib").cleanDate,o=t("../../constants/numerical").ONEDAY;e.exports=function(t,e,r){var i=e.type,l=r+"bins",s=t[l];s||(s=t[l]={});var c="date"===i?function(t){return t||0===t?a(t):null}:function(t){return n(t)?Number(t):null};s.start=c(s.start),s.end=c(s.end);var u="date"===i?o:1,f=s.size;if(n(f))s.size=f>0?Number(f):u;else if("string"!=typeof f)s.size=u;else{var d=f.charAt(0),h=f.substr(1);h=n(h)?Number(h):0,(h<=0||"date"!==i||"M"!==d||h!==Math.round(h))&&(s.size=u)}var p="autobin"+r;"boolean"!=typeof t[p]&&(t[p]=!((s.start||0===s.start)&&(s.end||0===s.end))),t[p]||delete t["nbins"+r]}},{"../../constants/numerical":110,"../../lib":122,"fast-isnumeric":17}],248:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../components/color"),o=t("./bin_defaults"),i=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),s=t("./attributes");e.exports=function(t,e,r,c){function u(r,a){return n.coerce(t,e,s,r,a)}var f=u("x"),d=u("y");u("text");var h=u("orientation",d&&!f?"h":"v"),p=e["v"===h?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===h?"x":"y"];g&&u("histfunc");var m="h"===h?["y"]:["x"];o(t,e,u,m),i(t,e,u,r,c),l(t,e,a.defaultLine,{axis:"y"}),l(t,e,a.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":30,"../../components/errorbars/defaults":58,"../../lib":122,"../bar/style_defaults":209,"./attributes":242,"./bin_defaults":244}],249:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("../bar/layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("../bar/layout_defaults"),n.calc=t("./calc"),n.setPositions=t("../bar/set_positions"),n.plot=t("../bar/plot"),n.style=t("../bar/style"),n.colorbar=t("../scatter/colorbar"),n.hoverPoints=t("../bar/hover"),n.moduleType="trace",n.name="histogram",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":157,"../bar/hover":201,"../bar/layout_attributes":203,"../bar/layout_defaults":204,"../bar/plot":205,"../bar/set_positions":206,"../bar/style":208,"../scatter/colorbar":274,"./attributes":242,"./calc":246,"./defaults":248}],250:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,a=0;ay&&g.splice(y,g.length-y),v.length>y&&v.splice(y,v.length-y),!e.autobinx&&"xbins"in e||(e.xbins=a.autoBin(g,p,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start=p.c2r(a.tickIncrement(p.r2c(e.xbins.start),e.xbins.size,!0)),e.xbins.end=p.c2r(a.tickIncrement(p.r2c(e.xbins.end),e.xbins.size))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=a.autoBin(v,m,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start=m.c2r(a.tickIncrement(m.r2c(e.ybins.start),e.ybins.size,!0)),e.ybins.end=m.c2r(a.tickIncrement(m.r2c(e.ybins.end),e.ybins.size))),e._input.ybins=e.ybins),d=[];var x,b,_=[],w=[],k="string"==typeof e.xbins.size?[]:e.xbins,M="string"==typeof e.xbins.size?[]:e.ybins,A=0,T=[],L=e.histnorm,z=e.histfunc,C=L.indexOf("density")!==-1,S="max"===z||"min"===z,O=S?null:0,D=o.count,P=i[L],N=!1,E=[],I=[],R="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";R&&"count"!==z&&(N="avg"===z,D=o[z]);var F=e.xbins,j=p.r2c(F.start),q=p.r2c(F.end)+(j-a.tickIncrement(j,F.size))/1e6;for(h=j;h=0&&x=0&&b")}return g};var s},{"../../components/color":30,"./helpers":263,"fast-isnumeric":17,tinycolor2:20}],262:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r,o){function i(r,o){return n.coerce(t,e,a,r,o)}var l=n.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,m=g||"inside"===p,v=g||"outside"===p;if(m||v){var y=l(i,"textfont",o.font);m&&l(i,"insidetextfont",y),v&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":122,"./attributes":259}],263:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return r.lastIndexOf(".")!==-1&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return r.lastIndexOf(".")!==-1&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":122}],264:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.layoutAttributes=t("./layout_attributes"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.styleOne=t("./style_one"),n.moduleType="trace",n.name="pie",n.basePlotModule=t("./base_plot"),n.categories=["pie","showLegend"],n.meta={},e.exports=n},{"./attributes":259,"./base_plot":260,"./calc":261,"./defaults":262,"./layout_attributes":265,"./layout_defaults":266,"./plot":267,"./style":268,"./style_one":269}],265:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],266:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function r(r,o){return n.coerce(t,e,a,r,o)}r("hiddenlabels")}},{"../../lib":122,"./layout_attributes":265}],267:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/r.vTotal,.5),l=1-r.trace.hole,s=a(e,r),c={scale:s*r.r*2/n,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=r.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/r.r)-f*o/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=r.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),m={scale:2*g/t.width,rCenter:Math.cos(g/r.r)-g/o/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>d.scale?m:d;return c.scale<1&&v.scale>c.scale?v:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var r=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(r)),(1-e.trace.hole)/2)}function o(t,e){var r=e.pxmid[0],n=e.pxmid[1],a=t.width/2,o=t.height/2;return r<0&&(a*=-1),n<0&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+r*r/(n*n)),outside:!0}}function i(t,e){function r(t,e){return t.pxmid[1]-e.pxmid[1]}function n(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,r){r||(r={});var n,a,o,l,d,h,g=r.labelExtraY+(i?r.yLabelMax:r.yLabelMin),m=i?t.yLabelMin:t.yLabelMax,v=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-m;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-m-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*f>0&&(n=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,m,v;for(i=0;i<2;i++)for(l=i?r:n,c=i?Math.max:Math.min,f=i?1:-1,o=0;o<2;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),m=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(r/c(l.tilt,Math.sin(s),l.depth),n/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&h.indexOf(l.scalegroup)===-1&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,r){if(!t)return 1;var n=Math.sin(t*Math.PI/180);return Math.max(.01,r*n*Math.abs(e)+2*Math.sqrt(1-n*n*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;l(e,r._size);var c=r._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],m=c.trace,v=0,y=(m.depth||0)*c.r*Math.sin(v)/2,x=m.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(v),k=l.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],v=!1;l.each(function(i){function l(e){var n=t._fullLayout,o=t._fullData[m.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&n.hovermode!==!1&&"none"!==l&&"skip"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=r.separators,p=[];l.indexOf("label")!==-1&&p.push(i.label),o.text&&o.text[i.i]&&l.indexOf("text")!==-1&&p.push(o.text[i.i]),l.indexOf("value")!==-1&&p.push(g.formatPieValue(i.v,h)),l.indexOf("percent")!==-1&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:l.indexOf("name")!==-1?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:n._hoverlayer.node(),outerContainer:n._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(r._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],t._hoverdata.trace=e.trace,f.click(t,{target:!0})}function b(t,e,r,n){return"a"+n*c.r+","+n*w+" "+x+" "+i.largeArc+(r?" 1 ":" 0 ")+n*(e[0]-t[0])+","+n*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y),m.pull){var z=+(Array.isArray(m.pull)?m.pull[i.i]:m.pull)||0;z>0&&(k+=z*i.pxmid[0],M+=z*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var C=m.hole;if(i.v===c.vTotal){var S="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";C?T.attr("d","M"+(k+C*i.px0[0])+","+(M+C*i.px0[1])+b(i.px0,i.pxmid,!1,C)+b(i.pxmid,i.px0,!1,C)+"Z"+S):T.attr("d",S)}else{var O=b(i.px0,i.px1,!0,1);if(C){var D=1-C;T.attr("d","M"+(k+C*i.px1[0])+","+(M+C*i.px1[1])+b(i.px1,i.px0,!1,C)+"l"+D*i.px0[0]+","+D*i.px0[1]+O+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+O+"Z")}var P=Array.isArray(m.textposition)?m.textposition[i.i]:m.textposition,N=A.selectAll("g.slicetext").data(i.text&&"none"!==P?[0]:[]);N.enter().append("g").classed("slicetext",!0),N.exit().remove(),N.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===P?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,r=h.bBox(t.node());"outside"===P?e=o(r,i):(e=n(r,i,c),"auto"===P&&e.scale<1&&(t.call(h.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),r=h.bBox(t.node())),e=o(r,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-r.height/2,i.yLabelMid=l,i.yLabelMax=l+r.height/2,i.labelExtraX=0,i.labelExtraY=0,v=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(r.left+r.right)/2+","+-(r.top+r.bottom)/2+")")})}),v&&i(s,m),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+n+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(n+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":30,"../../components/drawing":53,"../../lib/svg_text_utils":134,"../../plots/cartesian/graph_interact":156,"./helpers":263,d3:14}],268:[function(t,e,r){"use strict";var n=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],r=e.trace,o=n.select(this);o.style({opacity:r.opacity}),o.selectAll(".top path.surface").each(function(t){n.select(this).call(a,t,r)})})}},{"./style_one":269,d3:14}],269:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var a=r.marker.line.color;Array.isArray(a)&&(a=a[e.i]||n.defaultLine);var o=r.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(n.stroke,a)}},{"../../components/color":30}],270:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){var e=t[0].trace,r=e.marker;if(n.mergeArray(e.text,t,"tx"),n.mergeArray(e.textposition,t,"tp"),e.textfont&&(n.mergeArray(e.textfont.size,t,"ts"),n.mergeArray(e.textfont.color,t,"tc"),n.mergeArray(e.textfont.family,t,"tf")),r&&r.line){var a=r.line;n.mergeArray(r.opacity,t,"mo"),n.mergeArray(r.symbol,t,"mx"),n.mergeArray(r.color,t,"mc"),n.mergeArray(a.color,t,"mlc"),n.mergeArray(a.width,t,"mlw")}}},{"../../lib":122}],271:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),a=t("../../components/errorbars/attributes"),o=t("../../components/colorbar/attributes"),i=t("../../components/drawing"),l=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},ids:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"},simplify:{valType:"boolean",dflt:!0}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:l({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},colorbar:o,line:l({},{width:{valType:"number",min:0,arrayOk:!0}},n("marker.line"))},n("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},error_y:a,error_x:a}},{"../../components/colorbar/attributes":31,"../../components/colorscale/color_attributes":37,"../../components/drawing":53,"../../components/errorbars/attributes":55,"../../lib/extend":119,"./constants":276}],272:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var r,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(r=e.marker,s=r.size,Array.isArray(s)){var v={type:"linear"};a.setConvert(v),s=v.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,a.expand(u,d,g),a.expand(f,h,m);var b=new Array(p);for(c=0;c=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}}}}},{}],274:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,s=r.marker,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===s||!s.showscale)return void o.autoMargin(t,c);var u=s.color,f=s.cmin,d=s.cmax;n(f)||(f=a.aggNums(Math.min,null,u)),n(d)||(d=a.aggNums(Math.max,null,u));var h=e[0].t.cb=l(t,c),p=i.makeColorScaleFunc(i.extractScale(s.colorscale,f,d),{noNumericCheck:!0});h.fillcolor(p).filllevels({start:f,end:d,size:(d-f)/254}).options(s.colorbar)()}},{"../../components/colorbar/draw":33,"../../components/colorscale":44,"../../lib":122,"../../plots/plots":173,"fast-isnumeric":17}],275:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&n(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(n(t,"marker")&&a(t,t.marker.color,"marker","c"),n(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":36,"../../components/colorscale/has_colorscale":43,"./subtypes":291}],276:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],277:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,o){return n.coerce(t,e,a,r,o)}var m=l(t,e,g),v=mB!=P>=B&&(S=z[T-1][0],O=z[T][0],C=S+(O-S)*(B-D)/(P-D),R=Math.min(R,C),F=Math.max(F,C));R=Math.max(R,0),F=Math.min(F,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),n.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:F,y0:B,y1:B,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":30,"../../components/errorbars":59,"../../lib":122,"../../plots/cartesian/constants":154,"../../plots/cartesian/graph_interact":156,"./get_trace_color":279}],281:[function(t,e,r){"use strict";var n={},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"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":157,"./arrays_to_calcdata":270,"./attributes":271,"./calc":272,"./clean_data":273,"./colorbar":274,"./defaults":277,"./hover":280,"./plot":288,"./select":289,"./style":290,"./subtypes":291}],282:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,i){var l=(t.marker||{}).color;if(i("line.color",r),n(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=!Array.isArray(l)&&l||r;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":39,"../../components/colorscale/has_colorscale":43}],283:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),a=k.c2p(t[e].y);return r!==n&&a!==n&&[r,a]}function a(t){var e=t[0]/w._length,r=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function o(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var i,l,s,c,u,f,d,h,p,g,m,v,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.simplify,A=e.connectGaps,T=e.baseTolerance,L=e.linear,z=[],C=.2,S=new Array(t.length),O=0;for(M||(T=C=-1),i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,c=f,h=!1):y=t.length||!f)break;S[O++]=f,l=f}}else S[O++]=c}z.push(S.slice(0,O))}return z}},{"../../constants/numerical":110}],284:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],285:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,a,o=null,i=0;i0?Math.max(e,a):0}}},{"fast-isnumeric":17}],287:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,r,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(r=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",r),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?n.background:n.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":30,"../../components/colorscale/defaults":39,"../../components/colorscale/has_colorscale":43,"./subtypes":291}],288:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=i.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function a(t,e,r,n,a,h,g){function m(t){return M?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,r,n=t[0].trace,a=i.select(this),o=u.hasMarkers(n),c=u.hasText(n),f=x(n),d=b,h=b;o&&(d=n.marker.maxdisplayed?v:l.identity),c&&(h=n.marker.maxdisplayed?v:l.identity),r=a.selectAll("path.point"),e=r.data(d,f);var p=e.enter().append("path").classed("point",!0);p.call(s.pointStyle,n).call(s.translatePoints,A,T,n),M&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=m(i.select(this));s.translatePoint(t,e,A,T),s.singlePointStyle(t,e,n)}),M?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=a.selectAll("g"),e=r.data(h,f),e.enter().append("g").append("text"),e.each(function(t){var e=m(i.select(this).select("text"));s.translatePoint(t,e,A,T)}),e.selectAll("text").call(s.textPointStyle,n).each(function(t){var e=t.xp||A.c2p(t.x),r=t.yp||T.c2p(t.y);i.select(this).selectAll("tspan").each(function(){m(i.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,k;o(t,e,r,n,a);var M=!!g&&g.duration>0,A=r.xaxis,T=r.yaxis,L=n[0].trace,z=L.line,C=i.select(h);if(C.call(c.plot,r,g),L.visible===!0){m(C).style("opacity",L.opacity);var S,O,D=L.fill.charAt(L.fill.length-1);"x"!==D&&"y"!==D&&(D=""),n[0].node3=C,f(n);var P="",N=[],E=L._prevtrace;E&&(P=E._prevRevpath||"",O=E._nextFill,N=E._polygons);var I,R,F,j,q,B,H,V,Z,X="",U="",G=[],Y=[],W=l.noop;if(S=L._ownFill,u.hasLines(L)||"none"!==L.fill){for(O&&O.datum(n),["hv","vh","hvh","vhv"].indexOf(z.shape)!==-1?(F=s.steps(z.shape),j=s.steps(z.shape.split("").reverse().join(""))):F=j="spline"===z.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?s.smoothclosed(t.slice(1),z.smoothing):s.smoothopen(t,z.smoothing)}:function(t){return"M"+t.join("L")},q=function(t){return j(t.reverse())},G=d(n,{xaxis:A,yaxis:T,connectGaps:L.connectgaps,baseTolerance:Math.max(z.width||1,3)/4,linear:"linear"===z.shape,simplify:z.simplify}),Z=L._polygons=new Array(G.length),k=0;k1}),W=function(t){return function(e){if(I=F(e),R=q(e),X?D?(X+="L"+I.substr(1),U=R+("L"+U.substr(1))):(X+="Z"+I,U=R+"Z"+U):(X=I,U=R),u.hasLines(L)&&e.length>1){var r=i.select(this);if(r.datum(n),t)m(r.style("opacity",0).attr("d",I).call(s.lineGroupStyle)).style("opacity",1);else{var a=m(r);a.attr("d",I),s.singleLineStyle(n,a)}}}}}var Q=C.selectAll(".js-line").data(Y);m(Q.exit()).style("opacity",0).remove(),Q.each(W(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(W(!0)),G.length&&(S?B&&V&&(D?("y"===D?B[1]=V[1]=T.c2p(0,!0):"x"===D&&(B[0]=V[0]=A.c2p(0,!0)),m(S).attr("d","M"+V+"L"+B+"L"+X.substr(1))):m(S).attr("d",X+"Z")):"tonext"===L.fill.substr(0,6)&&X&&P&&("tonext"===L.fill?m(O).attr("d",X+"Z"+P+"Z"):m(O).attr("d",X+"L"+P.substr(1)+"Z"),L._polygons=L._polygons.concat(N)),L._prevRevpath=U,L._prevPolygons=Z);var $=C.selectAll(".points");w=$.data([n]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function o(t,e,r,n,a){var o=r.xaxis,l=r.yaxis,s=i.extent(o.range.map(o.r2l).map(o.l2c)),c=i.extent(l.range.map(l.r2l).map(l.l2c)),f=n[0].trace;if(u.hasMarkers(f)){var d=f.marker.maxdisplayed;if(0!==d){var h=n.filter(function(t){return t.x>=s[0]&&t.x<=s[1]&&t.y>=c[0]&&t.y<=c[1]}),p=Math.ceil(h.length/d),g=0;a.forEach(function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(u=p.selectAll("g.trace"),f=u.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),h(t,e,r),n(t,p),s=0,c=[];sn?1:-1}),m){l&&(d=l());var v=i.transition().duration(o.duration).ease(o.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()});v.each(function(){p.selectAll("g.trace").each(function(n,i){a(t,i,e,n,r,this,o)})})}else p.selectAll("g.trace").each(function(n,i){a(t,i,e,n,r,this,o)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":53,"../../components/errorbars":59,"../../lib":122,"../../lib/polygon":129,"./arrays_to_calcdata":270,"./line_points":283,"./link_traces":285,"./subtypes":291,d3:14}],289:[function(t,e,r){"use strict";var n=t("./subtypes"),a=.2;e.exports=function(t,e){var r,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!n.hasMarkers(d)&&!n.hasText(d);if(d.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;rM&&L.splice(M,L.length-M)}return l(e),"undefined"!=typeof L&&o.mergeArray(L,A,"ms"),A}},{"../../lib":122,"../../plots/cartesian/axes":149,"../scatter/colorscale_calc":275,"../scatter/subtypes":291,"fast-isnumeric":17}],296:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../scatter/constants"),o=t("../scatter/subtypes"),i=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),s=t("../scatter/line_shape_defaults"),c=t("../scatter/text_defaults"),u=t("../scatter/fillcolor_defaults"),f=t("./attributes");e.exports=function(t,e,r,d){function h(r,a){return n.coerce(t,e,f,r,a)}var p,g=h("a"),m=h("b"),v=h("c");if(g?(p=g.length,m?(p=Math.min(p,m.length),v&&(p=Math.min(p,v.length))):p=v?Math.min(p,v.length):0):m&&v&&(p=Math.min(m.length,v.length)),!p)return void(e.visible=!1);g&&p"),l}}},{"../../plots/cartesian/axes":149,"../scatter/hover":280}],298:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/ternary":181,"../scatter/colorbar":274,"./attributes":294,"./calc":295,"./defaults":296,"./hover":297,"./plot":299,"./select":300,"./style":301}],299:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e){var r=t.plotContainer;r.select(".scatterlayer").selectAll("*").remove();for(var a={xaxis:t.xaxis,yaxis:t.yaxis,plot:r},o=new Array(e.length),i=t.graphDiv.calcdata,l=0;l paper // first convert to fraction of the axis - position = (position - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + position = axOld.r2fraction(position); // next scale the axis to the whole plot position = axOld.domain[0] + @@ -13487,8 +13486,7 @@ function drawOne(gd, index, opt, value) { (axNew.domain[1] - axNew.domain[0]); // finally convert to data coordinates - position = axNew.range[0] + - position * (axNew.range[1] - axNew.range[0]); + position = axNew.fraction2r(position); } } @@ -13505,7 +13503,8 @@ function drawOne(gd, index, opt, value) { optionsIn[axLetter] = position; } - var options = handleAnnotationDefaults(optionsIn, fullLayout); + var options = {}; + handleAnnotationDefaults(optionsIn, options, fullLayout); fullLayout.annotations[index] = options; var xa = Axes.getFromId(gd, options.xref), @@ -13619,20 +13618,21 @@ function drawOne(gd, index, opt, value) { // outside the visible plot (as long as the axis // isn't autoranged - then we need to draw it // anyway to get its bounding box) - if(!ax.autorange && ((options[axLetter] - ax.range[0]) * - (options[axLetter] - ax.range[1]) > 0)) { + var posFraction = ax.r2fraction(options[axLetter]); + if(!ax.autorange && (posFraction < 0 || posFraction > 1)) { if(options['a' + axLetter + 'ref'] === axRef) { - if((options['a' + axLetter] - ax.range[0]) * - (options['a' + axLetter] - ax.range[1]) > 0) { + posFraction = ax.r2fraction(options['a' + axLetter]); + if(posFraction < 0 || posFraction > 1) { annotationIsOffscreen = true; } - } else { + } + else { annotationIsOffscreen = true; } if(annotationIsOffscreen) return; } - annPosPx[axLetter] = ax._offset + ax.l2p(options[axLetter]); + annPosPx[axLetter] = ax._offset + ax.r2p(options[axLetter]); alignPosition = 0.5; } else { @@ -13645,7 +13645,7 @@ function drawOne(gd, index, opt, value) { var alignShift = 0; if(options['a' + axLetter + 'ref'] === axRef) { - annPosPx['aa' + axLetter] = ax._offset + ax.l2p(options['a' + axLetter]); + annPosPx['aa' + axLetter] = ax._offset + ax.r2p(options['a' + axLetter]); } else { if(options.showarrow) { alignShift = options['a' + axLetter]; @@ -13845,22 +13845,22 @@ function drawOne(gd, index, opt, value) { ann.call(Lib.setTranslate, xcenter, ycenter); update[annbase + '.x'] = xa ? - (options.x + dx / xa._m) : + xa.p2r(xa.r2p(options.x) + dx) : ((arrowX + dx - gs.l) / gs.w); update[annbase + '.y'] = ya ? - (options.y + dy / ya._m) : + ya.p2r(ya.r2p(options.y) + dy) : (1 - ((arrowY + dy - gs.t) / gs.h)); if(options.axref === options.xref) { update[annbase + '.ax'] = xa ? - (options.ax + dx / xa._m) : - ((arrowX + dx - gs.l) / gs.w); + xa.p2r(xa.r2p(options.ax) + dx) : + ((arrowX + dx - gs.l) / gs.w); } if(options.ayref === options.yref) { update[annbase + '.ay'] = ya ? - (options.ay + dy / ya._m) : - (1 - ((arrowY + dy - gs.t) / gs.h)); + ya.p2r(ya.r2p(options.ay) + dy) : + (1 - ((arrowY + dy - gs.t) / gs.h)); } anng.attr({ @@ -13906,13 +13906,13 @@ function drawOne(gd, index, opt, value) { var csr = 'pointer'; if(options.showarrow) { if(options.axref === options.xref) { - update[annbase + '.ax'] = xa.p2l(xa.l2p(options.ax) + dx); + update[annbase + '.ax'] = xa.p2r(xa.r2p(options.ax) + dx); } else { update[annbase + '.ax'] = options.ax + dx; } if(options.ayref === options.yref) { - update[annbase + '.ay'] = ya.p2l(ya.l2p(options.ay) + dy); + update[annbase + '.ay'] = ya.p2r(ya.r2p(options.ay) + dy); } else { update[annbase + '.ay'] = options.ay + dy; } @@ -14018,7 +14018,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":116,"../../lib/setcursor":126,"../../lib/svg_text_utils":128,"../../plotly":138,"../../plots/cartesian/axes":142,"../../plots/plots":167,"../color":26,"../dragelement":48,"../drawing":50,"./annotation_defaults":17,"./defaults":21,"./draw_arrow_head":23,"d3":10,"fast-isnumeric":13}],23:[function(require,module,exports){ +},{"../../lib":118,"../../lib/setcursor":128,"../../lib/svg_text_utils":130,"../../plotly":140,"../../plots/cartesian/axes":145,"../../plots/plots":169,"../color":26,"../dragelement":47,"../drawing":49,"./annotation_defaults":17,"./defaults":21,"./draw_arrow_head":23,"d3":10,"fast-isnumeric":13}],23:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14137,7 +14137,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { if(doEnd) drawhead(end, endRot); }; -},{"../color":26,"../drawing":50,"./arrow_paths":18,"d3":10,"fast-isnumeric":13}],24:[function(require,module,exports){ +},{"../color":26,"../drawing":49,"./arrow_paths":18,"d3":10,"fast-isnumeric":13}],24:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14149,33 +14149,21 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { 'use strict'; -var Plotly = require('../../plotly'); - -exports.moduleType = 'component'; - -exports.name = 'annotations'; - -exports.ARROWPATHS = require('./arrow_paths'); - -exports.layoutAttributes = require('./attributes'); - -exports.supplyLayoutDefaults = require('./defaults'); - -exports.calcAutorange = require('./calc_autorange'); - -exports.arrowhead = require('./draw_arrow_head'); - var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; -exports.add = function(gd) { - var nextAnn = gd._fullLayout.annotations.length; +module.exports = { + moduleType: 'component', + name: 'annotations', + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), - Plotly.relayout(gd, 'annotations[' + nextAnn + ']', 'add'); + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne }; -},{"../../plotly":138,"./arrow_paths":18,"./attributes":19,"./calc_autorange":20,"./defaults":21,"./draw":22,"./draw_arrow_head":23}],25:[function(require,module,exports){ +},{"./attributes":19,"./calc_autorange":20,"./defaults":21,"./draw":22}],25:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14528,7 +14516,7 @@ module.exports = { } }; -},{"../../lib/extend":114,"../../plots/cartesian/layout_attributes":152,"../../plots/font_attributes":163}],28:[function(require,module,exports){ +},{"../../lib/extend":115,"../../plots/cartesian/layout_attributes":154,"../../plots/font_attributes":165}],28:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14595,7 +14583,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":116,"../../plots/cartesian/tick_label_defaults":158,"../../plots/cartesian/tick_mark_defaults":159,"../../plots/cartesian/tick_value_defaults":160,"./attributes":27}],29:[function(require,module,exports){ +},{"../../lib":118,"../../plots/cartesian/tick_label_defaults":160,"../../plots/cartesian/tick_mark_defaults":161,"../../plots/cartesian/tick_value_defaults":162,"./attributes":27}],29:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15227,7 +15215,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":116,"../../lib/extend":114,"../../lib/setcursor":126,"../../plotly":138,"../../plots/cartesian/axes":142,"../../plots/cartesian/axis_defaults":144,"../../plots/cartesian/layout_attributes":152,"../../plots/cartesian/position_defaults":155,"../../plots/plots":167,"../../registry":174,"../color":26,"../dragelement":48,"../drawing":50,"../titles":101,"./attributes":27,"d3":10,"tinycolor2":16}],30:[function(require,module,exports){ +},{"../../lib":118,"../../lib/extend":115,"../../lib/setcursor":128,"../../plotly":140,"../../plots/cartesian/axes":145,"../../plots/cartesian/axis_defaults":147,"../../plots/cartesian/layout_attributes":154,"../../plots/cartesian/position_defaults":157,"../../plots/plots":169,"../../registry":176,"../color":26,"../dragelement":47,"../drawing":49,"../titles":100,"./attributes":27,"d3":10,"tinycolor2":16}],30:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15246,28 +15234,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":116}],31:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -exports.attributes = require('./attributes'); - -exports.supplyDefaults = require('./defaults'); - -exports.draw = require('./draw'); - -exports.hasColorbar = require('./has_colorbar'); - -},{"./attributes":27,"./defaults":28,"./draw":29,"./has_colorbar":30}],32:[function(require,module,exports){ +},{"../../lib":118}],31:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15322,7 +15289,7 @@ module.exports = { } }; -},{}],33:[function(require,module,exports){ +},{}],32:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15388,7 +15355,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":116,"./flip_scale":38,"./scales":45}],34:[function(require,module,exports){ +},{"../../lib":118,"./flip_scale":37,"./scales":44}],33:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15432,7 +15399,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":114,"./attributes":32,"./scales.js":45}],35:[function(require,module,exports){ +},{"../../lib/extend":115,"./attributes":31,"./scales.js":44}],34:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15448,7 +15415,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":45}],36:[function(require,module,exports){ +},{"./scales":44}],35:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15512,7 +15479,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":116,"../colorbar/defaults":28,"../colorbar/has_colorbar":30,"./flip_scale":38,"./is_valid_scale":42,"fast-isnumeric":13}],37:[function(require,module,exports){ +},{"../../lib":118,"../colorbar/defaults":28,"../colorbar/has_colorbar":30,"./flip_scale":37,"./is_valid_scale":41,"fast-isnumeric":13}],36:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15549,7 +15516,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],38:[function(require,module,exports){ +},{}],37:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15574,7 +15541,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],39:[function(require,module,exports){ +},{}],38:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15614,7 +15581,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":35,"./is_valid_scale_array":43,"./scales":45}],40:[function(require,module,exports){ +},{"./default_scale":34,"./is_valid_scale_array":42,"./scales":44}],39:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15660,7 +15627,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":116,"./is_valid_scale":42,"fast-isnumeric":13}],41:[function(require,module,exports){ +},{"../../lib":118,"./is_valid_scale":41,"fast-isnumeric":13}],40:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15694,7 +15661,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":32,"./calc":33,"./default_scale":35,"./defaults":36,"./extract_scale":37,"./flip_scale":38,"./get_scale":39,"./has_colorscale":40,"./is_valid_scale":42,"./make_color_scale_func":44,"./scales":45}],42:[function(require,module,exports){ +},{"./attributes":31,"./calc":32,"./default_scale":34,"./defaults":35,"./extract_scale":36,"./flip_scale":37,"./get_scale":38,"./has_colorscale":39,"./is_valid_scale":41,"./make_color_scale_func":43,"./scales":44}],41:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15715,7 +15682,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":43,"./scales":45}],43:[function(require,module,exports){ +},{"./is_valid_scale_array":42,"./scales":44}],42:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15752,7 +15719,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":16}],44:[function(require,module,exports){ +},{"tinycolor2":16}],43:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15848,7 +15815,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":26,"d3":10,"fast-isnumeric":13,"tinycolor2":16}],45:[function(require,module,exports){ +},{"../color":26,"d3":10,"fast-isnumeric":13,"tinycolor2":16}],44:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15979,7 +15946,7 @@ module.exports = { ] }; -},{}],46:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16012,7 +15979,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],47:[function(require,module,exports){ +},{}],46:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16050,7 +16017,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":116}],48:[function(require,module,exports){ +},{"../../lib":118}],47:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16237,7 +16204,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../lib":116,"../../plotly":138,"../../plots/cartesian/constants":148,"./align":46,"./cursor":47,"./unhover":49}],49:[function(require,module,exports){ +},{"../../lib":118,"../../plotly":140,"../../plots/cartesian/constants":150,"./align":45,"./cursor":46,"./unhover":48}],48:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16288,7 +16255,7 @@ unhover.raw = function unhoverRaw(gd, evt) { gd._hoverdata = undefined; }; -},{"../../lib/events":113}],50:[function(require,module,exports){ +},{"../../lib/events":114}],49:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16366,14 +16333,14 @@ drawing.getPx = function(s, styleAttr) { return Number(s.style(styleAttr).replace(/px$/, '')); }; -drawing.crispRound = function(td, lineWidth, dflt) { +drawing.crispRound = function(gd, lineWidth, dflt) { // for lines that disable antialiasing we want to // make sure the width is an integer, and at least 1 if it's nonzero if(!lineWidth || !isNumeric(lineWidth)) return dflt || 0; // but not for static plots - these don't get antialiased anyway. - if(td._context.staticPlot) return lineWidth; + if(gd._context.staticPlot) return lineWidth; if(lineWidth < 1) return 1; return Math.round(lineWidth); @@ -16567,9 +16534,8 @@ drawing.singlePointStyle = function(d, sel, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); singlePointStyle(d, sel, trace, markerScale, lineScale, marker, markerLine); @@ -16581,50 +16547,22 @@ drawing.pointStyle = function(s, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales var marker = trace.marker; - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale); }); }; -// for a given color attribute (ie m -> mc = marker.color) look to see if we -// have a colorscale for it (ie mscl, mcmin, mcmax) - if we do, translate -// all numeric color values according to that scale -drawing.tryColorscale = function(cont, contIn, prefix) { - var colorArray = Lib.nestedProperty(cont, prefix + 'color').get(), - scl = Lib.nestedProperty(cont, prefix + 'colorscale').get(), - auto = Lib.nestedProperty(cont, prefix + 'cauto').get(), - minProp = Lib.nestedProperty(cont, prefix + 'cmin'), - maxProp = Lib.nestedProperty(cont, prefix + 'cmax'), - min = minProp.get(), - max = maxProp.get(); +drawing.tryColorscale = function(marker, prefix) { + var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker, + scl = cont.colorscale, + colorArray = cont.color; - // TODO handle this in Colorscale.calc if(scl && Array.isArray(colorArray)) { - if(auto || !isNumeric(min) || !isNumeric(max)) { - min = Infinity; - max = -Infinity; - colorArray.forEach(function(color) { - if(isNumeric(color)) { - if(min > color) min = +color; - if(max < color) max = +color; - } - }); - if(min > max) { - min = 0; - max = 1; - } - minProp.set(min); - maxProp.set(max); - Lib.nestedProperty(contIn, prefix + 'cmin').set(min); - Lib.nestedProperty(contIn, prefix + 'cmax').set(max); - } - return Colorscale.makeColorScaleFunc( - Colorscale.extractScale(scl, min, max) + Colorscale.extractScale(scl, cont.cmin, cont.cmax) ); } else return Lib.identity; @@ -16892,7 +16830,7 @@ drawing.setClipUrl = function(s, localId) { s.attr('clip-path', 'url(' + url + ')'); }; -},{"../../constants/xmlns_namespaces":108,"../../lib":116,"../../lib/svg_text_utils":128,"../../registry":174,"../../traces/scatter/make_bubble_size_func":252,"../../traces/scatter/subtypes":257,"../color":26,"../colorscale":41,"./symbol_defs":51,"d3":10,"fast-isnumeric":13}],51:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":108,"../../lib":118,"../../lib/svg_text_utils":130,"../../registry":176,"../../traces/scatter/make_bubble_size_func":255,"../../traces/scatter/subtypes":260,"../color":26,"../colorscale":40,"./symbol_defs":50,"d3":10,"fast-isnumeric":13}],50:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17368,7 +17306,7 @@ module.exports = { } }; -},{"d3":10}],52:[function(require,module,exports){ +},{"d3":10}],51:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17467,7 +17405,7 @@ module.exports = { } }; -},{}],53:[function(require,module,exports){ +},{}],52:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17530,7 +17468,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":142,"../../registry":174,"./compute_error":54,"fast-isnumeric":13}],54:[function(require,module,exports){ +},{"../../plots/cartesian/axes":145,"../../registry":176,"./compute_error":53,"fast-isnumeric":13}],53:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17626,7 +17564,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],55:[function(require,module,exports){ +},{}],54:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17703,7 +17641,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":116,"../../registry":174,"./attributes":52,"fast-isnumeric":13}],56:[function(require,module,exports){ +},{"../../lib":118,"../../registry":176,"./attributes":51,"fast-isnumeric":13}],55:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17762,7 +17700,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":52,"./calc":53,"./defaults":55,"./plot":57,"./style":58}],57:[function(require,module,exports){ +},{"./attributes":51,"./calc":52,"./defaults":54,"./plot":56,"./style":57}],56:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17926,7 +17864,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":257,"d3":10,"fast-isnumeric":13}],58:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":260,"d3":10,"fast-isnumeric":13}],57:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17963,7 +17901,7 @@ module.exports = function style(traces) { }); }; -},{"../color":26,"d3":10}],59:[function(require,module,exports){ +},{"../color":26,"d3":10}],58:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17978,7 +17916,14 @@ var cartesianConstants = require('../../plots/cartesian/constants'); module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'image', + + visible: { + valType: 'boolean', + + dflt: true, + + }, source: { valType: 'string', @@ -18026,14 +17971,14 @@ module.exports = { }, x: { - valType: 'number', + valType: 'any', dflt: 0, }, y: { - valType: 'number', + valType: 'any', dflt: 0, @@ -18078,7 +18023,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":148}],60:[function(require,module,exports){ +},{"../../plots/cartesian/constants":150}],59:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18089,40 +18034,34 @@ module.exports = { 'use strict'; -var Axes = require('../../plots/cartesian/axes'); var Lib = require('../../lib'); -var attributes = require('./attributes'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var attributes = require('./attributes'); +var name = 'images'; module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { + var opts = { + name: name, + handleItemDefaults: imageDefaults + }; - if(!layoutIn.images || !Array.isArray(layoutIn.images)) return; - - - var containerIn = layoutIn.images, - containerOut = layoutOut.images = []; - - - for(var i = 0; i < containerIn.length; i++) { - var image = containerIn[i]; - - if(!image.source) continue; - - var defaulted = imageDefaults(containerIn[i] || {}, containerOut[i] || {}, layoutOut); - containerOut.push(defaulted); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function imageDefaults(imageIn, imageOut, fullLayout) { - imageOut = imageOut || {}; - function coerce(attr, dflt) { return Lib.coerce(imageIn, imageOut, attributes, attr, dflt); } - coerce('source'); + var source = coerce('source'); + var visible = coerce('visible', !!source); + + if(!visible) return imageOut; + coerce('layer'); coerce('x'); coerce('y'); @@ -18133,18 +18072,18 @@ function imageDefaults(imageIn, imageOut, fullLayout) { coerce('sizing'); coerce('opacity'); - for(var i = 0; i < 2; i++) { - var tdMock = { _fullLayout: fullLayout }, - axLetter = ['x', 'y'][i]; + var gdMock = { _fullLayout: fullLayout }, + axLetters = ['x', 'y']; + for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref - Axes.coerceRef(imageIn, imageOut, tdMock, axLetter, 'paper'); + Axes.coerceRef(imageIn, imageOut, gdMock, axLetters[i], 'paper'); } return imageOut; } -},{"../../lib":116,"../../plots/cartesian/axes":142,"./attributes":59}],61:[function(require,module,exports){ +},{"../../lib":118,"../../plots/array_container_defaults":142,"../../plots/cartesian/axes":145,"./attributes":58}],60:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18161,25 +18100,23 @@ var Axes = require('../../plots/cartesian/axes'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, imageDataAbove = [], imageDataSubplot = [], imageDataBelow = []; - if(!fullLayout.images) return; - - // Sort into top, subplot, and bottom layers for(var i = 0; i < fullLayout.images.length; i++) { var img = fullLayout.images[i]; - if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - imageDataSubplot.push(img); - } else if(img.layer === 'above') { - imageDataAbove.push(img); - } else { - imageDataBelow.push(img); + if(img.visible) { + if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { + imageDataSubplot.push(img); + } else if(img.layer === 'above') { + imageDataAbove.push(img); + } else { + imageDataBelow.push(img); + } } } @@ -18248,12 +18185,12 @@ module.exports = function draw(gd) { var thisImage = d3.select(this); // Axes if specified - var xref = Axes.getFromId(gd, d.xref), - yref = Axes.getFromId(gd, d.yref); + var xa = Axes.getFromId(gd, d.xref), + ya = Axes.getFromId(gd, d.yref); var size = fullLayout._size, - width = xref ? Math.abs(xref.l2p(d.sizex) - xref.l2p(0)) : d.sizex * size.w, - height = yref ? Math.abs(yref.l2p(d.sizey) - yref.l2p(0)) : d.sizey * size.h; + width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w, + height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset, @@ -18262,8 +18199,8 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xref ? xref.l2p(d.x) + xref._offset : d.x * size.w + size.l) + xOffset, - yPos = (yref ? yref.l2p(d.y) + yref._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset, + yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; // Construct the proper aspectRatio attribute @@ -18288,8 +18225,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xref ? xref._id : '', - yId = yref ? yref._id : '', + var xId = xa ? xa._id : '', + yId = ya ? ya._id : '', clipAxes = xId + yId; if(clipAxes) { @@ -18326,7 +18263,7 @@ module.exports = function draw(gd) { }); }; -},{"../../constants/xmlns_namespaces":108,"../../plots/cartesian/axes":142,"../drawing":50,"d3":10}],62:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":108,"../../plots/cartesian/axes":145,"../drawing":49,"d3":10}],61:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18337,21 +18274,17 @@ module.exports = function draw(gd) { 'use strict'; - -var draw = require('./draw'); -var supplyLayoutDefaults = require('./defaults'); -var attributes = require('./attributes'); - - module.exports = { moduleType: 'component', name: 'images', - draw: draw, - layoutAttributes: attributes, - supplyLayoutDefaults: supplyLayoutDefaults + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), + + draw: require('./draw') }; -},{"./attributes":59,"./defaults":60,"./draw":61}],63:[function(require,module,exports){ +},{"./attributes":58,"./defaults":59,"./draw":60}],62:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18400,7 +18333,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],64:[function(require,module,exports){ +},{}],63:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18491,7 +18424,7 @@ module.exports = { } }; -},{"../../lib/extend":114,"../../plots/font_attributes":163,"../color/attributes":25}],65:[function(require,module,exports){ +},{"../../lib/extend":115,"../../plots/font_attributes":165,"../color/attributes":25}],64:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18509,7 +18442,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],66:[function(require,module,exports){ +},{}],65:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18602,7 +18535,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":116,"../../plots/layout_attributes":165,"../../registry":174,"./attributes":64,"./helpers":69}],67:[function(require,module,exports){ +},{"../../lib":118,"../../plots/layout_attributes":167,"../../registry":176,"./attributes":63,"./helpers":68}],66:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19318,7 +19251,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../lib":116,"../../lib/svg_text_utils":128,"../../plotly":138,"../../plots/plots":167,"../../registry":174,"../color":26,"../dragelement":48,"../drawing":50,"./anchor_utils":63,"./constants":65,"./get_legend_data":68,"./helpers":69,"./style":71,"d3":10}],68:[function(require,module,exports){ +},{"../../lib":118,"../../lib/svg_text_utils":130,"../../plotly":140,"../../plots/plots":169,"../../registry":176,"../color":26,"../dragelement":47,"../drawing":49,"./anchor_utils":62,"./constants":64,"./get_legend_data":67,"./helpers":68,"./style":70,"d3":10}],67:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19423,7 +19356,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":174,"./helpers":69}],69:[function(require,module,exports){ +},{"../../registry":176,"./helpers":68}],68:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19454,7 +19387,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":174}],70:[function(require,module,exports){ +},{"../../registry":176}],69:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19467,22 +19400,18 @@ exports.isReversed = function isReversed(legendLayout) { 'use strict'; -var legend = module.exports = {}; - - -legend.moduleType = 'component'; - -legend.name = 'legend'; - -legend.layoutAttributes = require('./attributes'); - -legend.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'legend', -legend.draw = require('./draw'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -legend.style = require('./style'); + draw: require('./draw'), + style: require('./style') +}; -},{"./attributes":64,"./defaults":66,"./draw":67,"./style":71}],71:[function(require,module,exports){ +},{"./attributes":63,"./defaults":65,"./draw":66,"./style":70}],70:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19704,7 +19633,7 @@ function stylePies(d) { if(pts.size()) pts.call(stylePie, d[0], trace); } -},{"../../lib":116,"../../registry":174,"../../traces/pie/style_one":235,"../../traces/scatter/subtypes":257,"../color":26,"../drawing":50,"d3":10}],72:[function(require,module,exports){ +},{"../../lib":118,"../../registry":176,"../../traces/pie/style_one":238,"../../traces/scatter/subtypes":260,"../color":26,"../drawing":49,"d3":10}],71:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20214,7 +20143,7 @@ modeBarButtons.resetViews = { } }; -},{"../../../build/ploticon":2,"../../lib":116,"../../plotly":138,"../../plots/cartesian/axes":142,"../../plots/plots":167,"../../snapshot/download":176}],73:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":118,"../../plotly":140,"../../plots/cartesian/axes":145,"../../plots/plots":169,"../../snapshot/download":178}],72:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20228,7 +20157,7 @@ modeBarButtons.resetViews = { exports.manage = require('./manage'); -},{"./manage":74}],74:[function(require,module,exports){ +},{"./manage":73}],73:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20456,7 +20385,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":142,"../../traces/scatter/subtypes":257,"./buttons":72,"./modebar":75}],75:[function(require,module,exports){ +},{"../../plots/cartesian/axes":145,"../../traces/scatter/subtypes":260,"./buttons":71,"./modebar":74}],74:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20746,7 +20675,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":116,"d3":10}],76:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":118,"d3":10}],75:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20763,7 +20692,8 @@ var extendFlat = require('../../lib/extend').extendFlat; var buttonAttrs = require('./button_attributes'); buttonAttrs = extendFlat(buttonAttrs, { - _isLinkedToArray: true, + _isLinkedToArray: 'button', + }); @@ -20835,7 +20765,7 @@ module.exports = { } }; -},{"../../lib/extend":114,"../../plots/font_attributes":163,"../color/attributes":25,"./button_attributes":77}],77:[function(require,module,exports){ +},{"../../lib/extend":115,"../../plots/font_attributes":165,"../color/attributes":25,"./button_attributes":76}],76:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20876,7 +20806,7 @@ module.exports = { } }; -},{}],78:[function(require,module,exports){ +},{}],77:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20905,7 +20835,7 @@ module.exports = { darkAmount: 10 }; -},{}],79:[function(require,module,exports){ +},{}],78:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20998,7 +20928,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":116,"../color":26,"./attributes":76,"./button_attributes":77,"./constants":78}],80:[function(require,module,exports){ +},{"../../lib":118,"../color":26,"./attributes":75,"./button_attributes":76,"./constants":77}],79:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21273,7 +21203,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":128,"../../plotly":138,"../../plots/cartesian/axis_ids":145,"../../plots/plots":167,"../color":26,"../drawing":50,"../legend/anchor_utils":63,"./constants":78,"./get_update_object":81,"d3":10}],81:[function(require,module,exports){ +},{"../../lib/svg_text_utils":130,"../../plotly":140,"../../plots/cartesian/axis_ids":148,"../../plots/plots":169,"../color":26,"../drawing":49,"../legend/anchor_utils":62,"./constants":77,"./get_update_object":80,"d3":10}],80:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21287,6 +21217,8 @@ function reposition(gd, buttons, opts, axName) { var d3 = require('d3'); +var Lib = require('../../lib'); + module.exports = function getUpdateObject(axisLayout, buttonLayout) { var axName = axisLayout._name; @@ -21307,7 +21239,7 @@ module.exports = function getUpdateObject(axisLayout, buttonLayout) { function getXRange(axisLayout, buttonLayout) { var currentRange = axisLayout.range; - var base = new Date(currentRange[1]); + var base = new Date(Lib.dateTime2ms(currentRange[1])); var step = buttonLayout.step, count = buttonLayout.count; @@ -21316,13 +21248,13 @@ function getXRange(axisLayout, buttonLayout) { switch(buttonLayout.stepmode) { case 'backward': - range0 = d3.time[step].offset(base, -count).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].offset(base, -count)); break; case 'todate': - var base2 = d3.time[step].offset(base, -(count - 1)); + var base2 = d3.time[step].offset(base, -count); - range0 = d3.time[step].floor(base2).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].ceil(base2)); break; } @@ -21331,7 +21263,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":10}],82:[function(require,module,exports){ +},{"../../lib":118,"d3":10}],81:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21342,18 +21274,18 @@ function getXRange(axisLayout, buttonLayout) { 'use strict'; +module.exports = { + moduleType: 'component', + name: 'rangeselector', -exports.moduleType = 'component'; - -exports.name = 'rangeselector'; - -exports.layoutAttributes = require('./attributes'); - -exports.handleDefaults = require('./defaults'); + layoutNodes: ['xaxis.'], + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":76,"./defaults":79,"./draw":80}],83:[function(require,module,exports){ +},{"./attributes":75,"./defaults":78,"./draw":79}],82:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21390,8 +21322,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -21411,7 +21343,7 @@ module.exports = { } }; -},{"../color/attributes":25}],84:[function(require,module,exports){ +},{"../color/attributes":25}],83:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21464,7 +21396,7 @@ module.exports = { handleStroke: '#666', }; -},{}],85:[function(require,module,exports){ +},{}],84:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21488,7 +21420,8 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe } var containerIn = layoutIn[axName].rangeslider, - containerOut = layoutOut[axName].rangeslider = {}; + axOut = layoutOut[axName], + containerOut = axOut.rangeslider = {}; function coerce(attr, dflt) { return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); @@ -21502,14 +21435,16 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe coerce('range'); // Expand slider range to the axis range - if(containerOut.range && !layoutOut[axName].autorange) { + if(containerOut.range && !axOut.autorange) { var outRange = containerOut.range, - axRange = layoutOut[axName].range; + axRange = axOut.range, + l2r = axOut.l2r, + r2l = axOut.r2l; - outRange[0] = Math.min(outRange[0], axRange[0]); - outRange[1] = Math.max(outRange[1], axRange[1]); + outRange[0] = l2r(Math.min(r2l(outRange[0]), r2l(axRange[0]))); + outRange[1] = l2r(Math.max(r2l(outRange[1]), r2l(axRange[1]))); } else { - layoutOut[axName]._needsExpand = true; + axOut._needsExpand = true; } if(containerOut.visible) { @@ -21524,7 +21459,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe containerOut._input = containerIn; }; -},{"../../lib":116,"./attributes":83}],86:[function(require,module,exports){ +},{"../../lib":118,"./attributes":82}],85:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21631,20 +21566,10 @@ module.exports = function(gd) { rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); - // update inner nodes - - rangeSlider - .call(drawBg, gd, axisOpts, opts) - .call(addClipPath, gd, axisOpts, opts) - .call(drawRangePlot, gd, axisOpts, opts) - .call(drawMasks, gd, axisOpts, opts) - .call(drawSlideBox, gd, axisOpts, opts) - .call(drawGrabbers, gd, axisOpts, opts); - // update data <--> pixel coordinate conversion methods - var range0 = opts.range[0], - range1 = opts.range[1], + var range0 = axisOpts.r2l(opts.range[0]), + range1 = axisOpts.r2l(opts.range[1]), dist = range1 - range0; opts.p2d = function(v) { @@ -21655,6 +21580,18 @@ module.exports = function(gd) { return (v - range0) / dist * opts._width; }; + opts._rl = [range0, range1]; + + // update inner nodes + + rangeSlider + .call(drawBg, gd, axisOpts, opts) + .call(addClipPath, gd, axisOpts, opts) + .call(drawRangePlot, gd, axisOpts, opts) + .call(drawMasks, gd, axisOpts, opts) + .call(drawSlideBox, gd, axisOpts, opts) + .call(drawGrabbers, gd, axisOpts, opts); + // setup drag element setupDragElement(rangeSlider, gd, axisOpts, opts); @@ -21692,8 +21629,8 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { target = event.target, startX = event.clientX, offsetX = startX - rangeSlider.node().getBoundingClientRect().left, - minVal = opts.d2p(axisOpts.range[0]), - maxVal = opts.d2p(axisOpts.range[1]); + minVal = opts.d2p(axisOpts._rl[0]), + maxVal = opts.d2p(axisOpts._rl[1]); var dragCover = dragElement.coverSlip(); @@ -21754,7 +21691,7 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { function setDataRange(rangeSlider, gd, axisOpts, opts) { function clamp(v) { - return Lib.constrain(v, opts.range[0], opts.range[1]); + return axisOpts.l2r(Lib.constrain(v, opts._rl[0], opts._rl[1])); } var dataMin = clamp(opts.p2d(opts._pixelMin)), @@ -21771,8 +21708,8 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts) { return Lib.constrain(v, 0, opts._width); } - var pixelMin = clamp(opts.d2p(axisOpts.range[0])), - pixelMax = clamp(opts.d2p(axisOpts.range[1])); + var pixelMin = clamp(opts.d2p(axisOpts._rl[0])), + pixelMax = clamp(opts.d2p(axisOpts._rl[1])); rangeSlider.select('rect.' + constants.slideBoxClassName) .attr('x', pixelMin) @@ -21865,6 +21802,7 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) { data: [], layout: { xaxis: { + type: axisOpts.type, domain: [0, 1], range: opts.range.slice() }, @@ -22046,7 +21984,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":116,"../../lib/setcursor":126,"../../plotly":138,"../../plots/cartesian":151,"../../plots/cartesian/axes":142,"../../plots/plots":167,"../color":26,"../dragelement":48,"../drawing":50,"./constants":84,"d3":10}],87:[function(require,module,exports){ +},{"../../lib":118,"../../lib/setcursor":128,"../../plotly":140,"../../plots/cartesian":153,"../../plots/cartesian/axes":145,"../../plots/plots":169,"../color":26,"../dragelement":47,"../drawing":49,"./constants":83,"d3":10}],86:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22060,12 +21998,15 @@ function clearPushMargins(gd) { module.exports = { moduleType: 'component', name: 'rangeslider', + + layoutNodes: ['xaxis.'], layoutAttributes: require('./attributes'), handleDefaults: require('./defaults'), + draw: require('./draw') }; -},{"./attributes":83,"./defaults":85,"./draw":86}],88:[function(require,module,exports){ +},{"./attributes":82,"./defaults":84,"./draw":85}],87:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22083,7 +22024,14 @@ var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'shape', + + visible: { + valType: 'boolean', + + dflt: true, + + }, type: { valType: 'enumerated', @@ -22156,7 +22104,7 @@ module.exports = { } }; -},{"../../lib/extend":114,"../../traces/scatter/attributes":237,"../annotations/attributes":19}],89:[function(require,module,exports){ +},{"../../lib/extend":115,"../../traces/scatter/attributes":240,"../annotations/attributes":19}],88:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22168,6 +22116,7 @@ module.exports = { 'use strict'; +var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); var constants = require('./constants'); @@ -22176,7 +22125,7 @@ var helpers = require('./helpers'); module.exports = function calcAutorange(gd) { var fullLayout = gd._fullLayout, - shapeList = fullLayout.shapes; + shapeList = Lib.filterVisible(fullLayout.shapes); if(!shapeList.length || !gd._fullData.length) return; @@ -22232,7 +22181,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../plots/cartesian/axes":142,"./constants":90,"./helpers":93}],90:[function(require,module,exports){ +},{"../../lib":118,"../../plots/cartesian/axes":145,"./constants":89,"./helpers":92}],89:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22296,7 +22245,7 @@ module.exports = { } }; -},{}],91:[function(require,module,exports){ +},{}],90:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22308,22 +22257,20 @@ module.exports = { 'use strict'; +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var handleShapeDefaults = require('./shape_defaults'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - var containerIn = layoutIn.shapes || [], - containerOut = layoutOut.shapes = []; - - for(var i = 0; i < containerIn.length; i++) { - var shapeIn = containerIn[i] || {}, - shapeOut = handleShapeDefaults(shapeIn, layoutOut); + var opts = { + name: 'shapes', + handleItemDefaults: handleShapeDefaults + }; - containerOut.push(shapeOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"./shape_defaults":95}],92:[function(require,module,exports){ +},{"../../plots/array_container_defaults":142,"./shape_defaults":94}],91:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22375,7 +22322,9 @@ function draw(gd) { fullLayout._shapeSubplotLayer.selectAll('path').remove(); for(var i = 0; i < fullLayout.shapes.length; i++) { - drawOne(gd, i); + if(fullLayout.shapes[i].visible) { + drawOne(gd, i); + } } // may need to resurrect this if we put text (LaTeX) in shapes @@ -22495,8 +22444,6 @@ function updateShape(gd, index, opt, value) { // TODO: clean this up and remove it. if(!optionsIn) return; - var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; - // alter the input shape as requested var optionsEdit = {}; if(typeof opt === 'string' && opt) optionsEdit[opt] = value; @@ -22508,7 +22455,12 @@ function updateShape(gd, index, opt, value) { Lib.nestedProperty(optionsIn, k).set(optionsEdit[k]); } - var posAttrs = ['x0', 'x1', 'y0', 'y1']; + // return early in visible: false updates + if(optionsIn.visible === false) return; + + var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}, + posAttrs = ['x0', 'x1', 'y0', 'y1']; + for(i = 0; i < 4; i++) { var posAttr = posAttrs[i]; // if we don't have an explicit position already, @@ -22523,18 +22475,17 @@ function updateShape(gd, index, opt, value) { var axLetter = posAttr.charAt(0), axOld = Axes.getFromId(gd, - Axes.coerceRef(oldRef, {}, gd, axLetter)), + Axes.coerceRef(oldRef, {}, gd, axLetter, '', 'paper')), axNew = Axes.getFromId(gd, - Axes.coerceRef(optionsIn, {}, gd, axLetter)), + Axes.coerceRef(optionsIn, {}, gd, axLetter, '', 'paper')), position = optionsIn[posAttr], - linearizedPosition; + rangePosition; if(optionsEdit[axLetter + 'ref'] !== undefined) { // first convert to fraction of the axis if(axOld) { - linearizedPosition = helpers.dataToLinear(axOld)(position); - position = (linearizedPosition - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + rangePosition = helpers.shapePositionToRange(axOld)(position); + position = axOld.r2fraction(rangePosition); } else { position = (position - axNew.domain[0]) / (axNew.domain[1] - axNew.domain[0]); @@ -22542,9 +22493,8 @@ function updateShape(gd, index, opt, value) { if(axNew) { // then convert to new data coordinates at the same fraction - linearizedPosition = axNew.range[0] + position * - (axNew.range[1] - axNew.range[0]); - position = helpers.linearToData(axNew)(linearizedPosition); + rangePosition = axNew.fraction2r(position); + position = helpers.rangeToShapePosition(axNew)(rangePosition); } else { // or scale to the whole plot position = axOld.domain[0] + @@ -22555,7 +22505,8 @@ function updateShape(gd, index, opt, value) { optionsIn[posAttr] = position; } - var options = handleShapeDefaults(optionsIn, gd._fullLayout); + var options = {}; + handleShapeDefaults(optionsIn, options, gd._fullLayout); gd._fullLayout.shapes[index] = options; var clipAxes; @@ -22789,22 +22740,22 @@ function getPathString(gd, options) { xa = Axes.getFromId(gd, options.xref), ya = Axes.getFromId(gd, options.yref), gs = gd._fullLayout._size, - x2l, + x2r, x2p, - y2l, + y2r, y2p; if(xa) { - x2l = helpers.dataToLinear(xa); - x2p = function(v) { return xa._offset + xa.l2p(x2l(v, true)); }; + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2l = helpers.dataToLinear(ya); - y2p = function(v) { return ya._offset + ya.l2p(y2l(v, true)); }; + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; @@ -22886,7 +22837,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":116,"../../lib/setcursor":126,"../../plotly":138,"../../plots/cartesian/axes":142,"../color":26,"../dragelement":48,"../drawing":50,"./constants":90,"./defaults":91,"./helpers":93,"./shape_defaults":95,"fast-isnumeric":13}],93:[function(require,module,exports){ +},{"../../lib":118,"../../lib/setcursor":128,"../../plotly":140,"../../plots/cartesian/axes":145,"../color":26,"../dragelement":47,"../drawing":49,"./constants":89,"./defaults":90,"./helpers":92,"./shape_defaults":94,"fast-isnumeric":13}],92:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22903,16 +22854,16 @@ function movePath(pathIn, moveX, moveY) { // so these have to be specified in terms of the category serial numbers, // but can take fractional values. Other axis types we specify position based on // the actual data values. -// TODO: this should really be part of axes, but for now it's only used here. -// eventually annotations and axis ranges will use this too. -// what should we do, invent a new letter for "data except if it's category"? +// TODO: in V2.0 (when log axis ranges are in data units) range and shape position +// will be identical, so rangeToShapePosition and shapePositionToRange can be +// removed entirely. -exports.dataToLinear = function(ax) { - return ax.type === 'category' ? ax.c2l : ax.d2l; +exports.rangeToShapePosition = function(ax) { + return (ax.type === 'log') ? ax.r2d : function(v) { return v; }; }; -exports.linearToData = function(ax) { - return ax.type === 'category' ? ax.l2c : ax.l2d; +exports.shapePositionToRange = function(ax) { + return (ax.type === 'log') ? ax.d2r : function(v) { return v; }; }; exports.decodeDate = function(convertToPx) { @@ -22931,10 +22882,10 @@ exports.getDataToPixel = function(gd, axis, isVertical) { dataToPixel; if(axis) { - var d2l = exports.dataToLinear(axis); + var d2r = exports.shapePositionToRange(axis); dataToPixel = function(v) { - return axis._offset + axis.l2p(d2l(v, true)); + return axis._offset + axis.r2p(d2r(v, true)); }; if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); @@ -22954,8 +22905,8 @@ exports.getPixelToData = function(gd, axis, isVertical) { pixelToData; if(axis) { - var l2d = exports.linearToData(axis); - pixelToData = function(p) { return l2d(axis.p2l(p - axis._offset)); }; + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; @@ -22967,7 +22918,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],94:[function(require,module,exports){ +},{}],93:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22979,21 +22930,21 @@ exports.getPixelToData = function(gd, axis, isVertical) { 'use strict'; -exports.moduleType = 'component'; - -exports.name = 'shapes'; - -exports.layoutAttributes = require('./attributes'); +var drawModule = require('./draw'); -exports.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'shapes', -exports.calcAutorange = require('./calc_autorange'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne +}; -},{"./attributes":88,"./calc_autorange":89,"./defaults":91,"./draw":92}],95:[function(require,module,exports){ +},{"./attributes":87,"./calc_autorange":88,"./defaults":90,"./draw":91}],94:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23011,13 +22962,19 @@ var Axes = require('../../plots/cartesian/axes'); var attributes = require('./attributes'); var helpers = require('./helpers'); -module.exports = function handleShapeDefaults(shapeIn, fullLayout) { - var shapeOut = {}; + +module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opts, itemOpts) { + opts = opts || {}; + itemOpts = itemOpts || {}; function coerce(attr, dflt) { return Lib.coerce(shapeIn, shapeOut, attributes, attr, dflt); } + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + + if(!visible) return shapeOut; + coerce('layer'); coerce('opacity'); coerce('fillcolor'); @@ -23032,39 +22989,61 @@ module.exports = function handleShapeDefaults(shapeIn, fullLayout) { var axLetters = ['x', 'y']; for(var i = 0; i < 2; i++) { var axLetter = axLetters[i], - tdMock = {_fullLayout: fullLayout}; + gdMock = {_fullLayout: fullLayout}; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, tdMock, axLetter); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); if(shapeType !== 'path') { var dflt0 = 0.25, - dflt1 = 0.75; + dflt1 = 0.75, + ax, + pos2r, + r2pos; if(axRef !== 'paper') { - var ax = Axes.getFromId(tdMock, axRef), - convertFn = helpers.linearToData(ax); - - dflt0 = convertFn(ax.range[0] + dflt0 * (ax.range[1] - ax.range[0])); - dflt1 = convertFn(ax.range[0] + dflt1 * (ax.range[1] - ax.range[0])); + ax = Axes.getFromId(gdMock, axRef); + r2pos = helpers.rangeToShapePosition(ax); + pos2r = helpers.shapePositionToRange(ax); + } + else { + pos2r = r2pos = Lib.identity; } + // hack until V2.0 when log has regular range behavior - make it look like other + // ranges to send to coerce, then put it back after + // this is all to give reasonable default position behavior on log axes, which is + // a pretty unimportant edge case so we could just ignore this. + var attr0 = axLetter + '0', + attr1 = axLetter + '1', + in0 = shapeIn[attr0], + in1 = shapeIn[attr1]; + shapeIn[attr0] = pos2r(shapeIn[attr0], true); + shapeIn[attr1] = pos2r(shapeIn[attr1], true); + // x0, x1 (and y0, y1) - coerce(axLetter + '0', dflt0); - coerce(axLetter + '1', dflt1); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr0, dflt0); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr1, dflt1); + + // hack part 2 + shapeOut[attr0] = r2pos(shapeOut[attr0]); + shapeOut[attr1] = r2pos(shapeOut[attr1]); + shapeIn[attr0] = in0; + shapeIn[attr1] = in1; } } if(shapeType === 'path') { coerce('path'); - } else { + } + else { Lib.noneOrAll(shapeIn, shapeOut, ['x0', 'x1', 'y0', 'y1']); } return shapeOut; }; -},{"../../lib":116,"../../plots/cartesian/axes":142,"./attributes":88,"./helpers":93}],96:[function(require,module,exports){ +},{"../../lib":118,"../../plots/cartesian/axes":145,"./attributes":87,"./helpers":92}],95:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23083,7 +23062,7 @@ var animationAttrs = require('../../plots/animation_attributes'); var constants = require('./constants'); var stepsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'step', method: { valType: 'enumerated', @@ -23116,6 +23095,8 @@ var stepsAttrs = { }; module.exports = { + _isLinkedToArray: 'slider', + visible: { valType: 'boolean', @@ -23296,7 +23277,7 @@ module.exports = { }, }; -},{"../../lib/extend":114,"../../plots/animation_attributes":139,"../../plots/font_attributes":163,"../../plots/pad_attributes":166,"./constants":97}],97:[function(require,module,exports){ +},{"../../lib/extend":115,"../../plots/animation_attributes":141,"../../plots/font_attributes":165,"../../plots/pad_attributes":168,"./constants":96}],96:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23311,9 +23292,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'sliders', - itemName: 'slider', // class names containerClassName: 'slider-container', @@ -23394,7 +23374,7 @@ module.exports = { currentValueInset: 0, }; -},{}],98:[function(require,module,exports){ +},{}],97:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23406,6 +23386,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -23415,23 +23396,12 @@ var stepAttrs = attributes.steps; module.exports = function slidersDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var sliderIn = contIn[i] || {}, - sliderOut = {}; - - sliderDefaults(sliderIn, sliderOut, layoutOut); - - // used on button click to update the 'active' field - sliderOut._input = sliderIn; - - // used to determine object constancy - sliderOut._index = i; + var opts = { + name: name, + handleItemDefaults: sliderDefaults + }; - contOut.push(sliderOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function sliderDefaults(sliderIn, sliderOut, layoutOut) { @@ -23517,7 +23487,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":116,"./attributes":96,"./constants":97}],99:[function(require,module,exports){ +},{"../../lib":118,"../../plots/array_container_defaults":142,"./attributes":95,"./constants":96}],98:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23886,6 +23856,7 @@ function handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, doTransiti } function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) { + var previousActive = sliderOpts.active; sliderOpts._input.active = sliderOpts.active = index; var step = sliderOpts.steps[sliderOpts.active]; @@ -23893,6 +23864,13 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) sliderGroup.call(setGripPosition, sliderOpts, sliderOpts.active / (sliderOpts.steps.length - 1), doTransition); sliderGroup.call(drawCurrentValue, sliderOpts); + gd.emit('plotly_sliderchange', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active], + interaction: doCallback, + previousActive: previousActive + }); + if(step && step.method && doCallback) { if(sliderGroup._nextMethod) { // If we've already queued up an update, just overwrite it with the most recent: @@ -23919,6 +23897,8 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { var $gd = d3.select(gd); item.on('mousedown', function() { + gd.emit('plotly_sliderstart', {slider: sliderOpts}); + var grip = sliderGroup.select('.' + constants.gripRectClass); d3.event.stopPropagation(); @@ -23939,6 +23919,11 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { grip.call(Color.fill, sliderOpts.bgcolor); $gd.on('mouseup', null); $gd.on('mousemove', null); + + gd.emit('plotly_sliderend', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active] + }); }); }); } @@ -24076,7 +24061,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":116,"../../lib/svg_text_utils":128,"../../plots/plots":167,"../color":26,"../drawing":50,"../legend/anchor_utils":63,"./constants":97,"d3":10}],100:[function(require,module,exports){ +},{"../../lib":118,"../../lib/svg_text_utils":130,"../../plots/plots":169,"../color":26,"../drawing":49,"../legend/anchor_utils":62,"./constants":96,"d3":10}],99:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24087,18 +24072,19 @@ function clearPushMargins(gd) { 'use strict'; +var constants = require('./constants'); -exports.moduleType = 'component'; - -exports.name = 'sliders'; - -exports.layoutAttributes = require('./attributes'); +module.exports = { + moduleType: 'component', + name: constants.name, -exports.supplyLayoutDefaults = require('./defaults'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":96,"./defaults":98,"./draw":99}],101:[function(require,module,exports){ +},{"./attributes":95,"./constants":96,"./defaults":97,"./draw":98}],100:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24328,7 +24314,7 @@ Titles.draw = function(gd, titleClass, options) { el.classed('js-placeholder', isplaceholder); }; -},{"../../lib":116,"../../lib/svg_text_utils":128,"../../plotly":138,"../../plots/plots":167,"../color":26,"../drawing":50,"d3":10,"fast-isnumeric":13}],102:[function(require,module,exports){ +},{"../../lib":118,"../../lib/svg_text_utils":130,"../../plotly":140,"../../plots/plots":169,"../color":26,"../drawing":49,"d3":10,"fast-isnumeric":13}],101:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24345,7 +24331,7 @@ var extendFlat = require('../../lib/extend').extendFlat; var padAttrs = require('../../plots/pad_attributes'); var buttonsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'button', method: { valType: 'enumerated', @@ -24374,7 +24360,7 @@ var buttonsAttrs = { }; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'updatemenu', visible: { valType: 'boolean', @@ -24474,7 +24460,7 @@ module.exports = { } }; -},{"../../lib/extend":114,"../../plots/font_attributes":163,"../../plots/pad_attributes":166,"../color/attributes":25}],103:[function(require,module,exports){ +},{"../../lib/extend":115,"../../plots/font_attributes":165,"../../plots/pad_attributes":168,"../color/attributes":25}],102:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24489,9 +24475,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'updatemenus', - itemName: 'updatemenu', // class names containerClassName: 'updatemenu-container', @@ -24551,7 +24536,7 @@ module.exports = { hoverColor: '#F4FAFF' }; -},{}],104:[function(require,module,exports){ +},{}],103:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24563,6 +24548,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -24572,23 +24558,12 @@ var buttonAttrs = attributes.buttons; module.exports = function updateMenusDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var menuIn = contIn[i] || {}, - menuOut = {}; - - menuDefaults(menuIn, menuOut, layoutOut); - - // used on button click to update the 'active' field - menuOut._input = menuIn; - - // used to determine object constancy - menuOut._index = i; + var opts = { + name: name, + handleItemDefaults: menuDefaults + }; - contOut.push(menuOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function menuDefaults(menuIn, menuOut, layoutOut) { @@ -24655,7 +24630,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":116,"./attributes":102,"./constants":103}],105:[function(require,module,exports){ +},{"../../lib":118,"../../plots/array_container_defaults":142,"./attributes":101,"./constants":102}],104:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24957,6 +24932,8 @@ function drawButtons(gd, gHeader, gButton, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, buttonIndex); Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + + gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); button.on('mouseover', function() { @@ -25236,7 +25213,9 @@ function clearPushMargins(gd) { } } -},{"../../lib":116,"../../lib/svg_text_utils":128,"../../plots/plots":167,"../color":26,"../drawing":50,"../legend/anchor_utils":63,"./constants":103,"d3":10}],106:[function(require,module,exports){ +},{"../../lib":118,"../../lib/svg_text_utils":130,"../../plots/plots":169,"../color":26,"../drawing":49,"../legend/anchor_utils":62,"./constants":102,"d3":10}],105:[function(require,module,exports){ +arguments[4][99][0].apply(exports,arguments) +},{"./attributes":101,"./constants":102,"./defaults":103,"./draw":104,"dup":99}],106:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25248,17 +25227,37 @@ function clearPushMargins(gd) { 'use strict'; -exports.moduleType = 'component'; - -exports.name = 'updatemenus'; - -exports.layoutAttributes = require('./attributes'); +module.exports = { + /** + * Standardize all missing data in calcdata to use undefined + * never null or NaN. + * That way we can use !==undefined, or !== BADNUM, + * to test for real data + */ + BADNUM: undefined, -exports.supplyLayoutDefaults = require('./defaults'); + /* + * Limit certain operations to well below floating point max value + * to avoid glitches: Make sure that even when you multiply it by the + * number of pixels on a giant screen it still works + */ + FP_SAFE: Number.MAX_VALUE / 10000, -exports.draw = require('./draw'); + /* + * conversion of date units to milliseconds + * year and month constants are marked "AVG" + * to remind us that not all years and months + * have the same length + */ + ONEAVGYEAR: 31557600000, // 365.25 days + ONEAVGMONTH: 2629800000, // 1/12 of ONEAVGYEAR + ONEDAY: 86400000, + ONEHOUR: 3600000, + ONEMIN: 60000, + ONESEC: 1000 +}; -},{"./attributes":102,"./defaults":104,"./draw":105}],107:[function(require,module,exports){ +},{}],107:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25338,7 +25337,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.19.2'; +exports.version = '1.20.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -25399,7 +25398,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":24,"./components/images":62,"./components/legend":70,"./components/rangeselector":82,"./components/rangeslider":87,"./components/shapes":94,"./components/sliders":100,"./components/updatemenus":106,"./fonts/mathjax_config":110,"./lib/queue":124,"./plot_api/plot_schema":132,"./plot_api/register":133,"./plot_api/set_plot_config":134,"./plot_api/to_image":136,"./plot_api/validate":137,"./plotly":138,"./snapshot":179,"./snapshot/download":176,"./traces/scatter":247,"d3":10,"es6-promise":11}],110:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":24,"./components/images":61,"./components/legend":69,"./components/rangeselector":81,"./components/rangeslider":86,"./components/shapes":93,"./components/sliders":99,"./components/updatemenus":105,"./fonts/mathjax_config":110,"./lib/queue":126,"./plot_api/plot_schema":134,"./plot_api/register":135,"./plot_api/set_plot_config":136,"./plot_api/to_image":138,"./plot_api/validate":139,"./plotly":140,"./snapshot":181,"./snapshot/download":178,"./traces/scatter":250,"d3":10,"es6-promise":11}],110:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25442,22 +25441,50 @@ if(typeof MathJax !== 'undefined') { */ +'use strict'; + +var isNumeric = require('fast-isnumeric'); + +var BADNUM = require('../constants/numerical').BADNUM; + +// precompile these regex's for speed +var FRONTJUNK = /^['"%,$#\s']+/; +var ENDJUNK = /['"%,$#\s']+$/; + +/** + * cleanNumber: remove common leading and trailing cruft + * Always returns either a number or BADNUM. + */ +module.exports = function cleanNumber(v) { + if(typeof v === 'string') { + v = v.replace(FRONTJUNK, '').replace(ENDJUNK, ''); + } + + if(isNumeric(v)) return Number(v); + + return BADNUM; +}; + +},{"../constants/numerical":106,"fast-isnumeric":13}],112:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + 'use strict'; var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); -var nestedProperty = require('./nested_property'); -var isPlainObject = require('./is_plain_object'); -var filterUnique = require('./filter_unique'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); +var nestedProperty = require('./nested_property'); -var idRegex = /^([2-9]|[1-9][0-9]+)$/; - -function isValObject(obj) { - return obj && obj.valType !== undefined; -} +var ID_REGEX = /^([2-9]|[1-9][0-9]+)$/; exports.valObjects = { data_array: { @@ -25568,7 +25595,7 @@ exports.valObjects = { coerceFunction: function(v, propOut, dflt) { var dlen = dflt.length; if(typeof v === 'string' && v.substr(0, dlen) === dflt && - idRegex.test(v.substr(dlen))) { + ID_REGEX.test(v.substr(dlen))) { propOut.set(v); return; } @@ -25580,7 +25607,7 @@ exports.valObjects = { if(v === dflt) return true; if(typeof v !== 'string') return false; - if(v.substr(0, dlen) === dflt && idRegex.test(v.substr(dlen))) { + if(v.substr(0, dlen) === dflt && ID_REGEX.test(v.substr(dlen))) { return true; } @@ -25748,129 +25775,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -/* - * returns true for a valid value object and false for tree nodes in the attribute hierarchy - */ -exports.isValObject = isValObject; - -exports.IS_SUBPLOT_OBJ = '_isSubplotObj'; -exports.IS_LINKED_TO_ARRAY = '_isLinkedToArray'; -exports.DEPRECATED = '_deprecated'; - -// list of underscore attributes to keep in schema as is -exports.UNDERSCORE_ATTRS = [exports.IS_SUBPLOT_OBJ, exports.IS_LINKED_TO_ARRAY, exports.DEPRECATED]; - -/** - * Crawl the attribute tree, recursively calling a callback function - * - * @param {object} attrs - * The node of the attribute tree (e.g. the root) from which recursion originates - * @param {Function} callback - * A callback function with the signature: - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * @param {Number} [specifiedLevel] - * The level in the tree, in order to let the callback function detect descend or backtrack, - * typically unsupplied (implied 0), just used by the self-recursive call. - * The necessity arises because the tree traversal is not controlled by callback return values. - * The decision to not use callback return values for controlling tree pruning arose from - * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions - * precedes the callback call. - * - * @return {object} transformOut - * copy of transformIn that contains attribute defaults - */ -exports.crawl = function(attrs, callback, specifiedLevel) { - var level = specifiedLevel || 0; - Object.keys(attrs).forEach(function(attrName) { - var attr = attrs[attrName]; - - if(exports.UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - - callback(attr, attrName, attrs, level); - - if(isValObject(attr)) return; - if(isPlainObject(attr)) exports.crawl(attr, callback, level + 1); - }); -}; - -/** - * Find all data array attributes in a given trace object - including - * `arrayOk` attributes. - * - * @param {object} trace - * full trace object that contains a reference to `_module.attributes` - * - * @return {array} arrayAttributes - * list of array attributes for the given trace - */ -exports.findArrayAttributes = function(trace) { - var arrayAttributes = [], - stack = []; - - /** - * A closure that gathers attribute paths into its enclosed arraySplitAttributes - * Attribute paths are collected iff their leaf node is a splittable attribute - * - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * - * @closureVariable {String[][]} arrayAttributes the set of gathered attributes - * Example of filled closure variable (expected to be initialized to []): - * [["marker","size"],["marker","line","width"],["marker","line","color"]] - */ - function callback(attr, attrName, attrs, level) { - stack = stack.slice(0, level).concat([attrName]); - - var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; - if(!splittableAttr) return; - - var astr = toAttrString(stack); - var val = nestedProperty(trace, astr).get(); - if(!Array.isArray(val)) return; - - arrayAttributes.push(astr); - } - - function toAttrString(stack) { - return stack.join('.'); - } - - exports.crawl(trace._module.attributes, callback); - - if(trace.transforms) { - var transforms = trace.transforms; - - for(var i = 0; i < transforms.length; i++) { - var transform = transforms[i]; - - stack = ['transforms[' + i + ']']; - exports.crawl(transform._module.attributes, callback, 1); - } - } - - // Look into the fullInput module attributes for array attributes - // to make sure that 'custom' array attributes are detected. - // - // At the moment, we need this block to make sure that - // ohlc and candlestick 'open', 'high', 'low', 'close' can be - // used with filter ang groupby transforms. - if(trace._fullInput) { - exports.crawl(trace._fullInput._module.attributes, callback); - - arrayAttributes = filterUnique(arrayAttributes); - } - - return arrayAttributes; -}; - -},{"../components/colorscale/get_scale":39,"../components/colorscale/scales":45,"./filter_unique":115,"./is_plain_object":118,"./nested_property":121,"fast-isnumeric":13,"tinycolor2":16}],112:[function(require,module,exports){ +},{"../components/colorscale/get_scale":38,"../components/colorscale/scales":44,"./nested_property":123,"fast-isnumeric":13,"tinycolor2":16}],113:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25885,6 +25790,24 @@ exports.findArrayAttributes = function(trace) { var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); +var logError = require('./loggers').error; + +var constants = require('../constants/numerical'); +var BADNUM = constants.BADNUM; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + +// is an object a javascript date? +exports.isJSDate = function(v) { + return typeof v === 'object' && v !== null && typeof v.getTime === 'function'; +}; + +// The absolute limits of our date-time system +// This is a little weird: we use MIN_MS and MAX_MS in dateTime2ms +// but we use dateTime2ms to calculate them (after defining it!) +var MIN_MS, MAX_MS; /** * dateTime2ms - turn a date object or string s of the form @@ -25892,7 +25815,13 @@ var isNumeric = require('fast-isnumeric'); * per javascript standard) * may truncate after any full field, and sss can be any length * even >3 digits, though javascript dates truncate to milliseconds - * returns false if it doesn't find a date + * returns BADNUM if it doesn't find a date + * + * Expanded to support negative years to -9999 but you must always + * give 4 digits, except for 2-digit positive years which we assume are + * near the present time. + * Note that we follow ISO 8601:2004: there *is* a year 0, which + * is 1BC/BCE, and -1===2BC etc. * * 2-digit to 4-digit year conversion, where to cut off? * from http://support.microsoft.com/kb/244664: @@ -25900,85 +25829,123 @@ var isNumeric = require('fast-isnumeric'); * but in my mac chrome from eg. d=new Date(Date.parse('8/19/50')): * 1950-2049 * by Java, from http://stackoverflow.com/questions/2024273/: - * now-80 - now+20 + * now-80 - now+19 * or FileMaker Pro, from * http://www.filemaker.com/12help/html/add_view_data.4.21.html: - * now-70 - now+30 + * now-70 - now+29 * but python strptime etc, via * http://docs.python.org/py3k/library/time.html: * 1969-2068 (super forward-looking, but static, not sliding!) * - * lets go with now-70 to now+30, and if anyone runs into this problem + * lets go with now-70 to now+29, and if anyone runs into this problem * they can learn the hard way not to use 2-digit years, as no choice we * make now will cover all possibilities. mostly this will all be taken * care of in initial parsing, should only be an issue for hand-entered data - * currently (2012) this range is: - * 1942-2041 + * currently (2016) this range is: + * 1946-2045 */ exports.dateTime2ms = function(s) { // first check if s is a date object - try { - if(s.getTime) return +s; - } - catch(e) { - return false; + if(exports.isJSDate(s)) { + s = Number(s); + if(s >= MIN_MS && s <= MAX_MS) return s; + return BADNUM; } + // otherwise only accept strings and numbers + if(typeof s !== 'string' && typeof s !== 'number') return BADNUM; var y, m, d, h; // split date and time parts - var datetime = String(s).split(' '); - if(datetime.length > 2) return false; + // TODO: we strip leading/trailing whitespace but not other + // characters like we do for numbers - do we want to? + var datetime = String(s).trim().split(' '); + if(datetime.length > 2) return BADNUM; var p = datetime[0].split('-'); // date part - if(p.length > 3 || (p.length !== 3 && datetime[1])) return false; + + var CE = true; // common era, ie positive year + if(p[0] === '') { + // first part is blank: year starts with a minus sign + CE = false; + p.splice(0, 1); + } + + var plen = p.length; + if(plen > 3 || (plen !== 3 && datetime[1]) || !plen) return BADNUM; // year if(p[0].length === 4) y = Number(p[0]); else if(p[0].length === 2) { + if(!CE) return BADNUM; var yNow = new Date().getFullYear(); y = ((Number(p[0]) - yNow + 70) % 100 + 200) % 100 + yNow - 70; } - else return false; - if(!isNumeric(y)) return false; - if(p.length === 1) return new Date(y, 0, 1).getTime(); // year only + else return BADNUM; + if(!isNumeric(y)) return BADNUM; + + // javascript takes new Date(0..99,m,d) to mean 1900-1999, so + // to support years 0-99 we need to use setFullYear explicitly + var baseDate = new Date(0, 0, 1); + baseDate.setFullYear(CE ? y : -y); + if(p.length > 1) { + + // month - may be 1 or 2 digits + m = Number(p[1]) - 1; // new Date() uses zero-based months + if(p[1].length > 2 || !(m >= 0 && m <= 11)) return BADNUM; + baseDate.setMonth(m); + + if(p.length > 2) { + + // day - may be 1 or 2 digits + d = Number(p[2]); + if(p[2].length > 2 || !(d >= 1 && d <= 31)) return BADNUM; + baseDate.setDate(d); - // month - m = Number(p[1]) - 1; // new Date() uses zero-based months - if(p[1].length > 2 || !(m >= 0 && m <= 11)) return false; - if(p.length === 2) return new Date(y, m, 1).getTime(); // year-month + // does that date exist in this month? + if(baseDate.getDate() !== d) return BADNUM; - // day - d = Number(p[2]); - if(p[2].length > 2 || !(d >= 1 && d <= 31)) return false; + if(datetime[1]) { - // now save the date part - d = new Date(y, m, d).getTime(); - if(!datetime[1]) return d; // year-month-day - p = datetime[1].split(':'); - if(p.length > 3) return false; + p = datetime[1].split(':'); + if(p.length > 3) return BADNUM; - // hour - h = Number(p[0]); - if(p[0].length > 2 || !(h >= 0 && h <= 23)) return false; - d += 3600000 * h; - if(p.length === 1) return d; + // hour - may be 1 or 2 digits + h = Number(p[0]); + if(p[0].length > 2 || !p[0].length || !(h >= 0 && h <= 23)) return BADNUM; + baseDate.setHours(h); - // minute - m = Number(p[1]); - if(p[1].length > 2 || !(m >= 0 && m <= 59)) return false; - d += 60000 * m; - if(p.length === 2) return d; + // does that hour exist in this day? (Daylight time!) + // (TODO: remove this check when we move to UTC) + if(baseDate.getHours() !== h) return BADNUM; - // second - s = Number(p[2]); - if(!(s >= 0 && s < 60)) return false; - return d + s * 1000; + if(p.length > 1) { + d = baseDate.getTime(); + + // minute - must be 2 digits + m = Number(p[1]); + if(p[1].length !== 2 || !(m >= 0 && m <= 59)) return BADNUM; + d += ONEMIN * m; + if(p.length === 2) return d; + + // second (and milliseconds) - must have 2-digit seconds + if(p[2].split('.')[0].length !== 2) return BADNUM; + s = Number(p[2]); + if(!(s >= 0 && s < 60)) return BADNUM; + return d + s * ONESEC; + } + } + } + } + return baseDate.getTime(); }; +MIN_MS = exports.MIN_MS = exports.dateTime2ms('-9999'); +MAX_MS = exports.MAX_MS = exports.dateTime2ms('9999-12-31 23:59:59.9999'); + // is string s a date? (see above) exports.isDateTime = function(s) { - return (exports.dateTime2ms(s) !== false); + return (exports.dateTime2ms(s) !== BADNUM); }; // pad a number with zeroes, to given # of digits before the decimal point @@ -25987,224 +25954,68 @@ function lpad(val, digits) { } /** - * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.sss - * Crop any trailing zeros in time, but always leave full date - * (we could choose to crop '-01' from date too)... + * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.ssss + * Crop any trailing zeros in time, except never stop right after hours + * (we could choose to crop '-01' from date too but for now we always + * show the whole date) * Optional range r is the data range that applies, also in ms. * If rng is big, the later parts of time will be omitted */ +var NINETYDAYS = 90 * ONEDAY; +var THREEHOURS = 3 * ONEHOUR; +var FIVEMIN = 5 * ONEMIN; exports.ms2DateTime = function(ms, r) { + if(typeof ms !== 'number' || !(ms >= MIN_MS && ms <= MAX_MS)) return BADNUM; + if(!r) r = 0; - var d = new Date(ms), - s = d3.time.format('%Y-%m-%d')(d); - - if(r < 7776000000) { - // <90 days: add hours - s += ' ' + lpad(d.getHours(), 2); - if(r < 432000000) { - // <5 days: add minutes - s += ':' + lpad(d.getMinutes(), 2); - if(r < 10800000) { - // <3 hours: add seconds - s += ':' + lpad(d.getSeconds(), 2); - if(r < 300000) { - // <5 minutes: add ms - s += '.' + lpad(d.getMilliseconds(), 3); + var d = new Date(Math.floor(ms)), + dateStr = d3.time.format('%Y-%m-%d')(d), + // <90 days: add hours and minutes - never *only* add hours + h = (r < NINETYDAYS) ? d.getHours() : 0, + m = (r < NINETYDAYS) ? d.getMinutes() : 0, + // <3 hours: add seconds + s = (r < THREEHOURS) ? d.getSeconds() : 0, + // <5 minutes: add ms (plus one extra digit, this is msec*10) + msec10 = (r < FIVEMIN) ? Math.round((d.getMilliseconds() + (((ms % 1) + 1) % 1)) * 10) : 0; + + // include each part that has nonzero data in or after it + if(h || m || s || msec10) { + dateStr += ' ' + lpad(h, 2) + ':' + lpad(m, 2); + if(s || msec10) { + dateStr += ':' + lpad(s, 2); + if(msec10) { + var digits = 4; + while(msec10 % 10 === 0) { + digits -= 1; + msec10 /= 10; } + dateStr += '.' + lpad(msec10, digits); } } - // strip trailing zeros - return s.replace(/([:\s]00)*\.?[0]*$/, ''); } - return s; -}; - -/** - * parseDate: forgiving attempt to turn any date string - * into a javascript date object - * - * first collate all the date formats we want to support, precompiled - * to d3 format objects see below for the string cleaning that happens - * before this separate out 2-digit (y) and 4-digit-year (Y) formats, - * formats with month names (b), and formats with am/pm (I) or no time (D) - * (also includes hour only, as the test is really for a colon) so we can - * cut down the number of tests we need to run for any given string - * (right now all are between 15 and 32 tests) - */ - -// TODO: this is way out of date vs. the server-side version -var timeFormats = { - // 24 hour - H: ['%H:%M:%S~%L', '%H:%M:%S', '%H:%M'], - // with am/pm - I: ['%I:%M:%S~%L%p', '%I:%M:%S%p', '%I:%M%p'], - // no colon, ie only date or date with hour (could also support eg 12h34m?) - D: ['%H', '%I%p', '%Hh'] -}; - -var dateFormats = { - Y: [ - '%Y~%m~%d', - '%Y%m%d', - '%y%m%d', // YYMMDD, has 6 digits together so will match Y, not y - '%m~%d~%Y', // MM/DD/YYYY has first precedence - '%d~%m~%Y' // then DD/MM/YYYY - ], - Yb: [ - '%b~%d~%Y', // eg nov 21 2013 - '%d~%b~%Y', // eg 21 nov 2013 - '%Y~%d~%b', // eg 2013 21 nov (or 2013 q3, after replacement) - '%Y~%b~%d' // eg 2013 nov 21 - ], - /** - * the two-digit year cases have so many potential ambiguities - * it's not even funny, but we'll try them anyway. - */ - y: [ - '%m~%d~%y', - '%d~%m~%y', - '%y~%m~%d' - ], - yb: [ - '%b~%d~%y', - '%d~%b~%y', - '%y~%d~%b', - '%y~%b~%d' - ] + return dateStr; }; -// use utc formatter since we're ignoring timezone info -var formatter = d3.time.format.utc; - -/** - * ISO8601 and YYYYMMDDHHMMSS are the only ones where date and time - * are not separated by a space, so they get inserted specially here. - * Also a couple formats with no day (so time makes no sense) - */ -var dateTimeFormats = { - Y: { - H: ['%Y~%m~%dT%H:%M:%S', '%Y~%m~%dT%H:%M:%S~%L'].map(formatter), - I: [], - D: ['%Y%m%d%H%M%S', '%Y~%m', '%m~%Y'].map(formatter) - }, - Yb: {H: [], I: [], D: ['%Y~%b', '%b~%Y'].map(formatter)}, - y: {H: [], I: [], D: []}, - yb: {H: [], I: [], D: []} -}; -// all others get inserted in all possible combinations from dateFormats and timeFormats -['Y', 'Yb', 'y', 'yb'].forEach(function(dateType) { - dateFormats[dateType].forEach(function(dateFormat) { - // just a date (don't do just a time) - dateTimeFormats[dateType].D.push(formatter(dateFormat)); - ['H', 'I', 'D'].forEach(function(timeType) { - timeFormats[timeType].forEach(function(timeFormat) { - var a = dateTimeFormats[dateType][timeType]; - - // 'date time', then 'time date' - a.push(formatter(dateFormat + '~' + timeFormat)); - a.push(formatter(timeFormat + '~' + dateFormat)); - }); - }); - }); -}); - -// precompiled regexps for performance -var matchword = /[a-z]*/g, - shortenword = function(m) { return m.substr(0, 3); }, - weekdaymatch = /(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g, - separatormatch = /[\s,\/\-\.\(\)]+/g, - ampmmatch = /~?([ap])~?m(~|$)/, - replaceampm = function(m, ap) { return ap + 'm '; }, - match4Y = /\d\d\d\d/, - matchMonthName = /(^|~)[a-z]{3}/, - matchAMPM = /[ap]m/, - matchcolon = /:/, - matchquarter = /q([1-4])/, - quarters = ['31~mar', '30~jun', '30~sep', '31~dec'], - replacequarter = function(m, n) { return quarters[n - 1]; }, - matchTZ = / ?([+\-]\d\d:?\d\d|Z)$/; - -function getDateType(v) { - var dateType; - dateType = (match4Y.test(v) ? 'Y' : 'y'); - dateType = dateType + (matchMonthName.test(v) ? 'b' : ''); - return dateType; -} - -function getTimeType(v) { - var timeType; - timeType = matchcolon.test(v) ? (matchAMPM.test(v) ? 'I' : 'H') : 'D'; - return timeType; -} - -exports.parseDate = function(v) { - // is it already a date? just return it - if(v.getTime) return v; - /** - * otherwise, if it's not a string, return nothing - * the case of numbers that just have years will get - * dealt with elsewhere. - */ - if(typeof v !== 'string') return false; - - // first clean up the string a bit to reduce the number of formats we have to test - v = v.toLowerCase() - /** - * cut all words down to 3 characters - this will result in - * some spurious matches, ie whenever the first three characters - * of a word match a month or weekday but that seems more likely - * to fix typos than to make dates where they shouldn't be... - * and then we can omit the long form of months from our testing - */ - .replace(matchword, shortenword) - /** - * remove weekday names, as they get overridden anyway if they're - * inconsistent also removes a few more words - * (ie "tuesday the 26th of november") - * TODO: language support? - * for months too, but these seem to be built into d3 - */ - .replace(weekdaymatch, '') - /** - * collapse all separators one ~ at a time, except : which seems - * pretty consistent for the time part use ~ instead of space or - * something since d3 can eat a space as padding on 1-digit numbers - */ - .replace(separatormatch, '~') - // in case of a.m. or p.m. (also take off any space before am/pm) - .replace(ampmmatch, replaceampm) - // turn quarters Q1-4 into dates (quarter ends) - .replace(matchquarter, replacequarter) - .trim() - // also try to ignore timezone info, at least for now - .replace(matchTZ, ''); - - // now test against the various formats that might match - var out = null, - dateType = getDateType(v), - timeType = getTimeType(v), - formatList, - len; - - formatList = dateTimeFormats[dateType][timeType]; - len = formatList.length; - - for(var i = 0; i < len; i++) { - out = formatList[i].parse(v); - if(out) break; +// normalize date format to date string, in case it starts as +// a Date object or milliseconds +// optional dflt is the return value if cleaning fails +exports.cleanDate = function(v, dflt) { + if(exports.isJSDate(v) || typeof v === 'number') { + // NOTE: if someone puts in a year as a number rather than a string, + // this will mistakenly convert it thinking it's milliseconds from 1970 + // that is: '2012' -> Jan. 1, 2012, but 2012 -> 2012 epoch milliseconds + v = exports.ms2DateTime(+v); + if(!v && dflt !== undefined) return dflt; } - - // If not an instance of Date at this point, just return it. - if(!(out instanceof Date)) return false; - // parse() method interprets arguments with local time zone. - var tzoff = out.getTimezoneOffset(); - // In general (default) this is not what we want, so force into UTC: - out.setTime(out.getTime() + tzoff * 60 * 1000); - return out; + else if(!exports.isDateTime(v)) { + logError('unrecognized date', v); + return dflt; + } + return v; }; -},{"d3":10,"fast-isnumeric":13}],113:[function(require,module,exports){ +},{"../constants/numerical":106,"./loggers":121,"d3":10,"fast-isnumeric":13}],114:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26370,7 +26181,7 @@ var Events = { module.exports = Events; -},{"events":12}],114:[function(require,module,exports){ +},{"events":12}],115:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26484,7 +26295,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":118}],115:[function(require,module,exports){ +},{"./is_plain_object.js":120}],116:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26535,7 +26346,38 @@ module.exports = function filterUnique(array) { return out; }; -},{}],116:[function(require,module,exports){ +},{}],117:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +/** Filter out object items with visible !== true + * insider array container. + * + * @param {array of objects} container + * @return {array of objects} of length <= container + * + */ +module.exports = function filterVisible(container) { + var out = []; + + for(var i = 0; i < container.length; i++) { + var item = container[i]; + + if(item.visible === true) out.push(item); + } + + return out; +}; + +},{}],118:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26561,19 +26403,15 @@ lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; lib.validate = coerceModule.validate; -lib.isValObject = coerceModule.isValObject; -lib.crawl = coerceModule.crawl; -lib.findArrayAttributes = coerceModule.findArrayAttributes; -lib.IS_SUBPLOT_OBJ = coerceModule.IS_SUBPLOT_OBJ; -lib.IS_LINKED_TO_ARRAY = coerceModule.IS_LINKED_TO_ARRAY; -lib.DEPRECATED = coerceModule.DEPRECATED; -lib.UNDERSCORE_ATTRS = coerceModule.UNDERSCORE_ATTRS; var datesModule = require('./dates'); lib.dateTime2ms = datesModule.dateTime2ms; lib.isDateTime = datesModule.isDateTime; lib.ms2DateTime = datesModule.ms2DateTime; -lib.parseDate = datesModule.parseDate; +lib.cleanDate = datesModule.cleanDate; +lib.isJSDate = datesModule.isJSDate; +lib.MIN_MS = datesModule.MIN_MS; +lib.MAX_MS = datesModule.MAX_MS; var searchModule = require('./search'); lib.findBin = searchModule.findBin; @@ -26614,6 +26452,10 @@ lib.error = loggersModule.error; lib.notifier = require('./notifier'); lib.filterUnique = require('./filter_unique'); +lib.filterVisible = require('./filter_visible'); + + +lib.cleanNumber = require('./clean_number'); /** * swap x and y of the same attribute in container cont @@ -26790,7 +26632,7 @@ lib.smooth = function(arrayIn, FWHM) { * as long as its returns are not promises (ie have no .then) * includes one argument arg to send to all functions... * this is mainly just to prevent us having to make wrapper functions - * when the only purpose of the wrapper is to reference gd / td + * when the only purpose of the wrapper is to reference gd * and a final step to be executed at the end * TODO: if there's an error and everything is sync, * this doesn't happen yet because we want to make sure @@ -27263,7 +27105,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./coerce":111,"./dates":112,"./extend":114,"./filter_unique":115,"./is_array":117,"./is_plain_object":118,"./loggers":119,"./matrix":120,"./nested_property":121,"./notifier":122,"./search":125,"./stats":127,"d3":10}],117:[function(require,module,exports){ +},{"./clean_number":111,"./coerce":112,"./dates":113,"./extend":115,"./filter_unique":116,"./filter_visible":117,"./is_array":119,"./is_plain_object":120,"./loggers":121,"./matrix":122,"./nested_property":123,"./notifier":124,"./search":127,"./stats":129,"d3":10}],119:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27281,7 +27123,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ArrayBuffer.isView(a); }; -},{}],118:[function(require,module,exports){ +},{}],120:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27310,7 +27152,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],119:[function(require,module,exports){ +},{}],121:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27377,7 +27219,7 @@ loggers.error = function() { } }; -},{"../plot_api/plot_config":131}],120:[function(require,module,exports){ +},{"../plot_api/plot_config":133}],122:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27487,7 +27329,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],121:[function(require,module,exports){ +},{}],123:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27744,7 +27586,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./is_array":117,"fast-isnumeric":13}],122:[function(require,module,exports){ +},{"./is_array":119,"fast-isnumeric":13}],124:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27821,7 +27663,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":10,"fast-isnumeric":13}],123:[function(require,module,exports){ +},{"d3":10,"fast-isnumeric":13}],125:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28061,7 +27903,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"./matrix":120}],124:[function(require,module,exports){ +},{"./matrix":122}],126:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28272,7 +28114,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":116,"../plot_api/plot_config":131}],125:[function(require,module,exports){ +},{"../lib":118,"../plot_api/plot_config":133}],127:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28383,7 +28225,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":119,"fast-isnumeric":13}],126:[function(require,module,exports){ +},{"./loggers":121,"fast-isnumeric":13}],128:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28406,7 +28248,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],127:[function(require,module,exports){ +},{}],129:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28502,7 +28344,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":13}],128:[function(require,module,exports){ +},{"fast-isnumeric":13}],130:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28616,8 +28458,8 @@ exports.convertToTspans = function(_context, _callback) { } if(tex) { - var td = Lib.getPlotDiv(that.node()); - ((td && td._promises) || []).push(new Promise(function(resolve) { + var gd = Lib.getPlotDiv(that.node()); + ((gd && gd._promises) || []).push(new Promise(function(resolve) { that.style({visibility: 'hidden'}); var config = {fontSize: parseInt(that.style('font-size'), 10)}; @@ -29029,7 +28871,7 @@ exports.makeEditable = function(context, _delegate, options) { return d3.rebind(this, dispatch, 'on'); }; -},{"../constants/string_mappings":107,"../constants/xmlns_namespaces":108,"../lib":116,"d3":10}],129:[function(require,module,exports){ +},{"../constants/string_mappings":107,"../constants/xmlns_namespaces":108,"../lib":118,"d3":10}],131:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -29134,13 +28976,12 @@ exports.cleanLayout = function(layout) { } } - if(layout.annotations !== undefined && !Array.isArray(layout.annotations)) { - Lib.warn('Annotations must be an array.'); - delete layout.annotations; - } - var annotationsLen = (layout.annotations || []).length; + var annotationsLen = Array.isArray(layout.annotations) ? layout.annotations.length : 0; for(i = 0; i < annotationsLen; i++) { var ann = layout.annotations[i]; + + if(!Lib.isPlainObject(ann)) continue; + if(ann.ref) { if(ann.ref === 'paper') { ann.xref = 'paper'; @@ -29152,17 +28993,17 @@ exports.cleanLayout = function(layout) { } delete ann.ref; } + cleanAxRef(ann, 'xref'); cleanAxRef(ann, 'yref'); } - if(layout.shapes !== undefined && !Array.isArray(layout.shapes)) { - Lib.warn('Shapes must be an array.'); - delete layout.shapes; - } - var shapesLen = (layout.shapes || []).length; + var shapesLen = Array.isArray(layout.shapes) ? layout.shapes.length : 0; for(i = 0; i < shapesLen; i++) { var shape = layout.shapes[i]; + + if(!Lib.isPlainObject(shape)) continue; + cleanAxRef(shape, 'xref'); cleanAxRef(shape, 'yref'); } @@ -29511,7 +29352,7 @@ exports.manageArrayContainers = function(np, newVal, undoit) { } }; -},{"../components/color":26,"../lib":116,"../plots/cartesian/axes":142,"../plots/plots":167,"../registry":174,"fast-isnumeric":13,"gl-mat4/fromQuat":14}],130:[function(require,module,exports){ +},{"../components/color":26,"../lib":118,"../plots/cartesian/axes":145,"../plots/plots":169,"../registry":176,"fast-isnumeric":13,"gl-mat4/fromQuat":14}],132:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -31431,13 +31272,14 @@ function _relayout(gd, aobj) { objList = layout[objType] || [], obji = objList[objNum] || {}; - // new API, remove annotation / shape with `null` - if(vi === null) aobj[ai] = 'remove'; - // if p.parts is just an annotation number, and val is either // 'add' or an entire annotation to add, the undo is 'remove' // if val is 'remove' then undo is the whole annotation object if(p.parts.length === 2) { + + // new API, remove annotation / shape with `null` + if(vi === null) aobj[ai] = 'remove'; + if(aobj[ai] === 'add' || Lib.isPlainObject(aobj[ai])) { undoit[ai] = 'remove'; } @@ -31472,6 +31314,7 @@ function _relayout(gd, aobj) { } // alter gd.layout else { + var pp1 = String(p.parts[1] || ''); // check whether we can short-circuit a full redraw // 3d or geo at this point just needs to redraw. if(p.parts[0].indexOf('scene') === 0) flags.doplot = true; @@ -31486,17 +31329,17 @@ function _relayout(gd, aobj) { else if(ai.indexOf('title') !== -1) flags.doticks = true; else if(p.parts[0].indexOf('bgcolor') !== -1) flags.dolayoutstyle = true; else if(p.parts.length > 1 && - Lib.containsAny(p.parts[1], ['tick', 'exponent', 'grid', 'zeroline'])) { + Lib.containsAny(pp1, ['tick', 'exponent', 'grid', 'zeroline'])) { flags.doticks = true; } else if(ai.indexOf('.linewidth') !== -1 && ai.indexOf('axis') !== -1) { flags.doticks = flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1].indexOf('line') !== -1) { + else if(p.parts.length > 1 && pp1.indexOf('line') !== -1) { flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1] === 'mirror') { + else if(p.parts.length > 1 && pp1 === 'mirror') { flags.doticks = flags.dolayoutstyle = true; } else if(ai === 'margin.pad') { @@ -31518,7 +31361,7 @@ function _relayout(gd, aobj) { */ else if(['hovermode', 'dragmode'].indexOf(ai) !== -1) flags.domodebar = true; else if(['hovermode', 'dragmode', 'height', - 'width', 'autosize'].indexOf(ai) === -1) { + 'width', 'autosize'].indexOf(ai) === -1) { flags.doplot = true; } @@ -31727,6 +31570,20 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } } + // Execute a callback after the wrapper function has been called n times. + // This is used to defer the resolution until a transition has resovled *and* + // the frame has completed. If it's not done this way, then we get a race + // condition in which the animation might resolve before a transition is complete + // or vice versa. + function callbackOnNthTime(cb, n) { + var cnt = 0; + return function() { + if(cb && ++cnt === n) { + return cb(); + } + }; + } + return new Promise(function(resolve, reject) { function discardExistingFrames() { if(trans._frameQueue.length === 0) { @@ -31771,14 +31628,13 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { frameOpts: frameOpts, transitionOpts: transitionOpts, }; - if(i === frameList.length - 1) { // The last frame in this .animate call stores the promise resolve // and reject callbacks. This is how we ensure that the animation // loop (which may exist as a result of a *different* .animate call) // still resolves or rejecdts this .animate call's promise. once it's // complete. - nextFrame.onComplete = resolve; + nextFrame.onComplete = callbackOnNthTime(resolve, 2); nextFrame.onInterrupt = reject; } @@ -31816,7 +31672,6 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { // Execute the callback and unset it to ensure it doesn't // accidentally get called twice trans._currentFrame.onComplete(); - trans._currentFrame.onComplete = null; } var newFrame = trans._currentFrame = trans._frameQueue.shift(); @@ -31836,7 +31691,12 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { helpers.coerceTraceIndices(gd, newFrame.frame.traces), newFrame.frameOpts, newFrame.transitionOpts - ); + ).then(function() { + if(newFrame.onComplete) { + newFrame.onComplete(); + } + + }); gd.emit('plotly_animatingframe', { name: newFrame.name, @@ -31912,6 +31772,8 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { for(i = 0; i < trans._frames.length; i++) { frame = trans._frames[i]; + if(!frame) continue; + if(allFrames || frame.group === frameOrGroupNameOrFrameList) { frameList.push({ type: 'byname', @@ -31923,14 +31785,15 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } else if(isFrameArray) { for(i = 0; i < frameOrGroupNameOrFrameList.length; i++) { var frameOrName = frameOrGroupNameOrFrameList[i]; - if(typeof frameOrName === 'string') { + if(['number', 'string'].indexOf(typeof frameOrName) !== -1) { + frameOrName = String(frameOrName); // In this case, there's an array and this frame is a string name: frameList.push({ type: 'byname', name: frameOrName, data: setTransitionConfig({name: frameOrName}) }); - } else { + } else if(Lib.isPlainObject(frameOrName)) { frameList.push({ type: 'object', data: setTransitionConfig(Lib.extendFlat({}, frameOrName)) @@ -32074,7 +31937,7 @@ Plotly.addFrames = function(gd, frameList, indices) { if(_hash[frame.name]) { // If frame is present, overwrite its definition: for(j = 0; j < _frames.length; j++) { - if(_frames[j].name === frame.name) break; + if((_frames[j] || {}).name === frame.name) break; } ops.push({type: 'replace', index: j, value: frame}); revops.unshift({type: 'replace', index: j, value: _frames[j]}); @@ -32274,7 +32137,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":50,"../components/errorbars":56,"../constants/xmlns_namespaces":108,"../lib":116,"../lib/events":113,"../lib/queue":124,"../lib/svg_text_utils":128,"../plotly":138,"../plots/cartesian/graph_interact":150,"../plots/plots":167,"../plots/polar":170,"../registry":174,"./helpers":129,"./subroutines":135,"d3":10,"fast-isnumeric":13}],131:[function(require,module,exports){ +},{"../components/drawing":49,"../components/errorbars":55,"../constants/xmlns_namespaces":108,"../lib":118,"../lib/events":114,"../lib/queue":126,"../lib/svg_text_utils":130,"../plotly":140,"../plots/cartesian/graph_interact":152,"../plots/plots":169,"../plots/polar":172,"../registry":176,"./helpers":131,"./subroutines":137,"d3":10,"fast-isnumeric":13}],133:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -32394,7 +32257,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],132:[function(require,module,exports){ +},{}],134:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -32406,185 +32269,287 @@ function defaultSetBackground(gd, bgColor) { 'use strict'; -var Plotly = require('../plotly'); var Registry = require('../registry'); -var Plots = require('../plots/plots'); var Lib = require('../lib'); -// FIXME polar attribute are not part of Plotly yet +var baseAttributes = require('../plots/attributes'); +var baseLayoutAttributes = require('../plots/layout_attributes'); +var frameAttributes = require('../plots/frame_attributes'); +var animationAttributes = require('../plots/animation_attributes'); + +// polar attributes are not part of the Registry yet var polarAreaAttrs = require('../plots/polar/area_attributes'); var polarAxisAttrs = require('../plots/polar/axis_attributes'); var extendFlat = Lib.extendFlat; var extendDeep = Lib.extendDeep; -var extendDeepAll = Lib.extendDeepAll; -var NESTED_MODULE = '_nestedModules', - COMPOSED_MODULE = '_composedModules'; +var IS_SUBPLOT_OBJ = '_isSubplotObj'; +var IS_LINKED_TO_ARRAY = '_isLinkedToArray'; +var DEPRECATED = '_deprecated'; +var UNDERSCORE_ATTRS = [IS_SUBPLOT_OBJ, IS_LINKED_TO_ARRAY, DEPRECATED]; -var plotSchema = { - traces: {}, - layout: {}, - transforms: {}, - defs: {} -}; +exports.IS_SUBPLOT_OBJ = IS_SUBPLOT_OBJ; +exports.IS_LINKED_TO_ARRAY = IS_LINKED_TO_ARRAY; +exports.DEPRECATED = DEPRECATED; +exports.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS; +/** Outputs the full plotly.js plot schema + * + * @return {object} + * - defs + * - traces + * - layout + * - transforms + * - frames + * - animations + * - config (coming soon ...) + */ +exports.get = function() { + var traces = {}; -var PlotSchema = module.exports = {}; + Registry.allTypes.concat('area').forEach(function(type) { + traces[type] = getTraceAttributes(type); + }); + var transforms = {}; -PlotSchema.get = function() { - Registry.allTypes - .concat('area') // FIXME polar 'area' attributes - .forEach(getTraceAttributes); + Object.keys(Registry.transformsRegistry).forEach(function(type) { + transforms[type] = getTransformAttributes(type); + }); - getLayoutAttributes(); + return { + defs: { + valObjects: Lib.valObjects, + metaKeys: UNDERSCORE_ATTRS.concat['description', 'role'] + }, - Object.keys(Registry.transformsRegistry).forEach(getTransformAttributes); + traces: traces, + layout: getLayoutAttributes(), - getDefs(); + transforms: transforms, - return plotSchema; + frames: formatAttributes(frameAttributes), + animation: formatAttributes(animationAttributes) + }; }; -PlotSchema.crawl = Lib.crawl; +/** + * Crawl the attribute tree, recursively calling a callback function + * + * @param {object} attrs + * The node of the attribute tree (e.g. the root) from which recursion originates + * @param {Function} callback + * A callback function with the signature: + * @callback callback + * @param {object} attr an attribute + * @param {String} attrName name string + * @param {object[]} attrs all the attributes + * @param {Number} level the recursion level, 0 at the root + * @param {Number} [specifiedLevel] + * The level in the tree, in order to let the callback function detect descend or backtrack, + * typically unsupplied (implied 0), just used by the self-recursive call. + * The necessity arises because the tree traversal is not controlled by callback return values. + * The decision to not use callback return values for controlling tree pruning arose from + * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions + * precedes the callback call. + * + * @return {object} transformOut + * copy of transformIn that contains attribute defaults + */ +exports.crawl = function(attrs, callback, specifiedLevel) { + var level = specifiedLevel || 0; + + Object.keys(attrs).forEach(function(attrName) { + var attr = attrs[attrName]; -PlotSchema.isValObject = Lib.isValObject; + if(UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; -function getTraceAttributes(type) { - var globalAttributes = Plots.attributes, - _module = getModule({type: type}), - meta = getMeta(type), - subplotRegistry = getSubplotRegistry(type); + callback(attr, attrName, attrs, level); - var attributes = {}, - layoutAttributes = {}; + if(exports.isValObject(attr)) return; - // make 'type' the first attribute in the object - attributes.type = null; + if(Lib.isPlainObject(attr)) exports.crawl(attr, callback, level + 1); + }); +}; + +/** Is object a value object (or a container object)? + * + * @param {object} obj + * @return {boolean} + * returns true for a valid value object and + * false for tree nodes in the attribute hierarchy + */ +exports.isValObject = function(obj) { + return obj && obj.valType !== undefined; +}; - // global attributes (same for all trace types) - extendDeep(attributes, globalAttributes); +/** + * Find all data array attributes in a given trace object - including + * `arrayOk` attributes. + * + * @param {object} trace + * full trace object that contains a reference to `_module.attributes` + * + * @return {array} arrayAttributes + * list of array attributes for the given trace + */ +exports.findArrayAttributes = function(trace) { + var arrayAttributes = [], + stack = []; - // module attributes (+ nested + composed) - attributes = coupleAttrs( - _module.attributes, attributes, 'attributes', type - ); + function callback(attr, attrName, attrs, level) { + stack = stack.slice(0, level).concat([attrName]); - // subplot attributes - if(subplotRegistry.attributes !== undefined) { - extendDeep(attributes, subplotRegistry.attributes); + var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; + if(!splittableAttr) return; + + var astr = toAttrString(stack); + var val = Lib.nestedProperty(trace, astr).get(); + if(!Array.isArray(val)) return; + + arrayAttributes.push(astr); } - // 'type' gets overwritten by globalAttributes; reset it here - attributes.type = type; + function toAttrString(stack) { + return stack.join('.'); + } - attributes = removeUnderscoreAttrs(attributes); - mergeValTypeAndRole(attributes); - plotSchema.traces[type] = extendFlat({}, - meta, - { attributes: attributes } - ); + exports.crawl(trace._module.attributes, callback); - // trace-specific layout attributes - if(_module.layoutAttributes !== undefined) { - layoutAttributes = coupleAttrs( - _module.layoutAttributes, layoutAttributes, 'layoutAttributes', type - ); + if(trace.transforms) { + var transforms = trace.transforms; - mergeValTypeAndRole(layoutAttributes); - plotSchema.traces[type].layoutAttributes = layoutAttributes; + for(var i = 0; i < transforms.length; i++) { + var transform = transforms[i]; + + stack = ['transforms[' + i + ']']; + exports.crawl(transform._module.attributes, callback, 1); + } } -} -function getLayoutAttributes() { - var globalLayoutAttributes = Plots.layoutAttributes, - layoutAttributes = {}; + // Look into the fullInput module attributes for array attributes + // to make sure that 'custom' array attributes are detected. + // + // At the moment, we need this block to make sure that + // ohlc and candlestick 'open', 'high', 'low', 'close' can be + // used with filter ang groupby transforms. + if(trace._fullInput) { + exports.crawl(trace._fullInput._module.attributes, callback); - // layout module attributes (+ nested + composed) - layoutAttributes = coupleAttrs( - globalLayoutAttributes, layoutAttributes, 'layoutAttributes', '*' - ); + arrayAttributes = Lib.filterUnique(arrayAttributes); + } - // FIXME polar layout attributes - layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); + return arrayAttributes; +}; - // add crawler.IS_SUBPLOT_OBJ attribute - layoutAttributes = handleSubplotObjs(layoutAttributes); +function getTraceAttributes(type) { + var _module, basePlotModule; - layoutAttributes = removeUnderscoreAttrs(layoutAttributes); - mergeValTypeAndRole(layoutAttributes); + if(type === 'area') { + _module = { attributes: polarAreaAttrs }; + basePlotModule = {}; + } + else { + _module = Registry.modules[type]._module, + basePlotModule = _module.basePlotModule; + } - // generate crawler.IS_LINKED_TO_ARRAY structure - handleLinkedToArray(layoutAttributes); + var attributes = {}; - plotSchema.layout = { layoutAttributes: layoutAttributes }; -} + // make 'type' the first attribute in the object + attributes.type = null; -function getTransformAttributes(name) { - var _module = Registry.transformsRegistry[name], - _schema = {}; + // base attributes (same for all trace types) + extendDeep(attributes, baseAttributes); - _schema = coupleAttrs(_schema, _module.attributes || {}, 'attributes', '*'); - _schema = removeUnderscoreAttrs(_schema); - mergeValTypeAndRole(_schema); - handleLinkedToArray(_schema); + // module attributes + extendDeep(attributes, _module.attributes); - plotSchema.transforms[name] = { attributes: _schema }; -} + // subplot attributes + if(basePlotModule.attributes) { + extendDeep(attributes, basePlotModule.attributes); + } + + // 'type' gets overwritten by baseAttributes; reset it here + attributes.type = type; -function getDefs() { - plotSchema.defs = { - valObjects: Lib.valObjects, - metaKeys: Lib.UNDERSCORE_ATTRS.concat(['description', 'role']) + var out = { + meta: _module.meta || {}, + attributes: formatAttributes(attributes), }; + + // trace-specific layout attributes + if(_module.layoutAttributes) { + var layoutAttributes = {}; + + extendDeep(layoutAttributes, _module.layoutAttributes); + out.layoutAttributes = formatAttributes(layoutAttributes); + } + + return out; } -function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) { - var nestedModule, nestedAttrs, nestedReference, - composedModule, composedAttrs; +function getLayoutAttributes() { + var layoutAttributes = {}; - Object.keys(attrsIn).forEach(function(k) { + // global layout attributes + extendDeep(layoutAttributes, baseLayoutAttributes); - if(k === NESTED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - nestedModule = getModule({_module: attrsIn[k][kk]}); - if(nestedModule === undefined) return; + // add base plot module layout attributes + Object.keys(Registry.subplotsRegistry).forEach(function(k) { + var _module = Registry.subplotsRegistry[k]; - nestedAttrs = nestedModule[whichAttrs]; - nestedReference = coupleAttrs( - nestedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - Lib.nestedProperty(attrsOut, kk) - .set(extendDeep({}, nestedReference)); - }); - return; + if(_module.name === 'cartesian') { + handleBasePlotModule(layoutAttributes, _module, 'xaxis'); + handleBasePlotModule(layoutAttributes, _module, 'yaxis'); + } + else { + var astr = _module.attr === 'subplot' ? _module.name : _module.attr; + + handleBasePlotModule(layoutAttributes, _module, astr); } + }); - if(k === COMPOSED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - if(kk !== type) return; + // polar layout attributes + layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); - composedModule = getModule({_module: attrsIn[k][kk]}); - if(composedModule === undefined) return; + // add registered components layout attribute + Object.keys(Registry.componentsRegistry).forEach(function(k) { + var _module = Registry.componentsRegistry[k]; - composedAttrs = composedModule[whichAttrs]; - composedAttrs = coupleAttrs( - composedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - extendDeepAll(attrsOut, composedAttrs); + if(Array.isArray(_module.layoutNodes)) { + _module.layoutNodes.forEach(function(v) { + handleRegisteredComponent(layoutAttributes, _module, v + _module.name); }); - return; } - - attrsOut[k] = Lib.isPlainObject(attrsIn[k]) ? - extendDeepAll({}, attrsIn[k]) : - attrsIn[k]; + else { + handleRegisteredComponent(layoutAttributes, _module, _module.name); + } }); - return attrsOut; + return { + layoutAttributes: formatAttributes(layoutAttributes) + }; +} + +function getTransformAttributes(type) { + var _module = Registry.transformsRegistry[type]; + + return { + attributes: formatAttributes(_module.attributes) + }; +} + +function formatAttributes(attrs) { + mergeValTypeAndRole(attrs); + formatArrayContainers(attrs); + + return attrs; } function mergeValTypeAndRole(attrs) { @@ -32598,7 +32563,7 @@ function mergeValTypeAndRole(attrs) { } function callback(attr, attrName, attrs) { - if(PlotSchema.isValObject(attr)) { + if(exports.isValObject(attr)) { if(attr.valType === 'data_array') { // all 'data_array' attrs have role 'data' attr.role = 'data'; @@ -32616,40 +32581,26 @@ function mergeValTypeAndRole(attrs) { } } - Lib.crawl(attrs, callback); + exports.crawl(attrs, callback); } -// helper methods +function formatArrayContainers(attrs) { -function getModule(arg) { - if('type' in arg) { - return (arg.type === 'area') ? // FIXME - { attributes: polarAreaAttrs } : - Registry.getModule({type: arg.type}); - } + function callback(attr, attrName, attrs) { + if(!attr) return; - var subplotsRegistry = Registry.subplotsRegistry, - componentsRegistry = Registry.componentsRegistry, - _module = arg._module; + var itemName = attr[IS_LINKED_TO_ARRAY]; - if(subplotsRegistry[_module]) return subplotsRegistry[_module]; - else if(componentsRegistry[_module]) return componentsRegistry[_module]; + if(!itemName) return; - // look it internal Plotly if all previous attempts fail - return Plotly[_module]; -} + delete attr[IS_LINKED_TO_ARRAY]; -function removeUnderscoreAttrs(attributes) { - Object.keys(attributes).forEach(function(k) { - if(k.charAt(0) === '_' && - Lib.UNDERSCORE_ATTRS.indexOf(k) === -1) delete attributes[k]; - }); - return attributes; -} + attrs[attrName] = { items: {} }; + attrs[attrName].items[itemName] = attr; + attrs[attrName].role = 'object'; + } -function getMeta(type) { - if(type === 'area') return {}; // FIXME - return Registry.modules[type].meta || {}; + exports.crawl(attrs, callback); } function assignPolarLayoutAttrs(layoutAttributes) { @@ -32660,68 +32611,25 @@ function assignPolarLayoutAttrs(layoutAttributes) { extendFlat(layoutAttributes, polarAxisAttrs.layout); - return layoutAttributes; // FIXME -} - -function getSubplotRegistry(traceType) { - if(traceType === 'area') return {}; // FIXME - - var subplotsRegistry = Registry.subplotsRegistry, - subplotType = Object.keys(subplotsRegistry).filter(function(subplotType) { - return Registry.traceIs({type: traceType}, subplotType); - })[0]; - - if(subplotType === undefined) return {}; - - return subplotsRegistry[subplotType]; -} - -function handleSubplotObjs(layoutAttributes) { - var subplotsRegistry = Registry.subplotsRegistry; - - Object.keys(layoutAttributes).forEach(function(k) { - Object.keys(subplotsRegistry).forEach(function(subplotType) { - var subplotRegistry = subplotsRegistry[subplotType], - isSubplotObj; - - if(!subplotRegistry.attrRegex) return; - - if(subplotType === 'cartesian' || subplotType === 'gl2d') { - isSubplotObj = ( - subplotRegistry.attrRegex.x.test(k) || - subplotRegistry.attrRegex.y.test(k) - ); - } - else { - isSubplotObj = subplotRegistry.attrRegex.test(k); - } - - if(isSubplotObj) layoutAttributes[k][Lib.IS_SUBPLOT_OBJ] = true; - }); - }); - return layoutAttributes; } -function handleLinkedToArray(layoutAttributes) { +function handleBasePlotModule(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep({}, _module.layoutAttributes); - function callback(attr, attrName, attrs) { - if(attr[Lib.IS_LINKED_TO_ARRAY] !== true) return; - - // TODO more robust logic - var itemName = attrName.substr(0, attrName.length - 1); + attrs[IS_SUBPLOT_OBJ] = true; + np.set(attrs); +} - delete attr[Lib.IS_LINKED_TO_ARRAY]; +function handleRegisteredComponent(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep(np.get() || {}, _module.layoutAttributes); - attrs[attrName] = { items: {} }; - attrs[attrName].items[itemName] = attr; - attrs[attrName].role = 'object'; - } - - Lib.crawl(layoutAttributes, callback); + np.set(attrs); } -},{"../lib":116,"../plotly":138,"../plots/plots":167,"../plots/polar/area_attributes":168,"../plots/polar/axis_attributes":169,"../registry":174}],133:[function(require,module,exports){ +},{"../lib":118,"../plots/animation_attributes":141,"../plots/attributes":143,"../plots/frame_attributes":166,"../plots/layout_attributes":167,"../plots/polar/area_attributes":170,"../plots/polar/axis_attributes":171,"../registry":176}],135:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -32813,10 +32721,14 @@ function registerTransformModule(newModule) { } function registerComponentModule(newModule) { - Registry.componentsRegistry[newModule.name] = newModule; + if(typeof newModule.name !== 'string') { + throw new Error('Component module *name* must be a string.'); + } + + Registry.registerComponent(newModule); } -},{"../lib":116,"../registry":174}],134:[function(require,module,exports){ +},{"../lib":118,"../registry":176}],136:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -32842,7 +32754,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":116,"../plotly":138}],135:[function(require,module,exports){ +},{"../lib":118,"../plotly":140}],137:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33164,7 +33076,7 @@ exports.doModeBar = function(gd) { return Plots.previousPromises(gd); }; -},{"../components/color":26,"../components/drawing":50,"../components/modebar":73,"../components/titles":101,"../lib":116,"../plotly":138,"../plots/plots":167,"../registry":174}],136:[function(require,module,exports){ +},{"../components/color":26,"../components/drawing":49,"../components/modebar":72,"../components/titles":100,"../lib":118,"../plotly":140,"../plots/plots":169,"../registry":176}],138:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33219,7 +33131,7 @@ function toImage(gd, opts) { // first clone the GD so we can operate in a clean environment var clone = clonePlot(gd, {format: 'png', height: opts.height, width: opts.width}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -33274,7 +33186,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":116,"../plotly":138,"../snapshot/cloneplot":175,"../snapshot/helpers":178,"../snapshot/svgtoimg":180,"../snapshot/tosvg":182,"fast-isnumeric":13}],137:[function(require,module,exports){ +},{"../lib":118,"../plotly":140,"../snapshot/cloneplot":177,"../snapshot/helpers":180,"../snapshot/svgtoimg":182,"../snapshot/tosvg":184,"fast-isnumeric":13}],139:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33450,7 +33362,8 @@ function crawl(objIn, objOut, schema, list, base, path) { crawl(valIn, valOut, nestedSchema, list, base, p); } else if(nestedSchema.items && !isInfoArray && isArray(valIn)) { - var itemName = k.substr(0, k.length - 1), + var items = nestedSchema.items, + _nestedSchema = items[Object.keys(items)[0]], indexList = []; var j, _p; @@ -33458,8 +33371,7 @@ function crawl(objIn, objOut, schema, list, base, path) { // loop over valOut items while keeping track of their // corresponding input container index (given by _index) for(j = 0; j < valOut.length; j++) { - var _nestedSchema = nestedSchema.items[itemName], - _index = valOut[j]._index || j; + var _index = valOut[j]._index || j; _p = p.slice(); _p.push(_index); @@ -33644,7 +33556,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":116,"../plots/plots":167,"./plot_schema":132}],138:[function(require,module,exports){ +},{"../lib":118,"../plots/plots":169,"./plot_schema":134}],140:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33672,25 +33584,12 @@ exports.defaultConfig = require('./plot_api/plot_config'); exports.Plots = require('./plots/plots'); exports.Axes = require('./plots/cartesian/axes'); exports.Fx = require('./plots/cartesian/graph_interact'); - -// components -exports.Color = require('./components/color'); -exports.Drawing = require('./components/drawing'); -exports.Colorscale = require('./components/colorscale'); -exports.Colorbar = require('./components/colorbar'); -exports.ErrorBars = require('./components/errorbars'); -exports.Annotations = require('./components/annotations'); -exports.Shapes = require('./components/shapes'); -exports.Legend = require('./components/legend'); -exports.Images = require('./components/images'); -exports.UpdateMenus = require('./components/updatemenus'); -exports.Sliders = require('./components/sliders'); exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/annotations":24,"./components/color":26,"./components/colorbar":31,"./components/colorscale":41,"./components/drawing":50,"./components/errorbars":56,"./components/images":62,"./components/legend":70,"./components/modebar":73,"./components/shapes":94,"./components/sliders":100,"./components/updatemenus":106,"./plot_api/plot_api":130,"./plot_api/plot_config":131,"./plots/cartesian/axes":142,"./plots/cartesian/graph_interact":150,"./plots/plots":167}],139:[function(require,module,exports){ +},{"./components/modebar":72,"./plot_api/plot_api":132,"./plot_api/plot_config":133,"./plots/cartesian/axes":145,"./plots/cartesian/graph_interact":152,"./plots/plots":169}],141:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33792,7 +33691,76 @@ module.exports = { } }; -},{}],140:[function(require,module,exports){ +},{}],142:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var Lib = require('../lib'); + + +/** Convenience wrapper for making array container logic DRY and consistent + * + * @param {object} parentObjIn + * user input object where the container in question is linked + * (i.e. either a user trace object or the user layout object) + * + * @param {object} parentObjOut + * full object where the coerced container will be linked + * (i.e. either a full trace object or the full layout object) + * + * @param {object} opts + * options object: + * - name {string} + * name of the key linking the container in question + * - handleItemDefaults {function} + * defaults method to be called on each item in the array container in question + * + * Its arguments are: + * - itemIn {object} item in user layout + * - itemOut {object} item in full layout + * - parentObj {object} (as in closure) + * - opts {object} (as in closure) + * - itemOpts {object} + * - itemIsNotPlainObject {boolean} + * N.B. + * + * - opts is passed to handleItemDefaults so it can also store + * links to supplementary data (e.g. fullData for layout components) + * + */ +module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut, opts) { + var name = opts.name; + + var contIn = Array.isArray(parentObjIn[name]) ? parentObjIn[name] : [], + contOut = parentObjOut[name] = []; + + for(var i = 0; i < contIn.length; i++) { + var itemIn = contIn[i], + itemOut = {}, + itemOpts = {}; + + if(!Lib.isPlainObject(itemIn)) { + itemOpts.itemIsNotPlainObject = true; + itemIn = {}; + } + + opts.handleItemDefaults(itemIn, itemOut, parentObjOut, opts, itemOpts); + + itemOut._input = itemIn; + itemOut._index = i; + + contOut.push(itemOut); + } +}; + +},{"../lib":118}],143:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33875,7 +33843,7 @@ module.exports = { } }; -},{}],141:[function(require,module,exports){ +},{}],144:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33902,7 +33870,7 @@ module.exports = { } }; -},{}],142:[function(require,module,exports){ +},{}],145:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33924,6 +33892,15 @@ var Titles = require('../../components/titles'); var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); +var constants = require('../../constants/numerical'); +var FP_SAFE = constants.FP_SAFE; +var ONEAVGYEAR = constants.ONEAVGYEAR; +var ONEAVGMONTH = constants.ONEAVGMONTH; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + var axes = module.exports = {}; @@ -33941,43 +33918,88 @@ axes.getFromId = axisIds.getFromId; axes.getFromTrace = axisIds.getFromTrace; -// find the list of possible axes to reference with an xref or yref attribute -// and coerce it to that list -axes.coerceRef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = axLetter + 'ref', +/* + * find the list of possible axes to reference with an xref or yref attribute + * and coerce it to that list + * + * attr: the attribute we're generating a reference for. Should end in 'x' or 'y' + * but can be prefixed, like 'ax' for annotation's arrow x + * dflt: the default to coerce to, or blank to use the first axis (falling back on + * extraOption if there is no axis) + * extraOption: aside from existing axes with this letter, what non-axis value is allowed? + * Only required if it's different from `dflt` + */ +axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption) { + var axLetter = attr.charAt(attr.length - 1), + axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), + refAttr = attr + 'ref', attrDef = {}; + if(!dflt) dflt = axlist[0] || extraOption; + if(!extraOption) extraOption = dflt; + // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(['paper']), - dflt: dflt || axlist[0] || 'paper' + values: axlist.concat(extraOption ? [extraOption] : []), + dflt: dflt }; // xref, yref return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; -// todo: duplicated per github PR 610. Should be consolidated with axes.coerceRef. -// find the list of possible axes to reference with an axref or ayref attribute -// and coerce it to that list -axes.coerceARef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = 'a' + axLetter + 'ref', - attrDef = {}; +/* + * coerce position attributes (range-type) that can be either on axes or absolute + * (paper or pixel) referenced. The biggest complication here is that we don't know + * before looking at the axis whether the value must be a number or not (it may be + * a date string), so we can't use the regular valType='number' machinery + * + * axRef (string): the axis this position is referenced to, or: + * paper: fraction of the plot area + * pixel: pixels relative to some starting position + * attr (string): the attribute in containerOut we are coercing + * dflt (number): the default position, as a fraction or pixels. If the attribute + * is to be axis-referenced, this will be converted to an axis data value + * + * Also cleans the values, since the attribute definition itself has to say + * valType: 'any' to handle date axes. This allows us to accept: + * - for category axes: category names, and convert them here into serial numbers. + * Note that this will NOT work for axis range endpoints, because we don't know + * the category list yet (it's set by ax.makeCalcdata during calc) + * but it works for component (note, shape, images) positions. + * - for date axes: JS Dates or milliseconds, and convert to date strings + * - for other types: coerce them to numbers + */ +axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { + var pos, + newPos; - // data-ref annotations are not supported in gl2d yet + if(axRef === 'paper' || axRef === 'pixel') { + pos = coerce(attr, dflt); + } + else { + var ax = axes.getFromId(gd, axRef); - attrDef[refAttr] = { - valType: 'enumerated', - values: axlist.concat(['pixel']), - dflt: dflt || 'pixel' || axlist[0] - }; + dflt = ax.fraction2r(dflt); + pos = coerce(attr, dflt); - // axref, ayref - return Lib.coerce(containerIn, containerOut, attrDef, refAttr); + if(ax.type === 'category') { + // if position is given as a category name, convert it to a number + if(typeof pos === 'string' && (ax._categories || []).length) { + newPos = ax._categories.indexOf(pos); + containerOut[attr] = (newPos !== -1) ? dflt : newPos; + return; + } + } + else if(ax.type === 'date') { + containerOut[attr] = Lib.cleanDate(pos); + return; + } + } + // finally make sure we have a number (unless date type already returned a string) + containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; }; // empty out types for all axes containing these traces @@ -34003,14 +34025,16 @@ axes.counterLetter = function(id) { // incorporate a new minimum difference and first tick into // forced +// note that _forceTick0 is linearized, so needs to be turned into +// a range value for setting tick0 axes.minDtick = function(ax, newDiff, newFirst, allow) { // doesn't make sense to do forced min dTick on log or category axes, // and the plot itself may decide to cancel (ie non-grouped bars) if(['log', 'category'].indexOf(ax.type) !== -1 || !allow) { ax._minDtick = 0; } - // null means there's nothing there yet - else if(ax._minDtick === null) { + // undefined means there's nothing there yet + else if(ax._minDtick === undefined) { ax._minDtick = newDiff; ax._forceTick0 = newFirst; } @@ -34035,6 +34059,19 @@ axes.minDtick = function(ax, newDiff, newFirst, allow) { } }; +// Find the autorange for this axis +// +// assumes ax._min and ax._max have already been set by calling axes.expand +// using calcdata from all traces. These are arrays of: +// {val: calcdata value, pad: extra pixels beyond this value} +// +// Returns an array of [min, max]. These are calcdata for log and category axes +// and data for linear and date axes. +// +// TODO: we want to change log to data as well, but it's hard to do this +// maintaining backward compatibility. category will always have to use calcdata +// though, because otherwise values between categories (or outside all categories) +// would be impossible. axes.getAutoRange = function(ax) { var newRange = []; @@ -34053,7 +34090,12 @@ axes.getAutoRange = function(ax) { var j, minpt, maxpt, minbest, maxbest, dp, dv, mbest = 0, - axReverse = (ax.range && ax.range[1] < ax.range[0]); + axReverse = false; + + if(ax.range) { + var rng = ax.range.map(ax.r2l); + axReverse = rng[1] < rng[0]; + } // one-time setting to easily reverse the axis // when plotting from code @@ -34142,11 +34184,9 @@ axes.getAutoRange = function(ax) { } // maintain reversal - if(axReverse) { - newRange.reverse(); - } + if(axReverse) newRange.reverse(); - return newRange; + return newRange.map(ax.l2r || Number); }; axes.doAutoRange = function(ax) { @@ -34209,7 +34249,6 @@ axes.saveRangeInitial = function(gd, overwrite) { // (unless one end is overridden by tozero) // tozero: (boolean) make sure to include zero if axis is linear, // and make it a tight bound if possible -var FP_SAFE = Number.MAX_VALUE / 2; axes.expand = function(ax, data, options) { if(!(ax.autorange || ax._needsExpand) || !data) return; if(!ax._min) ax._min = []; @@ -34348,10 +34387,24 @@ axes.autoBin = function(data, ax, nbins, is2d) { } // piggyback off autotick code to make "nice" bin sizes - var dummyax = { - type: ax.type === 'log' ? 'linear' : ax.type, - range: [datamin, datamax] - }; + var dummyax; + if(ax.type === 'log') { + dummyax = { + type: 'linear', + range: [datamin, datamax], + r2l: Number + }; + } + else { + dummyax = { + type: ax.type, + // conversion below would be ax.c2r but that's only different from l2r + // for log, and this is the only place (so far?) we would want c2r. + range: [datamin, datamax].map(ax.l2r), + r2l: ax.r2l + }; + } + axes.autoTicks(dummyax, size0); var binstart = axes.tickIncrement( axes.tickFirst(dummyax), dummyax.dtick, 'reverse'), @@ -34415,8 +34468,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { } return { - start: binstart, - end: binend, + start: ax.c2r(binstart), + end: ax.c2r(binend), size: dummyax.dtick }; }; @@ -34433,6 +34486,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { axes.calcTicks = function calcTicks(ax) { if(ax.tickmode === 'array') return arrayTicks(ax); + var rng = ax.range.map(ax.r2l); + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks, @@ -34447,18 +34502,17 @@ axes.calcTicks = function calcTicks(ax) { nt = Lib.constrain(ax._length / minPx, 4, 9) + 1; } } - axes.autoTicks(ax, Math.abs(ax.range[1] - ax.range[0]) / nt); + axes.autoTicks(ax, Math.abs(rng[1] - rng[0]) / nt); // check for a forced minimum dtick if(ax._minDtick > 0 && ax.dtick < ax._minDtick * 2) { ax.dtick = ax._minDtick; - ax.tick0 = ax._forceTick0; + ax.tick0 = ax.l2r(ax._forceTick0); } } // check for missing tick0 if(!ax.tick0) { - ax.tick0 = (ax.type === 'date') ? - new Date(2000, 0, 1).getTime() : 0; + ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; } // now figure out rounding of tick values @@ -34468,12 +34522,12 @@ axes.calcTicks = function calcTicks(ax) { ax._tmin = axes.tickFirst(ax); // check for reversed axis - var axrev = (ax.range[1] < ax.range[0]); + var axrev = (rng[1] < rng[0]); // return the full set of tick vals var vals = [], // add a tiny bit so we get ticks which may have rounded out - endtick = ax.range[1] * 1.0001 - ax.range[0] * 0.0001; + endtick = rng[1] * 1.0001 - rng[0] * 0.0001; if(ax.type === 'category') { endtick = (axrev) ? Math.max(-0.5, endtick) : Math.min(ax._categories.length - 0.5, endtick); @@ -34491,9 +34545,18 @@ axes.calcTicks = function calcTicks(ax) { // show the exponent only on the last one ax._tmax = vals[vals.length - 1]; + // for showing date suffixes: ax._prevSuffix holds what we showed most + // recently. Start with it cleared and mark that we're in calcTicks (ie + // calculating a whole string of these so we should care what the previous + // suffix was!) + ax._prevSuffix = ''; + ax._inCalcTicks = true; + var ticksOut = new Array(vals.length); for(var i = 0; i < vals.length; i++) ticksOut[i] = axes.tickText(ax, vals[i]); + ax._inCalcTicks = false; + return ticksOut; }; @@ -34501,15 +34564,15 @@ function arrayTicks(ax) { var vals = ax.tickvals, text = ax.ticktext, ticksOut = new Array(vals.length), - r0expanded = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, - r1expanded = ax.range[1] * 1.0001 - ax.range[0] * 0.0001, + rng = ax.range.map(ax.r2l), + r0expanded = rng[0] * 1.0001 - rng[1] * 0.0001, + r1expanded = rng[1] * 1.0001 - rng[0] * 0.0001, tickMin = Math.min(r0expanded, r1expanded), tickMax = Math.max(r0expanded, r1expanded), vali, i, j = 0; - // without a text array, just format the given values as any other ticks // except with more precision to the numbers if(!Array.isArray(text)) text = []; @@ -34549,7 +34612,7 @@ function roundDTick(roughDTick, base, roundingSet) { // outputs (into ax): // tick0: starting point for ticks (not necessarily on the graph) // usually 0 for numeric (=10^0=1 for log) or jan 1, 2000 for dates -// dtick: the actual, nice round tick spacing, somewhat larger than roughDTick +// dtick: the actual, nice round tick spacing, usually a little larger than roughDTick // if the ticks are spaced linearly (linear scale, categories, // log with only full powers, date ticks < month), // this will just be a number @@ -34562,36 +34625,35 @@ axes.autoTicks = function(ax, roughDTick) { var base; if(ax.type === 'date') { - ax.tick0 = new Date(2000, 0, 1).getTime(); + ax.tick0 = '2000-01-01'; + // the criteria below are all based on the rough spacing we calculate + // being > half of the final unit - so precalculate twice the rough val + var roughX2 = 2 * roughDTick; - if(roughDTick > 15778800000) { - // years if roughDTick > 6mo - roughDTick /= 31557600000; + if(roughX2 > ONEAVGYEAR) { + roughDTick /= ONEAVGYEAR; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'M' + (12 * roundDTick(roughDTick, base, roundBase10)); } - else if(roughDTick > 1209600000) { - // months if roughDTick > 2wk - roughDTick /= 2629800000; + else if(roughX2 > ONEAVGMONTH) { + roughDTick /= ONEAVGMONTH; ax.dtick = 'M' + roundDTick(roughDTick, 1, roundBase24); } - else if(roughDTick > 43200000) { - // days if roughDTick > 12h - ax.dtick = roundDTick(roughDTick, 86400000, roundDays); + else if(roughX2 > ONEDAY) { + ax.dtick = roundDTick(roughDTick, ONEDAY, roundDays); // get week ticks on sunday - ax.tick0 = new Date(2000, 0, 2).getTime(); + // this will also move the base tick off 2000-01-01 if dtick is + // 2 or 3 days... but that's a weird enough case that we'll ignore it. + ax.tick0 = '2000-01-02'; } - else if(roughDTick > 1800000) { - // hours if roughDTick > 30m - ax.dtick = roundDTick(roughDTick, 3600000, roundBase24); + else if(roughX2 > ONEHOUR) { + ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } - else if(roughDTick > 30000) { - // minutes if roughDTick > 30sec - ax.dtick = roundDTick(roughDTick, 60000, roundBase60); + else if(roughX2 > ONEMIN) { + ax.dtick = roundDTick(roughDTick, ONEMIN, roundBase60); } - else if(roughDTick > 500) { - // seconds if roughDTick > 0.5sec - ax.dtick = roundDTick(roughDTick, 1000, roundBase60); + else if(roughX2 > ONESEC) { + ax.dtick = roundDTick(roughDTick, ONESEC, roundBase60); } else { // milliseconds @@ -34601,16 +34663,19 @@ axes.autoTicks = function(ax, roughDTick) { } else if(ax.type === 'log') { ax.tick0 = 0; + var rng = ax.range.map(ax.r2l); - // only show powers of 10 - if(roughDTick > 0.7) ax.dtick = Math.ceil(roughDTick); - else if(Math.abs(ax.range[1] - ax.range[0]) < 1) { + if(roughDTick > 0.7) { + // only show powers of 10 + ax.dtick = Math.ceil(roughDTick); + } + else if(Math.abs(rng[1] - rng[0]) < 1) { // span is less than one power of 10 - var nt = 1.5 * Math.abs((ax.range[1] - ax.range[0]) / roughDTick); + var nt = 1.5 * Math.abs((rng[1] - rng[0]) / roughDTick); // ticks on a linear scale, labeled fully - roughDTick = Math.abs(Math.pow(10, ax.range[1]) - - Math.pow(10, ax.range[0])) / nt; + roughDTick = Math.abs(Math.pow(10, rng[1]) - + Math.pow(10, rng[0])) / nt; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'L' + roundDTick(roughDTick, base, roundBase10); } @@ -34649,41 +34714,59 @@ axes.autoTicks = function(ax, roughDTick) { // for date ticks, the last date part to show (y,m,d,H,M,S) // or an integer # digits past seconds function autoTickRound(ax) { - var dtick = ax.dtick, - maxend; + var dtick = ax.dtick; ax._tickexponent = 0; - if(!isNumeric(dtick) && typeof dtick !== 'string') dtick = 1; + if(!isNumeric(dtick) && typeof dtick !== 'string') { + dtick = 1; + } - if(ax.type === 'category') ax._tickround = null; - else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { - if(ax.type === 'date') { - if(dtick >= 86400000) ax._tickround = 'd'; - else if(dtick >= 3600000) ax._tickround = 'H'; - else if(dtick >= 60000) ax._tickround = 'M'; - else if(dtick >= 1000) ax._tickround = 'S'; - else ax._tickround = 3 - Math.round(Math.log(dtick / 2) / Math.LN10); - } + if(ax.type === 'category') { + ax._tickround = null; + } + if(ax.type === 'date') { + // If tick0 is unusual, give tickround a bit more information + // not necessarily *all* the information in tick0 though, if it's really odd + // minimal string length for tick0: 'd' is 10, 'M' is 16, 'S' is 19 + // take off a leading minus (year < 0 so length is consistent) + var tick0ms = Lib.dateTime2ms(ax.tick0), + tick0str = Lib.ms2DateTime(tick0ms).replace(/^-/, ''), + tick0len = tick0str.length; + + if(String(dtick).charAt(0) === 'M') { + // any tick0 more specific than a year: alway show the full date + if(tick0len > 10 || tick0str.substr(5) !== '01-01') ax._tickround = 'd'; + // show the month unless ticks are full multiples of a year + else ax._tickround = (+(dtick.substr(1)) % 12 === 0) ? 'y' : 'm'; + } + else if((dtick >= ONEDAY && tick0len <= 10) || (dtick >= ONEDAY * 15)) ax._tickround = 'd'; + else if((dtick >= ONEMIN && tick0len <= 16) || (dtick >= ONEHOUR)) ax._tickround = 'M'; + else if((dtick >= ONESEC && tick0len <= 19) || (dtick >= ONEMIN)) ax._tickround = 'S'; else { - if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); - // 2 digits past largest digit of dtick - ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); + // of any two adjacent ticks, at least one will have the maximum fractional digits + // of all possible ticks - so take the max. length of tick0 and the next one + var tick1len = Lib.ms2DateTime(tick0ms + dtick).replace(/^-/, '').length; + ax._tickround = Math.max(tick0len, tick1len) - 20; + } + } + else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { + // linear or log (except D1, D2) + var rng = ax.range.map(ax.r2d || Number); + if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); + // 2 digits past largest digit of dtick + ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); - if(ax.type === 'log') { - maxend = Math.pow(10, Math.max(ax.range[0], ax.range[1])); - } - else maxend = Math.max(Math.abs(ax.range[0]), Math.abs(ax.range[1])); + var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); - var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { - if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { - ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); - } - else ax._tickexponent = rangeexp; + var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); + if(Math.abs(rangeexp) > 3) { + if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { + ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } + else ax._tickexponent = rangeexp; } } - else if(dtick.charAt(0) === 'M') ax._tickround = (dtick.length === 2) ? 'm' : 'y'; + // D1 or D2 (log) else ax._tickround = null; } @@ -34728,13 +34811,16 @@ axes.tickIncrement = function(x, dtick, axrev) { // calculate the first tick on an axis axes.tickFirst = function(ax) { - var axrev = ax.range[1] < ax.range[0], + var r2l = ax.r2l || Number, + rng = ax.range.map(r2l), + axrev = rng[1] < rng[0], sRound = axrev ? Math.floor : Math.ceil, // add a tiny extra bit to make sure we get ticks // that may have been rounded out - r0 = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, + r0 = rng[0] * 1.0001 - rng[1] * 0.0001, dtick = ax.dtick, - tick0 = ax.tick0; + tick0 = r2l(ax.tick0); + if(isNumeric(dtick)) { var tmin = sRound((r0 - tick0) / dtick) * dtick + tick0; @@ -34784,7 +34870,7 @@ axes.tickFirst = function(ax) { var yearFormat = d3.time.format('%Y'), monthFormat = d3.time.format('%b %Y'), dayFormat = d3.time.format('%b %-d'), - hourFormat = d3.time.format('%b %-d %Hh'), + yearMonthDayFormat = d3.time.format('%b %-d, %Y'), minuteFormat = d3.time.format('%H:%M'), secondFormat = d3.time.format(':%S'); @@ -34820,7 +34906,8 @@ axes.tickText = function(ax, x, hover) { i; if(arrayMode && Array.isArray(ax.ticktext)) { - var minDiff = Math.abs(ax.range[1] - ax.range[0]) / 10000; + var rng = ax.range.map(ax.r2l), + minDiff = Math.abs(rng[1] - rng[0]) / 10000; for(i = 0; i < ax.ticktext.length; i++) { if(Math.abs(x - ax.d2l(ax.tickvals[i])) < minDiff) break; } @@ -34875,10 +34962,12 @@ function tickTextObj(ax, x, text) { function formatDate(ax, out, hover, extraPrecision) { var x = out.x, tr = ax._tickround, + trOriginal = tr, d = new Date(x), // suffix completes the full date info, to be included - // with only the first tick - suffix = '', + // with only the first tick or if any info before what's + // shown has changed + suffix, tt; if(hover && ax.hoverformat) { tt = modDateFormat(ax.hoverformat, x); @@ -34891,34 +34980,40 @@ function formatDate(ax, out, hover, extraPrecision) { else { if(extraPrecision) { if(isNumeric(tr)) tr += 2; - else tr = {y: 'm', m: 'd', d: 'H', H: 'M', M: 'S', S: 2}[tr]; + else tr = {y: 'm', m: 'd', d: 'M', M: 'S', S: 2}[tr]; } if(tr === 'y') tt = yearFormat(d); else if(tr === 'm') tt = monthFormat(d); else { - if(x === ax._tmin && !hover) { - suffix = '
' + yearFormat(d); - } + if(tr === 'd') { + if(!hover) suffix = '
' + yearFormat(d); - if(tr === 'd') tt = dayFormat(d); - else if(tr === 'H') tt = hourFormat(d); + tt = dayFormat(d); + } else { - if(x === ax._tmin && !hover) { - suffix = '
' + dayFormat(d) + ', ' + yearFormat(d); - } + if(!hover) suffix = '
' + yearMonthDayFormat(d); tt = minuteFormat(d); if(tr !== 'M') { tt += secondFormat(d); if(tr !== 'S') { - tt += numFormat(mod(x / 1000, 1), ax, 'none', hover) + tt += numFormat(d3.round(mod(x / 1000, 1), 4), ax, 'none', hover) .substr(1); } } + else if(trOriginal === 'd') { + // for hover on axes with day ticks, minuteFormat (which + // only includes %H:%M) isn't enough, you want the date too + tt = dayFormat(d) + ' ' + tt; + } } } } - out.text = tt + suffix; + if(suffix && (!ax._inCalcTicks || (suffix !== ax._prevSuffix))) { + tt += suffix; + ax._prevSuffix = suffix; + } + out.text = tt; } function formatLog(ax, out, hover, extraPrecision, hideexp) { @@ -35010,7 +35105,7 @@ function numFormat(v, ax, fmtoverride, hover) { (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent // from what we calculate - range: ax.showexponent === 'none' ? ax.range : [0, v || 1] + range: ax.showexponent === 'none' ? ax.range.map(ax.r2d) : [0, v || 1] }; autoTickRound(ah); tickRound = (Number(ah._tickround) || 0) + 4; @@ -35258,8 +35353,9 @@ axes.makeClipPaths = function(gd) { // doTicks: draw ticks, grids, and tick labels // axid: 'x', 'y', 'x2' etc, // blank to do all, -// 'redraw' to force full redraw, and reset ax._r -// (stored range for use by zoom/pan) +// 'redraw' to force full redraw, and reset: +// ax._r (stored range for use by zoom/pan) +// ax._rl (stored linearized range for use by zoom/pan) // or can pass in an axis object directly axes.doTicks = function(gd, axid, skipTitle) { var fullLayout = gd._fullLayout, @@ -35297,7 +35393,10 @@ axes.doTicks = function(gd, axid, skipTitle) { return function() { if(!ax._id) return; var axDone = axes.doTicks(gd, ax._id); - if(axid === 'redraw') ax._r = ax.range.slice(); + if(axid === 'redraw') { + ax._r = ax.range.slice(); + ax._rl = ax._r.map(ax.r2l); + } return axDone; }; })); @@ -35315,9 +35414,6 @@ axes.doTicks = function(gd, axid, skipTitle) { } } - // in case a val turns into string somehow - ax.range = [+ax.range[0], +ax.range[1]]; - // set scaling to pixels ax.setScale(); @@ -35706,7 +35802,8 @@ axes.doTicks = function(gd, axid, skipTitle) { break; } } - var showZl = (ax.range[0] * ax.range[1] <= 0) && ax.zeroline && + var rng = ax.range.map(ax.r2l), + showZl = (rng[0] * rng[1] <= 0) && ax.zeroline && (ax.type === 'linear' || ax.type === '-') && gridvals.length && (hasBarsOrFill || clipEnds({x: 0}) || !ax.showline); var zl = zlcontainer.selectAll('path.' + zcls) @@ -35930,7 +36027,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { // rather than built-in % which gives a negative value for negative v function mod(v, d) { return ((v % d) + d) % d; } -},{"../../components/color":26,"../../components/drawing":50,"../../components/titles":101,"../../lib":116,"../../lib/svg_text_utils":128,"../../registry":174,"./axis_ids":145,"./layout_attributes":152,"./layout_defaults":153,"./set_convert":157,"d3":10,"fast-isnumeric":13}],143:[function(require,module,exports){ +},{"../../components/color":26,"../../components/drawing":49,"../../components/titles":100,"../../constants/numerical":106,"../../lib":118,"../../lib/svg_text_utils":130,"../../registry":176,"./axis_ids":148,"./layout_attributes":154,"./layout_defaults":155,"./set_convert":159,"d3":10,"fast-isnumeric":13}],146:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -35945,7 +36042,7 @@ function mod(v, d) { return ((v % d) + d) % d; } var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); -var cleanDatum = require('./clean_datum'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function autoType(array) { if(moreDates(array)) return 'date'; @@ -35987,7 +36084,7 @@ function moreDates(a) { return (dcnt > ncnt * 2); } -// are the (x,y)-values in td.data mostly text? +// are the (x,y)-values in gd.data mostly text? // require twice as many categories as numbers function category(a) { // test at most 1000 points @@ -35997,15 +36094,15 @@ function category(a) { ai; for(var i = 0; i < a.length; i += inc) { - ai = cleanDatum(a[Math.round(i)]); - if(isNumeric(ai)) curvenums++; + ai = a[Math.round(i)]; + if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; else if(typeof ai === 'string' && ai !== '' && ai !== 'None') curvecats++; } return curvecats > curvenums * 2; } -},{"../../lib":116,"./clean_datum":147,"fast-isnumeric":13}],144:[function(require,module,exports){ +},{"../../constants/numerical":106,"../../lib":118,"fast-isnumeric":13}],147:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36098,17 +36195,15 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var validRange = ( (containerIn.range || []).length === 2 && - isNumeric(containerIn.range[0]) && - isNumeric(containerIn.range[1]) + isNumeric(containerOut.r2l(containerIn.range[0])) && + isNumeric(containerOut.r2l(containerIn.range[1])) ); var autoRange = coerce('autorange', !validRange); if(autoRange) coerce('rangemode'); - var range = coerce('range', [-1, letter === 'x' ? 6 : 4]); - if(range[0] === range[1]) { - containerOut.range = [range[0] - 1, range[0] + 1]; - } - Lib.noneOrAll(containerIn.range, containerOut.range, [0, 1]); + + coerce('range'); + containerOut.cleanRange(); coerce('fixedrange'); @@ -36230,7 +36325,7 @@ function getFirstNonEmptyTrace(data, id, axLetter) { } } -},{"../../components/color/attributes":25,"../../lib":116,"../../registry":174,"./axis_autotype":143,"./axis_ids":145,"./category_order_defaults":146,"./layout_attributes":152,"./ordered_categories":154,"./set_convert":157,"./tick_label_defaults":158,"./tick_mark_defaults":159,"./tick_value_defaults":160,"fast-isnumeric":13,"tinycolor2":16}],145:[function(require,module,exports){ +},{"../../components/color/attributes":25,"../../lib":118,"../../registry":176,"./axis_autotype":146,"./axis_ids":148,"./category_order_defaults":149,"./layout_attributes":154,"./ordered_categories":156,"./set_convert":159,"./tick_label_defaults":160,"./tick_mark_defaults":161,"./tick_value_defaults":162,"fast-isnumeric":13,"tinycolor2":16}],148:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36352,7 +36447,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":116,"../../registry":174,"../plots":167,"./constants":148}],146:[function(require,module,exports){ +},{"../../lib":118,"../../registry":176,"../plots":169,"./constants":150}],149:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36386,46 +36481,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],147:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = require('fast-isnumeric'); - -var Lib = require('../../lib'); - - -/** - * cleanDatum: removes characters - * same replace criteria used in the grid.js:scrapeCol - * but also handling dates, numbers, and NaN, null, Infinity etc - */ -module.exports = function cleanDatum(c) { - try { - if(typeof c === 'object' && c !== null && c.getTime) { - return Lib.ms2DateTime(c); - } - if(typeof c !== 'string' && !isNumeric(c)) { - return ''; - } - c = c.toString().replace(/['"%,$# ]/g, ''); - } - catch(e) { - Lib.error(e, c); - } - - return c; -}; - -},{"../../lib":116,"fast-isnumeric":13}],148:[function(require,module,exports){ +},{}],150:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36449,14 +36505,6 @@ module.exports = { y: /^yaxis([2-9]|[1-9][0-9]+)?$/ }, - /** - * standardize all missing data in calcdata to use undefined - * never null or NaN. - * that way we can use !==undefined, or !== BADNUM, - * to test for real data - */ - BADNUM: undefined, - // axis match regular expression xAxisMatch: /^xaxis[0-9]*$/, yAxisMatch: /^yaxis[0-9]*$/, @@ -36500,10 +36548,15 @@ module.exports = { BENDPX: 1.5, // delay before a redraw (relayout) after smooth panning and zooming - REDRAWDELAY: 50 + REDRAWDELAY: 50, + + // last resort axis ranges for x, y, and date axes if we have no data + DFLTRANGEX: [-1, 6], + DFLTRANGEY: [-1, 4], + DFLTRANGEDATE: ['2000-01-01', '2001-01-01'], }; -},{}],149:[function(require,module,exports){ +},{}],151:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36604,11 +36657,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { return dragger; } - function forceNumbers(axRange) { - axRange[0] = Number(axRange[0]); - axRange[1] = Number(axRange[1]); - } - var dragOptions = { element: dragger, gd: gd, @@ -36719,7 +36767,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { .attr('d', 'M0,0Z'); clearSelect(); - for(var i = 0; i < allaxes.length; i++) forceNumbers(allaxes[i].range); } function clearSelect() { @@ -36810,16 +36857,16 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomAxRanges(axList, r0Fraction, r1Fraction) { var i, axi, - axRange; + axRangeLinear; for(i = 0; i < axList.length; i++) { axi = axList[i]; if(axi.fixedrange) continue; - axRange = axi.range; + axRangeLinear = axi.range.map(axi.r2l); axi.range = [ - axRange[0] + (axRange[1] - axRange[0]) * r0Fraction, - axRange[0] + (axRange[1] - axRange[0]) * r1Fraction + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r0Fraction), + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r1Fraction) ]; } } @@ -36873,7 +36920,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { verticalAlign: vAlign }) .on('edit', function(text) { - var v = ax.type === 'category' ? ax.c2l(text) : ax.d2l(text); + var v = ax.d2r(text); if(v !== undefined) { Plotly.relayout(gd, attrStr, v); } @@ -36933,10 +36980,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomWheelOneAxis(ax, centerFraction, zoom) { if(ax.fixedrange) return; - forceNumbers(ax.range); - var axRange = ax.range, + + var axRange = ax.range.map(ax.r2l), v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; - ax.range = [v0 + (axRange[0] - v0) * zoom, v0 + (axRange[1] - v0) * zoom]; + function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); } + ax.range = axRange.map(doZoom); } if(ew) { @@ -36984,7 +37032,10 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { for(var i = 0; i < axList.length; i++) { var axi = axList[i]; if(!axi.fixedrange) { - axi.range = [axi._r[0] - pix / axi._m, axi._r[1] - pix / axi._m]; + axi.range = [ + axi.l2r(axi._rl[0] - pix / axi._m), + axi.l2r(axi._rl[1] - pix / axi._m) + ]; } } } @@ -37007,23 +37058,29 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { 1 / (1 / Math.max(d, -0.3) + 3.222)); } - // dz: set a new value for one end (0 or 1) of an axis array ax, + // dz: set a new value for one end (0 or 1) of an axis array axArray, // and return a pixel shift for that end for the viewbox // based on pixel drag distance d // TODO: this makes (generally non-fatal) errors when you get // near floating point limits - function dz(ax, end, d) { + function dz(axArray, end, d) { var otherEnd = 1 - end, - movedi = 0; - for(var i = 0; i < ax.length; i++) { - var axi = ax[i]; + movedAx, + newLinearizedEnd; + for(var i = 0; i < axArray.length; i++) { + var axi = axArray[i]; if(axi.fixedrange) continue; - movedi = i; - axi.range[end] = axi._r[otherEnd] + - (axi._r[end] - axi._r[otherEnd]) / dZoom(d / axi._length); + movedAx = axi; + newLinearizedEnd = axi._rl[otherEnd] + + (axi._rl[end] - axi._rl[otherEnd]) / dZoom(d / axi._length); + var newEnd = axi.l2r(newLinearizedEnd); + + // if l2r comes back false or undefined, it means we've dragged off + // the end of valid ranges - so stop. + if(newEnd !== false && newEnd !== undefined) axi.range[end] = newEnd; } - return ax[movedi]._length * (ax[movedi]._r[end] - ax[movedi].range[end]) / - (ax[movedi]._r[end] - ax[movedi]._r[otherEnd]); + return movedAx._length * (movedAx._rl[end] - newLinearizedEnd) / + (movedAx._rl[end] - movedAx._rl[otherEnd]); } if(xActive === 'w') dx = dz(xa, 0, dx); @@ -37225,8 +37282,10 @@ function getEndText(ax, end) { diff = Math.abs(initialVal - ax.range[1 - end]), dig; + // TODO: this should basically be ax.r2d but we're doing extra + // rounding here... can we clean up at all? if(ax.type === 'date') { - return Lib.ms2DateTime(initialVal, diff); + return initialVal; } else if(ax.type === 'log') { dig = Math.ceil(Math.max(0, -Math.log(diff) / Math.LN10)) + 3; @@ -37260,7 +37319,7 @@ function isSelectOrLasso(dragmode) { return modes.indexOf(dragmode) !== -1; } -},{"../../components/color":26,"../../components/dragelement":48,"../../components/drawing":50,"../../lib":116,"../../lib/setcursor":126,"../../lib/svg_text_utils":128,"../../plotly":138,"../../registry":174,"./axes":142,"./constants":148,"./select":156,"d3":10,"tinycolor2":16}],150:[function(require,module,exports){ +},{"../../components/color":26,"../../components/dragelement":47,"../../components/drawing":49,"../../lib":118,"../../lib/setcursor":128,"../../lib/svg_text_utils":130,"../../plotly":140,"../../registry":176,"./axes":145,"./constants":150,"./select":158,"d3":10,"tinycolor2":16}],152:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -37286,6 +37345,7 @@ var dragElement = require('../../components/dragelement'); var Axes = require('./axes'); var constants = require('./constants'); var dragBox = require('./dragbox'); +var layoutAttributes = require('../layout_attributes'); var fx = module.exports = {}; @@ -37295,24 +37355,12 @@ var fx = module.exports = {}; fx.unhover = dragElement.unhover; fx.layoutAttributes = { - dragmode: { - valType: 'enumerated', - - values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], - dflt: 'zoom', - - }, - hovermode: { - valType: 'enumerated', - - values: ['x', 'y', 'closest', false], - - } }; fx.supplyLayoutDefaults = function(layoutIn, layoutOut, fullData) { + function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, fx.layoutAttributes, attr, dflt); + return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } coerce('dragmode'); @@ -38615,7 +38663,7 @@ fx.inbox = function(v0, v1) { return Infinity; }; -},{"../../components/color":26,"../../components/dragelement":48,"../../components/drawing":50,"../../lib":116,"../../lib/events":113,"../../lib/svg_text_utils":128,"./axes":142,"./constants":148,"./dragbox":149,"d3":10,"fast-isnumeric":13,"tinycolor2":16}],151:[function(require,module,exports){ +},{"../../components/color":26,"../../components/dragelement":47,"../../components/drawing":49,"../../lib":118,"../../lib/events":114,"../../lib/svg_text_utils":130,"../layout_attributes":167,"./axes":145,"./constants":150,"./dragbox":151,"d3":10,"fast-isnumeric":13,"tinycolor2":16}],153:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -38645,6 +38693,8 @@ exports.attrRegex = constants.attrRegex; exports.attributes = require('./attributes'); +exports.layoutAttributes = require('./layout_attributes'); + exports.transitionAxes = require('./transition_axes'); exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) { @@ -38987,7 +39037,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":116,"../plots":167,"./attributes":141,"./axes":142,"./constants":148,"./transition_axes":161,"d3":10}],152:[function(require,module,exports){ +},{"../../lib":118,"../plots":169,"./attributes":144,"./axes":145,"./constants":150,"./layout_attributes":154,"./transition_axes":163,"d3":10}],154:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39023,8 +39073,8 @@ module.exports = { type: { valType: 'enumerated', // '-' means we haven't yet run autotype or couldn't find any data - // it gets turned into linear in td._fullLayout but not copied back - // to td.data like the others are. + // it gets turned into linear in gd._fullLayout but not copied back + // to gd.data like the others are. values: ['-', 'linear', 'log', 'date', 'category'], dflt: '-', @@ -39048,8 +39098,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -39075,14 +39125,12 @@ module.exports = { }, tick0: { - valType: 'number', - dflt: 0, + valType: 'any', }, dtick: { valType: 'any', - dflt: 1, }, @@ -39323,11 +39371,6 @@ module.exports = { }, - _nestedModules: { - 'rangeslider': 'rangeslider', - 'rangeselector': 'rangeselector', - }, - _deprecated: { autotick: { valType: 'boolean', @@ -39337,7 +39380,7 @@ module.exports = { } }; -},{"../../components/color/attributes":25,"../../lib/extend":114,"../font_attributes":163,"./constants":148}],153:[function(require,module,exports){ +},{"../../components/color/attributes":25,"../../lib/extend":115,"../font_attributes":165,"./constants":150}],155:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39511,7 +39554,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { }); }; -},{"../../components/color":26,"../../lib":116,"../../registry":174,"../layout_attributes":165,"./axis_defaults":144,"./axis_ids":145,"./constants":148,"./layout_attributes":152,"./position_defaults":155}],154:[function(require,module,exports){ +},{"../../components/color":26,"../../lib":118,"../../registry":176,"../layout_attributes":167,"./axis_defaults":147,"./axis_ids":148,"./constants":150,"./layout_attributes":154,"./position_defaults":157}],156:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39590,7 +39633,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":10}],155:[function(require,module,exports){ +},{"d3":10}],157:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39655,7 +39698,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":116,"fast-isnumeric":13}],156:[function(require,module,exports){ +},{"../../lib":118,"fast-isnumeric":13}],158:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39855,7 +39898,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":26,"../../lib/polygon":123,"./axes":142,"./constants":148}],157:[function(require,module,exports){ +},{"../../components/color":26,"../../lib/polygon":125,"./axes":145,"./constants":150}],159:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39871,27 +39914,38 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); +var numConstants = require('../../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var constants = require('./constants'); -var cleanDatum = require('./clean_datum'); var axisIds = require('./axis_ids'); /** - * Define the conversion functions for an axis data is used in 4 ways: + * Define the conversion functions for an axis data is used in 5 ways: * * d: data, in whatever form it's provided * c: calcdata: turned into numbers, but not linearized - * l: linearized - same as c except for log axes (and other - * mappings later?) this is used by ranges, and when we - * need to know if it's *possible* to show some data on - * this axis, without caring about the current range + * l: linearized - same as c except for log axes (and other nonlinear + * mappings later?) this is used when we need to know if it's + * *possible* to show some data on this axis, without caring about + * the current range * p: pixel value - mapped to the screen with current size and zoom + * r: ranges, tick0, and annotation positions match one of the above + * but are handled differently for different types: + * - linear and date: data format (d) + * - category: calcdata format (c), and will stay that way because + * the data format has no continuous mapping + * - log: linearized (l) format + * TODO: in v2.0 we plan to change it to data format. At that point + * shapes will work the same way as ranges, tick0, and annotations + * so they can use this conversion too. * - * Creates/updates these conversion functions + * Creates/updates these conversion functions, as well as cleaner functions: + * ax.d2d and ax.clean2r * also clears the autorange bounds ._min and ._max - * and the autotick constraints ._minDtick, ._forceTick0, - * and looks for date ranges that aren't yet in numeric format + * and the autotick constraints ._minDtick, ._forceTick0 */ module.exports = function setConvert(ax) { @@ -39911,20 +39965,119 @@ module.exports = function setConvert(ax) { return 0.5 * (r0 + r1 - 3 * clipMult * Math.abs(r0 - r1)); } - else return constants.BADNUM; + else return BADNUM; + } + + function fromLog(v) { + return Math.pow(10, v); + } + + function num(v) { + if(!isNumeric(v)) return BADNUM; + v = Number(v); + if(v < -FP_SAFE || v > FP_SAFE) return BADNUM; + return isNumeric(v) ? Number(v) : BADNUM; } - function fromLog(v) { return Math.pow(10, v); } - function num(v) { return isNumeric(v) ? Number(v) : constants.BADNUM; } ax.c2l = (ax.type === 'log') ? toLog : num; ax.l2c = (ax.type === 'log') ? fromLog : num; ax.l2d = function(v) { return ax.c2d(ax.l2c(v)); }; ax.p2d = function(v) { return ax.l2d(ax.p2l(v)); }; + /* + * fn to make sure range is a couplet of valid & distinct values + * keep numbers away from the limits of floating point numbers, + * and dates away from the ends of our date system (+/- 9999 years) + * + * optional param rangeAttr: operate on a different attribute, like + * ax._r, rather than ax.range + */ + ax.cleanRange = function(rangeAttr) { + if(!rangeAttr) rangeAttr = 'range'; + var range = ax[rangeAttr], + axLetter = (ax._id || 'x').charAt(0), + i, dflt; + + if(ax.type === 'date') dflt = constants.DFLTRANGEDATE; + else if(axLetter === 'y') dflt = constants.DFLTRANGEY; + else dflt = constants.DFLTRANGEX; + + // make sure we don't later mutate the defaults + dflt = dflt.slice(); + + if(!range || range.length !== 2) { + ax[rangeAttr] = dflt; + return; + } + + if(ax.type === 'date') { + // check if milliseconds or js date objects are provided for range + // and convert to date strings + range[0] = Lib.cleanDate(range[0]); + range[1] = Lib.cleanDate(range[1]); + } + + for(i = 0; i < 2; i++) { + if(ax.type === 'date') { + if(!Lib.isDateTime(range[i])) { + ax[rangeAttr] = dflt; + break; + } + + if(range[i] < Lib.MIN_MS) range[i] = Lib.MIN_MS; + if(range[i] > Lib.MAX_MS) range[i] = Lib.MAX_MS; + + if(ax.r2l(range[0]) === ax.r2l(range[1])) { + // split by +/- 1 second + var linCenter = Lib.constrain(ax.r2l(range[0]), + Lib.MIN_MS + 1000, Lib.MAX_MS - 1000); + range[0] = ax.l2r(linCenter - 1000); + range[1] = ax.l2r(linCenter + 1000); + break; + } + } + else { + if(!isNumeric(range[i])) { + if(isNumeric(range[1 - i])) { + range[i] = range[1 - i] * (i ? 10 : 0.1); + } + else { + ax[rangeAttr] = dflt; + break; + } + } + + if(range[i] < -FP_SAFE) range[i] = -FP_SAFE; + else if(range[i] > FP_SAFE) range[i] = FP_SAFE; + + if(range[0] === range[1]) { + // somewhat arbitrary: split by 1 or 1ppm, whichever is bigger + var inc = Math.max(1, Math.abs(range[0] * 1e-6)); + range[0] -= inc; + range[1] += inc; + } + } + } + }; + + // find the range value at the specified (linear) fraction of the axis + ax.fraction2r = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return ax.l2r(rl0 + v * (rl1 - rl0)); + }; + + // find the fraction of the range at the specified range value + ax.r2fraction = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return (ax.r2l(v) - rl0) / (rl1 - rl0); + }; + // set scaling to pixels ax.setScale = function(usePrivateRange) { var gs = ax._gd._fullLayout._size, - i; + axLetter = ax._id.charAt(0); // TODO cleaner way to handle this case if(!ax._categories) ax._categories = []; @@ -39940,40 +40093,23 @@ module.exports = function setConvert(ax) { // issue if we transform the drawn layer *and* use the new axis range to // draw the data. This allows us to construct setConvert using the pre- // interaction values of the range: - var range = (usePrivateRange && ax._r) ? ax._r : ax.range; - - // make sure we have a range (linearized data values) - // and that it stays away from the limits of javascript numbers - if(!range || range.length !== 2 || range[0] === range[1]) { - range = [-1, 1]; - } - for(i = 0; i < 2; i++) { - if(!isNumeric(range[i])) { - range[i] = isNumeric(range[1 - i]) ? - (range[1 - i] * (i ? 10 : 0.1)) : - (i ? 1 : -1); - } + var rangeAttr = (usePrivateRange && ax._r) ? '_r' : 'range'; + ax.cleanRange(rangeAttr); - if(range[i] < -(Number.MAX_VALUE / 2)) { - range[i] = -(Number.MAX_VALUE / 2); - } - else if(range[i] > Number.MAX_VALUE / 2) { - range[i] = Number.MAX_VALUE / 2; - } - - } + var rl0 = ax.r2l(ax[rangeAttr][0]), + rl1 = ax.r2l(ax[rangeAttr][1]); - if(ax._id.charAt(0) === 'y') { + if(axLetter === 'y') { ax._offset = gs.t + (1 - ax.domain[1]) * gs.h; ax._length = gs.h * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[0] - range[1]); - ax._b = -ax._m * range[1]; + ax._m = ax._length / (rl0 - rl1); + ax._b = -ax._m * rl1; } else { ax._offset = gs.l + ax.domain[0] * gs.w; ax._length = gs.w * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[1] - range[0]); - ax._b = -ax._m * range[0]; + ax._m = ax._length / (rl1 - rl0); + ax._b = -ax._m * rl0; } if(!isFinite(ax._m) || !isFinite(ax._b)) { @@ -39986,7 +40122,7 @@ module.exports = function setConvert(ax) { }; ax.l2p = function(v) { - if(!isNumeric(v)) return constants.BADNUM; + if(!isNumeric(v)) return BADNUM; // include 2 fractional digits on pixel, for PDF zooming etc return d3.round(ax._b + ax._m * v, 2); @@ -39997,42 +40133,62 @@ module.exports = function setConvert(ax) { ax.c2p = function(v, clip) { return ax.l2p(ax.c2l(v, clip)); }; ax.p2c = function(px) { return ax.l2c(ax.p2l(px)); }; + // clip doesn't do anything here yet, but in v2.0 when log axes get + // refactored it will... so including it now so we don't forget. + ax.r2p = function(v, clip) { return ax.l2p(ax.r2l(v, clip)); }; + ax.p2r = function(px) { return ax.l2r(ax.p2l(px)); }; + + ax.r2c = function(v) { return ax.l2c(ax.r2l(v)); }; + ax.c2r = function(v) { return ax.l2r(ax.c2l(v)); }; + if(['linear', 'log', '-'].indexOf(ax.type) !== -1) { ax.c2d = num; - ax.d2c = function(v) { - v = cleanDatum(v); - return isNumeric(v) ? Number(v) : constants.BADNUM; - }; - ax.d2l = function(v, clip) { - if(ax.type === 'log') return ax.c2l(ax.d2c(v), clip); - else return ax.d2c(v); - }; + ax.d2c = Lib.cleanNumber; + if(ax.type === 'log') { + ax.d2l = function(v, clip) { + return ax.c2l(ax.d2c(v), clip); + }; + ax.d2r = ax.d2l; + ax.r2d = ax.l2d; + } + else { + ax.d2l = Lib.cleanNumber; + ax.d2r = Lib.cleanNumber; + ax.r2d = num; + } + ax.r2l = num; + ax.l2r = num; } else if(ax.type === 'date') { - ax.c2d = function(v) { - return isNumeric(v) ? Lib.ms2DateTime(v) : constants.BADNUM; - }; + ax.c2d = Lib.ms2DateTime; ax.d2c = function(v) { - return (isNumeric(v)) ? Number(v) : Lib.dateTime2ms(v); + // NOTE: Changed this behavior: previously we took any numeric value + // to be a ms, even if it was a string that could be a bare year. + // Now we convert it as a date if at all possible, and only try + // as ms if that fails. + var ms = Lib.dateTime2ms(v); + if(ms === BADNUM) { + if(isNumeric(v)) ms = Number(v); + else return BADNUM; + } + return Lib.constrain(ms, Lib.MIN_MS, Lib.MAX_MS); }; ax.d2l = ax.d2c; - - // check if date strings or js date objects are provided for range - // and convert to ms - if(ax.range && ax.range.length > 1) { - try { - var ar1 = ax.range.map(Lib.dateTime2ms); - if(!isNumeric(ax.range[0]) && isNumeric(ar1[0])) { - ax.range[0] = ar1[0]; - } - if(!isNumeric(ax.range[1]) && isNumeric(ar1[1])) { - ax.range[1] = ar1[1]; - } - } - catch(e) { Lib.error(e, ax.range); } - } + ax.r2l = ax.d2c; + ax.l2r = ax.c2d; + ax.d2r = Lib.identity; + ax.r2d = Lib.identity; + ax.cleanr = function(v) { + /* + * If v is already a date string this is a noop, but running it + * through d2c and back validates the value: + * normalizes Date objects, milliseconds, and out-of-bounds dates + * so we always end up with either a clean date string or BADNUM + */ + return ax.c2d(ax.d2c(v)); + }; } else if(ax.type === 'category') { @@ -40055,38 +40211,42 @@ module.exports = function setConvert(ax) { } var c = ax._categories.indexOf(v); - return c === -1 ? constants.BADNUM : c; + return c === -1 ? BADNUM : c; }; ax.d2l = ax.d2c; + ax.r2l = num; + ax.l2r = num; + ax.d2r = ax.d2c; + ax.r2d = ax.c2d; } // makeCalcdata: takes an x or y array and converts it // to a position on the axis object "ax" // inputs: - // tdc - a data object from td.data - // axletter - a string, either 'x' or 'y', for which item + // trace - a data object from gd.data + // axLetter - a string, either 'x' or 'y', for which item // to convert (TODO: is this now always the same as // the first letter of ax._id?) // in case the expected data isn't there, make a list of // integers based on the opposite data - ax.makeCalcdata = function(tdc, axletter) { + ax.makeCalcdata = function(trace, axLetter) { var arrayIn, arrayOut, i; - if(axletter in tdc) { - arrayIn = tdc[axletter]; + if(axLetter in trace) { + arrayIn = trace[axLetter]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = ax.d2c(arrayIn[i]); } else { - var v0 = ((axletter + '0') in tdc) ? - ax.d2c(tdc[axletter + '0']) : 0, - dv = (tdc['d' + axletter]) ? - Number(tdc['d' + axletter]) : 1; + var v0 = ((axLetter + '0') in trace) ? + ax.d2c(trace[axLetter + '0']) : 0, + dv = (trace['d' + axLetter]) ? + Number(trace['d' + axLetter]) : 1; // the opposing data, for size if we have x and dx etc - arrayIn = tdc[{x: 'y', y: 'x'}[axletter]]; + arrayIn = trace[{x: 'y', y: 'x'}[axLetter]]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = v0 + i * dv; @@ -40101,11 +40261,11 @@ module.exports = function setConvert(ax) { ax._max = []; // and for bar charts and box plots: reset forced minimum tick spacing - ax._minDtick = null; - ax._forceTick0 = null; + delete ax._minDtick; + delete ax._forceTick0; }; -},{"../../lib":116,"./axis_ids":145,"./clean_datum":147,"./constants":148,"d3":10,"fast-isnumeric":13}],158:[function(require,module,exports){ +},{"../../constants/numerical":106,"../../lib":118,"./axis_ids":148,"./constants":150,"d3":10,"fast-isnumeric":13}],160:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40175,8 +40335,8 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe */ function getShowAttrDflt(containerIn) { var showAttrsAll = ['showexponent', - 'showtickprefix', - 'showticksuffix'], + 'showtickprefix', + 'showticksuffix'], showAttrs = showAttrsAll.filter(function(a) { return containerIn[a] !== undefined; }), @@ -40189,7 +40349,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":116}],159:[function(require,module,exports){ +},{"../../lib":118}],161:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40222,7 +40382,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":116,"./layout_attributes":152}],160:[function(require,module,exports){ +},{"../../lib":118,"./layout_attributes":154}],162:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40235,6 +40395,8 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, 'use strict'; var isNumeric = require('fast-isnumeric'); +var Lib = require('../../lib'); +var ONEDAY = require('../../constants/numerical').ONEDAY; module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType) { @@ -40246,15 +40408,56 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } if(Array.isArray(containerIn.tickvals)) tickmodeDefault = 'array'; - else if(containerIn.dtick && isNumeric(containerIn.dtick)) { + else if(containerIn.dtick) { tickmodeDefault = 'linear'; } var tickmode = coerce('tickmode', tickmodeDefault); if(tickmode === 'auto') coerce('nticks'); else if(tickmode === 'linear') { - coerce('tick0'); - coerce('dtick'); + // dtick is usually a positive number, but there are some + // special strings available for log or date axes + // default is 1 day for dates, otherwise 1 + var dtickDflt = (axType === 'date') ? ONEDAY : 1; + var dtick = coerce('dtick', dtickDflt); + if(isNumeric(dtick)) { + containerOut.dtick = (dtick > 0) ? Number(dtick) : dtickDflt; + } + else if(typeof dtick !== 'string') { + containerOut.dtick = dtickDflt; + } + else { + // date and log special cases are all one character plus a number + var prefix = dtick.charAt(0), + dtickNum = dtick.substr(1); + + dtickNum = isNumeric(dtickNum) ? Number(dtickNum) : 0; + if((dtickNum <= 0) || !( + // "M" gives ticks every (integer) n months + (axType === 'date' && prefix === 'M' && dtickNum === Math.round(dtickNum)) || + // "L" gives ticks linearly spaced in data (not in position) every (float) f + (axType === 'log' && prefix === 'L') || + // "D1" gives powers of 10 with all small digits between, "D2" gives only 2 and 5 + (axType === 'log' && prefix === 'D' && (dtickNum === 1 || dtickNum === 2)) + )) { + containerOut.dtick = dtickDflt; + } + } + + // tick0 can have different valType for different axis types, so + // validate that now. Also for dates, change milliseconds to date strings + var tick0Dflt = (axType === 'date') ? '2000-01-01' : 0; + var tick0 = coerce('tick0', tick0Dflt); + if(axType === 'date') { + containerOut.tick0 = Lib.cleanDate(tick0, tick0Dflt); + } + // Aside from date axes, dtick must be numeric; D1 and D2 modes ignore tick0 entirely + else if(isNumeric(tick0) && dtick !== 'D1' && dtick !== 'D2') { + containerOut.tick0 = Number(tick0); + } + else { + containerOut.tick0 = tick0Dflt; + } } else { var tickvals = coerce('tickvals'); @@ -40263,7 +40466,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"fast-isnumeric":13}],161:[function(require,module,exports){ +},{"../../constants/numerical":106,"../../lib":118,"fast-isnumeric":13}],163:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40575,7 +40778,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../lib":116,"../../plotly":138,"../../registry":174,"./axes":142,"d3":10}],162:[function(require,module,exports){ +},{"../../lib":118,"../../plotly":140,"../../registry":176,"./axes":145,"d3":10}],164:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40987,7 +41190,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":116,"../plotly":138}],163:[function(require,module,exports){ +},{"../lib":118,"../plotly":140}],165:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41018,7 +41221,7 @@ module.exports = { } }; -},{}],164:[function(require,module,exports){ +},{}],166:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41059,7 +41262,7 @@ module.exports = { } }; -},{}],165:[function(require,module,exports){ +},{}],167:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41201,28 +41404,22 @@ module.exports = { }, - _composedModules: { - '*': 'Fx' + dragmode: { + valType: 'enumerated', + + values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], + dflt: 'zoom', + }, - - _nestedModules: { - 'xaxis': 'Axes', - 'yaxis': 'Axes', - 'scene': 'gl3d', - 'geo': 'geo', - 'ternary': 'ternary', - 'mapbox': 'mapbox', - - 'legend': 'legend', - 'annotations': 'annotations', - 'shapes': 'shapes', - 'images': 'images', - 'updatemenus': 'updatemenus', - 'sliders': 'sliders' + hovermode: { + valType: 'enumerated', + + values: ['x', 'y', 'closest', false], + } }; -},{"../components/color/attributes":25,"../lib":116,"./font_attributes":163}],166:[function(require,module,exports){ +},{"../components/color/attributes":25,"../lib":118,"./font_attributes":165}],168:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41260,7 +41457,7 @@ module.exports = { } }; -},{}],167:[function(require,module,exports){ +},{}],169:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41627,6 +41824,9 @@ plots.sendDataToCloud = function(gd) { // gd._fullLayout._basePlotModules // is a list of all the plot modules required to draw the plot. // +// gd._fullLayout._transformModules +// is a list of all the transform modules invoked. +// plots.supplyDefaults = function(gd) { var oldFullLayout = gd._fullLayout || {}, newFullLayout = gd._fullLayout = {}, @@ -41638,6 +41838,9 @@ plots.supplyDefaults = function(gd) { var i; + // Create all the storage space for frames, but only if doesn't already exist + if(!gd._transitionData) plots.createTransitionData(gd); + // first fill in what we can of layout without looking at data // because fullData needs a few things from layout @@ -41698,7 +41901,7 @@ plots.supplyDefaults = function(gd) { } // finally, fill in the pieces of layout that may need to look at data - plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData); + plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData); // TODO remove in v2.0.0 // add has-plot-type refs to fullLayout for backward compatibility @@ -41737,12 +41940,6 @@ plots.supplyDefaults = function(gd) { (gd.calcdata[i][0] || {}).trace = trace; } } - - // Create all the storage space for frames, but only if doesn't already - // exist: - if(!gd._transitionData) { - plots.createTransitionData(gd); - } }; // Create storage for all of the data related to frames and transitions: @@ -41909,6 +42106,8 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) { basePlotModules = fullLayout._basePlotModules = [], cnt = 0; + fullLayout._transformModules = []; + function pushModule(fullTrace) { dataOut.push(fullTrace); @@ -42126,6 +42325,8 @@ function supplyTransformDefaults(traceIn, traceOut, layout) { transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn); transformOut.type = type; transformOut._module = _module; + + Lib.pushUnique(layout._transformModules, _module); } else { transformOut = Lib.extendFlat({}, transformIn); @@ -42295,7 +42496,7 @@ function calculateReservedMargins(margins) { return resultingMargin; } -plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { +plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, transitionData) { var i, _module; // can't be be part of basePlotModules loop @@ -42326,6 +42527,16 @@ plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { } } + // transform module layout defaults + var transformModules = layoutOut._transformModules; + for(i = 0; i < transformModules.length; i++) { + _module = transformModules[i]; + + if(_module.supplyLayoutDefaults) { + _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData, transitionData); + } + } + // should FX be a component? Plotly.Fx.supplyLayoutDefaults(layoutIn, layoutOut, fullData); @@ -42353,8 +42564,16 @@ plots.purge = function(gd) { // remove modebar if(fullLayout._modeBar) fullLayout._modeBar.destroy(); - if(gd._transitionData && gd._transitionData._animationRaf) { - window.cancelAnimationFrame(gd._transitionData._animationRaf); + if(gd._transitionData) { + // Ensure any dangling callbacks are simply dropped if the plot is purged. + // This is more or less only actually important for testing. + if(gd._transitionData._interruptCallbacks) { + gd._transitionData._interruptCallbacks.length = 0; + } + + if(gd._transitionData._animationRaf) { + window.cancelAnimationFrame(gd._transitionData._animationRaf); + } } // data and layout @@ -42631,9 +42850,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { // convert native dates to date strings... // mostly for external users exporting to plotly - if(d && d.getTime) { - return Lib.ms2DateTime(d); - } + if(Lib.isJSDate(d)) return Lib.ms2DateTime(+d); return d; } @@ -42678,7 +42895,7 @@ plots.modifyFrames = function(gd, operations) { break;*/ case 'replace': frame = op.value; - var oldName = _frames[op.index].name; + var oldName = (_frames[op.index] || {}).name; var newName = frame.name; _frames[op.index] = _hash[newName] = frame; @@ -42812,8 +43029,14 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { for(i = 0; i < containerPaths.length; i++) { containerProp = Lib.nestedProperty(expandedObj, containerPaths[i]); containerVal = containerProp.get(); - containerProp.set(null); - Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + + if(containerVal === undefined) { + Lib.nestedProperty(containerObj, containerPaths[i]).set(null); + } + else { + containerProp.set(null); + Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + } } } @@ -42827,15 +43050,20 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { if(!srcContainer) continue; destProp = Lib.nestedProperty(dest, containerPaths[i]); - destContainer = destProp.get(); + if(!Array.isArray(destContainer)) { destContainer = []; destProp.set(destContainer); } for(j = 0; j < srcContainer.length; j++) { - destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcContainer[j]); + var srcObj = srcContainer[j]; + + if(srcObj === null) destContainer[j] = null; + else { + destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcObj); + } } destProp.set(destContainer); @@ -42846,7 +43074,7 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { }; plots.dataArrayContainers = ['transforms']; -plots.layoutArrayContainers = ['annotations', 'shapes', 'images', 'sliders', 'updatemenus']; +plots.layoutArrayContainers = Registry.layoutArrayContainers; /* * Extend a trace definition. This method: @@ -42905,11 +43133,15 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var trace = gd._fullData[traceIdx]; var module = trace._module; - if(!module || !module.animatable) { - continue; - } + // There's nothing to do if this module is not defined: + if(!module) continue; - transitionedTraces.push(traceIdx); + // Don't register the trace as transitioned if it doens't know what to do. + // If it *is* registered, it will receive a callback that it's responsible + // for calling in order to register the transition as having completed. + if(module.animatable) { + transitionedTraces.push(traceIdx); + } gd.data[traceIndices[i]] = plots.extendTrace(gd.data[traceIndices[i]], data[i]); } @@ -42963,6 +43195,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var aborted = false; function executeTransitions() { + + gd.emit('plotly_transitioning', []); + return new Promise(function(resolve) { // This flag is used to disabled things like autorange: gd._transitioning = true; @@ -43047,6 +43282,11 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function completeTransition(callback) { + // This a simple workaround for tests which purge the graph before animations + // have completed. That's not a very common case, so this is the simplest + // fix. + if(!gd._transitionData) return; + flushCallbacks(gd._transitionData._interruptCallbacks); return Promise.resolve().then(function() { @@ -43064,6 +43304,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function interruptPreviousTransitions() { + // Fail-safe against purged plot: + if(!gd._transitionData) return; + // If a transition is interrupted, set this to false. At the moment, the only thing that would // interrupt a transition is another transition, so that it will momentarily be set to true // again, but this determines whether autorange or dragbox work, so it's for the sake of @@ -43091,13 +43334,13 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var seq = [plots.previousPromises, interruptPreviousTransitions, prepareTransitions, executeTransitions]; - var transitionStarting = Lib.syncOrAsync(seq, gd); - if(!transitionStarting || !transitionStarting.then) transitionStarting = Promise.resolve(); + if(!transitionStarting || !transitionStarting.then) { + transitionStarting = Promise.resolve(); + } return transitionStarting.then(function() { - gd.emit('plotly_transitioning', []); return gd; }); }; @@ -43200,7 +43443,7 @@ plots.doCalcdata = function(gd, traces) { } }; -},{"../components/color":26,"../components/errorbars":56,"../lib":116,"../plotly":138,"../registry":174,"./animation_attributes":139,"./attributes":140,"./command":162,"./font_attributes":163,"./frame_attributes":164,"./layout_attributes":165,"d3":10,"fast-isnumeric":13}],168:[function(require,module,exports){ +},{"../components/color":26,"../components/errorbars":55,"../lib":118,"../plotly":140,"../registry":176,"./animation_attributes":141,"./attributes":143,"./command":164,"./font_attributes":165,"./frame_attributes":166,"./layout_attributes":167,"d3":10,"fast-isnumeric":13}],170:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43225,7 +43468,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":237}],169:[function(require,module,exports){ +},{"../../traces/scatter/attributes":240}],171:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43340,7 +43583,7 @@ module.exports = { } }; -},{"../../lib/extend":114,"../cartesian/layout_attributes":152}],170:[function(require,module,exports){ +},{"../../lib/extend":115,"../cartesian/layout_attributes":154}],172:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43355,7 +43598,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":171,"./micropolar_manager":172}],171:[function(require,module,exports){ +},{"./micropolar":173,"./micropolar_manager":174}],173:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44774,7 +45017,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":116,"d3":10}],172:[function(require,module,exports){ +},{"../../lib":118,"d3":10}],174:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44860,7 +45103,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":26,"../../lib":116,"./micropolar":171,"./undo_manager":173,"d3":10}],173:[function(require,module,exports){ +},{"../../components/color":26,"../../lib":118,"./micropolar":173,"./undo_manager":175,"d3":10}],175:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44926,7 +45169,7 @@ module.exports = function UndoManager() { }; }; -},{}],174:[function(require,module,exports){ +},{}],176:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44942,11 +45185,12 @@ var Lib = require('./lib'); var basePlotAttributes = require('./plots/attributes'); exports.modules = {}; -exports.allTypes = []; exports.allCategories = {}; +exports.allTypes = []; exports.subplotsRegistry = {}; exports.transformsRegistry = {}; exports.componentsRegistry = {}; +exports.layoutArrayContainers = []; /** * register a module as the handler for a trace type @@ -45012,6 +45256,16 @@ exports.registerSubplot = function(_module) { exports.subplotsRegistry[plotType] = _module; }; +exports.registerComponent = function(_module) { + var name = _module.name; + + exports.componentsRegistry[name] = _module; + + if(_module.layoutAttributes && _module.layoutAttributes._isLinkedToArray) { + Lib.pushUnique(exports.layoutArrayContainers, name); + } +}; + /** * Get registered module using trace object or trace type * @@ -45083,7 +45337,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib":116,"./plots/attributes":140}],175:[function(require,module,exports){ +},{"./lib":118,"./plots/attributes":143}],177:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45210,11 +45464,12 @@ module.exports = function clonePlot(graphObj, options) { } } - var td = document.createElement('div'); - if(options.tileClass) td.className = options.tileClass; + var gd = document.createElement('div'); + if(options.tileClass) gd.className = options.tileClass; var plotTile = { - td: td, + gd: gd, + td: gd, // for external (image server) compatibility layout: newLayout, data: newData, config: { @@ -45234,13 +45489,13 @@ module.exports = function clonePlot(graphObj, options) { plotTile.config.setBackground = options.setBackground || 'opaque'; } - // attaching the default Layout the td, so you can grab it later - plotTile.td.defaultLayout = cloneLayoutOverride(options.tileClass); + // attaching the default Layout the gd, so you can grab it later + plotTile.gd.defaultLayout = cloneLayoutOverride(options.tileClass); return plotTile; }; -},{"../lib":116,"../plots/plots":167}],176:[function(require,module,exports){ +},{"../lib":118,"../plots/plots":169}],178:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45306,7 +45561,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":116,"../plot_api/to_image":136,"./filesaver":177}],177:[function(require,module,exports){ +},{"../lib":118,"../plot_api/to_image":138,"./filesaver":179}],179:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45374,7 +45629,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],178:[function(require,module,exports){ +},{}],180:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45407,7 +45662,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],179:[function(require,module,exports){ +},{}],181:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45433,7 +45688,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":175,"./download":176,"./helpers":178,"./svgtoimg":180,"./toimage":181,"./tosvg":182}],180:[function(require,module,exports){ +},{"./cloneplot":177,"./download":178,"./helpers":180,"./svgtoimg":182,"./toimage":183,"./tosvg":184}],182:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45564,7 +45819,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":116,"events":12}],181:[function(require,module,exports){ +},{"../lib":118,"events":12}],183:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45597,7 +45852,7 @@ function toImage(gd, opts) { var ev = new EventEmitter(); var clone = clonePlot(gd, {format: 'png'}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -45644,7 +45899,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":116,"../plotly":138,"./cloneplot":175,"./helpers":178,"./svgtoimg":180,"./tosvg":182,"events":12}],182:[function(require,module,exports){ +},{"../lib":118,"../plotly":140,"./cloneplot":177,"./helpers":180,"./svgtoimg":182,"./tosvg":184,"events":12}],184:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45763,7 +46018,7 @@ module.exports = function toSVG(gd, format) { return s; }; -},{"../components/color":26,"../components/drawing":50,"../constants/xmlns_namespaces":108,"../lib/svg_text_utils":128,"d3":10}],183:[function(require,module,exports){ +},{"../components/color":26,"../components/drawing":49,"../constants/xmlns_namespaces":108,"../lib/svg_text_utils":130,"d3":10}],185:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45795,7 +46050,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":116}],184:[function(require,module,exports){ +},{"../../lib":118}],186:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45808,6 +46063,9 @@ module.exports = function arraysToCalcdata(cd) { var scatterAttrs = require('../scatter/attributes'); var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; var scatterMarkerAttrs = scatterAttrs.marker; @@ -45821,9 +46079,11 @@ var markerLine = extendFlat({}, { }, colorAttributes('marker.line')); var marker = extendFlat({}, { - showscale: scatterMarkerAttrs.showscale, line: markerLine -}, colorAttributes('marker')); +}, colorAttributes('marker'), { + showscale: scatterMarkerAttrs.showscale, + colorbar: colorbarAttrs +}); module.exports = { @@ -45872,11 +46132,8 @@ module.exports = { r: scatterAttrs.r, t: scatterAttrs.t, - _nestedModules: { // nested module coupling - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - }, + error_y: errorBarAttrs, + error_x: errorBarAttrs, _deprecated: { bardir: { @@ -45888,7 +46145,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":34,"../../lib/extend":114,"../scatter/attributes":237}],185:[function(require,module,exports){ +},{"../../components/colorbar/attributes":27,"../../components/colorscale/color_attributes":33,"../../components/errorbars/attributes":51,"../../lib/extend":115,"../scatter/attributes":240}],187:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45984,7 +46241,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":33,"../../components/colorscale/has_colorscale":40,"../../plots/cartesian/axes":142,"fast-isnumeric":13}],186:[function(require,module,exports){ +},{"../../components/colorscale/calc":32,"../../components/colorscale/has_colorscale":39,"../../plots/cartesian/axes":145,"fast-isnumeric":13}],188:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46029,7 +46286,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":26,"../../components/errorbars/defaults":55,"../../lib":116,"../bar/style_defaults":195,"../scatter/xy_defaults":259,"./attributes":184}],187:[function(require,module,exports){ +},{"../../components/color":26,"../../components/errorbars/defaults":54,"../../lib":118,"../bar/style_defaults":197,"../scatter/xy_defaults":262,"./attributes":186}],189:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46099,7 +46356,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { if(trace.orientation === 'h') { pointData.x0 = pointData.x1 = xa.c2p(di.x, true); - pointData.xLabelVal = di.s; + pointData.xLabelVal = di.b + di.s; pointData.y0 = ya.c2p(barPos(di) - barDelta, true); pointData.y1 = ya.c2p(barPos(di) + barDelta, true); @@ -46107,7 +46364,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } else { pointData.y0 = pointData.y1 = ya.c2p(di.y, true); - pointData.yLabelVal = di.s; + pointData.yLabelVal = di.b + di.s; pointData.x0 = xa.c2p(barPos(di) - barDelta, true); pointData.x1 = xa.c2p(barPos(di) + barDelta, true); @@ -46121,7 +46378,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return [pointData]; }; -},{"../../components/color":26,"../../components/errorbars":56,"../../plots/cartesian/graph_interact":150}],188:[function(require,module,exports){ +},{"../../components/color":26,"../../components/errorbars":55,"../../plots/cartesian/graph_interact":152}],190:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46157,7 +46414,7 @@ Bar.meta = { module.exports = Bar; -},{"../../plots/cartesian":151,"../scatter/colorbar":240,"./arrays_to_calcdata":183,"./attributes":184,"./calc":185,"./defaults":186,"./hover":187,"./layout_attributes":189,"./layout_defaults":190,"./plot":191,"./set_positions":192,"./style":194}],189:[function(require,module,exports){ +},{"../../plots/cartesian":153,"../scatter/colorbar":243,"./arrays_to_calcdata":185,"./attributes":186,"./calc":187,"./defaults":188,"./hover":189,"./layout_attributes":191,"./layout_defaults":192,"./plot":193,"./set_positions":194,"./style":196}],191:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46201,7 +46458,7 @@ module.exports = { } }; -},{}],190:[function(require,module,exports){ +},{}],192:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46259,7 +46516,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":116,"../../plots/cartesian/axes":142,"../../registry":174,"./layout_attributes":189}],191:[function(require,module,exports){ +},{"../../lib":118,"../../plots/cartesian/axes":145,"../../registry":176,"./layout_attributes":191}],193:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46380,7 +46637,7 @@ module.exports = function plot(gd, plotinfo, cdbar) { }; -},{"../../components/color":26,"../../components/errorbars":56,"../../lib":116,"./arrays_to_calcdata":183,"d3":10,"fast-isnumeric":13}],192:[function(require,module,exports){ +},{"../../components/color":26,"../../components/errorbars":55,"../../lib":118,"./arrays_to_calcdata":185,"d3":10,"fast-isnumeric":13}],194:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46868,8 +47125,8 @@ function stackBars(gd, sa, sieve) { if(!isNumeric(bar.s)) continue; // stack current bar and get previous sum - var barBase = sieve.put(bar.p, bar.s), - barTop = barBase + bar.s; + var barBase = sieve.put(bar.p, bar.b + bar.s), + barTop = barBase + bar.b + bar.s; // store the bar base and top in each calcdata item bar.b = barBase; @@ -46907,7 +47164,7 @@ function sieveBars(gd, sa, sieve) { for(var j = 0; j < trace.length; j++) { var bar = trace[j]; - if(isNumeric(bar.s)) sieve.put(bar.p, bar.s); + if(isNumeric(bar.s)) sieve.put(bar.p, bar.b + bar.s); } } } @@ -46976,7 +47233,7 @@ function getAxisLetter(ax) { return ax._id.charAt(0); } -},{"../../plots/cartesian/axes":142,"../../registry":174,"./sieve.js":193,"fast-isnumeric":13}],193:[function(require,module,exports){ +},{"../../plots/cartesian/axes":145,"../../registry":176,"./sieve.js":195,"fast-isnumeric":13}],195:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47077,7 +47334,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../lib":116}],194:[function(require,module,exports){ +},{"../../lib":118}],196:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47121,9 +47378,8 @@ module.exports = function style(gd) { var trace = d[0].trace, marker = trace.marker, markerLine = marker.line, - markerIn = (trace._input || {}).marker || {}, - markerScale = Drawing.tryColorscale(marker, markerIn, ''), - lineScale = Drawing.tryColorscale(marker, markerIn, 'line.'); + markerScale = Drawing.tryColorscale(marker, ''), + lineScale = Drawing.tryColorscale(marker, 'line'); d3.select(this).selectAll('path').each(function(d) { // allow all marker and marker line colors to be scaled @@ -47156,7 +47412,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/color":26,"../../components/drawing":50,"../../components/errorbars":56,"d3":10}],195:[function(require,module,exports){ +},{"../../components/color":26,"../../components/drawing":49,"../../components/errorbars":55,"d3":10}],197:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47193,7 +47449,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('marker.line.width'); }; -},{"../../components/color":26,"../../components/colorscale/defaults":36,"../../components/colorscale/has_colorscale":40}],196:[function(require,module,exports){ +},{"../../components/color":26,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":39}],198:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47324,7 +47580,7 @@ module.exports = { fillcolor: scatterAttrs.fillcolor }; -},{"../../components/color/attributes":25,"../../lib/extend":114,"../scatter/attributes":237}],197:[function(require,module,exports){ +},{"../../components/color/attributes":25,"../../lib/extend":115,"../scatter/attributes":240}],199:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47473,7 +47729,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":116,"../../plots/cartesian/axes":142,"fast-isnumeric":13}],198:[function(require,module,exports){ +},{"../../lib":118,"../../plots/cartesian/axes":145,"fast-isnumeric":13}],200:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47542,7 +47798,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { } }; -},{"../../components/color":26,"../../lib":116,"./attributes":196}],199:[function(require,module,exports){ +},{"../../components/color":26,"../../lib":118,"./attributes":198}],201:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47651,7 +47907,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return closeData; }; -},{"../../components/color":26,"../../lib":116,"../../plots/cartesian/axes":142,"../../plots/cartesian/graph_interact":150}],200:[function(require,module,exports){ +},{"../../components/color":26,"../../lib":118,"../../plots/cartesian/axes":145,"../../plots/cartesian/graph_interact":152}],202:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47684,7 +47940,7 @@ Box.meta = { module.exports = Box; -},{"../../plots/cartesian":151,"./attributes":196,"./calc":197,"./defaults":198,"./hover":199,"./layout_attributes":201,"./layout_defaults":202,"./plot":203,"./set_positions":204,"./style":205}],201:[function(require,module,exports){ +},{"../../plots/cartesian":153,"./attributes":198,"./calc":199,"./defaults":200,"./hover":201,"./layout_attributes":203,"./layout_defaults":204,"./plot":205,"./set_positions":206,"./style":207}],203:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47722,7 +47978,7 @@ module.exports = { } }; -},{}],202:[function(require,module,exports){ +},{}],204:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47756,7 +48012,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { coerce('boxgroupgap'); }; -},{"../../lib":116,"../../registry":174,"./layout_attributes":201}],203:[function(require,module,exports){ +},{"../../lib":118,"../../registry":176,"./layout_attributes":203}],205:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47996,7 +48252,7 @@ module.exports = function plot(gd, plotinfo, cdbox) { }); }; -},{"../../components/drawing":50,"../../lib":116,"d3":10}],204:[function(require,module,exports){ +},{"../../components/drawing":49,"../../lib":118,"d3":10}],206:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48090,7 +48346,7 @@ module.exports = function setPositions(gd, plotinfo) { } }; -},{"../../lib":116,"../../plots/cartesian/axes":142,"../../registry":174}],205:[function(require,module,exports){ +},{"../../lib":118,"../../plots/cartesian/axes":145,"../../registry":176}],207:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48129,7 +48385,7 @@ module.exports = function style(gd) { }); }; -},{"../../components/color":26,"../../components/drawing":50,"d3":10}],206:[function(require,module,exports){ +},{"../../components/color":26,"../../components/drawing":49,"d3":10}],208:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48182,7 +48438,7 @@ module.exports = { whiskerwidth: Lib.extendFlat({}, boxAttrs.whiskerwidth, { dflt: 0 }) }; -},{"../../lib":116,"../box/attributes":196,"../ohlc/attributes":218}],207:[function(require,module,exports){ +},{"../../lib":118,"../box/attributes":198,"../ohlc/attributes":221}],209:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48230,7 +48486,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.fillcolor'); } -},{"../../lib":116,"../ohlc/direction_defaults":220,"../ohlc/helpers":221,"../ohlc/ohlc_defaults":223,"./attributes":206}],208:[function(require,module,exports){ +},{"../../lib":118,"../ohlc/direction_defaults":223,"../ohlc/helpers":224,"../ohlc/ohlc_defaults":226,"./attributes":208}],210:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48260,7 +48516,7 @@ module.exports = { register(require('../box')); register(require('./transform')); -},{"../../plot_api/register":133,"../../plots/cartesian":151,"../box":200,"./attributes":206,"./defaults":207,"./transform":209}],209:[function(require,module,exports){ +},{"../../plot_api/register":135,"../../plots/cartesian":153,"../box":202,"./attributes":208,"./defaults":209,"./transform":211}],211:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48387,7 +48643,7 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { trace.y = y; }; -},{"../../lib":116,"../ohlc/helpers":221}],210:[function(require,module,exports){ +},{"../../lib":118,"../ohlc/helpers":224}],212:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48431,7 +48687,7 @@ module.exports = { autobinx: { valType: 'boolean', - dflt: true, + dflt: null, }, @@ -48446,7 +48702,7 @@ module.exports = { autobiny: { valType: 'boolean', - dflt: true, + dflt: null, }, @@ -48461,11 +48717,8 @@ module.exports = { marker: barAttrs.marker, - _nestedModules: { - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - }, + error_y: barAttrs.error_y, + error_x: barAttrs.error_x, _deprecated: { bardir: barAttrs._deprecated.bardir @@ -48475,27 +48728,27 @@ module.exports = { function makeBinsAttr(axLetter) { return { start: { - valType: 'number', + valType: 'any', // for date axes dflt: null, }, end: { - valType: 'number', + valType: 'any', // for date axes dflt: null, }, size: { valType: 'any', // for date axes - dflt: 1, + dflt: null, } }; } -},{"../bar/attributes":184}],211:[function(require,module,exports){ +},{"../bar/attributes":186}],213:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48521,7 +48774,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],212:[function(require,module,exports){ +},{}],214:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48538,20 +48791,23 @@ module.exports = function handleBinDefaults(traceIn, traceOut, coerce, binDirect coerce('histnorm'); binDirections.forEach(function(binDirection) { - // data being binned - note that even though it's a little weird, - // it's possible to have bins without data, if there's inferred data - var binstrt = coerce(binDirection + 'bins.start'), - binend = coerce(binDirection + 'bins.end'), - autobin = coerce('autobin' + binDirection, !(binstrt && binend)); - - if(autobin) coerce('nbins' + binDirection); - else coerce(binDirection + 'bins.size'); + /* + * Because date axes have string values for start and end, + * and string options for size, we cannot validate these attributes + * now. We will do this during calc (immediately prior to binning) + * in ./clean_bins, and push the cleaned values back to _fullData. + */ + coerce(binDirection + 'bins.start'); + coerce(binDirection + 'bins.end'); + coerce(binDirection + 'bins.size'); + coerce('autobin' + binDirection); + coerce('nbins' + binDirection); }); return traceOut; }; -},{}],213:[function(require,module,exports){ +},{}],215:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48625,7 +48881,7 @@ module.exports = { } }; -},{"fast-isnumeric":13}],214:[function(require,module,exports){ +},{"fast-isnumeric":13}],216:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48645,6 +48901,7 @@ var Axes = require('../../plots/cartesian/axes'); var binFunctions = require('./bin_functions'); var normFunctions = require('./norm_functions'); var doAvg = require('./average'); +var cleanBins = require('./clean_bins'); module.exports = function calc(gd, trace) { @@ -48661,6 +48918,8 @@ module.exports = function calc(gd, trace) { maindata = trace.orientation === 'h' ? 'y' : 'x', counterdata = {x: 'y', y: 'x'}[maindata]; + cleanBins(trace, pa, maindata); + // prepare the raw data var pos0 = pa.makeCalcdata(trace, maindata); // calculate the bins @@ -48699,10 +48958,11 @@ module.exports = function calc(gd, trace) { // create the bins (and any extra arrays needed) // assume more than 5000 bins is an error, so we don't crash the browser - i = binspec.start; + i = pa.r2c(binspec.start); + // decrease end a little in case of rounding errors - binend = binspec.end + - (binspec.start - Axes.tickIncrement(binspec.start, binspec.size)) / 1e6; + binend = pa.r2c(binspec.end) + (i - Axes.tickIncrement(i, binspec.size)) / 1e6; + while(i < binend && pos.length < 5000) { i2 = Axes.tickIncrement(i, binspec.size); pos.push((i + i2) / 2); @@ -48755,7 +49015,82 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":116,"../../plots/cartesian/axes":142,"./average":211,"./bin_functions":213,"./norm_functions":217,"fast-isnumeric":13}],215:[function(require,module,exports){ +},{"../../lib":118,"../../plots/cartesian/axes":145,"./average":213,"./bin_functions":215,"./clean_bins":217,"./norm_functions":220,"fast-isnumeric":13}],217:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; +var isNumeric = require('fast-isnumeric'); +var cleanDate = require('../../lib').cleanDate; +var ONEDAY = require('../../constants/numerical').ONEDAY; + +/* + * cleanBins: validate attributes autobin[xy] and [xy]bins.(start, end, size) + * Mutates trace so all these attributes are valid. + * + * Normally this kind of thing would happen during supplyDefaults, but + * in this case we need to know the axis type, and axis type isn't set until + * after trace supplyDefaults are completed. So this gets called during the + * calc step, when data are inserted into bins. + */ +module.exports = function cleanBins(trace, ax, binDirection) { + var axType = ax.type, + binAttr = binDirection + 'bins', + bins = trace[binAttr]; + + if(!bins) bins = trace[binAttr] = {}; + + var cleanBound = (axType === 'date') ? + function(v) { return (v || v === 0) ? cleanDate(v) : null; } : + function(v) { return isNumeric(v) ? Number(v) : null; }; + + bins.start = cleanBound(bins.start); + bins.end = cleanBound(bins.end); + + // logic for bin size is very similar to dtick (cartesian/tick_value_defaults) + // but without the extra string options for log axes + // ie the only strings we accept are M for months + var sizeDflt = (axType === 'date') ? ONEDAY : 1, + binSize = bins.size; + + if(isNumeric(binSize)) { + bins.size = (binSize > 0) ? Number(binSize) : sizeDflt; + } + else if(typeof binSize !== 'string') { + bins.size = sizeDflt; + } + else { + // date special case: "M" gives bins every (integer) n months + var prefix = binSize.charAt(0), + sizeNum = binSize.substr(1); + + sizeNum = isNumeric(sizeNum) ? Number(sizeNum) : 0; + if((sizeNum <= 0) || !( + axType === 'date' && prefix === 'M' && sizeNum === Math.round(sizeNum) + )) { + bins.size = sizeDflt; + } + } + + var autoBinAttr = 'autobin' + binDirection; + + if(typeof trace[autoBinAttr] !== 'boolean') { + trace[autoBinAttr] = !( + (bins.start || bins.start === 0) && + (bins.end || bins.end === 0) + ); + } + + if(!trace[autoBinAttr]) delete trace['nbins' + binDirection]; +}; + +},{"../../constants/numerical":106,"../../lib":118,"fast-isnumeric":13}],218:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48807,7 +49142,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":26,"../../components/errorbars/defaults":55,"../../lib":116,"../bar/style_defaults":195,"./attributes":210,"./bin_defaults":212}],216:[function(require,module,exports){ +},{"../../components/color":26,"../../components/errorbars/defaults":54,"../../lib":118,"../bar/style_defaults":197,"./attributes":212,"./bin_defaults":214}],219:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48856,7 +49191,7 @@ Histogram.meta = { module.exports = Histogram; -},{"../../plots/cartesian":151,"../bar/hover":187,"../bar/layout_attributes":189,"../bar/layout_defaults":190,"../bar/plot":191,"../bar/set_positions":192,"../bar/style":194,"../scatter/colorbar":240,"./attributes":210,"./calc":214,"./defaults":215}],217:[function(require,module,exports){ +},{"../../plots/cartesian":153,"../bar/hover":189,"../bar/layout_attributes":191,"../bar/layout_defaults":192,"../bar/plot":193,"../bar/set_positions":194,"../bar/style":196,"../scatter/colorbar":243,"./attributes":212,"./calc":216,"./defaults":218}],220:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48891,7 +49226,7 @@ module.exports = { } }; -},{}],218:[function(require,module,exports){ +},{}],221:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48998,7 +49333,7 @@ module.exports = { } }; -},{"../../lib":116,"../scatter/attributes":237}],219:[function(require,module,exports){ +},{"../../lib":118,"../scatter/attributes":240}],222:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49047,7 +49382,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.line.dash', traceOut.line.dash); } -},{"../../lib":116,"./attributes":218,"./direction_defaults":220,"./helpers":221,"./ohlc_defaults":223}],220:[function(require,module,exports){ +},{"../../lib":118,"./attributes":221,"./direction_defaults":223,"./helpers":224,"./ohlc_defaults":226}],223:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49073,7 +49408,7 @@ module.exports = function handleDirectionDefaults(traceIn, traceOut, coerce, dir coerce(direction + '.name', nameDflt); }; -},{}],221:[function(require,module,exports){ +},{}],224:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49185,7 +49520,7 @@ exports.addRangeSlider = function(layout) { if(!layout.xaxis.rangeslider) layout.xaxis.rangeslider = {}; }; -},{"../../lib":116}],222:[function(require,module,exports){ +},{"../../lib":118}],225:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49215,7 +49550,7 @@ module.exports = { register(require('../scatter')); register(require('./transform')); -},{"../../plot_api/register":133,"../../plots/cartesian":151,"../scatter":247,"./attributes":218,"./defaults":219,"./transform":224}],223:[function(require,module,exports){ +},{"../../plot_api/register":135,"../../plots/cartesian":153,"../scatter":250,"./attributes":221,"./defaults":222,"./transform":227}],226:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49251,7 +49586,7 @@ module.exports = function handleOHLC(traceIn, traceOut, coerce) { return len; }; -},{}],224:[function(require,module,exports){ +},{}],227:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49388,18 +49723,28 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { y = [], textOut = []; - var getXItem = trace._fullInput.x ? - function(i) { return xa.d2c(trace.x[i]); } : - function(i) { return i; }; - - var getTextItem = Array.isArray(textIn) ? - function(i) { return textIn[i] || ''; } : - function() { return textIn; }; - - var appendX = function(i) { - var v = getXItem(i); - x.push(v - tickWidth, v, v, v, v, v + tickWidth, null); - }; + var appendX; + if(trace._fullInput.x) { + appendX = function(i) { + var xi = trace.x[i], + xcalc = xa.d2c(xi); + + x.push( + xa.c2d(xcalc - tickWidth), + xi, xi, xi, xi, + xa.c2d(xcalc + tickWidth), + null); + }; + } + else { + appendX = function(i) { + x.push( + i - tickWidth, + i, i, i, i, + i + tickWidth, + null); + }; + } var appendY = function(o, h, l, c) { y.push(o, o, h, l, c, c, null); @@ -49415,6 +49760,10 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { hasY = hasAll || hoverParts.indexOf('y') !== -1, hasText = hasAll || hoverParts.indexOf('text') !== -1; + var getTextItem = Array.isArray(textIn) ? + function(i) { return textIn[i] || ''; } : + function() { return textIn; }; + var appendText = function(i, o, h, l, c) { var t = []; @@ -49493,7 +49842,7 @@ function convertTickWidth(gd, xa, trace) { return minDiff * tickWidth; } -},{"../../lib":116,"../../plots/cartesian/axes":142,"../../plots/cartesian/axis_ids":145,"./helpers":221}],225:[function(require,module,exports){ +},{"../../lib":118,"../../plots/cartesian/axes":145,"../../plots/cartesian/axis_ids":148,"./helpers":224}],228:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49713,7 +50062,7 @@ module.exports = { } }; -},{"../../components/color/attributes":25,"../../lib/extend":114,"../../plots/attributes":140,"../../plots/font_attributes":163}],226:[function(require,module,exports){ +},{"../../components/color/attributes":25,"../../lib/extend":115,"../../plots/attributes":143,"../../plots/font_attributes":165}],229:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49760,7 +50109,7 @@ function getCdModule(calcdata, _module) { return cdModule; } -},{"../../registry":174}],227:[function(require,module,exports){ +},{"../../registry":176}],230:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49912,7 +50261,7 @@ function nextDefaultColor(index) { return pieDefaultColors[index % pieDefaultColors.length]; } -},{"../../components/color":26,"./helpers":229,"fast-isnumeric":13,"tinycolor2":16}],228:[function(require,module,exports){ +},{"../../components/color":26,"./helpers":232,"fast-isnumeric":13,"tinycolor2":16}],231:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49996,7 +50345,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pull'); }; -},{"../../lib":116,"./attributes":225}],229:[function(require,module,exports){ +},{"../../lib":118,"./attributes":228}],232:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50025,7 +50374,7 @@ exports.formatPieValue = function formatPieValue(v, separators) { return Lib.numSeparate(vRounded, separators); }; -},{"../../lib":116}],230:[function(require,module,exports){ +},{"../../lib":118}],233:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50057,7 +50406,7 @@ Pie.meta = { module.exports = Pie; -},{"./attributes":225,"./base_plot":226,"./calc":227,"./defaults":228,"./layout_attributes":231,"./layout_defaults":232,"./plot":233,"./style":234,"./style_one":235}],231:[function(require,module,exports){ +},{"./attributes":228,"./base_plot":229,"./calc":230,"./defaults":231,"./layout_attributes":234,"./layout_defaults":235,"./plot":236,"./style":237,"./style_one":238}],234:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50077,7 +50426,7 @@ module.exports = { hiddenlabels: {valType: 'data_array'} }; -},{}],232:[function(require,module,exports){ +},{}],235:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50099,7 +50448,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('hiddenlabels'); }; -},{"../../lib":116,"./layout_attributes":231}],233:[function(require,module,exports){ +},{"../../lib":118,"./layout_attributes":234}],236:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50794,7 +51143,7 @@ function maxExtent(tilt, tiltAxisFraction, depth) { 2 * Math.sqrt(1 - sinTilt * sinTilt * tiltAxisFraction * tiltAxisFraction)); } -},{"../../components/color":26,"../../components/drawing":50,"../../lib/svg_text_utils":128,"../../plots/cartesian/graph_interact":150,"./helpers":229,"d3":10}],234:[function(require,module,exports){ +},{"../../components/color":26,"../../components/drawing":49,"../../lib/svg_text_utils":130,"../../plots/cartesian/graph_interact":152,"./helpers":232,"d3":10}],237:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50823,7 +51172,7 @@ module.exports = function style(gd) { }); }; -},{"./style_one":235,"d3":10}],235:[function(require,module,exports){ +},{"./style_one":238,"d3":10}],238:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50850,7 +51199,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":26}],236:[function(require,module,exports){ +},{"../../components/color":26}],239:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50888,7 +51237,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":116}],237:[function(require,module,exports){ +},{"../../lib":118}],240:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50900,11 +51249,11 @@ module.exports = function arraysToCalcdata(cd) { 'use strict'; var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var Drawing = require('../../components/drawing'); - var constants = require('./constants'); - var extendFlat = require('../../lib/extend').extendFlat; module.exports = { @@ -51080,12 +51429,15 @@ module.exports = { }, + showscale: { valType: 'boolean', dflt: false, }, + colorbar: colorbarAttrs, + line: extendFlat({}, { width: { valType: 'number', @@ -51133,6 +51485,7 @@ module.exports = { }, }, + r: { valType: 'data_array', @@ -51141,14 +51494,12 @@ module.exports = { valType: 'data_array', }, - _nestedModules: { // nested module coupling - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_y: errorBarAttrs, + error_x: errorBarAttrs }; -},{"../../components/colorscale/color_attributes":34,"../../components/drawing":50,"../../lib/extend":114,"./constants":242}],238:[function(require,module,exports){ +},{"../../components/colorbar/attributes":27,"../../components/colorscale/color_attributes":33,"../../components/drawing":49,"../../components/errorbars/attributes":51,"../../lib/extend":115,"./constants":245}],241:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51279,7 +51630,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":116,"../../plots/cartesian/axes":142,"./colorscale_calc":241,"./subtypes":257,"fast-isnumeric":13}],239:[function(require,module,exports){ +},{"../../lib":118,"../../plots/cartesian/axes":145,"./colorscale_calc":244,"./subtypes":260,"fast-isnumeric":13}],242:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51318,7 +51669,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],240:[function(require,module,exports){ +},{}],243:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51375,7 +51726,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":29,"../../components/colorscale":41,"../../lib":116,"../../plots/plots":167,"fast-isnumeric":13}],241:[function(require,module,exports){ +},{"../../components/colorbar/draw":29,"../../components/colorscale":40,"../../lib":118,"../../plots/plots":169,"fast-isnumeric":13}],244:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51408,7 +51759,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":33,"../../components/colorscale/has_colorscale":40,"./subtypes":257}],242:[function(require,module,exports){ +},{"../../components/colorscale/calc":32,"../../components/colorscale/has_colorscale":39,"./subtypes":260}],245:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51424,7 +51775,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],243:[function(require,module,exports){ +},{}],246:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51504,7 +51855,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":55,"../../lib":116,"./attributes":237,"./constants":242,"./fillcolor_defaults":244,"./line_defaults":248,"./line_shape_defaults":250,"./marker_defaults":253,"./subtypes":257,"./text_defaults":258,"./xy_defaults":259}],244:[function(require,module,exports){ +},{"../../components/errorbars/defaults":54,"../../lib":118,"./attributes":240,"./constants":245,"./fillcolor_defaults":247,"./line_defaults":251,"./line_shape_defaults":253,"./marker_defaults":256,"./subtypes":260,"./text_defaults":261,"./xy_defaults":262}],247:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51542,7 +51893,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":26}],245:[function(require,module,exports){ +},{"../../components/color":26}],248:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51595,7 +51946,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":26,"./subtypes":257}],246:[function(require,module,exports){ +},{"../../components/color":26,"./subtypes":260}],249:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51764,7 +52115,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":26,"../../components/errorbars":56,"../../lib":116,"../../plots/cartesian/constants":148,"../../plots/cartesian/graph_interact":150,"./get_trace_color":245}],247:[function(require,module,exports){ +},{"../../components/color":26,"../../components/errorbars":55,"../../lib":118,"../../plots/cartesian/constants":150,"../../plots/cartesian/graph_interact":152,"./get_trace_color":248}],250:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51808,7 +52159,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":151,"./arrays_to_calcdata":236,"./attributes":237,"./calc":238,"./clean_data":239,"./colorbar":240,"./defaults":243,"./hover":246,"./plot":254,"./select":255,"./style":256,"./subtypes":257}],248:[function(require,module,exports){ +},{"../../plots/cartesian":153,"./arrays_to_calcdata":239,"./attributes":240,"./calc":241,"./clean_data":242,"./colorbar":243,"./defaults":246,"./hover":249,"./plot":257,"./select":258,"./style":259,"./subtypes":260}],251:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51841,7 +52192,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce('line.dash'); }; -},{"../../components/colorscale/defaults":36,"../../components/colorscale/has_colorscale":40}],249:[function(require,module,exports){ +},{"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":39}],252:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51853,7 +52204,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, 'use strict'; -var Axes = require('../../plots/cartesian/axes'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function linePoints(d, opts) { @@ -51864,7 +52215,6 @@ module.exports = function linePoints(d, opts) { baseTolerance = opts.baseTolerance, linear = opts.linear, segments = [], - badnum = Axes.BADNUM, minTolerance = 0.2, // fraction of tolerance "so close we don't even consider it a new point" pts = new Array(d.length), pti = 0, @@ -51901,7 +52251,7 @@ module.exports = function linePoints(d, opts) { function getPt(index) { var x = xa.c2p(d[index].x), y = ya.c2p(d[index].y); - if(x === badnum || y === badnum) return false; + if(x === BADNUM || y === BADNUM) return false; return [x, y]; } @@ -52015,7 +52365,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../plots/cartesian/axes":142}],250:[function(require,module,exports){ +},{"../../constants/numerical":106}],253:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52034,7 +52384,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],251:[function(require,module,exports){ +},{}],254:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52075,7 +52425,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],252:[function(require,module,exports){ +},{}],255:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52117,7 +52467,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":13}],253:[function(require,module,exports){ +},{"fast-isnumeric":13}],256:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52177,7 +52527,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":26,"../../components/colorscale/defaults":36,"../../components/colorscale/has_colorscale":40,"./subtypes":257}],254:[function(require,module,exports){ +},{"../../components/color":26,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":39,"./subtypes":260}],257:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52349,6 +52699,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.visible !== true) return; + transition(tr).style('opacity', trace.opacity); + // BUILD LINES AND FILLS var ownFillEl3, tonext; var ownFillDir = trace.fill.charAt(trace.fill.length - 1); @@ -52674,8 +53026,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { var xa = plotinfo.xaxis, ya = plotinfo.yaxis, - xr = d3.extent(xa.range.map(xa.l2c)), - yr = d3.extent(ya.range.map(ya.l2c)); + xr = d3.extent(xa.range.map(xa.r2l).map(xa.l2c)), + yr = d3.extent(ya.range.map(ya.r2l).map(ya.l2c)); var trace = cdscatter[0].trace; if(!subTypes.hasMarkers(trace)) return; @@ -52713,7 +53065,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":50,"../../components/errorbars":56,"../../lib":116,"../../lib/polygon":123,"./arrays_to_calcdata":236,"./line_points":249,"./link_traces":251,"./subtypes":257,"d3":10}],255:[function(require,module,exports){ +},{"../../components/drawing":49,"../../components/errorbars":55,"../../lib":118,"../../lib/polygon":125,"./arrays_to_calcdata":239,"./line_points":252,"./link_traces":254,"./subtypes":260,"d3":10}],258:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52785,7 +53137,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":257}],256:[function(require,module,exports){ +},{"./subtypes":260}],259:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52827,7 +53179,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":50,"../../components/errorbars":56,"d3":10}],257:[function(require,module,exports){ +},{"../../components/drawing":49,"../../components/errorbars":55,"d3":10}],260:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52863,7 +53215,7 @@ module.exports = { } }; -},{"../../lib":116}],258:[function(require,module,exports){ +},{"../../lib":118}],261:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52884,7 +53236,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":116}],259:[function(require,module,exports){ +},{"../../lib":118}],262:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. diff --git a/dist/plotly-finance.min.js b/dist/plotly-finance.min.js index a920b36a0e6..997dd001f8c 100644 --- a/dist/plotly-finance.min.js +++ b/dist/plotly-finance.min.js @@ -1,27 +1,27 @@ /** -* plotly.js (finance - minified) v1.19.2 +* plotly.js (finance - minified) v1.20.0 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function t(e,n,r){function a(i,l){if(!n[i]){if(!e[i]){var s="function"==typeof require&&require;if(!l&&s)return s(i,!0);if(o)return o(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[i]={exports:{}};e[i][0].call(u.exports,function(t){var n=e[i][1][t];return a(n?n:t)},u,u.exports,t,e,n,r)}return n[i].exports}for(var o="function"==typeof require&&require,i=0;ie?1:t>=e?0:NaN}function o(t){return null===t?NaN:+t}function i(t){return!isNaN(t)}function l(t){return{left:function(e,n,r,a){for(arguments.length<3&&(r=0),arguments.length<4&&(a=e.length);r>>1;t(e[o],n)<0?r=o+1:a=o}return r},right:function(e,n,r,a){for(arguments.length<3&&(r=0),arguments.length<4&&(a=e.length);r>>1;t(e[o],n)>0?a=o:r=o+1}return r}}}function s(t){return t.length}function c(t){for(var e=1;t*e%1;)e*=10;return e}function u(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function f(){this._=Object.create(null)}function d(t){return(t+="")===_i||t[0]===wi?wi+t:t}function h(t){return(t+="")[0]===wi?t.slice(1):t}function p(t){return d(t)in this._}function g(t){return(t=d(t))in this._&&delete this._[t]}function m(){var t=[];for(var e in this._)t.push(h(e));return t}function v(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function x(){this._=Object.create(null)}function b(t){return t}function _(t,e,n){return function(){var r=n.apply(e,arguments);return r===e?t:r}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,r=ki.length;n=e&&(e=a+1);!(i=l[e])&&++e0&&(t=t.slice(0,l));var c=Pi.get(t);return c&&(t=c,s=Q),l?e?a:r:e?k:o}function W(t,e){return function(n){var r=ui.event;ui.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{ui.event=r}}}function Q(t,e){var n=W(t,e);return function(t){var e=this,r=t.relatedTarget;r&&(r===e||8&r.compareDocumentPosition(e))||n.call(e,t)}}function $(t){var n=".dragsuppress-"+ ++Ni,a="click"+n,o=ui.select(r(t)).on("touchmove"+n,T).on("dragstart"+n,T).on("selectstart"+n,T);if(null==Ei&&(Ei=!("onselectstart"in t)&&w(t.style,"userSelect")),Ei){var i=e(t).style,l=i[Ei];i[Ei]="none"}return function(t){if(o.on(n,null),Ei&&(i[Ei]=l),t){var e=function(){o.on(a,null)};o.on(a,function(){T(),e()},!0),setTimeout(e,0)}}}function J(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var a=n.createSVGPoint();if(Ii<0){var o=r(t);if(o.scrollX||o.scrollY){n=ui.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var i=n[0][0].getScreenCTM();Ii=!(i.f||i.e),n.remove()}}return Ii?(a.x=e.pageX,a.y=e.pageY):(a.x=e.clientX,a.y=e.clientY),a=a.matrixTransform(t.getScreenCTM().inverse()),[a.x,a.y]}var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}function K(){return ui.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function nt(t){return t>1?0:t<-1?ji:Math.acos(t)}function rt(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function at(t){return((t=Math.exp(t))-1/t)/2}function ot(t){return((t=Math.exp(t))+1/t)/2}function it(t){return((t=Math.exp(2*t))-1)/(t+1)}function lt(t){return(t=Math.sin(t/2))*t}function st(){}function ct(t,e,n){return this instanceof ct?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof ct?new ct(t.h,t.s,t.l):kt(""+t,Mt,ct):new ct(t,e,n)}function ut(t,e,n){function r(t){return t>360?t-=360:t<0&&(t+=360),t<60?o+(i-o)*t/60:t<180?i:t<240?o+(i-o)*(240-t)/60:o}function a(t){return Math.round(255*r(t))}var o,i;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=n<0?0:n>1?1:n,i=n<=.5?n*(1+e):n+e-n*e,o=2*n-i,new xt(a(t+120),a(t),a(t-120))}function ft(t,e,n){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof ht?gt(t.l,t.a,t.b):gt((t=At((t=ui.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,n)}function dt(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new ht(n,Math.cos(t*=Vi)*e,Math.sin(t)*e)}function ht(t,e,n){return this instanceof ht?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof ht?new ht(t.l,t.a,t.b):t instanceof ft?dt(t.h,t.c,t.l):At((t=xt(t)).r,t.g,t.b):new ht(t,e,n)}function pt(t,e,n){var r=(t+16)/116,a=r+e/500,o=r-n/200;return a=mt(a)*tl,r=mt(r)*el,o=mt(o)*nl,new xt(yt(3.2404542*a-1.5371385*r-.4985314*o),yt(-.969266*a+1.8760108*r+.041556*o),yt(.0556434*a-.2040259*r+1.0572252*o))}function gt(t,e,n){return t>0?new ft(Math.atan2(n,e)*Yi,Math.sqrt(e*e+n*n),t):new ft(NaN,NaN,t)}function mt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function vt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function xt(t,e,n){return this instanceof xt?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof xt?new xt(t.r,t.g,t.b):kt(""+t,xt,ut):new xt(t,e,n)}function bt(t){return new xt(t>>16,t>>8&255,255&t)}function _t(t){return bt(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function kt(t,e,n){var r,a,o,i=0,l=0,s=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=r[2].split(","),r[1]){case"hsl":return n(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(Lt(a[0]),Lt(a[1]),Lt(a[2]))}return(o=ol.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(i=(3840&o)>>4,i=i>>4|i,l=240&o,l=l>>4|l,s=15&o,s=s<<4|s):7===t.length&&(i=(16711680&o)>>16,l=(65280&o)>>8,s=255&o)),e(i,l,s))}function Mt(t,e,n){var r,a,o=Math.min(t/=255,e/=255,n/=255),i=Math.max(t,e,n),l=i-o,s=(i+o)/2;return l?(a=s<.5?l/(i+o):l/(2-i-o),r=t==i?(e-n)/l+(e0&&s<1?0:r),new ct(r,a,s)}function At(t,e,n){t=Tt(t),e=Tt(e),n=Tt(n);var r=vt((.4124564*t+.3575761*e+.1804375*n)/tl),a=vt((.2126729*t+.7151522*e+.072175*n)/el),o=vt((.0193339*t+.119192*e+.9503041*n)/nl);return ht(116*a-16,500*(r-a),200*(a-o))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Lt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Ct(t){return"function"==typeof t?t:function(){return t}}function zt(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),St(e,n,t,r)}}function St(t,e,n,r){function a(){var t,e=s.status;if(!e&&Dt(s)||e>=200&&e<300||304===e){try{t=n.call(o,s)}catch(t){return void i.error.call(o,t)}i.load.call(o,t)}else i.error.call(o,s)}var o={},i=ui.dispatch("beforesend","progress","load","error"),l={},s=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in s||!/^(http(s)?:)?\/\//.test(t)||(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=a:s.onreadystatechange=function(){s.readyState>3&&a()},s.onprogress=function(t){var e=ui.event;ui.event=t;try{i.progress.call(o,s)}finally{ui.event=e}},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?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return n=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(di(arguments)))}}),o.send=function(n,r,a){if(2===arguments.length&&"function"==typeof r&&(a=r,r=null),s.open(n,t,!0),null==e||"accept"in l||(l.accept=e+",*/*"),s.setRequestHeader)for(var u in l)s.setRequestHeader(u,l[u]);return null!=e&&s.overrideMimeType&&s.overrideMimeType(e),null!=c&&(s.responseType=c),null!=a&&o.on("error",a).on("load",function(t){a(null,t)}),i.beforesend.call(o,s),s.send(null==r?null:r),o},o.abort=function(){return s.abort(),o},ui.rebind(o,i,"on"),null==r?o:o.get(Ot(r))}function Ot(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}function Dt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Pt(t,e,n){var r=arguments.length;r<2&&(e=0),r<3&&(n=Date.now());var a=n+e,o={c:t,t:a,n:null};return ll?ll.n=o:il=o,ll=o,sl||(cl=clearTimeout(cl),sl=1,ul(Et)),o}function Et(){var t=Nt(),e=It()-t;e>24?(isFinite(e)&&(clearTimeout(cl),cl=setTimeout(Et,e)),sl=0):(sl=1,ul(Et))}function Nt(){for(var t=Date.now(),e=il;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function It(){for(var t,e=il,n=1/0;e;)e.c?(e.t8?function(t){return t/n}:function(t){return t*n},symbol:t}}function jt(t){var e=t.decimal,n=t.thousands,r=t.grouping,a=t.currency,o=r&&n?function(t,e){for(var a=t.length,o=[],i=0,l=r[0],s=0;a>0&&l>0&&(s+l+1>e&&(l=Math.max(1,e-s)),o.push(t.substring(a-=l,a+l)),!((s+=l+1)>e));)l=r[i=(i+1)%r.length];return o.reverse().join(n)}:b;return function(t){var n=dl.exec(t),r=n[1]||" ",i=n[2]||">",l=n[3]||"-",s=n[4]||"",c=n[5],u=+n[6],f=n[7],d=n[8],h=n[9],p=1,g="",m="",v=!1,y=!0;switch(d&&(d=+d.substring(1)),(c||"0"===r&&"="===i)&&(c=r="0",i="="),h){case"n":f=!0,h="g";break;case"%":p=100,m="%",h="f";break;case"p":p=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===s&&(g="0"+h.toLowerCase());case"c":y=!1;case"d":v=!0,d=0;break;case"s":p=-1,h="r"}"$"===s&&(g=a[0],m=a[1]),"r"!=h||d||(h="g"),null!=d&&("g"==h?d=Math.max(1,Math.min(21,d)):"e"!=h&&"f"!=h||(d=Math.max(0,Math.min(20,d)))),h=hl.get(h)||Bt;var x=c&&f;return function(t){var n=m;if(v&&t%1)return"";var a=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===l?"":l;if(p<0){var s=ui.formatPrefix(t,d);t=s.scale(t),n=s.symbol+m}else t*=p;t=h(t,d);var b,_,w=t.lastIndexOf(".");if(w<0){var k=y?t.lastIndexOf("e"):-1;k<0?(b=t,_=""):(b=t.substring(0,k),_=t.substring(k))}else b=t.substring(0,w),_=e+t.substring(w+1);!c&&f&&(b=o(b,1/0));var M=g.length+b.length+_.length+(x?0:a.length),A=M"===i?A+a+t:"^"===i?A.substring(0,M>>=1)+a+t+A.substring(M):a+(x?t:A+t))+n}}}function Bt(t){return t+""}function qt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ht(t,e,n){function r(e){var n=t(e),r=o(n,1);return e-n1)for(;i=c)return-1;if(a=e.charCodeAt(l++),37===a){if(i=e.charAt(l++),o=z[i in vl?e.charAt(l++):i],!o||(r=o(t,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}function r(t,e,n){w.lastIndex=0;var r=w.exec(e.slice(n));return r?(t.w=k.get(r[0].toLowerCase()),n+r[0].length):-1}function a(t,e,n){b.lastIndex=0;var r=b.exec(e.slice(n));return r?(t.w=_.get(r[0].toLowerCase()),n+r[0].length):-1}function o(t,e,n){T.lastIndex=0;var r=T.exec(e.slice(n));return r?(t.m=L.get(r[0].toLowerCase()),n+r[0].length):-1}function i(t,e,n){M.lastIndex=0;var r=M.exec(e.slice(n));return r?(t.m=A.get(r[0].toLowerCase()),n+r[0].length):-1}function l(t,e,r){return n(t,C.c.toString(),e,r)}function s(t,e,r){return n(t,C.x.toString(),e,r)}function c(t,e,r){return n(t,C.X.toString(),e,r)}function u(t,e,n){var r=x.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)}var f=t.dateTime,d=t.date,h=t.time,p=t.periods,g=t.days,m=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function n(t){try{gl=qt;var e=new gl;return e._=t,r(e)}finally{gl=Date}}var r=e(t);return n.parse=function(t){try{gl=qt;var e=r.parse(t);return e&&e._}finally{gl=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=ue;var x=ui.map(),b=Xt(g),_=Zt(g),w=Xt(m),k=Zt(m),M=Xt(v),A=Zt(v),T=Xt(y),L=Zt(y);p.forEach(function(t,e){x.set(t.toLowerCase(),e)});var C={a:function(t){return m[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(f),d:function(t,e){return Ut(t.getDate(),e,2)},e:function(t,e){return Ut(t.getDate(),e,2)},H:function(t,e){return Ut(t.getHours(),e,2)},I:function(t,e){return Ut(t.getHours()%12||12,e,2)},j:function(t,e){return Ut(1+pl.dayOfYear(t),e,3)},L:function(t,e){return Ut(t.getMilliseconds(),e,3)},m:function(t,e){return Ut(t.getMonth()+1,e,2)},M:function(t,e){return Ut(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Ut(t.getSeconds(),e,2)},U:function(t,e){return Ut(pl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ut(pl.mondayOfYear(t),e,2)},x:e(d),X:e(h),y:function(t,e){return Ut(t.getFullYear()%100,e,2)},Y:function(t,e){return Ut(t.getFullYear()%1e4,e,4)},Z:se,"%":function(){return"%"}},z={a:r,A:a,b:o,B:i,c:l,d:ne,e:ne,H:ae,I:ae,j:re,L:le,m:ee,M:oe,p:u,S:ie,U:Wt,w:Gt,W:Qt,x:s,X:c,y:Jt,Y:$t,Z:Kt,"%":ce};return e}function Ut(t,e,n){var r=t<0?"-":"",a=(r?-t:t)+"",o=a.length;return r+(o68?1900:2e3)}function ee(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ne(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function re(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function ae(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function oe(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ie(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function le(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function se(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=bi(e)/60|0,a=bi(e)%60;return n+Ut(r,"0",2)+Ut(a,"0",2); -}function ce(t,e,n){xl.lastIndex=0;var r=xl.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function ue(t){for(var e=t.length,n=-1;++n=0?1:-1,l=i*n,s=Math.cos(e),c=Math.sin(e),u=o*c,f=a*s+u*Math.cos(l),d=u*i*Math.sin(l);Al.add(Math.atan2(d,f)),r=t,a=s,o=c}var e,n,r,a,o;Tl.point=function(i,l){Tl.point=t,r=(e=i)*Vi,a=Math.cos(l=(n=l)*Vi/2+ji/4),o=Math.sin(l)},Tl.lineEnd=function(){t(e,n)}}function ve(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 be(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function ke(t){return[Math.atan2(t[1],t[0]),rt(t[2])]}function Me(t,e){return bi(t[0]-e[0])=0;--l)a.point((f=u[l])[0],f[1])}else r(h.x,h.p.x,-1,a);h=h.p}h=h.o,u=h.z,p=!p}while(!h.v);a.lineEnd()}}}function Pe(t){if(e=t.length){for(var e,n,r=0,a=t[0];++r0){for(_||(o.polygonStart(),_=!0),o.lineStart();++i1&&2&e&&n.push(n.pop().concat(n.shift())),h.push(n.filter(Ie))}var h,p,g,m=e(o),v=a.invert(r[0],r[1]),y={point:i,lineStart:s,lineEnd:c,polygonStart:function(){y.point=u,y.lineStart=f,y.lineEnd=d,h=[],p=[]},polygonEnd:function(){y.point=i,y.lineStart=s,y.lineEnd=c,h=ui.merge(h);var t=He(v,p);h.length?(_||(o.polygonStart(),_=!0),De(h,Fe,t,n,o)):t&&(_||(o.polygonStart(),_=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),_&&(o.polygonEnd(),_=!1),h=p=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}},x=Re(),b=e(x),_=!1;return y}}function Ie(t){return t.length>1}function Re(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:k,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Fe(t,e){return((t=t.x)[0]<0?t[1]-Hi-Ri:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-Ri:Hi-e[1])}function je(t){var e,n=NaN,r=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,i){var l=o>0?ji:-ji,s=bi(o-n);bi(s-ji)0?Hi:-Hi),t.point(a,r),t.lineEnd(),t.lineStart(),t.point(l,r),t.point(o,r),e=0):a!==l&&s>=ji&&(bi(n-a)Ri?Math.atan((Math.sin(e)*(o=Math.cos(r))*Math.sin(n)-Math.sin(r)*(a=Math.cos(e))*Math.sin(t))/(a*o*i)):(e+r)/2}function qe(t,e,n,r){var a;if(null==t)a=n*Hi,r.point(-ji,a),r.point(0,a),r.point(ji,a),r.point(ji,0),r.point(ji,-a),r.point(0,-a),r.point(-ji,-a),r.point(-ji,0),r.point(-ji,a);else if(bi(t[0]-e[0])>Ri){var o=t[0]=0?1:-1,k=w*_,M=k>ji,A=p*x;if(Al.add(Math.atan2(A*w*Math.sin(k),g*b+A*Math.cos(k))),o+=M?_+w*Bi:_,M^d>=n^v>=n){var T=xe(ve(f),ve(t));we(T);var L=xe(a,T);we(L);var C=(M^_>=0?-1:1)*rt(L[2]);(r>C||r===C&&(T[0]||T[1]))&&(i+=M^_>=0?1:-1)}if(!m++)break;d=v,p=x,g=b,f=t}}return(o<-Ri||oo}function n(t){var n,o,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var h,p=[f,d],g=e(f,d),m=i?g?0:a(f,d):g?a(f+(f<0?ji:-ji),d):0;if(!n&&(c=s=g)&&t.lineStart(),g!==s&&(h=r(n,p),(Me(n,h)||Me(p,h))&&(p[0]+=Ri,p[1]+=Ri,g=e(p[0],p[1]))),g!==s)u=0,g?(t.lineStart(),h=r(p,n),t.point(h[0],h[1])):(h=r(n,p),t.point(h[0],h[1]),t.lineEnd()),n=h;else if(l&&n&&i^g){var v;m&o||!(v=r(p,n,!0))||(u=0,i?(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||n&&Me(n,p)||t.point(p[0],p[1]),n=p,s=g,o=m},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return u|(c&&s)<<1}}}function r(t,e,n){var r=ve(t),a=ve(e),i=[1,0,0],l=xe(r,a),s=ye(l,l),c=l[0],u=s-c*c;if(!u)return!n&&t;var f=o*s/u,d=-o*c/u,h=xe(i,l),p=_e(i,f),g=_e(l,d);be(p,g);var m=h,v=ye(p,m),y=ye(m,m),x=v*v-y*(ye(p,p)-1);if(!(x<0)){var b=Math.sqrt(x),_=_e(m,(-v-b)/y);if(be(_,p),_=ke(_),!n)return _;var w,k=t[0],M=e[0],A=t[1],T=e[1];M0^_[1]<(bi(_[0]-k)ji^(k<=_[0]&&_[0]<=M)){var S=_e(m,(-v+b)/y);return be(S,p),[_,ke(S)]}}}function a(e,n){var r=i?t:ji-t,a=0;return e<-r?a|=1:e>r&&(a|=2),n<-r?a|=4:n>r&&(a|=8),a}var o=Math.cos(t),i=o>0,l=bi(o)>Ri,s=vn(t,6*Vi);return Ne(e,n,s,i?[0,-t]:[-ji,t-ji])}function Ye(t,e,n,r){return function(a){var o,i=a.a,l=a.b,s=i.x,c=i.y,u=l.x,f=l.y,d=0,h=1,p=u-s,g=f-c;if(o=t-s,p||!(o>0)){if(o/=p,p<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=n-s,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>d&&(d=o)}else if(p>0){if(o0)){if(o/=g,g<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=r-c,g||!(o<0)){if(o/=g,g<0){if(o>h)return;o>d&&(d=o)}else if(g>0){if(o0&&(a.a={x:s+d*p,y:c+d*g}),h<1&&(a.b={x:s+h*p,y:c+h*g}),a}}}}}}function Ue(t,e,n,r){function a(r,a){return bi(r[0]-t)0?0:3:bi(r[0]-n)0?2:1:bi(r[1]-e)0?1:0:a>0?3:2}function o(t,e){return i(t.x,e.x)}function i(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(l){function s(t){for(var e=0,n=m.length,r=t[1],a=0;ar&&et(c,o,t)>0&&++e:o[1]<=r&&et(c,o,t)<0&&--e,c=o;return 0!==e}function c(o,l,s,c){var u=0,f=0;if(null==o||(u=a(o,s))!==(f=a(l,s))||i(o,l)<0^s>0){do c.point(0===u||3===u?t:n,u>1?r:e);while((u=(u+s+4)%4)!==f)}else c.point(l[0],l[1])}function u(a,o){return t<=a&&a<=n&&e<=o&&o<=r}function f(t,e){u(t,e)&&l.point(t,e)}function d(){z.point=p,m&&m.push(v=[]),M=!0,k=!1,_=w=NaN}function h(){g&&(p(y,x),b&&k&&L.rejoin(),g.push(L.buffer())),z.point=f,k&&l.lineEnd()}function p(t,e){t=Math.max(-Bl,Math.min(Bl,t)),e=Math.max(-Bl,Math.min(Bl,e));var n=u(t,e);if(m&&v.push([t,e]),M)y=t,x=e,b=n,M=!1,n&&(l.lineStart(),l.point(t,e));else if(n&&k)l.point(t,e);else{var r={a:{x:_,y:w},b:{x:t,y:e}};C(r)?(k||(l.lineStart(),l.point(r.a.x,r.a.y)),l.point(r.b.x,r.b.y),n||l.lineEnd(),A=!1):n&&(l.lineStart(),l.point(t,e),A=!1)}_=t,w=e,k=n}var g,m,v,y,x,b,_,w,k,M,A,T=l,L=Re(),C=Ye(t,e,n,r),z={point:f,lineStart:d,lineEnd:h,polygonStart:function(){l=L,g=[],m=[],A=!0},polygonEnd:function(){l=T,g=ui.merge(g);var e=s([t,r]),n=A&&e,a=g.length;(n||a)&&(l.polygonStart(),n&&(l.lineStart(),c(null,null,1,l),l.lineEnd()),a&&De(g,o,e,c,l),l.polygonEnd()),g=m=v=null}};return z}}function Xe(t){var e=0,n=ji/3,r=cn(t),a=r(e,n);return a.parallels=function(t){return arguments.length?r(e=t[0]*ji/180,n=t[1]*ji/180):[e/ji*180,n/ji*180]},a}function Ze(t,e){function n(t,e){var n=Math.sqrt(o-2*a*Math.sin(e))/a;return[n*Math.sin(t*=a),i-n*Math.cos(t)]}var r=Math.sin(t),a=(r+Math.sin(e))/2,o=1+r*(2*a-r),i=Math.sqrt(o)/a;return n.invert=function(t,e){var n=i-e;return[Math.atan2(t,n)/a,rt((o-(t*t+n*n)*a*a)/(2*a))]},n}function Ge(){function t(t,e){Hl+=a*t-r*e,r=t,a=e}var e,n,r,a;Zl.point=function(o,i){Zl.point=t,e=r=o,n=a=i},Zl.lineEnd=function(){t(e,n)}}function We(t,e){tUl&&(Ul=t),eXl&&(Xl=e)}function Qe(){function t(t,e){i.push("M",t,",",e,o)}function e(t,e){i.push("M",t,",",e),l.point=n}function n(t,e){i.push("L",t,",",e)}function r(){l.point=t}function a(){i.push("Z")}var o=$e(4.5),i=[],l={point:t,lineStart:function(){l.point=e},lineEnd:r,polygonStart:function(){l.lineEnd=a},polygonEnd:function(){l.lineEnd=r,l.point=t},pointRadius:function(t){return o=$e(t),l},result:function(){if(i.length){var t=i.join("");return i=[],t}}};return l}function $e(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Je(t,e){zl+=t,Sl+=e,++Ol}function Ke(){function t(t,r){var a=t-e,o=r-n,i=Math.sqrt(a*a+o*o);Dl+=i*(e+t)/2,Pl+=i*(n+r)/2,El+=i,Je(e=t,n=r)}var e,n;Wl.point=function(r,a){Wl.point=t,Je(e=r,n=a)}}function tn(){Wl.point=Je}function en(){function t(t,e){var n=t-r,o=e-a,i=Math.sqrt(n*n+o*o);Dl+=i*(r+t)/2,Pl+=i*(a+e)/2,El+=i,i=a*t-r*e,Nl+=i*(r+t),Il+=i*(a+e),Rl+=3*i,Je(r=t,a=e)}var e,n,r,a;Wl.point=function(o,i){Wl.point=t,Je(e=r=o,n=a=i)},Wl.lineEnd=function(){t(e,n)}}function nn(t){function e(e,n){t.moveTo(e+i,n),t.arc(e,n,i,0,Bi)}function n(e,n){t.moveTo(e,n),l.point=r}function r(e,n){t.lineTo(e,n)}function a(){l.point=e}function o(){t.closePath()}var i=4.5,l={point:e,lineStart:function(){l.point=n},lineEnd:a,polygonStart:function(){l.lineEnd=o},polygonEnd:function(){l.lineEnd=a,l.point=e},pointRadius:function(t){return i=t,l},result:k};return l}function rn(t){function e(t){return(l?r:n)(t)}function n(e){return ln(e,function(n,r){n=t(n,r),e.point(n[0],n[1])})}function r(e){function n(n,r){n=t(n,r),e.point(n[0],n[1])}function r(){x=NaN,M.point=o,e.lineStart()}function o(n,r){var o=ve([n,r]),i=t(n,r);a(x,b,y,_,w,k,x=i[0],b=i[1],y=n,_=o[0],w=o[1],k=o[2],l,e),e.point(x,b)}function i(){M.point=n,e.lineEnd()}function s(){r(),M.point=c,M.lineEnd=u}function c(t,e){o(f=t,d=e),h=x,p=b,g=_,m=w,v=k,M.point=o}function u(){a(x,b,y,_,w,k,h,p,f,g,m,v,l,e),M.lineEnd=i,i()}var f,d,h,p,g,m,v,y,x,b,_,w,k,M={point:n,lineStart:r,lineEnd:i,polygonStart:function(){e.polygonStart(),M.lineStart=s},polygonEnd:function(){e.polygonEnd(),M.lineStart=r}};return M}function a(e,n,r,l,s,c,u,f,d,h,p,g,m,v){var y=u-e,x=f-n,b=y*y+x*x;if(b>4*o&&m--){var _=l+h,w=s+p,k=c+g,M=Math.sqrt(_*_+w*w+k*k),A=Math.asin(k/=M),T=bi(bi(k)-1)o||bi((y*S+x*O)/b-.5)>.3||l*h+s*p+c*g0&&16,e):Math.sqrt(o)},e}function an(t){var e=rn(function(e,n){return t([e*Yi,n*Yi])});return function(t){return un(e(t))}}function on(t){this.stream=t}function ln(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 sn(t){return cn(function(){return t})()}function cn(t){function e(t){return t=l(t[0]*Vi,t[1]*Vi),[t[0]*d+s,c-t[1]*d]}function n(t){return t=l.invert((t[0]-s)/d,(c-t[1])/d),t&&[t[0]*Yi,t[1]*Yi]}function r(){l=Se(i=hn(v,y,x),o);var t=o(g,m);return s=h-t[0]*d,c=p+t[1]*d,a()}function a(){return u&&(u.valid=!1,u=null),e}var o,i,l,s,c,u,f=rn(function(t,e){return t=o(t,e),[t[0]*d+s,c-t[1]*d]}),d=150,h=480,p=250,g=0,m=0,v=0,y=0,x=0,_=jl,w=b,k=null,M=null;return e.stream=function(t){return u&&(u.valid=!1),u=un(_(i,f(w(t)))),u.valid=!0,u},e.clipAngle=function(t){return arguments.length?(_=null==t?(k=t,jl):Ve((k=+t)*Vi),a()):k},e.clipExtent=function(t){return arguments.length?(M=t,w=t?Ue(t[0][0],t[0][1],t[1][0],t[1][1]):b,a()):M},e.scale=function(t){return arguments.length?(d=+t,r()):d},e.translate=function(t){return arguments.length?(h=+t[0],p=+t[1],r()):[h,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Vi,m=t[1]%360*Vi,r()):[g*Yi,m*Yi]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Vi,y=t[1]%360*Vi,x=t.length>2?t[2]%360*Vi:0,r()):[v*Yi,y*Yi,x*Yi]},ui.rebind(e,f,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&n,r()}}function un(t){return ln(t,function(e,n){t.point(e*Vi,n*Vi)})}function fn(t,e){return[t,e]}function dn(t,e){return[t>ji?t-Bi:t<-ji?t+Bi:t,e]}function hn(t,e,n){return t?e||n?Se(gn(t),mn(e,n)):gn(t):e||n?mn(e,n):dn}function pn(t){return function(e,n){return e+=t,[e>ji?e-Bi:e<-ji?e+Bi:e,n]}}function gn(t){var e=pn(t);return e.invert=pn(-t),e}function mn(t,e){function n(t,e){var n=Math.cos(e),l=Math.cos(t)*n,s=Math.sin(t)*n,c=Math.sin(e),u=c*r+l*a;return[Math.atan2(s*o-u*i,l*r-c*a),rt(u*o+s*i)]}var r=Math.cos(t),a=Math.sin(t),o=Math.cos(e),i=Math.sin(e);return n.invert=function(t,e){var n=Math.cos(e),l=Math.cos(t)*n,s=Math.sin(t)*n,c=Math.sin(e),u=c*o-s*i;return[Math.atan2(s*o+c*i,l*r+u*a),rt(u*r-l*a)]},n}function vn(t,e){var n=Math.cos(t),r=Math.sin(t);return function(a,o,i,l){var s=i*e;null!=a?(a=yn(n,a),o=yn(n,o),(i>0?ao)&&(a+=i*Bi)):(a=t+i*Bi,o=t-.5*s);for(var c,u=a;i>0?u>o:u0?e<-Hi+Ri&&(e=-Hi+Ri):e>Hi-Ri&&(e=Hi-Ri);var n=i/Math.pow(a(e),o);return[n*Math.sin(o*t),i-n*Math.cos(o*t)]}var r=Math.cos(t),a=function(t){return Math.tan(ji/4+t/2)},o=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(a(e)/a(t)),i=r*Math.pow(a(t),o)/o;return o?(n.invert=function(t,e){var n=i-e,r=tt(o)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/o,2*Math.atan(Math.pow(i/r,1/o))-Hi]},n):Cn}function Ln(t,e){function n(t,e){var n=o-e;return[n*Math.sin(a*t),o-n*Math.cos(a*t)]}var r=Math.cos(t),a=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),o=r/a+t;return bi(a)1&&et(t[n[r-2]],t[n[r-1]],t[a])<=0;)--r;n[r++]=a}return n.slice(0,r)}function En(t,e){return t[0]-e[0]||t[1]-e[1]}function Nn(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function In(t,e,n,r){var a=t[0],o=n[0],i=e[0]-a,l=r[0]-o,s=t[1],c=n[1],u=e[1]-s,f=r[1]-c,d=(l*(s-c)-f*(a-o))/(f*i-l*u);return[a+d*i,s+d*u]}function Rn(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function Fn(){or(this),this.edge=this.site=this.circle=null}function jn(t){var e=cs.pop()||new Fn;return e.site=t,e}function Bn(t){Qn(t),is.remove(t),cs.push(t),or(t)}function qn(t){var e=t.circle,n=e.x,r=e.cy,a={x:n,y:r},o=t.P,i=t.N,l=[t];Bn(t);for(var s=o;s.circle&&bi(n-s.circle.x)Ri)l=l.L;else{if(a=o-Yn(l,i),!(a>Ri)){r>-Ri?(e=l.P,n=l):a>-Ri?(e=l,n=l.N):e=n=l;break}if(!l.R){e=l;break}l=l.R}var s=jn(t);if(is.insert(e,s),e||n){if(e===n)return Qn(e),n=jn(e.site),is.insert(s,n),s.edge=n.edge=tr(e.site,s.site),Wn(e),void Wn(n);if(!n)return void(s.edge=tr(e.site,s.site));Qn(e),Qn(n);var c=e.site,u=c.x,f=c.y,d=t.x-u,h=t.y-f,p=n.site,g=p.x-u,m=p.y-f,v=2*(d*m-h*g),y=d*d+h*h,x=g*g+m*m,b={x:(m*y-h*x)/v+u,y:(d*x-g*y)/v+f};nr(n.edge,c,p,b),s.edge=tr(c,t,null,b),n.edge=tr(t,p,null,b),Wn(e),Wn(n)}}function Vn(t,e){var n=t.site,r=n.x,a=n.y,o=a-e;if(!o)return r;var i=t.P;if(!i)return-(1/0);n=i.site;var l=n.x,s=n.y,c=s-e;if(!c)return l;var u=l-r,f=1/o-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-o/2)))/f+r:(r+l)/2}function Yn(t,e){var n=t.N;if(n)return Vn(n,e);var r=t.site;return r.y===e?r.x:1/0}function Un(t){this.site=t,this.edges=[]}function Xn(t){for(var e,n,r,a,o,i,l,s,c,u,f=t[0][0],d=t[1][0],h=t[0][1],p=t[1][1],g=os,m=g.length;m--;)if(o=g[m],o&&o.prepare())for(l=o.edges,s=l.length,i=0;iRi||bi(a-n)>Ri)&&(l.splice(i,0,new rr(er(o.site,u,bi(r-f)Ri?{x:f,y:bi(e-f)Ri?{x:bi(n-p)Ri?{x:d,y:bi(e-d)Ri?{x:bi(n-h)=-Fi)){var h=s*s+c*c,p=u*u+f*f,g=(f*h-c*p)/d,m=(s*p-u*h)/d,f=m+l,v=us.pop()||new Gn;v.arc=t,v.site=a,v.x=g+i,v.y=f+Math.sqrt(g*g+m*m),v.cy=f,t.circle=v;for(var y=null,x=ss._;x;)if(v.y=l)return;if(d>p){if(o){if(o.y>=c)return}else o={x:m,y:s};n={x:m,y:c}}else{if(o){if(o.y1)if(d>p){if(o){if(o.y>=c)return}else o={x:(s-a)/r,y:s};n={x:(c-a)/r,y:c}}else{if(o){if(o.y=l)return}else o={x:i,y:r*i+a};n={x:l,y:r*l+a}}else{if(o){if(o.xo||f>i||d=b,k=n>=_,M=k<<1|w,A=M+4;Mo&&(a=e.slice(o,a),l[i]?l[i]+=a:l[++i]=a),(n=n[0])===(r=r[0])?l[i]?l[i]+=r:l[++i]=r:(l[++i]=null,s.push({i:i,x:xr(n,r)})),o=hs.lastIndex;return o=0&&!(n=ui.interpolators[r](t,e)););return n}function wr(t,e){var n,r=[],a=[],o=t.length,i=e.length,l=Math.min(t.length,e.length);for(n=0;n=1?1:t(e)}}function Mr(t){return function(e){return 1-t(1-e)}}function Ar(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tr(t){return t*t}function Lr(t){return t*t*t}function Cr(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function zr(t){return function(e){return Math.pow(e,t)}}function Sr(t){return 1-Math.cos(t*Hi)}function Or(t){return Math.pow(2,10*(t-1))}function Dr(t){return 1-Math.sqrt(1-t*t)}function Pr(t,e){var n;return arguments.length<2&&(e=.45),arguments.length?n=e/Bi*Math.asin(1/t):(t=1,n=e/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-n)*Bi/e)}}function Er(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Nr(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 Ir(t,e){t=ui.hcl(t),e=ui.hcl(e);var n=t.h,r=t.c,a=t.l,o=e.h-n,i=e.c-r,l=e.l-a;return isNaN(i)&&(i=0,r=isNaN(r)?e.c:r),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360),function(t){return dt(n+o*t,r+i*t,a+l*t)+""}}function Rr(t,e){t=ui.hsl(t),e=ui.hsl(e);var n=t.h,r=t.s,a=t.l,o=e.h-n,i=e.s-r,l=e.l-a;return isNaN(i)&&(i=0,r=isNaN(r)?e.s:r),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360),function(t){return ut(n+o*t,r+i*t,a+l*t)+""}}function Fr(t,e){t=ui.lab(t),e=ui.lab(e);var n=t.l,r=t.a,a=t.b,o=e.l-n,i=e.a-r,l=e.b-a;return function(t){return pt(n+o*t,r+i*t,a+l*t)+""}}function jr(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function Br(t){var e=[t.a,t.b],n=[t.c,t.d],r=Hr(e),a=qr(e,n),o=Hr(Vr(n,e,-a))||0;e[0]*n[1]180?e+=360:e-t>180&&(t+=360),r.push({i:n.push(Yr(n)+"rotate(",null,")")-2,x:xr(t,e)})):e&&n.push(Yr(n)+"rotate("+e+")")}function Zr(t,e,n,r){t!==e?r.push({i:n.push(Yr(n)+"skewX(",null,")")-2,x:xr(t,e)}):e&&n.push(Yr(n)+"skewX("+e+")")}function Gr(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var a=n.push(Yr(n)+"scale(",null,",",null,")");r.push({i:a-4,x:xr(t[0],e[0])},{i:a-2,x:xr(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(Yr(n)+"scale("+e+")")}function Wr(t,e){var n=[],r=[];return t=ui.transform(t),e=ui.transform(e),Ur(t.translate,e.translate,n,r),Xr(t.rotate,e.rotate,n,r),Zr(t.skew,e.skew,n,r),Gr(t.scale,e.scale,n,r),t=e=null,function(t){for(var e,a=-1,o=r.length;++a=0;)n.push(a[r])}function sa(t,e){for(var n=[t],r=[];null!=(t=n.pop());)if(r.push(t),(o=t.children)&&(a=o.length))for(var a,o,i=-1;++ia&&(r=n,a=e);return r}function xa(t){return t.reduce(ba,0)}function ba(t,e){return t+e[1]}function _a(t,e){return wa(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wa(t,e){for(var n=-1,r=+t[0],a=(t[1]-r)/e,o=[];++n<=e;)o[n]=a*n+r;return o}function ka(t){return[ui.min(t),ui.max(t)]}function Ma(t,e){return t.value-e.value}function Aa(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Ta(t,e){t._pack_next=e,e._pack_prev=t}function La(t,e){var n=e.x-t.x,r=e.y-t.y,a=t.r+e.r;return.999*a*a>n*n+r*r}function Ca(t){function e(t){u=Math.min(t.x-t.r,u),f=Math.max(t.x+t.r,f),d=Math.min(t.y-t.r,d),h=Math.max(t.y+t.r,h)}if((n=t.children)&&(c=n.length)){var n,r,a,o,i,l,s,c,u=1/0,f=-(1/0),d=1/0,h=-(1/0);if(n.forEach(za),r=n[0],r.x=-r.r,r.y=0,e(r),c>1&&(a=n[1],a.x=a.r,a.y=0,e(a),c>2))for(o=n[2],Da(r,a,o),e(o),Aa(r,o),r._pack_prev=o,Aa(o,a),a=r._pack_next,i=3;i=0;)e=a[o],e.z+=n,e.m+=n,n+=e.s+(r+=e.c)}function Fa(t,e,n){return t.a.parent===e.parent?t.a:n}function ja(t){return 1+ui.max(t,function(t){return t.y})}function Ba(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function qa(t){var e=t.children;return e&&e.length?qa(e[0]):t}function Ha(t){var e,n=t.children;return n&&(e=n.length)?Ha(n[e-1]):t}function Va(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Ya(t,e){var n=t.x+e[3],r=t.y+e[0],a=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return a<0&&(n+=a/2,a=0),o<0&&(r+=o/2,o=0),{x:n,y:r,dx:a,dy:o}}function Ua(t){var e=t[0],n=t[t.length-1];return e2?Qa:Za,s=r?$r:Qr;return i=a(t,e,s,n),l=a(e,t,s,_r),o}function o(t){return i(t)}var i,l;return o.invert=function(t){return l(t)},o.domain=function(e){return arguments.length?(t=e.map(Number),a()):t},o.range=function(t){return arguments.length?(e=t,a()):e},o.rangeRound=function(t){return o.range(t).interpolate(jr)},o.clamp=function(t){return arguments.length?(r=t,a()):r},o.interpolate=function(t){return arguments.length?(n=t,a()):n},o.ticks=function(e){return eo(t,e)},o.tickFormat=function(e,n){return no(t,e,n)},o.nice=function(e){return Ka(t,e),a()},o.copy=function(){return $a(t,e,n,r)},a()}function Ja(t,e){return ui.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ka(t,e){return Ga(t,Wa(to(t,e)[2])),Ga(t,Wa(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var n=Ua(t),r=n[1]-n[0],a=Math.pow(10,Math.floor(Math.log(r/e)/Math.LN10)),o=e/r*a;return o<=.15?a*=10:o<=.35?a*=5:o<=.75&&(a*=2),n[0]=Math.ceil(n[0]/a)*a,n[1]=Math.floor(n[1]/a)*a+.5*a,n[2]=a,n}function eo(t,e){return ui.range.apply(ui,to(t,e))}function no(t,e,n){var r=to(t,e);if(n){var a=dl.exec(n);if(a.shift(),"s"===a[8]){var o=ui.formatPrefix(Math.max(bi(r[0]),bi(r[1])));return a[7]||(a[7]="."+ro(o.scale(r[2]))),a[8]="f",n=ui.format(a.join("")),function(t){return n(o.scale(t))+o.symbol}}a[7]||(a[7]="."+ao(a[8],r)),n=a.join("")}else n=",."+ro(r[2])+"f";return ui.format(n)}function ro(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ao(t,e){var n=ro(e[2]);return t in As?Math.abs(n-ro(Math.max(bi(e[0]),bi(e[1]))))+ +("e"!==t):n-2*("%"===t)}function oo(t,e,n,r){function a(t){return(n?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return n?Math.pow(e,t):-Math.pow(e,-t)}function i(e){return t(a(e))}return i.invert=function(e){return o(t.invert(e))},i.domain=function(e){return arguments.length?(n=e[0]>=0,t.domain((r=e.map(Number)).map(a)),i):r},i.base=function(n){return arguments.length?(e=+n,t.domain(r.map(a)),i):e},i.nice=function(){var e=Ga(r.map(a),n?Math:Ls);return t.domain(e),r=e.map(o),i},i.ticks=function(){var t=Ua(r),i=[],l=t[0],s=t[1],c=Math.floor(a(l)),u=Math.ceil(a(s)),f=e%1?2:e;if(isFinite(u-c)){if(n){for(;c0;d--)i.push(o(c)*d);for(c=0;i[c]s;u--);i=i.slice(c,u)}return i},i.tickFormat=function(t,n){if(!arguments.length)return Ts;arguments.length<2?n=Ts:"function"!=typeof n&&(n=ui.format(n));var r=Math.max(1,e*t/i.ticks().length);return function(t){var i=t/o(Math.round(a(t)));return i*e0?l[n-1]:t[0],n0?0:1}function _o(t,e,n,r,a){var o=t[0]-e[0],i=t[1]-e[1],l=(a?r:-r)/Math.sqrt(o*o+i*i),s=l*i,c=-l*o,u=t[0]+s,f=t[1]+c,d=e[0]+s,h=e[1]+c,p=(u+d)/2,g=(f+h)/2,m=d-u,v=h-f,y=m*m+v*v,x=n-r,b=u*h-d*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-p,L=k-g,C=M-p,z=A-g;return T*T+L*L>C*C+z*z&&(w=M,k=A),[[w-s,k-c],[w*n/x,k*n/x]]}function wo(t){function e(e){function i(){c.push("M",o(t(u),l))}for(var s,c=[],u=[],f=-1,d=e.length,h=Ct(n),p=Ct(r);++f1?t.join("L"):t+"Z"}function Mo(t){return t.join("L")+"Z"}function Ao(t){for(var e=0,n=t.length,r=t[0],a=[r[0],",",r[1]];++e1&&a.push("H",r[0]),a.join("")}function To(t){for(var e=0,n=t.length,r=t[0],a=[r[0],",",r[1]];++e1){l=e[1],o=t[s],s++,r+="C"+(a[0]+i[0])+","+(a[1]+i[1])+","+(o[0]-l[0])+","+(o[1]-l[1])+","+o[0]+","+o[1];for(var c=2;c9&&(a=3*e/Math.sqrt(a),i[l]=a*n,i[l+1]=a*r));for(l=-1;++l<=s;)a=(t[Math.min(s,l+1)][0]-t[Math.max(0,l-1)][0])/(6*(1+i[l]*i[l])),o.push([a||0,i[l]*a||0]);return o}function Ho(t){return t.length<3?ko(t):t[0]+Oo(t,qo(t))}function Vo(t){for(var e,n,r,a=-1,o=t.length;++a0;)h[--l].call(t,i);if(o>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[r]:delete t[n],1}var s,c,u,d,h,p=t[n]||(t[n]={active:0,count:0}),g=p[r];g||(s=a.time,c=Pt(o,0,s),g=p[r]={tween:new f,time:s,timer:c,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++p.count)}function ri(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate("+(isFinite(r)?r:n(t))+",0)"})}function ai(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate(0,"+(isFinite(r)?r:n(t))+")"})}function oi(t){return t.toISOString()}function ii(t,e,n){function r(e){return t(e)}function a(t,n){var r=t[1]-t[0],a=r/n,o=ui.bisect(Js,a);return o==Js.length?[e.year,to(t.map(function(t){return t/31536e6}),n)[2]]:o?e[a/Js[o-1]1?{floor:function(e){for(;n(e=t.floor(e));)e=li(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=li(+e+1);return e}}:t))},r.ticks=function(t,e){var n=Ua(r.domain()),o=null==t?a(n,10):"number"==typeof t?a(n,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(n[0],li(+n[1]+1),e<1?1:e)},r.tickFormat=function(){return n},r.copy=function(){return ii(t.copy(),e,n)},Ja(r,t)}function li(t){return new Date(t)}function si(t){return JSON.parse(t.responseText)}function ci(t){var e=hi.createRange();return e.selectNode(hi.body),e.createContextualFragment(t.responseText)}var ui={version:"3.5.17"},fi=[].slice,di=function(t){return fi.call(t)},hi=this.document;if(hi)try{di(hi.documentElement.childNodes)[0].nodeType}catch(t){di=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),hi)try{hi.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var pi=this.Element.prototype,gi=pi.setAttribute,mi=pi.setAttributeNS,vi=this.CSSStyleDeclaration.prototype,yi=vi.setProperty;pi.setAttribute=function(t,e){gi.call(this,t,e+"")},pi.setAttributeNS=function(t,e,n){mi.call(this,t,e,n+"")},vi.setProperty=function(t,e,n){yi.call(this,t,e+"",n)}}ui.ascending=a,ui.descending=function(t,e){return et?1:e>=t?0:NaN},ui.min=function(t,e){var n,r,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=r;break}for(;++ar&&(n=r)}else{for(;++a=r){n=r;break}for(;++ar&&(n=r)}return n},ui.max=function(t,e){var n,r,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=r;break}for(;++an&&(n=r)}else{for(;++a=r){n=r;break}for(;++an&&(n=r)}return n},ui.extent=function(t,e){var n,r,a,o=-1,i=t.length;if(1===arguments.length){for(;++o=r){n=a=r;break}for(;++or&&(n=r),a=r){n=a=r;break}for(;++or&&(n=r),a1)return s/(u-1)},ui.deviation=function(){var t=ui.variance.apply(this,arguments);return t?Math.sqrt(t):t};var xi=l(a);ui.bisectLeft=xi.left,ui.bisect=ui.bisectRight=xi.right,ui.bisector=function(t){return l(1===t.length?function(e,n){return a(t(e),n)}:t)},ui.shuffle=function(t,e,n){(o=arguments.length)<3&&(n=t.length,o<2&&(e=0));for(var r,a,o=n-e;o;)a=Math.random()*o--|0,r=t[o+e],t[o+e]=t[a+e],t[a+e]=r;return t},ui.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r},ui.pairs=function(t){for(var e,n=0,r=t.length-1,a=t[0],o=new Array(r<0?0:r);n=0;)for(r=t[a],e=r.length;--e>=0;)n[--i]=r[e];return n};var bi=Math.abs;ui.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n===1/0)throw new Error("infinite range");var r,a=[],o=c(bi(n)),i=-1;if(t*=o,e*=o,n*=o,n<0)for(;(r=t+n*++i)>e;)a.push(r/o);else for(;(r=t+n*++i)=o.length)return r?r.call(a,i):n?i.sort(n):i;for(var s,c,u,d,h=-1,p=i.length,g=o[l++],m=new f;++h=o.length)return t;var r=[],a=i[n++];return t.forEach(function(t,a){r.push({key:t,values:e(a,n)})}),a?r.sort(function(t,e){return a(t.key,e.key)}):r}var n,r,a={},o=[],i=[];return a.map=function(e,n){return t(n,e,0)},a.entries=function(n){return e(t(ui.map,n,0),0)},a.key=function(t){return o.push(t),a},a.sortKeys=function(t){return i[o.length-1]=t,a},a.sortValues=function(t){return n=t,a},a.rollup=function(t){return r=t,a},a},ui.set=function(t){var e=new x;if(t)for(var n=0,r=t.length;n=0&&(r=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},ui.event=null,ui.requote=function(t){return t.replace(Mi,"\\$&")};var Mi=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ai={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},Ti=function(t,e){return e.querySelector(t)},Li=function(t,e){return e.querySelectorAll(t)},Ci=function(t,e){var n=t.matches||t[w(t,"matchesSelector")];return(Ci=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Ti=function(t,e){return Sizzle(t,e)[0]||null},Li=Sizzle,Ci=Sizzle.matchesSelector),ui.selection=function(){return ui.select(hi.documentElement)};var zi=ui.selection.prototype=[];zi.select=function(t){var e,n,r,a,o=[];t=S(t);for(var i=-1,l=this.length;++i=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Oi.hasOwnProperty(n)?{space:Oi[n],local:t}:t}},zi.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();return t=ui.ns.qualify(t),t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(D(e,t[e]));return this}return this.each(D(t,e))},zi.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=N(t)).length,a=-1;if(e=n.classList){for(;++a=0;)(n=r[a])&&(o&&o!==n.nextSibling&&o.parentNode.insertBefore(n,o),o=n);return this},zi.sort=function(t){t=Y.apply(this,arguments);for(var e=-1,n=this.length;++e0&&(e=e.transition().duration(z)),e.call(t.event)}function l(){_&&_.domain(b.range().map(function(t){return(t-M.x)/M.k}).map(b.invert)),k&&k.domain(w.range().map(function(t){return(t-M.y)/M.k}).map(w.invert))}function s(t){S++||t({type:"zoomstart"})}function c(t){l(),t({type:"zoom",scale:M.k,translate:[M.x,M.y]})}function u(t){--S||(t({type:"zoomend"}),m=null)}function f(){function t(){l=1,o(ui.mouse(a),d),c(i)}function n(){f.on(D,null).on(P,null),h(l),u(i)}var a=this,i=N.of(a,arguments),l=0,f=ui.select(r(a)).on(D,t).on(P,n),d=e(ui.mouse(a)),h=$(a);Hs.call(a),s(i)}function d(){function t(){ -var t=ui.touches(p);return h=M.k,t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))}),t}function n(){var e=ui.event.target;ui.select(e).on(b,r).on(_,l),w.push(e);for(var n=ui.event.changedTouches,a=0,o=n.length;a1){var u=s[0],f=s[1],d=u[0]-f[0],h=u[1]-f[1];v=d*d+h*h}}function r(){var t,e,n,r,i=ui.touches(p);Hs.call(p);for(var l=0,s=i.length;l=c)return i;if(a)return a=!1,o;var e=u;if(34===t.charCodeAt(e)){for(var n=e;n++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,hl=ui.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=ui.round(t,Rt(t,e))).toFixed(Math.max(0,Math.min(20,Rt(t*(1+1e-15),e))))}}),pl=ui.time={},gl=Date;qt.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(){ml.setUTCDate.apply(this._,arguments)},setDay:function(){ml.setUTCDay.apply(this._,arguments)},setFullYear:function(){ml.setUTCFullYear.apply(this._,arguments)},setHours:function(){ml.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ml.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ml.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ml.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ml.setUTCSeconds.apply(this._,arguments)},setTime:function(){ml.setTime.apply(this._,arguments)}};var ml=Date.prototype;pl.year=Ht(function(t){return t=pl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),pl.years=pl.year.range,pl.years.utc=pl.year.utc.range,pl.day=Ht(function(t){var e=new gl(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),pl.days=pl.day.range,pl.days.utc=pl.day.utc.range,pl.dayOfYear=function(t){var e=pl.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=pl[t]=Ht(function(t){return(t=pl.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});pl[t+"s"]=n.range,pl[t+"s"].utc=n.utc.range,pl[t+"OfYear"]=function(t){var n=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(n+e)%7)/7)}}),pl.week=pl.sunday,pl.weeks=pl.sunday.range,pl.weeks.utc=pl.sunday.utc.range,pl.weekOfYear=pl.sundayOfYear;var vl={"-":"",_:" ",0:"0"},yl=/^\s*\d+/,xl=/^%/;ui.locale=function(t){return{numberFormat:jt(t),timeFormat:Yt(t)}};var bl=ui.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"]});ui.format=bl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,_l),de(_l.s,this.s,this),this.s?this.t+=_l.t:this.s=_l.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _l=new fe;ui.geo.stream=function(t,e){t&&wl.hasOwnProperty(t.type)?wl[t.type](t,e):he(t,e)};var wl={Feature:function(t,e){he(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,a=n.length;++rh&&(h=e)}function e(e,n){var r=ve([e*Vi,n*Vi]);if(v){var a=xe(v,r),o=[a[1],-a[0],0],i=xe(o,a);we(i),i=ke(i);var s=e-p,c=s>0?1:-1,g=i[0]*Yi*c,m=bi(s)>180;if(m^(c*ph&&(h=y)}else if(g=(g+360)%360-180,m^(c*ph&&(h=n);m?el(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e):d>=u?(ed&&(d=e)):e>p?l(u,e)>l(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e)}else t(e,n);v=r,p=e}function n(){_.point=e}function r(){b[0]=u,b[1]=d,_.point=t,v=null}function a(t,n){if(v){var r=t-p;y+=bi(r)>180?r+(r>0?360:-360):r}else g=t,m=n;Tl.point(t,n),e(t,n)}function o(){Tl.lineStart()}function i(){a(g,m),Tl.lineEnd(),bi(y)>Ri&&(u=-(d=180)),b[0]=u,b[1]=d,v=null}function l(t,e){return(e-=t)<0?e+360:e}function s(t,e){return t[0]-e[0]}function c(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tRi?h=90:y<-Ri&&(f=-90),b[0]=u,b[1]=d}};return function(t){h=d=-(u=f=1/0),x=[],ui.geo.stream(t,_);var e=x.length;if(e){x.sort(s);for(var n,r=1,a=x[0],o=[a];rl(a[0],a[1])&&(a[1]=n[1]),l(n[0],a[1])>l(a[0],a[1])&&(a[0]=n[0])):o.push(a=n);for(var i,n,p=-(1/0),e=o.length-1,r=0,a=o[e];r<=e;a=n,++r)n=o[r],(i=l(a[1],n[0]))>p&&(p=i,u=n[0],d=a[1])}return x=b=null,u===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[u,f],[d,h]]}}(),ui.geo.centroid=function(t){Ll=Cl=zl=Sl=Ol=Dl=Pl=El=Nl=Il=Rl=0,ui.geo.stream(t,Fl);var e=Nl,n=Il,r=Rl,a=e*e+n*n+r*r;return a=.12&&a<.234&&r>=-.425&&r<-.214?i:a>=.166&&a<.234&&r>=-.214&&r<-.115?l:o).invert(t)},t.stream=function(t){var e=o.stream(t),n=i.stream(t),r=l.stream(t);return{point:function(t,a){e.point(t,a),n.point(t,a),r.point(t,a)},sphere:function(){e.sphere(),n.sphere(),r.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),i.precision(e),l.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),i.scale(.35*e),l.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var c=o.scale(),u=+e[0],f=+e[1];return n=o.translate(e).clipExtent([[u-.455*c,f-.238*c],[u+.455*c,f+.238*c]]).stream(s).point,r=i.translate([u-.307*c,f+.201*c]).clipExtent([[u-.425*c+Ri,f+.12*c+Ri],[u-.214*c-Ri,f+.234*c-Ri]]).stream(s).point,a=l.translate([u-.205*c,f+.212*c]).clipExtent([[u-.214*c+Ri,f+.166*c+Ri],[u-.115*c-Ri,f+.234*c-Ri]]).stream(s).point,t},t.scale(1070)};var ql,Hl,Vl,Yl,Ul,Xl,Zl={point:k,lineStart:k,lineEnd:k,polygonStart:function(){Hl=0,Zl.lineStart=Ge},polygonEnd:function(){Zl.lineStart=Zl.lineEnd=Zl.point=k,ql+=bi(Hl/2)}},Gl={point:We,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Wl={point:Je,lineStart:Ke,lineEnd:tn,polygonStart:function(){Wl.lineStart=en},polygonEnd:function(){Wl.point=Je,Wl.lineStart=Ke,Wl.lineEnd=tn}};ui.geo.path=function(){function t(t){return t&&("function"==typeof l&&o.pointRadius(+l.apply(this,arguments)),i&&i.valid||(i=a(o)),ui.geo.stream(t,i)),o.result()}function e(){return i=null,t}var n,r,a,o,i,l=4.5;return t.area=function(t){return ql=0,ui.geo.stream(t,a(Zl)),ql},t.centroid=function(t){return zl=Sl=Ol=Dl=Pl=El=Nl=Il=Rl=0,ui.geo.stream(t,a(Wl)),Rl?[Nl/Rl,Il/Rl]:El?[Dl/El,Pl/El]:Ol?[zl/Ol,Sl/Ol]:[NaN,NaN]},t.bounds=function(t){return Ul=Xl=-(Vl=Yl=1/0),ui.geo.stream(t,a(Gl)),[[Vl,Yl],[Ul,Xl]]},t.projection=function(t){return arguments.length?(a=(n=t)?t.stream||an(t):b,e()):n},t.context=function(t){return arguments.length?(o=null==(r=t)?new Qe:new nn(t),"function"!=typeof l&&o.pointRadius(l),e()):r},t.pointRadius=function(e){return arguments.length?(l="function"==typeof e?e:(o.pointRadius(+e),+e),t):l},t.projection(ui.geo.albersUsa()).context(null)},ui.geo.transform=function(t){return{stream:function(e){var n=new on(e);for(var r in t)n[r]=t[r];return n}}},on.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()}},ui.geo.projection=sn,ui.geo.projectionMutator=cn,(ui.geo.equirectangular=function(){return sn(fn)}).raw=fn.invert=fn,ui.geo.rotation=function(t){function e(e){return e=t(e[0]*Vi,e[1]*Vi),e[0]*=Yi,e[1]*=Yi,e}return t=hn(t[0]%360*Vi,t[1]*Vi,t.length>2?t[2]*Vi:0),e.invert=function(e){return e=t.invert(e[0]*Vi,e[1]*Vi),e[0]*=Yi,e[1]*=Yi,e},e},dn.invert=fn,ui.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,e=hn(-t[0]*Vi,-t[1]*Vi,0).invert,a=[];return n(null,null,1,{point:function(t,n){a.push(t=e(t,n)),t[0]*=Yi,t[1]*=Yi}}),{type:"Polygon",coordinates:[a]}}var e,n,r=[0,0],a=6;return t.origin=function(e){return arguments.length?(r=e,t):r},t.angle=function(r){return arguments.length?(n=vn((e=+r)*Vi,a*Vi),t):e},t.precision=function(r){return arguments.length?(n=vn(e*Vi,(a=+r)*Vi),t):a},t.angle(90)},ui.geo.distance=function(t,e){var n,r=(e[0]-t[0])*Vi,a=t[1]*Vi,o=e[1]*Vi,i=Math.sin(r),l=Math.cos(r),s=Math.sin(a),c=Math.cos(a),u=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((n=f*i)*n+(n=c*u-s*f*l)*n),s*u+c*f*l)},ui.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return ui.range(Math.ceil(o/m)*m,a,m).map(d).concat(ui.range(Math.ceil(c/v)*v,s,v).map(h)).concat(ui.range(Math.ceil(r/p)*p,n,p).filter(function(t){return bi(t%m)>Ri}).map(u)).concat(ui.range(Math.ceil(l/g)*g,i,g).filter(function(t){return bi(t%v)>Ri}).map(f))}var n,r,a,o,i,l,s,c,u,f,d,h,p=10,g=p,m=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[d(o).concat(h(s).slice(1),d(a).reverse().slice(1),h(c).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],a=+e[1][0],c=+e[0][1],s=+e[1][1],o>a&&(e=o,o=a,a=e),c>s&&(e=c,c=s,s=e),t.precision(y)):[[o,c],[a,s]]},t.minorExtent=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],l=+e[0][1],i=+e[1][1],r>n&&(e=r,r=n,n=e),l>i&&(e=l,l=i,i=e),t.precision(y)):[[r,l],[n,i]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(m=+e[0],v=+e[1],t):[m,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,u=xn(l,i,90),f=bn(r,n,y),d=xn(c,s,90),h=bn(o,a,y),t):y},t.majorExtent([[-180,-90+Ri],[180,90-Ri]]).minorExtent([[-180,-80-Ri],[180,80+Ri]])},ui.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||r.apply(this,arguments),n||a.apply(this,arguments)]}}var e,n,r=_n,a=wn;return t.distance=function(){return ui.geo.distance(e||r.apply(this,arguments),n||a.apply(this,arguments))},t.source=function(n){return arguments.length?(r=n,e="function"==typeof n?null:n,t):r},t.target=function(e){return arguments.length?(a=e,n="function"==typeof e?null:e,t):a},t.precision=function(){return arguments.length?t:0},t},ui.geo.interpolate=function(t,e){return kn(t[0]*Vi,t[1]*Vi,e[0]*Vi,e[1]*Vi)},ui.geo.length=function(t){return Ql=0,ui.geo.stream(t,$l),Ql};var Ql,$l={sphere:k,point:k,lineStart:Mn,lineEnd:k,polygonStart:k,polygonEnd:k},Jl=An(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return sn(Jl)}).raw=Jl;var Kl=An(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return sn(Kl)}).raw=Kl,(ui.geo.conicConformal=function(){return Xe(Tn)}).raw=Tn,(ui.geo.conicEquidistant=function(){return Xe(Ln)}).raw=Ln;var ts=An(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return sn(ts)}).raw=ts,Cn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return zn(Cn)}).raw=Cn;var es=An(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return sn(es)}).raw=es;var ns=An(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return sn(ns)}).raw=ns,Sn.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Hi]},(ui.geo.transverseMercator=function(){var t=zn(Sn),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):(t=n(),[t[0],t[1],t[2]-90])},n([0,0,90])}).raw=Sn,ui.geom={},ui.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,a=Ct(n),o=Ct(r),i=t.length,l=[],s=[];for(e=0;e=0;--e)h.push(t[l[c[e]][2]]);for(e=+f;e=r&&c.x<=o&&c.y>=a&&c.y<=i?[[r,i],[o,i],[o,a],[r,a]]:[];u.point=t[l]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Ri)*Ri,y:Math.round(i(t,e)/Ri)*Ri,i:e}})}var r=On,a=Dn,o=r,i=a,l=fs;return t?e(t):(e.links=function(t){return cr(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return cr(n(t)).cells.forEach(function(n,r){for(var a,o,i=n.site,l=n.edges.sort(Zn),s=-1,c=l.length,u=l[c-1].edge,f=u.l===i?u.r:u.l;++s=c,d=r>=u,h=d<<1|f;t.leaf=!1,t=t.nodes[h]||(t.nodes[h]=pr()),f?a=c:l=c,d?i=u:s=u,o(t,e,n,r,a,i,l,s)}var u,f,d,h,p,g,m,v,y,x=Ct(l),b=Ct(s);if(null!=e)g=e,m=n,v=r,y=a;else if(v=y=-(g=m=1/0),f=[],d=[],p=t.length,i)for(h=0;hv&&(v=u.x),u.y>y&&(y=u.y),f.push(u.x),d.push(u.y);else for(h=0;hv&&(v=_),w>y&&(y=w),f.push(_),d.push(w)}var k=v-g,M=y-m;k>M?y=m+k:v=g+M;var A=pr();if(A.add=function(t){o(A,t,+x(t,++h),+b(t,h),g,m,v,y)},A.visit=function(t){gr(t,A,g,m,v,y)},A.find=function(t){return mr(A,t[0],t[1],g,m,v,y)},h=-1,null==e){for(;++h=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=gs.get(n)||ps,r=ms.get(r)||b,kr(r(n.apply(null,fi.call(arguments,1))))},ui.interpolateHcl=Ir,ui.interpolateHsl=Rr,ui.interpolateLab=Fr,ui.interpolateRound=jr,ui.transform=function(t){var e=hi.createElementNS(ui.ns.prefix.svg,"g");return(ui.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new Br(n?n.matrix:vs)})(t)},Br.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var vs={a:1,b:0,c:0,d:1,e:0,f:0};ui.interpolateTransform=Wr,ui.layout={},ui.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++n0?a=t:(n.c=null,n.t=NaN,n=null,c.end({type:"end",alpha:a=0})):t>0&&(c.start({type:"start",alpha:a=t}),n=Pt(s.tick)),s):a},s.start=function(){function t(t,r){if(!n){for(n=new Array(a),s=0;s=0;)i.push(u=c[s]),u.parent=o,u.depth=o.depth+1;r&&(o.value=0),o.children=c}else r&&(o.value=+r.call(t,o,o.depth)||0),delete o.children;return sa(a,function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)}),l}var e=fa,n=ca,r=ua;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(r=e,t):r},t.revalue=function(e){return r&&(la(e,function(t){t.children&&(t.value=0)}),sa(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},ui.layout.partition=function(){function t(e,n,r,a){var o=e.children;if(e.x=n,e.y=e.depth*a,e.dx=r,e.dy=a,o&&(i=o.length)){var i,l,s,c=-1;for(r=e.value?r/e.value:0;++cl&&(l=r),i.push(r)}for(n=0;n0)for(o=-1;++o=u[0]&&l<=u[1]&&(i=s[ui.bisect(f,l,1,h)-1],i.y+=p,i.push(t[o]));return s}var e=!0,n=Number,r=ka,a=_a;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(r=Ct(e),t):r},t.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return wa(t,e)}:Ct(e),t):a},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},ui.layout.pack=function(){function t(t,o){var i=n.call(this,t,o),l=i[0],s=a[0],c=a[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(l.x=l.y=0,sa(l,function(t){t.r=+u(t.value)}),sa(l,Ca),r){var f=r*(e?1:Math.max(2*l.r/s,2*l.r/c))/2;sa(l,function(t){t.r+=f}),sa(l,Ca),sa(l,function(t){t.r-=f})}return Oa(l,s/2,c/2,e?1:1/Math.max(2*l.r/s,2*l.r/c)),i}var e,n=ui.layout.hierarchy().sort(Ma),r=0,a=[1,1];return t.size=function(e){return arguments.length?(a=e,t):a},t.radius=function(n){return arguments.length?(e=null==n||"function"==typeof n?n:+n,t):e},t.padding=function(e){return arguments.length?(r=+e,t):r},ia(t,n)},ui.layout.tree=function(){function t(t,a){var u=i.call(this,t,a),f=u[0],d=e(f);if(sa(d,n),d.parent.m=-d.z,la(d,r),c)la(f,o);else{var h=f,p=f,g=f;la(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var m=l(h,p)/2-h.x,v=s[0]/(p.x+l(p,h)/2+m),y=s[1]/(g.depth||1);la(f,function(t){t.x=(t.x+m)*v,t.y=t.depth*y})}return u}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var a,o=e.children,i=0,l=o.length;i0&&(Ia(Fa(i,t,n),t,r),c+=r,u+=r),f+=i.m,c+=a.m,d+=s.m,u+=o.m;i&&!Na(o)&&(o.t=i,o.m+=f-u),a&&!Ea(s)&&(s.t=a,s.m+=c-d,n=t)}return n}function o(t){t.x*=s[0],t.y=t.depth*s[1]}var i=ui.layout.hierarchy().sort(null).value(null),l=Pa,s=[1,1],c=null;return t.separation=function(e){return arguments.length?(l=e,t):l},t.size=function(e){return arguments.length?(c=null==(s=e)?o:null,t):c?null:s},t.nodeSize=function(e){return arguments.length?(c=null==(s=e)?null:o,t):c?s:null},ia(t,i)},ui.layout.cluster=function(){function t(t,o){var i,l=e.call(this,t,o),s=l[0],c=0;sa(s,function(t){var e=t.children;e&&e.length?(t.x=Ba(e),t.y=ja(e)):(t.x=i?c+=n(t,i):0,t.y=0,i=t)});var u=qa(s),f=Ha(s),d=u.x-n(u,f)/2,h=f.x+n(f,u)/2;return sa(s,a?function(t){t.x=(t.x-s.x)*r[0],t.y=(s.y-t.y)*r[1]}:function(t){t.x=(t.x-d)/(h-d)*r[0],t.y=(1-(s.y?t.y/s.y:1))*r[1]}),l}var e=ui.layout.hierarchy().sort(null).value(null),n=Pa,r=[1,1],a=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(a=null==(r=e),t):a?null:r},t.nodeSize=function(e){return arguments.length?(a=null!=(r=e),t):a?r:null},ia(t,e)},ui.layout.treemap=function(){function t(t,e){for(var n,r,a=-1,o=t.length;++a0;)u.push(i=d[s-1]),u.area+=i.area,"squarify"!==h||(l=r(u,g))<=p?(d.pop(),p=l):(u.area-=u.pop().area,a(u,g,c,!1),g=Math.min(c.dx,c.dy),u.length=u.area=0,p=1/0);u.length&&(a(u,g,c,!0),u.length=u.area=0),o.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var o,i=f(e),l=r.slice(),s=[];for(t(l,i.dx*i.dy/e.value),s.area=0;o=l.pop();)s.push(o),s.area+=o.area,null!=o.z&&(a(s,o.z?i.dx:i.dy,i,!l.length),s.length=s.area=0);r.forEach(n)}}function r(t,e){for(var n,r=t.area,a=0,o=1/0,i=-1,l=t.length;++ia&&(a=n));return r*=r,e*=e,r?Math.max(e*a*p/r,r/(e*o*p)):1/0}function a(t,e,n,r){var a,o=-1,i=t.length,l=n.x,c=n.y,u=e?s(t.area/e):0;if(e==n.dx){for((r||u>n.dy)&&(u=n.dy);++on.dx)&&(u=n.dx);++o1);return t+e*n*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=ui.random.normal.apply(ui,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ui.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;nf?0:1;if(c=qi)return e(c,h)+(t?e(t,1-h):"")+"Z";var p,g,m,v,y,x,b,_,w,k,M,A,T=0,L=0,C=[];if((v=(+s.apply(this,arguments)||0)/2)&&(m=o===Ds?Math.sqrt(t*t+c*c):+o.apply(this,arguments),h||(L*=-1),c&&(L=rt(m/c*Math.sin(v))),t&&(T=rt(m/t*Math.sin(v)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var z=Math.abs(f-u-2*L)<=ji?0:1;if(L&&bo(y,x,b,_)===h^z){var S=(u+f)/2;y=c*Math.cos(S),x=c*Math.sin(S),b=_=null}}else y=x=0;if(t){w=t*Math.cos(f-T),k=t*Math.sin(f-T),M=t*Math.cos(u+T),A=t*Math.sin(u+T);var O=Math.abs(u-f+2*T)<=ji?0:1;if(T&&bo(w,k,M,A)===1-h^O){var D=(u+f)/2;w=t*Math.cos(D),k=t*Math.sin(D),M=A=null}}else w=k=0;if(d>Ri&&(p=Math.min(Math.abs(c-t)/2,+a.apply(this,arguments)))>.001){g=tji)+",1 "+e}function a(t,e,n,r){return"Q 0,0 "+r}var o=_n,i=wn,l=Uo,s=vo,c=yo;return t.radius=function(e){return arguments.length?(l=Ct(e),t):l},t.source=function(e){return arguments.length?(o=Ct(e),t):o},t.target=function(e){return arguments.length?(i=Ct(e),t):i},t.startAngle=function(e){return arguments.length?(s=Ct(e),t):s},t.endAngle=function(e){return arguments.length?(c=Ct(e),t):c},t},ui.svg.diagonal=function(){function t(t,a){var o=e.call(this,t,a),i=n.call(this,t,a),l=(o.y+i.y)/2,s=[o,{x:o.x,y:l},{x:i.x,y:l},i];return s=s.map(r),"M"+s[0]+"C"+s[1]+" "+s[2]+" "+s[3]}var e=_n,n=wn,r=Xo;return t.source=function(n){return arguments.length?(e=Ct(n),t):e},t.target=function(e){return arguments.length?(n=Ct(e),t):n},t.projection=function(e){return arguments.length?(r=e,t):r},t},ui.svg.diagonal.radial=function(){var t=ui.svg.diagonal(),e=Xo,n=t.projection;return t.projection=function(t){return arguments.length?n(Zo(e=t)):e},t},ui.svg.symbol=function(){function t(t,r){return(Rs.get(e.call(this,t,r))||Qo)(n.call(this,t,r))}var e=Wo,n=Go;return t.type=function(n){return arguments.length?(e=Ct(n),t):e},t.size=function(e){return arguments.length?(n=Ct(e),t):n},t};var Rs=ui.map({circle:Qo,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*js)),n=e*js;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",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/Fs),n=e*Fs/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Fs),n=e*Fs/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});ui.svg.symbolTypes=Rs.keys();var Fs=Math.sqrt(3),js=Math.tan(30*Vi);zi.transition=function(t){for(var e,n,r=Bs||++Ys,a=ei(t),o=[],i=qs||{time:Date.now(),ease:Cr,delay:0,duration:250},l=-1,s=this.length;++lrect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",d[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==ui.event.keyCode&&(z||(x=null,O[0]-=f[1],O[1]-=d[1],z=2),T())}function g(){32==ui.event.keyCode&&2==z&&(O[0]+=f[1],O[1]+=d[1],z=0,T())}function m(){var t=ui.mouse(_),r=!1;b&&(t[0]+=b[0],t[1]+=b[1]),z||(ui.event.altKey?(x||(x=[(f[0]+f[1])/2,(d[0]+d[1])/2]),O[0]=f[+(t[0]0&&this._events[t].length>n&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!a(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,l;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||a(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(n)){for(l=o;l-- >0;)if(n[l]===e||n[l].listener&&n[l].listener===e){r=l;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;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(n=this._events[t],a(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],13:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;r13)&&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}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return t-t<1}},{}],14:[function(t,e,n){function r(t,e){var n=e[0],r=e[1],a=e[2],o=e[3],i=n+n,l=r+r,s=a+a,c=n*i,u=r*i,f=r*l,d=a*i,h=a*l,p=a*s,g=o*i,m=o*l,v=o*s;return t[0]=1-f-p,t[1]=u+v,t[2]=d-m,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+m,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=r},{}],15:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function i(t){if(d===clearTimeout)return clearTimeout(t);if((d===a||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{return d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}function l(){m&&p&&(m=!1,p.length?g=p.concat(g):v=-1,g.length&&s())}function s(){if(!m){var t=o(l);m=!0;for(var e=g.length;e;){for(p=g,g=[];++v1)for(var n=1;n.5?s/(2-o-i):s/(o+i),o){case t:r=(e-n)/s+(e1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var a,o,i;if(t=C(t,360),e=C(e,100),n=C(n,100),0===e)a=o=i=n;else{var l=n<.5?n*(1+e):n+e-n*e,s=2*n-l;a=r(s,l,t+1/3),o=r(s,l,t),i=r(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function s(t,e,n){t=C(t,255),e=C(e,255),n=C(n,255);var r,a,o=U(t,e,n),i=Y(t,e,n),l=o,s=o-i;if(a=0===o?0:s/o,o==i)r=0;else{switch(o){case t:r=(e-n)/s+(e>1)+720)%360;--e;)a.h=(a.h+o)%360,i.push(r(a));return i}function A(t,e){e=e||6;for(var n=r(t).toHsv(),a=n.h,o=n.s,i=n.v,l=[],s=1/e;e--;)l.push(r({h:a,s:o,v:i})),i=(i+s)%1;return l}function T(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function C(t,n){O(t)&&(t="100%");var r=D(t);return t=Y(n,U(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function z(t){return Y(1,U(0,t))}function S(t){return parseInt(t,16)}function O(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function D(t){return"string"==typeof t&&t.indexOf("%")!=-1}function P(t){return 1==t.length?"0"+t:""+t}function E(t){return t<=1&&(t=100*t+"%"),t}function N(t){return e.round(255*parseFloat(t)).toString(16)}function I(t){return S(t)/255}function R(t){return!!W.CSS_UNIT.exec(t)}function F(t){t=t.replace(B,"").replace(q,"").toLowerCase();var e=!1;if(Z[t])t=Z[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=W.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=W.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=W.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=W.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=W.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=W.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=W.hex8.exec(t))?{r:S(n[1]),g:S(n[2]),b:S(n[3]),a:I(n[4]),format:e?"name":"hex8"}:(n=W.hex6.exec(t))?{r:S(n[1]),g:S(n[2]),b:S(n[3]),format:e?"name":"hex"}:(n=W.hex4.exec(t))?{r:S(n[1]+""+n[1]),g:S(n[2]+""+n[2]),b:S(n[3]+""+n[3]),a:I(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=W.hex3.exec(t))&&{r:S(n[1]+""+n[1]),g:S(n[2]+""+n[2]),b:S(n[3]+""+n[3]),format:e?"name":"hex"}}function j(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var B=/^\s+/,q=/\s+$/,H=0,V=e.round,Y=e.min,U=e.max,X=e.random;r.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,a,o,i,l=this.toRgb();return t=l.r/255,n=l.g/255,r=l.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),i=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),.2126*a+.7152*o+.0722*i},setAlpha:function(t){return this._a=L(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*C(this._r,255))+"%",g:V(100*C(this._g,255))+"%",b:V(100*C(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%)":"rgba("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(G[u(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),n=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=r(t);n="#"+d(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,a=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return r(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},r.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?n[a]=t[a]:n[a]=E(t[a]));t=n}return r(t,e)},r.equals=function(t,e){return!(!t||!e)&&r(t).toRgbString()==r(e).toRgbString()},r.random=function(){return r.fromRatio({r:X(),g:X(),b:X()})},r.mix=function(t,e,n){n=0===n?0:n||50;var a=r(t).toRgb(),o=r(e).toRgb(),i=n/100,l={r:(o.r-a.r)*i+a.r,g:(o.g-a.g)*i+a.g,b:(o.b-a.b)*i+a.b,a:(o.a-a.a)*i+a.a};return r(l)},r.readability=function(t,n){var a=r(t),o=r(n);return(e.max(a.getLuminance(),o.getLuminance())+.05)/(e.min(a.getLuminance(),o.getLuminance())+.05)},r.isReadable=function(t,e,n){var a,o,i=r.readability(t,e);switch(o=!1,a=j(n),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},r.mostReadable=function(t,e,n){var a,o,i,l,s=null,c=0;n=n||{},o=n.includeFallbackColors,i=n.level,l=n.size;for(var u=0;uc&&(c=a,s=r(e[u]));return r.isReadable(t,s,{level:i,size:l})||!o?s:(n.includeFallbackColors=!1,r.mostReadable(t,["#fff","#000"],n))};var Z=r.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"},G=r.hexNames=T(Z),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+r),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})$/}}();"undefined"!=typeof n&&n.exports?n.exports=r:"function"==typeof t&&t.amd?t(function(){return r}):window.tinycolor=r}(Math)},{}],17:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../color"),o=t("../../plots/cartesian/axes"),i=t("./attributes");e.exports=function(t,e){function n(e,n){return r.coerce(t,l,i,e,n)}var l={};n("opacity"),n("align"),n("bgcolor");var s=n("bordercolor"),c=a.opacity(s);n("borderpad");var u=n("borderwidth"),f=n("showarrow");f&&(n("arrowcolor",c?l.bordercolor:a.defaultLine),n("arrowhead"),n("arrowsize"),n("arrowwidth",2*(c&&u||1)),n("ax"),n("ay"),n("axref"),n("ayref"),r.noneOrAll(t,l,["ax","ay"])),n("text",f?" ":"new text"),n("textangle"),r.coerceFont(n,"font",e.font);for(var d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:e},m=o.coerceRef(t,l,g,p),v=o.coerceARef(t,l,g,p),y=.5;if("paper"!==m){ -var x=o.getFromId(g,m);if(y=x.range[0]+y*(x.range[1]-x.range[0]),["date","category"].indexOf(x.type)!==-1&&"string"==typeof t[p]){var b;if("date"===x.type){if(b=r.dateTime2ms(t[p]),b!==!1&&(t[p]=b),v===m){var _=r.dateTime2ms(t["a"+p]);_!==!1&&(t["a"+p]=_)}}else(x._categories||[]).length&&(b=x._categories.indexOf(t[p]),b!==-1&&(t[p]=b))}}n(p,y),f||n(p+"anchor")}return r.noneOrAll(t,l,["x","y"]),l}},{"../../lib":116,"../../plots/cartesian/axes":142,"../color":26,"./attributes":19}],18:[function(t,e,n){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],19:[function(t,e,n){"use strict";var r=t("./arrow_paths"),a=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),i=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:i({},a,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:r.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":114,"../../plots/cartesian/constants":148,"../../plots/font_attributes":163,"./arrow_paths":18}],20:[function(t,e,n){"use strict";function r(t){var e=t._fullLayout;e.annotations.forEach(function(e){var n=o.getFromId(t,e.xref),r=o.getFromId(t,e.yref);if(n||r){var a=(e._xsize||0)/2,i=e._xshift||0,l=(e._ysize||0)/2,s=e._yshift||0,c=a-i,u=a+i,f=l-s,d=l+s;if(e.showarrow){var h=3*e.arrowsize*e.arrowwidth;c=Math.max(c,h),u=Math.max(u,h),f=Math.max(f,h),d=Math.max(d,h)}n&&n.autorange&&o.expand(n,[n.l2c(e.x)],{ppadplus:u,ppadminus:c}),r&&r.autorange&&o.expand(r,[r.l2c(e.y)],{ppadplus:d,ppadminus:f})}})}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,n=e.annotations;if(n.length&&t._fullData.length){var l={};n.forEach(function(t){l[t.xref]=!0,l[t.yref]=!0});var s=o.list(t).filter(function(t){return t.autorange&&l[t._id]});if(s.length)return a.syncOrAsync([i,r],t)}}},{"../../lib":116,"../../plots/cartesian/axes":142,"./draw":22}],21:[function(t,e,n){"use strict";var r=t("./annotation_defaults");e.exports=function(t,e){for(var n=t.annotations||[],a=e.annotations=[],o=0;o2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}rt.selectAll("tspan.line").attr({y:0,x:0});var r=$.select(".annotation-math-group"),a=!r.empty(),l=h.bBox((a?r:rt).node()),c=l.width,p=l.height,v=Math.round(c+2*tt),y=Math.round(p+2*tt);Y._w=c,Y._h=p;var b=!1;if(["x","y"].forEach(function(e){var r,a=Y[e+"ref"]||e,o=f.getFromId(t,a),i=(G+("x"===e?0:90))*Math.PI/180,l=v*Math.abs(Math.cos(i))+y*Math.abs(Math.sin(i)),s=Y[e+"anchor"];if(o){if(!o.autorange&&(Y[e]-o.range[0])*(Y[e]-o.range[1])>0&&(Y["a"+e+"ref"]===a?(Y["a"+e]-o.range[0])*(Y["a"+e]-o.range[1])>0&&(b=!0):b=!0,b))return;Z[e]=o._offset+o.l2p(Y[e]),r=.5}else r=Y[e],"y"===e&&(r=1-r),Z[e]="x"===e?D.l+D.w*r:D.t+D.h*r;var c=0;Y["a"+e+"ref"]===a?Z["aa"+e]=o._offset+o.l2p(Y["a"+e]):(c=Y.showarrow?Y["a"+e]:l*n(r,s),Z[e]+=c),Y["_"+e+"type"]=o&&o.type,Y["_"+e+"size"]=l,Y["_"+e+"shift"]=c}),b)return void $.remove();var _,w;Y.showarrow&&(_=Y.axref===Y.xref?Z.x:u.constrain(Z.x-Y.ax,1,M.width-1),w=Y.ayref===Y.yref?Z.y:u.constrain(Z.y-Y.ay,1,M.height-1)),Z.x=u.constrain(Z.x,1,M.width-1),Z.y=u.constrain(Z.y,1,M.height-1);var k=tt-l.top,A=tt-l.left;a?r.select("svg").attr({x:tt-1,y:tt}):(rt.attr({x:A,y:k}),rt.selectAll("tspan.line").attr({y:k,x:A})),et.call(h.setRect,J/2,J/2,v-J,y-J);var T=0,L=0;T=Y.axref===Y.xref?Math.round(Z.aax-v/2):Math.round(Z.x-v/2),L=Y.ayref===Y.yref?Math.round(Z.aay-y/2):Math.round(Z.y-y/2),$.call(u.setTranslate,T,L);var C="annotations["+e+"]",z=function(n,r){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=Y.axref===Y.xref?Z.aax+n:Z.x+n,l=Y.ayref===Y.yref?Z.aay+r:Z.y+r;var c=u.rotationXYMatrix(G,a,l),f=u.apply2DTransform(c),h=u.apply2DTransform2(c),p=et.attr("width")/2,g=et.attr("height")/2,v=[[a-p,l-g,a-p,l+g],[a-p,l+g,a+p,l+g],[a+p,l+g,a+p,l-g],[a+p,l-g,a-p,l-g]].map(h);if(!v.reduce(function(t,e){return t^!!o(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=o(a,l,_,w,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var y=Y.arrowwidth,b=Y.arrowcolor,k=W.append("g").style({opacity:d.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=k.append("path").attr("d","M"+a+","+l+"L"+_+","+w).style("stroke-width",y+"px").call(d.stroke,d.rgb(b));x(M,Y.arrowhead,"end",Y.arrowsize);var A=k.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-_)+","+(l-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,z;m.init({element:A.node(),prepFn:function(){var t=u.getTranslate($);L=t.x,z=t.y,T={},U&&U.autorange&&(T[U._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){k.attr("transform","translate("+t+","+e+")");var n=f(L,z),r=n[0]+t,a=n[1]+e;$.call(u.setTranslate,r,a),T[C+".x"]=U?Y.x+t/U._m:(_+t-D.l)/D.w,T[C+".y"]=X?Y.y+e/X._m:1-(w+e-D.t)/D.h,Y.axref===Y.xref&&(T[C+".ax"]=U?Y.ax+t/U._m:(_+t-D.l)/D.w),Y.ayref===Y.yref&&(T[C+".ay"]=X?Y.ay+e/X._m:1-(w+e-D.t)/D.h),Q.attr({transform:"rotate("+G+","+r+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};Y.showarrow&&z(0,0);var S=u.rotationXYMatrix(G,Z.x,Z.y),O=u.apply2DTransform(S);if(t._context.editable){var P,E,N;m.init({element:$.node(),prepFn:function(){var t=u.getTranslate($);P=t.x,E=t.y,N={}},moveFn:function(t,e){$.call(u.setTranslate,P+t,E+e);var n="pointer";if(Y.showarrow)Y.axref===Y.xref?N[C+".ax"]=U.p2l(U.l2p(Y.ax)+t):N[C+".ax"]=Y.ax+t,Y.ayref===Y.yref?N[C+".ay"]=X.p2l(X.l2p(Y.ay)+e):N[C+".ay"]=Y.ay+e,z(t,e);else{if(U)N[C+".x"]=Y.x+t/U._m;else{var r=Y._xsize/D.w,a=Y.x+Y._xshift/D.w-r/2;N[C+".x"]=m.align(a+t/D.w,r,0,1,Y.xanchor)}if(X)N[C+".y"]=Y.y+e/X._m;else{var o=Y._ysize/D.h,i=Y.y-Y._yshift/D.h-o/2;N[C+".y"]=m.align(i-e/D.h,o,0,1,Y.yanchor)}U&&X||(n=m.getCursor(U?.5:N[C+".x"],X?.5:N[C+".y"],Y.xanchor,Y.yanchor))}var l=O(P,E),s=l[0]+t,c=l[1]+e;$.call(u.setTranslate,P+t,E+e),Q.attr({transform:"rotate("+G+","+s+","+c+")"}),g($,n)},doneFn:function(e){if(g($),e){s.relayout(t,N);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var w,k=t.layout,M=t._fullLayout;if(!l(e)||e===-1){if(!e&&Array.isArray(c))return k.annotations=c,y(k,M),void r(t);if("remove"===c)return delete k.annotations,M.annotations=[],void r(t);if(n&&"add"!==c){for(w=0;we;w--)M._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),a(t,w)}}M._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=k.annotations[e],L=M.annotations[e];if(T){var C={xref:T.xref,yref:T.yref},z={};"string"==typeof n&&n?z[n]=c:u.isPlainObject(n)&&(z=n);var S=Object.keys(z);for(w=0;w4/3&&(R=H)}}else I&&(j&&(R<1/3?R+=q:R>2/3&&(R-=q)),R=(R-I.domain[0])/(I.domain[1]-I.domain[0]),R=I.range[0]+R*(I.range[1]-I.range[0]))}I&&I===N&&F&&("log"===F&&"log"!==I.type?R=Math.pow(10,R):"log"!==F&&"log"===I.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),T[E]=R}}var Y=v(T,M);M.annotations[e]=Y;var U=f.getFromId(t,Y.xref),X=f.getFromId(t,Y.yref),Z={x:0,y:0},G=+Y.textangle||0,W=M._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",Y.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:Y})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),J=Y.borderwidth,K=Y.borderpad,tt=J+K,et=$.append("rect").attr("class","bg").style("stroke-width",J+"px").call(d.stroke,Y.bordercolor).call(d.fill,Y.bgcolor),nt=Y.font,rt=$.append("text").classed("annotation",!0).attr("data-unformatted",Y.text).text(Y.text);t._context.editable?rt.call(p.makeEditable,$).call(b).on("edit",function(n){Y.text=n,this.attr({"data-unformatted":Y.text}),this.call(b);var r={};r["annotations["+e+"].text"]=Y.text,U&&U.autorange&&(r[U._name+".autorange"]=!0),X&&X.autorange&&(r[X._name+".autorange"]=!0),s.relayout(t,r)}):rt.call(b),Q.attr({transform:"rotate("+G+","+Z.x+","+Z.y+")"}).call(h.setPosition,Z.x,Z.y)}}function o(t,e,n,r,a,o,i,l){var s=n-t,c=a-t,u=i-a,f=r-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,m=(c*f-s*d)/p;return m<0||m>1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:r,drawOne:a}},{"../../lib":116,"../../lib/setcursor":126,"../../lib/svg_text_utils":128,"../../plotly":138,"../../plots/cartesian/axes":142,"../../plots/plots":167,"../color":26,"../dragelement":48,"../drawing":50,"./annotation_defaults":17,"./defaults":21,"./draw_arrow_head":23,d3:10,"fast-isnumeric":13}],23:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../color"),i=t("../drawing"),l=t("./arrow_paths");e.exports=function(t,e,n,s){a(s)||(s=1);var c=t.node(),u=l[e||0];if(u){"string"==typeof n&&n||(n="end");var f,d,h,p,g=(i.getPx(t,"stroke-width")||1)*s,m=t.style("stroke")||o.defaultLine,v=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,b=u.backoff*g;if("line"===c.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},d={x:+t.attr("x2"),y:+t.attr("y2")},h=Math.atan2(f.y-d.y,f.x-d.x),p=h+Math.PI,b){var _=b*Math.cos(h),w=b*Math.sin(h);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(d.x+=_,d.y+=w,t.attr({x2:d.x,y2:d.y}))}}else if("path"===c.nodeName){var k=c.getTotalLength(),M="";if(y){var A=c.getPointAtLength(0),T=c.getPointAtLength(.1);h=Math.atan2(A.y-T.y,A.x-T.x),f=c.getPointAtLength(Math.min(b,k)),b&&(M="0px,"+b+"px,")}if(x){var L=c.getPointAtLength(k),C=c.getPointAtLength(k-.1);if(p=Math.atan2(L.y-C.y,L.x-C.x),d=c.getPointAtLength(Math.max(0,k-b)),b){var z=M?2*b:b;M+=k-z+"px,"+k+"px"}}else M&&(M+=k+"px");M&&t.style("stroke-dasharray",M)}var S=function(n,a){e>5&&(a=0),r.select(c.parentElement).append("path").attr({class:t.attr("class"),d:u.path,transform:"translate("+n.x+","+n.y+")rotate("+180*a/Math.PI+")scale("+g+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&S(f,h),x&&S(d,p)}}},{"../color":26,"../drawing":50,"./arrow_paths":18,d3:10,"fast-isnumeric":13}],24:[function(t,e,n){"use strict";var r=t("../../plotly");n.moduleType="component",n.name="annotations",n.ARROWPATHS=t("./arrow_paths"),n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.calcAutorange=t("./calc_autorange"),n.arrowhead=t("./draw_arrow_head");var a=t("./draw");n.draw=a.draw,n.drawOne=a.drawOne,n.add=function(t){var e=t._fullLayout.annotations.length;r.relayout(t,"annotations["+e+"]","add")}},{"../../plotly":138,"./arrow_paths":18,"./attributes":19,"./calc_autorange":20,"./defaults":21,"./draw":22,"./draw_arrow_head":23}],25:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],26:[function(t,e,n){"use strict";function r(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===r.length;if(!a&&3!==r.length)return t;for(var i=0;i=0))return t;if(3===i)r[i]>1&&(r[i]=1);else if(r[i]>=1)return t}var l=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return a?"rgba("+l+", "+r[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var n=a(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},i.combine=function(t,e){var n=a(t).toRgb();if(1===n.a)return a(t).toRgbString();var r=a(e||i.background).toRgb(),o=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},l={r:o.r*(1-n.a)+n.r*n.a,g:o.g*(1-n.a)+n.g*n.a,b:o.b*(1-n.a)+n.b*n.a};return a(l).toRgbString()},i.contrast=function(t,e,n){var r=a(t),o=r.isLight()?r.darken(n):r.lighten(e);return o.toString()},i.stroke=function(t,e){var n=a(e);t.style({stroke:i.tinyRGB(n),"stroke-opacity":n.getAlpha()})},i.fill=function(t,e){var n=a(e);t.style({fill:i.tinyRGB(n),"fill-opacity":n.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,n,a,o,l=Object.keys(t);for(e=0;el&&(o[1]-=(lt-l)/2)):n.node()&&!n.classed("js-placeholder")&&(lt=h.bBox(e.node()).height),lt){if(lt+=5,"top"===_.titleside)K.domain[1]-=lt/T.h,o[1]*=-1;else{K.domain[0]+=lt/T.h;var c=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),K.setScale()}}ot.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-K.domain[1]))+")");var f=ot.select(".cbfills").selectAll("rect.cbfill").data(S);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?C[0]:(S[e]+S[e-1])/2,e===S.length-1?C[1]:(S[e]+S[e+1])/2].map(K.c2p).map(Math.round);e!==S.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=D(t).replace("e-",""),i=a(o).toHexString();r.select(this).attr({x:Z,width:Math.max(B,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var d=ot.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?z:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){r.select(this).attr("d","M"+Z+","+(Math.round(K.c2p(t))+_.line.width/2%1)+"h"+B).call(h.lineGroupStyle,_.line.width,O(t),_.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=Z+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=K.titlefont.size,n=K._offset+K._length/2,a=T.l+(K.position||0)*T.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));k("h"+K._id+"title",{avoid:{selection:r.select(t).selectAll("g."+K._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:A.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function k(e,n){var r,a=b();r=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:K,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:ot.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;ot.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,n||{}))}function M(){var n=B+_.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(R=it.select("text"),R.node()&&!R.classed("js-placeholder")){var r,a=it.select(".h"+K._id+"title-math-group").node();r=a&&["top","bottom"].indexOf(_.titleside)!==-1?h.bBox(a).width:h.bBox(it.node()).right-Z-T.l,n=Math.max(n,r)}var o=2*_.xpad+n+_.borderwidth+_.outlinewidth/2,l=Q-$;ot.select(".cbbg").attr({x:Z-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-U,width:Math.max(o,2),height:Math.max(l+2*U,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),ot.selectAll(".cboutline").attr({x:Z,y:$+_.ypad+("top"===_.titleside?lt:0),width:Math.max(B,2),height:Math.max(l-2*_.ypad-lt,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var s=({center:.5,right:1}[_.xanchor]||0)*o;ot.attr("transform","translate("+(T.l-s)+","+T.t+")"),i.autoMargin(t,e,{x:_.x,y:_.y,l:o*({right:1,center:.5}[_.xanchor]||0),r:o*({left:1,center:.5}[_.xanchor]||0),t:l*({bottom:1,middle:.5}[_.yanchor]||0),b:l*({top:1,middle:.5}[_.yanchor]||0)})}var A=t._fullLayout,T=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var L,C=r.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),z=[],S=[],O="function"==typeof _.line.color?_.line.color:function(){return _.line.color},D="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},P=_.levels.end+_.levels.size/100,E=_.levels.size,N=1.001*C[0]-.001*C[1],I=1.001*C[1]-.001*C[0];for(L=_.levels.start;(L-P)*E<0;L+=E)L>N&&LC[0]&&L1){var at=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));et*=at*u.roundUp(rt/at,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+X,W+V-X],K.setScale();var ot=A._infolayer.selectAll("g."+e).data([0]);ot.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),ot.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var it=ot.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");K._axislayer=ot.select(".cbaxis");var lt=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var st,ct=T.l+(_.x+Y)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-X))*T.h+T.t+3+.75*ut:(1-(W+X))*T.h+T.t-3-.25*ut,k(K._id+"title",{attributes:{x:ct,y:st,"text-anchor":"start"}})}var ft=u.syncOrAsync([i.previousPromises,w,i.previousPromises,M],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var dt,ht,pt;c.init({element:ot.node(),prepFn:function(){dt=ot.attr("transform"),d(ot)},moveFn:function(t,e){ot.attr("transform",dt+" translate("+t+","+e+")"),ht=c.align(G+t/T.w,q,0,1,_.xanchor),pt=c.align(W-e/T.h,V,0,1,_.yanchor);var n=c.getCursor(ht,pt,_.xanchor,_.yanchor);d(ot,n)},doneFn:function(e){d(ot),e&&void 0!==ht&&void 0!==pt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":pt},b().index)}})}return ft}function b(){var n,r,a=e.substr(2);for(n=0;n=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":116,"./flip_scale":38,"./scales":45}],34:[function(t,e,n){"use strict";var r=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},r.colorscale,{}),cauto:a({},r.zauto,{}),cmax:a({},r.zmax,{}),cmin:a({},r.zmin,{}),autocolorscale:a({},r.autocolorscale,{}),reversescale:a({},r.reversescale,{})}}},{"../../lib/extend":114,"./attributes":32,"./scales.js":45}],35:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":45}],36:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,n,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,m=p[d+"min"],v=p[d+"max"],y=p.colorscale,x=r(m)&&r(v)&&m=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],39:[function(t,e,n){"use strict";var r=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=a),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":35,"./is_valid_scale_array":43,"./scales":45}],40:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?a.nestedProperty(t,e).get()||{}:t,i=n.color,l=!1;if(Array.isArray(i))for(var s=0;s4/3-l?i:l}},{}],47:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":116}],48:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=r},{"../../lib":116,"../../plotly":138,"../../plots/cartesian/constants":148,"./align":46,"./cursor":47,"./unhover":49}],49:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":113}],50:[function(t,e,n){"use strict";function r(t,e,n,r,a,o,i){if(l.traceIs(n,"symbols")){var c=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(n)?c(t.ms):(o.size||6)/2,t.mrc=e;var r=g.symbolNumber(t.mx||o.symbol)||0,a=r%100;return t.om=r%200>=100,g.symbolFuncs[a](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=r(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,n,r){var a=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(s.fill,r)},g.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},g.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},g.setRect=function(t,e,n,r,a){t.call(g.setPosition,e,n).call(g.setSize,r,a)},g.translatePoint=function(t,e,n,r){var a=t.xp||n.c2p(t.x),o=t.yp||r.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,n,r){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,n,r)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,n){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},g.singleLineStyle=function(t,e,n,r,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=n||o.width||0,l=a||o.dash||"";s.stroke(e,r||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=r||a.dash||"";o.select(this).call(s.stroke,n||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=o.select(this);try{n.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),n.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,n){var a=n.marker,o=a.line,i=(n._input||{}).marker||{},l=g.tryColorscale(a,i,""),s=g.tryColorscale(a,i,"line.");r(t,e,n,l,s,a,o)},g.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=(e._input||{}).marker||{},a=g.tryColorscale(n,r,""),i=g.tryColorscale(n,r,"line.");t.each(function(t){g.singlePointStyle(t,o.select(this),e,a,i)})}},g.tryColorscale=function(t,e,n){var r=u.nestedProperty(t,n+"color").get(),a=u.nestedProperty(t,n+"colorscale").get(),o=u.nestedProperty(t,n+"cauto").get(),l=u.nestedProperty(t,n+"cmin"),s=u.nestedProperty(t,n+"cmax"),f=l.get(),d=s.get();return a&&Array.isArray(r)?(!o&&i(f)&&i(d)||(f=1/0,d=-(1/0),r.forEach(function(t){i(t)&&(f>t&&(f=+t),dd&&(f=0,d=1),l.set(f),s.set(d),u.nestedProperty(e,n+"cmin").set(f),u.nestedProperty(e,n+"cmax").set(d)),c.makeColorScaleFunc(c.extractScale(a,f,d))):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var n=o.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,n.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(f.convertToTspans);var d=o.select(this.parentNode),h=n.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,m=x[s]*u,v=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+m+","+v+")"),p>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],o=[];for(n=1;n=A&&(o.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=o.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":108,"../../lib":116,"../../lib/svg_text_utils":128,"../../registry":174,"../../traces/scatter/make_bubble_size_func":252,"../../traces/scatter/subtypes":257,"../color":26,"../colorscale":41,"./symbol_defs":51,d3:10,"fast-isnumeric":13}],51:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:10}],52:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],53:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&["linear","log"].indexOf(n.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var m=g.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(n.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=r(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");l=!m.size(),l?m=e.append("path").classed("yerror",!0):u&&(m=m.transition().duration(n.duration).ease(n.easing)),m.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var v=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-v)+"v"+2*v+"m0,-"+v+"H"+i.xs,i.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":257,d3:10,"fast-isnumeric":13}],58:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":26,d3:10}],59:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":148}],60:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}e=e||{},r("source"),r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var l=0;l<2;l++){var s={_fullLayout:n},c=["x","y"][l];a.coerceRef(t,e,s,c,"paper")}return e}var a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var n=t.images,a=e.images=[],o=0;o=2/3},n.isCenterAnchor=function(t){ -return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],64:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":114,"../../plots/font_attributes":163,"../color/attributes":25}],65:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],66:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":116,"../../plots/layout_attributes":165,"../../registry":174,"./attributes":64,"./helpers":69}],67:[function(t,e,n){"use strict";function r(t,e){function n(n){v.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,v=Math.max(e.height,v)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,j,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,_=n.showlegend&&x(t.calcdata,v),k=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=n._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=M.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var z=L.selectAll("g.groups").data(_);z.enter().append("g").attr("class","groups"),z.exit().remove();var S=z.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,z,S),l(t));var D=0,P=n.width,E=0,N=n.height;i(t,z,S),v.height>N?s(t):l(t);var I=n._size,R=I.l+I.w*v.x,F=I.t+I.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?F-=v.height:w.isMiddleAnchor(v)&&(F-=v.height/2);var j=v.width,B=I.w;j>B?(R=I.l,j=B):(R+j>P&&(R=P-j),RH?(F=I.t,q=H):(F+q>N&&(F=N-q),Fn[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":116,"../../registry":174,"../../traces/pie/style_one":235,"../../traces/scatter/subtypes":257,"../color":26,"../drawing":50,d3:10}],72:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||v||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(m,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":116,"../color":26,"./attributes":76,"./button_attributes":77,"./constants":78}],80:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../plots/cartesian/axes"),o=t("./constants"),i=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=e.shapes;if(n.length&&t._fullData.length)for(var i=0;ie;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,z)},a=z.line.width?z.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",z.opacity).call(_.stroke,a).call(_.fill,z.fillcolor).call(w.dashLine,z.line.dash,z.line.width);S&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+S),t._context.editable&&f(t,o,z,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={xref:l.xref,yref:l.yref},c={};"string"==typeof n&&n?c[n]=r:x.isPlainObject(n)&&(c=n);var u=Object.keys(c);for(o=0;oX&&r>Z&&!t.shiftKey?k.getCursor(a/n,1-o/r):"move";M(e,i),U=i.split("-")[0]}function o(e){j=b.getFromId(t,n.xref),B=b.getFromId(t,n.yref),q=T.getDataToPixel(t,j),H=T.getDataToPixel(t,B,!0),V=T.getPixelToData(t,j),Y=T.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(R=n.path,F=o+".path"):(u=q(n.x0),f=H(n.y0),d=q(n.x1),h=H(n.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uZ&&(c[z]=n[P]=Y(l),c[S]=n[E]=Y(s)),f-u>X&&(c[O]=n[N]=V(u),c[D]=n[I]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,v,x,_,w,A,L,C,z,S,O,D,P,E,N,I,R,F,j,B,q,H,V,Y,U,X=10,Z=10,G={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=G.element.getBoundingClientRect();k.init(G)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.dataToLinear(l),r=function(t){return l._offset+l.l2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.dataToLinear(s),o=function(t){return s._offset+s.l2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults");e.exports={draw:r,drawOne:a}},{"../../lib":116,"../../lib/setcursor":126,"../../plotly":138,"../../plots/cartesian/axes":142,"../color":26,"../dragelement":48,"../drawing":50,"./constants":90,"./defaults":91,"./helpers":93,"./shape_defaults":95,"fast-isnumeric":13}],93:[function(t,e,n){"use strict";n.dataToLinear=function(t){return"category"===t.type?t.c2l:t.d2l},n.linearToData=function(t){return"category"===t.type?t.l2c:t.l2d},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.dataToLinear(e);a=function(t){return e._offset+e.l2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.linearToData(e);a=function(t){return i(e.p2l(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],94:[function(t,e,n){"use strict";n.moduleType="component",n.name="shapes",n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.calcAutorange=t("./calc_autorange");var r=t("./draw");n.draw=r.draw,n.drawOne=r.drawOne},{"./attributes":88,"./calc_autorange":89,"./defaults":91,"./draw":92}],95:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e){function n(e,n){return r.coerce(t,l,o,e,n)}var l={};n("layer"),n("opacity"),n("fillcolor"),n("line.color"),n("line.width"),n("line.dash");for(var s=t.path?"path":"rect",c=n("type",s),u=["x","y"],f=0;f<2;f++){var d=u[f],h={_fullLayout:e},p=a.coerceRef(t,l,h,d);if("path"!==c){var g=.25,m=.75;if("paper"!==p){var v=a.getFromId(h,p),y=i.linearToData(v);g=y(v.range[0]+g*(v.range[1]-v.range[0])),m=y(v.range[0]+m*(v.range[1]-v.range[0]))}n(d+"0",g),n(d+"1",m)}}return"path"===c?n("path"):r.noneOrAll(t,l,["x0","x1","y0","y1"]),l}},{"../../lib":116,"../../plots/cartesian/axes":142,"./attributes":88,"./helpers":93}],96:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":114,"../../plots/animation_attributes":139,"../../plots/font_attributes":163,"../../plots/pad_attributes":166,"./constants":97}],97:[function(t,e,n){"use strict";e.exports={name:"sliders",itemName:"slider",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],98:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}var l=a(t,e),s=r("visible",l.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,c,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*z.gripWidth)+","+e.currentValueTotalHeight+")"); -}}function v(t,e){return t.inputAreaStart+z.stepInset+(t.inputAreaLength-2*z.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-z.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*z.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+z.railTouchRectClass).data([0]);r.enter().append("rect").classed(z.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,z.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),M.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+z.railRectClass).data([0]);n.enter().append("rect").classed(z.railRectClass,!0);var r=e.inputAreaLength-2*z.railInset;n.attr({width:r,height:z.railWidth,rx:z.railRadius,ry:z.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(n,z.railInset,.5*(e.inputAreaWidth-z.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(z.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+z.groupClassName).data(n,a);s.enter().append("g").classed(z.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,z.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,z=O,k._infolayer.select("."+e).attr({"data-unformatted":z}).text(z).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,z=g.title.trim();""===z&&(L=0),z.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var S=w.selectAll("text").data([0]);S.enter().append("text"),S.text(z).attr("class",e),S.attr({"data-unformatted":z}).call(f);var O="Click to enter "+y+" title";t._context.editable?(z||p(),S.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):z&&!z.match(/Click to enter .+ title/)||S.remove(),S.classed("js-placeholder",C)}},{"../../lib":116,"../../lib/svg_text_utils":128,"../../plotly":138,"../../plots/plots":167,"../color":26,"../drawing":50,d3:10,"fast-isnumeric":13}],102:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":114,"../../plots/font_attributes":163,"../../plots/pad_attributes":166,"../color/attributes":25}],103:[function(t,e,n){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],104:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}var l=a(t,e),s=r("visible",l.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,c,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],108:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],109:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.19.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":24,"./components/images":62,"./components/legend":70,"./components/rangeselector":82,"./components/rangeslider":87,"./components/shapes":94,"./components/sliders":100,"./components/updatemenus":106,"./fonts/mathjax_config":110,"./lib/queue":124,"./plot_api/plot_schema":132,"./plot_api/register":133,"./plot_api/set_plot_config":134,"./plot_api/to_image":136,"./plot_api/validate":137,"./plotly":138,"./snapshot":179,"./snapshot/download":176,"./traces/scatter":247,d3:10,"es6-promise":11}],110:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],111:[function(t,e,n){"use strict";function r(t){return t&&void 0!==t.valType}var a=t("fast-isnumeric"),o=t("tinycolor2"),i=t("./nested_property"),l=t("./is_plain_object"),s=t("./filter_unique"),c=t("../components/colorscale/get_scale"),u=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,r){!a(t)||void 0!==r.min&&tr.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,r){t%1||!a(t)||void 0!==r.min&&tr.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){o(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(c(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):a(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&u.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!u.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o2)return!1;var i=o[0].split("-");if(i.length>3||3!==i.length&&o[1])return!1;if(4===i[0].length)e=Number(i[0]);else{if(2!==i[0].length)return!1;var s=(new Date).getFullYear();e=((Number(i[0])-s+70)%100+200)%100+s-70}return!!l(e)&&(1===i.length?new Date(e,0,1).getTime():(n=Number(i[1])-1,!(i[1].length>2)&&n>=0&&n<=11&&(2===i.length?new Date(e,n,1).getTime():(r=Number(i[2]),!(i[2].length>2)&&r>=1&&r<=31&&(r=new Date(e,n,r).getTime(),o[1]?(i=o[1].split(":"),!(i.length>3)&&(a=Number(i[0]),!(i[0].length>2)&&a>=0&&a<=23&&(r+=36e5*a,1===i.length?r:(n=Number(i[1]),!(i[1].length>2)&&n>=0&&n<=59&&(r+=6e4*n,2===i.length?r:(t=Number(i[2]),t>=0&&t<60&&r+1e3*t)))))):r)))))},n.isDateTime=function(t){return n.dateTime2ms(t)!==!1},n.ms2DateTime=function(t,e){e||(e=0);var n=new Date(t),a=i.time.format("%Y-%m-%d")(n);return e<7776e6?(a+=" "+r(n.getHours(),2),e<432e6&&(a+=":"+r(n.getMinutes(),2),e<108e5&&(a+=":"+r(n.getSeconds(),2),e<3e5&&(a+="."+r(n.getMilliseconds(),3)))),a.replace(/([:\s]00)*\.?[0]*$/,"")):a};var s={H:["%H:%M:%S~%L","%H:%M:%S","%H:%M"],I:["%I:%M:%S~%L%p","%I:%M:%S%p","%I:%M%p"],D:["%H","%I%p","%Hh"]},c={Y:["%Y~%m~%d","%Y%m%d","%y%m%d","%m~%d~%Y","%d~%m~%Y"],Yb:["%b~%d~%Y","%d~%b~%Y","%Y~%d~%b","%Y~%b~%d"],y:["%m~%d~%y","%d~%m~%y","%y~%m~%d"],yb:["%b~%d~%y","%d~%b~%y","%y~%d~%b","%y~%b~%d"]},u=i.time.format.utc,f={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(u),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(u)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(u)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){f[t].D.push(u(e)),["H","I","D"].forEach(function(n){s[n].forEach(function(r){var a=f[t][n];a.push(u(e+"~"+r)),a.push(u(r+"~"+e))})})})});var d=/[a-z]*/g,h=function(t){return t.substr(0,3)},p=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,g=/[\s,\/\-\.\(\)]+/g,m=/~?([ap])~?m(~|$)/,v=function(t,e){return e+"m "},y=/\d\d\d\d/,x=/(^|~)[a-z]{3}/,b=/[ap]m/,_=/:/,w=/q([1-4])/,k=["31~mar","30~jun","30~sep","31~dec"],M=function(t,e){return k[e-1]},A=/ ?([+\-]\d\d:?\d\d|Z)$/;n.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(d,h).replace(p,"").replace(g,"~").replace(m,v).replace(w,M).trim().replace(A,"");var e,n,r=null,i=a(t),l=o(t);e=f[i][l],n=e.length;for(var s=0;sn?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"./coerce":111,"./dates":112,"./extend":114,"./filter_unique":115,"./is_array":117,"./is_plain_object":118,"./loggers":119,"./matrix":120,"./nested_property":121,"./notifier":122,"./search":125,"./stats":127,d3:10}],117:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],118:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],119:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],i=!1,d(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");lo||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],s=t[1];if(no||sl)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],m=r[0][1],v=0;for(c=1;cMath.max(u,g)||s>Math.max(f,m)))if(su||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":120}],124:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;f90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":13}],128:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,m.indexOf(u.protocol)===-1?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||r(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":107,"../constants/xmlns_namespaces":108,"../lib":116,d3:10}],129:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function a(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var a=f.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=u.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&l(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sO.range[0]?[1,2]:[2,1]);else{var D=O.range[0],P=O.range[1];"log"===b?(D<=0&&P<=0&&n(L+".autorange",!0),D<=0?D=P/1e6:P<=0&&(P=D/1e6),n(L+".range[0]",Math.log(D)/Math.LN10),n(L+".range[1]",Math.log(P)/Math.LN10)):(n(L+".range[0]",Math.pow(10,D)),n(L+".range[1]",Math.pow(10,P)))}else n(L+".autorange",!0)}if("reverse"===A)C.range?C.range.reverse():(n(L+".autorange",!0),C.range=[1,0]),z.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var E=v.parts[1],N=v.parts[0],I=o[N]||[],R=I[E]||{};null===b&&(e[m]="remove"),2===v.parts.length&&("add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?E===-1?(g[N]=I,delete g[m]):g[m]=R:x.log("???",e)),!r(R,"x")&&!r(R,"y")||x.containsAny(m,["color","opacity","align","dash"])||(h.docalc=!0);var F=w.getComponentMethod(N,"drawOne");F(t,E,v.parts.slice(2).join("."),e[m]),delete e[m]}else k.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1]?(S.manageArrayContainers(v,b,g),h.doplot=!0):(0===v.parts[0].indexOf("scene")?h.doplot=!0:0===v.parts[0].indexOf("geo")?h.doplot=!0:0===v.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===m?h.doplot=!0:!i._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?h.docalc=!0:v.parts[0].indexOf("legend")!==-1?h.dolegend=!0:m.indexOf("title")!==-1?h.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(v.parts[1],["tick","exponent","grid","zeroline"])?h.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:v.parts.length>1&&v.parts[1].indexOf("line")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&"mirror"===v.parts[1]?h.doticks=h.dolayoutstyle=!0:"margin.pad"===m?h.doticks=h.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(h.doplot=!0):h.doplot=!0,v.set(b))}}var j=t._fullLayout.width,B=t._fullLayout.height;k.supplyDefaults(t),t.layout.autosize&&k.plotAutoSize(t,t.layout,t._fullLayout);var q=e.height||e.width||t._fullLayout.width!==j||t._fullLayout.height!==B;return q&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];m.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(C.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var o=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=o.append("g").classed("imagelayer",!0),n._shapeUpperLayer=o.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),k=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),C=t("../constants/xmlns_namespaces"),z=t("../lib/svg_text_utils"),S=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,n,r){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=D._basePlotModules,n=0;n=i.length?i[0]:i[t]:i}function a(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}if(t=S.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),n=k.supplyAnimationDefaults(n);var i=n.transition,l=n.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,s){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function u(e){if(0!==e.length){for(var i=0;io._timeToNext&&d()};e()}function p(t){return Array.isArray(i)?v>=i.length?t.transitionOpts=i[v]:t.transitionOpts=i[0]:t.transitionOpts=i,v++,t}var g,m,v=0,y=[],b=void 0===e||null===e,_=Array.isArray(e),w=!b&&!_&&x.isPlainObject(e);if(w)y.push({type:"object",data:p(x.extendFlat({},e))});else if(b||"string"==typeof e)for(g=0;g0&&TT)&&L.push(m);y=L}}y.length>0?u(y):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,n){if(t=S.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,a,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(r=e.length-1;r>=0;r--)u.push({frame:k.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:c+r});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(a=u[r].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=k.modifyFrames,s=k.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),k.modifyFrames(t,o)},y.purge=function(t){t=S.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return k.cleanPlot([],{},n,e),k.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":50,"../components/errorbars":56,"../constants/xmlns_namespaces":108,"../lib":116,"../lib/events":113,"../lib/queue":124,"../lib/svg_text_utils":128,"../plotly":138,"../plots/cartesian/graph_interact":150,"../plots/plots":167,"../plots/polar":170,"../registry":174,"./helpers":129,"./subroutines":135,d3:10,"fast-isnumeric":13}],131:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],132:[function(t,e,n){"use strict";function r(t){var e=y.attributes,n=c({type:t}),r=f(t),a=h(t),o={},i={};o.type=null,k(o,e),o=l(n.attributes,o,"attributes",t),void 0!==a.attributes&&k(o,a.attributes),o.type=t,o=u(o),s(o),L.traces[t]=w({},r,{attributes:o}),void 0!==n.layoutAttributes&&(i=l(n.layoutAttributes,i,"layoutAttributes",t),s(i),L.traces[t].layoutAttributes=i)}function a(){var t=y.layoutAttributes,e={};e=l(t,e,"layoutAttributes","*"),e=d(e),e=p(e),e=u(e),s(e),g(e),L.layout={layoutAttributes:e}}function o(t){var e=v.transformsRegistry[t],n={};n=l(n,e.attributes||{},"attributes","*"),n=u(n),s(n),g(n),L.transforms[t]={attributes:n}}function i(){L.defs={valObjects:x.valObjects,metaKeys:x.UNDERSCORE_ATTRS.concat(["description","role"])}}function l(t,e,n,r){var a,o,i,s,u;return Object.keys(t).forEach(function(f){return f===A?void Object.keys(t[f]).forEach(function(s){a=c({_module:t[f][s]}),void 0!==a&&(o=a[n],i=l(o,{},n,r),x.nestedProperty(e,s).set(k({},i)))}):f===T?void Object.keys(t[f]).forEach(function(a){a===r&&(s=c({_module:t[f][a]}),void 0!==s&&(u=s[n],u=l(u,{},n,r),M(e,u)))}):void(e[f]=x.isPlainObject(t[f])?M({},t[f]):t[f])}),e}function s(t){function e(t){return{valType:"string"}}function n(t,n,r){C.isValObject(t)?"data_array"===t.valType?(t.role="data",r[n+"src"]=e(n)):t.arrayOk===!0&&(r[n+"src"]=e(n)):x.isPlainObject(t)&&(t.role="object")}x.crawl(t,n)}function c(t){if("type"in t)return"area"===t.type?{attributes:b}:v.getModule({type:t.type});var e=v.subplotsRegistry,n=v.componentsRegistry,r=t._module;return e[r]?e[r]:n[r]?n[r]:m[r]}function u(t){return Object.keys(t).forEach(function(e){"_"===e.charAt(0)&&x.UNDERSCORE_ATTRS.indexOf(e)===-1&&delete t[e]}),t}function f(t){return"area"===t?{}:v.modules[t].meta||{}}function d(t){return w(t,{radialaxis:_.radialaxis,angularaxis:_.angularaxis}),w(t,_.layout),t}function h(t){if("area"===t)return{};var e=v.subplotsRegistry,n=Object.keys(e).filter(function(e){return v.traceIs({type:t},e)})[0];return void 0===n?{}:e[n]}function p(t){var e=v.subplotsRegistry;return Object.keys(t).forEach(function(n){Object.keys(e).forEach(function(r){var a,o=e[r];o.attrRegex&&(a="cartesian"===r||"gl2d"===r?o.attrRegex.x.test(n)||o.attrRegex.y.test(n):o.attrRegex.test(n),a&&(t[n][x.IS_SUBPLOT_OBJ]=!0))})}),t}function g(t){function e(t,e,n){if(t[x.IS_LINKED_TO_ARRAY]===!0){var r=e.substr(0,e.length-1);delete t[x.IS_LINKED_TO_ARRAY],n[e]={items:{}},n[e].items[r]=t,n[e].role="object"}}x.crawl(t,e)}var m=t("../plotly"),v=t("../registry"),y=t("../plots/plots"),x=t("../lib"),b=t("../plots/polar/area_attributes"),_=t("../plots/polar/axis_attributes"),w=x.extendFlat,k=x.extendDeep,M=x.extendDeepAll,A="_nestedModules",T="_composedModules",L={traces:{},layout:{},transforms:{},defs:{}},C=e.exports={};C.get=function(){return v.allTypes.concat("area").forEach(r),a(),Object.keys(v.transformsRegistry).forEach(o),i(),L},C.crawl=x.crawl,C.isValObject=x.isValObject},{"../lib":116,"../plotly":138,"../plots/plots":167,"../plots/polar/area_attributes":168,"../plots/polar/axis_attributes":169,"../registry":174}],133:[function(t,e,n){"use strict";function r(t){i.register(t,t.name,t.categories,t.meta),i.subplotsRegistry[t.basePlotModule.name]||i.registerSubplot(t.basePlotModule)}function a(t){if("string"!=typeof t.name)throw new Error("Transform module *name* must be a string.");var e="Transform module "+t.name,n="function"==typeof t.transform,r="function"==typeof t.calcTransform;if(!n&&!r)throw new Error(e+" is missing a *transform* or *calcTransform* method.");n&&r&&l.log([e+" has both a *transform* and *calcTransform* methods.","Please note that all *transform* methods are executed","before all *calcTransform* methods."].join(" ")),l.isPlainObject(t.attributes)||l.log(e+" registered without an *attributes* object."),"function"!=typeof t.supplyDefaults&&l.log(e+" registered without a *supplyDefaults* method."),i.transformsRegistry[t.name]=t}function o(t){i.componentsRegistry[t.name]=t}var i=t("../registry"),l=t("../lib");e.exports=function(t){if(!t)throw new Error("No argument passed to Plotly.register.");t&&!Array.isArray(t)&&(t=[t]);for(var e=0;e1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.td;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":116,"../plotly":138,"../snapshot/cloneplot":175,"../snapshot/helpers":178,"../snapshot/svgtoimg":180,"../snapshot/tosvg":182,"fast-isnumeric":13}],137:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=n.length,v=0;vc&&e=864e5?t._tickround="d":n>=36e5?t._tickround="H":n>=6e4?t._tickround="M":n>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(n/2)/Math.LN10);else{x(n)||(n=Number(n.substr(1))),t._tickround=2-Math.floor(Math.log(n)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var r=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(r)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((r-1)/3):t._tickexponent=r)}else"M"===n.charAt(0)?t._tickround=2===n.length?"m":"y":t._tickround=null}function i(t,e){var n=t.match(q),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(q,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o=e.x,l=t._tickround,s=new Date(o),c="";n&&t.hoverformat?a=i(t.hoverformat,o):t.tickformat?a=i(t.tickformat,o):(r&&(x(l)?l+=2:l={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[l]),"y"===l?a=N(s):"m"===l?a=I(s):(o!==t._tmin||n||(c="
"+N(s)),"d"===l?a=R(s):"H"===l?a=F(s):(o!==t._tmin||n||(c="
"+R(s)+", "+N(s)),a=j(s),"M"!==l&&(a+=B(s),"S"!==l&&(a+=d(v(o/1e3,1),t,"none",n).substr(1)))))),e.text=a+c}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=t<0,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=H[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var p=r-1,g=r+1;n="tozero"===t.rangemode?r<0?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var n=T.list(t,"",!0),r=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},T.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[o,i]};T.autoTicks(f,l);var d,h=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var a=t.range[1]=l:s<=l)&&(i.push(s),!(i.length>1e3));s=T.tickIncrement(s,t.dtick,a));t._tmax=i[i.length-1];for(var c=new Array(i.length),u=0;u157788e5?(e/=315576e5,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,z)):e>12096e5?(e/=26298e5,t.dtick="M"+a(e,1,S)):e>432e5?(t.dtick=a(e,864e5,D),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=a(e,36e5,S):e>3e4?t.dtick=a(e,6e4,O):e>500?t.dtick=a(e,1e3,O):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,z));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var r=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/r,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,z)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,z));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?E:P,s=t+.01*r,c=_.roundUp(v(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]r:c1&&e2*r}function o(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("./clean_datum");e.exports=function(t){return a(t)?"date":o(t)?"category":r(t)?"linear":"-"}},{"../../lib":116,"./clean_datum":147,"fast-isnumeric":13}],144:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var l=i(e,n,r);if(l){if("histogram"===l.type&&r==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,r)){for(var s,u=a(l),f=[],d=0;d0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],147:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return a.ms2DateTime(t);if("string"!=typeof t&&!r(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){a.error(e,t)}return t}},{"../../lib":116,"fast-isnumeric":13}],148:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],149:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?f.ms2DateTime(r,a):"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,n,l,_,w,k,M){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+mt+", "+vt+")").attr("d",ut+"Z"),pt=gt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+mt+", "+vt+")").attr("d","M0,0Z"),z();for(var o=0;o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),pt.transition().style("opacity",1).duration(200),ft=!0)}function O(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),b=!1)))}function P(e,n){var a=1===(k+M).length;if(e)F();else if(2!==n||a){if(1===n&&a){var o=k?V[0]:H[0],i="s"===k||"w"===M?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",f="middle";if(o.fixedrange)return;k?(f="n"===k?"top":"bottom","right"===o.side&&(u="right")):"e"===M&&(u="right"),rt.call(d.makeEditable,null,{immediate:!0,background:B.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var n="category"===o.type?o.c2l(e):o.d2l(e);void 0!==n&&c.relayout(t,l,n)})}}else R()}function E(e){function n(t,e,n){if(!t.fixedrange){T(t.range);var r=t.range,a=r[0]+(r[1]-r[0])*e;t.range=[a+(r[0]-a)*n,a+(r[1]-a)*n]}}if(t._context.scrollZoom||B._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(L(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(xt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=_t.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=yt[0]+yt[2]*s,u=(l.bottom-e.clientY)/l.height,d=yt[1]+yt[3]*(1-u);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,n){for(var r=1-e,o=0,i=0;i0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rG.width||Z<0||Z>G.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:M[0]._length/2,Z="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?r(o,e.xval):a(M,X),D="yval"in e?r(o,e.yval):a(A,Z),!g(O[0])||!g(D[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(E=0;E1||I.hoverinfo.indexOf("name")!==-1?I.name:void 0,index:!1,distance:Math.min(W,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[R]&&(H.subplot=i[R]._subplot),V=Y.length,"array"===j){var Q=e[E];"pointNumber"in Q?(H.index=Q.pointNumber,j="closest"):(j="","xval"in Q&&(B=Q.xval,j="x"),"yval"in Q&&(q=Q.yval,j=j?"closest":"y"))}else B=O[F],q=D[F];if(I._module&&I._module.hoverPoints){var $=I._module.hoverPoints(H,B,q,j);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&Y.push(s(J,S))}else m.log("Unrecognized trace type in hover:",I);"closest"===S&&Y.length>V&&(Y.splice(0,V),W=Y[0].distance)}if(0===Y.length)return _.unhoverRaw(t,e);var tt="y"===S&&U.length>1;Y.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),nt={hovermode:S,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},rt=c(Y,nt);u(Y,tt?"xa":"ya"),f(rt,tt);var at=t._hoverdata,ot=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),m=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),m=d.node().getBoundingClientRect().width+2*D):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var v,k,L=f.node().getBoundingClientRect(),C=t.xa._offset+(t.x0+t.x1)/2,z=t.ya._offset+(t.y0+t.y1)/2,S=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),E=L.width+O+D+m;t.ty0=_-L.top,t.bx=L.width+2*D,t.by=L.height+2*D,t.anchor="start",t.txwidth=L.width,t.tx2width=m,t.offset=0,o?(t.pos=C,v=z+P/2+E<=M,k=z-P/2-E>=0,"top"!==t.idealAlign&&v||!k?v?(z+=P/2,t.anchor="start"):t.anchor="middle":(z-=P/2,t.anchor="end")):(t.pos=z,v=C+S/2+E<=w,k=C-S/2-E>=0,"left"!==t.idealAlign&&v||!k?v?(C+=S/2,t.anchor="start"):t.anchor="middle":(C-=S/2,t.anchor="end")),f.attr("text-anchor",t.anchor),m&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+C+","+z+")"+(o?"rotate("+T+")":""))}),z}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?C:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var m=f[i];for(l=m.length-1;l>=0;l--){var v=m[l],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(O+D),l=i+o*(t.txwidth+D),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-S,s=t.offset*z),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*O+s)+","+(O+c)+"v"+(t.by/2-O)+"h"+r*t.bx+"v-"+t.by+"H"+(r*O+s)+"V"+(c-O)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+D).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*D+s,c+t.ty0-t.by/2+D),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=e.exports={};A.unhover=_.unhover, -A.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},A.supplyLayoutDefaults=function(t,e,n){function r(n,r){return m.coerce(t,e,A.layoutAttributes,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=A.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},A.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+k.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},A.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},A.getClosest=function(t,e,n){if(n.index!==!1)n.index>=0&&n.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":116,"fast-isnumeric":13}],156:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-m.left,b=n-m.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),C=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var z=g.selectAll("path.select-outline").data([1,2]);z.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",k+"Z");var S,O,D,P,E,N=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,F=[];for(S=0;S0)return Math.log(e)/Math.LN10;if(e<=0&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*u*Math.abs(r-a))}return i.BADNUM}function n(t){return Math.pow(10,t)}function c(t){return a(t)?Number(t):i.BADNUM}var u=10;if(t.c2l="log"===t.type?e:c,t.l2c="log"===t.type?n:c,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(e){var n,r=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var i=s.getFromId(t._gd,t.overlaying);t.domain=i.domain}var l=e&&t._r?t._r:t.range;for(l&&2===l.length&&l[0]!==l[1]||(l=[-1,1]),n=0;n<2;n++)a(l[n])||(l[n]=a(l[1-n])?l[1-n]*(n?10:.1):n?1:-1),l[n]<-(Number.MAX_VALUE/2)?l[n]=-(Number.MAX_VALUE/2):l[n]>Number.MAX_VALUE/2&&(l[n]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l[0]-l[1]),t._b=-t._m*l[1]):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l[1]-l[0]),t._b=-t._m*l[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):i.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},["linear","log","-"].indexOf(t.type)!==-1)t.c2d=c,t.d2c=function(t){return t=l(t),a(t)?Number(t):i.BADNUM},t.d2l=function(e,n){return"log"===t.type?t.c2l(t.d2c(e),n):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return a(t)?o.ms2DateTime(t):i.BADNUM},t.d2c=function(t){return a(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(o.dateTime2ms);!a(t.range[0])&&a(f[0])&&(t.range[0]=f[0]),!a(t.range[1])&&a(f[1])&&(t.range[1]=f[1])}catch(e){o.error(e,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var n=t._categories.indexOf(e);return n===-1?i.BADNUM:n},t.d2l=t.d2c);t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;on.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var k;c&&(k=c());var M,A,T,L=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),M=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":116,"../../plotly":138,"../../registry":174,"./axes":142,d3:10}],162:[function(t,e,n){"use strict";function r(t,e,n){var r,a,o,i=!1;if("data"===e.type)r=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;r=t._fullLayout}return a=c.nestedProperty(r,e.prop).get(),o=n[e.type]=n[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var n=[],r=e[0],a={};if("string"==typeof r)a[r]=e[1];else{if(!c.isPlainObject(r))return n;a=r}return l(a,function(t,e,r){n.push({type:"layout",prop:t,value:r})},"",0),n}function i(t,e){var n,r,a,o,i=[];if(r=e[0],a=e[1],n=e[2],o={},"string"==typeof r)o[r]=a;else{if(!c.isPlainObject(r))return i;o=r,void 0===n&&(n=a)}return void 0===n&&(n=null),l(o,function(e,r,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);n&&(l=Math.min(l,n.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,r+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");n.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=n.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){r(t,s,i.cache),i.check=function(){if(l){var e=r(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(n._initialAutoSizeIsDone){var c=n.width,f=n.height;p.supplyLayoutGlobalDefaults(o,r),o.width||(r.width=c),o.height||(r.height=f)}else{p.supplyLayoutGlobalDefaults(o,r);var d=!o.width||!o.height,h=r.autosize,g=t._context&&t._context.autosizable,m=d&&(h||g);m?p.plotAutoSize(t,o,r):d&&p.sanitizeMargins(t),!h&&d&&(o.width=r.width,o.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=s.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,r),r._has=p._hasPlotType.bind(r);var v=r._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,m=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(g*(m.width-f)),a=Math.round(g*(m.height-h))}else{var v=s?window.getComputedStyle(t):{};r=parseFloat(v.width)||n.width,a=parseFloat(v.height)||n.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;r1,_=!e.height&&Math.abs(n.height-a)>1;(_||b)&&(b&&(n.width=r),_&&(n.height=a)),t._initialAutoSize||(t._initialAutoSize={width:r,height:a}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n){var r,a;u.Axes.supplyLayoutDefaults(t,e,n);var o=e._basePlotModules;for(r=0;r.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var m=s[t].t.val,v=s[t].t.size;if(m>d){var y=(h*m+(v-e.height)*d)/(m-d),x=(v*(1-d)+(h-e.height)*(1-m))/(m-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!t._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):t&&t.getTime?d.ms2DateTime(t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var n,r,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(n=0;n0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(n)for(l=0;l=0,z=C?f.angularAxis.domain:r.extent(M),S=Math.abs(M[1]-M[0]);T&&!A&&(S=0);var O=z.slice();L&&A&&(O[1]+=S);var D=f.angularAxis.ticksCount||4;D>8&&(D=D/(D/8)+D%8),f.angularAxis.ticksStep&&(D=(O[1]-O[0])/D);var P=f.angularAxis.ticksStep||(O[1]-O[0])/(D*(f.minorTicks+1));k&&(P=Math.max(Math.round(P),1)),O[2]||(O[2]=P);var E=r.range.apply(this,O);if(E=E.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=r.scale.linear().domain(O.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?S:0,e=r.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var N="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(N,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=r.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,j=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},q={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=i.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});i.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},i.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],a.range([0,x]),u.layout.radialAxis.domain=a.domain(),F.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),j.attr("transform","translate("+_+")").style({cursor:"crosshair"});var Y=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(Y[0]=Math.max(0,Y[0]),Y[1]=Math.max(0,Y[1]),e.select(".outer-group").attr("transform","translate("+Y+")"),f.title){var U=e.select("g.title-group text").style(q).text(f.title),X=U.node().getBBox();U.attr({x:_[0]-X.width/2,y:_[1]-x-20})}var Z=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var G=Z.selectAll("circle.grid-circle").data(a.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(B),G.attr("r",a),G.exit().remove()}Z.select("circle.outside-circle").attr({r:x}).style(B);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=r.svg.axis().scale(a).ticks(5).tickSize(5);Z.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Z.selectAll(".domain").style(B),Z.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(q).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,q["font-size"]]+")":"translate("+[0,q["font-size"]]+")"}}),Z.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(E),J=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),J.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(q);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?n<270&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(n<=180&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(q);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=r.max(j.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=a,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=r.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return o(i[n].defaultConfig(),t)});i[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=i.tooltipPanel().config({container:ct,fontSize:8})(),ft=i.tooltipPanel().config({container:ct,fontSize:8})(),dt=i.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});j.on("mousemove.angular-guide",function(t,e){var n=i.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=i.util.convertToCartesian(x+12,n+180);ut.text(i.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});j.on("mousemove.radial-guide",function(t,e){var n=i.util.getMousePos(W).radius;pt.attr({r:n}).style({opacity:.5}),lt=a.invert(i.util.getMousePos(W).radius);var r=i.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(i.util.round(lt)).move([r[0]+_[0],r[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var a=r.select(this),o=a.style("fill"),l="black",s=a.style("opacity")||1;if(a.attr({"data-opacity":s}),"none"!=o){a.attr({"data-fill":o}),l=r.hsl(o).darker().toString(),a.style({fill:l,opacity:1});var c={t:i.util.round(t[0]),r:i.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-Y[0]-d.left,f.top+f.height/2-Y[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else o=a.style("stroke"),a.attr({"data-stroke":o}),l=r.hsl(o).darker().toString(),a.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==r.event.which&&void(r.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=r.select(this),a=n.attr("data-fill");a?n.style({fill:a,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,a,l,s={data:[],layout:{}},c={},u={},f=r.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=i.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),o(s.data[e],i.Axis.defaultConfig().data[0]),o(s.data[e],t)}),o(s.layout,i.Axis.defaultConfig().layout),o(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},r.rebind(d,f,"on"),d},i.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:r.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},i.util={},i.DATAEXTENT="dataExtent",i.AREA="AreaChart",i.LINE="LinePlot", -i.DOT="DotPlot",i.BAR="BarChart",i.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},i.util._extend=function(t,e){for(var n in t)e[n]=t[n]},i.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},i.util.dataFromEquation2=function(t,e){var n=e||6,a=r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return a},i.util.dataFromEquation=function(t,e,n){var a=e||6,o=[],i=[];r.range(0,360+a,a).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},i.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return r.range(e).map(function(t,e){return n[e]||n[0]})},i.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=i.util.ensureArray(t[e],n)}),t},i.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},i.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},i.util.sumArrays=function(t,e){return r.zip(t,e).map(function(t,e){return r.sum(t)})},i.util.arrayLast=function(t){return t[t.length-1]},i.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return n===-2},i.util.flattenArray=function(t){for(var e=[];!i.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},i.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},i.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},i.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},i.util.getMousePos=function(t){var e=r.mouse(t.node()),n=e[0],a=e[1],o={};return o.x=n,o.y=a,o.pos=e,o.angle=180*(Math.atan2(a,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+a*a),o},i.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;a0)){var l=r.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(n,a,o)},"fill-opacity":0,stroke:function(t,e){return m.stroke(n,a,o)},"stroke-width":function(t,e){return m["stroke-width"](n,a,o)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](n,a,o)},opacity:function(t,e){return m.opacity(n,a,o)},display:function(t,e){return m.display(n,a,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=r.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,a){r.select(this).attr({class:"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var m={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},v=r.select(this).selectAll("g.layer").data(s);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(m).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,n=[i.PolyChart.defaultConfig()],a=r.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),o(n[e],i.PolyChart.defaultConfig()),o(n[e],t)}),this):n},t.getColorScale=function(){return e},r.rebind(t,a,"on"),t},i.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}};return t},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},i.Legend=function(){function t(){var n=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=o({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),i=r.merge(a);i=i.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(i=i.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=r.select(l));var s=i.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof i[0]:n.isContinuous,f=u?n.height:c*i.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=r.range(i.length),m=r.scale[u?"linear":"ordinal"]().domain(g).range(s),v=r.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":r.svg.symbolTypes.indexOf(t)!=-1?r.svg.symbol().type(t).size(n)():r.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(i);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,v(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=r.svg.axis().scale(v).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return i[e].name}),t}var e=i.Legend.defaultConfig(),n=r.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},r.rebind(t,n,"on"),t},i.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},i.tooltipPanel=function(){var t,e,n,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=10,c=function(){t=a.container.selectAll("g."+l).data([0]);var r=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=r.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=r.append("text").attr({dx:a.padding+s,dy:.3*+a.fontSize}),c};return c.text=function(o){var i=r.hsl(a.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var d=a.padding,h=e.node().getBBox(),p={fill:a.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,m=h.height+2*d;return n.attr({d:"M"+[[s,-m/2],[s,-m/4],[a.hasTick?0:s,0],[s,m/4],[s,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-m/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){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 o(a,t),c},c},i.tooltipPanel.uid=1,i.adapter={},i.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=o({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var r=a.indexOf(t.geometry);r!=-1&&(n.data[e].groupId=r)})}if(t.layout){var l=o({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};r.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../lib":116,d3:10}],172:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../lib"),o=t("../../components/color"),i=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){function e(e,a){return a&&(f=a),r.select(r.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?s(n,e):e,o||(o=i.Axis()),u=i.adapter.plotly().convert(n),o.config(u).render(f),t.data=n.data,t.layout=n.layout,c.fillLayout(t),n}var n,a,o,u,f,d=new l;return e.isPolar=!0,e.svg=function(){return o.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return i.adapter.plotly().convert(o.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:o.angularScale(),r:o.radialScale()}},e.setUndoPoint=function(){var t=this,e=i.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,a),a=i.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},c.fillLayout=function(t){var e=r.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:o.background,_container:e,_paperdiv:n,_paper:a};t._fullLayout=s(i,t.layout)}},{"../../components/color":26,"../../lib":116,"./micropolar":171,"./undo_manager":173,d3:10}],173:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return r!==-1},hasRedo:function(){return r-1}var o=t("../lib"),i=t("../plots/plots"),l=o.extendFlat,s=o.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,o=t.data,c=t.layout,u=s([],o),f=s({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;n=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var m,v,y,x,b=e.p+(h?d[n]:d),_=b+(g?p[n]:p),w=e.b,k=w+e.s;if("h"===l.orientation?(y=u.c2p(b,!0),x=u.c2p(_,!0),m=c.c2p(w,!0),v=c.c2p(k,!0)):(m=c.c2p(b,!0),v=c.c2p(_,!0),y=u.c2p(w,!0),x=u.c2p(k,!0)),!(a(m)&&a(v)&&a(y)&&a(x)&&m!==v&&y!==x))return void r.select(this).remove(); -var M=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,A=r.round(M/2%1,2);if(!t._context.staticPlot){var T=i.opacity(e.mc||l.marker.color),L=T<1||M>.01?o:s;m=L(m,v),v=L(v,m),y=L(y,x),x=L(x,y)}r.select(this).attr("d","M"+m+","+y+"V"+x+"H"+v+"V"+y+"Z")})}),d.call(l.plot,e)}},{"../../components/color":26,"../../components/errorbars":56,"../../lib":116,"./arrays_to_calcdata":183,d3:10,"fast-isnumeric":13}],192:[function(t,e,n){"use strict";function r(t,e,n,r){if(r.length){var l,s,c,u,f,d=t._fullLayout.barmode,h="overlay"===d,p="group"===d;if(h)a(t,e,n,r);else if(p){for(l=[],s=[],c=0;cs+i&&(c=!0,s=y)),v(e.c2l(g))&&(gs+i&&(c=!0,s=g))}}x.expand(e,[l,s],{tozero:!0,padded:c})}function m(t){return t._id.charAt(0)}var v=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var n,a=e.xaxis,o=e.yaxis,i=t._fullData,l=t.calcdata,s=[],c=[];for(n=0;n1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&r.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,n=e.marker,i=n.line,l=(e._input||{}).marker||{},s=o.tryColorscale(n,l,""),c=o.tryColorscale(n,l,"line.");r.select(this).selectAll("path").each(function(t){var e,o,l=(t.mlw+1||i.width+1)-1,u=r.select(this);e="mc"in t?t.mcc=s(t.mc):Array.isArray(n.color)?a.defaultLine:n.color,u.style("stroke-width",l+"px").call(a.fill,e),l&&(o="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":26,"../../components/drawing":50,"../../components/errorbars":56,d3:10}],195:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,n,i,l){n("marker.color",i),a(t,"marker")&&o(t,e,l,n,{prefix:"marker.",cLetter:"c"}),n("marker.line.color",r.defaultLine),a(t,"marker.line")&&o(t,e,l,n,{prefix:"marker.line.",cLetter:"c"}),n("marker.line.width")}},{"../../components/color":26,"../../components/colorscale/defaults":36,"../../components/colorscale/has_colorscale":40}],196:[function(t,e,n){"use strict";var r=t("../scatter/attributes"),a=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,i=r.marker,l=i.line;e.exports={y:{valType:"data_array"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:o({},i.symbol,{arrayOk:!1}),opacity:o({},i.opacity,{arrayOk:!1,dflt:1}),size:o({},i.size,{arrayOk:!1}),color:o({},i.color,{arrayOk:!1}),line:{color:o({},l.color,{arrayOk:!1,dflt:a.defaultLine}),width:o({},l.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:r.fillcolor}},{"../../components/color/attributes":25,"../../lib/extend":114,"../scatter/attributes":237}],197:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(t,e,n,o,i){var l;return n in e?p=o.makeCalcdata(e,n):(l=n+"0"in e?e[n+"0"]:"name"in e&&("category"===o.type||r(e.name)&&["linear","log"].indexOf(o.type)!==-1||a.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,l=o.d2c(l),p=i.map(function(){return l})),p}function i(t,e,n,o,i){var l,s,c,u,f=o.length,d=e.length,h=[],p=[];for(l=0;l=0&&c1,v=n.dPos*(1-d.boxgap)*(1-d.boxgroupgap)/(m?t.numboxes:1),y=m?2*n.dPos*(-.5+(n.boxnum+.5)/t.numboxes)*(1-d.boxgap):0,x=v*g.whiskerwidth;return g.visible!==!0||n.emptybox?void o.select(this).remove():("h"===g.orientation?(s=p,f=h):(s=h,f=p),n.bPos=y,n.bdPos=v,r(),o.select(this).selectAll("path.box").data(i.identity).enter().append("path").attr("class","box").each(function(t){var e=s.c2p(t.pos+y,!0),n=s.c2p(t.pos+y-v,!0),r=s.c2p(t.pos+y+v,!0),a=s.c2p(t.pos+y-x,!0),l=s.c2p(t.pos+y+x,!0),c=f.c2p(t.q1,!0),u=f.c2p(t.q3,!0),d=i.constrain(f.c2p(t.med,!0),Math.min(c,u)+1,Math.max(c,u)-1),h=f.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=f.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?o.select(this).attr("d","M"+d+","+n+"V"+r+"M"+c+","+n+"V"+r+"H"+u+"V"+n+"ZM"+c+","+e+"H"+h+"M"+u+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+h+","+a+"V"+l+"M"+p+","+a+"V"+l)):o.select(this).attr("d","M"+n+","+d+"H"+r+"M"+n+","+c+"H"+r+"V"+u+"H"+n+"ZM"+e+","+c+"V"+h+"M"+e+","+u+"V"+p+(0===g.whiskerwidth?"":"M"+a+","+h+"H"+l+"M"+a+","+p+"H"+l))}),g.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=n,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,n,r,o,l,s,f,d="all"===g.boxpoints?t.val:t.val.filter(function(e){return et.uf}),h=Math.max((t.max-t.min)/10,t.q3-t.q1),p=1e-9*h,m=h*u,x=[],b=0;if(g.jitter){if(0===h)for(b=1,x=new Array(d.length),e=0;et.lo&&(r.so=!0),r})}).enter().append("path").call(l.translatePoints,h,p),void(g.boxmean&&o.select(this).selectAll("path.mean").data(i.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=s.c2p(t.pos+y,!0),n=s.c2p(t.pos+y-v,!0),r=s.c2p(t.pos+y+v,!0),a=f.c2p(t.mean,!0),i=f.c2p(t.mean-t.sd,!0),l=f.c2p(t.mean+t.sd,!0);"h"===g.orientation?o.select(this).attr("d","M"+a+","+n+"V"+r+("sd"!==g.boxmean?"":"m0,0L"+i+","+e+"L"+a+","+n+"L"+l+","+e+"Z")):o.select(this).attr("d","M"+n+","+a+"H"+r+("sd"!==g.boxmean?"":"m0,0L"+e+","+i+"L"+n+","+a+"L"+e+","+l+"Z"))})))})}},{"../../components/drawing":50,"../../lib":116,d3:10}],204:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../plots/cartesian/axes"),o=t("../../lib");e.exports=function(t,e){var n,i,l,s,c=t._fullLayout,u=e.xaxis,f=e.yaxis,d=["v","h"];for(i=0;io)return n[t]=o,o-n[t]}return 0},max:function(t,e,n,a){var o=a[e];if(r(o)){if(o=Number(o),!r(n[t]))return n[t]=o,o;if(n[t]=0&&vI;n--)if(u[n]){R=n;break}for(n=I;n<=R;n++)r(c[n])&&r(u[n])&&N.push({p:c[n],s:u[n],b:0});return N}}},{"../../lib":116,"../../plots/cartesian/axes":142,"./average":211,"./bin_functions":213,"./norm_functions":217,"fast-isnumeric":13}],215:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../components/color"),o=t("./bin_defaults"),i=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),s=t("./attributes");e.exports=function(t,e,n,c){function u(n,a){return r.coerce(t,e,s,n,a)}var f=u("x"),d=u("y");u("text");var h=u("orientation",d&&!f?"h":"v"),p=e["v"===h?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===h?"x":"y"];g&&u("histfunc");var m="h"===h?["y"]:["x"];o(t,e,u,m),i(t,e,u,n,c),l(t,e,a.defaultLine,{axis:"y"}),l(t,e,a.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":26,"../../components/errorbars/defaults":55,"../../lib":116,"../bar/style_defaults":195,"./attributes":210,"./bin_defaults":212}],216:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.layoutAttributes=t("../bar/layout_attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("../bar/layout_defaults"),r.calc=t("./calc"),r.setPositions=t("../bar/set_positions"),r.plot=t("../bar/plot"),r.style=t("../bar/style"),r.colorbar=t("../scatter/colorbar"),r.hoverPoints=t("../bar/hover"),r.moduleType="trace",r.name="histogram",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":151,"../bar/hover":187,"../bar/layout_attributes":189,"../bar/layout_defaults":190,"../bar/plot":191,"../bar/set_positions":192,"../bar/style":194,"../scatter/colorbar":240,"./attributes":210,"./calc":214,"./defaults":215}],217:[function(t,e,n){"use strict";e.exports={percent:function(t,e){for(var n=t.length,r=100/e,a=0;ae}}},n.addRangeSlider=function(t){t.xaxis||(t.xaxis={}),t.xaxis.rangeslider||(t.xaxis.rangeslider={})}},{"../../lib":116}],222:[function(t,e,n){"use strict";var r=t("../../plot_api/register");e.exports={moduleType:"trace",name:"ohlc",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","showLegend"],meta:{},attributes:t("./attributes"),supplyDefaults:t("./defaults")},r(t("../scatter")),r(t("./transform"))},{"../../plot_api/register":133,"../../plots/cartesian":151,"../scatter":247,"./attributes":218,"./defaults":219,"./transform":224}],223:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r,a=n("x"),o=n("open"),i=n("high"),l=n("low"),s=n("close");return r=Math.min(o.length,i.length,l.length,s.length),a&&(r=Math.min(r,a.length),r1)){var f=i.distinctVals(u.x.map(e.d2c)).minDiff;o=Math.min(o,f)}}for(o===1/0&&(o=1),c=0;c");b.push(i,i,i,i,i,i,null)},D=0;D")}return g};var s},{"../../components/color":26,"./helpers":229,"fast-isnumeric":13,tinycolor2:16}],228:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(n,o){return r.coerce(t,e,a,n,o)}var l=r.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,m=g||"inside"===p,v=g||"outside"===p;if(m||v){var y=l(i,"textfont",o.font);m&&l(i,"insidetextfont",y),v&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":116,"./attributes":225}],229:[function(t,e,n){"use strict";var r=t("../../lib");n.formatPiePercent=function(t,e){var n=(100*t).toPrecision(3);return n.lastIndexOf(".")!==-1&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)+"%"},n.formatPieValue=function(t,e){var n=t.toPrecision(10);return n.lastIndexOf(".")!==-1&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)}},{"../../lib":116}],230:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.layoutAttributes=t("./layout_attributes"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.styleOne=t("./style_one"),r.moduleType="trace",r.name="pie",r.basePlotModule=t("./base_plot"),r.categories=["pie","showLegend"],r.meta={},e.exports=r},{"./attributes":225,"./base_plot":226,"./calc":227,"./defaults":228,"./layout_attributes":231,"./layout_defaults":232,"./plot":233,"./style":234,"./style_one":235}],231:[function(t,e,n){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],232:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function n(n,o){return r.coerce(t,e,a,n,o)}n("hiddenlabels")}},{"../../lib":116,"./layout_attributes":231}],233:[function(t,e,n){"use strict";function r(t,e,n){var r=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/n.vTotal,.5),l=1-n.trace.hole,s=a(e,n),c={scale:s*n.r*2/r,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=n.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/n.r)-f*o/n.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=n.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),m={scale:2*g/t.width,rCenter:Math.cos(g/n.r)-g/o/n.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>d.scale?m:d;return c.scale<1&&v.scale>c.scale?v:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var n=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(n)),(1-e.trace.hole)/2)}function o(t,e){var n=e.pxmid[0],r=e.pxmid[1],a=t.width/2,o=t.height/2;return n<0&&(a*=-1),r<0&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+n*n/(r*r)),outside:!0}}function i(t,e){function n(t,e){return t.pxmid[1]-e.pxmid[1]}function r(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,n){n||(n={});var r,a,o,l,d,h,g=n.labelExtraY+(i?n.yLabelMax:n.yLabelMin),m=i?t.yLabelMin:t.yLabelMax,v=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-m;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-m-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*f>0&&(r=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+r-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,m,v;for(i=0;i<2;i++)for(l=i?n:r,c=i?Math.max:Math.min,f=i?1:-1,o=0;o<2;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),m=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(n/c(l.tilt,Math.sin(s),l.depth),r/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&h.indexOf(l.scalegroup)===-1&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,n){if(!t)return 1;var r=Math.sin(t*Math.PI/180);return Math.max(.01,n*r*Math.abs(e)+2*Math.sqrt(1-r*r*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var n=t._fullLayout;l(e,n._size);var c=n._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],m=c.trace,v=0,y=(m.depth||0)*c.r*Math.sin(v)/2,x=m.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(v),k=l.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],v=!1;l.each(function(i){function l(e){var r=t._fullLayout,o=t._fullData[m.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&r.hovermode!==!1&&"none"!==l&&"skip"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=n.separators,p=[];l.indexOf("label")!==-1&&p.push(i.label),o.text&&o.text[i.i]&&l.indexOf("text")!==-1&&p.push(o.text[i.i]),l.indexOf("value")!==-1&&p.push(g.formatPieValue(i.v,h)),l.indexOf("percent")!==-1&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:l.indexOf("name")!==-1?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:r._hoverlayer.node(),outerContainer:r._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(n._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],t._hoverdata.trace=e.trace,f.click(t,{target:!0})}function b(t,e,n,r){return"a"+r*c.r+","+r*w+" "+x+" "+i.largeArc+(n?" 1 ":" 0 ")+r*(e[0]-t[0])+","+r*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y),m.pull){var C=+(Array.isArray(m.pull)?m.pull[i.i]:m.pull)||0;C>0&&(k+=C*i.pxmid[0],M+=C*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var z=m.hole;if(i.v===c.vTotal){var S="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";z?T.attr("d","M"+(k+z*i.px0[0])+","+(M+z*i.px0[1])+b(i.px0,i.pxmid,!1,z)+b(i.pxmid,i.px0,!1,z)+"Z"+S):T.attr("d",S)}else{var O=b(i.px0,i.px1,!0,1);if(z){var D=1-z;T.attr("d","M"+(k+z*i.px1[0])+","+(M+z*i.px1[1])+b(i.px1,i.px0,!1,z)+"l"+D*i.px0[0]+","+D*i.px0[1]+O+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+O+"Z")}var P=Array.isArray(m.textposition)?m.textposition[i.i]:m.textposition,E=A.selectAll("g.slicetext").data(i.text&&"none"!==P?[0]:[]);E.enter().append("g").classed("slicetext",!0),E.exit().remove(),E.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===P?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,n=h.bBox(t.node());"outside"===P?e=o(n,i):(e=r(n,i,c),"auto"===P&&e.scale<1&&(t.call(h.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),n=h.bBox(t.node())),e=o(n,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-n.height/2,i.yLabelMid=l,i.yLabelMax=l+n.height/2,i.labelExtraX=0,i.labelExtraY=0,v=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(n.left+n.right)/2+","+-(n.top+n.bottom)/2+")")})}),v&&i(s,m),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),n=e.select("g.slicetext text");n.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+n.attr("transform"));var r=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+r+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(r+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":26,"../../components/drawing":50,"../../lib/svg_text_utils":128,"../../plots/cartesian/graph_interact":150,"./helpers":229,d3:10}],234:[function(t,e,n){"use strict";var r=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],n=e.trace,o=r.select(this);o.style({opacity:n.opacity}),o.selectAll(".top path.surface").each(function(t){r.select(this).call(a,t,n)})})}},{"./style_one":235,d3:10}],235:[function(t,e,n){"use strict";var r=t("../../components/color");e.exports=function(t,e,n){var a=n.marker.line.color;Array.isArray(a)&&(a=a[e.i]||r.defaultLine);var o=n.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(r.stroke,a)}},{"../../components/color":26}],236:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t){var e=t[0].trace,n=e.marker;if(r.mergeArray(e.text,t,"tx"),r.mergeArray(e.textposition,t,"tp"),e.textfont&&(r.mergeArray(e.textfont.size,t,"ts"),r.mergeArray(e.textfont.color,t,"tc"),r.mergeArray(e.textfont.family,t,"tf")),n&&n.line){var a=n.line;r.mergeArray(n.opacity,t,"mo"),r.mergeArray(n.symbol,t,"mx"),r.mergeArray(n.color,t,"mc"),r.mergeArray(a.color,t,"mlc"),r.mergeArray(a.width,t,"mlw")}}},{"../../lib":116}],237:[function(t,e,n){"use strict";var r=t("../../components/colorscale/color_attributes"),a=t("../../components/drawing"),o=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},ids:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"},simplify:{valType:"boolean",dflt:!0}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:o({},{symbol:{valType:"enumerated",values:a.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:o({},{width:{valType:"number",min:0,arrayOk:!0}},r("marker.line"))},r("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":34,"../../components/drawing":50,"../../lib/extend":114,"./constants":242}],238:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var n,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var v={type:"linear"};a.setConvert(v),s=v.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,a.expand(u,d,g),a.expand(f,h,m);var b=new Array(p);for(c=0;c=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}}}}},{}],240:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,s=n.marker,c="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===s||!s.showscale)return void o.autoMargin(t,c);var u=s.color,f=s.cmin,d=s.cmax;r(f)||(f=a.aggNums(Math.min,null,u)),r(d)||(d=a.aggNums(Math.max,null,u));var h=e[0].t.cb=l(t,c),p=i.makeColorScaleFunc(i.extractScale(s.colorscale,f,d),{noNumericCheck:!0});h.fillcolor(p).filllevels({start:f,end:d,size:(d-f)/254}).options(s.colorbar)()}},{"../../components/colorbar/draw":29,"../../components/colorscale":41,"../../lib":116,"../../plots/plots":167,"fast-isnumeric":13}],241:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":33,"../../components/colorscale/has_colorscale":40,"./subtypes":257}],242:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],243:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var m=l(t,e,g),v=mq!=P>=q&&(S=C[T-1][0],O=C[T][0],z=S+(O-S)*(q-D)/(P-D),R=Math.min(R,z),F=Math.max(F,z));R=Math.max(R,0),F=Math.min(F,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:F,y0:q,y1:q,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":26,"../../components/errorbars":56,"../../lib":116,"../../plots/cartesian/constants":148,"../../plots/cartesian/graph_interact":150,"./get_trace_color":245}],247:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.animatable=!0,r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":151,"./arrays_to_calcdata":236,"./attributes":237,"./calc":238,"./clean_data":239,"./colorbar":240,"./defaults":243,"./hover":246,"./plot":254,"./select":255,"./style":256,"./subtypes":257}],248:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=!Array.isArray(l)&&l||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":36,"../../components/colorscale/has_colorscale":40}],249:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),r=k.c2p(t[e].y);return n!==z&&r!==z&&[n,r]}function a(t){var e=t[0]/w._length,n=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*T}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,m,v,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.simplify,A=e.connectGaps,T=e.baseTolerance,L=e.linear,C=[],z=r.BADNUM,S=.2,O=new Array(t.length),D=0;for(M||(T=S=-1),i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,c=f,h=!1):y=t.length||!f)break;O[D++]=f,l=f}}else O[D++]=c}C.push(O.slice(0,D))}return C}},{"../../plots/cartesian/axes":142}],250:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],251:[function(t,e,n){"use strict";e.exports=function(t,e,n){for(var r,a,o=null,i=0;i0?Math.max(e,a):0}}},{"fast-isnumeric":13}],253:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":26,"../../components/colorscale/defaults":36,"../../components/colorscale/has_colorscale":40,"./subtypes":257}],254:[function(t,e,n){"use strict";function r(t,e){var n;e.selectAll("g.trace").each(function(t){var e=i.select(this);if(n=t[0].trace,n._nexttrace){if(n._nextFill=e.select(".js-fill.js-tonext"),!n._nextFill.size()){var r=":first-child";e.select(".js-fill.js-tozero").size()&&(r+=" + *"),n._nextFill=e.insert("path",r).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),n._nextFill=null;n.fill&&("tozero"===n.fill.substr(0,6)||"toself"===n.fill||"to"===n.fill.substr(0,2)&&!n._prevtrace)?(n._ownFill=e.select(".js-fill.js-tozero"),n._ownFill.size()||(n._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),n._ownFill=null)})}function a(t,e,n,r,a,h,g){function m(t){return M?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,n,r=t[0].trace,a=i.select(this),o=u.hasMarkers(r),c=u.hasText(r),f=x(r),d=b,h=b;o&&(d=r.marker.maxdisplayed?v:l.identity),c&&(h=r.marker.maxdisplayed?v:l.identity),n=a.selectAll("path.point"),e=n.data(d,f);var p=e.enter().append("path").classed("point",!0);p.call(s.pointStyle,r).call(s.translatePoints,A,T,r),M&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=m(i.select(this));s.translatePoint(t,e,A,T),s.singlePointStyle(t,e,r)}),M?e.exit().transition().style("opacity",0).remove():e.exit().remove(),n=a.selectAll("g"),e=n.data(h,f),e.enter().append("g").append("text"),e.each(function(t){var e=m(i.select(this).select("text"));s.translatePoint(t,e,A,T)}),e.selectAll("text").call(s.textPointStyle,r).each(function(t){var e=t.xp||A.c2p(t.x),n=t.yp||T.c2p(t.y);i.select(this).selectAll("tspan").each(function(){m(i.select(this)).attr({x:e,y:n})})}),e.exit().remove()}var w,k;o(t,e,n,r,a);var M=!!g&&g.duration>0,A=n.xaxis,T=n.yaxis,L=r[0].trace,C=L.line,z=i.select(h);if(z.call(c.plot,n,g),L.visible===!0){var S,O,D=L.fill.charAt(L.fill.length-1);"x"!==D&&"y"!==D&&(D=""),r[0].node3=z,f(r);var P="",E=[],N=L._prevtrace;N&&(P=N._prevRevpath||"",O=N._nextFill,E=N._polygons);var I,R,F,j,B,q,H,V,Y,U="",X="",Z=[],G=[],W=l.noop;if(S=L._ownFill,u.hasLines(L)||"none"!==L.fill){for(O&&O.datum(r),["hv","vh","hvh","vhv"].indexOf(C.shape)!==-1?(F=s.steps(C.shape),j=s.steps(C.shape.split("").reverse().join(""))):F=j="spline"===C.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?s.smoothclosed(t.slice(1),C.smoothing):s.smoothopen(t,C.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return j(t.reverse())},Z=d(r,{xaxis:A,yaxis:T,connectGaps:L.connectgaps,baseTolerance:Math.max(C.width||1,3)/4,linear:"linear"===C.shape,simplify:C.simplify}),Y=L._polygons=new Array(Z.length),k=0;k1}),W=function(t){return function(e){if(I=F(e),R=B(e),U?D?(U+="L"+I.substr(1),X=R+("L"+X.substr(1))):(U+="Z"+I,X=R+"Z"+X):(U=I,X=R),u.hasLines(L)&&e.length>1){var n=i.select(this);if(n.datum(r),t)m(n.style("opacity",0).attr("d",I).call(s.lineGroupStyle)).style("opacity",1);else{var a=m(n);a.attr("d",I),s.singleLineStyle(r,a)}}}}}var Q=z.selectAll(".js-line").data(G);m(Q.exit()).style("opacity",0).remove(),Q.each(W(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(W(!0)),Z.length&&(S?q&&V&&(D?("y"===D?q[1]=V[1]=T.c2p(0,!0):"x"===D&&(q[0]=V[0]=A.c2p(0,!0)), -m(S).attr("d","M"+V+"L"+q+"L"+U.substr(1))):m(S).attr("d",U+"Z")):"tonext"===L.fill.substr(0,6)&&U&&P&&("tonext"===L.fill?m(O).attr("d",U+"Z"+P+"Z"):m(O).attr("d",U+"L"+P.substr(1)+"Z"),L._polygons=L._polygons.concat(E)),L._prevRevpath=X,L._prevPolygons=Y);var $=z.selectAll(".points");w=$.data([r]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function o(t,e,n,r,a){var o=n.xaxis,l=n.yaxis,s=i.extent(o.range.map(o.l2c)),c=i.extent(l.range.map(l.l2c)),f=r[0].trace;if(u.hasMarkers(f)){var d=f.marker.maxdisplayed;if(0!==d){var h=r.filter(function(t){return t.x>=s[0]&&t.x<=s[1]&&t.y>=c[0]&&t.y<=c[1]}),p=Math.ceil(h.length/d),g=0;a.forEach(function(t,n){var r=t[0].trace;u.hasMarkers(r)&&r.marker.maxdisplayed>0&&n0;for(u=p.selectAll("g.trace"),f=u.data(n,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),h(t,e,n),r(t,p),s=0,c=[];sr?1:-1}),m){l&&(d=l());var v=i.transition().duration(o.duration).ease(o.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()});v.each(function(){p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)})})}else p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":50,"../../components/errorbars":56,"../../lib":116,"../../lib/polygon":123,"./arrays_to_calcdata":236,"./line_points":249,"./link_traces":251,"./subtypes":257,d3:10}],255:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;ne?1:t>=e?0:NaN}function o(t){return null===t?NaN:+t}function i(t){return!isNaN(t)}function l(t){return{left:function(e,n,r,a){for(arguments.length<3&&(r=0),arguments.length<4&&(a=e.length);r>>1;t(e[o],n)<0?r=o+1:a=o}return r},right:function(e,n,r,a){for(arguments.length<3&&(r=0),arguments.length<4&&(a=e.length);r>>1;t(e[o],n)>0?a=o:r=o+1}return r}}}function s(t){return t.length}function c(t){for(var e=1;t*e%1;)e*=10;return e}function u(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function f(){this._=Object.create(null)}function d(t){return(t+="")===_i||t[0]===wi?wi+t:t}function h(t){return(t+="")[0]===wi?t.slice(1):t}function p(t){return d(t)in this._}function g(t){return(t=d(t))in this._&&delete this._[t]}function m(){var t=[];for(var e in this._)t.push(h(e));return t}function v(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function x(){this._=Object.create(null)}function b(t){return t}function _(t,e,n){return function(){var r=n.apply(e,arguments);return r===e?t:r}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,r=ki.length;n=e&&(e=a+1);!(i=l[e])&&++e0&&(t=t.slice(0,l));var c=Di.get(t);return c&&(t=c,s=Q),l?e?a:r:e?k:o}function W(t,e){return function(n){var r=ui.event;ui.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{ui.event=r}}}function Q(t,e){var n=W(t,e);return function(t){var e=this,r=t.relatedTarget;r&&(r===e||8&r.compareDocumentPosition(e))||n.call(e,t)}}function $(t){var n=".dragsuppress-"+ ++Ei,a="click"+n,o=ui.select(r(t)).on("touchmove"+n,T).on("dragstart"+n,T).on("selectstart"+n,T);if(null==Ni&&(Ni=!("onselectstart"in t)&&w(t.style,"userSelect")),Ni){var i=e(t).style,l=i[Ni];i[Ni]="none"}return function(t){if(o.on(n,null),Ni&&(i[Ni]=l),t){var e=function(){o.on(a,null)};o.on(a,function(){T(),e()},!0),setTimeout(e,0)}}}function J(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var a=n.createSVGPoint();if(Ii<0){var o=r(t);if(o.scrollX||o.scrollY){n=ui.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var i=n[0][0].getScreenCTM();Ii=!(i.f||i.e),n.remove()}}return Ii?(a.x=e.pageX,a.y=e.pageY):(a.x=e.clientX,a.y=e.clientY),a=a.matrixTransform(t.getScreenCTM().inverse()),[a.x,a.y]}var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}function K(){return ui.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function nt(t){return t>1?0:t<-1?ji:Math.acos(t)}function rt(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function at(t){return((t=Math.exp(t))-1/t)/2}function ot(t){return((t=Math.exp(t))+1/t)/2}function it(t){return((t=Math.exp(2*t))-1)/(t+1)}function lt(t){return(t=Math.sin(t/2))*t}function st(){}function ct(t,e,n){return this instanceof ct?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof ct?new ct(t.h,t.s,t.l):kt(""+t,Mt,ct):new ct(t,e,n)}function ut(t,e,n){function r(t){return t>360?t-=360:t<0&&(t+=360),t<60?o+(i-o)*t/60:t<180?i:t<240?o+(i-o)*(240-t)/60:o}function a(t){return Math.round(255*r(t))}var o,i;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=n<0?0:n>1?1:n,i=n<=.5?n*(1+e):n+e-n*e,o=2*n-i,new xt(a(t+120),a(t),a(t-120))}function ft(t,e,n){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof ht?gt(t.l,t.a,t.b):gt((t=At((t=ui.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,n)}function dt(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new ht(n,Math.cos(t*=Vi)*e,Math.sin(t)*e)}function ht(t,e,n){return this instanceof ht?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof ht?new ht(t.l,t.a,t.b):t instanceof ft?dt(t.h,t.c,t.l):At((t=xt(t)).r,t.g,t.b):new ht(t,e,n)}function pt(t,e,n){var r=(t+16)/116,a=r+e/500,o=r-n/200;return a=mt(a)*tl,r=mt(r)*el,o=mt(o)*nl,new xt(yt(3.2404542*a-1.5371385*r-.4985314*o),yt(-.969266*a+1.8760108*r+.041556*o),yt(.0556434*a-.2040259*r+1.0572252*o))}function gt(t,e,n){return t>0?new ft(Math.atan2(n,e)*Xi,Math.sqrt(e*e+n*n),t):new ft(NaN,NaN,t)}function mt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function vt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function xt(t,e,n){return this instanceof xt?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof xt?new xt(t.r,t.g,t.b):kt(""+t,xt,ut):new xt(t,e,n)}function bt(t){return new xt(t>>16,t>>8&255,255&t)}function _t(t){return bt(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function kt(t,e,n){var r,a,o,i=0,l=0,s=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=r[2].split(","),r[1]){case"hsl":return n(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(Lt(a[0]),Lt(a[1]),Lt(a[2]))}return(o=ol.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(i=(3840&o)>>4,i|=i>>4,l=240&o,l|=l>>4,s=15&o,s|=s<<4):7===t.length&&(i=(16711680&o)>>16,l=(65280&o)>>8,s=255&o)),e(i,l,s))}function Mt(t,e,n){var r,a,o=Math.min(t/=255,e/=255,n/=255),i=Math.max(t,e,n),l=i-o,s=(i+o)/2;return l?(a=s<.5?l/(i+o):l/(2-i-o),r=t==i?(e-n)/l+(e0&&s<1?0:r),new ct(r,a,s)}function At(t,e,n){t=Tt(t),e=Tt(e),n=Tt(n);var r=vt((.4124564*t+.3575761*e+.1804375*n)/tl),a=vt((.2126729*t+.7151522*e+.072175*n)/el),o=vt((.0193339*t+.119192*e+.9503041*n)/nl);return ht(116*a-16,500*(r-a),200*(a-o))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Lt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Ct(t){return"function"==typeof t?t:function(){return t}}function zt(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),St(e,n,t,r)}}function St(t,e,n,r){function a(){var t,e=s.status;if(!e&&Pt(s)||e>=200&&e<300||304===e){try{t=n.call(o,s)}catch(t){return void i.error.call(o,t)}i.load.call(o,t)}else i.error.call(o,s)}var o={},i=ui.dispatch("beforesend","progress","load","error"),l={},s=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in s||!/^(http(s)?:)?\/\//.test(t)||(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=a:s.onreadystatechange=function(){s.readyState>3&&a()},s.onprogress=function(t){var e=ui.event;ui.event=t;try{i.progress.call(o,s)}finally{ui.event=e}},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?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return n=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(di(arguments)))}}),o.send=function(n,r,a){if(2===arguments.length&&"function"==typeof r&&(a=r,r=null),s.open(n,t,!0),null==e||"accept"in l||(l.accept=e+",*/*"),s.setRequestHeader)for(var u in l)s.setRequestHeader(u,l[u]);return null!=e&&s.overrideMimeType&&s.overrideMimeType(e),null!=c&&(s.responseType=c),null!=a&&o.on("error",a).on("load",function(t){a(null,t)}),i.beforesend.call(o,s),s.send(null==r?null:r),o},o.abort=function(){return s.abort(),o},ui.rebind(o,i,"on"),null==r?o:o.get(Ot(r))}function Ot(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}function Pt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Dt(t,e,n){var r=arguments.length;r<2&&(e=0),r<3&&(n=Date.now());var a=n+e,o={c:t,t:a,n:null};return ll?ll.n=o:il=o,ll=o,sl||(cl=clearTimeout(cl),sl=1,ul(Nt)),o}function Nt(){var t=Et(),e=It()-t;e>24?(isFinite(e)&&(clearTimeout(cl),cl=setTimeout(Nt,e)),sl=0):(sl=1,ul(Nt))}function Et(){for(var t=Date.now(),e=il;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function It(){for(var t,e=il,n=1/0;e;)e.c?(e.t8?function(t){return t/n}:function(t){return t*n},symbol:t}}function jt(t){var e=t.decimal,n=t.thousands,r=t.grouping,a=t.currency,o=r&&n?function(t,e){for(var a=t.length,o=[],i=0,l=r[0],s=0;a>0&&l>0&&(s+l+1>e&&(l=Math.max(1,e-s)),o.push(t.substring(a-=l,a+l)),!((s+=l+1)>e));)l=r[i=(i+1)%r.length];return o.reverse().join(n)}:b;return function(t){var n=dl.exec(t),r=n[1]||" ",i=n[2]||">",l=n[3]||"-",s=n[4]||"",c=n[5],u=+n[6],f=n[7],d=n[8],h=n[9],p=1,g="",m="",v=!1,y=!0;switch(d&&(d=+d.substring(1)),(c||"0"===r&&"="===i)&&(c=r="0",i="="),h){case"n":f=!0,h="g";break;case"%":p=100,m="%",h="f";break;case"p":p=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===s&&(g="0"+h.toLowerCase());case"c":y=!1;case"d":v=!0,d=0;break;case"s":p=-1,h="r"}"$"===s&&(g=a[0],m=a[1]),"r"!=h||d||(h="g"),null!=d&&("g"==h?d=Math.max(1,Math.min(21,d)):"e"!=h&&"f"!=h||(d=Math.max(0,Math.min(20,d)))),h=hl.get(h)||qt;var x=c&&f;return function(t){var n=m;if(v&&t%1)return"";var a=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===l?"":l;if(p<0){var s=ui.formatPrefix(t,d);t=s.scale(t),n=s.symbol+m}else t*=p;t=h(t,d);var b,_,w=t.lastIndexOf(".");if(w<0){var k=y?t.lastIndexOf("e"):-1;k<0?(b=t,_=""):(b=t.substring(0,k),_=t.substring(k))}else b=t.substring(0,w),_=e+t.substring(w+1);!c&&f&&(b=o(b,1/0));var M=g.length+b.length+_.length+(x?0:a.length),A=M"===i?A+a+t:"^"===i?A.substring(0,M>>=1)+a+t+A.substring(M):a+(x?t:A+t))+n}}}function qt(t){return t+""}function Bt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ht(t,e,n){function r(e){var n=t(e),r=o(n,1);return e-n1)for(;i=c)return-1;if(a=e.charCodeAt(l++),37===a){if(i=e.charAt(l++),o=z[i in vl?e.charAt(l++):i],!o||(r=o(t,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}function r(t,e,n){w.lastIndex=0;var r=w.exec(e.slice(n));return r?(t.w=k.get(r[0].toLowerCase()),n+r[0].length):-1}function a(t,e,n){b.lastIndex=0;var r=b.exec(e.slice(n));return r?(t.w=_.get(r[0].toLowerCase()),n+r[0].length):-1}function o(t,e,n){T.lastIndex=0;var r=T.exec(e.slice(n));return r?(t.m=L.get(r[0].toLowerCase()),n+r[0].length):-1}function i(t,e,n){M.lastIndex=0;var r=M.exec(e.slice(n));return r?(t.m=A.get(r[0].toLowerCase()),n+r[0].length):-1}function l(t,e,r){return n(t,C.c.toString(),e,r)}function s(t,e,r){return n(t,C.x.toString(),e,r)}function c(t,e,r){return n(t,C.X.toString(),e,r)}function u(t,e,n){var r=x.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)}var f=t.dateTime,d=t.date,h=t.time,p=t.periods,g=t.days,m=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function n(t){try{gl=Bt;var e=new gl;return e._=t,r(e)}finally{gl=Date}}var r=e(t);return n.parse=function(t){try{gl=Bt;var e=r.parse(t);return e&&e._}finally{gl=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=ue;var x=ui.map(),b=Ut(g),_=Gt(g),w=Ut(m),k=Gt(m),M=Ut(v),A=Gt(v),T=Ut(y),L=Gt(y);p.forEach(function(t,e){x.set(t.toLowerCase(),e)});var C={a:function(t){return m[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(f),d:function(t,e){return Zt(t.getDate(),e,2)},e:function(t,e){return Zt(t.getDate(),e,2)},H:function(t,e){return Zt(t.getHours(),e,2)},I:function(t,e){return Zt(t.getHours()%12||12,e,2)},j:function(t,e){return Zt(1+pl.dayOfYear(t),e,3)},L:function(t,e){return Zt(t.getMilliseconds(),e,3)},m:function(t,e){return Zt(t.getMonth()+1,e,2)},M:function(t,e){return Zt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Zt(t.getSeconds(),e,2)},U:function(t,e){return Zt(pl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Zt(pl.mondayOfYear(t),e,2)},x:e(d),X:e(h),y:function(t,e){return Zt(t.getFullYear()%100,e,2)},Y:function(t,e){return Zt(t.getFullYear()%1e4,e,4)},Z:se,"%":function(){return"%"}},z={a:r,A:a,b:o,B:i,c:l,d:ne,e:ne,H:ae,I:ae,j:re,L:le,m:ee,M:oe,p:u,S:ie,U:Wt,w:Yt,W:Qt,x:s,X:c,y:Jt,Y:$t,Z:Kt,"%":ce};return e}function Zt(t,e,n){var r=t<0?"-":"",a=(r?-t:t)+"",o=a.length;return r+(o68?1900:2e3)}function ee(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ne(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function re(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function ae(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function oe(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ie(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function le(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function se(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=bi(e)/60|0,a=bi(e)%60;return n+Zt(r,"0",2)+Zt(a,"0",2); +}function ce(t,e,n){xl.lastIndex=0;var r=xl.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function ue(t){for(var e=t.length,n=-1;++n=0?1:-1,l=i*n,s=Math.cos(e),c=Math.sin(e),u=o*c,f=a*s+u*Math.cos(l),d=u*i*Math.sin(l);Al.add(Math.atan2(d,f)),r=t,a=s,o=c}var e,n,r,a,o;Tl.point=function(i,l){Tl.point=t,r=(e=i)*Vi,a=Math.cos(l=(n=l)*Vi/2+ji/4),o=Math.sin(l)},Tl.lineEnd=function(){t(e,n)}}function ve(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 be(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function ke(t){return[Math.atan2(t[1],t[0]),rt(t[2])]}function Me(t,e){return bi(t[0]-e[0])=0;--l)a.point((f=u[l])[0],f[1])}else r(h.x,h.p.x,-1,a);h=h.p}h=h.o,u=h.z,p=!p}while(!h.v);a.lineEnd()}}}function De(t){if(e=t.length){for(var e,n,r=0,a=t[0];++r0){for(_||(o.polygonStart(),_=!0),o.lineStart();++i1&&2&e&&n.push(n.pop().concat(n.shift())),h.push(n.filter(Ie))}var h,p,g,m=e(o),v=a.invert(r[0],r[1]),y={point:i,lineStart:s,lineEnd:c,polygonStart:function(){y.point=u,y.lineStart=f,y.lineEnd=d,h=[],p=[]},polygonEnd:function(){y.point=i,y.lineStart=s,y.lineEnd=c,h=ui.merge(h);var t=He(v,p);h.length?(_||(o.polygonStart(),_=!0),Pe(h,Fe,t,n,o)):t&&(_||(o.polygonStart(),_=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),_&&(o.polygonEnd(),_=!1),h=p=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}},x=Re(),b=e(x),_=!1;return y}}function Ie(t){return t.length>1}function Re(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:k,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Fe(t,e){return((t=t.x)[0]<0?t[1]-Hi-Ri:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-Ri:Hi-e[1])}function je(t){var e,n=NaN,r=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,i){var l=o>0?ji:-ji,s=bi(o-n);bi(s-ji)0?Hi:-Hi),t.point(a,r),t.lineEnd(),t.lineStart(),t.point(l,r),t.point(o,r),e=0):a!==l&&s>=ji&&(bi(n-a)Ri?Math.atan((Math.sin(e)*(o=Math.cos(r))*Math.sin(n)-Math.sin(r)*(a=Math.cos(e))*Math.sin(t))/(a*o*i)):(e+r)/2}function Be(t,e,n,r){var a;if(null==t)a=n*Hi,r.point(-ji,a),r.point(0,a),r.point(ji,a),r.point(ji,0),r.point(ji,-a),r.point(0,-a),r.point(-ji,-a),r.point(-ji,0),r.point(-ji,a);else if(bi(t[0]-e[0])>Ri){var o=t[0]=0?1:-1,k=w*_,M=k>ji,A=p*x;if(Al.add(Math.atan2(A*w*Math.sin(k),g*b+A*Math.cos(k))),o+=M?_+w*qi:_,M^d>=n^v>=n){var T=xe(ve(f),ve(t));we(T);var L=xe(a,T);we(L);var C=(M^_>=0?-1:1)*rt(L[2]);(r>C||r===C&&(T[0]||T[1]))&&(i+=M^_>=0?1:-1)}if(!m++)break;d=v,p=x,g=b,f=t}}return(o<-Ri||oo}function n(t){var n,o,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var h,p=[f,d],g=e(f,d),m=i?g?0:a(f,d):g?a(f+(f<0?ji:-ji),d):0;if(!n&&(c=s=g)&&t.lineStart(),g!==s&&(h=r(n,p),(Me(n,h)||Me(p,h))&&(p[0]+=Ri,p[1]+=Ri,g=e(p[0],p[1]))),g!==s)u=0,g?(t.lineStart(),h=r(p,n),t.point(h[0],h[1])):(h=r(n,p),t.point(h[0],h[1]),t.lineEnd()),n=h;else if(l&&n&&i^g){var v;m&o||!(v=r(p,n,!0))||(u=0,i?(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||n&&Me(n,p)||t.point(p[0],p[1]),n=p,s=g,o=m},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return u|(c&&s)<<1}}}function r(t,e,n){var r=ve(t),a=ve(e),i=[1,0,0],l=xe(r,a),s=ye(l,l),c=l[0],u=s-c*c;if(!u)return!n&&t;var f=o*s/u,d=-o*c/u,h=xe(i,l),p=_e(i,f),g=_e(l,d);be(p,g);var m=h,v=ye(p,m),y=ye(m,m),x=v*v-y*(ye(p,p)-1);if(!(x<0)){var b=Math.sqrt(x),_=_e(m,(-v-b)/y);if(be(_,p),_=ke(_),!n)return _;var w,k=t[0],M=e[0],A=t[1],T=e[1];M0^_[1]<(bi(_[0]-k)ji^(k<=_[0]&&_[0]<=M)){var S=_e(m,(-v+b)/y);return be(S,p),[_,ke(S)]}}}function a(e,n){var r=i?t:ji-t,a=0;return e<-r?a|=1:e>r&&(a|=2),n<-r?a|=4:n>r&&(a|=8),a}var o=Math.cos(t),i=o>0,l=bi(o)>Ri,s=vn(t,6*Vi);return Ee(e,n,s,i?[0,-t]:[-ji,t-ji])}function Xe(t,e,n,r){return function(a){var o,i=a.a,l=a.b,s=i.x,c=i.y,u=l.x,f=l.y,d=0,h=1,p=u-s,g=f-c;if(o=t-s,p||!(o>0)){if(o/=p,p<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=n-s,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>d&&(d=o)}else if(p>0){if(o0)){if(o/=g,g<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=r-c,g||!(o<0)){if(o/=g,g<0){if(o>h)return;o>d&&(d=o)}else if(g>0){if(o0&&(a.a={x:s+d*p,y:c+d*g}),h<1&&(a.b={x:s+h*p,y:c+h*g}),a}}}}}}function Ze(t,e,n,r){function a(r,a){return bi(r[0]-t)0?0:3:bi(r[0]-n)0?2:1:bi(r[1]-e)0?1:0:a>0?3:2}function o(t,e){return i(t.x,e.x)}function i(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(l){function s(t){for(var e=0,n=m.length,r=t[1],a=0;ar&&et(c,o,t)>0&&++e:o[1]<=r&&et(c,o,t)<0&&--e,c=o;return 0!==e}function c(o,l,s,c){var u=0,f=0;if(null==o||(u=a(o,s))!==(f=a(l,s))||i(o,l)<0^s>0){do c.point(0===u||3===u?t:n,u>1?r:e);while((u=(u+s+4)%4)!==f)}else c.point(l[0],l[1])}function u(a,o){return t<=a&&a<=n&&e<=o&&o<=r}function f(t,e){u(t,e)&&l.point(t,e)}function d(){z.point=p,m&&m.push(v=[]),M=!0,k=!1,_=w=NaN}function h(){g&&(p(y,x),b&&k&&L.rejoin(),g.push(L.buffer())),z.point=f,k&&l.lineEnd()}function p(t,e){t=Math.max(-ql,Math.min(ql,t)),e=Math.max(-ql,Math.min(ql,e));var n=u(t,e);if(m&&v.push([t,e]),M)y=t,x=e,b=n,M=!1,n&&(l.lineStart(),l.point(t,e));else if(n&&k)l.point(t,e);else{var r={a:{x:_,y:w},b:{x:t,y:e}};C(r)?(k||(l.lineStart(),l.point(r.a.x,r.a.y)),l.point(r.b.x,r.b.y),n||l.lineEnd(),A=!1):n&&(l.lineStart(),l.point(t,e),A=!1)}_=t,w=e,k=n}var g,m,v,y,x,b,_,w,k,M,A,T=l,L=Re(),C=Xe(t,e,n,r),z={point:f,lineStart:d,lineEnd:h,polygonStart:function(){l=L,g=[],m=[],A=!0},polygonEnd:function(){l=T,g=ui.merge(g);var e=s([t,r]),n=A&&e,a=g.length;(n||a)&&(l.polygonStart(),n&&(l.lineStart(),c(null,null,1,l),l.lineEnd()),a&&Pe(g,o,e,c,l),l.polygonEnd()),g=m=v=null}};return z}}function Ue(t){var e=0,n=ji/3,r=cn(t),a=r(e,n);return a.parallels=function(t){return arguments.length?r(e=t[0]*ji/180,n=t[1]*ji/180):[e/ji*180,n/ji*180]},a}function Ge(t,e){function n(t,e){var n=Math.sqrt(o-2*a*Math.sin(e))/a;return[n*Math.sin(t*=a),i-n*Math.cos(t)]}var r=Math.sin(t),a=(r+Math.sin(e))/2,o=1+r*(2*a-r),i=Math.sqrt(o)/a;return n.invert=function(t,e){var n=i-e;return[Math.atan2(t,n)/a,rt((o-(t*t+n*n)*a*a)/(2*a))]},n}function Ye(){function t(t,e){Hl+=a*t-r*e,r=t,a=e}var e,n,r,a;Gl.point=function(o,i){Gl.point=t,e=r=o,n=a=i},Gl.lineEnd=function(){t(e,n)}}function We(t,e){tZl&&(Zl=t),eUl&&(Ul=e)}function Qe(){function t(t,e){i.push("M",t,",",e,o)}function e(t,e){i.push("M",t,",",e),l.point=n}function n(t,e){i.push("L",t,",",e)}function r(){l.point=t}function a(){i.push("Z")}var o=$e(4.5),i=[],l={point:t,lineStart:function(){l.point=e},lineEnd:r,polygonStart:function(){l.lineEnd=a},polygonEnd:function(){l.lineEnd=r,l.point=t},pointRadius:function(t){return o=$e(t),l},result:function(){if(i.length){var t=i.join("");return i=[],t}}};return l}function $e(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Je(t,e){zl+=t,Sl+=e,++Ol}function Ke(){function t(t,r){var a=t-e,o=r-n,i=Math.sqrt(a*a+o*o);Pl+=i*(e+t)/2,Dl+=i*(n+r)/2,Nl+=i,Je(e=t,n=r)}var e,n;Wl.point=function(r,a){Wl.point=t,Je(e=r,n=a)}}function tn(){Wl.point=Je}function en(){function t(t,e){var n=t-r,o=e-a,i=Math.sqrt(n*n+o*o);Pl+=i*(r+t)/2,Dl+=i*(a+e)/2,Nl+=i,i=a*t-r*e,El+=i*(r+t),Il+=i*(a+e),Rl+=3*i,Je(r=t,a=e)}var e,n,r,a;Wl.point=function(o,i){Wl.point=t,Je(e=r=o,n=a=i)},Wl.lineEnd=function(){t(e,n)}}function nn(t){function e(e,n){t.moveTo(e+i,n),t.arc(e,n,i,0,qi)}function n(e,n){t.moveTo(e,n),l.point=r}function r(e,n){t.lineTo(e,n)}function a(){l.point=e}function o(){t.closePath()}var i=4.5,l={point:e,lineStart:function(){l.point=n},lineEnd:a,polygonStart:function(){l.lineEnd=o},polygonEnd:function(){l.lineEnd=a,l.point=e},pointRadius:function(t){return i=t,l},result:k};return l}function rn(t){function e(t){return(l?r:n)(t)}function n(e){return ln(e,function(n,r){n=t(n,r),e.point(n[0],n[1])})}function r(e){function n(n,r){n=t(n,r),e.point(n[0],n[1])}function r(){x=NaN,M.point=o,e.lineStart()}function o(n,r){var o=ve([n,r]),i=t(n,r);a(x,b,y,_,w,k,x=i[0],b=i[1],y=n,_=o[0],w=o[1],k=o[2],l,e),e.point(x,b)}function i(){M.point=n,e.lineEnd()}function s(){r(),M.point=c,M.lineEnd=u}function c(t,e){o(f=t,d=e),h=x,p=b,g=_,m=w,v=k,M.point=o}function u(){a(x,b,y,_,w,k,h,p,f,g,m,v,l,e),M.lineEnd=i,i()}var f,d,h,p,g,m,v,y,x,b,_,w,k,M={point:n,lineStart:r,lineEnd:i,polygonStart:function(){e.polygonStart(),M.lineStart=s},polygonEnd:function(){e.polygonEnd(),M.lineStart=r}};return M}function a(e,n,r,l,s,c,u,f,d,h,p,g,m,v){var y=u-e,x=f-n,b=y*y+x*x;if(b>4*o&&m--){var _=l+h,w=s+p,k=c+g,M=Math.sqrt(_*_+w*w+k*k),A=Math.asin(k/=M),T=bi(bi(k)-1)o||bi((y*S+x*O)/b-.5)>.3||l*h+s*p+c*g0&&16,e):Math.sqrt(o)},e}function an(t){var e=rn(function(e,n){return t([e*Xi,n*Xi])});return function(t){return un(e(t))}}function on(t){this.stream=t}function ln(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 sn(t){return cn(function(){return t})()}function cn(t){function e(t){return t=l(t[0]*Vi,t[1]*Vi),[t[0]*d+s,c-t[1]*d]}function n(t){return t=l.invert((t[0]-s)/d,(c-t[1])/d),t&&[t[0]*Xi,t[1]*Xi]}function r(){l=Se(i=hn(v,y,x),o);var t=o(g,m);return s=h-t[0]*d,c=p+t[1]*d,a()}function a(){return u&&(u.valid=!1,u=null),e}var o,i,l,s,c,u,f=rn(function(t,e){return t=o(t,e),[t[0]*d+s,c-t[1]*d]}),d=150,h=480,p=250,g=0,m=0,v=0,y=0,x=0,_=jl,w=b,k=null,M=null;return e.stream=function(t){return u&&(u.valid=!1),u=un(_(i,f(w(t)))),u.valid=!0,u},e.clipAngle=function(t){return arguments.length?(_=null==t?(k=t,jl):Ve((k=+t)*Vi),a()):k},e.clipExtent=function(t){return arguments.length?(M=t,w=t?Ze(t[0][0],t[0][1],t[1][0],t[1][1]):b,a()):M},e.scale=function(t){return arguments.length?(d=+t,r()):d},e.translate=function(t){return arguments.length?(h=+t[0],p=+t[1],r()):[h,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Vi,m=t[1]%360*Vi,r()):[g*Xi,m*Xi]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Vi,y=t[1]%360*Vi,x=t.length>2?t[2]%360*Vi:0,r()):[v*Xi,y*Xi,x*Xi]},ui.rebind(e,f,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&n,r()}}function un(t){return ln(t,function(e,n){t.point(e*Vi,n*Vi)})}function fn(t,e){return[t,e]}function dn(t,e){return[t>ji?t-qi:t<-ji?t+qi:t,e]}function hn(t,e,n){return t?e||n?Se(gn(t),mn(e,n)):gn(t):e||n?mn(e,n):dn}function pn(t){return function(e,n){return e+=t,[e>ji?e-qi:e<-ji?e+qi:e,n]}}function gn(t){var e=pn(t);return e.invert=pn(-t),e}function mn(t,e){function n(t,e){var n=Math.cos(e),l=Math.cos(t)*n,s=Math.sin(t)*n,c=Math.sin(e),u=c*r+l*a;return[Math.atan2(s*o-u*i,l*r-c*a),rt(u*o+s*i)]}var r=Math.cos(t),a=Math.sin(t),o=Math.cos(e),i=Math.sin(e);return n.invert=function(t,e){var n=Math.cos(e),l=Math.cos(t)*n,s=Math.sin(t)*n,c=Math.sin(e),u=c*o-s*i;return[Math.atan2(s*o+c*i,l*r+u*a),rt(u*r-l*a)]},n}function vn(t,e){var n=Math.cos(t),r=Math.sin(t);return function(a,o,i,l){var s=i*e;null!=a?(a=yn(n,a),o=yn(n,o),(i>0?ao)&&(a+=i*qi)):(a=t+i*qi,o=t-.5*s);for(var c,u=a;i>0?u>o:u0?e<-Hi+Ri&&(e=-Hi+Ri):e>Hi-Ri&&(e=Hi-Ri);var n=i/Math.pow(a(e),o);return[n*Math.sin(o*t),i-n*Math.cos(o*t)]}var r=Math.cos(t),a=function(t){return Math.tan(ji/4+t/2)},o=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(a(e)/a(t)),i=r*Math.pow(a(t),o)/o;return o?(n.invert=function(t,e){var n=i-e,r=tt(o)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/o,2*Math.atan(Math.pow(i/r,1/o))-Hi]},n):Cn}function Ln(t,e){function n(t,e){var n=o-e;return[n*Math.sin(a*t),o-n*Math.cos(a*t)]}var r=Math.cos(t),a=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),o=r/a+t;return bi(a)1&&et(t[n[r-2]],t[n[r-1]],t[a])<=0;)--r;n[r++]=a}return n.slice(0,r)}function Nn(t,e){return t[0]-e[0]||t[1]-e[1]}function En(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function In(t,e,n,r){var a=t[0],o=n[0],i=e[0]-a,l=r[0]-o,s=t[1],c=n[1],u=e[1]-s,f=r[1]-c,d=(l*(s-c)-f*(a-o))/(f*i-l*u);return[a+d*i,s+d*u]}function Rn(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function Fn(){or(this),this.edge=this.site=this.circle=null}function jn(t){var e=cs.pop()||new Fn;return e.site=t,e}function qn(t){Qn(t),is.remove(t),cs.push(t),or(t)}function Bn(t){var e=t.circle,n=e.x,r=e.cy,a={x:n,y:r},o=t.P,i=t.N,l=[t];qn(t);for(var s=o;s.circle&&bi(n-s.circle.x)Ri)l=l.L;else{if(a=o-Xn(l,i),!(a>Ri)){r>-Ri?(e=l.P,n=l):a>-Ri?(e=l,n=l.N):e=n=l;break}if(!l.R){e=l;break}l=l.R}var s=jn(t);if(is.insert(e,s),e||n){if(e===n)return Qn(e),n=jn(e.site),is.insert(s,n),s.edge=n.edge=tr(e.site,s.site),Wn(e),void Wn(n);if(!n)return void(s.edge=tr(e.site,s.site));Qn(e),Qn(n);var c=e.site,u=c.x,f=c.y,d=t.x-u,h=t.y-f,p=n.site,g=p.x-u,m=p.y-f,v=2*(d*m-h*g),y=d*d+h*h,x=g*g+m*m,b={x:(m*y-h*x)/v+u,y:(d*x-g*y)/v+f};nr(n.edge,c,p,b),s.edge=tr(c,t,null,b),n.edge=tr(t,p,null,b),Wn(e),Wn(n)}}function Vn(t,e){var n=t.site,r=n.x,a=n.y,o=a-e;if(!o)return r;var i=t.P;if(!i)return-(1/0);n=i.site;var l=n.x,s=n.y,c=s-e;if(!c)return l;var u=l-r,f=1/o-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-o/2)))/f+r:(r+l)/2}function Xn(t,e){var n=t.N;if(n)return Vn(n,e);var r=t.site;return r.y===e?r.x:1/0}function Zn(t){this.site=t,this.edges=[]}function Un(t){for(var e,n,r,a,o,i,l,s,c,u,f=t[0][0],d=t[1][0],h=t[0][1],p=t[1][1],g=os,m=g.length;m--;)if(o=g[m],o&&o.prepare())for(l=o.edges,s=l.length,i=0;iRi||bi(a-n)>Ri)&&(l.splice(i,0,new rr(er(o.site,u,bi(r-f)Ri?{x:f,y:bi(e-f)Ri?{x:bi(n-p)Ri?{x:d,y:bi(e-d)Ri?{x:bi(n-h)=-Fi)){var h=s*s+c*c,p=u*u+f*f,g=(f*h-c*p)/d,m=(s*p-u*h)/d,f=m+l,v=us.pop()||new Yn;v.arc=t,v.site=a,v.x=g+i,v.y=f+Math.sqrt(g*g+m*m),v.cy=f,t.circle=v;for(var y=null,x=ss._;x;)if(v.y=l)return;if(d>p){if(o){if(o.y>=c)return}else o={x:m,y:s};n={x:m,y:c}}else{if(o){if(o.y1)if(d>p){if(o){if(o.y>=c)return}else o={x:(s-a)/r,y:s};n={x:(c-a)/r,y:c}}else{if(o){if(o.y=l)return}else o={x:i,y:r*i+a};n={x:l,y:r*l+a}}else{if(o){if(o.xo||f>i||d=b,k=n>=_,M=k<<1|w,A=M+4;Mo&&(a=e.slice(o,a),l[i]?l[i]+=a:l[++i]=a),(n=n[0])===(r=r[0])?l[i]?l[i]+=r:l[++i]=r:(l[++i]=null,s.push({i:i,x:xr(n,r)})),o=hs.lastIndex;return o=0&&!(n=ui.interpolators[r](t,e)););return n}function wr(t,e){var n,r=[],a=[],o=t.length,i=e.length,l=Math.min(t.length,e.length);for(n=0;n=1?1:t(e)}}function Mr(t){return function(e){return 1-t(1-e)}}function Ar(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tr(t){return t*t}function Lr(t){return t*t*t}function Cr(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function zr(t){return function(e){return Math.pow(e,t)}}function Sr(t){return 1-Math.cos(t*Hi)}function Or(t){return Math.pow(2,10*(t-1))}function Pr(t){return 1-Math.sqrt(1-t*t)}function Dr(t,e){var n;return arguments.length<2&&(e=.45),arguments.length?n=e/qi*Math.asin(1/t):(t=1,n=e/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-n)*qi/e)}}function Nr(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Er(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 Ir(t,e){t=ui.hcl(t),e=ui.hcl(e);var n=t.h,r=t.c,a=t.l,o=e.h-n,i=e.c-r,l=e.l-a;return isNaN(i)&&(i=0,r=isNaN(r)?e.c:r),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360),function(t){return dt(n+o*t,r+i*t,a+l*t)+""}}function Rr(t,e){t=ui.hsl(t),e=ui.hsl(e);var n=t.h,r=t.s,a=t.l,o=e.h-n,i=e.s-r,l=e.l-a;return isNaN(i)&&(i=0,r=isNaN(r)?e.s:r),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360),function(t){return ut(n+o*t,r+i*t,a+l*t)+""}}function Fr(t,e){t=ui.lab(t),e=ui.lab(e);var n=t.l,r=t.a,a=t.b,o=e.l-n,i=e.a-r,l=e.b-a;return function(t){return pt(n+o*t,r+i*t,a+l*t)+""}}function jr(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function qr(t){var e=[t.a,t.b],n=[t.c,t.d],r=Hr(e),a=Br(e,n),o=Hr(Vr(n,e,-a))||0;e[0]*n[1]180?e+=360:e-t>180&&(t+=360),r.push({i:n.push(Xr(n)+"rotate(",null,")")-2,x:xr(t,e)})):e&&n.push(Xr(n)+"rotate("+e+")")}function Gr(t,e,n,r){t!==e?r.push({i:n.push(Xr(n)+"skewX(",null,")")-2,x:xr(t,e)}):e&&n.push(Xr(n)+"skewX("+e+")")}function Yr(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var a=n.push(Xr(n)+"scale(",null,",",null,")");r.push({i:a-4,x:xr(t[0],e[0])},{i:a-2,x:xr(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(Xr(n)+"scale("+e+")")}function Wr(t,e){var n=[],r=[];return t=ui.transform(t),e=ui.transform(e),Zr(t.translate,e.translate,n,r),Ur(t.rotate,e.rotate,n,r),Gr(t.skew,e.skew,n,r),Yr(t.scale,e.scale,n,r),t=e=null,function(t){for(var e,a=-1,o=r.length;++a=0;)n.push(a[r])}function sa(t,e){for(var n=[t],r=[];null!=(t=n.pop());)if(r.push(t),(o=t.children)&&(a=o.length))for(var a,o,i=-1;++ia&&(r=n,a=e);return r}function xa(t){return t.reduce(ba,0)}function ba(t,e){return t+e[1]}function _a(t,e){return wa(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wa(t,e){for(var n=-1,r=+t[0],a=(t[1]-r)/e,o=[];++n<=e;)o[n]=a*n+r;return o}function ka(t){return[ui.min(t),ui.max(t)]}function Ma(t,e){return t.value-e.value}function Aa(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Ta(t,e){t._pack_next=e,e._pack_prev=t}function La(t,e){var n=e.x-t.x,r=e.y-t.y,a=t.r+e.r;return.999*a*a>n*n+r*r}function Ca(t){function e(t){u=Math.min(t.x-t.r,u),f=Math.max(t.x+t.r,f),d=Math.min(t.y-t.r,d),h=Math.max(t.y+t.r,h)}if((n=t.children)&&(c=n.length)){var n,r,a,o,i,l,s,c,u=1/0,f=-(1/0),d=1/0,h=-(1/0);if(n.forEach(za),r=n[0],r.x=-r.r,r.y=0,e(r),c>1&&(a=n[1],a.x=a.r,a.y=0,e(a),c>2))for(o=n[2],Pa(r,a,o),e(o),Aa(r,o),r._pack_prev=o,Aa(o,a),a=r._pack_next,i=3;i=0;)e=a[o],e.z+=n,e.m+=n,n+=e.s+(r+=e.c)}function Fa(t,e,n){return t.a.parent===e.parent?t.a:n}function ja(t){return 1+ui.max(t,function(t){return t.y})}function qa(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ba(t){var e=t.children;return e&&e.length?Ba(e[0]):t}function Ha(t){var e,n=t.children;return n&&(e=n.length)?Ha(n[e-1]):t}function Va(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Xa(t,e){var n=t.x+e[3],r=t.y+e[0],a=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return a<0&&(n+=a/2,a=0),o<0&&(r+=o/2,o=0),{x:n,y:r,dx:a,dy:o}}function Za(t){var e=t[0],n=t[t.length-1];return e2?Qa:Ga,s=r?$r:Qr;return i=a(t,e,s,n),l=a(e,t,s,_r),o}function o(t){return i(t)}var i,l;return o.invert=function(t){return l(t)},o.domain=function(e){return arguments.length?(t=e.map(Number),a()):t},o.range=function(t){return arguments.length?(e=t,a()):e},o.rangeRound=function(t){return o.range(t).interpolate(jr)},o.clamp=function(t){return arguments.length?(r=t,a()):r},o.interpolate=function(t){return arguments.length?(n=t,a()):n},o.ticks=function(e){return eo(t,e)},o.tickFormat=function(e,n){return no(t,e,n)},o.nice=function(e){return Ka(t,e),a()},o.copy=function(){return $a(t,e,n,r)},a()}function Ja(t,e){return ui.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ka(t,e){return Ya(t,Wa(to(t,e)[2])),Ya(t,Wa(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var n=Za(t),r=n[1]-n[0],a=Math.pow(10,Math.floor(Math.log(r/e)/Math.LN10)),o=e/r*a;return o<=.15?a*=10:o<=.35?a*=5:o<=.75&&(a*=2),n[0]=Math.ceil(n[0]/a)*a,n[1]=Math.floor(n[1]/a)*a+.5*a,n[2]=a,n}function eo(t,e){return ui.range.apply(ui,to(t,e))}function no(t,e,n){var r=to(t,e);if(n){var a=dl.exec(n);if(a.shift(),"s"===a[8]){var o=ui.formatPrefix(Math.max(bi(r[0]),bi(r[1])));return a[7]||(a[7]="."+ro(o.scale(r[2]))),a[8]="f",n=ui.format(a.join("")),function(t){return n(o.scale(t))+o.symbol}}a[7]||(a[7]="."+ao(a[8],r)),n=a.join("")}else n=",."+ro(r[2])+"f";return ui.format(n)}function ro(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ao(t,e){var n=ro(e[2]);return t in As?Math.abs(n-ro(Math.max(bi(e[0]),bi(e[1]))))+ +("e"!==t):n-2*("%"===t)}function oo(t,e,n,r){function a(t){return(n?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return n?Math.pow(e,t):-Math.pow(e,-t)}function i(e){return t(a(e))}return i.invert=function(e){return o(t.invert(e))},i.domain=function(e){return arguments.length?(n=e[0]>=0,t.domain((r=e.map(Number)).map(a)),i):r},i.base=function(n){return arguments.length?(e=+n,t.domain(r.map(a)),i):e},i.nice=function(){var e=Ya(r.map(a),n?Math:Ls);return t.domain(e),r=e.map(o),i},i.ticks=function(){var t=Za(r),i=[],l=t[0],s=t[1],c=Math.floor(a(l)),u=Math.ceil(a(s)),f=e%1?2:e;if(isFinite(u-c)){if(n){for(;c0;d--)i.push(o(c)*d);for(c=0;i[c]s;u--);i=i.slice(c,u)}return i},i.tickFormat=function(t,n){if(!arguments.length)return Ts;arguments.length<2?n=Ts:"function"!=typeof n&&(n=ui.format(n));var r=Math.max(1,e*t/i.ticks().length);return function(t){var i=t/o(Math.round(a(t)));return i*e0?l[n-1]:t[0],n0?0:1}function _o(t,e,n,r,a){var o=t[0]-e[0],i=t[1]-e[1],l=(a?r:-r)/Math.sqrt(o*o+i*i),s=l*i,c=-l*o,u=t[0]+s,f=t[1]+c,d=e[0]+s,h=e[1]+c,p=(u+d)/2,g=(f+h)/2,m=d-u,v=h-f,y=m*m+v*v,x=n-r,b=u*h-d*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-p,L=k-g,C=M-p,z=A-g;return T*T+L*L>C*C+z*z&&(w=M,k=A),[[w-s,k-c],[w*n/x,k*n/x]]}function wo(t){function e(e){function i(){c.push("M",o(t(u),l))}for(var s,c=[],u=[],f=-1,d=e.length,h=Ct(n),p=Ct(r);++f1?t.join("L"):t+"Z"}function Mo(t){return t.join("L")+"Z"}function Ao(t){for(var e=0,n=t.length,r=t[0],a=[r[0],",",r[1]];++e1&&a.push("H",r[0]),a.join("")}function To(t){for(var e=0,n=t.length,r=t[0],a=[r[0],",",r[1]];++e1){l=e[1],o=t[s],s++,r+="C"+(a[0]+i[0])+","+(a[1]+i[1])+","+(o[0]-l[0])+","+(o[1]-l[1])+","+o[0]+","+o[1];for(var c=2;c9&&(a=3*e/Math.sqrt(a),i[l]=a*n,i[l+1]=a*r));for(l=-1;++l<=s;)a=(t[Math.min(s,l+1)][0]-t[Math.max(0,l-1)][0])/(6*(1+i[l]*i[l])),o.push([a||0,i[l]*a||0]);return o}function Ho(t){return t.length<3?ko(t):t[0]+Oo(t,Bo(t))}function Vo(t){for(var e,n,r,a=-1,o=t.length;++a0;)h[--l].call(t,i);if(o>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[r]:delete t[n],1}var s,c,u,d,h,p=t[n]||(t[n]={active:0,count:0}),g=p[r];g||(s=a.time,c=Dt(o,0,s),g=p[r]={tween:new f,time:s,timer:c,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++p.count)}function ri(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate("+(isFinite(r)?r:n(t))+",0)"})}function ai(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate(0,"+(isFinite(r)?r:n(t))+")"})}function oi(t){return t.toISOString()}function ii(t,e,n){function r(e){return t(e)}function a(t,n){var r=t[1]-t[0],a=r/n,o=ui.bisect(Js,a);return o==Js.length?[e.year,to(t.map(function(t){return t/31536e6}),n)[2]]:o?e[a/Js[o-1]1?{floor:function(e){for(;n(e=t.floor(e));)e=li(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=li(+e+1);return e}}:t))},r.ticks=function(t,e){var n=Za(r.domain()),o=null==t?a(n,10):"number"==typeof t?a(n,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(n[0],li(+n[1]+1),e<1?1:e)},r.tickFormat=function(){return n},r.copy=function(){return ii(t.copy(),e,n)},Ja(r,t)}function li(t){return new Date(t)}function si(t){return JSON.parse(t.responseText)}function ci(t){var e=hi.createRange();return e.selectNode(hi.body),e.createContextualFragment(t.responseText)}var ui={version:"3.5.17"},fi=[].slice,di=function(t){return fi.call(t)},hi=this.document;if(hi)try{di(hi.documentElement.childNodes)[0].nodeType}catch(t){di=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),hi)try{hi.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var pi=this.Element.prototype,gi=pi.setAttribute,mi=pi.setAttributeNS,vi=this.CSSStyleDeclaration.prototype,yi=vi.setProperty;pi.setAttribute=function(t,e){gi.call(this,t,e+"")},pi.setAttributeNS=function(t,e,n){mi.call(this,t,e,n+"")},vi.setProperty=function(t,e,n){yi.call(this,t,e+"",n)}}ui.ascending=a,ui.descending=function(t,e){return et?1:e>=t?0:NaN},ui.min=function(t,e){var n,r,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=r;break}for(;++ar&&(n=r)}else{for(;++a=r){n=r;break}for(;++ar&&(n=r)}return n},ui.max=function(t,e){var n,r,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=r;break}for(;++an&&(n=r)}else{for(;++a=r){n=r;break}for(;++an&&(n=r)}return n},ui.extent=function(t,e){var n,r,a,o=-1,i=t.length;if(1===arguments.length){for(;++o=r){n=a=r;break}for(;++or&&(n=r),a=r){n=a=r;break}for(;++or&&(n=r),a1)return s/(u-1)},ui.deviation=function(){var t=ui.variance.apply(this,arguments);return t?Math.sqrt(t):t};var xi=l(a);ui.bisectLeft=xi.left,ui.bisect=ui.bisectRight=xi.right,ui.bisector=function(t){return l(1===t.length?function(e,n){return a(t(e),n)}:t)},ui.shuffle=function(t,e,n){(o=arguments.length)<3&&(n=t.length,o<2&&(e=0));for(var r,a,o=n-e;o;)a=Math.random()*o--|0,r=t[o+e],t[o+e]=t[a+e],t[a+e]=r;return t},ui.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r},ui.pairs=function(t){for(var e,n=0,r=t.length-1,a=t[0],o=new Array(r<0?0:r);n=0;)for(r=t[a],e=r.length;--e>=0;)n[--i]=r[e];return n};var bi=Math.abs;ui.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n===1/0)throw new Error("infinite range");var r,a=[],o=c(bi(n)),i=-1;if(t*=o,e*=o,n*=o,n<0)for(;(r=t+n*++i)>e;)a.push(r/o);else for(;(r=t+n*++i)=o.length)return r?r.call(a,i):n?i.sort(n):i;for(var s,c,u,d,h=-1,p=i.length,g=o[l++],m=new f;++h=o.length)return t;var r=[],a=i[n++];return t.forEach(function(t,a){r.push({key:t,values:e(a,n)})}),a?r.sort(function(t,e){return a(t.key,e.key)}):r}var n,r,a={},o=[],i=[];return a.map=function(e,n){return t(n,e,0)},a.entries=function(n){return e(t(ui.map,n,0),0)},a.key=function(t){return o.push(t),a},a.sortKeys=function(t){return i[o.length-1]=t,a},a.sortValues=function(t){return n=t,a},a.rollup=function(t){return r=t,a},a},ui.set=function(t){var e=new x;if(t)for(var n=0,r=t.length;n=0&&(r=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},ui.event=null,ui.requote=function(t){return t.replace(Mi,"\\$&")};var Mi=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ai={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},Ti=function(t,e){return e.querySelector(t)},Li=function(t,e){return e.querySelectorAll(t)},Ci=function(t,e){var n=t.matches||t[w(t,"matchesSelector")];return(Ci=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Ti=function(t,e){return Sizzle(t,e)[0]||null},Li=Sizzle,Ci=Sizzle.matchesSelector),ui.selection=function(){return ui.select(hi.documentElement)};var zi=ui.selection.prototype=[];zi.select=function(t){var e,n,r,a,o=[];t=S(t);for(var i=-1,l=this.length;++i=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Oi.hasOwnProperty(n)?{space:Oi[n],local:t}:t}},zi.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();return t=ui.ns.qualify(t),t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(P(e,t[e]));return this}return this.each(P(t,e))},zi.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=E(t)).length,a=-1;if(e=n.classList){for(;++a=0;)(n=r[a])&&(o&&o!==n.nextSibling&&o.parentNode.insertBefore(n,o),o=n);return this},zi.sort=function(t){t=X.apply(this,arguments);for(var e=-1,n=this.length;++e0&&(e=e.transition().duration(z)),e.call(t.event)}function l(){_&&_.domain(b.range().map(function(t){return(t-M.x)/M.k}).map(b.invert)),k&&k.domain(w.range().map(function(t){return(t-M.y)/M.k}).map(w.invert))}function s(t){S++||t({type:"zoomstart"})}function c(t){l(),t({type:"zoom",scale:M.k,translate:[M.x,M.y]})}function u(t){--S||(t({type:"zoomend"}),m=null)}function f(){function t(){l=1,o(ui.mouse(a),d),c(i)}function n(){f.on(P,null).on(D,null),h(l),u(i)}var a=this,i=E.of(a,arguments),l=0,f=ui.select(r(a)).on(P,t).on(D,n),d=e(ui.mouse(a)),h=$(a);Hs.call(a),s(i)}function d(){function t(){ +var t=ui.touches(p);return h=M.k,t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))}),t}function n(){var e=ui.event.target;ui.select(e).on(b,r).on(_,l),w.push(e);for(var n=ui.event.changedTouches,a=0,o=n.length;a1){var u=s[0],f=s[1],d=u[0]-f[0],h=u[1]-f[1];v=d*d+h*h}}function r(){var t,e,n,r,i=ui.touches(p);Hs.call(p);for(var l=0,s=i.length;l=c)return i;if(a)return a=!1,o;var e=u;if(34===t.charCodeAt(e)){for(var n=e;n++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,hl=ui.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=ui.round(t,Rt(t,e))).toFixed(Math.max(0,Math.min(20,Rt(t*(1+1e-15),e))))}}),pl=ui.time={},gl=Date;Bt.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(){ml.setUTCDate.apply(this._,arguments)},setDay:function(){ml.setUTCDay.apply(this._,arguments)},setFullYear:function(){ml.setUTCFullYear.apply(this._,arguments)},setHours:function(){ml.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ml.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ml.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ml.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ml.setUTCSeconds.apply(this._,arguments)},setTime:function(){ml.setTime.apply(this._,arguments)}};var ml=Date.prototype;pl.year=Ht(function(t){return t=pl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),pl.years=pl.year.range,pl.years.utc=pl.year.utc.range,pl.day=Ht(function(t){var e=new gl(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),pl.days=pl.day.range,pl.days.utc=pl.day.utc.range,pl.dayOfYear=function(t){var e=pl.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=pl[t]=Ht(function(t){return(t=pl.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});pl[t+"s"]=n.range,pl[t+"s"].utc=n.utc.range,pl[t+"OfYear"]=function(t){var n=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(n+e)%7)/7)}}),pl.week=pl.sunday,pl.weeks=pl.sunday.range,pl.weeks.utc=pl.sunday.utc.range,pl.weekOfYear=pl.sundayOfYear;var vl={"-":"",_:" ",0:"0"},yl=/^\s*\d+/,xl=/^%/;ui.locale=function(t){return{numberFormat:jt(t),timeFormat:Xt(t)}};var bl=ui.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"]});ui.format=bl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,_l),de(_l.s,this.s,this),this.s?this.t+=_l.t:this.s=_l.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _l=new fe;ui.geo.stream=function(t,e){t&&wl.hasOwnProperty(t.type)?wl[t.type](t,e):he(t,e)};var wl={Feature:function(t,e){he(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,a=n.length;++rh&&(h=e)}function e(e,n){var r=ve([e*Vi,n*Vi]);if(v){var a=xe(v,r),o=[a[1],-a[0],0],i=xe(o,a);we(i),i=ke(i);var s=e-p,c=s>0?1:-1,g=i[0]*Xi*c,m=bi(s)>180;if(m^(c*ph&&(h=y)}else if(g=(g+360)%360-180,m^(c*ph&&(h=n);m?el(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e):d>=u?(ed&&(d=e)):e>p?l(u,e)>l(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e)}else t(e,n);v=r,p=e}function n(){_.point=e}function r(){b[0]=u,b[1]=d,_.point=t,v=null}function a(t,n){if(v){var r=t-p;y+=bi(r)>180?r+(r>0?360:-360):r}else g=t,m=n;Tl.point(t,n),e(t,n)}function o(){Tl.lineStart()}function i(){a(g,m),Tl.lineEnd(),bi(y)>Ri&&(u=-(d=180)),b[0]=u,b[1]=d,v=null}function l(t,e){return(e-=t)<0?e+360:e}function s(t,e){return t[0]-e[0]}function c(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tRi?h=90:y<-Ri&&(f=-90),b[0]=u,b[1]=d}};return function(t){h=d=-(u=f=1/0),x=[],ui.geo.stream(t,_);var e=x.length;if(e){x.sort(s);for(var n,r=1,a=x[0],o=[a];rl(a[0],a[1])&&(a[1]=n[1]),l(n[0],a[1])>l(a[0],a[1])&&(a[0]=n[0])):o.push(a=n);for(var i,n,p=-(1/0),e=o.length-1,r=0,a=o[e];r<=e;a=n,++r)n=o[r],(i=l(a[1],n[0]))>p&&(p=i,u=n[0],d=a[1])}return x=b=null,u===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[u,f],[d,h]]}}(),ui.geo.centroid=function(t){Ll=Cl=zl=Sl=Ol=Pl=Dl=Nl=El=Il=Rl=0,ui.geo.stream(t,Fl);var e=El,n=Il,r=Rl,a=e*e+n*n+r*r;return a=.12&&a<.234&&r>=-.425&&r<-.214?i:a>=.166&&a<.234&&r>=-.214&&r<-.115?l:o).invert(t)},t.stream=function(t){var e=o.stream(t),n=i.stream(t),r=l.stream(t);return{point:function(t,a){e.point(t,a),n.point(t,a),r.point(t,a)},sphere:function(){e.sphere(),n.sphere(),r.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),i.precision(e),l.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),i.scale(.35*e),l.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var c=o.scale(),u=+e[0],f=+e[1];return n=o.translate(e).clipExtent([[u-.455*c,f-.238*c],[u+.455*c,f+.238*c]]).stream(s).point,r=i.translate([u-.307*c,f+.201*c]).clipExtent([[u-.425*c+Ri,f+.12*c+Ri],[u-.214*c-Ri,f+.234*c-Ri]]).stream(s).point,a=l.translate([u-.205*c,f+.212*c]).clipExtent([[u-.214*c+Ri,f+.166*c+Ri],[u-.115*c-Ri,f+.234*c-Ri]]).stream(s).point,t},t.scale(1070)};var Bl,Hl,Vl,Xl,Zl,Ul,Gl={point:k,lineStart:k,lineEnd:k,polygonStart:function(){Hl=0,Gl.lineStart=Ye},polygonEnd:function(){Gl.lineStart=Gl.lineEnd=Gl.point=k,Bl+=bi(Hl/2)}},Yl={point:We,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Wl={point:Je,lineStart:Ke,lineEnd:tn,polygonStart:function(){Wl.lineStart=en},polygonEnd:function(){Wl.point=Je,Wl.lineStart=Ke,Wl.lineEnd=tn}};ui.geo.path=function(){function t(t){return t&&("function"==typeof l&&o.pointRadius(+l.apply(this,arguments)),i&&i.valid||(i=a(o)),ui.geo.stream(t,i)),o.result()}function e(){return i=null,t}var n,r,a,o,i,l=4.5;return t.area=function(t){return Bl=0,ui.geo.stream(t,a(Gl)),Bl},t.centroid=function(t){return zl=Sl=Ol=Pl=Dl=Nl=El=Il=Rl=0,ui.geo.stream(t,a(Wl)),Rl?[El/Rl,Il/Rl]:Nl?[Pl/Nl,Dl/Nl]:Ol?[zl/Ol,Sl/Ol]:[NaN,NaN]},t.bounds=function(t){return Zl=Ul=-(Vl=Xl=1/0),ui.geo.stream(t,a(Yl)),[[Vl,Xl],[Zl,Ul]]},t.projection=function(t){return arguments.length?(a=(n=t)?t.stream||an(t):b,e()):n},t.context=function(t){return arguments.length?(o=null==(r=t)?new Qe:new nn(t),"function"!=typeof l&&o.pointRadius(l),e()):r},t.pointRadius=function(e){return arguments.length?(l="function"==typeof e?e:(o.pointRadius(+e),+e),t):l},t.projection(ui.geo.albersUsa()).context(null)},ui.geo.transform=function(t){return{stream:function(e){var n=new on(e);for(var r in t)n[r]=t[r];return n}}},on.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()}},ui.geo.projection=sn,ui.geo.projectionMutator=cn,(ui.geo.equirectangular=function(){return sn(fn)}).raw=fn.invert=fn,ui.geo.rotation=function(t){function e(e){return e=t(e[0]*Vi,e[1]*Vi),e[0]*=Xi,e[1]*=Xi,e}return t=hn(t[0]%360*Vi,t[1]*Vi,t.length>2?t[2]*Vi:0),e.invert=function(e){return e=t.invert(e[0]*Vi,e[1]*Vi),e[0]*=Xi,e[1]*=Xi,e},e},dn.invert=fn,ui.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,e=hn(-t[0]*Vi,-t[1]*Vi,0).invert,a=[];return n(null,null,1,{point:function(t,n){a.push(t=e(t,n)),t[0]*=Xi,t[1]*=Xi}}),{type:"Polygon",coordinates:[a]}}var e,n,r=[0,0],a=6;return t.origin=function(e){return arguments.length?(r=e,t):r},t.angle=function(r){return arguments.length?(n=vn((e=+r)*Vi,a*Vi),t):e},t.precision=function(r){return arguments.length?(n=vn(e*Vi,(a=+r)*Vi),t):a},t.angle(90)},ui.geo.distance=function(t,e){var n,r=(e[0]-t[0])*Vi,a=t[1]*Vi,o=e[1]*Vi,i=Math.sin(r),l=Math.cos(r),s=Math.sin(a),c=Math.cos(a),u=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((n=f*i)*n+(n=c*u-s*f*l)*n),s*u+c*f*l)},ui.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return ui.range(Math.ceil(o/m)*m,a,m).map(d).concat(ui.range(Math.ceil(c/v)*v,s,v).map(h)).concat(ui.range(Math.ceil(r/p)*p,n,p).filter(function(t){return bi(t%m)>Ri}).map(u)).concat(ui.range(Math.ceil(l/g)*g,i,g).filter(function(t){return bi(t%v)>Ri}).map(f))}var n,r,a,o,i,l,s,c,u,f,d,h,p=10,g=p,m=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[d(o).concat(h(s).slice(1),d(a).reverse().slice(1),h(c).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],a=+e[1][0],c=+e[0][1],s=+e[1][1],o>a&&(e=o,o=a,a=e),c>s&&(e=c,c=s,s=e),t.precision(y)):[[o,c],[a,s]]},t.minorExtent=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],l=+e[0][1],i=+e[1][1],r>n&&(e=r,r=n,n=e),l>i&&(e=l,l=i,i=e),t.precision(y)):[[r,l],[n,i]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(m=+e[0],v=+e[1],t):[m,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,u=xn(l,i,90),f=bn(r,n,y),d=xn(c,s,90),h=bn(o,a,y),t):y},t.majorExtent([[-180,-90+Ri],[180,90-Ri]]).minorExtent([[-180,-80-Ri],[180,80+Ri]])},ui.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||r.apply(this,arguments),n||a.apply(this,arguments)]}}var e,n,r=_n,a=wn;return t.distance=function(){return ui.geo.distance(e||r.apply(this,arguments),n||a.apply(this,arguments))},t.source=function(n){return arguments.length?(r=n,e="function"==typeof n?null:n,t):r},t.target=function(e){return arguments.length?(a=e,n="function"==typeof e?null:e,t):a},t.precision=function(){return arguments.length?t:0},t},ui.geo.interpolate=function(t,e){return kn(t[0]*Vi,t[1]*Vi,e[0]*Vi,e[1]*Vi)},ui.geo.length=function(t){return Ql=0,ui.geo.stream(t,$l),Ql};var Ql,$l={sphere:k,point:k,lineStart:Mn,lineEnd:k,polygonStart:k,polygonEnd:k},Jl=An(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return sn(Jl)}).raw=Jl;var Kl=An(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return sn(Kl)}).raw=Kl,(ui.geo.conicConformal=function(){return Ue(Tn)}).raw=Tn,(ui.geo.conicEquidistant=function(){return Ue(Ln)}).raw=Ln;var ts=An(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return sn(ts)}).raw=ts,Cn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return zn(Cn)}).raw=Cn;var es=An(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return sn(es)}).raw=es;var ns=An(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return sn(ns)}).raw=ns,Sn.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Hi]},(ui.geo.transverseMercator=function(){var t=zn(Sn),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):(t=n(),[t[0],t[1],t[2]-90])},n([0,0,90])}).raw=Sn,ui.geom={},ui.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,a=Ct(n),o=Ct(r),i=t.length,l=[],s=[];for(e=0;e=0;--e)h.push(t[l[c[e]][2]]);for(e=+f;e=r&&c.x<=o&&c.y>=a&&c.y<=i?[[r,i],[o,i],[o,a],[r,a]]:[];u.point=t[l]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Ri)*Ri,y:Math.round(i(t,e)/Ri)*Ri,i:e}})}var r=On,a=Pn,o=r,i=a,l=fs;return t?e(t):(e.links=function(t){return cr(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return cr(n(t)).cells.forEach(function(n,r){for(var a,o,i=n.site,l=n.edges.sort(Gn),s=-1,c=l.length,u=l[c-1].edge,f=u.l===i?u.r:u.l;++s=c,d=r>=u,h=d<<1|f;t.leaf=!1,t=t.nodes[h]||(t.nodes[h]=pr()),f?a=c:l=c,d?i=u:s=u,o(t,e,n,r,a,i,l,s)}var u,f,d,h,p,g,m,v,y,x=Ct(l),b=Ct(s);if(null!=e)g=e,m=n,v=r,y=a;else if(v=y=-(g=m=1/0),f=[],d=[],p=t.length,i)for(h=0;hv&&(v=u.x),u.y>y&&(y=u.y),f.push(u.x),d.push(u.y);else for(h=0;hv&&(v=_),w>y&&(y=w),f.push(_),d.push(w)}var k=v-g,M=y-m;k>M?y=m+k:v=g+M;var A=pr();if(A.add=function(t){o(A,t,+x(t,++h),+b(t,h),g,m,v,y)},A.visit=function(t){gr(t,A,g,m,v,y)},A.find=function(t){return mr(A,t[0],t[1],g,m,v,y)},h=-1,null==e){for(;++h=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=gs.get(n)||ps,r=ms.get(r)||b,kr(r(n.apply(null,fi.call(arguments,1))))},ui.interpolateHcl=Ir,ui.interpolateHsl=Rr,ui.interpolateLab=Fr,ui.interpolateRound=jr,ui.transform=function(t){var e=hi.createElementNS(ui.ns.prefix.svg,"g");return(ui.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new qr(n?n.matrix:vs)})(t)},qr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var vs={a:1,b:0,c:0,d:1,e:0,f:0};ui.interpolateTransform=Wr,ui.layout={},ui.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++n0?a=t:(n.c=null,n.t=NaN,n=null,c.end({type:"end",alpha:a=0})):t>0&&(c.start({type:"start",alpha:a=t}),n=Dt(s.tick)),s):a},s.start=function(){function t(t,r){if(!n){for(n=new Array(a),s=0;s=0;)i.push(u=c[s]),u.parent=o,u.depth=o.depth+1;r&&(o.value=0),o.children=c}else r&&(o.value=+r.call(t,o,o.depth)||0),delete o.children;return sa(a,function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)}),l}var e=fa,n=ca,r=ua;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(r=e,t):r},t.revalue=function(e){return r&&(la(e,function(t){t.children&&(t.value=0)}),sa(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},ui.layout.partition=function(){function t(e,n,r,a){var o=e.children;if(e.x=n,e.y=e.depth*a,e.dx=r,e.dy=a,o&&(i=o.length)){var i,l,s,c=-1;for(r=e.value?r/e.value:0;++cl&&(l=r),i.push(r)}for(n=0;n0)for(o=-1;++o=u[0]&&l<=u[1]&&(i=s[ui.bisect(f,l,1,h)-1],i.y+=p,i.push(t[o]));return s}var e=!0,n=Number,r=ka,a=_a;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(r=Ct(e),t):r},t.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return wa(t,e)}:Ct(e),t):a},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},ui.layout.pack=function(){function t(t,o){var i=n.call(this,t,o),l=i[0],s=a[0],c=a[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(l.x=l.y=0,sa(l,function(t){t.r=+u(t.value)}),sa(l,Ca),r){var f=r*(e?1:Math.max(2*l.r/s,2*l.r/c))/2;sa(l,function(t){t.r+=f}),sa(l,Ca),sa(l,function(t){t.r-=f})}return Oa(l,s/2,c/2,e?1:1/Math.max(2*l.r/s,2*l.r/c)),i}var e,n=ui.layout.hierarchy().sort(Ma),r=0,a=[1,1];return t.size=function(e){return arguments.length?(a=e,t):a},t.radius=function(n){return arguments.length?(e=null==n||"function"==typeof n?n:+n,t):e},t.padding=function(e){return arguments.length?(r=+e,t):r},ia(t,n)},ui.layout.tree=function(){function t(t,a){var u=i.call(this,t,a),f=u[0],d=e(f);if(sa(d,n),d.parent.m=-d.z,la(d,r),c)la(f,o);else{var h=f,p=f,g=f;la(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var m=l(h,p)/2-h.x,v=s[0]/(p.x+l(p,h)/2+m),y=s[1]/(g.depth||1);la(f,function(t){t.x=(t.x+m)*v,t.y=t.depth*y})}return u}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var a,o=e.children,i=0,l=o.length;i0&&(Ia(Fa(i,t,n),t,r),c+=r,u+=r),f+=i.m,c+=a.m,d+=s.m,u+=o.m;i&&!Ea(o)&&(o.t=i,o.m+=f-u),a&&!Na(s)&&(s.t=a,s.m+=c-d,n=t)}return n}function o(t){t.x*=s[0],t.y=t.depth*s[1]}var i=ui.layout.hierarchy().sort(null).value(null),l=Da,s=[1,1],c=null;return t.separation=function(e){return arguments.length?(l=e,t):l},t.size=function(e){return arguments.length?(c=null==(s=e)?o:null,t):c?null:s},t.nodeSize=function(e){return arguments.length?(c=null==(s=e)?null:o,t):c?s:null},ia(t,i)},ui.layout.cluster=function(){function t(t,o){var i,l=e.call(this,t,o),s=l[0],c=0;sa(s,function(t){var e=t.children;e&&e.length?(t.x=qa(e),t.y=ja(e)):(t.x=i?c+=n(t,i):0,t.y=0,i=t)});var u=Ba(s),f=Ha(s),d=u.x-n(u,f)/2,h=f.x+n(f,u)/2;return sa(s,a?function(t){t.x=(t.x-s.x)*r[0],t.y=(s.y-t.y)*r[1]}:function(t){t.x=(t.x-d)/(h-d)*r[0],t.y=(1-(s.y?t.y/s.y:1))*r[1]}),l}var e=ui.layout.hierarchy().sort(null).value(null),n=Da,r=[1,1],a=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(a=null==(r=e),t):a?null:r},t.nodeSize=function(e){return arguments.length?(a=null!=(r=e),t):a?r:null},ia(t,e)},ui.layout.treemap=function(){function t(t,e){for(var n,r,a=-1,o=t.length;++a0;)u.push(i=d[s-1]),u.area+=i.area,"squarify"!==h||(l=r(u,g))<=p?(d.pop(),p=l):(u.area-=u.pop().area,a(u,g,c,!1),g=Math.min(c.dx,c.dy),u.length=u.area=0,p=1/0);u.length&&(a(u,g,c,!0),u.length=u.area=0),o.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var o,i=f(e),l=r.slice(),s=[];for(t(l,i.dx*i.dy/e.value),s.area=0;o=l.pop();)s.push(o),s.area+=o.area,null!=o.z&&(a(s,o.z?i.dx:i.dy,i,!l.length),s.length=s.area=0);r.forEach(n)}}function r(t,e){for(var n,r=t.area,a=0,o=1/0,i=-1,l=t.length;++ia&&(a=n));return r*=r,e*=e,r?Math.max(e*a*p/r,r/(e*o*p)):1/0}function a(t,e,n,r){var a,o=-1,i=t.length,l=n.x,c=n.y,u=e?s(t.area/e):0;if(e==n.dx){for((r||u>n.dy)&&(u=n.dy);++on.dx)&&(u=n.dx);++o1);return t+e*n*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=ui.random.normal.apply(ui,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ui.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;nf?0:1;if(c=Bi)return e(c,h)+(t?e(t,1-h):"")+"Z";var p,g,m,v,y,x,b,_,w,k,M,A,T=0,L=0,C=[];if((v=(+s.apply(this,arguments)||0)/2)&&(m=o===Ps?Math.sqrt(t*t+c*c):+o.apply(this,arguments),h||(L*=-1),c&&(L=rt(m/c*Math.sin(v))),t&&(T=rt(m/t*Math.sin(v)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var z=Math.abs(f-u-2*L)<=ji?0:1;if(L&&bo(y,x,b,_)===h^z){var S=(u+f)/2;y=c*Math.cos(S),x=c*Math.sin(S),b=_=null}}else y=x=0;if(t){w=t*Math.cos(f-T),k=t*Math.sin(f-T),M=t*Math.cos(u+T),A=t*Math.sin(u+T);var O=Math.abs(u-f+2*T)<=ji?0:1;if(T&&bo(w,k,M,A)===1-h^O){var P=(u+f)/2;w=t*Math.cos(P),k=t*Math.sin(P),M=A=null}}else w=k=0;if(d>Ri&&(p=Math.min(Math.abs(c-t)/2,+a.apply(this,arguments)))>.001){g=tji)+",1 "+e}function a(t,e,n,r){return"Q 0,0 "+r}var o=_n,i=wn,l=Zo,s=vo,c=yo;return t.radius=function(e){return arguments.length?(l=Ct(e),t):l},t.source=function(e){return arguments.length?(o=Ct(e),t):o},t.target=function(e){return arguments.length?(i=Ct(e),t):i},t.startAngle=function(e){return arguments.length?(s=Ct(e),t):s},t.endAngle=function(e){return arguments.length?(c=Ct(e),t):c},t},ui.svg.diagonal=function(){function t(t,a){var o=e.call(this,t,a),i=n.call(this,t,a),l=(o.y+i.y)/2,s=[o,{x:o.x,y:l},{x:i.x,y:l},i];return s=s.map(r),"M"+s[0]+"C"+s[1]+" "+s[2]+" "+s[3]}var e=_n,n=wn,r=Uo;return t.source=function(n){return arguments.length?(e=Ct(n),t):e},t.target=function(e){return arguments.length?(n=Ct(e),t):n},t.projection=function(e){return arguments.length?(r=e,t):r},t},ui.svg.diagonal.radial=function(){var t=ui.svg.diagonal(),e=Uo,n=t.projection;return t.projection=function(t){return arguments.length?n(Go(e=t)):e},t},ui.svg.symbol=function(){function t(t,r){return(Rs.get(e.call(this,t,r))||Qo)(n.call(this,t,r))}var e=Wo,n=Yo;return t.type=function(n){return arguments.length?(e=Ct(n),t):e},t.size=function(e){return arguments.length?(n=Ct(e),t):n},t};var Rs=ui.map({circle:Qo,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*js)),n=e*js;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",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/Fs),n=e*Fs/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Fs),n=e*Fs/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});ui.svg.symbolTypes=Rs.keys();var Fs=Math.sqrt(3),js=Math.tan(30*Vi);zi.transition=function(t){for(var e,n,r=qs||++Xs,a=ei(t),o=[],i=Bs||{time:Date.now(),ease:Cr,delay:0,duration:250},l=-1,s=this.length;++lrect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",d[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==ui.event.keyCode&&(z||(x=null,O[0]-=f[1],O[1]-=d[1],z=2),T())}function g(){32==ui.event.keyCode&&2==z&&(O[0]+=f[1],O[1]+=d[1],z=0,T())}function m(){var t=ui.mouse(_),r=!1;b&&(t[0]+=b[0],t[1]+=b[1]),z||(ui.event.altKey?(x||(x=[(f[0]+f[1])/2,(d[0]+d[1])/2]),O[0]=f[+(t[0]0&&this._events[t].length>n&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!a(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,l;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||a(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(n)){for(l=o;l-- >0;)if(n[l]===e||n[l].listener&&n[l].listener===e){r=l;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;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(n=this._events[t],a(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],13:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;r13)&&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}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return t-t<1}},{}],14:[function(t,e,n){function r(t,e){var n=e[0],r=e[1],a=e[2],o=e[3],i=n+n,l=r+r,s=a+a,c=n*i,u=r*i,f=r*l,d=a*i,h=a*l,p=a*s,g=o*i,m=o*l,v=o*s;return t[0]=1-f-p,t[1]=u+v,t[2]=d-m,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+m,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=r},{}],15:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function i(t){if(d===clearTimeout)return clearTimeout(t);if((d===a||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{return d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}function l(){m&&p&&(m=!1,p.length?g=p.concat(g):v=-1,g.length&&s())}function s(){if(!m){var t=o(l);m=!0;for(var e=g.length;e;){for(p=g,g=[];++v1)for(var n=1;n.5?s/(2-o-i):s/(o+i),o){case t:r=(e-n)/s+(e1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var a,o,i;if(t=C(t,360),e=C(e,100),n=C(n,100),0===e)a=o=i=n;else{var l=n<.5?n*(1+e):n+e-n*e,s=2*n-l;a=r(s,l,t+1/3),o=r(s,l,t),i=r(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function s(t,e,n){t=C(t,255),e=C(e,255),n=C(n,255);var r,a,o=Z(t,e,n),i=X(t,e,n),l=o,s=o-i;if(a=0===o?0:s/o,o==i)r=0;else{switch(o){case t:r=(e-n)/s+(e>1)+720)%360;--e;)a.h=(a.h+o)%360,i.push(r(a));return i}function A(t,e){e=e||6;for(var n=r(t).toHsv(),a=n.h,o=n.s,i=n.v,l=[],s=1/e;e--;)l.push(r({h:a,s:o,v:i})),i=(i+s)%1;return l}function T(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function C(t,n){O(t)&&(t="100%");var r=P(t);return t=X(n,Z(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function z(t){return X(1,Z(0,t))}function S(t){return parseInt(t,16)}function O(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function P(t){return"string"==typeof t&&t.indexOf("%")!=-1}function D(t){return 1==t.length?"0"+t:""+t}function N(t){return t<=1&&(t=100*t+"%"),t}function E(t){return e.round(255*parseFloat(t)).toString(16)}function I(t){return S(t)/255}function R(t){return!!W.CSS_UNIT.exec(t)}function F(t){t=t.replace(q,"").replace(B,"").toLowerCase();var e=!1;if(G[t])t=G[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=W.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=W.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=W.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=W.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=W.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=W.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=W.hex8.exec(t))?{r:S(n[1]),g:S(n[2]),b:S(n[3]),a:I(n[4]),format:e?"name":"hex8"}:(n=W.hex6.exec(t))?{r:S(n[1]),g:S(n[2]),b:S(n[3]),format:e?"name":"hex"}:(n=W.hex4.exec(t))?{r:S(n[1]+""+n[1]),g:S(n[2]+""+n[2]),b:S(n[3]+""+n[3]),a:I(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=W.hex3.exec(t))&&{r:S(n[1]+""+n[1]),g:S(n[2]+""+n[2]),b:S(n[3]+""+n[3]),format:e?"name":"hex"}}function j(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var q=/^\s+/,B=/\s+$/,H=0,V=e.round,X=e.min,Z=e.max,U=e.random;r.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,a,o,i,l=this.toRgb();return t=l.r/255,n=l.g/255,r=l.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),i=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),.2126*a+.7152*o+.0722*i},setAlpha:function(t){return this._a=L(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*C(this._r,255))+"%",g:V(100*C(this._g,255))+"%",b:V(100*C(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%)":"rgba("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[u(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),n=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=r(t);n="#"+d(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,a=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return r(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},r.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?n[a]=t[a]:n[a]=N(t[a]));t=n}return r(t,e)},r.equals=function(t,e){return!(!t||!e)&&r(t).toRgbString()==r(e).toRgbString()},r.random=function(){return r.fromRatio({r:U(),g:U(),b:U()})},r.mix=function(t,e,n){n=0===n?0:n||50;var a=r(t).toRgb(),o=r(e).toRgb(),i=n/100,l={r:(o.r-a.r)*i+a.r,g:(o.g-a.g)*i+a.g,b:(o.b-a.b)*i+a.b,a:(o.a-a.a)*i+a.a};return r(l)},r.readability=function(t,n){var a=r(t),o=r(n);return(e.max(a.getLuminance(),o.getLuminance())+.05)/(e.min(a.getLuminance(),o.getLuminance())+.05)},r.isReadable=function(t,e,n){var a,o,i=r.readability(t,e);switch(o=!1,a=j(n),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},r.mostReadable=function(t,e,n){var a,o,i,l,s=null,c=0;n=n||{},o=n.includeFallbackColors,i=n.level,l=n.size;for(var u=0;uc&&(c=a,s=r(e[u]));return r.isReadable(t,s,{level:i,size:l})||!o?s:(n.includeFallbackColors=!1,r.mostReadable(t,["#fff","#000"],n))};var G=r.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=r.hexNames=T(G),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+r),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})$/}}();"undefined"!=typeof n&&n.exports?n.exports=r:"function"==typeof t&&t.amd?t(function(){return r}):window.tinycolor=r}(Math)},{}],17:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../color"),o=t("../../plots/cartesian/axes"),i=t("./attributes");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,i,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("opacity"),c("align"),c("bgcolor");var f=c("bordercolor"),d=a.opacity(f);c("borderpad");var h=c("borderwidth"),p=c("showarrow");c("text",p?" ":"new text"),c("textangle"),r.coerceFont(c,"font",n.font);for(var g=["x","y"],m=[-10,-30],v={_fullLayout:n},y=0;y<2;y++){var x=g[y],b=o.coerceRef(t,e,v,x,"","paper");if(o.coercePosition(e,v,c,b,x,.5),p){var _="a"+x,w=o.coerceRef(t,e,v,_,"pixel");"pixel"!==w&&w!==b&&(w=e[_]="pixel"); +var k="pixel"===w?m[y]:.4;o.coercePosition(e,v,c,w,_,k)}else c(x+"anchor")}return r.noneOrAll(t,e,["x","y"]),p&&(c("arrowcolor",d?e.bordercolor:a.defaultLine),c("arrowhead"),c("arrowsize"),c("arrowwidth",2*(d&&h||1)),r.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":118,"../../plots/cartesian/axes":145,"../color":26,"./attributes":19}],18:[function(t,e,n){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],19:[function(t,e,n){"use strict";var r=t("./arrow_paths"),a=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),i=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:i({},a,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:r.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":115,"../../plots/cartesian/constants":150,"../../plots/font_attributes":165,"./arrow_paths":18}],20:[function(t,e,n){"use strict";function r(t){var e=t._fullLayout;e.annotations.forEach(function(e){var n=o.getFromId(t,e.xref),r=o.getFromId(t,e.yref);if(n||r){var a=(e._xsize||0)/2,i=e._xshift||0,l=(e._ysize||0)/2,s=e._yshift||0,c=a-i,u=a+i,f=l-s,d=l+s;if(e.showarrow){var h=3*e.arrowsize*e.arrowwidth;c=Math.max(c,h),u=Math.max(u,h),f=Math.max(f,h),d=Math.max(d,h)}n&&n.autorange&&o.expand(n,[n.l2c(n.r2l(e.x))],{ppadplus:u,ppadminus:c}),r&&r.autorange&&o.expand(r,[r.l2c(r.r2l(e.y))],{ppadplus:d,ppadminus:f})}})}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.annotations);if(n.length&&t._fullData.length){var l={};n.forEach(function(t){l[t.xref]=!0,l[t.yref]=!0});var s=o.list(t).filter(function(t){return t.autorange&&l[t._id]});if(s.length)return a.syncOrAsync([i,r],t)}}},{"../../lib":118,"../../plots/cartesian/axes":145,"./draw":22}],21:[function(t,e,n){"use strict";var r=t("../../plots/array_container_defaults"),a=t("./annotation_defaults");e.exports=function(t,e){var n={name:"annotations",handleItemDefaults:a};r(t,e,n)}},{"../../plots/array_container_defaults":142,"./annotation_defaults":17}],22:[function(t,e,n){"use strict";function r(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var n=0;n2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}rt.selectAll("tspan.line").attr({y:0,x:0});var r=$.select(".annotation-math-group"),a=!r.empty(),l=h.bBox((a?r:rt).node()),c=l.width,p=l.height,v=Math.round(c+2*tt),y=Math.round(p+2*tt);X._w=c,X._h=p;var b=!1;if(["x","y"].forEach(function(e){var r,a=X[e+"ref"]||e,o=f.getFromId(t,a),i=(Y+("x"===e?0:90))*Math.PI/180,l=v*Math.abs(Math.cos(i))+y*Math.abs(Math.sin(i)),s=X[e+"anchor"];if(o){var c=o.r2fraction(X[e]);if(!o.autorange&&(c<0||c>1)&&(X["a"+e+"ref"]===a?(c=o.r2fraction(X["a"+e]),(c<0||c>1)&&(b=!0)):b=!0,b))return;G[e]=o._offset+o.r2p(X[e]),r=.5}else r=X[e],"y"===e&&(r=1-r),G[e]="x"===e?O.l+O.w*r:O.t+O.h*r;var u=0;X["a"+e+"ref"]===a?G["aa"+e]=o._offset+o.r2p(X["a"+e]):(u=X.showarrow?X["a"+e]:l*n(r,s),G[e]+=u),X["_"+e+"type"]=o&&o.type,X["_"+e+"size"]=l,X["_"+e+"shift"]=u}),b)return void $.remove();var _,w;X.showarrow&&(_=X.axref===X.xref?G.x:u.constrain(G.x-X.ax,1,M.width-1),w=X.ayref===X.yref?G.y:u.constrain(G.y-X.ay,1,M.height-1)),G.x=u.constrain(G.x,1,M.width-1),G.y=u.constrain(G.y,1,M.height-1);var k=tt-l.top,A=tt-l.left;a?r.select("svg").attr({x:tt-1,y:tt}):(rt.attr({x:A,y:k}),rt.selectAll("tspan.line").attr({y:k,x:A})),et.call(h.setRect,J/2,J/2,v-J,y-J);var T=0,L=0;T=X.axref===X.xref?Math.round(G.aax-v/2):Math.round(G.x-v/2),L=X.ayref===X.yref?Math.round(G.aay-y/2):Math.round(G.y-y/2),$.call(u.setTranslate,T,L);var C="annotations["+e+"]",z=function(n,r){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=X.axref===X.xref?G.aax+n:G.x+n,l=X.ayref===X.yref?G.aay+r:G.y+r;var c=u.rotationXYMatrix(Y,a,l),f=u.apply2DTransform(c),h=u.apply2DTransform2(c),p=et.attr("width")/2,g=et.attr("height")/2,v=[[a-p,l-g,a-p,l+g],[a-p,l+g,a+p,l+g],[a+p,l+g,a+p,l-g],[a+p,l-g,a-p,l-g]].map(h);if(!v.reduce(function(t,e){return t^!!o(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=o(a,l,_,w,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var y=X.arrowwidth,b=X.arrowcolor,k=W.append("g").style({opacity:d.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=k.append("path").attr("d","M"+a+","+l+"L"+_+","+w).style("stroke-width",y+"px").call(d.stroke,d.rgb(b));x(M,X.arrowhead,"end",X.arrowsize);var A=k.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-_)+","+(l-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,z;m.init({element:A.node(),prepFn:function(){var t=u.getTranslate($);L=t.x,z=t.y,T={},Z&&Z.autorange&&(T[Z._name+".autorange"]=!0),U&&U.autorange&&(T[U._name+".autorange"]=!0)},moveFn:function(t,e){k.attr("transform","translate("+t+","+e+")");var n=f(L,z),r=n[0]+t,a=n[1]+e;$.call(u.setTranslate,r,a),T[C+".x"]=Z?Z.p2r(Z.r2p(X.x)+t):(_+t-O.l)/O.w,T[C+".y"]=U?U.p2r(U.r2p(X.y)+e):1-(w+e-O.t)/O.h,X.axref===X.xref&&(T[C+".ax"]=Z?Z.p2r(Z.r2p(X.ax)+t):(_+t-O.l)/O.w),X.ayref===X.yref&&(T[C+".ay"]=U?U.p2r(U.r2p(X.ay)+e):1-(w+e-O.t)/O.h),Q.attr({transform:"rotate("+Y+","+r+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};X.showarrow&&z(0,0);var S=u.rotationXYMatrix(Y,G.x,G.y),P=u.apply2DTransform(S);if(t._context.editable){var D,N,E;m.init({element:$.node(),prepFn:function(){var t=u.getTranslate($);D=t.x,N=t.y,E={}},moveFn:function(t,e){$.call(u.setTranslate,D+t,N+e);var n="pointer";if(X.showarrow)X.axref===X.xref?E[C+".ax"]=Z.p2r(Z.r2p(X.ax)+t):E[C+".ax"]=X.ax+t,X.ayref===X.yref?E[C+".ay"]=U.p2r(U.r2p(X.ay)+e):E[C+".ay"]=X.ay+e,z(t,e);else{if(Z)E[C+".x"]=X.x+t/Z._m;else{var r=X._xsize/O.w,a=X.x+X._xshift/O.w-r/2;E[C+".x"]=m.align(a+t/O.w,r,0,1,X.xanchor)}if(U)E[C+".y"]=X.y+e/U._m;else{var o=X._ysize/O.h,i=X.y-X._yshift/O.h-o/2;E[C+".y"]=m.align(i-e/O.h,o,0,1,X.yanchor)}Z&&U||(n=m.getCursor(Z?.5:E[C+".x"],U?.5:E[C+".y"],X.xanchor,X.yanchor))}var l=P(D,N),s=l[0]+t,c=l[1]+e;$.call(u.setTranslate,D+t,N+e),Q.attr({transform:"rotate("+Y+","+s+","+c+")"}),g($,n)},doneFn:function(e){if(g($),e){s.relayout(t,E);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var w,k=t.layout,M=t._fullLayout;if(!l(e)||e===-1){if(!e&&Array.isArray(c))return k.annotations=c,y(k,M),void r(t);if("remove"===c)return delete k.annotations,M.annotations=[],void r(t);if(n&&"add"!==c){for(w=0;we;w--)M._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),a(t,w)}}M._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=k.annotations[e],L=M.annotations[e];if(T){var C={};"string"==typeof n&&n?C[n]=c:u.isPlainObject(n)&&(C=n);var z=Object.keys(C);for(w=0;w4/3&&(R=H)}}else I&&(j&&(R<1/3?R+=B:R>2/3&&(R-=B)),R=(R-I.domain[0])/(I.domain[1]-I.domain[0]),R=I.fraction2r(R))}I&&I===E&&F&&("log"===F&&"log"!==I.type?R=Math.pow(10,R):"log"!==F&&"log"===I.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),T[N]=R}}var X={};v(T,X,M),M.annotations[e]=X;var Z=f.getFromId(t,X.xref),U=f.getFromId(t,X.yref),G={x:0,y:0},Y=+X.textangle||0,W=M._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",X.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:X})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),J=X.borderwidth,K=X.borderpad,tt=J+K,et=$.append("rect").attr("class","bg").style("stroke-width",J+"px").call(d.stroke,X.bordercolor).call(d.fill,X.bgcolor),nt=X.font,rt=$.append("text").classed("annotation",!0).attr("data-unformatted",X.text).text(X.text);t._context.editable?rt.call(p.makeEditable,$).call(b).on("edit",function(n){X.text=n,this.attr({"data-unformatted":X.text}),this.call(b);var r={};r["annotations["+e+"].text"]=X.text,Z&&Z.autorange&&(r[Z._name+".autorange"]=!0),U&&U.autorange&&(r[U._name+".autorange"]=!0),s.relayout(t,r)}):rt.call(b),Q.attr({transform:"rotate("+Y+","+G.x+","+G.y+")"}).call(h.setPosition,G.x,G.y)}}}function o(t,e,n,r,a,o,i,l){var s=n-t,c=a-t,u=i-a,f=r-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,m=(c*f-s*d)/p;return m<0||m>1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:r,drawOne:a}},{"../../lib":118,"../../lib/setcursor":128,"../../lib/svg_text_utils":130,"../../plotly":140,"../../plots/cartesian/axes":145,"../../plots/plots":169,"../color":26,"../dragelement":47,"../drawing":49,"./annotation_defaults":17,"./defaults":21,"./draw_arrow_head":23,d3:10,"fast-isnumeric":13}],23:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../color"),i=t("../drawing"),l=t("./arrow_paths");e.exports=function(t,e,n,s){a(s)||(s=1);var c=t.node(),u=l[e||0];if(u){"string"==typeof n&&n||(n="end");var f,d,h,p,g=(i.getPx(t,"stroke-width")||1)*s,m=t.style("stroke")||o.defaultLine,v=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,b=u.backoff*g;if("line"===c.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},d={x:+t.attr("x2"),y:+t.attr("y2")},h=Math.atan2(f.y-d.y,f.x-d.x),p=h+Math.PI,b){var _=b*Math.cos(h),w=b*Math.sin(h);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(d.x+=_,d.y+=w,t.attr({x2:d.x,y2:d.y}))}}else if("path"===c.nodeName){var k=c.getTotalLength(),M="";if(y){var A=c.getPointAtLength(0),T=c.getPointAtLength(.1);h=Math.atan2(A.y-T.y,A.x-T.x),f=c.getPointAtLength(Math.min(b,k)),b&&(M="0px,"+b+"px,")}if(x){var L=c.getPointAtLength(k),C=c.getPointAtLength(k-.1);if(p=Math.atan2(L.y-C.y,L.x-C.x),d=c.getPointAtLength(Math.max(0,k-b)),b){var z=M?2*b:b;M+=k-z+"px,"+k+"px"}}else M&&(M+=k+"px");M&&t.style("stroke-dasharray",M)}var S=function(n,a){e>5&&(a=0),r.select(c.parentElement).append("path").attr({class:t.attr("class"),d:u.path,transform:"translate("+n.x+","+n.y+")rotate("+180*a/Math.PI+")scale("+g+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&S(f,h),x&&S(d,p)}}},{"../color":26,"../drawing":49,"./arrow_paths":18,d3:10,"fast-isnumeric":13}],24:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":19,"./calc_autorange":20,"./defaults":21,"./draw":22}],25:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],26:[function(t,e,n){"use strict";function r(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===r.length;if(!a&&3!==r.length)return t;for(var i=0;i=0))return t;if(3===i)r[i]>1&&(r[i]=1);else if(r[i]>=1)return t}var l=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return a?"rgba("+l+", "+r[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var n=a(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},i.combine=function(t,e){var n=a(t).toRgb();if(1===n.a)return a(t).toRgbString();var r=a(e||i.background).toRgb(),o=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},l={r:o.r*(1-n.a)+n.r*n.a,g:o.g*(1-n.a)+n.g*n.a,b:o.b*(1-n.a)+n.b*n.a};return a(l).toRgbString()},i.contrast=function(t,e,n){var r=a(t),o=r.isLight()?r.darken(n):r.lighten(e);return o.toString()},i.stroke=function(t,e){var n=a(e);t.style({stroke:i.tinyRGB(n),"stroke-opacity":n.getAlpha()})},i.fill=function(t,e){var n=a(e);t.style({fill:i.tinyRGB(n),"fill-opacity":n.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,n,a,o,l=Object.keys(t);for(e=0;el&&(o[1]-=(lt-l)/2)):n.node()&&!n.classed("js-placeholder")&&(lt=h.bBox(e.node()).height),lt){if(lt+=5,"top"===_.titleside)K.domain[1]-=lt/T.h,o[1]*=-1;else{K.domain[0]+=lt/T.h;var c=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),K.setScale()}}ot.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-K.domain[1]))+")");var f=ot.select(".cbfills").selectAll("rect.cbfill").data(S);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?C[0]:(S[e]+S[e-1])/2,e===S.length-1?C[1]:(S[e]+S[e+1])/2].map(K.c2p).map(Math.round);e!==S.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=P(t).replace("e-",""),i=a(o).toHexString();r.select(this).attr({x:G,width:Math.max(q,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var d=ot.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?z:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){r.select(this).attr("d","M"+G+","+(Math.round(K.c2p(t))+_.line.width/2%1)+"h"+q).call(h.lineGroupStyle,_.line.width,O(t),_.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=G+q+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=K.titlefont.size,n=K._offset+K._length/2,a=T.l+(K.position||0)*T.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));k("h"+K._id+"title",{avoid:{selection:r.select(t).selectAll("g."+K._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:A.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function k(e,n){var r,a=b();r=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:K,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:ot.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;ot.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,n||{}))}function M(){var n=q+_.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(R=it.select("text"),R.node()&&!R.classed("js-placeholder")){var r,a=it.select(".h"+K._id+"title-math-group").node();r=a&&["top","bottom"].indexOf(_.titleside)!==-1?h.bBox(a).width:h.bBox(it.node()).right-G-T.l,n=Math.max(n,r)}var o=2*_.xpad+n+_.borderwidth+_.outlinewidth/2,l=Q-$;ot.select(".cbbg").attr({x:G-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-Z,width:Math.max(o,2),height:Math.max(l+2*Z,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),ot.selectAll(".cboutline").attr({x:G,y:$+_.ypad+("top"===_.titleside?lt:0),width:Math.max(q,2),height:Math.max(l-2*_.ypad-lt,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var s=({center:.5,right:1}[_.xanchor]||0)*o;ot.attr("transform","translate("+(T.l-s)+","+T.t+")"),i.autoMargin(t,e,{x:_.x,y:_.y,l:o*({right:1,center:.5}[_.xanchor]||0),r:o*({left:1,center:.5}[_.xanchor]||0),t:l*({bottom:1,middle:.5}[_.yanchor]||0),b:l*({top:1,middle:.5}[_.yanchor]||0)})}var A=t._fullLayout,T=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var L,C=r.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),z=[],S=[],O="function"==typeof _.line.color?_.line.color:function(){return _.line.color},P="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},D=_.levels.end+_.levels.size/100,N=_.levels.size,E=1.001*C[0]-.001*C[1],I=1.001*C[1]-.001*C[0];for(L=_.levels.start;(L-D)*N<0;L+=N)L>E&&LC[0]&&L1){var at=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));et*=at*u.roundUp(rt/at,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+U,W+V-U],K.setScale();var ot=A._infolayer.selectAll("g."+e).data([0]);ot.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),ot.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var it=ot.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");K._axislayer=ot.select(".cbaxis");var lt=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var st,ct=T.l+(_.x+X)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-U))*T.h+T.t+3+.75*ut:(1-(W+U))*T.h+T.t-3-.25*ut,k(K._id+"title",{attributes:{x:ct,y:st,"text-anchor":"start"}})}var ft=u.syncOrAsync([i.previousPromises,w,i.previousPromises,M],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var dt,ht,pt;c.init({element:ot.node(),prepFn:function(){dt=ot.attr("transform"),d(ot)},moveFn:function(t,e){ot.attr("transform",dt+" translate("+t+","+e+")"),ht=c.align(Y+t/T.w,B,0,1,_.xanchor),pt=c.align(W-e/T.h,V,0,1,_.yanchor);var n=c.getCursor(ht,pt,_.xanchor,_.yanchor);d(ot,n)},doneFn:function(e){d(ot),e&&void 0!==ht&&void 0!==pt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":pt},b().index)}})}return ft}function b(){var n,r,a=e.substr(2);for(n=0;n=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":118,"./flip_scale":37,"./scales":44}],33:[function(t,e,n){"use strict";var r=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},r.colorscale,{}),cauto:a({},r.zauto,{}),cmax:a({},r.zmax,{}),cmin:a({},r.zmin,{}),autocolorscale:a({},r.autocolorscale,{}),reversescale:a({},r.reversescale,{})}}},{"../../lib/extend":115,"./attributes":31,"./scales.js":44}],34:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":44}],35:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,n,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,m=p[d+"min"],v=p[d+"max"],y=p.colorscale,x=r(m)&&r(v)&&m=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],38:[function(t,e,n){"use strict";var r=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=a),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":34,"./is_valid_scale_array":42,"./scales":44}],39:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?a.nestedProperty(t,e).get()||{}:t,i=n.color,l=!1;if(Array.isArray(i))for(var s=0;s4/3-l?i:l}},{}],46:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":118}],47:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=r},{"../../lib":118,"../../plotly":140,"../../plots/cartesian/constants":150,"./align":45,"./cursor":46,"./unhover":48}],48:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":114}],49:[function(t,e,n){"use strict";function r(t,e,n,r,a,o,i){if(l.traceIs(n,"symbols")){var c=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(n)?c(t.ms):(o.size||6)/2,t.mrc=e;var r=g.symbolNumber(t.mx||o.symbol)||0,a=r%100;return t.om=r%200>=100,g.symbolFuncs[a](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=r(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,n,r){var a=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(s.fill,r)},g.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},g.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},g.setRect=function(t,e,n,r,a){t.call(g.setPosition,e,n).call(g.setSize,r,a)},g.translatePoint=function(t,e,n,r){var a=t.xp||n.c2p(t.x),o=t.yp||r.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,n,r){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,n,r)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,n){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},g.singleLineStyle=function(t,e,n,r,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=n||o.width||0,l=a||o.dash||"";s.stroke(e,r||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=r||a.dash||"";o.select(this).call(s.stroke,n||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=o.select(this);try{n.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),n.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,n){var a=n.marker,o=a.line,i=g.tryColorscale(a,""),l=g.tryColorscale(a,"line");r(t,e,n,i,l,a,o)},g.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=g.tryColorscale(n,""),a=g.tryColorscale(n,"line");t.each(function(t){g.singlePointStyle(t,o.select(this),e,r,a)})}},g.tryColorscale=function(t,e){var n=e?u.nestedProperty(t,e).get():t,r=n.colorscale,a=n.color;return r&&Array.isArray(a)?c.makeColorScaleFunc(c.extractScale(r,n.cmin,n.cmax)):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var n=o.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,n.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(f.convertToTspans);var d=o.select(this.parentNode),h=n.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,m=x[s]*u,v=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+m+","+v+")"),p>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],o=[];for(n=1;n=A&&(o.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=o.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":108,"../../lib":118,"../../lib/svg_text_utils":130,"../../registry":176,"../../traces/scatter/make_bubble_size_func":255,"../../traces/scatter/subtypes":260,"../color":26,"../colorscale":40,"./symbol_defs":50,d3:10,"fast-isnumeric":13}],50:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:10}],51:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],52:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&["linear","log"].indexOf(n.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var m=g.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(n.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=r(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");l=!m.size(),l?m=e.append("path").classed("yerror",!0):u&&(m=m.transition().duration(n.duration).ease(n.easing)),m.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var v=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-v)+"v"+2*v+"m0,-"+v+"H"+i.xs,i.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":260,d3:10,"fast-isnumeric":13}],57:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":26,d3:10}],58:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":150}],59:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,l,n,r)}var i=r("source"),s=r("visible",!!i);if(!s)return e;r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var c={_fullLayout:n},u=["x","y"],f=0;f<2;f++)o.coerceRef(t,e,c,u[f],"paper");return e}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("../../plots/array_container_defaults"),l=t("./attributes"),s="images";e.exports=function(t,e){var n={name:s,handleItemDefaults:r};i(t,e,n)}},{"../../lib":118,"../../plots/array_container_defaults":142,"../../plots/cartesian/axes":145,"./attributes":58}],60:[function(t,e,n){"use strict";var r=t("d3"),a=t("../drawing"),o=t("../../plots/cartesian/axes"),i=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var n=r.select(this);if(!this.img||this.img.src!==e.source){n.attr("xmlns",i.svg);var a=new Promise(function(t){function r(){n.remove(),t()}var a=new Image;this.img=a,a.setAttribute("crossOrigin","anonymous"),a.onerror=r,a.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var r=t.toDataURL("image/png");n.attr("xlink:href",r)},n.on("error",r),n.on("load",t),a.src=e.source}.bind(this));t._promises.push(a)}}function n(e){var n=r.select(this),i=o.getFromId(t,e.xref),s=o.getFromId(t,e.yref),c=l._size,u=i?Math.abs(i.l2p(e.sizex)-i.l2p(0)):e.sizex*c.w,f=s?Math.abs(s.l2p(e.sizey)-s.l2p(0)):e.sizey*c.h,d=u*h.x[e.xanchor].offset,p=f*h.y[e.yanchor].offset,g=h.x[e.xanchor].sizing+h.y[e.yanchor].sizing,m=(i?i.r2p(e.x)+i._offset:e.x*c.w+c.l)+d,v=(s?s.r2p(e.y)+s._offset:c.h-e.y*c.h+c.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}n.attr({x:m,y:v,width:u,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=i?i._id:"",x=s?s._id:"",b=y+x;b&&n.call(a.setClipUrl,"clip"+l._uid+b)}for(var l=t._fullLayout,s=[],c=[],u=[],f=0;f=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],63:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2, +max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":115,"../../plots/font_attributes":165,"../color/attributes":25}],64:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],65:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":118,"../../plots/layout_attributes":167,"../../registry":176,"./attributes":63,"./helpers":68}],66:[function(t,e,n){"use strict";function r(t,e){function n(n){v.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,v=Math.max(e.height,v)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,j,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,_=n.showlegend&&x(t.calcdata,v),k=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=n._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=M.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var z=L.selectAll("g.groups").data(_);z.enter().append("g").attr("class","groups"),z.exit().remove();var S=z.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,z,S),l(t));var P=0,D=n.width,N=0,E=n.height;i(t,z,S),v.height>E?s(t):l(t);var I=n._size,R=I.l+I.w*v.x,F=I.t+I.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?F-=v.height:w.isMiddleAnchor(v)&&(F-=v.height/2);var j=v.width,q=I.w;j>q?(R=I.l,j=q):(R+j>D&&(R=D-j),RH?(F=I.t,B=H):(F+B>E&&(F=E-B),Fn[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":118,"../../registry":176,"../../traces/pie/style_one":238,"../../traces/scatter/subtypes":260,"../color":26,"../drawing":49,d3:10}],71:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||v||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(m,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":118,"../color":26,"./attributes":75,"./button_attributes":76,"./constants":77}],79:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,z)},a=z.line.width?z.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",z.opacity).call(_.stroke,a).call(_.fill,z.fillcolor).call(w.dashLine,z.line.dash,z.line.width);S&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+S),t._context.editable&&f(t,o,z,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof n&&n?s[n]=r:x.isPlainObject(n)&&(s=n);var c=Object.keys(s);for(o=0;oU&&r>G&&!t.shiftKey?k.getCursor(a/n,1-o/r):"move";M(e,i),Z=i.split("-")[0]}function o(e){j=b.getFromId(t,n.xref),q=b.getFromId(t,n.yref),B=T.getDataToPixel(t,j),H=T.getDataToPixel(t,q,!0),V=T.getPixelToData(t,j),X=T.getPixelToData(t,q,!0);var o="shapes["+r+"]";"path"===n.type?(R=n.path,F=o+".path"):(u=B(n.x0),f=H(n.y0),d=B(n.x1),h=H(n.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uG&&(c[z]=n[D]=X(l),c[S]=n[N]=X(s)),f-u>U&&(c[O]=n[E]=V(u),c[P]=n[I]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,v,x,_,w,A,L,C,z,S,O,P,D,N,E,I,R,F,j,q,B,H,V,X,Z,U=10,G=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();k.init(Y)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults");e.exports={draw:r,drawOne:a}},{"../../lib":118,"../../lib/setcursor":128,"../../plotly":140,"../../plots/cartesian/axes":145,"../color":26,"../dragelement":47,"../drawing":49,"./constants":89,"./defaults":90,"./helpers":92,"./shape_defaults":94,"fast-isnumeric":13}],92:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],93:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":87,"./calc_autorange":88,"./defaults":90,"./draw":91}],94:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],m={_fullLayout:n},v=a.coerceRef(t,e,m,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==v?(y=a.getFromId(m,v),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=r.identity;var k=g+"0",M=g+"1",A=t[k],T=t[M];t[k]=x(t[k],!0),t[M]=x(t[M],!0),a.coercePosition(e,m,c,v,k,_),a.coercePosition(e,m,c,v,M,w),e[k]=b(e[k]),e[M]=b(e[M]),t[k]=A,t[M]=T}}return"path"===d?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":118,"../../plots/cartesian/axes":145,"./attributes":87,"./helpers":92}],95:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":115,"../../plots/animation_attributes":141,"../../plots/font_attributes":165,"../../plots/pad_attributes":168,"./constants":96}],96:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],97:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*z.gripWidth)+","+e.currentValueTotalHeight+")"); +}}function v(t,e){return t.inputAreaStart+z.stepInset+(t.inputAreaLength-2*z.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-z.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*z.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+z.railTouchRectClass).data([0]);r.enter().append("rect").classed(z.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,z.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),M.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+z.railRectClass).data([0]);n.enter().append("rect").classed(z.railRectClass,!0);var r=e.inputAreaLength-2*z.railInset;n.attr({width:r,height:z.railWidth,rx:z.railRadius,ry:z.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(n,z.railInset,.5*(e.inputAreaWidth-z.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(z.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+z.groupClassName).data(n,a);s.enter().append("g").classed(z.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,z.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,z=O,k._infolayer.select("."+e).attr({"data-unformatted":z}).text(z).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,z=g.title.trim();""===z&&(L=0),z.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var S=w.selectAll("text").data([0]);S.enter().append("text"),S.text(z).attr("class",e),S.attr({"data-unformatted":z}).call(f);var O="Click to enter "+y+" title";t._context.editable?(z||p(),S.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):z&&!z.match(/Click to enter .+ title/)||S.remove(),S.classed("js-placeholder",C)}},{"../../lib":118,"../../lib/svg_text_utils":130,"../../plotly":140,"../../plots/plots":169,"../color":26,"../drawing":49,d3:10,"fast-isnumeric":13}],101:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":115,"../../plots/font_attributes":165,"../../plots/pad_attributes":168,"../color/attributes":25}],102:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],103:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],108:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],109:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":24,"./components/images":61,"./components/legend":69,"./components/rangeselector":81,"./components/rangeslider":86,"./components/shapes":93,"./components/sliders":99,"./components/updatemenus":105,"./fonts/mathjax_config":110,"./lib/queue":126,"./plot_api/plot_schema":134,"./plot_api/register":135,"./plot_api/set_plot_config":136,"./plot_api/to_image":138,"./plot_api/validate":139,"./plotly":140,"./snapshot":181,"./snapshot/download":178,"./traces/scatter":250,d3:10,"es6-promise":11}],110:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],111:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":106,"fast-isnumeric":13}],112:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(o(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,r,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var m=(new Date).getFullYear();e=((Number(c[0])-m+70)%100+200)%100+m-70}if(!o(e))return s;var v=new Date(0,0,1);if(v.setFullYear(u?e:-e),c.length>1){if(r=Number(c[1])-1,c[1].length>2||!(r>=0&&r<=11))return s;if(v.setMonth(r),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(v.setDate(a),v.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(v.setHours(i),v.getHours()!==i)return s;if(c.length>1)return a=v.getTime(),r=Number(c[1]),2===c[1].length&&r>=0&&r<=59?(a+=f*r,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return v.getTime()},h=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==s};var g=90*c,m=3*u,v=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var n=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(n),i=en?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"./clean_number":111,"./coerce":112,"./dates":113,"./extend":115,"./filter_unique":116,"./filter_visible":117,"./is_array":119,"./is_plain_object":120,"./loggers":121,"./matrix":122,"./nested_property":123,"./notifier":124,"./search":127,"./stats":129,d3:10}],119:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],120:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],121:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],i=!1,d(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");lo||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],s=t[1];if(no||sl)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],m=r[0][1],v=0;for(c=1;cMath.max(u,g)||s>Math.max(f,m)))if(su||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":122}],126:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;f90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":13}],130:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,m.indexOf(u.protocol)===-1?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||r(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":107,"../constants/xmlns_namespaces":108,"../lib":118,d3:10}],131:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function a(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var a=f.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=u.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&l(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sO.range[0]?[1,2]:[2,1]);else{var P=O.range[0],D=O.range[1];"log"===b?(P<=0&&D<=0&&n(L+".autorange",!0),P<=0?P=D/1e6:D<=0&&(D=P/1e6),n(L+".range[0]",Math.log(P)/Math.LN10),n(L+".range[1]",Math.log(D)/Math.LN10)):(n(L+".range[0]",Math.pow(10,P)),n(L+".range[1]",Math.pow(10,D)))}else n(L+".autorange",!0)}if("reverse"===A)C.range?C.range.reverse():(n(L+".autorange",!0),C.range=[1,0]),z.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var N=v.parts[1],E=v.parts[0],I=o[E]||[],R=I[N]||{};2===v.parts.length&&(null===b&&(e[m]="remove"),"add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?N===-1?(g[E]=I,delete g[m]):g[m]=R:x.log("???",e)),!r(R,"x")&&!r(R,"y")||x.containsAny(m,["color","opacity","align","dash"])||(h.docalc=!0);var F=w.getComponentMethod(E,"drawOne");F(t,N,v.parts.slice(2).join("."),e[m]),delete e[m]}else if(k.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])S.manageArrayContainers(v,b,g),h.doplot=!0;else{var j=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?h.doplot=!0:0===v.parts[0].indexOf("geo")?h.doplot=!0:0===v.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===m?h.doplot=!0:!i._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?h.docalc=!0:v.parts[0].indexOf("legend")!==-1?h.dolegend=!0:m.indexOf("title")!==-1?h.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(j,["tick","exponent","grid","zeroline"])?h.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:v.parts.length>1&&j.indexOf("line")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&"mirror"===j?h.doticks=h.dolayoutstyle=!0:"margin.pad"===m?h.doticks=h.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(h.doplot=!0):h.doplot=!0,v.set(b)}}}var q=t._fullLayout.width,B=t._fullLayout.height;k.supplyDefaults(t),t.layout.autosize&&k.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==q||t._fullLayout.height!==B;return H&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];m.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(C.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var o=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=o.append("g").classed("imagelayer",!0),n._shapeUpperLayer=o.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),k=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),C=t("../constants/xmlns_namespaces"),z=t("../lib/svg_text_utils"),S=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,n,r){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=P._basePlotModules,n=0;n=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=S.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),n=k.supplyAnimationDefaults(n);var l=n.transition,s=n.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){if(0!==i._frameQueue.length){for(;i._frameQueue.length;){var e=i._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var l=0;li._timeToNext&&h()};e()}function g(t){return Array.isArray(l)?y>=l.length?t.transitionOpts=l[y]:t.transitionOpts=l[0]:t.transitionOpts=l,y++,t}var m,v,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&x.isPlainObject(e);if(M)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&LL)&&C.push(v);b=C}}b.length>0?f(b):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,n){if(t=S.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,a,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(r=e.length-1;r>=0;r--)u.push({frame:k.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:c+r});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(a=u[r].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=k.modifyFrames,s=k.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),k.modifyFrames(t,o)},y.purge=function(t){t=S.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return k.cleanPlot([],{},n,e),k.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":49,"../components/errorbars":55,"../constants/xmlns_namespaces":108,"../lib":118,"../lib/events":114,"../lib/queue":126,"../lib/svg_text_utils":130,"../plotly":140,"../plots/cartesian/graph_interact":152,"../plots/plots":169,"../plots/polar":172,"../registry":176,"./helpers":131,"./subroutines":137,d3:10,"fast-isnumeric":13}],133:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],134:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:y},n={}):(e=d.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,_(r,p),_(r,e.attributes),n.attributes&&_(r,n.attributes),r.type=t;var a={meta:e.meta||{},attributes:i(r)};if(e.layoutAttributes){var o={};_(o,e.layoutAttributes),a.layoutAttributes=i(o)}return a}function a(){var t={};return _(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var n=d.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)u(t,n,"xaxis"),u(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;u(t,n,r)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.layoutAttributes&&(Array.isArray(n.layoutNodes)?n.layoutNodes.forEach(function(e){f(t,n,e+n.name)}):f(t,n,n.name))}),{layoutAttributes:i(t)}}function o(t){var e=d.transformsRegistry[t];return{attributes:i(e.attributes)}}function i(t){return l(t),s(t),t}function l(t){function e(t){return{valType:"string"}}function r(t,r,a){n.isValObject(t)?"data_array"===t.valType?(t.role="data",a[r+"src"]=e(r)):t.arrayOk===!0&&(a[r+"src"]=e(r)):h.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function s(t){function e(t,e,n){if(t){var r=t[k];r&&(delete t[k],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function c(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function u(t,e,n){var r=h.nestedProperty(t,n),a=_({},e.layoutAttributes);a[w]=!0,r.set(a)}function f(t,e,n){var r=h.nestedProperty(t,n),a=_(r.get()||{},e.layoutAttributes);r.set(a)}var d=t("../registry"),h=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=h.extendFlat,_=h.extendDeep,w="_isSubplotObj",k="_isLinkedToArray",M="_deprecated",A=[w,k,M];n.IS_SUBPLOT_OBJ=w,n.IS_LINKED_TO_ARRAY=k,n.DEPRECATED=M,n.UNDERSCORE_ATTRS=A,n.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:h.valObjects,metaKeys:A.concat.role},traces:t,layout:a(),transforms:e,frames:i(m),animation:i(v)}},n.crawl=function(t,e,r){var a=r||0;Object.keys(t).forEach(function(r){var o=t[r];A.indexOf(r)===-1&&(e(o,r,t,a),n.isValObject(o)||h.isPlainObject(o)&&n.crawl(o,e,a+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,i,l){o=o.slice(0,l).concat([n]);var s="data_array"===e.valType||e.arrayOk===!0;if(s){var c=r(o),u=h.nestedProperty(t,c).get();Array.isArray(u)&&a.push(c)}}function r(t){return t.join(".")}var a=[],o=[];if(n.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":118,"../plotly":140,"../snapshot/cloneplot":177,"../snapshot/helpers":180,"../snapshot/svgtoimg":182,"../snapshot/tosvg":184,"fast-isnumeric":13}],139:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=n.length,v=0;vu&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=S&&a<=10||e>=15*S)t._tickround="d";else if(e>=P&&a<=16||e>=O)t._tickround="M";else if(e>=D&&a<=19||e>=P)t._tickround="S";else{var o=_.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var n=t.match(Y),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);n&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(r&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(n||(a="
"+H(u)),o=X(u)):(n||(a="
"+Z(u)),o=U(u),"M"!==s?(o+=G(u),"S"!==s&&(o+=d(y.round(v(l/1e3,1),4),t,"none",n).substr(1))):"d"===c&&(o=X(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=t<0,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var g=r-1,m=r+1;n="tozero"===t.rangemode?r<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n.map(t.l2r||Number)},N.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=N.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},N.saveRangeInitial=function(t,e){for(var n=N.list(t,"",!0),r=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},N.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},N.autoTicks(f,l);var d,h=N.tickIncrement(N.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=N.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=N.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fC?(e/=C,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,I)):r>z?(e/=z,t.dtick="M"+a(e,1,R)):r>S?(t.dtick=a(e,S,j),t.tick0="2000-01-02"):r>O?t.dtick=a(e,O,R):r>P?t.dtick=a(e,P,F):r>D?t.dtick=a(e,D,F):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,I)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},N.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?B:q,s=t+.01*r,c=_.roundUp(v(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]o:f1&&e2*r}function o(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("../../constants/numerical").BADNUM;e.exports=function(t){return a(t)?"date":o(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":106,"../../lib":118,"fast-isnumeric":13}],147:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var l=i(e,n,r);if(l){if("histogram"===l.type&&r==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,r)){for(var s,u=a(l),f=[],d=0;d0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],150:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],151:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?r:"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,n,l,_,w,k,M){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+mt+")").attr("d",ct+"Z"),ht=pt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+mt+")").attr("d","M0,0Z"),C()}function C(){pt.selectAll(".select-outline").remove()}function z(e,n){if(t._transitioningWithDuration)return!1;var r=Math.max(0,Math.min(V,e+ot)),a=Math.max(0,Math.min(X,n+it)),o=Math.abs(r-ot),i=Math.abs(a-it),l=Math.floor(Math.min(i,o,U)/2);lt.l=Math.min(ot,r),lt.r=Math.max(ot,r),lt.t=Math.min(it,a),lt.b=Math.max(it,a),!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function S(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),b=!1)))}function P(e,n){var a=1===(k+M).length;if(e)R();else if(2!==n||a){if(1===n&&a){var o=k?H[0]:B[0],i="s"===k||"w"===M?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",f="middle";if(o.fixedrange)return;k?(f="n"===k?"top":"bottom","right"===o.side&&(u="right")):"e"===M&&(u="right"),nt.call(d.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var n=o.d2r(e);void 0!==n&&c.relayout(t,l,n)})}}else I()}function D(e){function n(t,e,n){function r(e){return t.l2r(o+(e-o)*n)}if(!t.fixedrange){var a=t.range.map(t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(r)}}if(t._context.scrollZoom||j._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(T(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(yt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=vt[0]+vt[2]*s,u=(l.bottom-e.clientY)/l.height,d=vt[1]+vt[3]*(1-u);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,n){for(var r,o,i=1-e,l=0;l0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rY.width||G<0||G>Y.height)return _.unhoverRaw(t,e)}else U="xpx"in e?e.xpx:M[0]._length/2,G="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?r(o,e.xval):a(M,U),P="yval"in e?r(o,e.yval):a(A,G),!g(O[0])||!g(P[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(N=0;N1||I.hoverinfo.indexOf("name")!==-1?I.name:void 0,index:!1,distance:Math.min(W,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[R]&&(H.subplot=i[R]._subplot),V=X.length,"array"===j){var Q=e[N];"pointNumber"in Q?(H.index=Q.pointNumber,j="closest"):(j="","xval"in Q&&(q=Q.xval,j="x"),"yval"in Q&&(B=Q.yval,j=j?"closest":"y"))}else q=O[F],B=P[F];if(I._module&&I._module.hoverPoints){var $=I._module.hoverPoints(H,q,B,j);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&X.push(s(J,S))}else m.log("Unrecognized trace type in hover:",I);"closest"===S&&X.length>V&&(X.splice(0,V),W=X[0].distance)}if(0===X.length)return _.unhoverRaw(t,e);var tt="y"===S&&Z.length>1;X.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),nt={hovermode:S,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},rt=c(X,nt);u(X,tt?"xa":"ya"),f(rt,tt);var at=t._hoverdata,ot=[];for(D=0;D128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),m=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),m=d.node().getBoundingClientRect().width+2*D):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var v,k,T=f.node().getBoundingClientRect(),C=t.xa._offset+(t.x0+t.x1)/2,z=t.ya._offset+(t.y0+t.y1)/2,S=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),N=T.width+P+D+m;t.ty0=_-T.top,t.bx=T.width+2*D,t.by=T.height+2*D,t.anchor="start",t.txwidth=T.width,t.tx2width=m,t.offset=0,o?(t.pos=C,v=z+O/2+N<=M,k=z-O/2-N>=0,"top"!==t.idealAlign&&v||!k?v?(z+=O/2,t.anchor="start"):t.anchor="middle":(z-=O/2,t.anchor="end")):(t.pos=z,v=C+S/2+N<=w,k=C-S/2-N>=0,"left"!==t.idealAlign&&v||!k?v?(C+=S/2,t.anchor="start"):t.anchor="middle":(C-=S/2,t.anchor="end")),f.attr("text-anchor",t.anchor),m&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+C+","+z+")"+(o?"rotate("+L+")":""))}),z}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?z:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var m=f[i];for(l=m.length-1;l>=0;l--){var v=m[l],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(P+D),l=i+o*(t.txwidth+D),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-O,s=t.offset*S),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*P+s)+","+(P+c)+"v"+(t.by/2-P)+"h"+r*t.bx+"v-"+t.by+"H"+(r*P+s)+"V"+(c-P)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+D).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*D+s,c+t.ty0-t.by/2+D),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,n){function r(n,r){return m.coerce(t,e,A,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=T.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},T.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+k.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},T.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},T.getClosest=function(t,e,n){ +if(n.index!==!1)n.index>=0&&n.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":118,"fast-isnumeric":13}],158:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-m.left,b=n-m.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),C=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var z=g.selectAll("path.select-outline").data([1,2]);z.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",k+"Z");var S,O,P,D,N,E=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,F=[];for(S=0;S0)return Math.log(e)/Math.LN10;if(e<=0&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*f*Math.abs(r-a))}return s}function n(t){return Math.pow(10,t)}function i(t){return a(t)?(t=Number(t),t<-l||t>l?s:a(t)?Number(t):s):s}var f=10;t.c2l="log"===t.type?e:i,t.l2c="log"===t.type?n:i,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var n,r,i=t[e],s=(t._id||"x").charAt(0);if(r="date"===t.type?c.DFLTRANGEDATE:"y"===s?c.DFLTRANGEY:c.DFLTRANGEX,r=r.slice(),!i||2!==i.length)return void(t[e]=r);for("date"===t.type&&(i[0]=o.cleanDate(i[0]),i[1]=o.cleanDate(i[1])),n=0;n<2;n++)if("date"===t.type){if(!o.isDateTime(i[n])){t[e]=r;break}if(i[n]o.MAX_MS&&(i[n]=o.MAX_MS),t.r2l(i[0])===t.r2l(i[1])){var u=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(u-1e3),i[1]=t.l2r(u+1e3);break}}else{if(!a(i[n])){if(!a(i[1-n])){t[e]=r;break}i[n]=i[1-n]*(n?10:.1)}if(i[n]<-l?i[n]=-l:i[n]>l&&(i[n]=l),i[0]===i[1]){var f=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=f,i[1]+=f}}},t.fraction2r=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return t.l2r(n+e*(r-n))},t.r2fraction=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return(t.r2l(e)-n)/(r-n)},t.setScale=function(e){var n=t._gd._fullLayout._size,r=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var a=u.getFromId(t._gd,t.overlaying);t.domain=a.domain}var i=e&&t._r?"_r":"range";t.cleanRange(i);var l=t.r2l(t[i][0]),s=t.r2l(t[i][1]);if("y"===r?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):s},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,n){return t.l2p(t.r2l(e,n))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=i,t.d2c=o.cleanNumber,"log"===t.type?(t.d2l=function(e,n){return t.c2l(t.d2c(e),n)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=o.cleanNumber,t.d2r=o.cleanNumber,t.r2d=i),t.r2l=i,t.l2r=i):"date"===t.type?(t.c2d=o.ms2DateTime,t.d2c=function(t){var e=o.dateTime2ms(t);if(e===s){if(!a(t))return s;e=Number(t)}return o.constrain(e,o.MIN_MS,o.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=o.identity,t.r2d=o.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var n=t._categories.indexOf(e);return n===-1?s:n},t.d2l=t.d2c,t.r2l=i,t.l2r=i,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;o0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var f=u.charAt(0),d=u.substr(1);d=r(d)?Number(d):0,(d<=0||!("date"===i&&"M"===f&&d===Math.round(d)||"log"===i&&"L"===f||"log"===i&&"D"===f&&(1===d||2===d)))&&(e.dtick=c)}var h="date"===i?"2000-01-01":0,p=n("tick0",h);"date"===i?e.tick0=a.cleanDate(p,h):r(p)&&"D1"!==u&&"D2"!==u?e.tick0=Number(p):e.tick0=h}else{var g=n("tickvals");void 0===g?e.tickmode="auto":n("ticktext")}}},{"../../constants/numerical":106,"../../lib":118,"fast-isnumeric":13}],163:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../lib"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,n,c){function u(t){var e,n,r,a,o,i={};for(e in t)if(n=e.split("."),r=n[0].match(s)){var l=r[1],c=l+"axis";if(a=y[c],o={},Array.isArray(t[e])?o.to=t[e].slice(0):Array.isArray(t[e].range)&&(o.to=t[e].range.slice(0)),!o.to)continue;o.axisName=c,o.length=a._length,x.push(l),i[l]=o}return i}function f(t,e,n){var r,a,o,i=t._plots,l=[];for(r in i){var s=i[r];if(l.indexOf(s)===-1){var c=s.xaxis._id,u=s.yaxis._id,f=s.xaxis.range,d=s.yaxis.range;s.xaxis._r=s.xaxis.range.slice(),s.yaxis._r=s.yaxis.range.slice(),a=n[c]?n[c].to:f,o=n[u]?n[u].to:d,f[0]===a[0]&&f[1]===a[1]&&d[0]===o[0]&&d[1]===o[1]||e.indexOf(c)===-1&&e.indexOf(u)===-1||l.push(s)}}return l}function d(e,n){function r(e,n){for(a=0;an.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var k;c&&(k=c());var M,A,T,L=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),M=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":118,"../../plotly":140,"../../registry":176,"./axes":145,d3:10}],164:[function(t,e,n){"use strict";function r(t,e,n){var r,a,o,i=!1;if("data"===e.type)r=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;r=t._fullLayout}return a=c.nestedProperty(r,e.prop).get(),o=n[e.type]=n[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var n=[],r=e[0],a={};if("string"==typeof r)a[r]=e[1];else{if(!c.isPlainObject(r))return n;a=r}return l(a,function(t,e,r){n.push({type:"layout",prop:t,value:r})},"",0),n}function i(t,e){var n,r,a,o,i=[];if(r=e[0],a=e[1],n=e[2],o={},"string"==typeof r)o[r]=a;else{if(!c.isPlainObject(r))return i;o=r,void 0===n&&(n=a)}return void 0===n&&(n=null),l(o,function(e,r,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);n&&(l=Math.min(l,n.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,r+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");n.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=n.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){r(t,s,i.cache),i.check=function(){if(l){var e=r(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),n._initialAutoSizeIsDone){var c=n.width,f=n.height;p.supplyLayoutGlobalDefaults(o,r),o.width||(r.width=c),o.height||(r.height=f)}else{p.supplyLayoutGlobalDefaults(o,r);var d=!o.width||!o.height,h=r.autosize,g=t._context&&t._context.autosizable,m=d&&(h||g);m?p.plotAutoSize(t,o,r):d&&p.sanitizeMargins(t),!h&&d&&(o.width=r.width,o.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=s.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,r),r._has=p._hasPlotType.bind(r);var v=r._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,m=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(g*(m.width-f)),a=Math.round(g*(m.height-h))}else{var v=s?window.getComputedStyle(t):{};r=parseFloat(v.width)||n.width,a=parseFloat(v.height)||n.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;r1,_=!e.height&&Math.abs(n.height-a)>1;(_||b)&&(b&&(n.width=r),_&&(n.height=a)),t._initialAutoSize||(t._initialAutoSize={width:r,height:a}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n,r){var a,o;u.Axes.supplyLayoutDefaults(t,e,n);var i=e._basePlotModules;for(a=0;a.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var m=s[t].t.val,v=s[t].t.size;if(m>d){var y=(h*m+(v-e.height)*d)/(m-d),x=(v*(1-d)+(h-e.height)*(1-m))/(m-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!t._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):d.isJSDate(t)?d.ms2DateTime(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var n,r,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(n=0;n0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(n)for(l=0;l=0,z=C?f.angularAxis.domain:r.extent(M),S=Math.abs(M[1]-M[0]);T&&!A&&(S=0);var O=z.slice();L&&A&&(O[1]+=S);var P=f.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),f.angularAxis.ticksStep&&(P=(O[1]-O[0])/P);var D=f.angularAxis.ticksStep||(O[1]-O[0])/(P*(f.minorTicks+1));k&&(D=Math.max(Math.round(D),1)),O[2]||(O[2]=D);var N=r.range.apply(this,O);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=r.scale.linear().domain(O.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?S:0,e=r.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var E="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(E,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=r.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,j=e.select(".chart-group"),q={fill:"none",stroke:f.tickColor},B={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=i.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});i.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},i.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],a.range([0,x]),u.layout.radialAxis.domain=a.domain(),F.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),j.attr("transform","translate("+_+")").style({cursor:"crosshair"});var X=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(X[0]=Math.max(0,X[0]),X[1]=Math.max(0,X[1]),e.select(".outer-group").attr("transform","translate("+X+")"),f.title){var Z=e.select("g.title-group text").style(B).text(f.title),U=Z.node().getBBox();Z.attr({x:_[0]-U.width/2,y:_[1]-x-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=G.selectAll("circle.grid-circle").data(a.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(q),Y.attr("r",a),Y.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(q);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=r.svg.axis().scale(a).ticks(5).tickSize(5);G.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(q),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(B).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),J=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(q),J.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(B);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?n<270&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(n<=180&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(B);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=r.max(j.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=a,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=r.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return o(i[n].defaultConfig(),t)});i[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=i.tooltipPanel().config({container:ct,fontSize:8})(),ft=i.tooltipPanel().config({container:ct,fontSize:8})(),dt=i.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});j.on("mousemove.angular-guide",function(t,e){var n=i.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=i.util.convertToCartesian(x+12,n+180);ut.text(i.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});j.on("mousemove.radial-guide",function(t,e){var n=i.util.getMousePos(W).radius;pt.attr({r:n}).style({opacity:.5}),lt=a.invert(i.util.getMousePos(W).radius);var r=i.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(i.util.round(lt)).move([r[0]+_[0],r[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var a=r.select(this),o=a.style("fill"),l="black",s=a.style("opacity")||1;if(a.attr({"data-opacity":s}),"none"!=o){a.attr({"data-fill":o}),l=r.hsl(o).darker().toString(),a.style({fill:l,opacity:1});var c={t:i.util.round(t[0]),r:i.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-X[0]-d.left,f.top+f.height/2-X[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else o=a.style("stroke"),a.attr({"data-stroke":o}),l=r.hsl(o).darker().toString(),a.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==r.event.which&&void(r.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=r.select(this),a=n.attr("data-fill");a?n.style({fill:a,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,a,l,s={data:[],layout:{}},c={},u={},f=r.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=i.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),o(s.data[e],i.Axis.defaultConfig().data[0]),o(s.data[e],t)}),o(s.layout,i.Axis.defaultConfig().layout),o(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},r.rebind(d,f,"on"),d},i.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:r.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},i.util={},i.DATAEXTENT="dataExtent",i.AREA="AreaChart",i.LINE="LinePlot",i.DOT="DotPlot",i.BAR="BarChart",i.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},i.util._extend=function(t,e){for(var n in t)e[n]=t[n]},i.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},i.util.dataFromEquation2=function(t,e){var n=e||6,a=r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return a},i.util.dataFromEquation=function(t,e,n){var a=e||6,o=[],i=[];r.range(0,360+a,a).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},i.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return r.range(e).map(function(t,e){return n[e]||n[0]})},i.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=i.util.ensureArray(t[e],n)}),t},i.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},i.util.validateKeys=function(t,e){ +"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},i.util.sumArrays=function(t,e){return r.zip(t,e).map(function(t,e){return r.sum(t)})},i.util.arrayLast=function(t){return t[t.length-1]},i.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return n===-2},i.util.flattenArray=function(t){for(var e=[];!i.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},i.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},i.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},i.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},i.util.getMousePos=function(t){var e=r.mouse(t.node()),n=e[0],a=e[1],o={};return o.x=n,o.y=a,o.pos=e,o.angle=180*(Math.atan2(a,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+a*a),o},i.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;a0)){var l=r.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(n,a,o)},"fill-opacity":0,stroke:function(t,e){return m.stroke(n,a,o)},"stroke-width":function(t,e){return m["stroke-width"](n,a,o)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](n,a,o)},opacity:function(t,e){return m.opacity(n,a,o)},display:function(t,e){return m.display(n,a,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=r.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,a){r.select(this).attr({class:"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var m={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},v=r.select(this).selectAll("g.layer").data(s);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(m).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,n=[i.PolyChart.defaultConfig()],a=r.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),o(n[e],i.PolyChart.defaultConfig()),o(n[e],t)}),this):n},t.getColorScale=function(){return e},r.rebind(t,a,"on"),t},i.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}};return t},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},i.Legend=function(){function t(){var n=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=o({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),i=r.merge(a);i=i.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(i=i.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=r.select(l));var s=i.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof i[0]:n.isContinuous,f=u?n.height:c*i.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=r.range(i.length),m=r.scale[u?"linear":"ordinal"]().domain(g).range(s),v=r.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":r.svg.symbolTypes.indexOf(t)!=-1?r.svg.symbol().type(t).size(n)():r.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(i);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,v(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=r.svg.axis().scale(v).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return i[e].name}),t}var e=i.Legend.defaultConfig(),n=r.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},r.rebind(t,n,"on"),t},i.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},i.tooltipPanel=function(){var t,e,n,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=10,c=function(){t=a.container.selectAll("g."+l).data([0]);var r=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=r.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=r.append("text").attr({dx:a.padding+s,dy:.3*+a.fontSize}),c};return c.text=function(o){var i=r.hsl(a.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var d=a.padding,h=e.node().getBBox(),p={fill:a.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,m=h.height+2*d;return n.attr({d:"M"+[[s,-m/2],[s,-m/4],[a.hasTick?0:s,0],[s,m/4],[s,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-m/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){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 o(a,t),c},c},i.tooltipPanel.uid=1,i.adapter={},i.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=o({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var r=a.indexOf(t.geometry);r!=-1&&(n.data[e].groupId=r)})}if(t.layout){var l=o({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};r.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../lib":118,d3:10}],174:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../lib"),o=t("../../components/color"),i=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){function e(e,a){return a&&(f=a),r.select(r.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?s(n,e):e,o||(o=i.Axis()),u=i.adapter.plotly().convert(n),o.config(u).render(f),t.data=n.data,t.layout=n.layout,c.fillLayout(t),n}var n,a,o,u,f,d=new l;return e.isPolar=!0,e.svg=function(){return o.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return i.adapter.plotly().convert(o.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:o.angularScale(),r:o.radialScale()}},e.setUndoPoint=function(){var t=this,e=i.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,a),a=i.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},c.fillLayout=function(t){var e=r.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:o.background,_container:e,_paperdiv:n,_paper:a};t._fullLayout=s(i,t.layout)}},{"../../components/color":26,"../../lib":118,"./micropolar":173,"./undo_manager":175,d3:10}],175:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return r!==-1},hasRedo:function(){return r-1}var o=t("../lib"),i=t("../plots/plots"),l=o.extendFlat,s=o.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,o=t.data,c=t.layout,u=s([],o),f=s({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;n=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var m,v,y,x,b=e.p+(h?d[n]:d),_=b+(g?p[n]:p),w=e.b,k=w+e.s;if("h"===l.orientation?(y=u.c2p(b,!0),x=u.c2p(_,!0),m=c.c2p(w,!0),v=c.c2p(k,!0)):(m=c.c2p(b,!0),v=c.c2p(_,!0),y=u.c2p(w,!0),x=u.c2p(k,!0)),!(a(m)&&a(v)&&a(y)&&a(x)&&m!==v&&y!==x))return void r.select(this).remove();var M=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,A=r.round(M/2%1,2);if(!t._context.staticPlot){var T=i.opacity(e.mc||l.marker.color),L=T<1||M>.01?o:s;m=L(m,v),v=L(v,m),y=L(y,x),x=L(x,y)}r.select(this).attr("d","M"+m+","+y+"V"+x+"H"+v+"V"+y+"Z")})}),d.call(l.plot,e)}},{"../../components/color":26,"../../components/errorbars":55,"../../lib":118,"./arrays_to_calcdata":185,d3:10,"fast-isnumeric":13}],194:[function(t,e,n){"use strict";function r(t,e,n,r){if(r.length){var l,s,c,u,f,d=t._fullLayout.barmode,h="overlay"===d,p="group"===d;if(h)a(t,e,n,r);else if(p){ +for(l=[],s=[],c=0;cs+i&&(c=!0,s=y)),v(e.c2l(g))&&(gs+i&&(c=!0,s=g))}}x.expand(e,[l,s],{tozero:!0,padded:c})}function m(t){return t._id.charAt(0)}var v=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var n,a=e.xaxis,o=e.yaxis,i=t._fullData,l=t.calcdata,s=[],c=[];for(n=0;n1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&r.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,n=e.marker,i=n.line,l=o.tryColorscale(n,""),s=o.tryColorscale(n,"line");r.select(this).selectAll("path").each(function(t){var e,o,c=(t.mlw+1||i.width+1)-1,u=r.select(this);e="mc"in t?t.mcc=l(t.mc):Array.isArray(n.color)?a.defaultLine:n.color,u.style("stroke-width",c+"px").call(a.fill,e),c&&(o="mlc"in t?t.mlcc=s(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":26,"../../components/drawing":49,"../../components/errorbars":55,d3:10}],197:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,n,i,l){n("marker.color",i),a(t,"marker")&&o(t,e,l,n,{prefix:"marker.",cLetter:"c"}),n("marker.line.color",r.defaultLine),a(t,"marker.line")&&o(t,e,l,n,{prefix:"marker.line.",cLetter:"c"}),n("marker.line.width")}},{"../../components/color":26,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":39}],198:[function(t,e,n){"use strict";var r=t("../scatter/attributes"),a=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,i=r.marker,l=i.line;e.exports={y:{valType:"data_array"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:o({},i.symbol,{arrayOk:!1}),opacity:o({},i.opacity,{arrayOk:!1,dflt:1}),size:o({},i.size,{arrayOk:!1}),color:o({},i.color,{arrayOk:!1}),line:{color:o({},l.color,{arrayOk:!1,dflt:a.defaultLine}),width:o({},l.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:r.fillcolor}},{"../../components/color/attributes":25,"../../lib/extend":115,"../scatter/attributes":240}],199:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(t,e,n,o,i){var l;return n in e?p=o.makeCalcdata(e,n):(l=n+"0"in e?e[n+"0"]:"name"in e&&("category"===o.type||r(e.name)&&["linear","log"].indexOf(o.type)!==-1||a.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,l=o.d2c(l),p=i.map(function(){return l})),p}function i(t,e,n,o,i){var l,s,c,u,f=o.length,d=e.length,h=[],p=[];for(l=0;l=0&&c1,v=n.dPos*(1-d.boxgap)*(1-d.boxgroupgap)/(m?t.numboxes:1),y=m?2*n.dPos*(-.5+(n.boxnum+.5)/t.numboxes)*(1-d.boxgap):0,x=v*g.whiskerwidth;return g.visible!==!0||n.emptybox?void o.select(this).remove():("h"===g.orientation?(s=p,f=h):(s=h,f=p),n.bPos=y,n.bdPos=v,r(),o.select(this).selectAll("path.box").data(i.identity).enter().append("path").attr("class","box").each(function(t){var e=s.c2p(t.pos+y,!0),n=s.c2p(t.pos+y-v,!0),r=s.c2p(t.pos+y+v,!0),a=s.c2p(t.pos+y-x,!0),l=s.c2p(t.pos+y+x,!0),c=f.c2p(t.q1,!0),u=f.c2p(t.q3,!0),d=i.constrain(f.c2p(t.med,!0),Math.min(c,u)+1,Math.max(c,u)-1),h=f.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=f.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?o.select(this).attr("d","M"+d+","+n+"V"+r+"M"+c+","+n+"V"+r+"H"+u+"V"+n+"ZM"+c+","+e+"H"+h+"M"+u+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+h+","+a+"V"+l+"M"+p+","+a+"V"+l)):o.select(this).attr("d","M"+n+","+d+"H"+r+"M"+n+","+c+"H"+r+"V"+u+"H"+n+"ZM"+e+","+c+"V"+h+"M"+e+","+u+"V"+p+(0===g.whiskerwidth?"":"M"+a+","+h+"H"+l+"M"+a+","+p+"H"+l))}),g.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=n,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,n,r,o,l,s,f,d="all"===g.boxpoints?t.val:t.val.filter(function(e){return et.uf}),h=Math.max((t.max-t.min)/10,t.q3-t.q1),p=1e-9*h,m=h*u,x=[],b=0;if(g.jitter){if(0===h)for(b=1,x=new Array(d.length),e=0;et.lo&&(r.so=!0),r})}).enter().append("path").call(l.translatePoints,h,p),void(g.boxmean&&o.select(this).selectAll("path.mean").data(i.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=s.c2p(t.pos+y,!0),n=s.c2p(t.pos+y-v,!0),r=s.c2p(t.pos+y+v,!0),a=f.c2p(t.mean,!0),i=f.c2p(t.mean-t.sd,!0),l=f.c2p(t.mean+t.sd,!0);"h"===g.orientation?o.select(this).attr("d","M"+a+","+n+"V"+r+("sd"!==g.boxmean?"":"m0,0L"+i+","+e+"L"+a+","+n+"L"+l+","+e+"Z")):o.select(this).attr("d","M"+n+","+a+"H"+r+("sd"!==g.boxmean?"":"m0,0L"+e+","+i+"L"+n+","+a+"L"+e+","+l+"Z"))})))})}},{"../../components/drawing":49,"../../lib":118,d3:10}],206:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../plots/cartesian/axes"),o=t("../../lib");e.exports=function(t,e){var n,i,l,s,c=t._fullLayout,u=e.xaxis,f=e.yaxis,d=["v","h"];for(i=0;io)return n[t]=o,o-n[t]}return 0},max:function(t,e,n,a){var o=a[e];if(r(o)){if(o=Number(o),!r(n[t]))return n[t]=o,o;if(n[t]=0&&yR;n--)if(f[n]){F=n;break}for(n=R;n<=F;n++)r(u[n])&&r(f[n])&&I.push({p:u[n],s:f[n],b:0});return I}}},{"../../lib":118,"../../plots/cartesian/axes":145,"./average":213,"./bin_functions":215,"./clean_bins":217,"./norm_functions":220,"fast-isnumeric":13}],217:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib").cleanDate,o=t("../../constants/numerical").ONEDAY;e.exports=function(t,e,n){var i=e.type,l=n+"bins",s=t[l];s||(s=t[l]={});var c="date"===i?function(t){return t||0===t?a(t):null}:function(t){return r(t)?Number(t):null};s.start=c(s.start),s.end=c(s.end);var u="date"===i?o:1,f=s.size;if(r(f))s.size=f>0?Number(f):u;else if("string"!=typeof f)s.size=u;else{var d=f.charAt(0),h=f.substr(1);h=r(h)?Number(h):0,(h<=0||"date"!==i||"M"!==d||h!==Math.round(h))&&(s.size=u)}var p="autobin"+n;"boolean"!=typeof t[p]&&(t[p]=!((s.start||0===s.start)&&(s.end||0===s.end))),t[p]||delete t["nbins"+n]}},{"../../constants/numerical":106,"../../lib":118,"fast-isnumeric":13}],218:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../components/color"),o=t("./bin_defaults"),i=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),s=t("./attributes");e.exports=function(t,e,n,c){function u(n,a){return r.coerce(t,e,s,n,a)}var f=u("x"),d=u("y");u("text");var h=u("orientation",d&&!f?"h":"v"),p=e["v"===h?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===h?"x":"y"];g&&u("histfunc");var m="h"===h?["y"]:["x"];o(t,e,u,m),i(t,e,u,n,c),l(t,e,a.defaultLine,{axis:"y"}),l(t,e,a.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":26,"../../components/errorbars/defaults":54,"../../lib":118,"../bar/style_defaults":197,"./attributes":212,"./bin_defaults":214}],219:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.layoutAttributes=t("../bar/layout_attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("../bar/layout_defaults"),r.calc=t("./calc"),r.setPositions=t("../bar/set_positions"),r.plot=t("../bar/plot"),r.style=t("../bar/style"),r.colorbar=t("../scatter/colorbar"),r.hoverPoints=t("../bar/hover"),r.moduleType="trace",r.name="histogram",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":153,"../bar/hover":189,"../bar/layout_attributes":191,"../bar/layout_defaults":192,"../bar/plot":193,"../bar/set_positions":194,"../bar/style":196,"../scatter/colorbar":243,"./attributes":212,"./calc":216,"./defaults":218}],220:[function(t,e,n){"use strict";e.exports={percent:function(t,e){for(var n=t.length,r=100/e,a=0;ae}}},n.addRangeSlider=function(t){t.xaxis||(t.xaxis={}),t.xaxis.rangeslider||(t.xaxis.rangeslider={})}},{"../../lib":118}],225:[function(t,e,n){"use strict";var r=t("../../plot_api/register");e.exports={moduleType:"trace",name:"ohlc",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","showLegend"],meta:{},attributes:t("./attributes"),supplyDefaults:t("./defaults")},r(t("../scatter")),r(t("./transform"))},{"../../plot_api/register":135,"../../plots/cartesian":153,"../scatter":250,"./attributes":221,"./defaults":222,"./transform":227}],226:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r,a=n("x"),o=n("open"),i=n("high"),l=n("low"),s=n("close");return r=Math.min(o.length,i.length,l.length,s.length),a&&(r=Math.min(r,a.length),r1)){var f=i.distinctVals(u.x.map(e.d2c)).minDiff;o=Math.min(o,f)}}for(o===1/0&&(o=1),c=0;c");_.push(i,i,i,i,i,i,null)},O=0;O")}return g};var s},{"../../components/color":26,"./helpers":232,"fast-isnumeric":13,tinycolor2:16}],231:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(n,o){return r.coerce(t,e,a,n,o)}var l=r.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,m=g||"inside"===p,v=g||"outside"===p;if(m||v){var y=l(i,"textfont",o.font);m&&l(i,"insidetextfont",y),v&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":118,"./attributes":228}],232:[function(t,e,n){"use strict";var r=t("../../lib");n.formatPiePercent=function(t,e){var n=(100*t).toPrecision(3);return n.lastIndexOf(".")!==-1&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)+"%"},n.formatPieValue=function(t,e){var n=t.toPrecision(10);return n.lastIndexOf(".")!==-1&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)}},{"../../lib":118}],233:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.layoutAttributes=t("./layout_attributes"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.styleOne=t("./style_one"),r.moduleType="trace",r.name="pie",r.basePlotModule=t("./base_plot"),r.categories=["pie","showLegend"],r.meta={},e.exports=r},{"./attributes":228,"./base_plot":229,"./calc":230,"./defaults":231,"./layout_attributes":234,"./layout_defaults":235,"./plot":236,"./style":237,"./style_one":238}],234:[function(t,e,n){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],235:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function n(n,o){return r.coerce(t,e,a,n,o)}n("hiddenlabels")}},{"../../lib":118,"./layout_attributes":234}],236:[function(t,e,n){"use strict";function r(t,e,n){var r=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/n.vTotal,.5),l=1-n.trace.hole,s=a(e,n),c={scale:s*n.r*2/r,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=n.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/n.r)-f*o/n.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=n.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),m={scale:2*g/t.width,rCenter:Math.cos(g/n.r)-g/o/n.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>d.scale?m:d;return c.scale<1&&v.scale>c.scale?v:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var n=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(n)),(1-e.trace.hole)/2)}function o(t,e){var n=e.pxmid[0],r=e.pxmid[1],a=t.width/2,o=t.height/2;return n<0&&(a*=-1),r<0&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+n*n/(r*r)),outside:!0}}function i(t,e){function n(t,e){return t.pxmid[1]-e.pxmid[1]}function r(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,n){n||(n={});var r,a,o,l,d,h,g=n.labelExtraY+(i?n.yLabelMax:n.yLabelMin),m=i?t.yLabelMin:t.yLabelMax,v=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-m;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-m-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*f>0&&(r=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+r-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,m,v;for(i=0;i<2;i++)for(l=i?n:r,c=i?Math.max:Math.min,f=i?1:-1,o=0;o<2;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),m=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(n/c(l.tilt,Math.sin(s),l.depth),r/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&h.indexOf(l.scalegroup)===-1&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,n){if(!t)return 1;var r=Math.sin(t*Math.PI/180);return Math.max(.01,n*r*Math.abs(e)+2*Math.sqrt(1-r*r*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var n=t._fullLayout;l(e,n._size);var c=n._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],m=c.trace,v=0,y=(m.depth||0)*c.r*Math.sin(v)/2,x=m.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(v),k=l.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],v=!1;l.each(function(i){function l(e){var r=t._fullLayout,o=t._fullData[m.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&r.hovermode!==!1&&"none"!==l&&"skip"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=n.separators,p=[];l.indexOf("label")!==-1&&p.push(i.label),o.text&&o.text[i.i]&&l.indexOf("text")!==-1&&p.push(o.text[i.i]),l.indexOf("value")!==-1&&p.push(g.formatPieValue(i.v,h)),l.indexOf("percent")!==-1&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:l.indexOf("name")!==-1?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:r._hoverlayer.node(),outerContainer:r._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(n._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],t._hoverdata.trace=e.trace,f.click(t,{target:!0})}function b(t,e,n,r){return"a"+r*c.r+","+r*w+" "+x+" "+i.largeArc+(n?" 1 ":" 0 ")+r*(e[0]-t[0])+","+r*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y),m.pull){var C=+(Array.isArray(m.pull)?m.pull[i.i]:m.pull)||0;C>0&&(k+=C*i.pxmid[0],M+=C*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var z=m.hole;if(i.v===c.vTotal){var S="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";z?T.attr("d","M"+(k+z*i.px0[0])+","+(M+z*i.px0[1])+b(i.px0,i.pxmid,!1,z)+b(i.pxmid,i.px0,!1,z)+"Z"+S):T.attr("d",S)}else{var O=b(i.px0,i.px1,!0,1);if(z){var P=1-z;T.attr("d","M"+(k+z*i.px1[0])+","+(M+z*i.px1[1])+b(i.px1,i.px0,!1,z)+"l"+P*i.px0[0]+","+P*i.px0[1]+O+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+O+"Z")}var D=Array.isArray(m.textposition)?m.textposition[i.i]:m.textposition,N=A.selectAll("g.slicetext").data(i.text&&"none"!==D?[0]:[]);N.enter().append("g").classed("slicetext",!0),N.exit().remove(),N.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===D?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,n=h.bBox(t.node());"outside"===D?e=o(n,i):(e=r(n,i,c),"auto"===D&&e.scale<1&&(t.call(h.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),n=h.bBox(t.node())),e=o(n,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-n.height/2,i.yLabelMid=l,i.yLabelMax=l+n.height/2,i.labelExtraX=0,i.labelExtraY=0,v=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(n.left+n.right)/2+","+-(n.top+n.bottom)/2+")")})}),v&&i(s,m),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),n=e.select("g.slicetext text");n.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+n.attr("transform"));var r=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+r+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(r+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":26,"../../components/drawing":49,"../../lib/svg_text_utils":130,"../../plots/cartesian/graph_interact":152,"./helpers":232,d3:10}],237:[function(t,e,n){"use strict";var r=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],n=e.trace,o=r.select(this);o.style({opacity:n.opacity}),o.selectAll(".top path.surface").each(function(t){r.select(this).call(a,t,n)})})}},{"./style_one":238,d3:10}],238:[function(t,e,n){"use strict";var r=t("../../components/color");e.exports=function(t,e,n){var a=n.marker.line.color;Array.isArray(a)&&(a=a[e.i]||r.defaultLine);var o=n.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(r.stroke,a)}},{"../../components/color":26}],239:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t){var e=t[0].trace,n=e.marker;if(r.mergeArray(e.text,t,"tx"),r.mergeArray(e.textposition,t,"tp"),e.textfont&&(r.mergeArray(e.textfont.size,t,"ts"),r.mergeArray(e.textfont.color,t,"tc"),r.mergeArray(e.textfont.family,t,"tf")),n&&n.line){var a=n.line;r.mergeArray(n.opacity,t,"mo"),r.mergeArray(n.symbol,t,"mx"),r.mergeArray(n.color,t,"mc"),r.mergeArray(a.color,t,"mlc"),r.mergeArray(a.width,t,"mlw")}}},{"../../lib":118}],240:[function(t,e,n){"use strict";var r=t("../../components/colorscale/color_attributes"),a=t("../../components/errorbars/attributes"),o=t("../../components/colorbar/attributes"),i=t("../../components/drawing"),l=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},ids:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"},simplify:{valType:"boolean",dflt:!0}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:l({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},colorbar:o,line:l({},{width:{valType:"number",min:0,arrayOk:!0}},r("marker.line"))},r("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},error_y:a,error_x:a}},{"../../components/colorbar/attributes":27,"../../components/colorscale/color_attributes":33,"../../components/drawing":49,"../../components/errorbars/attributes":51,"../../lib/extend":115,"./constants":245}],241:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var n,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var v={type:"linear"};a.setConvert(v),s=v.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,a.expand(u,d,g),a.expand(f,h,m);var b=new Array(p);for(c=0;c=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}}}}},{}],243:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,s=n.marker,c="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===s||!s.showscale)return void o.autoMargin(t,c);var u=s.color,f=s.cmin,d=s.cmax;r(f)||(f=a.aggNums(Math.min,null,u)),r(d)||(d=a.aggNums(Math.max,null,u));var h=e[0].t.cb=l(t,c),p=i.makeColorScaleFunc(i.extractScale(s.colorscale,f,d),{noNumericCheck:!0});h.fillcolor(p).filllevels({start:f,end:d,size:(d-f)/254}).options(s.colorbar)()}},{"../../components/colorbar/draw":29,"../../components/colorscale":40,"../../lib":118,"../../plots/plots":169,"fast-isnumeric":13}],244:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":32,"../../components/colorscale/has_colorscale":39,"./subtypes":260}],245:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],246:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var m=l(t,e,g),v=mB!=D>=B&&(S=C[T-1][0],O=C[T][0],z=S+(O-S)*(B-P)/(D-P),R=Math.min(R,z),F=Math.max(F,z));R=Math.max(R,0),F=Math.min(F,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:F,y0:B,y1:B,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":26,"../../components/errorbars":55,"../../lib":118,"../../plots/cartesian/constants":150,"../../plots/cartesian/graph_interact":152,"./get_trace_color":248}],250:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.animatable=!0,r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":153,"./arrays_to_calcdata":239,"./attributes":240,"./calc":241,"./clean_data":242,"./colorbar":243,"./defaults":246,"./hover":249,"./plot":257,"./select":258,"./style":259,"./subtypes":260}],251:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=!Array.isArray(l)&&l||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":39}],252:[function(t,e,n){"use strict";var r=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),a=k.c2p(t[e].y);return n!==r&&a!==r&&[n,a]}function a(t){var e=t[0]/w._length,n=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*T}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,m,v,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.simplify,A=e.connectGaps,T=e.baseTolerance,L=e.linear,C=[],z=.2,S=new Array(t.length),O=0;for(M||(T=z=-1),i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,c=f,h=!1):y=t.length||!f)break;S[O++]=f,l=f}}else S[O++]=c}C.push(S.slice(0,O))}return C}},{"../../constants/numerical":106}],253:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],254:[function(t,e,n){"use strict";e.exports=function(t,e,n){for(var r,a,o=null,i=0;i0?Math.max(e,a):0}}},{"fast-isnumeric":13}],256:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":26,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":39,"./subtypes":260}],257:[function(t,e,n){"use strict";function r(t,e){var n;e.selectAll("g.trace").each(function(t){var e=i.select(this);if(n=t[0].trace,n._nexttrace){if(n._nextFill=e.select(".js-fill.js-tonext"),!n._nextFill.size()){var r=":first-child";e.select(".js-fill.js-tozero").size()&&(r+=" + *"),n._nextFill=e.insert("path",r).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),n._nextFill=null;n.fill&&("tozero"===n.fill.substr(0,6)||"toself"===n.fill||"to"===n.fill.substr(0,2)&&!n._prevtrace)?(n._ownFill=e.select(".js-fill.js-tozero"),n._ownFill.size()||(n._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),n._ownFill=null)})}function a(t,e,n,r,a,h,g){function m(t){return M?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,n,r=t[0].trace,a=i.select(this),o=u.hasMarkers(r),c=u.hasText(r),f=x(r),d=b,h=b;o&&(d=r.marker.maxdisplayed?v:l.identity),c&&(h=r.marker.maxdisplayed?v:l.identity),n=a.selectAll("path.point"),e=n.data(d,f);var p=e.enter().append("path").classed("point",!0);p.call(s.pointStyle,r).call(s.translatePoints,A,T,r),M&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=m(i.select(this));s.translatePoint(t,e,A,T),s.singlePointStyle(t,e,r)}),M?e.exit().transition().style("opacity",0).remove():e.exit().remove(),n=a.selectAll("g"),e=n.data(h,f),e.enter().append("g").append("text"),e.each(function(t){var e=m(i.select(this).select("text"));s.translatePoint(t,e,A,T)}),e.selectAll("text").call(s.textPointStyle,r).each(function(t){var e=t.xp||A.c2p(t.x),n=t.yp||T.c2p(t.y);i.select(this).selectAll("tspan").each(function(){m(i.select(this)).attr({x:e,y:n})})}),e.exit().remove()}var w,k;o(t,e,n,r,a);var M=!!g&&g.duration>0,A=n.xaxis,T=n.yaxis,L=r[0].trace,C=L.line,z=i.select(h);if(z.call(c.plot,n,g),L.visible===!0){m(z).style("opacity",L.opacity);var S,O,P=L.fill.charAt(L.fill.length-1);"x"!==P&&"y"!==P&&(P=""),r[0].node3=z,f(r);var D="",N=[],E=L._prevtrace;E&&(D=E._prevRevpath||"",O=E._nextFill,N=E._polygons);var I,R,F,j,q,B,H,V,X,Z="",U="",G=[],Y=[],W=l.noop;if(S=L._ownFill,u.hasLines(L)||"none"!==L.fill){for(O&&O.datum(r),["hv","vh","hvh","vhv"].indexOf(C.shape)!==-1?(F=s.steps(C.shape),j=s.steps(C.shape.split("").reverse().join(""))):F=j="spline"===C.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?s.smoothclosed(t.slice(1),C.smoothing):s.smoothopen(t,C.smoothing)}:function(t){return"M"+t.join("L")},q=function(t){return j(t.reverse())},G=d(r,{xaxis:A,yaxis:T,connectGaps:L.connectgaps,baseTolerance:Math.max(C.width||1,3)/4,linear:"linear"===C.shape,simplify:C.simplify}),X=L._polygons=new Array(G.length),k=0;k1}),W=function(t){return function(e){if(I=F(e),R=q(e),Z?P?(Z+="L"+I.substr(1),U=R+("L"+U.substr(1))):(Z+="Z"+I,U=R+"Z"+U):(Z=I,U=R),u.hasLines(L)&&e.length>1){var n=i.select(this);if(n.datum(r),t)m(n.style("opacity",0).attr("d",I).call(s.lineGroupStyle)).style("opacity",1);else{var a=m(n);a.attr("d",I),s.singleLineStyle(r,a)}}}}}var Q=z.selectAll(".js-line").data(Y);m(Q.exit()).style("opacity",0).remove(),Q.each(W(!1)), +Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(W(!0)),G.length&&(S?B&&V&&(P?("y"===P?B[1]=V[1]=T.c2p(0,!0):"x"===P&&(B[0]=V[0]=A.c2p(0,!0)),m(S).attr("d","M"+V+"L"+B+"L"+Z.substr(1))):m(S).attr("d",Z+"Z")):"tonext"===L.fill.substr(0,6)&&Z&&D&&("tonext"===L.fill?m(O).attr("d",Z+"Z"+D+"Z"):m(O).attr("d",Z+"L"+D.substr(1)+"Z"),L._polygons=L._polygons.concat(N)),L._prevRevpath=U,L._prevPolygons=X);var $=z.selectAll(".points");w=$.data([r]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function o(t,e,n,r,a){var o=n.xaxis,l=n.yaxis,s=i.extent(o.range.map(o.r2l).map(o.l2c)),c=i.extent(l.range.map(l.r2l).map(l.l2c)),f=r[0].trace;if(u.hasMarkers(f)){var d=f.marker.maxdisplayed;if(0!==d){var h=r.filter(function(t){return t.x>=s[0]&&t.x<=s[1]&&t.y>=c[0]&&t.y<=c[1]}),p=Math.ceil(h.length/d),g=0;a.forEach(function(t,n){var r=t[0].trace;u.hasMarkers(r)&&r.marker.maxdisplayed>0&&n0;for(u=p.selectAll("g.trace"),f=u.data(n,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),h(t,e,n),r(t,p),s=0,c=[];sr?1:-1}),m){l&&(d=l());var v=i.transition().duration(o.duration).ease(o.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()});v.each(function(){p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)})})}else p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":49,"../../components/errorbars":55,"../../lib":118,"../../lib/polygon":125,"./arrays_to_calcdata":239,"./line_points":252,"./link_traces":254,"./subtypes":260,d3:10}],258:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;n x1) x1 = p1[0]; + if (p1[1] < y0) y0 = p1[1]; + if (p1[1] > y1) y1 = p1[1]; + } -function bisect(a, x) { - var lo = 0, hi = a.length; - while (lo < hi) { - var mid = lo + hi >>> 1; - if (a[mid] < x) lo = mid + 1; - else hi = mid; + function bboxGeometry(o) { + switch (o.type) { + case "GeometryCollection": o.geometries.forEach(bboxGeometry); break; + case "Point": bboxPoint(o.coordinates); break; + case "MultiPoint": o.coordinates.forEach(bboxPoint); break; + } } - return lo; -} -function feature(topology, o) { - return o.type === "GeometryCollection" ? { - type: "FeatureCollection", - features: o.geometries.map(function(o) { return feature$1(topology, o); }) - } : feature$1(topology, o); -} + if (!bbox) { + var t = transform(topology), p0, p1 = new Array(2), name, + x0 = Infinity, y0 = x0, x1 = -x0, y1 = -x0; + + topology.arcs.forEach(function(arc) { + var i = -1, n = arc.length; + while (++i < n) { + p0 = arc[i], p1[0] = p0[0], p1[1] = p0[1], t(p1, i); + if (p1[0] < x0) x0 = p1[0]; + if (p1[0] > x1) x1 = p1[0]; + if (p1[1] < y0) y0 = p1[1]; + if (p1[1] > y1) y1 = p1[1]; + } + }); + + for (name in topology.objects) { + bboxGeometry(topology.objects[name]); + } + + bbox = topology.bbox = [x0, y0, x1, y1]; + } + + return bbox; +}; + +var reverse = function(array, n) { + var t, j = array.length, i = j - n; + while (i < --j) t = array[i], array[i++] = array[j], array[j] = t; +}; + +var feature = function(topology, o) { + return o.type === "GeometryCollection" + ? {type: "FeatureCollection", features: o.geometries.map(function(o) { return feature$1(topology, o); })} + : feature$1(topology, o); +}; function feature$1(topology, o) { - var f = { - type: "Feature", - id: o.id, - properties: o.properties || {}, - geometry: object(topology, o) - }; - if (o.id == null) delete f.id; - return f; + var id = o.id, + bbox = o.bbox, + properties = o.properties == null ? {} : o.properties, + geometry = object(topology, o); + return id == null && bbox == null ? {type: "Feature", properties: properties, geometry: geometry} + : bbox == null ? {type: "Feature", id: id, properties: properties, geometry: geometry} + : {type: "Feature", id: id, bbox: bbox, properties: properties, geometry: geometry}; } function object(topology, o) { - var absolute = transformAbsolute(topology.transform), + var transformPoint = transform(topology), arcs = topology.arcs; function arc(i, points) { if (points.length) points.pop(); - for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) { - points.push(p = a[k].slice()); - absolute(p, k); + for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) { + points.push(transformPoint(a[k].slice(), k)); } if (i < 0) reverse(points, n); } function point(p) { - p = p.slice(); - absolute(p, 0); - return p; + return transformPoint(p.slice()); } function line(arcs) { @@ -13119,25 +13134,24 @@ function object(topology, o) { } function geometry(o) { - var t = o.type; - return t === "GeometryCollection" ? {type: t, geometries: o.geometries.map(geometry)} - : t in geometryType ? {type: t, coordinates: geometryType[t](o)} - : null; + var type = o.type, coordinates; + switch (type) { + case "GeometryCollection": return {type: type, geometries: o.geometries.map(geometry)}; + case "Point": coordinates = point(o.coordinates); break; + case "MultiPoint": coordinates = o.coordinates.map(point); break; + case "LineString": coordinates = line(o.arcs); break; + case "MultiLineString": coordinates = o.arcs.map(line); break; + case "Polygon": coordinates = polygon(o.arcs); break; + case "MultiPolygon": coordinates = o.arcs.map(polygon); break; + default: return null; + } + return {type: type, coordinates: coordinates}; } - var geometryType = { - Point: function(o) { return point(o.coordinates); }, - MultiPoint: function(o) { return o.coordinates.map(point); }, - LineString: function(o) { return line(o.arcs); }, - MultiLineString: function(o) { return o.arcs.map(line); }, - Polygon: function(o) { return polygon(o.arcs); }, - MultiPolygon: function(o) { return o.arcs.map(polygon); } - }; - return geometry(o); } -function stitchArcs(topology, arcs) { +var stitch = function(topology, arcs) { var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, @@ -13209,114 +13223,107 @@ function stitchArcs(topology, arcs) { arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); }); return fragments; -} +}; -function mesh(topology) { +var mesh = function(topology) { return object(topology, meshArcs.apply(this, arguments)); +}; + +function meshArcs(topology, object$$1, filter) { + var arcs, i, n; + if (arguments.length > 1) arcs = extractArcs(topology, object$$1, filter); + else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i; + return {type: "MultiLineString", arcs: stitch(topology, arcs)}; } -function meshArcs(topology, o, filter) { - var arcs = []; +function extractArcs(topology, object$$1, filter) { + var arcs = [], + geomsByArc = [], + geom; - function arc(i) { + function extract0(i) { var j = i < 0 ? ~i : i; (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom}); } - function line(arcs) { - arcs.forEach(arc); + function extract1(arcs) { + arcs.forEach(extract0); } - function polygon(arcs) { - arcs.forEach(line); + function extract2(arcs) { + arcs.forEach(extract1); } - function geometry(o) { - if (o.type === "GeometryCollection") o.geometries.forEach(geometry); - else if (o.type in geometryType) geom = o, geometryType[o.type](o.arcs); + function extract3(arcs) { + arcs.forEach(extract2); } - if (arguments.length > 1) { - var geomsByArc = [], - geom; - - var geometryType = { - LineString: line, - MultiLineString: polygon, - Polygon: polygon, - MultiPolygon: function(arcs) { arcs.forEach(polygon); } - }; - - geometry(o); - - geomsByArc.forEach(arguments.length < 3 - ? function(geoms) { arcs.push(geoms[0].i); } - : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); }); - } else { - for (var i = 0, n = topology.arcs.length; i < n; ++i) arcs.push(i); + function geometry(o) { + switch (geom = o, o.type) { + case "GeometryCollection": o.geometries.forEach(geometry); break; + case "LineString": extract1(o.arcs); break; + case "MultiLineString": case "Polygon": extract2(o.arcs); break; + case "MultiPolygon": extract3(o.arcs); break; + } } - return {type: "MultiLineString", arcs: stitchArcs(topology, arcs)}; -} + geometry(object$$1); -function cartesianTriangleArea(triangle) { - var a = triangle[0], b = triangle[1], c = triangle[2]; - return Math.abs((a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1])); -} - -function ring(ring) { - var i = -1, - n = ring.length, - a, - b = ring[n - 1], - area = 0; + geomsByArc.forEach(filter == null + ? function(geoms) { arcs.push(geoms[0].i); } + : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); }); - while (++i < n) { - a = b; - b = ring[i]; - area += a[0] * b[1] - a[1] * b[0]; - } + return arcs; +} - return area / 2; +function planarRingArea(ring) { + var i = -1, n = ring.length, a, b = ring[n - 1], area = 0; + while (++i < n) a = b, b = ring[i], area += a[0] * b[1] - a[1] * b[0]; + return Math.abs(area); // Note: doubled area! } -function merge(topology) { +var merge = function(topology) { return object(topology, mergeArcs.apply(this, arguments)); -} +}; function mergeArcs(topology, objects) { var polygonsByArc = {}, polygons = [], - components = []; + groups = []; - objects.forEach(function(o) { - if (o.type === "Polygon") register(o.arcs); - else if (o.type === "MultiPolygon") o.arcs.forEach(register); - }); + objects.forEach(geometry); + + function geometry(o) { + switch (o.type) { + case "GeometryCollection": o.geometries.forEach(geometry); break; + case "Polygon": extract(o.arcs); break; + case "MultiPolygon": o.arcs.forEach(extract); break; + } + } - function register(polygon) { - polygon.forEach(function(ring$$) { - ring$$.forEach(function(arc) { + function extract(polygon) { + polygon.forEach(function(ring) { + ring.forEach(function(arc) { (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon); }); }); polygons.push(polygon); } - function area(ring$$) { - return Math.abs(ring(object(topology, {type: "Polygon", arcs: [ring$$]}).coordinates[0])); + function area(ring) { + return planarRingArea(object(topology, {type: "Polygon", arcs: [ring]}).coordinates[0]); } polygons.forEach(function(polygon) { if (!polygon._) { - var component = [], + var group = [], neighbors = [polygon]; polygon._ = 1; - components.push(component); + groups.push(group); while (polygon = neighbors.pop()) { - component.push(polygon); - polygon.forEach(function(ring$$) { - ring$$.forEach(function(arc) { + group.push(polygon); + polygon.forEach(function(ring) { + ring.forEach(function(arc) { polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) { if (!polygon._) { polygon._ = 1; @@ -13335,13 +13342,13 @@ function mergeArcs(topology, objects) { return { type: "MultiPolygon", - arcs: components.map(function(polygons) { + arcs: groups.map(function(polygons) { var arcs = [], n; // Extract the exterior (unique) arcs. polygons.forEach(function(polygon) { - polygon.forEach(function(ring$$) { - ring$$.forEach(function(arc) { + polygon.forEach(function(ring) { + ring.forEach(function(arc) { if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) { arcs.push(arc); } @@ -13350,7 +13357,7 @@ function mergeArcs(topology, objects) { }); // Stitch the arcs into one or more rings. - arcs = stitchArcs(topology, arcs); + arcs = stitch(topology, arcs); // If more than one ring is returned, // at most one of these rings can be the exterior; @@ -13368,7 +13375,17 @@ function mergeArcs(topology, objects) { }; } -function neighbors(objects) { +var bisect = function(a, x) { + var lo = 0, hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (a[mid] < x) lo = mid + 1; + else hi = mid; + } + return lo; +}; + +var neighbors = function(objects) { var indexesByArc = {}, // arc index -> array of object indexes neighbors = objects.map(function() { return []; }); @@ -13410,150 +13427,105 @@ function neighbors(objects) { } return neighbors; -} - -function compareArea(a, b) { - return a[1][2] - b[1][2]; -} - -function minAreaHeap() { - var heap = {}, - array = [], - size = 0; - - heap.push = function(object) { - up(array[object._ = size] = object, size++); - return size; - }; - - heap.pop = function() { - if (size <= 0) return; - var removed = array[0], object; - if (--size > 0) object = array[size], down(array[object._ = 0] = object, 0); - return removed; - }; +}; - heap.remove = function(removed) { - var i = removed._, object; - if (array[i] !== removed) return; // invalid request - if (i !== --size) object = array[size], (compareArea(object, removed) < 0 ? up : down)(array[object._ = i] = object, i); - return i; - }; +var quantize = function(topology, n) { + if (!((n = Math.floor(n)) >= 2)) throw new Error("n must be ≥2"); + if (topology.transform) throw new Error("already quantized"); + var bb = bbox(topology), name, + dx = bb[0], kx = (bb[2] - dx) / (n - 1) || 1, + dy = bb[1], ky = (bb[3] - dy) / (n - 1) || 1; - function up(object, i) { - while (i > 0) { - var j = ((i + 1) >> 1) - 1, - parent = array[j]; - if (compareArea(object, parent) >= 0) break; - array[parent._ = i] = parent; - array[object._ = i = j] = object; - } + function quantizePoint(p) { + p[0] = Math.round((p[0] - dx) / kx); + p[1] = Math.round((p[1] - dy) / ky); } - function down(object, i) { - while (true) { - var r = (i + 1) << 1, - l = r - 1, - j = i, - child = array[j]; - if (l < size && compareArea(array[l], child) < 0) child = array[j = l]; - if (r < size && compareArea(array[r], child) < 0) child = array[j = r]; - if (j === i) break; - array[child._ = i] = child; - array[object._ = i = j] = object; + function quantizeGeometry(o) { + switch (o.type) { + case "GeometryCollection": o.geometries.forEach(quantizeGeometry); break; + case "Point": quantizePoint(o.coordinates); break; + case "MultiPoint": o.coordinates.forEach(quantizePoint); break; } } - return heap; -} - -function presimplify(topology, triangleArea) { - var absolute = transformAbsolute(topology.transform), - relative = transformRelative(topology.transform), - heap = minAreaHeap(); - - if (!triangleArea) triangleArea = cartesianTriangleArea; - topology.arcs.forEach(function(arc) { - var triangles = [], - maxArea = 0, - triangle, - i, - n, - p; - - // To store each point’s effective area, we create a new array rather than - // extending the passed-in point to workaround a Chrome/V8 bug (getting - // stuck in smi mode). For midpoints, the initial effective area of - // Infinity will be computed in the next step. - for (i = 0, n = arc.length; i < n; ++i) { - p = arc[i]; - absolute(arc[i] = [p[0], p[1], Infinity], i); - } - - for (i = 1, n = arc.length - 1; i < n; ++i) { - triangle = arc.slice(i - 1, i + 2); - triangle[1][2] = triangleArea(triangle); - triangles.push(triangle); - heap.push(triangle); - } - - for (i = 0, n = triangles.length; i < n; ++i) { - triangle = triangles[i]; - triangle.previous = triangles[i - 1]; - triangle.next = triangles[i + 1]; - } - - while (triangle = heap.pop()) { - var previous = triangle.previous, - next = triangle.next; - - // If the area of the current point is less than that of the previous point - // to be eliminated, use the latter's area instead. This ensures that the - // current point cannot be eliminated without eliminating previously- - // eliminated points. - if (triangle[1][2] < maxArea) triangle[1][2] = maxArea; - else maxArea = triangle[1][2]; - - if (previous) { - previous.next = next; - previous[2] = triangle[2]; - update(previous); + var i = 1, + j = 1, + n = arc.length, + pi = arc[0], + x0 = pi[0] = Math.round((pi[0] - dx) / kx), + y0 = pi[1] = Math.round((pi[1] - dy) / ky), + pj, + x1, + y1; + + for (; i < n; ++i) { + pi = arc[i]; + x1 = Math.round((pi[0] - dx) / kx); + y1 = Math.round((pi[1] - dy) / ky); + if (x1 !== x0 || y1 !== y0) { + pj = arc[j++]; + pj[0] = x1 - x0, x0 = x1; + pj[1] = y1 - y0, y0 = y1; } + } - if (next) { - next.previous = previous; - next[0] = triangle[0]; - update(next); - } + if (j < 2) { + pj = arc[j++]; + pj[0] = 0; + pj[1] = 0; } - arc.forEach(relative); + arc.length = j; }); - function update(triangle) { - heap.remove(triangle); - triangle[1][2] = triangleArea(triangle); - heap.push(triangle); + for (name in topology.objects) { + quantizeGeometry(topology.objects[name]); } + topology.transform = { + scale: [kx, ky], + translate: [dx, dy] + }; + return topology; -} +}; -var version = "1.6.27"; +var untransform = function(topology) { + if ((transform = topology.transform) == null) return identity; + var transform, + x0, + y0, + kx = transform.scale[0], + ky = transform.scale[1], + dx = transform.translate[0], + dy = transform.translate[1]; + return function(point, i) { + if (!i) x0 = y0 = 0; + var x1 = Math.round((point[0] - dx) / kx), + y1 = Math.round((point[1] - dy) / ky); + point[0] = x1 - x0, x0 = x1; + point[1] = y1 - y0, y0 = y1; + return point; + }; +}; -exports.version = version; +exports.bbox = bbox; +exports.feature = feature; exports.mesh = mesh; exports.meshArcs = meshArcs; exports.merge = merge; exports.mergeArcs = mergeArcs; -exports.feature = feature; exports.neighbors = neighbors; -exports.presimplify = presimplify; +exports.quantize = quantize; +exports.transform = transform; +exports.untransform = untransform; Object.defineProperty(exports, '__esModule', { value: true }); }))); + },{}],16:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. @@ -13573,13 +13545,18 @@ var Axes = require('../../plots/cartesian/axes'); var attributes = require('./attributes'); -module.exports = function handleAnnotationDefaults(annIn, fullLayout) { - var annOut = {}; +module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, opts, itemOpts) { + opts = opts || {}; + itemOpts = itemOpts || {}; function coerce(attr, dflt) { return Lib.coerce(annIn, annOut, attributes, attr, dflt); } + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + + if(!visible) return annOut; + coerce('opacity'); coerce('align'); coerce('bgcolor'); @@ -13592,74 +13569,61 @@ module.exports = function handleAnnotationDefaults(annIn, fullLayout) { var borderWidth = coerce('borderwidth'); var showArrow = coerce('showarrow'); - if(showArrow) { - coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); - coerce('arrowhead'); - coerce('arrowsize'); - coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); - coerce('ax'); - coerce('ay'); - coerce('axref'); - coerce('ayref'); - - // if you have one part of arrow length you should have both - Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); - } - coerce('text', showArrow ? ' ' : 'new text'); coerce('textangle'); Lib.coerceFont(coerce, 'font', fullLayout.font); // positioning - var axLetters = ['x', 'y']; + var axLetters = ['x', 'y'], + arrowPosDflt = [-10, -30], + gdMock = {_fullLayout: fullLayout}; for(var i = 0; i < 2; i++) { - var axLetter = axLetters[i], - tdMock = {_fullLayout: fullLayout}; + var axLetter = axLetters[i]; // xref, yref - var axRef = Axes.coerceRef(annIn, annOut, tdMock, axLetter); - - // TODO: should be refactored in conjunction with Axes axref, ayref - var aaxRef = Axes.coerceARef(annIn, annOut, tdMock, axLetter); + var axRef = Axes.coerceRef(annIn, annOut, gdMock, axLetter, '', 'paper'); // x, y - var defaultPosition = 0.5; - if(axRef !== 'paper') { - var ax = Axes.getFromId(tdMock, axRef); - defaultPosition = ax.range[0] + defaultPosition * (ax.range[1] - ax.range[0]); - - // convert date or category strings to numbers - if(['date', 'category'].indexOf(ax.type) !== -1 && - typeof annIn[axLetter] === 'string') { - var newval; - if(ax.type === 'date') { - newval = Lib.dateTime2ms(annIn[axLetter]); - if(newval !== false) annIn[axLetter] = newval; - - if(aaxRef === axRef) { - var newvalB = Lib.dateTime2ms(annIn['a' + axLetter]); - if(newvalB !== false) annIn['a' + axLetter] = newvalB; - } - } - else if((ax._categories || []).length) { - newval = ax._categories.indexOf(annIn[axLetter]); - if(newval !== -1) annIn[axLetter] = newval; - } + Axes.coercePosition(annOut, gdMock, coerce, axRef, axLetter, 0.5); + + if(showArrow) { + var arrowPosAttr = 'a' + axLetter, + // axref, ayref + aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + + // for now the arrow can only be on the same axis or specified as pixels + // TODO: sometime it might be interesting to allow it to be on *any* axis + // but that would require updates to drawing & autorange code and maybe more + if(aaxRef !== 'pixel' && aaxRef !== axRef) { + aaxRef = annOut[arrowPosAttr] = 'pixel'; } + + // ax, ay + var aDflt = (aaxRef === 'pixel') ? arrowPosDflt[i] : 0.4; + Axes.coercePosition(annOut, gdMock, coerce, aaxRef, arrowPosAttr, aDflt); } - coerce(axLetter, defaultPosition); // xanchor, yanchor - if(!showArrow) coerce(axLetter + 'anchor'); + else coerce(axLetter + 'anchor'); } // if you have one coordinate you should have both Lib.noneOrAll(annIn, annOut, ['x', 'y']); + if(showArrow) { + coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); + coerce('arrowhead'); + coerce('arrowsize'); + coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); + + // if you have one part of arrow length you should have both + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); + } + return annOut; }; -},{"../../lib":118,"../../plots/cartesian/axes":145,"../color":25,"./attributes":18}],17:[function(require,module,exports){ +},{"../../lib":120,"../../plots/cartesian/axes":148,"../color":25,"./attributes":18}],17:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -13739,7 +13703,14 @@ var extendFlat = require('../../lib/extend').extendFlat; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'annotation', + + visible: { + valType: 'boolean', + + dflt: true, + + }, text: { valType: 'string', @@ -13830,14 +13801,12 @@ module.exports = { }, ax: { - valType: 'number', - dflt: -10, + valType: 'any', }, ay: { - valType: 'number', - dflt: -30, + valType: 'any', }, @@ -13872,7 +13841,7 @@ module.exports = { }, x: { - valType: 'number', + valType: 'any', }, @@ -13893,7 +13862,7 @@ module.exports = { }, y: { - valType: 'number', + valType: 'any', }, @@ -13914,7 +13883,7 @@ module.exports = { } }; -},{"../../lib/extend":114,"../../plots/cartesian/constants":151,"../../plots/font_attributes":166,"./arrow_paths":17}],19:[function(require,module,exports){ +},{"../../lib/extend":115,"../../plots/cartesian/constants":153,"../../plots/font_attributes":168,"./arrow_paths":17}],19:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -13934,7 +13903,7 @@ var draw = require('./draw').draw; module.exports = function calcAutorange(gd) { var fullLayout = gd._fullLayout, - annotationList = fullLayout.annotations; + annotationList = Lib.filterVisible(fullLayout.annotations); if(!annotationList.length || !gd._fullData.length) return; @@ -13986,14 +13955,14 @@ function annAutorange(gd) { } if(xa && xa.autorange) { - Axes.expand(xa, [xa.l2c(ann.x)], { + Axes.expand(xa, [xa.l2c(xa.r2l(ann.x))], { ppadplus: rightSize, ppadminus: leftSize }); } if(ya && ya.autorange) { - Axes.expand(ya, [ya.l2c(ann.y)], { + Axes.expand(ya, [ya.l2c(ya.r2l(ann.y))], { ppadplus: bottomSize, ppadminus: topSize }); @@ -14001,7 +13970,7 @@ function annAutorange(gd) { }); } -},{"../../lib":118,"../../plots/cartesian/axes":145,"./draw":21}],20:[function(require,module,exports){ +},{"../../lib":120,"../../plots/cartesian/axes":148,"./draw":21}],20:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14013,22 +13982,20 @@ function annAutorange(gd) { 'use strict'; +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var handleAnnotationDefaults = require('./annotation_defaults'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - var containerIn = layoutIn.annotations || [], - containerOut = layoutOut.annotations = []; - - for(var i = 0; i < containerIn.length; i++) { - var annIn = containerIn[i] || {}, - annOut = handleAnnotationDefaults(annIn, layoutOut); + var opts = { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults + }; - containerOut.push(annOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"./annotation_defaults":16}],21:[function(require,module,exports){ +},{"../../plots/array_container_defaults":145,"./annotation_defaults":16}],21:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14078,7 +14045,9 @@ function draw(gd) { fullLayout._infolayer.selectAll('.annotation').remove(); for(var i = 0; i < fullLayout.annotations.length; i++) { - drawOne(gd, i); + if(fullLayout.annotations[i].visible) { + drawOne(gd, i); + } } return Plots.previousPromises(gd); @@ -14171,8 +14140,6 @@ function drawOne(gd, index, opt, value) { // where we fail here when they add/remove annotations if(!optionsIn) return; - var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; - // alter the input annotation as requested var optionsEdit = {}; if(typeof opt === 'string' && opt) optionsEdit[opt] = value; @@ -14184,7 +14151,11 @@ function drawOne(gd, index, opt, value) { Lib.nestedProperty(optionsIn, k).set(optionsEdit[k]); } + // return early in visible: false updates + if(optionsIn.visible === false) return; + var gs = fullLayout._size; + var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; var axLetters = ['x', 'y']; for(i = 0; i < 2; i++) { @@ -14199,12 +14170,19 @@ function drawOne(gd, index, opt, value) { continue; } - var axOld = Axes.getFromId(gd, Axes.coerceRef(oldRef, {}, gd, axLetter)), - axNew = Axes.getFromId(gd, Axes.coerceRef(optionsIn, {}, gd, axLetter)), + var axOld = Axes.getFromId(gd, Axes.coerceRef(oldRef, {}, gd, axLetter, '', 'paper')), + axNew = Axes.getFromId(gd, Axes.coerceRef(optionsIn, {}, gd, axLetter, '', 'paper')), position = optionsIn[axLetter], axTypeOld = oldPrivate['_' + axLetter + 'type']; if(optionsEdit[axLetter + 'ref'] !== undefined) { + + // TODO: include ax / ay / axref / ayref here if not 'pixel' + // or even better, move all of this machinery out of here and into + // streambed as extra attributes to a regular relayout call + // we should do this after v2.0 when it can work equivalently for + // annotations, shapes, and images. + var autoAnchor = optionsIn[axLetter + 'anchor'] === 'auto', plotSize = (axLetter === 'x' ? gs.w : gs.h), halfSizeFrac = (oldPrivate['_' + axLetter + 'size'] || 0) / @@ -14213,18 +14191,11 @@ function drawOne(gd, index, opt, value) { // go to the same fraction of the axis length // whether or not these axes share a domain - // first convert to fraction of the axis - position = (position - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); - - // then convert to new data coordinates at the same fraction - position = axNew.range[0] + - position * (axNew.range[1] - axNew.range[0]); + position = axNew.fraction2r(axOld.r2fraction(position)); } else if(axOld) { // data -> paper // first convert to fraction of the axis - position = (position - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + position = axOld.r2fraction(position); // next scale the axis to the whole plot position = axOld.domain[0] + @@ -14252,8 +14223,7 @@ function drawOne(gd, index, opt, value) { (axNew.domain[1] - axNew.domain[0]); // finally convert to data coordinates - position = axNew.range[0] + - position * (axNew.range[1] - axNew.range[0]); + position = axNew.fraction2r(position); } } @@ -14270,7 +14240,8 @@ function drawOne(gd, index, opt, value) { optionsIn[axLetter] = position; } - var options = handleAnnotationDefaults(optionsIn, fullLayout); + var options = {}; + handleAnnotationDefaults(optionsIn, options, fullLayout); fullLayout.annotations[index] = options; var xa = Axes.getFromId(gd, options.xref), @@ -14384,20 +14355,21 @@ function drawOne(gd, index, opt, value) { // outside the visible plot (as long as the axis // isn't autoranged - then we need to draw it // anyway to get its bounding box) - if(!ax.autorange && ((options[axLetter] - ax.range[0]) * - (options[axLetter] - ax.range[1]) > 0)) { + var posFraction = ax.r2fraction(options[axLetter]); + if(!ax.autorange && (posFraction < 0 || posFraction > 1)) { if(options['a' + axLetter + 'ref'] === axRef) { - if((options['a' + axLetter] - ax.range[0]) * - (options['a' + axLetter] - ax.range[1]) > 0) { + posFraction = ax.r2fraction(options['a' + axLetter]); + if(posFraction < 0 || posFraction > 1) { annotationIsOffscreen = true; } - } else { + } + else { annotationIsOffscreen = true; } if(annotationIsOffscreen) return; } - annPosPx[axLetter] = ax._offset + ax.l2p(options[axLetter]); + annPosPx[axLetter] = ax._offset + ax.r2p(options[axLetter]); alignPosition = 0.5; } else { @@ -14410,7 +14382,7 @@ function drawOne(gd, index, opt, value) { var alignShift = 0; if(options['a' + axLetter + 'ref'] === axRef) { - annPosPx['aa' + axLetter] = ax._offset + ax.l2p(options['a' + axLetter]); + annPosPx['aa' + axLetter] = ax._offset + ax.r2p(options['a' + axLetter]); } else { if(options.showarrow) { alignShift = options['a' + axLetter]; @@ -14610,22 +14582,22 @@ function drawOne(gd, index, opt, value) { ann.call(Lib.setTranslate, xcenter, ycenter); update[annbase + '.x'] = xa ? - (options.x + dx / xa._m) : + xa.p2r(xa.r2p(options.x) + dx) : ((arrowX + dx - gs.l) / gs.w); update[annbase + '.y'] = ya ? - (options.y + dy / ya._m) : + ya.p2r(ya.r2p(options.y) + dy) : (1 - ((arrowY + dy - gs.t) / gs.h)); if(options.axref === options.xref) { update[annbase + '.ax'] = xa ? - (options.ax + dx / xa._m) : - ((arrowX + dx - gs.l) / gs.w); + xa.p2r(xa.r2p(options.ax) + dx) : + ((arrowX + dx - gs.l) / gs.w); } if(options.ayref === options.yref) { update[annbase + '.ay'] = ya ? - (options.ay + dy / ya._m) : - (1 - ((arrowY + dy - gs.t) / gs.h)); + ya.p2r(ya.r2p(options.ay) + dy) : + (1 - ((arrowY + dy - gs.t) / gs.h)); } anng.attr({ @@ -14671,13 +14643,13 @@ function drawOne(gd, index, opt, value) { var csr = 'pointer'; if(options.showarrow) { if(options.axref === options.xref) { - update[annbase + '.ax'] = xa.p2l(xa.l2p(options.ax) + dx); + update[annbase + '.ax'] = xa.p2r(xa.r2p(options.ax) + dx); } else { update[annbase + '.ax'] = options.ax + dx; } if(options.ayref === options.yref) { - update[annbase + '.ay'] = ya.p2l(ya.l2p(options.ay) + dy); + update[annbase + '.ay'] = ya.p2r(ya.r2p(options.ay) + dy); } else { update[annbase + '.ay'] = options.ay + dy; } @@ -14783,7 +14755,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":118,"../../lib/setcursor":128,"../../lib/svg_text_utils":130,"../../plotly":141,"../../plots/cartesian/axes":145,"../../plots/plots":182,"../color":25,"../dragelement":47,"../drawing":49,"./annotation_defaults":16,"./defaults":20,"./draw_arrow_head":22,"d3":8,"fast-isnumeric":11}],22:[function(require,module,exports){ +},{"../../lib":120,"../../lib/setcursor":130,"../../lib/svg_text_utils":132,"../../plotly":143,"../../plots/cartesian/axes":148,"../../plots/plots":184,"../color":25,"../dragelement":46,"../drawing":48,"./annotation_defaults":16,"./defaults":20,"./draw_arrow_head":22,"d3":8,"fast-isnumeric":11}],22:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14902,7 +14874,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { if(doEnd) drawhead(end, endRot); }; -},{"../color":25,"../drawing":49,"./arrow_paths":17,"d3":8,"fast-isnumeric":11}],23:[function(require,module,exports){ +},{"../color":25,"../drawing":48,"./arrow_paths":17,"d3":8,"fast-isnumeric":11}],23:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -14914,33 +14886,21 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { 'use strict'; -var Plotly = require('../../plotly'); - -exports.moduleType = 'component'; - -exports.name = 'annotations'; - -exports.ARROWPATHS = require('./arrow_paths'); - -exports.layoutAttributes = require('./attributes'); - -exports.supplyLayoutDefaults = require('./defaults'); - -exports.calcAutorange = require('./calc_autorange'); - -exports.arrowhead = require('./draw_arrow_head'); - var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; -exports.add = function(gd) { - var nextAnn = gd._fullLayout.annotations.length; +module.exports = { + moduleType: 'component', + name: 'annotations', + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), - Plotly.relayout(gd, 'annotations[' + nextAnn + ']', 'add'); + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne }; -},{"../../plotly":141,"./arrow_paths":17,"./attributes":18,"./calc_autorange":19,"./defaults":20,"./draw":21,"./draw_arrow_head":22}],24:[function(require,module,exports){ +},{"./attributes":18,"./calc_autorange":19,"./defaults":20,"./draw":21}],24:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15293,7 +15253,7 @@ module.exports = { } }; -},{"../../lib/extend":114,"../../plots/cartesian/layout_attributes":155,"../../plots/font_attributes":166}],27:[function(require,module,exports){ +},{"../../lib/extend":115,"../../plots/cartesian/layout_attributes":157,"../../plots/font_attributes":168}],27:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15360,7 +15320,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":118,"../../plots/cartesian/tick_label_defaults":161,"../../plots/cartesian/tick_mark_defaults":162,"../../plots/cartesian/tick_value_defaults":163,"./attributes":26}],28:[function(require,module,exports){ +},{"../../lib":120,"../../plots/cartesian/tick_label_defaults":163,"../../plots/cartesian/tick_mark_defaults":164,"../../plots/cartesian/tick_value_defaults":165,"./attributes":26}],28:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -15992,7 +15952,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":118,"../../lib/extend":114,"../../lib/setcursor":128,"../../plotly":141,"../../plots/cartesian/axes":145,"../../plots/cartesian/axis_defaults":147,"../../plots/cartesian/layout_attributes":155,"../../plots/cartesian/position_defaults":158,"../../plots/plots":182,"../../registry":190,"../color":25,"../dragelement":47,"../drawing":49,"../titles":100,"./attributes":26,"d3":8,"tinycolor2":14}],29:[function(require,module,exports){ +},{"../../lib":120,"../../lib/extend":115,"../../lib/setcursor":130,"../../plotly":143,"../../plots/cartesian/axes":148,"../../plots/cartesian/axis_defaults":150,"../../plots/cartesian/layout_attributes":157,"../../plots/cartesian/position_defaults":160,"../../plots/plots":184,"../../registry":192,"../color":25,"../dragelement":46,"../drawing":48,"../titles":99,"./attributes":26,"d3":8,"tinycolor2":14}],29:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16011,28 +15971,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":118}],30:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -exports.attributes = require('./attributes'); - -exports.supplyDefaults = require('./defaults'); - -exports.draw = require('./draw'); - -exports.hasColorbar = require('./has_colorbar'); - -},{"./attributes":26,"./defaults":27,"./draw":28,"./has_colorbar":29}],31:[function(require,module,exports){ +},{"../../lib":120}],30:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16087,7 +16026,7 @@ module.exports = { } }; -},{}],32:[function(require,module,exports){ +},{}],31:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16153,7 +16092,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":118,"./flip_scale":37,"./scales":44}],33:[function(require,module,exports){ +},{"../../lib":120,"./flip_scale":36,"./scales":43}],32:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16197,7 +16136,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":114,"./attributes":31,"./scales.js":44}],34:[function(require,module,exports){ +},{"../../lib/extend":115,"./attributes":30,"./scales.js":43}],33:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16213,7 +16152,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":44}],35:[function(require,module,exports){ +},{"./scales":43}],34:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16277,7 +16216,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":118,"../colorbar/defaults":27,"../colorbar/has_colorbar":29,"./flip_scale":37,"./is_valid_scale":41,"fast-isnumeric":11}],36:[function(require,module,exports){ +},{"../../lib":120,"../colorbar/defaults":27,"../colorbar/has_colorbar":29,"./flip_scale":36,"./is_valid_scale":40,"fast-isnumeric":11}],35:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16314,7 +16253,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],37:[function(require,module,exports){ +},{}],36:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16339,7 +16278,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],38:[function(require,module,exports){ +},{}],37:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16379,7 +16318,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":34,"./is_valid_scale_array":42,"./scales":44}],39:[function(require,module,exports){ +},{"./default_scale":33,"./is_valid_scale_array":41,"./scales":43}],38:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16425,7 +16364,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":118,"./is_valid_scale":41,"fast-isnumeric":11}],40:[function(require,module,exports){ +},{"../../lib":120,"./is_valid_scale":40,"fast-isnumeric":11}],39:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16459,7 +16398,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":31,"./calc":32,"./default_scale":34,"./defaults":35,"./extract_scale":36,"./flip_scale":37,"./get_scale":38,"./has_colorscale":39,"./is_valid_scale":41,"./make_color_scale_func":43,"./scales":44}],41:[function(require,module,exports){ +},{"./attributes":30,"./calc":31,"./default_scale":33,"./defaults":34,"./extract_scale":35,"./flip_scale":36,"./get_scale":37,"./has_colorscale":38,"./is_valid_scale":40,"./make_color_scale_func":42,"./scales":43}],40:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16480,7 +16419,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":42,"./scales":44}],42:[function(require,module,exports){ +},{"./is_valid_scale_array":41,"./scales":43}],41:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16517,7 +16456,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":14}],43:[function(require,module,exports){ +},{"tinycolor2":14}],42:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16613,7 +16552,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":25,"d3":8,"fast-isnumeric":11,"tinycolor2":14}],44:[function(require,module,exports){ +},{"../color":25,"d3":8,"fast-isnumeric":11,"tinycolor2":14}],43:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16744,7 +16683,7 @@ module.exports = { ] }; -},{}],45:[function(require,module,exports){ +},{}],44:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16777,7 +16716,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],46:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -16815,7 +16754,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":118}],47:[function(require,module,exports){ +},{"../../lib":120}],46:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17002,7 +16941,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../lib":118,"../../plotly":141,"../../plots/cartesian/constants":151,"./align":45,"./cursor":46,"./unhover":48}],48:[function(require,module,exports){ +},{"../../lib":120,"../../plotly":143,"../../plots/cartesian/constants":153,"./align":44,"./cursor":45,"./unhover":47}],47:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17053,7 +16992,7 @@ unhover.raw = function unhoverRaw(gd, evt) { gd._hoverdata = undefined; }; -},{"../../lib/events":113}],49:[function(require,module,exports){ +},{"../../lib/events":114}],48:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -17131,14 +17070,14 @@ drawing.getPx = function(s, styleAttr) { return Number(s.style(styleAttr).replace(/px$/, '')); }; -drawing.crispRound = function(td, lineWidth, dflt) { +drawing.crispRound = function(gd, lineWidth, dflt) { // for lines that disable antialiasing we want to // make sure the width is an integer, and at least 1 if it's nonzero if(!lineWidth || !isNumeric(lineWidth)) return dflt || 0; // but not for static plots - these don't get antialiased anyway. - if(td._context.staticPlot) return lineWidth; + if(gd._context.staticPlot) return lineWidth; if(lineWidth < 1) return 1; return Math.round(lineWidth); @@ -17332,9 +17271,8 @@ drawing.singlePointStyle = function(d, sel, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); singlePointStyle(d, sel, trace, markerScale, lineScale, marker, markerLine); @@ -17346,50 +17284,22 @@ drawing.pointStyle = function(s, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales var marker = trace.marker; - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale); }); }; -// for a given color attribute (ie m -> mc = marker.color) look to see if we -// have a colorscale for it (ie mscl, mcmin, mcmax) - if we do, translate -// all numeric color values according to that scale -drawing.tryColorscale = function(cont, contIn, prefix) { - var colorArray = Lib.nestedProperty(cont, prefix + 'color').get(), - scl = Lib.nestedProperty(cont, prefix + 'colorscale').get(), - auto = Lib.nestedProperty(cont, prefix + 'cauto').get(), - minProp = Lib.nestedProperty(cont, prefix + 'cmin'), - maxProp = Lib.nestedProperty(cont, prefix + 'cmax'), - min = minProp.get(), - max = maxProp.get(); +drawing.tryColorscale = function(marker, prefix) { + var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker, + scl = cont.colorscale, + colorArray = cont.color; - // TODO handle this in Colorscale.calc if(scl && Array.isArray(colorArray)) { - if(auto || !isNumeric(min) || !isNumeric(max)) { - min = Infinity; - max = -Infinity; - colorArray.forEach(function(color) { - if(isNumeric(color)) { - if(min > color) min = +color; - if(max < color) max = +color; - } - }); - if(min > max) { - min = 0; - max = 1; - } - minProp.set(min); - maxProp.set(max); - Lib.nestedProperty(contIn, prefix + 'cmin').set(min); - Lib.nestedProperty(contIn, prefix + 'cmax').set(max); - } - return Colorscale.makeColorScaleFunc( - Colorscale.extractScale(scl, min, max) + Colorscale.extractScale(scl, cont.cmin, cont.cmax) ); } else return Lib.identity; @@ -17657,7 +17567,7 @@ drawing.setClipUrl = function(s, localId) { s.attr('clip-path', 'url(' + url + ')'); }; -},{"../../constants/xmlns_namespaces":107,"../../lib":118,"../../lib/svg_text_utils":130,"../../registry":190,"../../traces/scatter/make_bubble_size_func":222,"../../traces/scatter/subtypes":227,"../color":25,"../colorscale":40,"./symbol_defs":50,"d3":8,"fast-isnumeric":11}],50:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":107,"../../lib":120,"../../lib/svg_text_utils":132,"../../registry":192,"../../traces/scatter/make_bubble_size_func":224,"../../traces/scatter/subtypes":229,"../color":25,"../colorscale":39,"./symbol_defs":49,"d3":8,"fast-isnumeric":11}],49:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18133,7 +18043,7 @@ module.exports = { } }; -},{"d3":8}],51:[function(require,module,exports){ +},{"d3":8}],50:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18232,7 +18142,7 @@ module.exports = { } }; -},{}],52:[function(require,module,exports){ +},{}],51:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18295,7 +18205,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":145,"../../registry":190,"./compute_error":53,"fast-isnumeric":11}],53:[function(require,module,exports){ +},{"../../plots/cartesian/axes":148,"../../registry":192,"./compute_error":52,"fast-isnumeric":11}],52:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18391,7 +18301,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],54:[function(require,module,exports){ +},{}],53:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18468,7 +18378,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":118,"../../registry":190,"./attributes":51,"fast-isnumeric":11}],55:[function(require,module,exports){ +},{"../../lib":120,"../../registry":192,"./attributes":50,"fast-isnumeric":11}],54:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18527,7 +18437,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":51,"./calc":52,"./defaults":54,"./plot":56,"./style":57}],56:[function(require,module,exports){ +},{"./attributes":50,"./calc":51,"./defaults":53,"./plot":55,"./style":56}],55:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18691,7 +18601,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":227,"d3":8,"fast-isnumeric":11}],57:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":229,"d3":8,"fast-isnumeric":11}],56:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18728,7 +18638,7 @@ module.exports = function style(traces) { }); }; -},{"../color":25,"d3":8}],58:[function(require,module,exports){ +},{"../color":25,"d3":8}],57:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18743,7 +18653,14 @@ var cartesianConstants = require('../../plots/cartesian/constants'); module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'image', + + visible: { + valType: 'boolean', + + dflt: true, + + }, source: { valType: 'string', @@ -18791,14 +18708,14 @@ module.exports = { }, x: { - valType: 'number', + valType: 'any', dflt: 0, }, y: { - valType: 'number', + valType: 'any', dflt: 0, @@ -18843,7 +18760,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":151}],59:[function(require,module,exports){ +},{"../../plots/cartesian/constants":153}],58:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18854,40 +18771,34 @@ module.exports = { 'use strict'; -var Axes = require('../../plots/cartesian/axes'); var Lib = require('../../lib'); -var attributes = require('./attributes'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var attributes = require('./attributes'); +var name = 'images'; module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { + var opts = { + name: name, + handleItemDefaults: imageDefaults + }; - if(!layoutIn.images || !Array.isArray(layoutIn.images)) return; - - - var containerIn = layoutIn.images, - containerOut = layoutOut.images = []; - - - for(var i = 0; i < containerIn.length; i++) { - var image = containerIn[i]; - - if(!image.source) continue; - - var defaulted = imageDefaults(containerIn[i] || {}, containerOut[i] || {}, layoutOut); - containerOut.push(defaulted); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function imageDefaults(imageIn, imageOut, fullLayout) { - imageOut = imageOut || {}; - function coerce(attr, dflt) { return Lib.coerce(imageIn, imageOut, attributes, attr, dflt); } - coerce('source'); + var source = coerce('source'); + var visible = coerce('visible', !!source); + + if(!visible) return imageOut; + coerce('layer'); coerce('x'); coerce('y'); @@ -18898,18 +18809,18 @@ function imageDefaults(imageIn, imageOut, fullLayout) { coerce('sizing'); coerce('opacity'); - for(var i = 0; i < 2; i++) { - var tdMock = { _fullLayout: fullLayout }, - axLetter = ['x', 'y'][i]; + var gdMock = { _fullLayout: fullLayout }, + axLetters = ['x', 'y']; + for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref - Axes.coerceRef(imageIn, imageOut, tdMock, axLetter, 'paper'); + Axes.coerceRef(imageIn, imageOut, gdMock, axLetters[i], 'paper'); } return imageOut; } -},{"../../lib":118,"../../plots/cartesian/axes":145,"./attributes":58}],60:[function(require,module,exports){ +},{"../../lib":120,"../../plots/array_container_defaults":145,"../../plots/cartesian/axes":148,"./attributes":57}],59:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -18926,25 +18837,23 @@ var Axes = require('../../plots/cartesian/axes'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, imageDataAbove = [], imageDataSubplot = [], imageDataBelow = []; - if(!fullLayout.images) return; - - // Sort into top, subplot, and bottom layers for(var i = 0; i < fullLayout.images.length; i++) { var img = fullLayout.images[i]; - if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - imageDataSubplot.push(img); - } else if(img.layer === 'above') { - imageDataAbove.push(img); - } else { - imageDataBelow.push(img); + if(img.visible) { + if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { + imageDataSubplot.push(img); + } else if(img.layer === 'above') { + imageDataAbove.push(img); + } else { + imageDataBelow.push(img); + } } } @@ -19013,12 +18922,12 @@ module.exports = function draw(gd) { var thisImage = d3.select(this); // Axes if specified - var xref = Axes.getFromId(gd, d.xref), - yref = Axes.getFromId(gd, d.yref); + var xa = Axes.getFromId(gd, d.xref), + ya = Axes.getFromId(gd, d.yref); var size = fullLayout._size, - width = xref ? Math.abs(xref.l2p(d.sizex) - xref.l2p(0)) : d.sizex * size.w, - height = yref ? Math.abs(yref.l2p(d.sizey) - yref.l2p(0)) : d.sizey * size.h; + width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w, + height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset, @@ -19027,8 +18936,8 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xref ? xref.l2p(d.x) + xref._offset : d.x * size.w + size.l) + xOffset, - yPos = (yref ? yref.l2p(d.y) + yref._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset, + yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; // Construct the proper aspectRatio attribute @@ -19053,8 +18962,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xref ? xref._id : '', - yId = yref ? yref._id : '', + var xId = xa ? xa._id : '', + yId = ya ? ya._id : '', clipAxes = xId + yId; if(clipAxes) { @@ -19091,7 +19000,7 @@ module.exports = function draw(gd) { }); }; -},{"../../constants/xmlns_namespaces":107,"../../plots/cartesian/axes":145,"../drawing":49,"d3":8}],61:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":107,"../../plots/cartesian/axes":148,"../drawing":48,"d3":8}],60:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19102,21 +19011,17 @@ module.exports = function draw(gd) { 'use strict'; - -var draw = require('./draw'); -var supplyLayoutDefaults = require('./defaults'); -var attributes = require('./attributes'); - - module.exports = { moduleType: 'component', name: 'images', - draw: draw, - layoutAttributes: attributes, - supplyLayoutDefaults: supplyLayoutDefaults + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), + + draw: require('./draw') }; -},{"./attributes":58,"./defaults":59,"./draw":60}],62:[function(require,module,exports){ +},{"./attributes":57,"./defaults":58,"./draw":59}],61:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19165,7 +19070,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],63:[function(require,module,exports){ +},{}],62:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19256,7 +19161,7 @@ module.exports = { } }; -},{"../../lib/extend":114,"../../plots/font_attributes":166,"../color/attributes":24}],64:[function(require,module,exports){ +},{"../../lib/extend":115,"../../plots/font_attributes":168,"../color/attributes":24}],63:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19274,7 +19179,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],65:[function(require,module,exports){ +},{}],64:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -19367,7 +19272,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":118,"../../plots/layout_attributes":180,"../../registry":190,"./attributes":63,"./helpers":68}],66:[function(require,module,exports){ +},{"../../lib":120,"../../plots/layout_attributes":182,"../../registry":192,"./attributes":62,"./helpers":67}],65:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20083,7 +19988,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../lib":118,"../../lib/svg_text_utils":130,"../../plotly":141,"../../plots/plots":182,"../../registry":190,"../color":25,"../dragelement":47,"../drawing":49,"./anchor_utils":62,"./constants":64,"./get_legend_data":67,"./helpers":68,"./style":70,"d3":8}],67:[function(require,module,exports){ +},{"../../lib":120,"../../lib/svg_text_utils":132,"../../plotly":143,"../../plots/plots":184,"../../registry":192,"../color":25,"../dragelement":46,"../drawing":48,"./anchor_utils":61,"./constants":63,"./get_legend_data":66,"./helpers":67,"./style":69,"d3":8}],66:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20188,7 +20093,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":190,"./helpers":68}],68:[function(require,module,exports){ +},{"../../registry":192,"./helpers":67}],67:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20219,7 +20124,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":190}],69:[function(require,module,exports){ +},{"../../registry":192}],68:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20232,22 +20137,18 @@ exports.isReversed = function isReversed(legendLayout) { 'use strict'; -var legend = module.exports = {}; - - -legend.moduleType = 'component'; - -legend.name = 'legend'; - -legend.layoutAttributes = require('./attributes'); - -legend.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'legend', -legend.draw = require('./draw'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -legend.style = require('./style'); + draw: require('./draw'), + style: require('./style') +}; -},{"./attributes":63,"./defaults":65,"./draw":66,"./style":70}],70:[function(require,module,exports){ +},{"./attributes":62,"./defaults":64,"./draw":65,"./style":69}],69:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20469,7 +20370,7 @@ function stylePies(d) { if(pts.size()) pts.call(stylePie, d[0], trace); } -},{"../../lib":118,"../../registry":190,"../../traces/pie/style_one":205,"../../traces/scatter/subtypes":227,"../color":25,"../drawing":49,"d3":8}],71:[function(require,module,exports){ +},{"../../lib":120,"../../registry":192,"../../traces/pie/style_one":207,"../../traces/scatter/subtypes":229,"../color":25,"../drawing":48,"d3":8}],70:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20979,7 +20880,7 @@ modeBarButtons.resetViews = { } }; -},{"../../../build/ploticon":2,"../../lib":118,"../../plotly":141,"../../plots/cartesian/axes":145,"../../plots/plots":182,"../../snapshot/download":192}],72:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":120,"../../plotly":143,"../../plots/cartesian/axes":148,"../../plots/plots":184,"../../snapshot/download":194}],71:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -20993,7 +20894,7 @@ modeBarButtons.resetViews = { exports.manage = require('./manage'); -},{"./manage":73}],73:[function(require,module,exports){ +},{"./manage":72}],72:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21221,7 +21122,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":145,"../../traces/scatter/subtypes":227,"./buttons":71,"./modebar":74}],74:[function(require,module,exports){ +},{"../../plots/cartesian/axes":148,"../../traces/scatter/subtypes":229,"./buttons":70,"./modebar":73}],73:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21511,7 +21412,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":118,"d3":8}],75:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":120,"d3":8}],74:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21528,7 +21429,8 @@ var extendFlat = require('../../lib/extend').extendFlat; var buttonAttrs = require('./button_attributes'); buttonAttrs = extendFlat(buttonAttrs, { - _isLinkedToArray: true, + _isLinkedToArray: 'button', + }); @@ -21600,7 +21502,7 @@ module.exports = { } }; -},{"../../lib/extend":114,"../../plots/font_attributes":166,"../color/attributes":24,"./button_attributes":76}],76:[function(require,module,exports){ +},{"../../lib/extend":115,"../../plots/font_attributes":168,"../color/attributes":24,"./button_attributes":75}],75:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21641,7 +21543,7 @@ module.exports = { } }; -},{}],77:[function(require,module,exports){ +},{}],76:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21670,7 +21572,7 @@ module.exports = { darkAmount: 10 }; -},{}],78:[function(require,module,exports){ +},{}],77:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -21763,7 +21665,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":118,"../color":25,"./attributes":75,"./button_attributes":76,"./constants":77}],79:[function(require,module,exports){ +},{"../../lib":120,"../color":25,"./attributes":74,"./button_attributes":75,"./constants":76}],78:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22038,7 +21940,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":130,"../../plotly":141,"../../plots/cartesian/axis_ids":148,"../../plots/plots":182,"../color":25,"../drawing":49,"../legend/anchor_utils":62,"./constants":77,"./get_update_object":80,"d3":8}],80:[function(require,module,exports){ +},{"../../lib/svg_text_utils":132,"../../plotly":143,"../../plots/cartesian/axis_ids":151,"../../plots/plots":184,"../color":25,"../drawing":48,"../legend/anchor_utils":61,"./constants":76,"./get_update_object":79,"d3":8}],79:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22052,6 +21954,8 @@ function reposition(gd, buttons, opts, axName) { var d3 = require('d3'); +var Lib = require('../../lib'); + module.exports = function getUpdateObject(axisLayout, buttonLayout) { var axName = axisLayout._name; @@ -22072,7 +21976,7 @@ module.exports = function getUpdateObject(axisLayout, buttonLayout) { function getXRange(axisLayout, buttonLayout) { var currentRange = axisLayout.range; - var base = new Date(currentRange[1]); + var base = new Date(Lib.dateTime2ms(currentRange[1])); var step = buttonLayout.step, count = buttonLayout.count; @@ -22081,13 +21985,13 @@ function getXRange(axisLayout, buttonLayout) { switch(buttonLayout.stepmode) { case 'backward': - range0 = d3.time[step].offset(base, -count).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].offset(base, -count)); break; case 'todate': - var base2 = d3.time[step].offset(base, -(count - 1)); + var base2 = d3.time[step].offset(base, -count); - range0 = d3.time[step].floor(base2).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].ceil(base2)); break; } @@ -22096,7 +22000,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":8}],81:[function(require,module,exports){ +},{"../../lib":120,"d3":8}],80:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22107,18 +22011,18 @@ function getXRange(axisLayout, buttonLayout) { 'use strict'; +module.exports = { + moduleType: 'component', + name: 'rangeselector', -exports.moduleType = 'component'; - -exports.name = 'rangeselector'; - -exports.layoutAttributes = require('./attributes'); - -exports.handleDefaults = require('./defaults'); + layoutNodes: ['xaxis.'], + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":75,"./defaults":78,"./draw":79}],82:[function(require,module,exports){ +},{"./attributes":74,"./defaults":77,"./draw":78}],81:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22155,8 +22059,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -22176,7 +22080,7 @@ module.exports = { } }; -},{"../color/attributes":24}],83:[function(require,module,exports){ +},{"../color/attributes":24}],82:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22229,7 +22133,7 @@ module.exports = { handleStroke: '#666', }; -},{}],84:[function(require,module,exports){ +},{}],83:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22253,7 +22157,8 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe } var containerIn = layoutIn[axName].rangeslider, - containerOut = layoutOut[axName].rangeslider = {}; + axOut = layoutOut[axName], + containerOut = axOut.rangeslider = {}; function coerce(attr, dflt) { return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); @@ -22267,14 +22172,16 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe coerce('range'); // Expand slider range to the axis range - if(containerOut.range && !layoutOut[axName].autorange) { + if(containerOut.range && !axOut.autorange) { var outRange = containerOut.range, - axRange = layoutOut[axName].range; + axRange = axOut.range, + l2r = axOut.l2r, + r2l = axOut.r2l; - outRange[0] = Math.min(outRange[0], axRange[0]); - outRange[1] = Math.max(outRange[1], axRange[1]); + outRange[0] = l2r(Math.min(r2l(outRange[0]), r2l(axRange[0]))); + outRange[1] = l2r(Math.max(r2l(outRange[1]), r2l(axRange[1]))); } else { - layoutOut[axName]._needsExpand = true; + axOut._needsExpand = true; } if(containerOut.visible) { @@ -22289,7 +22196,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe containerOut._input = containerIn; }; -},{"../../lib":118,"./attributes":82}],85:[function(require,module,exports){ +},{"../../lib":120,"./attributes":81}],84:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22396,20 +22303,10 @@ module.exports = function(gd) { rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); - // update inner nodes - - rangeSlider - .call(drawBg, gd, axisOpts, opts) - .call(addClipPath, gd, axisOpts, opts) - .call(drawRangePlot, gd, axisOpts, opts) - .call(drawMasks, gd, axisOpts, opts) - .call(drawSlideBox, gd, axisOpts, opts) - .call(drawGrabbers, gd, axisOpts, opts); - // update data <--> pixel coordinate conversion methods - var range0 = opts.range[0], - range1 = opts.range[1], + var range0 = axisOpts.r2l(opts.range[0]), + range1 = axisOpts.r2l(opts.range[1]), dist = range1 - range0; opts.p2d = function(v) { @@ -22420,6 +22317,18 @@ module.exports = function(gd) { return (v - range0) / dist * opts._width; }; + opts._rl = [range0, range1]; + + // update inner nodes + + rangeSlider + .call(drawBg, gd, axisOpts, opts) + .call(addClipPath, gd, axisOpts, opts) + .call(drawRangePlot, gd, axisOpts, opts) + .call(drawMasks, gd, axisOpts, opts) + .call(drawSlideBox, gd, axisOpts, opts) + .call(drawGrabbers, gd, axisOpts, opts); + // setup drag element setupDragElement(rangeSlider, gd, axisOpts, opts); @@ -22457,8 +22366,8 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { target = event.target, startX = event.clientX, offsetX = startX - rangeSlider.node().getBoundingClientRect().left, - minVal = opts.d2p(axisOpts.range[0]), - maxVal = opts.d2p(axisOpts.range[1]); + minVal = opts.d2p(axisOpts._rl[0]), + maxVal = opts.d2p(axisOpts._rl[1]); var dragCover = dragElement.coverSlip(); @@ -22519,7 +22428,7 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { function setDataRange(rangeSlider, gd, axisOpts, opts) { function clamp(v) { - return Lib.constrain(v, opts.range[0], opts.range[1]); + return axisOpts.l2r(Lib.constrain(v, opts._rl[0], opts._rl[1])); } var dataMin = clamp(opts.p2d(opts._pixelMin)), @@ -22536,8 +22445,8 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts) { return Lib.constrain(v, 0, opts._width); } - var pixelMin = clamp(opts.d2p(axisOpts.range[0])), - pixelMax = clamp(opts.d2p(axisOpts.range[1])); + var pixelMin = clamp(opts.d2p(axisOpts._rl[0])), + pixelMax = clamp(opts.d2p(axisOpts._rl[1])); rangeSlider.select('rect.' + constants.slideBoxClassName) .attr('x', pixelMin) @@ -22630,6 +22539,7 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) { data: [], layout: { xaxis: { + type: axisOpts.type, domain: [0, 1], range: opts.range.slice() }, @@ -22811,7 +22721,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":118,"../../lib/setcursor":128,"../../plotly":141,"../../plots/cartesian":154,"../../plots/cartesian/axes":145,"../../plots/plots":182,"../color":25,"../dragelement":47,"../drawing":49,"./constants":83,"d3":8}],86:[function(require,module,exports){ +},{"../../lib":120,"../../lib/setcursor":130,"../../plotly":143,"../../plots/cartesian":156,"../../plots/cartesian/axes":148,"../../plots/plots":184,"../color":25,"../dragelement":46,"../drawing":48,"./constants":82,"d3":8}],85:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22825,12 +22735,15 @@ function clearPushMargins(gd) { module.exports = { moduleType: 'component', name: 'rangeslider', + + layoutNodes: ['xaxis.'], layoutAttributes: require('./attributes'), handleDefaults: require('./defaults'), + draw: require('./draw') }; -},{"./attributes":82,"./defaults":84,"./draw":85}],87:[function(require,module,exports){ +},{"./attributes":81,"./defaults":83,"./draw":84}],86:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22848,7 +22761,14 @@ var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'shape', + + visible: { + valType: 'boolean', + + dflt: true, + + }, type: { valType: 'enumerated', @@ -22921,7 +22841,7 @@ module.exports = { } }; -},{"../../lib/extend":114,"../../traces/scatter/attributes":207,"../annotations/attributes":18}],88:[function(require,module,exports){ +},{"../../lib/extend":115,"../../traces/scatter/attributes":209,"../annotations/attributes":18}],87:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -22933,6 +22853,7 @@ module.exports = { 'use strict'; +var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); var constants = require('./constants'); @@ -22941,7 +22862,7 @@ var helpers = require('./helpers'); module.exports = function calcAutorange(gd) { var fullLayout = gd._fullLayout, - shapeList = fullLayout.shapes; + shapeList = Lib.filterVisible(fullLayout.shapes); if(!shapeList.length || !gd._fullData.length) return; @@ -22997,7 +22918,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../plots/cartesian/axes":145,"./constants":89,"./helpers":92}],89:[function(require,module,exports){ +},{"../../lib":120,"../../plots/cartesian/axes":148,"./constants":88,"./helpers":91}],88:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23061,7 +22982,7 @@ module.exports = { } }; -},{}],90:[function(require,module,exports){ +},{}],89:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23073,22 +22994,20 @@ module.exports = { 'use strict'; +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var handleShapeDefaults = require('./shape_defaults'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - var containerIn = layoutIn.shapes || [], - containerOut = layoutOut.shapes = []; - - for(var i = 0; i < containerIn.length; i++) { - var shapeIn = containerIn[i] || {}, - shapeOut = handleShapeDefaults(shapeIn, layoutOut); + var opts = { + name: 'shapes', + handleItemDefaults: handleShapeDefaults + }; - containerOut.push(shapeOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"./shape_defaults":94}],91:[function(require,module,exports){ +},{"../../plots/array_container_defaults":145,"./shape_defaults":93}],90:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23140,7 +23059,9 @@ function draw(gd) { fullLayout._shapeSubplotLayer.selectAll('path').remove(); for(var i = 0; i < fullLayout.shapes.length; i++) { - drawOne(gd, i); + if(fullLayout.shapes[i].visible) { + drawOne(gd, i); + } } // may need to resurrect this if we put text (LaTeX) in shapes @@ -23260,8 +23181,6 @@ function updateShape(gd, index, opt, value) { // TODO: clean this up and remove it. if(!optionsIn) return; - var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; - // alter the input shape as requested var optionsEdit = {}; if(typeof opt === 'string' && opt) optionsEdit[opt] = value; @@ -23273,7 +23192,12 @@ function updateShape(gd, index, opt, value) { Lib.nestedProperty(optionsIn, k).set(optionsEdit[k]); } - var posAttrs = ['x0', 'x1', 'y0', 'y1']; + // return early in visible: false updates + if(optionsIn.visible === false) return; + + var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}, + posAttrs = ['x0', 'x1', 'y0', 'y1']; + for(i = 0; i < 4; i++) { var posAttr = posAttrs[i]; // if we don't have an explicit position already, @@ -23288,18 +23212,17 @@ function updateShape(gd, index, opt, value) { var axLetter = posAttr.charAt(0), axOld = Axes.getFromId(gd, - Axes.coerceRef(oldRef, {}, gd, axLetter)), + Axes.coerceRef(oldRef, {}, gd, axLetter, '', 'paper')), axNew = Axes.getFromId(gd, - Axes.coerceRef(optionsIn, {}, gd, axLetter)), + Axes.coerceRef(optionsIn, {}, gd, axLetter, '', 'paper')), position = optionsIn[posAttr], - linearizedPosition; + rangePosition; if(optionsEdit[axLetter + 'ref'] !== undefined) { // first convert to fraction of the axis if(axOld) { - linearizedPosition = helpers.dataToLinear(axOld)(position); - position = (linearizedPosition - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + rangePosition = helpers.shapePositionToRange(axOld)(position); + position = axOld.r2fraction(rangePosition); } else { position = (position - axNew.domain[0]) / (axNew.domain[1] - axNew.domain[0]); @@ -23307,9 +23230,8 @@ function updateShape(gd, index, opt, value) { if(axNew) { // then convert to new data coordinates at the same fraction - linearizedPosition = axNew.range[0] + position * - (axNew.range[1] - axNew.range[0]); - position = helpers.linearToData(axNew)(linearizedPosition); + rangePosition = axNew.fraction2r(position); + position = helpers.rangeToShapePosition(axNew)(rangePosition); } else { // or scale to the whole plot position = axOld.domain[0] + @@ -23320,7 +23242,8 @@ function updateShape(gd, index, opt, value) { optionsIn[posAttr] = position; } - var options = handleShapeDefaults(optionsIn, gd._fullLayout); + var options = {}; + handleShapeDefaults(optionsIn, options, gd._fullLayout); gd._fullLayout.shapes[index] = options; var clipAxes; @@ -23554,22 +23477,22 @@ function getPathString(gd, options) { xa = Axes.getFromId(gd, options.xref), ya = Axes.getFromId(gd, options.yref), gs = gd._fullLayout._size, - x2l, + x2r, x2p, - y2l, + y2r, y2p; if(xa) { - x2l = helpers.dataToLinear(xa); - x2p = function(v) { return xa._offset + xa.l2p(x2l(v, true)); }; + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2l = helpers.dataToLinear(ya); - y2p = function(v) { return ya._offset + ya.l2p(y2l(v, true)); }; + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; @@ -23651,7 +23574,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":118,"../../lib/setcursor":128,"../../plotly":141,"../../plots/cartesian/axes":145,"../color":25,"../dragelement":47,"../drawing":49,"./constants":89,"./defaults":90,"./helpers":92,"./shape_defaults":94,"fast-isnumeric":11}],92:[function(require,module,exports){ +},{"../../lib":120,"../../lib/setcursor":130,"../../plotly":143,"../../plots/cartesian/axes":148,"../color":25,"../dragelement":46,"../drawing":48,"./constants":88,"./defaults":89,"./helpers":91,"./shape_defaults":93,"fast-isnumeric":11}],91:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23668,16 +23591,16 @@ function movePath(pathIn, moveX, moveY) { // so these have to be specified in terms of the category serial numbers, // but can take fractional values. Other axis types we specify position based on // the actual data values. -// TODO: this should really be part of axes, but for now it's only used here. -// eventually annotations and axis ranges will use this too. -// what should we do, invent a new letter for "data except if it's category"? +// TODO: in V2.0 (when log axis ranges are in data units) range and shape position +// will be identical, so rangeToShapePosition and shapePositionToRange can be +// removed entirely. -exports.dataToLinear = function(ax) { - return ax.type === 'category' ? ax.c2l : ax.d2l; +exports.rangeToShapePosition = function(ax) { + return (ax.type === 'log') ? ax.r2d : function(v) { return v; }; }; -exports.linearToData = function(ax) { - return ax.type === 'category' ? ax.l2c : ax.l2d; +exports.shapePositionToRange = function(ax) { + return (ax.type === 'log') ? ax.d2r : function(v) { return v; }; }; exports.decodeDate = function(convertToPx) { @@ -23696,10 +23619,10 @@ exports.getDataToPixel = function(gd, axis, isVertical) { dataToPixel; if(axis) { - var d2l = exports.dataToLinear(axis); + var d2r = exports.shapePositionToRange(axis); dataToPixel = function(v) { - return axis._offset + axis.l2p(d2l(v, true)); + return axis._offset + axis.r2p(d2r(v, true)); }; if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); @@ -23719,8 +23642,8 @@ exports.getPixelToData = function(gd, axis, isVertical) { pixelToData; if(axis) { - var l2d = exports.linearToData(axis); - pixelToData = function(p) { return l2d(axis.p2l(p - axis._offset)); }; + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; @@ -23732,7 +23655,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],93:[function(require,module,exports){ +},{}],92:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23744,21 +23667,21 @@ exports.getPixelToData = function(gd, axis, isVertical) { 'use strict'; -exports.moduleType = 'component'; - -exports.name = 'shapes'; - -exports.layoutAttributes = require('./attributes'); +var drawModule = require('./draw'); -exports.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'shapes', -exports.calcAutorange = require('./calc_autorange'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne +}; -},{"./attributes":87,"./calc_autorange":88,"./defaults":90,"./draw":91}],94:[function(require,module,exports){ +},{"./attributes":86,"./calc_autorange":87,"./defaults":89,"./draw":90}],93:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23776,13 +23699,19 @@ var Axes = require('../../plots/cartesian/axes'); var attributes = require('./attributes'); var helpers = require('./helpers'); -module.exports = function handleShapeDefaults(shapeIn, fullLayout) { - var shapeOut = {}; + +module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opts, itemOpts) { + opts = opts || {}; + itemOpts = itemOpts || {}; function coerce(attr, dflt) { return Lib.coerce(shapeIn, shapeOut, attributes, attr, dflt); } + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + + if(!visible) return shapeOut; + coerce('layer'); coerce('opacity'); coerce('fillcolor'); @@ -23797,39 +23726,61 @@ module.exports = function handleShapeDefaults(shapeIn, fullLayout) { var axLetters = ['x', 'y']; for(var i = 0; i < 2; i++) { var axLetter = axLetters[i], - tdMock = {_fullLayout: fullLayout}; + gdMock = {_fullLayout: fullLayout}; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, tdMock, axLetter); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); if(shapeType !== 'path') { var dflt0 = 0.25, - dflt1 = 0.75; + dflt1 = 0.75, + ax, + pos2r, + r2pos; if(axRef !== 'paper') { - var ax = Axes.getFromId(tdMock, axRef), - convertFn = helpers.linearToData(ax); - - dflt0 = convertFn(ax.range[0] + dflt0 * (ax.range[1] - ax.range[0])); - dflt1 = convertFn(ax.range[0] + dflt1 * (ax.range[1] - ax.range[0])); + ax = Axes.getFromId(gdMock, axRef); + r2pos = helpers.rangeToShapePosition(ax); + pos2r = helpers.shapePositionToRange(ax); } + else { + pos2r = r2pos = Lib.identity; + } + + // hack until V2.0 when log has regular range behavior - make it look like other + // ranges to send to coerce, then put it back after + // this is all to give reasonable default position behavior on log axes, which is + // a pretty unimportant edge case so we could just ignore this. + var attr0 = axLetter + '0', + attr1 = axLetter + '1', + in0 = shapeIn[attr0], + in1 = shapeIn[attr1]; + shapeIn[attr0] = pos2r(shapeIn[attr0], true); + shapeIn[attr1] = pos2r(shapeIn[attr1], true); // x0, x1 (and y0, y1) - coerce(axLetter + '0', dflt0); - coerce(axLetter + '1', dflt1); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr0, dflt0); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr1, dflt1); + + // hack part 2 + shapeOut[attr0] = r2pos(shapeOut[attr0]); + shapeOut[attr1] = r2pos(shapeOut[attr1]); + shapeIn[attr0] = in0; + shapeIn[attr1] = in1; } } if(shapeType === 'path') { coerce('path'); - } else { + } + else { Lib.noneOrAll(shapeIn, shapeOut, ['x0', 'x1', 'y0', 'y1']); } return shapeOut; }; -},{"../../lib":118,"../../plots/cartesian/axes":145,"./attributes":87,"./helpers":92}],95:[function(require,module,exports){ +},{"../../lib":120,"../../plots/cartesian/axes":148,"./attributes":86,"./helpers":91}],94:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -23848,7 +23799,7 @@ var animationAttrs = require('../../plots/animation_attributes'); var constants = require('./constants'); var stepsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'step', method: { valType: 'enumerated', @@ -23881,6 +23832,8 @@ var stepsAttrs = { }; module.exports = { + _isLinkedToArray: 'slider', + visible: { valType: 'boolean', @@ -24061,7 +24014,7 @@ module.exports = { }, }; -},{"../../lib/extend":114,"../../plots/animation_attributes":142,"../../plots/font_attributes":166,"../../plots/pad_attributes":181,"./constants":96}],96:[function(require,module,exports){ +},{"../../lib/extend":115,"../../plots/animation_attributes":144,"../../plots/font_attributes":168,"../../plots/pad_attributes":183,"./constants":95}],95:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24076,9 +24029,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'sliders', - itemName: 'slider', // class names containerClassName: 'slider-container', @@ -24159,7 +24111,7 @@ module.exports = { currentValueInset: 0, }; -},{}],97:[function(require,module,exports){ +},{}],96:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24171,6 +24123,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -24180,23 +24133,12 @@ var stepAttrs = attributes.steps; module.exports = function slidersDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var sliderIn = contIn[i] || {}, - sliderOut = {}; - - sliderDefaults(sliderIn, sliderOut, layoutOut); - - // used on button click to update the 'active' field - sliderOut._input = sliderIn; - - // used to determine object constancy - sliderOut._index = i; + var opts = { + name: name, + handleItemDefaults: sliderDefaults + }; - contOut.push(sliderOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function sliderDefaults(sliderIn, sliderOut, layoutOut) { @@ -24282,7 +24224,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":118,"./attributes":95,"./constants":96}],98:[function(require,module,exports){ +},{"../../lib":120,"../../plots/array_container_defaults":145,"./attributes":94,"./constants":95}],97:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24651,6 +24593,7 @@ function handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, doTransiti } function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) { + var previousActive = sliderOpts.active; sliderOpts._input.active = sliderOpts.active = index; var step = sliderOpts.steps[sliderOpts.active]; @@ -24658,6 +24601,13 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) sliderGroup.call(setGripPosition, sliderOpts, sliderOpts.active / (sliderOpts.steps.length - 1), doTransition); sliderGroup.call(drawCurrentValue, sliderOpts); + gd.emit('plotly_sliderchange', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active], + interaction: doCallback, + previousActive: previousActive + }); + if(step && step.method && doCallback) { if(sliderGroup._nextMethod) { // If we've already queued up an update, just overwrite it with the most recent: @@ -24684,6 +24634,8 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { var $gd = d3.select(gd); item.on('mousedown', function() { + gd.emit('plotly_sliderstart', {slider: sliderOpts}); + var grip = sliderGroup.select('.' + constants.gripRectClass); d3.event.stopPropagation(); @@ -24704,6 +24656,11 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { grip.call(Color.fill, sliderOpts.bgcolor); $gd.on('mouseup', null); $gd.on('mousemove', null); + + gd.emit('plotly_sliderend', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active] + }); }); }); } @@ -24841,7 +24798,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":118,"../../lib/svg_text_utils":130,"../../plots/plots":182,"../color":25,"../drawing":49,"../legend/anchor_utils":62,"./constants":96,"d3":8}],99:[function(require,module,exports){ +},{"../../lib":120,"../../lib/svg_text_utils":132,"../../plots/plots":184,"../color":25,"../drawing":48,"../legend/anchor_utils":61,"./constants":95,"d3":8}],98:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -24852,18 +24809,19 @@ function clearPushMargins(gd) { 'use strict'; +var constants = require('./constants'); -exports.moduleType = 'component'; - -exports.name = 'sliders'; - -exports.layoutAttributes = require('./attributes'); +module.exports = { + moduleType: 'component', + name: constants.name, -exports.supplyLayoutDefaults = require('./defaults'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":95,"./defaults":97,"./draw":98}],100:[function(require,module,exports){ +},{"./attributes":94,"./constants":95,"./defaults":96,"./draw":97}],99:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25093,7 +25051,7 @@ Titles.draw = function(gd, titleClass, options) { el.classed('js-placeholder', isplaceholder); }; -},{"../../lib":118,"../../lib/svg_text_utils":130,"../../plotly":141,"../../plots/plots":182,"../color":25,"../drawing":49,"d3":8,"fast-isnumeric":11}],101:[function(require,module,exports){ +},{"../../lib":120,"../../lib/svg_text_utils":132,"../../plotly":143,"../../plots/plots":184,"../color":25,"../drawing":48,"d3":8,"fast-isnumeric":11}],100:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25110,7 +25068,7 @@ var extendFlat = require('../../lib/extend').extendFlat; var padAttrs = require('../../plots/pad_attributes'); var buttonsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'button', method: { valType: 'enumerated', @@ -25139,7 +25097,7 @@ var buttonsAttrs = { }; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'updatemenu', visible: { valType: 'boolean', @@ -25239,7 +25197,7 @@ module.exports = { } }; -},{"../../lib/extend":114,"../../plots/font_attributes":166,"../../plots/pad_attributes":181,"../color/attributes":24}],102:[function(require,module,exports){ +},{"../../lib/extend":115,"../../plots/font_attributes":168,"../../plots/pad_attributes":183,"../color/attributes":24}],101:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25254,9 +25212,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'updatemenus', - itemName: 'updatemenu', // class names containerClassName: 'updatemenu-container', @@ -25316,7 +25273,7 @@ module.exports = { hoverColor: '#F4FAFF' }; -},{}],103:[function(require,module,exports){ +},{}],102:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25328,6 +25285,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -25337,23 +25295,12 @@ var buttonAttrs = attributes.buttons; module.exports = function updateMenusDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var menuIn = contIn[i] || {}, - menuOut = {}; - - menuDefaults(menuIn, menuOut, layoutOut); - - // used on button click to update the 'active' field - menuOut._input = menuIn; - - // used to determine object constancy - menuOut._index = i; + var opts = { + name: name, + handleItemDefaults: menuDefaults + }; - contOut.push(menuOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function menuDefaults(menuIn, menuOut, layoutOut) { @@ -25420,7 +25367,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":118,"./attributes":101,"./constants":102}],104:[function(require,module,exports){ +},{"../../lib":120,"../../plots/array_container_defaults":145,"./attributes":100,"./constants":101}],103:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -25722,6 +25669,8 @@ function drawButtons(gd, gHeader, gButton, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, buttonIndex); Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + + gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); button.on('mouseover', function() { @@ -26001,7 +25950,9 @@ function clearPushMargins(gd) { } } -},{"../../lib":118,"../../lib/svg_text_utils":130,"../../plots/plots":182,"../color":25,"../drawing":49,"../legend/anchor_utils":62,"./constants":102,"d3":8}],105:[function(require,module,exports){ +},{"../../lib":120,"../../lib/svg_text_utils":132,"../../plots/plots":184,"../color":25,"../drawing":48,"../legend/anchor_utils":61,"./constants":101,"d3":8}],104:[function(require,module,exports){ +arguments[4][98][0].apply(exports,arguments) +},{"./attributes":100,"./constants":101,"./defaults":102,"./draw":103,"dup":98}],105:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26013,17 +25964,37 @@ function clearPushMargins(gd) { 'use strict'; -exports.moduleType = 'component'; - -exports.name = 'updatemenus'; - -exports.layoutAttributes = require('./attributes'); +module.exports = { + /** + * Standardize all missing data in calcdata to use undefined + * never null or NaN. + * That way we can use !==undefined, or !== BADNUM, + * to test for real data + */ + BADNUM: undefined, -exports.supplyLayoutDefaults = require('./defaults'); + /* + * Limit certain operations to well below floating point max value + * to avoid glitches: Make sure that even when you multiply it by the + * number of pixels on a giant screen it still works + */ + FP_SAFE: Number.MAX_VALUE / 10000, -exports.draw = require('./draw'); + /* + * conversion of date units to milliseconds + * year and month constants are marked "AVG" + * to remind us that not all years and months + * have the same length + */ + ONEAVGYEAR: 31557600000, // 365.25 days + ONEAVGMONTH: 2629800000, // 1/12 of ONEAVGYEAR + ONEDAY: 86400000, + ONEHOUR: 3600000, + ONEMIN: 60000, + ONESEC: 1000 +}; -},{"./attributes":101,"./defaults":103,"./draw":104}],106:[function(require,module,exports){ +},{}],106:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26103,7 +26074,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.19.2'; +exports.version = '1.20.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -26164,7 +26135,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":23,"./components/images":61,"./components/legend":69,"./components/rangeselector":81,"./components/rangeslider":86,"./components/shapes":93,"./components/sliders":99,"./components/updatemenus":105,"./fonts/mathjax_config":109,"./lib/queue":126,"./plot_api/plot_schema":135,"./plot_api/register":136,"./plot_api/set_plot_config":137,"./plot_api/to_image":139,"./plot_api/validate":140,"./plotly":141,"./snapshot":195,"./snapshot/download":192,"./traces/scatter":217,"d3":8,"es6-promise":9}],109:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":23,"./components/images":60,"./components/legend":68,"./components/rangeselector":80,"./components/rangeslider":85,"./components/shapes":92,"./components/sliders":98,"./components/updatemenus":104,"./fonts/mathjax_config":109,"./lib/queue":128,"./plot_api/plot_schema":137,"./plot_api/register":138,"./plot_api/set_plot_config":139,"./plot_api/to_image":141,"./plot_api/validate":142,"./plotly":143,"./snapshot":197,"./snapshot/download":194,"./traces/scatter":219,"d3":8,"es6-promise":9}],109:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26224,22 +26195,50 @@ module.exports = function arrayToCalcItem(traceAttr, calcItem, calcAttr, i) { */ +'use strict'; + +var isNumeric = require('fast-isnumeric'); + +var BADNUM = require('../constants/numerical').BADNUM; + +// precompile these regex's for speed +var FRONTJUNK = /^['"%,$#\s']+/; +var ENDJUNK = /['"%,$#\s']+$/; + +/** + * cleanNumber: remove common leading and trailing cruft + * Always returns either a number or BADNUM. + */ +module.exports = function cleanNumber(v) { + if(typeof v === 'string') { + v = v.replace(FRONTJUNK, '').replace(ENDJUNK, ''); + } + + if(isNumeric(v)) return Number(v); + + return BADNUM; +}; + +},{"../constants/numerical":105,"fast-isnumeric":11}],112:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + 'use strict'; var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); -var nestedProperty = require('./nested_property'); -var isPlainObject = require('./is_plain_object'); -var filterUnique = require('./filter_unique'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); +var nestedProperty = require('./nested_property'); -var idRegex = /^([2-9]|[1-9][0-9]+)$/; - -function isValObject(obj) { - return obj && obj.valType !== undefined; -} +var ID_REGEX = /^([2-9]|[1-9][0-9]+)$/; exports.valObjects = { data_array: { @@ -26350,7 +26349,7 @@ exports.valObjects = { coerceFunction: function(v, propOut, dflt) { var dlen = dflt.length; if(typeof v === 'string' && v.substr(0, dlen) === dflt && - idRegex.test(v.substr(dlen))) { + ID_REGEX.test(v.substr(dlen))) { propOut.set(v); return; } @@ -26362,7 +26361,7 @@ exports.valObjects = { if(v === dflt) return true; if(typeof v !== 'string') return false; - if(v.substr(0, dlen) === dflt && idRegex.test(v.substr(dlen))) { + if(v.substr(0, dlen) === dflt && ID_REGEX.test(v.substr(dlen))) { return true; } @@ -26530,129 +26529,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -/* - * returns true for a valid value object and false for tree nodes in the attribute hierarchy - */ -exports.isValObject = isValObject; - -exports.IS_SUBPLOT_OBJ = '_isSubplotObj'; -exports.IS_LINKED_TO_ARRAY = '_isLinkedToArray'; -exports.DEPRECATED = '_deprecated'; - -// list of underscore attributes to keep in schema as is -exports.UNDERSCORE_ATTRS = [exports.IS_SUBPLOT_OBJ, exports.IS_LINKED_TO_ARRAY, exports.DEPRECATED]; - -/** - * Crawl the attribute tree, recursively calling a callback function - * - * @param {object} attrs - * The node of the attribute tree (e.g. the root) from which recursion originates - * @param {Function} callback - * A callback function with the signature: - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * @param {Number} [specifiedLevel] - * The level in the tree, in order to let the callback function detect descend or backtrack, - * typically unsupplied (implied 0), just used by the self-recursive call. - * The necessity arises because the tree traversal is not controlled by callback return values. - * The decision to not use callback return values for controlling tree pruning arose from - * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions - * precedes the callback call. - * - * @return {object} transformOut - * copy of transformIn that contains attribute defaults - */ -exports.crawl = function(attrs, callback, specifiedLevel) { - var level = specifiedLevel || 0; - Object.keys(attrs).forEach(function(attrName) { - var attr = attrs[attrName]; - - if(exports.UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - - callback(attr, attrName, attrs, level); - - if(isValObject(attr)) return; - if(isPlainObject(attr)) exports.crawl(attr, callback, level + 1); - }); -}; - -/** - * Find all data array attributes in a given trace object - including - * `arrayOk` attributes. - * - * @param {object} trace - * full trace object that contains a reference to `_module.attributes` - * - * @return {array} arrayAttributes - * list of array attributes for the given trace - */ -exports.findArrayAttributes = function(trace) { - var arrayAttributes = [], - stack = []; - - /** - * A closure that gathers attribute paths into its enclosed arraySplitAttributes - * Attribute paths are collected iff their leaf node is a splittable attribute - * - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * - * @closureVariable {String[][]} arrayAttributes the set of gathered attributes - * Example of filled closure variable (expected to be initialized to []): - * [["marker","size"],["marker","line","width"],["marker","line","color"]] - */ - function callback(attr, attrName, attrs, level) { - stack = stack.slice(0, level).concat([attrName]); - - var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; - if(!splittableAttr) return; - - var astr = toAttrString(stack); - var val = nestedProperty(trace, astr).get(); - if(!Array.isArray(val)) return; - - arrayAttributes.push(astr); - } - - function toAttrString(stack) { - return stack.join('.'); - } - - exports.crawl(trace._module.attributes, callback); - - if(trace.transforms) { - var transforms = trace.transforms; - - for(var i = 0; i < transforms.length; i++) { - var transform = transforms[i]; - - stack = ['transforms[' + i + ']']; - exports.crawl(transform._module.attributes, callback, 1); - } - } - - // Look into the fullInput module attributes for array attributes - // to make sure that 'custom' array attributes are detected. - // - // At the moment, we need this block to make sure that - // ohlc and candlestick 'open', 'high', 'low', 'close' can be - // used with filter ang groupby transforms. - if(trace._fullInput) { - exports.crawl(trace._fullInput._module.attributes, callback); - - arrayAttributes = filterUnique(arrayAttributes); - } - - return arrayAttributes; -}; - -},{"../components/colorscale/get_scale":38,"../components/colorscale/scales":44,"./filter_unique":115,"./is_plain_object":120,"./nested_property":123,"fast-isnumeric":11,"tinycolor2":14}],112:[function(require,module,exports){ +},{"../components/colorscale/get_scale":37,"../components/colorscale/scales":43,"./nested_property":125,"fast-isnumeric":11,"tinycolor2":14}],113:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -26667,6 +26544,24 @@ exports.findArrayAttributes = function(trace) { var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); +var logError = require('./loggers').error; + +var constants = require('../constants/numerical'); +var BADNUM = constants.BADNUM; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + +// is an object a javascript date? +exports.isJSDate = function(v) { + return typeof v === 'object' && v !== null && typeof v.getTime === 'function'; +}; + +// The absolute limits of our date-time system +// This is a little weird: we use MIN_MS and MAX_MS in dateTime2ms +// but we use dateTime2ms to calculate them (after defining it!) +var MIN_MS, MAX_MS; /** * dateTime2ms - turn a date object or string s of the form @@ -26674,7 +26569,13 @@ var isNumeric = require('fast-isnumeric'); * per javascript standard) * may truncate after any full field, and sss can be any length * even >3 digits, though javascript dates truncate to milliseconds - * returns false if it doesn't find a date + * returns BADNUM if it doesn't find a date + * + * Expanded to support negative years to -9999 but you must always + * give 4 digits, except for 2-digit positive years which we assume are + * near the present time. + * Note that we follow ISO 8601:2004: there *is* a year 0, which + * is 1BC/BCE, and -1===2BC etc. * * 2-digit to 4-digit year conversion, where to cut off? * from http://support.microsoft.com/kb/244664: @@ -26682,85 +26583,123 @@ var isNumeric = require('fast-isnumeric'); * but in my mac chrome from eg. d=new Date(Date.parse('8/19/50')): * 1950-2049 * by Java, from http://stackoverflow.com/questions/2024273/: - * now-80 - now+20 + * now-80 - now+19 * or FileMaker Pro, from * http://www.filemaker.com/12help/html/add_view_data.4.21.html: - * now-70 - now+30 + * now-70 - now+29 * but python strptime etc, via * http://docs.python.org/py3k/library/time.html: * 1969-2068 (super forward-looking, but static, not sliding!) * - * lets go with now-70 to now+30, and if anyone runs into this problem + * lets go with now-70 to now+29, and if anyone runs into this problem * they can learn the hard way not to use 2-digit years, as no choice we * make now will cover all possibilities. mostly this will all be taken * care of in initial parsing, should only be an issue for hand-entered data - * currently (2012) this range is: - * 1942-2041 + * currently (2016) this range is: + * 1946-2045 */ exports.dateTime2ms = function(s) { // first check if s is a date object - try { - if(s.getTime) return +s; - } - catch(e) { - return false; + if(exports.isJSDate(s)) { + s = Number(s); + if(s >= MIN_MS && s <= MAX_MS) return s; + return BADNUM; } + // otherwise only accept strings and numbers + if(typeof s !== 'string' && typeof s !== 'number') return BADNUM; var y, m, d, h; // split date and time parts - var datetime = String(s).split(' '); - if(datetime.length > 2) return false; + // TODO: we strip leading/trailing whitespace but not other + // characters like we do for numbers - do we want to? + var datetime = String(s).trim().split(' '); + if(datetime.length > 2) return BADNUM; var p = datetime[0].split('-'); // date part - if(p.length > 3 || (p.length !== 3 && datetime[1])) return false; + + var CE = true; // common era, ie positive year + if(p[0] === '') { + // first part is blank: year starts with a minus sign + CE = false; + p.splice(0, 1); + } + + var plen = p.length; + if(plen > 3 || (plen !== 3 && datetime[1]) || !plen) return BADNUM; // year if(p[0].length === 4) y = Number(p[0]); else if(p[0].length === 2) { + if(!CE) return BADNUM; var yNow = new Date().getFullYear(); y = ((Number(p[0]) - yNow + 70) % 100 + 200) % 100 + yNow - 70; } - else return false; - if(!isNumeric(y)) return false; - if(p.length === 1) return new Date(y, 0, 1).getTime(); // year only + else return BADNUM; + if(!isNumeric(y)) return BADNUM; + + // javascript takes new Date(0..99,m,d) to mean 1900-1999, so + // to support years 0-99 we need to use setFullYear explicitly + var baseDate = new Date(0, 0, 1); + baseDate.setFullYear(CE ? y : -y); + if(p.length > 1) { + + // month - may be 1 or 2 digits + m = Number(p[1]) - 1; // new Date() uses zero-based months + if(p[1].length > 2 || !(m >= 0 && m <= 11)) return BADNUM; + baseDate.setMonth(m); + + if(p.length > 2) { - // month - m = Number(p[1]) - 1; // new Date() uses zero-based months - if(p[1].length > 2 || !(m >= 0 && m <= 11)) return false; - if(p.length === 2) return new Date(y, m, 1).getTime(); // year-month + // day - may be 1 or 2 digits + d = Number(p[2]); + if(p[2].length > 2 || !(d >= 1 && d <= 31)) return BADNUM; + baseDate.setDate(d); - // day - d = Number(p[2]); - if(p[2].length > 2 || !(d >= 1 && d <= 31)) return false; + // does that date exist in this month? + if(baseDate.getDate() !== d) return BADNUM; - // now save the date part - d = new Date(y, m, d).getTime(); - if(!datetime[1]) return d; // year-month-day - p = datetime[1].split(':'); - if(p.length > 3) return false; + if(datetime[1]) { - // hour - h = Number(p[0]); - if(p[0].length > 2 || !(h >= 0 && h <= 23)) return false; - d += 3600000 * h; - if(p.length === 1) return d; + p = datetime[1].split(':'); + if(p.length > 3) return BADNUM; - // minute - m = Number(p[1]); - if(p[1].length > 2 || !(m >= 0 && m <= 59)) return false; - d += 60000 * m; - if(p.length === 2) return d; + // hour - may be 1 or 2 digits + h = Number(p[0]); + if(p[0].length > 2 || !p[0].length || !(h >= 0 && h <= 23)) return BADNUM; + baseDate.setHours(h); - // second - s = Number(p[2]); - if(!(s >= 0 && s < 60)) return false; - return d + s * 1000; + // does that hour exist in this day? (Daylight time!) + // (TODO: remove this check when we move to UTC) + if(baseDate.getHours() !== h) return BADNUM; + + if(p.length > 1) { + d = baseDate.getTime(); + + // minute - must be 2 digits + m = Number(p[1]); + if(p[1].length !== 2 || !(m >= 0 && m <= 59)) return BADNUM; + d += ONEMIN * m; + if(p.length === 2) return d; + + // second (and milliseconds) - must have 2-digit seconds + if(p[2].split('.')[0].length !== 2) return BADNUM; + s = Number(p[2]); + if(!(s >= 0 && s < 60)) return BADNUM; + return d + s * ONESEC; + } + } + } + } + return baseDate.getTime(); }; +MIN_MS = exports.MIN_MS = exports.dateTime2ms('-9999'); +MAX_MS = exports.MAX_MS = exports.dateTime2ms('9999-12-31 23:59:59.9999'); + // is string s a date? (see above) exports.isDateTime = function(s) { - return (exports.dateTime2ms(s) !== false); + return (exports.dateTime2ms(s) !== BADNUM); }; // pad a number with zeroes, to given # of digits before the decimal point @@ -26769,224 +26708,68 @@ function lpad(val, digits) { } /** - * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.sss - * Crop any trailing zeros in time, but always leave full date - * (we could choose to crop '-01' from date too)... + * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.ssss + * Crop any trailing zeros in time, except never stop right after hours + * (we could choose to crop '-01' from date too but for now we always + * show the whole date) * Optional range r is the data range that applies, also in ms. * If rng is big, the later parts of time will be omitted */ +var NINETYDAYS = 90 * ONEDAY; +var THREEHOURS = 3 * ONEHOUR; +var FIVEMIN = 5 * ONEMIN; exports.ms2DateTime = function(ms, r) { + if(typeof ms !== 'number' || !(ms >= MIN_MS && ms <= MAX_MS)) return BADNUM; + if(!r) r = 0; - var d = new Date(ms), - s = d3.time.format('%Y-%m-%d')(d); - - if(r < 7776000000) { - // <90 days: add hours - s += ' ' + lpad(d.getHours(), 2); - if(r < 432000000) { - // <5 days: add minutes - s += ':' + lpad(d.getMinutes(), 2); - if(r < 10800000) { - // <3 hours: add seconds - s += ':' + lpad(d.getSeconds(), 2); - if(r < 300000) { - // <5 minutes: add ms - s += '.' + lpad(d.getMilliseconds(), 3); + var d = new Date(Math.floor(ms)), + dateStr = d3.time.format('%Y-%m-%d')(d), + // <90 days: add hours and minutes - never *only* add hours + h = (r < NINETYDAYS) ? d.getHours() : 0, + m = (r < NINETYDAYS) ? d.getMinutes() : 0, + // <3 hours: add seconds + s = (r < THREEHOURS) ? d.getSeconds() : 0, + // <5 minutes: add ms (plus one extra digit, this is msec*10) + msec10 = (r < FIVEMIN) ? Math.round((d.getMilliseconds() + (((ms % 1) + 1) % 1)) * 10) : 0; + + // include each part that has nonzero data in or after it + if(h || m || s || msec10) { + dateStr += ' ' + lpad(h, 2) + ':' + lpad(m, 2); + if(s || msec10) { + dateStr += ':' + lpad(s, 2); + if(msec10) { + var digits = 4; + while(msec10 % 10 === 0) { + digits -= 1; + msec10 /= 10; } + dateStr += '.' + lpad(msec10, digits); } } - // strip trailing zeros - return s.replace(/([:\s]00)*\.?[0]*$/, ''); } - return s; + return dateStr; }; -/** - * parseDate: forgiving attempt to turn any date string - * into a javascript date object - * - * first collate all the date formats we want to support, precompiled - * to d3 format objects see below for the string cleaning that happens - * before this separate out 2-digit (y) and 4-digit-year (Y) formats, - * formats with month names (b), and formats with am/pm (I) or no time (D) - * (also includes hour only, as the test is really for a colon) so we can - * cut down the number of tests we need to run for any given string - * (right now all are between 15 and 32 tests) - */ - -// TODO: this is way out of date vs. the server-side version -var timeFormats = { - // 24 hour - H: ['%H:%M:%S~%L', '%H:%M:%S', '%H:%M'], - // with am/pm - I: ['%I:%M:%S~%L%p', '%I:%M:%S%p', '%I:%M%p'], - // no colon, ie only date or date with hour (could also support eg 12h34m?) - D: ['%H', '%I%p', '%Hh'] -}; - -var dateFormats = { - Y: [ - '%Y~%m~%d', - '%Y%m%d', - '%y%m%d', // YYMMDD, has 6 digits together so will match Y, not y - '%m~%d~%Y', // MM/DD/YYYY has first precedence - '%d~%m~%Y' // then DD/MM/YYYY - ], - Yb: [ - '%b~%d~%Y', // eg nov 21 2013 - '%d~%b~%Y', // eg 21 nov 2013 - '%Y~%d~%b', // eg 2013 21 nov (or 2013 q3, after replacement) - '%Y~%b~%d' // eg 2013 nov 21 - ], - /** - * the two-digit year cases have so many potential ambiguities - * it's not even funny, but we'll try them anyway. - */ - y: [ - '%m~%d~%y', - '%d~%m~%y', - '%y~%m~%d' - ], - yb: [ - '%b~%d~%y', - '%d~%b~%y', - '%y~%d~%b', - '%y~%b~%d' - ] -}; - -// use utc formatter since we're ignoring timezone info -var formatter = d3.time.format.utc; - -/** - * ISO8601 and YYYYMMDDHHMMSS are the only ones where date and time - * are not separated by a space, so they get inserted specially here. - * Also a couple formats with no day (so time makes no sense) - */ -var dateTimeFormats = { - Y: { - H: ['%Y~%m~%dT%H:%M:%S', '%Y~%m~%dT%H:%M:%S~%L'].map(formatter), - I: [], - D: ['%Y%m%d%H%M%S', '%Y~%m', '%m~%Y'].map(formatter) - }, - Yb: {H: [], I: [], D: ['%Y~%b', '%b~%Y'].map(formatter)}, - y: {H: [], I: [], D: []}, - yb: {H: [], I: [], D: []} -}; -// all others get inserted in all possible combinations from dateFormats and timeFormats -['Y', 'Yb', 'y', 'yb'].forEach(function(dateType) { - dateFormats[dateType].forEach(function(dateFormat) { - // just a date (don't do just a time) - dateTimeFormats[dateType].D.push(formatter(dateFormat)); - ['H', 'I', 'D'].forEach(function(timeType) { - timeFormats[timeType].forEach(function(timeFormat) { - var a = dateTimeFormats[dateType][timeType]; - - // 'date time', then 'time date' - a.push(formatter(dateFormat + '~' + timeFormat)); - a.push(formatter(timeFormat + '~' + dateFormat)); - }); - }); - }); -}); - -// precompiled regexps for performance -var matchword = /[a-z]*/g, - shortenword = function(m) { return m.substr(0, 3); }, - weekdaymatch = /(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g, - separatormatch = /[\s,\/\-\.\(\)]+/g, - ampmmatch = /~?([ap])~?m(~|$)/, - replaceampm = function(m, ap) { return ap + 'm '; }, - match4Y = /\d\d\d\d/, - matchMonthName = /(^|~)[a-z]{3}/, - matchAMPM = /[ap]m/, - matchcolon = /:/, - matchquarter = /q([1-4])/, - quarters = ['31~mar', '30~jun', '30~sep', '31~dec'], - replacequarter = function(m, n) { return quarters[n - 1]; }, - matchTZ = / ?([+\-]\d\d:?\d\d|Z)$/; - -function getDateType(v) { - var dateType; - dateType = (match4Y.test(v) ? 'Y' : 'y'); - dateType = dateType + (matchMonthName.test(v) ? 'b' : ''); - return dateType; -} - -function getTimeType(v) { - var timeType; - timeType = matchcolon.test(v) ? (matchAMPM.test(v) ? 'I' : 'H') : 'D'; - return timeType; -} - -exports.parseDate = function(v) { - // is it already a date? just return it - if(v.getTime) return v; - /** - * otherwise, if it's not a string, return nothing - * the case of numbers that just have years will get - * dealt with elsewhere. - */ - if(typeof v !== 'string') return false; - - // first clean up the string a bit to reduce the number of formats we have to test - v = v.toLowerCase() - /** - * cut all words down to 3 characters - this will result in - * some spurious matches, ie whenever the first three characters - * of a word match a month or weekday but that seems more likely - * to fix typos than to make dates where they shouldn't be... - * and then we can omit the long form of months from our testing - */ - .replace(matchword, shortenword) - /** - * remove weekday names, as they get overridden anyway if they're - * inconsistent also removes a few more words - * (ie "tuesday the 26th of november") - * TODO: language support? - * for months too, but these seem to be built into d3 - */ - .replace(weekdaymatch, '') - /** - * collapse all separators one ~ at a time, except : which seems - * pretty consistent for the time part use ~ instead of space or - * something since d3 can eat a space as padding on 1-digit numbers - */ - .replace(separatormatch, '~') - // in case of a.m. or p.m. (also take off any space before am/pm) - .replace(ampmmatch, replaceampm) - // turn quarters Q1-4 into dates (quarter ends) - .replace(matchquarter, replacequarter) - .trim() - // also try to ignore timezone info, at least for now - .replace(matchTZ, ''); - - // now test against the various formats that might match - var out = null, - dateType = getDateType(v), - timeType = getTimeType(v), - formatList, - len; - - formatList = dateTimeFormats[dateType][timeType]; - len = formatList.length; - - for(var i = 0; i < len; i++) { - out = formatList[i].parse(v); - if(out) break; +// normalize date format to date string, in case it starts as +// a Date object or milliseconds +// optional dflt is the return value if cleaning fails +exports.cleanDate = function(v, dflt) { + if(exports.isJSDate(v) || typeof v === 'number') { + // NOTE: if someone puts in a year as a number rather than a string, + // this will mistakenly convert it thinking it's milliseconds from 1970 + // that is: '2012' -> Jan. 1, 2012, but 2012 -> 2012 epoch milliseconds + v = exports.ms2DateTime(+v); + if(!v && dflt !== undefined) return dflt; } - - // If not an instance of Date at this point, just return it. - if(!(out instanceof Date)) return false; - // parse() method interprets arguments with local time zone. - var tzoff = out.getTimezoneOffset(); - // In general (default) this is not what we want, so force into UTC: - out.setTime(out.getTime() + tzoff * 60 * 1000); - return out; + else if(!exports.isDateTime(v)) { + logError('unrecognized date', v); + return dflt; + } + return v; }; -},{"d3":8,"fast-isnumeric":11}],113:[function(require,module,exports){ +},{"../constants/numerical":105,"./loggers":123,"d3":8,"fast-isnumeric":11}],114:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27152,7 +26935,7 @@ var Events = { module.exports = Events; -},{"events":10}],114:[function(require,module,exports){ +},{"events":10}],115:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27266,7 +27049,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":120}],115:[function(require,module,exports){ +},{"./is_plain_object.js":122}],116:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27317,7 +27100,38 @@ module.exports = function filterUnique(array) { return out; }; -},{}],116:[function(require,module,exports){ +},{}],117:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +/** Filter out object items with visible !== true + * insider array container. + * + * @param {array of objects} container + * @return {array of objects} of length <= container + * + */ +module.exports = function filterVisible(container) { + var out = []; + + for(var i = 0; i < container.length; i++) { + var item = container[i]; + + if(item.visible === true) out.push(item); + } + + return out; +}; + +},{}],118:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27379,7 +27193,7 @@ function countryNameToISO3(countryName) { return false; } -},{"../lib":118,"country-regex":7}],117:[function(require,module,exports){ +},{"../lib":120,"country-regex":7}],119:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27511,7 +27325,7 @@ exports.makeBlank = function() { }; }; -},{}],118:[function(require,module,exports){ +},{}],120:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -27537,19 +27351,15 @@ lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; lib.validate = coerceModule.validate; -lib.isValObject = coerceModule.isValObject; -lib.crawl = coerceModule.crawl; -lib.findArrayAttributes = coerceModule.findArrayAttributes; -lib.IS_SUBPLOT_OBJ = coerceModule.IS_SUBPLOT_OBJ; -lib.IS_LINKED_TO_ARRAY = coerceModule.IS_LINKED_TO_ARRAY; -lib.DEPRECATED = coerceModule.DEPRECATED; -lib.UNDERSCORE_ATTRS = coerceModule.UNDERSCORE_ATTRS; var datesModule = require('./dates'); lib.dateTime2ms = datesModule.dateTime2ms; lib.isDateTime = datesModule.isDateTime; lib.ms2DateTime = datesModule.ms2DateTime; -lib.parseDate = datesModule.parseDate; +lib.cleanDate = datesModule.cleanDate; +lib.isJSDate = datesModule.isJSDate; +lib.MIN_MS = datesModule.MIN_MS; +lib.MAX_MS = datesModule.MAX_MS; var searchModule = require('./search'); lib.findBin = searchModule.findBin; @@ -27590,6 +27400,10 @@ lib.error = loggersModule.error; lib.notifier = require('./notifier'); lib.filterUnique = require('./filter_unique'); +lib.filterVisible = require('./filter_visible'); + + +lib.cleanNumber = require('./clean_number'); /** * swap x and y of the same attribute in container cont @@ -27766,7 +27580,7 @@ lib.smooth = function(arrayIn, FWHM) { * as long as its returns are not promises (ie have no .then) * includes one argument arg to send to all functions... * this is mainly just to prevent us having to make wrapper functions - * when the only purpose of the wrapper is to reference gd / td + * when the only purpose of the wrapper is to reference gd * and a final step to be executed at the end * TODO: if there's an error and everything is sync, * this doesn't happen yet because we want to make sure @@ -28239,7 +28053,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./coerce":111,"./dates":112,"./extend":114,"./filter_unique":115,"./is_array":119,"./is_plain_object":120,"./loggers":121,"./matrix":122,"./nested_property":123,"./notifier":124,"./search":127,"./stats":129,"d3":8}],119:[function(require,module,exports){ +},{"./clean_number":111,"./coerce":112,"./dates":113,"./extend":115,"./filter_unique":116,"./filter_visible":117,"./is_array":121,"./is_plain_object":122,"./loggers":123,"./matrix":124,"./nested_property":125,"./notifier":126,"./search":129,"./stats":131,"d3":8}],121:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28257,7 +28071,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ArrayBuffer.isView(a); }; -},{}],120:[function(require,module,exports){ +},{}],122:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28286,7 +28100,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],121:[function(require,module,exports){ +},{}],123:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28353,7 +28167,7 @@ loggers.error = function() { } }; -},{"../plot_api/plot_config":134}],122:[function(require,module,exports){ +},{"../plot_api/plot_config":136}],124:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28463,7 +28277,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],123:[function(require,module,exports){ +},{}],125:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28720,7 +28534,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./is_array":119,"fast-isnumeric":11}],124:[function(require,module,exports){ +},{"./is_array":121,"fast-isnumeric":11}],126:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -28797,7 +28611,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":8,"fast-isnumeric":11}],125:[function(require,module,exports){ +},{"d3":8,"fast-isnumeric":11}],127:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -29037,7 +28851,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"./matrix":122}],126:[function(require,module,exports){ +},{"./matrix":124}],128:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -29248,7 +29062,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":118,"../plot_api/plot_config":134}],127:[function(require,module,exports){ +},{"../lib":120,"../plot_api/plot_config":136}],129:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -29359,7 +29173,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":121,"fast-isnumeric":11}],128:[function(require,module,exports){ +},{"./loggers":123,"fast-isnumeric":11}],130:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -29382,7 +29196,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],129:[function(require,module,exports){ +},{}],131:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -29478,7 +29292,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":11}],130:[function(require,module,exports){ +},{"fast-isnumeric":11}],132:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -29592,8 +29406,8 @@ exports.convertToTspans = function(_context, _callback) { } if(tex) { - var td = Lib.getPlotDiv(that.node()); - ((td && td._promises) || []).push(new Promise(function(resolve) { + var gd = Lib.getPlotDiv(that.node()); + ((gd && gd._promises) || []).push(new Promise(function(resolve) { that.style({visibility: 'hidden'}); var config = {fontSize: parseInt(that.style('font-size'), 10)}; @@ -30005,7 +29819,7 @@ exports.makeEditable = function(context, _delegate, options) { return d3.rebind(this, dispatch, 'on'); }; -},{"../constants/string_mappings":106,"../constants/xmlns_namespaces":107,"../lib":118,"d3":8}],131:[function(require,module,exports){ +},{"../constants/string_mappings":106,"../constants/xmlns_namespaces":107,"../lib":120,"d3":8}],133:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -30019,8 +29833,8 @@ exports.makeEditable = function(context, _delegate, options) { var topojsonUtils = module.exports = {}; -var locationmodeToLayer = require('../plots/geo/constants').locationmodeToLayer, - topojsonFeature = require('topojson').feature; +var locationmodeToLayer = require('../plots/geo/constants').locationmodeToLayer; +var topojsonFeature = require('topojson-client').feature; topojsonUtils.getTopojsonName = function(geoLayout) { @@ -30041,7 +29855,7 @@ topojsonUtils.getTopojsonFeatures = function(trace, topojson) { return topojsonFeature(topojson, obj).features; }; -},{"../plots/geo/constants":168,"topojson":15}],132:[function(require,module,exports){ +},{"../plots/geo/constants":170,"topojson-client":15}],134:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -30146,13 +29960,12 @@ exports.cleanLayout = function(layout) { } } - if(layout.annotations !== undefined && !Array.isArray(layout.annotations)) { - Lib.warn('Annotations must be an array.'); - delete layout.annotations; - } - var annotationsLen = (layout.annotations || []).length; + var annotationsLen = Array.isArray(layout.annotations) ? layout.annotations.length : 0; for(i = 0; i < annotationsLen; i++) { var ann = layout.annotations[i]; + + if(!Lib.isPlainObject(ann)) continue; + if(ann.ref) { if(ann.ref === 'paper') { ann.xref = 'paper'; @@ -30164,17 +29977,17 @@ exports.cleanLayout = function(layout) { } delete ann.ref; } + cleanAxRef(ann, 'xref'); cleanAxRef(ann, 'yref'); } - if(layout.shapes !== undefined && !Array.isArray(layout.shapes)) { - Lib.warn('Shapes must be an array.'); - delete layout.shapes; - } - var shapesLen = (layout.shapes || []).length; + var shapesLen = Array.isArray(layout.shapes) ? layout.shapes.length : 0; for(i = 0; i < shapesLen; i++) { var shape = layout.shapes[i]; + + if(!Lib.isPlainObject(shape)) continue; + cleanAxRef(shape, 'xref'); cleanAxRef(shape, 'yref'); } @@ -30523,7 +30336,7 @@ exports.manageArrayContainers = function(np, newVal, undoit) { } }; -},{"../components/color":25,"../lib":118,"../plots/cartesian/axes":145,"../plots/plots":182,"../registry":190,"fast-isnumeric":11,"gl-mat4/fromQuat":12}],133:[function(require,module,exports){ +},{"../components/color":25,"../lib":120,"../plots/cartesian/axes":148,"../plots/plots":184,"../registry":192,"fast-isnumeric":11,"gl-mat4/fromQuat":12}],135:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -32443,13 +32256,14 @@ function _relayout(gd, aobj) { objList = layout[objType] || [], obji = objList[objNum] || {}; - // new API, remove annotation / shape with `null` - if(vi === null) aobj[ai] = 'remove'; - // if p.parts is just an annotation number, and val is either // 'add' or an entire annotation to add, the undo is 'remove' // if val is 'remove' then undo is the whole annotation object if(p.parts.length === 2) { + + // new API, remove annotation / shape with `null` + if(vi === null) aobj[ai] = 'remove'; + if(aobj[ai] === 'add' || Lib.isPlainObject(aobj[ai])) { undoit[ai] = 'remove'; } @@ -32484,6 +32298,7 @@ function _relayout(gd, aobj) { } // alter gd.layout else { + var pp1 = String(p.parts[1] || ''); // check whether we can short-circuit a full redraw // 3d or geo at this point just needs to redraw. if(p.parts[0].indexOf('scene') === 0) flags.doplot = true; @@ -32498,17 +32313,17 @@ function _relayout(gd, aobj) { else if(ai.indexOf('title') !== -1) flags.doticks = true; else if(p.parts[0].indexOf('bgcolor') !== -1) flags.dolayoutstyle = true; else if(p.parts.length > 1 && - Lib.containsAny(p.parts[1], ['tick', 'exponent', 'grid', 'zeroline'])) { + Lib.containsAny(pp1, ['tick', 'exponent', 'grid', 'zeroline'])) { flags.doticks = true; } else if(ai.indexOf('.linewidth') !== -1 && ai.indexOf('axis') !== -1) { flags.doticks = flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1].indexOf('line') !== -1) { + else if(p.parts.length > 1 && pp1.indexOf('line') !== -1) { flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1] === 'mirror') { + else if(p.parts.length > 1 && pp1 === 'mirror') { flags.doticks = flags.dolayoutstyle = true; } else if(ai === 'margin.pad') { @@ -32530,7 +32345,7 @@ function _relayout(gd, aobj) { */ else if(['hovermode', 'dragmode'].indexOf(ai) !== -1) flags.domodebar = true; else if(['hovermode', 'dragmode', 'height', - 'width', 'autosize'].indexOf(ai) === -1) { + 'width', 'autosize'].indexOf(ai) === -1) { flags.doplot = true; } @@ -32739,6 +32554,20 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } } + // Execute a callback after the wrapper function has been called n times. + // This is used to defer the resolution until a transition has resovled *and* + // the frame has completed. If it's not done this way, then we get a race + // condition in which the animation might resolve before a transition is complete + // or vice versa. + function callbackOnNthTime(cb, n) { + var cnt = 0; + return function() { + if(cb && ++cnt === n) { + return cb(); + } + }; + } + return new Promise(function(resolve, reject) { function discardExistingFrames() { if(trans._frameQueue.length === 0) { @@ -32783,14 +32612,13 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { frameOpts: frameOpts, transitionOpts: transitionOpts, }; - if(i === frameList.length - 1) { // The last frame in this .animate call stores the promise resolve // and reject callbacks. This is how we ensure that the animation // loop (which may exist as a result of a *different* .animate call) // still resolves or rejecdts this .animate call's promise. once it's // complete. - nextFrame.onComplete = resolve; + nextFrame.onComplete = callbackOnNthTime(resolve, 2); nextFrame.onInterrupt = reject; } @@ -32828,7 +32656,6 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { // Execute the callback and unset it to ensure it doesn't // accidentally get called twice trans._currentFrame.onComplete(); - trans._currentFrame.onComplete = null; } var newFrame = trans._currentFrame = trans._frameQueue.shift(); @@ -32848,7 +32675,12 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { helpers.coerceTraceIndices(gd, newFrame.frame.traces), newFrame.frameOpts, newFrame.transitionOpts - ); + ).then(function() { + if(newFrame.onComplete) { + newFrame.onComplete(); + } + + }); gd.emit('plotly_animatingframe', { name: newFrame.name, @@ -32924,6 +32756,8 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { for(i = 0; i < trans._frames.length; i++) { frame = trans._frames[i]; + if(!frame) continue; + if(allFrames || frame.group === frameOrGroupNameOrFrameList) { frameList.push({ type: 'byname', @@ -32935,14 +32769,15 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } else if(isFrameArray) { for(i = 0; i < frameOrGroupNameOrFrameList.length; i++) { var frameOrName = frameOrGroupNameOrFrameList[i]; - if(typeof frameOrName === 'string') { + if(['number', 'string'].indexOf(typeof frameOrName) !== -1) { + frameOrName = String(frameOrName); // In this case, there's an array and this frame is a string name: frameList.push({ type: 'byname', name: frameOrName, data: setTransitionConfig({name: frameOrName}) }); - } else { + } else if(Lib.isPlainObject(frameOrName)) { frameList.push({ type: 'object', data: setTransitionConfig(Lib.extendFlat({}, frameOrName)) @@ -33086,7 +32921,7 @@ Plotly.addFrames = function(gd, frameList, indices) { if(_hash[frame.name]) { // If frame is present, overwrite its definition: for(j = 0; j < _frames.length; j++) { - if(_frames[j].name === frame.name) break; + if((_frames[j] || {}).name === frame.name) break; } ops.push({type: 'replace', index: j, value: frame}); revops.unshift({type: 'replace', index: j, value: _frames[j]}); @@ -33286,7 +33121,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":49,"../components/errorbars":55,"../constants/xmlns_namespaces":107,"../lib":118,"../lib/events":113,"../lib/queue":126,"../lib/svg_text_utils":130,"../plotly":141,"../plots/cartesian/graph_interact":153,"../plots/plots":182,"../plots/polar":185,"../registry":190,"./helpers":132,"./subroutines":138,"d3":8,"fast-isnumeric":11}],134:[function(require,module,exports){ +},{"../components/drawing":48,"../components/errorbars":54,"../constants/xmlns_namespaces":107,"../lib":120,"../lib/events":114,"../lib/queue":128,"../lib/svg_text_utils":132,"../plotly":143,"../plots/cartesian/graph_interact":155,"../plots/plots":184,"../plots/polar":187,"../registry":192,"./helpers":134,"./subroutines":140,"d3":8,"fast-isnumeric":11}],136:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33406,7 +33241,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],135:[function(require,module,exports){ +},{}],137:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33418,185 +33253,287 @@ function defaultSetBackground(gd, bgColor) { 'use strict'; -var Plotly = require('../plotly'); var Registry = require('../registry'); -var Plots = require('../plots/plots'); var Lib = require('../lib'); -// FIXME polar attribute are not part of Plotly yet +var baseAttributes = require('../plots/attributes'); +var baseLayoutAttributes = require('../plots/layout_attributes'); +var frameAttributes = require('../plots/frame_attributes'); +var animationAttributes = require('../plots/animation_attributes'); + +// polar attributes are not part of the Registry yet var polarAreaAttrs = require('../plots/polar/area_attributes'); var polarAxisAttrs = require('../plots/polar/axis_attributes'); var extendFlat = Lib.extendFlat; var extendDeep = Lib.extendDeep; -var extendDeepAll = Lib.extendDeepAll; -var NESTED_MODULE = '_nestedModules', - COMPOSED_MODULE = '_composedModules'; +var IS_SUBPLOT_OBJ = '_isSubplotObj'; +var IS_LINKED_TO_ARRAY = '_isLinkedToArray'; +var DEPRECATED = '_deprecated'; +var UNDERSCORE_ATTRS = [IS_SUBPLOT_OBJ, IS_LINKED_TO_ARRAY, DEPRECATED]; -var plotSchema = { - traces: {}, - layout: {}, - transforms: {}, - defs: {} -}; +exports.IS_SUBPLOT_OBJ = IS_SUBPLOT_OBJ; +exports.IS_LINKED_TO_ARRAY = IS_LINKED_TO_ARRAY; +exports.DEPRECATED = DEPRECATED; +exports.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS; +/** Outputs the full plotly.js plot schema + * + * @return {object} + * - defs + * - traces + * - layout + * - transforms + * - frames + * - animations + * - config (coming soon ...) + */ +exports.get = function() { + var traces = {}; -var PlotSchema = module.exports = {}; + Registry.allTypes.concat('area').forEach(function(type) { + traces[type] = getTraceAttributes(type); + }); + var transforms = {}; -PlotSchema.get = function() { - Registry.allTypes - .concat('area') // FIXME polar 'area' attributes - .forEach(getTraceAttributes); + Object.keys(Registry.transformsRegistry).forEach(function(type) { + transforms[type] = getTransformAttributes(type); + }); - getLayoutAttributes(); + return { + defs: { + valObjects: Lib.valObjects, + metaKeys: UNDERSCORE_ATTRS.concat['description', 'role'] + }, - Object.keys(Registry.transformsRegistry).forEach(getTransformAttributes); + traces: traces, + layout: getLayoutAttributes(), - getDefs(); + transforms: transforms, - return plotSchema; + frames: formatAttributes(frameAttributes), + animation: formatAttributes(animationAttributes) + }; }; -PlotSchema.crawl = Lib.crawl; +/** + * Crawl the attribute tree, recursively calling a callback function + * + * @param {object} attrs + * The node of the attribute tree (e.g. the root) from which recursion originates + * @param {Function} callback + * A callback function with the signature: + * @callback callback + * @param {object} attr an attribute + * @param {String} attrName name string + * @param {object[]} attrs all the attributes + * @param {Number} level the recursion level, 0 at the root + * @param {Number} [specifiedLevel] + * The level in the tree, in order to let the callback function detect descend or backtrack, + * typically unsupplied (implied 0), just used by the self-recursive call. + * The necessity arises because the tree traversal is not controlled by callback return values. + * The decision to not use callback return values for controlling tree pruning arose from + * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions + * precedes the callback call. + * + * @return {object} transformOut + * copy of transformIn that contains attribute defaults + */ +exports.crawl = function(attrs, callback, specifiedLevel) { + var level = specifiedLevel || 0; -PlotSchema.isValObject = Lib.isValObject; + Object.keys(attrs).forEach(function(attrName) { + var attr = attrs[attrName]; -function getTraceAttributes(type) { - var globalAttributes = Plots.attributes, - _module = getModule({type: type}), - meta = getMeta(type), - subplotRegistry = getSubplotRegistry(type); + if(UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - var attributes = {}, - layoutAttributes = {}; + callback(attr, attrName, attrs, level); - // make 'type' the first attribute in the object - attributes.type = null; + if(exports.isValObject(attr)) return; - // global attributes (same for all trace types) - extendDeep(attributes, globalAttributes); + if(Lib.isPlainObject(attr)) exports.crawl(attr, callback, level + 1); + }); +}; - // module attributes (+ nested + composed) - attributes = coupleAttrs( - _module.attributes, attributes, 'attributes', type - ); +/** Is object a value object (or a container object)? + * + * @param {object} obj + * @return {boolean} + * returns true for a valid value object and + * false for tree nodes in the attribute hierarchy + */ +exports.isValObject = function(obj) { + return obj && obj.valType !== undefined; +}; - // subplot attributes - if(subplotRegistry.attributes !== undefined) { - extendDeep(attributes, subplotRegistry.attributes); +/** + * Find all data array attributes in a given trace object - including + * `arrayOk` attributes. + * + * @param {object} trace + * full trace object that contains a reference to `_module.attributes` + * + * @return {array} arrayAttributes + * list of array attributes for the given trace + */ +exports.findArrayAttributes = function(trace) { + var arrayAttributes = [], + stack = []; + + function callback(attr, attrName, attrs, level) { + stack = stack.slice(0, level).concat([attrName]); + + var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; + if(!splittableAttr) return; + + var astr = toAttrString(stack); + var val = Lib.nestedProperty(trace, astr).get(); + if(!Array.isArray(val)) return; + + arrayAttributes.push(astr); } - // 'type' gets overwritten by globalAttributes; reset it here - attributes.type = type; + function toAttrString(stack) { + return stack.join('.'); + } - attributes = removeUnderscoreAttrs(attributes); - mergeValTypeAndRole(attributes); - plotSchema.traces[type] = extendFlat({}, - meta, - { attributes: attributes } - ); + exports.crawl(trace._module.attributes, callback); - // trace-specific layout attributes - if(_module.layoutAttributes !== undefined) { - layoutAttributes = coupleAttrs( - _module.layoutAttributes, layoutAttributes, 'layoutAttributes', type - ); + if(trace.transforms) { + var transforms = trace.transforms; - mergeValTypeAndRole(layoutAttributes); - plotSchema.traces[type].layoutAttributes = layoutAttributes; + for(var i = 0; i < transforms.length; i++) { + var transform = transforms[i]; + + stack = ['transforms[' + i + ']']; + exports.crawl(transform._module.attributes, callback, 1); + } } -} -function getLayoutAttributes() { - var globalLayoutAttributes = Plots.layoutAttributes, - layoutAttributes = {}; + // Look into the fullInput module attributes for array attributes + // to make sure that 'custom' array attributes are detected. + // + // At the moment, we need this block to make sure that + // ohlc and candlestick 'open', 'high', 'low', 'close' can be + // used with filter ang groupby transforms. + if(trace._fullInput) { + exports.crawl(trace._fullInput._module.attributes, callback); - // layout module attributes (+ nested + composed) - layoutAttributes = coupleAttrs( - globalLayoutAttributes, layoutAttributes, 'layoutAttributes', '*' - ); + arrayAttributes = Lib.filterUnique(arrayAttributes); + } - // FIXME polar layout attributes - layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); + return arrayAttributes; +}; - // add crawler.IS_SUBPLOT_OBJ attribute - layoutAttributes = handleSubplotObjs(layoutAttributes); +function getTraceAttributes(type) { + var _module, basePlotModule; - layoutAttributes = removeUnderscoreAttrs(layoutAttributes); - mergeValTypeAndRole(layoutAttributes); + if(type === 'area') { + _module = { attributes: polarAreaAttrs }; + basePlotModule = {}; + } + else { + _module = Registry.modules[type]._module, + basePlotModule = _module.basePlotModule; + } - // generate crawler.IS_LINKED_TO_ARRAY structure - handleLinkedToArray(layoutAttributes); + var attributes = {}; - plotSchema.layout = { layoutAttributes: layoutAttributes }; -} + // make 'type' the first attribute in the object + attributes.type = null; -function getTransformAttributes(name) { - var _module = Registry.transformsRegistry[name], - _schema = {}; + // base attributes (same for all trace types) + extendDeep(attributes, baseAttributes); - _schema = coupleAttrs(_schema, _module.attributes || {}, 'attributes', '*'); - _schema = removeUnderscoreAttrs(_schema); - mergeValTypeAndRole(_schema); - handleLinkedToArray(_schema); + // module attributes + extendDeep(attributes, _module.attributes); - plotSchema.transforms[name] = { attributes: _schema }; -} + // subplot attributes + if(basePlotModule.attributes) { + extendDeep(attributes, basePlotModule.attributes); + } -function getDefs() { - plotSchema.defs = { - valObjects: Lib.valObjects, - metaKeys: Lib.UNDERSCORE_ATTRS.concat(['description', 'role']) + // 'type' gets overwritten by baseAttributes; reset it here + attributes.type = type; + + var out = { + meta: _module.meta || {}, + attributes: formatAttributes(attributes), }; + + // trace-specific layout attributes + if(_module.layoutAttributes) { + var layoutAttributes = {}; + + extendDeep(layoutAttributes, _module.layoutAttributes); + out.layoutAttributes = formatAttributes(layoutAttributes); + } + + return out; } -function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) { - var nestedModule, nestedAttrs, nestedReference, - composedModule, composedAttrs; +function getLayoutAttributes() { + var layoutAttributes = {}; - Object.keys(attrsIn).forEach(function(k) { + // global layout attributes + extendDeep(layoutAttributes, baseLayoutAttributes); - if(k === NESTED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - nestedModule = getModule({_module: attrsIn[k][kk]}); - if(nestedModule === undefined) return; + // add base plot module layout attributes + Object.keys(Registry.subplotsRegistry).forEach(function(k) { + var _module = Registry.subplotsRegistry[k]; - nestedAttrs = nestedModule[whichAttrs]; - nestedReference = coupleAttrs( - nestedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - Lib.nestedProperty(attrsOut, kk) - .set(extendDeep({}, nestedReference)); - }); - return; + if(_module.name === 'cartesian') { + handleBasePlotModule(layoutAttributes, _module, 'xaxis'); + handleBasePlotModule(layoutAttributes, _module, 'yaxis'); + } + else { + var astr = _module.attr === 'subplot' ? _module.name : _module.attr; + + handleBasePlotModule(layoutAttributes, _module, astr); } + }); - if(k === COMPOSED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - if(kk !== type) return; + // polar layout attributes + layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); - composedModule = getModule({_module: attrsIn[k][kk]}); - if(composedModule === undefined) return; + // add registered components layout attribute + Object.keys(Registry.componentsRegistry).forEach(function(k) { + var _module = Registry.componentsRegistry[k]; - composedAttrs = composedModule[whichAttrs]; - composedAttrs = coupleAttrs( - composedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - extendDeepAll(attrsOut, composedAttrs); + if(Array.isArray(_module.layoutNodes)) { + _module.layoutNodes.forEach(function(v) { + handleRegisteredComponent(layoutAttributes, _module, v + _module.name); }); - return; } - - attrsOut[k] = Lib.isPlainObject(attrsIn[k]) ? - extendDeepAll({}, attrsIn[k]) : - attrsIn[k]; + else { + handleRegisteredComponent(layoutAttributes, _module, _module.name); + } }); - return attrsOut; + return { + layoutAttributes: formatAttributes(layoutAttributes) + }; +} + +function getTransformAttributes(type) { + var _module = Registry.transformsRegistry[type]; + + return { + attributes: formatAttributes(_module.attributes) + }; +} + +function formatAttributes(attrs) { + mergeValTypeAndRole(attrs); + formatArrayContainers(attrs); + + return attrs; } function mergeValTypeAndRole(attrs) { @@ -33610,7 +33547,7 @@ function mergeValTypeAndRole(attrs) { } function callback(attr, attrName, attrs) { - if(PlotSchema.isValObject(attr)) { + if(exports.isValObject(attr)) { if(attr.valType === 'data_array') { // all 'data_array' attrs have role 'data' attr.role = 'data'; @@ -33628,40 +33565,26 @@ function mergeValTypeAndRole(attrs) { } } - Lib.crawl(attrs, callback); + exports.crawl(attrs, callback); } -// helper methods +function formatArrayContainers(attrs) { -function getModule(arg) { - if('type' in arg) { - return (arg.type === 'area') ? // FIXME - { attributes: polarAreaAttrs } : - Registry.getModule({type: arg.type}); - } + function callback(attr, attrName, attrs) { + if(!attr) return; - var subplotsRegistry = Registry.subplotsRegistry, - componentsRegistry = Registry.componentsRegistry, - _module = arg._module; + var itemName = attr[IS_LINKED_TO_ARRAY]; - if(subplotsRegistry[_module]) return subplotsRegistry[_module]; - else if(componentsRegistry[_module]) return componentsRegistry[_module]; + if(!itemName) return; - // look it internal Plotly if all previous attempts fail - return Plotly[_module]; -} + delete attr[IS_LINKED_TO_ARRAY]; -function removeUnderscoreAttrs(attributes) { - Object.keys(attributes).forEach(function(k) { - if(k.charAt(0) === '_' && - Lib.UNDERSCORE_ATTRS.indexOf(k) === -1) delete attributes[k]; - }); - return attributes; -} + attrs[attrName] = { items: {} }; + attrs[attrName].items[itemName] = attr; + attrs[attrName].role = 'object'; + } -function getMeta(type) { - if(type === 'area') return {}; // FIXME - return Registry.modules[type].meta || {}; + exports.crawl(attrs, callback); } function assignPolarLayoutAttrs(layoutAttributes) { @@ -33672,68 +33595,25 @@ function assignPolarLayoutAttrs(layoutAttributes) { extendFlat(layoutAttributes, polarAxisAttrs.layout); - return layoutAttributes; // FIXME -} - -function getSubplotRegistry(traceType) { - if(traceType === 'area') return {}; // FIXME - - var subplotsRegistry = Registry.subplotsRegistry, - subplotType = Object.keys(subplotsRegistry).filter(function(subplotType) { - return Registry.traceIs({type: traceType}, subplotType); - })[0]; - - if(subplotType === undefined) return {}; - - return subplotsRegistry[subplotType]; -} - -function handleSubplotObjs(layoutAttributes) { - var subplotsRegistry = Registry.subplotsRegistry; - - Object.keys(layoutAttributes).forEach(function(k) { - Object.keys(subplotsRegistry).forEach(function(subplotType) { - var subplotRegistry = subplotsRegistry[subplotType], - isSubplotObj; - - if(!subplotRegistry.attrRegex) return; - - if(subplotType === 'cartesian' || subplotType === 'gl2d') { - isSubplotObj = ( - subplotRegistry.attrRegex.x.test(k) || - subplotRegistry.attrRegex.y.test(k) - ); - } - else { - isSubplotObj = subplotRegistry.attrRegex.test(k); - } - - if(isSubplotObj) layoutAttributes[k][Lib.IS_SUBPLOT_OBJ] = true; - }); - }); - return layoutAttributes; } -function handleLinkedToArray(layoutAttributes) { - - function callback(attr, attrName, attrs) { - if(attr[Lib.IS_LINKED_TO_ARRAY] !== true) return; - - // TODO more robust logic - var itemName = attrName.substr(0, attrName.length - 1); +function handleBasePlotModule(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep({}, _module.layoutAttributes); - delete attr[Lib.IS_LINKED_TO_ARRAY]; + attrs[IS_SUBPLOT_OBJ] = true; + np.set(attrs); +} - attrs[attrName] = { items: {} }; - attrs[attrName].items[itemName] = attr; - attrs[attrName].role = 'object'; - } +function handleRegisteredComponent(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep(np.get() || {}, _module.layoutAttributes); - Lib.crawl(layoutAttributes, callback); + np.set(attrs); } -},{"../lib":118,"../plotly":141,"../plots/plots":182,"../plots/polar/area_attributes":183,"../plots/polar/axis_attributes":184,"../registry":190}],136:[function(require,module,exports){ +},{"../lib":120,"../plots/animation_attributes":144,"../plots/attributes":146,"../plots/frame_attributes":169,"../plots/layout_attributes":182,"../plots/polar/area_attributes":185,"../plots/polar/axis_attributes":186,"../registry":192}],138:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33825,10 +33705,14 @@ function registerTransformModule(newModule) { } function registerComponentModule(newModule) { - Registry.componentsRegistry[newModule.name] = newModule; + if(typeof newModule.name !== 'string') { + throw new Error('Component module *name* must be a string.'); + } + + Registry.registerComponent(newModule); } -},{"../lib":118,"../registry":190}],137:[function(require,module,exports){ +},{"../lib":120,"../registry":192}],139:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -33854,7 +33738,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":118,"../plotly":141}],138:[function(require,module,exports){ +},{"../lib":120,"../plotly":143}],140:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -34176,7 +34060,7 @@ exports.doModeBar = function(gd) { return Plots.previousPromises(gd); }; -},{"../components/color":25,"../components/drawing":49,"../components/modebar":72,"../components/titles":100,"../lib":118,"../plotly":141,"../plots/plots":182,"../registry":190}],139:[function(require,module,exports){ +},{"../components/color":25,"../components/drawing":48,"../components/modebar":71,"../components/titles":99,"../lib":120,"../plotly":143,"../plots/plots":184,"../registry":192}],141:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -34231,7 +34115,7 @@ function toImage(gd, opts) { // first clone the GD so we can operate in a clean environment var clone = clonePlot(gd, {format: 'png', height: opts.height, width: opts.width}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -34286,7 +34170,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":118,"../plotly":141,"../snapshot/cloneplot":191,"../snapshot/helpers":194,"../snapshot/svgtoimg":196,"../snapshot/tosvg":198,"fast-isnumeric":11}],140:[function(require,module,exports){ +},{"../lib":120,"../plotly":143,"../snapshot/cloneplot":193,"../snapshot/helpers":196,"../snapshot/svgtoimg":198,"../snapshot/tosvg":200,"fast-isnumeric":11}],142:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -34462,7 +34346,8 @@ function crawl(objIn, objOut, schema, list, base, path) { crawl(valIn, valOut, nestedSchema, list, base, p); } else if(nestedSchema.items && !isInfoArray && isArray(valIn)) { - var itemName = k.substr(0, k.length - 1), + var items = nestedSchema.items, + _nestedSchema = items[Object.keys(items)[0]], indexList = []; var j, _p; @@ -34470,8 +34355,7 @@ function crawl(objIn, objOut, schema, list, base, path) { // loop over valOut items while keeping track of their // corresponding input container index (given by _index) for(j = 0; j < valOut.length; j++) { - var _nestedSchema = nestedSchema.items[itemName], - _index = valOut[j]._index || j; + var _index = valOut[j]._index || j; _p = p.slice(); _p.push(_index); @@ -34656,7 +34540,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":118,"../plots/plots":182,"./plot_schema":135}],141:[function(require,module,exports){ +},{"../lib":120,"../plots/plots":184,"./plot_schema":137}],143:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -34684,25 +34568,12 @@ exports.defaultConfig = require('./plot_api/plot_config'); exports.Plots = require('./plots/plots'); exports.Axes = require('./plots/cartesian/axes'); exports.Fx = require('./plots/cartesian/graph_interact'); - -// components -exports.Color = require('./components/color'); -exports.Drawing = require('./components/drawing'); -exports.Colorscale = require('./components/colorscale'); -exports.Colorbar = require('./components/colorbar'); -exports.ErrorBars = require('./components/errorbars'); -exports.Annotations = require('./components/annotations'); -exports.Shapes = require('./components/shapes'); -exports.Legend = require('./components/legend'); -exports.Images = require('./components/images'); -exports.UpdateMenus = require('./components/updatemenus'); -exports.Sliders = require('./components/sliders'); exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/annotations":23,"./components/color":25,"./components/colorbar":30,"./components/colorscale":40,"./components/drawing":49,"./components/errorbars":55,"./components/images":61,"./components/legend":69,"./components/modebar":72,"./components/shapes":93,"./components/sliders":99,"./components/updatemenus":105,"./plot_api/plot_api":133,"./plot_api/plot_config":134,"./plots/cartesian/axes":145,"./plots/cartesian/graph_interact":153,"./plots/plots":182}],142:[function(require,module,exports){ +},{"./components/modebar":71,"./plot_api/plot_api":135,"./plot_api/plot_config":136,"./plots/cartesian/axes":148,"./plots/cartesian/graph_interact":155,"./plots/plots":184}],144:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -34804,7 +34675,76 @@ module.exports = { } }; -},{}],143:[function(require,module,exports){ +},{}],145:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var Lib = require('../lib'); + + +/** Convenience wrapper for making array container logic DRY and consistent + * + * @param {object} parentObjIn + * user input object where the container in question is linked + * (i.e. either a user trace object or the user layout object) + * + * @param {object} parentObjOut + * full object where the coerced container will be linked + * (i.e. either a full trace object or the full layout object) + * + * @param {object} opts + * options object: + * - name {string} + * name of the key linking the container in question + * - handleItemDefaults {function} + * defaults method to be called on each item in the array container in question + * + * Its arguments are: + * - itemIn {object} item in user layout + * - itemOut {object} item in full layout + * - parentObj {object} (as in closure) + * - opts {object} (as in closure) + * - itemOpts {object} + * - itemIsNotPlainObject {boolean} + * N.B. + * + * - opts is passed to handleItemDefaults so it can also store + * links to supplementary data (e.g. fullData for layout components) + * + */ +module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut, opts) { + var name = opts.name; + + var contIn = Array.isArray(parentObjIn[name]) ? parentObjIn[name] : [], + contOut = parentObjOut[name] = []; + + for(var i = 0; i < contIn.length; i++) { + var itemIn = contIn[i], + itemOut = {}, + itemOpts = {}; + + if(!Lib.isPlainObject(itemIn)) { + itemOpts.itemIsNotPlainObject = true; + itemIn = {}; + } + + opts.handleItemDefaults(itemIn, itemOut, parentObjOut, opts, itemOpts); + + itemOut._input = itemIn; + itemOut._index = i; + + contOut.push(itemOut); + } +}; + +},{"../lib":120}],146:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -34887,7 +34827,7 @@ module.exports = { } }; -},{}],144:[function(require,module,exports){ +},{}],147:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -34914,7 +34854,7 @@ module.exports = { } }; -},{}],145:[function(require,module,exports){ +},{}],148:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -34936,6 +34876,15 @@ var Titles = require('../../components/titles'); var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); +var constants = require('../../constants/numerical'); +var FP_SAFE = constants.FP_SAFE; +var ONEAVGYEAR = constants.ONEAVGYEAR; +var ONEAVGMONTH = constants.ONEAVGMONTH; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + var axes = module.exports = {}; @@ -34953,43 +34902,88 @@ axes.getFromId = axisIds.getFromId; axes.getFromTrace = axisIds.getFromTrace; -// find the list of possible axes to reference with an xref or yref attribute -// and coerce it to that list -axes.coerceRef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = axLetter + 'ref', +/* + * find the list of possible axes to reference with an xref or yref attribute + * and coerce it to that list + * + * attr: the attribute we're generating a reference for. Should end in 'x' or 'y' + * but can be prefixed, like 'ax' for annotation's arrow x + * dflt: the default to coerce to, or blank to use the first axis (falling back on + * extraOption if there is no axis) + * extraOption: aside from existing axes with this letter, what non-axis value is allowed? + * Only required if it's different from `dflt` + */ +axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption) { + var axLetter = attr.charAt(attr.length - 1), + axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), + refAttr = attr + 'ref', attrDef = {}; + if(!dflt) dflt = axlist[0] || extraOption; + if(!extraOption) extraOption = dflt; + // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(['paper']), - dflt: dflt || axlist[0] || 'paper' + values: axlist.concat(extraOption ? [extraOption] : []), + dflt: dflt }; // xref, yref return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; -// todo: duplicated per github PR 610. Should be consolidated with axes.coerceRef. -// find the list of possible axes to reference with an axref or ayref attribute -// and coerce it to that list -axes.coerceARef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = 'a' + axLetter + 'ref', - attrDef = {}; +/* + * coerce position attributes (range-type) that can be either on axes or absolute + * (paper or pixel) referenced. The biggest complication here is that we don't know + * before looking at the axis whether the value must be a number or not (it may be + * a date string), so we can't use the regular valType='number' machinery + * + * axRef (string): the axis this position is referenced to, or: + * paper: fraction of the plot area + * pixel: pixels relative to some starting position + * attr (string): the attribute in containerOut we are coercing + * dflt (number): the default position, as a fraction or pixels. If the attribute + * is to be axis-referenced, this will be converted to an axis data value + * + * Also cleans the values, since the attribute definition itself has to say + * valType: 'any' to handle date axes. This allows us to accept: + * - for category axes: category names, and convert them here into serial numbers. + * Note that this will NOT work for axis range endpoints, because we don't know + * the category list yet (it's set by ax.makeCalcdata during calc) + * but it works for component (note, shape, images) positions. + * - for date axes: JS Dates or milliseconds, and convert to date strings + * - for other types: coerce them to numbers + */ +axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { + var pos, + newPos; - // data-ref annotations are not supported in gl2d yet + if(axRef === 'paper' || axRef === 'pixel') { + pos = coerce(attr, dflt); + } + else { + var ax = axes.getFromId(gd, axRef); - attrDef[refAttr] = { - valType: 'enumerated', - values: axlist.concat(['pixel']), - dflt: dflt || 'pixel' || axlist[0] - }; + dflt = ax.fraction2r(dflt); + pos = coerce(attr, dflt); - // axref, ayref - return Lib.coerce(containerIn, containerOut, attrDef, refAttr); + if(ax.type === 'category') { + // if position is given as a category name, convert it to a number + if(typeof pos === 'string' && (ax._categories || []).length) { + newPos = ax._categories.indexOf(pos); + containerOut[attr] = (newPos !== -1) ? dflt : newPos; + return; + } + } + else if(ax.type === 'date') { + containerOut[attr] = Lib.cleanDate(pos); + return; + } + } + // finally make sure we have a number (unless date type already returned a string) + containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; }; // empty out types for all axes containing these traces @@ -35015,14 +35009,16 @@ axes.counterLetter = function(id) { // incorporate a new minimum difference and first tick into // forced +// note that _forceTick0 is linearized, so needs to be turned into +// a range value for setting tick0 axes.minDtick = function(ax, newDiff, newFirst, allow) { // doesn't make sense to do forced min dTick on log or category axes, // and the plot itself may decide to cancel (ie non-grouped bars) if(['log', 'category'].indexOf(ax.type) !== -1 || !allow) { ax._minDtick = 0; } - // null means there's nothing there yet - else if(ax._minDtick === null) { + // undefined means there's nothing there yet + else if(ax._minDtick === undefined) { ax._minDtick = newDiff; ax._forceTick0 = newFirst; } @@ -35047,6 +35043,19 @@ axes.minDtick = function(ax, newDiff, newFirst, allow) { } }; +// Find the autorange for this axis +// +// assumes ax._min and ax._max have already been set by calling axes.expand +// using calcdata from all traces. These are arrays of: +// {val: calcdata value, pad: extra pixels beyond this value} +// +// Returns an array of [min, max]. These are calcdata for log and category axes +// and data for linear and date axes. +// +// TODO: we want to change log to data as well, but it's hard to do this +// maintaining backward compatibility. category will always have to use calcdata +// though, because otherwise values between categories (or outside all categories) +// would be impossible. axes.getAutoRange = function(ax) { var newRange = []; @@ -35065,7 +35074,12 @@ axes.getAutoRange = function(ax) { var j, minpt, maxpt, minbest, maxbest, dp, dv, mbest = 0, - axReverse = (ax.range && ax.range[1] < ax.range[0]); + axReverse = false; + + if(ax.range) { + var rng = ax.range.map(ax.r2l); + axReverse = rng[1] < rng[0]; + } // one-time setting to easily reverse the axis // when plotting from code @@ -35154,11 +35168,9 @@ axes.getAutoRange = function(ax) { } // maintain reversal - if(axReverse) { - newRange.reverse(); - } + if(axReverse) newRange.reverse(); - return newRange; + return newRange.map(ax.l2r || Number); }; axes.doAutoRange = function(ax) { @@ -35221,7 +35233,6 @@ axes.saveRangeInitial = function(gd, overwrite) { // (unless one end is overridden by tozero) // tozero: (boolean) make sure to include zero if axis is linear, // and make it a tight bound if possible -var FP_SAFE = Number.MAX_VALUE / 2; axes.expand = function(ax, data, options) { if(!(ax.autorange || ax._needsExpand) || !data) return; if(!ax._min) ax._min = []; @@ -35360,10 +35371,24 @@ axes.autoBin = function(data, ax, nbins, is2d) { } // piggyback off autotick code to make "nice" bin sizes - var dummyax = { - type: ax.type === 'log' ? 'linear' : ax.type, - range: [datamin, datamax] - }; + var dummyax; + if(ax.type === 'log') { + dummyax = { + type: 'linear', + range: [datamin, datamax], + r2l: Number + }; + } + else { + dummyax = { + type: ax.type, + // conversion below would be ax.c2r but that's only different from l2r + // for log, and this is the only place (so far?) we would want c2r. + range: [datamin, datamax].map(ax.l2r), + r2l: ax.r2l + }; + } + axes.autoTicks(dummyax, size0); var binstart = axes.tickIncrement( axes.tickFirst(dummyax), dummyax.dtick, 'reverse'), @@ -35427,8 +35452,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { } return { - start: binstart, - end: binend, + start: ax.c2r(binstart), + end: ax.c2r(binend), size: dummyax.dtick }; }; @@ -35445,6 +35470,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { axes.calcTicks = function calcTicks(ax) { if(ax.tickmode === 'array') return arrayTicks(ax); + var rng = ax.range.map(ax.r2l); + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks, @@ -35459,18 +35486,17 @@ axes.calcTicks = function calcTicks(ax) { nt = Lib.constrain(ax._length / minPx, 4, 9) + 1; } } - axes.autoTicks(ax, Math.abs(ax.range[1] - ax.range[0]) / nt); + axes.autoTicks(ax, Math.abs(rng[1] - rng[0]) / nt); // check for a forced minimum dtick if(ax._minDtick > 0 && ax.dtick < ax._minDtick * 2) { ax.dtick = ax._minDtick; - ax.tick0 = ax._forceTick0; + ax.tick0 = ax.l2r(ax._forceTick0); } } // check for missing tick0 if(!ax.tick0) { - ax.tick0 = (ax.type === 'date') ? - new Date(2000, 0, 1).getTime() : 0; + ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; } // now figure out rounding of tick values @@ -35480,12 +35506,12 @@ axes.calcTicks = function calcTicks(ax) { ax._tmin = axes.tickFirst(ax); // check for reversed axis - var axrev = (ax.range[1] < ax.range[0]); + var axrev = (rng[1] < rng[0]); // return the full set of tick vals var vals = [], // add a tiny bit so we get ticks which may have rounded out - endtick = ax.range[1] * 1.0001 - ax.range[0] * 0.0001; + endtick = rng[1] * 1.0001 - rng[0] * 0.0001; if(ax.type === 'category') { endtick = (axrev) ? Math.max(-0.5, endtick) : Math.min(ax._categories.length - 0.5, endtick); @@ -35503,9 +35529,18 @@ axes.calcTicks = function calcTicks(ax) { // show the exponent only on the last one ax._tmax = vals[vals.length - 1]; + // for showing date suffixes: ax._prevSuffix holds what we showed most + // recently. Start with it cleared and mark that we're in calcTicks (ie + // calculating a whole string of these so we should care what the previous + // suffix was!) + ax._prevSuffix = ''; + ax._inCalcTicks = true; + var ticksOut = new Array(vals.length); for(var i = 0; i < vals.length; i++) ticksOut[i] = axes.tickText(ax, vals[i]); + ax._inCalcTicks = false; + return ticksOut; }; @@ -35513,15 +35548,15 @@ function arrayTicks(ax) { var vals = ax.tickvals, text = ax.ticktext, ticksOut = new Array(vals.length), - r0expanded = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, - r1expanded = ax.range[1] * 1.0001 - ax.range[0] * 0.0001, + rng = ax.range.map(ax.r2l), + r0expanded = rng[0] * 1.0001 - rng[1] * 0.0001, + r1expanded = rng[1] * 1.0001 - rng[0] * 0.0001, tickMin = Math.min(r0expanded, r1expanded), tickMax = Math.max(r0expanded, r1expanded), vali, i, j = 0; - // without a text array, just format the given values as any other ticks // except with more precision to the numbers if(!Array.isArray(text)) text = []; @@ -35561,7 +35596,7 @@ function roundDTick(roughDTick, base, roundingSet) { // outputs (into ax): // tick0: starting point for ticks (not necessarily on the graph) // usually 0 for numeric (=10^0=1 for log) or jan 1, 2000 for dates -// dtick: the actual, nice round tick spacing, somewhat larger than roughDTick +// dtick: the actual, nice round tick spacing, usually a little larger than roughDTick // if the ticks are spaced linearly (linear scale, categories, // log with only full powers, date ticks < month), // this will just be a number @@ -35574,36 +35609,35 @@ axes.autoTicks = function(ax, roughDTick) { var base; if(ax.type === 'date') { - ax.tick0 = new Date(2000, 0, 1).getTime(); + ax.tick0 = '2000-01-01'; + // the criteria below are all based on the rough spacing we calculate + // being > half of the final unit - so precalculate twice the rough val + var roughX2 = 2 * roughDTick; - if(roughDTick > 15778800000) { - // years if roughDTick > 6mo - roughDTick /= 31557600000; + if(roughX2 > ONEAVGYEAR) { + roughDTick /= ONEAVGYEAR; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'M' + (12 * roundDTick(roughDTick, base, roundBase10)); } - else if(roughDTick > 1209600000) { - // months if roughDTick > 2wk - roughDTick /= 2629800000; + else if(roughX2 > ONEAVGMONTH) { + roughDTick /= ONEAVGMONTH; ax.dtick = 'M' + roundDTick(roughDTick, 1, roundBase24); } - else if(roughDTick > 43200000) { - // days if roughDTick > 12h - ax.dtick = roundDTick(roughDTick, 86400000, roundDays); + else if(roughX2 > ONEDAY) { + ax.dtick = roundDTick(roughDTick, ONEDAY, roundDays); // get week ticks on sunday - ax.tick0 = new Date(2000, 0, 2).getTime(); + // this will also move the base tick off 2000-01-01 if dtick is + // 2 or 3 days... but that's a weird enough case that we'll ignore it. + ax.tick0 = '2000-01-02'; } - else if(roughDTick > 1800000) { - // hours if roughDTick > 30m - ax.dtick = roundDTick(roughDTick, 3600000, roundBase24); + else if(roughX2 > ONEHOUR) { + ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } - else if(roughDTick > 30000) { - // minutes if roughDTick > 30sec - ax.dtick = roundDTick(roughDTick, 60000, roundBase60); + else if(roughX2 > ONEMIN) { + ax.dtick = roundDTick(roughDTick, ONEMIN, roundBase60); } - else if(roughDTick > 500) { - // seconds if roughDTick > 0.5sec - ax.dtick = roundDTick(roughDTick, 1000, roundBase60); + else if(roughX2 > ONESEC) { + ax.dtick = roundDTick(roughDTick, ONESEC, roundBase60); } else { // milliseconds @@ -35613,16 +35647,19 @@ axes.autoTicks = function(ax, roughDTick) { } else if(ax.type === 'log') { ax.tick0 = 0; + var rng = ax.range.map(ax.r2l); - // only show powers of 10 - if(roughDTick > 0.7) ax.dtick = Math.ceil(roughDTick); - else if(Math.abs(ax.range[1] - ax.range[0]) < 1) { + if(roughDTick > 0.7) { + // only show powers of 10 + ax.dtick = Math.ceil(roughDTick); + } + else if(Math.abs(rng[1] - rng[0]) < 1) { // span is less than one power of 10 - var nt = 1.5 * Math.abs((ax.range[1] - ax.range[0]) / roughDTick); + var nt = 1.5 * Math.abs((rng[1] - rng[0]) / roughDTick); // ticks on a linear scale, labeled fully - roughDTick = Math.abs(Math.pow(10, ax.range[1]) - - Math.pow(10, ax.range[0])) / nt; + roughDTick = Math.abs(Math.pow(10, rng[1]) - + Math.pow(10, rng[0])) / nt; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'L' + roundDTick(roughDTick, base, roundBase10); } @@ -35661,41 +35698,59 @@ axes.autoTicks = function(ax, roughDTick) { // for date ticks, the last date part to show (y,m,d,H,M,S) // or an integer # digits past seconds function autoTickRound(ax) { - var dtick = ax.dtick, - maxend; + var dtick = ax.dtick; ax._tickexponent = 0; - if(!isNumeric(dtick) && typeof dtick !== 'string') dtick = 1; + if(!isNumeric(dtick) && typeof dtick !== 'string') { + dtick = 1; + } - if(ax.type === 'category') ax._tickround = null; - else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { - if(ax.type === 'date') { - if(dtick >= 86400000) ax._tickround = 'd'; - else if(dtick >= 3600000) ax._tickround = 'H'; - else if(dtick >= 60000) ax._tickround = 'M'; - else if(dtick >= 1000) ax._tickround = 'S'; - else ax._tickround = 3 - Math.round(Math.log(dtick / 2) / Math.LN10); - } + if(ax.type === 'category') { + ax._tickround = null; + } + if(ax.type === 'date') { + // If tick0 is unusual, give tickround a bit more information + // not necessarily *all* the information in tick0 though, if it's really odd + // minimal string length for tick0: 'd' is 10, 'M' is 16, 'S' is 19 + // take off a leading minus (year < 0 so length is consistent) + var tick0ms = Lib.dateTime2ms(ax.tick0), + tick0str = Lib.ms2DateTime(tick0ms).replace(/^-/, ''), + tick0len = tick0str.length; + + if(String(dtick).charAt(0) === 'M') { + // any tick0 more specific than a year: alway show the full date + if(tick0len > 10 || tick0str.substr(5) !== '01-01') ax._tickround = 'd'; + // show the month unless ticks are full multiples of a year + else ax._tickround = (+(dtick.substr(1)) % 12 === 0) ? 'y' : 'm'; + } + else if((dtick >= ONEDAY && tick0len <= 10) || (dtick >= ONEDAY * 15)) ax._tickround = 'd'; + else if((dtick >= ONEMIN && tick0len <= 16) || (dtick >= ONEHOUR)) ax._tickround = 'M'; + else if((dtick >= ONESEC && tick0len <= 19) || (dtick >= ONEMIN)) ax._tickround = 'S'; else { - if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); - // 2 digits past largest digit of dtick - ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); + // of any two adjacent ticks, at least one will have the maximum fractional digits + // of all possible ticks - so take the max. length of tick0 and the next one + var tick1len = Lib.ms2DateTime(tick0ms + dtick).replace(/^-/, '').length; + ax._tickround = Math.max(tick0len, tick1len) - 20; + } + } + else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { + // linear or log (except D1, D2) + var rng = ax.range.map(ax.r2d || Number); + if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); + // 2 digits past largest digit of dtick + ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); - if(ax.type === 'log') { - maxend = Math.pow(10, Math.max(ax.range[0], ax.range[1])); - } - else maxend = Math.max(Math.abs(ax.range[0]), Math.abs(ax.range[1])); + var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); - var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { - if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { - ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); - } - else ax._tickexponent = rangeexp; + var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); + if(Math.abs(rangeexp) > 3) { + if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { + ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } + else ax._tickexponent = rangeexp; } } - else if(dtick.charAt(0) === 'M') ax._tickround = (dtick.length === 2) ? 'm' : 'y'; + // D1 or D2 (log) else ax._tickround = null; } @@ -35740,13 +35795,16 @@ axes.tickIncrement = function(x, dtick, axrev) { // calculate the first tick on an axis axes.tickFirst = function(ax) { - var axrev = ax.range[1] < ax.range[0], + var r2l = ax.r2l || Number, + rng = ax.range.map(r2l), + axrev = rng[1] < rng[0], sRound = axrev ? Math.floor : Math.ceil, // add a tiny extra bit to make sure we get ticks // that may have been rounded out - r0 = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, + r0 = rng[0] * 1.0001 - rng[1] * 0.0001, dtick = ax.dtick, - tick0 = ax.tick0; + tick0 = r2l(ax.tick0); + if(isNumeric(dtick)) { var tmin = sRound((r0 - tick0) / dtick) * dtick + tick0; @@ -35796,7 +35854,7 @@ axes.tickFirst = function(ax) { var yearFormat = d3.time.format('%Y'), monthFormat = d3.time.format('%b %Y'), dayFormat = d3.time.format('%b %-d'), - hourFormat = d3.time.format('%b %-d %Hh'), + yearMonthDayFormat = d3.time.format('%b %-d, %Y'), minuteFormat = d3.time.format('%H:%M'), secondFormat = d3.time.format(':%S'); @@ -35832,7 +35890,8 @@ axes.tickText = function(ax, x, hover) { i; if(arrayMode && Array.isArray(ax.ticktext)) { - var minDiff = Math.abs(ax.range[1] - ax.range[0]) / 10000; + var rng = ax.range.map(ax.r2l), + minDiff = Math.abs(rng[1] - rng[0]) / 10000; for(i = 0; i < ax.ticktext.length; i++) { if(Math.abs(x - ax.d2l(ax.tickvals[i])) < minDiff) break; } @@ -35887,10 +35946,12 @@ function tickTextObj(ax, x, text) { function formatDate(ax, out, hover, extraPrecision) { var x = out.x, tr = ax._tickround, + trOriginal = tr, d = new Date(x), // suffix completes the full date info, to be included - // with only the first tick - suffix = '', + // with only the first tick or if any info before what's + // shown has changed + suffix, tt; if(hover && ax.hoverformat) { tt = modDateFormat(ax.hoverformat, x); @@ -35903,34 +35964,40 @@ function formatDate(ax, out, hover, extraPrecision) { else { if(extraPrecision) { if(isNumeric(tr)) tr += 2; - else tr = {y: 'm', m: 'd', d: 'H', H: 'M', M: 'S', S: 2}[tr]; + else tr = {y: 'm', m: 'd', d: 'M', M: 'S', S: 2}[tr]; } if(tr === 'y') tt = yearFormat(d); else if(tr === 'm') tt = monthFormat(d); else { - if(x === ax._tmin && !hover) { - suffix = '
' + yearFormat(d); - } + if(tr === 'd') { + if(!hover) suffix = '
' + yearFormat(d); - if(tr === 'd') tt = dayFormat(d); - else if(tr === 'H') tt = hourFormat(d); + tt = dayFormat(d); + } else { - if(x === ax._tmin && !hover) { - suffix = '
' + dayFormat(d) + ', ' + yearFormat(d); - } + if(!hover) suffix = '
' + yearMonthDayFormat(d); tt = minuteFormat(d); if(tr !== 'M') { tt += secondFormat(d); if(tr !== 'S') { - tt += numFormat(mod(x / 1000, 1), ax, 'none', hover) + tt += numFormat(d3.round(mod(x / 1000, 1), 4), ax, 'none', hover) .substr(1); } } + else if(trOriginal === 'd') { + // for hover on axes with day ticks, minuteFormat (which + // only includes %H:%M) isn't enough, you want the date too + tt = dayFormat(d) + ' ' + tt; + } } } } - out.text = tt + suffix; + if(suffix && (!ax._inCalcTicks || (suffix !== ax._prevSuffix))) { + tt += suffix; + ax._prevSuffix = suffix; + } + out.text = tt; } function formatLog(ax, out, hover, extraPrecision, hideexp) { @@ -36022,7 +36089,7 @@ function numFormat(v, ax, fmtoverride, hover) { (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent // from what we calculate - range: ax.showexponent === 'none' ? ax.range : [0, v || 1] + range: ax.showexponent === 'none' ? ax.range.map(ax.r2d) : [0, v || 1] }; autoTickRound(ah); tickRound = (Number(ah._tickround) || 0) + 4; @@ -36270,8 +36337,9 @@ axes.makeClipPaths = function(gd) { // doTicks: draw ticks, grids, and tick labels // axid: 'x', 'y', 'x2' etc, // blank to do all, -// 'redraw' to force full redraw, and reset ax._r -// (stored range for use by zoom/pan) +// 'redraw' to force full redraw, and reset: +// ax._r (stored range for use by zoom/pan) +// ax._rl (stored linearized range for use by zoom/pan) // or can pass in an axis object directly axes.doTicks = function(gd, axid, skipTitle) { var fullLayout = gd._fullLayout, @@ -36309,7 +36377,10 @@ axes.doTicks = function(gd, axid, skipTitle) { return function() { if(!ax._id) return; var axDone = axes.doTicks(gd, ax._id); - if(axid === 'redraw') ax._r = ax.range.slice(); + if(axid === 'redraw') { + ax._r = ax.range.slice(); + ax._rl = ax._r.map(ax.r2l); + } return axDone; }; })); @@ -36327,9 +36398,6 @@ axes.doTicks = function(gd, axid, skipTitle) { } } - // in case a val turns into string somehow - ax.range = [+ax.range[0], +ax.range[1]]; - // set scaling to pixels ax.setScale(); @@ -36718,7 +36786,8 @@ axes.doTicks = function(gd, axid, skipTitle) { break; } } - var showZl = (ax.range[0] * ax.range[1] <= 0) && ax.zeroline && + var rng = ax.range.map(ax.r2l), + showZl = (rng[0] * rng[1] <= 0) && ax.zeroline && (ax.type === 'linear' || ax.type === '-') && gridvals.length && (hasBarsOrFill || clipEnds({x: 0}) || !ax.showline); var zl = zlcontainer.selectAll('path.' + zcls) @@ -36942,7 +37011,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { // rather than built-in % which gives a negative value for negative v function mod(v, d) { return ((v % d) + d) % d; } -},{"../../components/color":25,"../../components/drawing":49,"../../components/titles":100,"../../lib":118,"../../lib/svg_text_utils":130,"../../registry":190,"./axis_ids":148,"./layout_attributes":155,"./layout_defaults":156,"./set_convert":160,"d3":8,"fast-isnumeric":11}],146:[function(require,module,exports){ +},{"../../components/color":25,"../../components/drawing":48,"../../components/titles":99,"../../constants/numerical":105,"../../lib":120,"../../lib/svg_text_utils":132,"../../registry":192,"./axis_ids":151,"./layout_attributes":157,"./layout_defaults":158,"./set_convert":162,"d3":8,"fast-isnumeric":11}],149:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -36957,7 +37026,7 @@ function mod(v, d) { return ((v % d) + d) % d; } var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); -var cleanDatum = require('./clean_datum'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function autoType(array) { if(moreDates(array)) return 'date'; @@ -36999,7 +37068,7 @@ function moreDates(a) { return (dcnt > ncnt * 2); } -// are the (x,y)-values in td.data mostly text? +// are the (x,y)-values in gd.data mostly text? // require twice as many categories as numbers function category(a) { // test at most 1000 points @@ -37009,15 +37078,15 @@ function category(a) { ai; for(var i = 0; i < a.length; i += inc) { - ai = cleanDatum(a[Math.round(i)]); - if(isNumeric(ai)) curvenums++; + ai = a[Math.round(i)]; + if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; else if(typeof ai === 'string' && ai !== '' && ai !== 'None') curvecats++; } return curvecats > curvenums * 2; } -},{"../../lib":118,"./clean_datum":150,"fast-isnumeric":11}],147:[function(require,module,exports){ +},{"../../constants/numerical":105,"../../lib":120,"fast-isnumeric":11}],150:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -37110,17 +37179,15 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var validRange = ( (containerIn.range || []).length === 2 && - isNumeric(containerIn.range[0]) && - isNumeric(containerIn.range[1]) + isNumeric(containerOut.r2l(containerIn.range[0])) && + isNumeric(containerOut.r2l(containerIn.range[1])) ); var autoRange = coerce('autorange', !validRange); if(autoRange) coerce('rangemode'); - var range = coerce('range', [-1, letter === 'x' ? 6 : 4]); - if(range[0] === range[1]) { - containerOut.range = [range[0] - 1, range[0] + 1]; - } - Lib.noneOrAll(containerIn.range, containerOut.range, [0, 1]); + + coerce('range'); + containerOut.cleanRange(); coerce('fixedrange'); @@ -37242,7 +37309,7 @@ function getFirstNonEmptyTrace(data, id, axLetter) { } } -},{"../../components/color/attributes":24,"../../lib":118,"../../registry":190,"./axis_autotype":146,"./axis_ids":148,"./category_order_defaults":149,"./layout_attributes":155,"./ordered_categories":157,"./set_convert":160,"./tick_label_defaults":161,"./tick_mark_defaults":162,"./tick_value_defaults":163,"fast-isnumeric":11,"tinycolor2":14}],148:[function(require,module,exports){ +},{"../../components/color/attributes":24,"../../lib":120,"../../registry":192,"./axis_autotype":149,"./axis_ids":151,"./category_order_defaults":152,"./layout_attributes":157,"./ordered_categories":159,"./set_convert":162,"./tick_label_defaults":163,"./tick_mark_defaults":164,"./tick_value_defaults":165,"fast-isnumeric":11,"tinycolor2":14}],151:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -37364,7 +37431,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":118,"../../registry":190,"../plots":182,"./constants":151}],149:[function(require,module,exports){ +},{"../../lib":120,"../../registry":192,"../plots":184,"./constants":153}],152:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -37398,46 +37465,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],150:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = require('fast-isnumeric'); - -var Lib = require('../../lib'); - - -/** - * cleanDatum: removes characters - * same replace criteria used in the grid.js:scrapeCol - * but also handling dates, numbers, and NaN, null, Infinity etc - */ -module.exports = function cleanDatum(c) { - try { - if(typeof c === 'object' && c !== null && c.getTime) { - return Lib.ms2DateTime(c); - } - if(typeof c !== 'string' && !isNumeric(c)) { - return ''; - } - c = c.toString().replace(/['"%,$# ]/g, ''); - } - catch(e) { - Lib.error(e, c); - } - - return c; -}; - -},{"../../lib":118,"fast-isnumeric":11}],151:[function(require,module,exports){ +},{}],153:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -37461,14 +37489,6 @@ module.exports = { y: /^yaxis([2-9]|[1-9][0-9]+)?$/ }, - /** - * standardize all missing data in calcdata to use undefined - * never null or NaN. - * that way we can use !==undefined, or !== BADNUM, - * to test for real data - */ - BADNUM: undefined, - // axis match regular expression xAxisMatch: /^xaxis[0-9]*$/, yAxisMatch: /^yaxis[0-9]*$/, @@ -37512,10 +37532,15 @@ module.exports = { BENDPX: 1.5, // delay before a redraw (relayout) after smooth panning and zooming - REDRAWDELAY: 50 + REDRAWDELAY: 50, + + // last resort axis ranges for x, y, and date axes if we have no data + DFLTRANGEX: [-1, 6], + DFLTRANGEY: [-1, 4], + DFLTRANGEDATE: ['2000-01-01', '2001-01-01'], }; -},{}],152:[function(require,module,exports){ +},{}],154:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -37616,11 +37641,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { return dragger; } - function forceNumbers(axRange) { - axRange[0] = Number(axRange[0]); - axRange[1] = Number(axRange[1]); - } - var dragOptions = { element: dragger, gd: gd, @@ -37731,7 +37751,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { .attr('d', 'M0,0Z'); clearSelect(); - for(var i = 0; i < allaxes.length; i++) forceNumbers(allaxes[i].range); } function clearSelect() { @@ -37822,16 +37841,16 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomAxRanges(axList, r0Fraction, r1Fraction) { var i, axi, - axRange; + axRangeLinear; for(i = 0; i < axList.length; i++) { axi = axList[i]; if(axi.fixedrange) continue; - axRange = axi.range; + axRangeLinear = axi.range.map(axi.r2l); axi.range = [ - axRange[0] + (axRange[1] - axRange[0]) * r0Fraction, - axRange[0] + (axRange[1] - axRange[0]) * r1Fraction + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r0Fraction), + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r1Fraction) ]; } } @@ -37885,7 +37904,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { verticalAlign: vAlign }) .on('edit', function(text) { - var v = ax.type === 'category' ? ax.c2l(text) : ax.d2l(text); + var v = ax.d2r(text); if(v !== undefined) { Plotly.relayout(gd, attrStr, v); } @@ -37945,10 +37964,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomWheelOneAxis(ax, centerFraction, zoom) { if(ax.fixedrange) return; - forceNumbers(ax.range); - var axRange = ax.range, + + var axRange = ax.range.map(ax.r2l), v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; - ax.range = [v0 + (axRange[0] - v0) * zoom, v0 + (axRange[1] - v0) * zoom]; + function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); } + ax.range = axRange.map(doZoom); } if(ew) { @@ -37996,7 +38016,10 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { for(var i = 0; i < axList.length; i++) { var axi = axList[i]; if(!axi.fixedrange) { - axi.range = [axi._r[0] - pix / axi._m, axi._r[1] - pix / axi._m]; + axi.range = [ + axi.l2r(axi._rl[0] - pix / axi._m), + axi.l2r(axi._rl[1] - pix / axi._m) + ]; } } } @@ -38019,23 +38042,29 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { 1 / (1 / Math.max(d, -0.3) + 3.222)); } - // dz: set a new value for one end (0 or 1) of an axis array ax, + // dz: set a new value for one end (0 or 1) of an axis array axArray, // and return a pixel shift for that end for the viewbox // based on pixel drag distance d // TODO: this makes (generally non-fatal) errors when you get // near floating point limits - function dz(ax, end, d) { + function dz(axArray, end, d) { var otherEnd = 1 - end, - movedi = 0; - for(var i = 0; i < ax.length; i++) { - var axi = ax[i]; + movedAx, + newLinearizedEnd; + for(var i = 0; i < axArray.length; i++) { + var axi = axArray[i]; if(axi.fixedrange) continue; - movedi = i; - axi.range[end] = axi._r[otherEnd] + - (axi._r[end] - axi._r[otherEnd]) / dZoom(d / axi._length); + movedAx = axi; + newLinearizedEnd = axi._rl[otherEnd] + + (axi._rl[end] - axi._rl[otherEnd]) / dZoom(d / axi._length); + var newEnd = axi.l2r(newLinearizedEnd); + + // if l2r comes back false or undefined, it means we've dragged off + // the end of valid ranges - so stop. + if(newEnd !== false && newEnd !== undefined) axi.range[end] = newEnd; } - return ax[movedi]._length * (ax[movedi]._r[end] - ax[movedi].range[end]) / - (ax[movedi]._r[end] - ax[movedi]._r[otherEnd]); + return movedAx._length * (movedAx._rl[end] - newLinearizedEnd) / + (movedAx._rl[end] - movedAx._rl[otherEnd]); } if(xActive === 'w') dx = dz(xa, 0, dx); @@ -38237,8 +38266,10 @@ function getEndText(ax, end) { diff = Math.abs(initialVal - ax.range[1 - end]), dig; + // TODO: this should basically be ax.r2d but we're doing extra + // rounding here... can we clean up at all? if(ax.type === 'date') { - return Lib.ms2DateTime(initialVal, diff); + return initialVal; } else if(ax.type === 'log') { dig = Math.ceil(Math.max(0, -Math.log(diff) / Math.LN10)) + 3; @@ -38272,7 +38303,7 @@ function isSelectOrLasso(dragmode) { return modes.indexOf(dragmode) !== -1; } -},{"../../components/color":25,"../../components/dragelement":47,"../../components/drawing":49,"../../lib":118,"../../lib/setcursor":128,"../../lib/svg_text_utils":130,"../../plotly":141,"../../registry":190,"./axes":145,"./constants":151,"./select":159,"d3":8,"tinycolor2":14}],153:[function(require,module,exports){ +},{"../../components/color":25,"../../components/dragelement":46,"../../components/drawing":48,"../../lib":120,"../../lib/setcursor":130,"../../lib/svg_text_utils":132,"../../plotly":143,"../../registry":192,"./axes":148,"./constants":153,"./select":161,"d3":8,"tinycolor2":14}],155:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -38298,6 +38329,7 @@ var dragElement = require('../../components/dragelement'); var Axes = require('./axes'); var constants = require('./constants'); var dragBox = require('./dragbox'); +var layoutAttributes = require('../layout_attributes'); var fx = module.exports = {}; @@ -38307,24 +38339,12 @@ var fx = module.exports = {}; fx.unhover = dragElement.unhover; fx.layoutAttributes = { - dragmode: { - valType: 'enumerated', - - values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], - dflt: 'zoom', - - }, - hovermode: { - valType: 'enumerated', - - values: ['x', 'y', 'closest', false], - - } }; fx.supplyLayoutDefaults = function(layoutIn, layoutOut, fullData) { + function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, fx.layoutAttributes, attr, dflt); + return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } coerce('dragmode'); @@ -39627,7 +39647,7 @@ fx.inbox = function(v0, v1) { return Infinity; }; -},{"../../components/color":25,"../../components/dragelement":47,"../../components/drawing":49,"../../lib":118,"../../lib/events":113,"../../lib/svg_text_utils":130,"./axes":145,"./constants":151,"./dragbox":152,"d3":8,"fast-isnumeric":11,"tinycolor2":14}],154:[function(require,module,exports){ +},{"../../components/color":25,"../../components/dragelement":46,"../../components/drawing":48,"../../lib":120,"../../lib/events":114,"../../lib/svg_text_utils":132,"../layout_attributes":182,"./axes":148,"./constants":153,"./dragbox":154,"d3":8,"fast-isnumeric":11,"tinycolor2":14}],156:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39657,6 +39677,8 @@ exports.attrRegex = constants.attrRegex; exports.attributes = require('./attributes'); +exports.layoutAttributes = require('./layout_attributes'); + exports.transitionAxes = require('./transition_axes'); exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) { @@ -39999,7 +40021,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":118,"../plots":182,"./attributes":144,"./axes":145,"./constants":151,"./transition_axes":164,"d3":8}],155:[function(require,module,exports){ +},{"../../lib":120,"../plots":184,"./attributes":147,"./axes":148,"./constants":153,"./layout_attributes":157,"./transition_axes":166,"d3":8}],157:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40035,8 +40057,8 @@ module.exports = { type: { valType: 'enumerated', // '-' means we haven't yet run autotype or couldn't find any data - // it gets turned into linear in td._fullLayout but not copied back - // to td.data like the others are. + // it gets turned into linear in gd._fullLayout but not copied back + // to gd.data like the others are. values: ['-', 'linear', 'log', 'date', 'category'], dflt: '-', @@ -40060,8 +40082,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -40087,14 +40109,12 @@ module.exports = { }, tick0: { - valType: 'number', - dflt: 0, + valType: 'any', }, dtick: { valType: 'any', - dflt: 1, }, @@ -40335,11 +40355,6 @@ module.exports = { }, - _nestedModules: { - 'rangeslider': 'rangeslider', - 'rangeselector': 'rangeselector', - }, - _deprecated: { autotick: { valType: 'boolean', @@ -40349,7 +40364,7 @@ module.exports = { } }; -},{"../../components/color/attributes":24,"../../lib/extend":114,"../font_attributes":166,"./constants":151}],156:[function(require,module,exports){ +},{"../../components/color/attributes":24,"../../lib/extend":115,"../font_attributes":168,"./constants":153}],158:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40523,7 +40538,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { }); }; -},{"../../components/color":25,"../../lib":118,"../../registry":190,"../layout_attributes":180,"./axis_defaults":147,"./axis_ids":148,"./constants":151,"./layout_attributes":155,"./position_defaults":158}],157:[function(require,module,exports){ +},{"../../components/color":25,"../../lib":120,"../../registry":192,"../layout_attributes":182,"./axis_defaults":150,"./axis_ids":151,"./constants":153,"./layout_attributes":157,"./position_defaults":160}],159:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40602,7 +40617,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":8}],158:[function(require,module,exports){ +},{"d3":8}],160:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40667,7 +40682,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":118,"fast-isnumeric":11}],159:[function(require,module,exports){ +},{"../../lib":120,"fast-isnumeric":11}],161:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40867,7 +40882,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":25,"../../lib/polygon":125,"./axes":145,"./constants":151}],160:[function(require,module,exports){ +},{"../../components/color":25,"../../lib/polygon":127,"./axes":148,"./constants":153}],162:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40883,27 +40898,38 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); +var numConstants = require('../../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var constants = require('./constants'); -var cleanDatum = require('./clean_datum'); var axisIds = require('./axis_ids'); /** - * Define the conversion functions for an axis data is used in 4 ways: + * Define the conversion functions for an axis data is used in 5 ways: * * d: data, in whatever form it's provided * c: calcdata: turned into numbers, but not linearized - * l: linearized - same as c except for log axes (and other - * mappings later?) this is used by ranges, and when we - * need to know if it's *possible* to show some data on - * this axis, without caring about the current range + * l: linearized - same as c except for log axes (and other nonlinear + * mappings later?) this is used when we need to know if it's + * *possible* to show some data on this axis, without caring about + * the current range * p: pixel value - mapped to the screen with current size and zoom + * r: ranges, tick0, and annotation positions match one of the above + * but are handled differently for different types: + * - linear and date: data format (d) + * - category: calcdata format (c), and will stay that way because + * the data format has no continuous mapping + * - log: linearized (l) format + * TODO: in v2.0 we plan to change it to data format. At that point + * shapes will work the same way as ranges, tick0, and annotations + * so they can use this conversion too. * - * Creates/updates these conversion functions + * Creates/updates these conversion functions, as well as cleaner functions: + * ax.d2d and ax.clean2r * also clears the autorange bounds ._min and ._max - * and the autotick constraints ._minDtick, ._forceTick0, - * and looks for date ranges that aren't yet in numeric format + * and the autotick constraints ._minDtick, ._forceTick0 */ module.exports = function setConvert(ax) { @@ -40923,20 +40949,119 @@ module.exports = function setConvert(ax) { return 0.5 * (r0 + r1 - 3 * clipMult * Math.abs(r0 - r1)); } - else return constants.BADNUM; + else return BADNUM; + } + + function fromLog(v) { + return Math.pow(10, v); + } + + function num(v) { + if(!isNumeric(v)) return BADNUM; + v = Number(v); + if(v < -FP_SAFE || v > FP_SAFE) return BADNUM; + return isNumeric(v) ? Number(v) : BADNUM; } - function fromLog(v) { return Math.pow(10, v); } - function num(v) { return isNumeric(v) ? Number(v) : constants.BADNUM; } ax.c2l = (ax.type === 'log') ? toLog : num; ax.l2c = (ax.type === 'log') ? fromLog : num; ax.l2d = function(v) { return ax.c2d(ax.l2c(v)); }; ax.p2d = function(v) { return ax.l2d(ax.p2l(v)); }; + /* + * fn to make sure range is a couplet of valid & distinct values + * keep numbers away from the limits of floating point numbers, + * and dates away from the ends of our date system (+/- 9999 years) + * + * optional param rangeAttr: operate on a different attribute, like + * ax._r, rather than ax.range + */ + ax.cleanRange = function(rangeAttr) { + if(!rangeAttr) rangeAttr = 'range'; + var range = ax[rangeAttr], + axLetter = (ax._id || 'x').charAt(0), + i, dflt; + + if(ax.type === 'date') dflt = constants.DFLTRANGEDATE; + else if(axLetter === 'y') dflt = constants.DFLTRANGEY; + else dflt = constants.DFLTRANGEX; + + // make sure we don't later mutate the defaults + dflt = dflt.slice(); + + if(!range || range.length !== 2) { + ax[rangeAttr] = dflt; + return; + } + + if(ax.type === 'date') { + // check if milliseconds or js date objects are provided for range + // and convert to date strings + range[0] = Lib.cleanDate(range[0]); + range[1] = Lib.cleanDate(range[1]); + } + + for(i = 0; i < 2; i++) { + if(ax.type === 'date') { + if(!Lib.isDateTime(range[i])) { + ax[rangeAttr] = dflt; + break; + } + + if(range[i] < Lib.MIN_MS) range[i] = Lib.MIN_MS; + if(range[i] > Lib.MAX_MS) range[i] = Lib.MAX_MS; + + if(ax.r2l(range[0]) === ax.r2l(range[1])) { + // split by +/- 1 second + var linCenter = Lib.constrain(ax.r2l(range[0]), + Lib.MIN_MS + 1000, Lib.MAX_MS - 1000); + range[0] = ax.l2r(linCenter - 1000); + range[1] = ax.l2r(linCenter + 1000); + break; + } + } + else { + if(!isNumeric(range[i])) { + if(isNumeric(range[1 - i])) { + range[i] = range[1 - i] * (i ? 10 : 0.1); + } + else { + ax[rangeAttr] = dflt; + break; + } + } + + if(range[i] < -FP_SAFE) range[i] = -FP_SAFE; + else if(range[i] > FP_SAFE) range[i] = FP_SAFE; + + if(range[0] === range[1]) { + // somewhat arbitrary: split by 1 or 1ppm, whichever is bigger + var inc = Math.max(1, Math.abs(range[0] * 1e-6)); + range[0] -= inc; + range[1] += inc; + } + } + } + }; + + // find the range value at the specified (linear) fraction of the axis + ax.fraction2r = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return ax.l2r(rl0 + v * (rl1 - rl0)); + }; + + // find the fraction of the range at the specified range value + ax.r2fraction = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return (ax.r2l(v) - rl0) / (rl1 - rl0); + }; + // set scaling to pixels ax.setScale = function(usePrivateRange) { var gs = ax._gd._fullLayout._size, - i; + axLetter = ax._id.charAt(0); // TODO cleaner way to handle this case if(!ax._categories) ax._categories = []; @@ -40952,40 +41077,23 @@ module.exports = function setConvert(ax) { // issue if we transform the drawn layer *and* use the new axis range to // draw the data. This allows us to construct setConvert using the pre- // interaction values of the range: - var range = (usePrivateRange && ax._r) ? ax._r : ax.range; - - // make sure we have a range (linearized data values) - // and that it stays away from the limits of javascript numbers - if(!range || range.length !== 2 || range[0] === range[1]) { - range = [-1, 1]; - } - for(i = 0; i < 2; i++) { - if(!isNumeric(range[i])) { - range[i] = isNumeric(range[1 - i]) ? - (range[1 - i] * (i ? 10 : 0.1)) : - (i ? 1 : -1); - } + var rangeAttr = (usePrivateRange && ax._r) ? '_r' : 'range'; + ax.cleanRange(rangeAttr); - if(range[i] < -(Number.MAX_VALUE / 2)) { - range[i] = -(Number.MAX_VALUE / 2); - } - else if(range[i] > Number.MAX_VALUE / 2) { - range[i] = Number.MAX_VALUE / 2; - } + var rl0 = ax.r2l(ax[rangeAttr][0]), + rl1 = ax.r2l(ax[rangeAttr][1]); - } - - if(ax._id.charAt(0) === 'y') { + if(axLetter === 'y') { ax._offset = gs.t + (1 - ax.domain[1]) * gs.h; ax._length = gs.h * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[0] - range[1]); - ax._b = -ax._m * range[1]; + ax._m = ax._length / (rl0 - rl1); + ax._b = -ax._m * rl1; } else { ax._offset = gs.l + ax.domain[0] * gs.w; ax._length = gs.w * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[1] - range[0]); - ax._b = -ax._m * range[0]; + ax._m = ax._length / (rl1 - rl0); + ax._b = -ax._m * rl0; } if(!isFinite(ax._m) || !isFinite(ax._b)) { @@ -40998,7 +41106,7 @@ module.exports = function setConvert(ax) { }; ax.l2p = function(v) { - if(!isNumeric(v)) return constants.BADNUM; + if(!isNumeric(v)) return BADNUM; // include 2 fractional digits on pixel, for PDF zooming etc return d3.round(ax._b + ax._m * v, 2); @@ -41009,42 +41117,62 @@ module.exports = function setConvert(ax) { ax.c2p = function(v, clip) { return ax.l2p(ax.c2l(v, clip)); }; ax.p2c = function(px) { return ax.l2c(ax.p2l(px)); }; + // clip doesn't do anything here yet, but in v2.0 when log axes get + // refactored it will... so including it now so we don't forget. + ax.r2p = function(v, clip) { return ax.l2p(ax.r2l(v, clip)); }; + ax.p2r = function(px) { return ax.l2r(ax.p2l(px)); }; + + ax.r2c = function(v) { return ax.l2c(ax.r2l(v)); }; + ax.c2r = function(v) { return ax.l2r(ax.c2l(v)); }; + if(['linear', 'log', '-'].indexOf(ax.type) !== -1) { ax.c2d = num; - ax.d2c = function(v) { - v = cleanDatum(v); - return isNumeric(v) ? Number(v) : constants.BADNUM; - }; - ax.d2l = function(v, clip) { - if(ax.type === 'log') return ax.c2l(ax.d2c(v), clip); - else return ax.d2c(v); - }; + ax.d2c = Lib.cleanNumber; + if(ax.type === 'log') { + ax.d2l = function(v, clip) { + return ax.c2l(ax.d2c(v), clip); + }; + ax.d2r = ax.d2l; + ax.r2d = ax.l2d; + } + else { + ax.d2l = Lib.cleanNumber; + ax.d2r = Lib.cleanNumber; + ax.r2d = num; + } + ax.r2l = num; + ax.l2r = num; } else if(ax.type === 'date') { - ax.c2d = function(v) { - return isNumeric(v) ? Lib.ms2DateTime(v) : constants.BADNUM; - }; + ax.c2d = Lib.ms2DateTime; ax.d2c = function(v) { - return (isNumeric(v)) ? Number(v) : Lib.dateTime2ms(v); + // NOTE: Changed this behavior: previously we took any numeric value + // to be a ms, even if it was a string that could be a bare year. + // Now we convert it as a date if at all possible, and only try + // as ms if that fails. + var ms = Lib.dateTime2ms(v); + if(ms === BADNUM) { + if(isNumeric(v)) ms = Number(v); + else return BADNUM; + } + return Lib.constrain(ms, Lib.MIN_MS, Lib.MAX_MS); }; ax.d2l = ax.d2c; - - // check if date strings or js date objects are provided for range - // and convert to ms - if(ax.range && ax.range.length > 1) { - try { - var ar1 = ax.range.map(Lib.dateTime2ms); - if(!isNumeric(ax.range[0]) && isNumeric(ar1[0])) { - ax.range[0] = ar1[0]; - } - if(!isNumeric(ax.range[1]) && isNumeric(ar1[1])) { - ax.range[1] = ar1[1]; - } - } - catch(e) { Lib.error(e, ax.range); } - } + ax.r2l = ax.d2c; + ax.l2r = ax.c2d; + ax.d2r = Lib.identity; + ax.r2d = Lib.identity; + ax.cleanr = function(v) { + /* + * If v is already a date string this is a noop, but running it + * through d2c and back validates the value: + * normalizes Date objects, milliseconds, and out-of-bounds dates + * so we always end up with either a clean date string or BADNUM + */ + return ax.c2d(ax.d2c(v)); + }; } else if(ax.type === 'category') { @@ -41067,38 +41195,42 @@ module.exports = function setConvert(ax) { } var c = ax._categories.indexOf(v); - return c === -1 ? constants.BADNUM : c; + return c === -1 ? BADNUM : c; }; ax.d2l = ax.d2c; + ax.r2l = num; + ax.l2r = num; + ax.d2r = ax.d2c; + ax.r2d = ax.c2d; } // makeCalcdata: takes an x or y array and converts it // to a position on the axis object "ax" // inputs: - // tdc - a data object from td.data - // axletter - a string, either 'x' or 'y', for which item + // trace - a data object from gd.data + // axLetter - a string, either 'x' or 'y', for which item // to convert (TODO: is this now always the same as // the first letter of ax._id?) // in case the expected data isn't there, make a list of // integers based on the opposite data - ax.makeCalcdata = function(tdc, axletter) { + ax.makeCalcdata = function(trace, axLetter) { var arrayIn, arrayOut, i; - if(axletter in tdc) { - arrayIn = tdc[axletter]; + if(axLetter in trace) { + arrayIn = trace[axLetter]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = ax.d2c(arrayIn[i]); } else { - var v0 = ((axletter + '0') in tdc) ? - ax.d2c(tdc[axletter + '0']) : 0, - dv = (tdc['d' + axletter]) ? - Number(tdc['d' + axletter]) : 1; + var v0 = ((axLetter + '0') in trace) ? + ax.d2c(trace[axLetter + '0']) : 0, + dv = (trace['d' + axLetter]) ? + Number(trace['d' + axLetter]) : 1; // the opposing data, for size if we have x and dx etc - arrayIn = tdc[{x: 'y', y: 'x'}[axletter]]; + arrayIn = trace[{x: 'y', y: 'x'}[axLetter]]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = v0 + i * dv; @@ -41113,11 +41245,11 @@ module.exports = function setConvert(ax) { ax._max = []; // and for bar charts and box plots: reset forced minimum tick spacing - ax._minDtick = null; - ax._forceTick0 = null; + delete ax._minDtick; + delete ax._forceTick0; }; -},{"../../lib":118,"./axis_ids":148,"./clean_datum":150,"./constants":151,"d3":8,"fast-isnumeric":11}],161:[function(require,module,exports){ +},{"../../constants/numerical":105,"../../lib":120,"./axis_ids":151,"./constants":153,"d3":8,"fast-isnumeric":11}],163:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41187,8 +41319,8 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe */ function getShowAttrDflt(containerIn) { var showAttrsAll = ['showexponent', - 'showtickprefix', - 'showticksuffix'], + 'showtickprefix', + 'showticksuffix'], showAttrs = showAttrsAll.filter(function(a) { return containerIn[a] !== undefined; }), @@ -41201,7 +41333,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":118}],162:[function(require,module,exports){ +},{"../../lib":120}],164:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41234,7 +41366,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":118,"./layout_attributes":155}],163:[function(require,module,exports){ +},{"../../lib":120,"./layout_attributes":157}],165:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41247,6 +41379,8 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, 'use strict'; var isNumeric = require('fast-isnumeric'); +var Lib = require('../../lib'); +var ONEDAY = require('../../constants/numerical').ONEDAY; module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType) { @@ -41258,15 +41392,56 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } if(Array.isArray(containerIn.tickvals)) tickmodeDefault = 'array'; - else if(containerIn.dtick && isNumeric(containerIn.dtick)) { + else if(containerIn.dtick) { tickmodeDefault = 'linear'; } var tickmode = coerce('tickmode', tickmodeDefault); if(tickmode === 'auto') coerce('nticks'); else if(tickmode === 'linear') { - coerce('tick0'); - coerce('dtick'); + // dtick is usually a positive number, but there are some + // special strings available for log or date axes + // default is 1 day for dates, otherwise 1 + var dtickDflt = (axType === 'date') ? ONEDAY : 1; + var dtick = coerce('dtick', dtickDflt); + if(isNumeric(dtick)) { + containerOut.dtick = (dtick > 0) ? Number(dtick) : dtickDflt; + } + else if(typeof dtick !== 'string') { + containerOut.dtick = dtickDflt; + } + else { + // date and log special cases are all one character plus a number + var prefix = dtick.charAt(0), + dtickNum = dtick.substr(1); + + dtickNum = isNumeric(dtickNum) ? Number(dtickNum) : 0; + if((dtickNum <= 0) || !( + // "M" gives ticks every (integer) n months + (axType === 'date' && prefix === 'M' && dtickNum === Math.round(dtickNum)) || + // "L" gives ticks linearly spaced in data (not in position) every (float) f + (axType === 'log' && prefix === 'L') || + // "D1" gives powers of 10 with all small digits between, "D2" gives only 2 and 5 + (axType === 'log' && prefix === 'D' && (dtickNum === 1 || dtickNum === 2)) + )) { + containerOut.dtick = dtickDflt; + } + } + + // tick0 can have different valType for different axis types, so + // validate that now. Also for dates, change milliseconds to date strings + var tick0Dflt = (axType === 'date') ? '2000-01-01' : 0; + var tick0 = coerce('tick0', tick0Dflt); + if(axType === 'date') { + containerOut.tick0 = Lib.cleanDate(tick0, tick0Dflt); + } + // Aside from date axes, dtick must be numeric; D1 and D2 modes ignore tick0 entirely + else if(isNumeric(tick0) && dtick !== 'D1' && dtick !== 'D2') { + containerOut.tick0 = Number(tick0); + } + else { + containerOut.tick0 = tick0Dflt; + } } else { var tickvals = coerce('tickvals'); @@ -41275,7 +41450,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"fast-isnumeric":11}],164:[function(require,module,exports){ +},{"../../constants/numerical":105,"../../lib":120,"fast-isnumeric":11}],166:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41587,7 +41762,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../lib":118,"../../plotly":141,"../../registry":190,"./axes":145,"d3":8}],165:[function(require,module,exports){ +},{"../../lib":120,"../../plotly":143,"../../registry":192,"./axes":148,"d3":8}],167:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41999,7 +42174,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":118,"../plotly":141}],166:[function(require,module,exports){ +},{"../lib":120,"../plotly":143}],168:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42030,7 +42205,7 @@ module.exports = { } }; -},{}],167:[function(require,module,exports){ +},{}],169:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42071,7 +42246,7 @@ module.exports = { } }; -},{}],168:[function(require,module,exports){ +},{}],170:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42229,7 +42404,7 @@ params.layerNameToAdjective = { // base layers drawn over choropleth params.baseLayersOverChoropleth = ['rivers', 'lakes']; -},{}],169:[function(require,module,exports){ +},{}],171:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42258,7 +42433,7 @@ var constants = require('./constants'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); var topojsonUtils = require('../../lib/topojson_utils'); -var topojsonFeature = require('topojson').feature; +var topojsonFeature = require('topojson-client').feature; // add a few projection types to d3.geo addProjectionsToD3(d3); @@ -42791,7 +42966,7 @@ function createMockAxis(fullLayout) { return mockAxis; } -},{"../../components/color":25,"../../components/drawing":49,"../../constants/xmlns_namespaces":107,"../../lib/topojson_utils":131,"../../plots/cartesian/axes":145,"../../plots/cartesian/graph_interact":153,"./constants":168,"./projections":176,"./set_scale":177,"./zoom":178,"./zoom_reset":179,"d3":8,"topojson":15}],170:[function(require,module,exports){ +},{"../../components/color":25,"../../components/drawing":48,"../../constants/xmlns_namespaces":107,"../../lib/topojson_utils":133,"../../plots/cartesian/axes":148,"../../plots/cartesian/graph_interact":155,"./constants":170,"./projections":178,"./set_scale":179,"./zoom":180,"./zoom_reset":181,"d3":8,"topojson-client":15}],172:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42910,7 +43085,7 @@ function getSubplotCalcData(calcData, id) { return subplotCalcData; } -},{"../../plots/plots":182,"./geo":169,"./layout/attributes":171,"./layout/defaults":174,"./layout/layout_attributes":175}],171:[function(require,module,exports){ +},{"../../plots/plots":184,"./geo":171,"./layout/attributes":173,"./layout/defaults":176,"./layout/layout_attributes":177}],173:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42931,7 +43106,7 @@ module.exports = { } }; -},{}],172:[function(require,module,exports){ +},{}],174:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42986,7 +43161,7 @@ module.exports = { } }; -},{"../../../components/color/attributes":24}],173:[function(require,module,exports){ +},{"../../../components/color/attributes":24}],175:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43060,7 +43235,7 @@ module.exports = function supplyGeoAxisLayoutDefaults(geoLayoutIn, geoLayoutOut) } }; -},{"../../../lib":118,"../constants":168,"./axis_attributes":172}],174:[function(require,module,exports){ +},{"../../../lib":120,"../constants":170,"./axis_attributes":174}],176:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43179,7 +43354,7 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce) { ]; } -},{"../../subplot_defaults":189,"../constants":168,"./axis_defaults":173,"./layout_attributes":175}],175:[function(require,module,exports){ +},{"../../subplot_defaults":191,"../constants":170,"./axis_defaults":175,"./layout_attributes":177}],177:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43412,7 +43587,7 @@ module.exports = { lataxis: geoAxesAttrs }; -},{"../../../components/color/attributes":24,"../constants":168,"./axis_attributes":172}],176:[function(require,module,exports){ +},{"../../../components/color/attributes":24,"../constants":170,"./axis_attributes":174}],178:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43858,7 +44033,7 @@ function addProjectionsToD3(d3) { module.exports = addProjectionsToD3; -},{}],177:[function(require,module,exports){ +},{}],179:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43988,7 +44163,7 @@ function makeRangeBox(lon0, lat0, lon1, lat1) { return { type: 'Polygon', coordinates: [ - [ [lon0, lat0], + [ [lon0, lat0], [lon0, lat1], [lon0 + dlon4, lat1], [lon0 + 2 * dlon4, lat1], @@ -44009,7 +44184,7 @@ function getBounds(projection, rangeBox) { return d3.geo.path().projection(projection).bounds(rangeBox); } -},{"./constants":168,"d3":8}],178:[function(require,module,exports){ +},{"./constants":170,"d3":8}],180:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44436,7 +44611,7 @@ function d3_eventDispatch(target) { return dispatch; } -},{"d3":8}],179:[function(require,module,exports){ +},{"d3":8}],181:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44471,7 +44646,7 @@ function createGeoZoomReset(geo, geoLayout) { module.exports = createGeoZoomReset; -},{"../cartesian/graph_interact":153}],180:[function(require,module,exports){ +},{"../cartesian/graph_interact":155}],182:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44613,28 +44788,22 @@ module.exports = { }, - _composedModules: { - '*': 'Fx' + dragmode: { + valType: 'enumerated', + + values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], + dflt: 'zoom', + }, - - _nestedModules: { - 'xaxis': 'Axes', - 'yaxis': 'Axes', - 'scene': 'gl3d', - 'geo': 'geo', - 'ternary': 'ternary', - 'mapbox': 'mapbox', - - 'legend': 'legend', - 'annotations': 'annotations', - 'shapes': 'shapes', - 'images': 'images', - 'updatemenus': 'updatemenus', - 'sliders': 'sliders' + hovermode: { + valType: 'enumerated', + + values: ['x', 'y', 'closest', false], + } }; -},{"../components/color/attributes":24,"../lib":118,"./font_attributes":166}],181:[function(require,module,exports){ +},{"../components/color/attributes":24,"../lib":120,"./font_attributes":168}],183:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44672,7 +44841,7 @@ module.exports = { } }; -},{}],182:[function(require,module,exports){ +},{}],184:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45039,6 +45208,9 @@ plots.sendDataToCloud = function(gd) { // gd._fullLayout._basePlotModules // is a list of all the plot modules required to draw the plot. // +// gd._fullLayout._transformModules +// is a list of all the transform modules invoked. +// plots.supplyDefaults = function(gd) { var oldFullLayout = gd._fullLayout || {}, newFullLayout = gd._fullLayout = {}, @@ -45050,6 +45222,9 @@ plots.supplyDefaults = function(gd) { var i; + // Create all the storage space for frames, but only if doesn't already exist + if(!gd._transitionData) plots.createTransitionData(gd); + // first fill in what we can of layout without looking at data // because fullData needs a few things from layout @@ -45110,7 +45285,7 @@ plots.supplyDefaults = function(gd) { } // finally, fill in the pieces of layout that may need to look at data - plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData); + plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData); // TODO remove in v2.0.0 // add has-plot-type refs to fullLayout for backward compatibility @@ -45149,12 +45324,6 @@ plots.supplyDefaults = function(gd) { (gd.calcdata[i][0] || {}).trace = trace; } } - - // Create all the storage space for frames, but only if doesn't already - // exist: - if(!gd._transitionData) { - plots.createTransitionData(gd); - } }; // Create storage for all of the data related to frames and transitions: @@ -45321,6 +45490,8 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) { basePlotModules = fullLayout._basePlotModules = [], cnt = 0; + fullLayout._transformModules = []; + function pushModule(fullTrace) { dataOut.push(fullTrace); @@ -45538,6 +45709,8 @@ function supplyTransformDefaults(traceIn, traceOut, layout) { transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn); transformOut.type = type; transformOut._module = _module; + + Lib.pushUnique(layout._transformModules, _module); } else { transformOut = Lib.extendFlat({}, transformIn); @@ -45707,7 +45880,7 @@ function calculateReservedMargins(margins) { return resultingMargin; } -plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { +plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, transitionData) { var i, _module; // can't be be part of basePlotModules loop @@ -45738,6 +45911,16 @@ plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { } } + // transform module layout defaults + var transformModules = layoutOut._transformModules; + for(i = 0; i < transformModules.length; i++) { + _module = transformModules[i]; + + if(_module.supplyLayoutDefaults) { + _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData, transitionData); + } + } + // should FX be a component? Plotly.Fx.supplyLayoutDefaults(layoutIn, layoutOut, fullData); @@ -45765,8 +45948,16 @@ plots.purge = function(gd) { // remove modebar if(fullLayout._modeBar) fullLayout._modeBar.destroy(); - if(gd._transitionData && gd._transitionData._animationRaf) { - window.cancelAnimationFrame(gd._transitionData._animationRaf); + if(gd._transitionData) { + // Ensure any dangling callbacks are simply dropped if the plot is purged. + // This is more or less only actually important for testing. + if(gd._transitionData._interruptCallbacks) { + gd._transitionData._interruptCallbacks.length = 0; + } + + if(gd._transitionData._animationRaf) { + window.cancelAnimationFrame(gd._transitionData._animationRaf); + } } // data and layout @@ -46043,9 +46234,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { // convert native dates to date strings... // mostly for external users exporting to plotly - if(d && d.getTime) { - return Lib.ms2DateTime(d); - } + if(Lib.isJSDate(d)) return Lib.ms2DateTime(+d); return d; } @@ -46090,7 +46279,7 @@ plots.modifyFrames = function(gd, operations) { break;*/ case 'replace': frame = op.value; - var oldName = _frames[op.index].name; + var oldName = (_frames[op.index] || {}).name; var newName = frame.name; _frames[op.index] = _hash[newName] = frame; @@ -46224,8 +46413,14 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { for(i = 0; i < containerPaths.length; i++) { containerProp = Lib.nestedProperty(expandedObj, containerPaths[i]); containerVal = containerProp.get(); - containerProp.set(null); - Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + + if(containerVal === undefined) { + Lib.nestedProperty(containerObj, containerPaths[i]).set(null); + } + else { + containerProp.set(null); + Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + } } } @@ -46239,15 +46434,20 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { if(!srcContainer) continue; destProp = Lib.nestedProperty(dest, containerPaths[i]); - destContainer = destProp.get(); + if(!Array.isArray(destContainer)) { destContainer = []; destProp.set(destContainer); } for(j = 0; j < srcContainer.length; j++) { - destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcContainer[j]); + var srcObj = srcContainer[j]; + + if(srcObj === null) destContainer[j] = null; + else { + destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcObj); + } } destProp.set(destContainer); @@ -46258,7 +46458,7 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { }; plots.dataArrayContainers = ['transforms']; -plots.layoutArrayContainers = ['annotations', 'shapes', 'images', 'sliders', 'updatemenus']; +plots.layoutArrayContainers = Registry.layoutArrayContainers; /* * Extend a trace definition. This method: @@ -46317,11 +46517,15 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var trace = gd._fullData[traceIdx]; var module = trace._module; - if(!module || !module.animatable) { - continue; - } + // There's nothing to do if this module is not defined: + if(!module) continue; - transitionedTraces.push(traceIdx); + // Don't register the trace as transitioned if it doens't know what to do. + // If it *is* registered, it will receive a callback that it's responsible + // for calling in order to register the transition as having completed. + if(module.animatable) { + transitionedTraces.push(traceIdx); + } gd.data[traceIndices[i]] = plots.extendTrace(gd.data[traceIndices[i]], data[i]); } @@ -46375,6 +46579,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var aborted = false; function executeTransitions() { + + gd.emit('plotly_transitioning', []); + return new Promise(function(resolve) { // This flag is used to disabled things like autorange: gd._transitioning = true; @@ -46459,6 +46666,11 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function completeTransition(callback) { + // This a simple workaround for tests which purge the graph before animations + // have completed. That's not a very common case, so this is the simplest + // fix. + if(!gd._transitionData) return; + flushCallbacks(gd._transitionData._interruptCallbacks); return Promise.resolve().then(function() { @@ -46476,6 +46688,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function interruptPreviousTransitions() { + // Fail-safe against purged plot: + if(!gd._transitionData) return; + // If a transition is interrupted, set this to false. At the moment, the only thing that would // interrupt a transition is another transition, so that it will momentarily be set to true // again, but this determines whether autorange or dragbox work, so it's for the sake of @@ -46503,13 +46718,13 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var seq = [plots.previousPromises, interruptPreviousTransitions, prepareTransitions, executeTransitions]; - var transitionStarting = Lib.syncOrAsync(seq, gd); - if(!transitionStarting || !transitionStarting.then) transitionStarting = Promise.resolve(); + if(!transitionStarting || !transitionStarting.then) { + transitionStarting = Promise.resolve(); + } return transitionStarting.then(function() { - gd.emit('plotly_transitioning', []); return gd; }); }; @@ -46612,7 +46827,7 @@ plots.doCalcdata = function(gd, traces) { } }; -},{"../components/color":25,"../components/errorbars":55,"../lib":118,"../plotly":141,"../registry":190,"./animation_attributes":142,"./attributes":143,"./command":165,"./font_attributes":166,"./frame_attributes":167,"./layout_attributes":180,"d3":8,"fast-isnumeric":11}],183:[function(require,module,exports){ +},{"../components/color":25,"../components/errorbars":54,"../lib":120,"../plotly":143,"../registry":192,"./animation_attributes":144,"./attributes":146,"./command":167,"./font_attributes":168,"./frame_attributes":169,"./layout_attributes":182,"d3":8,"fast-isnumeric":11}],185:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46637,7 +46852,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":207}],184:[function(require,module,exports){ +},{"../../traces/scatter/attributes":209}],186:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46752,7 +46967,7 @@ module.exports = { } }; -},{"../../lib/extend":114,"../cartesian/layout_attributes":155}],185:[function(require,module,exports){ +},{"../../lib/extend":115,"../cartesian/layout_attributes":157}],187:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46767,7 +46982,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":186,"./micropolar_manager":187}],186:[function(require,module,exports){ +},{"./micropolar":188,"./micropolar_manager":189}],188:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48186,7 +48401,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":118,"d3":8}],187:[function(require,module,exports){ +},{"../../lib":120,"d3":8}],189:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48272,7 +48487,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":25,"../../lib":118,"./micropolar":186,"./undo_manager":188,"d3":8}],188:[function(require,module,exports){ +},{"../../components/color":25,"../../lib":120,"./micropolar":188,"./undo_manager":190,"d3":8}],190:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48338,7 +48553,7 @@ module.exports = function UndoManager() { }; }; -},{}],189:[function(require,module,exports){ +},{}],191:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48413,7 +48628,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":118,"./plots":182}],190:[function(require,module,exports){ +},{"../lib":120,"./plots":184}],192:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48429,11 +48644,12 @@ var Lib = require('./lib'); var basePlotAttributes = require('./plots/attributes'); exports.modules = {}; -exports.allTypes = []; exports.allCategories = {}; +exports.allTypes = []; exports.subplotsRegistry = {}; exports.transformsRegistry = {}; exports.componentsRegistry = {}; +exports.layoutArrayContainers = []; /** * register a module as the handler for a trace type @@ -48499,6 +48715,16 @@ exports.registerSubplot = function(_module) { exports.subplotsRegistry[plotType] = _module; }; +exports.registerComponent = function(_module) { + var name = _module.name; + + exports.componentsRegistry[name] = _module; + + if(_module.layoutAttributes && _module.layoutAttributes._isLinkedToArray) { + Lib.pushUnique(exports.layoutArrayContainers, name); + } +}; + /** * Get registered module using trace object or trace type * @@ -48570,7 +48796,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib":118,"./plots/attributes":143}],191:[function(require,module,exports){ +},{"./lib":120,"./plots/attributes":146}],193:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48697,11 +48923,12 @@ module.exports = function clonePlot(graphObj, options) { } } - var td = document.createElement('div'); - if(options.tileClass) td.className = options.tileClass; + var gd = document.createElement('div'); + if(options.tileClass) gd.className = options.tileClass; var plotTile = { - td: td, + gd: gd, + td: gd, // for external (image server) compatibility layout: newLayout, data: newData, config: { @@ -48721,13 +48948,13 @@ module.exports = function clonePlot(graphObj, options) { plotTile.config.setBackground = options.setBackground || 'opaque'; } - // attaching the default Layout the td, so you can grab it later - plotTile.td.defaultLayout = cloneLayoutOverride(options.tileClass); + // attaching the default Layout the gd, so you can grab it later + plotTile.gd.defaultLayout = cloneLayoutOverride(options.tileClass); return plotTile; }; -},{"../lib":118,"../plots/plots":182}],192:[function(require,module,exports){ +},{"../lib":120,"../plots/plots":184}],194:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48793,7 +49020,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":118,"../plot_api/to_image":139,"./filesaver":193}],193:[function(require,module,exports){ +},{"../lib":120,"../plot_api/to_image":141,"./filesaver":195}],195:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48861,7 +49088,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],194:[function(require,module,exports){ +},{}],196:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48894,7 +49121,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],195:[function(require,module,exports){ +},{}],197:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48920,7 +49147,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":191,"./download":192,"./helpers":194,"./svgtoimg":196,"./toimage":197,"./tosvg":198}],196:[function(require,module,exports){ +},{"./cloneplot":193,"./download":194,"./helpers":196,"./svgtoimg":198,"./toimage":199,"./tosvg":200}],198:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49051,7 +49278,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":118,"events":10}],197:[function(require,module,exports){ +},{"../lib":120,"events":10}],199:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49084,7 +49311,7 @@ function toImage(gd, opts) { var ev = new EventEmitter(); var clone = clonePlot(gd, {format: 'png'}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -49131,7 +49358,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":118,"../plotly":141,"./cloneplot":191,"./helpers":194,"./svgtoimg":196,"./tosvg":198,"events":10}],198:[function(require,module,exports){ +},{"../lib":120,"../plotly":143,"./cloneplot":193,"./helpers":196,"./svgtoimg":198,"./tosvg":200,"events":10}],200:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49250,7 +49477,7 @@ module.exports = function toSVG(gd, format) { return s; }; -},{"../components/color":25,"../components/drawing":49,"../constants/xmlns_namespaces":107,"../lib/svg_text_utils":130,"d3":8}],199:[function(require,module,exports){ +},{"../components/color":25,"../components/drawing":48,"../constants/xmlns_namespaces":107,"../lib/svg_text_utils":132,"d3":8}],201:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49263,7 +49490,9 @@ module.exports = function toSVG(gd, format) { var ScatterGeoAttrs = require('../scattergeo/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var plotAttrs = require('../../plots/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; var ScatterGeoMarkerLineAttrs = ScatterGeoAttrs.marker.line; @@ -49291,14 +49520,12 @@ module.exports = extendFlat({}, { hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['location', 'z', 'text', 'name'] }), - _nestedModules: { - 'colorbar': 'Colorbar' - } }, - colorscaleAttrs + colorscaleAttrs, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":31,"../../lib/extend":114,"../../plots/attributes":143,"../scattergeo/attributes":230}],200:[function(require,module,exports){ +},{"../../components/colorbar/attributes":26,"../../components/colorscale/attributes":30,"../../lib/extend":115,"../../plots/attributes":146,"../scattergeo/attributes":232}],202:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49317,7 +49544,7 @@ module.exports = function calc(gd, trace) { colorscaleCalc(trace, trace.z, '', 'z'); }; -},{"../../components/colorscale/calc":32}],201:[function(require,module,exports){ +},{"../../components/colorscale/calc":31}],203:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49372,7 +49599,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hoverinfo', (layout._dataLength === 1) ? 'location+z+text' : undefined); }; -},{"../../components/colorscale/defaults":35,"../../lib":118,"./attributes":199}],202:[function(require,module,exports){ +},{"../../components/colorscale/defaults":34,"../../lib":120,"./attributes":201}],204:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49405,7 +49632,7 @@ Choropleth.meta = { module.exports = Choropleth; -},{"../../plots/geo":170,"../heatmap/colorbar":204,"./attributes":199,"./calc":200,"./defaults":201,"./plot":203}],203:[function(require,module,exports){ +},{"../../plots/geo":172,"../heatmap/colorbar":206,"./attributes":201,"./calc":202,"./defaults":203,"./plot":205}],205:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49634,7 +49861,7 @@ function makeEventDataFunc(trace) { }; } -},{"../../components/color":25,"../../components/colorscale":40,"../../components/drawing":49,"../../lib/array_to_calc_item":110,"../../lib/geo_location_utils":116,"../../lib/topojson_utils":131,"../../plots/cartesian/axes":145,"../../plots/cartesian/graph_interact":153,"../../plots/geo/constants":168,"./attributes":199,"d3":8}],204:[function(require,module,exports){ +},{"../../components/color":25,"../../components/colorscale":39,"../../components/drawing":48,"../../lib/array_to_calc_item":110,"../../lib/geo_location_utils":118,"../../lib/topojson_utils":133,"../../plots/cartesian/axes":148,"../../plots/cartesian/graph_interact":155,"../../plots/geo/constants":170,"./attributes":201,"d3":8}],206:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49685,7 +49912,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":28,"../../components/colorscale":40,"../../lib":118,"../../plots/plots":182,"fast-isnumeric":11}],205:[function(require,module,exports){ +},{"../../components/colorbar/draw":28,"../../components/colorscale":39,"../../lib":120,"../../plots/plots":184,"fast-isnumeric":11}],207:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49712,7 +49939,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":25}],206:[function(require,module,exports){ +},{"../../components/color":25}],208:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49750,7 +49977,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":118}],207:[function(require,module,exports){ +},{"../../lib":120}],209:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49762,11 +49989,11 @@ module.exports = function arraysToCalcdata(cd) { 'use strict'; var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var Drawing = require('../../components/drawing'); - var constants = require('./constants'); - var extendFlat = require('../../lib/extend').extendFlat; module.exports = { @@ -49942,12 +50169,15 @@ module.exports = { }, + showscale: { valType: 'boolean', dflt: false, }, + colorbar: colorbarAttrs, + line: extendFlat({}, { width: { valType: 'number', @@ -49995,6 +50225,7 @@ module.exports = { }, }, + r: { valType: 'data_array', @@ -50003,14 +50234,12 @@ module.exports = { valType: 'data_array', }, - _nestedModules: { // nested module coupling - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_y: errorBarAttrs, + error_x: errorBarAttrs }; -},{"../../components/colorscale/color_attributes":33,"../../components/drawing":49,"../../lib/extend":114,"./constants":212}],208:[function(require,module,exports){ +},{"../../components/colorbar/attributes":26,"../../components/colorscale/color_attributes":32,"../../components/drawing":48,"../../components/errorbars/attributes":50,"../../lib/extend":115,"./constants":214}],210:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50141,7 +50370,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":118,"../../plots/cartesian/axes":145,"./colorscale_calc":211,"./subtypes":227,"fast-isnumeric":11}],209:[function(require,module,exports){ +},{"../../lib":120,"../../plots/cartesian/axes":148,"./colorscale_calc":213,"./subtypes":229,"fast-isnumeric":11}],211:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50180,7 +50409,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],210:[function(require,module,exports){ +},{}],212:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50237,7 +50466,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":28,"../../components/colorscale":40,"../../lib":118,"../../plots/plots":182,"fast-isnumeric":11}],211:[function(require,module,exports){ +},{"../../components/colorbar/draw":28,"../../components/colorscale":39,"../../lib":120,"../../plots/plots":184,"fast-isnumeric":11}],213:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50270,7 +50499,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":32,"../../components/colorscale/has_colorscale":39,"./subtypes":227}],212:[function(require,module,exports){ +},{"../../components/colorscale/calc":31,"../../components/colorscale/has_colorscale":38,"./subtypes":229}],214:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50286,7 +50515,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],213:[function(require,module,exports){ +},{}],215:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50366,7 +50595,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":54,"../../lib":118,"./attributes":207,"./constants":212,"./fillcolor_defaults":214,"./line_defaults":218,"./line_shape_defaults":220,"./marker_defaults":223,"./subtypes":227,"./text_defaults":228,"./xy_defaults":229}],214:[function(require,module,exports){ +},{"../../components/errorbars/defaults":53,"../../lib":120,"./attributes":209,"./constants":214,"./fillcolor_defaults":216,"./line_defaults":220,"./line_shape_defaults":222,"./marker_defaults":225,"./subtypes":229,"./text_defaults":230,"./xy_defaults":231}],216:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50404,7 +50633,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":25}],215:[function(require,module,exports){ +},{"../../components/color":25}],217:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50457,7 +50686,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":25,"./subtypes":227}],216:[function(require,module,exports){ +},{"../../components/color":25,"./subtypes":229}],218:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50626,7 +50855,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":25,"../../components/errorbars":55,"../../lib":118,"../../plots/cartesian/constants":151,"../../plots/cartesian/graph_interact":153,"./get_trace_color":215}],217:[function(require,module,exports){ +},{"../../components/color":25,"../../components/errorbars":54,"../../lib":120,"../../plots/cartesian/constants":153,"../../plots/cartesian/graph_interact":155,"./get_trace_color":217}],219:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50670,7 +50899,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":154,"./arrays_to_calcdata":206,"./attributes":207,"./calc":208,"./clean_data":209,"./colorbar":210,"./defaults":213,"./hover":216,"./plot":224,"./select":225,"./style":226,"./subtypes":227}],218:[function(require,module,exports){ +},{"../../plots/cartesian":156,"./arrays_to_calcdata":208,"./attributes":209,"./calc":210,"./clean_data":211,"./colorbar":212,"./defaults":215,"./hover":218,"./plot":226,"./select":227,"./style":228,"./subtypes":229}],220:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50703,7 +50932,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce('line.dash'); }; -},{"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":39}],219:[function(require,module,exports){ +},{"../../components/colorscale/defaults":34,"../../components/colorscale/has_colorscale":38}],221:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50715,7 +50944,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, 'use strict'; -var Axes = require('../../plots/cartesian/axes'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function linePoints(d, opts) { @@ -50726,7 +50955,6 @@ module.exports = function linePoints(d, opts) { baseTolerance = opts.baseTolerance, linear = opts.linear, segments = [], - badnum = Axes.BADNUM, minTolerance = 0.2, // fraction of tolerance "so close we don't even consider it a new point" pts = new Array(d.length), pti = 0, @@ -50763,7 +50991,7 @@ module.exports = function linePoints(d, opts) { function getPt(index) { var x = xa.c2p(d[index].x), y = ya.c2p(d[index].y); - if(x === badnum || y === badnum) return false; + if(x === BADNUM || y === BADNUM) return false; return [x, y]; } @@ -50877,7 +51105,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../plots/cartesian/axes":145}],220:[function(require,module,exports){ +},{"../../constants/numerical":105}],222:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50896,7 +51124,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],221:[function(require,module,exports){ +},{}],223:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50937,7 +51165,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],222:[function(require,module,exports){ +},{}],224:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50979,7 +51207,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":11}],223:[function(require,module,exports){ +},{"fast-isnumeric":11}],225:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51039,7 +51267,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":25,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":39,"./subtypes":227}],224:[function(require,module,exports){ +},{"../../components/color":25,"../../components/colorscale/defaults":34,"../../components/colorscale/has_colorscale":38,"./subtypes":229}],226:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51211,6 +51439,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.visible !== true) return; + transition(tr).style('opacity', trace.opacity); + // BUILD LINES AND FILLS var ownFillEl3, tonext; var ownFillDir = trace.fill.charAt(trace.fill.length - 1); @@ -51536,8 +51766,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { var xa = plotinfo.xaxis, ya = plotinfo.yaxis, - xr = d3.extent(xa.range.map(xa.l2c)), - yr = d3.extent(ya.range.map(ya.l2c)); + xr = d3.extent(xa.range.map(xa.r2l).map(xa.l2c)), + yr = d3.extent(ya.range.map(ya.r2l).map(ya.l2c)); var trace = cdscatter[0].trace; if(!subTypes.hasMarkers(trace)) return; @@ -51575,7 +51805,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":49,"../../components/errorbars":55,"../../lib":118,"../../lib/polygon":125,"./arrays_to_calcdata":206,"./line_points":219,"./link_traces":221,"./subtypes":227,"d3":8}],225:[function(require,module,exports){ +},{"../../components/drawing":48,"../../components/errorbars":54,"../../lib":120,"../../lib/polygon":127,"./arrays_to_calcdata":208,"./line_points":221,"./link_traces":223,"./subtypes":229,"d3":8}],227:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51647,7 +51877,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":227}],226:[function(require,module,exports){ +},{"./subtypes":229}],228:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51689,7 +51919,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":49,"../../components/errorbars":55,"d3":8}],227:[function(require,module,exports){ +},{"../../components/drawing":48,"../../components/errorbars":54,"d3":8}],229:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51725,7 +51955,7 @@ module.exports = { } }; -},{"../../lib":118}],228:[function(require,module,exports){ +},{"../../lib":120}],230:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51746,7 +51976,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":118}],229:[function(require,module,exports){ +},{"../../lib":120}],231:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51791,7 +52021,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { return len; }; -},{}],230:[function(require,module,exports){ +},{}],232:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51857,6 +52087,7 @@ module.exports = { sizemin: scatterMarkerAttrs.sizemin, sizemode: scatterMarkerAttrs.sizemode, showscale: scatterMarkerAttrs.showscale, + colorbar: scatterMarkerAttrs.colorbar, line: extendFlat({}, {width: scatterMarkerLineAttrs.width}, colorAttributes('marker.line') @@ -51876,14 +52107,10 @@ module.exports = { hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['lon', 'lat', 'location', 'text', 'name'] - }), - - _nestedModules: { - 'marker.colorbar': 'Colorbar' - } + }) }; -},{"../../components/colorscale/color_attributes":33,"../../lib/extend":114,"../../plots/attributes":143,"../scatter/attributes":207}],231:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":32,"../../lib/extend":115,"../../plots/attributes":146,"../scatter/attributes":209}],233:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51940,7 +52167,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../scatter/colorscale_calc":211,"fast-isnumeric":11}],232:[function(require,module,exports){ +},{"../scatter/colorscale_calc":213,"fast-isnumeric":11}],234:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52020,7 +52247,7 @@ function handleLonLatLocDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":118,"../scatter/fillcolor_defaults":214,"../scatter/line_defaults":218,"../scatter/marker_defaults":223,"../scatter/subtypes":227,"../scatter/text_defaults":228,"./attributes":230}],233:[function(require,module,exports){ +},{"../../lib":120,"../scatter/fillcolor_defaults":216,"../scatter/line_defaults":220,"../scatter/marker_defaults":225,"../scatter/subtypes":229,"../scatter/text_defaults":230,"./attributes":232}],235:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52041,7 +52268,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],234:[function(require,module,exports){ +},{}],236:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52151,7 +52378,7 @@ function getExtraText(trace, pt, axis) { return text.join('
'); } -},{"../../plots/cartesian/axes":145,"../../plots/cartesian/graph_interact":153,"../scatter/get_trace_color":215,"./attributes":230}],235:[function(require,module,exports){ +},{"../../plots/cartesian/axes":148,"../../plots/cartesian/graph_interact":155,"../scatter/get_trace_color":217,"./attributes":232}],237:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52184,7 +52411,7 @@ ScatterGeo.meta = { module.exports = ScatterGeo; -},{"../../plots/geo":170,"../scatter/colorbar":210,"./attributes":230,"./calc":231,"./defaults":232,"./event_data":233,"./hover":234,"./plot":236}],236:[function(require,module,exports){ +},{"../../plots/geo":172,"../scatter/colorbar":212,"./attributes":232,"./calc":233,"./defaults":234,"./event_data":235,"./hover":236,"./plot":238}],238:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52356,5 +52583,5 @@ function style(geo) { }); } -},{"../../components/color":25,"../../components/drawing":49,"../../lib":118,"../../lib/array_to_calc_item":110,"../../lib/geo_location_utils":116,"../../lib/geojson_utils":117,"../../lib/topojson_utils":131,"../scatter/subtypes":227,"d3":8}]},{},[5])(5) +},{"../../components/color":25,"../../components/drawing":48,"../../lib":120,"../../lib/array_to_calc_item":110,"../../lib/geo_location_utils":118,"../../lib/geojson_utils":119,"../../lib/topojson_utils":133,"../scatter/subtypes":229,"d3":8}]},{},[5])(5) }); \ No newline at end of file diff --git a/dist/plotly-geo.min.js b/dist/plotly-geo.min.js index 1b2b3d0958d..59a3626847f 100644 --- a/dist/plotly-geo.min.js +++ b/dist/plotly-geo.min.js @@ -1,27 +1,27 @@ /** -* plotly.js (geo - minified) v1.19.2 +* plotly.js (geo - minified) v1.20.0 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function t(e,n,r){function a(i,l){if(!n[i]){if(!e[i]){var s="function"==typeof require&&require;if(!l&&s)return s(i,!0);if(o)return o(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[i]={exports:{}};e[i][0].call(u.exports,function(t){var n=e[i][1][t];return a(n?n:t)},u,u.exports,t,e,n,r)}return n[i].exports}for(var o="function"==typeof require&&require,i=0;ie?1:t>=e?0:NaN}function o(t){return null===t?NaN:+t}function i(t){return!isNaN(t)}function l(t){return{left:function(e,n,r,a){for(arguments.length<3&&(r=0),arguments.length<4&&(a=e.length);r>>1;t(e[o],n)<0?r=o+1:a=o}return r},right:function(e,n,r,a){for(arguments.length<3&&(r=0),arguments.length<4&&(a=e.length);r>>1;t(e[o],n)>0?a=o:r=o+1}return r}}}function s(t){return t.length}function c(t){for(var e=1;t*e%1;)e*=10;return e}function u(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function f(){this._=Object.create(null)}function d(t){return(t+="")===_i||t[0]===wi?wi+t:t}function h(t){return(t+="")[0]===wi?t.slice(1):t}function p(t){return d(t)in this._}function g(t){return(t=d(t))in this._&&delete this._[t]}function m(){var t=[];for(var e in this._)t.push(h(e));return t}function v(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function x(){this._=Object.create(null)}function b(t){return t}function _(t,e,n){return function(){var r=n.apply(e,arguments);return r===e?t:r}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,r=Mi.length;n=e&&(e=a+1);!(i=l[e])&&++e0&&(t=t.slice(0,l));var c=Pi.get(t);return c&&(t=c,s=Q),l?e?a:r:e?M:o}function W(t,e){return function(n){var r=ui.event;ui.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{ui.event=r}}}function Q(t,e){var n=W(t,e);return function(t){var e=this,r=t.relatedTarget;r&&(r===e||8&r.compareDocumentPosition(e))||n.call(e,t)}}function $(t){var n=".dragsuppress-"+ ++Di,a="click"+n,o=ui.select(r(t)).on("touchmove"+n,T).on("dragstart"+n,T).on("selectstart"+n,T);if(null==Ni&&(Ni=!("onselectstart"in t)&&w(t.style,"userSelect")),Ni){var i=e(t).style,l=i[Ni];i[Ni]="none"}return function(t){if(o.on(n,null),Ni&&(i[Ni]=l),t){var e=function(){o.on(a,null)};o.on(a,function(){T(),e()},!0),setTimeout(e,0)}}}function J(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var a=n.createSVGPoint();if(Ri<0){var o=r(t);if(o.scrollX||o.scrollY){n=ui.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var i=n[0][0].getScreenCTM();Ri=!(i.f||i.e),n.remove()}}return Ri?(a.x=e.pageX,a.y=e.pageY):(a.x=e.clientX,a.y=e.clientY),a=a.matrixTransform(t.getScreenCTM().inverse()),[a.x,a.y]}var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}function K(){return ui.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function nt(t){return t>1?0:t<-1?Fi:Math.acos(t)}function rt(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function at(t){return((t=Math.exp(t))-1/t)/2}function ot(t){return((t=Math.exp(t))+1/t)/2}function it(t){return((t=Math.exp(2*t))-1)/(t+1)}function lt(t){return(t=Math.sin(t/2))*t}function st(){}function ct(t,e,n){return this instanceof ct?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof ct?new ct(t.h,t.s,t.l):Mt(""+t,kt,ct):new ct(t,e,n)}function ut(t,e,n){function r(t){return t>360?t-=360:t<0&&(t+=360),t<60?o+(i-o)*t/60:t<180?i:t<240?o+(i-o)*(240-t)/60:o}function a(t){return Math.round(255*r(t))}var o,i;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=n<0?0:n>1?1:n,i=n<=.5?n*(1+e):n+e-n*e,o=2*n-i,new xt(a(t+120),a(t),a(t-120))}function ft(t,e,n){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof ht?gt(t.l,t.a,t.b):gt((t=At((t=ui.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,n)}function dt(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new ht(n,Math.cos(t*=Vi)*e,Math.sin(t)*e)}function ht(t,e,n){return this instanceof ht?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof ht?new ht(t.l,t.a,t.b):t instanceof ft?dt(t.h,t.c,t.l):At((t=xt(t)).r,t.g,t.b):new ht(t,e,n)}function pt(t,e,n){var r=(t+16)/116,a=r+e/500,o=r-n/200;return a=mt(a)*tl,r=mt(r)*el,o=mt(o)*nl,new xt(yt(3.2404542*a-1.5371385*r-.4985314*o),yt(-.969266*a+1.8760108*r+.041556*o),yt(.0556434*a-.2040259*r+1.0572252*o))}function gt(t,e,n){return t>0?new ft(Math.atan2(n,e)*Ui,Math.sqrt(e*e+n*n),t):new ft(NaN,NaN,t)}function mt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function vt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function xt(t,e,n){return this instanceof xt?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof xt?new xt(t.r,t.g,t.b):Mt(""+t,xt,ut):new xt(t,e,n)}function bt(t){return new xt(t>>16,t>>8&255,255&t)}function _t(t){return bt(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(t,e,n){var r,a,o,i=0,l=0,s=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=r[2].split(","),r[1]){case"hsl":return n(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(Lt(a[0]),Lt(a[1]),Lt(a[2]))}return(o=ol.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(i=(3840&o)>>4,i=i>>4|i,l=240&o,l=l>>4|l,s=15&o,s=s<<4|s):7===t.length&&(i=(16711680&o)>>16,l=(65280&o)>>8,s=255&o)),e(i,l,s))}function kt(t,e,n){var r,a,o=Math.min(t/=255,e/=255,n/=255),i=Math.max(t,e,n),l=i-o,s=(i+o)/2;return l?(a=s<.5?l/(i+o):l/(2-i-o),r=t==i?(e-n)/l+(e0&&s<1?0:r),new ct(r,a,s)}function At(t,e,n){t=Tt(t),e=Tt(e),n=Tt(n);var r=vt((.4124564*t+.3575761*e+.1804375*n)/tl),a=vt((.2126729*t+.7151522*e+.072175*n)/el),o=vt((.0193339*t+.119192*e+.9503041*n)/nl);return ht(116*a-16,500*(r-a),200*(a-o))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Lt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Ct(t){return"function"==typeof t?t:function(){return t}}function St(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),zt(e,n,t,r)}}function zt(t,e,n,r){function a(){var t,e=s.status;if(!e&&Et(s)||e>=200&&e<300||304===e){try{t=n.call(o,s)}catch(t){return void i.error.call(o,t)}i.load.call(o,t)}else i.error.call(o,s)}var o={},i=ui.dispatch("beforesend","progress","load","error"),l={},s=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in s||!/^(http(s)?:)?\/\//.test(t)||(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=a:s.onreadystatechange=function(){s.readyState>3&&a()},s.onprogress=function(t){var e=ui.event;ui.event=t;try{i.progress.call(o,s)}finally{ui.event=e}},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?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return n=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(di(arguments)))}}),o.send=function(n,r,a){if(2===arguments.length&&"function"==typeof r&&(a=r,r=null),s.open(n,t,!0),null==e||"accept"in l||(l.accept=e+",*/*"),s.setRequestHeader)for(var u in l)s.setRequestHeader(u,l[u]);return null!=e&&s.overrideMimeType&&s.overrideMimeType(e),null!=c&&(s.responseType=c),null!=a&&o.on("error",a).on("load",function(t){a(null,t)}),i.beforesend.call(o,s),s.send(null==r?null:r),o},o.abort=function(){return s.abort(),o},ui.rebind(o,i,"on"),null==r?o:o.get(Ot(r))}function Ot(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}function Et(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Pt(t,e,n){var r=arguments.length;r<2&&(e=0),r<3&&(n=Date.now());var a=n+e,o={c:t,t:a,n:null};return ll?ll.n=o:il=o,ll=o,sl||(cl=clearTimeout(cl),sl=1,ul(Nt)),o}function Nt(){var t=Dt(),e=Rt()-t;e>24?(isFinite(e)&&(clearTimeout(cl),cl=setTimeout(Nt,e)),sl=0):(sl=1,ul(Nt))}function Dt(){for(var t=Date.now(),e=il;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Rt(){for(var t,e=il,n=1/0;e;)e.c?(e.t8?function(t){return t/n}:function(t){return t*n},symbol:t}}function Ft(t){var e=t.decimal,n=t.thousands,r=t.grouping,a=t.currency,o=r&&n?function(t,e){for(var a=t.length,o=[],i=0,l=r[0],s=0;a>0&&l>0&&(s+l+1>e&&(l=Math.max(1,e-s)),o.push(t.substring(a-=l,a+l)),!((s+=l+1)>e));)l=r[i=(i+1)%r.length];return o.reverse().join(n)}:b;return function(t){var n=dl.exec(t),r=n[1]||" ",i=n[2]||">",l=n[3]||"-",s=n[4]||"",c=n[5],u=+n[6],f=n[7],d=n[8],h=n[9],p=1,g="",m="",v=!1,y=!0;switch(d&&(d=+d.substring(1)),(c||"0"===r&&"="===i)&&(c=r="0",i="="),h){case"n":f=!0,h="g";break;case"%":p=100,m="%",h="f";break;case"p":p=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===s&&(g="0"+h.toLowerCase());case"c":y=!1;case"d":v=!0,d=0;break;case"s":p=-1,h="r"}"$"===s&&(g=a[0],m=a[1]),"r"!=h||d||(h="g"),null!=d&&("g"==h?d=Math.max(1,Math.min(21,d)):"e"!=h&&"f"!=h||(d=Math.max(0,Math.min(20,d)))),h=hl.get(h)||Bt;var x=c&&f;return function(t){var n=m;if(v&&t%1)return"";var a=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===l?"":l;if(p<0){var s=ui.formatPrefix(t,d);t=s.scale(t),n=s.symbol+m}else t*=p;t=h(t,d);var b,_,w=t.lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(b=t,_=""):(b=t.substring(0,M),_=t.substring(M))}else b=t.substring(0,w),_=e+t.substring(w+1);!c&&f&&(b=o(b,1/0));var k=g.length+b.length+_.length+(x?0:a.length),A=k"===i?A+a+t:"^"===i?A.substring(0,k>>=1)+a+t+A.substring(k):a+(x?t:A+t))+n}}}function Bt(t){return t+""}function qt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ht(t,e,n){function r(e){var n=t(e),r=o(n,1);return e-n1)for(;i=c)return-1;if(a=e.charCodeAt(l++),37===a){if(i=e.charAt(l++),o=S[i in vl?e.charAt(l++):i],!o||(r=o(t,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}function r(t,e,n){w.lastIndex=0;var r=w.exec(e.slice(n));return r?(t.w=M.get(r[0].toLowerCase()),n+r[0].length):-1}function a(t,e,n){b.lastIndex=0;var r=b.exec(e.slice(n));return r?(t.w=_.get(r[0].toLowerCase()),n+r[0].length):-1}function o(t,e,n){T.lastIndex=0;var r=T.exec(e.slice(n));return r?(t.m=L.get(r[0].toLowerCase()),n+r[0].length):-1}function i(t,e,n){k.lastIndex=0;var r=k.exec(e.slice(n));return r?(t.m=A.get(r[0].toLowerCase()),n+r[0].length):-1}function l(t,e,r){return n(t,C.c.toString(),e,r)}function s(t,e,r){return n(t,C.x.toString(),e,r)}function c(t,e,r){return n(t,C.X.toString(),e,r)}function u(t,e,n){var r=x.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)}var f=t.dateTime,d=t.date,h=t.time,p=t.periods,g=t.days,m=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function n(t){try{gl=qt;var e=new gl;return e._=t,r(e)}finally{gl=Date}}var r=e(t);return n.parse=function(t){try{gl=qt;var e=r.parse(t);return e&&e._}finally{gl=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=ue;var x=ui.map(),b=Yt(g),_=Zt(g),w=Yt(m),M=Zt(m),k=Yt(v),A=Zt(v),T=Yt(y),L=Zt(y);p.forEach(function(t,e){x.set(t.toLowerCase(),e)});var C={a:function(t){return m[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(f),d:function(t,e){return Gt(t.getDate(),e,2)},e:function(t,e){return Gt(t.getDate(),e,2)},H:function(t,e){return Gt(t.getHours(),e,2)},I:function(t,e){return Gt(t.getHours()%12||12,e,2)},j:function(t,e){return Gt(1+pl.dayOfYear(t),e,3)},L:function(t,e){return Gt(t.getMilliseconds(),e,3)},m:function(t,e){return Gt(t.getMonth()+1,e,2)},M:function(t,e){return Gt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Gt(t.getSeconds(),e,2)},U:function(t,e){return Gt(pl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(pl.mondayOfYear(t),e,2)},x:e(d),X:e(h),y:function(t,e){return Gt(t.getFullYear()%100,e,2)},Y:function(t,e){return Gt(t.getFullYear()%1e4,e,4)},Z:se,"%":function(){return"%"}},S={a:r,A:a,b:o,B:i,c:l,d:ne,e:ne,H:ae,I:ae,j:re,L:le,m:ee,M:oe,p:u,S:ie,U:Wt,w:Xt,W:Qt,x:s,X:c,y:Jt,Y:$t,Z:Kt,"%":ce};return e}function Gt(t,e,n){var r=t<0?"-":"",a=(r?-t:t)+"",o=a.length;return r+(o68?1900:2e3)}function ee(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ne(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function re(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function ae(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function oe(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ie(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function le(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function se(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=bi(e)/60|0,a=bi(e)%60;return n+Gt(r,"0",2)+Gt(a,"0",2)}function ce(t,e,n){xl.lastIndex=0;var r=xl.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function ue(t){for(var e=t.length,n=-1;++n=0?1:-1,l=i*n,s=Math.cos(e),c=Math.sin(e),u=o*c,f=a*s+u*Math.cos(l),d=u*i*Math.sin(l);Al.add(Math.atan2(d,f)),r=t,a=s,o=c}var e,n,r,a,o;Tl.point=function(i,l){Tl.point=t,r=(e=i)*Vi,a=Math.cos(l=(n=l)*Vi/2+Fi/4),o=Math.sin(l)},Tl.lineEnd=function(){t(e,n)}}function ve(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 be(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Me(t){return[Math.atan2(t[1],t[0]),rt(t[2])]}function ke(t,e){return bi(t[0]-e[0])=0;--l)a.point((f=u[l])[0],f[1])}else r(h.x,h.p.x,-1,a);h=h.p}h=h.o,u=h.z,p=!p}while(!h.v);a.lineEnd()}}}function Pe(t){if(e=t.length){for(var e,n,r=0,a=t[0];++r0){for(_||(o.polygonStart(),_=!0),o.lineStart();++i1&&2&e&&n.push(n.pop().concat(n.shift())),h.push(n.filter(Re))}var h,p,g,m=e(o),v=a.invert(r[0],r[1]),y={point:i,lineStart:s,lineEnd:c,polygonStart:function(){y.point=u,y.lineStart=f,y.lineEnd=d,h=[],p=[]},polygonEnd:function(){y.point=i,y.lineStart=s,y.lineEnd=c,h=ui.merge(h);var t=He(v,p);h.length?(_||(o.polygonStart(),_=!0),Ee(h,Ie,t,n,o)):t&&(_||(o.polygonStart(),_=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),_&&(o.polygonEnd(),_=!1),h=p=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}},x=je(),b=e(x),_=!1;return y}}function Re(t){return t.length>1}function je(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:M,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Ie(t,e){return((t=t.x)[0]<0?t[1]-Hi-ji:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-ji:Hi-e[1])}function Fe(t){var e,n=NaN,r=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,i){var l=o>0?Fi:-Fi,s=bi(o-n);bi(s-Fi)0?Hi:-Hi),t.point(a,r),t.lineEnd(),t.lineStart(),t.point(l,r),t.point(o,r),e=0):a!==l&&s>=Fi&&(bi(n-a)ji?Math.atan((Math.sin(e)*(o=Math.cos(r))*Math.sin(n)-Math.sin(r)*(a=Math.cos(e))*Math.sin(t))/(a*o*i)):(e+r)/2}function qe(t,e,n,r){var a;if(null==t)a=n*Hi,r.point(-Fi,a),r.point(0,a),r.point(Fi,a),r.point(Fi,0),r.point(Fi,-a),r.point(0,-a),r.point(-Fi,-a),r.point(-Fi,0),r.point(-Fi,a);else if(bi(t[0]-e[0])>ji){var o=t[0]=0?1:-1,M=w*_,k=M>Fi,A=p*x;if(Al.add(Math.atan2(A*w*Math.sin(M),g*b+A*Math.cos(M))),o+=k?_+w*Bi:_,k^d>=n^v>=n){var T=xe(ve(f),ve(t));we(T);var L=xe(a,T);we(L);var C=(k^_>=0?-1:1)*rt(L[2]);(r>C||r===C&&(T[0]||T[1]))&&(i+=k^_>=0?1:-1)}if(!m++)break;d=v,p=x,g=b,f=t}}return(o<-ji||oo}function n(t){var n,o,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var h,p=[f,d],g=e(f,d),m=i?g?0:a(f,d):g?a(f+(f<0?Fi:-Fi),d):0;if(!n&&(c=s=g)&&t.lineStart(),g!==s&&(h=r(n,p),(ke(n,h)||ke(p,h))&&(p[0]+=ji,p[1]+=ji,g=e(p[0],p[1]))),g!==s)u=0,g?(t.lineStart(),h=r(p,n),t.point(h[0],h[1])):(h=r(n,p),t.point(h[0],h[1]),t.lineEnd()),n=h;else if(l&&n&&i^g){var v;m&o||!(v=r(p,n,!0))||(u=0,i?(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||n&&ke(n,p)||t.point(p[0],p[1]),n=p,s=g,o=m},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return u|(c&&s)<<1}}}function r(t,e,n){var r=ve(t),a=ve(e),i=[1,0,0],l=xe(r,a),s=ye(l,l),c=l[0],u=s-c*c;if(!u)return!n&&t;var f=o*s/u,d=-o*c/u,h=xe(i,l),p=_e(i,f),g=_e(l,d);be(p,g);var m=h,v=ye(p,m),y=ye(m,m),x=v*v-y*(ye(p,p)-1);if(!(x<0)){var b=Math.sqrt(x),_=_e(m,(-v-b)/y);if(be(_,p),_=Me(_),!n)return _;var w,M=t[0],k=e[0],A=t[1],T=e[1];k0^_[1]<(bi(_[0]-M)Fi^(M<=_[0]&&_[0]<=k)){var z=_e(m,(-v+b)/y);return be(z,p),[_,Me(z)]}}}function a(e,n){var r=i?t:Fi-t,a=0;return e<-r?a|=1:e>r&&(a|=2),n<-r?a|=4:n>r&&(a|=8),a}var o=Math.cos(t),i=o>0,l=bi(o)>ji,s=vn(t,6*Vi);return De(e,n,s,i?[0,-t]:[-Fi,t-Fi])}function Ue(t,e,n,r){return function(a){var o,i=a.a,l=a.b,s=i.x,c=i.y,u=l.x,f=l.y,d=0,h=1,p=u-s,g=f-c;if(o=t-s,p||!(o>0)){if(o/=p,p<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=n-s,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>d&&(d=o)}else if(p>0){if(o0)){if(o/=g,g<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=r-c,g||!(o<0)){if(o/=g,g<0){if(o>h)return;o>d&&(d=o)}else if(g>0){if(o0&&(a.a={x:s+d*p,y:c+d*g}),h<1&&(a.b={x:s+h*p,y:c+h*g}),a}}}}}}function Ge(t,e,n,r){function a(r,a){return bi(r[0]-t)0?0:3:bi(r[0]-n)0?2:1:bi(r[1]-e)0?1:0:a>0?3:2}function o(t,e){return i(t.x,e.x)}function i(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(l){function s(t){for(var e=0,n=m.length,r=t[1],a=0;ar&&et(c,o,t)>0&&++e:o[1]<=r&&et(c,o,t)<0&&--e,c=o;return 0!==e}function c(o,l,s,c){var u=0,f=0;if(null==o||(u=a(o,s))!==(f=a(l,s))||i(o,l)<0^s>0){do c.point(0===u||3===u?t:n,u>1?r:e);while((u=(u+s+4)%4)!==f)}else c.point(l[0],l[1])}function u(a,o){return t<=a&&a<=n&&e<=o&&o<=r}function f(t,e){u(t,e)&&l.point(t,e)}function d(){S.point=p,m&&m.push(v=[]),k=!0,M=!1,_=w=NaN}function h(){g&&(p(y,x),b&&M&&L.rejoin(),g.push(L.buffer())),S.point=f,M&&l.lineEnd()}function p(t,e){t=Math.max(-Bl,Math.min(Bl,t)),e=Math.max(-Bl,Math.min(Bl,e));var n=u(t,e);if(m&&v.push([t,e]),k)y=t,x=e,b=n,k=!1,n&&(l.lineStart(),l.point(t,e));else if(n&&M)l.point(t,e);else{var r={a:{x:_,y:w},b:{x:t,y:e}};C(r)?(M||(l.lineStart(),l.point(r.a.x,r.a.y)),l.point(r.b.x,r.b.y),n||l.lineEnd(),A=!1):n&&(l.lineStart(),l.point(t,e),A=!1)}_=t,w=e,M=n}var g,m,v,y,x,b,_,w,M,k,A,T=l,L=je(),C=Ue(t,e,n,r),S={point:f,lineStart:d,lineEnd:h,polygonStart:function(){l=L,g=[],m=[],A=!0},polygonEnd:function(){l=T,g=ui.merge(g);var e=s([t,r]),n=A&&e,a=g.length;(n||a)&&(l.polygonStart(),n&&(l.lineStart(),c(null,null,1,l),l.lineEnd()),a&&Ee(g,o,e,c,l),l.polygonEnd()),g=m=v=null}};return S}}function Ye(t){var e=0,n=Fi/3,r=cn(t),a=r(e,n);return a.parallels=function(t){return arguments.length?r(e=t[0]*Fi/180,n=t[1]*Fi/180):[e/Fi*180,n/Fi*180]},a}function Ze(t,e){function n(t,e){var n=Math.sqrt(o-2*a*Math.sin(e))/a;return[n*Math.sin(t*=a),i-n*Math.cos(t)]}var r=Math.sin(t),a=(r+Math.sin(e))/2,o=1+r*(2*a-r),i=Math.sqrt(o)/a;return n.invert=function(t,e){var n=i-e;return[Math.atan2(t,n)/a,rt((o-(t*t+n*n)*a*a)/(2*a))]},n}function Xe(){function t(t,e){Hl+=a*t-r*e,r=t,a=e}var e,n,r,a;Zl.point=function(o,i){Zl.point=t,e=r=o,n=a=i},Zl.lineEnd=function(){t(e,n)}}function We(t,e){tGl&&(Gl=t),eYl&&(Yl=e)}function Qe(){function t(t,e){i.push("M",t,",",e,o)}function e(t,e){i.push("M",t,",",e),l.point=n}function n(t,e){i.push("L",t,",",e)}function r(){l.point=t}function a(){i.push("Z")}var o=$e(4.5),i=[],l={point:t,lineStart:function(){l.point=e},lineEnd:r,polygonStart:function(){l.lineEnd=a},polygonEnd:function(){l.lineEnd=r,l.point=t},pointRadius:function(t){return o=$e(t),l},result:function(){if(i.length){var t=i.join("");return i=[],t}}};return l}function $e(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Je(t,e){Sl+=t,zl+=e,++Ol}function Ke(){function t(t,r){var a=t-e,o=r-n,i=Math.sqrt(a*a+o*o);El+=i*(e+t)/2,Pl+=i*(n+r)/2,Nl+=i,Je(e=t,n=r)}var e,n;Wl.point=function(r,a){Wl.point=t,Je(e=r,n=a)}}function tn(){Wl.point=Je}function en(){function t(t,e){var n=t-r,o=e-a,i=Math.sqrt(n*n+o*o);El+=i*(r+t)/2,Pl+=i*(a+e)/2,Nl+=i,i=a*t-r*e,Dl+=i*(r+t),Rl+=i*(a+e),jl+=3*i,Je(r=t,a=e)}var e,n,r,a;Wl.point=function(o,i){Wl.point=t,Je(e=r=o,n=a=i)},Wl.lineEnd=function(){t(e,n)}}function nn(t){function e(e,n){t.moveTo(e+i,n),t.arc(e,n,i,0,Bi)}function n(e,n){t.moveTo(e,n),l.point=r}function r(e,n){t.lineTo(e,n)}function a(){l.point=e}function o(){t.closePath()}var i=4.5,l={point:e,lineStart:function(){l.point=n},lineEnd:a,polygonStart:function(){l.lineEnd=o},polygonEnd:function(){l.lineEnd=a,l.point=e},pointRadius:function(t){return i=t,l},result:M};return l}function rn(t){function e(t){return(l?r:n)(t)}function n(e){return ln(e,function(n,r){n=t(n,r),e.point(n[0],n[1])})}function r(e){function n(n,r){n=t(n,r),e.point(n[0],n[1])}function r(){x=NaN,k.point=o,e.lineStart()}function o(n,r){var o=ve([n,r]),i=t(n,r);a(x,b,y,_,w,M,x=i[0],b=i[1],y=n,_=o[0],w=o[1],M=o[2],l,e),e.point(x,b)}function i(){k.point=n,e.lineEnd()}function s(){r(),k.point=c,k.lineEnd=u}function c(t,e){o(f=t,d=e),h=x,p=b,g=_,m=w,v=M,k.point=o}function u(){a(x,b,y,_,w,M,h,p,f,g,m,v,l,e),k.lineEnd=i,i()}var f,d,h,p,g,m,v,y,x,b,_,w,M,k={point:n,lineStart:r,lineEnd:i,polygonStart:function(){e.polygonStart(),k.lineStart=s},polygonEnd:function(){e.polygonEnd(),k.lineStart=r}};return k}function a(e,n,r,l,s,c,u,f,d,h,p,g,m,v){var y=u-e,x=f-n,b=y*y+x*x;if(b>4*o&&m--){var _=l+h,w=s+p,M=c+g,k=Math.sqrt(_*_+w*w+M*M),A=Math.asin(M/=k),T=bi(bi(M)-1)o||bi((y*z+x*O)/b-.5)>.3||l*h+s*p+c*g0&&16,e):Math.sqrt(o)},e}function an(t){var e=rn(function(e,n){return t([e*Ui,n*Ui])});return function(t){return un(e(t))}}function on(t){this.stream=t}function ln(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 sn(t){return cn(function(){return t})()}function cn(t){function e(t){return t=l(t[0]*Vi,t[1]*Vi),[t[0]*d+s,c-t[1]*d]}function n(t){return t=l.invert((t[0]-s)/d,(c-t[1])/d),t&&[t[0]*Ui,t[1]*Ui]}function r(){l=ze(i=hn(v,y,x),o);var t=o(g,m);return s=h-t[0]*d,c=p+t[1]*d,a()}function a(){return u&&(u.valid=!1,u=null),e}var o,i,l,s,c,u,f=rn(function(t,e){return t=o(t,e),[t[0]*d+s,c-t[1]*d]}),d=150,h=480,p=250,g=0,m=0,v=0,y=0,x=0,_=Fl,w=b,M=null,k=null;return e.stream=function(t){return u&&(u.valid=!1),u=un(_(i,f(w(t)))),u.valid=!0,u},e.clipAngle=function(t){return arguments.length?(_=null==t?(M=t,Fl):Ve((M=+t)*Vi),a()):M},e.clipExtent=function(t){return arguments.length?(k=t,w=t?Ge(t[0][0],t[0][1],t[1][0],t[1][1]):b,a()):k},e.scale=function(t){return arguments.length?(d=+t,r()):d},e.translate=function(t){return arguments.length?(h=+t[0],p=+t[1],r()):[h,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Vi,m=t[1]%360*Vi,r()):[g*Ui,m*Ui]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Vi,y=t[1]%360*Vi,x=t.length>2?t[2]%360*Vi:0,r()):[v*Ui,y*Ui,x*Ui]},ui.rebind(e,f,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&n,r()}}function un(t){return ln(t,function(e,n){t.point(e*Vi,n*Vi)})}function fn(t,e){return[t,e]}function dn(t,e){return[t>Fi?t-Bi:t<-Fi?t+Bi:t,e]}function hn(t,e,n){return t?e||n?ze(gn(t),mn(e,n)):gn(t):e||n?mn(e,n):dn}function pn(t){return function(e,n){return e+=t,[e>Fi?e-Bi:e<-Fi?e+Bi:e,n]}}function gn(t){var e=pn(t);return e.invert=pn(-t),e}function mn(t,e){function n(t,e){var n=Math.cos(e),l=Math.cos(t)*n,s=Math.sin(t)*n,c=Math.sin(e),u=c*r+l*a;return[Math.atan2(s*o-u*i,l*r-c*a),rt(u*o+s*i)]}var r=Math.cos(t),a=Math.sin(t),o=Math.cos(e),i=Math.sin(e);return n.invert=function(t,e){var n=Math.cos(e),l=Math.cos(t)*n,s=Math.sin(t)*n,c=Math.sin(e),u=c*o-s*i;return[Math.atan2(s*o+c*i,l*r+u*a),rt(u*r-l*a)]},n}function vn(t,e){var n=Math.cos(t),r=Math.sin(t);return function(a,o,i,l){var s=i*e;null!=a?(a=yn(n,a),o=yn(n,o),(i>0?ao)&&(a+=i*Bi)):(a=t+i*Bi,o=t-.5*s);for(var c,u=a;i>0?u>o:u0?e<-Hi+ji&&(e=-Hi+ji):e>Hi-ji&&(e=Hi-ji);var n=i/Math.pow(a(e),o);return[n*Math.sin(o*t),i-n*Math.cos(o*t)]}var r=Math.cos(t),a=function(t){return Math.tan(Fi/4+t/2)},o=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(a(e)/a(t)),i=r*Math.pow(a(t),o)/o;return o?(n.invert=function(t,e){var n=i-e,r=tt(o)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/o,2*Math.atan(Math.pow(i/r,1/o))-Hi]},n):Cn}function Ln(t,e){function n(t,e){var n=o-e;return[n*Math.sin(a*t),o-n*Math.cos(a*t)]}var r=Math.cos(t),a=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),o=r/a+t;return bi(a)1&&et(t[n[r-2]],t[n[r-1]],t[a])<=0;)--r;n[r++]=a}return n.slice(0,r)}function Nn(t,e){return t[0]-e[0]||t[1]-e[1]}function Dn(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function Rn(t,e,n,r){var a=t[0],o=n[0],i=e[0]-a,l=r[0]-o,s=t[1],c=n[1],u=e[1]-s,f=r[1]-c,d=(l*(s-c)-f*(a-o))/(f*i-l*u);return[a+d*i,s+d*u]}function jn(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function In(){or(this),this.edge=this.site=this.circle=null}function Fn(t){var e=cs.pop()||new In;return e.site=t,e}function Bn(t){Qn(t),is.remove(t),cs.push(t),or(t)}function qn(t){var e=t.circle,n=e.x,r=e.cy,a={x:n,y:r},o=t.P,i=t.N,l=[t];Bn(t);for(var s=o;s.circle&&bi(n-s.circle.x)ji)l=l.L;else{if(a=o-Un(l,i),!(a>ji)){r>-ji?(e=l.P,n=l):a>-ji?(e=l,n=l.N):e=n=l;break}if(!l.R){e=l;break}l=l.R}var s=Fn(t);if(is.insert(e,s),e||n){if(e===n)return Qn(e),n=Fn(e.site),is.insert(s,n),s.edge=n.edge=tr(e.site,s.site),Wn(e),void Wn(n);if(!n)return void(s.edge=tr(e.site,s.site));Qn(e),Qn(n);var c=e.site,u=c.x,f=c.y,d=t.x-u,h=t.y-f,p=n.site,g=p.x-u,m=p.y-f,v=2*(d*m-h*g),y=d*d+h*h,x=g*g+m*m,b={x:(m*y-h*x)/v+u,y:(d*x-g*y)/v+f};nr(n.edge,c,p,b),s.edge=tr(c,t,null,b),n.edge=tr(t,p,null,b),Wn(e),Wn(n)}}function Vn(t,e){var n=t.site,r=n.x,a=n.y,o=a-e;if(!o)return r;var i=t.P;if(!i)return-(1/0);n=i.site;var l=n.x,s=n.y,c=s-e;if(!c)return l;var u=l-r,f=1/o-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-o/2)))/f+r:(r+l)/2}function Un(t,e){var n=t.N;if(n)return Vn(n,e);var r=t.site;return r.y===e?r.x:1/0}function Gn(t){this.site=t,this.edges=[]}function Yn(t){for(var e,n,r,a,o,i,l,s,c,u,f=t[0][0],d=t[1][0],h=t[0][1],p=t[1][1],g=os,m=g.length;m--;)if(o=g[m],o&&o.prepare())for(l=o.edges,s=l.length,i=0;iji||bi(a-n)>ji)&&(l.splice(i,0,new rr(er(o.site,u,bi(r-f)ji?{x:f,y:bi(e-f)ji?{x:bi(n-p)ji?{x:d,y:bi(e-d)ji?{x:bi(n-h)=-Ii)){var h=s*s+c*c,p=u*u+f*f,g=(f*h-c*p)/d,m=(s*p-u*h)/d,f=m+l,v=us.pop()||new Xn;v.arc=t,v.site=a,v.x=g+i,v.y=f+Math.sqrt(g*g+m*m),v.cy=f,t.circle=v;for(var y=null,x=ss._;x;)if(v.y=l)return;if(d>p){if(o){if(o.y>=c)return}else o={x:m,y:s};n={x:m,y:c}}else{if(o){if(o.y1)if(d>p){if(o){if(o.y>=c)return}else o={x:(s-a)/r,y:s};n={x:(c-a)/r,y:c}}else{if(o){if(o.y=l)return}else o={x:i,y:r*i+a};n={x:l,y:r*l+a}}else{if(o){if(o.xo||f>i||d=b,M=n>=_,k=M<<1|w,A=k+4;ko&&(a=e.slice(o,a),l[i]?l[i]+=a:l[++i]=a),(n=n[0])===(r=r[0])?l[i]?l[i]+=r:l[++i]=r:(l[++i]=null,s.push({i:i,x:xr(n,r)})),o=hs.lastIndex;return o=0&&!(n=ui.interpolators[r](t,e)););return n}function wr(t,e){var n,r=[],a=[],o=t.length,i=e.length,l=Math.min(t.length,e.length);for(n=0;n=1?1:t(e)}}function kr(t){return function(e){return 1-t(1-e)}}function Ar(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tr(t){return t*t}function Lr(t){return t*t*t}function Cr(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function Sr(t){return function(e){return Math.pow(e,t)}}function zr(t){return 1-Math.cos(t*Hi)}function Or(t){return Math.pow(2,10*(t-1)); -}function Er(t){return 1-Math.sqrt(1-t*t)}function Pr(t,e){var n;return arguments.length<2&&(e=.45),arguments.length?n=e/Bi*Math.asin(1/t):(t=1,n=e/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-n)*Bi/e)}}function Nr(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Dr(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 Rr(t,e){t=ui.hcl(t),e=ui.hcl(e);var n=t.h,r=t.c,a=t.l,o=e.h-n,i=e.c-r,l=e.l-a;return isNaN(i)&&(i=0,r=isNaN(r)?e.c:r),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360),function(t){return dt(n+o*t,r+i*t,a+l*t)+""}}function jr(t,e){t=ui.hsl(t),e=ui.hsl(e);var n=t.h,r=t.s,a=t.l,o=e.h-n,i=e.s-r,l=e.l-a;return isNaN(i)&&(i=0,r=isNaN(r)?e.s:r),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360),function(t){return ut(n+o*t,r+i*t,a+l*t)+""}}function Ir(t,e){t=ui.lab(t),e=ui.lab(e);var n=t.l,r=t.a,a=t.b,o=e.l-n,i=e.a-r,l=e.b-a;return function(t){return pt(n+o*t,r+i*t,a+l*t)+""}}function Fr(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function Br(t){var e=[t.a,t.b],n=[t.c,t.d],r=Hr(e),a=qr(e,n),o=Hr(Vr(n,e,-a))||0;e[0]*n[1]180?e+=360:e-t>180&&(t+=360),r.push({i:n.push(Ur(n)+"rotate(",null,")")-2,x:xr(t,e)})):e&&n.push(Ur(n)+"rotate("+e+")")}function Zr(t,e,n,r){t!==e?r.push({i:n.push(Ur(n)+"skewX(",null,")")-2,x:xr(t,e)}):e&&n.push(Ur(n)+"skewX("+e+")")}function Xr(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var a=n.push(Ur(n)+"scale(",null,",",null,")");r.push({i:a-4,x:xr(t[0],e[0])},{i:a-2,x:xr(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(Ur(n)+"scale("+e+")")}function Wr(t,e){var n=[],r=[];return t=ui.transform(t),e=ui.transform(e),Gr(t.translate,e.translate,n,r),Yr(t.rotate,e.rotate,n,r),Zr(t.skew,e.skew,n,r),Xr(t.scale,e.scale,n,r),t=e=null,function(t){for(var e,a=-1,o=r.length;++a=0;)n.push(a[r])}function sa(t,e){for(var n=[t],r=[];null!=(t=n.pop());)if(r.push(t),(o=t.children)&&(a=o.length))for(var a,o,i=-1;++ia&&(r=n,a=e);return r}function xa(t){return t.reduce(ba,0)}function ba(t,e){return t+e[1]}function _a(t,e){return wa(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wa(t,e){for(var n=-1,r=+t[0],a=(t[1]-r)/e,o=[];++n<=e;)o[n]=a*n+r;return o}function Ma(t){return[ui.min(t),ui.max(t)]}function ka(t,e){return t.value-e.value}function Aa(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Ta(t,e){t._pack_next=e,e._pack_prev=t}function La(t,e){var n=e.x-t.x,r=e.y-t.y,a=t.r+e.r;return.999*a*a>n*n+r*r}function Ca(t){function e(t){u=Math.min(t.x-t.r,u),f=Math.max(t.x+t.r,f),d=Math.min(t.y-t.r,d),h=Math.max(t.y+t.r,h)}if((n=t.children)&&(c=n.length)){var n,r,a,o,i,l,s,c,u=1/0,f=-(1/0),d=1/0,h=-(1/0);if(n.forEach(Sa),r=n[0],r.x=-r.r,r.y=0,e(r),c>1&&(a=n[1],a.x=a.r,a.y=0,e(a),c>2))for(o=n[2],Ea(r,a,o),e(o),Aa(r,o),r._pack_prev=o,Aa(o,a),a=r._pack_next,i=3;i=0;)e=a[o],e.z+=n,e.m+=n,n+=e.s+(r+=e.c)}function Ia(t,e,n){return t.a.parent===e.parent?t.a:n}function Fa(t){return 1+ui.max(t,function(t){return t.y})}function Ba(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function qa(t){var e=t.children;return e&&e.length?qa(e[0]):t}function Ha(t){var e,n=t.children;return n&&(e=n.length)?Ha(n[e-1]):t}function Va(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Ua(t,e){var n=t.x+e[3],r=t.y+e[0],a=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return a<0&&(n+=a/2,a=0),o<0&&(r+=o/2,o=0),{x:n,y:r,dx:a,dy:o}}function Ga(t){var e=t[0],n=t[t.length-1];return e2?Qa:Za,s=r?$r:Qr;return i=a(t,e,s,n),l=a(e,t,s,_r),o}function o(t){return i(t)}var i,l;return o.invert=function(t){return l(t)},o.domain=function(e){return arguments.length?(t=e.map(Number),a()):t},o.range=function(t){return arguments.length?(e=t,a()):e},o.rangeRound=function(t){return o.range(t).interpolate(Fr)},o.clamp=function(t){return arguments.length?(r=t,a()):r},o.interpolate=function(t){return arguments.length?(n=t,a()):n},o.ticks=function(e){return eo(t,e)},o.tickFormat=function(e,n){return no(t,e,n)},o.nice=function(e){return Ka(t,e),a()},o.copy=function(){return $a(t,e,n,r)},a()}function Ja(t,e){return ui.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ka(t,e){return Xa(t,Wa(to(t,e)[2])),Xa(t,Wa(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var n=Ga(t),r=n[1]-n[0],a=Math.pow(10,Math.floor(Math.log(r/e)/Math.LN10)),o=e/r*a;return o<=.15?a*=10:o<=.35?a*=5:o<=.75&&(a*=2),n[0]=Math.ceil(n[0]/a)*a,n[1]=Math.floor(n[1]/a)*a+.5*a,n[2]=a,n}function eo(t,e){return ui.range.apply(ui,to(t,e))}function no(t,e,n){var r=to(t,e);if(n){var a=dl.exec(n);if(a.shift(),"s"===a[8]){var o=ui.formatPrefix(Math.max(bi(r[0]),bi(r[1])));return a[7]||(a[7]="."+ro(o.scale(r[2]))),a[8]="f",n=ui.format(a.join("")),function(t){return n(o.scale(t))+o.symbol}}a[7]||(a[7]="."+ao(a[8],r)),n=a.join("")}else n=",."+ro(r[2])+"f";return ui.format(n)}function ro(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ao(t,e){var n=ro(e[2]);return t in As?Math.abs(n-ro(Math.max(bi(e[0]),bi(e[1]))))+ +("e"!==t):n-2*("%"===t)}function oo(t,e,n,r){function a(t){return(n?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return n?Math.pow(e,t):-Math.pow(e,-t)}function i(e){return t(a(e))}return i.invert=function(e){return o(t.invert(e))},i.domain=function(e){return arguments.length?(n=e[0]>=0,t.domain((r=e.map(Number)).map(a)),i):r},i.base=function(n){return arguments.length?(e=+n,t.domain(r.map(a)),i):e},i.nice=function(){var e=Xa(r.map(a),n?Math:Ls);return t.domain(e),r=e.map(o),i},i.ticks=function(){var t=Ga(r),i=[],l=t[0],s=t[1],c=Math.floor(a(l)),u=Math.ceil(a(s)),f=e%1?2:e;if(isFinite(u-c)){if(n){for(;c0;d--)i.push(o(c)*d);for(c=0;i[c]s;u--);i=i.slice(c,u)}return i},i.tickFormat=function(t,n){if(!arguments.length)return Ts;arguments.length<2?n=Ts:"function"!=typeof n&&(n=ui.format(n));var r=Math.max(1,e*t/i.ticks().length);return function(t){var i=t/o(Math.round(a(t)));return i*e0?l[n-1]:t[0],n0?0:1}function _o(t,e,n,r,a){var o=t[0]-e[0],i=t[1]-e[1],l=(a?r:-r)/Math.sqrt(o*o+i*i),s=l*i,c=-l*o,u=t[0]+s,f=t[1]+c,d=e[0]+s,h=e[1]+c,p=(u+d)/2,g=(f+h)/2,m=d-u,v=h-f,y=m*m+v*v,x=n-r,b=u*h-d*f,_=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*v-m*_)/y,M=(-b*m-v*_)/y,k=(b*v+m*_)/y,A=(-b*m+v*_)/y,T=w-p,L=M-g,C=k-p,S=A-g;return T*T+L*L>C*C+S*S&&(w=k,M=A),[[w-s,M-c],[w*n/x,M*n/x]]}function wo(t){function e(e){function i(){c.push("M",o(t(u),l))}for(var s,c=[],u=[],f=-1,d=e.length,h=Ct(n),p=Ct(r);++f1?t.join("L"):t+"Z"}function ko(t){return t.join("L")+"Z"}function Ao(t){for(var e=0,n=t.length,r=t[0],a=[r[0],",",r[1]];++e1&&a.push("H",r[0]),a.join("")}function To(t){for(var e=0,n=t.length,r=t[0],a=[r[0],",",r[1]];++e1){l=e[1],o=t[s],s++,r+="C"+(a[0]+i[0])+","+(a[1]+i[1])+","+(o[0]-l[0])+","+(o[1]-l[1])+","+o[0]+","+o[1];for(var c=2;c9&&(a=3*e/Math.sqrt(a),i[l]=a*n,i[l+1]=a*r));for(l=-1;++l<=s;)a=(t[Math.min(s,l+1)][0]-t[Math.max(0,l-1)][0])/(6*(1+i[l]*i[l])),o.push([a||0,i[l]*a||0]);return o}function Ho(t){return t.length<3?Mo(t):t[0]+Oo(t,qo(t))}function Vo(t){for(var e,n,r,a=-1,o=t.length;++a0;)h[--l].call(t,i);if(o>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[r]:delete t[n],1}var s,c,u,d,h,p=t[n]||(t[n]={active:0,count:0}),g=p[r];g||(s=a.time,c=Pt(o,0,s),g=p[r]={tween:new f,time:s,timer:c,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++p.count)}function ri(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate("+(isFinite(r)?r:n(t))+",0)"})}function ai(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate(0,"+(isFinite(r)?r:n(t))+")"})}function oi(t){return t.toISOString()}function ii(t,e,n){function r(e){return t(e)}function a(t,n){var r=t[1]-t[0],a=r/n,o=ui.bisect(Js,a);return o==Js.length?[e.year,to(t.map(function(t){return t/31536e6}),n)[2]]:o?e[a/Js[o-1]1?{floor:function(e){for(;n(e=t.floor(e));)e=li(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=li(+e+1);return e}}:t))},r.ticks=function(t,e){var n=Ga(r.domain()),o=null==t?a(n,10):"number"==typeof t?a(n,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(n[0],li(+n[1]+1),e<1?1:e)},r.tickFormat=function(){return n},r.copy=function(){return ii(t.copy(),e,n)},Ja(r,t)}function li(t){return new Date(t)}function si(t){return JSON.parse(t.responseText)}function ci(t){var e=hi.createRange();return e.selectNode(hi.body),e.createContextualFragment(t.responseText)}var ui={version:"3.5.17"},fi=[].slice,di=function(t){return fi.call(t)},hi=this.document;if(hi)try{di(hi.documentElement.childNodes)[0].nodeType}catch(t){di=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),hi)try{hi.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var pi=this.Element.prototype,gi=pi.setAttribute,mi=pi.setAttributeNS,vi=this.CSSStyleDeclaration.prototype,yi=vi.setProperty;pi.setAttribute=function(t,e){gi.call(this,t,e+"")},pi.setAttributeNS=function(t,e,n){mi.call(this,t,e,n+"")},vi.setProperty=function(t,e,n){yi.call(this,t,e+"",n)}}ui.ascending=a,ui.descending=function(t,e){return et?1:e>=t?0:NaN},ui.min=function(t,e){var n,r,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=r;break}for(;++ar&&(n=r)}else{for(;++a=r){n=r;break}for(;++ar&&(n=r)}return n},ui.max=function(t,e){var n,r,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=r;break}for(;++an&&(n=r)}else{for(;++a=r){n=r;break}for(;++an&&(n=r)}return n},ui.extent=function(t,e){var n,r,a,o=-1,i=t.length;if(1===arguments.length){for(;++o=r){n=a=r;break}for(;++or&&(n=r),a=r){n=a=r;break}for(;++or&&(n=r),a1)return s/(u-1)},ui.deviation=function(){var t=ui.variance.apply(this,arguments);return t?Math.sqrt(t):t};var xi=l(a);ui.bisectLeft=xi.left,ui.bisect=ui.bisectRight=xi.right,ui.bisector=function(t){return l(1===t.length?function(e,n){return a(t(e),n)}:t)},ui.shuffle=function(t,e,n){(o=arguments.length)<3&&(n=t.length,o<2&&(e=0));for(var r,a,o=n-e;o;)a=Math.random()*o--|0,r=t[o+e],t[o+e]=t[a+e],t[a+e]=r;return t},ui.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r},ui.pairs=function(t){for(var e,n=0,r=t.length-1,a=t[0],o=new Array(r<0?0:r);n=0;)for(r=t[a],e=r.length;--e>=0;)n[--i]=r[e];return n};var bi=Math.abs;ui.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n===1/0)throw new Error("infinite range");var r,a=[],o=c(bi(n)),i=-1;if(t*=o,e*=o,n*=o,n<0)for(;(r=t+n*++i)>e;)a.push(r/o);else for(;(r=t+n*++i)=o.length)return r?r.call(a,i):n?i.sort(n):i;for(var s,c,u,d,h=-1,p=i.length,g=o[l++],m=new f;++h=o.length)return t;var r=[],a=i[n++];return t.forEach(function(t,a){r.push({key:t,values:e(a,n)})}),a?r.sort(function(t,e){return a(t.key,e.key)}):r}var n,r,a={},o=[],i=[];return a.map=function(e,n){return t(n,e,0)},a.entries=function(n){return e(t(ui.map,n,0),0)},a.key=function(t){return o.push(t),a},a.sortKeys=function(t){return i[o.length-1]=t,a},a.sortValues=function(t){return n=t,a},a.rollup=function(t){return r=t,a},a},ui.set=function(t){var e=new x;if(t)for(var n=0,r=t.length;n=0&&(r=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},ui.event=null,ui.requote=function(t){return t.replace(ki,"\\$&")};var ki=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ai={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},Ti=function(t,e){return e.querySelector(t)},Li=function(t,e){return e.querySelectorAll(t)},Ci=function(t,e){var n=t.matches||t[w(t,"matchesSelector")];return(Ci=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Ti=function(t,e){return Sizzle(t,e)[0]||null},Li=Sizzle,Ci=Sizzle.matchesSelector),ui.selection=function(){return ui.select(hi.documentElement)};var Si=ui.selection.prototype=[];Si.select=function(t){var e,n,r,a,o=[];t=z(t);for(var i=-1,l=this.length;++i=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Oi.hasOwnProperty(n)?{space:Oi[n],local:t}:t}},Si.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();return t=ui.ns.qualify(t),t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(E(e,t[e]));return this}return this.each(E(t,e))},Si.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=D(t)).length,a=-1;if(e=n.classList){for(;++a=0;)(n=r[a])&&(o&&o!==n.nextSibling&&o.parentNode.insertBefore(n,o),o=n);return this},Si.sort=function(t){t=U.apply(this,arguments);for(var e=-1,n=this.length;++e0&&(e=e.transition().duration(S)),e.call(t.event)}function l(){_&&_.domain(b.range().map(function(t){return(t-k.x)/k.k}).map(b.invert)),M&&M.domain(w.range().map(function(t){return(t-k.y)/k.k}).map(w.invert))}function s(t){z++||t({type:"zoomstart"})}function c(t){l(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function u(t){--z||(t({type:"zoomend"}),m=null)}function f(){function t(){l=1,o(ui.mouse(a),d),c(i)}function n(){f.on(E,null).on(P,null),h(l),u(i)}var a=this,i=D.of(a,arguments),l=0,f=ui.select(r(a)).on(E,t).on(P,n),d=e(ui.mouse(a)),h=$(a);Hs.call(a),s(i)}function d(){function t(){var t=ui.touches(p);return h=k.k,t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))}),t}function n(){var e=ui.event.target;ui.select(e).on(b,r).on(_,l),w.push(e);for(var n=ui.event.changedTouches,a=0,o=n.length;a1){var u=s[0],f=s[1],d=u[0]-f[0],h=u[1]-f[1];v=d*d+h*h}}function r(){var t,e,n,r,i=ui.touches(p);Hs.call(p);for(var l=0,s=i.length;l=c)return i;if(a)return a=!1,o;var e=u;if(34===t.charCodeAt(e)){for(var n=e;n++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,hl=ui.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=ui.round(t,jt(t,e))).toFixed(Math.max(0,Math.min(20,jt(t*(1+1e-15),e))))}}),pl=ui.time={},gl=Date;qt.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(){ml.setUTCDate.apply(this._,arguments)},setDay:function(){ml.setUTCDay.apply(this._,arguments)},setFullYear:function(){ml.setUTCFullYear.apply(this._,arguments)},setHours:function(){ml.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ml.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ml.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ml.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ml.setUTCSeconds.apply(this._,arguments)},setTime:function(){ml.setTime.apply(this._,arguments)}};var ml=Date.prototype;pl.year=Ht(function(t){return t=pl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),pl.years=pl.year.range,pl.years.utc=pl.year.utc.range,pl.day=Ht(function(t){var e=new gl(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),pl.days=pl.day.range,pl.days.utc=pl.day.utc.range,pl.dayOfYear=function(t){var e=pl.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=pl[t]=Ht(function(t){return(t=pl.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});pl[t+"s"]=n.range,pl[t+"s"].utc=n.utc.range,pl[t+"OfYear"]=function(t){var n=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(n+e)%7)/7)}}),pl.week=pl.sunday,pl.weeks=pl.sunday.range,pl.weeks.utc=pl.sunday.utc.range,pl.weekOfYear=pl.sundayOfYear;var vl={"-":"",_:" ",0:"0"},yl=/^\s*\d+/,xl=/^%/;ui.locale=function(t){return{numberFormat:Ft(t),timeFormat:Ut(t)}};var bl=ui.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"]});ui.format=bl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,_l),de(_l.s,this.s,this),this.s?this.t+=_l.t:this.s=_l.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _l=new fe;ui.geo.stream=function(t,e){t&&wl.hasOwnProperty(t.type)?wl[t.type](t,e):he(t,e)};var wl={Feature:function(t,e){he(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,a=n.length;++rh&&(h=e)}function e(e,n){var r=ve([e*Vi,n*Vi]);if(v){var a=xe(v,r),o=[a[1],-a[0],0],i=xe(o,a);we(i),i=Me(i);var s=e-p,c=s>0?1:-1,g=i[0]*Ui*c,m=bi(s)>180;if(m^(c*ph&&(h=y)}else if(g=(g+360)%360-180,m^(c*ph&&(h=n);m?el(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e):d>=u?(ed&&(d=e)):e>p?l(u,e)>l(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e)}else t(e,n);v=r,p=e}function n(){_.point=e}function r(){b[0]=u,b[1]=d,_.point=t,v=null}function a(t,n){if(v){var r=t-p;y+=bi(r)>180?r+(r>0?360:-360):r}else g=t,m=n;Tl.point(t,n),e(t,n)}function o(){Tl.lineStart()}function i(){a(g,m),Tl.lineEnd(),bi(y)>ji&&(u=-(d=180)),b[0]=u,b[1]=d,v=null}function l(t,e){return(e-=t)<0?e+360:e}function s(t,e){return t[0]-e[0]}function c(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tji?h=90:y<-ji&&(f=-90),b[0]=u,b[1]=d}};return function(t){h=d=-(u=f=1/0),x=[],ui.geo.stream(t,_);var e=x.length;if(e){x.sort(s);for(var n,r=1,a=x[0],o=[a];rl(a[0],a[1])&&(a[1]=n[1]),l(n[0],a[1])>l(a[0],a[1])&&(a[0]=n[0])):o.push(a=n);for(var i,n,p=-(1/0),e=o.length-1,r=0,a=o[e];r<=e;a=n,++r)n=o[r],(i=l(a[1],n[0]))>p&&(p=i,u=n[0],d=a[1])}return x=b=null,u===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[u,f],[d,h]]}}(),ui.geo.centroid=function(t){Ll=Cl=Sl=zl=Ol=El=Pl=Nl=Dl=Rl=jl=0,ui.geo.stream(t,Il);var e=Dl,n=Rl,r=jl,a=e*e+n*n+r*r;return a=.12&&a<.234&&r>=-.425&&r<-.214?i:a>=.166&&a<.234&&r>=-.214&&r<-.115?l:o).invert(t)},t.stream=function(t){var e=o.stream(t),n=i.stream(t),r=l.stream(t);return{point:function(t,a){e.point(t,a),n.point(t,a),r.point(t,a)},sphere:function(){e.sphere(),n.sphere(),r.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),i.precision(e),l.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),i.scale(.35*e),l.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var c=o.scale(),u=+e[0],f=+e[1];return n=o.translate(e).clipExtent([[u-.455*c,f-.238*c],[u+.455*c,f+.238*c]]).stream(s).point,r=i.translate([u-.307*c,f+.201*c]).clipExtent([[u-.425*c+ji,f+.12*c+ji],[u-.214*c-ji,f+.234*c-ji]]).stream(s).point,a=l.translate([u-.205*c,f+.212*c]).clipExtent([[u-.214*c+ji,f+.166*c+ji],[u-.115*c-ji,f+.234*c-ji]]).stream(s).point,t},t.scale(1070)};var ql,Hl,Vl,Ul,Gl,Yl,Zl={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Hl=0,Zl.lineStart=Xe},polygonEnd:function(){Zl.lineStart=Zl.lineEnd=Zl.point=M,ql+=bi(Hl/2)}},Xl={point:We,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Wl={point:Je,lineStart:Ke,lineEnd:tn,polygonStart:function(){Wl.lineStart=en},polygonEnd:function(){Wl.point=Je,Wl.lineStart=Ke,Wl.lineEnd=tn}};ui.geo.path=function(){function t(t){return t&&("function"==typeof l&&o.pointRadius(+l.apply(this,arguments)),i&&i.valid||(i=a(o)),ui.geo.stream(t,i)),o.result()}function e(){return i=null,t}var n,r,a,o,i,l=4.5;return t.area=function(t){return ql=0,ui.geo.stream(t,a(Zl)),ql},t.centroid=function(t){return Sl=zl=Ol=El=Pl=Nl=Dl=Rl=jl=0,ui.geo.stream(t,a(Wl)),jl?[Dl/jl,Rl/jl]:Nl?[El/Nl,Pl/Nl]:Ol?[Sl/Ol,zl/Ol]:[NaN,NaN]},t.bounds=function(t){return Gl=Yl=-(Vl=Ul=1/0),ui.geo.stream(t,a(Xl)),[[Vl,Ul],[Gl,Yl]]},t.projection=function(t){return arguments.length?(a=(n=t)?t.stream||an(t):b,e()):n},t.context=function(t){return arguments.length?(o=null==(r=t)?new Qe:new nn(t),"function"!=typeof l&&o.pointRadius(l),e()):r},t.pointRadius=function(e){return arguments.length?(l="function"==typeof e?e:(o.pointRadius(+e),+e),t):l},t.projection(ui.geo.albersUsa()).context(null)},ui.geo.transform=function(t){return{stream:function(e){var n=new on(e);for(var r in t)n[r]=t[r];return n}}},on.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()}},ui.geo.projection=sn,ui.geo.projectionMutator=cn,(ui.geo.equirectangular=function(){return sn(fn)}).raw=fn.invert=fn,ui.geo.rotation=function(t){function e(e){return e=t(e[0]*Vi,e[1]*Vi),e[0]*=Ui,e[1]*=Ui,e}return t=hn(t[0]%360*Vi,t[1]*Vi,t.length>2?t[2]*Vi:0),e.invert=function(e){return e=t.invert(e[0]*Vi,e[1]*Vi),e[0]*=Ui,e[1]*=Ui,e},e},dn.invert=fn,ui.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,e=hn(-t[0]*Vi,-t[1]*Vi,0).invert,a=[];return n(null,null,1,{point:function(t,n){a.push(t=e(t,n)),t[0]*=Ui,t[1]*=Ui}}),{type:"Polygon",coordinates:[a]}}var e,n,r=[0,0],a=6;return t.origin=function(e){return arguments.length?(r=e,t):r},t.angle=function(r){return arguments.length?(n=vn((e=+r)*Vi,a*Vi),t):e},t.precision=function(r){return arguments.length?(n=vn(e*Vi,(a=+r)*Vi),t):a},t.angle(90)},ui.geo.distance=function(t,e){var n,r=(e[0]-t[0])*Vi,a=t[1]*Vi,o=e[1]*Vi,i=Math.sin(r),l=Math.cos(r),s=Math.sin(a),c=Math.cos(a),u=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((n=f*i)*n+(n=c*u-s*f*l)*n),s*u+c*f*l)},ui.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return ui.range(Math.ceil(o/m)*m,a,m).map(d).concat(ui.range(Math.ceil(c/v)*v,s,v).map(h)).concat(ui.range(Math.ceil(r/p)*p,n,p).filter(function(t){return bi(t%m)>ji}).map(u)).concat(ui.range(Math.ceil(l/g)*g,i,g).filter(function(t){return bi(t%v)>ji}).map(f))}var n,r,a,o,i,l,s,c,u,f,d,h,p=10,g=p,m=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[d(o).concat(h(s).slice(1),d(a).reverse().slice(1),h(c).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],a=+e[1][0],c=+e[0][1],s=+e[1][1],o>a&&(e=o,o=a,a=e),c>s&&(e=c,c=s,s=e),t.precision(y)):[[o,c],[a,s]]},t.minorExtent=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],l=+e[0][1],i=+e[1][1],r>n&&(e=r,r=n,n=e),l>i&&(e=l,l=i,i=e),t.precision(y)):[[r,l],[n,i]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(m=+e[0],v=+e[1],t):[m,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,u=xn(l,i,90),f=bn(r,n,y),d=xn(c,s,90),h=bn(o,a,y),t):y},t.majorExtent([[-180,-90+ji],[180,90-ji]]).minorExtent([[-180,-80-ji],[180,80+ji]])},ui.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||r.apply(this,arguments),n||a.apply(this,arguments)]}}var e,n,r=_n,a=wn;return t.distance=function(){return ui.geo.distance(e||r.apply(this,arguments),n||a.apply(this,arguments))},t.source=function(n){return arguments.length?(r=n,e="function"==typeof n?null:n,t):r},t.target=function(e){return arguments.length?(a=e,n="function"==typeof e?null:e,t):a},t.precision=function(){return arguments.length?t:0},t},ui.geo.interpolate=function(t,e){return Mn(t[0]*Vi,t[1]*Vi,e[0]*Vi,e[1]*Vi)},ui.geo.length=function(t){return Ql=0,ui.geo.stream(t,$l),Ql};var Ql,$l={sphere:M,point:M,lineStart:kn,lineEnd:M,polygonStart:M,polygonEnd:M},Jl=An(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return sn(Jl)}).raw=Jl;var Kl=An(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return sn(Kl)}).raw=Kl,(ui.geo.conicConformal=function(){return Ye(Tn)}).raw=Tn,(ui.geo.conicEquidistant=function(){return Ye(Ln)}).raw=Ln;var ts=An(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return sn(ts)}).raw=ts,Cn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return Sn(Cn)}).raw=Cn;var es=An(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return sn(es)}).raw=es;var ns=An(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return sn(ns)}).raw=ns,zn.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Hi]},(ui.geo.transverseMercator=function(){var t=Sn(zn),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):(t=n(),[t[0],t[1],t[2]-90])},n([0,0,90])}).raw=zn,ui.geom={},ui.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,a=Ct(n),o=Ct(r),i=t.length,l=[],s=[];for(e=0;e=0;--e)h.push(t[l[c[e]][2]]);for(e=+f;e=r&&c.x<=o&&c.y>=a&&c.y<=i?[[r,i],[o,i],[o,a],[r,a]]:[];u.point=t[l]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/ji)*ji,y:Math.round(i(t,e)/ji)*ji,i:e}})}var r=On,a=En,o=r,i=a,l=fs;return t?e(t):(e.links=function(t){return cr(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return cr(n(t)).cells.forEach(function(n,r){for(var a,o,i=n.site,l=n.edges.sort(Zn),s=-1,c=l.length,u=l[c-1].edge,f=u.l===i?u.r:u.l;++s=c,d=r>=u,h=d<<1|f;t.leaf=!1,t=t.nodes[h]||(t.nodes[h]=pr()),f?a=c:l=c,d?i=u:s=u,o(t,e,n,r,a,i,l,s)}var u,f,d,h,p,g,m,v,y,x=Ct(l),b=Ct(s);if(null!=e)g=e,m=n,v=r,y=a;else if(v=y=-(g=m=1/0),f=[],d=[],p=t.length,i)for(h=0;hv&&(v=u.x),u.y>y&&(y=u.y),f.push(u.x),d.push(u.y);else for(h=0;hv&&(v=_),w>y&&(y=w),f.push(_),d.push(w)}var M=v-g,k=y-m;M>k?y=m+M:v=g+k;var A=pr();if(A.add=function(t){o(A,t,+x(t,++h),+b(t,h),g,m,v,y)},A.visit=function(t){gr(t,A,g,m,v,y)},A.find=function(t){return mr(A,t[0],t[1],g,m,v,y)},h=-1,null==e){for(;++h=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=gs.get(n)||ps,r=ms.get(r)||b,Mr(r(n.apply(null,fi.call(arguments,1))))},ui.interpolateHcl=Rr,ui.interpolateHsl=jr,ui.interpolateLab=Ir,ui.interpolateRound=Fr,ui.transform=function(t){var e=hi.createElementNS(ui.ns.prefix.svg,"g");return(ui.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new Br(n?n.matrix:vs)})(t)},Br.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var vs={a:1,b:0,c:0,d:1,e:0,f:0};ui.interpolateTransform=Wr,ui.layout={},ui.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++n0?a=t:(n.c=null,n.t=NaN,n=null,c.end({type:"end",alpha:a=0})):t>0&&(c.start({type:"start",alpha:a=t}),n=Pt(s.tick)),s):a},s.start=function(){function t(t,r){if(!n){for(n=new Array(a),s=0;s=0;)i.push(u=c[s]),u.parent=o,u.depth=o.depth+1;r&&(o.value=0),o.children=c}else r&&(o.value=+r.call(t,o,o.depth)||0),delete o.children;return sa(a,function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)}),l}var e=fa,n=ca,r=ua;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(r=e,t):r},t.revalue=function(e){return r&&(la(e,function(t){t.children&&(t.value=0)}),sa(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},ui.layout.partition=function(){function t(e,n,r,a){var o=e.children;if(e.x=n,e.y=e.depth*a,e.dx=r,e.dy=a,o&&(i=o.length)){var i,l,s,c=-1;for(r=e.value?r/e.value:0;++cl&&(l=r),i.push(r)}for(n=0;n0)for(o=-1;++o=u[0]&&l<=u[1]&&(i=s[ui.bisect(f,l,1,h)-1],i.y+=p,i.push(t[o]));return s}var e=!0,n=Number,r=Ma,a=_a;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(r=Ct(e),t):r},t.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return wa(t,e)}:Ct(e),t):a},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},ui.layout.pack=function(){function t(t,o){var i=n.call(this,t,o),l=i[0],s=a[0],c=a[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(l.x=l.y=0,sa(l,function(t){t.r=+u(t.value)}),sa(l,Ca),r){var f=r*(e?1:Math.max(2*l.r/s,2*l.r/c))/2;sa(l,function(t){t.r+=f}),sa(l,Ca),sa(l,function(t){t.r-=f})}return Oa(l,s/2,c/2,e?1:1/Math.max(2*l.r/s,2*l.r/c)),i}var e,n=ui.layout.hierarchy().sort(ka),r=0,a=[1,1];return t.size=function(e){return arguments.length?(a=e,t):a},t.radius=function(n){return arguments.length?(e=null==n||"function"==typeof n?n:+n,t):e},t.padding=function(e){return arguments.length?(r=+e,t):r},ia(t,n)},ui.layout.tree=function(){function t(t,a){var u=i.call(this,t,a),f=u[0],d=e(f);if(sa(d,n),d.parent.m=-d.z,la(d,r),c)la(f,o);else{var h=f,p=f,g=f;la(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var m=l(h,p)/2-h.x,v=s[0]/(p.x+l(p,h)/2+m),y=s[1]/(g.depth||1);la(f,function(t){t.x=(t.x+m)*v,t.y=t.depth*y})}return u}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var a,o=e.children,i=0,l=o.length;i0&&(Ra(Ia(i,t,n),t,r),c+=r,u+=r),f+=i.m,c+=a.m,d+=s.m,u+=o.m;i&&!Da(o)&&(o.t=i,o.m+=f-u),a&&!Na(s)&&(s.t=a,s.m+=c-d,n=t)}return n}function o(t){t.x*=s[0],t.y=t.depth*s[1]}var i=ui.layout.hierarchy().sort(null).value(null),l=Pa,s=[1,1],c=null;return t.separation=function(e){return arguments.length?(l=e,t):l},t.size=function(e){return arguments.length?(c=null==(s=e)?o:null,t):c?null:s},t.nodeSize=function(e){return arguments.length?(c=null==(s=e)?null:o,t):c?s:null},ia(t,i)},ui.layout.cluster=function(){function t(t,o){var i,l=e.call(this,t,o),s=l[0],c=0;sa(s,function(t){var e=t.children;e&&e.length?(t.x=Ba(e),t.y=Fa(e)):(t.x=i?c+=n(t,i):0,t.y=0,i=t)});var u=qa(s),f=Ha(s),d=u.x-n(u,f)/2,h=f.x+n(f,u)/2;return sa(s,a?function(t){t.x=(t.x-s.x)*r[0],t.y=(s.y-t.y)*r[1]}:function(t){t.x=(t.x-d)/(h-d)*r[0],t.y=(1-(s.y?t.y/s.y:1))*r[1]}),l}var e=ui.layout.hierarchy().sort(null).value(null),n=Pa,r=[1,1],a=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(a=null==(r=e),t):a?null:r},t.nodeSize=function(e){return arguments.length?(a=null!=(r=e),t):a?r:null},ia(t,e)},ui.layout.treemap=function(){function t(t,e){for(var n,r,a=-1,o=t.length;++a0;)u.push(i=d[s-1]),u.area+=i.area,"squarify"!==h||(l=r(u,g))<=p?(d.pop(),p=l):(u.area-=u.pop().area,a(u,g,c,!1),g=Math.min(c.dx,c.dy),u.length=u.area=0,p=1/0);u.length&&(a(u,g,c,!0),u.length=u.area=0),o.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var o,i=f(e),l=r.slice(),s=[];for(t(l,i.dx*i.dy/e.value),s.area=0;o=l.pop();)s.push(o),s.area+=o.area,null!=o.z&&(a(s,o.z?i.dx:i.dy,i,!l.length),s.length=s.area=0);r.forEach(n)}}function r(t,e){for(var n,r=t.area,a=0,o=1/0,i=-1,l=t.length;++ia&&(a=n));return r*=r,e*=e,r?Math.max(e*a*p/r,r/(e*o*p)):1/0}function a(t,e,n,r){var a,o=-1,i=t.length,l=n.x,c=n.y,u=e?s(t.area/e):0;if(e==n.dx){for((r||u>n.dy)&&(u=n.dy);++on.dx)&&(u=n.dx);++o1);return t+e*n*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=ui.random.normal.apply(ui,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ui.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;nf?0:1;if(c=qi)return e(c,h)+(t?e(t,1-h):"")+"Z";var p,g,m,v,y,x,b,_,w,M,k,A,T=0,L=0,C=[];if((v=(+s.apply(this,arguments)||0)/2)&&(m=o===Es?Math.sqrt(t*t+c*c):+o.apply(this,arguments),h||(L*=-1),c&&(L=rt(m/c*Math.sin(v))),t&&(T=rt(m/t*Math.sin(v)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var S=Math.abs(f-u-2*L)<=Fi?0:1;if(L&&bo(y,x,b,_)===h^S){var z=(u+f)/2;y=c*Math.cos(z),x=c*Math.sin(z),b=_=null}}else y=x=0;if(t){w=t*Math.cos(f-T),M=t*Math.sin(f-T),k=t*Math.cos(u+T),A=t*Math.sin(u+T);var O=Math.abs(u-f+2*T)<=Fi?0:1;if(T&&bo(w,M,k,A)===1-h^O){var E=(u+f)/2;w=t*Math.cos(E),M=t*Math.sin(E),k=A=null}}else w=M=0;if(d>ji&&(p=Math.min(Math.abs(c-t)/2,+a.apply(this,arguments)))>.001){g=tFi)+",1 "+e}function a(t,e,n,r){return"Q 0,0 "+r}var o=_n,i=wn,l=Go,s=vo,c=yo;return t.radius=function(e){return arguments.length?(l=Ct(e),t):l},t.source=function(e){return arguments.length?(o=Ct(e),t):o},t.target=function(e){return arguments.length?(i=Ct(e),t):i},t.startAngle=function(e){return arguments.length?(s=Ct(e),t):s},t.endAngle=function(e){return arguments.length?(c=Ct(e),t):c},t},ui.svg.diagonal=function(){function t(t,a){var o=e.call(this,t,a),i=n.call(this,t,a),l=(o.y+i.y)/2,s=[o,{x:o.x,y:l},{x:i.x,y:l},i];return s=s.map(r),"M"+s[0]+"C"+s[1]+" "+s[2]+" "+s[3]}var e=_n,n=wn,r=Yo;return t.source=function(n){return arguments.length?(e=Ct(n),t):e},t.target=function(e){return arguments.length?(n=Ct(e),t):n},t.projection=function(e){return arguments.length?(r=e,t):r},t},ui.svg.diagonal.radial=function(){var t=ui.svg.diagonal(),e=Yo,n=t.projection;return t.projection=function(t){return arguments.length?n(Zo(e=t)):e},t},ui.svg.symbol=function(){function t(t,r){return(js.get(e.call(this,t,r))||Qo)(n.call(this,t,r))}var e=Wo,n=Xo;return t.type=function(n){return arguments.length?(e=Ct(n),t):e},t.size=function(e){return arguments.length?(n=Ct(e),t):n},t};var js=ui.map({circle:Qo,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Fs)),n=e*Fs;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",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/Is),n=e*Is/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Is),n=e*Is/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});ui.svg.symbolTypes=js.keys();var Is=Math.sqrt(3),Fs=Math.tan(30*Vi);Si.transition=function(t){for(var e,n,r=Bs||++Us,a=ei(t),o=[],i=qs||{time:Date.now(),ease:Cr,delay:0,duration:250},l=-1,s=this.length;++lrect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",d[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==ui.event.keyCode&&(S||(x=null,O[0]-=f[1],O[1]-=d[1],S=2),T())}function g(){32==ui.event.keyCode&&2==S&&(O[0]+=f[1],O[1]+=d[1],S=0,T())}function m(){var t=ui.mouse(_),r=!1;b&&(t[0]+=b[0],t[1]+=b[1]),S||(ui.event.altKey?(x||(x=[(f[0]+f[1])/2,(d[0]+d[1])/2]),O[0]=f[+(t[0]0&&this._events[t].length>n&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!a(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,l;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||a(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(n)){for(l=o;l-- >0;)if(n[l]===e||n[l].listener&&n[l].listener===e){r=l;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;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(n=this._events[t],a(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],11:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;r13)&&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}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return t-t<1}},{}],12:[function(t,e,n){function r(t,e){var n=e[0],r=e[1],a=e[2],o=e[3],i=n+n,l=r+r,s=a+a,c=n*i,u=r*i,f=r*l,d=a*i,h=a*l,p=a*s,g=o*i,m=o*l,v=o*s;return t[0]=1-f-p,t[1]=u+v,t[2]=d-m,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+m,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=r},{}],13:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function i(t){if(d===clearTimeout)return clearTimeout(t);if((d===a||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{return d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}function l(){m&&p&&(m=!1,p.length?g=p.concat(g):v=-1,g.length&&s())}function s(){if(!m){var t=o(l);m=!0;for(var e=g.length;e;){for(p=g,g=[];++v1)for(var n=1;n.5?s/(2-o-i):s/(o+i),o){case t:r=(e-n)/s+(e1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var a,o,i;if(t=C(t,360),e=C(e,100),n=C(n,100),0===e)a=o=i=n;else{var l=n<.5?n*(1+e):n+e-n*e,s=2*n-l;a=r(s,l,t+1/3),o=r(s,l,t),i=r(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function s(t,e,n){t=C(t,255),e=C(e,255),n=C(n,255);var r,a,o=G(t,e,n),i=U(t,e,n),l=o,s=o-i;if(a=0===o?0:s/o,o==i)r=0;else{switch(o){case t:r=(e-n)/s+(e>1)+720)%360;--e;)a.h=(a.h+o)%360,i.push(r(a));return i}function A(t,e){e=e||6;for(var n=r(t).toHsv(),a=n.h,o=n.s,i=n.v,l=[],s=1/e;e--;)l.push(r({h:a,s:o,v:i})),i=(i+s)%1;return l}function T(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function C(t,n){O(t)&&(t="100%");var r=E(t);return t=U(n,G(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function S(t){return U(1,G(0,t))}function z(t){return parseInt(t,16)}function O(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function E(t){return"string"==typeof t&&t.indexOf("%")!=-1}function P(t){return 1==t.length?"0"+t:""+t}function N(t){return t<=1&&(t=100*t+"%"),t}function D(t){return e.round(255*parseFloat(t)).toString(16)}function R(t){return z(t)/255}function j(t){return!!W.CSS_UNIT.exec(t)}function I(t){t=t.replace(B,"").replace(q,"").toLowerCase();var e=!1;if(Z[t])t=Z[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=W.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=W.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=W.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=W.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=W.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=W.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=W.hex8.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),a:R(n[4]),format:e?"name":"hex8"}:(n=W.hex6.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),format:e?"name":"hex"}:(n=W.hex4.exec(t))?{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),a:R(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=W.hex3.exec(t))&&{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),format:e?"name":"hex"}}function F(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var B=/^\s+/,q=/\s+$/,H=0,V=e.round,U=e.min,G=e.max,Y=e.random;r.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,a,o,i,l=this.toRgb();return t=l.r/255,n=l.g/255,r=l.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),i=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),.2126*a+.7152*o+.0722*i},setAlpha:function(t){return this._a=L(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*C(this._r,255))+"%",g:V(100*C(this._g,255))+"%",b:V(100*C(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%)":"rgba("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(X[u(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),n=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=r(t);n="#"+d(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,a=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return r(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(k,arguments); -},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},r.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?n[a]=t[a]:n[a]=N(t[a]));t=n}return r(t,e)},r.equals=function(t,e){return!(!t||!e)&&r(t).toRgbString()==r(e).toRgbString()},r.random=function(){return r.fromRatio({r:Y(),g:Y(),b:Y()})},r.mix=function(t,e,n){n=0===n?0:n||50;var a=r(t).toRgb(),o=r(e).toRgb(),i=n/100,l={r:(o.r-a.r)*i+a.r,g:(o.g-a.g)*i+a.g,b:(o.b-a.b)*i+a.b,a:(o.a-a.a)*i+a.a};return r(l)},r.readability=function(t,n){var a=r(t),o=r(n);return(e.max(a.getLuminance(),o.getLuminance())+.05)/(e.min(a.getLuminance(),o.getLuminance())+.05)},r.isReadable=function(t,e,n){var a,o,i=r.readability(t,e);switch(o=!1,a=F(n),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},r.mostReadable=function(t,e,n){var a,o,i,l,s=null,c=0;n=n||{},o=n.includeFallbackColors,i=n.level,l=n.size;for(var u=0;uc&&(c=a,s=r(e[u]));return r.isReadable(t,s,{level:i,size:l})||!o?s:(n.includeFallbackColors=!1,r.mostReadable(t,["#fff","#000"],n))};var Z=r.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},X=r.hexNames=T(Z),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+r),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})$/}}();"undefined"!=typeof n&&n.exports?n.exports=r:"function"==typeof t&&t.amd?t(function(){return r}):window.tinycolor=r}(Math)},{}],15:[function(e,n,r){!function(e,a){"object"==typeof r&&"undefined"!=typeof n?a(r):"function"==typeof t&&t.amd?t(["exports"],a):a(e.topojson=e.topojson||{})}(this,function(t){"use strict";function e(){}function n(t){if(!t)return e;var n,r,a=t.scale[0],o=t.scale[1],i=t.translate[0],l=t.translate[1];return function(t,e){e||(n=r=0),t[0]=(n+=t[0])*a+i,t[1]=(r+=t[1])*o+l}}function r(t){if(!t)return e;var n,r,a=t.scale[0],o=t.scale[1],i=t.translate[0],l=t.translate[1];return function(t,e){e||(n=r=0);var s=Math.round((t[0]-i)/a),c=Math.round((t[1]-l)/o);t[0]=s-n,t[1]=c-r,n=s,r=c}}function a(t,e){for(var n,r=t.length,a=r-e;a<--r;)n=t[a],t[a++]=t[r],t[r]=n}function o(t,e){for(var n=0,r=t.length;n>>1;t[a]1){var s,u=[],f={LineString:a,MultiLineString:o,Polygon:o,MultiPolygon:function(t){t.forEach(o)}};i(e),u.forEach(arguments.length<3?function(t){l.push(t[0].i)}:function(t){n(t[0].g,t[t.length-1].g)&&l.push(t[0].i)})}else for(var d=0,h=t.arcs.length;d1)for(var i,l,s=1,u=r(o[0]);su&&(l=o[0],o[0]=o[s],o[s]=l,u=i);return o})}}function m(t){function e(t,e){t.forEach(function(t){t<0&&(t=~t);var n=a[t];n?n.push(e):a[t]=[e]})}function n(t,n){t.forEach(function(t){e(t,n)})}function r(t,e){"GeometryCollection"===t.type?t.geometries.forEach(function(t){r(t,e)}):t.type in l&&l[t.type](t.arcs,e)}var a={},i=t.map(function(){return[]}),l={LineString:e,MultiLineString:n,Polygon:n,MultiPolygon:function(t,e){t.forEach(function(t){n(t,e)})}};t.forEach(r);for(var s in a)for(var c=a[s],u=c.length,f=0;f0;){var n=(e+1>>1)-1,a=r[n];if(v(t,a)>=0)break;r[a._=e]=a,r[t._=e=n]=t}}function e(t,e){for(;;){var n=e+1<<1,o=n-1,i=e,l=r[i];if(o0&&(t=r[a],e(r[t._=0]=t,0)),n}},n.remove=function(n){var o,i=n._;if(r[i]===n)return i!==--a&&(o=r[a],(v(o,n)<0?t:e)(r[o._=i]=o,i)),i},n}function x(t,e){function a(t){l.remove(t),t[1][2]=e(t),l.push(t)}var o=n(t.transform),i=r(t.transform),l=y();return e||(e=d),t.arcs.forEach(function(t){var n,r,s,c,u=[],f=0;for(r=0,s=t.length;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}rt.selectAll("tspan.line").attr({y:0,x:0});var r=$.select(".annotation-math-group"),a=!r.empty(),l=h.bBox((a?r:rt).node()),c=l.width,p=l.height,v=Math.round(c+2*tt),y=Math.round(p+2*tt);U._w=c,U._h=p;var b=!1;if(["x","y"].forEach(function(e){var r,a=U[e+"ref"]||e,o=f.getFromId(t,a),i=(X+("x"===e?0:90))*Math.PI/180,l=v*Math.abs(Math.cos(i))+y*Math.abs(Math.sin(i)),s=U[e+"anchor"];if(o){if(!o.autorange&&(U[e]-o.range[0])*(U[e]-o.range[1])>0&&(U["a"+e+"ref"]===a?(U["a"+e]-o.range[0])*(U["a"+e]-o.range[1])>0&&(b=!0):b=!0,b))return;Z[e]=o._offset+o.l2p(U[e]),r=.5}else r=U[e],"y"===e&&(r=1-r),Z[e]="x"===e?E.l+E.w*r:E.t+E.h*r;var c=0;U["a"+e+"ref"]===a?Z["aa"+e]=o._offset+o.l2p(U["a"+e]):(c=U.showarrow?U["a"+e]:l*n(r,s),Z[e]+=c),U["_"+e+"type"]=o&&o.type,U["_"+e+"size"]=l,U["_"+e+"shift"]=c}),b)return void $.remove();var _,w;U.showarrow&&(_=U.axref===U.xref?Z.x:u.constrain(Z.x-U.ax,1,k.width-1),w=U.ayref===U.yref?Z.y:u.constrain(Z.y-U.ay,1,k.height-1)),Z.x=u.constrain(Z.x,1,k.width-1),Z.y=u.constrain(Z.y,1,k.height-1);var M=tt-l.top,A=tt-l.left;a?r.select("svg").attr({x:tt-1,y:tt}):(rt.attr({x:A,y:M}),rt.selectAll("tspan.line").attr({y:M,x:A})),et.call(h.setRect,J/2,J/2,v-J,y-J);var T=0,L=0;T=U.axref===U.xref?Math.round(Z.aax-v/2):Math.round(Z.x-v/2),L=U.ayref===U.yref?Math.round(Z.aay-y/2):Math.round(Z.y-y/2),$.call(u.setTranslate,T,L);var C="annotations["+e+"]",S=function(n,r){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=U.axref===U.xref?Z.aax+n:Z.x+n,l=U.ayref===U.yref?Z.aay+r:Z.y+r;var c=u.rotationXYMatrix(X,a,l),f=u.apply2DTransform(c),h=u.apply2DTransform2(c),p=et.attr("width")/2,g=et.attr("height")/2,v=[[a-p,l-g,a-p,l+g],[a-p,l+g,a+p,l+g],[a+p,l+g,a+p,l-g],[a+p,l-g,a-p,l-g]].map(h);if(!v.reduce(function(t,e){return t^!!o(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=o(a,l,_,w,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var y=U.arrowwidth,b=U.arrowcolor,M=W.append("g").style({opacity:d.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=M.append("path").attr("d","M"+a+","+l+"L"+_+","+w).style("stroke-width",y+"px").call(d.stroke,d.rgb(b));x(k,U.arrowhead,"end",U.arrowsize);var A=M.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-_)+","+(l-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,S;m.init({element:A.node(),prepFn:function(){var t=u.getTranslate($);L=t.x,S=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),Y&&Y.autorange&&(T[Y._name+".autorange"]=!0)},moveFn:function(t,e){M.attr("transform","translate("+t+","+e+")");var n=f(L,S),r=n[0]+t,a=n[1]+e;$.call(u.setTranslate,r,a),T[C+".x"]=G?U.x+t/G._m:(_+t-E.l)/E.w,T[C+".y"]=Y?U.y+e/Y._m:1-(w+e-E.t)/E.h,U.axref===U.xref&&(T[C+".ax"]=G?U.ax+t/G._m:(_+t-E.l)/E.w),U.ayref===U.yref&&(T[C+".ay"]=Y?U.ay+e/Y._m:1-(w+e-E.t)/E.h),Q.attr({transform:"rotate("+X+","+r+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};U.showarrow&&S(0,0);var z=u.rotationXYMatrix(X,Z.x,Z.y),O=u.apply2DTransform(z);if(t._context.editable){var P,N,D;m.init({element:$.node(),prepFn:function(){var t=u.getTranslate($);P=t.x,N=t.y,D={}},moveFn:function(t,e){$.call(u.setTranslate,P+t,N+e);var n="pointer";if(U.showarrow)U.axref===U.xref?D[C+".ax"]=G.p2l(G.l2p(U.ax)+t):D[C+".ax"]=U.ax+t,U.ayref===U.yref?D[C+".ay"]=Y.p2l(Y.l2p(U.ay)+e):D[C+".ay"]=U.ay+e,S(t,e);else{if(G)D[C+".x"]=U.x+t/G._m;else{var r=U._xsize/E.w,a=U.x+U._xshift/E.w-r/2;D[C+".x"]=m.align(a+t/E.w,r,0,1,U.xanchor)}if(Y)D[C+".y"]=U.y+e/Y._m;else{var o=U._ysize/E.h,i=U.y-U._yshift/E.h-o/2;D[C+".y"]=m.align(i-e/E.h,o,0,1,U.yanchor)}G&&Y||(n=m.getCursor(G?.5:D[C+".x"],Y?.5:D[C+".y"],U.xanchor,U.yanchor))}var l=O(P,N),s=l[0]+t,c=l[1]+e;$.call(u.setTranslate,P+t,N+e),Q.attr({transform:"rotate("+X+","+s+","+c+")"}),g($,n)},doneFn:function(e){if(g($),e){s.relayout(t,D);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var w,M=t.layout,k=t._fullLayout;if(!l(e)||e===-1){if(!e&&Array.isArray(c))return M.annotations=c,y(M,k),void r(t);if("remove"===c)return delete M.annotations,k.annotations=[],void r(t);if(n&&"add"!==c){for(w=0;we;w--)k._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),a(t,w)}}k._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=M.annotations[e],L=k.annotations[e];if(T){var C={xref:T.xref,yref:T.yref},S={};"string"==typeof n&&n?S[n]=c:u.isPlainObject(n)&&(S=n);var z=Object.keys(S);for(w=0;w4/3&&(j=H)}}else R&&(F&&(j<1/3?j+=q:j>2/3&&(j-=q)),j=(j-R.domain[0])/(R.domain[1]-R.domain[0]),j=R.range[0]+j*(R.range[1]-R.range[0]))}R&&R===D&&I&&("log"===I&&"log"!==R.type?j=Math.pow(10,j):"log"!==I&&"log"===R.type&&(j=j>0?Math.log(j)/Math.LN10:void 0)),T[N]=j}}var U=v(T,k);k.annotations[e]=U;var G=f.getFromId(t,U.xref),Y=f.getFromId(t,U.yref),Z={x:0,y:0},X=+U.textangle||0,W=k._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",U.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:U})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),J=U.borderwidth,K=U.borderpad,tt=J+K,et=$.append("rect").attr("class","bg").style("stroke-width",J+"px").call(d.stroke,U.bordercolor).call(d.fill,U.bgcolor),nt=U.font,rt=$.append("text").classed("annotation",!0).attr("data-unformatted",U.text).text(U.text);t._context.editable?rt.call(p.makeEditable,$).call(b).on("edit",function(n){U.text=n,this.attr({"data-unformatted":U.text}),this.call(b);var r={};r["annotations["+e+"].text"]=U.text,G&&G.autorange&&(r[G._name+".autorange"]=!0),Y&&Y.autorange&&(r[Y._name+".autorange"]=!0),s.relayout(t,r)}):rt.call(b),Q.attr({transform:"rotate("+X+","+Z.x+","+Z.y+")"}).call(h.setPosition,Z.x,Z.y)}}function o(t,e,n,r,a,o,i,l){var s=n-t,c=a-t,u=i-a,f=r-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,m=(c*f-s*d)/p;return m<0||m>1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:r,drawOne:a}},{"../../lib":118,"../../lib/setcursor":128,"../../lib/svg_text_utils":130,"../../plotly":141,"../../plots/cartesian/axes":145,"../../plots/plots":182,"../color":25,"../dragelement":47,"../drawing":49,"./annotation_defaults":16,"./defaults":20,"./draw_arrow_head":22,d3:8,"fast-isnumeric":11}],22:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../color"),i=t("../drawing"),l=t("./arrow_paths");e.exports=function(t,e,n,s){a(s)||(s=1);var c=t.node(),u=l[e||0];if(u){"string"==typeof n&&n||(n="end");var f,d,h,p,g=(i.getPx(t,"stroke-width")||1)*s,m=t.style("stroke")||o.defaultLine,v=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,b=u.backoff*g;if("line"===c.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},d={x:+t.attr("x2"),y:+t.attr("y2")},h=Math.atan2(f.y-d.y,f.x-d.x),p=h+Math.PI,b){var _=b*Math.cos(h),w=b*Math.sin(h);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(d.x+=_,d.y+=w,t.attr({x2:d.x,y2:d.y}))}}else if("path"===c.nodeName){var M=c.getTotalLength(),k="";if(y){var A=c.getPointAtLength(0),T=c.getPointAtLength(.1);h=Math.atan2(A.y-T.y,A.x-T.x),f=c.getPointAtLength(Math.min(b,M)),b&&(k="0px,"+b+"px,")}if(x){var L=c.getPointAtLength(M),C=c.getPointAtLength(M-.1);if(p=Math.atan2(L.y-C.y,L.x-C.x),d=c.getPointAtLength(Math.max(0,M-b)),b){var S=k?2*b:b;k+=M-S+"px,"+M+"px"}}else k&&(k+=M+"px");k&&t.style("stroke-dasharray",k)}var z=function(n,a){e>5&&(a=0),r.select(c.parentElement).append("path").attr({class:t.attr("class"),d:u.path,transform:"translate("+n.x+","+n.y+")rotate("+180*a/Math.PI+")scale("+g+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&z(f,h),x&&z(d,p)}}},{"../color":25,"../drawing":49,"./arrow_paths":17,d3:8,"fast-isnumeric":11}],23:[function(t,e,n){"use strict";var r=t("../../plotly");n.moduleType="component",n.name="annotations",n.ARROWPATHS=t("./arrow_paths"),n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.calcAutorange=t("./calc_autorange"),n.arrowhead=t("./draw_arrow_head");var a=t("./draw");n.draw=a.draw,n.drawOne=a.drawOne,n.add=function(t){var e=t._fullLayout.annotations.length;r.relayout(t,"annotations["+e+"]","add")}},{"../../plotly":141,"./arrow_paths":17,"./attributes":18,"./calc_autorange":19,"./defaults":20,"./draw":21,"./draw_arrow_head":22}],24:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],25:[function(t,e,n){"use strict";function r(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===r.length;if(!a&&3!==r.length)return t;for(var i=0;i=0))return t;if(3===i)r[i]>1&&(r[i]=1);else if(r[i]>=1)return t}var l=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return a?"rgba("+l+", "+r[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var n=a(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},i.combine=function(t,e){var n=a(t).toRgb();if(1===n.a)return a(t).toRgbString();var r=a(e||i.background).toRgb(),o=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},l={r:o.r*(1-n.a)+n.r*n.a,g:o.g*(1-n.a)+n.g*n.a,b:o.b*(1-n.a)+n.b*n.a};return a(l).toRgbString()},i.contrast=function(t,e,n){var r=a(t),o=r.isLight()?r.darken(n):r.lighten(e);return o.toString()},i.stroke=function(t,e){var n=a(e);t.style({stroke:i.tinyRGB(n),"stroke-opacity":n.getAlpha()})},i.fill=function(t,e){var n=a(e);t.style({fill:i.tinyRGB(n),"fill-opacity":n.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,n,a,o,l=Object.keys(t);for(e=0;el&&(o[1]-=(lt-l)/2)):n.node()&&!n.classed("js-placeholder")&&(lt=h.bBox(e.node()).height),lt){if(lt+=5,"top"===_.titleside)K.domain[1]-=lt/T.h,o[1]*=-1;else{K.domain[0]+=lt/T.h;var c=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),K.setScale()}}ot.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-K.domain[1]))+")");var f=ot.select(".cbfills").selectAll("rect.cbfill").data(z);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?C[0]:(z[e]+z[e-1])/2,e===z.length-1?C[1]:(z[e]+z[e+1])/2].map(K.c2p).map(Math.round);e!==z.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=E(t).replace("e-",""),i=a(o).toHexString();r.select(this).attr({x:Z,width:Math.max(B,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var d=ot.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){r.select(this).attr("d","M"+Z+","+(Math.round(K.c2p(t))+_.line.width/2%1)+"h"+B).call(h.lineGroupStyle,_.line.width,O(t),_.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=Z+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=K.titlefont.size,n=K._offset+K._length/2,a=T.l+(K.position||0)*T.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));M("h"+K._id+"title",{avoid:{selection:r.select(t).selectAll("g."+K._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:A.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,n){var r,a=b();r=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:K,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:ot.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;ot.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,n||{}))}function k(){var n=B+_.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(j=it.select("text"),j.node()&&!j.classed("js-placeholder")){var r,a=it.select(".h"+K._id+"title-math-group").node();r=a&&["top","bottom"].indexOf(_.titleside)!==-1?h.bBox(a).width:h.bBox(it.node()).right-Z-T.l,n=Math.max(n,r)}var o=2*_.xpad+n+_.borderwidth+_.outlinewidth/2,l=Q-$;ot.select(".cbbg").attr({x:Z-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-G,width:Math.max(o,2),height:Math.max(l+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),ot.selectAll(".cboutline").attr({x:Z,y:$+_.ypad+("top"===_.titleside?lt:0),width:Math.max(B,2),height:Math.max(l-2*_.ypad-lt,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var s=({center:.5,right:1}[_.xanchor]||0)*o;ot.attr("transform","translate("+(T.l-s)+","+T.t+")"),i.autoMargin(t,e,{x:_.x,y:_.y,l:o*({right:1,center:.5}[_.xanchor]||0),r:o*({left:1,center:.5}[_.xanchor]||0),t:l*({bottom:1,middle:.5}[_.yanchor]||0),b:l*({top:1,middle:.5}[_.yanchor]||0)})}var A=t._fullLayout,T=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var L,C=r.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],z=[],O="function"==typeof _.line.color?_.line.color:function(){return _.line.color},E="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},P=_.levels.end+_.levels.size/100,N=_.levels.size,D=1.001*C[0]-.001*C[1],R=1.001*C[1]-.001*C[0];for(L=_.levels.start;(L-P)*N<0;L+=N)L>D&&LC[0]&&L1){var at=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));et*=at*u.roundUp(rt/at,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+Y,W+V-Y],K.setScale();var ot=A._infolayer.selectAll("g."+e).data([0]);ot.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),ot.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var it=ot.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");K._axislayer=ot.select(".cbaxis");var lt=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var st,ct=T.l+(_.x+U)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-Y))*T.h+T.t+3+.75*ut:(1-(W+Y))*T.h+T.t-3-.25*ut,M(K._id+"title",{attributes:{x:ct,y:st,"text-anchor":"start"}})}var ft=u.syncOrAsync([i.previousPromises,w,i.previousPromises,k],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var dt,ht,pt;c.init({element:ot.node(),prepFn:function(){dt=ot.attr("transform"),d(ot)},moveFn:function(t,e){ot.attr("transform",dt+" translate("+t+","+e+")"),ht=c.align(X+t/T.w,q,0,1,_.xanchor),pt=c.align(W-e/T.h,V,0,1,_.yanchor);var n=c.getCursor(ht,pt,_.xanchor,_.yanchor);d(ot,n)},doneFn:function(e){d(ot),e&&void 0!==ht&&void 0!==pt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":pt},b().index)}})}return ft}function b(){var n,r,a=e.substr(2);for(n=0;n=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":118,"./flip_scale":37,"./scales":44}],33:[function(t,e,n){"use strict";var r=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},r.colorscale,{}),cauto:a({},r.zauto,{}),cmax:a({},r.zmax,{}),cmin:a({},r.zmin,{}),autocolorscale:a({},r.autocolorscale,{}),reversescale:a({},r.reversescale,{})}}},{"../../lib/extend":114,"./attributes":31,"./scales.js":44}],34:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":44}],35:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,n,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,m=p[d+"min"],v=p[d+"max"],y=p.colorscale,x=r(m)&&r(v)&&m=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],38:[function(t,e,n){"use strict";var r=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=a),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":34,"./is_valid_scale_array":42,"./scales":44}],39:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?a.nestedProperty(t,e).get()||{}:t,i=n.color,l=!1;if(Array.isArray(i))for(var s=0;s4/3-l?i:l}},{}],46:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":118}],47:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=r},{"../../lib":118,"../../plotly":141,"../../plots/cartesian/constants":151,"./align":45,"./cursor":46,"./unhover":48}],48:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":113}],49:[function(t,e,n){"use strict";function r(t,e,n,r,a,o,i){if(l.traceIs(n,"symbols")){var c=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(n)?c(t.ms):(o.size||6)/2,t.mrc=e;var r=g.symbolNumber(t.mx||o.symbol)||0,a=r%100;return t.om=r%200>=100,g.symbolFuncs[a](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=r(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,n,r){var a=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(s.fill,r)},g.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},g.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},g.setRect=function(t,e,n,r,a){t.call(g.setPosition,e,n).call(g.setSize,r,a)},g.translatePoint=function(t,e,n,r){var a=t.xp||n.c2p(t.x),o=t.yp||r.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,n,r){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,n,r)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,n){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},g.singleLineStyle=function(t,e,n,r,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=n||o.width||0,l=a||o.dash||"";s.stroke(e,r||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=r||a.dash||"";o.select(this).call(s.stroke,n||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=o.select(this);try{n.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),n.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,n){var a=n.marker,o=a.line,i=(n._input||{}).marker||{},l=g.tryColorscale(a,i,""),s=g.tryColorscale(a,i,"line.");r(t,e,n,l,s,a,o)},g.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=(e._input||{}).marker||{},a=g.tryColorscale(n,r,""),i=g.tryColorscale(n,r,"line.");t.each(function(t){g.singlePointStyle(t,o.select(this),e,a,i)})}},g.tryColorscale=function(t,e,n){var r=u.nestedProperty(t,n+"color").get(),a=u.nestedProperty(t,n+"colorscale").get(),o=u.nestedProperty(t,n+"cauto").get(),l=u.nestedProperty(t,n+"cmin"),s=u.nestedProperty(t,n+"cmax"),f=l.get(),d=s.get();return a&&Array.isArray(r)?(!o&&i(f)&&i(d)||(f=1/0,d=-(1/0),r.forEach(function(t){i(t)&&(f>t&&(f=+t),dd&&(f=0,d=1),l.set(f),s.set(d),u.nestedProperty(e,n+"cmin").set(f),u.nestedProperty(e,n+"cmax").set(d)),c.makeColorScaleFunc(c.extractScale(a,f,d))):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var n=o.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,n.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(f.convertToTspans);var d=o.select(this.parentNode),h=n.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,m=x[s]*u,v=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+m+","+v+")"),p>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],o=[];for(n=1;n=A&&(o.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=o.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":107,"../../lib":118,"../../lib/svg_text_utils":130,"../../registry":190,"../../traces/scatter/make_bubble_size_func":222,"../../traces/scatter/subtypes":227,"../color":25,"../colorscale":40,"./symbol_defs":50,d3:8,"fast-isnumeric":11}],50:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"; -},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:8}],51:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],52:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&["linear","log"].indexOf(n.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var m=g.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(n.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=r(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");l=!m.size(),l?m=e.append("path").classed("yerror",!0):u&&(m=m.transition().duration(n.duration).ease(n.easing)),m.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var v=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-v)+"v"+2*v+"m0,-"+v+"H"+i.xs,i.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":227,d3:8,"fast-isnumeric":11}],57:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":25,d3:8}],58:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":151}],59:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}e=e||{},r("source"),r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var l=0;l<2;l++){var s={_fullLayout:n},c=["x","y"][l];a.coerceRef(t,e,s,c,"paper")}return e}var a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var n=t.images,a=e.images=[],o=0;o=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],63:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":114,"../../plots/font_attributes":166,"../color/attributes":24}],64:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],65:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":118,"../../plots/layout_attributes":180,"../../registry":190,"./attributes":63,"./helpers":68}],66:[function(t,e,n){"use strict";function r(t,e){function n(n){v.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,v=Math.max(e.height,v)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,F,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,_=n.showlegend&&x(t.calcdata,v),M=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=k.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=k.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=k.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var S=L.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var z=S.selectAll("g.traces").data(f.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==k.enter().size();O&&(i(t,S,z),l(t));var E=0,P=n.width,N=0,D=n.height;i(t,S,z),v.height>D?s(t):l(t);var R=n._size,j=R.l+R.w*v.x,I=R.t+R.h*(1-v.y);w.isRightAnchor(v)?j-=v.width:w.isCenterAnchor(v)&&(j-=v.width/2),w.isBottomAnchor(v)?I-=v.height:w.isMiddleAnchor(v)&&(I-=v.height/2);var F=v.width,B=R.w;F>B?(j=R.l,F=B):(j+F>P&&(j=P-F),jH?(I=R.t,q=H):(I+q>D&&(I=D-q),In[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":118,"../../registry":190,"../../traces/pie/style_one":205,"../../traces/scatter/subtypes":227,"../color":25,"../drawing":49,d3:8}],71:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||v||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(m,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":118,"../color":25,"./attributes":75,"./button_attributes":76,"./constants":77}],79:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../plots/cartesian/axes"),o=t("./constants"),i=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=e.shapes;if(n.length&&t._fullData.length)for(var i=0;ie;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},a=S.line.width?S.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",S.opacity).call(_.stroke,a).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);z&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&f(t,o,S,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={xref:l.xref,yref:l.yref},c={};"string"==typeof n&&n?c[n]=r:x.isPlainObject(n)&&(c=n);var u=Object.keys(c);for(o=0;oY&&r>Z&&!t.shiftKey?M.getCursor(a/n,1-o/r):"move";k(e,i),G=i.split("-")[0]}function o(e){F=b.getFromId(t,n.xref),B=b.getFromId(t,n.yref),q=T.getDataToPixel(t,F),H=T.getDataToPixel(t,B,!0),V=T.getPixelToData(t,F),U=T.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(j=n.path,I=o+".path"):(u=q(n.x0),f=H(n.y0),d=q(n.x1),h=H(n.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uZ&&(c[S]=n[P]=U(l),c[z]=n[N]=U(s)),f-u>Y&&(c[O]=n[D]=V(u),c[E]=n[R]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,v,x,_,w,A,L,C,S,z,O,E,P,N,D,R,j,I,F,B,q,H,V,U,G,Y=10,Z=10,X={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=X.element.getBoundingClientRect();M.init(X)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.dataToLinear(l),r=function(t){return l._offset+l.l2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.dataToLinear(s),o=function(t){return s._offset+s.l2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),M=t("../dragelement"),k=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults");e.exports={draw:r,drawOne:a}},{"../../lib":118,"../../lib/setcursor":128,"../../plotly":141, -"../../plots/cartesian/axes":145,"../color":25,"../dragelement":47,"../drawing":49,"./constants":89,"./defaults":90,"./helpers":92,"./shape_defaults":94,"fast-isnumeric":11}],92:[function(t,e,n){"use strict";n.dataToLinear=function(t){return"category"===t.type?t.c2l:t.d2l},n.linearToData=function(t){return"category"===t.type?t.l2c:t.l2d},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.dataToLinear(e);a=function(t){return e._offset+e.l2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.linearToData(e);a=function(t){return i(e.p2l(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],93:[function(t,e,n){"use strict";n.moduleType="component",n.name="shapes",n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.calcAutorange=t("./calc_autorange");var r=t("./draw");n.draw=r.draw,n.drawOne=r.drawOne},{"./attributes":87,"./calc_autorange":88,"./defaults":90,"./draw":91}],94:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e){function n(e,n){return r.coerce(t,l,o,e,n)}var l={};n("layer"),n("opacity"),n("fillcolor"),n("line.color"),n("line.width"),n("line.dash");for(var s=t.path?"path":"rect",c=n("type",s),u=["x","y"],f=0;f<2;f++){var d=u[f],h={_fullLayout:e},p=a.coerceRef(t,l,h,d);if("path"!==c){var g=.25,m=.75;if("paper"!==p){var v=a.getFromId(h,p),y=i.linearToData(v);g=y(v.range[0]+g*(v.range[1]-v.range[0])),m=y(v.range[0]+m*(v.range[1]-v.range[0]))}n(d+"0",g),n(d+"1",m)}}return"path"===c?n("path"):r.noneOrAll(t,l,["x0","x1","y0","y1"]),l}},{"../../lib":118,"../../plots/cartesian/axes":145,"./attributes":87,"./helpers":92}],95:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":114,"../../plots/animation_attributes":142,"../../plots/font_attributes":166,"../../plots/pad_attributes":181,"./constants":96}],96:[function(t,e,n){"use strict";e.exports={name:"sliders",itemName:"slider",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],97:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}var l=a(t,e),s=r("visible",l.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,c,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+S.railTouchRectClass).data([0]);r.enter().append("rect").classed(S.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,S.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),k.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+S.railRectClass).data([0]);n.enter().append("rect").classed(S.railRectClass,!0);var r=e.inputAreaLength-2*S.railInset;n.attr({width:r,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(n,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+S.groupClassName).data(n,a);s.enter().append("g").classed(S.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,S=O,M._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,M=t._fullLayout,k=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(S).attr("class",e),z.attr({"data-unformatted":S}).call(f);var O="Click to enter "+y+" title";t._context.editable?(S||p(),z.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",C)}},{"../../lib":118,"../../lib/svg_text_utils":130,"../../plotly":141,"../../plots/plots":182,"../color":25,"../drawing":49,d3:8,"fast-isnumeric":11}],101:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":114,"../../plots/font_attributes":166,"../../plots/pad_attributes":181,"../color/attributes":24}],102:[function(t,e,n){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],103:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}var l=a(t,e),s=r("visible",l.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,c,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],107:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],108:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.19.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":23,"./components/images":61,"./components/legend":69,"./components/rangeselector":81,"./components/rangeslider":86,"./components/shapes":93,"./components/sliders":99,"./components/updatemenus":105,"./fonts/mathjax_config":109,"./lib/queue":126,"./plot_api/plot_schema":135,"./plot_api/register":136,"./plot_api/set_plot_config":137,"./plot_api/to_image":139,"./plot_api/validate":140,"./plotly":141,"./snapshot":195,"./snapshot/download":192,"./traces/scatter":217,d3:8,"es6-promise":9}],109:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],110:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){Array.isArray(t)&&(e[n]=t[r])}},{}],111:[function(t,e,n){"use strict";function r(t){return t&&void 0!==t.valType}var a=t("fast-isnumeric"),o=t("tinycolor2"),i=t("./nested_property"),l=t("./is_plain_object"),s=t("./filter_unique"),c=t("../components/colorscale/get_scale"),u=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,r){!a(t)||void 0!==r.min&&tr.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,r){t%1||!a(t)||void 0!==r.min&&tr.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){o(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(c(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):a(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&u.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!u.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o2)return!1;var i=o[0].split("-");if(i.length>3||3!==i.length&&o[1])return!1;if(4===i[0].length)e=Number(i[0]);else{if(2!==i[0].length)return!1;var s=(new Date).getFullYear();e=((Number(i[0])-s+70)%100+200)%100+s-70}return!!l(e)&&(1===i.length?new Date(e,0,1).getTime():(n=Number(i[1])-1,!(i[1].length>2)&&n>=0&&n<=11&&(2===i.length?new Date(e,n,1).getTime():(r=Number(i[2]),!(i[2].length>2)&&r>=1&&r<=31&&(r=new Date(e,n,r).getTime(),o[1]?(i=o[1].split(":"),!(i.length>3)&&(a=Number(i[0]),!(i[0].length>2)&&a>=0&&a<=23&&(r+=36e5*a,1===i.length?r:(n=Number(i[1]),!(i[1].length>2)&&n>=0&&n<=59&&(r+=6e4*n,2===i.length?r:(t=Number(i[2]),t>=0&&t<60&&r+1e3*t)))))):r)))))},n.isDateTime=function(t){return n.dateTime2ms(t)!==!1},n.ms2DateTime=function(t,e){e||(e=0);var n=new Date(t),a=i.time.format("%Y-%m-%d")(n);return e<7776e6?(a+=" "+r(n.getHours(),2),e<432e6&&(a+=":"+r(n.getMinutes(),2),e<108e5&&(a+=":"+r(n.getSeconds(),2),e<3e5&&(a+="."+r(n.getMilliseconds(),3)))),a.replace(/([:\s]00)*\.?[0]*$/,"")):a};var s={H:["%H:%M:%S~%L","%H:%M:%S","%H:%M"],I:["%I:%M:%S~%L%p","%I:%M:%S%p","%I:%M%p"],D:["%H","%I%p","%Hh"]},c={Y:["%Y~%m~%d","%Y%m%d","%y%m%d","%m~%d~%Y","%d~%m~%Y"],Yb:["%b~%d~%Y","%d~%b~%Y","%Y~%d~%b","%Y~%b~%d"],y:["%m~%d~%y","%d~%m~%y","%y~%m~%d"],yb:["%b~%d~%y","%d~%b~%y","%y~%d~%b","%y~%b~%d"]},u=i.time.format.utc,f={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(u),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(u)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(u)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){f[t].D.push(u(e)),["H","I","D"].forEach(function(n){s[n].forEach(function(r){var a=f[t][n];a.push(u(e+"~"+r)),a.push(u(r+"~"+e))})})})});var d=/[a-z]*/g,h=function(t){return t.substr(0,3)},p=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,g=/[\s,\/\-\.\(\)]+/g,m=/~?([ap])~?m(~|$)/,v=function(t,e){return e+"m "},y=/\d\d\d\d/,x=/(^|~)[a-z]{3}/,b=/[ap]m/,_=/:/,w=/q([1-4])/,M=["31~mar","30~jun","30~sep","31~dec"],k=function(t,e){return M[e-1]},A=/ ?([+\-]\d\d:?\d\d|Z)$/;n.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(d,h).replace(p,"").replace(g,"~").replace(m,v).replace(w,k).trim().replace(A,"");var e,n,r=null,i=a(t),l=o(t);e=f[i][l],n=e.length;for(var s=0;s0&&(r.push(a),a=[])}return r.push(a),r},n.makeLine=function(t,e){var n={};return n=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(n.trace=e),n},n.makePolygon=function(t,e){var n={};if(1===t.length)n={type:"Polygon",coordinates:t};else{for(var r=new Array(t.length),a=0;an?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"./coerce":111,"./dates":112,"./extend":114,"./filter_unique":115,"./is_array":119,"./is_plain_object":120,"./loggers":121,"./matrix":122,"./nested_property":123,"./notifier":124,"./search":127,"./stats":129,d3:8}],119:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],120:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],121:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],i=!1,d(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");lo||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],s=t[1];if(no||sl)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],m=r[0][1],v=0;for(c=1;cMath.max(u,g)||s>Math.max(f,m)))if(su||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":122}],126:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;f90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":11}],130:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,m.indexOf(u.protocol)===-1?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||r(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else n(); -return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":106,"../constants/xmlns_namespaces":107,"../lib":118,d3:8}],131:[function(t,e,n){"use strict";var r=e.exports={},a=t("../plots/geo/constants").locationmodeToLayer,o=t("topojson").feature;r.getTopojsonName=function(t){return[t.scope.replace(/ /g,"-"),"_",t.resolution.toString(),"m"].join("")},r.getTopojsonPath=function(t,e){return t+e+".json"},r.getTopojsonFeatures=function(t,e){var n=a[t.locationmode],r=e.objects[n];return o(e,r).features}},{"../plots/geo/constants":168,topojson:15}],132:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function a(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var a=f.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=u.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&l(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sO.range[0]?[1,2]:[2,1]);else{var E=O.range[0],P=O.range[1];"log"===b?(E<=0&&P<=0&&n(L+".autorange",!0),E<=0?E=P/1e6:P<=0&&(P=E/1e6),n(L+".range[0]",Math.log(E)/Math.LN10),n(L+".range[1]",Math.log(P)/Math.LN10)):(n(L+".range[0]",Math.pow(10,E)),n(L+".range[1]",Math.pow(10,P)))}else n(L+".autorange",!0)}if("reverse"===A)C.range?C.range.reverse():(n(L+".autorange",!0),C.range=[1,0]),S.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var N=v.parts[1],D=v.parts[0],R=o[D]||[],j=R[N]||{};null===b&&(e[m]="remove"),2===v.parts.length&&("add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?N===-1?(g[D]=R,delete g[m]):g[m]=j:x.log("???",e)),!r(j,"x")&&!r(j,"y")||x.containsAny(m,["color","opacity","align","dash"])||(h.docalc=!0);var I=w.getComponentMethod(D,"drawOne");I(t,N,v.parts.slice(2).join("."),e[m]),delete e[m]}else M.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1]?(z.manageArrayContainers(v,b,g),h.doplot=!0):(0===v.parts[0].indexOf("scene")?h.doplot=!0:0===v.parts[0].indexOf("geo")?h.doplot=!0:0===v.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===m?h.doplot=!0:!i._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?h.docalc=!0:v.parts[0].indexOf("legend")!==-1?h.dolegend=!0:m.indexOf("title")!==-1?h.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(v.parts[1],["tick","exponent","grid","zeroline"])?h.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:v.parts.length>1&&v.parts[1].indexOf("line")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&"mirror"===v.parts[1]?h.doticks=h.dolayoutstyle=!0:"margin.pad"===m?h.doticks=h.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(h.doplot=!0):h.doplot=!0,v.set(b))}}var F=t._fullLayout.width,B=t._fullLayout.height;M.supplyDefaults(t),t.layout.autosize&&M.plotAutoSize(t,t.layout,t._fullLayout);var q=e.height||e.width||t._fullLayout.width!==F||t._fullLayout.height!==B;return q&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];m.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(C.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var o=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=o.append("g").classed("imagelayer",!0),n._shapeUpperLayer=o.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),M=t("../plots/plots"),k=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),C=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),z=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,n,r){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=E._basePlotModules,n=0;n=i.length?i[0]:i[t]:i}function a(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}if(t=z.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),n=M.supplyAnimationDefaults(n);var i=n.transition,l=n.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,s){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function u(e){if(0!==e.length){for(var i=0;io._timeToNext&&d()};e()}function p(t){return Array.isArray(i)?v>=i.length?t.transitionOpts=i[v]:t.transitionOpts=i[0]:t.transitionOpts=i,v++,t}var g,m,v=0,y=[],b=void 0===e||null===e,_=Array.isArray(e),w=!b&&!_&&x.isPlainObject(e);if(w)y.push({type:"object",data:p(x.extendFlat({},e))});else if(b||"string"==typeof e)for(g=0;g0&&TT)&&L.push(m);y=L}}y.length>0?u(y):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,n){if(t=z.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,a,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(r=e.length-1;r>=0;r--)u.push({frame:M.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:c+r});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(a=u[r].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=M.modifyFrames,s=M.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),M.modifyFrames(t,o)},y.purge=function(t){t=z.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return M.cleanPlot([],{},n,e),M.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":49,"../components/errorbars":55,"../constants/xmlns_namespaces":107,"../lib":118,"../lib/events":113,"../lib/queue":126,"../lib/svg_text_utils":130,"../plotly":141,"../plots/cartesian/graph_interact":153,"../plots/plots":182,"../plots/polar":185,"../registry":190,"./helpers":132,"./subroutines":138,d3:8,"fast-isnumeric":11}],134:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],135:[function(t,e,n){"use strict";function r(t){var e=y.attributes,n=c({type:t}),r=f(t),a=h(t),o={},i={};o.type=null,M(o,e),o=l(n.attributes,o,"attributes",t),void 0!==a.attributes&&M(o,a.attributes),o.type=t,o=u(o),s(o),L.traces[t]=w({},r,{attributes:o}),void 0!==n.layoutAttributes&&(i=l(n.layoutAttributes,i,"layoutAttributes",t),s(i),L.traces[t].layoutAttributes=i)}function a(){var t=y.layoutAttributes,e={};e=l(t,e,"layoutAttributes","*"),e=d(e),e=p(e),e=u(e),s(e),g(e),L.layout={layoutAttributes:e}}function o(t){var e=v.transformsRegistry[t],n={};n=l(n,e.attributes||{},"attributes","*"),n=u(n),s(n),g(n),L.transforms[t]={attributes:n}}function i(){L.defs={valObjects:x.valObjects,metaKeys:x.UNDERSCORE_ATTRS.concat(["description","role"])}}function l(t,e,n,r){var a,o,i,s,u;return Object.keys(t).forEach(function(f){return f===A?void Object.keys(t[f]).forEach(function(s){a=c({_module:t[f][s]}),void 0!==a&&(o=a[n],i=l(o,{},n,r),x.nestedProperty(e,s).set(M({},i)))}):f===T?void Object.keys(t[f]).forEach(function(a){a===r&&(s=c({_module:t[f][a]}),void 0!==s&&(u=s[n],u=l(u,{},n,r),k(e,u)))}):void(e[f]=x.isPlainObject(t[f])?k({},t[f]):t[f])}),e}function s(t){function e(t){return{valType:"string"}}function n(t,n,r){C.isValObject(t)?"data_array"===t.valType?(t.role="data",r[n+"src"]=e(n)):t.arrayOk===!0&&(r[n+"src"]=e(n)):x.isPlainObject(t)&&(t.role="object")}x.crawl(t,n)}function c(t){if("type"in t)return"area"===t.type?{attributes:b}:v.getModule({type:t.type});var e=v.subplotsRegistry,n=v.componentsRegistry,r=t._module;return e[r]?e[r]:n[r]?n[r]:m[r]}function u(t){return Object.keys(t).forEach(function(e){"_"===e.charAt(0)&&x.UNDERSCORE_ATTRS.indexOf(e)===-1&&delete t[e]}),t}function f(t){return"area"===t?{}:v.modules[t].meta||{}}function d(t){return w(t,{radialaxis:_.radialaxis,angularaxis:_.angularaxis}),w(t,_.layout),t}function h(t){if("area"===t)return{};var e=v.subplotsRegistry,n=Object.keys(e).filter(function(e){return v.traceIs({type:t},e)})[0];return void 0===n?{}:e[n]}function p(t){var e=v.subplotsRegistry;return Object.keys(t).forEach(function(n){Object.keys(e).forEach(function(r){var a,o=e[r];o.attrRegex&&(a="cartesian"===r||"gl2d"===r?o.attrRegex.x.test(n)||o.attrRegex.y.test(n):o.attrRegex.test(n),a&&(t[n][x.IS_SUBPLOT_OBJ]=!0))})}),t}function g(t){function e(t,e,n){if(t[x.IS_LINKED_TO_ARRAY]===!0){var r=e.substr(0,e.length-1);delete t[x.IS_LINKED_TO_ARRAY],n[e]={items:{}},n[e].items[r]=t,n[e].role="object"}}x.crawl(t,e)}var m=t("../plotly"),v=t("../registry"),y=t("../plots/plots"),x=t("../lib"),b=t("../plots/polar/area_attributes"),_=t("../plots/polar/axis_attributes"),w=x.extendFlat,M=x.extendDeep,k=x.extendDeepAll,A="_nestedModules",T="_composedModules",L={traces:{},layout:{},transforms:{},defs:{}},C=e.exports={};C.get=function(){return v.allTypes.concat("area").forEach(r),a(),Object.keys(v.transformsRegistry).forEach(o),i(),L},C.crawl=x.crawl,C.isValObject=x.isValObject},{"../lib":118,"../plotly":141,"../plots/plots":182,"../plots/polar/area_attributes":183,"../plots/polar/axis_attributes":184,"../registry":190}],136:[function(t,e,n){"use strict";function r(t){i.register(t,t.name,t.categories,t.meta),i.subplotsRegistry[t.basePlotModule.name]||i.registerSubplot(t.basePlotModule)}function a(t){if("string"!=typeof t.name)throw new Error("Transform module *name* must be a string.");var e="Transform module "+t.name,n="function"==typeof t.transform,r="function"==typeof t.calcTransform;if(!n&&!r)throw new Error(e+" is missing a *transform* or *calcTransform* method.");n&&r&&l.log([e+" has both a *transform* and *calcTransform* methods.","Please note that all *transform* methods are executed","before all *calcTransform* methods."].join(" ")),l.isPlainObject(t.attributes)||l.log(e+" registered without an *attributes* object."),"function"!=typeof t.supplyDefaults&&l.log(e+" registered without a *supplyDefaults* method."),i.transformsRegistry[t.name]=t}function o(t){i.componentsRegistry[t.name]=t}var i=t("../registry"),l=t("../lib");e.exports=function(t){if(!t)throw new Error("No argument passed to Plotly.register.");t&&!Array.isArray(t)&&(t=[t]);for(var e=0;e1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.td;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":118,"../plotly":141,"../snapshot/cloneplot":191,"../snapshot/helpers":194,"../snapshot/svgtoimg":196,"../snapshot/tosvg":198,"fast-isnumeric":11}],140:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=n.length,v=0;vc&&e=864e5?t._tickround="d":n>=36e5?t._tickround="H":n>=6e4?t._tickround="M":n>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(n/2)/Math.LN10);else{x(n)||(n=Number(n.substr(1))),t._tickround=2-Math.floor(Math.log(n)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var r=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(r)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((r-1)/3):t._tickexponent=r)}else"M"===n.charAt(0)?t._tickround=2===n.length?"m":"y":t._tickround=null}function i(t,e){var n=t.match(q),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(q,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o=e.x,l=t._tickround,s=new Date(o),c="";n&&t.hoverformat?a=i(t.hoverformat,o):t.tickformat?a=i(t.tickformat,o):(r&&(x(l)?l+=2:l={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[l]),"y"===l?a=D(s):"m"===l?a=R(s):(o!==t._tmin||n||(c="
"+D(s)),"d"===l?a=j(s):"H"===l?a=I(s):(o!==t._tmin||n||(c="
"+j(s)+", "+D(s)),a=F(s),"M"!==l&&(a+=B(s),"S"!==l&&(a+=d(v(o/1e3,1),t,"none",n).substr(1)))))),e.text=a+c}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=t<0,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=H[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var p=r-1,g=r+1;n="tozero"===t.rangemode?r<0?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var n=T.list(t,"",!0),r=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),M=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},T.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[o,i]};T.autoTicks(f,l);var d,h=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var a=t.range[1]=l:s<=l)&&(i.push(s),!(i.length>1e3));s=T.tickIncrement(s,t.dtick,a));t._tmax=i[i.length-1];for(var c=new Array(i.length),u=0;u157788e5?(e/=315576e5,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,S)):e>12096e5?(e/=26298e5,t.dtick="M"+a(e,1,z)):e>432e5?(t.dtick=a(e,864e5,E),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=a(e,36e5,z):e>3e4?t.dtick=a(e,6e4,O):e>500?t.dtick=a(e,1e3,O):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var r=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/r,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,S)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?N:P,s=t+.01*r,c=_.roundUp(v(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]r:c1&&e2*r}function o(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("./clean_datum");e.exports=function(t){return a(t)?"date":o(t)?"category":r(t)?"linear":"-"}},{"../../lib":118,"./clean_datum":150,"fast-isnumeric":11}],147:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var l=i(e,n,r);if(l){if("histogram"===l.type&&r==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,r)){for(var s,u=a(l),f=[],d=0;d0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],150:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return a.ms2DateTime(t);if("string"!=typeof t&&!r(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){a.error(e,t)}return t}},{"../../lib":118,"fast-isnumeric":11}],151:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],152:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?f.ms2DateTime(r,a):"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,n,l,_,w,M,k){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+mt+", "+vt+")").attr("d",ut+"Z"),pt=gt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+mt+", "+vt+")").attr("d","M0,0Z"),S();for(var o=0;o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),pt.transition().style("opacity",1).duration(200),ft=!0)}function O(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),b=!1)))}function P(e,n){var a=1===(M+k).length;if(e)I();else if(2!==n||a){if(1===n&&a){var o=M?V[0]:H[0],i="s"===M||"w"===k?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",f="middle";if(o.fixedrange)return;M?(f="n"===M?"top":"bottom","right"===o.side&&(u="right")):"e"===k&&(u="right"),rt.call(d.makeEditable,null,{immediate:!0,background:B.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var n="category"===o.type?o.c2l(e):o.d2l(e);void 0!==n&&c.relayout(t,l,n)})}}else j()}function N(e){function n(t,e,n){if(!t.fixedrange){T(t.range);var r=t.range,a=r[0]+(r[1]-r[0])*e;t.range=[a+(r[0]-a)*n,a+(r[1]-a)*n]}}if(t._context.scrollZoom||B._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(L(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(xt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=_t.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=yt[0]+yt[2]*s,u=(l.bottom-e.clientY)/l.height,d=yt[1]+yt[3]*(1-u);if(k){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,n){for(var r=1-e,o=0,i=0;i0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rX.width||Z<0||Z>X.height)return _.unhoverRaw(t,e)}else Y="xpx"in e?e.xpx:k[0]._length/2,Z="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?r(o,e.xval):a(k,Y),E="yval"in e?r(o,e.yval):a(A,Z),!g(O[0])||!g(E[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(N=0;N1||R.hoverinfo.indexOf("name")!==-1?R.name:void 0,index:!1,distance:Math.min(W,M.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[j]&&(H.subplot=i[j]._subplot),V=U.length,"array"===F){var Q=e[N];"pointNumber"in Q?(H.index=Q.pointNumber,F="closest"):(F="","xval"in Q&&(B=Q.xval,F="x"),"yval"in Q&&(q=Q.yval,F=F?"closest":"y"))}else B=O[I],q=E[I];if(R._module&&R._module.hoverPoints){var $=R._module.hoverPoints(H,B,q,F);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&U.push(s(J,z))}else m.log("Unrecognized trace type in hover:",R);"closest"===z&&U.length>V&&(U.splice(0,V),W=U[0].distance)}if(0===U.length)return _.unhoverRaw(t,e);var tt="y"===z&&G.length>1;U.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),nt={hovermode:z,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},rt=c(U,nt);u(U,tt?"xa":"ya"),f(rt,tt);var at=t._hoverdata,ot=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),m=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),m=d.node().getBoundingClientRect().width+2*E):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var v,M,L=f.node().getBoundingClientRect(),C=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),N=L.width+O+E+m;t.ty0=_-L.top,t.bx=L.width+2*E,t.by=L.height+2*E,t.anchor="start",t.txwidth=L.width,t.tx2width=m,t.offset=0,o?(t.pos=C,v=S+P/2+N<=k,M=S-P/2-N>=0,"top"!==t.idealAlign&&v||!M?v?(S+=P/2,t.anchor="start"):t.anchor="middle":(S-=P/2,t.anchor="end")):(t.pos=S,v=C+z/2+N<=w,M=C-z/2-N>=0,"left"!==t.idealAlign&&v||!M?v?(C+=z/2,t.anchor="start"):t.anchor="middle":(C-=z/2,t.anchor="end")),f.attr("text-anchor",t.anchor),m&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+C+","+S+")"+(o?"rotate("+T+")":""))}),S}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?C:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var m=f[i];for(l=m.length-1;l>=0;l--){var v=m[l],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(O+E),l=i+o*(t.txwidth+E),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-z,s=t.offset*S),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*O+s)+","+(O+c)+"v"+(t.by/2-O)+"h"+r*t.bx+"v-"+t.by+"H"+(r*O+s)+"V"+(c-O)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+E).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*E+s,c+t.ty0-t.by/2+E),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),k=t("./dragbox"),A=e.exports={};A.unhover=_.unhover,A.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},A.supplyLayoutDefaults=function(t,e,n){function r(n,r){return m.coerce(t,e,A.layoutAttributes,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=A.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},A.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+M.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},A.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},A.getClosest=function(t,e,n){if(n.index!==!1)n.index>=0&&n.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":118,"fast-isnumeric":11}],159:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-m.left,b=n-m.top,_=x,w=b,M="M"+x+","+b,k=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),C=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",M+"Z");var z,O,E,P,N,D=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),R=[],j=a.gd,I=[];for(z=0;z0)return Math.log(e)/Math.LN10;if(e<=0&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*u*Math.abs(r-a))}return i.BADNUM}function n(t){return Math.pow(10,t)}function c(t){return a(t)?Number(t):i.BADNUM}var u=10;if(t.c2l="log"===t.type?e:c,t.l2c="log"===t.type?n:c,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(e){var n,r=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var i=s.getFromId(t._gd,t.overlaying);t.domain=i.domain}var l=e&&t._r?t._r:t.range;for(l&&2===l.length&&l[0]!==l[1]||(l=[-1,1]),n=0;n<2;n++)a(l[n])||(l[n]=a(l[1-n])?l[1-n]*(n?10:.1):n?1:-1),l[n]<-(Number.MAX_VALUE/2)?l[n]=-(Number.MAX_VALUE/2):l[n]>Number.MAX_VALUE/2&&(l[n]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l[0]-l[1]),t._b=-t._m*l[1]):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l[1]-l[0]), -t._b=-t._m*l[0]),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):i.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},["linear","log","-"].indexOf(t.type)!==-1)t.c2d=c,t.d2c=function(t){return t=l(t),a(t)?Number(t):i.BADNUM},t.d2l=function(e,n){return"log"===t.type?t.c2l(t.d2c(e),n):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return a(t)?o.ms2DateTime(t):i.BADNUM},t.d2c=function(t){return a(t)?Number(t):o.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(o.dateTime2ms);!a(t.range[0])&&a(f[0])&&(t.range[0]=f[0]),!a(t.range[1])&&a(f[1])&&(t.range[1]=f[1])}catch(e){o.error(e,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var n=t._categories.indexOf(e);return n===-1?i.BADNUM:n},t.d2l=t.d2c);t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;on.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var M;c&&(M=c());var k,A,T,L=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),k=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":118,"../../plotly":141,"../../registry":190,"./axes":145,d3:8}],165:[function(t,e,n){"use strict";function r(t,e,n){var r,a,o,i=!1;if("data"===e.type)r=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;r=t._fullLayout}return a=c.nestedProperty(r,e.prop).get(),o=n[e.type]=n[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var n=[],r=e[0],a={};if("string"==typeof r)a[r]=e[1];else{if(!c.isPlainObject(r))return n;a=r}return l(a,function(t,e,r){n.push({type:"layout",prop:t,value:r})},"",0),n}function i(t,e){var n,r,a,o,i=[];if(r=e[0],a=e[1],n=e[2],o={},"string"==typeof r)o[r]=a;else{if(!c.isPlainObject(r))return i;o=r,void 0===n&&(n=a)}return void 0===n&&(n=null),l(o,function(e,r,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);n&&(l=Math.min(l,n.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,r+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");n.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=n.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){r(t,s,i.cache),i.check=function(){if(l){var e=r(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;fa},M.render=function(){function t(t){var e=n.projection(t.lonlat);return e?"translate("+e[0]+","+e[1]+")":null}function e(t){return n.isLonLatOverEdges(t.lonlat)?"0":"1.0"}var n=this,r=n.framework,a=r.select("g.choroplethlayer"),o=r.select("g.scattergeolayer"),i=n.path;r.selectAll("path.basepath").attr("d",i),r.selectAll("path.graticulepath").attr("d",i),a.selectAll("path.choroplethlocation").attr("d",i),a.selectAll("path.basepath").attr("d",i),o.selectAll("path.js-line").attr("d",i),null!==n.clipAngle?(o.selectAll("path.point").style("opacity",e).attr("transform",t),o.selectAll("text").style("opacity",e).attr("transform",t)):(o.selectAll("path.point").attr("transform",t),o.selectAll("text").attr("transform",t))}},{"../../components/color":25,"../../components/drawing":49,"../../constants/xmlns_namespaces":107,"../../lib/topojson_utils":131,"../../plots/cartesian/axes":145,"../../plots/cartesian/graph_interact":153,"./constants":168,"./projections":176,"./set_scale":177,"./zoom":178,"./zoom_reset":179,d3:8,topojson:15}],170:[function(t,e,n){"use strict";function r(t,e){for(var n=[],r=0;rr^h>r&&n<(d-c)*(r-u)/(h-u)+c&&(a=!a)}return a}function i(t){return t?t/Math.sin(t):1}function l(t){return t>1?E:t<-1?-E:Math.asin(t)}function s(t){return t>1?0:t<-1?O:Math.acos(t)}function c(t,e){var n=(2+E)*Math.sin(e);e/=2;for(var r=0,a=1/0;r<10&&Math.abs(a)>S;r++){var o=Math.cos(e);e-=a=(e+Math.sin(e)*(o+2)-n)/(2*o*(1+o))}return[2/Math.sqrt(O*(4+O))*t*(1+Math.cos(e)),2*Math.sqrt(O/(4+O))*Math.sin(e)]}function u(t,e){function n(n,r){var a=j(n/e,r);return a[0]*=t,a}return arguments.length<2&&(e=t),1===e?j:e===1/0?d:(n.invert=function(n,r){var a=j.invert(n/t,r);return a[0]*=e,a},n)}function f(){var t=2,e=R(u),n=e(t);return n.coefficient=function(n){return arguments.length?e(t=+n):t},n}function d(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function h(t,e){return[3*t/(2*O)*Math.sqrt(O*O/3-e*e),e]}function p(t,e){return[t,1.25*Math.log(Math.tan(O/4+.4*e))]}function g(t){return function(e){var n,r=t*Math.sin(e),a=30;do e-=n=(e+Math.sin(e)-r)/(1+Math.cos(e));while(Math.abs(n)>S&&--a>0);return e/2}}function m(t,e,n){function r(n,r){return[t*n*Math.cos(r=a(r)),e*Math.sin(r)]}var a=g(n);return r.invert=function(r,a){var o=l(a/e);return[r/(t*Math.cos(o)),l((2*o+Math.sin(2*o))/n)]},r}function v(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),e*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}function y(t,e){var n,r=Math.min(18,36*Math.abs(e)/O),a=Math.floor(r),o=r-a,i=(n=F[a])[0],l=n[1],s=(n=F[++a])[0],c=n[1],u=(n=F[Math.min(19,++a)])[0],f=n[1];return[t*(s+o*(u-i)/2+o*o*(u-2*s+i)/2),(e>0?E:-E)*(c+o*(f-l)/2+o*o*(f-2*c+l)/2)]}function x(t,e){return[t*Math.cos(e),e]}function b(t,e){var n=Math.cos(e),r=i(s(n*Math.cos(t/=2)));return[2*n*Math.sin(t)*r,Math.sin(e)*r]}function _(t,e){var n=b(t,e);return[(n[0]+t/E)/2,(n[1]+e)/2]}t.geo.project=function(t,e){var r=e.stream;if(!r)throw new Error("not yet supported");return(t&&w.hasOwnProperty(t.type)?w[t.type]:n)(t,r)};var w={Feature:e,FeatureCollection:function(t,n){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,n)})}}},M=[],k=[],A={point:function(t,e){M.push([t,e])},result:function(){var t=M.length?M.length<2?{type:"Point",coordinates:M[0]}:{type:"MultiPoint",coordinates:M}:null;return M=[],t}},T={lineStart:r,point:function(t,e){M.push([t,e])},lineEnd:function(){M.length&&(k.push(M),M=[])},result:function(){var t=k.length?k.length<2?{type:"LineString",coordinates:k[0]}:{type:"MultiLineString",coordinates:k}:null;return k=[],t}},L={polygonStart:r,lineStart:r,point:function(t,e){M.push([t,e])},lineEnd:function(){var t=M.length;if(t){do M.push(M[0].slice());while(++t<4);k.push(M),M=[]}},polygonEnd:r,result:function(){if(!k.length)return null;var t=[],e=[];return k.forEach(function(n){a(n)?t.push([n]):e.push(n)}),e.forEach(function(e){var n=e[0];t.some(function(t){if(o(t[0],n))return t.push(e),!0})||t.push([e])}),k=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},C={Point:A,MultiPoint:A,LineString:T,MultiLineString:T,Polygon:L,MultiPolygon:L,Sphere:L},S=1e-6,z=S*S,O=Math.PI,E=O/2,P=(Math.sqrt(O),O/180),N=180/O,D=t.geo.projection,R=t.geo.projectionMutator;t.geo.interrupt=function(e){function n(t,n){for(var r=n<0?-1:1,a=s[+(n<0)],o=0,i=a.length-1;oa[o][2][0];++o);var l=e(t-a[o][1][0],n);return l[0]+=e(a[o][1][0],r*n>r*a[o][0][1]?a[o][0][1]:n)[0],l}function r(){l=s.map(function(t){return t.map(function(t){var n,r=e(t[0][0],t[0][1])[0],a=e(t[2][0],t[2][1])[0],o=e(t[1][0],t[0][1])[1],i=e(t[1][0],t[1][1])[1];return o>i&&(n=o,o=i,i=n),[[r,o],[a,i]]})})}function a(){for(var e=1e-6,n=[],r=0,a=s[0].length;r=0;--r){var i=s[1][r],l=180*i[0][0]/O,c=180*i[0][1]/O,u=180*i[1][1]/O,f=180*i[2][0]/O,d=180*i[2][1]/O;n.push(o([[f-e,d-e],[f-e,u+e],[l+e,u+e],[l+e,c-e]],30))}return{type:"Polygon",coordinates:[t.merge(n)]}}function o(t,e){for(var n,r,a,o=-1,i=t.length,l=t[0],s=[];++oS&&--a>0);return[t/(.8707+(o=r*r)*(-.131979+o*(-.013791+o*o*o*(.003971-.001529*o)))),r]},(t.geo.naturalEarth=function(){return D(v)}).raw=v;var F=[[.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]];F.forEach(function(t){t[1]*=1.0144}),y.invert=function(t,e){var n=e/E,r=90*n,a=Math.min(18,Math.abs(r/5)),o=Math.max(0,Math.floor(a));do{var i=F[o][1],l=F[o+1][1],s=F[Math.min(19,o+2)][1],c=s-i,u=s-2*l+i,f=2*(Math.abs(n)-l)/c,d=u/c,h=f*(1-d*f*(1-2*d*f));if(h>=0||1===o){r=(e>=0?5:-5)*(h+a);var p,g=50;do a=Math.min(18,Math.abs(r)/5),o=Math.floor(a),h=a-o,i=F[o][1],l=F[o+1][1],s=F[Math.min(19,o+2)][1],r-=(p=(e>=0?E:-E)*(l+h*(s-i)/2+h*h*(s-2*l+i)/2)-e)*N;while(Math.abs(p)>z&&--g>0);break}}while(--o>=0);var m=F[o][0],v=F[o+1][0],y=F[Math.min(19,o+2)][0];return[t/(v+h*(y-m)/2+h*h*(y-2*v+m)/2),r*P]},(t.geo.robinson=function(){return D(y)}).raw=y,x.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return D(x)}).raw=x,b.invert=function(t,e){if(!(t*t+4*e*e>O*O+S)){var n=t,r=e,a=25;do{var o,i=Math.sin(n),l=Math.sin(n/2),c=Math.cos(n/2),u=Math.sin(r),f=Math.cos(r),d=Math.sin(2*r),h=u*u,p=f*f,g=l*l,m=1-p*c*c,v=m?s(f*c)*Math.sqrt(o=1/m):o=0,y=2*v*f*l-t,x=v*u-e,b=o*(p*g+v*f*c*h),_=o*(.5*i*d-2*v*u*l),w=.25*o*(d*l-v*u*p*i),M=o*(h*c+v*g*f),k=_*w-M*b;if(!k)break;var A=(x*_-y*M)/k,T=(y*w-x*b)/k;n-=A,r-=T}while((Math.abs(A)>S||Math.abs(T)>S)&&--a>0);return[n,r]}},(t.geo.aitoff=function(){return D(b)}).raw=b,_.invert=function(t,e){var n=t,r=e,a=25;do{var o,i=Math.cos(r),l=Math.sin(r),c=Math.sin(2*r),u=l*l,f=i*i,d=Math.sin(n),h=Math.cos(n/2),p=Math.sin(n/2),g=p*p,m=1-f*h*h,v=m?s(i*h)*Math.sqrt(o=1/m):o=0,y=.5*(2*v*i*p+n/E)-t,x=.5*(v*l+r)-e,b=.5*o*(f*g+v*i*h*u)+.5/E,_=o*(d*c/4-v*l*p),w=.125*o*(c*p-v*l*f*d),M=.5*o*(u*h+v*g*i)+.5,k=_*w-M*b,A=(x*_-y*M)/k,T=(y*w-x*b)/k;n-=A,r-=T}while((Math.abs(A)>S||Math.abs(T)>S)&&--a>0);return[n,r]},(t.geo.winkel3=function(){return D(_)}).raw=_}e.exports=r},{}],177:[function(t,e,n){"use strict";function r(t,e){var n=t.projection,r=t.lonaxis,i=t.lataxis,s=t.domain,c=t.framewidth||0,u=e.w*(s.x[1]-s.x[0]),f=e.h*(s.y[1]-s.y[0]),d=r.range[0]+l,h=r.range[1]-l,p=i.range[0]+l,g=i.range[1]-l,m=r._fullRange[0]+l,v=r._fullRange[1]-l,y=i._fullRange[0]+l,x=i._fullRange[1]-l;n._translate0=[e.l+u/2,e.t+f/2];var b=h-d,_=g-p,w=[d+b/2,p+_/2],M=n._rotate;n._center=[w[0]+M[0],w[1]+M[1]];var k=function(e){function r(t){return Math.min(_*u/(t[1][0]-t[0][0]),_*f/(t[1][1]-t[0][1]))}var i,l,s,b,_=e.scale(),w=n._translate0,M=a(d,p,h,g),k=a(m,y,v,x);s=o(e,M),i=r(s),b=o(e,k),n._fullScale=r(b),e.scale(i),s=o(e,M),l=[w[0]-s[0][0]+c,w[1]-s[0][1]+c],n._translate=l,e.translate(l),s=o(e,M),t._isAlbersUsa||e.clipExtent(s),i=n.scale*i,n._scale=i,t._width=Math.round(s[1][0])+c,t._height=Math.round(s[1][1])+c,t._marginX=(u-Math.round(s[1][0]))/2,t._marginY=(f-Math.round(s[1][1]))/2};return k}function a(t,e,n,r){var a=(n-t)/4;return{type:"Polygon",coordinates:[[[t,e],[t,r],[t+a,r],[t+2*a,r],[t+3*a,r],[n,r],[n,e],[n-a,e],[n-2*a,e],[n-3*a,e],[t,e]]]}}function o(t,e){return i.geo.path().projection(t).bounds(e)}var i=t("d3"),l=t("./constants").clipPad;e.exports=r},{"./constants":168,d3:8}],178:[function(t,e,n){"use strict";function r(t,e){var n;return(n=e._isScoped?o:e._clipAngle?l:i)(t,e.projection)}function a(t,e){var n=e._fullScale;return _.behavior.zoom().translate(t.translate()).scale(t.scale()).scaleExtent([.5*n,100*n])}function o(t,e){function n(){_.select(this).style(k)}function r(){i.scale(_.event.scale).translate(_.event.translate),t.render()}function o(){_.select(this).style(A)}var i=t.projection,l=a(i,e);return l.on("zoomstart",n).on("zoom",r).on("zoomend",o),l}function i(t,e){function n(t){return m.invert(t)}function r(t){var e=m(n(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function o(){_.select(this).style(k),s=_.mouse(this),c=m.rotate(),u=m.translate(),f=c,d=n(s)}function i(){return h=_.mouse(this),r(s)?(v.scale(m.scale()),void v.translate(m.translate())):(m.scale(_.event.scale),m.translate([u[0],_.event.translate[1]]),d?n(h)&&(g=n(h),p=[f[0]+(g[0]-d[0]),c[1],c[2]],m.rotate(p),f=p):(s=h,d=n(s)),void t.render())}function l(){_.select(this).style(A)}var s,c,u,f,d,h,p,g,m=t.projection,v=a(m,e),y=2;return v.on("zoomstart",o).on("zoom",i).on("zoomend",l),v}function l(t,e){function n(t){v++||t({type:"zoomstart"})}function r(t){t({type:"zoom"})}function o(t){--v||t({type:"zoomend"})}var i,l=t.projection,h={r:l.rotate(),k:l.scale()},p=a(l,e),g=b(p,"zoomstart","zoom","zoomend"),v=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(k);var t=_.mouse(this),e=l.rotate(),a=e,o=l.translate(),v=c(e);i=s(l,t),y.call(p,"zoom",function(){var n=_.mouse(this);if(l.scale(h.k=_.event.scale),i){if(s(l,n)){l.rotate(e).translate(o);var c=s(l,n),p=f(i,c),y=m(u(v,p)),x=h.r=d(y,i,a);isFinite(x[0])&&isFinite(x[1])&&isFinite(x[2])||(x=a),l.rotate(x),a=x}}else t=n,i=s(l,t);r(g.of(this,arguments))}),n(g.of(this,arguments))}).on("zoomend",function(){_.select(this).style(A),y.call(p,"zoom",null),o(g.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,g,"on")}function s(t,e){var n=t.invert(e);return n&&isFinite(n[0])&&isFinite(n[1])&&v(n)}function c(t){var e=.5*t[0]*w,n=.5*t[1]*w,r=.5*t[2]*w,a=Math.sin(e),o=Math.cos(e),i=Math.sin(n),l=Math.cos(n),s=Math.sin(r),c=Math.cos(r);return[o*l*c+a*i*s,a*l*c-o*i*s,o*i*c+a*l*s,o*l*s-a*i*c]}function u(t,e){var n=t[0],r=t[1],a=t[2],o=t[3],i=e[0],l=e[1],s=e[2],c=e[3];return[n*i-r*l-a*s-o*c,n*l+r*i+a*c-o*s,n*s-r*c+a*i+o*l,n*c+r*s-a*l+o*i]}function f(t,e){if(t&&e){var n=x(t,e),r=Math.sqrt(y(n,n)),a=.5*Math.acos(Math.max(-1,Math.min(1,y(t,e)))),o=Math.sin(a)/r;return r&&[Math.cos(a),n[2]*o,-n[1]*o,n[0]*o]}}function d(t,e,n){var r=g(e,2,t[0]);r=g(r,1,t[1]),r=g(r,0,t[2]-n[2]);var a,o,i=e[0],l=e[1],s=e[2],c=r[0],u=r[1],f=r[2],d=Math.atan2(l,i)*M,p=Math.sqrt(i*i+l*l);Math.abs(u)>p?(o=(u>0?90:-90)-d,a=0):(o=Math.asin(u/p)*M-d,a=Math.sqrt(p*p-u*u));var m=180-o-2*d,v=(Math.atan2(f,c)-Math.atan2(s,a))*M,y=(Math.atan2(f,c)-Math.atan2(s,-a))*M,x=h(n[0],n[1],o,v),b=h(n[0],n[1],m,y);return x<=b?[o,v,n[2]]:[m,y,n[2]]}function h(t,e,n,r){var a=p(n-t),o=p(r-e);return Math.sqrt(a*a+o*o)}function p(t){return(t%360+540)%360-180}function g(t,e,n){var r=n*w,a=t.slice(),o=0===e?1:0,i=2===e?1:2,l=Math.cos(r),s=Math.sin(r);return a[o]=t[o]*l-t[i]*s,a[i]=t[i]*l+t[o]*s,a}function m(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*M,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*M,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*M]}function v(t){var e=t[0]*w,n=t[1]*w,r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function y(t,e){for(var n=0,r=0,a=t.length;r=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(n._initialAutoSizeIsDone){var c=n.width,f=n.height;p.supplyLayoutGlobalDefaults(o,r),o.width||(r.width=c),o.height||(r.height=f)}else{p.supplyLayoutGlobalDefaults(o,r);var d=!o.width||!o.height,h=r.autosize,g=t._context&&t._context.autosizable,m=d&&(h||g);m?p.plotAutoSize(t,o,r):d&&p.sanitizeMargins(t),!h&&d&&(o.width=r.width,o.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=s.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,r),r._has=p._hasPlotType.bind(r);var v=r._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,m=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(g*(m.width-f)),a=Math.round(g*(m.height-h))}else{var v=s?window.getComputedStyle(t):{};r=parseFloat(v.width)||n.width,a=parseFloat(v.height)||n.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;r1,_=!e.height&&Math.abs(n.height-a)>1;(_||b)&&(b&&(n.width=r),_&&(n.height=a)),t._initialAutoSize||(t._initialAutoSize={width:r,height:a}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n){var r,a;u.Axes.supplyLayoutDefaults(t,e,n);var o=e._basePlotModules;for(r=0;r.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var m=s[t].t.val,v=s[t].t.size;if(m>d){var y=(h*m+(v-e.height)*d)/(m-d),x=(v*(1-d)+(h-e.height)*(1-m))/(m-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!t._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):t&&t.getTime?d.ms2DateTime(t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var n,r,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(n=0;n0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(n)for(l=0;l=0,S=C?f.angularAxis.domain:r.extent(k),z=Math.abs(k[1]-k[0]);T&&!A&&(z=0);var O=S.slice();L&&A&&(O[1]+=z);var E=f.angularAxis.ticksCount||4;E>8&&(E=E/(E/8)+E%8),f.angularAxis.ticksStep&&(E=(O[1]-O[0])/E);var P=f.angularAxis.ticksStep||(O[1]-O[0])/(E*(f.minorTicks+1));M&&(P=Math.max(Math.round(P),1)),O[2]||(O[2]=P);var N=r.range.apply(this,O);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=r.scale.linear().domain(O.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?z:0,e=r.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var D="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",R=(new DOMParser).parseFromString(D,"application/xml"),j=this.appendChild(this.ownerDocument.importNode(R.documentElement,!0));e=r.select(j)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var I,F=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},q={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){I=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=i.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});i.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},i.Legend.defaultConfig().legendConfig,{container:I,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=I.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],a.range([0,x]),u.layout.radialAxis.domain=a.domain(),I.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else I=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var U=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(U[0]=Math.max(0,U[0]),U[1]=Math.max(0,U[1]),e.select(".outer-group").attr("transform","translate("+U+")"),f.title){var G=e.select("g.title-group text").style(q).text(f.title),Y=G.node().getBBox();G.attr({x:_[0]-Y.width/2,y:_[1]-x-20})}var Z=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var X=Z.selectAll("circle.grid-circle").data(a.ticks(5));X.enter().append("circle").attr({class:"grid-circle"}).style(B),X.attr("r",a),X.exit().remove()}Z.select("circle.outside-circle").attr({r:x}).style(B);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=r.svg.axis().scale(a).ticks(5).tickSize(5);Z.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Z.selectAll(".domain").style(B),Z.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(q).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,q["font-size"]]+")":"translate("+[0,q["font-size"]]+")"}}),Z.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),J=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),J.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(q);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?n<270&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(n<=180&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":M?M[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(q);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=r.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));I.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=a,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=r.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return o(i[n].defaultConfig(),t)});i[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=i.tooltipPanel().config({container:ct,fontSize:8})(),ft=i.tooltipPanel().config({container:ct,fontSize:8})(),dt=i.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var n=i.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=i.util.convertToCartesian(x+12,n+180);ut.text(i.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var n=i.util.getMousePos(W).radius;pt.attr({r:n}).style({opacity:.5}),lt=a.invert(i.util.getMousePos(W).radius);var r=i.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(i.util.round(lt)).move([r[0]+_[0],r[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var a=r.select(this),o=a.style("fill"),l="black",s=a.style("opacity")||1;if(a.attr({"data-opacity":s}),"none"!=o){a.attr({"data-fill":o}),l=r.hsl(o).darker().toString(),a.style({fill:l,opacity:1});var c={t:i.util.round(t[0]),r:i.util.round(t[1])};A&&(c.t=M[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-U[0]-d.left,f.top+f.height/2-U[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else o=a.style("stroke"),a.attr({"data-stroke":o}),l=r.hsl(o).darker().toString(),a.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==r.event.which&&void(r.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=r.select(this),a=n.attr("data-fill");a?n.style({fill:a,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,a,l,s={data:[],layout:{}},c={},u={},f=r.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=i.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),o(s.data[e],i.Axis.defaultConfig().data[0]),o(s.data[e],t)}),o(s.layout,i.Axis.defaultConfig().layout),o(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},r.rebind(d,f,"on"),d},i.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:r.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},i.util={},i.DATAEXTENT="dataExtent",i.AREA="AreaChart",i.LINE="LinePlot",i.DOT="DotPlot",i.BAR="BarChart",i.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},i.util._extend=function(t,e){for(var n in t)e[n]=t[n]},i.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},i.util.dataFromEquation2=function(t,e){var n=e||6,a=r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return a},i.util.dataFromEquation=function(t,e,n){var a=e||6,o=[],i=[];r.range(0,360+a,a).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},i.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return r.range(e).map(function(t,e){return n[e]||n[0]})},i.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=i.util.ensureArray(t[e],n)}),t},i.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},i.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},i.util.sumArrays=function(t,e){return r.zip(t,e).map(function(t,e){return r.sum(t)})},i.util.arrayLast=function(t){return t[t.length-1]},i.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return n===-2},i.util.flattenArray=function(t){for(var e=[];!i.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},i.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},i.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},i.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},i.util.getMousePos=function(t){var e=r.mouse(t.node()),n=e[0],a=e[1],o={};return o.x=n,o.y=a,o.pos=e,o.angle=180*(Math.atan2(a,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+a*a),o},i.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;a0)){var l=r.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(n,a,o)},"fill-opacity":0,stroke:function(t,e){return m.stroke(n,a,o)},"stroke-width":function(t,e){return m["stroke-width"](n,a,o)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](n,a,o)},opacity:function(t,e){return m.opacity(n,a,o)},display:function(t,e){return m.display(n,a,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=r.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,a){r.select(this).attr({class:"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var m={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},v=r.select(this).selectAll("g.layer").data(s);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(m).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,n=[i.PolyChart.defaultConfig()],a=r.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),o(n[e],i.PolyChart.defaultConfig()),o(n[e],t)}),this):n},t.getColorScale=function(){return e},r.rebind(t,a,"on"),t},i.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}};return t},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},i.Legend=function(){function t(){var n=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=o({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),i=r.merge(a);i=i.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(i=i.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=r.select(l));var s=i.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof i[0]:n.isContinuous,f=u?n.height:c*i.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=r.range(i.length),m=r.scale[u?"linear":"ordinal"]().domain(g).range(s),v=r.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":r.svg.symbolTypes.indexOf(t)!=-1?r.svg.symbol().type(t).size(n)():r.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(i);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,v(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=r.svg.axis().scale(v).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return i[e].name}),t}var e=i.Legend.defaultConfig(),n=r.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},r.rebind(t,n,"on"),t},i.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},i.tooltipPanel=function(){var t,e,n,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=10,c=function(){t=a.container.selectAll("g."+l).data([0]);var r=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=r.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=r.append("text").attr({dx:a.padding+s,dy:.3*+a.fontSize}),c};return c.text=function(o){var i=r.hsl(a.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var d=a.padding,h=e.node().getBBox(),p={fill:a.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,m=h.height+2*d;return n.attr({d:"M"+[[s,-m/2],[s,-m/4],[a.hasTick?0:s,0],[s,m/4],[s,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-m/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){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 o(a,t),c},c},i.tooltipPanel.uid=1,i.adapter={},i.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=o({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var r=a.indexOf(t.geometry);r!=-1&&(n.data[e].groupId=r)})}if(t.layout){var l=o({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};r.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../lib":118,d3:8}],187:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../lib"),o=t("../../components/color"),i=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){function e(e,a){return a&&(f=a),r.select(r.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?s(n,e):e,o||(o=i.Axis()),u=i.adapter.plotly().convert(n),o.config(u).render(f),t.data=n.data,t.layout=n.layout,c.fillLayout(t),n}var n,a,o,u,f,d=new l;return e.isPolar=!0,e.svg=function(){return o.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return i.adapter.plotly().convert(o.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:o.angularScale(),r:o.radialScale()}},e.setUndoPoint=function(){var t=this,e=i.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,a),a=i.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},c.fillLayout=function(t){var e=r.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:o.background,_container:e,_paperdiv:n,_paper:a};t._fullLayout=s(i,t.layout)}},{"../../components/color":25,"../../lib":118,"./micropolar":186,"./undo_manager":188,d3:8}],188:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return r!==-1},hasRedo:function(){return r-1}var o=t("../lib"),i=t("../plots/plots"),l=o.extendFlat,s=o.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,o=t.data,c=t.layout,u=s([],o),f=s({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;ns&&(e.z=u.slice(0,s)),l("locationmode"),l("text"),l("marker.line.color"),l("marker.line.width"),a(t,e,i,l,{prefix:"",cLetter:"z"}),void l("hoverinfo",1===i._dataLength?"location+z+text":void 0)):void(e.visible=!1)}},{"../../components/colorscale/defaults":35,"../../lib":118,"./attributes":199}],202:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../heatmap/colorbar"),r.calc=t("./calc"),r.plot=t("./plot").plot,r.hoverPoints=function(){},r.moduleType="trace",r.name="choropleth",r.basePlotModule=t("../../plots/geo"),r.categories=["geo","noOpacity"],r.meta={},e.exports=r},{"../../plots/geo":170,"../heatmap/colorbar":204,"./attributes":199,"./calc":200,"./defaults":201,"./plot":203}],203:[function(t,e,n){"use strict";function r(t,e){function n(e){var n=t.mockAxis;return i.tickText(n,n.c2l(e),"hover").text}var r=e.hoverinfo;if("none"===r||"skip"===r)return function(t){delete t.nameLabel,delete t.textLabel};var a="all"===r?g.hoverinfo.flags:r.split("+"),o=a.indexOf("name")!==-1,l=a.indexOf("location")!==-1,s=a.indexOf("z")!==-1,c=a.indexOf("text")!==-1,u=!o&&l;return function(t){var r=[];u?t.nameLabel=t.id:(o&&(t.nameLabel=e.name),l&&r.push(t.id)),s&&r.push(n(t.z)),c&&r.push(t.tx),t.textLabel=r.join("
")}}function a(t){return function(e,n){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:n,location:e.id,z:e.z}]}}}var o=t("d3"),i=t("../../plots/cartesian/axes"),l=t("../../plots/cartesian/graph_interact"),s=t("../../components/color"),c=t("../../components/drawing"),u=t("../../components/colorscale"),f=t("../../lib/topojson_utils").getTopojsonFeatures,d=t("../../lib/geo_location_utils").locationToFeature,h=t("../../lib/array_to_calc_item"),p=t("../../plots/geo/constants"),g=t("./attributes"),m=e.exports={};m.calcGeoJSON=function(t,e){for(var n,r=[],a=t.locations,o=a.length,i=f(t,e),l=(t.marker||{}).line||{},s=0;s0&&(r[0].trace=t),r},m.plot=function(t,e,n){function i(t){return t[0].trace.uid}var s,c=t.framework,u=c.select("g.choroplethlayer"),f=c.select("g.baselayer"),d=c.select("g.baselayeroverchoropleth"),h=p.baseLayersOverChoropleth,g=u.selectAll("g.trace.choropleth").data(e,i);g.enter().append("g").attr("class","trace choropleth"),g.exit().remove(),g.each(function(e){function n(e,n){if(t.showHover){var r=t.projection(e.properties.ct);u(e),l.loneHover({x:r[0],y:r[1],name:e.nameLabel,text:e.textLabel},{container:t.hoverContainer.node()}),d=f(e,n),t.graphDiv.emit("plotly_hover",d)}}function i(e,n){t.graphDiv.emit("plotly_click",f(e,n))}var s=e[0].trace,c=m.calcGeoJSON(s,t.topojson),u=r(t,s),f=a(s),d=null,h=o.select(this).selectAll("path.choroplethlocation").data(c);h.enter().append("path").classed("choroplethlocation",!0).on("mouseover",n).on("click",i).on("mouseout",function(){l.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",d)}).on("mousedown",function(){l.loneUnhover(t.hoverContainer)}).on("mouseup",n),h.exit().remove()}),d.selectAll("*").remove();for(var v=0;vp&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var v={type:"linear"};a.setConvert(v),s=v.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,a.expand(u,d,g),a.expand(f,h,m);var b=new Array(p);for(c=0;c=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}}}}},{}],210:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,s=n.marker,c="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===s||!s.showscale)return void o.autoMargin(t,c);var u=s.color,f=s.cmin,d=s.cmax;r(f)||(f=a.aggNums(Math.min,null,u)),r(d)||(d=a.aggNums(Math.max,null,u));var h=e[0].t.cb=l(t,c),p=i.makeColorScaleFunc(i.extractScale(s.colorscale,f,d),{noNumericCheck:!0});h.fillcolor(p).filllevels({start:f,end:d,size:(d-f)/254}).options(s.colorbar)()}},{"../../components/colorbar/draw":28,"../../components/colorscale":40,"../../lib":118,"../../plots/plots":182,"fast-isnumeric":11}],211:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":32,"../../components/colorscale/has_colorscale":39,"./subtypes":227}],212:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],213:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var m=l(t,e,g),v=mq!=P>=q&&(z=C[T-1][0],O=C[T][0],S=z+(O-z)*(q-E)/(P-E),j=Math.min(j,S),I=Math.max(I,S));j=Math.max(j,0),I=Math.min(I,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:j,x1:I,y0:q,y1:q,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":25,"../../components/errorbars":55,"../../lib":118,"../../plots/cartesian/constants":151,"../../plots/cartesian/graph_interact":153,"./get_trace_color":215}],217:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.animatable=!0,r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":154,"./arrays_to_calcdata":206,"./attributes":207,"./calc":208,"./clean_data":209,"./colorbar":210,"./defaults":213,"./hover":216,"./plot":224,"./select":225,"./style":226,"./subtypes":227}],218:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=!Array.isArray(l)&&l||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":39}],219:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),r=M.c2p(t[e].y);return n!==S&&r!==S&&[n,r]}function a(t){var e=t[0]/w._length,n=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*T}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,m,v,y,x,b,_,w=e.xaxis,M=e.yaxis,k=e.simplify,A=e.connectGaps,T=e.baseTolerance,L=e.linear,C=[],S=r.BADNUM,z=.2,O=new Array(t.length),E=0;for(k||(T=z=-1),i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,c=f,h=!1):y=t.length||!f)break;O[E++]=f,l=f}}else O[E++]=c}C.push(O.slice(0,E))}return C}},{"../../plots/cartesian/axes":145}],220:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],221:[function(t,e,n){"use strict";e.exports=function(t,e,n){for(var r,a,o=null,i=0;i0?Math.max(e,a):0}}},{"fast-isnumeric":11}],223:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":25,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":39,"./subtypes":227}],224:[function(t,e,n){"use strict";function r(t,e){var n;e.selectAll("g.trace").each(function(t){var e=i.select(this);if(n=t[0].trace,n._nexttrace){if(n._nextFill=e.select(".js-fill.js-tonext"),!n._nextFill.size()){var r=":first-child";e.select(".js-fill.js-tozero").size()&&(r+=" + *"),n._nextFill=e.insert("path",r).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),n._nextFill=null;n.fill&&("tozero"===n.fill.substr(0,6)||"toself"===n.fill||"to"===n.fill.substr(0,2)&&!n._prevtrace)?(n._ownFill=e.select(".js-fill.js-tozero"),n._ownFill.size()||(n._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),n._ownFill=null)})}function a(t,e,n,r,a,h,g){function m(t){return k?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,n,r=t[0].trace,a=i.select(this),o=u.hasMarkers(r),c=u.hasText(r),f=x(r),d=b,h=b;o&&(d=r.marker.maxdisplayed?v:l.identity),c&&(h=r.marker.maxdisplayed?v:l.identity),n=a.selectAll("path.point"),e=n.data(d,f);var p=e.enter().append("path").classed("point",!0);p.call(s.pointStyle,r).call(s.translatePoints,A,T,r),k&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=m(i.select(this));s.translatePoint(t,e,A,T),s.singlePointStyle(t,e,r)}),k?e.exit().transition().style("opacity",0).remove():e.exit().remove(),n=a.selectAll("g"),e=n.data(h,f),e.enter().append("g").append("text"),e.each(function(t){var e=m(i.select(this).select("text"));s.translatePoint(t,e,A,T)}),e.selectAll("text").call(s.textPointStyle,r).each(function(t){var e=t.xp||A.c2p(t.x),n=t.yp||T.c2p(t.y);i.select(this).selectAll("tspan").each(function(){m(i.select(this)).attr({x:e,y:n})})}),e.exit().remove()}var w,M;o(t,e,n,r,a);var k=!!g&&g.duration>0,A=n.xaxis,T=n.yaxis,L=r[0].trace,C=L.line,S=i.select(h);if(S.call(c.plot,n,g),L.visible===!0){var z,O,E=L.fill.charAt(L.fill.length-1);"x"!==E&&"y"!==E&&(E=""),r[0].node3=S,f(r);var P="",N=[],D=L._prevtrace;D&&(P=D._prevRevpath||"",O=D._nextFill,N=D._polygons);var R,j,I,F,B,q,H,V,U,G="",Y="",Z=[],X=[],W=l.noop;if(z=L._ownFill,u.hasLines(L)||"none"!==L.fill){for(O&&O.datum(r),["hv","vh","hvh","vhv"].indexOf(C.shape)!==-1?(I=s.steps(C.shape),F=s.steps(C.shape.split("").reverse().join(""))):I=F="spline"===C.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?s.smoothclosed(t.slice(1),C.smoothing):s.smoothopen(t,C.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return F(t.reverse())},Z=d(r,{xaxis:A,yaxis:T,connectGaps:L.connectgaps,baseTolerance:Math.max(C.width||1,3)/4,linear:"linear"===C.shape,simplify:C.simplify}),U=L._polygons=new Array(Z.length),M=0;M1}),W=function(t){return function(e){if(R=I(e),j=B(e),G?E?(G+="L"+R.substr(1),Y=j+("L"+Y.substr(1))):(G+="Z"+R,Y=j+"Z"+Y):(G=R,Y=j),u.hasLines(L)&&e.length>1){var n=i.select(this);if(n.datum(r),t)m(n.style("opacity",0).attr("d",R).call(s.lineGroupStyle)).style("opacity",1);else{var a=m(n);a.attr("d",R),s.singleLineStyle(r,a)}}}}}var Q=S.selectAll(".js-line").data(X);m(Q.exit()).style("opacity",0).remove(),Q.each(W(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(W(!0)),Z.length&&(z?q&&V&&(E?("y"===E?q[1]=V[1]=T.c2p(0,!0):"x"===E&&(q[0]=V[0]=A.c2p(0,!0)),m(z).attr("d","M"+V+"L"+q+"L"+G.substr(1))):m(z).attr("d",G+"Z")):"tonext"===L.fill.substr(0,6)&&G&&P&&("tonext"===L.fill?m(O).attr("d",G+"Z"+P+"Z"):m(O).attr("d",G+"L"+P.substr(1)+"Z"),L._polygons=L._polygons.concat(N)),L._prevRevpath=Y,L._prevPolygons=U);var $=S.selectAll(".points");w=$.data([r]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function o(t,e,n,r,a){var o=n.xaxis,l=n.yaxis,s=i.extent(o.range.map(o.l2c)),c=i.extent(l.range.map(l.l2c)),f=r[0].trace;if(u.hasMarkers(f)){var d=f.marker.maxdisplayed;if(0!==d){var h=r.filter(function(t){return t.x>=s[0]&&t.x<=s[1]&&t.y>=c[0]&&t.y<=c[1]}),p=Math.ceil(h.length/d),g=0;a.forEach(function(t,n){var r=t[0].trace;u.hasMarkers(r)&&r.marker.maxdisplayed>0&&n0;for(u=p.selectAll("g.trace"),f=u.data(n,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),h(t,e,n),r(t,p),s=0,c=[];sr?1:-1}),m){l&&(d=l());var v=i.transition().duration(o.duration).ease(o.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()});v.each(function(){p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)})})}else p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":49,"../../components/errorbars":55,"../../lib":118,"../../lib/polygon":125,"./arrays_to_calcdata":206,"./line_points":219,"./link_traces":221,"./subtypes":227,d3:8}],225:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;n0&&(i[l-1].gapAfter=!0):(l++,i.push(u))}return a(e),i}},{"../scatter/colorscale_calc":211,"fast-isnumeric":11}],232:[function(t,e,n){"use strict";function r(t,e,n){var r,a,o=0,i=n("locations");return i?(n("locationmode"),o=i.length):(r=n("lon")||[],a=n("lat")||[],o=Math.min(r.length,a.length),o")}var a=t("../../plots/cartesian/graph_interact"),o=t("../../plots/cartesian/axes"),i=t("../scatter/get_trace_color"),l=t("./attributes");e.exports=function(t){function e(t){return u.projection(t)}function n(t){var n=t.lonlat;if(null===n[0]||null===n[1])return 1/0;if(u.isLonLatOverEdges(n))return 1/0;var r=e(n),a=s.c2p(),o=c.c2p(),i=Math.abs(a-r[0]),l=Math.abs(o-r[1]),f=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(i*i+l*l)-f,1-3/f)}var o=t.cd,l=o[0].trace,s=t.xa,c=t.ya,u=t.subplot;if(!o[0].placeholder&&(a.getClosest(o,n,t),t.index!==!1)){var f=o[t.index],d=f.lonlat,h=e(d),p=f.mrc||1;return t.x0=h[0]-p,t.x1=h[0]+p,t.y0=h[1]-p,t.y1=h[1]+p,t.loc=f.loc,t.lat=d[0],t.lon=d[1],t.color=i(l,f),t.extraText=r(l,f,u.mockAxis),[t]}}},{"../../plots/cartesian/axes":145,"../../plots/cartesian/graph_interact":153,"../scatter/get_trace_color":215,"./attributes":230}],235:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../scatter/colorbar"),r.calc=t("./calc"),r.plot=t("./plot"),r.hoverPoints=t("./hover"),r.eventData=t("./event_data"),r.moduleType="trace",r.name="scattergeo",r.basePlotModule=t("../../plots/geo"),r.categories=["geo","symbols","markerColorscale","showLegend"],r.meta={},e.exports=r},{"../../plots/geo":170,"../scatter/colorbar":210,"./attributes":230,"./calc":231,"./defaults":232,"./event_data":233,"./hover":234,"./plot":236}],236:[function(t,e,n){"use strict";function r(t,e){if(!Array.isArray(t.locations))return c.identity;var n=u(t,e),r=t.locationmode;return function(t){var e=f(r,t.loc,n);return e?(t.lonlat=e.properties.ct,t):(t.lonlat=[null,null],!1)}}function a(t,e,n){function r(t,r){h(t,e,r,n)}var a=t.marker;if(r(t.text,"tx"),r(t.textposition,"tp"),t.textfont&&(r(t.textfont.size,"ts"),r(t.textfont.color,"tc"),r(t.textfont.family,"tf")),a&&a.line){var o=a.line;r(a.opacity,"mo"),r(a.symbol,"mx"),r(a.color,"mc"),r(a.size,"ms"),r(o.color,"mlc"),r(o.width,"mlw")}}function o(t){var e=t.framework.selectAll("g.trace.scattergeo");e.style("opacity",function(t){return t[0].trace.opacity}),e.each(function(t){var e=t[0].trace,n=i.select(this);n.selectAll("path.point").call(l.pointStyle,e),n.selectAll("text").call(l.textPointStyle,e)}),e.selectAll("path.js-line").style("fill","none").each(function(t){var e=i.select(this),n=t.trace,r=n.line||{};e.call(s.stroke,r.color).call(l.dashLine,r.dash||"",r.width||0),"none"!==n.fill&&e.call(s.fill,n.fillcolor)})}var i=t("d3"),l=t("../../components/drawing"),s=t("../../components/color"),c=t("../../lib"),u=t("../../lib/topojson_utils").getTopojsonFeatures,f=t("../../lib/geo_location_utils").locationToFeature,d=t("../../lib/geojson_utils"),h=t("../../lib/array_to_calc_item"),p=t("../scatter/subtypes");e.exports=function(t,e){function n(t){return t[0].trace.uid}var l=t.framework.select(".scattergeolayer").selectAll("g.trace.scattergeo").data(e,n);l.enter().append("g").attr("class","trace scattergeo"),l.exit().remove(),l.selectAll("*").remove(),l.each(function(e){var n=i.select(this),o=e[0].trace,l=r(o,t.topojson);e[0].placeholder&&n.remove();for(var s=[],c=0;ce?1:t>=e?0:NaN}function o(t){return null===t?NaN:+t}function i(t){return!isNaN(t)}function l(t){return{left:function(e,n,r,a){for(arguments.length<3&&(r=0),arguments.length<4&&(a=e.length);r>>1;t(e[o],n)<0?r=o+1:a=o}return r},right:function(e,n,r,a){for(arguments.length<3&&(r=0),arguments.length<4&&(a=e.length);r>>1;t(e[o],n)>0?a=o:r=o+1}return r}}}function s(t){return t.length}function c(t){for(var e=1;t*e%1;)e*=10;return e}function u(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function f(){this._=Object.create(null)}function d(t){return(t+="")===_i||t[0]===wi?wi+t:t}function h(t){return(t+="")[0]===wi?t.slice(1):t}function p(t){return d(t)in this._}function g(t){return(t=d(t))in this._&&delete this._[t]}function m(){var t=[];for(var e in this._)t.push(h(e));return t}function v(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function x(){this._=Object.create(null)}function b(t){return t}function _(t,e,n){return function(){var r=n.apply(e,arguments);return r===e?t:r}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,r=Mi.length;n=e&&(e=a+1);!(i=l[e])&&++e0&&(t=t.slice(0,l));var c=Pi.get(t);return c&&(t=c,s=Q),l?e?a:r:e?M:o}function W(t,e){return function(n){var r=ui.event;ui.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{ui.event=r}}}function Q(t,e){var n=W(t,e);return function(t){var e=this,r=t.relatedTarget;r&&(r===e||8&r.compareDocumentPosition(e))||n.call(e,t)}}function $(t){var n=".dragsuppress-"+ ++Di,a="click"+n,o=ui.select(r(t)).on("touchmove"+n,T).on("dragstart"+n,T).on("selectstart"+n,T);if(null==Ei&&(Ei=!("onselectstart"in t)&&w(t.style,"userSelect")),Ei){var i=e(t).style,l=i[Ei];i[Ei]="none"}return function(t){if(o.on(n,null),Ei&&(i[Ei]=l),t){var e=function(){o.on(a,null)};o.on(a,function(){T(),e()},!0),setTimeout(e,0)}}}function J(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var a=n.createSVGPoint();if(Ri<0){var o=r(t);if(o.scrollX||o.scrollY){n=ui.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var i=n[0][0].getScreenCTM();Ri=!(i.f||i.e),n.remove()}}return Ri?(a.x=e.pageX,a.y=e.pageY):(a.x=e.clientX,a.y=e.clientY),a=a.matrixTransform(t.getScreenCTM().inverse()),[a.x,a.y]}var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}function K(){return ui.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function nt(t){return t>1?0:t<-1?Fi:Math.acos(t)}function rt(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function at(t){return((t=Math.exp(t))-1/t)/2}function ot(t){return((t=Math.exp(t))+1/t)/2}function it(t){return((t=Math.exp(2*t))-1)/(t+1)}function lt(t){return(t=Math.sin(t/2))*t}function st(){}function ct(t,e,n){return this instanceof ct?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof ct?new ct(t.h,t.s,t.l):Mt(""+t,kt,ct):new ct(t,e,n)}function ut(t,e,n){function r(t){return t>360?t-=360:t<0&&(t+=360),t<60?o+(i-o)*t/60:t<180?i:t<240?o+(i-o)*(240-t)/60:o}function a(t){return Math.round(255*r(t))}var o,i;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=n<0?0:n>1?1:n,i=n<=.5?n*(1+e):n+e-n*e,o=2*n-i,new xt(a(t+120),a(t),a(t-120))}function ft(t,e,n){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof ht?gt(t.l,t.a,t.b):gt((t=At((t=ui.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,n)}function dt(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new ht(n,Math.cos(t*=Vi)*e,Math.sin(t)*e)}function ht(t,e,n){return this instanceof ht?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof ht?new ht(t.l,t.a,t.b):t instanceof ft?dt(t.h,t.c,t.l):At((t=xt(t)).r,t.g,t.b):new ht(t,e,n)}function pt(t,e,n){var r=(t+16)/116,a=r+e/500,o=r-n/200;return a=mt(a)*tl,r=mt(r)*el,o=mt(o)*nl,new xt(yt(3.2404542*a-1.5371385*r-.4985314*o),yt(-.969266*a+1.8760108*r+.041556*o),yt(.0556434*a-.2040259*r+1.0572252*o))}function gt(t,e,n){return t>0?new ft(Math.atan2(n,e)*Gi,Math.sqrt(e*e+n*n),t):new ft(NaN,NaN,t)}function mt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function vt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function xt(t,e,n){return this instanceof xt?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof xt?new xt(t.r,t.g,t.b):Mt(""+t,xt,ut):new xt(t,e,n)}function bt(t){return new xt(t>>16,t>>8&255,255&t)}function _t(t){return bt(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(t,e,n){var r,a,o,i=0,l=0,s=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=r[2].split(","),r[1]){case"hsl":return n(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(Lt(a[0]),Lt(a[1]),Lt(a[2]))}return(o=ol.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(i=(3840&o)>>4,i|=i>>4,l=240&o,l|=l>>4,s=15&o,s|=s<<4):7===t.length&&(i=(16711680&o)>>16,l=(65280&o)>>8,s=255&o)),e(i,l,s))}function kt(t,e,n){var r,a,o=Math.min(t/=255,e/=255,n/=255),i=Math.max(t,e,n),l=i-o,s=(i+o)/2;return l?(a=s<.5?l/(i+o):l/(2-i-o),r=t==i?(e-n)/l+(e0&&s<1?0:r),new ct(r,a,s)}function At(t,e,n){t=Tt(t),e=Tt(e),n=Tt(n);var r=vt((.4124564*t+.3575761*e+.1804375*n)/tl),a=vt((.2126729*t+.7151522*e+.072175*n)/el),o=vt((.0193339*t+.119192*e+.9503041*n)/nl);return ht(116*a-16,500*(r-a),200*(a-o))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Lt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Ct(t){return"function"==typeof t?t:function(){return t}}function St(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),zt(e,n,t,r)}}function zt(t,e,n,r){function a(){var t,e=s.status;if(!e&&Nt(s)||e>=200&&e<300||304===e){try{t=n.call(o,s)}catch(t){return void i.error.call(o,t)}i.load.call(o,t)}else i.error.call(o,s)}var o={},i=ui.dispatch("beforesend","progress","load","error"),l={},s=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in s||!/^(http(s)?:)?\/\//.test(t)||(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=a:s.onreadystatechange=function(){s.readyState>3&&a()},s.onprogress=function(t){var e=ui.event;ui.event=t;try{i.progress.call(o,s)}finally{ui.event=e}},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?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return n=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(di(arguments)))}}),o.send=function(n,r,a){if(2===arguments.length&&"function"==typeof r&&(a=r,r=null),s.open(n,t,!0),null==e||"accept"in l||(l.accept=e+",*/*"),s.setRequestHeader)for(var u in l)s.setRequestHeader(u,l[u]);return null!=e&&s.overrideMimeType&&s.overrideMimeType(e),null!=c&&(s.responseType=c),null!=a&&o.on("error",a).on("load",function(t){a(null,t)}),i.beforesend.call(o,s),s.send(null==r?null:r),o},o.abort=function(){return s.abort(),o},ui.rebind(o,i,"on"),null==r?o:o.get(Ot(r))}function Ot(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}function Nt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Pt(t,e,n){var r=arguments.length;r<2&&(e=0),r<3&&(n=Date.now());var a=n+e,o={c:t,t:a,n:null};return ll?ll.n=o:il=o,ll=o,sl||(cl=clearTimeout(cl),sl=1,ul(Et)),o}function Et(){var t=Dt(),e=Rt()-t;e>24?(isFinite(e)&&(clearTimeout(cl),cl=setTimeout(Et,e)),sl=0):(sl=1,ul(Et))}function Dt(){for(var t=Date.now(),e=il;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Rt(){for(var t,e=il,n=1/0;e;)e.c?(e.t8?function(t){return t/n}:function(t){return t*n},symbol:t}}function Ft(t){var e=t.decimal,n=t.thousands,r=t.grouping,a=t.currency,o=r&&n?function(t,e){for(var a=t.length,o=[],i=0,l=r[0],s=0;a>0&&l>0&&(s+l+1>e&&(l=Math.max(1,e-s)),o.push(t.substring(a-=l,a+l)),!((s+=l+1)>e));)l=r[i=(i+1)%r.length];return o.reverse().join(n)}:b;return function(t){var n=dl.exec(t),r=n[1]||" ",i=n[2]||">",l=n[3]||"-",s=n[4]||"",c=n[5],u=+n[6],f=n[7],d=n[8],h=n[9],p=1,g="",m="",v=!1,y=!0;switch(d&&(d=+d.substring(1)),(c||"0"===r&&"="===i)&&(c=r="0",i="="),h){case"n":f=!0,h="g";break;case"%":p=100,m="%",h="f";break;case"p":p=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===s&&(g="0"+h.toLowerCase());case"c":y=!1;case"d":v=!0,d=0;break;case"s":p=-1,h="r"}"$"===s&&(g=a[0],m=a[1]),"r"!=h||d||(h="g"),null!=d&&("g"==h?d=Math.max(1,Math.min(21,d)):"e"!=h&&"f"!=h||(d=Math.max(0,Math.min(20,d)))),h=hl.get(h)||Bt;var x=c&&f;return function(t){var n=m;if(v&&t%1)return"";var a=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===l?"":l;if(p<0){var s=ui.formatPrefix(t,d);t=s.scale(t),n=s.symbol+m}else t*=p;t=h(t,d);var b,_,w=t.lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(b=t,_=""):(b=t.substring(0,M),_=t.substring(M))}else b=t.substring(0,w),_=e+t.substring(w+1);!c&&f&&(b=o(b,1/0));var k=g.length+b.length+_.length+(x?0:a.length),A=k"===i?A+a+t:"^"===i?A.substring(0,k>>=1)+a+t+A.substring(k):a+(x?t:A+t))+n}}}function Bt(t){return t+""}function qt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ht(t,e,n){function r(e){var n=t(e),r=o(n,1);return e-n1)for(;i=c)return-1;if(a=e.charCodeAt(l++),37===a){if(i=e.charAt(l++),o=S[i in vl?e.charAt(l++):i],!o||(r=o(t,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}function r(t,e,n){w.lastIndex=0;var r=w.exec(e.slice(n));return r?(t.w=M.get(r[0].toLowerCase()),n+r[0].length):-1}function a(t,e,n){b.lastIndex=0;var r=b.exec(e.slice(n));return r?(t.w=_.get(r[0].toLowerCase()),n+r[0].length):-1}function o(t,e,n){T.lastIndex=0;var r=T.exec(e.slice(n));return r?(t.m=L.get(r[0].toLowerCase()),n+r[0].length):-1}function i(t,e,n){k.lastIndex=0;var r=k.exec(e.slice(n));return r?(t.m=A.get(r[0].toLowerCase()),n+r[0].length):-1}function l(t,e,r){return n(t,C.c.toString(),e,r)}function s(t,e,r){return n(t,C.x.toString(),e,r)}function c(t,e,r){return n(t,C.X.toString(),e,r)}function u(t,e,n){var r=x.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)}var f=t.dateTime,d=t.date,h=t.time,p=t.periods,g=t.days,m=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function n(t){try{gl=qt;var e=new gl;return e._=t,r(e)}finally{gl=Date}}var r=e(t);return n.parse=function(t){try{gl=qt;var e=r.parse(t);return e&&e._}finally{gl=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=ue;var x=ui.map(),b=Xt(g),_=Zt(g),w=Xt(m),M=Zt(m),k=Xt(v),A=Zt(v),T=Xt(y),L=Zt(y);p.forEach(function(t,e){x.set(t.toLowerCase(),e)});var C={a:function(t){return m[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(f),d:function(t,e){return Ut(t.getDate(),e,2)},e:function(t,e){return Ut(t.getDate(),e,2)},H:function(t,e){return Ut(t.getHours(),e,2)},I:function(t,e){return Ut(t.getHours()%12||12,e,2)},j:function(t,e){return Ut(1+pl.dayOfYear(t),e,3)},L:function(t,e){return Ut(t.getMilliseconds(),e,3)},m:function(t,e){return Ut(t.getMonth()+1,e,2)},M:function(t,e){return Ut(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Ut(t.getSeconds(),e,2)},U:function(t,e){return Ut(pl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ut(pl.mondayOfYear(t),e,2)},x:e(d),X:e(h),y:function(t,e){return Ut(t.getFullYear()%100,e,2)},Y:function(t,e){return Ut(t.getFullYear()%1e4,e,4)},Z:se,"%":function(){return"%"}},S={a:r,A:a,b:o,B:i,c:l,d:ne,e:ne,H:ae,I:ae,j:re,L:le,m:ee,M:oe,p:u,S:ie,U:Wt,w:Yt,W:Qt,x:s,X:c,y:Jt,Y:$t,Z:Kt,"%":ce};return e}function Ut(t,e,n){var r=t<0?"-":"",a=(r?-t:t)+"",o=a.length;return r+(o68?1900:2e3)}function ee(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ne(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function re(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function ae(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function oe(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ie(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function le(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function se(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=bi(e)/60|0,a=bi(e)%60;return n+Ut(r,"0",2)+Ut(a,"0",2)}function ce(t,e,n){xl.lastIndex=0;var r=xl.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function ue(t){for(var e=t.length,n=-1;++n=0?1:-1,l=i*n,s=Math.cos(e),c=Math.sin(e),u=o*c,f=a*s+u*Math.cos(l),d=u*i*Math.sin(l);Al.add(Math.atan2(d,f)),r=t,a=s,o=c}var e,n,r,a,o;Tl.point=function(i,l){Tl.point=t,r=(e=i)*Vi,a=Math.cos(l=(n=l)*Vi/2+Fi/4),o=Math.sin(l)},Tl.lineEnd=function(){t(e,n)}}function ve(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 be(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Me(t){return[Math.atan2(t[1],t[0]),rt(t[2])]}function ke(t,e){return bi(t[0]-e[0])=0;--l)a.point((f=u[l])[0],f[1])}else r(h.x,h.p.x,-1,a);h=h.p}h=h.o,u=h.z,p=!p}while(!h.v);a.lineEnd()}}}function Pe(t){if(e=t.length){for(var e,n,r=0,a=t[0];++r0){for(_||(o.polygonStart(),_=!0),o.lineStart();++i1&&2&e&&n.push(n.pop().concat(n.shift())),h.push(n.filter(Re))}var h,p,g,m=e(o),v=a.invert(r[0],r[1]),y={point:i,lineStart:s,lineEnd:c,polygonStart:function(){y.point=u,y.lineStart=f,y.lineEnd=d,h=[],p=[]},polygonEnd:function(){y.point=i,y.lineStart=s,y.lineEnd=c,h=ui.merge(h);var t=He(v,p);h.length?(_||(o.polygonStart(),_=!0),Ne(h,Ie,t,n,o)):t&&(_||(o.polygonStart(),_=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),_&&(o.polygonEnd(),_=!1),h=p=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}},x=je(),b=e(x),_=!1;return y}}function Re(t){return t.length>1}function je(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:M,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Ie(t,e){return((t=t.x)[0]<0?t[1]-Hi-ji:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-ji:Hi-e[1])}function Fe(t){var e,n=NaN,r=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,i){var l=o>0?Fi:-Fi,s=bi(o-n);bi(s-Fi)0?Hi:-Hi),t.point(a,r),t.lineEnd(),t.lineStart(),t.point(l,r),t.point(o,r),e=0):a!==l&&s>=Fi&&(bi(n-a)ji?Math.atan((Math.sin(e)*(o=Math.cos(r))*Math.sin(n)-Math.sin(r)*(a=Math.cos(e))*Math.sin(t))/(a*o*i)):(e+r)/2}function qe(t,e,n,r){var a;if(null==t)a=n*Hi,r.point(-Fi,a),r.point(0,a),r.point(Fi,a),r.point(Fi,0),r.point(Fi,-a),r.point(0,-a),r.point(-Fi,-a),r.point(-Fi,0),r.point(-Fi,a);else if(bi(t[0]-e[0])>ji){var o=t[0]=0?1:-1,M=w*_,k=M>Fi,A=p*x;if(Al.add(Math.atan2(A*w*Math.sin(M),g*b+A*Math.cos(M))),o+=k?_+w*Bi:_,k^d>=n^v>=n){var T=xe(ve(f),ve(t));we(T);var L=xe(a,T);we(L);var C=(k^_>=0?-1:1)*rt(L[2]);(r>C||r===C&&(T[0]||T[1]))&&(i+=k^_>=0?1:-1)}if(!m++)break;d=v,p=x,g=b,f=t}}return(o<-ji||oo}function n(t){var n,o,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var h,p=[f,d],g=e(f,d),m=i?g?0:a(f,d):g?a(f+(f<0?Fi:-Fi),d):0;if(!n&&(c=s=g)&&t.lineStart(),g!==s&&(h=r(n,p),(ke(n,h)||ke(p,h))&&(p[0]+=ji,p[1]+=ji,g=e(p[0],p[1]))),g!==s)u=0,g?(t.lineStart(),h=r(p,n),t.point(h[0],h[1])):(h=r(n,p),t.point(h[0],h[1]),t.lineEnd()),n=h;else if(l&&n&&i^g){var v;m&o||!(v=r(p,n,!0))||(u=0,i?(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||n&&ke(n,p)||t.point(p[0],p[1]),n=p,s=g,o=m},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return u|(c&&s)<<1}}}function r(t,e,n){var r=ve(t),a=ve(e),i=[1,0,0],l=xe(r,a),s=ye(l,l),c=l[0],u=s-c*c;if(!u)return!n&&t;var f=o*s/u,d=-o*c/u,h=xe(i,l),p=_e(i,f),g=_e(l,d);be(p,g);var m=h,v=ye(p,m),y=ye(m,m),x=v*v-y*(ye(p,p)-1);if(!(x<0)){var b=Math.sqrt(x),_=_e(m,(-v-b)/y);if(be(_,p),_=Me(_),!n)return _;var w,M=t[0],k=e[0],A=t[1],T=e[1];k0^_[1]<(bi(_[0]-M)Fi^(M<=_[0]&&_[0]<=k)){var z=_e(m,(-v+b)/y);return be(z,p),[_,Me(z)]}}}function a(e,n){var r=i?t:Fi-t,a=0;return e<-r?a|=1:e>r&&(a|=2),n<-r?a|=4:n>r&&(a|=8),a}var o=Math.cos(t),i=o>0,l=bi(o)>ji,s=vn(t,6*Vi);return De(e,n,s,i?[0,-t]:[-Fi,t-Fi])}function Ge(t,e,n,r){return function(a){var o,i=a.a,l=a.b,s=i.x,c=i.y,u=l.x,f=l.y,d=0,h=1,p=u-s,g=f-c;if(o=t-s,p||!(o>0)){if(o/=p,p<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=n-s,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>d&&(d=o)}else if(p>0){if(o0)){if(o/=g,g<0){if(o0){if(o>h)return;o>d&&(d=o)}if(o=r-c,g||!(o<0)){if(o/=g,g<0){if(o>h)return;o>d&&(d=o)}else if(g>0){if(o0&&(a.a={x:s+d*p,y:c+d*g}),h<1&&(a.b={x:s+h*p,y:c+h*g}),a}}}}}}function Ue(t,e,n,r){function a(r,a){return bi(r[0]-t)0?0:3:bi(r[0]-n)0?2:1:bi(r[1]-e)0?1:0:a>0?3:2}function o(t,e){return i(t.x,e.x)}function i(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(l){function s(t){for(var e=0,n=m.length,r=t[1],a=0;ar&&et(c,o,t)>0&&++e:o[1]<=r&&et(c,o,t)<0&&--e,c=o;return 0!==e}function c(o,l,s,c){var u=0,f=0;if(null==o||(u=a(o,s))!==(f=a(l,s))||i(o,l)<0^s>0){do c.point(0===u||3===u?t:n,u>1?r:e);while((u=(u+s+4)%4)!==f)}else c.point(l[0],l[1])}function u(a,o){return t<=a&&a<=n&&e<=o&&o<=r}function f(t,e){u(t,e)&&l.point(t,e)}function d(){S.point=p,m&&m.push(v=[]),k=!0,M=!1,_=w=NaN}function h(){g&&(p(y,x),b&&M&&L.rejoin(),g.push(L.buffer())),S.point=f,M&&l.lineEnd()}function p(t,e){t=Math.max(-Bl,Math.min(Bl,t)),e=Math.max(-Bl,Math.min(Bl,e));var n=u(t,e);if(m&&v.push([t,e]),k)y=t,x=e,b=n,k=!1,n&&(l.lineStart(),l.point(t,e));else if(n&&M)l.point(t,e);else{var r={a:{x:_,y:w},b:{x:t,y:e}};C(r)?(M||(l.lineStart(),l.point(r.a.x,r.a.y)),l.point(r.b.x,r.b.y),n||l.lineEnd(),A=!1):n&&(l.lineStart(),l.point(t,e),A=!1)}_=t,w=e,M=n}var g,m,v,y,x,b,_,w,M,k,A,T=l,L=je(),C=Ge(t,e,n,r),S={point:f,lineStart:d,lineEnd:h,polygonStart:function(){l=L,g=[],m=[],A=!0},polygonEnd:function(){l=T,g=ui.merge(g);var e=s([t,r]),n=A&&e,a=g.length;(n||a)&&(l.polygonStart(),n&&(l.lineStart(),c(null,null,1,l),l.lineEnd()),a&&Ne(g,o,e,c,l),l.polygonEnd()),g=m=v=null}};return S}}function Xe(t){var e=0,n=Fi/3,r=cn(t),a=r(e,n);return a.parallels=function(t){return arguments.length?r(e=t[0]*Fi/180,n=t[1]*Fi/180):[e/Fi*180,n/Fi*180]},a}function Ze(t,e){function n(t,e){var n=Math.sqrt(o-2*a*Math.sin(e))/a;return[n*Math.sin(t*=a),i-n*Math.cos(t)]}var r=Math.sin(t),a=(r+Math.sin(e))/2,o=1+r*(2*a-r),i=Math.sqrt(o)/a;return n.invert=function(t,e){var n=i-e;return[Math.atan2(t,n)/a,rt((o-(t*t+n*n)*a*a)/(2*a))]},n}function Ye(){function t(t,e){Hl+=a*t-r*e,r=t,a=e}var e,n,r,a;Zl.point=function(o,i){Zl.point=t,e=r=o,n=a=i},Zl.lineEnd=function(){t(e,n)}}function We(t,e){tUl&&(Ul=t),eXl&&(Xl=e)}function Qe(){function t(t,e){i.push("M",t,",",e,o)}function e(t,e){i.push("M",t,",",e),l.point=n}function n(t,e){i.push("L",t,",",e)}function r(){l.point=t}function a(){i.push("Z")}var o=$e(4.5),i=[],l={point:t,lineStart:function(){l.point=e},lineEnd:r,polygonStart:function(){l.lineEnd=a},polygonEnd:function(){l.lineEnd=r,l.point=t},pointRadius:function(t){return o=$e(t),l},result:function(){if(i.length){var t=i.join("");return i=[],t}}};return l}function $e(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Je(t,e){Sl+=t,zl+=e,++Ol}function Ke(){function t(t,r){var a=t-e,o=r-n,i=Math.sqrt(a*a+o*o);Nl+=i*(e+t)/2,Pl+=i*(n+r)/2,El+=i,Je(e=t,n=r)}var e,n;Wl.point=function(r,a){Wl.point=t,Je(e=r,n=a)}}function tn(){Wl.point=Je}function en(){function t(t,e){var n=t-r,o=e-a,i=Math.sqrt(n*n+o*o);Nl+=i*(r+t)/2,Pl+=i*(a+e)/2,El+=i,i=a*t-r*e,Dl+=i*(r+t),Rl+=i*(a+e),jl+=3*i,Je(r=t,a=e)}var e,n,r,a;Wl.point=function(o,i){Wl.point=t,Je(e=r=o,n=a=i)},Wl.lineEnd=function(){t(e,n)}}function nn(t){function e(e,n){t.moveTo(e+i,n),t.arc(e,n,i,0,Bi)}function n(e,n){t.moveTo(e,n),l.point=r}function r(e,n){t.lineTo(e,n)}function a(){l.point=e}function o(){t.closePath()}var i=4.5,l={point:e,lineStart:function(){l.point=n},lineEnd:a,polygonStart:function(){l.lineEnd=o},polygonEnd:function(){l.lineEnd=a,l.point=e},pointRadius:function(t){return i=t,l},result:M};return l}function rn(t){function e(t){return(l?r:n)(t)}function n(e){return ln(e,function(n,r){n=t(n,r),e.point(n[0],n[1])})}function r(e){function n(n,r){n=t(n,r),e.point(n[0],n[1])}function r(){x=NaN,k.point=o,e.lineStart()}function o(n,r){var o=ve([n,r]),i=t(n,r);a(x,b,y,_,w,M,x=i[0],b=i[1],y=n,_=o[0],w=o[1],M=o[2],l,e),e.point(x,b)}function i(){k.point=n,e.lineEnd()}function s(){r(),k.point=c,k.lineEnd=u}function c(t,e){o(f=t,d=e),h=x,p=b,g=_,m=w,v=M,k.point=o}function u(){a(x,b,y,_,w,M,h,p,f,g,m,v,l,e),k.lineEnd=i,i()}var f,d,h,p,g,m,v,y,x,b,_,w,M,k={point:n,lineStart:r,lineEnd:i,polygonStart:function(){e.polygonStart(),k.lineStart=s},polygonEnd:function(){e.polygonEnd(),k.lineStart=r}};return k}function a(e,n,r,l,s,c,u,f,d,h,p,g,m,v){var y=u-e,x=f-n,b=y*y+x*x;if(b>4*o&&m--){var _=l+h,w=s+p,M=c+g,k=Math.sqrt(_*_+w*w+M*M),A=Math.asin(M/=k),T=bi(bi(M)-1)o||bi((y*z+x*O)/b-.5)>.3||l*h+s*p+c*g0&&16,e):Math.sqrt(o)},e}function an(t){var e=rn(function(e,n){return t([e*Gi,n*Gi])});return function(t){return un(e(t))}}function on(t){this.stream=t}function ln(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 sn(t){return cn(function(){return t})()}function cn(t){function e(t){return t=l(t[0]*Vi,t[1]*Vi),[t[0]*d+s,c-t[1]*d]}function n(t){return t=l.invert((t[0]-s)/d,(c-t[1])/d),t&&[t[0]*Gi,t[1]*Gi]}function r(){l=ze(i=hn(v,y,x),o);var t=o(g,m);return s=h-t[0]*d,c=p+t[1]*d,a()}function a(){return u&&(u.valid=!1,u=null),e}var o,i,l,s,c,u,f=rn(function(t,e){return t=o(t,e),[t[0]*d+s,c-t[1]*d]}),d=150,h=480,p=250,g=0,m=0,v=0,y=0,x=0,_=Fl,w=b,M=null,k=null;return e.stream=function(t){return u&&(u.valid=!1),u=un(_(i,f(w(t)))),u.valid=!0,u},e.clipAngle=function(t){return arguments.length?(_=null==t?(M=t,Fl):Ve((M=+t)*Vi),a()):M},e.clipExtent=function(t){return arguments.length?(k=t,w=t?Ue(t[0][0],t[0][1],t[1][0],t[1][1]):b,a()):k},e.scale=function(t){return arguments.length?(d=+t,r()):d},e.translate=function(t){return arguments.length?(h=+t[0],p=+t[1],r()):[h,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Vi,m=t[1]%360*Vi,r()):[g*Gi,m*Gi]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Vi,y=t[1]%360*Vi,x=t.length>2?t[2]%360*Vi:0,r()):[v*Gi,y*Gi,x*Gi]},ui.rebind(e,f,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&n,r()}}function un(t){return ln(t,function(e,n){t.point(e*Vi,n*Vi)})}function fn(t,e){return[t,e]}function dn(t,e){return[t>Fi?t-Bi:t<-Fi?t+Bi:t,e]}function hn(t,e,n){return t?e||n?ze(gn(t),mn(e,n)):gn(t):e||n?mn(e,n):dn}function pn(t){return function(e,n){return e+=t,[e>Fi?e-Bi:e<-Fi?e+Bi:e,n]}}function gn(t){var e=pn(t);return e.invert=pn(-t),e}function mn(t,e){function n(t,e){var n=Math.cos(e),l=Math.cos(t)*n,s=Math.sin(t)*n,c=Math.sin(e),u=c*r+l*a;return[Math.atan2(s*o-u*i,l*r-c*a),rt(u*o+s*i)]}var r=Math.cos(t),a=Math.sin(t),o=Math.cos(e),i=Math.sin(e);return n.invert=function(t,e){var n=Math.cos(e),l=Math.cos(t)*n,s=Math.sin(t)*n,c=Math.sin(e),u=c*o-s*i;return[Math.atan2(s*o+c*i,l*r+u*a),rt(u*r-l*a)]},n}function vn(t,e){var n=Math.cos(t),r=Math.sin(t);return function(a,o,i,l){var s=i*e;null!=a?(a=yn(n,a),o=yn(n,o),(i>0?ao)&&(a+=i*Bi)):(a=t+i*Bi,o=t-.5*s);for(var c,u=a;i>0?u>o:u0?e<-Hi+ji&&(e=-Hi+ji):e>Hi-ji&&(e=Hi-ji);var n=i/Math.pow(a(e),o);return[n*Math.sin(o*t),i-n*Math.cos(o*t)]}var r=Math.cos(t),a=function(t){return Math.tan(Fi/4+t/2)},o=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(a(e)/a(t)),i=r*Math.pow(a(t),o)/o;return o?(n.invert=function(t,e){var n=i-e,r=tt(o)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/o,2*Math.atan(Math.pow(i/r,1/o))-Hi]},n):Cn}function Ln(t,e){function n(t,e){var n=o-e;return[n*Math.sin(a*t),o-n*Math.cos(a*t)]}var r=Math.cos(t),a=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),o=r/a+t;return bi(a)1&&et(t[n[r-2]],t[n[r-1]],t[a])<=0;)--r;n[r++]=a}return n.slice(0,r)}function En(t,e){return t[0]-e[0]||t[1]-e[1]}function Dn(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function Rn(t,e,n,r){var a=t[0],o=n[0],i=e[0]-a,l=r[0]-o,s=t[1],c=n[1],u=e[1]-s,f=r[1]-c,d=(l*(s-c)-f*(a-o))/(f*i-l*u);return[a+d*i,s+d*u]}function jn(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function In(){or(this),this.edge=this.site=this.circle=null}function Fn(t){var e=cs.pop()||new In;return e.site=t,e}function Bn(t){Qn(t),is.remove(t),cs.push(t),or(t)}function qn(t){var e=t.circle,n=e.x,r=e.cy,a={x:n,y:r},o=t.P,i=t.N,l=[t];Bn(t);for(var s=o;s.circle&&bi(n-s.circle.x)ji)l=l.L;else{if(a=o-Gn(l,i),!(a>ji)){r>-ji?(e=l.P,n=l):a>-ji?(e=l,n=l.N):e=n=l;break}if(!l.R){e=l;break}l=l.R}var s=Fn(t);if(is.insert(e,s),e||n){if(e===n)return Qn(e),n=Fn(e.site),is.insert(s,n),s.edge=n.edge=tr(e.site,s.site),Wn(e),void Wn(n);if(!n)return void(s.edge=tr(e.site,s.site));Qn(e),Qn(n);var c=e.site,u=c.x,f=c.y,d=t.x-u,h=t.y-f,p=n.site,g=p.x-u,m=p.y-f,v=2*(d*m-h*g),y=d*d+h*h,x=g*g+m*m,b={x:(m*y-h*x)/v+u,y:(d*x-g*y)/v+f};nr(n.edge,c,p,b),s.edge=tr(c,t,null,b),n.edge=tr(t,p,null,b),Wn(e),Wn(n)}}function Vn(t,e){var n=t.site,r=n.x,a=n.y,o=a-e;if(!o)return r;var i=t.P;if(!i)return-(1/0);n=i.site;var l=n.x,s=n.y,c=s-e;if(!c)return l;var u=l-r,f=1/o-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-o/2)))/f+r:(r+l)/2}function Gn(t,e){var n=t.N;if(n)return Vn(n,e);var r=t.site;return r.y===e?r.x:1/0}function Un(t){this.site=t,this.edges=[]}function Xn(t){for(var e,n,r,a,o,i,l,s,c,u,f=t[0][0],d=t[1][0],h=t[0][1],p=t[1][1],g=os,m=g.length;m--;)if(o=g[m],o&&o.prepare())for(l=o.edges,s=l.length,i=0;iji||bi(a-n)>ji)&&(l.splice(i,0,new rr(er(o.site,u,bi(r-f)ji?{x:f,y:bi(e-f)ji?{x:bi(n-p)ji?{x:d,y:bi(e-d)ji?{x:bi(n-h)=-Ii)){var h=s*s+c*c,p=u*u+f*f,g=(f*h-c*p)/d,m=(s*p-u*h)/d,f=m+l,v=us.pop()||new Yn;v.arc=t,v.site=a,v.x=g+i,v.y=f+Math.sqrt(g*g+m*m),v.cy=f,t.circle=v;for(var y=null,x=ss._;x;)if(v.y=l)return;if(d>p){if(o){if(o.y>=c)return}else o={x:m,y:s};n={x:m,y:c}}else{if(o){if(o.y1)if(d>p){if(o){if(o.y>=c)return}else o={x:(s-a)/r,y:s};n={x:(c-a)/r,y:c}}else{if(o){if(o.y=l)return}else o={x:i,y:r*i+a};n={x:l,y:r*l+a}}else{if(o){if(o.xo||f>i||d=b,M=n>=_,k=M<<1|w,A=k+4;ko&&(a=e.slice(o,a),l[i]?l[i]+=a:l[++i]=a),(n=n[0])===(r=r[0])?l[i]?l[i]+=r:l[++i]=r:(l[++i]=null,s.push({i:i,x:xr(n,r)})),o=hs.lastIndex;return o=0&&!(n=ui.interpolators[r](t,e)););return n}function wr(t,e){var n,r=[],a=[],o=t.length,i=e.length,l=Math.min(t.length,e.length);for(n=0;n=1?1:t(e)}}function kr(t){return function(e){return 1-t(1-e)}}function Ar(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tr(t){return t*t}function Lr(t){return t*t*t}function Cr(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function Sr(t){return function(e){return Math.pow(e,t)}}function zr(t){return 1-Math.cos(t*Hi)}function Or(t){return Math.pow(2,10*(t-1)); +}function Nr(t){return 1-Math.sqrt(1-t*t)}function Pr(t,e){var n;return arguments.length<2&&(e=.45),arguments.length?n=e/Bi*Math.asin(1/t):(t=1,n=e/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-n)*Bi/e)}}function Er(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Dr(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 Rr(t,e){t=ui.hcl(t),e=ui.hcl(e);var n=t.h,r=t.c,a=t.l,o=e.h-n,i=e.c-r,l=e.l-a;return isNaN(i)&&(i=0,r=isNaN(r)?e.c:r),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360),function(t){return dt(n+o*t,r+i*t,a+l*t)+""}}function jr(t,e){t=ui.hsl(t),e=ui.hsl(e);var n=t.h,r=t.s,a=t.l,o=e.h-n,i=e.s-r,l=e.l-a;return isNaN(i)&&(i=0,r=isNaN(r)?e.s:r),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360),function(t){return ut(n+o*t,r+i*t,a+l*t)+""}}function Ir(t,e){t=ui.lab(t),e=ui.lab(e);var n=t.l,r=t.a,a=t.b,o=e.l-n,i=e.a-r,l=e.b-a;return function(t){return pt(n+o*t,r+i*t,a+l*t)+""}}function Fr(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function Br(t){var e=[t.a,t.b],n=[t.c,t.d],r=Hr(e),a=qr(e,n),o=Hr(Vr(n,e,-a))||0;e[0]*n[1]180?e+=360:e-t>180&&(t+=360),r.push({i:n.push(Gr(n)+"rotate(",null,")")-2,x:xr(t,e)})):e&&n.push(Gr(n)+"rotate("+e+")")}function Zr(t,e,n,r){t!==e?r.push({i:n.push(Gr(n)+"skewX(",null,")")-2,x:xr(t,e)}):e&&n.push(Gr(n)+"skewX("+e+")")}function Yr(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var a=n.push(Gr(n)+"scale(",null,",",null,")");r.push({i:a-4,x:xr(t[0],e[0])},{i:a-2,x:xr(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(Gr(n)+"scale("+e+")")}function Wr(t,e){var n=[],r=[];return t=ui.transform(t),e=ui.transform(e),Ur(t.translate,e.translate,n,r),Xr(t.rotate,e.rotate,n,r),Zr(t.skew,e.skew,n,r),Yr(t.scale,e.scale,n,r),t=e=null,function(t){for(var e,a=-1,o=r.length;++a=0;)n.push(a[r])}function sa(t,e){for(var n=[t],r=[];null!=(t=n.pop());)if(r.push(t),(o=t.children)&&(a=o.length))for(var a,o,i=-1;++ia&&(r=n,a=e);return r}function xa(t){return t.reduce(ba,0)}function ba(t,e){return t+e[1]}function _a(t,e){return wa(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wa(t,e){for(var n=-1,r=+t[0],a=(t[1]-r)/e,o=[];++n<=e;)o[n]=a*n+r;return o}function Ma(t){return[ui.min(t),ui.max(t)]}function ka(t,e){return t.value-e.value}function Aa(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Ta(t,e){t._pack_next=e,e._pack_prev=t}function La(t,e){var n=e.x-t.x,r=e.y-t.y,a=t.r+e.r;return.999*a*a>n*n+r*r}function Ca(t){function e(t){u=Math.min(t.x-t.r,u),f=Math.max(t.x+t.r,f),d=Math.min(t.y-t.r,d),h=Math.max(t.y+t.r,h)}if((n=t.children)&&(c=n.length)){var n,r,a,o,i,l,s,c,u=1/0,f=-(1/0),d=1/0,h=-(1/0);if(n.forEach(Sa),r=n[0],r.x=-r.r,r.y=0,e(r),c>1&&(a=n[1],a.x=a.r,a.y=0,e(a),c>2))for(o=n[2],Na(r,a,o),e(o),Aa(r,o),r._pack_prev=o,Aa(o,a),a=r._pack_next,i=3;i=0;)e=a[o],e.z+=n,e.m+=n,n+=e.s+(r+=e.c)}function Ia(t,e,n){return t.a.parent===e.parent?t.a:n}function Fa(t){return 1+ui.max(t,function(t){return t.y})}function Ba(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function qa(t){var e=t.children;return e&&e.length?qa(e[0]):t}function Ha(t){var e,n=t.children;return n&&(e=n.length)?Ha(n[e-1]):t}function Va(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Ga(t,e){var n=t.x+e[3],r=t.y+e[0],a=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return a<0&&(n+=a/2,a=0),o<0&&(r+=o/2,o=0),{x:n,y:r,dx:a,dy:o}}function Ua(t){var e=t[0],n=t[t.length-1];return e2?Qa:Za,s=r?$r:Qr;return i=a(t,e,s,n),l=a(e,t,s,_r),o}function o(t){return i(t)}var i,l;return o.invert=function(t){return l(t)},o.domain=function(e){return arguments.length?(t=e.map(Number),a()):t},o.range=function(t){return arguments.length?(e=t,a()):e},o.rangeRound=function(t){return o.range(t).interpolate(Fr)},o.clamp=function(t){return arguments.length?(r=t,a()):r},o.interpolate=function(t){return arguments.length?(n=t,a()):n},o.ticks=function(e){return eo(t,e)},o.tickFormat=function(e,n){return no(t,e,n)},o.nice=function(e){return Ka(t,e),a()},o.copy=function(){return $a(t,e,n,r)},a()}function Ja(t,e){return ui.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ka(t,e){return Ya(t,Wa(to(t,e)[2])),Ya(t,Wa(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var n=Ua(t),r=n[1]-n[0],a=Math.pow(10,Math.floor(Math.log(r/e)/Math.LN10)),o=e/r*a;return o<=.15?a*=10:o<=.35?a*=5:o<=.75&&(a*=2),n[0]=Math.ceil(n[0]/a)*a,n[1]=Math.floor(n[1]/a)*a+.5*a,n[2]=a,n}function eo(t,e){return ui.range.apply(ui,to(t,e))}function no(t,e,n){var r=to(t,e);if(n){var a=dl.exec(n);if(a.shift(),"s"===a[8]){var o=ui.formatPrefix(Math.max(bi(r[0]),bi(r[1])));return a[7]||(a[7]="."+ro(o.scale(r[2]))),a[8]="f",n=ui.format(a.join("")),function(t){return n(o.scale(t))+o.symbol}}a[7]||(a[7]="."+ao(a[8],r)),n=a.join("")}else n=",."+ro(r[2])+"f";return ui.format(n)}function ro(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ao(t,e){var n=ro(e[2]);return t in As?Math.abs(n-ro(Math.max(bi(e[0]),bi(e[1]))))+ +("e"!==t):n-2*("%"===t)}function oo(t,e,n,r){function a(t){return(n?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return n?Math.pow(e,t):-Math.pow(e,-t)}function i(e){return t(a(e))}return i.invert=function(e){return o(t.invert(e))},i.domain=function(e){return arguments.length?(n=e[0]>=0,t.domain((r=e.map(Number)).map(a)),i):r},i.base=function(n){return arguments.length?(e=+n,t.domain(r.map(a)),i):e},i.nice=function(){var e=Ya(r.map(a),n?Math:Ls);return t.domain(e),r=e.map(o),i},i.ticks=function(){var t=Ua(r),i=[],l=t[0],s=t[1],c=Math.floor(a(l)),u=Math.ceil(a(s)),f=e%1?2:e;if(isFinite(u-c)){if(n){for(;c0;d--)i.push(o(c)*d);for(c=0;i[c]s;u--);i=i.slice(c,u)}return i},i.tickFormat=function(t,n){if(!arguments.length)return Ts;arguments.length<2?n=Ts:"function"!=typeof n&&(n=ui.format(n));var r=Math.max(1,e*t/i.ticks().length);return function(t){var i=t/o(Math.round(a(t)));return i*e0?l[n-1]:t[0],n0?0:1}function _o(t,e,n,r,a){var o=t[0]-e[0],i=t[1]-e[1],l=(a?r:-r)/Math.sqrt(o*o+i*i),s=l*i,c=-l*o,u=t[0]+s,f=t[1]+c,d=e[0]+s,h=e[1]+c,p=(u+d)/2,g=(f+h)/2,m=d-u,v=h-f,y=m*m+v*v,x=n-r,b=u*h-d*f,_=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*v-m*_)/y,M=(-b*m-v*_)/y,k=(b*v+m*_)/y,A=(-b*m+v*_)/y,T=w-p,L=M-g,C=k-p,S=A-g;return T*T+L*L>C*C+S*S&&(w=k,M=A),[[w-s,M-c],[w*n/x,M*n/x]]}function wo(t){function e(e){function i(){c.push("M",o(t(u),l))}for(var s,c=[],u=[],f=-1,d=e.length,h=Ct(n),p=Ct(r);++f1?t.join("L"):t+"Z"}function ko(t){return t.join("L")+"Z"}function Ao(t){for(var e=0,n=t.length,r=t[0],a=[r[0],",",r[1]];++e1&&a.push("H",r[0]),a.join("")}function To(t){for(var e=0,n=t.length,r=t[0],a=[r[0],",",r[1]];++e1){l=e[1],o=t[s],s++,r+="C"+(a[0]+i[0])+","+(a[1]+i[1])+","+(o[0]-l[0])+","+(o[1]-l[1])+","+o[0]+","+o[1];for(var c=2;c9&&(a=3*e/Math.sqrt(a),i[l]=a*n,i[l+1]=a*r));for(l=-1;++l<=s;)a=(t[Math.min(s,l+1)][0]-t[Math.max(0,l-1)][0])/(6*(1+i[l]*i[l])),o.push([a||0,i[l]*a||0]);return o}function Ho(t){return t.length<3?Mo(t):t[0]+Oo(t,qo(t))}function Vo(t){for(var e,n,r,a=-1,o=t.length;++a0;)h[--l].call(t,i);if(o>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[r]:delete t[n],1}var s,c,u,d,h,p=t[n]||(t[n]={active:0,count:0}),g=p[r];g||(s=a.time,c=Pt(o,0,s),g=p[r]={tween:new f,time:s,timer:c,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++p.count)}function ri(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate("+(isFinite(r)?r:n(t))+",0)"})}function ai(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate(0,"+(isFinite(r)?r:n(t))+")"})}function oi(t){return t.toISOString()}function ii(t,e,n){function r(e){return t(e)}function a(t,n){var r=t[1]-t[0],a=r/n,o=ui.bisect(Js,a);return o==Js.length?[e.year,to(t.map(function(t){return t/31536e6}),n)[2]]:o?e[a/Js[o-1]1?{floor:function(e){for(;n(e=t.floor(e));)e=li(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=li(+e+1);return e}}:t))},r.ticks=function(t,e){var n=Ua(r.domain()),o=null==t?a(n,10):"number"==typeof t?a(n,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(n[0],li(+n[1]+1),e<1?1:e)},r.tickFormat=function(){return n},r.copy=function(){return ii(t.copy(),e,n)},Ja(r,t)}function li(t){return new Date(t)}function si(t){return JSON.parse(t.responseText)}function ci(t){var e=hi.createRange();return e.selectNode(hi.body),e.createContextualFragment(t.responseText)}var ui={version:"3.5.17"},fi=[].slice,di=function(t){return fi.call(t)},hi=this.document;if(hi)try{di(hi.documentElement.childNodes)[0].nodeType}catch(t){di=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),hi)try{hi.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var pi=this.Element.prototype,gi=pi.setAttribute,mi=pi.setAttributeNS,vi=this.CSSStyleDeclaration.prototype,yi=vi.setProperty;pi.setAttribute=function(t,e){gi.call(this,t,e+"")},pi.setAttributeNS=function(t,e,n){mi.call(this,t,e,n+"")},vi.setProperty=function(t,e,n){yi.call(this,t,e+"",n)}}ui.ascending=a,ui.descending=function(t,e){return et?1:e>=t?0:NaN},ui.min=function(t,e){var n,r,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=r;break}for(;++ar&&(n=r)}else{for(;++a=r){n=r;break}for(;++ar&&(n=r)}return n},ui.max=function(t,e){var n,r,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=r;break}for(;++an&&(n=r)}else{for(;++a=r){n=r;break}for(;++an&&(n=r)}return n},ui.extent=function(t,e){var n,r,a,o=-1,i=t.length;if(1===arguments.length){for(;++o=r){n=a=r;break}for(;++or&&(n=r),a=r){n=a=r;break}for(;++or&&(n=r),a1)return s/(u-1)},ui.deviation=function(){var t=ui.variance.apply(this,arguments);return t?Math.sqrt(t):t};var xi=l(a);ui.bisectLeft=xi.left,ui.bisect=ui.bisectRight=xi.right,ui.bisector=function(t){return l(1===t.length?function(e,n){return a(t(e),n)}:t)},ui.shuffle=function(t,e,n){(o=arguments.length)<3&&(n=t.length,o<2&&(e=0));for(var r,a,o=n-e;o;)a=Math.random()*o--|0,r=t[o+e],t[o+e]=t[a+e],t[a+e]=r;return t},ui.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r},ui.pairs=function(t){for(var e,n=0,r=t.length-1,a=t[0],o=new Array(r<0?0:r);n=0;)for(r=t[a],e=r.length;--e>=0;)n[--i]=r[e];return n};var bi=Math.abs;ui.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n===1/0)throw new Error("infinite range");var r,a=[],o=c(bi(n)),i=-1;if(t*=o,e*=o,n*=o,n<0)for(;(r=t+n*++i)>e;)a.push(r/o);else for(;(r=t+n*++i)=o.length)return r?r.call(a,i):n?i.sort(n):i;for(var s,c,u,d,h=-1,p=i.length,g=o[l++],m=new f;++h=o.length)return t;var r=[],a=i[n++];return t.forEach(function(t,a){r.push({key:t,values:e(a,n)})}),a?r.sort(function(t,e){return a(t.key,e.key)}):r}var n,r,a={},o=[],i=[];return a.map=function(e,n){return t(n,e,0)},a.entries=function(n){return e(t(ui.map,n,0),0)},a.key=function(t){return o.push(t),a},a.sortKeys=function(t){return i[o.length-1]=t,a},a.sortValues=function(t){return n=t,a},a.rollup=function(t){return r=t,a},a},ui.set=function(t){var e=new x;if(t)for(var n=0,r=t.length;n=0&&(r=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},ui.event=null,ui.requote=function(t){return t.replace(ki,"\\$&")};var ki=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ai={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},Ti=function(t,e){return e.querySelector(t)},Li=function(t,e){return e.querySelectorAll(t)},Ci=function(t,e){var n=t.matches||t[w(t,"matchesSelector")];return(Ci=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Ti=function(t,e){return Sizzle(t,e)[0]||null},Li=Sizzle,Ci=Sizzle.matchesSelector),ui.selection=function(){return ui.select(hi.documentElement)};var Si=ui.selection.prototype=[];Si.select=function(t){var e,n,r,a,o=[];t=z(t);for(var i=-1,l=this.length;++i=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Oi.hasOwnProperty(n)?{space:Oi[n],local:t}:t}},Si.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();return t=ui.ns.qualify(t),t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(N(e,t[e]));return this}return this.each(N(t,e))},Si.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=D(t)).length,a=-1;if(e=n.classList){for(;++a=0;)(n=r[a])&&(o&&o!==n.nextSibling&&o.parentNode.insertBefore(n,o),o=n);return this},Si.sort=function(t){t=G.apply(this,arguments);for(var e=-1,n=this.length;++e0&&(e=e.transition().duration(S)),e.call(t.event)}function l(){_&&_.domain(b.range().map(function(t){return(t-k.x)/k.k}).map(b.invert)),M&&M.domain(w.range().map(function(t){return(t-k.y)/k.k}).map(w.invert))}function s(t){z++||t({type:"zoomstart"})}function c(t){l(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function u(t){--z||(t({type:"zoomend"}),m=null)}function f(){function t(){l=1,o(ui.mouse(a),d),c(i)}function n(){f.on(N,null).on(P,null),h(l),u(i)}var a=this,i=D.of(a,arguments),l=0,f=ui.select(r(a)).on(N,t).on(P,n),d=e(ui.mouse(a)),h=$(a);Hs.call(a),s(i)}function d(){function t(){var t=ui.touches(p);return h=k.k,t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))}),t}function n(){var e=ui.event.target;ui.select(e).on(b,r).on(_,l),w.push(e);for(var n=ui.event.changedTouches,a=0,o=n.length;a1){var u=s[0],f=s[1],d=u[0]-f[0],h=u[1]-f[1];v=d*d+h*h}}function r(){var t,e,n,r,i=ui.touches(p);Hs.call(p);for(var l=0,s=i.length;l=c)return i;if(a)return a=!1,o;var e=u;if(34===t.charCodeAt(e)){for(var n=e;n++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,hl=ui.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=ui.round(t,jt(t,e))).toFixed(Math.max(0,Math.min(20,jt(t*(1+1e-15),e))))}}),pl=ui.time={},gl=Date;qt.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(){ml.setUTCDate.apply(this._,arguments)},setDay:function(){ml.setUTCDay.apply(this._,arguments)},setFullYear:function(){ml.setUTCFullYear.apply(this._,arguments)},setHours:function(){ml.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ml.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ml.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ml.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ml.setUTCSeconds.apply(this._,arguments)},setTime:function(){ml.setTime.apply(this._,arguments)}};var ml=Date.prototype;pl.year=Ht(function(t){return t=pl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),pl.years=pl.year.range,pl.years.utc=pl.year.utc.range,pl.day=Ht(function(t){var e=new gl(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),pl.days=pl.day.range,pl.days.utc=pl.day.utc.range,pl.dayOfYear=function(t){var e=pl.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=pl[t]=Ht(function(t){return(t=pl.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});pl[t+"s"]=n.range,pl[t+"s"].utc=n.utc.range,pl[t+"OfYear"]=function(t){var n=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(n+e)%7)/7)}}),pl.week=pl.sunday,pl.weeks=pl.sunday.range,pl.weeks.utc=pl.sunday.utc.range,pl.weekOfYear=pl.sundayOfYear;var vl={"-":"",_:" ",0:"0"},yl=/^\s*\d+/,xl=/^%/;ui.locale=function(t){return{numberFormat:Ft(t),timeFormat:Gt(t)}};var bl=ui.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"]});ui.format=bl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,_l),de(_l.s,this.s,this),this.s?this.t+=_l.t:this.s=_l.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _l=new fe;ui.geo.stream=function(t,e){t&&wl.hasOwnProperty(t.type)?wl[t.type](t,e):he(t,e)};var wl={Feature:function(t,e){he(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,a=n.length;++rh&&(h=e)}function e(e,n){var r=ve([e*Vi,n*Vi]);if(v){var a=xe(v,r),o=[a[1],-a[0],0],i=xe(o,a);we(i),i=Me(i);var s=e-p,c=s>0?1:-1,g=i[0]*Gi*c,m=bi(s)>180;if(m^(c*ph&&(h=y)}else if(g=(g+360)%360-180,m^(c*ph&&(h=n);m?el(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e):d>=u?(ed&&(d=e)):e>p?l(u,e)>l(u,d)&&(d=e):l(e,d)>l(u,d)&&(u=e)}else t(e,n);v=r,p=e}function n(){_.point=e}function r(){b[0]=u,b[1]=d,_.point=t,v=null}function a(t,n){if(v){var r=t-p;y+=bi(r)>180?r+(r>0?360:-360):r}else g=t,m=n;Tl.point(t,n),e(t,n)}function o(){Tl.lineStart()}function i(){a(g,m),Tl.lineEnd(),bi(y)>ji&&(u=-(d=180)),b[0]=u,b[1]=d,v=null}function l(t,e){return(e-=t)<0?e+360:e}function s(t,e){return t[0]-e[0]}function c(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tji?h=90:y<-ji&&(f=-90),b[0]=u,b[1]=d}};return function(t){h=d=-(u=f=1/0),x=[],ui.geo.stream(t,_);var e=x.length;if(e){x.sort(s);for(var n,r=1,a=x[0],o=[a];rl(a[0],a[1])&&(a[1]=n[1]),l(n[0],a[1])>l(a[0],a[1])&&(a[0]=n[0])):o.push(a=n);for(var i,n,p=-(1/0),e=o.length-1,r=0,a=o[e];r<=e;a=n,++r)n=o[r],(i=l(a[1],n[0]))>p&&(p=i,u=n[0],d=a[1])}return x=b=null,u===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[u,f],[d,h]]}}(),ui.geo.centroid=function(t){Ll=Cl=Sl=zl=Ol=Nl=Pl=El=Dl=Rl=jl=0,ui.geo.stream(t,Il);var e=Dl,n=Rl,r=jl,a=e*e+n*n+r*r;return a=.12&&a<.234&&r>=-.425&&r<-.214?i:a>=.166&&a<.234&&r>=-.214&&r<-.115?l:o).invert(t)},t.stream=function(t){var e=o.stream(t),n=i.stream(t),r=l.stream(t);return{point:function(t,a){e.point(t,a),n.point(t,a),r.point(t,a)},sphere:function(){e.sphere(),n.sphere(),r.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),i.precision(e),l.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),i.scale(.35*e),l.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var c=o.scale(),u=+e[0],f=+e[1];return n=o.translate(e).clipExtent([[u-.455*c,f-.238*c],[u+.455*c,f+.238*c]]).stream(s).point,r=i.translate([u-.307*c,f+.201*c]).clipExtent([[u-.425*c+ji,f+.12*c+ji],[u-.214*c-ji,f+.234*c-ji]]).stream(s).point,a=l.translate([u-.205*c,f+.212*c]).clipExtent([[u-.214*c+ji,f+.166*c+ji],[u-.115*c-ji,f+.234*c-ji]]).stream(s).point,t},t.scale(1070)};var ql,Hl,Vl,Gl,Ul,Xl,Zl={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Hl=0,Zl.lineStart=Ye},polygonEnd:function(){Zl.lineStart=Zl.lineEnd=Zl.point=M,ql+=bi(Hl/2)}},Yl={point:We,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Wl={point:Je,lineStart:Ke,lineEnd:tn,polygonStart:function(){Wl.lineStart=en},polygonEnd:function(){Wl.point=Je,Wl.lineStart=Ke,Wl.lineEnd=tn}};ui.geo.path=function(){function t(t){return t&&("function"==typeof l&&o.pointRadius(+l.apply(this,arguments)),i&&i.valid||(i=a(o)),ui.geo.stream(t,i)),o.result()}function e(){return i=null,t}var n,r,a,o,i,l=4.5;return t.area=function(t){return ql=0,ui.geo.stream(t,a(Zl)),ql},t.centroid=function(t){return Sl=zl=Ol=Nl=Pl=El=Dl=Rl=jl=0,ui.geo.stream(t,a(Wl)),jl?[Dl/jl,Rl/jl]:El?[Nl/El,Pl/El]:Ol?[Sl/Ol,zl/Ol]:[NaN,NaN]},t.bounds=function(t){return Ul=Xl=-(Vl=Gl=1/0),ui.geo.stream(t,a(Yl)),[[Vl,Gl],[Ul,Xl]]},t.projection=function(t){return arguments.length?(a=(n=t)?t.stream||an(t):b,e()):n},t.context=function(t){return arguments.length?(o=null==(r=t)?new Qe:new nn(t),"function"!=typeof l&&o.pointRadius(l),e()):r},t.pointRadius=function(e){return arguments.length?(l="function"==typeof e?e:(o.pointRadius(+e),+e),t):l},t.projection(ui.geo.albersUsa()).context(null)},ui.geo.transform=function(t){return{stream:function(e){var n=new on(e);for(var r in t)n[r]=t[r];return n}}},on.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()}},ui.geo.projection=sn,ui.geo.projectionMutator=cn,(ui.geo.equirectangular=function(){return sn(fn)}).raw=fn.invert=fn,ui.geo.rotation=function(t){function e(e){return e=t(e[0]*Vi,e[1]*Vi),e[0]*=Gi,e[1]*=Gi,e}return t=hn(t[0]%360*Vi,t[1]*Vi,t.length>2?t[2]*Vi:0),e.invert=function(e){return e=t.invert(e[0]*Vi,e[1]*Vi),e[0]*=Gi,e[1]*=Gi,e},e},dn.invert=fn,ui.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,e=hn(-t[0]*Vi,-t[1]*Vi,0).invert,a=[];return n(null,null,1,{point:function(t,n){a.push(t=e(t,n)),t[0]*=Gi,t[1]*=Gi}}),{type:"Polygon",coordinates:[a]}}var e,n,r=[0,0],a=6;return t.origin=function(e){return arguments.length?(r=e,t):r},t.angle=function(r){return arguments.length?(n=vn((e=+r)*Vi,a*Vi),t):e},t.precision=function(r){return arguments.length?(n=vn(e*Vi,(a=+r)*Vi),t):a},t.angle(90)},ui.geo.distance=function(t,e){var n,r=(e[0]-t[0])*Vi,a=t[1]*Vi,o=e[1]*Vi,i=Math.sin(r),l=Math.cos(r),s=Math.sin(a),c=Math.cos(a),u=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((n=f*i)*n+(n=c*u-s*f*l)*n),s*u+c*f*l)},ui.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return ui.range(Math.ceil(o/m)*m,a,m).map(d).concat(ui.range(Math.ceil(c/v)*v,s,v).map(h)).concat(ui.range(Math.ceil(r/p)*p,n,p).filter(function(t){return bi(t%m)>ji}).map(u)).concat(ui.range(Math.ceil(l/g)*g,i,g).filter(function(t){return bi(t%v)>ji}).map(f))}var n,r,a,o,i,l,s,c,u,f,d,h,p=10,g=p,m=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[d(o).concat(h(s).slice(1),d(a).reverse().slice(1),h(c).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],a=+e[1][0],c=+e[0][1],s=+e[1][1],o>a&&(e=o,o=a,a=e),c>s&&(e=c,c=s,s=e),t.precision(y)):[[o,c],[a,s]]},t.minorExtent=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],l=+e[0][1],i=+e[1][1],r>n&&(e=r,r=n,n=e),l>i&&(e=l,l=i,i=e),t.precision(y)):[[r,l],[n,i]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(m=+e[0],v=+e[1],t):[m,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,u=xn(l,i,90),f=bn(r,n,y),d=xn(c,s,90),h=bn(o,a,y),t):y},t.majorExtent([[-180,-90+ji],[180,90-ji]]).minorExtent([[-180,-80-ji],[180,80+ji]])},ui.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||r.apply(this,arguments),n||a.apply(this,arguments)]}}var e,n,r=_n,a=wn;return t.distance=function(){return ui.geo.distance(e||r.apply(this,arguments),n||a.apply(this,arguments))},t.source=function(n){return arguments.length?(r=n,e="function"==typeof n?null:n,t):r},t.target=function(e){return arguments.length?(a=e,n="function"==typeof e?null:e,t):a},t.precision=function(){return arguments.length?t:0},t},ui.geo.interpolate=function(t,e){return Mn(t[0]*Vi,t[1]*Vi,e[0]*Vi,e[1]*Vi)},ui.geo.length=function(t){return Ql=0,ui.geo.stream(t,$l),Ql};var Ql,$l={sphere:M,point:M,lineStart:kn,lineEnd:M,polygonStart:M,polygonEnd:M},Jl=An(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return sn(Jl)}).raw=Jl;var Kl=An(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return sn(Kl)}).raw=Kl,(ui.geo.conicConformal=function(){return Xe(Tn)}).raw=Tn,(ui.geo.conicEquidistant=function(){return Xe(Ln)}).raw=Ln;var ts=An(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return sn(ts)}).raw=ts,Cn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return Sn(Cn)}).raw=Cn;var es=An(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return sn(es)}).raw=es;var ns=An(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return sn(ns)}).raw=ns,zn.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Hi]},(ui.geo.transverseMercator=function(){var t=Sn(zn),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):(t=n(),[t[0],t[1],t[2]-90])},n([0,0,90])}).raw=zn,ui.geom={},ui.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,a=Ct(n),o=Ct(r),i=t.length,l=[],s=[];for(e=0;e=0;--e)h.push(t[l[c[e]][2]]);for(e=+f;e=r&&c.x<=o&&c.y>=a&&c.y<=i?[[r,i],[o,i],[o,a],[r,a]]:[];u.point=t[l]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/ji)*ji,y:Math.round(i(t,e)/ji)*ji,i:e}})}var r=On,a=Nn,o=r,i=a,l=fs;return t?e(t):(e.links=function(t){return cr(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return cr(n(t)).cells.forEach(function(n,r){for(var a,o,i=n.site,l=n.edges.sort(Zn),s=-1,c=l.length,u=l[c-1].edge,f=u.l===i?u.r:u.l;++s=c,d=r>=u,h=d<<1|f;t.leaf=!1,t=t.nodes[h]||(t.nodes[h]=pr()),f?a=c:l=c,d?i=u:s=u,o(t,e,n,r,a,i,l,s)}var u,f,d,h,p,g,m,v,y,x=Ct(l),b=Ct(s);if(null!=e)g=e,m=n,v=r,y=a;else if(v=y=-(g=m=1/0),f=[],d=[],p=t.length,i)for(h=0;hv&&(v=u.x),u.y>y&&(y=u.y),f.push(u.x),d.push(u.y);else for(h=0;hv&&(v=_),w>y&&(y=w),f.push(_),d.push(w)}var M=v-g,k=y-m;M>k?y=m+M:v=g+k;var A=pr();if(A.add=function(t){o(A,t,+x(t,++h),+b(t,h),g,m,v,y)},A.visit=function(t){gr(t,A,g,m,v,y)},A.find=function(t){return mr(A,t[0],t[1],g,m,v,y)},h=-1,null==e){for(;++h=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=gs.get(n)||ps,r=ms.get(r)||b,Mr(r(n.apply(null,fi.call(arguments,1))))},ui.interpolateHcl=Rr,ui.interpolateHsl=jr,ui.interpolateLab=Ir,ui.interpolateRound=Fr,ui.transform=function(t){var e=hi.createElementNS(ui.ns.prefix.svg,"g");return(ui.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new Br(n?n.matrix:vs)})(t)},Br.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var vs={a:1,b:0,c:0,d:1,e:0,f:0};ui.interpolateTransform=Wr,ui.layout={},ui.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++n0?a=t:(n.c=null,n.t=NaN,n=null,c.end({type:"end",alpha:a=0})):t>0&&(c.start({type:"start",alpha:a=t}),n=Pt(s.tick)),s):a},s.start=function(){function t(t,r){if(!n){for(n=new Array(a),s=0;s=0;)i.push(u=c[s]),u.parent=o,u.depth=o.depth+1;r&&(o.value=0),o.children=c}else r&&(o.value=+r.call(t,o,o.depth)||0),delete o.children;return sa(a,function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)}),l}var e=fa,n=ca,r=ua;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(r=e,t):r},t.revalue=function(e){return r&&(la(e,function(t){t.children&&(t.value=0)}),sa(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},ui.layout.partition=function(){function t(e,n,r,a){var o=e.children;if(e.x=n,e.y=e.depth*a,e.dx=r,e.dy=a,o&&(i=o.length)){var i,l,s,c=-1;for(r=e.value?r/e.value:0;++cl&&(l=r),i.push(r)}for(n=0;n0)for(o=-1;++o=u[0]&&l<=u[1]&&(i=s[ui.bisect(f,l,1,h)-1],i.y+=p,i.push(t[o]));return s}var e=!0,n=Number,r=Ma,a=_a;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(r=Ct(e),t):r},t.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return wa(t,e)}:Ct(e),t):a},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},ui.layout.pack=function(){function t(t,o){var i=n.call(this,t,o),l=i[0],s=a[0],c=a[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(l.x=l.y=0,sa(l,function(t){t.r=+u(t.value)}),sa(l,Ca),r){var f=r*(e?1:Math.max(2*l.r/s,2*l.r/c))/2;sa(l,function(t){t.r+=f}),sa(l,Ca),sa(l,function(t){t.r-=f})}return Oa(l,s/2,c/2,e?1:1/Math.max(2*l.r/s,2*l.r/c)),i}var e,n=ui.layout.hierarchy().sort(ka),r=0,a=[1,1];return t.size=function(e){return arguments.length?(a=e,t):a},t.radius=function(n){return arguments.length?(e=null==n||"function"==typeof n?n:+n,t):e},t.padding=function(e){return arguments.length?(r=+e,t):r},ia(t,n)},ui.layout.tree=function(){function t(t,a){var u=i.call(this,t,a),f=u[0],d=e(f);if(sa(d,n),d.parent.m=-d.z,la(d,r),c)la(f,o);else{var h=f,p=f,g=f;la(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var m=l(h,p)/2-h.x,v=s[0]/(p.x+l(p,h)/2+m),y=s[1]/(g.depth||1);la(f,function(t){t.x=(t.x+m)*v,t.y=t.depth*y})}return u}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var a,o=e.children,i=0,l=o.length;i0&&(Ra(Ia(i,t,n),t,r),c+=r,u+=r),f+=i.m,c+=a.m,d+=s.m,u+=o.m;i&&!Da(o)&&(o.t=i,o.m+=f-u),a&&!Ea(s)&&(s.t=a,s.m+=c-d,n=t)}return n}function o(t){t.x*=s[0],t.y=t.depth*s[1]}var i=ui.layout.hierarchy().sort(null).value(null),l=Pa,s=[1,1],c=null;return t.separation=function(e){return arguments.length?(l=e,t):l},t.size=function(e){return arguments.length?(c=null==(s=e)?o:null,t):c?null:s},t.nodeSize=function(e){return arguments.length?(c=null==(s=e)?null:o,t):c?s:null},ia(t,i)},ui.layout.cluster=function(){function t(t,o){var i,l=e.call(this,t,o),s=l[0],c=0;sa(s,function(t){var e=t.children;e&&e.length?(t.x=Ba(e),t.y=Fa(e)):(t.x=i?c+=n(t,i):0,t.y=0,i=t)});var u=qa(s),f=Ha(s),d=u.x-n(u,f)/2,h=f.x+n(f,u)/2;return sa(s,a?function(t){t.x=(t.x-s.x)*r[0],t.y=(s.y-t.y)*r[1]}:function(t){t.x=(t.x-d)/(h-d)*r[0],t.y=(1-(s.y?t.y/s.y:1))*r[1]}),l}var e=ui.layout.hierarchy().sort(null).value(null),n=Pa,r=[1,1],a=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(a=null==(r=e),t):a?null:r},t.nodeSize=function(e){return arguments.length?(a=null!=(r=e),t):a?r:null},ia(t,e)},ui.layout.treemap=function(){function t(t,e){for(var n,r,a=-1,o=t.length;++a0;)u.push(i=d[s-1]),u.area+=i.area,"squarify"!==h||(l=r(u,g))<=p?(d.pop(),p=l):(u.area-=u.pop().area,a(u,g,c,!1),g=Math.min(c.dx,c.dy),u.length=u.area=0,p=1/0);u.length&&(a(u,g,c,!0),u.length=u.area=0),o.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var o,i=f(e),l=r.slice(),s=[];for(t(l,i.dx*i.dy/e.value),s.area=0;o=l.pop();)s.push(o),s.area+=o.area,null!=o.z&&(a(s,o.z?i.dx:i.dy,i,!l.length),s.length=s.area=0);r.forEach(n)}}function r(t,e){for(var n,r=t.area,a=0,o=1/0,i=-1,l=t.length;++ia&&(a=n));return r*=r,e*=e,r?Math.max(e*a*p/r,r/(e*o*p)):1/0}function a(t,e,n,r){var a,o=-1,i=t.length,l=n.x,c=n.y,u=e?s(t.area/e):0;if(e==n.dx){for((r||u>n.dy)&&(u=n.dy);++on.dx)&&(u=n.dx);++o1);return t+e*n*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=ui.random.normal.apply(ui,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ui.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;nf?0:1;if(c=qi)return e(c,h)+(t?e(t,1-h):"")+"Z";var p,g,m,v,y,x,b,_,w,M,k,A,T=0,L=0,C=[];if((v=(+s.apply(this,arguments)||0)/2)&&(m=o===Ns?Math.sqrt(t*t+c*c):+o.apply(this,arguments),h||(L*=-1),c&&(L=rt(m/c*Math.sin(v))),t&&(T=rt(m/t*Math.sin(v)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var S=Math.abs(f-u-2*L)<=Fi?0:1;if(L&&bo(y,x,b,_)===h^S){var z=(u+f)/2;y=c*Math.cos(z),x=c*Math.sin(z),b=_=null}}else y=x=0;if(t){w=t*Math.cos(f-T),M=t*Math.sin(f-T),k=t*Math.cos(u+T),A=t*Math.sin(u+T);var O=Math.abs(u-f+2*T)<=Fi?0:1;if(T&&bo(w,M,k,A)===1-h^O){var N=(u+f)/2;w=t*Math.cos(N),M=t*Math.sin(N),k=A=null}}else w=M=0;if(d>ji&&(p=Math.min(Math.abs(c-t)/2,+a.apply(this,arguments)))>.001){g=tFi)+",1 "+e}function a(t,e,n,r){return"Q 0,0 "+r}var o=_n,i=wn,l=Uo,s=vo,c=yo;return t.radius=function(e){return arguments.length?(l=Ct(e),t):l},t.source=function(e){return arguments.length?(o=Ct(e),t):o},t.target=function(e){return arguments.length?(i=Ct(e),t):i},t.startAngle=function(e){return arguments.length?(s=Ct(e),t):s},t.endAngle=function(e){return arguments.length?(c=Ct(e),t):c},t},ui.svg.diagonal=function(){function t(t,a){var o=e.call(this,t,a),i=n.call(this,t,a),l=(o.y+i.y)/2,s=[o,{x:o.x,y:l},{x:i.x,y:l},i];return s=s.map(r),"M"+s[0]+"C"+s[1]+" "+s[2]+" "+s[3]}var e=_n,n=wn,r=Xo;return t.source=function(n){return arguments.length?(e=Ct(n),t):e},t.target=function(e){return arguments.length?(n=Ct(e),t):n},t.projection=function(e){return arguments.length?(r=e,t):r},t},ui.svg.diagonal.radial=function(){var t=ui.svg.diagonal(),e=Xo,n=t.projection;return t.projection=function(t){return arguments.length?n(Zo(e=t)):e},t},ui.svg.symbol=function(){function t(t,r){return(js.get(e.call(this,t,r))||Qo)(n.call(this,t,r))}var e=Wo,n=Yo;return t.type=function(n){return arguments.length?(e=Ct(n),t):e},t.size=function(e){return arguments.length?(n=Ct(e),t):n},t};var js=ui.map({circle:Qo,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Fs)),n=e*Fs;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",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/Is),n=e*Is/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Is),n=e*Is/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});ui.svg.symbolTypes=js.keys();var Is=Math.sqrt(3),Fs=Math.tan(30*Vi);Si.transition=function(t){for(var e,n,r=Bs||++Gs,a=ei(t),o=[],i=qs||{time:Date.now(),ease:Cr,delay:0,duration:250},l=-1,s=this.length;++lrect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",d[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==ui.event.keyCode&&(S||(x=null,O[0]-=f[1],O[1]-=d[1],S=2),T())}function g(){32==ui.event.keyCode&&2==S&&(O[0]+=f[1],O[1]+=d[1],S=0,T())}function m(){var t=ui.mouse(_),r=!1;b&&(t[0]+=b[0],t[1]+=b[1]),S||(ui.event.altKey?(x||(x=[(f[0]+f[1])/2,(d[0]+d[1])/2]),O[0]=f[+(t[0]0&&this._events[t].length>n&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!a(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,l;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||a(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(n)){for(l=o;l-- >0;)if(n[l]===e||n[l].listener&&n[l].listener===e){r=l;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;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(n=this._events[t],a(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],11:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;r13)&&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}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return t-t<1}},{}],12:[function(t,e,n){function r(t,e){var n=e[0],r=e[1],a=e[2],o=e[3],i=n+n,l=r+r,s=a+a,c=n*i,u=r*i,f=r*l,d=a*i,h=a*l,p=a*s,g=o*i,m=o*l,v=o*s;return t[0]=1-f-p,t[1]=u+v,t[2]=d-m,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+m,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=r},{}],13:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function i(t){if(d===clearTimeout)return clearTimeout(t);if((d===a||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{return d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}function l(){m&&p&&(m=!1,p.length?g=p.concat(g):v=-1,g.length&&s())}function s(){if(!m){var t=o(l);m=!0;for(var e=g.length;e;){for(p=g,g=[];++v1)for(var n=1;n.5?s/(2-o-i):s/(o+i),o){case t:r=(e-n)/s+(e1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var a,o,i;if(t=C(t,360),e=C(e,100),n=C(n,100),0===e)a=o=i=n;else{var l=n<.5?n*(1+e):n+e-n*e,s=2*n-l;a=r(s,l,t+1/3),o=r(s,l,t),i=r(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function s(t,e,n){t=C(t,255),e=C(e,255),n=C(n,255);var r,a,o=U(t,e,n),i=G(t,e,n),l=o,s=o-i;if(a=0===o?0:s/o,o==i)r=0;else{switch(o){case t:r=(e-n)/s+(e>1)+720)%360;--e;)a.h=(a.h+o)%360,i.push(r(a));return i}function A(t,e){e=e||6;for(var n=r(t).toHsv(),a=n.h,o=n.s,i=n.v,l=[],s=1/e;e--;)l.push(r({h:a,s:o,v:i})),i=(i+s)%1;return l}function T(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function C(t,n){O(t)&&(t="100%");var r=N(t);return t=G(n,U(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function S(t){return G(1,U(0,t))}function z(t){return parseInt(t,16)}function O(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function N(t){return"string"==typeof t&&t.indexOf("%")!=-1}function P(t){return 1==t.length?"0"+t:""+t}function E(t){return t<=1&&(t=100*t+"%"),t}function D(t){return e.round(255*parseFloat(t)).toString(16)}function R(t){return z(t)/255}function j(t){return!!W.CSS_UNIT.exec(t)}function I(t){t=t.replace(B,"").replace(q,"").toLowerCase();var e=!1;if(Z[t])t=Z[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=W.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=W.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=W.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=W.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=W.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=W.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=W.hex8.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),a:R(n[4]),format:e?"name":"hex8"}:(n=W.hex6.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),format:e?"name":"hex"}:(n=W.hex4.exec(t))?{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),a:R(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=W.hex3.exec(t))&&{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),format:e?"name":"hex"}}function F(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var B=/^\s+/,q=/\s+$/,H=0,V=e.round,G=e.min,U=e.max,X=e.random;r.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,a,o,i,l=this.toRgb();return t=l.r/255,n=l.g/255,r=l.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),i=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),.2126*a+.7152*o+.0722*i},setAlpha:function(t){return this._a=L(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*C(this._r,255))+"%",g:V(100*C(this._g,255))+"%",b:V(100*C(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%)":"rgba("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[u(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),n=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=r(t);n="#"+d(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,a=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return r(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(k,arguments); +},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},r.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?n[a]=t[a]:n[a]=E(t[a]));t=n}return r(t,e)},r.equals=function(t,e){return!(!t||!e)&&r(t).toRgbString()==r(e).toRgbString()},r.random=function(){return r.fromRatio({r:X(),g:X(),b:X()})},r.mix=function(t,e,n){n=0===n?0:n||50;var a=r(t).toRgb(),o=r(e).toRgb(),i=n/100,l={r:(o.r-a.r)*i+a.r,g:(o.g-a.g)*i+a.g,b:(o.b-a.b)*i+a.b,a:(o.a-a.a)*i+a.a};return r(l)},r.readability=function(t,n){var a=r(t),o=r(n);return(e.max(a.getLuminance(),o.getLuminance())+.05)/(e.min(a.getLuminance(),o.getLuminance())+.05)},r.isReadable=function(t,e,n){var a,o,i=r.readability(t,e);switch(o=!1,a=F(n),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},r.mostReadable=function(t,e,n){var a,o,i,l,s=null,c=0;n=n||{},o=n.includeFallbackColors,i=n.level,l=n.size;for(var u=0;uc&&(c=a,s=r(e[u]));return r.isReadable(t,s,{level:i,size:l})||!o?s:(n.includeFallbackColors=!1,r.mostReadable(t,["#fff","#000"],n))};var Z=r.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=r.hexNames=T(Z),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+r),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})$/}}();"undefined"!=typeof n&&n.exports?n.exports=r:"function"==typeof t&&t.amd?t(function(){return r}):window.tinycolor=r}(Math)},{}],15:[function(e,n,r){!function(e,a){"object"==typeof r&&"undefined"!=typeof n?a(r):"function"==typeof t&&t.amd?t(["exports"],a):a(e.topojson=e.topojson||{})}(this,function(t){"use strict";function e(t,e){var r=e.id,a=e.bbox,o=null==e.properties?{}:e.properties,i=n(t,e);return null==r&&null==a?{type:"Feature",properties:o,geometry:i}:null==a?{type:"Feature",id:r,properties:o,geometry:i}:{type:"Feature",id:r,bbox:a,properties:o,geometry:i}}function n(t,e){function n(t,e){e.length&&e.pop();for(var n=f[t<0?~t:t],r=0,a=n.length;r1)r=a(t,e,n);else for(o=0,r=new Array(i=t.arcs.length);o1)for(var a,o,s=1,c=i(r[0]);sc&&(o=r[0],r[0]=r[s],r[s]=o,c=a);return r})}}var l=function(t){return t},s=function(t){if(null==(e=t.transform))return l;var e,n,r,a=e.scale[0],o=e.scale[1],i=e.translate[0],s=e.translate[1];return function(t,e){return e||(n=r=0),t[0]=(n+=t[0])*a+i,t[1]=(r+=t[1])*o+s,t}},c=function(t){function e(t){l[0]=t[0],l[1]=t[1],i(l),l[0]f&&(f=l[0]),l[1]d&&(d=l[1])}function n(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(n);break;case"Point":e(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(e)}}var r=t.bbox;if(!r){var a,o,i=s(t),l=new Array(2),c=1/0,u=c,f=-c,d=-c;t.arcs.forEach(function(t){for(var e=-1,n=t.length;++ef&&(f=l[0]),l[1]d&&(d=l[1])});for(o in t.objects)n(t.objects[o]);r=t.bbox=[c,u,f,d]}return r},u=function(t,e){for(var n,r=t.length,a=r-e;a<--r;)n=t[a],t[a++]=t[r],t[r]=n},f=function(t,n){return"GeometryCollection"===n.type?{type:"FeatureCollection",features:n.geometries.map(function(n){return e(t,n)})}:e(t,n)},d=function(t,e){function n(e){var n,r=t.arcs[e<0?~e:e],a=r[0];return t.transform?(n=[0,0],r.forEach(function(t){n[0]+=t[0],n[1]+=t[1]})):n=r[r.length-1],e<0?[n,a]:[a,n]}function r(t,e){for(var n in t){var r=t[n];delete e[r.start],delete r.start,delete r.end,r.forEach(function(t){a[t<0?~t:t]=1}),l.push(r)}}var a={},o={},i={},l=[],s=-1;return e.forEach(function(n,r){var a,o=t.arcs[n<0?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(a=e[++s],e[s]=n,e[r]=a)}),e.forEach(function(t){var e,r,a=n(t),l=a[0],s=a[1];if(e=i[l])if(delete i[e.end],e.push(t),e.end=s,r=o[s]){delete o[r.start];var c=r===e?e:e.concat(r);o[c.start=e.start]=i[c.end=r.end]=c}else o[e.start]=i[e.end]=e;else if(e=o[s])if(delete o[e.start],e.unshift(t),e.start=l,r=i[l]){delete i[r.end];var u=r===e?e:r.concat(e);o[u.start=r.start]=i[u.end=e.end]=u}else o[e.start]=i[e.end]=e;else e=[t],o[e.start=l]=i[e.end=s]=e}),r(i,o),r(o,i),e.forEach(function(t){a[t<0?~t:t]||l.push([t])}),l},h=function(t){return n(t,r.apply(this,arguments))},p=function(t){return n(t,i.apply(this,arguments))},g=function(t,e){for(var n=0,r=t.length;n>>1;t[a]=2))throw new Error("n must be \u22652");if(t.transform)throw new Error("already quantized");var a,o=c(t),i=o[0],l=(o[2]-i)/(e-1)||1,s=o[1],u=(o[3]-s)/(e-1)||1;t.arcs.forEach(function(t){for(var e,n,r,a=1,o=1,c=t.length,f=t[0],d=f[0]=Math.round((f[0]-i)/l),h=f[1]=Math.round((f[1]-s)/u);a2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}rt.selectAll("tspan.line").attr({y:0,x:0});var r=$.select(".annotation-math-group"),a=!r.empty(),l=h.bBox((a?r:rt).node()),c=l.width,p=l.height,v=Math.round(c+2*tt),y=Math.round(p+2*tt);G._w=c,G._h=p;var b=!1;if(["x","y"].forEach(function(e){var r,a=G[e+"ref"]||e,o=f.getFromId(t,a),i=(Y+("x"===e?0:90))*Math.PI/180,l=v*Math.abs(Math.cos(i))+y*Math.abs(Math.sin(i)),s=G[e+"anchor"];if(o){var c=o.r2fraction(G[e]);if(!o.autorange&&(c<0||c>1)&&(G["a"+e+"ref"]===a?(c=o.r2fraction(G["a"+e]),(c<0||c>1)&&(b=!0)):b=!0,b))return;Z[e]=o._offset+o.r2p(G[e]),r=.5}else r=G[e],"y"===e&&(r=1-r),Z[e]="x"===e?O.l+O.w*r:O.t+O.h*r;var u=0;G["a"+e+"ref"]===a?Z["aa"+e]=o._offset+o.r2p(G["a"+e]):(u=G.showarrow?G["a"+e]:l*n(r,s),Z[e]+=u),G["_"+e+"type"]=o&&o.type,G["_"+e+"size"]=l,G["_"+e+"shift"]=u}),b)return void $.remove();var _,w;G.showarrow&&(_=G.axref===G.xref?Z.x:u.constrain(Z.x-G.ax,1,k.width-1),w=G.ayref===G.yref?Z.y:u.constrain(Z.y-G.ay,1,k.height-1)),Z.x=u.constrain(Z.x,1,k.width-1),Z.y=u.constrain(Z.y,1,k.height-1);var M=tt-l.top,A=tt-l.left;a?r.select("svg").attr({x:tt-1,y:tt}):(rt.attr({x:A,y:M}),rt.selectAll("tspan.line").attr({y:M,x:A})),et.call(h.setRect,J/2,J/2,v-J,y-J);var T=0,L=0;T=G.axref===G.xref?Math.round(Z.aax-v/2):Math.round(Z.x-v/2),L=G.ayref===G.yref?Math.round(Z.aay-y/2):Math.round(Z.y-y/2),$.call(u.setTranslate,T,L);var C="annotations["+e+"]",S=function(n,r){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=G.axref===G.xref?Z.aax+n:Z.x+n,l=G.ayref===G.yref?Z.aay+r:Z.y+r;var c=u.rotationXYMatrix(Y,a,l),f=u.apply2DTransform(c),h=u.apply2DTransform2(c),p=et.attr("width")/2,g=et.attr("height")/2,v=[[a-p,l-g,a-p,l+g],[a-p,l+g,a+p,l+g],[a+p,l+g,a+p,l-g],[a+p,l-g,a-p,l-g]].map(h);if(!v.reduce(function(t,e){return t^!!o(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=o(a,l,_,w,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var y=G.arrowwidth,b=G.arrowcolor,M=W.append("g").style({opacity:d.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=M.append("path").attr("d","M"+a+","+l+"L"+_+","+w).style("stroke-width",y+"px").call(d.stroke,d.rgb(b));x(k,G.arrowhead,"end",G.arrowsize);var A=M.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-_)+","+(l-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,S;m.init({element:A.node(),prepFn:function(){var t=u.getTranslate($);L=t.x,S=t.y,T={},U&&U.autorange&&(T[U._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){M.attr("transform","translate("+t+","+e+")");var n=f(L,S),r=n[0]+t,a=n[1]+e;$.call(u.setTranslate,r,a),T[C+".x"]=U?U.p2r(U.r2p(G.x)+t):(_+t-O.l)/O.w,T[C+".y"]=X?X.p2r(X.r2p(G.y)+e):1-(w+e-O.t)/O.h,G.axref===G.xref&&(T[C+".ax"]=U?U.p2r(U.r2p(G.ax)+t):(_+t-O.l)/O.w),G.ayref===G.yref&&(T[C+".ay"]=X?X.p2r(X.r2p(G.ay)+e):1-(w+e-O.t)/O.h),Q.attr({transform:"rotate("+Y+","+r+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};G.showarrow&&S(0,0);var z=u.rotationXYMatrix(Y,Z.x,Z.y),N=u.apply2DTransform(z);if(t._context.editable){var P,E,D;m.init({element:$.node(),prepFn:function(){var t=u.getTranslate($);P=t.x,E=t.y,D={}},moveFn:function(t,e){$.call(u.setTranslate,P+t,E+e);var n="pointer";if(G.showarrow)G.axref===G.xref?D[C+".ax"]=U.p2r(U.r2p(G.ax)+t):D[C+".ax"]=G.ax+t,G.ayref===G.yref?D[C+".ay"]=X.p2r(X.r2p(G.ay)+e):D[C+".ay"]=G.ay+e,S(t,e);else{if(U)D[C+".x"]=G.x+t/U._m;else{var r=G._xsize/O.w,a=G.x+G._xshift/O.w-r/2;D[C+".x"]=m.align(a+t/O.w,r,0,1,G.xanchor)}if(X)D[C+".y"]=G.y+e/X._m;else{var o=G._ysize/O.h,i=G.y-G._yshift/O.h-o/2;D[C+".y"]=m.align(i-e/O.h,o,0,1,G.yanchor)}U&&X||(n=m.getCursor(U?.5:D[C+".x"],X?.5:D[C+".y"],G.xanchor,G.yanchor))}var l=N(P,E),s=l[0]+t,c=l[1]+e;$.call(u.setTranslate,P+t,E+e),Q.attr({transform:"rotate("+Y+","+s+","+c+")"}),g($,n)},doneFn:function(e){if(g($),e){s.relayout(t,D);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var w,M=t.layout,k=t._fullLayout;if(!l(e)||e===-1){if(!e&&Array.isArray(c))return M.annotations=c,y(M,k),void r(t);if("remove"===c)return delete M.annotations,k.annotations=[],void r(t);if(n&&"add"!==c){for(w=0;we;w--)k._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),a(t,w)}}k._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=M.annotations[e],L=k.annotations[e];if(T){var C={};"string"==typeof n&&n?C[n]=c:u.isPlainObject(n)&&(C=n);var S=Object.keys(C);for(w=0;w4/3&&(j=H)}}else R&&(F&&(j<1/3?j+=q:j>2/3&&(j-=q)),j=(j-R.domain[0])/(R.domain[1]-R.domain[0]),j=R.fraction2r(j))}R&&R===D&&I&&("log"===I&&"log"!==R.type?j=Math.pow(10,j):"log"!==I&&"log"===R.type&&(j=j>0?Math.log(j)/Math.LN10:void 0)),T[E]=j}}var G={};v(T,G,k),k.annotations[e]=G;var U=f.getFromId(t,G.xref),X=f.getFromId(t,G.yref),Z={x:0,y:0},Y=+G.textangle||0,W=k._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",G.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:G})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),J=G.borderwidth,K=G.borderpad,tt=J+K,et=$.append("rect").attr("class","bg").style("stroke-width",J+"px").call(d.stroke,G.bordercolor).call(d.fill,G.bgcolor),nt=G.font,rt=$.append("text").classed("annotation",!0).attr("data-unformatted",G.text).text(G.text);t._context.editable?rt.call(p.makeEditable,$).call(b).on("edit",function(n){G.text=n,this.attr({"data-unformatted":G.text}),this.call(b);var r={};r["annotations["+e+"].text"]=G.text,U&&U.autorange&&(r[U._name+".autorange"]=!0),X&&X.autorange&&(r[X._name+".autorange"]=!0),s.relayout(t,r)}):rt.call(b),Q.attr({transform:"rotate("+Y+","+Z.x+","+Z.y+")"}).call(h.setPosition,Z.x,Z.y)}}}function o(t,e,n,r,a,o,i,l){var s=n-t,c=a-t,u=i-a,f=r-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,m=(c*f-s*d)/p;return m<0||m>1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:r,drawOne:a}},{"../../lib":120,"../../lib/setcursor":130,"../../lib/svg_text_utils":132,"../../plotly":143,"../../plots/cartesian/axes":148,"../../plots/plots":184,"../color":25,"../dragelement":46,"../drawing":48,"./annotation_defaults":16,"./defaults":20,"./draw_arrow_head":22,d3:8,"fast-isnumeric":11}],22:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../color"),i=t("../drawing"),l=t("./arrow_paths");e.exports=function(t,e,n,s){a(s)||(s=1);var c=t.node(),u=l[e||0];if(u){"string"==typeof n&&n||(n="end");var f,d,h,p,g=(i.getPx(t,"stroke-width")||1)*s,m=t.style("stroke")||o.defaultLine,v=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,b=u.backoff*g;if("line"===c.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},d={x:+t.attr("x2"),y:+t.attr("y2")},h=Math.atan2(f.y-d.y,f.x-d.x),p=h+Math.PI,b){var _=b*Math.cos(h),w=b*Math.sin(h);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(d.x+=_,d.y+=w,t.attr({x2:d.x,y2:d.y}))}}else if("path"===c.nodeName){var M=c.getTotalLength(),k="";if(y){var A=c.getPointAtLength(0),T=c.getPointAtLength(.1);h=Math.atan2(A.y-T.y,A.x-T.x),f=c.getPointAtLength(Math.min(b,M)),b&&(k="0px,"+b+"px,")}if(x){var L=c.getPointAtLength(M),C=c.getPointAtLength(M-.1);if(p=Math.atan2(L.y-C.y,L.x-C.x),d=c.getPointAtLength(Math.max(0,M-b)),b){var S=k?2*b:b;k+=M-S+"px,"+M+"px"}}else k&&(k+=M+"px");k&&t.style("stroke-dasharray",k)}var z=function(n,a){e>5&&(a=0),r.select(c.parentElement).append("path").attr({class:t.attr("class"),d:u.path,transform:"translate("+n.x+","+n.y+")rotate("+180*a/Math.PI+")scale("+g+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&z(f,h),x&&z(d,p)}}},{"../color":25,"../drawing":48,"./arrow_paths":17,d3:8,"fast-isnumeric":11}],23:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":18,"./calc_autorange":19,"./defaults":20,"./draw":21}],24:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],25:[function(t,e,n){"use strict";function r(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===r.length;if(!a&&3!==r.length)return t;for(var i=0;i=0))return t;if(3===i)r[i]>1&&(r[i]=1);else if(r[i]>=1)return t}var l=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return a?"rgba("+l+", "+r[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var n=a(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},i.combine=function(t,e){var n=a(t).toRgb();if(1===n.a)return a(t).toRgbString();var r=a(e||i.background).toRgb(),o=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},l={r:o.r*(1-n.a)+n.r*n.a,g:o.g*(1-n.a)+n.g*n.a,b:o.b*(1-n.a)+n.b*n.a};return a(l).toRgbString()},i.contrast=function(t,e,n){var r=a(t),o=r.isLight()?r.darken(n):r.lighten(e);return o.toString()},i.stroke=function(t,e){var n=a(e);t.style({stroke:i.tinyRGB(n),"stroke-opacity":n.getAlpha()})},i.fill=function(t,e){var n=a(e);t.style({fill:i.tinyRGB(n),"fill-opacity":n.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,n,a,o,l=Object.keys(t);for(e=0;el&&(o[1]-=(lt-l)/2)):n.node()&&!n.classed("js-placeholder")&&(lt=h.bBox(e.node()).height),lt){if(lt+=5,"top"===_.titleside)K.domain[1]-=lt/T.h,o[1]*=-1;else{K.domain[0]+=lt/T.h;var c=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),K.setScale()}}ot.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-K.domain[1]))+")");var f=ot.select(".cbfills").selectAll("rect.cbfill").data(z);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?C[0]:(z[e]+z[e-1])/2,e===z.length-1?C[1]:(z[e]+z[e+1])/2].map(K.c2p).map(Math.round);e!==z.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=N(t).replace("e-",""),i=a(o).toHexString();r.select(this).attr({x:Z,width:Math.max(B,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var d=ot.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){r.select(this).attr("d","M"+Z+","+(Math.round(K.c2p(t))+_.line.width/2%1)+"h"+B).call(h.lineGroupStyle,_.line.width,O(t),_.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=Z+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=K.titlefont.size,n=K._offset+K._length/2,a=T.l+(K.position||0)*T.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));M("h"+K._id+"title",{avoid:{selection:r.select(t).selectAll("g."+K._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:A.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,n){var r,a=b();r=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:K,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:ot.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;ot.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,n||{}))}function k(){var n=B+_.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(j=it.select("text"),j.node()&&!j.classed("js-placeholder")){var r,a=it.select(".h"+K._id+"title-math-group").node();r=a&&["top","bottom"].indexOf(_.titleside)!==-1?h.bBox(a).width:h.bBox(it.node()).right-Z-T.l,n=Math.max(n,r)}var o=2*_.xpad+n+_.borderwidth+_.outlinewidth/2,l=Q-$;ot.select(".cbbg").attr({x:Z-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-U,width:Math.max(o,2),height:Math.max(l+2*U,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),ot.selectAll(".cboutline").attr({x:Z,y:$+_.ypad+("top"===_.titleside?lt:0),width:Math.max(B,2),height:Math.max(l-2*_.ypad-lt,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var s=({center:.5,right:1}[_.xanchor]||0)*o;ot.attr("transform","translate("+(T.l-s)+","+T.t+")"),i.autoMargin(t,e,{x:_.x,y:_.y,l:o*({right:1,center:.5}[_.xanchor]||0),r:o*({left:1,center:.5}[_.xanchor]||0),t:l*({bottom:1,middle:.5}[_.yanchor]||0),b:l*({top:1,middle:.5}[_.yanchor]||0)})}var A=t._fullLayout,T=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var L,C=r.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],z=[],O="function"==typeof _.line.color?_.line.color:function(){return _.line.color},N="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},P=_.levels.end+_.levels.size/100,E=_.levels.size,D=1.001*C[0]-.001*C[1],R=1.001*C[1]-.001*C[0];for(L=_.levels.start;(L-P)*E<0;L+=E)L>D&&LC[0]&&L1){var at=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));et*=at*u.roundUp(rt/at,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+X,W+V-X],K.setScale();var ot=A._infolayer.selectAll("g."+e).data([0]);ot.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),ot.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var it=ot.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");K._axislayer=ot.select(".cbaxis");var lt=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var st,ct=T.l+(_.x+G)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-X))*T.h+T.t+3+.75*ut:(1-(W+X))*T.h+T.t-3-.25*ut,M(K._id+"title",{attributes:{x:ct,y:st,"text-anchor":"start"}})}var ft=u.syncOrAsync([i.previousPromises,w,i.previousPromises,k],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var dt,ht,pt;c.init({element:ot.node(),prepFn:function(){dt=ot.attr("transform"),d(ot)},moveFn:function(t,e){ot.attr("transform",dt+" translate("+t+","+e+")"),ht=c.align(Y+t/T.w,q,0,1,_.xanchor),pt=c.align(W-e/T.h,V,0,1,_.yanchor);var n=c.getCursor(ht,pt,_.xanchor,_.yanchor);d(ot,n)},doneFn:function(e){d(ot),e&&void 0!==ht&&void 0!==pt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":pt},b().index)}})}return ft}function b(){var n,r,a=e.substr(2);for(n=0;n=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":120,"./flip_scale":36,"./scales":43}],32:[function(t,e,n){"use strict";var r=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},r.colorscale,{}),cauto:a({},r.zauto,{}),cmax:a({},r.zmax,{}),cmin:a({},r.zmin,{}),autocolorscale:a({},r.autocolorscale,{}),reversescale:a({},r.reversescale,{})}}},{"../../lib/extend":115,"./attributes":30,"./scales.js":43}],33:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":43}],34:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,n,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,m=p[d+"min"],v=p[d+"max"],y=p.colorscale,x=r(m)&&r(v)&&m=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],37:[function(t,e,n){"use strict";var r=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=a),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":33,"./is_valid_scale_array":41,"./scales":43}],38:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?a.nestedProperty(t,e).get()||{}:t,i=n.color,l=!1;if(Array.isArray(i))for(var s=0;s4/3-l?i:l}},{}],45:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":120}],46:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=r},{"../../lib":120,"../../plotly":143,"../../plots/cartesian/constants":153,"./align":44,"./cursor":45,"./unhover":47}],47:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":114}],48:[function(t,e,n){"use strict";function r(t,e,n,r,a,o,i){if(l.traceIs(n,"symbols")){var c=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(n)?c(t.ms):(o.size||6)/2,t.mrc=e;var r=g.symbolNumber(t.mx||o.symbol)||0,a=r%100;return t.om=r%200>=100,g.symbolFuncs[a](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=r(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,n,r){var a=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(s.fill,r)},g.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},g.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},g.setRect=function(t,e,n,r,a){t.call(g.setPosition,e,n).call(g.setSize,r,a)},g.translatePoint=function(t,e,n,r){var a=t.xp||n.c2p(t.x),o=t.yp||r.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,n,r){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,n,r)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,n){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},g.singleLineStyle=function(t,e,n,r,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=n||o.width||0,l=a||o.dash||"";s.stroke(e,r||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=r||a.dash||"";o.select(this).call(s.stroke,n||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=o.select(this);try{n.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),n.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,n){var a=n.marker,o=a.line,i=g.tryColorscale(a,""),l=g.tryColorscale(a,"line");r(t,e,n,i,l,a,o)},g.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=g.tryColorscale(n,""),a=g.tryColorscale(n,"line");t.each(function(t){g.singlePointStyle(t,o.select(this),e,r,a)})}},g.tryColorscale=function(t,e){var n=e?u.nestedProperty(t,e).get():t,r=n.colorscale,a=n.color;return r&&Array.isArray(a)?c.makeColorScaleFunc(c.extractScale(r,n.cmin,n.cmax)):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var n=o.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,n.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(f.convertToTspans);var d=o.select(this.parentNode),h=n.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,m=x[s]*u,v=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+m+","+v+")"),p>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],o=[];for(n=1;n=A&&(o.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=o.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":107,"../../lib":120,"../../lib/svg_text_utils":132,"../../registry":192,"../../traces/scatter/make_bubble_size_func":224,"../../traces/scatter/subtypes":229,"../color":25,"../colorscale":39,"./symbol_defs":49,d3:8,"fast-isnumeric":11}],49:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2); +return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:8}],50:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],51:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&["linear","log"].indexOf(n.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var m=g.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(n.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=r(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");l=!m.size(),l?m=e.append("path").classed("yerror",!0):u&&(m=m.transition().duration(n.duration).ease(n.easing)),m.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var v=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-v)+"v"+2*v+"m0,-"+v+"H"+i.xs,i.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":229,d3:8,"fast-isnumeric":11}],56:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":25,d3:8}],57:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":153}],58:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,l,n,r)}var i=r("source"),s=r("visible",!!i);if(!s)return e;r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var c={_fullLayout:n},u=["x","y"],f=0;f<2;f++)o.coerceRef(t,e,c,u[f],"paper");return e}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("../../plots/array_container_defaults"),l=t("./attributes"),s="images";e.exports=function(t,e){var n={name:s,handleItemDefaults:r};i(t,e,n)}},{"../../lib":120,"../../plots/array_container_defaults":145,"../../plots/cartesian/axes":148,"./attributes":57}],59:[function(t,e,n){"use strict";var r=t("d3"),a=t("../drawing"),o=t("../../plots/cartesian/axes"),i=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var n=r.select(this);if(!this.img||this.img.src!==e.source){n.attr("xmlns",i.svg);var a=new Promise(function(t){function r(){n.remove(),t()}var a=new Image;this.img=a,a.setAttribute("crossOrigin","anonymous"),a.onerror=r,a.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var r=t.toDataURL("image/png");n.attr("xlink:href",r)},n.on("error",r),n.on("load",t),a.src=e.source}.bind(this));t._promises.push(a)}}function n(e){var n=r.select(this),i=o.getFromId(t,e.xref),s=o.getFromId(t,e.yref),c=l._size,u=i?Math.abs(i.l2p(e.sizex)-i.l2p(0)):e.sizex*c.w,f=s?Math.abs(s.l2p(e.sizey)-s.l2p(0)):e.sizey*c.h,d=u*h.x[e.xanchor].offset,p=f*h.y[e.yanchor].offset,g=h.x[e.xanchor].sizing+h.y[e.yanchor].sizing,m=(i?i.r2p(e.x)+i._offset:e.x*c.w+c.l)+d,v=(s?s.r2p(e.y)+s._offset:c.h-e.y*c.h+c.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}n.attr({x:m,y:v,width:u,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=i?i._id:"",x=s?s._id:"",b=y+x;b&&n.call(a.setClipUrl,"clip"+l._uid+b)}for(var l=t._fullLayout,s=[],c=[],u=[],f=0;f=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],62:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":115,"../../plots/font_attributes":168,"../color/attributes":24}],63:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],64:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":120,"../../plots/layout_attributes":182,"../../registry":192,"./attributes":62,"./helpers":67}],65:[function(t,e,n){"use strict";function r(t,e){function n(n){v.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,v=Math.max(e.height,v)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,F,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,_=n.showlegend&&x(t.calcdata,v),M=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=k.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=k.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=k.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var S=L.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var z=S.selectAll("g.traces").data(f.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==k.enter().size();O&&(i(t,S,z),l(t));var N=0,P=n.width,E=0,D=n.height;i(t,S,z),v.height>D?s(t):l(t);var R=n._size,j=R.l+R.w*v.x,I=R.t+R.h*(1-v.y);w.isRightAnchor(v)?j-=v.width:w.isCenterAnchor(v)&&(j-=v.width/2),w.isBottomAnchor(v)?I-=v.height:w.isMiddleAnchor(v)&&(I-=v.height/2);var F=v.width,B=R.w;F>B?(j=R.l,F=B):(j+F>P&&(j=P-F),jH?(I=R.t,q=H):(I+q>D&&(I=D-q),In[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":120,"../../registry":192,"../../traces/pie/style_one":207,"../../traces/scatter/subtypes":229,"../color":25,"../drawing":48,d3:8}],70:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||v||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(m,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":120,"../color":25,"./attributes":74,"./button_attributes":75,"./constants":76}],78:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},a=S.line.width?S.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",S.opacity).call(_.stroke,a).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);z&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&f(t,o,S,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof n&&n?s[n]=r:x.isPlainObject(n)&&(s=n);var c=Object.keys(s);for(o=0;oX&&r>Z&&!t.shiftKey?M.getCursor(a/n,1-o/r):"move";k(e,i),U=i.split("-")[0]}function o(e){F=b.getFromId(t,n.xref),B=b.getFromId(t,n.yref),q=T.getDataToPixel(t,F),H=T.getDataToPixel(t,B,!0),V=T.getPixelToData(t,F),G=T.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(j=n.path,I=o+".path"):(u=q(n.x0),f=H(n.y0),d=q(n.x1),h=H(n.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uZ&&(c[S]=n[P]=G(l),c[z]=n[E]=G(s)),f-u>X&&(c[O]=n[D]=V(u),c[N]=n[R]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,v,x,_,w,A,L,C,S,z,O,N,P,E,D,R,j,I,F,B,q,H,V,G,U,X=10,Z=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();M.init(Y)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),M=t("../dragelement"),k=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults");e.exports={ +draw:r,drawOne:a}},{"../../lib":120,"../../lib/setcursor":130,"../../plotly":143,"../../plots/cartesian/axes":148,"../color":25,"../dragelement":46,"../drawing":48,"./constants":88,"./defaults":89,"./helpers":91,"./shape_defaults":93,"fast-isnumeric":11}],91:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],92:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":86,"./calc_autorange":87,"./defaults":89,"./draw":90}],93:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],m={_fullLayout:n},v=a.coerceRef(t,e,m,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==v?(y=a.getFromId(m,v),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=r.identity;var M=g+"0",k=g+"1",A=t[M],T=t[k];t[M]=x(t[M],!0),t[k]=x(t[k],!0),a.coercePosition(e,m,c,v,M,_),a.coercePosition(e,m,c,v,k,w),e[M]=b(e[M]),e[k]=b(e[k]),t[M]=A,t[k]=T}}return"path"===d?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":120,"../../plots/cartesian/axes":148,"./attributes":86,"./helpers":91}],94:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":115,"../../plots/animation_attributes":144,"../../plots/font_attributes":168,"../../plots/pad_attributes":183,"./constants":95}],95:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],96:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+S.railTouchRectClass).data([0]);r.enter().append("rect").classed(S.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,S.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),k.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+S.railRectClass).data([0]);n.enter().append("rect").classed(S.railRectClass,!0);var r=e.inputAreaLength-2*S.railInset;n.attr({width:r,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(n,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+S.groupClassName).data(n,a);s.enter().append("g").classed(S.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,S=O,M._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,M=t._fullLayout,k=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(S).attr("class",e),z.attr({"data-unformatted":S}).call(f);var O="Click to enter "+y+" title";t._context.editable?(S||p(),z.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",C)}},{"../../lib":120,"../../lib/svg_text_utils":132,"../../plotly":143,"../../plots/plots":184,"../color":25,"../drawing":48,d3:8,"fast-isnumeric":11}],100:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":115,"../../plots/font_attributes":168,"../../plots/pad_attributes":183,"../color/attributes":24}],101:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],102:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],107:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],108:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":23,"./components/images":60,"./components/legend":68,"./components/rangeselector":80,"./components/rangeslider":85,"./components/shapes":92,"./components/sliders":98,"./components/updatemenus":104,"./fonts/mathjax_config":109,"./lib/queue":128,"./plot_api/plot_schema":137,"./plot_api/register":138,"./plot_api/set_plot_config":139,"./plot_api/to_image":141,"./plot_api/validate":142,"./plotly":143,"./snapshot":197,"./snapshot/download":194,"./traces/scatter":219,d3:8,"es6-promise":9}],109:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],110:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){Array.isArray(t)&&(e[n]=t[r])}},{}],111:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":105,"fast-isnumeric":11}],112:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n); +}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(o(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,r,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var m=(new Date).getFullYear();e=((Number(c[0])-m+70)%100+200)%100+m-70}if(!o(e))return s;var v=new Date(0,0,1);if(v.setFullYear(u?e:-e),c.length>1){if(r=Number(c[1])-1,c[1].length>2||!(r>=0&&r<=11))return s;if(v.setMonth(r),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(v.setDate(a),v.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(v.setHours(i),v.getHours()!==i)return s;if(c.length>1)return a=v.getTime(),r=Number(c[1]),2===c[1].length&&r>=0&&r<=59?(a+=f*r,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return v.getTime()},h=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==s};var g=90*c,m=3*u,v=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var n=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(n),i=e0&&(r.push(a),a=[])}return r.push(a),r},n.makeLine=function(t,e){var n={};return n=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(n.trace=e),n},n.makePolygon=function(t,e){var n={};if(1===t.length)n={type:"Polygon",coordinates:t};else{for(var r=new Array(t.length),a=0;an?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"./clean_number":111,"./coerce":112,"./dates":113,"./extend":115,"./filter_unique":116,"./filter_visible":117,"./is_array":121,"./is_plain_object":122,"./loggers":123,"./matrix":124,"./nested_property":125,"./notifier":126,"./search":129,"./stats":131,d3:8}],121:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],122:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],123:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],i=!1,d(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");lo||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],s=t[1];if(no||sl)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],m=r[0][1],v=0;for(c=1;cMath.max(u,g)||s>Math.max(f,m)))if(su||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":124}],128:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;f90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":11}],132:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,m.indexOf(u.protocol)===-1?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||r(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{ +regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":106,"../constants/xmlns_namespaces":107,"../lib":120,d3:8}],133:[function(t,e,n){"use strict";var r=e.exports={},a=t("../plots/geo/constants").locationmodeToLayer,o=t("topojson-client").feature;r.getTopojsonName=function(t){return[t.scope.replace(/ /g,"-"),"_",t.resolution.toString(),"m"].join("")},r.getTopojsonPath=function(t,e){return t+e+".json"},r.getTopojsonFeatures=function(t,e){var n=a[t.locationmode],r=e.objects[n];return o(e,r).features}},{"../plots/geo/constants":170,"topojson-client":15}],134:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function a(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var a=f.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=u.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&l(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sO.range[0]?[1,2]:[2,1]);else{var N=O.range[0],P=O.range[1];"log"===b?(N<=0&&P<=0&&n(L+".autorange",!0),N<=0?N=P/1e6:P<=0&&(P=N/1e6),n(L+".range[0]",Math.log(N)/Math.LN10),n(L+".range[1]",Math.log(P)/Math.LN10)):(n(L+".range[0]",Math.pow(10,N)),n(L+".range[1]",Math.pow(10,P)))}else n(L+".autorange",!0)}if("reverse"===A)C.range?C.range.reverse():(n(L+".autorange",!0),C.range=[1,0]),S.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var E=v.parts[1],D=v.parts[0],R=o[D]||[],j=R[E]||{};2===v.parts.length&&(null===b&&(e[m]="remove"),"add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?E===-1?(g[D]=R,delete g[m]):g[m]=j:x.log("???",e)),!r(j,"x")&&!r(j,"y")||x.containsAny(m,["color","opacity","align","dash"])||(h.docalc=!0);var I=w.getComponentMethod(D,"drawOne");I(t,E,v.parts.slice(2).join("."),e[m]),delete e[m]}else if(M.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])z.manageArrayContainers(v,b,g),h.doplot=!0;else{var F=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?h.doplot=!0:0===v.parts[0].indexOf("geo")?h.doplot=!0:0===v.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===m?h.doplot=!0:!i._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?h.docalc=!0:v.parts[0].indexOf("legend")!==-1?h.dolegend=!0:m.indexOf("title")!==-1?h.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(F,["tick","exponent","grid","zeroline"])?h.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:v.parts.length>1&&F.indexOf("line")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&"mirror"===F?h.doticks=h.dolayoutstyle=!0:"margin.pad"===m?h.doticks=h.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(h.doplot=!0):h.doplot=!0,v.set(b)}}}var B=t._fullLayout.width,q=t._fullLayout.height;M.supplyDefaults(t),t.layout.autosize&&M.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==q;return H&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];m.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(C.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var o=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=o.append("g").classed("imagelayer",!0),n._shapeUpperLayer=o.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),M=t("../plots/plots"),k=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),C=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),z=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,n,r){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=N._basePlotModules,n=0;n=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=z.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),n=M.supplyAnimationDefaults(n);var l=n.transition,s=n.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){if(0!==i._frameQueue.length){for(;i._frameQueue.length;){var e=i._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var l=0;li._timeToNext&&h()};e()}function g(t){return Array.isArray(l)?y>=l.length?t.transitionOpts=l[y]:t.transitionOpts=l[0]:t.transitionOpts=l,y++,t}var m,v,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),k=!_&&!w&&x.isPlainObject(e);if(k)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&LL)&&C.push(v);b=C}}b.length>0?f(b):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,n){if(t=z.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,a,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(r=e.length-1;r>=0;r--)u.push({frame:M.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:c+r});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(a=u[r].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=M.modifyFrames,s=M.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),M.modifyFrames(t,o)},y.purge=function(t){t=z.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return M.cleanPlot([],{},n,e),M.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":48,"../components/errorbars":54,"../constants/xmlns_namespaces":107,"../lib":120,"../lib/events":114,"../lib/queue":128,"../lib/svg_text_utils":132,"../plotly":143,"../plots/cartesian/graph_interact":155,"../plots/plots":184,"../plots/polar":187,"../registry":192,"./helpers":134,"./subroutines":140,d3:8,"fast-isnumeric":11}],136:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],137:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:y},n={}):(e=d.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,_(r,p),_(r,e.attributes),n.attributes&&_(r,n.attributes),r.type=t;var a={meta:e.meta||{},attributes:i(r)};if(e.layoutAttributes){var o={};_(o,e.layoutAttributes),a.layoutAttributes=i(o)}return a}function a(){var t={};return _(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var n=d.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)u(t,n,"xaxis"),u(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;u(t,n,r)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.layoutAttributes&&(Array.isArray(n.layoutNodes)?n.layoutNodes.forEach(function(e){f(t,n,e+n.name)}):f(t,n,n.name))}),{layoutAttributes:i(t)}}function o(t){var e=d.transformsRegistry[t];return{attributes:i(e.attributes)}}function i(t){return l(t),s(t),t}function l(t){function e(t){return{valType:"string"}}function r(t,r,a){n.isValObject(t)?"data_array"===t.valType?(t.role="data",a[r+"src"]=e(r)):t.arrayOk===!0&&(a[r+"src"]=e(r)):h.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function s(t){function e(t,e,n){if(t){var r=t[M];r&&(delete t[M],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function c(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function u(t,e,n){var r=h.nestedProperty(t,n),a=_({},e.layoutAttributes);a[w]=!0,r.set(a)}function f(t,e,n){var r=h.nestedProperty(t,n),a=_(r.get()||{},e.layoutAttributes);r.set(a)}var d=t("../registry"),h=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=h.extendFlat,_=h.extendDeep,w="_isSubplotObj",M="_isLinkedToArray",k="_deprecated",A=[w,M,k];n.IS_SUBPLOT_OBJ=w,n.IS_LINKED_TO_ARRAY=M,n.DEPRECATED=k,n.UNDERSCORE_ATTRS=A,n.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:h.valObjects,metaKeys:A.concat.role},traces:t,layout:a(),transforms:e,frames:i(m),animation:i(v)}},n.crawl=function(t,e,r){var a=r||0;Object.keys(t).forEach(function(r){var o=t[r];A.indexOf(r)===-1&&(e(o,r,t,a),n.isValObject(o)||h.isPlainObject(o)&&n.crawl(o,e,a+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,i,l){o=o.slice(0,l).concat([n]);var s="data_array"===e.valType||e.arrayOk===!0;if(s){var c=r(o),u=h.nestedProperty(t,c).get();Array.isArray(u)&&a.push(c)}}function r(t){return t.join(".")}var a=[],o=[];if(n.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":120,"../plotly":143,"../snapshot/cloneplot":193,"../snapshot/helpers":196,"../snapshot/svgtoimg":198,"../snapshot/tosvg":200,"fast-isnumeric":11}],142:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=n.length,v=0;vu&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=z&&a<=10||e>=15*z)t._tickround="d";else if(e>=N&&a<=16||e>=O)t._tickround="M";else if(e>=P&&a<=19||e>=N)t._tickround="S";else{var o=_.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var n=t.match(Y),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);n&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(r&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(n||(a="
"+H(u)),o=G(u)):(n||(a="
"+U(u)),o=X(u),"M"!==s?(o+=Z(u),"S"!==s&&(o+=d(y.round(v(l/1e3,1),4),t,"none",n).substr(1))):"d"===c&&(o=G(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=t<0,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},E.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var g=r-1,m=r+1;n="tozero"===t.rangemode?r<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n.map(t.l2r||Number)},E.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=E.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},E.saveRangeInitial=function(t,e){for(var n=E.list(t,"",!0),r=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),M=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},E.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},E.autoTicks(f,l);var d,h=E.tickIncrement(E.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=E.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=E.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fC?(e/=C,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,R)):r>S?(e/=S,t.dtick="M"+a(e,1,j)):r>z?(t.dtick=a(e,z,F),t.tick0="2000-01-02"):r>O?t.dtick=a(e,O,j):r>N?t.dtick=a(e,N,I):r>P?t.dtick=a(e,P,I):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,R))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,R)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,R));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},E.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?q:B,s=t+.01*r,c=_.roundUp(v(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},E.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]o:f1&&e2*r}function o(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("../../constants/numerical").BADNUM;e.exports=function(t){return a(t)?"date":o(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":105,"../../lib":120,"fast-isnumeric":11}],150:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var l=i(e,n,r);if(l){if("histogram"===l.type&&r==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,r)){for(var s,u=a(l),f=[],d=0;d0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],153:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],154:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?r:"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,n,l,_,w,M,k){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+mt+")").attr("d",ct+"Z"),ht=pt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+mt+")").attr("d","M0,0Z"),C()}function C(){pt.selectAll(".select-outline").remove()}function S(e,n){if(t._transitioningWithDuration)return!1;var r=Math.max(0,Math.min(V,e+ot)),a=Math.max(0,Math.min(G,n+it)),o=Math.abs(r-ot),i=Math.abs(a-it),l=Math.floor(Math.min(i,o,X)/2);lt.l=Math.min(ot,r),lt.r=Math.max(ot,r),lt.t=Math.min(it,a),lt.b=Math.max(it,a),!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function z(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),b=!1)))}function N(e,n){var a=1===(M+k).length;if(e)j();else if(2!==n||a){if(1===n&&a){var o=M?H[0]:q[0],i="s"===M||"w"===k?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",f="middle";if(o.fixedrange)return;M?(f="n"===M?"top":"bottom","right"===o.side&&(u="right")):"e"===k&&(u="right"),nt.call(d.makeEditable,null,{immediate:!0,background:F.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var n=o.d2r(e);void 0!==n&&c.relayout(t,l,n)})}}else R()}function P(e){function n(t,e,n){function r(e){return t.l2r(o+(e-o)*n)}if(!t.fixedrange){var a=t.range.map(t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(r)}}if(t._context.scrollZoom||F._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(T(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(yt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=vt[0]+vt[2]*s,u=(l.bottom-e.clientY)/l.height,d=vt[1]+vt[3]*(1-u);if(k){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,n){for(var r,o,i=1-e,l=0;l0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rY.width||Z<0||Z>Y.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:k[0]._length/2,Z="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?r(o,e.xval):a(k,X),N="yval"in e?r(o,e.yval):a(A,Z),!g(O[0])||!g(N[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(E=0;E1||R.hoverinfo.indexOf("name")!==-1?R.name:void 0,index:!1,distance:Math.min(W,M.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[j]&&(H.subplot=i[j]._subplot),V=G.length,"array"===F){var Q=e[E];"pointNumber"in Q?(H.index=Q.pointNumber,F="closest"):(F="","xval"in Q&&(B=Q.xval,F="x"),"yval"in Q&&(q=Q.yval,F=F?"closest":"y"))}else B=O[I],q=N[I];if(R._module&&R._module.hoverPoints){var $=R._module.hoverPoints(H,B,q,F);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&G.push(s(J,z))}else m.log("Unrecognized trace type in hover:",R);"closest"===z&&G.length>V&&(G.splice(0,V),W=G[0].distance)}if(0===G.length)return _.unhoverRaw(t,e);var tt="y"===z&&U.length>1;G.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),nt={hovermode:z,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},rt=c(G,nt);u(G,tt?"xa":"ya"),f(rt,tt);var at=t._hoverdata,ot=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),m=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),m=d.node().getBoundingClientRect().width+2*P):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var v,M,T=f.node().getBoundingClientRect(),C=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),E=T.width+N+P+m;t.ty0=_-T.top,t.bx=T.width+2*P,t.by=T.height+2*P,t.anchor="start",t.txwidth=T.width,t.tx2width=m,t.offset=0,o?(t.pos=C,v=S+O/2+E<=k,M=S-O/2-E>=0,"top"!==t.idealAlign&&v||!M?v?(S+=O/2,t.anchor="start"):t.anchor="middle":(S-=O/2,t.anchor="end")):(t.pos=S,v=C+z/2+E<=w,M=C-z/2-E>=0,"left"!==t.idealAlign&&v||!M?v?(C+=z/2,t.anchor="start"):t.anchor="middle":(C-=z/2,t.anchor="end")),f.attr("text-anchor",t.anchor),m&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+C+","+S+")"+(o?"rotate("+L+")":""))}),S}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?S:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var m=f[i];for(l=m.length-1;l>=0;l--){var v=m[l],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(N+P),l=i+o*(t.txwidth+P),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-O,s=t.offset*z),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*N+s)+","+(N+c)+"v"+(t.by/2-N)+"h"+r*t.bx+"v-"+t.by+"H"+(r*N+s)+"V"+(c-N)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*P+s,c+t.ty0-t.by/2+P),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),k=t("./dragbox"),A=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,n){function r(n,r){return m.coerce(t,e,A,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=T.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},T.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+M.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},T.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},T.getClosest=function(t,e,n){if(n.index!==!1)n.index>=0&&n.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":120,"fast-isnumeric":11}],161:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-m.left,b=n-m.top,_=x,w=b,M="M"+x+","+b,k=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),C=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",M+"Z");var z,O,N,P,E,D=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),R=[],j=a.gd,I=[];for(z=0;z0)return Math.log(e)/Math.LN10;if(e<=0&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*f*Math.abs(r-a))}return s}function n(t){return Math.pow(10,t)}function i(t){return a(t)?(t=Number(t),t<-l||t>l?s:a(t)?Number(t):s):s}var f=10;t.c2l="log"===t.type?e:i,t.l2c="log"===t.type?n:i,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var n,r,i=t[e],s=(t._id||"x").charAt(0);if(r="date"===t.type?c.DFLTRANGEDATE:"y"===s?c.DFLTRANGEY:c.DFLTRANGEX,r=r.slice(),!i||2!==i.length)return void(t[e]=r);for("date"===t.type&&(i[0]=o.cleanDate(i[0]),i[1]=o.cleanDate(i[1])),n=0;n<2;n++)if("date"===t.type){if(!o.isDateTime(i[n])){t[e]=r;break}if(i[n]o.MAX_MS&&(i[n]=o.MAX_MS),t.r2l(i[0])===t.r2l(i[1])){var u=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(u-1e3),i[1]=t.l2r(u+1e3);break}}else{if(!a(i[n])){if(!a(i[1-n])){t[e]=r;break}i[n]=i[1-n]*(n?10:.1)}if(i[n]<-l?i[n]=-l:i[n]>l&&(i[n]=l),i[0]===i[1]){var f=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=f,i[1]+=f}}},t.fraction2r=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return t.l2r(n+e*(r-n))},t.r2fraction=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return(t.r2l(e)-n)/(r-n)},t.setScale=function(e){var n=t._gd._fullLayout._size,r=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var a=u.getFromId(t._gd,t.overlaying);t.domain=a.domain}var i=e&&t._r?"_r":"range";t.cleanRange(i);var l=t.r2l(t[i][0]),s=t.r2l(t[i][1]);if("y"===r?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s):(t._offset=n.l+t.domain[0]*n.w, +t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):s},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,n){return t.l2p(t.r2l(e,n))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=i,t.d2c=o.cleanNumber,"log"===t.type?(t.d2l=function(e,n){return t.c2l(t.d2c(e),n)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=o.cleanNumber,t.d2r=o.cleanNumber,t.r2d=i),t.r2l=i,t.l2r=i):"date"===t.type?(t.c2d=o.ms2DateTime,t.d2c=function(t){var e=o.dateTime2ms(t);if(e===s){if(!a(t))return s;e=Number(t)}return o.constrain(e,o.MIN_MS,o.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=o.identity,t.r2d=o.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var n=t._categories.indexOf(e);return n===-1?s:n},t.d2l=t.d2c,t.r2l=i,t.l2r=i,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;o0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var f=u.charAt(0),d=u.substr(1);d=r(d)?Number(d):0,(d<=0||!("date"===i&&"M"===f&&d===Math.round(d)||"log"===i&&"L"===f||"log"===i&&"D"===f&&(1===d||2===d)))&&(e.dtick=c)}var h="date"===i?"2000-01-01":0,p=n("tick0",h);"date"===i?e.tick0=a.cleanDate(p,h):r(p)&&"D1"!==u&&"D2"!==u?e.tick0=Number(p):e.tick0=h}else{var g=n("tickvals");void 0===g?e.tickmode="auto":n("ticktext")}}},{"../../constants/numerical":105,"../../lib":120,"fast-isnumeric":11}],166:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../lib"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,n,c){function u(t){var e,n,r,a,o,i={};for(e in t)if(n=e.split("."),r=n[0].match(s)){var l=r[1],c=l+"axis";if(a=y[c],o={},Array.isArray(t[e])?o.to=t[e].slice(0):Array.isArray(t[e].range)&&(o.to=t[e].range.slice(0)),!o.to)continue;o.axisName=c,o.length=a._length,x.push(l),i[l]=o}return i}function f(t,e,n){var r,a,o,i=t._plots,l=[];for(r in i){var s=i[r];if(l.indexOf(s)===-1){var c=s.xaxis._id,u=s.yaxis._id,f=s.xaxis.range,d=s.yaxis.range;s.xaxis._r=s.xaxis.range.slice(),s.yaxis._r=s.yaxis.range.slice(),a=n[c]?n[c].to:f,o=n[u]?n[u].to:d,f[0]===a[0]&&f[1]===a[1]&&d[0]===o[0]&&d[1]===o[1]||e.indexOf(c)===-1&&e.indexOf(u)===-1||l.push(s)}}return l}function d(e,n){function r(e,n){for(a=0;an.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var M;c&&(M=c());var k,A,T,L=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),k=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":120,"../../plotly":143,"../../registry":192,"./axes":148,d3:8}],167:[function(t,e,n){"use strict";function r(t,e,n){var r,a,o,i=!1;if("data"===e.type)r=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;r=t._fullLayout}return a=c.nestedProperty(r,e.prop).get(),o=n[e.type]=n[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var n=[],r=e[0],a={};if("string"==typeof r)a[r]=e[1];else{if(!c.isPlainObject(r))return n;a=r}return l(a,function(t,e,r){n.push({type:"layout",prop:t,value:r})},"",0),n}function i(t,e){var n,r,a,o,i=[];if(r=e[0],a=e[1],n=e[2],o={},"string"==typeof r)o[r]=a;else{if(!c.isPlainObject(r))return i;o=r,void 0===n&&(n=a)}return void 0===n&&(n=null),l(o,function(e,r,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);n&&(l=Math.min(l,n.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,r+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");n.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=n.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){r(t,s,i.cache),i.check=function(){if(l){var e=r(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;fa},M.render=function(){function t(t){var e=n.projection(t.lonlat);return e?"translate("+e[0]+","+e[1]+")":null}function e(t){return n.isLonLatOverEdges(t.lonlat)?"0":"1.0"}var n=this,r=n.framework,a=r.select("g.choroplethlayer"),o=r.select("g.scattergeolayer"),i=n.path;r.selectAll("path.basepath").attr("d",i),r.selectAll("path.graticulepath").attr("d",i),a.selectAll("path.choroplethlocation").attr("d",i),a.selectAll("path.basepath").attr("d",i),o.selectAll("path.js-line").attr("d",i),null!==n.clipAngle?(o.selectAll("path.point").style("opacity",e).attr("transform",t),o.selectAll("text").style("opacity",e).attr("transform",t)):(o.selectAll("path.point").attr("transform",t),o.selectAll("text").attr("transform",t))}},{"../../components/color":25,"../../components/drawing":48,"../../constants/xmlns_namespaces":107,"../../lib/topojson_utils":133,"../../plots/cartesian/axes":148,"../../plots/cartesian/graph_interact":155,"./constants":170,"./projections":178,"./set_scale":179,"./zoom":180,"./zoom_reset":181,d3:8,"topojson-client":15}],172:[function(t,e,n){"use strict";function r(t,e){for(var n=[],r=0;rr^h>r&&n<(d-c)*(r-u)/(h-u)+c&&(a=!a)}return a}function i(t){return t?t/Math.sin(t):1}function l(t){return t>1?N:t<-1?-N:Math.asin(t)}function s(t){return t>1?0:t<-1?O:Math.acos(t)}function c(t,e){var n=(2+N)*Math.sin(e);e/=2;for(var r=0,a=1/0;r<10&&Math.abs(a)>S;r++){var o=Math.cos(e);e-=a=(e+Math.sin(e)*(o+2)-n)/(2*o*(1+o))}return[2/Math.sqrt(O*(4+O))*t*(1+Math.cos(e)),2*Math.sqrt(O/(4+O))*Math.sin(e)]}function u(t,e){function n(n,r){var a=j(n/e,r);return a[0]*=t,a}return arguments.length<2&&(e=t),1===e?j:e===1/0?d:(n.invert=function(n,r){var a=j.invert(n/t,r);return a[0]*=e,a},n)}function f(){var t=2,e=R(u),n=e(t);return n.coefficient=function(n){return arguments.length?e(t=+n):t},n}function d(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function h(t,e){return[3*t/(2*O)*Math.sqrt(O*O/3-e*e),e]}function p(t,e){return[t,1.25*Math.log(Math.tan(O/4+.4*e))]}function g(t){return function(e){var n,r=t*Math.sin(e),a=30;do e-=n=(e+Math.sin(e)-r)/(1+Math.cos(e));while(Math.abs(n)>S&&--a>0);return e/2}}function m(t,e,n){function r(n,r){return[t*n*Math.cos(r=a(r)),e*Math.sin(r)]}var a=g(n);return r.invert=function(r,a){var o=l(a/e);return[r/(t*Math.cos(o)),l((2*o+Math.sin(2*o))/n)]},r}function v(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),e*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}function y(t,e){var n,r=Math.min(18,36*Math.abs(e)/O),a=Math.floor(r),o=r-a,i=(n=F[a])[0],l=n[1],s=(n=F[++a])[0],c=n[1],u=(n=F[Math.min(19,++a)])[0],f=n[1];return[t*(s+o*(u-i)/2+o*o*(u-2*s+i)/2),(e>0?N:-N)*(c+o*(f-l)/2+o*o*(f-2*c+l)/2)]}function x(t,e){return[t*Math.cos(e),e]}function b(t,e){var n=Math.cos(e),r=i(s(n*Math.cos(t/=2)));return[2*n*Math.sin(t)*r,Math.sin(e)*r]}function _(t,e){var n=b(t,e);return[(n[0]+t/N)/2,(n[1]+e)/2]}t.geo.project=function(t,e){var r=e.stream;if(!r)throw new Error("not yet supported");return(t&&w.hasOwnProperty(t.type)?w[t.type]:n)(t,r)};var w={Feature:e,FeatureCollection:function(t,n){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,n)})}}},M=[],k=[],A={point:function(t,e){M.push([t,e])},result:function(){var t=M.length?M.length<2?{type:"Point",coordinates:M[0]}:{type:"MultiPoint",coordinates:M}:null;return M=[],t}},T={lineStart:r,point:function(t,e){M.push([t,e])},lineEnd:function(){M.length&&(k.push(M),M=[])},result:function(){var t=k.length?k.length<2?{type:"LineString",coordinates:k[0]}:{type:"MultiLineString",coordinates:k}:null;return k=[],t}},L={polygonStart:r,lineStart:r,point:function(t,e){M.push([t,e])},lineEnd:function(){var t=M.length;if(t){do M.push(M[0].slice());while(++t<4);k.push(M),M=[]}},polygonEnd:r,result:function(){if(!k.length)return null;var t=[],e=[];return k.forEach(function(n){a(n)?t.push([n]):e.push(n)}),e.forEach(function(e){var n=e[0];t.some(function(t){if(o(t[0],n))return t.push(e),!0})||t.push([e])}),k=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},C={Point:A,MultiPoint:A,LineString:T,MultiLineString:T,Polygon:L,MultiPolygon:L,Sphere:L},S=1e-6,z=S*S,O=Math.PI,N=O/2,P=(Math.sqrt(O),O/180),E=180/O,D=t.geo.projection,R=t.geo.projectionMutator;t.geo.interrupt=function(e){function n(t,n){for(var r=n<0?-1:1,a=s[+(n<0)],o=0,i=a.length-1;oa[o][2][0];++o);var l=e(t-a[o][1][0],n);return l[0]+=e(a[o][1][0],r*n>r*a[o][0][1]?a[o][0][1]:n)[0],l}function r(){l=s.map(function(t){return t.map(function(t){var n,r=e(t[0][0],t[0][1])[0],a=e(t[2][0],t[2][1])[0],o=e(t[1][0],t[0][1])[1],i=e(t[1][0],t[1][1])[1];return o>i&&(n=o,o=i,i=n),[[r,o],[a,i]]})})}function a(){for(var e=1e-6,n=[],r=0,a=s[0].length;r=0;--r){var i=s[1][r],l=180*i[0][0]/O,c=180*i[0][1]/O,u=180*i[1][1]/O,f=180*i[2][0]/O,d=180*i[2][1]/O;n.push(o([[f-e,d-e],[f-e,u+e],[l+e,u+e],[l+e,c-e]],30))}return{type:"Polygon",coordinates:[t.merge(n)]}}function o(t,e){for(var n,r,a,o=-1,i=t.length,l=t[0],s=[];++oS&&--a>0);return[t/(.8707+(o=r*r)*(-.131979+o*(-.013791+o*o*o*(.003971-.001529*o)))),r]},(t.geo.naturalEarth=function(){return D(v)}).raw=v;var F=[[.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]];F.forEach(function(t){t[1]*=1.0144}),y.invert=function(t,e){var n=e/N,r=90*n,a=Math.min(18,Math.abs(r/5)),o=Math.max(0,Math.floor(a));do{var i=F[o][1],l=F[o+1][1],s=F[Math.min(19,o+2)][1],c=s-i,u=s-2*l+i,f=2*(Math.abs(n)-l)/c,d=u/c,h=f*(1-d*f*(1-2*d*f));if(h>=0||1===o){r=(e>=0?5:-5)*(h+a);var p,g=50;do a=Math.min(18,Math.abs(r)/5),o=Math.floor(a),h=a-o,i=F[o][1],l=F[o+1][1],s=F[Math.min(19,o+2)][1],r-=(p=(e>=0?N:-N)*(l+h*(s-i)/2+h*h*(s-2*l+i)/2)-e)*E;while(Math.abs(p)>z&&--g>0);break}}while(--o>=0);var m=F[o][0],v=F[o+1][0],y=F[Math.min(19,o+2)][0];return[t/(v+h*(y-m)/2+h*h*(y-2*v+m)/2),r*P]},(t.geo.robinson=function(){return D(y)}).raw=y,x.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return D(x)}).raw=x,b.invert=function(t,e){if(!(t*t+4*e*e>O*O+S)){var n=t,r=e,a=25;do{var o,i=Math.sin(n),l=Math.sin(n/2),c=Math.cos(n/2),u=Math.sin(r),f=Math.cos(r),d=Math.sin(2*r),h=u*u,p=f*f,g=l*l,m=1-p*c*c,v=m?s(f*c)*Math.sqrt(o=1/m):o=0,y=2*v*f*l-t,x=v*u-e,b=o*(p*g+v*f*c*h),_=o*(.5*i*d-2*v*u*l),w=.25*o*(d*l-v*u*p*i),M=o*(h*c+v*g*f),k=_*w-M*b;if(!k)break;var A=(x*_-y*M)/k,T=(y*w-x*b)/k;n-=A,r-=T}while((Math.abs(A)>S||Math.abs(T)>S)&&--a>0);return[n,r]}},(t.geo.aitoff=function(){return D(b)}).raw=b,_.invert=function(t,e){var n=t,r=e,a=25;do{var o,i=Math.cos(r),l=Math.sin(r),c=Math.sin(2*r),u=l*l,f=i*i,d=Math.sin(n),h=Math.cos(n/2),p=Math.sin(n/2),g=p*p,m=1-f*h*h,v=m?s(i*h)*Math.sqrt(o=1/m):o=0,y=.5*(2*v*i*p+n/N)-t,x=.5*(v*l+r)-e,b=.5*o*(f*g+v*i*h*u)+.5/N,_=o*(d*c/4-v*l*p),w=.125*o*(c*p-v*l*f*d),M=.5*o*(u*h+v*g*i)+.5,k=_*w-M*b,A=(x*_-y*M)/k,T=(y*w-x*b)/k;n-=A,r-=T}while((Math.abs(A)>S||Math.abs(T)>S)&&--a>0);return[n,r]},(t.geo.winkel3=function(){return D(_)}).raw=_}e.exports=r},{}],179:[function(t,e,n){"use strict";function r(t,e){var n=t.projection,r=t.lonaxis,i=t.lataxis,s=t.domain,c=t.framewidth||0,u=e.w*(s.x[1]-s.x[0]),f=e.h*(s.y[1]-s.y[0]),d=r.range[0]+l,h=r.range[1]-l,p=i.range[0]+l,g=i.range[1]-l,m=r._fullRange[0]+l,v=r._fullRange[1]-l,y=i._fullRange[0]+l,x=i._fullRange[1]-l;n._translate0=[e.l+u/2,e.t+f/2];var b=h-d,_=g-p,w=[d+b/2,p+_/2],M=n._rotate;n._center=[w[0]+M[0],w[1]+M[1]];var k=function(e){function r(t){return Math.min(_*u/(t[1][0]-t[0][0]),_*f/(t[1][1]-t[0][1]))}var i,l,s,b,_=e.scale(),w=n._translate0,M=a(d,p,h,g),k=a(m,y,v,x);s=o(e,M),i=r(s),b=o(e,k),n._fullScale=r(b),e.scale(i),s=o(e,M),l=[w[0]-s[0][0]+c,w[1]-s[0][1]+c],n._translate=l,e.translate(l),s=o(e,M),t._isAlbersUsa||e.clipExtent(s),i=n.scale*i,n._scale=i,t._width=Math.round(s[1][0])+c,t._height=Math.round(s[1][1])+c,t._marginX=(u-Math.round(s[1][0]))/2,t._marginY=(f-Math.round(s[1][1]))/2};return k}function a(t,e,n,r){var a=(n-t)/4;return{type:"Polygon",coordinates:[[[t,e],[t,r],[t+a,r],[t+2*a,r],[t+3*a,r],[n,r],[n,e],[n-a,e],[n-2*a,e],[n-3*a,e],[t,e]]]}}function o(t,e){return i.geo.path().projection(t).bounds(e)}var i=t("d3"),l=t("./constants").clipPad;e.exports=r},{"./constants":170,d3:8}],180:[function(t,e,n){"use strict";function r(t,e){var n;return(n=e._isScoped?o:e._clipAngle?l:i)(t,e.projection)}function a(t,e){var n=e._fullScale;return _.behavior.zoom().translate(t.translate()).scale(t.scale()).scaleExtent([.5*n,100*n])}function o(t,e){function n(){_.select(this).style(k)}function r(){i.scale(_.event.scale).translate(_.event.translate),t.render()}function o(){_.select(this).style(A)}var i=t.projection,l=a(i,e);return l.on("zoomstart",n).on("zoom",r).on("zoomend",o),l}function i(t,e){function n(t){return m.invert(t)}function r(t){var e=m(n(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function o(){_.select(this).style(k),s=_.mouse(this),c=m.rotate(),u=m.translate(),f=c,d=n(s)}function i(){return h=_.mouse(this),r(s)?(v.scale(m.scale()),void v.translate(m.translate())):(m.scale(_.event.scale),m.translate([u[0],_.event.translate[1]]),d?n(h)&&(g=n(h),p=[f[0]+(g[0]-d[0]),c[1],c[2]],m.rotate(p),f=p):(s=h,d=n(s)),void t.render())}function l(){_.select(this).style(A)}var s,c,u,f,d,h,p,g,m=t.projection,v=a(m,e),y=2;return v.on("zoomstart",o).on("zoom",i).on("zoomend",l),v}function l(t,e){function n(t){v++||t({type:"zoomstart"})}function r(t){t({type:"zoom"})}function o(t){--v||t({type:"zoomend"})}var i,l=t.projection,h={r:l.rotate(),k:l.scale()},p=a(l,e),g=b(p,"zoomstart","zoom","zoomend"),v=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(k);var t=_.mouse(this),e=l.rotate(),a=e,o=l.translate(),v=c(e);i=s(l,t),y.call(p,"zoom",function(){var n=_.mouse(this);if(l.scale(h.k=_.event.scale),i){if(s(l,n)){l.rotate(e).translate(o);var c=s(l,n),p=f(i,c),y=m(u(v,p)),x=h.r=d(y,i,a);isFinite(x[0])&&isFinite(x[1])&&isFinite(x[2])||(x=a),l.rotate(x),a=x}}else t=n,i=s(l,t);r(g.of(this,arguments))}),n(g.of(this,arguments))}).on("zoomend",function(){_.select(this).style(A),y.call(p,"zoom",null),o(g.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,g,"on")}function s(t,e){var n=t.invert(e);return n&&isFinite(n[0])&&isFinite(n[1])&&v(n)}function c(t){var e=.5*t[0]*w,n=.5*t[1]*w,r=.5*t[2]*w,a=Math.sin(e),o=Math.cos(e),i=Math.sin(n),l=Math.cos(n),s=Math.sin(r),c=Math.cos(r);return[o*l*c+a*i*s,a*l*c-o*i*s,o*i*c+a*l*s,o*l*s-a*i*c]}function u(t,e){var n=t[0],r=t[1],a=t[2],o=t[3],i=e[0],l=e[1],s=e[2],c=e[3];return[n*i-r*l-a*s-o*c,n*l+r*i+a*c-o*s,n*s-r*c+a*i+o*l,n*c+r*s-a*l+o*i]}function f(t,e){if(t&&e){var n=x(t,e),r=Math.sqrt(y(n,n)),a=.5*Math.acos(Math.max(-1,Math.min(1,y(t,e)))),o=Math.sin(a)/r;return r&&[Math.cos(a),n[2]*o,-n[1]*o,n[0]*o]}}function d(t,e,n){var r=g(e,2,t[0]);r=g(r,1,t[1]),r=g(r,0,t[2]-n[2]);var a,o,i=e[0],l=e[1],s=e[2],c=r[0],u=r[1],f=r[2],d=Math.atan2(l,i)*M,p=Math.sqrt(i*i+l*l);Math.abs(u)>p?(o=(u>0?90:-90)-d,a=0):(o=Math.asin(u/p)*M-d,a=Math.sqrt(p*p-u*u));var m=180-o-2*d,v=(Math.atan2(f,c)-Math.atan2(s,a))*M,y=(Math.atan2(f,c)-Math.atan2(s,-a))*M,x=h(n[0],n[1],o,v),b=h(n[0],n[1],m,y);return x<=b?[o,v,n[2]]:[m,y,n[2]]}function h(t,e,n,r){var a=p(n-t),o=p(r-e);return Math.sqrt(a*a+o*o)}function p(t){return(t%360+540)%360-180}function g(t,e,n){var r=n*w,a=t.slice(),o=0===e?1:0,i=2===e?1:2,l=Math.cos(r),s=Math.sin(r);return a[o]=t[o]*l-t[i]*s,a[i]=t[i]*l+t[o]*s,a}function m(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*M,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*M,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*M]}function v(t){var e=t[0]*w,n=t[1]*w,r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function y(t,e){for(var n=0,r=0,a=t.length;r=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),n._initialAutoSizeIsDone){var c=n.width,f=n.height;p.supplyLayoutGlobalDefaults(o,r),o.width||(r.width=c),o.height||(r.height=f)}else{p.supplyLayoutGlobalDefaults(o,r);var d=!o.width||!o.height,h=r.autosize,g=t._context&&t._context.autosizable,m=d&&(h||g);m?p.plotAutoSize(t,o,r):d&&p.sanitizeMargins(t),!h&&d&&(o.width=r.width,o.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=s.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,r),r._has=p._hasPlotType.bind(r);var v=r._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,m=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(g*(m.width-f)),a=Math.round(g*(m.height-h))}else{var v=s?window.getComputedStyle(t):{};r=parseFloat(v.width)||n.width,a=parseFloat(v.height)||n.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;r1,_=!e.height&&Math.abs(n.height-a)>1;(_||b)&&(b&&(n.width=r),_&&(n.height=a)),t._initialAutoSize||(t._initialAutoSize={width:r,height:a}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n,r){var a,o;u.Axes.supplyLayoutDefaults(t,e,n);var i=e._basePlotModules;for(a=0;a.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var m=s[t].t.val,v=s[t].t.size;if(m>d){var y=(h*m+(v-e.height)*d)/(m-d),x=(v*(1-d)+(h-e.height)*(1-m))/(m-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!t._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):d.isJSDate(t)?d.ms2DateTime(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var n,r,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(n=0;n0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(n)for(l=0;l=0,S=C?f.angularAxis.domain:r.extent(k),z=Math.abs(k[1]-k[0]);T&&!A&&(z=0);var O=S.slice();L&&A&&(O[1]+=z);var N=f.angularAxis.ticksCount||4;N>8&&(N=N/(N/8)+N%8),f.angularAxis.ticksStep&&(N=(O[1]-O[0])/N);var P=f.angularAxis.ticksStep||(O[1]-O[0])/(N*(f.minorTicks+1));M&&(P=Math.max(Math.round(P),1)),O[2]||(O[2]=P);var E=r.range.apply(this,O);if(E=E.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=r.scale.linear().domain(O.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?z:0,e=r.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var D="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",R=(new DOMParser).parseFromString(D,"application/xml"),j=this.appendChild(this.ownerDocument.importNode(R.documentElement,!0));e=r.select(j)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var I,F=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},q={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){I=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=i.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});i.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},i.Legend.defaultConfig().legendConfig,{container:I,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=I.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],a.range([0,x]),u.layout.radialAxis.domain=a.domain(),I.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else I=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var G=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(G[0]=Math.max(0,G[0]),G[1]=Math.max(0,G[1]),e.select(".outer-group").attr("transform","translate("+G+")"),f.title){var U=e.select("g.title-group text").style(q).text(f.title),X=U.node().getBBox();U.attr({x:_[0]-X.width/2,y:_[1]-x-20})}var Z=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=Z.selectAll("circle.grid-circle").data(a.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(B),Y.attr("r",a),Y.exit().remove()}Z.select("circle.outside-circle").attr({r:x}).style(B);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=r.svg.axis().scale(a).ticks(5).tickSize(5);Z.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Z.selectAll(".domain").style(B),Z.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(q).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,q["font-size"]]+")":"translate("+[0,q["font-size"]]+")"}}),Z.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(E),J=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),J.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(q);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?n<270&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(n<=180&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":M?M[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(q);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=r.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));I.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=a,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=r.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return o(i[n].defaultConfig(),t)});i[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=i.tooltipPanel().config({container:ct,fontSize:8})(),ft=i.tooltipPanel().config({container:ct,fontSize:8})(),dt=i.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var n=i.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=i.util.convertToCartesian(x+12,n+180);ut.text(i.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var n=i.util.getMousePos(W).radius;pt.attr({r:n}).style({opacity:.5}),lt=a.invert(i.util.getMousePos(W).radius);var r=i.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(i.util.round(lt)).move([r[0]+_[0],r[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var a=r.select(this),o=a.style("fill"),l="black",s=a.style("opacity")||1;if(a.attr({"data-opacity":s}),"none"!=o){a.attr({"data-fill":o}),l=r.hsl(o).darker().toString(),a.style({fill:l,opacity:1});var c={t:i.util.round(t[0]),r:i.util.round(t[1])};A&&(c.t=M[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-G[0]-d.left,f.top+f.height/2-G[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else o=a.style("stroke"),a.attr({"data-stroke":o}),l=r.hsl(o).darker().toString(),a.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==r.event.which&&void(r.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=r.select(this),a=n.attr("data-fill");a?n.style({fill:a,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,a,l,s={data:[],layout:{}},c={},u={},f=r.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=i.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),o(s.data[e],i.Axis.defaultConfig().data[0]),o(s.data[e],t)}),o(s.layout,i.Axis.defaultConfig().layout),o(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},r.rebind(d,f,"on"),d},i.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:r.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},i.util={},i.DATAEXTENT="dataExtent",i.AREA="AreaChart",i.LINE="LinePlot",i.DOT="DotPlot",i.BAR="BarChart",i.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},i.util._extend=function(t,e){for(var n in t)e[n]=t[n]},i.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},i.util.dataFromEquation2=function(t,e){var n=e||6,a=r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return a},i.util.dataFromEquation=function(t,e,n){var a=e||6,o=[],i=[];r.range(0,360+a,a).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},i.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return r.range(e).map(function(t,e){return n[e]||n[0]})},i.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=i.util.ensureArray(t[e],n)}),t},i.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},i.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},i.util.sumArrays=function(t,e){return r.zip(t,e).map(function(t,e){return r.sum(t)})},i.util.arrayLast=function(t){return t[t.length-1]},i.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return n===-2},i.util.flattenArray=function(t){for(var e=[];!i.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},i.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},i.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},i.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},i.util.getMousePos=function(t){var e=r.mouse(t.node()),n=e[0],a=e[1],o={};return o.x=n,o.y=a,o.pos=e,o.angle=180*(Math.atan2(a,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+a*a),o},i.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;a0)){var l=r.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(n,a,o)},"fill-opacity":0,stroke:function(t,e){return m.stroke(n,a,o)},"stroke-width":function(t,e){return m["stroke-width"](n,a,o)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](n,a,o)},opacity:function(t,e){return m.opacity(n,a,o)},display:function(t,e){return m.display(n,a,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=r.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,a){r.select(this).attr({class:"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var m={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},v=r.select(this).selectAll("g.layer").data(s);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(m).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,n=[i.PolyChart.defaultConfig()],a=r.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),o(n[e],i.PolyChart.defaultConfig()),o(n[e],t)}),this):n},t.getColorScale=function(){return e},r.rebind(t,a,"on"),t},i.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}};return t},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},i.Legend=function(){function t(){var n=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=o({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),i=r.merge(a);i=i.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(i=i.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=r.select(l));var s=i.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof i[0]:n.isContinuous,f=u?n.height:c*i.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=r.range(i.length),m=r.scale[u?"linear":"ordinal"]().domain(g).range(s),v=r.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":r.svg.symbolTypes.indexOf(t)!=-1?r.svg.symbol().type(t).size(n)():r.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(i);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,v(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=r.svg.axis().scale(v).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return i[e].name}),t}var e=i.Legend.defaultConfig(),n=r.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},r.rebind(t,n,"on"),t},i.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},i.tooltipPanel=function(){var t,e,n,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=10,c=function(){t=a.container.selectAll("g."+l).data([0]);var r=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=r.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=r.append("text").attr({dx:a.padding+s,dy:.3*+a.fontSize}),c};return c.text=function(o){var i=r.hsl(a.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var d=a.padding,h=e.node().getBBox(),p={fill:a.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,m=h.height+2*d;return n.attr({d:"M"+[[s,-m/2],[s,-m/4],[a.hasTick?0:s,0],[s,m/4],[s,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-m/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){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 o(a,t),c},c},i.tooltipPanel.uid=1,i.adapter={},i.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=o({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var r=a.indexOf(t.geometry);r!=-1&&(n.data[e].groupId=r)})}if(t.layout){var l=o({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};r.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../lib":120,d3:8}],189:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../lib"),o=t("../../components/color"),i=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){function e(e,a){return a&&(f=a),r.select(r.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?s(n,e):e,o||(o=i.Axis()),u=i.adapter.plotly().convert(n),o.config(u).render(f),t.data=n.data,t.layout=n.layout,c.fillLayout(t),n}var n,a,o,u,f,d=new l;return e.isPolar=!0,e.svg=function(){return o.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return i.adapter.plotly().convert(o.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:o.angularScale(),r:o.radialScale()}},e.setUndoPoint=function(){var t=this,e=i.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,a),a=i.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},c.fillLayout=function(t){var e=r.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:o.background,_container:e,_paperdiv:n,_paper:a};t._fullLayout=s(i,t.layout)}},{"../../components/color":25,"../../lib":120,"./micropolar":188,"./undo_manager":190,d3:8}],190:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return r!==-1},hasRedo:function(){return r-1}var o=t("../lib"),i=t("../plots/plots"),l=o.extendFlat,s=o.extendDeep;e.exports=function(t,e){ +t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,o=t.data,c=t.layout,u=s([],o),f=s({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;ns&&(e.z=u.slice(0,s)),l("locationmode"),l("text"),l("marker.line.color"),l("marker.line.width"),a(t,e,i,l,{prefix:"",cLetter:"z"}),void l("hoverinfo",1===i._dataLength?"location+z+text":void 0)):void(e.visible=!1)}},{"../../components/colorscale/defaults":34,"../../lib":120,"./attributes":201}],204:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../heatmap/colorbar"),r.calc=t("./calc"),r.plot=t("./plot").plot,r.hoverPoints=function(){},r.moduleType="trace",r.name="choropleth",r.basePlotModule=t("../../plots/geo"),r.categories=["geo","noOpacity"],r.meta={},e.exports=r},{"../../plots/geo":172,"../heatmap/colorbar":206,"./attributes":201,"./calc":202,"./defaults":203,"./plot":205}],205:[function(t,e,n){"use strict";function r(t,e){function n(e){var n=t.mockAxis;return i.tickText(n,n.c2l(e),"hover").text}var r=e.hoverinfo;if("none"===r||"skip"===r)return function(t){delete t.nameLabel,delete t.textLabel};var a="all"===r?g.hoverinfo.flags:r.split("+"),o=a.indexOf("name")!==-1,l=a.indexOf("location")!==-1,s=a.indexOf("z")!==-1,c=a.indexOf("text")!==-1,u=!o&&l;return function(t){var r=[];u?t.nameLabel=t.id:(o&&(t.nameLabel=e.name),l&&r.push(t.id)),s&&r.push(n(t.z)),c&&r.push(t.tx),t.textLabel=r.join("
")}}function a(t){return function(e,n){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:n,location:e.id,z:e.z}]}}}var o=t("d3"),i=t("../../plots/cartesian/axes"),l=t("../../plots/cartesian/graph_interact"),s=t("../../components/color"),c=t("../../components/drawing"),u=t("../../components/colorscale"),f=t("../../lib/topojson_utils").getTopojsonFeatures,d=t("../../lib/geo_location_utils").locationToFeature,h=t("../../lib/array_to_calc_item"),p=t("../../plots/geo/constants"),g=t("./attributes"),m=e.exports={};m.calcGeoJSON=function(t,e){for(var n,r=[],a=t.locations,o=a.length,i=f(t,e),l=(t.marker||{}).line||{},s=0;s0&&(r[0].trace=t),r},m.plot=function(t,e,n){function i(t){return t[0].trace.uid}var s,c=t.framework,u=c.select("g.choroplethlayer"),f=c.select("g.baselayer"),d=c.select("g.baselayeroverchoropleth"),h=p.baseLayersOverChoropleth,g=u.selectAll("g.trace.choropleth").data(e,i);g.enter().append("g").attr("class","trace choropleth"),g.exit().remove(),g.each(function(e){function n(e,n){if(t.showHover){var r=t.projection(e.properties.ct);u(e),l.loneHover({x:r[0],y:r[1],name:e.nameLabel,text:e.textLabel},{container:t.hoverContainer.node()}),d=f(e,n),t.graphDiv.emit("plotly_hover",d)}}function i(e,n){t.graphDiv.emit("plotly_click",f(e,n))}var s=e[0].trace,c=m.calcGeoJSON(s,t.topojson),u=r(t,s),f=a(s),d=null,h=o.select(this).selectAll("path.choroplethlocation").data(c);h.enter().append("path").classed("choroplethlocation",!0).on("mouseover",n).on("click",i).on("mouseout",function(){l.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",d)}).on("mousedown",function(){l.loneUnhover(t.hoverContainer)}).on("mouseup",n),h.exit().remove()}),d.selectAll("*").remove();for(var v=0;vp&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var v={type:"linear"};a.setConvert(v),s=v.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,a.expand(u,d,g),a.expand(f,h,m);var b=new Array(p);for(c=0;c=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}}}}},{}],212:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,s=n.marker,c="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===s||!s.showscale)return void o.autoMargin(t,c);var u=s.color,f=s.cmin,d=s.cmax;r(f)||(f=a.aggNums(Math.min,null,u)),r(d)||(d=a.aggNums(Math.max,null,u));var h=e[0].t.cb=l(t,c),p=i.makeColorScaleFunc(i.extractScale(s.colorscale,f,d),{noNumericCheck:!0});h.fillcolor(p).filllevels({start:f,end:d,size:(d-f)/254}).options(s.colorbar)()}},{"../../components/colorbar/draw":28,"../../components/colorscale":39,"../../lib":120,"../../plots/plots":184,"fast-isnumeric":11}],213:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":31,"../../components/colorscale/has_colorscale":38,"./subtypes":229}],214:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],215:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var m=l(t,e,g),v=mq!=P>=q&&(z=C[T-1][0],O=C[T][0],S=z+(O-z)*(q-N)/(P-N),j=Math.min(j,S),I=Math.max(I,S));j=Math.max(j,0),I=Math.min(I,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:j,x1:I,y0:q,y1:q,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":25,"../../components/errorbars":54,"../../lib":120,"../../plots/cartesian/constants":153,"../../plots/cartesian/graph_interact":155,"./get_trace_color":217}],219:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.animatable=!0,r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":156,"./arrays_to_calcdata":208,"./attributes":209,"./calc":210,"./clean_data":211,"./colorbar":212,"./defaults":215,"./hover":218,"./plot":226,"./select":227,"./style":228,"./subtypes":229}],220:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=!Array.isArray(l)&&l||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":34,"../../components/colorscale/has_colorscale":38}],221:[function(t,e,n){"use strict";var r=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),a=M.c2p(t[e].y);return n!==r&&a!==r&&[n,a]}function a(t){var e=t[0]/w._length,n=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*T}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,m,v,y,x,b,_,w=e.xaxis,M=e.yaxis,k=e.simplify,A=e.connectGaps,T=e.baseTolerance,L=e.linear,C=[],S=.2,z=new Array(t.length),O=0;for(k||(T=S=-1),i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,c=f,h=!1):y=t.length||!f)break;z[O++]=f,l=f}}else z[O++]=c}C.push(z.slice(0,O))}return C}},{"../../constants/numerical":105}],222:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],223:[function(t,e,n){"use strict";e.exports=function(t,e,n){for(var r,a,o=null,i=0;i0?Math.max(e,a):0}}},{"fast-isnumeric":11}],225:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":25,"../../components/colorscale/defaults":34,"../../components/colorscale/has_colorscale":38,"./subtypes":229}],226:[function(t,e,n){"use strict";function r(t,e){var n;e.selectAll("g.trace").each(function(t){var e=i.select(this);if(n=t[0].trace,n._nexttrace){if(n._nextFill=e.select(".js-fill.js-tonext"),!n._nextFill.size()){var r=":first-child";e.select(".js-fill.js-tozero").size()&&(r+=" + *"),n._nextFill=e.insert("path",r).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),n._nextFill=null;n.fill&&("tozero"===n.fill.substr(0,6)||"toself"===n.fill||"to"===n.fill.substr(0,2)&&!n._prevtrace)?(n._ownFill=e.select(".js-fill.js-tozero"),n._ownFill.size()||(n._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),n._ownFill=null)})}function a(t,e,n,r,a,h,g){function m(t){return k?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,n,r=t[0].trace,a=i.select(this),o=u.hasMarkers(r),c=u.hasText(r),f=x(r),d=b,h=b;o&&(d=r.marker.maxdisplayed?v:l.identity),c&&(h=r.marker.maxdisplayed?v:l.identity),n=a.selectAll("path.point"),e=n.data(d,f);var p=e.enter().append("path").classed("point",!0);p.call(s.pointStyle,r).call(s.translatePoints,A,T,r),k&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=m(i.select(this));s.translatePoint(t,e,A,T),s.singlePointStyle(t,e,r)}),k?e.exit().transition().style("opacity",0).remove():e.exit().remove(),n=a.selectAll("g"),e=n.data(h,f),e.enter().append("g").append("text"),e.each(function(t){var e=m(i.select(this).select("text"));s.translatePoint(t,e,A,T)}),e.selectAll("text").call(s.textPointStyle,r).each(function(t){var e=t.xp||A.c2p(t.x),n=t.yp||T.c2p(t.y);i.select(this).selectAll("tspan").each(function(){m(i.select(this)).attr({x:e,y:n})})}),e.exit().remove()}var w,M;o(t,e,n,r,a);var k=!!g&&g.duration>0,A=n.xaxis,T=n.yaxis,L=r[0].trace,C=L.line,S=i.select(h);if(S.call(c.plot,n,g),L.visible===!0){m(S).style("opacity",L.opacity);var z,O,N=L.fill.charAt(L.fill.length-1);"x"!==N&&"y"!==N&&(N=""),r[0].node3=S,f(r);var P="",E=[],D=L._prevtrace;D&&(P=D._prevRevpath||"",O=D._nextFill,E=D._polygons);var R,j,I,F,B,q,H,V,G,U="",X="",Z=[],Y=[],W=l.noop;if(z=L._ownFill,u.hasLines(L)||"none"!==L.fill){for(O&&O.datum(r),["hv","vh","hvh","vhv"].indexOf(C.shape)!==-1?(I=s.steps(C.shape),F=s.steps(C.shape.split("").reverse().join(""))):I=F="spline"===C.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?s.smoothclosed(t.slice(1),C.smoothing):s.smoothopen(t,C.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return F(t.reverse())},Z=d(r,{xaxis:A,yaxis:T,connectGaps:L.connectgaps,baseTolerance:Math.max(C.width||1,3)/4,linear:"linear"===C.shape,simplify:C.simplify}),G=L._polygons=new Array(Z.length),M=0;M1}),W=function(t){return function(e){if(R=I(e),j=B(e),U?N?(U+="L"+R.substr(1),X=j+("L"+X.substr(1))):(U+="Z"+R,X=j+"Z"+X):(U=R,X=j),u.hasLines(L)&&e.length>1){var n=i.select(this);if(n.datum(r),t)m(n.style("opacity",0).attr("d",R).call(s.lineGroupStyle)).style("opacity",1);else{var a=m(n);a.attr("d",R),s.singleLineStyle(r,a)}}}}}var Q=S.selectAll(".js-line").data(Y);m(Q.exit()).style("opacity",0).remove(),Q.each(W(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(W(!0)),Z.length&&(z?q&&V&&(N?("y"===N?q[1]=V[1]=T.c2p(0,!0):"x"===N&&(q[0]=V[0]=A.c2p(0,!0)),m(z).attr("d","M"+V+"L"+q+"L"+U.substr(1))):m(z).attr("d",U+"Z")):"tonext"===L.fill.substr(0,6)&&U&&P&&("tonext"===L.fill?m(O).attr("d",U+"Z"+P+"Z"):m(O).attr("d",U+"L"+P.substr(1)+"Z"),L._polygons=L._polygons.concat(E)),L._prevRevpath=X,L._prevPolygons=G);var $=S.selectAll(".points");w=$.data([r]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function o(t,e,n,r,a){var o=n.xaxis,l=n.yaxis,s=i.extent(o.range.map(o.r2l).map(o.l2c)),c=i.extent(l.range.map(l.r2l).map(l.l2c)),f=r[0].trace;if(u.hasMarkers(f)){var d=f.marker.maxdisplayed;if(0!==d){var h=r.filter(function(t){return t.x>=s[0]&&t.x<=s[1]&&t.y>=c[0]&&t.y<=c[1]}),p=Math.ceil(h.length/d),g=0;a.forEach(function(t,n){var r=t[0].trace;u.hasMarkers(r)&&r.marker.maxdisplayed>0&&n0;for(u=p.selectAll("g.trace"),f=u.data(n,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),h(t,e,n),r(t,p),s=0,c=[];sr?1:-1}),m){l&&(d=l());var v=i.transition().duration(o.duration).ease(o.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()});v.each(function(){ +p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)})})}else p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":48,"../../components/errorbars":54,"../../lib":120,"../../lib/polygon":127,"./arrays_to_calcdata":208,"./line_points":221,"./link_traces":223,"./subtypes":229,d3:8}],227:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;n0&&(i[l-1].gapAfter=!0):(l++,i.push(u))}return a(e),i}},{"../scatter/colorscale_calc":213,"fast-isnumeric":11}],234:[function(t,e,n){"use strict";function r(t,e,n){var r,a,o=0,i=n("locations");return i?(n("locationmode"),o=i.length):(r=n("lon")||[],a=n("lat")||[],o=Math.min(r.length,a.length),o")}var a=t("../../plots/cartesian/graph_interact"),o=t("../../plots/cartesian/axes"),i=t("../scatter/get_trace_color"),l=t("./attributes");e.exports=function(t){function e(t){return u.projection(t)}function n(t){var n=t.lonlat;if(null===n[0]||null===n[1])return 1/0;if(u.isLonLatOverEdges(n))return 1/0;var r=e(n),a=s.c2p(),o=c.c2p(),i=Math.abs(a-r[0]),l=Math.abs(o-r[1]),f=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(i*i+l*l)-f,1-3/f)}var o=t.cd,l=o[0].trace,s=t.xa,c=t.ya,u=t.subplot;if(!o[0].placeholder&&(a.getClosest(o,n,t),t.index!==!1)){var f=o[t.index],d=f.lonlat,h=e(d),p=f.mrc||1;return t.x0=h[0]-p,t.x1=h[0]+p,t.y0=h[1]-p,t.y1=h[1]+p,t.loc=f.loc,t.lat=d[0],t.lon=d[1],t.color=i(l,f),t.extraText=r(l,f,u.mockAxis),[t]}}},{"../../plots/cartesian/axes":148,"../../plots/cartesian/graph_interact":155,"../scatter/get_trace_color":217,"./attributes":232}],237:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../scatter/colorbar"),r.calc=t("./calc"),r.plot=t("./plot"),r.hoverPoints=t("./hover"),r.eventData=t("./event_data"),r.moduleType="trace",r.name="scattergeo",r.basePlotModule=t("../../plots/geo"),r.categories=["geo","symbols","markerColorscale","showLegend"],r.meta={},e.exports=r},{"../../plots/geo":172,"../scatter/colorbar":212,"./attributes":232,"./calc":233,"./defaults":234,"./event_data":235,"./hover":236,"./plot":238}],238:[function(t,e,n){"use strict";function r(t,e){if(!Array.isArray(t.locations))return c.identity;var n=u(t,e),r=t.locationmode;return function(t){var e=f(r,t.loc,n);return e?(t.lonlat=e.properties.ct,t):(t.lonlat=[null,null],!1)}}function a(t,e,n){function r(t,r){h(t,e,r,n)}var a=t.marker;if(r(t.text,"tx"),r(t.textposition,"tp"),t.textfont&&(r(t.textfont.size,"ts"),r(t.textfont.color,"tc"),r(t.textfont.family,"tf")),a&&a.line){var o=a.line;r(a.opacity,"mo"),r(a.symbol,"mx"),r(a.color,"mc"),r(a.size,"ms"),r(o.color,"mlc"),r(o.width,"mlw")}}function o(t){var e=t.framework.selectAll("g.trace.scattergeo");e.style("opacity",function(t){return t[0].trace.opacity}),e.each(function(t){var e=t[0].trace,n=i.select(this);n.selectAll("path.point").call(l.pointStyle,e),n.selectAll("text").call(l.textPointStyle,e)}),e.selectAll("path.js-line").style("fill","none").each(function(t){var e=i.select(this),n=t.trace,r=n.line||{};e.call(s.stroke,r.color).call(l.dashLine,r.dash||"",r.width||0),"none"!==n.fill&&e.call(s.fill,n.fillcolor)})}var i=t("d3"),l=t("../../components/drawing"),s=t("../../components/color"),c=t("../../lib"),u=t("../../lib/topojson_utils").getTopojsonFeatures,f=t("../../lib/geo_location_utils").locationToFeature,d=t("../../lib/geojson_utils"),h=t("../../lib/array_to_calc_item"),p=t("../scatter/subtypes");e.exports=function(t,e){function n(t){return t[0].trace.uid}var l=t.framework.select(".scattergeolayer").selectAll("g.trace.scattergeo").data(e,n);l.enter().append("g").attr("class","trace scattergeo"),l.exit().remove(),l.selectAll("*").remove(),l.each(function(e){var n=i.select(this),o=e[0].trace,l=r(o,t.topojson);e[0].placeholder&&n.remove();for(var s=[],c=0;c paper // first convert to fraction of the axis - position = (position - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + position = axOld.r2fraction(position); // next scale the axis to the whole plot position = axOld.domain[0] + @@ -37591,8 +37592,7 @@ function drawOne(gd, index, opt, value) { (axNew.domain[1] - axNew.domain[0]); // finally convert to data coordinates - position = axNew.range[0] + - position * (axNew.range[1] - axNew.range[0]); + position = axNew.fraction2r(position); } } @@ -37609,7 +37609,8 @@ function drawOne(gd, index, opt, value) { optionsIn[axLetter] = position; } - var options = handleAnnotationDefaults(optionsIn, fullLayout); + var options = {}; + handleAnnotationDefaults(optionsIn, options, fullLayout); fullLayout.annotations[index] = options; var xa = Axes.getFromId(gd, options.xref), @@ -37723,20 +37724,21 @@ function drawOne(gd, index, opt, value) { // outside the visible plot (as long as the axis // isn't autoranged - then we need to draw it // anyway to get its bounding box) - if(!ax.autorange && ((options[axLetter] - ax.range[0]) * - (options[axLetter] - ax.range[1]) > 0)) { + var posFraction = ax.r2fraction(options[axLetter]); + if(!ax.autorange && (posFraction < 0 || posFraction > 1)) { if(options['a' + axLetter + 'ref'] === axRef) { - if((options['a' + axLetter] - ax.range[0]) * - (options['a' + axLetter] - ax.range[1]) > 0) { + posFraction = ax.r2fraction(options['a' + axLetter]); + if(posFraction < 0 || posFraction > 1) { annotationIsOffscreen = true; } - } else { + } + else { annotationIsOffscreen = true; } if(annotationIsOffscreen) return; } - annPosPx[axLetter] = ax._offset + ax.l2p(options[axLetter]); + annPosPx[axLetter] = ax._offset + ax.r2p(options[axLetter]); alignPosition = 0.5; } else { @@ -37749,7 +37751,7 @@ function drawOne(gd, index, opt, value) { var alignShift = 0; if(options['a' + axLetter + 'ref'] === axRef) { - annPosPx['aa' + axLetter] = ax._offset + ax.l2p(options['a' + axLetter]); + annPosPx['aa' + axLetter] = ax._offset + ax.r2p(options['a' + axLetter]); } else { if(options.showarrow) { alignShift = options['a' + axLetter]; @@ -37949,22 +37951,22 @@ function drawOne(gd, index, opt, value) { ann.call(Lib.setTranslate, xcenter, ycenter); update[annbase + '.x'] = xa ? - (options.x + dx / xa._m) : + xa.p2r(xa.r2p(options.x) + dx) : ((arrowX + dx - gs.l) / gs.w); update[annbase + '.y'] = ya ? - (options.y + dy / ya._m) : + ya.p2r(ya.r2p(options.y) + dy) : (1 - ((arrowY + dy - gs.t) / gs.h)); if(options.axref === options.xref) { update[annbase + '.ax'] = xa ? - (options.ax + dx / xa._m) : - ((arrowX + dx - gs.l) / gs.w); + xa.p2r(xa.r2p(options.ax) + dx) : + ((arrowX + dx - gs.l) / gs.w); } if(options.ayref === options.yref) { update[annbase + '.ay'] = ya ? - (options.ay + dy / ya._m) : - (1 - ((arrowY + dy - gs.t) / gs.h)); + ya.p2r(ya.r2p(options.ay) + dy) : + (1 - ((arrowY + dy - gs.t) / gs.h)); } anng.attr({ @@ -38010,13 +38012,13 @@ function drawOne(gd, index, opt, value) { var csr = 'pointer'; if(options.showarrow) { if(options.axref === options.xref) { - update[annbase + '.ax'] = xa.p2l(xa.l2p(options.ax) + dx); + update[annbase + '.ax'] = xa.p2r(xa.r2p(options.ax) + dx); } else { update[annbase + '.ax'] = options.ax + dx; } if(options.ayref === options.yref) { - update[annbase + '.ay'] = ya.p2l(ya.l2p(options.ay) + dy); + update[annbase + '.ay'] = ya.p2r(ya.r2p(options.ay) + dy); } else { update[annbase + '.ay'] = options.ay + dy; } @@ -38122,7 +38124,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":301,"../../lib/setcursor":311,"../../lib/svg_text_utils":315,"../../plotly":326,"../../plots/cartesian/axes":330,"../../plots/plots":359,"../color":207,"../dragelement":229,"../drawing":231,"./annotation_defaults":198,"./defaults":202,"./draw_arrow_head":204,"d3":55,"fast-isnumeric":61}],204:[function(require,module,exports){ +},{"../../lib":303,"../../lib/setcursor":313,"../../lib/svg_text_utils":317,"../../plotly":328,"../../plots/cartesian/axes":333,"../../plots/plots":361,"../color":207,"../dragelement":228,"../drawing":230,"./annotation_defaults":198,"./defaults":202,"./draw_arrow_head":204,"d3":55,"fast-isnumeric":61}],204:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -38241,7 +38243,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { if(doEnd) drawhead(end, endRot); }; -},{"../color":207,"../drawing":231,"./arrow_paths":199,"d3":55,"fast-isnumeric":61}],205:[function(require,module,exports){ +},{"../color":207,"../drawing":230,"./arrow_paths":199,"d3":55,"fast-isnumeric":61}],205:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -38253,33 +38255,21 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { 'use strict'; -var Plotly = require('../../plotly'); - -exports.moduleType = 'component'; - -exports.name = 'annotations'; - -exports.ARROWPATHS = require('./arrow_paths'); - -exports.layoutAttributes = require('./attributes'); - -exports.supplyLayoutDefaults = require('./defaults'); - -exports.calcAutorange = require('./calc_autorange'); - -exports.arrowhead = require('./draw_arrow_head'); - var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; -exports.add = function(gd) { - var nextAnn = gd._fullLayout.annotations.length; +module.exports = { + moduleType: 'component', + name: 'annotations', + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), - Plotly.relayout(gd, 'annotations[' + nextAnn + ']', 'add'); + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne }; -},{"../../plotly":326,"./arrow_paths":199,"./attributes":200,"./calc_autorange":201,"./defaults":202,"./draw":203,"./draw_arrow_head":204}],206:[function(require,module,exports){ +},{"./attributes":200,"./calc_autorange":201,"./defaults":202,"./draw":203}],206:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -38632,7 +38622,7 @@ module.exports = { } }; -},{"../../lib/extend":297,"../../plots/cartesian/layout_attributes":340,"../../plots/font_attributes":351}],209:[function(require,module,exports){ +},{"../../lib/extend":298,"../../plots/cartesian/layout_attributes":342,"../../plots/font_attributes":353}],209:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -38699,7 +38689,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":301,"../../plots/cartesian/tick_label_defaults":346,"../../plots/cartesian/tick_mark_defaults":347,"../../plots/cartesian/tick_value_defaults":348,"./attributes":208}],210:[function(require,module,exports){ +},{"../../lib":303,"../../plots/cartesian/tick_label_defaults":348,"../../plots/cartesian/tick_mark_defaults":349,"../../plots/cartesian/tick_value_defaults":350,"./attributes":208}],210:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39331,7 +39321,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":301,"../../lib/extend":297,"../../lib/setcursor":311,"../../plotly":326,"../../plots/cartesian/axes":330,"../../plots/cartesian/axis_defaults":332,"../../plots/cartesian/layout_attributes":340,"../../plots/cartesian/position_defaults":343,"../../plots/plots":359,"../../registry":366,"../color":207,"../dragelement":229,"../drawing":231,"../titles":282,"./attributes":208,"d3":55,"tinycolor2":182}],211:[function(require,module,exports){ +},{"../../lib":303,"../../lib/extend":298,"../../lib/setcursor":313,"../../plotly":328,"../../plots/cartesian/axes":333,"../../plots/cartesian/axis_defaults":335,"../../plots/cartesian/layout_attributes":342,"../../plots/cartesian/position_defaults":345,"../../plots/plots":361,"../../registry":368,"../color":207,"../dragelement":228,"../drawing":230,"../titles":281,"./attributes":208,"d3":55,"tinycolor2":182}],211:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39350,28 +39340,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":301}],212:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -exports.attributes = require('./attributes'); - -exports.supplyDefaults = require('./defaults'); - -exports.draw = require('./draw'); - -exports.hasColorbar = require('./has_colorbar'); - -},{"./attributes":208,"./defaults":209,"./draw":210,"./has_colorbar":211}],213:[function(require,module,exports){ +},{"../../lib":303}],212:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39426,7 +39395,7 @@ module.exports = { } }; -},{}],214:[function(require,module,exports){ +},{}],213:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39492,7 +39461,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":301,"./flip_scale":219,"./scales":226}],215:[function(require,module,exports){ +},{"../../lib":303,"./flip_scale":218,"./scales":225}],214:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39536,7 +39505,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":297,"./attributes":213,"./scales.js":226}],216:[function(require,module,exports){ +},{"../../lib/extend":298,"./attributes":212,"./scales.js":225}],215:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39552,7 +39521,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":226}],217:[function(require,module,exports){ +},{"./scales":225}],216:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39616,7 +39585,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":301,"../colorbar/defaults":209,"../colorbar/has_colorbar":211,"./flip_scale":219,"./is_valid_scale":223,"fast-isnumeric":61}],218:[function(require,module,exports){ +},{"../../lib":303,"../colorbar/defaults":209,"../colorbar/has_colorbar":211,"./flip_scale":218,"./is_valid_scale":222,"fast-isnumeric":61}],217:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39653,7 +39622,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],219:[function(require,module,exports){ +},{}],218:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39678,7 +39647,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],220:[function(require,module,exports){ +},{}],219:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39718,7 +39687,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":216,"./is_valid_scale_array":224,"./scales":226}],221:[function(require,module,exports){ +},{"./default_scale":215,"./is_valid_scale_array":223,"./scales":225}],220:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39764,7 +39733,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":301,"./is_valid_scale":223,"fast-isnumeric":61}],222:[function(require,module,exports){ +},{"../../lib":303,"./is_valid_scale":222,"fast-isnumeric":61}],221:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39798,7 +39767,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":213,"./calc":214,"./default_scale":216,"./defaults":217,"./extract_scale":218,"./flip_scale":219,"./get_scale":220,"./has_colorscale":221,"./is_valid_scale":223,"./make_color_scale_func":225,"./scales":226}],223:[function(require,module,exports){ +},{"./attributes":212,"./calc":213,"./default_scale":215,"./defaults":216,"./extract_scale":217,"./flip_scale":218,"./get_scale":219,"./has_colorscale":220,"./is_valid_scale":222,"./make_color_scale_func":224,"./scales":225}],222:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39819,7 +39788,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":224,"./scales":226}],224:[function(require,module,exports){ +},{"./is_valid_scale_array":223,"./scales":225}],223:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39856,7 +39825,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":182}],225:[function(require,module,exports){ +},{"tinycolor2":182}],224:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -39952,7 +39921,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":207,"d3":55,"fast-isnumeric":61,"tinycolor2":182}],226:[function(require,module,exports){ +},{"../color":207,"d3":55,"fast-isnumeric":61,"tinycolor2":182}],225:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40083,7 +40052,7 @@ module.exports = { ] }; -},{}],227:[function(require,module,exports){ +},{}],226:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40116,7 +40085,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],228:[function(require,module,exports){ +},{}],227:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40154,7 +40123,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":301}],229:[function(require,module,exports){ +},{"../../lib":303}],228:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40341,7 +40310,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../lib":301,"../../plotly":326,"../../plots/cartesian/constants":336,"./align":227,"./cursor":228,"./unhover":230}],230:[function(require,module,exports){ +},{"../../lib":303,"../../plotly":328,"../../plots/cartesian/constants":338,"./align":226,"./cursor":227,"./unhover":229}],229:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40392,7 +40361,7 @@ unhover.raw = function unhoverRaw(gd, evt) { gd._hoverdata = undefined; }; -},{"../../lib/events":296}],231:[function(require,module,exports){ +},{"../../lib/events":297}],230:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -40470,14 +40439,14 @@ drawing.getPx = function(s, styleAttr) { return Number(s.style(styleAttr).replace(/px$/, '')); }; -drawing.crispRound = function(td, lineWidth, dflt) { +drawing.crispRound = function(gd, lineWidth, dflt) { // for lines that disable antialiasing we want to // make sure the width is an integer, and at least 1 if it's nonzero if(!lineWidth || !isNumeric(lineWidth)) return dflt || 0; // but not for static plots - these don't get antialiased anyway. - if(td._context.staticPlot) return lineWidth; + if(gd._context.staticPlot) return lineWidth; if(lineWidth < 1) return 1; return Math.round(lineWidth); @@ -40671,9 +40640,8 @@ drawing.singlePointStyle = function(d, sel, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); singlePointStyle(d, sel, trace, markerScale, lineScale, marker, markerLine); @@ -40685,50 +40653,22 @@ drawing.pointStyle = function(s, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales var marker = trace.marker; - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale); }); }; -// for a given color attribute (ie m -> mc = marker.color) look to see if we -// have a colorscale for it (ie mscl, mcmin, mcmax) - if we do, translate -// all numeric color values according to that scale -drawing.tryColorscale = function(cont, contIn, prefix) { - var colorArray = Lib.nestedProperty(cont, prefix + 'color').get(), - scl = Lib.nestedProperty(cont, prefix + 'colorscale').get(), - auto = Lib.nestedProperty(cont, prefix + 'cauto').get(), - minProp = Lib.nestedProperty(cont, prefix + 'cmin'), - maxProp = Lib.nestedProperty(cont, prefix + 'cmax'), - min = minProp.get(), - max = maxProp.get(); +drawing.tryColorscale = function(marker, prefix) { + var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker, + scl = cont.colorscale, + colorArray = cont.color; - // TODO handle this in Colorscale.calc if(scl && Array.isArray(colorArray)) { - if(auto || !isNumeric(min) || !isNumeric(max)) { - min = Infinity; - max = -Infinity; - colorArray.forEach(function(color) { - if(isNumeric(color)) { - if(min > color) min = +color; - if(max < color) max = +color; - } - }); - if(min > max) { - min = 0; - max = 1; - } - minProp.set(min); - maxProp.set(max); - Lib.nestedProperty(contIn, prefix + 'cmin').set(min); - Lib.nestedProperty(contIn, prefix + 'cmax').set(max); - } - return Colorscale.makeColorScaleFunc( - Colorscale.extractScale(scl, min, max) + Colorscale.extractScale(scl, cont.cmin, cont.cmax) ); } else return Lib.identity; @@ -40996,7 +40936,7 @@ drawing.setClipUrl = function(s, localId) { s.attr('clip-path', 'url(' + url + ')'); }; -},{"../../constants/xmlns_namespaces":291,"../../lib":301,"../../lib/svg_text_utils":315,"../../registry":366,"../../traces/scatter/make_bubble_size_func":419,"../../traces/scatter/subtypes":424,"../color":207,"../colorscale":222,"./symbol_defs":232,"d3":55,"fast-isnumeric":61}],232:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":291,"../../lib":303,"../../lib/svg_text_utils":317,"../../registry":368,"../../traces/scatter/make_bubble_size_func":422,"../../traces/scatter/subtypes":427,"../color":207,"../colorscale":221,"./symbol_defs":231,"d3":55,"fast-isnumeric":61}],231:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41472,7 +41412,7 @@ module.exports = { } }; -},{"d3":55}],233:[function(require,module,exports){ +},{"d3":55}],232:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41571,7 +41511,7 @@ module.exports = { } }; -},{}],234:[function(require,module,exports){ +},{}],233:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41634,7 +41574,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":330,"../../registry":366,"./compute_error":235,"fast-isnumeric":61}],235:[function(require,module,exports){ +},{"../../plots/cartesian/axes":333,"../../registry":368,"./compute_error":234,"fast-isnumeric":61}],234:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41730,7 +41670,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],236:[function(require,module,exports){ +},{}],235:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41807,7 +41747,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":301,"../../registry":366,"./attributes":233,"fast-isnumeric":61}],237:[function(require,module,exports){ +},{"../../lib":303,"../../registry":368,"./attributes":232,"fast-isnumeric":61}],236:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -41866,7 +41806,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":233,"./calc":234,"./defaults":236,"./plot":238,"./style":239}],238:[function(require,module,exports){ +},{"./attributes":232,"./calc":233,"./defaults":235,"./plot":237,"./style":238}],237:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42030,7 +41970,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":424,"d3":55,"fast-isnumeric":61}],239:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":427,"d3":55,"fast-isnumeric":61}],238:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42067,7 +42007,7 @@ module.exports = function style(traces) { }); }; -},{"../color":207,"d3":55}],240:[function(require,module,exports){ +},{"../color":207,"d3":55}],239:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42082,7 +42022,14 @@ var cartesianConstants = require('../../plots/cartesian/constants'); module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'image', + + visible: { + valType: 'boolean', + + dflt: true, + + }, source: { valType: 'string', @@ -42130,14 +42077,14 @@ module.exports = { }, x: { - valType: 'number', + valType: 'any', dflt: 0, }, y: { - valType: 'number', + valType: 'any', dflt: 0, @@ -42182,7 +42129,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":336}],241:[function(require,module,exports){ +},{"../../plots/cartesian/constants":338}],240:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42193,40 +42140,34 @@ module.exports = { 'use strict'; -var Axes = require('../../plots/cartesian/axes'); var Lib = require('../../lib'); -var attributes = require('./attributes'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var attributes = require('./attributes'); +var name = 'images'; module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { + var opts = { + name: name, + handleItemDefaults: imageDefaults + }; - if(!layoutIn.images || !Array.isArray(layoutIn.images)) return; - - - var containerIn = layoutIn.images, - containerOut = layoutOut.images = []; - - - for(var i = 0; i < containerIn.length; i++) { - var image = containerIn[i]; - - if(!image.source) continue; - - var defaulted = imageDefaults(containerIn[i] || {}, containerOut[i] || {}, layoutOut); - containerOut.push(defaulted); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function imageDefaults(imageIn, imageOut, fullLayout) { - imageOut = imageOut || {}; - function coerce(attr, dflt) { return Lib.coerce(imageIn, imageOut, attributes, attr, dflt); } - coerce('source'); + var source = coerce('source'); + var visible = coerce('visible', !!source); + + if(!visible) return imageOut; + coerce('layer'); coerce('x'); coerce('y'); @@ -42237,18 +42178,18 @@ function imageDefaults(imageIn, imageOut, fullLayout) { coerce('sizing'); coerce('opacity'); - for(var i = 0; i < 2; i++) { - var tdMock = { _fullLayout: fullLayout }, - axLetter = ['x', 'y'][i]; + var gdMock = { _fullLayout: fullLayout }, + axLetters = ['x', 'y']; + for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref - Axes.coerceRef(imageIn, imageOut, tdMock, axLetter, 'paper'); + Axes.coerceRef(imageIn, imageOut, gdMock, axLetters[i], 'paper'); } return imageOut; } -},{"../../lib":301,"../../plots/cartesian/axes":330,"./attributes":240}],242:[function(require,module,exports){ +},{"../../lib":303,"../../plots/array_container_defaults":330,"../../plots/cartesian/axes":333,"./attributes":239}],241:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42265,25 +42206,23 @@ var Axes = require('../../plots/cartesian/axes'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, imageDataAbove = [], imageDataSubplot = [], imageDataBelow = []; - if(!fullLayout.images) return; - - // Sort into top, subplot, and bottom layers for(var i = 0; i < fullLayout.images.length; i++) { var img = fullLayout.images[i]; - if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - imageDataSubplot.push(img); - } else if(img.layer === 'above') { - imageDataAbove.push(img); - } else { - imageDataBelow.push(img); + if(img.visible) { + if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { + imageDataSubplot.push(img); + } else if(img.layer === 'above') { + imageDataAbove.push(img); + } else { + imageDataBelow.push(img); + } } } @@ -42352,12 +42291,12 @@ module.exports = function draw(gd) { var thisImage = d3.select(this); // Axes if specified - var xref = Axes.getFromId(gd, d.xref), - yref = Axes.getFromId(gd, d.yref); + var xa = Axes.getFromId(gd, d.xref), + ya = Axes.getFromId(gd, d.yref); var size = fullLayout._size, - width = xref ? Math.abs(xref.l2p(d.sizex) - xref.l2p(0)) : d.sizex * size.w, - height = yref ? Math.abs(yref.l2p(d.sizey) - yref.l2p(0)) : d.sizey * size.h; + width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w, + height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset, @@ -42366,8 +42305,8 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xref ? xref.l2p(d.x) + xref._offset : d.x * size.w + size.l) + xOffset, - yPos = (yref ? yref.l2p(d.y) + yref._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset, + yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; // Construct the proper aspectRatio attribute @@ -42392,8 +42331,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xref ? xref._id : '', - yId = yref ? yref._id : '', + var xId = xa ? xa._id : '', + yId = ya ? ya._id : '', clipAxes = xId + yId; if(clipAxes) { @@ -42430,7 +42369,7 @@ module.exports = function draw(gd) { }); }; -},{"../../constants/xmlns_namespaces":291,"../../plots/cartesian/axes":330,"../drawing":231,"d3":55}],243:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":291,"../../plots/cartesian/axes":333,"../drawing":230,"d3":55}],242:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42441,21 +42380,17 @@ module.exports = function draw(gd) { 'use strict'; - -var draw = require('./draw'); -var supplyLayoutDefaults = require('./defaults'); -var attributes = require('./attributes'); - - module.exports = { moduleType: 'component', name: 'images', - draw: draw, - layoutAttributes: attributes, - supplyLayoutDefaults: supplyLayoutDefaults + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), + + draw: require('./draw') }; -},{"./attributes":240,"./defaults":241,"./draw":242}],244:[function(require,module,exports){ +},{"./attributes":239,"./defaults":240,"./draw":241}],243:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42504,7 +42439,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],245:[function(require,module,exports){ +},{}],244:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42595,7 +42530,7 @@ module.exports = { } }; -},{"../../lib/extend":297,"../../plots/font_attributes":351,"../color/attributes":206}],246:[function(require,module,exports){ +},{"../../lib/extend":298,"../../plots/font_attributes":353,"../color/attributes":206}],245:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42613,7 +42548,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],247:[function(require,module,exports){ +},{}],246:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -42706,7 +42641,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":301,"../../plots/layout_attributes":357,"../../registry":366,"./attributes":245,"./helpers":250}],248:[function(require,module,exports){ +},{"../../lib":303,"../../plots/layout_attributes":359,"../../registry":368,"./attributes":244,"./helpers":249}],247:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43422,7 +43357,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../lib":301,"../../lib/svg_text_utils":315,"../../plotly":326,"../../plots/plots":359,"../../registry":366,"../color":207,"../dragelement":229,"../drawing":231,"./anchor_utils":244,"./constants":246,"./get_legend_data":249,"./helpers":250,"./style":252,"d3":55}],249:[function(require,module,exports){ +},{"../../lib":303,"../../lib/svg_text_utils":317,"../../plotly":328,"../../plots/plots":361,"../../registry":368,"../color":207,"../dragelement":228,"../drawing":230,"./anchor_utils":243,"./constants":245,"./get_legend_data":248,"./helpers":249,"./style":251,"d3":55}],248:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43527,7 +43462,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":366,"./helpers":250}],250:[function(require,module,exports){ +},{"../../registry":368,"./helpers":249}],249:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43558,7 +43493,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":366}],251:[function(require,module,exports){ +},{"../../registry":368}],250:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43571,22 +43506,18 @@ exports.isReversed = function isReversed(legendLayout) { 'use strict'; -var legend = module.exports = {}; - - -legend.moduleType = 'component'; - -legend.name = 'legend'; - -legend.layoutAttributes = require('./attributes'); - -legend.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'legend', -legend.draw = require('./draw'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -legend.style = require('./style'); + draw: require('./draw'), + style: require('./style') +}; -},{"./attributes":245,"./defaults":247,"./draw":248,"./style":252}],252:[function(require,module,exports){ +},{"./attributes":244,"./defaults":246,"./draw":247,"./style":251}],251:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -43808,7 +43739,7 @@ function stylePies(d) { if(pts.size()) pts.call(stylePie, d[0], trace); } -},{"../../lib":301,"../../registry":366,"../../traces/pie/style_one":398,"../../traces/scatter/subtypes":424,"../color":207,"../drawing":231,"d3":55}],253:[function(require,module,exports){ +},{"../../lib":303,"../../registry":368,"../../traces/pie/style_one":401,"../../traces/scatter/subtypes":427,"../color":207,"../drawing":230,"d3":55}],252:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44318,7 +44249,7 @@ modeBarButtons.resetViews = { } }; -},{"../../../build/ploticon":2,"../../lib":301,"../../plotly":326,"../../plots/cartesian/axes":330,"../../plots/plots":359,"../../snapshot/download":368}],254:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":303,"../../plotly":328,"../../plots/cartesian/axes":333,"../../plots/plots":361,"../../snapshot/download":370}],253:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44332,7 +44263,7 @@ modeBarButtons.resetViews = { exports.manage = require('./manage'); -},{"./manage":255}],255:[function(require,module,exports){ +},{"./manage":254}],254:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44560,7 +44491,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":330,"../../traces/scatter/subtypes":424,"./buttons":253,"./modebar":256}],256:[function(require,module,exports){ +},{"../../plots/cartesian/axes":333,"../../traces/scatter/subtypes":427,"./buttons":252,"./modebar":255}],255:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44850,7 +44781,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":301,"d3":55}],257:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":303,"d3":55}],256:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44867,7 +44798,8 @@ var extendFlat = require('../../lib/extend').extendFlat; var buttonAttrs = require('./button_attributes'); buttonAttrs = extendFlat(buttonAttrs, { - _isLinkedToArray: true, + _isLinkedToArray: 'button', + }); @@ -44939,7 +44871,7 @@ module.exports = { } }; -},{"../../lib/extend":297,"../../plots/font_attributes":351,"../color/attributes":206,"./button_attributes":258}],258:[function(require,module,exports){ +},{"../../lib/extend":298,"../../plots/font_attributes":353,"../color/attributes":206,"./button_attributes":257}],257:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -44980,7 +44912,7 @@ module.exports = { } }; -},{}],259:[function(require,module,exports){ +},{}],258:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45009,7 +44941,7 @@ module.exports = { darkAmount: 10 }; -},{}],260:[function(require,module,exports){ +},{}],259:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45102,7 +45034,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":301,"../color":207,"./attributes":257,"./button_attributes":258,"./constants":259}],261:[function(require,module,exports){ +},{"../../lib":303,"../color":207,"./attributes":256,"./button_attributes":257,"./constants":258}],260:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45377,7 +45309,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":315,"../../plotly":326,"../../plots/cartesian/axis_ids":333,"../../plots/plots":359,"../color":207,"../drawing":231,"../legend/anchor_utils":244,"./constants":259,"./get_update_object":262,"d3":55}],262:[function(require,module,exports){ +},{"../../lib/svg_text_utils":317,"../../plotly":328,"../../plots/cartesian/axis_ids":336,"../../plots/plots":361,"../color":207,"../drawing":230,"../legend/anchor_utils":243,"./constants":258,"./get_update_object":261,"d3":55}],261:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45391,6 +45323,8 @@ function reposition(gd, buttons, opts, axName) { var d3 = require('d3'); +var Lib = require('../../lib'); + module.exports = function getUpdateObject(axisLayout, buttonLayout) { var axName = axisLayout._name; @@ -45411,7 +45345,7 @@ module.exports = function getUpdateObject(axisLayout, buttonLayout) { function getXRange(axisLayout, buttonLayout) { var currentRange = axisLayout.range; - var base = new Date(currentRange[1]); + var base = new Date(Lib.dateTime2ms(currentRange[1])); var step = buttonLayout.step, count = buttonLayout.count; @@ -45420,13 +45354,13 @@ function getXRange(axisLayout, buttonLayout) { switch(buttonLayout.stepmode) { case 'backward': - range0 = d3.time[step].offset(base, -count).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].offset(base, -count)); break; case 'todate': - var base2 = d3.time[step].offset(base, -(count - 1)); + var base2 = d3.time[step].offset(base, -count); - range0 = d3.time[step].floor(base2).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].ceil(base2)); break; } @@ -45435,7 +45369,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":55}],263:[function(require,module,exports){ +},{"../../lib":303,"d3":55}],262:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45446,18 +45380,18 @@ function getXRange(axisLayout, buttonLayout) { 'use strict'; +module.exports = { + moduleType: 'component', + name: 'rangeselector', -exports.moduleType = 'component'; - -exports.name = 'rangeselector'; - -exports.layoutAttributes = require('./attributes'); - -exports.handleDefaults = require('./defaults'); + layoutNodes: ['xaxis.'], + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":257,"./defaults":260,"./draw":261}],264:[function(require,module,exports){ +},{"./attributes":256,"./defaults":259,"./draw":260}],263:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45494,8 +45428,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -45515,7 +45449,7 @@ module.exports = { } }; -},{"../color/attributes":206}],265:[function(require,module,exports){ +},{"../color/attributes":206}],264:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45568,7 +45502,7 @@ module.exports = { handleStroke: '#666', }; -},{}],266:[function(require,module,exports){ +},{}],265:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45592,7 +45526,8 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe } var containerIn = layoutIn[axName].rangeslider, - containerOut = layoutOut[axName].rangeslider = {}; + axOut = layoutOut[axName], + containerOut = axOut.rangeslider = {}; function coerce(attr, dflt) { return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); @@ -45606,14 +45541,16 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe coerce('range'); // Expand slider range to the axis range - if(containerOut.range && !layoutOut[axName].autorange) { + if(containerOut.range && !axOut.autorange) { var outRange = containerOut.range, - axRange = layoutOut[axName].range; + axRange = axOut.range, + l2r = axOut.l2r, + r2l = axOut.r2l; - outRange[0] = Math.min(outRange[0], axRange[0]); - outRange[1] = Math.max(outRange[1], axRange[1]); + outRange[0] = l2r(Math.min(r2l(outRange[0]), r2l(axRange[0]))); + outRange[1] = l2r(Math.max(r2l(outRange[1]), r2l(axRange[1]))); } else { - layoutOut[axName]._needsExpand = true; + axOut._needsExpand = true; } if(containerOut.visible) { @@ -45628,7 +45565,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe containerOut._input = containerIn; }; -},{"../../lib":301,"./attributes":264}],267:[function(require,module,exports){ +},{"../../lib":303,"./attributes":263}],266:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -45735,20 +45672,10 @@ module.exports = function(gd) { rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); - // update inner nodes - - rangeSlider - .call(drawBg, gd, axisOpts, opts) - .call(addClipPath, gd, axisOpts, opts) - .call(drawRangePlot, gd, axisOpts, opts) - .call(drawMasks, gd, axisOpts, opts) - .call(drawSlideBox, gd, axisOpts, opts) - .call(drawGrabbers, gd, axisOpts, opts); - // update data <--> pixel coordinate conversion methods - var range0 = opts.range[0], - range1 = opts.range[1], + var range0 = axisOpts.r2l(opts.range[0]), + range1 = axisOpts.r2l(opts.range[1]), dist = range1 - range0; opts.p2d = function(v) { @@ -45759,6 +45686,18 @@ module.exports = function(gd) { return (v - range0) / dist * opts._width; }; + opts._rl = [range0, range1]; + + // update inner nodes + + rangeSlider + .call(drawBg, gd, axisOpts, opts) + .call(addClipPath, gd, axisOpts, opts) + .call(drawRangePlot, gd, axisOpts, opts) + .call(drawMasks, gd, axisOpts, opts) + .call(drawSlideBox, gd, axisOpts, opts) + .call(drawGrabbers, gd, axisOpts, opts); + // setup drag element setupDragElement(rangeSlider, gd, axisOpts, opts); @@ -45796,8 +45735,8 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { target = event.target, startX = event.clientX, offsetX = startX - rangeSlider.node().getBoundingClientRect().left, - minVal = opts.d2p(axisOpts.range[0]), - maxVal = opts.d2p(axisOpts.range[1]); + minVal = opts.d2p(axisOpts._rl[0]), + maxVal = opts.d2p(axisOpts._rl[1]); var dragCover = dragElement.coverSlip(); @@ -45858,7 +45797,7 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { function setDataRange(rangeSlider, gd, axisOpts, opts) { function clamp(v) { - return Lib.constrain(v, opts.range[0], opts.range[1]); + return axisOpts.l2r(Lib.constrain(v, opts._rl[0], opts._rl[1])); } var dataMin = clamp(opts.p2d(opts._pixelMin)), @@ -45875,8 +45814,8 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts) { return Lib.constrain(v, 0, opts._width); } - var pixelMin = clamp(opts.d2p(axisOpts.range[0])), - pixelMax = clamp(opts.d2p(axisOpts.range[1])); + var pixelMin = clamp(opts.d2p(axisOpts._rl[0])), + pixelMax = clamp(opts.d2p(axisOpts._rl[1])); rangeSlider.select('rect.' + constants.slideBoxClassName) .attr('x', pixelMin) @@ -45969,6 +45908,7 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) { data: [], layout: { xaxis: { + type: axisOpts.type, domain: [0, 1], range: opts.range.slice() }, @@ -46150,7 +46090,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":301,"../../lib/setcursor":311,"../../plotly":326,"../../plots/cartesian":339,"../../plots/cartesian/axes":330,"../../plots/plots":359,"../color":207,"../dragelement":229,"../drawing":231,"./constants":265,"d3":55}],268:[function(require,module,exports){ +},{"../../lib":303,"../../lib/setcursor":313,"../../plotly":328,"../../plots/cartesian":341,"../../plots/cartesian/axes":333,"../../plots/plots":361,"../color":207,"../dragelement":228,"../drawing":230,"./constants":264,"d3":55}],267:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46164,12 +46104,15 @@ function clearPushMargins(gd) { module.exports = { moduleType: 'component', name: 'rangeslider', + + layoutNodes: ['xaxis.'], layoutAttributes: require('./attributes'), handleDefaults: require('./defaults'), + draw: require('./draw') }; -},{"./attributes":264,"./defaults":266,"./draw":267}],269:[function(require,module,exports){ +},{"./attributes":263,"./defaults":265,"./draw":266}],268:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46187,7 +46130,14 @@ var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'shape', + + visible: { + valType: 'boolean', + + dflt: true, + + }, type: { valType: 'enumerated', @@ -46260,7 +46210,7 @@ module.exports = { } }; -},{"../../lib/extend":297,"../../traces/scatter/attributes":404,"../annotations/attributes":200}],270:[function(require,module,exports){ +},{"../../lib/extend":298,"../../traces/scatter/attributes":407,"../annotations/attributes":200}],269:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46272,6 +46222,7 @@ module.exports = { 'use strict'; +var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); var constants = require('./constants'); @@ -46280,7 +46231,7 @@ var helpers = require('./helpers'); module.exports = function calcAutorange(gd) { var fullLayout = gd._fullLayout, - shapeList = fullLayout.shapes; + shapeList = Lib.filterVisible(fullLayout.shapes); if(!shapeList.length || !gd._fullData.length) return; @@ -46336,7 +46287,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../plots/cartesian/axes":330,"./constants":271,"./helpers":274}],271:[function(require,module,exports){ +},{"../../lib":303,"../../plots/cartesian/axes":333,"./constants":270,"./helpers":273}],270:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46400,7 +46351,7 @@ module.exports = { } }; -},{}],272:[function(require,module,exports){ +},{}],271:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46412,22 +46363,20 @@ module.exports = { 'use strict'; +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var handleShapeDefaults = require('./shape_defaults'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - var containerIn = layoutIn.shapes || [], - containerOut = layoutOut.shapes = []; - - for(var i = 0; i < containerIn.length; i++) { - var shapeIn = containerIn[i] || {}, - shapeOut = handleShapeDefaults(shapeIn, layoutOut); + var opts = { + name: 'shapes', + handleItemDefaults: handleShapeDefaults + }; - containerOut.push(shapeOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"./shape_defaults":276}],273:[function(require,module,exports){ +},{"../../plots/array_container_defaults":330,"./shape_defaults":275}],272:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -46479,7 +46428,9 @@ function draw(gd) { fullLayout._shapeSubplotLayer.selectAll('path').remove(); for(var i = 0; i < fullLayout.shapes.length; i++) { - drawOne(gd, i); + if(fullLayout.shapes[i].visible) { + drawOne(gd, i); + } } // may need to resurrect this if we put text (LaTeX) in shapes @@ -46599,8 +46550,6 @@ function updateShape(gd, index, opt, value) { // TODO: clean this up and remove it. if(!optionsIn) return; - var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; - // alter the input shape as requested var optionsEdit = {}; if(typeof opt === 'string' && opt) optionsEdit[opt] = value; @@ -46612,7 +46561,12 @@ function updateShape(gd, index, opt, value) { Lib.nestedProperty(optionsIn, k).set(optionsEdit[k]); } - var posAttrs = ['x0', 'x1', 'y0', 'y1']; + // return early in visible: false updates + if(optionsIn.visible === false) return; + + var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}, + posAttrs = ['x0', 'x1', 'y0', 'y1']; + for(i = 0; i < 4; i++) { var posAttr = posAttrs[i]; // if we don't have an explicit position already, @@ -46627,18 +46581,17 @@ function updateShape(gd, index, opt, value) { var axLetter = posAttr.charAt(0), axOld = Axes.getFromId(gd, - Axes.coerceRef(oldRef, {}, gd, axLetter)), + Axes.coerceRef(oldRef, {}, gd, axLetter, '', 'paper')), axNew = Axes.getFromId(gd, - Axes.coerceRef(optionsIn, {}, gd, axLetter)), + Axes.coerceRef(optionsIn, {}, gd, axLetter, '', 'paper')), position = optionsIn[posAttr], - linearizedPosition; + rangePosition; if(optionsEdit[axLetter + 'ref'] !== undefined) { // first convert to fraction of the axis if(axOld) { - linearizedPosition = helpers.dataToLinear(axOld)(position); - position = (linearizedPosition - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + rangePosition = helpers.shapePositionToRange(axOld)(position); + position = axOld.r2fraction(rangePosition); } else { position = (position - axNew.domain[0]) / (axNew.domain[1] - axNew.domain[0]); @@ -46646,9 +46599,8 @@ function updateShape(gd, index, opt, value) { if(axNew) { // then convert to new data coordinates at the same fraction - linearizedPosition = axNew.range[0] + position * - (axNew.range[1] - axNew.range[0]); - position = helpers.linearToData(axNew)(linearizedPosition); + rangePosition = axNew.fraction2r(position); + position = helpers.rangeToShapePosition(axNew)(rangePosition); } else { // or scale to the whole plot position = axOld.domain[0] + @@ -46659,7 +46611,8 @@ function updateShape(gd, index, opt, value) { optionsIn[posAttr] = position; } - var options = handleShapeDefaults(optionsIn, gd._fullLayout); + var options = {}; + handleShapeDefaults(optionsIn, options, gd._fullLayout); gd._fullLayout.shapes[index] = options; var clipAxes; @@ -46893,22 +46846,22 @@ function getPathString(gd, options) { xa = Axes.getFromId(gd, options.xref), ya = Axes.getFromId(gd, options.yref), gs = gd._fullLayout._size, - x2l, + x2r, x2p, - y2l, + y2r, y2p; if(xa) { - x2l = helpers.dataToLinear(xa); - x2p = function(v) { return xa._offset + xa.l2p(x2l(v, true)); }; + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2l = helpers.dataToLinear(ya); - y2p = function(v) { return ya._offset + ya.l2p(y2l(v, true)); }; + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; @@ -46990,7 +46943,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":301,"../../lib/setcursor":311,"../../plotly":326,"../../plots/cartesian/axes":330,"../color":207,"../dragelement":229,"../drawing":231,"./constants":271,"./defaults":272,"./helpers":274,"./shape_defaults":276,"fast-isnumeric":61}],274:[function(require,module,exports){ +},{"../../lib":303,"../../lib/setcursor":313,"../../plotly":328,"../../plots/cartesian/axes":333,"../color":207,"../dragelement":228,"../drawing":230,"./constants":270,"./defaults":271,"./helpers":273,"./shape_defaults":275,"fast-isnumeric":61}],273:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47007,16 +46960,16 @@ function movePath(pathIn, moveX, moveY) { // so these have to be specified in terms of the category serial numbers, // but can take fractional values. Other axis types we specify position based on // the actual data values. -// TODO: this should really be part of axes, but for now it's only used here. -// eventually annotations and axis ranges will use this too. -// what should we do, invent a new letter for "data except if it's category"? +// TODO: in V2.0 (when log axis ranges are in data units) range and shape position +// will be identical, so rangeToShapePosition and shapePositionToRange can be +// removed entirely. -exports.dataToLinear = function(ax) { - return ax.type === 'category' ? ax.c2l : ax.d2l; +exports.rangeToShapePosition = function(ax) { + return (ax.type === 'log') ? ax.r2d : function(v) { return v; }; }; -exports.linearToData = function(ax) { - return ax.type === 'category' ? ax.l2c : ax.l2d; +exports.shapePositionToRange = function(ax) { + return (ax.type === 'log') ? ax.d2r : function(v) { return v; }; }; exports.decodeDate = function(convertToPx) { @@ -47035,10 +46988,10 @@ exports.getDataToPixel = function(gd, axis, isVertical) { dataToPixel; if(axis) { - var d2l = exports.dataToLinear(axis); + var d2r = exports.shapePositionToRange(axis); dataToPixel = function(v) { - return axis._offset + axis.l2p(d2l(v, true)); + return axis._offset + axis.r2p(d2r(v, true)); }; if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); @@ -47058,8 +47011,8 @@ exports.getPixelToData = function(gd, axis, isVertical) { pixelToData; if(axis) { - var l2d = exports.linearToData(axis); - pixelToData = function(p) { return l2d(axis.p2l(p - axis._offset)); }; + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; @@ -47071,7 +47024,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],275:[function(require,module,exports){ +},{}],274:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47083,21 +47036,21 @@ exports.getPixelToData = function(gd, axis, isVertical) { 'use strict'; -exports.moduleType = 'component'; - -exports.name = 'shapes'; - -exports.layoutAttributes = require('./attributes'); +var drawModule = require('./draw'); -exports.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'shapes', -exports.calcAutorange = require('./calc_autorange'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne +}; -},{"./attributes":269,"./calc_autorange":270,"./defaults":272,"./draw":273}],276:[function(require,module,exports){ +},{"./attributes":268,"./calc_autorange":269,"./defaults":271,"./draw":272}],275:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47115,13 +47068,19 @@ var Axes = require('../../plots/cartesian/axes'); var attributes = require('./attributes'); var helpers = require('./helpers'); -module.exports = function handleShapeDefaults(shapeIn, fullLayout) { - var shapeOut = {}; + +module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opts, itemOpts) { + opts = opts || {}; + itemOpts = itemOpts || {}; function coerce(attr, dflt) { return Lib.coerce(shapeIn, shapeOut, attributes, attr, dflt); } + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + + if(!visible) return shapeOut; + coerce('layer'); coerce('opacity'); coerce('fillcolor'); @@ -47136,39 +47095,61 @@ module.exports = function handleShapeDefaults(shapeIn, fullLayout) { var axLetters = ['x', 'y']; for(var i = 0; i < 2; i++) { var axLetter = axLetters[i], - tdMock = {_fullLayout: fullLayout}; + gdMock = {_fullLayout: fullLayout}; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, tdMock, axLetter); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); if(shapeType !== 'path') { var dflt0 = 0.25, - dflt1 = 0.75; + dflt1 = 0.75, + ax, + pos2r, + r2pos; if(axRef !== 'paper') { - var ax = Axes.getFromId(tdMock, axRef), - convertFn = helpers.linearToData(ax); - - dflt0 = convertFn(ax.range[0] + dflt0 * (ax.range[1] - ax.range[0])); - dflt1 = convertFn(ax.range[0] + dflt1 * (ax.range[1] - ax.range[0])); + ax = Axes.getFromId(gdMock, axRef); + r2pos = helpers.rangeToShapePosition(ax); + pos2r = helpers.shapePositionToRange(ax); + } + else { + pos2r = r2pos = Lib.identity; } + // hack until V2.0 when log has regular range behavior - make it look like other + // ranges to send to coerce, then put it back after + // this is all to give reasonable default position behavior on log axes, which is + // a pretty unimportant edge case so we could just ignore this. + var attr0 = axLetter + '0', + attr1 = axLetter + '1', + in0 = shapeIn[attr0], + in1 = shapeIn[attr1]; + shapeIn[attr0] = pos2r(shapeIn[attr0], true); + shapeIn[attr1] = pos2r(shapeIn[attr1], true); + // x0, x1 (and y0, y1) - coerce(axLetter + '0', dflt0); - coerce(axLetter + '1', dflt1); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr0, dflt0); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr1, dflt1); + + // hack part 2 + shapeOut[attr0] = r2pos(shapeOut[attr0]); + shapeOut[attr1] = r2pos(shapeOut[attr1]); + shapeIn[attr0] = in0; + shapeIn[attr1] = in1; } } if(shapeType === 'path') { coerce('path'); - } else { + } + else { Lib.noneOrAll(shapeIn, shapeOut, ['x0', 'x1', 'y0', 'y1']); } return shapeOut; }; -},{"../../lib":301,"../../plots/cartesian/axes":330,"./attributes":269,"./helpers":274}],277:[function(require,module,exports){ +},{"../../lib":303,"../../plots/cartesian/axes":333,"./attributes":268,"./helpers":273}],276:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47187,7 +47168,7 @@ var animationAttrs = require('../../plots/animation_attributes'); var constants = require('./constants'); var stepsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'step', method: { valType: 'enumerated', @@ -47220,6 +47201,8 @@ var stepsAttrs = { }; module.exports = { + _isLinkedToArray: 'slider', + visible: { valType: 'boolean', @@ -47400,7 +47383,7 @@ module.exports = { }, }; -},{"../../lib/extend":297,"../../plots/animation_attributes":327,"../../plots/font_attributes":351,"../../plots/pad_attributes":358,"./constants":278}],278:[function(require,module,exports){ +},{"../../lib/extend":298,"../../plots/animation_attributes":329,"../../plots/font_attributes":353,"../../plots/pad_attributes":360,"./constants":277}],277:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47415,9 +47398,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'sliders', - itemName: 'slider', // class names containerClassName: 'slider-container', @@ -47498,7 +47480,7 @@ module.exports = { currentValueInset: 0, }; -},{}],279:[function(require,module,exports){ +},{}],278:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47510,6 +47492,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -47519,23 +47502,12 @@ var stepAttrs = attributes.steps; module.exports = function slidersDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var sliderIn = contIn[i] || {}, - sliderOut = {}; - - sliderDefaults(sliderIn, sliderOut, layoutOut); - - // used on button click to update the 'active' field - sliderOut._input = sliderIn; - - // used to determine object constancy - sliderOut._index = i; + var opts = { + name: name, + handleItemDefaults: sliderDefaults + }; - contOut.push(sliderOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function sliderDefaults(sliderIn, sliderOut, layoutOut) { @@ -47621,7 +47593,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":301,"./attributes":277,"./constants":278}],280:[function(require,module,exports){ +},{"../../lib":303,"../../plots/array_container_defaults":330,"./attributes":276,"./constants":277}],279:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47990,6 +47962,7 @@ function handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, doTransiti } function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) { + var previousActive = sliderOpts.active; sliderOpts._input.active = sliderOpts.active = index; var step = sliderOpts.steps[sliderOpts.active]; @@ -47997,6 +47970,13 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) sliderGroup.call(setGripPosition, sliderOpts, sliderOpts.active / (sliderOpts.steps.length - 1), doTransition); sliderGroup.call(drawCurrentValue, sliderOpts); + gd.emit('plotly_sliderchange', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active], + interaction: doCallback, + previousActive: previousActive + }); + if(step && step.method && doCallback) { if(sliderGroup._nextMethod) { // If we've already queued up an update, just overwrite it with the most recent: @@ -48023,6 +48003,8 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { var $gd = d3.select(gd); item.on('mousedown', function() { + gd.emit('plotly_sliderstart', {slider: sliderOpts}); + var grip = sliderGroup.select('.' + constants.gripRectClass); d3.event.stopPropagation(); @@ -48043,6 +48025,11 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { grip.call(Color.fill, sliderOpts.bgcolor); $gd.on('mouseup', null); $gd.on('mousemove', null); + + gd.emit('plotly_sliderend', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active] + }); }); }); } @@ -48180,7 +48167,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":301,"../../lib/svg_text_utils":315,"../../plots/plots":359,"../color":207,"../drawing":231,"../legend/anchor_utils":244,"./constants":278,"d3":55}],281:[function(require,module,exports){ +},{"../../lib":303,"../../lib/svg_text_utils":317,"../../plots/plots":361,"../color":207,"../drawing":230,"../legend/anchor_utils":243,"./constants":277,"d3":55}],280:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48191,18 +48178,19 @@ function clearPushMargins(gd) { 'use strict'; +var constants = require('./constants'); -exports.moduleType = 'component'; - -exports.name = 'sliders'; - -exports.layoutAttributes = require('./attributes'); +module.exports = { + moduleType: 'component', + name: constants.name, -exports.supplyLayoutDefaults = require('./defaults'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":277,"./defaults":279,"./draw":280}],282:[function(require,module,exports){ +},{"./attributes":276,"./constants":277,"./defaults":278,"./draw":279}],281:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48432,7 +48420,7 @@ Titles.draw = function(gd, titleClass, options) { el.classed('js-placeholder', isplaceholder); }; -},{"../../lib":301,"../../lib/svg_text_utils":315,"../../plotly":326,"../../plots/plots":359,"../color":207,"../drawing":231,"d3":55,"fast-isnumeric":61}],283:[function(require,module,exports){ +},{"../../lib":303,"../../lib/svg_text_utils":317,"../../plotly":328,"../../plots/plots":361,"../color":207,"../drawing":230,"d3":55,"fast-isnumeric":61}],282:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48449,7 +48437,7 @@ var extendFlat = require('../../lib/extend').extendFlat; var padAttrs = require('../../plots/pad_attributes'); var buttonsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'button', method: { valType: 'enumerated', @@ -48478,7 +48466,7 @@ var buttonsAttrs = { }; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'updatemenu', visible: { valType: 'boolean', @@ -48578,7 +48566,7 @@ module.exports = { } }; -},{"../../lib/extend":297,"../../plots/font_attributes":351,"../../plots/pad_attributes":358,"../color/attributes":206}],284:[function(require,module,exports){ +},{"../../lib/extend":298,"../../plots/font_attributes":353,"../../plots/pad_attributes":360,"../color/attributes":206}],283:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48593,9 +48581,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'updatemenus', - itemName: 'updatemenu', // class names containerClassName: 'updatemenu-container', @@ -48655,7 +48642,7 @@ module.exports = { hoverColor: '#F4FAFF' }; -},{}],285:[function(require,module,exports){ +},{}],284:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48667,6 +48654,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -48676,23 +48664,12 @@ var buttonAttrs = attributes.buttons; module.exports = function updateMenusDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var menuIn = contIn[i] || {}, - menuOut = {}; - - menuDefaults(menuIn, menuOut, layoutOut); - - // used on button click to update the 'active' field - menuOut._input = menuIn; - - // used to determine object constancy - menuOut._index = i; + var opts = { + name: name, + handleItemDefaults: menuDefaults + }; - contOut.push(menuOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function menuDefaults(menuIn, menuOut, layoutOut) { @@ -48759,7 +48736,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":301,"./attributes":283,"./constants":284}],286:[function(require,module,exports){ +},{"../../lib":303,"../../plots/array_container_defaults":330,"./attributes":282,"./constants":283}],285:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49061,6 +49038,8 @@ function drawButtons(gd, gHeader, gButton, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, buttonIndex); Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + + gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); button.on('mouseover', function() { @@ -49340,29 +49319,9 @@ function clearPushMargins(gd) { } } -},{"../../lib":301,"../../lib/svg_text_utils":315,"../../plots/plots":359,"../color":207,"../drawing":231,"../legend/anchor_utils":244,"./constants":284,"d3":55}],287:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - - -exports.moduleType = 'component'; - -exports.name = 'updatemenus'; - -exports.layoutAttributes = require('./attributes'); - -exports.supplyLayoutDefaults = require('./defaults'); - -exports.draw = require('./draw'); - -},{"./attributes":283,"./defaults":285,"./draw":286}],288:[function(require,module,exports){ +},{"../../lib":303,"../../lib/svg_text_utils":317,"../../plots/plots":361,"../color":207,"../drawing":230,"../legend/anchor_utils":243,"./constants":283,"d3":55}],286:[function(require,module,exports){ +arguments[4][280][0].apply(exports,arguments) +},{"./attributes":282,"./constants":283,"./defaults":284,"./draw":285,"dup":280}],287:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49383,7 +49342,7 @@ module.exports = { longdashdot: [8, 1, 1, 1] }; -},{}],289:[function(require,module,exports){ +},{}],288:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49406,6 +49365,48 @@ module.exports = { x: '❌' }; +},{}],289:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + + +module.exports = { + /** + * Standardize all missing data in calcdata to use undefined + * never null or NaN. + * That way we can use !==undefined, or !== BADNUM, + * to test for real data + */ + BADNUM: undefined, + + /* + * Limit certain operations to well below floating point max value + * to avoid glitches: Make sure that even when you multiply it by the + * number of pixels on a giant screen it still works + */ + FP_SAFE: Number.MAX_VALUE / 10000, + + /* + * conversion of date units to milliseconds + * year and month constants are marked "AVG" + * to remind us that not all years and months + * have the same length + */ + ONEAVGYEAR: 31557600000, // 365.25 days + ONEAVGMONTH: 2629800000, // 1/12 of ONEAVGYEAR + ONEDAY: 86400000, + ONEHOUR: 3600000, + ONEMIN: 60000, + ONESEC: 1000 +}; + },{}],290:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. @@ -49486,7 +49487,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.19.2'; +exports.version = '1.20.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -49547,7 +49548,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":205,"./components/images":243,"./components/legend":251,"./components/rangeselector":263,"./components/rangeslider":268,"./components/shapes":275,"./components/sliders":281,"./components/updatemenus":287,"./fonts/mathjax_config":293,"./lib/queue":309,"./plot_api/plot_schema":320,"./plot_api/register":321,"./plot_api/set_plot_config":322,"./plot_api/to_image":324,"./plot_api/validate":325,"./plotly":326,"./snapshot":371,"./snapshot/download":368,"./traces/scatter":414,"d3":55,"es6-promise":59}],293:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":205,"./components/images":242,"./components/legend":250,"./components/rangeselector":262,"./components/rangeslider":267,"./components/shapes":274,"./components/sliders":280,"./components/updatemenus":286,"./fonts/mathjax_config":293,"./lib/queue":311,"./plot_api/plot_schema":322,"./plot_api/register":323,"./plot_api/set_plot_config":324,"./plot_api/to_image":326,"./plot_api/validate":327,"./plotly":328,"./snapshot":373,"./snapshot/download":370,"./traces/scatter":417,"d3":55,"es6-promise":59}],293:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49590,22 +49591,50 @@ if(typeof MathJax !== 'undefined') { */ +'use strict'; + +var isNumeric = require('fast-isnumeric'); + +var BADNUM = require('../constants/numerical').BADNUM; + +// precompile these regex's for speed +var FRONTJUNK = /^['"%,$#\s']+/; +var ENDJUNK = /['"%,$#\s']+$/; + +/** + * cleanNumber: remove common leading and trailing cruft + * Always returns either a number or BADNUM. + */ +module.exports = function cleanNumber(v) { + if(typeof v === 'string') { + v = v.replace(FRONTJUNK, '').replace(ENDJUNK, ''); + } + + if(isNumeric(v)) return Number(v); + + return BADNUM; +}; + +},{"../constants/numerical":289,"fast-isnumeric":61}],295:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + 'use strict'; var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); -var nestedProperty = require('./nested_property'); -var isPlainObject = require('./is_plain_object'); -var filterUnique = require('./filter_unique'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); +var nestedProperty = require('./nested_property'); -var idRegex = /^([2-9]|[1-9][0-9]+)$/; - -function isValObject(obj) { - return obj && obj.valType !== undefined; -} +var ID_REGEX = /^([2-9]|[1-9][0-9]+)$/; exports.valObjects = { data_array: { @@ -49716,7 +49745,7 @@ exports.valObjects = { coerceFunction: function(v, propOut, dflt) { var dlen = dflt.length; if(typeof v === 'string' && v.substr(0, dlen) === dflt && - idRegex.test(v.substr(dlen))) { + ID_REGEX.test(v.substr(dlen))) { propOut.set(v); return; } @@ -49728,7 +49757,7 @@ exports.valObjects = { if(v === dflt) return true; if(typeof v !== 'string') return false; - if(v.substr(0, dlen) === dflt && idRegex.test(v.substr(dlen))) { + if(v.substr(0, dlen) === dflt && ID_REGEX.test(v.substr(dlen))) { return true; } @@ -49896,129 +49925,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -/* - * returns true for a valid value object and false for tree nodes in the attribute hierarchy - */ -exports.isValObject = isValObject; - -exports.IS_SUBPLOT_OBJ = '_isSubplotObj'; -exports.IS_LINKED_TO_ARRAY = '_isLinkedToArray'; -exports.DEPRECATED = '_deprecated'; - -// list of underscore attributes to keep in schema as is -exports.UNDERSCORE_ATTRS = [exports.IS_SUBPLOT_OBJ, exports.IS_LINKED_TO_ARRAY, exports.DEPRECATED]; - -/** - * Crawl the attribute tree, recursively calling a callback function - * - * @param {object} attrs - * The node of the attribute tree (e.g. the root) from which recursion originates - * @param {Function} callback - * A callback function with the signature: - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * @param {Number} [specifiedLevel] - * The level in the tree, in order to let the callback function detect descend or backtrack, - * typically unsupplied (implied 0), just used by the self-recursive call. - * The necessity arises because the tree traversal is not controlled by callback return values. - * The decision to not use callback return values for controlling tree pruning arose from - * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions - * precedes the callback call. - * - * @return {object} transformOut - * copy of transformIn that contains attribute defaults - */ -exports.crawl = function(attrs, callback, specifiedLevel) { - var level = specifiedLevel || 0; - Object.keys(attrs).forEach(function(attrName) { - var attr = attrs[attrName]; - - if(exports.UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - - callback(attr, attrName, attrs, level); - - if(isValObject(attr)) return; - if(isPlainObject(attr)) exports.crawl(attr, callback, level + 1); - }); -}; - -/** - * Find all data array attributes in a given trace object - including - * `arrayOk` attributes. - * - * @param {object} trace - * full trace object that contains a reference to `_module.attributes` - * - * @return {array} arrayAttributes - * list of array attributes for the given trace - */ -exports.findArrayAttributes = function(trace) { - var arrayAttributes = [], - stack = []; - - /** - * A closure that gathers attribute paths into its enclosed arraySplitAttributes - * Attribute paths are collected iff their leaf node is a splittable attribute - * - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * - * @closureVariable {String[][]} arrayAttributes the set of gathered attributes - * Example of filled closure variable (expected to be initialized to []): - * [["marker","size"],["marker","line","width"],["marker","line","color"]] - */ - function callback(attr, attrName, attrs, level) { - stack = stack.slice(0, level).concat([attrName]); - - var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; - if(!splittableAttr) return; - - var astr = toAttrString(stack); - var val = nestedProperty(trace, astr).get(); - if(!Array.isArray(val)) return; - - arrayAttributes.push(astr); - } - - function toAttrString(stack) { - return stack.join('.'); - } - - exports.crawl(trace._module.attributes, callback); - - if(trace.transforms) { - var transforms = trace.transforms; - - for(var i = 0; i < transforms.length; i++) { - var transform = transforms[i]; - - stack = ['transforms[' + i + ']']; - exports.crawl(transform._module.attributes, callback, 1); - } - } - - // Look into the fullInput module attributes for array attributes - // to make sure that 'custom' array attributes are detected. - // - // At the moment, we need this block to make sure that - // ohlc and candlestick 'open', 'high', 'low', 'close' can be - // used with filter ang groupby transforms. - if(trace._fullInput) { - exports.crawl(trace._fullInput._module.attributes, callback); - - arrayAttributes = filterUnique(arrayAttributes); - } - - return arrayAttributes; -}; - -},{"../components/colorscale/get_scale":220,"../components/colorscale/scales":226,"./filter_unique":298,"./is_plain_object":303,"./nested_property":306,"fast-isnumeric":61,"tinycolor2":182}],295:[function(require,module,exports){ +},{"../components/colorscale/get_scale":219,"../components/colorscale/scales":225,"./nested_property":308,"fast-isnumeric":61,"tinycolor2":182}],296:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50033,6 +49940,24 @@ exports.findArrayAttributes = function(trace) { var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); +var logError = require('./loggers').error; + +var constants = require('../constants/numerical'); +var BADNUM = constants.BADNUM; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + +// is an object a javascript date? +exports.isJSDate = function(v) { + return typeof v === 'object' && v !== null && typeof v.getTime === 'function'; +}; + +// The absolute limits of our date-time system +// This is a little weird: we use MIN_MS and MAX_MS in dateTime2ms +// but we use dateTime2ms to calculate them (after defining it!) +var MIN_MS, MAX_MS; /** * dateTime2ms - turn a date object or string s of the form @@ -50040,7 +49965,13 @@ var isNumeric = require('fast-isnumeric'); * per javascript standard) * may truncate after any full field, and sss can be any length * even >3 digits, though javascript dates truncate to milliseconds - * returns false if it doesn't find a date + * returns BADNUM if it doesn't find a date + * + * Expanded to support negative years to -9999 but you must always + * give 4 digits, except for 2-digit positive years which we assume are + * near the present time. + * Note that we follow ISO 8601:2004: there *is* a year 0, which + * is 1BC/BCE, and -1===2BC etc. * * 2-digit to 4-digit year conversion, where to cut off? * from http://support.microsoft.com/kb/244664: @@ -50048,85 +49979,123 @@ var isNumeric = require('fast-isnumeric'); * but in my mac chrome from eg. d=new Date(Date.parse('8/19/50')): * 1950-2049 * by Java, from http://stackoverflow.com/questions/2024273/: - * now-80 - now+20 + * now-80 - now+19 * or FileMaker Pro, from * http://www.filemaker.com/12help/html/add_view_data.4.21.html: - * now-70 - now+30 + * now-70 - now+29 * but python strptime etc, via * http://docs.python.org/py3k/library/time.html: * 1969-2068 (super forward-looking, but static, not sliding!) * - * lets go with now-70 to now+30, and if anyone runs into this problem + * lets go with now-70 to now+29, and if anyone runs into this problem * they can learn the hard way not to use 2-digit years, as no choice we * make now will cover all possibilities. mostly this will all be taken * care of in initial parsing, should only be an issue for hand-entered data - * currently (2012) this range is: - * 1942-2041 + * currently (2016) this range is: + * 1946-2045 */ exports.dateTime2ms = function(s) { // first check if s is a date object - try { - if(s.getTime) return +s; - } - catch(e) { - return false; + if(exports.isJSDate(s)) { + s = Number(s); + if(s >= MIN_MS && s <= MAX_MS) return s; + return BADNUM; } + // otherwise only accept strings and numbers + if(typeof s !== 'string' && typeof s !== 'number') return BADNUM; var y, m, d, h; // split date and time parts - var datetime = String(s).split(' '); - if(datetime.length > 2) return false; + // TODO: we strip leading/trailing whitespace but not other + // characters like we do for numbers - do we want to? + var datetime = String(s).trim().split(' '); + if(datetime.length > 2) return BADNUM; var p = datetime[0].split('-'); // date part - if(p.length > 3 || (p.length !== 3 && datetime[1])) return false; + + var CE = true; // common era, ie positive year + if(p[0] === '') { + // first part is blank: year starts with a minus sign + CE = false; + p.splice(0, 1); + } + + var plen = p.length; + if(plen > 3 || (plen !== 3 && datetime[1]) || !plen) return BADNUM; // year if(p[0].length === 4) y = Number(p[0]); else if(p[0].length === 2) { + if(!CE) return BADNUM; var yNow = new Date().getFullYear(); y = ((Number(p[0]) - yNow + 70) % 100 + 200) % 100 + yNow - 70; } - else return false; - if(!isNumeric(y)) return false; - if(p.length === 1) return new Date(y, 0, 1).getTime(); // year only + else return BADNUM; + if(!isNumeric(y)) return BADNUM; + + // javascript takes new Date(0..99,m,d) to mean 1900-1999, so + // to support years 0-99 we need to use setFullYear explicitly + var baseDate = new Date(0, 0, 1); + baseDate.setFullYear(CE ? y : -y); + if(p.length > 1) { + + // month - may be 1 or 2 digits + m = Number(p[1]) - 1; // new Date() uses zero-based months + if(p[1].length > 2 || !(m >= 0 && m <= 11)) return BADNUM; + baseDate.setMonth(m); + + if(p.length > 2) { + + // day - may be 1 or 2 digits + d = Number(p[2]); + if(p[2].length > 2 || !(d >= 1 && d <= 31)) return BADNUM; + baseDate.setDate(d); + + // does that date exist in this month? + if(baseDate.getDate() !== d) return BADNUM; + + if(datetime[1]) { - // month - m = Number(p[1]) - 1; // new Date() uses zero-based months - if(p[1].length > 2 || !(m >= 0 && m <= 11)) return false; - if(p.length === 2) return new Date(y, m, 1).getTime(); // year-month + p = datetime[1].split(':'); + if(p.length > 3) return BADNUM; - // day - d = Number(p[2]); - if(p[2].length > 2 || !(d >= 1 && d <= 31)) return false; + // hour - may be 1 or 2 digits + h = Number(p[0]); + if(p[0].length > 2 || !p[0].length || !(h >= 0 && h <= 23)) return BADNUM; + baseDate.setHours(h); - // now save the date part - d = new Date(y, m, d).getTime(); - if(!datetime[1]) return d; // year-month-day - p = datetime[1].split(':'); - if(p.length > 3) return false; + // does that hour exist in this day? (Daylight time!) + // (TODO: remove this check when we move to UTC) + if(baseDate.getHours() !== h) return BADNUM; - // hour - h = Number(p[0]); - if(p[0].length > 2 || !(h >= 0 && h <= 23)) return false; - d += 3600000 * h; - if(p.length === 1) return d; + if(p.length > 1) { + d = baseDate.getTime(); - // minute - m = Number(p[1]); - if(p[1].length > 2 || !(m >= 0 && m <= 59)) return false; - d += 60000 * m; - if(p.length === 2) return d; + // minute - must be 2 digits + m = Number(p[1]); + if(p[1].length !== 2 || !(m >= 0 && m <= 59)) return BADNUM; + d += ONEMIN * m; + if(p.length === 2) return d; - // second - s = Number(p[2]); - if(!(s >= 0 && s < 60)) return false; - return d + s * 1000; + // second (and milliseconds) - must have 2-digit seconds + if(p[2].split('.')[0].length !== 2) return BADNUM; + s = Number(p[2]); + if(!(s >= 0 && s < 60)) return BADNUM; + return d + s * ONESEC; + } + } + } + } + return baseDate.getTime(); }; +MIN_MS = exports.MIN_MS = exports.dateTime2ms('-9999'); +MAX_MS = exports.MAX_MS = exports.dateTime2ms('9999-12-31 23:59:59.9999'); + // is string s a date? (see above) exports.isDateTime = function(s) { - return (exports.dateTime2ms(s) !== false); + return (exports.dateTime2ms(s) !== BADNUM); }; // pad a number with zeroes, to given # of digits before the decimal point @@ -50135,224 +50104,68 @@ function lpad(val, digits) { } /** - * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.sss - * Crop any trailing zeros in time, but always leave full date - * (we could choose to crop '-01' from date too)... + * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.ssss + * Crop any trailing zeros in time, except never stop right after hours + * (we could choose to crop '-01' from date too but for now we always + * show the whole date) * Optional range r is the data range that applies, also in ms. * If rng is big, the later parts of time will be omitted */ +var NINETYDAYS = 90 * ONEDAY; +var THREEHOURS = 3 * ONEHOUR; +var FIVEMIN = 5 * ONEMIN; exports.ms2DateTime = function(ms, r) { + if(typeof ms !== 'number' || !(ms >= MIN_MS && ms <= MAX_MS)) return BADNUM; + if(!r) r = 0; - var d = new Date(ms), - s = d3.time.format('%Y-%m-%d')(d); - - if(r < 7776000000) { - // <90 days: add hours - s += ' ' + lpad(d.getHours(), 2); - if(r < 432000000) { - // <5 days: add minutes - s += ':' + lpad(d.getMinutes(), 2); - if(r < 10800000) { - // <3 hours: add seconds - s += ':' + lpad(d.getSeconds(), 2); - if(r < 300000) { - // <5 minutes: add ms - s += '.' + lpad(d.getMilliseconds(), 3); + var d = new Date(Math.floor(ms)), + dateStr = d3.time.format('%Y-%m-%d')(d), + // <90 days: add hours and minutes - never *only* add hours + h = (r < NINETYDAYS) ? d.getHours() : 0, + m = (r < NINETYDAYS) ? d.getMinutes() : 0, + // <3 hours: add seconds + s = (r < THREEHOURS) ? d.getSeconds() : 0, + // <5 minutes: add ms (plus one extra digit, this is msec*10) + msec10 = (r < FIVEMIN) ? Math.round((d.getMilliseconds() + (((ms % 1) + 1) % 1)) * 10) : 0; + + // include each part that has nonzero data in or after it + if(h || m || s || msec10) { + dateStr += ' ' + lpad(h, 2) + ':' + lpad(m, 2); + if(s || msec10) { + dateStr += ':' + lpad(s, 2); + if(msec10) { + var digits = 4; + while(msec10 % 10 === 0) { + digits -= 1; + msec10 /= 10; } + dateStr += '.' + lpad(msec10, digits); } } - // strip trailing zeros - return s.replace(/([:\s]00)*\.?[0]*$/, ''); } - return s; + return dateStr; }; -/** - * parseDate: forgiving attempt to turn any date string - * into a javascript date object - * - * first collate all the date formats we want to support, precompiled - * to d3 format objects see below for the string cleaning that happens - * before this separate out 2-digit (y) and 4-digit-year (Y) formats, - * formats with month names (b), and formats with am/pm (I) or no time (D) - * (also includes hour only, as the test is really for a colon) so we can - * cut down the number of tests we need to run for any given string - * (right now all are between 15 and 32 tests) - */ - -// TODO: this is way out of date vs. the server-side version -var timeFormats = { - // 24 hour - H: ['%H:%M:%S~%L', '%H:%M:%S', '%H:%M'], - // with am/pm - I: ['%I:%M:%S~%L%p', '%I:%M:%S%p', '%I:%M%p'], - // no colon, ie only date or date with hour (could also support eg 12h34m?) - D: ['%H', '%I%p', '%Hh'] -}; - -var dateFormats = { - Y: [ - '%Y~%m~%d', - '%Y%m%d', - '%y%m%d', // YYMMDD, has 6 digits together so will match Y, not y - '%m~%d~%Y', // MM/DD/YYYY has first precedence - '%d~%m~%Y' // then DD/MM/YYYY - ], - Yb: [ - '%b~%d~%Y', // eg nov 21 2013 - '%d~%b~%Y', // eg 21 nov 2013 - '%Y~%d~%b', // eg 2013 21 nov (or 2013 q3, after replacement) - '%Y~%b~%d' // eg 2013 nov 21 - ], - /** - * the two-digit year cases have so many potential ambiguities - * it's not even funny, but we'll try them anyway. - */ - y: [ - '%m~%d~%y', - '%d~%m~%y', - '%y~%m~%d' - ], - yb: [ - '%b~%d~%y', - '%d~%b~%y', - '%y~%d~%b', - '%y~%b~%d' - ] -}; - -// use utc formatter since we're ignoring timezone info -var formatter = d3.time.format.utc; - -/** - * ISO8601 and YYYYMMDDHHMMSS are the only ones where date and time - * are not separated by a space, so they get inserted specially here. - * Also a couple formats with no day (so time makes no sense) - */ -var dateTimeFormats = { - Y: { - H: ['%Y~%m~%dT%H:%M:%S', '%Y~%m~%dT%H:%M:%S~%L'].map(formatter), - I: [], - D: ['%Y%m%d%H%M%S', '%Y~%m', '%m~%Y'].map(formatter) - }, - Yb: {H: [], I: [], D: ['%Y~%b', '%b~%Y'].map(formatter)}, - y: {H: [], I: [], D: []}, - yb: {H: [], I: [], D: []} -}; -// all others get inserted in all possible combinations from dateFormats and timeFormats -['Y', 'Yb', 'y', 'yb'].forEach(function(dateType) { - dateFormats[dateType].forEach(function(dateFormat) { - // just a date (don't do just a time) - dateTimeFormats[dateType].D.push(formatter(dateFormat)); - ['H', 'I', 'D'].forEach(function(timeType) { - timeFormats[timeType].forEach(function(timeFormat) { - var a = dateTimeFormats[dateType][timeType]; - - // 'date time', then 'time date' - a.push(formatter(dateFormat + '~' + timeFormat)); - a.push(formatter(timeFormat + '~' + dateFormat)); - }); - }); - }); -}); - -// precompiled regexps for performance -var matchword = /[a-z]*/g, - shortenword = function(m) { return m.substr(0, 3); }, - weekdaymatch = /(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g, - separatormatch = /[\s,\/\-\.\(\)]+/g, - ampmmatch = /~?([ap])~?m(~|$)/, - replaceampm = function(m, ap) { return ap + 'm '; }, - match4Y = /\d\d\d\d/, - matchMonthName = /(^|~)[a-z]{3}/, - matchAMPM = /[ap]m/, - matchcolon = /:/, - matchquarter = /q([1-4])/, - quarters = ['31~mar', '30~jun', '30~sep', '31~dec'], - replacequarter = function(m, n) { return quarters[n - 1]; }, - matchTZ = / ?([+\-]\d\d:?\d\d|Z)$/; - -function getDateType(v) { - var dateType; - dateType = (match4Y.test(v) ? 'Y' : 'y'); - dateType = dateType + (matchMonthName.test(v) ? 'b' : ''); - return dateType; -} - -function getTimeType(v) { - var timeType; - timeType = matchcolon.test(v) ? (matchAMPM.test(v) ? 'I' : 'H') : 'D'; - return timeType; -} - -exports.parseDate = function(v) { - // is it already a date? just return it - if(v.getTime) return v; - /** - * otherwise, if it's not a string, return nothing - * the case of numbers that just have years will get - * dealt with elsewhere. - */ - if(typeof v !== 'string') return false; - - // first clean up the string a bit to reduce the number of formats we have to test - v = v.toLowerCase() - /** - * cut all words down to 3 characters - this will result in - * some spurious matches, ie whenever the first three characters - * of a word match a month or weekday but that seems more likely - * to fix typos than to make dates where they shouldn't be... - * and then we can omit the long form of months from our testing - */ - .replace(matchword, shortenword) - /** - * remove weekday names, as they get overridden anyway if they're - * inconsistent also removes a few more words - * (ie "tuesday the 26th of november") - * TODO: language support? - * for months too, but these seem to be built into d3 - */ - .replace(weekdaymatch, '') - /** - * collapse all separators one ~ at a time, except : which seems - * pretty consistent for the time part use ~ instead of space or - * something since d3 can eat a space as padding on 1-digit numbers - */ - .replace(separatormatch, '~') - // in case of a.m. or p.m. (also take off any space before am/pm) - .replace(ampmmatch, replaceampm) - // turn quarters Q1-4 into dates (quarter ends) - .replace(matchquarter, replacequarter) - .trim() - // also try to ignore timezone info, at least for now - .replace(matchTZ, ''); - - // now test against the various formats that might match - var out = null, - dateType = getDateType(v), - timeType = getTimeType(v), - formatList, - len; - - formatList = dateTimeFormats[dateType][timeType]; - len = formatList.length; - - for(var i = 0; i < len; i++) { - out = formatList[i].parse(v); - if(out) break; +// normalize date format to date string, in case it starts as +// a Date object or milliseconds +// optional dflt is the return value if cleaning fails +exports.cleanDate = function(v, dflt) { + if(exports.isJSDate(v) || typeof v === 'number') { + // NOTE: if someone puts in a year as a number rather than a string, + // this will mistakenly convert it thinking it's milliseconds from 1970 + // that is: '2012' -> Jan. 1, 2012, but 2012 -> 2012 epoch milliseconds + v = exports.ms2DateTime(+v); + if(!v && dflt !== undefined) return dflt; } - - // If not an instance of Date at this point, just return it. - if(!(out instanceof Date)) return false; - // parse() method interprets arguments with local time zone. - var tzoff = out.getTimezoneOffset(); - // In general (default) this is not what we want, so force into UTC: - out.setTime(out.getTime() + tzoff * 60 * 1000); - return out; + else if(!exports.isDateTime(v)) { + logError('unrecognized date', v); + return dflt; + } + return v; }; -},{"d3":55,"fast-isnumeric":61}],296:[function(require,module,exports){ +},{"../constants/numerical":289,"./loggers":306,"d3":55,"fast-isnumeric":61}],297:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50518,7 +50331,7 @@ var Events = { module.exports = Events; -},{"events":60}],297:[function(require,module,exports){ +},{"events":60}],298:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50632,7 +50445,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":303}],298:[function(require,module,exports){ +},{"./is_plain_object.js":305}],299:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50683,7 +50496,38 @@ module.exports = function filterUnique(array) { return out; }; -},{}],299:[function(require,module,exports){ +},{}],300:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +/** Filter out object items with visible !== true + * insider array container. + * + * @param {array of objects} container + * @return {array of objects} of length <= container + * + */ +module.exports = function filterVisible(container) { + var out = []; + + for(var i = 0; i < container.length; i++) { + var item = container[i]; + + if(item.visible === true) out.push(item); + } + + return out; +}; + +},{}],301:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50766,7 +50610,7 @@ function formatColor(containerIn, opacityIn, len) { module.exports = formatColor; -},{"../components/color/attributes":206,"../components/colorscale":222,"./str2rgbarray":314,"fast-isnumeric":61,"tinycolor2":182}],300:[function(require,module,exports){ +},{"../components/color/attributes":206,"../components/colorscale":221,"./str2rgbarray":316,"fast-isnumeric":61,"tinycolor2":182}],302:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50835,7 +50679,7 @@ function convertHTMLToUnicode(html) { module.exports = convertHTMLToUnicode; -},{"../constants/string_mappings":290,"superscript-text":179}],301:[function(require,module,exports){ +},{"../constants/string_mappings":290,"superscript-text":179}],303:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50861,19 +50705,15 @@ lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; lib.validate = coerceModule.validate; -lib.isValObject = coerceModule.isValObject; -lib.crawl = coerceModule.crawl; -lib.findArrayAttributes = coerceModule.findArrayAttributes; -lib.IS_SUBPLOT_OBJ = coerceModule.IS_SUBPLOT_OBJ; -lib.IS_LINKED_TO_ARRAY = coerceModule.IS_LINKED_TO_ARRAY; -lib.DEPRECATED = coerceModule.DEPRECATED; -lib.UNDERSCORE_ATTRS = coerceModule.UNDERSCORE_ATTRS; var datesModule = require('./dates'); lib.dateTime2ms = datesModule.dateTime2ms; lib.isDateTime = datesModule.isDateTime; lib.ms2DateTime = datesModule.ms2DateTime; -lib.parseDate = datesModule.parseDate; +lib.cleanDate = datesModule.cleanDate; +lib.isJSDate = datesModule.isJSDate; +lib.MIN_MS = datesModule.MIN_MS; +lib.MAX_MS = datesModule.MAX_MS; var searchModule = require('./search'); lib.findBin = searchModule.findBin; @@ -50914,6 +50754,10 @@ lib.error = loggersModule.error; lib.notifier = require('./notifier'); lib.filterUnique = require('./filter_unique'); +lib.filterVisible = require('./filter_visible'); + + +lib.cleanNumber = require('./clean_number'); /** * swap x and y of the same attribute in container cont @@ -51090,7 +50934,7 @@ lib.smooth = function(arrayIn, FWHM) { * as long as its returns are not promises (ie have no .then) * includes one argument arg to send to all functions... * this is mainly just to prevent us having to make wrapper functions - * when the only purpose of the wrapper is to reference gd / td + * when the only purpose of the wrapper is to reference gd * and a final step to be executed at the end * TODO: if there's an error and everything is sync, * this doesn't happen yet because we want to make sure @@ -51563,7 +51407,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./coerce":294,"./dates":295,"./extend":297,"./filter_unique":298,"./is_array":302,"./is_plain_object":303,"./loggers":304,"./matrix":305,"./nested_property":306,"./notifier":307,"./search":310,"./stats":313,"d3":55}],302:[function(require,module,exports){ +},{"./clean_number":294,"./coerce":295,"./dates":296,"./extend":298,"./filter_unique":299,"./filter_visible":300,"./is_array":304,"./is_plain_object":305,"./loggers":306,"./matrix":307,"./nested_property":308,"./notifier":309,"./search":312,"./stats":315,"d3":55}],304:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51581,7 +51425,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ArrayBuffer.isView(a); }; -},{}],303:[function(require,module,exports){ +},{}],305:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51610,7 +51454,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],304:[function(require,module,exports){ +},{}],306:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51677,7 +51521,7 @@ loggers.error = function() { } }; -},{"../plot_api/plot_config":319}],305:[function(require,module,exports){ +},{"../plot_api/plot_config":321}],307:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51787,7 +51631,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],306:[function(require,module,exports){ +},{}],308:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52044,7 +51888,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./is_array":302,"fast-isnumeric":61}],307:[function(require,module,exports){ +},{"./is_array":304,"fast-isnumeric":61}],309:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52121,7 +51965,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":55,"fast-isnumeric":61}],308:[function(require,module,exports){ +},{"d3":55,"fast-isnumeric":61}],310:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52361,7 +52205,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"./matrix":305}],309:[function(require,module,exports){ +},{"./matrix":307}],311:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52572,7 +52416,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":301,"../plot_api/plot_config":319}],310:[function(require,module,exports){ +},{"../lib":303,"../plot_api/plot_config":321}],312:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52683,7 +52527,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":304,"fast-isnumeric":61}],311:[function(require,module,exports){ +},{"./loggers":306,"fast-isnumeric":61}],313:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52706,7 +52550,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],312:[function(require,module,exports){ +},{}],314:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52755,7 +52599,7 @@ module.exports = function showWebGlMsg(scene) { return false; }; -},{"../components/color":207}],313:[function(require,module,exports){ +},{"../components/color":207}],315:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52851,7 +52695,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":61}],314:[function(require,module,exports){ +},{"fast-isnumeric":61}],316:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52873,7 +52717,7 @@ function str2RgbaArray(color) { module.exports = str2RgbaArray; -},{"arraytools":10,"tinycolor2":182}],315:[function(require,module,exports){ +},{"arraytools":10,"tinycolor2":182}],317:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52987,8 +52831,8 @@ exports.convertToTspans = function(_context, _callback) { } if(tex) { - var td = Lib.getPlotDiv(that.node()); - ((td && td._promises) || []).push(new Promise(function(resolve) { + var gd = Lib.getPlotDiv(that.node()); + ((gd && gd._promises) || []).push(new Promise(function(resolve) { that.style({visibility: 'hidden'}); var config = {fontSize: parseInt(that.style('font-size'), 10)}; @@ -53400,7 +53244,7 @@ exports.makeEditable = function(context, _delegate, options) { return d3.rebind(this, dispatch, 'on'); }; -},{"../constants/string_mappings":290,"../constants/xmlns_namespaces":291,"../lib":301,"d3":55}],316:[function(require,module,exports){ +},{"../constants/string_mappings":290,"../constants/xmlns_namespaces":291,"../lib":303,"d3":55}],318:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53434,7 +53278,7 @@ module.exports = function truncate(arrayIn, len) { throw new Error('This array type is not yet supported by `truncate`.'); }; -},{}],317:[function(require,module,exports){ +},{}],319:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53539,13 +53383,12 @@ exports.cleanLayout = function(layout) { } } - if(layout.annotations !== undefined && !Array.isArray(layout.annotations)) { - Lib.warn('Annotations must be an array.'); - delete layout.annotations; - } - var annotationsLen = (layout.annotations || []).length; + var annotationsLen = Array.isArray(layout.annotations) ? layout.annotations.length : 0; for(i = 0; i < annotationsLen; i++) { var ann = layout.annotations[i]; + + if(!Lib.isPlainObject(ann)) continue; + if(ann.ref) { if(ann.ref === 'paper') { ann.xref = 'paper'; @@ -53557,17 +53400,17 @@ exports.cleanLayout = function(layout) { } delete ann.ref; } + cleanAxRef(ann, 'xref'); cleanAxRef(ann, 'yref'); } - if(layout.shapes !== undefined && !Array.isArray(layout.shapes)) { - Lib.warn('Shapes must be an array.'); - delete layout.shapes; - } - var shapesLen = (layout.shapes || []).length; + var shapesLen = Array.isArray(layout.shapes) ? layout.shapes.length : 0; for(i = 0; i < shapesLen; i++) { var shape = layout.shapes[i]; + + if(!Lib.isPlainObject(shape)) continue; + cleanAxRef(shape, 'xref'); cleanAxRef(shape, 'yref'); } @@ -53916,7 +53759,7 @@ exports.manageArrayContainers = function(np, newVal, undoit) { } }; -},{"../components/color":207,"../lib":301,"../plots/cartesian/axes":330,"../plots/plots":359,"../registry":366,"fast-isnumeric":61,"gl-mat4/fromQuat":80}],318:[function(require,module,exports){ +},{"../components/color":207,"../lib":303,"../plots/cartesian/axes":333,"../plots/plots":361,"../registry":368,"fast-isnumeric":61,"gl-mat4/fromQuat":80}],320:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55836,13 +55679,14 @@ function _relayout(gd, aobj) { objList = layout[objType] || [], obji = objList[objNum] || {}; - // new API, remove annotation / shape with `null` - if(vi === null) aobj[ai] = 'remove'; - // if p.parts is just an annotation number, and val is either // 'add' or an entire annotation to add, the undo is 'remove' // if val is 'remove' then undo is the whole annotation object if(p.parts.length === 2) { + + // new API, remove annotation / shape with `null` + if(vi === null) aobj[ai] = 'remove'; + if(aobj[ai] === 'add' || Lib.isPlainObject(aobj[ai])) { undoit[ai] = 'remove'; } @@ -55877,6 +55721,7 @@ function _relayout(gd, aobj) { } // alter gd.layout else { + var pp1 = String(p.parts[1] || ''); // check whether we can short-circuit a full redraw // 3d or geo at this point just needs to redraw. if(p.parts[0].indexOf('scene') === 0) flags.doplot = true; @@ -55891,17 +55736,17 @@ function _relayout(gd, aobj) { else if(ai.indexOf('title') !== -1) flags.doticks = true; else if(p.parts[0].indexOf('bgcolor') !== -1) flags.dolayoutstyle = true; else if(p.parts.length > 1 && - Lib.containsAny(p.parts[1], ['tick', 'exponent', 'grid', 'zeroline'])) { + Lib.containsAny(pp1, ['tick', 'exponent', 'grid', 'zeroline'])) { flags.doticks = true; } else if(ai.indexOf('.linewidth') !== -1 && ai.indexOf('axis') !== -1) { flags.doticks = flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1].indexOf('line') !== -1) { + else if(p.parts.length > 1 && pp1.indexOf('line') !== -1) { flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1] === 'mirror') { + else if(p.parts.length > 1 && pp1 === 'mirror') { flags.doticks = flags.dolayoutstyle = true; } else if(ai === 'margin.pad') { @@ -55923,7 +55768,7 @@ function _relayout(gd, aobj) { */ else if(['hovermode', 'dragmode'].indexOf(ai) !== -1) flags.domodebar = true; else if(['hovermode', 'dragmode', 'height', - 'width', 'autosize'].indexOf(ai) === -1) { + 'width', 'autosize'].indexOf(ai) === -1) { flags.doplot = true; } @@ -56132,6 +55977,20 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } } + // Execute a callback after the wrapper function has been called n times. + // This is used to defer the resolution until a transition has resovled *and* + // the frame has completed. If it's not done this way, then we get a race + // condition in which the animation might resolve before a transition is complete + // or vice versa. + function callbackOnNthTime(cb, n) { + var cnt = 0; + return function() { + if(cb && ++cnt === n) { + return cb(); + } + }; + } + return new Promise(function(resolve, reject) { function discardExistingFrames() { if(trans._frameQueue.length === 0) { @@ -56176,14 +56035,13 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { frameOpts: frameOpts, transitionOpts: transitionOpts, }; - if(i === frameList.length - 1) { // The last frame in this .animate call stores the promise resolve // and reject callbacks. This is how we ensure that the animation // loop (which may exist as a result of a *different* .animate call) // still resolves or rejecdts this .animate call's promise. once it's // complete. - nextFrame.onComplete = resolve; + nextFrame.onComplete = callbackOnNthTime(resolve, 2); nextFrame.onInterrupt = reject; } @@ -56221,7 +56079,6 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { // Execute the callback and unset it to ensure it doesn't // accidentally get called twice trans._currentFrame.onComplete(); - trans._currentFrame.onComplete = null; } var newFrame = trans._currentFrame = trans._frameQueue.shift(); @@ -56241,7 +56098,12 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { helpers.coerceTraceIndices(gd, newFrame.frame.traces), newFrame.frameOpts, newFrame.transitionOpts - ); + ).then(function() { + if(newFrame.onComplete) { + newFrame.onComplete(); + } + + }); gd.emit('plotly_animatingframe', { name: newFrame.name, @@ -56317,6 +56179,8 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { for(i = 0; i < trans._frames.length; i++) { frame = trans._frames[i]; + if(!frame) continue; + if(allFrames || frame.group === frameOrGroupNameOrFrameList) { frameList.push({ type: 'byname', @@ -56328,14 +56192,15 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } else if(isFrameArray) { for(i = 0; i < frameOrGroupNameOrFrameList.length; i++) { var frameOrName = frameOrGroupNameOrFrameList[i]; - if(typeof frameOrName === 'string') { + if(['number', 'string'].indexOf(typeof frameOrName) !== -1) { + frameOrName = String(frameOrName); // In this case, there's an array and this frame is a string name: frameList.push({ type: 'byname', name: frameOrName, data: setTransitionConfig({name: frameOrName}) }); - } else { + } else if(Lib.isPlainObject(frameOrName)) { frameList.push({ type: 'object', data: setTransitionConfig(Lib.extendFlat({}, frameOrName)) @@ -56479,7 +56344,7 @@ Plotly.addFrames = function(gd, frameList, indices) { if(_hash[frame.name]) { // If frame is present, overwrite its definition: for(j = 0; j < _frames.length; j++) { - if(_frames[j].name === frame.name) break; + if((_frames[j] || {}).name === frame.name) break; } ops.push({type: 'replace', index: j, value: frame}); revops.unshift({type: 'replace', index: j, value: _frames[j]}); @@ -56679,7 +56544,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":231,"../components/errorbars":237,"../constants/xmlns_namespaces":291,"../lib":301,"../lib/events":296,"../lib/queue":309,"../lib/svg_text_utils":315,"../plotly":326,"../plots/cartesian/graph_interact":338,"../plots/plots":359,"../plots/polar":362,"../registry":366,"./helpers":317,"./subroutines":323,"d3":55,"fast-isnumeric":61}],319:[function(require,module,exports){ +},{"../components/drawing":230,"../components/errorbars":236,"../constants/xmlns_namespaces":291,"../lib":303,"../lib/events":297,"../lib/queue":311,"../lib/svg_text_utils":317,"../plotly":328,"../plots/cartesian/graph_interact":340,"../plots/plots":361,"../plots/polar":364,"../registry":368,"./helpers":319,"./subroutines":325,"d3":55,"fast-isnumeric":61}],321:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56799,7 +56664,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],320:[function(require,module,exports){ +},{}],322:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56811,185 +56676,287 @@ function defaultSetBackground(gd, bgColor) { 'use strict'; -var Plotly = require('../plotly'); var Registry = require('../registry'); -var Plots = require('../plots/plots'); var Lib = require('../lib'); -// FIXME polar attribute are not part of Plotly yet +var baseAttributes = require('../plots/attributes'); +var baseLayoutAttributes = require('../plots/layout_attributes'); +var frameAttributes = require('../plots/frame_attributes'); +var animationAttributes = require('../plots/animation_attributes'); + +// polar attributes are not part of the Registry yet var polarAreaAttrs = require('../plots/polar/area_attributes'); var polarAxisAttrs = require('../plots/polar/axis_attributes'); var extendFlat = Lib.extendFlat; var extendDeep = Lib.extendDeep; -var extendDeepAll = Lib.extendDeepAll; -var NESTED_MODULE = '_nestedModules', - COMPOSED_MODULE = '_composedModules'; +var IS_SUBPLOT_OBJ = '_isSubplotObj'; +var IS_LINKED_TO_ARRAY = '_isLinkedToArray'; +var DEPRECATED = '_deprecated'; +var UNDERSCORE_ATTRS = [IS_SUBPLOT_OBJ, IS_LINKED_TO_ARRAY, DEPRECATED]; -var plotSchema = { - traces: {}, - layout: {}, - transforms: {}, - defs: {} -}; +exports.IS_SUBPLOT_OBJ = IS_SUBPLOT_OBJ; +exports.IS_LINKED_TO_ARRAY = IS_LINKED_TO_ARRAY; +exports.DEPRECATED = DEPRECATED; +exports.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS; +/** Outputs the full plotly.js plot schema + * + * @return {object} + * - defs + * - traces + * - layout + * - transforms + * - frames + * - animations + * - config (coming soon ...) + */ +exports.get = function() { + var traces = {}; -var PlotSchema = module.exports = {}; + Registry.allTypes.concat('area').forEach(function(type) { + traces[type] = getTraceAttributes(type); + }); + var transforms = {}; -PlotSchema.get = function() { - Registry.allTypes - .concat('area') // FIXME polar 'area' attributes - .forEach(getTraceAttributes); + Object.keys(Registry.transformsRegistry).forEach(function(type) { + transforms[type] = getTransformAttributes(type); + }); - getLayoutAttributes(); + return { + defs: { + valObjects: Lib.valObjects, + metaKeys: UNDERSCORE_ATTRS.concat['description', 'role'] + }, - Object.keys(Registry.transformsRegistry).forEach(getTransformAttributes); + traces: traces, + layout: getLayoutAttributes(), - getDefs(); + transforms: transforms, - return plotSchema; + frames: formatAttributes(frameAttributes), + animation: formatAttributes(animationAttributes) + }; }; -PlotSchema.crawl = Lib.crawl; +/** + * Crawl the attribute tree, recursively calling a callback function + * + * @param {object} attrs + * The node of the attribute tree (e.g. the root) from which recursion originates + * @param {Function} callback + * A callback function with the signature: + * @callback callback + * @param {object} attr an attribute + * @param {String} attrName name string + * @param {object[]} attrs all the attributes + * @param {Number} level the recursion level, 0 at the root + * @param {Number} [specifiedLevel] + * The level in the tree, in order to let the callback function detect descend or backtrack, + * typically unsupplied (implied 0), just used by the self-recursive call. + * The necessity arises because the tree traversal is not controlled by callback return values. + * The decision to not use callback return values for controlling tree pruning arose from + * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions + * precedes the callback call. + * + * @return {object} transformOut + * copy of transformIn that contains attribute defaults + */ +exports.crawl = function(attrs, callback, specifiedLevel) { + var level = specifiedLevel || 0; -PlotSchema.isValObject = Lib.isValObject; + Object.keys(attrs).forEach(function(attrName) { + var attr = attrs[attrName]; -function getTraceAttributes(type) { - var globalAttributes = Plots.attributes, - _module = getModule({type: type}), - meta = getMeta(type), - subplotRegistry = getSubplotRegistry(type); + if(UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; + + callback(attr, attrName, attrs, level); - var attributes = {}, - layoutAttributes = {}; + if(exports.isValObject(attr)) return; - // make 'type' the first attribute in the object - attributes.type = null; + if(Lib.isPlainObject(attr)) exports.crawl(attr, callback, level + 1); + }); +}; - // global attributes (same for all trace types) - extendDeep(attributes, globalAttributes); +/** Is object a value object (or a container object)? + * + * @param {object} obj + * @return {boolean} + * returns true for a valid value object and + * false for tree nodes in the attribute hierarchy + */ +exports.isValObject = function(obj) { + return obj && obj.valType !== undefined; +}; - // module attributes (+ nested + composed) - attributes = coupleAttrs( - _module.attributes, attributes, 'attributes', type - ); +/** + * Find all data array attributes in a given trace object - including + * `arrayOk` attributes. + * + * @param {object} trace + * full trace object that contains a reference to `_module.attributes` + * + * @return {array} arrayAttributes + * list of array attributes for the given trace + */ +exports.findArrayAttributes = function(trace) { + var arrayAttributes = [], + stack = []; - // subplot attributes - if(subplotRegistry.attributes !== undefined) { - extendDeep(attributes, subplotRegistry.attributes); + function callback(attr, attrName, attrs, level) { + stack = stack.slice(0, level).concat([attrName]); + + var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; + if(!splittableAttr) return; + + var astr = toAttrString(stack); + var val = Lib.nestedProperty(trace, astr).get(); + if(!Array.isArray(val)) return; + + arrayAttributes.push(astr); } - // 'type' gets overwritten by globalAttributes; reset it here - attributes.type = type; + function toAttrString(stack) { + return stack.join('.'); + } - attributes = removeUnderscoreAttrs(attributes); - mergeValTypeAndRole(attributes); - plotSchema.traces[type] = extendFlat({}, - meta, - { attributes: attributes } - ); + exports.crawl(trace._module.attributes, callback); - // trace-specific layout attributes - if(_module.layoutAttributes !== undefined) { - layoutAttributes = coupleAttrs( - _module.layoutAttributes, layoutAttributes, 'layoutAttributes', type - ); + if(trace.transforms) { + var transforms = trace.transforms; - mergeValTypeAndRole(layoutAttributes); - plotSchema.traces[type].layoutAttributes = layoutAttributes; + for(var i = 0; i < transforms.length; i++) { + var transform = transforms[i]; + + stack = ['transforms[' + i + ']']; + exports.crawl(transform._module.attributes, callback, 1); + } } -} -function getLayoutAttributes() { - var globalLayoutAttributes = Plots.layoutAttributes, - layoutAttributes = {}; + // Look into the fullInput module attributes for array attributes + // to make sure that 'custom' array attributes are detected. + // + // At the moment, we need this block to make sure that + // ohlc and candlestick 'open', 'high', 'low', 'close' can be + // used with filter ang groupby transforms. + if(trace._fullInput) { + exports.crawl(trace._fullInput._module.attributes, callback); - // layout module attributes (+ nested + composed) - layoutAttributes = coupleAttrs( - globalLayoutAttributes, layoutAttributes, 'layoutAttributes', '*' - ); + arrayAttributes = Lib.filterUnique(arrayAttributes); + } - // FIXME polar layout attributes - layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); + return arrayAttributes; +}; - // add crawler.IS_SUBPLOT_OBJ attribute - layoutAttributes = handleSubplotObjs(layoutAttributes); +function getTraceAttributes(type) { + var _module, basePlotModule; - layoutAttributes = removeUnderscoreAttrs(layoutAttributes); - mergeValTypeAndRole(layoutAttributes); + if(type === 'area') { + _module = { attributes: polarAreaAttrs }; + basePlotModule = {}; + } + else { + _module = Registry.modules[type]._module, + basePlotModule = _module.basePlotModule; + } - // generate crawler.IS_LINKED_TO_ARRAY structure - handleLinkedToArray(layoutAttributes); + var attributes = {}; - plotSchema.layout = { layoutAttributes: layoutAttributes }; -} + // make 'type' the first attribute in the object + attributes.type = null; -function getTransformAttributes(name) { - var _module = Registry.transformsRegistry[name], - _schema = {}; + // base attributes (same for all trace types) + extendDeep(attributes, baseAttributes); - _schema = coupleAttrs(_schema, _module.attributes || {}, 'attributes', '*'); - _schema = removeUnderscoreAttrs(_schema); - mergeValTypeAndRole(_schema); - handleLinkedToArray(_schema); + // module attributes + extendDeep(attributes, _module.attributes); - plotSchema.transforms[name] = { attributes: _schema }; -} + // subplot attributes + if(basePlotModule.attributes) { + extendDeep(attributes, basePlotModule.attributes); + } -function getDefs() { - plotSchema.defs = { - valObjects: Lib.valObjects, - metaKeys: Lib.UNDERSCORE_ATTRS.concat(['description', 'role']) + // 'type' gets overwritten by baseAttributes; reset it here + attributes.type = type; + + var out = { + meta: _module.meta || {}, + attributes: formatAttributes(attributes), }; + + // trace-specific layout attributes + if(_module.layoutAttributes) { + var layoutAttributes = {}; + + extendDeep(layoutAttributes, _module.layoutAttributes); + out.layoutAttributes = formatAttributes(layoutAttributes); + } + + return out; } -function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) { - var nestedModule, nestedAttrs, nestedReference, - composedModule, composedAttrs; +function getLayoutAttributes() { + var layoutAttributes = {}; - Object.keys(attrsIn).forEach(function(k) { + // global layout attributes + extendDeep(layoutAttributes, baseLayoutAttributes); - if(k === NESTED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - nestedModule = getModule({_module: attrsIn[k][kk]}); - if(nestedModule === undefined) return; + // add base plot module layout attributes + Object.keys(Registry.subplotsRegistry).forEach(function(k) { + var _module = Registry.subplotsRegistry[k]; - nestedAttrs = nestedModule[whichAttrs]; - nestedReference = coupleAttrs( - nestedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - Lib.nestedProperty(attrsOut, kk) - .set(extendDeep({}, nestedReference)); - }); - return; + if(_module.name === 'cartesian') { + handleBasePlotModule(layoutAttributes, _module, 'xaxis'); + handleBasePlotModule(layoutAttributes, _module, 'yaxis'); } + else { + var astr = _module.attr === 'subplot' ? _module.name : _module.attr; - if(k === COMPOSED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - if(kk !== type) return; + handleBasePlotModule(layoutAttributes, _module, astr); + } + }); + + // polar layout attributes + layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); - composedModule = getModule({_module: attrsIn[k][kk]}); - if(composedModule === undefined) return; + // add registered components layout attribute + Object.keys(Registry.componentsRegistry).forEach(function(k) { + var _module = Registry.componentsRegistry[k]; - composedAttrs = composedModule[whichAttrs]; - composedAttrs = coupleAttrs( - composedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - extendDeepAll(attrsOut, composedAttrs); + if(Array.isArray(_module.layoutNodes)) { + _module.layoutNodes.forEach(function(v) { + handleRegisteredComponent(layoutAttributes, _module, v + _module.name); }); - return; } - - attrsOut[k] = Lib.isPlainObject(attrsIn[k]) ? - extendDeepAll({}, attrsIn[k]) : - attrsIn[k]; + else { + handleRegisteredComponent(layoutAttributes, _module, _module.name); + } }); - return attrsOut; + return { + layoutAttributes: formatAttributes(layoutAttributes) + }; +} + +function getTransformAttributes(type) { + var _module = Registry.transformsRegistry[type]; + + return { + attributes: formatAttributes(_module.attributes) + }; +} + +function formatAttributes(attrs) { + mergeValTypeAndRole(attrs); + formatArrayContainers(attrs); + + return attrs; } function mergeValTypeAndRole(attrs) { @@ -57003,7 +56970,7 @@ function mergeValTypeAndRole(attrs) { } function callback(attr, attrName, attrs) { - if(PlotSchema.isValObject(attr)) { + if(exports.isValObject(attr)) { if(attr.valType === 'data_array') { // all 'data_array' attrs have role 'data' attr.role = 'data'; @@ -57021,40 +56988,26 @@ function mergeValTypeAndRole(attrs) { } } - Lib.crawl(attrs, callback); + exports.crawl(attrs, callback); } -// helper methods +function formatArrayContainers(attrs) { -function getModule(arg) { - if('type' in arg) { - return (arg.type === 'area') ? // FIXME - { attributes: polarAreaAttrs } : - Registry.getModule({type: arg.type}); - } + function callback(attr, attrName, attrs) { + if(!attr) return; - var subplotsRegistry = Registry.subplotsRegistry, - componentsRegistry = Registry.componentsRegistry, - _module = arg._module; + var itemName = attr[IS_LINKED_TO_ARRAY]; - if(subplotsRegistry[_module]) return subplotsRegistry[_module]; - else if(componentsRegistry[_module]) return componentsRegistry[_module]; + if(!itemName) return; - // look it internal Plotly if all previous attempts fail - return Plotly[_module]; -} + delete attr[IS_LINKED_TO_ARRAY]; -function removeUnderscoreAttrs(attributes) { - Object.keys(attributes).forEach(function(k) { - if(k.charAt(0) === '_' && - Lib.UNDERSCORE_ATTRS.indexOf(k) === -1) delete attributes[k]; - }); - return attributes; -} + attrs[attrName] = { items: {} }; + attrs[attrName].items[itemName] = attr; + attrs[attrName].role = 'object'; + } -function getMeta(type) { - if(type === 'area') return {}; // FIXME - return Registry.modules[type].meta || {}; + exports.crawl(attrs, callback); } function assignPolarLayoutAttrs(layoutAttributes) { @@ -57065,68 +57018,25 @@ function assignPolarLayoutAttrs(layoutAttributes) { extendFlat(layoutAttributes, polarAxisAttrs.layout); - return layoutAttributes; // FIXME -} - -function getSubplotRegistry(traceType) { - if(traceType === 'area') return {}; // FIXME - - var subplotsRegistry = Registry.subplotsRegistry, - subplotType = Object.keys(subplotsRegistry).filter(function(subplotType) { - return Registry.traceIs({type: traceType}, subplotType); - })[0]; - - if(subplotType === undefined) return {}; - - return subplotsRegistry[subplotType]; -} - -function handleSubplotObjs(layoutAttributes) { - var subplotsRegistry = Registry.subplotsRegistry; - - Object.keys(layoutAttributes).forEach(function(k) { - Object.keys(subplotsRegistry).forEach(function(subplotType) { - var subplotRegistry = subplotsRegistry[subplotType], - isSubplotObj; - - if(!subplotRegistry.attrRegex) return; - - if(subplotType === 'cartesian' || subplotType === 'gl2d') { - isSubplotObj = ( - subplotRegistry.attrRegex.x.test(k) || - subplotRegistry.attrRegex.y.test(k) - ); - } - else { - isSubplotObj = subplotRegistry.attrRegex.test(k); - } - - if(isSubplotObj) layoutAttributes[k][Lib.IS_SUBPLOT_OBJ] = true; - }); - }); - return layoutAttributes; } -function handleLinkedToArray(layoutAttributes) { - - function callback(attr, attrName, attrs) { - if(attr[Lib.IS_LINKED_TO_ARRAY] !== true) return; - - // TODO more robust logic - var itemName = attrName.substr(0, attrName.length - 1); +function handleBasePlotModule(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep({}, _module.layoutAttributes); - delete attr[Lib.IS_LINKED_TO_ARRAY]; + attrs[IS_SUBPLOT_OBJ] = true; + np.set(attrs); +} - attrs[attrName] = { items: {} }; - attrs[attrName].items[itemName] = attr; - attrs[attrName].role = 'object'; - } +function handleRegisteredComponent(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep(np.get() || {}, _module.layoutAttributes); - Lib.crawl(layoutAttributes, callback); + np.set(attrs); } -},{"../lib":301,"../plotly":326,"../plots/plots":359,"../plots/polar/area_attributes":360,"../plots/polar/axis_attributes":361,"../registry":366}],321:[function(require,module,exports){ +},{"../lib":303,"../plots/animation_attributes":329,"../plots/attributes":331,"../plots/frame_attributes":354,"../plots/layout_attributes":359,"../plots/polar/area_attributes":362,"../plots/polar/axis_attributes":363,"../registry":368}],323:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -57218,10 +57128,14 @@ function registerTransformModule(newModule) { } function registerComponentModule(newModule) { - Registry.componentsRegistry[newModule.name] = newModule; + if(typeof newModule.name !== 'string') { + throw new Error('Component module *name* must be a string.'); + } + + Registry.registerComponent(newModule); } -},{"../lib":301,"../registry":366}],322:[function(require,module,exports){ +},{"../lib":303,"../registry":368}],324:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -57247,7 +57161,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":301,"../plotly":326}],323:[function(require,module,exports){ +},{"../lib":303,"../plotly":328}],325:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -57569,7 +57483,7 @@ exports.doModeBar = function(gd) { return Plots.previousPromises(gd); }; -},{"../components/color":207,"../components/drawing":231,"../components/modebar":254,"../components/titles":282,"../lib":301,"../plotly":326,"../plots/plots":359,"../registry":366}],324:[function(require,module,exports){ +},{"../components/color":207,"../components/drawing":230,"../components/modebar":253,"../components/titles":281,"../lib":303,"../plotly":328,"../plots/plots":361,"../registry":368}],326:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -57624,7 +57538,7 @@ function toImage(gd, opts) { // first clone the GD so we can operate in a clean environment var clone = clonePlot(gd, {format: 'png', height: opts.height, width: opts.width}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -57679,7 +57593,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":301,"../plotly":326,"../snapshot/cloneplot":367,"../snapshot/helpers":370,"../snapshot/svgtoimg":372,"../snapshot/tosvg":374,"fast-isnumeric":61}],325:[function(require,module,exports){ +},{"../lib":303,"../plotly":328,"../snapshot/cloneplot":369,"../snapshot/helpers":372,"../snapshot/svgtoimg":374,"../snapshot/tosvg":376,"fast-isnumeric":61}],327:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -57855,7 +57769,8 @@ function crawl(objIn, objOut, schema, list, base, path) { crawl(valIn, valOut, nestedSchema, list, base, p); } else if(nestedSchema.items && !isInfoArray && isArray(valIn)) { - var itemName = k.substr(0, k.length - 1), + var items = nestedSchema.items, + _nestedSchema = items[Object.keys(items)[0]], indexList = []; var j, _p; @@ -57863,8 +57778,7 @@ function crawl(objIn, objOut, schema, list, base, path) { // loop over valOut items while keeping track of their // corresponding input container index (given by _index) for(j = 0; j < valOut.length; j++) { - var _nestedSchema = nestedSchema.items[itemName], - _index = valOut[j]._index || j; + var _index = valOut[j]._index || j; _p = p.slice(); _p.push(_index); @@ -58049,7 +57963,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":301,"../plots/plots":359,"./plot_schema":320}],326:[function(require,module,exports){ +},{"../lib":303,"../plots/plots":361,"./plot_schema":322}],328:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58077,25 +57991,12 @@ exports.defaultConfig = require('./plot_api/plot_config'); exports.Plots = require('./plots/plots'); exports.Axes = require('./plots/cartesian/axes'); exports.Fx = require('./plots/cartesian/graph_interact'); - -// components -exports.Color = require('./components/color'); -exports.Drawing = require('./components/drawing'); -exports.Colorscale = require('./components/colorscale'); -exports.Colorbar = require('./components/colorbar'); -exports.ErrorBars = require('./components/errorbars'); -exports.Annotations = require('./components/annotations'); -exports.Shapes = require('./components/shapes'); -exports.Legend = require('./components/legend'); -exports.Images = require('./components/images'); -exports.UpdateMenus = require('./components/updatemenus'); -exports.Sliders = require('./components/sliders'); exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/annotations":205,"./components/color":207,"./components/colorbar":212,"./components/colorscale":222,"./components/drawing":231,"./components/errorbars":237,"./components/images":243,"./components/legend":251,"./components/modebar":254,"./components/shapes":275,"./components/sliders":281,"./components/updatemenus":287,"./plot_api/plot_api":318,"./plot_api/plot_config":319,"./plots/cartesian/axes":330,"./plots/cartesian/graph_interact":338,"./plots/plots":359}],327:[function(require,module,exports){ +},{"./components/modebar":253,"./plot_api/plot_api":320,"./plot_api/plot_config":321,"./plots/cartesian/axes":333,"./plots/cartesian/graph_interact":340,"./plots/plots":361}],329:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58197,7 +58098,76 @@ module.exports = { } }; -},{}],328:[function(require,module,exports){ +},{}],330:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var Lib = require('../lib'); + + +/** Convenience wrapper for making array container logic DRY and consistent + * + * @param {object} parentObjIn + * user input object where the container in question is linked + * (i.e. either a user trace object or the user layout object) + * + * @param {object} parentObjOut + * full object where the coerced container will be linked + * (i.e. either a full trace object or the full layout object) + * + * @param {object} opts + * options object: + * - name {string} + * name of the key linking the container in question + * - handleItemDefaults {function} + * defaults method to be called on each item in the array container in question + * + * Its arguments are: + * - itemIn {object} item in user layout + * - itemOut {object} item in full layout + * - parentObj {object} (as in closure) + * - opts {object} (as in closure) + * - itemOpts {object} + * - itemIsNotPlainObject {boolean} + * N.B. + * + * - opts is passed to handleItemDefaults so it can also store + * links to supplementary data (e.g. fullData for layout components) + * + */ +module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut, opts) { + var name = opts.name; + + var contIn = Array.isArray(parentObjIn[name]) ? parentObjIn[name] : [], + contOut = parentObjOut[name] = []; + + for(var i = 0; i < contIn.length; i++) { + var itemIn = contIn[i], + itemOut = {}, + itemOpts = {}; + + if(!Lib.isPlainObject(itemIn)) { + itemOpts.itemIsNotPlainObject = true; + itemIn = {}; + } + + opts.handleItemDefaults(itemIn, itemOut, parentObjOut, opts, itemOpts); + + itemOut._input = itemIn; + itemOut._index = i; + + contOut.push(itemOut); + } +}; + +},{"../lib":303}],331:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58280,7 +58250,7 @@ module.exports = { } }; -},{}],329:[function(require,module,exports){ +},{}],332:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58307,7 +58277,7 @@ module.exports = { } }; -},{}],330:[function(require,module,exports){ +},{}],333:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58329,6 +58299,15 @@ var Titles = require('../../components/titles'); var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); +var constants = require('../../constants/numerical'); +var FP_SAFE = constants.FP_SAFE; +var ONEAVGYEAR = constants.ONEAVGYEAR; +var ONEAVGMONTH = constants.ONEAVGMONTH; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + var axes = module.exports = {}; @@ -58346,43 +58325,88 @@ axes.getFromId = axisIds.getFromId; axes.getFromTrace = axisIds.getFromTrace; -// find the list of possible axes to reference with an xref or yref attribute -// and coerce it to that list -axes.coerceRef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = axLetter + 'ref', +/* + * find the list of possible axes to reference with an xref or yref attribute + * and coerce it to that list + * + * attr: the attribute we're generating a reference for. Should end in 'x' or 'y' + * but can be prefixed, like 'ax' for annotation's arrow x + * dflt: the default to coerce to, or blank to use the first axis (falling back on + * extraOption if there is no axis) + * extraOption: aside from existing axes with this letter, what non-axis value is allowed? + * Only required if it's different from `dflt` + */ +axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption) { + var axLetter = attr.charAt(attr.length - 1), + axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), + refAttr = attr + 'ref', attrDef = {}; + if(!dflt) dflt = axlist[0] || extraOption; + if(!extraOption) extraOption = dflt; + // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(['paper']), - dflt: dflt || axlist[0] || 'paper' + values: axlist.concat(extraOption ? [extraOption] : []), + dflt: dflt }; // xref, yref return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; -// todo: duplicated per github PR 610. Should be consolidated with axes.coerceRef. -// find the list of possible axes to reference with an axref or ayref attribute -// and coerce it to that list -axes.coerceARef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = 'a' + axLetter + 'ref', - attrDef = {}; +/* + * coerce position attributes (range-type) that can be either on axes or absolute + * (paper or pixel) referenced. The biggest complication here is that we don't know + * before looking at the axis whether the value must be a number or not (it may be + * a date string), so we can't use the regular valType='number' machinery + * + * axRef (string): the axis this position is referenced to, or: + * paper: fraction of the plot area + * pixel: pixels relative to some starting position + * attr (string): the attribute in containerOut we are coercing + * dflt (number): the default position, as a fraction or pixels. If the attribute + * is to be axis-referenced, this will be converted to an axis data value + * + * Also cleans the values, since the attribute definition itself has to say + * valType: 'any' to handle date axes. This allows us to accept: + * - for category axes: category names, and convert them here into serial numbers. + * Note that this will NOT work for axis range endpoints, because we don't know + * the category list yet (it's set by ax.makeCalcdata during calc) + * but it works for component (note, shape, images) positions. + * - for date axes: JS Dates or milliseconds, and convert to date strings + * - for other types: coerce them to numbers + */ +axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { + var pos, + newPos; - // data-ref annotations are not supported in gl2d yet + if(axRef === 'paper' || axRef === 'pixel') { + pos = coerce(attr, dflt); + } + else { + var ax = axes.getFromId(gd, axRef); - attrDef[refAttr] = { - valType: 'enumerated', - values: axlist.concat(['pixel']), - dflt: dflt || 'pixel' || axlist[0] - }; + dflt = ax.fraction2r(dflt); + pos = coerce(attr, dflt); - // axref, ayref - return Lib.coerce(containerIn, containerOut, attrDef, refAttr); + if(ax.type === 'category') { + // if position is given as a category name, convert it to a number + if(typeof pos === 'string' && (ax._categories || []).length) { + newPos = ax._categories.indexOf(pos); + containerOut[attr] = (newPos !== -1) ? dflt : newPos; + return; + } + } + else if(ax.type === 'date') { + containerOut[attr] = Lib.cleanDate(pos); + return; + } + } + // finally make sure we have a number (unless date type already returned a string) + containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; }; // empty out types for all axes containing these traces @@ -58408,14 +58432,16 @@ axes.counterLetter = function(id) { // incorporate a new minimum difference and first tick into // forced +// note that _forceTick0 is linearized, so needs to be turned into +// a range value for setting tick0 axes.minDtick = function(ax, newDiff, newFirst, allow) { // doesn't make sense to do forced min dTick on log or category axes, // and the plot itself may decide to cancel (ie non-grouped bars) if(['log', 'category'].indexOf(ax.type) !== -1 || !allow) { ax._minDtick = 0; } - // null means there's nothing there yet - else if(ax._minDtick === null) { + // undefined means there's nothing there yet + else if(ax._minDtick === undefined) { ax._minDtick = newDiff; ax._forceTick0 = newFirst; } @@ -58440,6 +58466,19 @@ axes.minDtick = function(ax, newDiff, newFirst, allow) { } }; +// Find the autorange for this axis +// +// assumes ax._min and ax._max have already been set by calling axes.expand +// using calcdata from all traces. These are arrays of: +// {val: calcdata value, pad: extra pixels beyond this value} +// +// Returns an array of [min, max]. These are calcdata for log and category axes +// and data for linear and date axes. +// +// TODO: we want to change log to data as well, but it's hard to do this +// maintaining backward compatibility. category will always have to use calcdata +// though, because otherwise values between categories (or outside all categories) +// would be impossible. axes.getAutoRange = function(ax) { var newRange = []; @@ -58458,7 +58497,12 @@ axes.getAutoRange = function(ax) { var j, minpt, maxpt, minbest, maxbest, dp, dv, mbest = 0, - axReverse = (ax.range && ax.range[1] < ax.range[0]); + axReverse = false; + + if(ax.range) { + var rng = ax.range.map(ax.r2l); + axReverse = rng[1] < rng[0]; + } // one-time setting to easily reverse the axis // when plotting from code @@ -58547,11 +58591,9 @@ axes.getAutoRange = function(ax) { } // maintain reversal - if(axReverse) { - newRange.reverse(); - } + if(axReverse) newRange.reverse(); - return newRange; + return newRange.map(ax.l2r || Number); }; axes.doAutoRange = function(ax) { @@ -58614,7 +58656,6 @@ axes.saveRangeInitial = function(gd, overwrite) { // (unless one end is overridden by tozero) // tozero: (boolean) make sure to include zero if axis is linear, // and make it a tight bound if possible -var FP_SAFE = Number.MAX_VALUE / 2; axes.expand = function(ax, data, options) { if(!(ax.autorange || ax._needsExpand) || !data) return; if(!ax._min) ax._min = []; @@ -58753,10 +58794,24 @@ axes.autoBin = function(data, ax, nbins, is2d) { } // piggyback off autotick code to make "nice" bin sizes - var dummyax = { - type: ax.type === 'log' ? 'linear' : ax.type, - range: [datamin, datamax] - }; + var dummyax; + if(ax.type === 'log') { + dummyax = { + type: 'linear', + range: [datamin, datamax], + r2l: Number + }; + } + else { + dummyax = { + type: ax.type, + // conversion below would be ax.c2r but that's only different from l2r + // for log, and this is the only place (so far?) we would want c2r. + range: [datamin, datamax].map(ax.l2r), + r2l: ax.r2l + }; + } + axes.autoTicks(dummyax, size0); var binstart = axes.tickIncrement( axes.tickFirst(dummyax), dummyax.dtick, 'reverse'), @@ -58820,8 +58875,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { } return { - start: binstart, - end: binend, + start: ax.c2r(binstart), + end: ax.c2r(binend), size: dummyax.dtick }; }; @@ -58838,6 +58893,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { axes.calcTicks = function calcTicks(ax) { if(ax.tickmode === 'array') return arrayTicks(ax); + var rng = ax.range.map(ax.r2l); + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks, @@ -58852,18 +58909,17 @@ axes.calcTicks = function calcTicks(ax) { nt = Lib.constrain(ax._length / minPx, 4, 9) + 1; } } - axes.autoTicks(ax, Math.abs(ax.range[1] - ax.range[0]) / nt); + axes.autoTicks(ax, Math.abs(rng[1] - rng[0]) / nt); // check for a forced minimum dtick if(ax._minDtick > 0 && ax.dtick < ax._minDtick * 2) { ax.dtick = ax._minDtick; - ax.tick0 = ax._forceTick0; + ax.tick0 = ax.l2r(ax._forceTick0); } } // check for missing tick0 if(!ax.tick0) { - ax.tick0 = (ax.type === 'date') ? - new Date(2000, 0, 1).getTime() : 0; + ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; } // now figure out rounding of tick values @@ -58873,12 +58929,12 @@ axes.calcTicks = function calcTicks(ax) { ax._tmin = axes.tickFirst(ax); // check for reversed axis - var axrev = (ax.range[1] < ax.range[0]); + var axrev = (rng[1] < rng[0]); // return the full set of tick vals var vals = [], // add a tiny bit so we get ticks which may have rounded out - endtick = ax.range[1] * 1.0001 - ax.range[0] * 0.0001; + endtick = rng[1] * 1.0001 - rng[0] * 0.0001; if(ax.type === 'category') { endtick = (axrev) ? Math.max(-0.5, endtick) : Math.min(ax._categories.length - 0.5, endtick); @@ -58896,9 +58952,18 @@ axes.calcTicks = function calcTicks(ax) { // show the exponent only on the last one ax._tmax = vals[vals.length - 1]; + // for showing date suffixes: ax._prevSuffix holds what we showed most + // recently. Start with it cleared and mark that we're in calcTicks (ie + // calculating a whole string of these so we should care what the previous + // suffix was!) + ax._prevSuffix = ''; + ax._inCalcTicks = true; + var ticksOut = new Array(vals.length); for(var i = 0; i < vals.length; i++) ticksOut[i] = axes.tickText(ax, vals[i]); + ax._inCalcTicks = false; + return ticksOut; }; @@ -58906,15 +58971,15 @@ function arrayTicks(ax) { var vals = ax.tickvals, text = ax.ticktext, ticksOut = new Array(vals.length), - r0expanded = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, - r1expanded = ax.range[1] * 1.0001 - ax.range[0] * 0.0001, + rng = ax.range.map(ax.r2l), + r0expanded = rng[0] * 1.0001 - rng[1] * 0.0001, + r1expanded = rng[1] * 1.0001 - rng[0] * 0.0001, tickMin = Math.min(r0expanded, r1expanded), tickMax = Math.max(r0expanded, r1expanded), vali, i, j = 0; - // without a text array, just format the given values as any other ticks // except with more precision to the numbers if(!Array.isArray(text)) text = []; @@ -58954,7 +59019,7 @@ function roundDTick(roughDTick, base, roundingSet) { // outputs (into ax): // tick0: starting point for ticks (not necessarily on the graph) // usually 0 for numeric (=10^0=1 for log) or jan 1, 2000 for dates -// dtick: the actual, nice round tick spacing, somewhat larger than roughDTick +// dtick: the actual, nice round tick spacing, usually a little larger than roughDTick // if the ticks are spaced linearly (linear scale, categories, // log with only full powers, date ticks < month), // this will just be a number @@ -58967,36 +59032,35 @@ axes.autoTicks = function(ax, roughDTick) { var base; if(ax.type === 'date') { - ax.tick0 = new Date(2000, 0, 1).getTime(); + ax.tick0 = '2000-01-01'; + // the criteria below are all based on the rough spacing we calculate + // being > half of the final unit - so precalculate twice the rough val + var roughX2 = 2 * roughDTick; - if(roughDTick > 15778800000) { - // years if roughDTick > 6mo - roughDTick /= 31557600000; + if(roughX2 > ONEAVGYEAR) { + roughDTick /= ONEAVGYEAR; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'M' + (12 * roundDTick(roughDTick, base, roundBase10)); } - else if(roughDTick > 1209600000) { - // months if roughDTick > 2wk - roughDTick /= 2629800000; + else if(roughX2 > ONEAVGMONTH) { + roughDTick /= ONEAVGMONTH; ax.dtick = 'M' + roundDTick(roughDTick, 1, roundBase24); } - else if(roughDTick > 43200000) { - // days if roughDTick > 12h - ax.dtick = roundDTick(roughDTick, 86400000, roundDays); + else if(roughX2 > ONEDAY) { + ax.dtick = roundDTick(roughDTick, ONEDAY, roundDays); // get week ticks on sunday - ax.tick0 = new Date(2000, 0, 2).getTime(); + // this will also move the base tick off 2000-01-01 if dtick is + // 2 or 3 days... but that's a weird enough case that we'll ignore it. + ax.tick0 = '2000-01-02'; } - else if(roughDTick > 1800000) { - // hours if roughDTick > 30m - ax.dtick = roundDTick(roughDTick, 3600000, roundBase24); + else if(roughX2 > ONEHOUR) { + ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } - else if(roughDTick > 30000) { - // minutes if roughDTick > 30sec - ax.dtick = roundDTick(roughDTick, 60000, roundBase60); + else if(roughX2 > ONEMIN) { + ax.dtick = roundDTick(roughDTick, ONEMIN, roundBase60); } - else if(roughDTick > 500) { - // seconds if roughDTick > 0.5sec - ax.dtick = roundDTick(roughDTick, 1000, roundBase60); + else if(roughX2 > ONESEC) { + ax.dtick = roundDTick(roughDTick, ONESEC, roundBase60); } else { // milliseconds @@ -59006,16 +59070,19 @@ axes.autoTicks = function(ax, roughDTick) { } else if(ax.type === 'log') { ax.tick0 = 0; + var rng = ax.range.map(ax.r2l); - // only show powers of 10 - if(roughDTick > 0.7) ax.dtick = Math.ceil(roughDTick); - else if(Math.abs(ax.range[1] - ax.range[0]) < 1) { + if(roughDTick > 0.7) { + // only show powers of 10 + ax.dtick = Math.ceil(roughDTick); + } + else if(Math.abs(rng[1] - rng[0]) < 1) { // span is less than one power of 10 - var nt = 1.5 * Math.abs((ax.range[1] - ax.range[0]) / roughDTick); + var nt = 1.5 * Math.abs((rng[1] - rng[0]) / roughDTick); // ticks on a linear scale, labeled fully - roughDTick = Math.abs(Math.pow(10, ax.range[1]) - - Math.pow(10, ax.range[0])) / nt; + roughDTick = Math.abs(Math.pow(10, rng[1]) - + Math.pow(10, rng[0])) / nt; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'L' + roundDTick(roughDTick, base, roundBase10); } @@ -59054,41 +59121,59 @@ axes.autoTicks = function(ax, roughDTick) { // for date ticks, the last date part to show (y,m,d,H,M,S) // or an integer # digits past seconds function autoTickRound(ax) { - var dtick = ax.dtick, - maxend; + var dtick = ax.dtick; ax._tickexponent = 0; - if(!isNumeric(dtick) && typeof dtick !== 'string') dtick = 1; + if(!isNumeric(dtick) && typeof dtick !== 'string') { + dtick = 1; + } - if(ax.type === 'category') ax._tickround = null; - else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { - if(ax.type === 'date') { - if(dtick >= 86400000) ax._tickround = 'd'; - else if(dtick >= 3600000) ax._tickround = 'H'; - else if(dtick >= 60000) ax._tickround = 'M'; - else if(dtick >= 1000) ax._tickround = 'S'; - else ax._tickround = 3 - Math.round(Math.log(dtick / 2) / Math.LN10); - } + if(ax.type === 'category') { + ax._tickround = null; + } + if(ax.type === 'date') { + // If tick0 is unusual, give tickround a bit more information + // not necessarily *all* the information in tick0 though, if it's really odd + // minimal string length for tick0: 'd' is 10, 'M' is 16, 'S' is 19 + // take off a leading minus (year < 0 so length is consistent) + var tick0ms = Lib.dateTime2ms(ax.tick0), + tick0str = Lib.ms2DateTime(tick0ms).replace(/^-/, ''), + tick0len = tick0str.length; + + if(String(dtick).charAt(0) === 'M') { + // any tick0 more specific than a year: alway show the full date + if(tick0len > 10 || tick0str.substr(5) !== '01-01') ax._tickround = 'd'; + // show the month unless ticks are full multiples of a year + else ax._tickround = (+(dtick.substr(1)) % 12 === 0) ? 'y' : 'm'; + } + else if((dtick >= ONEDAY && tick0len <= 10) || (dtick >= ONEDAY * 15)) ax._tickround = 'd'; + else if((dtick >= ONEMIN && tick0len <= 16) || (dtick >= ONEHOUR)) ax._tickround = 'M'; + else if((dtick >= ONESEC && tick0len <= 19) || (dtick >= ONEMIN)) ax._tickround = 'S'; else { - if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); - // 2 digits past largest digit of dtick - ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); - - if(ax.type === 'log') { - maxend = Math.pow(10, Math.max(ax.range[0], ax.range[1])); - } - else maxend = Math.max(Math.abs(ax.range[0]), Math.abs(ax.range[1])); - - var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { - if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { - ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); - } - else ax._tickexponent = rangeexp; + // of any two adjacent ticks, at least one will have the maximum fractional digits + // of all possible ticks - so take the max. length of tick0 and the next one + var tick1len = Lib.ms2DateTime(tick0ms + dtick).replace(/^-/, '').length; + ax._tickround = Math.max(tick0len, tick1len) - 20; + } + } + else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { + // linear or log (except D1, D2) + var rng = ax.range.map(ax.r2d || Number); + if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); + // 2 digits past largest digit of dtick + ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); + + var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); + + var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); + if(Math.abs(rangeexp) > 3) { + if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { + ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } + else ax._tickexponent = rangeexp; } } - else if(dtick.charAt(0) === 'M') ax._tickround = (dtick.length === 2) ? 'm' : 'y'; + // D1 or D2 (log) else ax._tickround = null; } @@ -59133,13 +59218,16 @@ axes.tickIncrement = function(x, dtick, axrev) { // calculate the first tick on an axis axes.tickFirst = function(ax) { - var axrev = ax.range[1] < ax.range[0], + var r2l = ax.r2l || Number, + rng = ax.range.map(r2l), + axrev = rng[1] < rng[0], sRound = axrev ? Math.floor : Math.ceil, // add a tiny extra bit to make sure we get ticks // that may have been rounded out - r0 = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, + r0 = rng[0] * 1.0001 - rng[1] * 0.0001, dtick = ax.dtick, - tick0 = ax.tick0; + tick0 = r2l(ax.tick0); + if(isNumeric(dtick)) { var tmin = sRound((r0 - tick0) / dtick) * dtick + tick0; @@ -59189,7 +59277,7 @@ axes.tickFirst = function(ax) { var yearFormat = d3.time.format('%Y'), monthFormat = d3.time.format('%b %Y'), dayFormat = d3.time.format('%b %-d'), - hourFormat = d3.time.format('%b %-d %Hh'), + yearMonthDayFormat = d3.time.format('%b %-d, %Y'), minuteFormat = d3.time.format('%H:%M'), secondFormat = d3.time.format(':%S'); @@ -59225,7 +59313,8 @@ axes.tickText = function(ax, x, hover) { i; if(arrayMode && Array.isArray(ax.ticktext)) { - var minDiff = Math.abs(ax.range[1] - ax.range[0]) / 10000; + var rng = ax.range.map(ax.r2l), + minDiff = Math.abs(rng[1] - rng[0]) / 10000; for(i = 0; i < ax.ticktext.length; i++) { if(Math.abs(x - ax.d2l(ax.tickvals[i])) < minDiff) break; } @@ -59280,10 +59369,12 @@ function tickTextObj(ax, x, text) { function formatDate(ax, out, hover, extraPrecision) { var x = out.x, tr = ax._tickround, + trOriginal = tr, d = new Date(x), // suffix completes the full date info, to be included - // with only the first tick - suffix = '', + // with only the first tick or if any info before what's + // shown has changed + suffix, tt; if(hover && ax.hoverformat) { tt = modDateFormat(ax.hoverformat, x); @@ -59296,34 +59387,40 @@ function formatDate(ax, out, hover, extraPrecision) { else { if(extraPrecision) { if(isNumeric(tr)) tr += 2; - else tr = {y: 'm', m: 'd', d: 'H', H: 'M', M: 'S', S: 2}[tr]; + else tr = {y: 'm', m: 'd', d: 'M', M: 'S', S: 2}[tr]; } if(tr === 'y') tt = yearFormat(d); else if(tr === 'm') tt = monthFormat(d); else { - if(x === ax._tmin && !hover) { - suffix = '
' + yearFormat(d); - } + if(tr === 'd') { + if(!hover) suffix = '
' + yearFormat(d); - if(tr === 'd') tt = dayFormat(d); - else if(tr === 'H') tt = hourFormat(d); + tt = dayFormat(d); + } else { - if(x === ax._tmin && !hover) { - suffix = '
' + dayFormat(d) + ', ' + yearFormat(d); - } + if(!hover) suffix = '
' + yearMonthDayFormat(d); tt = minuteFormat(d); if(tr !== 'M') { tt += secondFormat(d); if(tr !== 'S') { - tt += numFormat(mod(x / 1000, 1), ax, 'none', hover) + tt += numFormat(d3.round(mod(x / 1000, 1), 4), ax, 'none', hover) .substr(1); } } + else if(trOriginal === 'd') { + // for hover on axes with day ticks, minuteFormat (which + // only includes %H:%M) isn't enough, you want the date too + tt = dayFormat(d) + ' ' + tt; + } } } } - out.text = tt + suffix; + if(suffix && (!ax._inCalcTicks || (suffix !== ax._prevSuffix))) { + tt += suffix; + ax._prevSuffix = suffix; + } + out.text = tt; } function formatLog(ax, out, hover, extraPrecision, hideexp) { @@ -59415,7 +59512,7 @@ function numFormat(v, ax, fmtoverride, hover) { (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent // from what we calculate - range: ax.showexponent === 'none' ? ax.range : [0, v || 1] + range: ax.showexponent === 'none' ? ax.range.map(ax.r2d) : [0, v || 1] }; autoTickRound(ah); tickRound = (Number(ah._tickround) || 0) + 4; @@ -59663,8 +59760,9 @@ axes.makeClipPaths = function(gd) { // doTicks: draw ticks, grids, and tick labels // axid: 'x', 'y', 'x2' etc, // blank to do all, -// 'redraw' to force full redraw, and reset ax._r -// (stored range for use by zoom/pan) +// 'redraw' to force full redraw, and reset: +// ax._r (stored range for use by zoom/pan) +// ax._rl (stored linearized range for use by zoom/pan) // or can pass in an axis object directly axes.doTicks = function(gd, axid, skipTitle) { var fullLayout = gd._fullLayout, @@ -59702,7 +59800,10 @@ axes.doTicks = function(gd, axid, skipTitle) { return function() { if(!ax._id) return; var axDone = axes.doTicks(gd, ax._id); - if(axid === 'redraw') ax._r = ax.range.slice(); + if(axid === 'redraw') { + ax._r = ax.range.slice(); + ax._rl = ax._r.map(ax.r2l); + } return axDone; }; })); @@ -59720,9 +59821,6 @@ axes.doTicks = function(gd, axid, skipTitle) { } } - // in case a val turns into string somehow - ax.range = [+ax.range[0], +ax.range[1]]; - // set scaling to pixels ax.setScale(); @@ -60111,7 +60209,8 @@ axes.doTicks = function(gd, axid, skipTitle) { break; } } - var showZl = (ax.range[0] * ax.range[1] <= 0) && ax.zeroline && + var rng = ax.range.map(ax.r2l), + showZl = (rng[0] * rng[1] <= 0) && ax.zeroline && (ax.type === 'linear' || ax.type === '-') && gridvals.length && (hasBarsOrFill || clipEnds({x: 0}) || !ax.showline); var zl = zlcontainer.selectAll('path.' + zcls) @@ -60335,7 +60434,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { // rather than built-in % which gives a negative value for negative v function mod(v, d) { return ((v % d) + d) % d; } -},{"../../components/color":207,"../../components/drawing":231,"../../components/titles":282,"../../lib":301,"../../lib/svg_text_utils":315,"../../registry":366,"./axis_ids":333,"./layout_attributes":340,"./layout_defaults":341,"./set_convert":345,"d3":55,"fast-isnumeric":61}],331:[function(require,module,exports){ +},{"../../components/color":207,"../../components/drawing":230,"../../components/titles":281,"../../constants/numerical":289,"../../lib":303,"../../lib/svg_text_utils":317,"../../registry":368,"./axis_ids":336,"./layout_attributes":342,"./layout_defaults":343,"./set_convert":347,"d3":55,"fast-isnumeric":61}],334:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60350,7 +60449,7 @@ function mod(v, d) { return ((v % d) + d) % d; } var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); -var cleanDatum = require('./clean_datum'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function autoType(array) { if(moreDates(array)) return 'date'; @@ -60392,7 +60491,7 @@ function moreDates(a) { return (dcnt > ncnt * 2); } -// are the (x,y)-values in td.data mostly text? +// are the (x,y)-values in gd.data mostly text? // require twice as many categories as numbers function category(a) { // test at most 1000 points @@ -60402,15 +60501,15 @@ function category(a) { ai; for(var i = 0; i < a.length; i += inc) { - ai = cleanDatum(a[Math.round(i)]); - if(isNumeric(ai)) curvenums++; + ai = a[Math.round(i)]; + if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; else if(typeof ai === 'string' && ai !== '' && ai !== 'None') curvecats++; } return curvecats > curvenums * 2; } -},{"../../lib":301,"./clean_datum":335,"fast-isnumeric":61}],332:[function(require,module,exports){ +},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],335:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60503,17 +60602,15 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var validRange = ( (containerIn.range || []).length === 2 && - isNumeric(containerIn.range[0]) && - isNumeric(containerIn.range[1]) + isNumeric(containerOut.r2l(containerIn.range[0])) && + isNumeric(containerOut.r2l(containerIn.range[1])) ); var autoRange = coerce('autorange', !validRange); if(autoRange) coerce('rangemode'); - var range = coerce('range', [-1, letter === 'x' ? 6 : 4]); - if(range[0] === range[1]) { - containerOut.range = [range[0] - 1, range[0] + 1]; - } - Lib.noneOrAll(containerIn.range, containerOut.range, [0, 1]); + + coerce('range'); + containerOut.cleanRange(); coerce('fixedrange'); @@ -60635,7 +60732,7 @@ function getFirstNonEmptyTrace(data, id, axLetter) { } } -},{"../../components/color/attributes":206,"../../lib":301,"../../registry":366,"./axis_autotype":331,"./axis_ids":333,"./category_order_defaults":334,"./layout_attributes":340,"./ordered_categories":342,"./set_convert":345,"./tick_label_defaults":346,"./tick_mark_defaults":347,"./tick_value_defaults":348,"fast-isnumeric":61,"tinycolor2":182}],333:[function(require,module,exports){ +},{"../../components/color/attributes":206,"../../lib":303,"../../registry":368,"./axis_autotype":334,"./axis_ids":336,"./category_order_defaults":337,"./layout_attributes":342,"./ordered_categories":344,"./set_convert":347,"./tick_label_defaults":348,"./tick_mark_defaults":349,"./tick_value_defaults":350,"fast-isnumeric":61,"tinycolor2":182}],336:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60757,7 +60854,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":301,"../../registry":366,"../plots":359,"./constants":336}],334:[function(require,module,exports){ +},{"../../lib":303,"../../registry":368,"../plots":361,"./constants":338}],337:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60791,46 +60888,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],335:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = require('fast-isnumeric'); - -var Lib = require('../../lib'); - - -/** - * cleanDatum: removes characters - * same replace criteria used in the grid.js:scrapeCol - * but also handling dates, numbers, and NaN, null, Infinity etc - */ -module.exports = function cleanDatum(c) { - try { - if(typeof c === 'object' && c !== null && c.getTime) { - return Lib.ms2DateTime(c); - } - if(typeof c !== 'string' && !isNumeric(c)) { - return ''; - } - c = c.toString().replace(/['"%,$# ]/g, ''); - } - catch(e) { - Lib.error(e, c); - } - - return c; -}; - -},{"../../lib":301,"fast-isnumeric":61}],336:[function(require,module,exports){ +},{}],338:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60854,14 +60912,6 @@ module.exports = { y: /^yaxis([2-9]|[1-9][0-9]+)?$/ }, - /** - * standardize all missing data in calcdata to use undefined - * never null or NaN. - * that way we can use !==undefined, or !== BADNUM, - * to test for real data - */ - BADNUM: undefined, - // axis match regular expression xAxisMatch: /^xaxis[0-9]*$/, yAxisMatch: /^yaxis[0-9]*$/, @@ -60905,10 +60955,15 @@ module.exports = { BENDPX: 1.5, // delay before a redraw (relayout) after smooth panning and zooming - REDRAWDELAY: 50 + REDRAWDELAY: 50, + + // last resort axis ranges for x, y, and date axes if we have no data + DFLTRANGEX: [-1, 6], + DFLTRANGEY: [-1, 4], + DFLTRANGEDATE: ['2000-01-01', '2001-01-01'], }; -},{}],337:[function(require,module,exports){ +},{}],339:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61009,11 +61064,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { return dragger; } - function forceNumbers(axRange) { - axRange[0] = Number(axRange[0]); - axRange[1] = Number(axRange[1]); - } - var dragOptions = { element: dragger, gd: gd, @@ -61124,7 +61174,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { .attr('d', 'M0,0Z'); clearSelect(); - for(var i = 0; i < allaxes.length; i++) forceNumbers(allaxes[i].range); } function clearSelect() { @@ -61215,16 +61264,16 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomAxRanges(axList, r0Fraction, r1Fraction) { var i, axi, - axRange; + axRangeLinear; for(i = 0; i < axList.length; i++) { axi = axList[i]; if(axi.fixedrange) continue; - axRange = axi.range; + axRangeLinear = axi.range.map(axi.r2l); axi.range = [ - axRange[0] + (axRange[1] - axRange[0]) * r0Fraction, - axRange[0] + (axRange[1] - axRange[0]) * r1Fraction + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r0Fraction), + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r1Fraction) ]; } } @@ -61278,7 +61327,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { verticalAlign: vAlign }) .on('edit', function(text) { - var v = ax.type === 'category' ? ax.c2l(text) : ax.d2l(text); + var v = ax.d2r(text); if(v !== undefined) { Plotly.relayout(gd, attrStr, v); } @@ -61338,10 +61387,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomWheelOneAxis(ax, centerFraction, zoom) { if(ax.fixedrange) return; - forceNumbers(ax.range); - var axRange = ax.range, + + var axRange = ax.range.map(ax.r2l), v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; - ax.range = [v0 + (axRange[0] - v0) * zoom, v0 + (axRange[1] - v0) * zoom]; + function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); } + ax.range = axRange.map(doZoom); } if(ew) { @@ -61389,7 +61439,10 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { for(var i = 0; i < axList.length; i++) { var axi = axList[i]; if(!axi.fixedrange) { - axi.range = [axi._r[0] - pix / axi._m, axi._r[1] - pix / axi._m]; + axi.range = [ + axi.l2r(axi._rl[0] - pix / axi._m), + axi.l2r(axi._rl[1] - pix / axi._m) + ]; } } } @@ -61412,23 +61465,29 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { 1 / (1 / Math.max(d, -0.3) + 3.222)); } - // dz: set a new value for one end (0 or 1) of an axis array ax, + // dz: set a new value for one end (0 or 1) of an axis array axArray, // and return a pixel shift for that end for the viewbox // based on pixel drag distance d // TODO: this makes (generally non-fatal) errors when you get // near floating point limits - function dz(ax, end, d) { + function dz(axArray, end, d) { var otherEnd = 1 - end, - movedi = 0; - for(var i = 0; i < ax.length; i++) { - var axi = ax[i]; + movedAx, + newLinearizedEnd; + for(var i = 0; i < axArray.length; i++) { + var axi = axArray[i]; if(axi.fixedrange) continue; - movedi = i; - axi.range[end] = axi._r[otherEnd] + - (axi._r[end] - axi._r[otherEnd]) / dZoom(d / axi._length); + movedAx = axi; + newLinearizedEnd = axi._rl[otherEnd] + + (axi._rl[end] - axi._rl[otherEnd]) / dZoom(d / axi._length); + var newEnd = axi.l2r(newLinearizedEnd); + + // if l2r comes back false or undefined, it means we've dragged off + // the end of valid ranges - so stop. + if(newEnd !== false && newEnd !== undefined) axi.range[end] = newEnd; } - return ax[movedi]._length * (ax[movedi]._r[end] - ax[movedi].range[end]) / - (ax[movedi]._r[end] - ax[movedi]._r[otherEnd]); + return movedAx._length * (movedAx._rl[end] - newLinearizedEnd) / + (movedAx._rl[end] - movedAx._rl[otherEnd]); } if(xActive === 'w') dx = dz(xa, 0, dx); @@ -61630,8 +61689,10 @@ function getEndText(ax, end) { diff = Math.abs(initialVal - ax.range[1 - end]), dig; + // TODO: this should basically be ax.r2d but we're doing extra + // rounding here... can we clean up at all? if(ax.type === 'date') { - return Lib.ms2DateTime(initialVal, diff); + return initialVal; } else if(ax.type === 'log') { dig = Math.ceil(Math.max(0, -Math.log(diff) / Math.LN10)) + 3; @@ -61665,7 +61726,7 @@ function isSelectOrLasso(dragmode) { return modes.indexOf(dragmode) !== -1; } -},{"../../components/color":207,"../../components/dragelement":229,"../../components/drawing":231,"../../lib":301,"../../lib/setcursor":311,"../../lib/svg_text_utils":315,"../../plotly":326,"../../registry":366,"./axes":330,"./constants":336,"./select":344,"d3":55,"tinycolor2":182}],338:[function(require,module,exports){ +},{"../../components/color":207,"../../components/dragelement":228,"../../components/drawing":230,"../../lib":303,"../../lib/setcursor":313,"../../lib/svg_text_utils":317,"../../plotly":328,"../../registry":368,"./axes":333,"./constants":338,"./select":346,"d3":55,"tinycolor2":182}],340:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61691,6 +61752,7 @@ var dragElement = require('../../components/dragelement'); var Axes = require('./axes'); var constants = require('./constants'); var dragBox = require('./dragbox'); +var layoutAttributes = require('../layout_attributes'); var fx = module.exports = {}; @@ -61700,24 +61762,12 @@ var fx = module.exports = {}; fx.unhover = dragElement.unhover; fx.layoutAttributes = { - dragmode: { - valType: 'enumerated', - - values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], - dflt: 'zoom', - - }, - hovermode: { - valType: 'enumerated', - - values: ['x', 'y', 'closest', false], - - } }; fx.supplyLayoutDefaults = function(layoutIn, layoutOut, fullData) { + function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, fx.layoutAttributes, attr, dflt); + return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } coerce('dragmode'); @@ -63020,7 +63070,7 @@ fx.inbox = function(v0, v1) { return Infinity; }; -},{"../../components/color":207,"../../components/dragelement":229,"../../components/drawing":231,"../../lib":301,"../../lib/events":296,"../../lib/svg_text_utils":315,"./axes":330,"./constants":336,"./dragbox":337,"d3":55,"fast-isnumeric":61,"tinycolor2":182}],339:[function(require,module,exports){ +},{"../../components/color":207,"../../components/dragelement":228,"../../components/drawing":230,"../../lib":303,"../../lib/events":297,"../../lib/svg_text_utils":317,"../layout_attributes":359,"./axes":333,"./constants":338,"./dragbox":339,"d3":55,"fast-isnumeric":61,"tinycolor2":182}],341:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -63050,6 +63100,8 @@ exports.attrRegex = constants.attrRegex; exports.attributes = require('./attributes'); +exports.layoutAttributes = require('./layout_attributes'); + exports.transitionAxes = require('./transition_axes'); exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) { @@ -63392,7 +63444,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":301,"../plots":359,"./attributes":329,"./axes":330,"./constants":336,"./transition_axes":349,"d3":55}],340:[function(require,module,exports){ +},{"../../lib":303,"../plots":361,"./attributes":332,"./axes":333,"./constants":338,"./layout_attributes":342,"./transition_axes":351,"d3":55}],342:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -63428,8 +63480,8 @@ module.exports = { type: { valType: 'enumerated', // '-' means we haven't yet run autotype or couldn't find any data - // it gets turned into linear in td._fullLayout but not copied back - // to td.data like the others are. + // it gets turned into linear in gd._fullLayout but not copied back + // to gd.data like the others are. values: ['-', 'linear', 'log', 'date', 'category'], dflt: '-', @@ -63453,8 +63505,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -63480,14 +63532,12 @@ module.exports = { }, tick0: { - valType: 'number', - dflt: 0, + valType: 'any', }, dtick: { valType: 'any', - dflt: 1, }, @@ -63728,11 +63778,6 @@ module.exports = { }, - _nestedModules: { - 'rangeslider': 'rangeslider', - 'rangeselector': 'rangeselector', - }, - _deprecated: { autotick: { valType: 'boolean', @@ -63742,7 +63787,7 @@ module.exports = { } }; -},{"../../components/color/attributes":206,"../../lib/extend":297,"../font_attributes":351,"./constants":336}],341:[function(require,module,exports){ +},{"../../components/color/attributes":206,"../../lib/extend":298,"../font_attributes":353,"./constants":338}],343:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -63916,7 +63961,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { }); }; -},{"../../components/color":207,"../../lib":301,"../../registry":366,"../layout_attributes":357,"./axis_defaults":332,"./axis_ids":333,"./constants":336,"./layout_attributes":340,"./position_defaults":343}],342:[function(require,module,exports){ +},{"../../components/color":207,"../../lib":303,"../../registry":368,"../layout_attributes":359,"./axis_defaults":335,"./axis_ids":336,"./constants":338,"./layout_attributes":342,"./position_defaults":345}],344:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -63995,7 +64040,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":55}],343:[function(require,module,exports){ +},{"d3":55}],345:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -64060,7 +64105,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":301,"fast-isnumeric":61}],344:[function(require,module,exports){ +},{"../../lib":303,"fast-isnumeric":61}],346:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -64260,7 +64305,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":207,"../../lib/polygon":308,"./axes":330,"./constants":336}],345:[function(require,module,exports){ +},{"../../components/color":207,"../../lib/polygon":310,"./axes":333,"./constants":338}],347:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -64276,27 +64321,38 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); +var numConstants = require('../../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var constants = require('./constants'); -var cleanDatum = require('./clean_datum'); var axisIds = require('./axis_ids'); /** - * Define the conversion functions for an axis data is used in 4 ways: + * Define the conversion functions for an axis data is used in 5 ways: * * d: data, in whatever form it's provided * c: calcdata: turned into numbers, but not linearized - * l: linearized - same as c except for log axes (and other - * mappings later?) this is used by ranges, and when we - * need to know if it's *possible* to show some data on - * this axis, without caring about the current range + * l: linearized - same as c except for log axes (and other nonlinear + * mappings later?) this is used when we need to know if it's + * *possible* to show some data on this axis, without caring about + * the current range * p: pixel value - mapped to the screen with current size and zoom + * r: ranges, tick0, and annotation positions match one of the above + * but are handled differently for different types: + * - linear and date: data format (d) + * - category: calcdata format (c), and will stay that way because + * the data format has no continuous mapping + * - log: linearized (l) format + * TODO: in v2.0 we plan to change it to data format. At that point + * shapes will work the same way as ranges, tick0, and annotations + * so they can use this conversion too. * - * Creates/updates these conversion functions + * Creates/updates these conversion functions, as well as cleaner functions: + * ax.d2d and ax.clean2r * also clears the autorange bounds ._min and ._max - * and the autotick constraints ._minDtick, ._forceTick0, - * and looks for date ranges that aren't yet in numeric format + * and the autotick constraints ._minDtick, ._forceTick0 */ module.exports = function setConvert(ax) { @@ -64316,20 +64372,119 @@ module.exports = function setConvert(ax) { return 0.5 * (r0 + r1 - 3 * clipMult * Math.abs(r0 - r1)); } - else return constants.BADNUM; + else return BADNUM; + } + + function fromLog(v) { + return Math.pow(10, v); + } + + function num(v) { + if(!isNumeric(v)) return BADNUM; + v = Number(v); + if(v < -FP_SAFE || v > FP_SAFE) return BADNUM; + return isNumeric(v) ? Number(v) : BADNUM; } - function fromLog(v) { return Math.pow(10, v); } - function num(v) { return isNumeric(v) ? Number(v) : constants.BADNUM; } ax.c2l = (ax.type === 'log') ? toLog : num; ax.l2c = (ax.type === 'log') ? fromLog : num; ax.l2d = function(v) { return ax.c2d(ax.l2c(v)); }; ax.p2d = function(v) { return ax.l2d(ax.p2l(v)); }; + /* + * fn to make sure range is a couplet of valid & distinct values + * keep numbers away from the limits of floating point numbers, + * and dates away from the ends of our date system (+/- 9999 years) + * + * optional param rangeAttr: operate on a different attribute, like + * ax._r, rather than ax.range + */ + ax.cleanRange = function(rangeAttr) { + if(!rangeAttr) rangeAttr = 'range'; + var range = ax[rangeAttr], + axLetter = (ax._id || 'x').charAt(0), + i, dflt; + + if(ax.type === 'date') dflt = constants.DFLTRANGEDATE; + else if(axLetter === 'y') dflt = constants.DFLTRANGEY; + else dflt = constants.DFLTRANGEX; + + // make sure we don't later mutate the defaults + dflt = dflt.slice(); + + if(!range || range.length !== 2) { + ax[rangeAttr] = dflt; + return; + } + + if(ax.type === 'date') { + // check if milliseconds or js date objects are provided for range + // and convert to date strings + range[0] = Lib.cleanDate(range[0]); + range[1] = Lib.cleanDate(range[1]); + } + + for(i = 0; i < 2; i++) { + if(ax.type === 'date') { + if(!Lib.isDateTime(range[i])) { + ax[rangeAttr] = dflt; + break; + } + + if(range[i] < Lib.MIN_MS) range[i] = Lib.MIN_MS; + if(range[i] > Lib.MAX_MS) range[i] = Lib.MAX_MS; + + if(ax.r2l(range[0]) === ax.r2l(range[1])) { + // split by +/- 1 second + var linCenter = Lib.constrain(ax.r2l(range[0]), + Lib.MIN_MS + 1000, Lib.MAX_MS - 1000); + range[0] = ax.l2r(linCenter - 1000); + range[1] = ax.l2r(linCenter + 1000); + break; + } + } + else { + if(!isNumeric(range[i])) { + if(isNumeric(range[1 - i])) { + range[i] = range[1 - i] * (i ? 10 : 0.1); + } + else { + ax[rangeAttr] = dflt; + break; + } + } + + if(range[i] < -FP_SAFE) range[i] = -FP_SAFE; + else if(range[i] > FP_SAFE) range[i] = FP_SAFE; + + if(range[0] === range[1]) { + // somewhat arbitrary: split by 1 or 1ppm, whichever is bigger + var inc = Math.max(1, Math.abs(range[0] * 1e-6)); + range[0] -= inc; + range[1] += inc; + } + } + } + }; + + // find the range value at the specified (linear) fraction of the axis + ax.fraction2r = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return ax.l2r(rl0 + v * (rl1 - rl0)); + }; + + // find the fraction of the range at the specified range value + ax.r2fraction = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return (ax.r2l(v) - rl0) / (rl1 - rl0); + }; + // set scaling to pixels ax.setScale = function(usePrivateRange) { var gs = ax._gd._fullLayout._size, - i; + axLetter = ax._id.charAt(0); // TODO cleaner way to handle this case if(!ax._categories) ax._categories = []; @@ -64345,40 +64500,23 @@ module.exports = function setConvert(ax) { // issue if we transform the drawn layer *and* use the new axis range to // draw the data. This allows us to construct setConvert using the pre- // interaction values of the range: - var range = (usePrivateRange && ax._r) ? ax._r : ax.range; - - // make sure we have a range (linearized data values) - // and that it stays away from the limits of javascript numbers - if(!range || range.length !== 2 || range[0] === range[1]) { - range = [-1, 1]; - } - for(i = 0; i < 2; i++) { - if(!isNumeric(range[i])) { - range[i] = isNumeric(range[1 - i]) ? - (range[1 - i] * (i ? 10 : 0.1)) : - (i ? 1 : -1); - } - - if(range[i] < -(Number.MAX_VALUE / 2)) { - range[i] = -(Number.MAX_VALUE / 2); - } - else if(range[i] > Number.MAX_VALUE / 2) { - range[i] = Number.MAX_VALUE / 2; - } + var rangeAttr = (usePrivateRange && ax._r) ? '_r' : 'range'; + ax.cleanRange(rangeAttr); - } + var rl0 = ax.r2l(ax[rangeAttr][0]), + rl1 = ax.r2l(ax[rangeAttr][1]); - if(ax._id.charAt(0) === 'y') { + if(axLetter === 'y') { ax._offset = gs.t + (1 - ax.domain[1]) * gs.h; ax._length = gs.h * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[0] - range[1]); - ax._b = -ax._m * range[1]; + ax._m = ax._length / (rl0 - rl1); + ax._b = -ax._m * rl1; } else { ax._offset = gs.l + ax.domain[0] * gs.w; ax._length = gs.w * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[1] - range[0]); - ax._b = -ax._m * range[0]; + ax._m = ax._length / (rl1 - rl0); + ax._b = -ax._m * rl0; } if(!isFinite(ax._m) || !isFinite(ax._b)) { @@ -64391,7 +64529,7 @@ module.exports = function setConvert(ax) { }; ax.l2p = function(v) { - if(!isNumeric(v)) return constants.BADNUM; + if(!isNumeric(v)) return BADNUM; // include 2 fractional digits on pixel, for PDF zooming etc return d3.round(ax._b + ax._m * v, 2); @@ -64402,42 +64540,62 @@ module.exports = function setConvert(ax) { ax.c2p = function(v, clip) { return ax.l2p(ax.c2l(v, clip)); }; ax.p2c = function(px) { return ax.l2c(ax.p2l(px)); }; + // clip doesn't do anything here yet, but in v2.0 when log axes get + // refactored it will... so including it now so we don't forget. + ax.r2p = function(v, clip) { return ax.l2p(ax.r2l(v, clip)); }; + ax.p2r = function(px) { return ax.l2r(ax.p2l(px)); }; + + ax.r2c = function(v) { return ax.l2c(ax.r2l(v)); }; + ax.c2r = function(v) { return ax.l2r(ax.c2l(v)); }; + if(['linear', 'log', '-'].indexOf(ax.type) !== -1) { ax.c2d = num; - ax.d2c = function(v) { - v = cleanDatum(v); - return isNumeric(v) ? Number(v) : constants.BADNUM; - }; - ax.d2l = function(v, clip) { - if(ax.type === 'log') return ax.c2l(ax.d2c(v), clip); - else return ax.d2c(v); - }; + ax.d2c = Lib.cleanNumber; + if(ax.type === 'log') { + ax.d2l = function(v, clip) { + return ax.c2l(ax.d2c(v), clip); + }; + ax.d2r = ax.d2l; + ax.r2d = ax.l2d; + } + else { + ax.d2l = Lib.cleanNumber; + ax.d2r = Lib.cleanNumber; + ax.r2d = num; + } + ax.r2l = num; + ax.l2r = num; } else if(ax.type === 'date') { - ax.c2d = function(v) { - return isNumeric(v) ? Lib.ms2DateTime(v) : constants.BADNUM; - }; + ax.c2d = Lib.ms2DateTime; ax.d2c = function(v) { - return (isNumeric(v)) ? Number(v) : Lib.dateTime2ms(v); + // NOTE: Changed this behavior: previously we took any numeric value + // to be a ms, even if it was a string that could be a bare year. + // Now we convert it as a date if at all possible, and only try + // as ms if that fails. + var ms = Lib.dateTime2ms(v); + if(ms === BADNUM) { + if(isNumeric(v)) ms = Number(v); + else return BADNUM; + } + return Lib.constrain(ms, Lib.MIN_MS, Lib.MAX_MS); }; ax.d2l = ax.d2c; - - // check if date strings or js date objects are provided for range - // and convert to ms - if(ax.range && ax.range.length > 1) { - try { - var ar1 = ax.range.map(Lib.dateTime2ms); - if(!isNumeric(ax.range[0]) && isNumeric(ar1[0])) { - ax.range[0] = ar1[0]; - } - if(!isNumeric(ax.range[1]) && isNumeric(ar1[1])) { - ax.range[1] = ar1[1]; - } - } - catch(e) { Lib.error(e, ax.range); } - } + ax.r2l = ax.d2c; + ax.l2r = ax.c2d; + ax.d2r = Lib.identity; + ax.r2d = Lib.identity; + ax.cleanr = function(v) { + /* + * If v is already a date string this is a noop, but running it + * through d2c and back validates the value: + * normalizes Date objects, milliseconds, and out-of-bounds dates + * so we always end up with either a clean date string or BADNUM + */ + return ax.c2d(ax.d2c(v)); + }; } else if(ax.type === 'category') { @@ -64460,38 +64618,42 @@ module.exports = function setConvert(ax) { } var c = ax._categories.indexOf(v); - return c === -1 ? constants.BADNUM : c; + return c === -1 ? BADNUM : c; }; ax.d2l = ax.d2c; + ax.r2l = num; + ax.l2r = num; + ax.d2r = ax.d2c; + ax.r2d = ax.c2d; } // makeCalcdata: takes an x or y array and converts it // to a position on the axis object "ax" // inputs: - // tdc - a data object from td.data - // axletter - a string, either 'x' or 'y', for which item + // trace - a data object from gd.data + // axLetter - a string, either 'x' or 'y', for which item // to convert (TODO: is this now always the same as // the first letter of ax._id?) // in case the expected data isn't there, make a list of // integers based on the opposite data - ax.makeCalcdata = function(tdc, axletter) { + ax.makeCalcdata = function(trace, axLetter) { var arrayIn, arrayOut, i; - if(axletter in tdc) { - arrayIn = tdc[axletter]; + if(axLetter in trace) { + arrayIn = trace[axLetter]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = ax.d2c(arrayIn[i]); } else { - var v0 = ((axletter + '0') in tdc) ? - ax.d2c(tdc[axletter + '0']) : 0, - dv = (tdc['d' + axletter]) ? - Number(tdc['d' + axletter]) : 1; + var v0 = ((axLetter + '0') in trace) ? + ax.d2c(trace[axLetter + '0']) : 0, + dv = (trace['d' + axLetter]) ? + Number(trace['d' + axLetter]) : 1; // the opposing data, for size if we have x and dx etc - arrayIn = tdc[{x: 'y', y: 'x'}[axletter]]; + arrayIn = trace[{x: 'y', y: 'x'}[axLetter]]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = v0 + i * dv; @@ -64506,11 +64668,11 @@ module.exports = function setConvert(ax) { ax._max = []; // and for bar charts and box plots: reset forced minimum tick spacing - ax._minDtick = null; - ax._forceTick0 = null; + delete ax._minDtick; + delete ax._forceTick0; }; -},{"../../lib":301,"./axis_ids":333,"./clean_datum":335,"./constants":336,"d3":55,"fast-isnumeric":61}],346:[function(require,module,exports){ +},{"../../constants/numerical":289,"../../lib":303,"./axis_ids":336,"./constants":338,"d3":55,"fast-isnumeric":61}],348:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -64580,8 +64742,8 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe */ function getShowAttrDflt(containerIn) { var showAttrsAll = ['showexponent', - 'showtickprefix', - 'showticksuffix'], + 'showtickprefix', + 'showticksuffix'], showAttrs = showAttrsAll.filter(function(a) { return containerIn[a] !== undefined; }), @@ -64594,7 +64756,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":301}],347:[function(require,module,exports){ +},{"../../lib":303}],349:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -64627,7 +64789,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":301,"./layout_attributes":340}],348:[function(require,module,exports){ +},{"../../lib":303,"./layout_attributes":342}],350:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -64640,6 +64802,8 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, 'use strict'; var isNumeric = require('fast-isnumeric'); +var Lib = require('../../lib'); +var ONEDAY = require('../../constants/numerical').ONEDAY; module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType) { @@ -64651,15 +64815,56 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } if(Array.isArray(containerIn.tickvals)) tickmodeDefault = 'array'; - else if(containerIn.dtick && isNumeric(containerIn.dtick)) { + else if(containerIn.dtick) { tickmodeDefault = 'linear'; } var tickmode = coerce('tickmode', tickmodeDefault); if(tickmode === 'auto') coerce('nticks'); else if(tickmode === 'linear') { - coerce('tick0'); - coerce('dtick'); + // dtick is usually a positive number, but there are some + // special strings available for log or date axes + // default is 1 day for dates, otherwise 1 + var dtickDflt = (axType === 'date') ? ONEDAY : 1; + var dtick = coerce('dtick', dtickDflt); + if(isNumeric(dtick)) { + containerOut.dtick = (dtick > 0) ? Number(dtick) : dtickDflt; + } + else if(typeof dtick !== 'string') { + containerOut.dtick = dtickDflt; + } + else { + // date and log special cases are all one character plus a number + var prefix = dtick.charAt(0), + dtickNum = dtick.substr(1); + + dtickNum = isNumeric(dtickNum) ? Number(dtickNum) : 0; + if((dtickNum <= 0) || !( + // "M" gives ticks every (integer) n months + (axType === 'date' && prefix === 'M' && dtickNum === Math.round(dtickNum)) || + // "L" gives ticks linearly spaced in data (not in position) every (float) f + (axType === 'log' && prefix === 'L') || + // "D1" gives powers of 10 with all small digits between, "D2" gives only 2 and 5 + (axType === 'log' && prefix === 'D' && (dtickNum === 1 || dtickNum === 2)) + )) { + containerOut.dtick = dtickDflt; + } + } + + // tick0 can have different valType for different axis types, so + // validate that now. Also for dates, change milliseconds to date strings + var tick0Dflt = (axType === 'date') ? '2000-01-01' : 0; + var tick0 = coerce('tick0', tick0Dflt); + if(axType === 'date') { + containerOut.tick0 = Lib.cleanDate(tick0, tick0Dflt); + } + // Aside from date axes, dtick must be numeric; D1 and D2 modes ignore tick0 entirely + else if(isNumeric(tick0) && dtick !== 'D1' && dtick !== 'D2') { + containerOut.tick0 = Number(tick0); + } + else { + containerOut.tick0 = tick0Dflt; + } } else { var tickvals = coerce('tickvals'); @@ -64668,7 +64873,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"fast-isnumeric":61}],349:[function(require,module,exports){ +},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],351:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -64980,7 +65185,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../lib":301,"../../plotly":326,"../../registry":366,"./axes":330,"d3":55}],350:[function(require,module,exports){ +},{"../../lib":303,"../../plotly":328,"../../registry":368,"./axes":333,"d3":55}],352:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -65392,7 +65597,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":301,"../plotly":326}],351:[function(require,module,exports){ +},{"../lib":303,"../plotly":328}],353:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -65423,7 +65628,7 @@ module.exports = { } }; -},{}],352:[function(require,module,exports){ +},{}],354:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -65464,7 +65669,7 @@ module.exports = { } }; -},{}],353:[function(require,module,exports){ +},{}],355:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -65505,8 +65710,7 @@ function createCamera(scene) { } result.mouseListener = mouseChange(element, function(buttons, x, y) { - var xrange = scene.xaxis.range, - yrange = scene.yaxis.range, + var dataBox = scene.calcDataBox(), viewBox = plot.viewBox; var lastX = result.lastPos[0], @@ -65518,14 +65722,15 @@ function createCamera(scene) { // mouseChange gives y about top; convert to about bottom y = (viewBox[3] - viewBox[1]) - y; - function updateRange(range, start, end) { + function updateRange(i0, start, end) { var range0 = Math.min(start, end), range1 = Math.max(start, end); if(range0 !== range1) { - range[0] = range0; - range[1] = range1; - result.dataBox = range; + dataBox[i0] = range0; + dataBox[i0 + 2] = range1; + result.dataBox = dataBox; + scene.setRanges(dataBox); } else { scene.selectBox.selectBox = [0, 0, 1, 1]; @@ -65537,11 +65742,11 @@ function createCamera(scene) { case 'zoom': if(buttons) { var dataX = x / - (viewBox[2] - viewBox[0]) * (xrange[1] - xrange[0]) + - xrange[0]; + (viewBox[2] - viewBox[0]) * (dataBox[2] - dataBox[0]) + + dataBox[0]; var dataY = y / - (viewBox[3] - viewBox[1]) * (yrange[1] - yrange[0]) + - yrange[0]; + (viewBox[3] - viewBox[1]) * (dataBox[3] - dataBox[1]) + + dataBox[1]; if(!result.boxEnabled) { result.boxStart[0] = dataX; @@ -65554,8 +65759,8 @@ function createCamera(scene) { result.boxEnabled = true; } else if(result.boxEnabled) { - updateRange(xrange, result.boxStart[0], result.boxEnd[0]); - updateRange(yrange, result.boxStart[1], result.boxEnd[1]); + updateRange(0, result.boxStart[0], result.boxEnd[0]); + updateRange(1, result.boxStart[1], result.boxEnd[1]); unSetAutoRange(); result.boxEnabled = false; } @@ -65565,15 +65770,17 @@ function createCamera(scene) { result.boxEnabled = false; if(buttons) { - var dx = (lastX - x) * (xrange[1] - xrange[0]) / + var dx = (lastX - x) * (dataBox[2] - dataBox[0]) / (plot.viewBox[2] - plot.viewBox[0]); - var dy = (lastY - y) * (yrange[1] - yrange[0]) / + var dy = (lastY - y) * (dataBox[3] - dataBox[1]) / (plot.viewBox[3] - plot.viewBox[1]); - xrange[0] += dx; - xrange[1] += dx; - yrange[0] += dy; - yrange[1] += dy; + dataBox[0] += dx; + dataBox[2] += dx; + dataBox[1] += dy; + dataBox[3] += dy; + + scene.setRanges(dataBox); result.lastInputTime = Date.now(); unSetAutoRange(); @@ -65587,8 +65794,7 @@ function createCamera(scene) { }); result.wheelListener = mouseWheel(element, function(dx, dy) { - var xrange = scene.xaxis.range, - yrange = scene.yaxis.range, + var dataBox = scene.calcDataBox(), viewBox = plot.viewBox; var lastX = result.lastPos[0], @@ -65602,16 +65808,18 @@ function createCamera(scene) { var scale = Math.exp(0.1 * dy / (viewBox[3] - viewBox[1])); var cx = lastX / - (viewBox[2] - viewBox[0]) * (xrange[1] - xrange[0]) + - xrange[0]; + (viewBox[2] - viewBox[0]) * (dataBox[2] - dataBox[0]) + + dataBox[0]; var cy = lastY / - (viewBox[3] - viewBox[1]) * (yrange[1] - yrange[0]) + - yrange[0]; + (viewBox[3] - viewBox[1]) * (dataBox[3] - dataBox[1]) + + dataBox[1]; - xrange[0] = (xrange[0] - cx) * scale + cx; - xrange[1] = (xrange[1] - cx) * scale + cx; - yrange[0] = (yrange[0] - cy) * scale + cy; - yrange[1] = (yrange[1] - cy) * scale + cy; + dataBox[0] = (dataBox[0] - cx) * scale + cx; + dataBox[2] = (dataBox[2] - cx) * scale + cx; + dataBox[1] = (dataBox[1] - cy) * scale + cy; + dataBox[3] = (dataBox[3] - cy) * scale + cy; + + scene.setRanges(dataBox); result.lastInputTime = Date.now(); unSetAutoRange(); @@ -65625,7 +65833,7 @@ function createCamera(scene) { return result; } -},{"mouse-change":143,"mouse-wheel":145}],354:[function(require,module,exports){ +},{"mouse-change":143,"mouse-wheel":145}],356:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -65871,7 +66079,7 @@ function createAxes2D(scene) { module.exports = createAxes2D; -},{"../../lib/html2unicode":300,"../../lib/str2rgbarray":314,"../cartesian/axes":330,"../plots":359}],355:[function(require,module,exports){ +},{"../../lib/html2unicode":302,"../../lib/str2rgbarray":316,"../cartesian/axes":333,"../plots":361}],357:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -65983,7 +66191,7 @@ exports.toSVG = function(gd) { } }; -},{"../../constants/xmlns_namespaces":291,"../cartesian/attributes":329,"../plots":359,"./scene2d":356}],356:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":291,"../cartesian/attributes":332,"../plots":361,"./scene2d":358}],358:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66296,14 +66504,9 @@ var relayoutCallback = function(scene) { }; proto.cameraChanged = function() { - var camera = this.camera, - xrange = this.xaxis.range, - yrange = this.yaxis.range; + var camera = this.camera; - this.glplot.setDataBox([ - xrange[0], yrange[0], - xrange[1], yrange[1] - ]); + this.glplot.setDataBox(this.calcDataBox()); var nextTicks = this.computeTickMarks(); var curTicks = this.glplotOptions.ticks; @@ -66401,9 +66604,7 @@ proto.plot = function(fullData, calcData, fullLayout) { options.ticks = this.computeTickMarks(); - var xrange = this.xaxis.range; - var yrange = this.yaxis.range; - options.dataBox = [xrange[0], yrange[0], xrange[1], yrange[1]]; + options.dataBox = this.calcDataBox(); options.merge(fullLayout); glplot.update(options); @@ -66412,6 +66613,27 @@ proto.plot = function(fullData, calcData, fullLayout) { this.glplot.draw(); }; +proto.calcDataBox = function() { + var xaxis = this.xaxis, + yaxis = this.yaxis, + xrange = xaxis.range, + yrange = yaxis.range, + xr2l = xaxis.r2l, + yr2l = yaxis.r2l; + + return [xr2l(xrange[0]), yr2l(yrange[0]), xr2l(xrange[1]), yr2l(yrange[1])]; +}; + +proto.setRanges = function(dataBox) { + var xaxis = this.xaxis, + yaxis = this.yaxis, + xl2r = xaxis.l2r, + yl2r = yaxis.l2r; + + xaxis.range = [xl2r(dataBox[0]), xl2r(dataBox[2])]; + yaxis.range = [yl2r(dataBox[1]), yl2r(dataBox[3])]; +}; + proto.updateTraces = function(fullData, calcData) { var traceIds = Object.keys(this.traces); var i, j, fullTrace; @@ -66590,7 +66812,7 @@ proto.hoverFormatter = function(axisName, val) { return Axes.tickText(axis, axis.c2l(val), 'hover').text; }; -},{"../../lib/html2unicode":300,"../../lib/show_no_webgl_msg":312,"../../plots/cartesian/axes":330,"../../plots/cartesian/graph_interact":338,"./camera":353,"./convert":354,"gl-plot2d":94,"gl-select-box":119,"gl-spikes2d":128,"webgl-context":195}],357:[function(require,module,exports){ +},{"../../lib/html2unicode":302,"../../lib/show_no_webgl_msg":314,"../../plots/cartesian/axes":333,"../../plots/cartesian/graph_interact":340,"./camera":355,"./convert":356,"gl-plot2d":94,"gl-select-box":119,"gl-spikes2d":128,"webgl-context":195}],359:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66732,28 +66954,22 @@ module.exports = { }, - _composedModules: { - '*': 'Fx' + dragmode: { + valType: 'enumerated', + + values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], + dflt: 'zoom', + }, - - _nestedModules: { - 'xaxis': 'Axes', - 'yaxis': 'Axes', - 'scene': 'gl3d', - 'geo': 'geo', - 'ternary': 'ternary', - 'mapbox': 'mapbox', - - 'legend': 'legend', - 'annotations': 'annotations', - 'shapes': 'shapes', - 'images': 'images', - 'updatemenus': 'updatemenus', - 'sliders': 'sliders' + hovermode: { + valType: 'enumerated', + + values: ['x', 'y', 'closest', false], + } }; -},{"../components/color/attributes":206,"../lib":301,"./font_attributes":351}],358:[function(require,module,exports){ +},{"../components/color/attributes":206,"../lib":303,"./font_attributes":353}],360:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66791,7 +67007,7 @@ module.exports = { } }; -},{}],359:[function(require,module,exports){ +},{}],361:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67158,6 +67374,9 @@ plots.sendDataToCloud = function(gd) { // gd._fullLayout._basePlotModules // is a list of all the plot modules required to draw the plot. // +// gd._fullLayout._transformModules +// is a list of all the transform modules invoked. +// plots.supplyDefaults = function(gd) { var oldFullLayout = gd._fullLayout || {}, newFullLayout = gd._fullLayout = {}, @@ -67169,6 +67388,9 @@ plots.supplyDefaults = function(gd) { var i; + // Create all the storage space for frames, but only if doesn't already exist + if(!gd._transitionData) plots.createTransitionData(gd); + // first fill in what we can of layout without looking at data // because fullData needs a few things from layout @@ -67229,7 +67451,7 @@ plots.supplyDefaults = function(gd) { } // finally, fill in the pieces of layout that may need to look at data - plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData); + plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData); // TODO remove in v2.0.0 // add has-plot-type refs to fullLayout for backward compatibility @@ -67268,12 +67490,6 @@ plots.supplyDefaults = function(gd) { (gd.calcdata[i][0] || {}).trace = trace; } } - - // Create all the storage space for frames, but only if doesn't already - // exist: - if(!gd._transitionData) { - plots.createTransitionData(gd); - } }; // Create storage for all of the data related to frames and transitions: @@ -67440,6 +67656,8 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) { basePlotModules = fullLayout._basePlotModules = [], cnt = 0; + fullLayout._transformModules = []; + function pushModule(fullTrace) { dataOut.push(fullTrace); @@ -67657,6 +67875,8 @@ function supplyTransformDefaults(traceIn, traceOut, layout) { transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn); transformOut.type = type; transformOut._module = _module; + + Lib.pushUnique(layout._transformModules, _module); } else { transformOut = Lib.extendFlat({}, transformIn); @@ -67826,7 +68046,7 @@ function calculateReservedMargins(margins) { return resultingMargin; } -plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { +plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, transitionData) { var i, _module; // can't be be part of basePlotModules loop @@ -67857,6 +68077,16 @@ plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { } } + // transform module layout defaults + var transformModules = layoutOut._transformModules; + for(i = 0; i < transformModules.length; i++) { + _module = transformModules[i]; + + if(_module.supplyLayoutDefaults) { + _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData, transitionData); + } + } + // should FX be a component? Plotly.Fx.supplyLayoutDefaults(layoutIn, layoutOut, fullData); @@ -67884,8 +68114,16 @@ plots.purge = function(gd) { // remove modebar if(fullLayout._modeBar) fullLayout._modeBar.destroy(); - if(gd._transitionData && gd._transitionData._animationRaf) { - window.cancelAnimationFrame(gd._transitionData._animationRaf); + if(gd._transitionData) { + // Ensure any dangling callbacks are simply dropped if the plot is purged. + // This is more or less only actually important for testing. + if(gd._transitionData._interruptCallbacks) { + gd._transitionData._interruptCallbacks.length = 0; + } + + if(gd._transitionData._animationRaf) { + window.cancelAnimationFrame(gd._transitionData._animationRaf); + } } // data and layout @@ -68162,9 +68400,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { // convert native dates to date strings... // mostly for external users exporting to plotly - if(d && d.getTime) { - return Lib.ms2DateTime(d); - } + if(Lib.isJSDate(d)) return Lib.ms2DateTime(+d); return d; } @@ -68209,7 +68445,7 @@ plots.modifyFrames = function(gd, operations) { break;*/ case 'replace': frame = op.value; - var oldName = _frames[op.index].name; + var oldName = (_frames[op.index] || {}).name; var newName = frame.name; _frames[op.index] = _hash[newName] = frame; @@ -68343,8 +68579,14 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { for(i = 0; i < containerPaths.length; i++) { containerProp = Lib.nestedProperty(expandedObj, containerPaths[i]); containerVal = containerProp.get(); - containerProp.set(null); - Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + + if(containerVal === undefined) { + Lib.nestedProperty(containerObj, containerPaths[i]).set(null); + } + else { + containerProp.set(null); + Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + } } } @@ -68358,15 +68600,20 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { if(!srcContainer) continue; destProp = Lib.nestedProperty(dest, containerPaths[i]); - destContainer = destProp.get(); + if(!Array.isArray(destContainer)) { destContainer = []; destProp.set(destContainer); } for(j = 0; j < srcContainer.length; j++) { - destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcContainer[j]); + var srcObj = srcContainer[j]; + + if(srcObj === null) destContainer[j] = null; + else { + destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcObj); + } } destProp.set(destContainer); @@ -68377,7 +68624,7 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { }; plots.dataArrayContainers = ['transforms']; -plots.layoutArrayContainers = ['annotations', 'shapes', 'images', 'sliders', 'updatemenus']; +plots.layoutArrayContainers = Registry.layoutArrayContainers; /* * Extend a trace definition. This method: @@ -68436,11 +68683,15 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var trace = gd._fullData[traceIdx]; var module = trace._module; - if(!module || !module.animatable) { - continue; - } + // There's nothing to do if this module is not defined: + if(!module) continue; - transitionedTraces.push(traceIdx); + // Don't register the trace as transitioned if it doens't know what to do. + // If it *is* registered, it will receive a callback that it's responsible + // for calling in order to register the transition as having completed. + if(module.animatable) { + transitionedTraces.push(traceIdx); + } gd.data[traceIndices[i]] = plots.extendTrace(gd.data[traceIndices[i]], data[i]); } @@ -68494,6 +68745,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var aborted = false; function executeTransitions() { + + gd.emit('plotly_transitioning', []); + return new Promise(function(resolve) { // This flag is used to disabled things like autorange: gd._transitioning = true; @@ -68578,6 +68832,11 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function completeTransition(callback) { + // This a simple workaround for tests which purge the graph before animations + // have completed. That's not a very common case, so this is the simplest + // fix. + if(!gd._transitionData) return; + flushCallbacks(gd._transitionData._interruptCallbacks); return Promise.resolve().then(function() { @@ -68595,6 +68854,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function interruptPreviousTransitions() { + // Fail-safe against purged plot: + if(!gd._transitionData) return; + // If a transition is interrupted, set this to false. At the moment, the only thing that would // interrupt a transition is another transition, so that it will momentarily be set to true // again, but this determines whether autorange or dragbox work, so it's for the sake of @@ -68622,13 +68884,13 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var seq = [plots.previousPromises, interruptPreviousTransitions, prepareTransitions, executeTransitions]; - var transitionStarting = Lib.syncOrAsync(seq, gd); - if(!transitionStarting || !transitionStarting.then) transitionStarting = Promise.resolve(); + if(!transitionStarting || !transitionStarting.then) { + transitionStarting = Promise.resolve(); + } return transitionStarting.then(function() { - gd.emit('plotly_transitioning', []); return gd; }); }; @@ -68731,7 +68993,7 @@ plots.doCalcdata = function(gd, traces) { } }; -},{"../components/color":207,"../components/errorbars":237,"../lib":301,"../plotly":326,"../registry":366,"./animation_attributes":327,"./attributes":328,"./command":350,"./font_attributes":351,"./frame_attributes":352,"./layout_attributes":357,"d3":55,"fast-isnumeric":61}],360:[function(require,module,exports){ +},{"../components/color":207,"../components/errorbars":236,"../lib":303,"../plotly":328,"../registry":368,"./animation_attributes":329,"./attributes":331,"./command":352,"./font_attributes":353,"./frame_attributes":354,"./layout_attributes":359,"d3":55,"fast-isnumeric":61}],362:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -68756,7 +69018,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":404}],361:[function(require,module,exports){ +},{"../../traces/scatter/attributes":407}],363:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -68871,7 +69133,7 @@ module.exports = { } }; -},{"../../lib/extend":297,"../cartesian/layout_attributes":340}],362:[function(require,module,exports){ +},{"../../lib/extend":298,"../cartesian/layout_attributes":342}],364:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -68886,7 +69148,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":363,"./micropolar_manager":364}],363:[function(require,module,exports){ +},{"./micropolar":365,"./micropolar_manager":366}],365:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70305,7 +70567,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":301,"d3":55}],364:[function(require,module,exports){ +},{"../../lib":303,"d3":55}],366:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70391,7 +70653,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":207,"../../lib":301,"./micropolar":363,"./undo_manager":365,"d3":55}],365:[function(require,module,exports){ +},{"../../components/color":207,"../../lib":303,"./micropolar":365,"./undo_manager":367,"d3":55}],367:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70457,7 +70719,7 @@ module.exports = function UndoManager() { }; }; -},{}],366:[function(require,module,exports){ +},{}],368:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70473,11 +70735,12 @@ var Lib = require('./lib'); var basePlotAttributes = require('./plots/attributes'); exports.modules = {}; -exports.allTypes = []; exports.allCategories = {}; +exports.allTypes = []; exports.subplotsRegistry = {}; exports.transformsRegistry = {}; exports.componentsRegistry = {}; +exports.layoutArrayContainers = []; /** * register a module as the handler for a trace type @@ -70543,6 +70806,16 @@ exports.registerSubplot = function(_module) { exports.subplotsRegistry[plotType] = _module; }; +exports.registerComponent = function(_module) { + var name = _module.name; + + exports.componentsRegistry[name] = _module; + + if(_module.layoutAttributes && _module.layoutAttributes._isLinkedToArray) { + Lib.pushUnique(exports.layoutArrayContainers, name); + } +}; + /** * Get registered module using trace object or trace type * @@ -70614,7 +70887,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib":301,"./plots/attributes":328}],367:[function(require,module,exports){ +},{"./lib":303,"./plots/attributes":331}],369:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70741,11 +71014,12 @@ module.exports = function clonePlot(graphObj, options) { } } - var td = document.createElement('div'); - if(options.tileClass) td.className = options.tileClass; + var gd = document.createElement('div'); + if(options.tileClass) gd.className = options.tileClass; var plotTile = { - td: td, + gd: gd, + td: gd, // for external (image server) compatibility layout: newLayout, data: newData, config: { @@ -70765,13 +71039,13 @@ module.exports = function clonePlot(graphObj, options) { plotTile.config.setBackground = options.setBackground || 'opaque'; } - // attaching the default Layout the td, so you can grab it later - plotTile.td.defaultLayout = cloneLayoutOverride(options.tileClass); + // attaching the default Layout the gd, so you can grab it later + plotTile.gd.defaultLayout = cloneLayoutOverride(options.tileClass); return plotTile; }; -},{"../lib":301,"../plots/plots":359}],368:[function(require,module,exports){ +},{"../lib":303,"../plots/plots":361}],370:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70837,7 +71111,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":301,"../plot_api/to_image":324,"./filesaver":369}],369:[function(require,module,exports){ +},{"../lib":303,"../plot_api/to_image":326,"./filesaver":371}],371:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70905,7 +71179,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],370:[function(require,module,exports){ +},{}],372:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70938,7 +71212,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],371:[function(require,module,exports){ +},{}],373:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70964,7 +71238,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":367,"./download":368,"./helpers":370,"./svgtoimg":372,"./toimage":373,"./tosvg":374}],372:[function(require,module,exports){ +},{"./cloneplot":369,"./download":370,"./helpers":372,"./svgtoimg":374,"./toimage":375,"./tosvg":376}],374:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71095,7 +71369,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":301,"events":60}],373:[function(require,module,exports){ +},{"../lib":303,"events":60}],375:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71128,7 +71402,7 @@ function toImage(gd, opts) { var ev = new EventEmitter(); var clone = clonePlot(gd, {format: 'png'}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -71175,7 +71449,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":301,"../plotly":326,"./cloneplot":367,"./helpers":370,"./svgtoimg":372,"./tosvg":374,"events":60}],374:[function(require,module,exports){ +},{"../lib":303,"../plotly":328,"./cloneplot":369,"./helpers":372,"./svgtoimg":374,"./tosvg":376,"events":60}],376:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71294,7 +71568,7 @@ module.exports = function toSVG(gd, format) { return s; }; -},{"../components/color":207,"../components/drawing":231,"../constants/xmlns_namespaces":291,"../lib/svg_text_utils":315,"d3":55}],375:[function(require,module,exports){ +},{"../components/color":207,"../components/drawing":230,"../constants/xmlns_namespaces":291,"../lib/svg_text_utils":317,"d3":55}],377:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71308,93 +71582,90 @@ module.exports = function toSVG(gd, format) { var heatmapAttrs = require('../heatmap/attributes'); var scatterAttrs = require('../scatter/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line; -module.exports = extendFlat({}, - { - z: heatmapAttrs.z, - x: heatmapAttrs.x, - x0: heatmapAttrs.x0, - dx: heatmapAttrs.dx, - y: heatmapAttrs.y, - y0: heatmapAttrs.y0, - dy: heatmapAttrs.dy, - text: heatmapAttrs.text, - transpose: heatmapAttrs.transpose, - xtype: heatmapAttrs.xtype, - ytype: heatmapAttrs.ytype, - - connectgaps: heatmapAttrs.connectgaps, - - autocontour: { - valType: 'boolean', - dflt: true, +module.exports = extendFlat({}, { + z: heatmapAttrs.z, + x: heatmapAttrs.x, + x0: heatmapAttrs.x0, + dx: heatmapAttrs.dx, + y: heatmapAttrs.y, + y0: heatmapAttrs.y0, + dy: heatmapAttrs.dy, + text: heatmapAttrs.text, + transpose: heatmapAttrs.transpose, + xtype: heatmapAttrs.xtype, + ytype: heatmapAttrs.ytype, + + connectgaps: heatmapAttrs.connectgaps, + + autocontour: { + valType: 'boolean', + dflt: true, + + + }, + ncontours: { + valType: 'integer', + dflt: 0, + + + }, + + contours: { + start: { + valType: 'number', + dflt: null, }, - ncontours: { - valType: 'integer', - dflt: 0, + end: { + valType: 'number', + dflt: null, }, - - contours: { - start: { - valType: 'number', - dflt: null, - - - }, - end: { - valType: 'number', - dflt: null, - - - }, - size: { - valType: 'number', - dflt: null, - - - }, - coloring: { - valType: 'enumerated', - values: ['fill', 'heatmap', 'lines', 'none'], - dflt: 'fill', - - - }, - showlines: { - valType: 'boolean', - dflt: true, - - - } + size: { + valType: 'number', + dflt: null, + + }, - - line: { - color: extendFlat({}, scatterLineAttrs.color, { - - }), - width: scatterLineAttrs.width, - dash: scatterLineAttrs.dash, - smoothing: extendFlat({}, scatterLineAttrs.smoothing, { - - }) + coloring: { + valType: 'enumerated', + values: ['fill', 'heatmap', 'lines', 'none'], + dflt: 'fill', + + }, - - _nestedModules: { - 'colorbar': 'Colorbar' + showlines: { + valType: 'boolean', + dflt: true, + + } }, + + line: { + color: extendFlat({}, scatterLineAttrs.color, { + + }), + width: scatterLineAttrs.width, + dash: scatterLineAttrs.dash, + smoothing: extendFlat({}, scatterLineAttrs.smoothing, { + + }) + } +}, colorscaleAttrs, - {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} + { autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}) }, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":213,"../../lib/extend":297,"../heatmap/attributes":383,"../scatter/attributes":404}],376:[function(require,module,exports){ +},{"../../components/colorbar/attributes":208,"../../components/colorscale/attributes":212,"../../lib/extend":298,"../heatmap/attributes":385,"../scatter/attributes":407}],378:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71447,7 +71718,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../plots/cartesian/axes":330,"../heatmap/calc":384}],377:[function(require,module,exports){ +},{"../../plots/cartesian/axes":333,"../heatmap/calc":386}],379:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71508,7 +71779,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":210,"../../plots/plots":359,"./make_color_map":379}],378:[function(require,module,exports){ +},{"../../components/colorbar/draw":210,"../../plots/plots":361,"./make_color_map":381}],380:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71552,7 +71823,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":301,"../contour/style_defaults":380,"../heatmap/has_columns":388,"../heatmap/xyz_defaults":390,"./attributes":375}],379:[function(require,module,exports){ +},{"../../lib":303,"../contour/style_defaults":382,"../heatmap/has_columns":390,"../heatmap/xyz_defaults":392,"./attributes":377}],381:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71630,7 +71901,7 @@ module.exports = function makeColorMap(trace) { }); }; -},{"../../components/colorscale":222,"d3":55}],380:[function(require,module,exports){ +},{"../../components/colorscale":221,"d3":55}],382:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71666,7 +71937,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout) } }; -},{"../../components/colorscale/defaults":217}],381:[function(require,module,exports){ +},{"../../components/colorscale/defaults":216}],383:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71853,7 +72124,7 @@ function createContour(scene, fullTrace, calcTrace) { module.exports = createContour; -},{"../../lib/str2rgbarray":314,"../../plots/cartesian/axes":330,"../contour/make_color_map":379,"gl-contour2d":68,"gl-heatmap2d":75}],382:[function(require,module,exports){ +},{"../../lib/str2rgbarray":316,"../../plots/cartesian/axes":333,"../contour/make_color_map":381,"gl-contour2d":68,"gl-heatmap2d":75}],384:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71884,7 +72155,7 @@ ContourGl.meta = { module.exports = ContourGl; -},{"../../plots/gl2d":355,"../contour/attributes":375,"../contour/calc":376,"../contour/colorbar":377,"../contour/defaults":378,"./convert":381}],383:[function(require,module,exports){ +},{"../../plots/gl2d":357,"../contour/attributes":377,"../contour/calc":378,"../contour/colorbar":379,"../contour/defaults":380,"./convert":383}],385:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71897,79 +72168,77 @@ module.exports = ContourGl; var scatterAttrs = require('../scatter/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; -module.exports = extendFlat({}, - { - z: { - valType: 'data_array', - - }, - x: scatterAttrs.x, - x0: scatterAttrs.x0, - dx: scatterAttrs.dx, - y: scatterAttrs.y, - y0: scatterAttrs.y0, - dy: scatterAttrs.dy, - text: { - valType: 'data_array', - - }, - transpose: { - valType: 'boolean', - dflt: false, - - - }, - xtype: { - valType: 'enumerated', - values: ['array', 'scaled'], - - - }, - ytype: { - valType: 'enumerated', - values: ['array', 'scaled'], - - - }, - zsmooth: { - valType: 'enumerated', - values: ['fast', 'best', false], - dflt: false, - - - }, - connectgaps: { - valType: 'boolean', - dflt: false, - - - }, - xgap: { - valType: 'number', - dflt: 0, - min: 0, - - - }, - ygap: { - valType: 'number', - dflt: 0, - min: 0, - - - }, - _nestedModules: { - 'colorbar': 'Colorbar' - } +module.exports = extendFlat({}, { + z: { + valType: 'data_array', + + }, + x: scatterAttrs.x, + x0: scatterAttrs.x0, + dx: scatterAttrs.dx, + y: scatterAttrs.y, + y0: scatterAttrs.y0, + dy: scatterAttrs.dy, + text: { + valType: 'data_array', + + }, + transpose: { + valType: 'boolean', + dflt: false, + + + }, + xtype: { + valType: 'enumerated', + values: ['array', 'scaled'], + + + }, + ytype: { + valType: 'enumerated', + values: ['array', 'scaled'], + + + }, + zsmooth: { + valType: 'enumerated', + values: ['fast', 'best', false], + dflt: false, + + + }, + connectgaps: { + valType: 'boolean', + dflt: false, + + }, + xgap: { + valType: 'number', + dflt: 0, + min: 0, + + + }, + ygap: { + valType: 'number', + dflt: 0, + min: 0, + + + }, +}, colorscaleAttrs, - {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} + { autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}) }, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":213,"../../lib/extend":297,"../scatter/attributes":404}],384:[function(require,module,exports){ +},{"../../components/colorbar/attributes":208,"../../components/colorscale/attributes":212,"../../lib/extend":298,"../scatter/attributes":407}],386:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72080,9 +72349,9 @@ module.exports = function calc(gd, trace) { // create arrays of brick boundaries, to be used by autorange and heatmap.plot var xlen = maxRowLength(z), - xIn = trace.xtype === 'scaled' ? '' : trace.x, + xIn = trace.xtype === 'scaled' ? '' : x, xArray = makeBoundArray(trace, xIn, x0, dx, xlen, xa), - yIn = trace.ytype === 'scaled' ? '' : trace.y, + yIn = trace.ytype === 'scaled' ? '' : y, yArray = makeBoundArray(trace, yIn, y0, dy, z.length, ya); // handled in gl2d convert step @@ -72152,7 +72421,6 @@ function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) { var isArrayOfTwoItemsOrMore = Array.isArray(arrayIn) && arrayIn.length > 1; if(isArrayOfTwoItemsOrMore && !isHist && (ax.type !== 'category')) { - arrayIn = arrayIn.map(ax.d2c); var len = arrayIn.length; // given vals are brick centers @@ -72195,7 +72463,7 @@ function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) { else { dv = dvIn || 1; - if(isHist || ax.type === 'category') v0 = v0In || 0; + if(isHist || ax.type === 'category') v0 = ax.r2c(v0In) || 0; else if(Array.isArray(arrayIn) && arrayIn.length === 1) v0 = arrayIn[0]; else if(v0In === undefined) v0 = 0; else v0 = ax.d2c(v0In); @@ -72419,7 +72687,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../components/colorscale/calc":214,"../../lib":301,"../../plots/cartesian/axes":330,"../../registry":366,"../histogram2d/calc":397,"./convert_column_xyz":386,"./has_columns":388,"./max_row_length":389,"fast-isnumeric":61}],385:[function(require,module,exports){ +},{"../../components/colorscale/calc":213,"../../lib":303,"../../plots/cartesian/axes":333,"../../registry":368,"../histogram2d/calc":400,"./convert_column_xyz":388,"./has_columns":390,"./max_row_length":391,"fast-isnumeric":61}],387:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72470,7 +72738,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":210,"../../components/colorscale":222,"../../lib":301,"../../plots/plots":359,"fast-isnumeric":61}],386:[function(require,module,exports){ +},{"../../components/colorbar/draw":210,"../../components/colorscale":221,"../../lib":303,"../../plots/plots":361,"fast-isnumeric":61}],388:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72527,7 +72795,7 @@ module.exports = function convertColumnXYZ(trace, xa, ya) { if(hasColumnText) trace.text = text; }; -},{"../../lib":301}],387:[function(require,module,exports){ +},{"../../lib":303}],389:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72572,7 +72840,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":217,"../../lib":301,"./attributes":383,"./has_columns":388,"./xyz_defaults":390}],388:[function(require,module,exports){ +},{"../../components/colorscale/defaults":216,"../../lib":303,"./attributes":385,"./has_columns":390,"./xyz_defaults":392}],390:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72588,7 +72856,7 @@ module.exports = function(trace) { return !Array.isArray(trace.z[0]); }; -},{}],389:[function(require,module,exports){ +},{}],391:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72610,7 +72878,7 @@ module.exports = function maxRowLength(z) { return len; }; -},{}],390:[function(require,module,exports){ +},{}],392:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72699,7 +72967,7 @@ function isValidZ(z) { return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"./has_columns":388,"fast-isnumeric":61}],391:[function(require,module,exports){ +},{"./has_columns":390,"fast-isnumeric":61}],393:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72715,7 +72983,7 @@ var heatmapAttrs = require('../scatter/attributes'); module.exports = heatmapAttrs; -},{"../scatter/attributes":404}],392:[function(require,module,exports){ +},{"../scatter/attributes":407}],394:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72854,7 +73122,7 @@ function createHeatmap(scene, fullTrace, calcTrace) { module.exports = createHeatmap; -},{"../../lib/str2rgbarray":314,"../../plots/cartesian/axes":330,"gl-heatmap2d":75}],393:[function(require,module,exports){ +},{"../../lib/str2rgbarray":316,"../../plots/cartesian/axes":333,"gl-heatmap2d":75}],395:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72885,7 +73153,7 @@ HeatmapGl.meta = { module.exports = HeatmapGl; -},{"../../plots/gl2d":355,"../heatmap/calc":384,"../heatmap/colorbar":385,"../heatmap/defaults":387,"./attributes":391,"./convert":392}],394:[function(require,module,exports){ +},{"../../plots/gl2d":357,"../heatmap/calc":386,"../heatmap/colorbar":387,"../heatmap/defaults":389,"./attributes":393,"./convert":394}],396:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72911,7 +73179,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],395:[function(require,module,exports){ +},{}],397:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72985,7 +73253,82 @@ module.exports = { } }; -},{"fast-isnumeric":61}],396:[function(require,module,exports){ +},{"fast-isnumeric":61}],398:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; +var isNumeric = require('fast-isnumeric'); +var cleanDate = require('../../lib').cleanDate; +var ONEDAY = require('../../constants/numerical').ONEDAY; + +/* + * cleanBins: validate attributes autobin[xy] and [xy]bins.(start, end, size) + * Mutates trace so all these attributes are valid. + * + * Normally this kind of thing would happen during supplyDefaults, but + * in this case we need to know the axis type, and axis type isn't set until + * after trace supplyDefaults are completed. So this gets called during the + * calc step, when data are inserted into bins. + */ +module.exports = function cleanBins(trace, ax, binDirection) { + var axType = ax.type, + binAttr = binDirection + 'bins', + bins = trace[binAttr]; + + if(!bins) bins = trace[binAttr] = {}; + + var cleanBound = (axType === 'date') ? + function(v) { return (v || v === 0) ? cleanDate(v) : null; } : + function(v) { return isNumeric(v) ? Number(v) : null; }; + + bins.start = cleanBound(bins.start); + bins.end = cleanBound(bins.end); + + // logic for bin size is very similar to dtick (cartesian/tick_value_defaults) + // but without the extra string options for log axes + // ie the only strings we accept are M for months + var sizeDflt = (axType === 'date') ? ONEDAY : 1, + binSize = bins.size; + + if(isNumeric(binSize)) { + bins.size = (binSize > 0) ? Number(binSize) : sizeDflt; + } + else if(typeof binSize !== 'string') { + bins.size = sizeDflt; + } + else { + // date special case: "M" gives bins every (integer) n months + var prefix = binSize.charAt(0), + sizeNum = binSize.substr(1); + + sizeNum = isNumeric(sizeNum) ? Number(sizeNum) : 0; + if((sizeNum <= 0) || !( + axType === 'date' && prefix === 'M' && sizeNum === Math.round(sizeNum) + )) { + bins.size = sizeDflt; + } + } + + var autoBinAttr = 'autobin' + binDirection; + + if(typeof trace[autoBinAttr] !== 'boolean') { + trace[autoBinAttr] = !( + (bins.start || bins.start === 0) && + (bins.end || bins.end === 0) + ); + } + + if(!trace[autoBinAttr]) delete trace['nbins' + binDirection]; +}; + +},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],399:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73020,7 +73363,7 @@ module.exports = { } }; -},{}],397:[function(require,module,exports){ +},{}],400:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73038,6 +73381,7 @@ var Axes = require('../../plots/cartesian/axes'); var binFunctions = require('../histogram/bin_functions'); var normFunctions = require('../histogram/norm_functions'); var doAvg = require('../histogram/average'); +var cleanBins = require('../histogram/clean_bins'); module.exports = function calc(gd, trace) { @@ -73052,6 +73396,9 @@ module.exports = function calc(gd, trace) { z, i; + cleanBins(trace, xa, 'x'); + cleanBins(trace, ya, 'y'); + var serieslen = Math.min(x.length, y.length); if(x.length > serieslen) x.splice(serieslen, x.length - serieslen); if(y.length > serieslen) y.splice(serieslen, y.length - serieslen); @@ -73061,8 +73408,10 @@ module.exports = function calc(gd, trace) { if(trace.autobinx || !('xbins' in trace)) { trace.xbins = Axes.autoBin(x, xa, trace.nbinsx, '2d'); if(trace.type === 'histogram2dcontour') { - trace.xbins.start -= trace.xbins.size; - trace.xbins.end += trace.xbins.size; + // the "true" last argument reverses the tick direction (which we can't + // just do with a minus sign because of month bins) + trace.xbins.start = xa.c2r(Axes.tickIncrement(xa.r2c(trace.xbins.start), trace.xbins.size, true)); + trace.xbins.end = xa.c2r(Axes.tickIncrement(xa.r2c(trace.xbins.end), trace.xbins.size)); } // copy bin info back to the source data. @@ -73071,8 +73420,8 @@ module.exports = function calc(gd, trace) { if(trace.autobiny || !('ybins' in trace)) { trace.ybins = Axes.autoBin(y, ya, trace.nbinsy, '2d'); if(trace.type === 'histogram2dcontour') { - trace.ybins.start -= trace.ybins.size; - trace.ybins.end += trace.ybins.size; + trace.ybins.start = ya.c2r(Axes.tickIncrement(ya.r2c(trace.ybins.start), trace.ybins.size, true)); + trace.ybins.end = ya.c2r(Axes.tickIncrement(ya.r2c(trace.ybins.end), trace.ybins.size)); } trace._input.ybins = trace.ybins; } @@ -73114,11 +73463,11 @@ module.exports = function calc(gd, trace) { // decrease end a little in case of rounding errors var binspec = trace.xbins, - binend = binspec.end + - (binspec.start - Axes.tickIncrement(binspec.start, binspec.size)) / 1e6; + binStart = xa.r2c(binspec.start), + binEnd = xa.r2c(binspec.end) + + (binStart - Axes.tickIncrement(binStart, binspec.size)) / 1e6; - for(i = binspec.start; i < binend; - i = Axes.tickIncrement(i, binspec.size)) { + for(i = binStart; i < binEnd; i = Axes.tickIncrement(i, binspec.size)) { onecol.push(sizeinit); if(Array.isArray(xbins)) xbins.push(i); if(doavg) zerocol.push(0); @@ -73127,15 +73476,16 @@ module.exports = function calc(gd, trace) { var nx = onecol.length; x0 = trace.xbins.start; - dx = (i - x0) / nx; - x0 += dx / 2; + var x0c = xa.r2c(x0); + dx = (i - x0c) / nx; + x0 = xa.c2r(x0c + dx / 2); binspec = trace.ybins; - binend = binspec.end + - (binspec.start - Axes.tickIncrement(binspec.start, binspec.size)) / 1e6; + binStart = ya.r2c(binspec.start); + binEnd = ya.r2c(binspec.end) + + (binStart - Axes.tickIncrement(binStart, binspec.size)) / 1e6; - for(i = binspec.start; i < binend; - i = Axes.tickIncrement(i, binspec.size)) { + for(i = binStart; i < binEnd; i = Axes.tickIncrement(i, binspec.size)) { z.push(onecol.concat()); if(Array.isArray(ybins)) ybins.push(i); if(doavg) counts.push(zerocol.concat()); @@ -73144,8 +73494,9 @@ module.exports = function calc(gd, trace) { var ny = z.length; y0 = trace.ybins.start; - dy = (i - y0) / ny; - y0 += dy / 2; + var y0c = ya.r2c(y0); + dy = (i - y0c) / ny; + y0 = ya.c2r(y0c + dy / 2); if(densitynorm) { xinc = onecol.map(function(v, i) { @@ -73186,7 +73537,7 @@ module.exports = function calc(gd, trace) { }; }; -},{"../../lib":301,"../../plots/cartesian/axes":330,"../histogram/average":394,"../histogram/bin_functions":395,"../histogram/norm_functions":396}],398:[function(require,module,exports){ +},{"../../lib":303,"../../plots/cartesian/axes":333,"../histogram/average":396,"../histogram/bin_functions":397,"../histogram/clean_bins":398,"../histogram/norm_functions":399}],401:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73213,7 +73564,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":207}],399:[function(require,module,exports){ +},{"../../components/color":207}],402:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73302,7 +73653,7 @@ module.exports = { } }; -},{"../scattergl/attributes":428}],400:[function(require,module,exports){ +},{"../scattergl/attributes":431}],403:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73534,7 +73885,7 @@ function createPointcloud(scene, data) { module.exports = createPointcloud; -},{"../../lib/str2rgbarray":314,"../scatter/get_trace_color":412,"gl-pointcloud2d":103}],401:[function(require,module,exports){ +},{"../../lib/str2rgbarray":316,"../scatter/get_trace_color":415,"gl-pointcloud2d":103}],404:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73579,7 +73930,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { coerce('marker.border.arearatio'); }; -},{"../../lib":301,"./attributes":399}],402:[function(require,module,exports){ +},{"../../lib":303,"./attributes":402}],405:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73609,7 +73960,7 @@ pointcloud.meta = { module.exports = pointcloud; -},{"../../plots/gl2d":355,"../scatter3d/calc":427,"./attributes":399,"./convert":400,"./defaults":401}],403:[function(require,module,exports){ +},{"../../plots/gl2d":357,"../scatter3d/calc":430,"./attributes":402,"./convert":403,"./defaults":404}],406:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73647,7 +73998,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":301}],404:[function(require,module,exports){ +},{"../../lib":303}],407:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73659,11 +74010,11 @@ module.exports = function arraysToCalcdata(cd) { 'use strict'; var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var Drawing = require('../../components/drawing'); - var constants = require('./constants'); - var extendFlat = require('../../lib/extend').extendFlat; module.exports = { @@ -73839,12 +74190,15 @@ module.exports = { }, + showscale: { valType: 'boolean', dflt: false, }, + colorbar: colorbarAttrs, + line: extendFlat({}, { width: { valType: 'number', @@ -73892,6 +74246,7 @@ module.exports = { }, }, + r: { valType: 'data_array', @@ -73900,14 +74255,12 @@ module.exports = { valType: 'data_array', }, - _nestedModules: { // nested module coupling - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_y: errorBarAttrs, + error_x: errorBarAttrs }; -},{"../../components/colorscale/color_attributes":215,"../../components/drawing":231,"../../lib/extend":297,"./constants":409}],405:[function(require,module,exports){ +},{"../../components/colorbar/attributes":208,"../../components/colorscale/color_attributes":214,"../../components/drawing":230,"../../components/errorbars/attributes":232,"../../lib/extend":298,"./constants":412}],408:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74038,7 +74391,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":301,"../../plots/cartesian/axes":330,"./colorscale_calc":408,"./subtypes":424,"fast-isnumeric":61}],406:[function(require,module,exports){ +},{"../../lib":303,"../../plots/cartesian/axes":333,"./colorscale_calc":411,"./subtypes":427,"fast-isnumeric":61}],409:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74077,7 +74430,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],407:[function(require,module,exports){ +},{}],410:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74134,7 +74487,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":210,"../../components/colorscale":222,"../../lib":301,"../../plots/plots":359,"fast-isnumeric":61}],408:[function(require,module,exports){ +},{"../../components/colorbar/draw":210,"../../components/colorscale":221,"../../lib":303,"../../plots/plots":361,"fast-isnumeric":61}],411:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74167,7 +74520,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":214,"../../components/colorscale/has_colorscale":221,"./subtypes":424}],409:[function(require,module,exports){ +},{"../../components/colorscale/calc":213,"../../components/colorscale/has_colorscale":220,"./subtypes":427}],412:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74183,7 +74536,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],410:[function(require,module,exports){ +},{}],413:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74263,7 +74616,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":236,"../../lib":301,"./attributes":404,"./constants":409,"./fillcolor_defaults":411,"./line_defaults":415,"./line_shape_defaults":417,"./marker_defaults":420,"./subtypes":424,"./text_defaults":425,"./xy_defaults":426}],411:[function(require,module,exports){ +},{"../../components/errorbars/defaults":235,"../../lib":303,"./attributes":407,"./constants":412,"./fillcolor_defaults":414,"./line_defaults":418,"./line_shape_defaults":420,"./marker_defaults":423,"./subtypes":427,"./text_defaults":428,"./xy_defaults":429}],414:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74301,7 +74654,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":207}],412:[function(require,module,exports){ +},{"../../components/color":207}],415:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74354,7 +74707,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":207,"./subtypes":424}],413:[function(require,module,exports){ +},{"../../components/color":207,"./subtypes":427}],416:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74523,7 +74876,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":207,"../../components/errorbars":237,"../../lib":301,"../../plots/cartesian/constants":336,"../../plots/cartesian/graph_interact":338,"./get_trace_color":412}],414:[function(require,module,exports){ +},{"../../components/color":207,"../../components/errorbars":236,"../../lib":303,"../../plots/cartesian/constants":338,"../../plots/cartesian/graph_interact":340,"./get_trace_color":415}],417:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74567,7 +74920,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":339,"./arrays_to_calcdata":403,"./attributes":404,"./calc":405,"./clean_data":406,"./colorbar":407,"./defaults":410,"./hover":413,"./plot":421,"./select":422,"./style":423,"./subtypes":424}],415:[function(require,module,exports){ +},{"../../plots/cartesian":341,"./arrays_to_calcdata":406,"./attributes":407,"./calc":408,"./clean_data":409,"./colorbar":410,"./defaults":413,"./hover":416,"./plot":424,"./select":425,"./style":426,"./subtypes":427}],418:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74600,7 +74953,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce('line.dash'); }; -},{"../../components/colorscale/defaults":217,"../../components/colorscale/has_colorscale":221}],416:[function(require,module,exports){ +},{"../../components/colorscale/defaults":216,"../../components/colorscale/has_colorscale":220}],419:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74612,7 +74965,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, 'use strict'; -var Axes = require('../../plots/cartesian/axes'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function linePoints(d, opts) { @@ -74623,7 +74976,6 @@ module.exports = function linePoints(d, opts) { baseTolerance = opts.baseTolerance, linear = opts.linear, segments = [], - badnum = Axes.BADNUM, minTolerance = 0.2, // fraction of tolerance "so close we don't even consider it a new point" pts = new Array(d.length), pti = 0, @@ -74660,7 +75012,7 @@ module.exports = function linePoints(d, opts) { function getPt(index) { var x = xa.c2p(d[index].x), y = ya.c2p(d[index].y); - if(x === badnum || y === badnum) return false; + if(x === BADNUM || y === BADNUM) return false; return [x, y]; } @@ -74774,7 +75126,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../plots/cartesian/axes":330}],417:[function(require,module,exports){ +},{"../../constants/numerical":289}],420:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74793,7 +75145,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],418:[function(require,module,exports){ +},{}],421:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74834,7 +75186,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],419:[function(require,module,exports){ +},{}],422:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74876,7 +75228,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":61}],420:[function(require,module,exports){ +},{"fast-isnumeric":61}],423:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74936,7 +75288,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":207,"../../components/colorscale/defaults":217,"../../components/colorscale/has_colorscale":221,"./subtypes":424}],421:[function(require,module,exports){ +},{"../../components/color":207,"../../components/colorscale/defaults":216,"../../components/colorscale/has_colorscale":220,"./subtypes":427}],424:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75108,6 +75460,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.visible !== true) return; + transition(tr).style('opacity', trace.opacity); + // BUILD LINES AND FILLS var ownFillEl3, tonext; var ownFillDir = trace.fill.charAt(trace.fill.length - 1); @@ -75433,8 +75787,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { var xa = plotinfo.xaxis, ya = plotinfo.yaxis, - xr = d3.extent(xa.range.map(xa.l2c)), - yr = d3.extent(ya.range.map(ya.l2c)); + xr = d3.extent(xa.range.map(xa.r2l).map(xa.l2c)), + yr = d3.extent(ya.range.map(ya.r2l).map(ya.l2c)); var trace = cdscatter[0].trace; if(!subTypes.hasMarkers(trace)) return; @@ -75472,7 +75826,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":231,"../../components/errorbars":237,"../../lib":301,"../../lib/polygon":308,"./arrays_to_calcdata":403,"./line_points":416,"./link_traces":418,"./subtypes":424,"d3":55}],422:[function(require,module,exports){ +},{"../../components/drawing":230,"../../components/errorbars":236,"../../lib":303,"../../lib/polygon":310,"./arrays_to_calcdata":406,"./line_points":419,"./link_traces":421,"./subtypes":427,"d3":55}],425:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75544,7 +75898,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":424}],423:[function(require,module,exports){ +},{"./subtypes":427}],426:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75586,7 +75940,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":231,"../../components/errorbars":237,"d3":55}],424:[function(require,module,exports){ +},{"../../components/drawing":230,"../../components/errorbars":236,"d3":55}],427:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75622,7 +75976,7 @@ module.exports = { } }; -},{"../../lib":301}],425:[function(require,module,exports){ +},{"../../lib":303}],428:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75643,7 +75997,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":301}],426:[function(require,module,exports){ +},{"../../lib":303}],429:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75688,7 +76042,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { return len; }; -},{}],427:[function(require,module,exports){ +},{}],430:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75717,7 +76071,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":403,"../scatter/colorscale_calc":408}],428:[function(require,module,exports){ +},{"../scatter/arrays_to_calcdata":406,"../scatter/colorscale_calc":411}],431:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75783,6 +76137,7 @@ module.exports = { sizemode: scatterMarkerAttrs.sizemode, opacity: scatterMarkerAttrs.opacity, showscale: scatterMarkerAttrs.showscale, + colorbar: scatterMarkerAttrs.colorbar, line: extendDeep({}, colorAttributes('marker.line'), { width: scatterMarkerLineAttrs.width }) @@ -75792,14 +76147,12 @@ module.exports = { values: ['none', 'tozeroy', 'tozerox'] }), fillcolor: scatterAttrs.fillcolor, - _nestedModules: { - 'error_x': 'ErrorBars', - 'error_y': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_y: scatterAttrs.error_y, + error_x: scatterAttrs.error_x }; -},{"../../components/colorscale/color_attributes":215,"../../constants/gl2d_dashes":288,"../../constants/gl_markers":289,"../../lib/extend":297,"../scatter/attributes":404}],429:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":214,"../../constants/gl2d_dashes":287,"../../constants/gl_markers":288,"../../lib/extend":298,"../scatter/attributes":407}],432:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -76416,7 +76769,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../components/errorbars":237,"../../constants/gl2d_dashes":288,"../../constants/gl_markers":289,"../../lib":301,"../../lib/gl_format_color":299,"../../lib/str2rgbarray":314,"../../lib/typed_array_truncate":316,"../../plots/cartesian/axes":330,"../../plots/cartesian/axis_autotype":331,"../scatter/get_trace_color":412,"../scatter/make_bubble_size_func":419,"../scatter/subtypes":424,"fast-isnumeric":61,"gl-error2d":71,"gl-line2d":79,"gl-scatter2d":117,"gl-scatter2d-fancy":112}],430:[function(require,module,exports){ +},{"../../components/errorbars":236,"../../constants/gl2d_dashes":287,"../../constants/gl_markers":288,"../../lib":303,"../../lib/gl_format_color":301,"../../lib/str2rgbarray":316,"../../lib/typed_array_truncate":318,"../../plots/cartesian/axes":333,"../../plots/cartesian/axis_autotype":334,"../scatter/get_trace_color":415,"../scatter/make_bubble_size_func":422,"../scatter/subtypes":427,"fast-isnumeric":61,"gl-error2d":71,"gl-line2d":79,"gl-scatter2d":117,"gl-scatter2d-fancy":112}],433:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -76473,7 +76826,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":236,"../../lib":301,"../scatter/constants":409,"../scatter/fillcolor_defaults":411,"../scatter/line_defaults":415,"../scatter/marker_defaults":420,"../scatter/subtypes":424,"../scatter/xy_defaults":426,"./attributes":428}],431:[function(require,module,exports){ +},{"../../components/errorbars/defaults":235,"../../lib":303,"../scatter/constants":412,"../scatter/fillcolor_defaults":414,"../scatter/line_defaults":418,"../scatter/marker_defaults":423,"../scatter/subtypes":427,"../scatter/xy_defaults":429,"./attributes":431}],434:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -76504,5 +76857,5 @@ ScatterGl.meta = { module.exports = ScatterGl; -},{"../../plots/gl2d":355,"../scatter/colorbar":407,"../scatter3d/calc":427,"./attributes":428,"./convert":429,"./defaults":430}]},{},[6])(6) +},{"../../plots/gl2d":357,"../scatter/colorbar":410,"../scatter3d/calc":430,"./attributes":431,"./convert":432,"./defaults":433}]},{},[6])(6) }); \ No newline at end of file diff --git a/dist/plotly-gl2d.min.js b/dist/plotly-gl2d.min.js index c55a029928a..7682716346b 100644 --- a/dist/plotly-gl2d.min.js +++ b/dist/plotly-gl2d.min.js @@ -1,36 +1,36 @@ /** -* plotly.js (gl2d - minified) v1.19.2 +* plotly.js (gl2d - minified) v1.20.0 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function 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 u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){var r=e[o][1][t];return i(r?r:t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o>16&255,r[1]=n>>8&255,r[2]=255&n):f.test(t)&&(n=t.match(h),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3])),!e)for(var i=0;i<3;++i)r[i]=r[i]/255;return r}function u(t,e){var r,n;if("string"!=typeof t)return t;if(r=[],"#"===t[0]?(t=t.substr(1),3===t.length&&(t+=t),n=parseInt(t,16),r[0]=n>>16&255,r[1]=n>>8&255,r[2]=255&n):f.test(t)&&(n=t.match(h),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3]),n[4]?r[3]=parseFloat(n[4]):r[3]=1),!e)for(var i=0;i<3;++i)r[i]=r[i]/255;return r}var c={},f=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,.*)?\)$/,h=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,?\s*(.*)?\)$/;return c.isPlainObject=t,c.linspace=e,c.zip3=n,c.sum=i,c.zip=r,c.isEqual=s,c.copy2D=a,c.copy1D=o,c.str2RgbArray=l,c.str2RgbaArray=u,c};e.exports=n()},{}],11:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],12:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).add(e[0].mul(t[1])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":22}],13:[function(t,e,r){"use strict";function n(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}e.exports=n},{}],14:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]),t[1].mul(e[0]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":22}],15:[function(t,e,r){"use strict";function n(t,e){if(i(t))return e?u(t,n(e)):[t[0].clone(),t[1].clone()];var r,c,f=0;if(a(t))r=t.clone();else if("string"==typeof t)r=s(t);else{if(0===t)return[o(0),o(1)];if(t===Math.floor(t))r=o(t);else{for(;t!==Math.floor(t);)t*=Math.pow(2,256),f-=256;r=o(t)}}if(i(e))r.mul(e[1]),c=e[0].clone();else if(a(e))c=e.clone();else if("string"==typeof e)c=s(e);else if(e)if(e===Math.floor(e))c=o(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),f+=256;c=o(e)}else c=o(1);return f>0?r=r.shln(f):f<0&&(c=c.shln(-f)),l(r,c)}var i=t("./is-rat"),a=t("./lib/is-bn"),o=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),u=t("./div");e.exports=n},{"./div":14,"./is-rat":16,"./lib/is-bn":20,"./lib/num-to-bn":21,"./lib/rationalize":22,"./lib/str-to-bn":23}],16:[function(t,e,r){"use strict";function n(t){return Array.isArray(t)&&2===t.length&&i(t[0])&&i(t[1])}var i=t("./lib/is-bn");e.exports=n},{"./lib/is-bn":20}],17:[function(t,e,r){"use strict";function n(t){return t.cmp(new i(0))}var i=t("bn.js");e.exports=n},{"bn.js":30}],18:[function(t,e,r){"use strict";function n(t){var e=t.length,r=t.words,n=0;if(1===e)n=r[0];else if(2===e)n=r[0]+67108864*r[1];else for(var n=0,i=0;i20?52:r+32}var i=t("double-bits"),a=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":29,"double-bits":56}],20:[function(t,e,r){"use strict";function n(t){return t&&"object"==typeof t&&Boolean(t.words)}t("bn.js");e.exports=n},{"bn.js":30}],21:[function(t,e,r){"use strict";function n(t){var e=a.exponent(t);return e<52?new i(t):new i(t*Math.pow(2,52-e)).shln(e-52)}var i=t("bn.js"),a=t("double-bits");e.exports=n},{"bn.js":30,"double-bits":56}],22:[function(t,e,r){"use strict";function n(t,e){var r=a(t),n=a(e);if(0===r)return[i(0),i(1)];if(0===n)return[i(0),i(0)];n<0&&(t=t.neg(),e=e.neg());var o=t.gcd(e);return o.cmpn(1)?[t.div(o),e.div(o)]:[t,e]}var i=t("./num-to-bn"),a=t("./bn-sign");e.exports=n},{"./bn-sign":17,"./num-to-bn":21}],23:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":30}],24:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[0]),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":22}],25:[function(t,e,r){"use strict";function n(t){return i(t[0])*i(t[1])}var i=t("./lib/bn-sign");e.exports=n},{"./lib/bn-sign":17}],26:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":22}],27:[function(t,e,r){"use strict";function n(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var n=e.divmod(r),o=n.div,s=i(o),l=n.mod;if(0===l.cmpn(0))return s;if(s){var u=a(s)+4,c=i(l.shln(u).divRound(r));return s<0&&(c=-c),s+c*Math.pow(2,-u)}var f=r.bitLength()-l.bitLength()+53,c=i(l.shln(f).divRound(r));return f<1023?c*Math.pow(2,-f):(c*=Math.pow(2,-1023),c*Math.pow(2,1023-f))}var i=t("./lib/bn-to-num"),a=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":18,"./lib/ctz":19}],28:[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){var a=new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""));return a()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],29:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return t&=-t,t&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}var i=32;r.INT_BITS=i,r.INT_MAX=2147483647,r.INT_MIN=-1<0)-(t<0)},r.abs=function(t){var e=t>>i-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,e|t>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,t&=15,27030>>>t&1};var a=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|a[t>>>16&255]<<8|a[t>>>24&255]},r.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},r.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),t=65535&(t|t>>>16),t<<16>>16},r.interleave3=function(t,e,r){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t|r<<2},r.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),t=1023&(t|t>>>16),t<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],30:[function(t,e,r){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){return null!==t&&"object"==typeof t&&Array.isArray(t.words)?t:(this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==e&&"be"!==e||(r=e,e=10),void(null!==t&&this._init(t||0,e||10,r||"be")))}function a(t,e,r){for(var n=0,i=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function o(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}function s(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function l(){s.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function u(){s.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function c(){s.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function f(){s.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function h(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function d(t){h.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.sign=!0),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){t<0&&(this.sign=!0,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3){var s=t[i]|t[i-1]<<8|t[i-2]<<16;this.words[o]|=s<>>26-a&67108863,a+=24,a>=26&&(a-=26,o++)}else if("le"===n)for(var i=0,o=0;i>>26-a&67108863,a+=24,a>=26&&(a-=26,o++)}return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6){var o=a(t,r,r+6);this.words[i]|=o<>>26-n&4194303,n+=24,n>=26&&(n-=26,i++)}if(r+6!==e){var o=a(t,e,r+6);this.words[i]|=o<>>26-n&4194303}this.strip()},i.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,s=a%n,l=Math.min(a,a-s)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function(){return(this.red?""};var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],g=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],v=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){if(t=t||10,16===t||"hex"===t){for(var n="",i=0,e=0|e||1,a=0,o=0;o>>24-i&16777215,n=0!==a||o!==this.length-1?p[6-l.length]+l+n:l+n,i+=2,i>=26&&(i-=26,o--)}for(0!==a&&(n=a.toString(16)+n);n.length%e!==0;)n="0"+n;return this.sign&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=g[t],c=v[t],n="",f=this.clone();for(f.sign=!1;0!==f.cmpn(0);){var h=f.modn(c).toString(t);f=f.idivn(c),n=0!==f.cmpn(0)?p[u-h.length]+h+n:h+n}return 0===this.cmpn(0)&&(n="0"+n),this.sign&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toArray=function(t){this.strip();var e=new Array(this.byteLength());e[0]=0;var r=this.clone();if("le"!==t)for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[e.length-n-1]=i}else for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[n]=i}return e},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},i.prototype.bitLength=function(){var t=0,e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function(t){this.sign=this.sign&&t.sign;var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function(t){this.sign=this.sign||t.sign;var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);for(var n=t/26|0,i=t%26;this.length<=n;)this.words[this.length++]=0;return e?this.words[n]=this.words[n]|1<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)},i.prototype.isub=function(t){if(t.sign){t.sign=!1;var e=this.iadd(t);return t.sign=!0,e._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t);if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var 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>>26,a=67108863&r,o=Math.min(n,t.length-1),s=Math.max(0,n-this.length+1);s<=o;s++){var l=n-s,u=0|this.words[l],c=0|t.words[s],f=u*c,h=67108863&f;i=i+(f/67108864|0)|0,h=h+a|0,a=67108863&h,i=i+(h>>>26)|0}e.words[n]=a,r=i}return 0!==r?e.words[n]=r:e.length--, -e.strip()},i.prototype._bigMulTo=function(t,e){e.sign=t.sign!==this.sign,e.length=this.length+t.length;for(var r=0,n=0,i=0;i>>26)|0,n+=a>>>26,a&=67108863}e.words[i]=o,r=a,a=n}return 0!==r?e.words[i]=r:e.length--,e.strip()},i.prototype.mulTo=function(t,e){var r;return r=this.length+t.length<63?this._smallMulTo(t,e):this._bigMulTo(t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.imul=function(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var e=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var n=this.length-2;n>=0;n--){for(var i=0,a=0,o=Math.min(n,r-1),s=Math.max(0,n-e+1);s<=o;s++){var l=n-s,u=this.words[l],c=t.words[s],f=u*c,h=67108863&f;i+=f/67108864|0,h+=a,a=67108863&h,i+=h>>>26}this.words[n]=a,this.words[n+1]+=i,i=0}for(var i=0,l=1;l>>26}return this.strip()},i.prototype.imuln=function(t){r("number"==typeof t);for(var e=0,n=0;n>=26,e+=i/67108864|0,e+=a>>>26,this.words[n]=67108863&a}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.mul(this)},i.prototype.ishln=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=67108863>>>26-e<<26-e;if(0!==e){for(var a=0,o=0;o>>26-e}a&&(this.words[o]=a,this.length++)}if(0!==n){for(var o=this.length-1;o>=0;o--)this.words[o+n]=this.words[o];for(var o=0;o=0);var i;i=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o){this.length-=o;for(var u=0;u=0&&(0!==c||u>=i);u--){var f=this.words[u];this.words[u]=c<<26-a|f>>>a,c=f&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),t<0)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&l}for(;i>26,this.words[i+n]=67108863&l}if(0===s)return this.strip();r(s===-1),s=0;for(var i=0;i>26,this.words[i]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),a=t,o=a.words[a.length-1],s=this._countBits(o);r=26-s,0!==r&&(a=a.shln(r),n.ishln(r),o=a.words[a.length-1]);var l,u=n.length-a.length;if("mod"!==e){l=new i(null),l.length=u+1,l.words=new Array(l.length);for(var c=0;c=0;h--){var d=67108864*n.words[a.length+h]+n.words[a.length+h-1];for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(a,d,h);n.sign;)d--,n.sign=!1,n._ishlnsubmul(a,1,h),0!==n.cmpn(0)&&(n.sign=!n.sign);l&&(l.words[h]=d)}return l&&l.strip(),n.strip(),"div"!==e&&0!==r&&n.ishrn(r),{div:l?l:null,mod:n}},i.prototype.divmod=function(t,e){if(r(0!==t.cmpn(0)),this.sign&&!t.sign){var n,a,o=this.neg().divmod(t,e);return"mod"!==e&&(n=o.div.neg()),"div"!==e&&(a=0===o.mod.cmpn(0)?o.mod:t.sub(o.mod)),{div:n,mod:a}}if(!this.sign&&t.sign){var n,o=this.divmod(t.neg(),e);return"mod"!==e&&(n=o.div.neg()),{div:n,mod:o.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),e):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e)},i.prototype.div=function(t){return this.divmod(t,"div").div},i.prototype.mod=function(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(0===e.mod.cmpn(0))return e.div;var r=e.div.sign?e.mod.isub(t):e.mod,n=t.shrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:e.div.sign?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+this.words[i])%t;return n},i.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=this.words[n]+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var a=new i(1),o=new i(0),s=new i(0),l=new i(1),u=0;e.isEven()&&n.isEven();)e.ishrn(1),n.ishrn(1),++u;for(var c=n.clone(),f=e.clone();0!==e.cmpn(0);){for(;e.isEven();)e.ishrn(1),a.isEven()&&o.isEven()?(a.ishrn(1),o.ishrn(1)):(a.iadd(c).ishrn(1),o.isub(f).ishrn(1));for(;n.isEven();)n.ishrn(1),s.isEven()&&l.isEven()?(s.ishrn(1),l.ishrn(1)):(s.iadd(c).ishrn(1),l.isub(f).ishrn(1));e.cmp(n)>=0?(e.isub(n),a.isub(s),o.isub(l)):(n.isub(e),s.isub(a),l.isub(o))}return{a:s,b:l,gcd:n.ishln(u)}},i.prototype._invmp=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var a=new i(1),o=new i(0),s=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(;e.isEven();)e.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(s).ishrn(1);for(;n.isEven();)n.ishrn(1),o.isEven()?o.ishrn(1):o.iadd(s).ishrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(o)):(n.isub(e),o.isub(a))}return 0===e.cmpn(1)?a:o},i.prototype.gcd=function(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var e=this.clone(),r=t.clone();e.sign=!1,r.sign=!1;for(var n=0;e.isEven()&&r.isEven();n++)e.ishrn(1),r.ishrn(1);for(;;){for(;e.isEven();)e.ishrn(1);for(;r.isEven();)r.ishrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.ishln(n)},i.prototype.invm=function(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function(){return 0===(1&this.words[0])},i.prototype.isOdd=function(){return 1===(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.cmpn=function(t){var e=t<0;if(e&&(t=-t),this.sign&&!e)return-1;if(!this.sign&&e)return 1;t&=67108863,this.strip();var r;if(this.length>1)r=1;else{var n=this.words[0];r=n===t?0:nt.length)return 1;if(this.length=0;r--){var n=this.words[r],i=t.words[r];if(n!==i){ni&&(e=1);break}}return e},i.red=function(t){return new h(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};s.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},s.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength();while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},s.prototype.split=function(t,e){t.ishrn(this.n,0,e)},s.prototype.imulK=function(t){return t.imul(this.k)},n(l,s),l.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,a=o}t.words[i-10]=a>>>22,t.length-=9},l.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e,r=0,n=0;n>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function t(e){if(m[e])return m[e];var t;if("k256"===e)t=new l;else if("p224"===e)t=new u;else if("p192"===e)t=new c;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new f}return m[e]=t,t},h.prototype._verify1=function(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},h.prototype._verify2=function(t,e){r(!t.sign&&!e.sign,"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},h.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},h.prototype.neg=function(t){var e=t.clone();return e.sign=!e.sign,e.iadd(this.m)._forceRed(this)},h.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)},h.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},h.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)},h.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},h.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.shln(e))},h.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},h.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},h.prototype.isqr=function(t){return this.imul(t,t)},h.prototype.sqr=function(t){return this.mul(t,t)},h.prototype.sqrt=function(t){if(0===t.cmpn(0))return t.clone();var e=this.m.andln(3);if(r(e%2===1),3===e){var n=this.m.add(new i(1)).ishrn(2),a=this.pow(t,n);return a}for(var o=this.m.subn(1),s=0;0!==o.cmpn(0)&&0===o.andln(1);)s++,o.ishrn(1);r(0!==o.cmpn(0));var l=new i(1).toRed(this),u=l.redNeg(),c=this.m.subn(1).ishrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,o),a=this.pow(t,o.addn(1).ishrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(l);){for(var g=d,v=0;0!==g.cmp(l);v++)g=g.redSqr();r(v=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},d.prototype.mul=function(t,e){if(0===t.cmpn(0)||0===e.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).ishrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},d.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}}("undefined"==typeof e||e,this)},{}],31:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r>>1;if(!(s<=0)){var l,u=f.mallocDouble(2*s*a),c=f.mallocInt32(a);if(a=i(t,s,u,c),a>0){if(1===s&&n)h.init(a),l=h.sweepComplete(s,r,0,a,u,c,0,a,u,c);else{var p=f.mallocDouble(2*s*o),g=f.mallocInt32(o);o=i(e,s,p,g),o>0&&(h.init(a+o),l=1===s?h.sweepBipartite(s,r,0,a,u,c,0,o,p,g):d(s,r,n,a,u,c,o,p,g),f.free(p),f.free(g))}f.free(u),f.free(c)}return l}}}function o(t,e){c.push([t,e])}function s(t){return c=[],a(t,t,o,!0),c}function l(t,e){return c=[],a(t,e,o,!1),c}function u(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?a(t,t,e,!0):l(t,e);case 3:return a(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}}e.exports=u;var c,f=t("typedarray-pool"),h=t("./lib/sweep"),d=t("./lib/intersect")},{"./lib/intersect":33,"./lib/sweep":37,"typedarray-pool":187}],32:[function(t,e,r){"use strict";function n(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),i=["function ",n,"(",w.join(),"){","var ",u,"=2*",a,";"],l="for(var i="+c+","+p+"="+u+"*"+c+";i<"+f+";++i,"+p+"+="+u+"){var x0="+h+"["+o+"+"+p+"],x1="+h+"["+o+"+"+p+"+"+a+"],xi="+d+"[i];",A="for(var j="+g+","+b+"="+u+"*"+g+";j<"+v+";++j,"+b+"+="+u+"){var y0="+m+"["+o+"+"+b+"],"+(r?"y1="+m+"["+o+"+"+b+"+"+a+"],":"")+"yi="+y+"[j];";return t?i.push(l,_,":",A):i.push(A,_,":",l),r?i.push("if(y1"+v+"-"+g+"){"),t?(e(!0,!1),o.push("}else{"),e(!1,!1)):(o.push("if("+l+"){"),e(!0,!0),o.push("}else{"),e(!0,!1),o.push("}}else{if("+l+"){"),e(!1,!0),o.push("}else{"),e(!1,!1),o.push("}")),o.push("}}return "+r);var s=i.join("")+o.join(""),u=new Function(s);return u()}var a="d",o="ax",s="vv",l="fp",u="es",c="rs",f="re",h="rb",d="ri",p="rp",g="bs",v="be",m="bb",y="bi",b="bp",x="rv",_="Q",w=[a,o,s,c,f,h,d,g,v,m,y];r.partial=i(!1),r.full=i(!0)},{}],33:[function(t,e,r){"use strict";function n(t,e){var r=8*u.log2(e+1)*(t+1)|0,n=u.nextPow2(M*r);L.length0;){R-=1;var O=R*M,P=L[O],N=L[O+1],D=L[O+2],z=L[O+3],F=L[O+4],B=L[O+5],j=R*T,U=S[j],H=S[j+1],V=1&B,q=!!(16&B),G=l,X=u,Y=g,W=E;if(V&&(G=g,X=E,Y=l,W=u),!(2&B&&(D=_(t,P,N,D,G,X,H),N>=D)||4&B&&(N=w(t,P,N,D,G,X,U),N>=D))){var Z=D-N,Q=F-z;if(q){if(t*Z*(Z+Q)=p0)&&!(p1>=hi)",["p0","p1"]),x=g("lo===p0",["p0"]),_=g("lor&&i[f+e]>u;--c,f-=o){for(var h=f,d=f+o,p=0;p>>1,h=2*t,d=f,p=a[h*f+e];u=b?(d=y,p=b):m>=_?(d=v,p=m):(d=x,p=_):b>=_?(d=y,p=b):_>=m?(d=v,p=m):(d=x,p=_);for(var w=h*(c-1),A=h*d,k=0;k=0&&n.push("lo=e[k+n]"),t.indexOf("hi")>=0&&n.push("hi=e[k+o]"),r.push(i.replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}e.exports=n;var i="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],36:[function(t,e,r){"use strict";function n(t,e){e<=4*h?i(0,e-1,t):f(0,e-1,t)}function i(t,e,r){for(var n=2*(t+1),i=t+1;i<=e;++i){for(var a=r[n++],o=r[n++],s=i,l=n-2;s-- >t;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function c(t,e,r,n){t*=2;var i=n[t];return i>1,v=g-n,m=g+n,y=d,b=v,x=g,_=m,w=p,A=t+1,k=e-1,M=0;u(y,b,r)&&(M=y,y=b,b=M),u(_,w,r)&&(M=_,_=w,w=M),u(y,x,r)&&(M=y,y=x,x=M),u(b,x,r)&&(M=b,b=x,x=M),u(y,_,r)&&(M=y,y=_,_=M),u(x,_,r)&&(M=x,x=_,_=M),u(b,w,r)&&(M=b,b=w,w=M),u(b,x,r)&&(M=b,b=x,x=M),u(_,w,r)&&(M=_,_=w,w=M);for(var T=r[2*b],E=r[2*b+1],L=r[2*_],S=r[2*_+1],C=2*y,R=2*x,I=2*w,O=2*d,P=2*g,N=2*p,D=0;D<2;++D){var z=r[C+D],F=r[R+D],B=r[I+D];r[O+D]=z,r[P+D]=F,r[N+D]=B}o(v,t,r),o(m,e,r);for(var j=A;j<=k;++j)if(c(j,T,E,r))j!==A&&a(j,A,r),++A;else if(!c(j,L,S,r))for(;;){if(c(k,L,S,r)){c(k,T,E,r)?(s(j,A,k,r),++A,--k):(a(j,k,r),--k);break}if(--k>>1;h(_,E);for(var L=0,S=0,A=0;A=d)C=C-d|0,i(m,y,S--,C);else if(C>=0)i(g,v,L--,C);else if(C<=-d){C=-C-d|0;for(var R=0;R>>1;h(_,L);for(var S=0,C=0,R=0,k=0;k>1===_[2*k+3]>>1&&(O=2,k+=1),I<0){for(var P=-(I>>1)-1,N=0;N>1)-1;0===O?i(g,v,S--,P):1===O?i(m,y,C--,P):2===O&&i(b,x,R--,P)}}}function l(t,e,r,n,o,s,l,u,c,f,p,m){var y=0,b=2*t,x=e,w=e+t,A=1,k=1;n?k=d:A=d;for(var M=o;M>>1;h(_,S);for(var C=0,M=0;M=d?(I=!n,T-=d):(I=!!n,T-=1),I)a(g,v,C++,T);else{var O=m[T],P=b*T,N=p[P+e+1],D=p[P+e+1+t];t:for(var z=0;z>>1;h(_,A);for(var k=0,y=0;y=d)g[k++]=b-d;else{b-=1;var T=c[b],E=p*b,L=u[E+e+1],S=u[E+e+1+t];t:for(var C=0;C=0;--C)if(g[C]===b){for(var P=C+1;P=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function v(t){return+t!=t&&(t=0),o.alloc(+t)}function m(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))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 G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(n)return G(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return""; -for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return I(this,e,r);case"base64":return L(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function x(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),r=+r,isNaN(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=o.from(e,n)),o.isBuffer(e))return 0===e.length?-1:_(t,e,r,n,i);if("number"==typeof e)return e=255&e,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function _(t,e,r,n,i){function a(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,s=t.length,l=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"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}var u;if(i){var c=-1;for(u=r;us&&(r=s-l),u=r;u>=0;u--){for(var f=!0,h=0;hi&&(n=i)):n=i;var a=e.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o239?4:a>223?3:a>191?2:1;if(i+s<=r){var l,u,c,f;switch(s){case 1:a<128&&(o=a);break;case 2:l=t[i+1],128===(192&l)&&(f=(31&a)<<6|63&l,f>127&&(o=f));break;case 3:l=t[i+1],u=t[i+2],128===(192&l)&&128===(192&u)&&(f=(15&a)<<12|(63&l)<<6|63&u,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:l=t[i+1],u=t[i+2],c=t[i+3],128===(192&l)&&128===(192&u)&&128===(192&c)&&(f=(15&a)<<18|(63&l)<<12|(63&u)<<6|63&c,f>65535&&f<1114112&&(o=f))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return C(n)}function C(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,r,n,i,a){if(!o.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 z(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,a=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function F(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,a=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function B(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 j(t,e,r,n,i){return i||B(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,i){return i||B(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(t,e,r,n,52,8),r+8}function H(t){if(t=V(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function V(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function q(t){return t<16?"0"+t.toString(16):t.toString(16)}function G(t,e){e=e||1/0;for(var r,n=t.length,i=null,a=[],o=0;o55295&&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=(i-55296<<10|r-56320)+65536}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 X(t){for(var e=[],r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function W(t){return $.toByteArray(H(t))}function Z(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Q(t){return t!==t}var $=t("base64-js"),K=t("ieee754"),J=t("isarray");r.Buffer=o,r.SlowBuffer=v,r.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),r.kMaxLength=i(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,r){return s(null,t,e,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,r){return u(null,t,e,r)},o.allocUnsafe=function(t){return c(null,t)},o.allocUnsafeSlow=function(t){return c(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},o.prototype.compare=function(t,e,r,n,i){if(!o.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,s=r-e,l=Math.min(a,s),u=this.slice(n,i),c=t.slice(e,r),f=0;fi)&&(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 w(this,t,e,r);case"utf8":case"utf-8":return A(this,t,e,r);case"ascii":return k(this,t,e,r);case"latin1":case"binary":return M(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||N(t,e,this.length);for(var n=this[t],i=1,a=0;++a=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||N(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a},o.prototype.readInt8=function(t,e){return e||N(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},o.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),K.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),K.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),K.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),K.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e=0|e,r=0|r,!n){var i=Math.pow(2,8*r)-1;D(this,t,e,r,i,0)}var a=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+a]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e=0|e,r||D(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=0|e,r||D(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):z(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=0|e,r||D(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):z(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=0|e,r||D(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):F(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=0|e,r||D(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);D(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},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);D(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},o.prototype.writeInt8=function(t,e,r){return t=+t,e=0|e,r||D(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e=0|e,r||D(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):z(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e=0|e,r||D(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):z(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e=0|e,r||D(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):F(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e=0|e,r||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var a;if("number"==typeof t)for(a=e;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function a(t){var e,r,i,a,o,s,l=t.length;o=n(t),s=new f(3*l/4-o),i=o>0?l-4:l;var u=0;for(e=0,r=0;e>16&255,s[u++]=a>>8&255,s[u++]=255&a;return 2===o?(a=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,s[u++]=255&a):1===o&&(a=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,s[u++]=a>>8&255,s[u++]=255&a),s}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var n,i=[],a=e;ac?c:l+o));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),a.push(i),a.join("")}r.byteLength=i,r.toByteArray=a,r.fromByteArray=l;for(var u=[],c=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;d0;){for(var c=r.pop(),s=r.pop(),f=-1,h=-1,l=o[s],p=1;p=0||(e.flip(s,c),n(t,e,r,f,s,h),n(t,e,r,s,h,f),n(t,e,r,h,c,f),n(t,e,r,c,f,h))}}var a=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=i},{"binary-search-bounds":46,"robust-in-sphere":164}],43:[function(t,e,r){"use strict";function n(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 i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function a(t,e){for(var r=t.cells(),a=r.length,o=0;o0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-i){u[d]=i;for(var p=(c[d],0);p<3;++p){var g=h[3*d+p];g>=0&&0===u[g]&&(f[3*d+p]?l.push(g):(s.push(g),u[g]=i))}}}var v=l;l=s,s=v,l.length=0,i=-i}var m=o(c,u,e);return r?m.concat(n.boundary):m}var l=t("binary-search-bounds");e.exports=s;var u=n.prototype;u.locate=function(){var t=[0,0,0];return function(e,r,n){var a=e,o=r,s=n;return r1&&d(r[c[f-2]],r[c[f-1]],n)>0;)t.push([c[f-1],c[f-2],i]),f-=1;c.length=f,c.push(i);for(var p=u.upperIds,f=p.length;f>1&&d(r[p[f-2]],r[p[f-1]],n)<0;)t.push([p[f-2],p[f-1],i]),f-=1;p.length=f,p.push(i)}}function l(t,e){var r;return(r=t.a[0]m[0]&&l.push(new i(m,d,v,f),new i(d,m,g,f))}l.sort(a);for(var y=l[0].a[0]-(1+Math.abs(l[0].a[0]))*Math.pow(2,-52),b=[new n([y,1],[y,0],-1,[],[],[],[])],x=[],f=0,_=l.length;f<_;++f){var w=l[f],A=w.type;A===p?s(x,b,t,w.a,w.idx):A===v?u(b,t,w):c(b,t,w)}return x}var h=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,g=1,v=2;e.exports=f},{"binary-search-bounds":46,"robust-orientation":165}],45:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function i(t,e,r){for(var n=1,i=t.length;n=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;i(n[t],e,r),i(n[e],r,t),i(n[r],t,e)},s.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},s.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;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){var a=new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""));return a()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],47:[function(t,e,r){"use strict";function n(t){var e=x(t),r=b(y(e),t);return r<0?[e,w(e,1/0)]:r>0?[w(e,-(1/0)),e]:[e,e]}function i(t,e){for(var r=new Array(e.length),n=0;n=t.length)return o[e-t.length];var r=t[e];return[y(r[0]),y(r[1])]}for(var o=[],s=0;s=0;--s){var g=n[s],u=g[0],v=e[u],m=v[0],x=v[1],w=t[m],k=t[x];if((w[0]-k[0]||w[1]-k[1])<0){var M=m;m=x,x=M}v[0]=m;var T,E=v[1]=g[1];for(i&&(T=v[2]);s>0&&n[s-1][0]===u;){var g=n[--s],L=g[1];i?e.push([E,L,T]):e.push([E,L]),E=L}i?e.push([E,x,T]):e.push([E,x])}return o}function u(t,e,r){for(var i=t.length+e.length,a=new g(i),o=r,s=0;se[2]?1:0}function h(t,e,r){if(0!==t.length){if(e)for(var n=0;n0||d.length>0)}function p(t,e,r){var n,i=!1;if(r){n=e;for(var a=new Array(e.length),o=0;o=0}function i(t,e,r,i){var s=a(e,r,i);if(0===s){var l=o(a(t,e,r)),u=o(a(t,e,i));if(l===u){if(0===l){var c=n(t,e,r),f=n(t,e,i);return c===f?0:c?1:-1}return 0}return 0===u?l>0?-1:n(t,e,i)?-1:1:0===l?u>0?1:n(t,e,r)?1:-1:o(u-l)}var h=a(t,e,r);if(h>0)return s>0&&a(t,e,i)>0?1:-1;if(h<0)return s>0||a(t,e,i)>0?1:-1;var d=a(t,e,i);return d>0?1:n(t,e,r)?1:-1}e.exports=i;var a=t("robust-orientation"),o=t("signum"),s=t("two-sum"),l=t("robust-product"),u=t("robust-sum")},{"robust-orientation":165,"robust-product":166,"robust-sum":170,signum:171,"two-sum":186}],50:[function(t,e,r){function n(t,e){return t-e}function i(t,e){var r=t.length,i=t.length-e.length;if(i)return i;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||a(t[0],t[1])-a(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];if(i=o+t[2]-(s+e[2]))return i;var l=a(t[0],t[1]),u=a(e[0],e[1]);return a(l,t[2])-a(u,e[2])||a(l+t[2],o)-a(u+e[2],s);case 4:var c=t[0],f=t[1],h=t[2],d=t[3],p=e[0],g=e[1],v=e[2],m=e[3];return c+f+h+d-(p+g+v+m)||a(c,f,h,d)-a(p,g,v,m,p)||a(c+f,c+h,c+d,f+h,f+d,h+d)-a(p+g,p+v,p+m,g+v,g+m,v+m)||a(c+f+h,c+f+d,c+h+d,f+h+d)-a(p+g+v,p+g+m,p+v+m,g+v+m);default:for(var y=t.slice().sort(n),b=e.slice().sort(n),x=0;x0)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"===o)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===o){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"===o){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,a(e)}var a=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":53}],52:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,f=0;for(n=0;n=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",f,"]-=s",f].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r,i){for(var a=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],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("")),l&&u.push(["index[",e[c],"]=j",c].join(""));for(var c=0;c0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}function l(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,l=new Array(t.arrayArgs.length),c=new Array(t.arrayArgs.length),f=0;f0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),f=0;f3&&x.push(o(t.pre,t,c));var T=o(t.body,t,c),E=a(v);E3&&x.push(o(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var L=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(c)].join(""),S=new Function(["function ",L,"(",b.join(","),"){",x.join("\n"),"} return ",L].join(""));return S()}var u=t("uniq");e.exports=l},{uniq:189}],53:[function(t,e,r){"use strict";function n(t){var e=["'use strict'","var CACHED={}"],r=[],n=t.funcName+"_cwise_thunk";e.push(["return function ",n,"(",t.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],u=[],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])+"]"))}t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+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}function a(t){return null===t?NaN:+t}function o(t){return!isNaN(t)}function s(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);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}}}function l(t){return t.length}function u(t){for(var e=1;t*e%1;)e*=10;return e}function c(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function f(){this._=Object.create(null)}function h(t){return(t+="")===_o||t[0]===wo?wo+t:t}function d(t){return(t+="")[0]===wo?t.slice(1):t}function p(t){return h(t)in this._}function g(t){return(t=h(t))in this._&&delete this._[t]}function v(){var t=[];for(var e in this._)t.push(d(e));return t}function m(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function b(){this._=Object.create(null)}function x(t){return t}function _(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=Ao.length;r=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Oo.get(t);return u&&(t=u,l=Q),s?e?i:n:e?A:a}function Z(t,e){return function(r){var n=uo.event;uo.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.event=n}}}function Q(t,e){var r=Z(t,e);return function(t){var e=this,n=t.relatedTarget;n&&(n===e||8&n.compareDocumentPosition(e))||r.call(e,t)}}function $(t){var r=".dragsuppress-"+ ++No,i="click"+r,a=uo.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Po&&(Po=!("onselectstart"in t)&&w(t.style,"userSelect")),Po){var o=e(t).style,s=o[Po];o[Po]="none"}return function(t){if(a.on(r,null),Po&&(o[Po]=s),t){var e=function(){a.on(i,null)};a.on(i,function(){T(),e()},!0),setTimeout(e,0)}}}function K(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(Do<0){var a=n(t);if(a.scrollX||a.scrollY){r=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();Do=!(o.f||o.e),r.remove()}}return Do?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function J(){return uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function rt(t){return t>1?0:t<-1?Bo:Math.acos(t)}function nt(t){return t>1?Ho:t<-1?-Ho:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function at(t){return((t=Math.exp(t))+1/t)/2}function ot(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ut(t,e,r){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):At(""+t,kt,ut):new ut(t,e,r)}function ct(t,e,r){function n(t){return t>360?t-=360:t<0&&(t+=360),t<60?a+(o-a)*t/60:t<180?o:t<240?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*n(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,o=r<=.5?r*(1+e):r+e-r*e,a=2*r-o,new bt(i(t+120),i(t),i(t-120))}function ft(t,e,r){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof dt?gt(t.l,t.a,t.b):gt((t=Mt((t=uo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,r)}function ht(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(r,Math.cos(t*=Vo)*e,Math.sin(t)*e)}function dt(t,e,r){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof ft?ht(t.h,t.c,t.l):Mt((t=bt(t)).r,t.g,t.b):new dt(t,e,r)}function pt(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return i=vt(i)*ts,n=vt(n)*es,a=vt(a)*rs,new bt(yt(3.2404542*i-1.5371385*n-.4985314*a),yt(-.969266*i+1.8760108*n+.041556*a),yt(.0556434*i-.2040259*n+1.0572252*a))}function gt(t,e,r){return t>0?new ft(Math.atan2(r,e)*qo,Math.sqrt(e*e+r*r),t):new ft(NaN,NaN,t)}function vt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function mt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function bt(t,e,r){return this instanceof bt?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof bt?new bt(t.r,t.g,t.b):At(""+t,bt,ct):new bt(t,e,r)}function xt(t){return new bt(t>>16,t>>8&255,255&t)}function _t(t){return xt(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function At(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(Et(i[0]),Et(i[1]),Et(i[2]))}return(a=as.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|o,s=240&a,s=s>>4|s,l=15&a,l=l<<4|l):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function kt(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 Mt(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=mt((.4124564*t+.3575761*e+.1804375*r)/ts),i=mt((.2126729*t+.7151522*e+.072175*r)/es),a=mt((.0193339*t+.119192*e+.9503041*r)/rs);return dt(116*i-16,500*(n-i),200*(i-a))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Et(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Lt(t){return"function"==typeof t?t:function(){return t}}function St(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),Ct(e,r,t,n)}}function Ct(t,e,r,n){function i(){var t,e=l.status;if(!e&&It(l)||e>=200&&e<300||304===e){try{t=r.call(a,l)}catch(t){return void o.error.call(a,t)}o.load.call(a,t)}else o.error.call(a,l)}var a={},o=uo.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=uo.event;uo.event=t;try{o.progress.call(a,l)}finally{uo.event=e}},a.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",a)},a.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",a):e},a.responseType=function(t){return arguments.length?(u=t,a):u},a.response=function(t){return r=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(fo(arguments)))}}),a.send=function(r,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),l.open(r,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=u&&(l.responseType=u),null!=i&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==n?null:n),a},a.abort=function(){return l.abort(),a},uo.rebind(a,o,"on"),null==n?a:a.get(Rt(n))}function Rt(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function It(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Ot(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var i=r+e,a={c:t,t:i,n:null};return ss?ss.n=a:os=a,ss=a,ls||(us=clearTimeout(us),ls=1,cs(Pt)),a}function Pt(){var t=Nt(),e=Dt()-t;e>24?(isFinite(e)&&(clearTimeout(us),us=setTimeout(Pt,e)),ls=0):(ls=1,cs(Pt))}function Nt(){for(var t=Date.now(),e=os;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Dt(){for(var t,e=os,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Bt(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,a=n&&r?function(t,e){for(var i=t.length,a=[],o=0,s=n[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=n[o=(o+1)%n.length];return a.reverse().join(r)}:x;return function(t){var r=hs.exec(t),n=r[1]||" ",o=r[2]||">",s=r[3]||"-",l=r[4]||"",u=r[5],c=+r[6],f=r[7],h=r[8],d=r[9],p=1,g="",v="",m=!1,y=!0;switch(h&&(h=+h.substring(1)),(u||"0"===n&&"="===o)&&(u=n="0",o="="),d){case"n":f=!0,d="g";break;case"%":p=100,v="%",d="f";break;case"p":p=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":y=!1;case"d":m=!0,h=0;break;case"s":p=-1,d="r"}"$"===l&&(g=i[0],v=i[1]),"r"!=d||h||(d="g"),null!=h&&("g"==d?h=Math.max(1,Math.min(21,h)):"e"!=d&&"f"!=d||(h=Math.max(0,Math.min(20,h)))),d=ds.get(d)||jt;var b=u&&f;return function(t){var r=v;if(m&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=uo.formatPrefix(t,h);t=l.scale(t),r=l.symbol+v}else t*=p;t=d(t,h);var x,_,w=t.lastIndexOf(".");if(w<0){var A=y?t.lastIndexOf("e"):-1;A<0?(x=t,_=""):(x=t.substring(0,A),_=t.substring(A))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&f&&(x=a(x,1/0));var k=g.length+x.length+_.length+(b?0:i.length),M=k"===o?M+i+t:"^"===o?M.substring(0,k>>=1)+i+t+M.substring(k):i+(b?t:M+t))+r}}}function jt(t){return t+""}function Ut(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ht(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o=u)return-1;if(i=e.charCodeAt(s++),37===i){if(o=e.charAt(s++),a=S[o in ms?e.charAt(s++):o],!a||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}function n(t,e,r){w.lastIndex=0;var n=w.exec(e.slice(r));return n?(t.w=A.get(n[0].toLowerCase()),r+n[0].length):-1}function i(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=E.get(n[0].toLowerCase()),r+n[0].length):-1}function o(t,e,r){k.lastIndex=0;var n=k.exec(e.slice(r));return n?(t.m=M.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,L.c.toString(),e,n)}function l(t,e,n){return r(t,L.x.toString(),e,n)}function u(t,e,n){return r(t,L.X.toString(),e,n)}function c(t,e,r){var n=b.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)}var f=t.dateTime,h=t.date,d=t.time,p=t.periods,g=t.days,v=t.shortDays,m=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{gs=Ut;var e=new gs;return e._=t,n(e)}finally{gs=Date}}var n=e(t);return r.parse=function(t){try{gs=Ut;var e=n.parse(t);return e&&e._}finally{gs=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Xt(g),_=Yt(g),w=Xt(v),A=Yt(v),k=Xt(m),M=Yt(m),T=Xt(y),E=Yt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var L={a:function(t){return v[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return m[t.getMonth()]},c:e(f),d:function(t,e){return Gt(t.getDate(),e,2)},e:function(t,e){return Gt(t.getDate(),e,2)},H:function(t,e){return Gt(t.getHours(),e,2)},I:function(t,e){return Gt(t.getHours()%12||12,e,2)},j:function(t,e){return Gt(1+ps.dayOfYear(t),e,3)},L:function(t,e){return Gt(t.getMilliseconds(),e,3)},m:function(t,e){return Gt(t.getMonth()+1,e,2)},M:function(t,e){return Gt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Gt(t.getSeconds(),e,2)},U:function(t,e){return Gt(ps.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(ps.mondayOfYear(t),e,2)},x:e(h),X:e(d),y:function(t,e){return Gt(t.getFullYear()%100,e,2)},Y:function(t,e){return Gt(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},S={a:n,A:i,b:a,B:o,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:ae,p:c,S:oe,U:Zt,w:Wt,W:Qt,x:l,X:u,y:Kt,Y:$t,Z:Jt,"%":ue};return e}function Gt(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3)}function ee(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ae(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function le(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=xo(e)/60|0,i=xo(e)%60;return r+Gt(n,"0",2)+Gt(i,"0",2)}function ue(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function ce(t){for(var e=t.length,r=-1;++r=0?1:-1,s=o*r,l=Math.cos(e),u=Math.sin(e),c=a*u,f=i*l+c*Math.cos(s),h=c*o*Math.sin(s);Ms.add(Math.atan2(h,f)),n=t,i=l,a=u}var e,r,n,i,a;Ts.point=function(o,s){Ts.point=t,n=(e=o)*Vo,i=Math.cos(s=(r=s)*Vo/2+Bo/4),a=Math.sin(s)},Ts.lineEnd=function(){t(e,r)}}function me(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function be(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function xe(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Ae(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function ke(t,e){return xo(t[0]-e[0])=0;--s)i.point((f=c[s])[0],f[1])}else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);i.lineEnd()}}}function Oe(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n0){for(_||(a.polygonStart(),_=!0),a.lineStart();++o1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(De))}var d,p,g,v=e(a),m=i.invert(n[0],n[1]),y={point:o,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=f,y.lineEnd=h,d=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=l,y.lineEnd=u,d=uo.merge(d);var t=He(m,p);d.length?(_||(a.polygonStart(),_=!0),Ie(d,Fe,t,r,a)):t&&(_||(a.polygonStart(),_=!0),a.lineStart(),r(null,null,1,a),a.lineEnd()),_&&(a.polygonEnd(),_=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),r(null,null,1,a),a.lineEnd(),a.polygonEnd()}},b=ze(),x=e(b),_=!1;return y}}function De(t){return t.length>1}function ze(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:A,buffer:function(){var r=e;return e=[], -t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Fe(t,e){return((t=t.x)[0]<0?t[1]-Ho-zo:Ho-t[1])-((e=e.x)[0]<0?e[1]-Ho-zo:Ho-e[1])}function Be(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?Bo:-Bo,l=xo(a-r);xo(l-Bo)0?Ho:-Ho),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=Bo&&(xo(r-i)zo?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}function Ue(t,e,r,n){var i;if(null==t)i=r*Ho,n.point(-Bo,i),n.point(0,i),n.point(Bo,i),n.point(Bo,0),n.point(Bo,-i),n.point(0,-i),n.point(-Bo,-i),n.point(-Bo,0),n.point(-Bo,i);else if(xo(t[0]-e[0])>zo){var a=t[0]=0?1:-1,A=w*_,k=A>Bo,M=p*b;if(Ms.add(Math.atan2(M*w*Math.sin(A),g*x+M*Math.cos(A))),a+=k?_+w*jo:_,k^h>=r^m>=r){var T=be(me(f),me(t));we(T);var E=be(i,T);we(E);var L=(k^_>=0?-1:1)*nt(E[2]);(n>L||n===L&&(T[0]||T[1]))&&(o+=k^_>=0?1:-1)}if(!v++)break;h=m,p=b,g=x,f=t}}return(a<-zo||aa}function r(t){var r,a,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],g=e(f,h),v=o?g?0:i(f,h):g?i(f+(f<0?Bo:-Bo),h):0;if(!r&&(u=l=g)&&t.lineStart(),g!==l&&(d=n(r,p),(ke(r,d)||ke(p,d))&&(p[0]+=zo,p[1]+=zo,g=e(p[0],p[1]))),g!==l)c=0,g?(t.lineStart(),d=n(p,r),t.point(d[0],d[1])):(d=n(r,p),t.point(d[0],d[1]),t.lineEnd()),r=d;else if(s&&r&&o^g){var m;v&a||!(m=n(p,r,!0))||(c=0,o?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||r&&ke(r,p)||t.point(p[0],p[1]),r=p,l=g,a=v},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=me(t),i=me(e),o=[1,0,0],s=be(n,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var f=a*l/c,h=-a*u/c,d=be(o,s),p=_e(o,f),g=_e(s,h);xe(p,g);var v=d,m=ye(p,v),y=ye(v,v),b=m*m-y*(ye(p,p)-1);if(!(b<0)){var x=Math.sqrt(b),_=_e(v,(-m-x)/y);if(xe(_,p),_=Ae(_),!r)return _;var w,A=t[0],k=e[0],M=t[1],T=e[1];k0^_[1]<(xo(_[0]-A)Bo^(A<=_[0]&&_[0]<=k)){var C=_e(v,(-m+x)/y);return xe(C,p),[_,Ae(C)]}}}function i(e,r){var n=o?t:Bo-t,i=0;return e<-n?i|=1:e>n&&(i|=2),r<-n?i|=4:r>n&&(i|=8),i}var a=Math.cos(t),o=a>0,s=xo(a)>zo,l=vr(t,6*Vo);return Ne(e,r,l,o?[0,-t]:[-Bo,t-Bo])}function qe(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=s.x,f=s.y,h=0,d=1,p=c-l,g=f-u;if(a=t-l,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=r-l,p||!(a<0)){if(a/=p,p<0){if(a>d)return;a>h&&(h=a)}else if(p>0){if(a0)){if(a/=g,g<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=n-u,g||!(a<0)){if(a/=g,g<0){if(a>d)return;a>h&&(h=a)}else if(g>0){if(a0&&(i.a={x:l+h*p,y:u+h*g}),d<1&&(i.b={x:l+d*p,y:u+d*g}),i}}}}}}function Ge(t,e,r,n){function i(n,i){return xo(n[0]-t)0?0:3:xo(n[0]-r)0?2:1:xo(n[1]-e)0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(t,e){var r=i(t,1),n=i(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,r=v.length,n=t[1],i=0;in&&et(u,a,t)>0&&++e:a[1]<=n&&et(u,a,t)<0&&--e,u=a;return 0!==e}function u(a,s,l,u){var c=0,f=0;if(null==a||(c=i(a,l))!==(f=i(s,l))||o(a,s)<0^l>0){do u.point(0===c||3===c?t:r,c>1?n:e);while((c=(c+l+4)%4)!==f)}else u.point(s[0],s[1])}function c(i,a){return t<=i&&i<=r&&e<=a&&a<=n}function f(t,e){c(t,e)&&s.point(t,e)}function h(){S.point=p,v&&v.push(m=[]),k=!0,A=!1,_=w=NaN}function d(){g&&(p(y,b),x&&A&&E.rejoin(),g.push(E.buffer())),S.point=f,A&&s.lineEnd()}function p(t,e){t=Math.max(-js,Math.min(js,t)),e=Math.max(-js,Math.min(js,e));var r=c(t,e);if(v&&m.push([t,e]),k)y=t,b=e,x=r,k=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&A)s.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};L(n)?(A||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),M=!1):r&&(s.lineStart(),s.point(t,e),M=!1)}_=t,w=e,A=r}var g,v,m,y,b,x,_,w,A,k,M,T=s,E=ze(),L=qe(t,e,r,n),S={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=E,g=[],v=[],M=!0},polygonEnd:function(){s=T,g=uo.merge(g);var e=l([t,n]),r=M&&e,i=g.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Ie(g,a,e,u,s),s.polygonEnd()),g=v=m=null}};return S}}function Xe(t){var e=0,r=Bo/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Bo/180,r=t[1]*Bo/180):[e/Bo*180,r/Bo*180]},i}function Ye(t,e){function r(t,e){var r=Math.sqrt(a-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),o-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,a=1+n*(2*i-n),o=Math.sqrt(a)/i;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,nt((a-(t*t+r*r)*i*i)/(2*i))]},r}function We(){function t(t,e){Hs+=i*t-n*e,n=t,i=e}var e,r,n,i;Ys.point=function(a,o){Ys.point=t,e=n=a,r=i=o},Ys.lineEnd=function(){t(e,r)}}function Ze(t,e){tGs&&(Gs=t),eXs&&(Xs=e)}function Qe(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=r}function r(t,e){o.push("L",t,",",e)}function n(){s.point=t}function i(){o.push("Z")}var a=$e(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return a=$e(t),s},result:function(){if(o.length){var t=o.join("");return o=[],t}}};return s}function $e(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ke(t,e){Ss+=t,Cs+=e,++Rs}function Je(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);Is+=o*(e+t)/2,Os+=o*(r+n)/2,Ps+=o,Ke(e=t,r=n)}var e,r;Zs.point=function(n,i){Zs.point=t,Ke(e=n,r=i)}}function tr(){Zs.point=Ke}function er(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Is+=o*(n+t)/2,Os+=o*(i+e)/2,Ps+=o,o=i*t-n*e,Ns+=o*(n+t),Ds+=o*(i+e),zs+=3*o,Ke(n=t,i=e)}var e,r,n,i;Zs.point=function(a,o){Zs.point=t,Ke(e=n=a,r=i=o)},Zs.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+o,r),t.arc(e,r,o,0,jo)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function i(){s.point=e}function a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:i,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return o=t,s},result:A};return s}function nr(t){function e(t){return(s?n:r)(t)}function r(e){return or(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})}function n(e){function r(r,n){r=t(r,n),e.point(r[0],r[1])}function n(){b=NaN,k.point=a,e.lineStart()}function a(r,n){var a=me([r,n]),o=t(r,n);i(b,x,y,_,w,A,b=o[0],x=o[1],y=r,_=a[0],w=a[1],A=a[2],s,e),e.point(b,x)}function o(){k.point=r,e.lineEnd()}function l(){n(),k.point=u,k.lineEnd=c}function u(t,e){a(f=t,h=e),d=b,p=x,g=_,v=w,m=A,k.point=a}function c(){i(b,x,y,_,w,A,d,p,f,g,v,m,s,e),k.lineEnd=o,o()}var f,h,d,p,g,v,m,y,b,x,_,w,A,k={point:r,lineStart:n,lineEnd:o,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=n}};return k}function i(e,r,n,s,l,u,c,f,h,d,p,g,v,m){var y=c-e,b=f-r,x=y*y+b*b;if(x>4*a&&v--){var _=s+d,w=l+p,A=u+g,k=Math.sqrt(_*_+w*w+A*A),M=Math.asin(A/=k),T=xo(xo(A)-1)a||xo((y*C+b*R)/x-.5)>.3||s*d+l*p+u*g0&&16,e):Math.sqrt(a)},e}function ir(t){var e=nr(function(e,r){return t([e*qo,r*qo])});return function(t){return ur(e(t))}}function ar(t){this.stream=t}function or(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function sr(t){return lr(function(){return t})()}function lr(t){function e(t){return t=s(t[0]*Vo,t[1]*Vo),[t[0]*h+l,u-t[1]*h]}function r(t){return t=s.invert((t[0]-l)/h,(u-t[1])/h),t&&[t[0]*qo,t[1]*qo]}function n(){s=Ce(o=hr(m,y,b),a);var t=a(g,v);return l=d-t[0]*h,u=p+t[1]*h,i()}function i(){return c&&(c.valid=!1,c=null),e}var a,o,s,l,u,c,f=nr(function(t,e){return t=a(t,e),[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,g=0,v=0,m=0,y=0,b=0,_=Bs,w=x,A=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(o,f(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(A=t,Bs):Ve((A=+t)*Vo),i()):A},e.clipExtent=function(t){return arguments.length?(k=t,w=t?Ge(t[0][0],t[0][1],t[1][0],t[1][1]):x,i()):k},e.scale=function(t){return arguments.length?(h=+t,n()):h},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],n()):[d,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Vo,v=t[1]%360*Vo,n()):[g*qo,v*qo]},e.rotate=function(t){return arguments.length?(m=t[0]%360*Vo,y=t[1]%360*Vo,b=t.length>2?t[2]%360*Vo:0,n()):[m*qo,y*qo,b*qo]},uo.rebind(e,f,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&r,n()}}function ur(t){return or(t,function(e,r){t.point(e*Vo,r*Vo)})}function cr(t,e){return[t,e]}function fr(t,e){return[t>Bo?t-jo:t<-Bo?t+jo:t,e]}function hr(t,e,r){return t?e||r?Ce(pr(t),gr(e,r)):pr(t):e||r?gr(e,r):fr}function dr(t){return function(e,r){return e+=t,[e>Bo?e-jo:e<-Bo?e+jo:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function gr(t,e){function r(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*n+s*i;return[Math.atan2(l*a-c*o,s*n-u*i),nt(c*a+l*o)]}var n=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*a-l*o;return[Math.atan2(l*a+u*o,s*n+c*i),nt(c*n-s*i)]},r}function vr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=mr(r,i),a=mr(r,a),(o>0?ia)&&(i+=o*jo)):(i=t+o*jo,a=t-.5*l);for(var u,c=i;o>0?c>a:c0?e<-Ho+zo&&(e=-Ho+zo):e>Ho-zo&&(e=Ho-zo);var r=o/Math.pow(i(e),a);return[r*Math.sin(a*t),o-r*Math.cos(a*t)]}var n=Math.cos(t),i=function(t){return Math.tan(Bo/4+t/2)},a=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),o=n*Math.pow(i(t),a)/a;return a?(r.invert=function(t,e){var r=o-e,n=tt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(o/n,1/a))-Ho]},r):Er}function Tr(t,e){function r(t,e){var r=a-e;return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),a=n/i+t;return xo(i)1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Or(t,e){return t[0]-e[0]||t[1]-e[1]}function Pr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Nr(t,e,r,n){var i=t[0],a=r[0],o=e[0]-i,s=n[0]-a,l=t[1],u=r[1],c=e[1]-l,f=n[1]-u,h=(s*(l-u)-f*(i-a))/(f*o-s*c);return[i+h*o,l+h*c]}function Dr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function zr(){an(this),this.edge=this.site=this.circle=null}function Fr(t){var e=ul.pop()||new zr;return e.site=t,e}function Br(t){Zr(t),ol.remove(t),ul.push(t),an(t)}function jr(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},a=t.P,o=t.N,s=[t];Br(t);for(var l=a;l.circle&&xo(r-l.circle.x)zo)s=s.L;else{if(i=a-Vr(s,o),!(i>zo)){n>-zo?(e=s.P,r=s):i>-zo?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=Fr(t);if(ol.insert(e,l),e||r){if(e===r)return Zr(e),r=Fr(e.site),ol.insert(l,r),l.edge=r.edge=Jr(e.site,l.site),Wr(e),void Wr(r);if(!r)return void(l.edge=Jr(e.site,l.site));Zr(e),Zr(r);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=r.site,g=p.x-c,v=p.y-f,m=2*(h*v-d*g),y=h*h+d*d,b=g*g+v*v,x={x:(v*y-d*b)/m+c,y:(h*b-g*y)/m+f};en(r.edge,u,p,x),l.edge=Jr(u,t,null,x),r.edge=Jr(t,p,null,x),Wr(e),Wr(r)}}function Hr(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);r=o.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,f=1/a-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+i-a/2)))/f+n:(n+s)/2}function Vr(t,e){var r=t.N;if(r)return Hr(r,e);var n=t.site;return n.y===e?n.x:1/0}function qr(t){this.site=t,this.edges=[]}function Gr(t){for(var e,r,n,i,a,o,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],g=al,v=g.length;v--;)if(a=g[v],a&&a.prepare())for(s=a.edges,l=s.length,o=0;ozo||xo(i-r)>zo)&&(s.splice(o,0,new rn(tn(a.site,c,xo(n-f)zo?{x:f,y:xo(e-f)zo?{x:xo(r-p)zo?{x:h,y:xo(e-h)zo?{x:xo(r-d)=-Fo)){var d=l*l+u*u,p=c*c+f*f,g=(f*d-u*p)/h,v=(l*p-c*d)/h,f=v+s,m=cl.pop()||new Yr;m.arc=t,m.site=i,m.x=g+o,m.y=f+Math.sqrt(g*g+v*v),m.cy=f,t.circle=m;for(var y=null,b=ll._;b;)if(m.y=s)return;if(h>p){if(a){if(a.y>=u)return}else a={x:v,y:l};r={x:v,y:u}}else{if(a){if(a.y1)if(h>p){if(a){if(a.y>=u)return}else a={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}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.xa||f>o||h=x,A=r>=_,k=A<<1|w,M=k+4;ka&&(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:bn(r,n)})),a=dl.lastIndex;return a=0&&!(r=uo.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function kn(t){return function(e){return 1-t(1-e)}}function Mn(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Ln(t){if(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 Sn(t){return function(e){return Math.pow(e,t)}}function Cn(t){return 1-Math.cos(t*Ho)}function Rn(t){return Math.pow(2,10*(t-1))}function In(t){return 1-Math.sqrt(1-t*t)}function On(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/jo*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*jo/e)}}function Pn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Nn(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 Dn(t,e){t=uo.hcl(t),e=uo.hcl(e);var r=t.h,n=t.c,i=t.l,a=e.h-r,o=e.c-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ht(r+a*t,n+o*t,i+s*t)+""}}function zn(t,e){t=uo.hsl(t),e=uo.hsl(e);var r=t.h,n=t.s,i=t.l,a=e.h-r,o=e.s-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ct(r+a*t,n+o*t,i+s*t)+""}}function Fn(t,e){t=uo.lab(t),e=uo.lab(e);var r=t.l,n=t.a,i=t.b,a=e.l-r,o=e.a-n,s=e.b-i;return function(t){return pt(r+a*t,n+o*t,i+s*t)+""}}function Bn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function jn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Hn(e),i=Un(e,r),a=Hn(Vn(r,e,-i))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(qn(r)+"rotate(",null,")")-2,x:bn(t,e)})):e&&r.push(qn(r)+"rotate("+e+")")}function Yn(t,e,r,n){t!==e?n.push({i:r.push(qn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(qn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(qn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:bn(t[0],e[0])},{i:i-2,x:bn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(qn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=uo.transform(t),e=uo.transform(e),Gn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Yn(t.skew,e.skew,r,n),Wn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,a=n.length;++i=0;)r.push(i[n])}function li(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;++oi&&(n=r,i=e);return n}function bi(t){return t.reduce(xi,0)}function xi(t,e){return t+e[1]}function _i(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,a=[];++r<=e;)a[r]=i*r+n;return a}function Ai(t){return[uo.min(t),uo.max(t)]}function ki(t,e){return t.value-e.value}function Mi(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ti(t,e){t._pack_next=e,e._pack_prev=t}function Ei(t,e){var r=e.x-t.x,n=e.y-t.y,i=t.r+e.r;return.999*i*i>r*r+n*n}function Li(t){function e(t){c=Math.min(t.x-t.r,c),f=Math.max(t.x+t.r,f),h=Math.min(t.y-t.r,h),d=Math.max(t.y+t.r,d)}if((r=t.children)&&(u=r.length)){var r,n,i,a,o,s,l,u,c=1/0,f=-(1/0),h=1/0,d=-(1/0);if(r.forEach(Si),n=r[0],n.x=-n.r,n.y=0,e(n),u>1&&(i=r[1],i.x=i.r,i.y=0,e(i),u>2))for(a=r[2],Ii(n,i,a),e(a),Mi(n,a),n._pack_prev=a,Mi(a,i),i=n._pack_next,o=3;o=0;)e=i[a],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function Fi(t,e,r){return t.a.parent===e.parent?t.a:r}function Bi(t){return 1+uo.max(t,function(t){return t.y})}function ji(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ui(t){var e=t.children;return e&&e.length?Ui(e[0]):t}function Hi(t){var e,r=t.children;return r&&(e=r.length)?Hi(r[e-1]):t}function Vi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function qi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(r+=i/2,i=0),a<0&&(n+=a/2,a=0),{x:r,y:n,dx:i,dy:a}}function Gi(t){var e=t[0],r=t[t.length-1];return e2?Qi:Yi,l=n?$n:Qn;return o=i(t,e,l,r),s=i(e,t,l,_n),a}function a(t){return o(t)}var o,s;return a.invert=function(t){return s(t)},a.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},a.range=function(t){return arguments.length?(e=t,i()):e},a.rangeRound=function(t){return a.range(t).interpolate(Bn)},a.clamp=function(t){return arguments.length?(n=t,i()):n},a.interpolate=function(t){return arguments.length?(r=t,i()):r},a.ticks=function(e){return ea(t,e)},a.tickFormat=function(e,r){return ra(t,e,r)},a.nice=function(e){return Ji(t,e),i()},a.copy=function(){return $i(t,e,r,n)},i()}function Ki(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ji(t,e){return Wi(t,Zi(ta(t,e)[2])),Wi(t,Zi(ta(t,e)[2])),t}function ta(t,e){null==e&&(e=10);var r=Gi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),a=e/n*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function ea(t,e){return uo.range.apply(uo,ta(t,e))}function ra(t,e,r){var n=ta(t,e);if(r){var i=hs.exec(r);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(xo(n[0]),xo(n[1])));return i[7]||(i[7]="."+na(a.scale(n[2]))),i[8]="f",r=uo.format(i.join("")),function(t){return r(a.scale(t))+a.symbol}}i[7]||(i[7]="."+ia(i[8],n)),r=i.join("")}else r=",."+na(n[2])+"f";return uo.format(r)}function na(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ia(t,e){var r=na(e[2]);return t in Ml?Math.abs(r-na(Math.max(xo(e[0]),xo(e[1]))))+ +("e"!==t):r-2*("%"===t)}function aa(t,e,r,n){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(i(e))}return o.invert=function(e){return a(t.invert(e))},o.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),o):e},o.nice=function(){var e=Wi(n.map(i),r?Math:El);return t.domain(e),n=e.map(a),o},o.ticks=function(){var t=Gi(n),o=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),f=e%1?2:e;if(isFinite(c-u)){if(r){for(;u0;h--)o.push(a(u)*h);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,r){if(!arguments.length)return Tl;arguments.length<2?r=Tl:"function"!=typeof r&&(r=uo.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e0?s[r-1]:t[0],r0?0:1}function xa(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,u=-s*a,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,g=(f+d)/2,v=h-c,m=d-f,y=v*v+m*m,b=r-n,x=c*d-h*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*m-v*_)/y,A=(-x*v-m*_)/y,k=(x*m+v*_)/y,M=(-x*v+m*_)/y,T=w-p,E=A-g,L=k-p,S=M-g;return T*T+E*E>L*L+S*S&&(w=k,A=M),[[w-l,A-u],[w*r/b,A*r/b]]}function _a(t){function e(e){function o(){u.push("M",a(t(c),s))}for(var l,u=[],c=[],f=-1,h=e.length,d=Lt(r),p=Lt(n);++f1?t.join("L"):t+"Z"}function Aa(t){return t.join("L")+"Z"}function ka(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1&&i.push("H",n[0]),i.join("")}function Ma(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 u=2;u9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[s+1]=i*n));for(s=-1;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}function Ua(t){return t.length<3?wa(t):t[0]+Ca(t,ja(t))}function Ha(t){for(var e,r,n,i=-1,a=t.length;++i0;)d[--s].call(t,o);if(a>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var l,u,c,h,d,p=t[r]||(t[r]={active:0,count:0}),g=p[n];g||(l=i.time,u=Ot(a,0,l),g=p[n]={tween:new f,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function ro(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function no(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function io(t){return t.toISOString()}function ao(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,a=uo.bisect(Kl,i);return a==Kl.length?[e.year,ta(t.map(function(t){return t/31536e6}),r)[2]]:a?e[i/Kl[a-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Gi(n.domain()),a=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(r[0],oo(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return ao(t.copy(),e,r)},Ki(n,t)}function oo(t){return new Date(t)}function so(t){return JSON.parse(t.responseText)}function lo(t){var e=ho.createRange();return e.selectNode(ho.body),e.createContextualFragment(t.responseText)}var uo={version:"3.5.17"},co=[].slice,fo=function(t){return co.call(t)},ho=this.document;if(ho)try{fo(ho.documentElement.childNodes)[0].nodeType}catch(t){fo=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}),ho)try{ho.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var po=this.Element.prototype,go=po.setAttribute,vo=po.setAttributeNS,mo=this.CSSStyleDeclaration.prototype,yo=mo.setProperty;po.setAttribute=function(t,e){go.call(this,t,e+"")},po.setAttributeNS=function(t,e,r){vo.call(this,t,e,r+"")},mo.setProperty=function(t,e,r){yo.call(this,t,e+"",r)}}uo.ascending=i,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.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},uo.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},uo.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 l/(c-1)},uo.deviation=function(){var t=uo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var bo=s(i);uo.bisectLeft=bo.left,uo.bisect=uo.bisectRight=bo.right,uo.bisector=function(t){return s(1===t.length?function(e,r){return i(t(e),r)}:t)},uo.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},uo.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},uo.pairs=function(t){for(var e,r=0,n=t.length-1,i=t[0],a=new Array(n<0?0:n);r=0;)for(n=t[i],e=n.length;--e>=0;)r[--o]=n[e];return r};var xo=Math.abs;uo.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=u(xo(r)),o=-1;if(t*=a,e*=a,r*=a,r<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=a.length)return n?n.call(i,o):r?o.sort(r):o;for(var l,u,c,h,d=-1,p=o.length,g=a[s++],v=new f;++d=a.length)return t;var n=[],i=o[r++];return t.forEach(function(t,i){n.push({key:t,values:e(i,r)})}),i?n.sort(function(t,e){return i(t.key,e.key)}):n}var r,n,i={},a=[],o=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(uo.map,r,0),0)},i.key=function(t){return a.push(t),i},i.sortKeys=function(t){return o[a.length-1]=t,i},i.sortValues=function(t){return r=t,i},i.rollup=function(t){return n=t,i},i},uo.set=function(t){var e=new b;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}},uo.event=null,uo.requote=function(t){return t.replace(ko,"\\$&")};var ko=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Mo={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},To=function(t,e){return e.querySelector(t)},Eo=function(t,e){return e.querySelectorAll(t)},Lo=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Lo=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(To=function(t,e){return Sizzle(t,e)[0]||null},Eo=Sizzle,Lo=Sizzle.matchesSelector),uo.selection=function(){return uo.select(ho.documentElement)};var So=uo.selection.prototype=[];So.select=function(t){var e,r,n,i,a=[];t=C(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Ro.hasOwnProperty(r)?{space:Ro[r],local:t}:t}},So.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=uo.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(I(e,t[e]));return this}return this.each(I(t,e))},So.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=N(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},So.sort=function(t){t=q.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.transition().duration(S)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-k.x)/k.k}).map(x.invert)),A&&A.domain(w.range().map(function(t){return(t-k.y)/k.k}).map(w.invert))}function l(t){C++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--C||(t({type:"zoomend"}),v=null)}function f(){function t(){s=1,a(uo.mouse(i),h),u(o)}function r(){f.on(I,null).on(O,null),d(s),c(o)}var i=this,o=N.of(i,arguments),s=0,f=uo.select(n(i)).on(I,t).on(O,r),h=e(uo.mouse(i)),d=$(i);Hl.call(i),l(o)}function h(){function t(){var t=uo.touches(p);return d=k.k,t.forEach(function(t){t.identifier in v&&(v[t.identifier]=e(t))}),t}function r(){var e=uo.event.target;uo.select(e).on(x,n).on(_,s),w.push(e);for(var r=uo.event.changedTouches,i=0,a=r.length;i1){var c=l[0],f=l[1],h=c[0]-f[0],d=c[1]-f[1];m=h*h+d*d}}function n(){var t,e,r,n,o=uo.touches(p);Hl.call(p);for(var s=0,l=o.length;s=u)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ds=uo.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=uo.round(t,zt(t,e))).toFixed(Math.max(0,Math.min(20,zt(t*(1+1e-15),e))))}}),ps=uo.time={},gs=Date;Ut.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){vs.setUTCDate.apply(this._,arguments)},setDay:function(){vs.setUTCDay.apply(this._,arguments)},setFullYear:function(){vs.setUTCFullYear.apply(this._,arguments)},setHours:function(){vs.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){vs.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){vs.setUTCMinutes.apply(this._,arguments)},setMonth:function(){vs.setUTCMonth.apply(this._,arguments)},setSeconds:function(){vs.setUTCSeconds.apply(this._,arguments)},setTime:function(){vs.setTime.apply(this._,arguments)}};var vs=Date.prototype;ps.year=Ht(function(t){return t=ps.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),ps.years=ps.year.range,ps.years.utc=ps.year.utc.range,ps.day=Ht(function(t){var e=new gs(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),ps.days=ps.day.range,ps.days.utc=ps.day.utc.range,ps.dayOfYear=function(t){var e=ps.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var r=ps[t]=Ht(function(t){return(t=ps.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var r=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});ps[t+"s"]=r.range,ps[t+"s"].utc=r.utc.range,ps[t+"OfYear"]=function(t){var r=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(r+e)%7)/7)}}),ps.week=ps.sunday,ps.weeks=ps.sunday.range,ps.weeks.utc=ps.sunday.utc.range,ps.weekOfYear=ps.sundayOfYear;var ms={"-":"",_:" ",0:"0"},ys=/^\s*\d+/,bs=/^%/;uo.locale=function(t){return{numberFormat:Bt(t),timeFormat:qt(t)}};var xs=uo.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"]});uo.format=xs.numberFormat,uo.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,_s),he(_s.s,this.s,this),this.s?this.t+=_s.t:this.s=_s.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _s=new fe;uo.geo.stream=function(t,e){t&&ws.hasOwnProperty(t.type)?ws[t.type](t,e):de(t,e)};var ws={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nd&&(d=e)}function e(e,r){var n=me([e*Vo,r*Vo]);if(m){var i=be(m,n),a=[i[1],-i[0],0],o=be(a,i);we(o),o=Ae(o);var l=e-p,u=l>0?1:-1,g=o[0]*qo*u,v=xo(l)>180;if(v^(u*pd&&(d=y)}else if(g=(g+360)%360-180,v^(u*pd&&(d=r);v?es(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e):h>=c?(eh&&(h=e)):e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,r);m=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=h,_.point=t,m=null}function i(t,r){if(m){var n=t-p;y+=xo(n)>180?n+(n>0?360:-360):n}else g=t,v=r;Ts.point(t,r),e(t,r)}function a(){Ts.lineStart()}function o(){i(g,v),Ts.lineEnd(),xo(y)>zo&&(c=-(h=180)),x[0]=c,x[1]=h,m=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tzo?d=90:y<-zo&&(f=-90),x[0]=c,x[1]=h}};return function(t){d=h=-(c=f=1/0),b=[],uo.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,i=b[0],a=[i];ns(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):a.push(i=r);for(var o,r,p=-(1/0),e=a.length-1,n=0,i=a[e];n<=e;i=r,++n)r=a[n],(o=s(i[1],r[0]))>p&&(p=o,c=r[0],h=i[1])}return b=x=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){Es=Ls=Ss=Cs=Rs=Is=Os=Ps=Ns=Ds=zs=0,uo.geo.stream(t,Fs);var e=Ns,r=Ds,n=zs,i=e*e+r*r+n*n;return i=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},t.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()}}},t.precision=function(e){return arguments.length?(a.precision(e),o.precision(e),s.precision(e),t):a.precision()},t.scale=function(e){return arguments.length?(a.scale(e),o.scale(.35*e),s.scale(e),t.translate(a.translate())):a.scale()},t.translate=function(e){if(!arguments.length)return a.translate();var u=a.scale(),c=+e[0],f=+e[1];return r=a.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,n=o.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+zo,f+.12*u+zo],[c-.214*u-zo,f+.234*u-zo]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+zo,f+.166*u+zo],[c-.115*u-zo,f+.234*u-zo]]).stream(l).point,t},t.scale(1070)};var Us,Hs,Vs,qs,Gs,Xs,Ys={point:A,lineStart:A,lineEnd:A,polygonStart:function(){Hs=0,Ys.lineStart=We},polygonEnd:function(){Ys.lineStart=Ys.lineEnd=Ys.point=A,Us+=xo(Hs/2)}},Ws={point:Ze,lineStart:A,lineEnd:A,polygonStart:A,polygonEnd:A},Zs={point:Ke,lineStart:Je,lineEnd:tr,polygonStart:function(){Zs.lineStart=er},polygonEnd:function(){Zs.point=Ke,Zs.lineStart=Je,Zs.lineEnd=tr}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),uo.geo.stream(t,o)),a.result()}function e(){return o=null,t}var r,n,i,a,o,s=4.5;return t.area=function(t){return Us=0,uo.geo.stream(t,i(Ys)),Us},t.centroid=function(t){return Ss=Cs=Rs=Is=Os=Ps=Ns=Ds=zs=0,uo.geo.stream(t,i(Zs)),zs?[Ns/zs,Ds/zs]:Ps?[Is/Ps,Os/Ps]:Rs?[Ss/Rs,Cs/Rs]:[NaN,NaN]},t.bounds=function(t){return Gs=Xs=-(Vs=qs=1/0),uo.geo.stream(t,i(Ws)),[[Vs,qs],[Gs,Xs]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):x,e()):r},t.context=function(t){return arguments.length?(a=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&a.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(a.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var r=new ar(e);for(var n in t)r[n]=t[n];return r}}},ar.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()}},uo.geo.projection=sr,uo.geo.projectionMutator=lr,(uo.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*Vo,e[1]*Vo),e[0]*=qo,e[1]*=qo,e}return t=hr(t[0]%360*Vo,t[1]*Vo,t.length>2?t[2]*Vo:0),e.invert=function(e){return e=t.invert(e[0]*Vo,e[1]*Vo),e[0]*=qo,e[1]*=qo,e},e},fr.invert=cr,uo.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=hr(-t[0]*Vo,-t[1]*Vo,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=qo,t[1]*=qo}}),{type:"Polygon",coordinates:[i]}}var e,r,n=[0,0],i=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=vr((e=+n)*Vo,i*Vo),t):e},t.precision=function(n){return arguments.length?(r=vr(e*Vo,(i=+n)*Vo),t):i},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Vo,i=t[1]*Vo,a=e[1]*Vo,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((r=f*o)*r+(r=u*c-l*f*s)*r),l*c+u*f*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/v)*v,i,v).map(h).concat(uo.range(Math.ceil(u/m)*m,l,m).map(d)).concat(uo.range(Math.ceil(n/p)*p,r,p).filter(function(t){return xo(t%v)>zo}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return xo(t%m)>zo}).map(f))}var r,n,i,a,o,s,l,u,c,f,h,d,p=10,g=p,v=90,m=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[h(a).concat(d(l).slice(1),h(i).reverse().slice(1),d(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(a=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],a>i&&(e=a,a=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[a,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(v=+e[0],m=+e[1],t):[v,m]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,o,90),f=br(n,r,y),h=yr(u,l,90),d=br(a,i,y),t):y},t.majorExtent([[-180,-90+zo],[180,90-zo]]).minorExtent([[-180,-80-zo],[180,80+zo]])},uo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}var e,r,n=xr,i=_r;return t.distance=function(){return uo.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(i=e,r="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},uo.geo.interpolate=function(t,e){return wr(t[0]*Vo,t[1]*Vo,e[0]*Vo,e[1]*Vo)},uo.geo.length=function(t){return Qs=0,uo.geo.stream(t,$s),Qs};var Qs,$s={sphere:A,point:A,lineStart:Ar,lineEnd:A,polygonStart:A,polygonEnd:A},Ks=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Ks)}).raw=Ks;var Js=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr(Js)}).raw=Js,(uo.geo.conicConformal=function(){return Xe(Mr)}).raw=Mr,(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var tl=kr(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(tl)}).raw=tl,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Ho]},(uo.geo.mercator=function(){return Lr(Er)}).raw=Er;var el=kr(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr(el)}).raw=el;var rl=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(rl)}).raw=rl,Sr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ho]},(uo.geo.transverseMercator=function(){var t=Lr(Sr),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=Sr,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Lt(r),a=Lt(n),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e=n&&u.x<=a&&u.y>=i&&u.y<=o?[[n,o],[a,o],[a,i],[n,i]]:[];c.point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/zo)*zo,y:Math.round(o(t,e)/zo)*zo,i:e}})}var n=Cr,i=Rr,a=n,o=i,s=fl;return t?e(t):(e.links=function(t){return un(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return un(r(t)).cells.forEach(function(r,n){for(var i,a,o=r.site,s=r.edges.sort(Xr),l=-1,u=s.length,c=s[u-1].edge,f=c.l===o?c.r:c.l;++l=u,h=n>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),f?i=u:s=u,h?o=c:l=c,a(t,e,r,n,i,o,s,l)}var c,f,h,d,p,g,v,m,y,b=Lt(s),x=Lt(l);if(null!=e)g=e,v=r,m=n,y=i;else if(m=y=-(g=v=1/0),f=[],h=[],p=t.length,o)for(d=0;dm&&(m=c.x),c.y>y&&(y=c.y),f.push(c.x),h.push(c.y);else for(d=0;dm&&(m=_),w>y&&(y=w),f.push(_),h.push(w)}var A=m-g,k=y-v;A>k?y=v+A:m=g+k;var M=pn();if(M.add=function(t){a(M,t,+b(t,++d),+x(t,d),g,v,m,y)},M.visit=function(t){gn(t,M,g,v,m,y)},M.find=function(t){return vn(M,t[0],t[1],g,v,m,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=gl.get(r)||pl,n=vl.get(n)||x,An(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=Dn,uo.interpolateHsl=zn,uo.interpolateLab=Fn,uo.interpolateRound=Bn,uo.transform=function(t){var e=ho.createElementNS(uo.ns.prefix.svg,"g");return(uo.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new jn(r?r.matrix:ml)})(t)},jn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ml={a:1,b:0,c:0,d:1,e:0,f:0};uo.interpolateTransform=Zn,uo.layout={},uo.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r0?i=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),r=Ot(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;l=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;n&&(a.value=0),a.children=u}else n&&(a.value=+n.call(t,a,a.depth)||0),delete a.children;return li(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=fi,r=ui,n=ci;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0),(r=e.parent)&&(r.value+=e.value); -})),e},t},uo.layout.partition=function(){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,u=-1;for(n=e.value?n/e.value:0;++us&&(s=n),o.push(n)}for(r=0;r0)for(a=-1;++a=c[0]&&s<=c[1]&&(o=l[uo.bisect(f,s,1,d)-1],o.y+=p,o.push(t[a]));return l}var e=!0,r=Number,n=Ai,i=_i;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=Lt(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:Lt(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},uo.layout.pack=function(){function t(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,Li),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=f}),li(s,Li),li(s,function(t){t.r-=f})}return Ri(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),o}var e,r=uo.layout.hierarchy().sort(ki),n=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},oi(t,r)},uo.layout.tree=function(){function t(t,i){var c=o.call(this,t,i),f=c[0],h=e(f);if(li(h,r),h.parent.m=-h.z,si(h,n),u)si(f,a);else{var d=f,p=f,g=f;si(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var v=s(d,p)/2-d.x,m=l[0]/(p.x+s(p,d)/2+v),y=l[1]/(g.depth||1);si(f,function(t){t.x=(t.x+v)*m,t.y=t.depth*y})}return c}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var i,a=e.children,o=0,s=a.length;o0&&(Di(Fi(o,t,r),t,n),u+=n,c+=n),f+=o.m,u+=i.m,h+=l.m,c+=a.m;o&&!Ni(a)&&(a.t=o,a.m+=f-c),i&&!Pi(l)&&(l.t=i,l.m+=u-h,r=t)}return r}function a(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Oi,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?a:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:a,t):u?l:null},oi(t,o)},uo.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=ji(e),t.y=Bi(e)):(t.x=o?u+=r(t,o):0,t.y=0,o=t)});var c=Ui(l),f=Hi(l),h=c.x-r(c,f)/2,d=f.x+r(f,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*n[0],t.y=(l.y-t.y)*n[1]}:function(t){t.x=(t.x-h)/(d-h)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=uo.layout.hierarchy().sort(null).value(null),r=Oi,n=[1,1],i=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(i=null==(n=e),t):i?null:n},t.nodeSize=function(e){return arguments.length?(i=null!=(n=e),t):i?n:null},oi(t,e)},uo.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,a=t.length;++i0;)c.push(o=h[l-1]),c.area+=o.area,"squarify"!==d||(s=n(c,g))<=p?(h.pop(),p=s):(c.area-=c.pop().area,i(c,g,u,!1),g=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,g,u,!0),c.length=c.area=0),a.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var a,o=f(e),s=n.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(i(l,a.z?o.dx:o.dy,o,!s.length),l.length=l.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=r));return n*=n,e*=e,n?Math.max(e*i*p/n,n/(e*a*p)):1/0}function i(t,e,r,n){var i,a=-1,o=t.length,s=r.x,u=r.y,c=e?l(t.area/e):0;if(e==r.dx){for((n||c>r.dy)&&(c=r.dy);++ar.dx)&&(c=r.dx);++a1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=uo.random.normal.apply(uo,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=uo.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;rf?0:1;if(u=Uo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,v,m,y,b,x,_,w,A,k,M,T=0,E=0,L=[];if((m=(+l.apply(this,arguments)||0)/2)&&(v=a===Il?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(E*=-1),u&&(E=nt(v/u*Math.sin(m))),t&&(T=nt(v/t*Math.sin(m)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(f-E),_=u*Math.sin(f-E);var S=Math.abs(f-c-2*E)<=Bo?0:1;if(E&&ba(y,b,x,_)===d^S){var C=(c+f)/2;y=u*Math.cos(C),b=u*Math.sin(C),x=_=null}}else y=b=0;if(t){w=t*Math.cos(f-T),A=t*Math.sin(f-T),k=t*Math.cos(c+T),M=t*Math.sin(c+T);var R=Math.abs(c-f+2*T)<=Bo?0:1;if(T&&ba(w,A,k,M)===1-d^R){var I=(c+f)/2;w=t*Math.cos(I),A=t*Math.sin(I),k=M=null}}else w=A=0;if(h>zo&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){g=tBo)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var a=xr,o=_r,s=qa,l=va,u=ma;return t.radius=function(e){return arguments.length?(s=Lt(e),t):s},t.source=function(e){return arguments.length?(a=Lt(e),t):a},t.target=function(e){return arguments.length?(o=Lt(e),t):o},t.startAngle=function(e){return arguments.length?(l=Lt(e),t):l},t.endAngle=function(e){return arguments.length?(u=Lt(e),t):u},t},uo.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=r.call(this,t,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return l=l.map(n),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=xr,r=_r,n=Ga;return t.source=function(r){return arguments.length?(e=Lt(r),t):e},t.target=function(e){return arguments.length?(r=Lt(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},uo.svg.diagonal.radial=function(){var t=uo.svg.diagonal(),e=Ga,r=t.projection;return t.projection=function(t){return arguments.length?r(Xa(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(zl.get(e.call(this,t,n))||Za)(r.call(this,t,n))}var e=Wa,r=Ya;return t.type=function(r){return arguments.length?(e=Lt(r),t):e},t.size=function(e){return arguments.length?(r=Lt(e),t):r},t};var zl=uo.map({circle:Za,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Bl)),r=e*Bl;return"M0,"+-e+"L"+r+",0 0,"+e+" "+-r+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/Fl),r=e*Fl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Fl),r=e*Fl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=zl.keys();var Fl=Math.sqrt(3),Bl=Math.tan(30*Vo);So.transition=function(t){for(var e,r,n=jl||++ql,i=to(t),a=[],o=Ul||{time:Date.now(),ease:Ln,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",f[1]-f[0])}function i(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function a(){function a(){32==uo.event.keyCode&&(S||(b=null,R[0]-=f[1],R[1]-=h[1],S=2),T())}function g(){32==uo.event.keyCode&&2==S&&(R[0]+=f[1],R[1]+=h[1],S=0,T())}function v(){var t=uo.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),S||(uo.event.altKey?(b||(b=[(f[0]+f[1])/2,(h[0]+h[1])/2]),R[0]=f[+(t[0]>>31},e.exports.exponent=function(t){var r=e.exports.hi(t);return(r<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){var r=e.exports.hi(t);return!(2146435072&r)}}).call(this,t("buffer").Buffer)},{buffer:38}],57:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(i<=0)return[];var a,o=new Array(i);if(r===t.length-1)for(a=0;a0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=a},{}],58:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;n0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],a=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(s=a;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(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],61:[function(t,e,r){"use strict";function n(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}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],62:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=a}function i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function a(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}function l(t,e){if(e.left){var r=l(t,e.left);if(r)return r}var r=t(e.key,e.value);return r?r:e.right?l(t,e.right):void 0}function u(t,e,r,n){var i=e(t,n.key);if(i<=0){if(n.left){var a=u(t,e,r,n.left);if(a)return a}var a=r(n.key,n.value);if(a)return a}if(n.right)return u(t,e,r,n.right)}function c(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=c(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return c(t,e,r,n,i.right)}function f(t,e){this.tree=t,this._stack=e}function h(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t._color=e._color,t._count=e._count}function d(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=m);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===v){if(n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=m,r._color=m,s._color=m,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}return void(t[l-1]=n)}if(n.left&&n.left._color===v){if(n=r.right=i(n),s=n.left=i(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=m,n._color=m,e._color=m,o(r),o(n),o(s),l>1){var u=t[l-2];u.left===r?u.left=s:u.right=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.right=a(v,n));r.right=a(v,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=v,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}t[l-1]=n,t[l]=r,l+11){var u=t[l-2];u.right===r?u.right=n:u.left=n}return void(t[l-1]=n)}if(n.right&&n.right._color===v){if(n=r.left=i(n),s=n.right=i(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=m,n._color=m,e._color=m,o(r),o(n),o(s),l>1){var u=t[l-2];u.right===r?u.right=s:u.left=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.left=a(v,n));r.left=a(v,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=v,o(r),o(n),l>1){var u=t[l-2];u.right===r?u.right=n:u.left=n}t[l-1]=n,t[l]=r,l+1e?1:0}function g(t){return new s(t||p,null)}e.exports=g;var v=0,m=1,y=s.prototype;Object.defineProperty(y,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(y,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(y,"length",{get:function(){return this.root?this.root._count:0}}),y.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],u=[];i;){var c=r(t,i.key);l.push(i),u.push(c),i=c<=0?i.left:i.right}l.push(new n(v,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){var i=l[f];u[f]<=0?l[f]=new n(i._color,i.key,i.value,l[f+1],i.right,i._count+1):l[f]=new n(i._color,i.key,i.value,i.left,l[f+1],i._count+1)}for(var f=l.length-1;f>1;--f){var h=l[f-1],i=l[f];if(h._color===m||i._color===m)break;var d=l[f-2];if(d.left===h)if(h.left===i){var p=d.right;if(!p||p._color!==v){if(d._color=v,d.left=h.right,h._color=m,h.right=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3){var g=l[f-3];g.left===d?g.left=h:g.right=h}break}h._color=m,d.right=a(m,p),d._color=v,f-=1}else{var p=d.right;if(!p||p._color!==v){if(h.right=i.left,d._color=v,d.left=i.right,i._color=m,i.left=h,i.right=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3){var g=l[f-3];g.left===d?g.left=i:g.right=i}break}h._color=m,d.right=a(m,p),d._color=v,f-=1}else if(h.right===i){var p=d.left;if(!p||p._color!==v){if(d._color=v,d.right=h.left,h._color=m,h.left=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3){var g=l[f-3];g.right===d?g.right=h:g.left=h}break}h._color=m,d.left=a(m,p),d._color=v,f-=1}else{var p=d.left;if(!p||p._color!==v){if(h.left=i.right,d._color=v,d.right=i.left,i._color=m,i.right=h,i.left=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3){var g=l[f-3];g.right===d?g.right=i:g.left=i}break}h._color=m,d.left=a(m,p),d._color=v,f-=1}}return l[0]._color=m,new s(r,l[0])},y.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return c(e,r,this._compare,t,this.root)}},Object.defineProperty(y,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new f(this,t)}}),Object.defineProperty(y,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new f(this,t)}}),y.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,[])},y.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)},y.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)},y.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)},y.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)},y.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var i=e(t,r.key);if(n.push(r),0===i)return new f(this,n);r=i<=0?r.left:r.right}return new f(this,[])},y.remove=function(t){var e=this.find(t);return e?e.remove():this},y.get=function(t){for(var e=this._compare,r=this.root;r;){var n=e(t,r.key);if(0===n)return r.value;r=n<=0?r.left:r.right}};var b=f.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new f(this.tree,this._stack.slice())},b.remove=function(){var t=this._stack;if(0===t.length)return this.tree;var e=new Array(t.length),r=t[t.length-1];e[e.length-1]=new n(r._color,r.key,r.value,r.left,r.right,r._count);for(var i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var a=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var o=e[a-1];e.push(new n(r._color,o.key,o.value,r.left,r.right,r._count)),e[a-1].key=r.key,e[a-1].value=r.value;for(var i=e.length-2;i>=a;--i)r=e[i],e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count);e[a-1].left=e[a]}if(r=e[e.length-1],r._color===v){var l=e[e.length-2];l.left===r?l.left=null:l.right===r&&(l.right=null),e.pop();for(var i=0;i0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(b,"index",{get:function(){var t=0,e=this._stack;if(0===e.length){var r=this.tree.root;return r?r._count:0}e[e.length-1].left&&(t=e[e.length-1].left._count);for(var n=e.length-2;n>=0;--n)e[n+1]===e[n].right&&(++t,e[n].left&&(t+=e[n].left._count));return t},enumerable:!0}),b.next=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.right)for(e=e.right;e;)t.push(e),e=e.left;else for(t.pop();t.length>0&&t[t.length-1].right===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(b,"hasNext",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].right)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].left===t[e])return!0;return!1}}),b.update=function(t){var e=this._stack;if(0===e.length)throw new Error("Can't update empty node!");var r=new Array(e.length),i=e[e.length-1];r[r.length-1]=new n(i._color,i.key,t,i.left,i.right,i._count);for(var a=e.length-2;a>=0;--a)i=e[a],i.left===e[a+1]?r[a]=new n(i._color,i.key,i.value,r[a+1],i.right,i._count):r[a]=new n(i._color,i.key,i.value,i.left,r[a+1],i._count);return new s(this.tree._compare,r[0])},b.prev=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.left)for(e=e.left;e;)t.push(e),e=e.right;else for(t.pop();t.length>0&&t[t.length-1].left===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(b,"hasPrev",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].left)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].right===t[e])return!0;return!1}})},{}],63:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=s[0],r=s.length-1;r>0;--r)e+=s[r]/(t+r);var n=t+o+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=7,a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],o=607/128,s=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];e.exports=function t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(n(e));e-=1;for(var r=a[0],o=1;or)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,a,i),r}function a(t,e){for(var r=l.malloc(t.length,e),n=t.length,i=0;i=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,i){if(r=r||t.ARRAY_BUFFER,i=i||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var a=t.createBuffer(),o=new n(t,r,a,0,i);return o.update(e),o}var l=t("typedarray-pool"),u=t("ndarray-ops"),c=t("ndarray"),f=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],h=n.prototype;h.bind=function(){this.gl.bindBuffer(this.type,this.handle)},h.unbind=function(){this.gl.bindBuffer(this.type,null)},h.dispose=function(){this.gl.deleteBuffer(this.handle)},h.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&"undefined"!=typeof t.shape){var r=t.dtype;if(f.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var n=gl.getExtension("OES_element_index_uint");r=n&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&o(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=l.malloc(t.size,r),h=c(s,t.shape);u.assign(h,t),e<0?this.length=i(this.gl,this.type,this.length,this.usage,s,e):this.length=i(this.gl,this.type,this.length,this.usage,s.subarray(0,t.size),e),l.free(s)}}else if(Array.isArray(t)){var d;d=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),e<0?this.length=i(this.gl,this.type,this.length,this.usage,d,e):this.length=i(this.gl,this.type,this.length,this.usage,d.subarray(0,t.length),e),l.free(d)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");t=0|t,t<=0&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:148,"ndarray-ops":147,"typedarray-pool":187}],66:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE", -36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],67:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":66}],68:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){this.plot=t,this.shader=e,this.fillShader=r,this.positionBuffer=n,this.colorBuffer=i,this.idBuffer=a,this.fillPositionBuffer=o,this.fillColorBuffer=s,this.fillVerts=0,this.shape=[0,0],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numVertices=0,this.lineWidth=1}function i(t,e){var r=Math.floor(e);if(r<0)return t[0];if(r>=t.length-1)return t[t.length-1];var n=e-r;return(1-n)*t[r]+n*t[r+1]}function a(t,e){var r=t.gl,i=s(r,p.vertex,p.fragment),a=s(r,p.fillVertex,p.fragment),o=l(r),u=l(r),c=l(r),f=l(r),h=l(r),d=new n(t,i,a,o,u,c,f,h);return d.update(e),t.addObject(d),d}e.exports=a;var o=t("iota-array"),s=t("gl-shader"),l=t("gl-buffer"),u=t("ndarray"),c=t("surface-nets"),f=t("cdt2d"),h=t("clean-pslg"),d=t("binary-search-bounds"),p=t("./lib/shaders"),g=n.prototype,v=[1,0,0,0,0,1,1,0,1,1,0,1];g.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0];return function(){var r,n,i=this.plot,a=this.shader,o=this.fillShader,s=this.bounds,l=this.numVertices,u=this.fillVerts,c=i.gl,f=i.viewBox,h=i.dataBox,d=s[2]-s[0],p=s[3]-s[1],g=h[2]-h[0],v=h[3]-h[1];if(t[0]=2*d/g,t[4]=2*p/v,t[6]=2*(s[0]-h[0])/g-1,t[7]=2*(s[1]-h[1])/v-1,e[0]=f[2]-f[0],e[1]=f[3]-f[1],u>0&&(o.bind(),r=o.uniforms,r.viewTransform=t,r.screenShape=e,n=a.attributes,this.fillPositionBuffer.bind(),n.position.pointer(),this.fillColorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0),c.drawArrays(c.TRIANGLES,0,u)),l>0){a.bind();var m=this.lineWidth*i.pixelRatio;r=a.uniforms,r.viewTransform=t,r.screenShape=e,r.lineWidth=m,r.pointSize=1e3,n=a.attributes,this.positionBuffer.bind(),n.position.pointer(c.FLOAT,!1,16,0),n.tangent.pointer(c.FLOAT,!1,16,8),this.colorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0),c.drawArrays(c.TRIANGLES,0,l),r.lineWidth=0,r.pointSize=m,this.positionBuffer.bind(),n.position.pointer(c.FLOAT,!1,48,0),n.tangent.pointer(c.FLOAT,!1,48,8),this.colorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0,12,0),c.drawArrays(c.POINTS,0,l/3)}}}(),g.drawPick=function(){return function(t){return t}}(),g.pick=function(t,e,r){return null},g.update=function(t){function e(t,e,r,n){var i=n-r;return Math.abs(i)<1e-6?e:Math.floor(e)+Math.max(.001,Math.min(.999,(t-r)/i))}t=t||{};var r=t.shape||[0,0],n=t.x||o(r[0]),a=t.y||o(r[1]),s=t.z||new Float32Array(r[0]*r[1]),l=t.levels||[],p=t.levelColors||[],g=this.bounds,m=g[0]=n[0],y=g[1]=a[0],b=g[2]=n[n.length-1],x=g[3]=a[a.length-1];m===b&&(g[2]+=1,b+=1),y===x&&(g[3]+=1,x+=1);var _=1/(b-m),w=1/(x-y);this.lineWidth=t.lineWidth||1;for(var A=u(s,r),k=[],M=[],T=[],E=[],L=[[0,0],[r[0]-1,0],[0,r[1]-1],[r[0]-1,r[1]-1]],S=0;S0&&C===l[S-1])){for(var R=c(A,C),I=255*p[4*S]|0,O=255*p[4*S+1]|0,P=255*p[4*S+2]|0,N=255*p[4*S+3]|0,D=R.cells,z=R.positions,F=Array(z.length),B=0;B1)){var V,q=H[0],G=H[1],X=A.get(Math.floor(q),Math.floor(G)),Y=A.get(Math.floor(q),Math.ceil(G)),W=A.get(Math.ceil(q),Math.floor(G)),Z=A.get(Math.ceil(q),Math.ceil(G));0===Math.floor(H[0])&&X<=C!=Y>1;for(e=0;e0&&(T*=_),E<0?E*=w:E>0&&(E*=A),v[b++]=h*(r-p+T),v[b++]=d*(n-g+E),v[b++]=o*M[2]+(l+o)*M[4],v[b++]=o*M[3]+(l+o)*M[5]}}for(e=0;e1&&h.drawBuffersWEBGL(y[f]);var m=r.getExtension("WEBGL_depth_texture");m?d?t.depth=s(r,u,c,m.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=s(r,u,c,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=l(r,u,c,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=l(r,u,c,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=l(r,u,c,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var v=0;vs||r<0||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(a),u=0;uo||r<0||r>o)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),s<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var f=!0;"depth"in n&&(f=!!n.depth);var h=!1;return"stencil"in n&&(h=!!n.stencil),new c(t,e,r,l,s,f,h,i)}var d=t("gl-texture2d");e.exports=h;var p,g,v,m,y=null,b=c.prototype;Object.defineProperties(b,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return f(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t=0|t,f(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t=0|t,f(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e>8*h&255;this.pickOffset=r,i.bind();var d=i.uniforms;d.viewTransform=t,d.pickOffset=e;var p=i.attributes;return this.positionBuffer.bind(),p.position.pointer(),this.idBuffer.bind(),p.pickId.pointer(o.UNSIGNED_BYTE,!1),o.drawArrays(o.TRIANGLES,0,this.numVertices),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){t=t||{};var e=t.shape||[0,0],r=t.x||o(e[0]),n=t.y||o(e[1]),i=t.z||new Float32Array(e[0]*e[1]);this.xData=r,this.yData=n;var l=t.colorLevels||[0],u=t.colorValues||[0,0,0,1],c=l.length,f=this.bounds,d=f[0]=r[0],p=f[1]=n[0],g=f[2]=r[r.length-1],v=f[3]=n[n.length-1],m=1/(g-d),y=1/(v-p),b=e[0]*e[1]*(h.length>>>1);this.numVertices=b;var x=s.mallocUint8(4*b),_=s.mallocFloat32(2*b),w=s.mallocUint32(b),A=e[0],k=e[1];this.shape=[A,k];for(var M=0,T=0;T2&&!this.usingDashes){var b=this.mitreShader;this.lineBufferLo.bind(),b.attributes.aLo.pointer(l.FLOAT,!1,48,0),this.lineBufferHi.bind(),b.bind();var x=b.uniforms;this.setProjectionUniforms(x,a),x.color=c,x.radius=s*u,b.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,i/3|0)}}}}(),h.drawPick=function(){var t=[0,0,0,0];return function(e){var r=this.vertCount,n=this.numPoints;if(this.pickOffset=e,!r)return e+n;var i=this.setProjectionModel(),a=this.plot,o=this.width,s=a.gl,l=a.pickPixelRatio,u=this.pickShader,c=this.pickBuffer;t[0]=255&e,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24,u.bind();var f=u.uniforms;this.setProjectionUniforms(f,i),f.width=o*l,f.pickOffset=t;var h=u.attributes;return this.lineBufferHi.bind(),h.aHi.pointer(s.FLOAT,!1,16,0),h.dHi.pointer(s.FLOAT,!1,16,8),this.lineBufferLo.bind(),h.aLo.pointer(s.FLOAT,!1,16,0),c.bind(),h.pick0.pointer(s.UNSIGNED_BYTE,!1,8,0),h.pick1.pointer(s.UNSIGNED_BYTE,!1,8,4),s.drawArrays(s.TRIANGLES,0,r),e+n}}(),h.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(r=n+i)return null;var a=r-n,o=this.data;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}},h.update=function(t){t=t||{};var e,r,n,a,o,s=this.plot.gl;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=i(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var f=t.dashes||[1],h=0;for(e=0;e1,this.dashPattern=l(s,u(d,[h,1,4],[1,0,0])),this.dashPattern.minFilter=s.NEAREST,this.dashPattern.magFilter=s.NEAREST,this.dashLength=h,c.free(d);var g=t.positions;this.data=g;var v=this.bounds;v[0]=v[1]=1/0,v[2]=v[3]=-(1/0);var m=this.numPoints=g.length>>>1;if(0!==m){for(e=0;e1;){var M=--n;a=g[2*n],o=g[2*n+1];var T=M-1,E=g[2*T],L=g[2*T+1];if(!(isNaN(a)||isNaN(o)||isNaN(E)||isNaN(L))){k+=1,a=(a-v[0])/(v[2]-v[0]),o=(o-v[1])/(v[3]-v[1]),E=(E-v[0])/(v[2]-v[0]),L=(L-v[1])/(v[3]-v[1]);var S=E-a,C=L-o,R=M|1<<24,I=M-1,O=M,P=M-1|1<<24;y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=a,_[--A]=R,_[--A]=I,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=O,_[--A]=P,y[--w]=-C,y[--w]=-S,y[--w]=L,y[--w]=E,_[--A]=O,_[--A]=P,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=O,_[--A]=P,y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=a,_[--A]=R,_[--A]=I,y[--w]=C,y[--w]=S,y[--w]=o,y[--w]=a,_[--A]=R,_[--A]=I}}for(e=0;es[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n],a.uniforms.angle=m[n],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n]&&A&&(e[1^n]-=T*d*b[n],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n],a.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,A)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*g[n+2],ks[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n+2],a.uniforms.angle=m[n+2],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n+2]&&A&&(e[1^n]+=T*d*b[n+2],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n+2],a.uniforms.angle=_[n+2],u.drawArrays(u.TRIANGLES,w,A))}}(),c.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,u=r.pixelRatio;if(this.titleCount){for(var c=0;c<2;++c)e[c]=2*(o[c]*u-a[c])/(a[2+c]-a[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,a=n._tickBounds,o=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var u=0;u<2;++u){var c=a[u],f=a[u+2],h=f-c,d=.5*(o[u+2]+o[u]),p=o[u+2]-o[u],g=l[u],v=l[u+2],m=v-g,y=s[u],b=s[u+2],x=b-y;e[u]=2*h/p*m/x,t[u]=2*(c-d)/p*m/x}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){var e,r,n,i,a,o=[],l=t.ticks,u=t.bounds;for(a=0;a<2;++a){var c=[Math.floor(o.length/3)],f=[-(1/0)],h=l[a];for(e=0;er)for(t=r;te)for(t=e;t=0){for(var k=0|A.type.charAt(A.type.length-1),M=new Array(k),T=0;T=0;)E+=1;w[b]=E}var L=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,x,w),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=a},{"./lib/GLError":88,"./lib/create-attributes":89,"./lib/create-uniforms":90,"./lib/reflect":91,"./lib/runtime-reflect":92,"./lib/shader-cache":93}],88:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="GLError",n.prototype.constructor=n,e.exports=n},{}],89:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}function i(t,e,r,i,a,o,s){for(var l=["gl","v"],u=[],c=0;c=0){var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);i(t,e,d[0],n,p,o,f)}else{if(!(h.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+f+": "+h);var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);a(t,e,d,n,p,o,f)}}}return o}e.exports=o;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,a=i._gl,o=i._locations[i._index];a.vertexAttribPointer(o,i._dimension,t||a.FLOAT,!!e,r||0,n||0),a.enableVertexAttribArray(o)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":88}],90:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;n4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(i<2||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],a=t;a+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function f(e){for(var n=["return function updateProperty(obj){"],i=c("",e),o=0;o4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var o=p(i);Object.defineProperty(t,e,{get:n(o),set:f(i),enumerable:!0,configurable:!1})}else a[i]?Object.defineProperty(t,e,{get:l(i),set:f(i),enumerable:!0,configurable:!1}):t[e]=h(r[i].type)}function p(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 u=1;u1)for(var l=0;l=0){var g=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(g,e[1],g,e[3],d[p],h[p]):o.drawLine(e[0],g,e[2],g,d[p],h[p])}}for(var p=0;p=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},h.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},h.removeObject=function(t){for(var e=this.objects,r=0;r>>1;for(r=0;r=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}function a(t,e){var r=t.gl,i=s(r),a=s(r),l=o(r,u.pointVertex,u.pointFragment),c=o(r,u.pickVertex,u.pickFragment),f=new n(t,i,a,l,c);return f.update(e),t.addObject(f),f}var o=t("gl-shader"),s=t("gl-buffer"),l=t("typedarray-pool"),u=t("./lib/shader");e.exports=a;var c=n.prototype;c.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},c.update=function(t){function e(e,r){return e in t?t[e]:r}var r;t=t||{},this.sizeMin=e("sizeMin",.5),this.sizeMax=e("sizeMax",20),this.color=e("color",[1,0,0,1]).slice(),this.areaRatio=e("areaRatio",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.blend=e("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,a=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,o=t.positions,s=i?o:l.mallocFloat32(o.length),u=a?t.idToIndex:l.mallocInt32(n);if(i||s.set(o),!a)for(s.set(o),r=0;r>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),a.attributes.pickId.pointer(o.UNSIGNED_BYTE),a.uniforms.pickOffset=e,this.pickOffset=r);var h=o.getParameter(o.BLEND),d=o.getParameter(o.DITHER);return h&&!this.blend&&o.disable(o.BLEND),d&&o.disable(o.DITHER),o.drawArrays(o.POINTS,0,this.pointCount),h&&!this.blend&&o.enable(o.BLEND),d&&o.enable(o.DITHER),r+this.pointCount}}(),c.draw=c.unifiedDraw,c.drawPick=c.unifiedDraw,c.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":95,"gl-buffer":65,"gl-shader":96,"typedarray-pool":187}],104:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4(scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n",fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4(scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],105:[function(t,e,r){arguments[4][87][0].apply(r,arguments)},{"./lib/GLError":106,"./lib/create-attributes":107,"./lib/create-uniforms":108,"./lib/reflect":109,"./lib/runtime-reflect":110,"./lib/shader-cache":111,dup:87}],106:[function(t,e,r){arguments[4][88][0].apply(r,arguments)},{dup:88}],107:[function(t,e,r){arguments[4][89][0].apply(r,arguments)},{"./GLError":106,dup:89}],108:[function(t,e,r){arguments[4][90][0].apply(r,arguments)},{"./GLError":106,"./reflect":109,dup:90}],109:[function(t,e,r){arguments[4][91][0].apply(r,arguments)},{dup:91}],110:[function(t,e,r){arguments[4][92][0].apply(r,arguments)},{dup:92}],111:[function(t,e,r){arguments[4][93][0].apply(r,arguments)},{"./GLError":106,dup:93,"gl-format-compiler-error":74,"weakmap-shim":194}],112:[function(t,e,r){"use strict";function n(t){if(t in h)return h[t];var e=c(t,{polygons:!0,font:"sans-serif",textAlign:"left",textBaseline:"alphabetic"}),r=[],n=[];e.forEach(function(t){t.forEach(function(t){for(var e=0;e>8*d&255;h.uniforms.pickOffset=o,this.idBuffer.bind(),h.attributes.id.pointer(f.UNSIGNED_BYTE,!1)}else this.colorBuffer.bind(),h.attributes.color.pointer(f.UNSIGNED_BYTE,!0);return this.posHiBuffer.bind(),h.attributes.positionHi.pointer(),this.posLoBuffer.bind(),h.attributes.positionLo.pointer(),this.offsetBuffer.bind(),h.attributes.offset.pointer(),h.uniforms.pixelScale=a,h.uniforms.scaleHi=e,h.uniforms.scaleLo=r,h.uniforms.translateHi=n,h.uniforms.translateLo=i,f.drawArrays(f.TRIANGLES,0,c),l?s+this.numPoints:void 0}}(),d.draw=d.drawPick,d.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;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]]}},d.update=function(t){t=t||{};var e,r,i=t.positions||[],a=t.colors||[],o=t.glyphs||[],s=t.sizes||[],c=t.borderWidths||[],f=t.borderColors||[];this.points=i;var h,d,p=this.bounds=[1/0,1/0,-(1/0),-(1/0)],g=0,v=[],m=[];for(e=0;e>1,r=0;r<2;++r)p[r]=Math.min(p[r],i[2*e+r]),p[2+r]=Math.max(p[2+r],i[2*e+r]);p[0]===p[2]&&(p[2]+=1),p[3]===p[1]&&(p[3]+=1);var y=1/(p[2]-p[0]),b=1/(p[3]-p[1]),x=p[0],_=p[1],w=u.mallocFloat64(2*g),A=u.mallocFloat32(2*g),k=u.mallocFloat32(2*g),M=u.mallocFloat32(2*g),T=u.mallocUint8(4*g),E=u.mallocUint32(g),L=0;for(e=0;et;){var d=r[h-1],p=n[2*(h-1)];if((d-s||l-p)>=0)break;r[h]=d,n[2*h]=p,n[2*h+1]=n[2*h-1],i[h]=i[h-1],a[h]=a[h-1],h-=1}r[h]=s,n[2*h]=l,n[2*h+1]=u,i[h]=c,a[h]=f}}function a(t,e,r,n,i,a){var o=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=a[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,i[e]=u,a[e]=c}function o(t,e,r,n,i,a){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e]}function s(t,e,r,n,i,a,o){var s=n[t],l=i[2*t],u=i[2*t+1],c=a[t],f=o[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],a[t]=a[e],o[t]=o[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],a[e]=a[r],o[e]=o[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,a[r]=c,o[r]=f}function l(t,e,r,n,i,a,o,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=a,c[e]=o}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,a,o,s){return(e-a[t]||o[2*t]-r||i-s[t])<0}function f(t,e,r,n,d,p){var g=(e-t+1)/6|0,v=t+g,m=e-g,y=t+e>>1,b=y-g,x=y+g,_=v,w=b,A=y,k=x,M=m,T=t+1,E=e-1,L=0;u(_,w,r,n,d,p)&&(L=_,_=w,w=L),u(k,M,r,n,d,p)&&(L=k,k=M,M=L),u(_,A,r,n,d,p)&&(L=_,_=A,A=L),u(w,A,r,n,d,p)&&(L=w,w=A,A=L),u(_,k,r,n,d,p)&&(L=_,_=k,k=L),u(A,k,r,n,d,p)&&(L=A,A=k,k=L),u(w,M,r,n,d,p)&&(L=w,w=M,M=L),u(w,A,r,n,d,p)&&(L=w,w=A,A=L),u(k,M,r,n,d,p)&&(L=k,k=M,M=L);var S=r[w],C=n[2*w],R=n[2*w+1],I=d[w],O=p[w],P=r[k],N=n[2*k],D=n[2*k+1],z=d[k],F=p[k],B=_,j=A,U=M,H=v,V=y,q=m,G=r[B],X=r[j],Y=r[U];r[H]=G,r[V]=X,r[q]=Y;for(var W=0;W<2;++W){var Z=n[2*B+W],Q=n[2*j+W],$=n[2*U+W];n[2*H+W]=Z,n[2*V+W]=Q,n[2*q+W]=$}var K=d[B],J=d[j],tt=d[U];d[H]=K,d[V]=J,d[q]=tt;var et=p[B],rt=p[j],nt=p[U];p[H]=et,p[V]=rt,p[q]=nt,o(b,t,r,n,d,p),o(x,e,r,n,d,p);for(var it=T;it<=E;++it)if(c(it,S,C,R,I,r,n,d))it!==T&&a(it,T,r,n,d,p),++T;else if(!c(it,P,N,D,z,r,n,d))for(;;){if(c(E,P,N,D,z,r,n,d)){c(E,S,C,R,I,r,n,d)?(s(it,T,E,r,n,d,p),++T,--E):(a(it,E,r,n,d,p),--E);break}if(--E=Math.max(.9*d,32)){var b=u+s>>>1;l(v,m,f,h,b,c+1),h=b}l(v,m,f,h,y,c+1),h=y}}}var u=t.length>>>1;if(u<1)return[];for(var c=1/0,f=1/0,h=-(1/0),d=-(1/0),p=0;p=0;--_){t[2*_]=(t[2*_]-c)*m,t[2*_+1]=(t[2*_+1]-f)*y;var M=x[_];M!==A&&(w.push(new i(b*Math.pow(.5,M),_+1,k-(_+1))),k=_+1,A=M)}return w.push(new i(b*Math.pow(.5,M+1),0,k)),o.free(x),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=a},{"./lib/sort":115,"typedarray-pool":187}],117:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.plot=t,this.positionBufferHi=e,this.positionBufferLo=r,this.pickBuffer=n,this.weightBuffer=i,this.shader=a,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=o(r),s=o(r),l=o(r),u=o(r),f=a(r,c.pointVertex,c.pointFragment),h=a(r,c.pickVertex,c.pickFragment),d=new n(t,i,s,l,u,f,h);return d.update(e),t.addObject(d),d}var a=t("gl-shader"),o=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var f=n.prototype,h=new Float32Array(2),d=new Float32Array(2),p=new Float32Array(2),g=new Float32Array(2),v=[0,0,0,0];f.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBufferHi.dispose(),this.positionBufferLo.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},f.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords),this.points=t.positions;var r=this.points.length>>>1,n=u.mallocInt32(r),i=u.mallocFloat32(2*r),a=u.mallocFloat64(2*r);a.set(this.points),this.scales=l(a,n,i,this.bounds);var o=u.mallocFloat64(r),s=u.mallocFloat32(2*r),c=u.mallocFloat32(2*r);s.set(a);for(var f=0,h=0;f>8&255,v[2]=t>>16&255,v[3]=t>>24&255,n.uniforms.pickOffset=v,l.bind(),n.attributes.pickId.pointer(m.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());for(var I=this.xCoords,O=(x[0]-u[0]-E*c*y)/_,P=(x[2]-u[0]+E*c*y)/_,N=!0,D=i.length-1;D>=0;D--){var z=i[D];if(!(z.pixelSize1)){var F=z.offset,B=z.count+F,j=s.ge(I,O,F,B-1),U=s.lt(I,P,j,B-1)+1;U>j&&m.drawArrays(m.POINTS,j,U-j),!e&&N&&(N=!1,n.uniforms.useWeight=0)}}},f.drawPick=f.draw,f.pick=function(t,e,r){var n=r-this.pickOffset;return n<0||n>=this.pointCount?null:{object:this,pointId:n,dataCoord:[this.points[2*n],this.points[2*n+1]]}}},{"./lib/shader":113,"binary-search-bounds":114,"gl-buffer":65,"gl-shader":121,"snap-points-2d":116,"typedarray-pool":187}],118:[function(t,e,r){"use strict";r.boxVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n",r.boxFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"},{}],119:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.boxBuffer=e,this.boxShader=r,this.enabled=!0,this.selectBox=[1/0,1/0,-(1/0),-(1/0)],this.borderColor=[0,0,0,1],this.innerFill=!1,this.innerColor=[0,0,0,.25],this.outerFill=!0,this.outerColor=[0,0,0,.5],this.borderWidth=10}function i(t,e){var r=t.gl,i=o(r,[0,0,0,1,1,0,1,1]),l=a(r,s.boxVertex,s.boxFragment),u=new n(t,i,l);return u.update(e),t.addOverlay(u),u}var a=t("gl-shader"),o=t("gl-buffer"),s=t("./lib/shaders");e.exports=i;var l=n.prototype;l.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),i=(this.outerFill,this.outerColor),a=this.borderColor,o=t.box,s=t.screenBox,l=t.dataBox,u=t.viewBox,c=t.pixelRatio,f=(e[0]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],h=(e[1]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1],d=(e[2]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],p=(e[3]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1];if(f=Math.max(f,u[0]),h=Math.max(h,u[1]),d=Math.min(d,u[2]),p=Math.min(p,u[3]),!(d0){var m=r*c;o.drawBox(f-m,h-m,d+m,h+m,a),o.drawBox(f-m,p-m,d+m,p+m,a),o.drawBox(f-m,h-m,f+m,p+m,a),o.drawBox(d-m,h-m,d+m,p+m,a)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":118,"gl-buffer":65,"gl-shader":121}],120:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function a(t,e){var r=o(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=a;var o=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(_inline_55_arg0_<255||_inline_55_arg1_<255||_inline_55_arg2_<255||_inline_55_arg3_<255){var _inline_55_l=_inline_55_arg4_-_inline_55_arg6_[0],_inline_55_a=_inline_55_arg5_-_inline_55_arg6_[1],_inline_55_f=_inline_55_l*_inline_55_l+_inline_55_a*_inline_55_a;_inline_55_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;i=0){for(var k=0|A.type.charAt(A.type.length-1),M=new Array(k),T=0;T=0;)E+=1;_[w]=E}var L=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=a},{"./lib/GLError":122,"./lib/create-attributes":123,"./lib/create-uniforms":124,"./lib/reflect":125,"./lib/runtime-reflect":126,"./lib/shader-cache":127}],122:[function(t,e,r){ -arguments[4][88][0].apply(r,arguments)},{dup:88}],123:[function(t,e,r){arguments[4][89][0].apply(r,arguments)},{"./GLError":122,dup:89}],124:[function(t,e,r){arguments[4][90][0].apply(r,arguments)},{"./GLError":122,"./reflect":125,dup:90}],125:[function(t,e,r){arguments[4][91][0].apply(r,arguments)},{dup:91}],126:[function(t,e,r){arguments[4][92][0].apply(r,arguments)},{dup:92}],127:[function(t,e,r){arguments[4][93][0].apply(r,arguments)},{"./GLError":122,dup:93,"gl-format-compiler-error":74,"weakmap-shim":194}],128:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}function i(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=i;var a=n.prototype;a.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},a.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,a=i.line,o=i.dataBox,s=i.viewBox;if(a.bind(),o[0]<=n[0]&&n[0]<=o[2]&&o[1]<=n[1]&&n[1]<=o[3]){var l=s[0]+(n[0]-o[0])/(o[2]-o[0])*(s[2]-s[0]),u=s[1]+(n[1]-o[1])/(o[3]-o[1])*(s[3]-s[1]);t[0]&&a.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&a.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&a.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&a.drawLine(l,u,l,s[3],e[3],r[3])}},a.dispose=function(){this.plot.removeOverlay(this)}},{}],129:[function(t,e,r){"use strict";function n(t){v=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],m=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],y=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function i(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(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 a(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}function o(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,a,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var f=0,h=0,v=o(c,l.stride.slice());"float32"===u?f=t.FLOAT:"float64"===u?(f=t.FLOAT,v=!1,u="float32"):"uint8"===u?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,v=!1,u="uint8");var m=1;if(2===c.length)h=t.LUMINANCE,c=[c[0],c[1],1],l=d(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])h=t.ALPHA;else if(2===c[2])h=t.LUMINANCE_ALPHA;else if(3===c[2])h=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");h=t.RGBA}m=c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(h=i),h!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,x=s.indexOf(n)<0;if(x&&s.push(n),f===a&&v)0===l.offset&&l.data.length===y?x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data):x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var _;_=a===t.FLOAT?g.mallocFloat32(y):g.mallocUint8(y);var w=d(_,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&a===t.UNSIGNED_BYTE?b(w,l):p.assign(w,l),x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,_.subarray(0,y)),a===t.FLOAT?g.freeFloat32(_):g.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var o=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>o||r<0||r>o)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new a(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new a(t,i,0|e.width,0|e.height,r,n)}function f(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=o(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=d(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var f,h,v=e.size;if(s)f=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var m=[n[2],n[2]*n[0],1];h=g.malloc(v,r);var y=d(h,n,m,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?p.assign(y,e):b(y,e),f=h.subarray(0,v)}var x=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,f),s||g.free(h),new a(t,x,n[0],n[1],c,u)}function h(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(v||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return f(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var d=t("ndarray"),p=t("ndarray-ops"),g=t("typedarray-pool");e.exports=h;var v=null,m=null,y=null,b=function(t,e){p.muls(t,e,255)},x=a.prototype;Object.defineProperties(x,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=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(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t=0|t,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t=0|t,i(this,this._shape[0],t),t}}}),x.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},x.dispose=function(){this.gl.deleteTexture(this.handle)},x.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},x.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var a=this._mipLevels.indexOf(n)<0;a?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:148,"ndarray-ops":147,"typedarray-pool":187}],130:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function R(){return/[^a-fA-F0-9]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function I(){return"."===N?(U.push(N),j=v,D=N,F+1):/[eE]/.test(N)?(U.push(N),j=v,D=N,F+1):"x"===N&&1===U.length&&"0"===U[0]?(j=w,U.push(N),D=N,F+1):/[^\d]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function O(){return"f"===N&&(U.push(N),D=N,F+=1),/[eE]/.test(N)?(U.push(N),D=N,F+1):"-"===N&&/[eE]/.test(D)?(U.push(N),D=N,F+1):/[^\d]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function P(){if(/[^\d\w_]/.test(N)){var t=U.join("");return j=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:m,e(U.join("")),j=u,F}return U.push(N),D=N,F+1}var N,D,z,F=0,B=0,j=u,U=[],H=[],V=1,q=0,G=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return H=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var i=t("./lib/literals"),a=t("./lib/operators"),o=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,f=0,h=1,d=2,p=3,g=4,v=5,m=6,y=7,b=8,x=9,_=10,w=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":133,"./lib/builtins-300es":132,"./lib/literals":135,"./lib/literals-300es":134,"./lib/operators":136}],132:[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":133}],133:[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"]},{}],134:[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":135}],135:[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"]},{}],136:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],137:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":131}],138:[function(t,e,r){r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=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=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),e*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):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+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],139:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function a(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),a(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],a=[],o=[],s=[],r=0;r3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=m.ge(this.leftPoints,t,h),n=m.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var a=this.left?this.left.count:0;if(4*a>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var o=this,l=this.left;l.right;)o=l,l=l.right;if(o===this)l.right=this.right;else{var u=this.left,n=this.right;o.count-=l.count,o.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var u=m.ge(this.leftPoints,t,h);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===x&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},w.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":28}],140:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;r0)return 1<=0)return 1<=0;--e)S(e,0);for(var r=[],e=0;e0;_=_-1&g)x.push(w+"["+T+"+"+v(_)+"]");x.push(m(0));for(var _=0;_0){",h(x[t]),"=1;"),P(t-1,e|1<0&&G.push(s(U,x[H-1])+"*"+o(x[H-1])),B.push(d(U,x[H])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)X.push(o(x[U]));B.push(M+"=("+X.join("*")+")|0",A+"=mallocUint32("+M+")",w+"=mallocUint32("+M+")",T+"=0"),B.push(p(0)+"=0");for(var H=1;H<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 a=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return b(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",A="P",k="N",M="Q",T="X",E="T"},{"typedarray-pool":187}],147:[function(t,e,r){"use strict";function n(t){if(!t)return s;for(var e=0;e>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=a({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]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,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=o({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=o({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=o({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=a({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=a({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=o({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":51}],148:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;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("+u.join(",")+",v){"),n?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var v=0;v=0){d=i"+v+"|0;b+=c"+v+"*d;a"+v+"-=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var v=0;v=0){c=(c+this.stride["+v+"]*i"+v+")|0}else{a.push(this.shape["+v+"]);b.push(this.stride["+v+"])}");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,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",a.join("\n"));return o(f[t],i)}function o(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=f.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),a=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":56}],150:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r="undefined"!=typeof r?r+"":" ",n(r,e)+t}},{"repeat-string":163}],151:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],152:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return a.freeUint32(l),a.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,a,o=1;for(r[0]=0,a=1;a0;--a)n=e/o|0,e=e-n*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}var a=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":140,"typedarray-pool":187}],154:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,s,l,c=0;c<2;++c)if(u[c][n].length>0){o=u[c][n][0],l=c;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=u[f][n],d=0;d0&&(o=p,s=g,l=f)}return a?s:(o&&r(o,l),s)}function a(t,a){var o=u[a][t][0],s=[t];r(o,a);for(var l=o[1^a];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],f=t,h=s[1],d=n(c,f,!0);if(i(e[c],e[f],e[h],e[d])<0)break;s.push(t),l=n(c,f)}return s}function o(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;c0;){var g=(u[0][c].length,a(c,d));o(p,g)?p.push.apply(p,g):(p.length>0&&h.push(p),p=g)}p.length>0&&h.push(p)}return h}e.exports=n;var i=t("compare-angle")},{"compare-angle":49}],155:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function a(t){for(var e=t.length,r=0;r0;){var U=B.pop(),H=I[U];f(H,function(t,e){return t-e});var V,q=H.length,G=j[U];if(0===G){var T=m[U];V=[T]}for(var v=0;v=0)&&(j[X]=1^G,B.push(X),0===G)){var T=m[X];a(T)||(T.reverse(),V.push(T))}}0===G&&d.push(V)}return d}e.exports=a;var o=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),f=t("uniq"),h=t("./lib/trim-leaves")},{"./lib/trim-leaves":155,"edges-to-adjacency-list":58,"planar-dual":154,"point-in-big-polygon":157,"robust-sum":170,"two-product":185,uniq:189}],157:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return!!i&&!!i.queryPoint(r,n)}}function a(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var o=i.key,s=f(r,o[0],o[1]);if(o[0][0]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))return 0;a=1,i=i.right}}return a}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;i1)for(var r=1;ra.length&&e>0&&(1&e&&(a+=t),e>>=1);)t+=t;return a.substr(0,r)}var i,a="";e.exports=n},{}],164:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;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=m*n;return o>=s||o<=-s?o:b(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],u=r[1]-n[1],c=t[2]-n[2],f=e[2]-n[2],h=r[2]-n[2],d=a*u,p=o*l,g=o*s,v=i*u,m=i*l,b=a*s,_=c*(d-p)+f*(g-v)+h*(m-b),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(m)+Math.abs(b))*Math.abs(h),A=y*w;return _>A||-_>A?_:x(t,e,r,n)}];c()},{"robust-scale":167,"robust-subtract":169,"robust-sum":170,"two-product":185}],166:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return a(e,t[0]);if(1===e.length)return a(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.length0&&s>0||o<0&&s<0)return!1;var l=a(r,t,e),u=a(i,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,i))}e.exports=i;var a=t("robust-orientation")[3]},{"robust-orientation":165}],169:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],v=h(g);p=i?(a=d,c+=1,c=i?(a=d,c+=1,c0?1:0}},{}],172:[function(t,e,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],173:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,i=t.length;n>1,s=o(t[a],e);s<=0?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function f(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[g],a))break}return r}function h(t,e){if(!e)return f(u(p(t,0)),t,0);for(var r=new Array(e),n=0;n>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){var n=s(r);if(e0){var t=M[0];return a(0,L-1),L-=1,u(0),t}return-1}function h(t,e){var r=M[t];return b[r]===e?t:(b[r]=-(1/0),c(t),f(),b[r]=e,L+=1,c(L-1))}function d(t){if(!x[t]){x[t]=!0;var e=m[t],r=y[t];m[r]>=0&&(m[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&h(T[e],i(e)),T[r]>=0&&h(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||i<0||i===n)break;if(n=i,i=t[n],!x[n]||i<0||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var g=e.length,v=t.length,m=new Array(g),y=new Array(g),b=new Array(g),x=new Array(g),_=0;_>1;_>=0;--_)u(_);for(;;){var S=f();if(S<0||b[S]>r)break;d(S)}for(var C=[],_=0;_=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&R.push([n,i])}}),o.unique(o.normalize(R)),{positions:C,edges:R}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":165,"simplicial-complex":173}],176:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return ol?i-l:o-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=a(r,i,s),u=a(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;if(l=a(s,o,i),u=a(s,o,r),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]}e.exports=i;var a=t("robust-orientation")},{"robust-orientation":165}],177:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=a(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=a(t.right,e);if(l)return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;a0){var s=a(this.slabs[e-1],t);s&&(o?h(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(o){var p=f(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":176,"binary-search-bounds":28,"functional-red-black-tree":62,"robust-orientation":165}],178:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function a(t,e){return Array(e+1).join(t)}var o={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,f,h,d=1,p=t.length,g="",v=[],m=!0,y="";for(s=0;s=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?v[v.length]=n:(!o.number.test(u[8])||m&&!u[3]?y="":(y=m?"+":"-",n=n.toString().replace(o.sign,"")),f=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",h=u[6]-(y+n).length,c=u[6]&&h>0?a(f,h):"",v[v.length]=u[5]?y+n+c:"0"===f?y+c+n:c+y+n)}return v.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],179:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],180:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128===0){f.length>0&&h.push("}}");var d="vExtra"+f.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(M="+"+v[x]+"*c");var T=.5*(p[x].length/y),E=.5+.5*(m[x]/y);k.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+M+")/("+g[x].join("+")+")")}h.push("a.push([",k.join(),"]);","break;")}n.push("}},"),f.length>0&&h.push("}}");for(var L=[],u=0;u<1<0&&(h+=.02);for(var p=new Float32Array(f),g=0,v=-.5*h,d=0;d.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=L(t,360),e=L(e,100),r=L(r,100),0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,i,a=G(t,e,r),o=q(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function M(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){R(t)&&(t="100%");var n=I(t);return t=q(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function S(t){return q(1,G(0,t))}function C(t){return parseInt(t,16)}function R(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function I(t){return"string"==typeof t&&t.indexOf("%")!=-1}function O(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function N(t){return e.round(255*parseFloat(t)).toString(16)}function D(t){return C(t)/255}function z(t){return!!Z.CSS_UNIT.exec(t)}function F(t){t=t.replace(j,"").replace(U,"").toLowerCase();var e=!1;if(Y[t])t=Y[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Z.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),a:D(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),a:D(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.hex3.exec(t))&&{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),format:e?"name":"hex"}}function B(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var j=/^\s+/,U=/\s+$/,H=0,V=e.round,q=e.min,G=e.max,X=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=E(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*L(this._r,255))+"%",g:V(100*L(this._g,255))+"%",b:V(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*L(this._r,255))+"%, "+V(100*L(this._g,255))+"%, "+V(100*L(this._b,255))+"%)":"rgba("+V(100*L(this._r,255))+"%, "+V(100*L(this._g,255))+"%, "+V(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(W[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,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(k,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=P(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return n(s)},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=B(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},n.mostReadable=function(t,e,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var Y=n.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"},W=n.hexNames=T(Y),Z=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],183:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":151}],184:[function(t,e,r){"use strict";function n(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(o(t+1)),r=[],n=0;n0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function f(t){return new Int16Array(o(2*t),0,t)}function h(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return x?new Uint8ClampedArray(o(t),0,t):s(t)}function v(t){return new DataView(o(t),0,t)}function m(t){t=y.nextPow2(t);var e=y.log2(t),r=A[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,A=_.BUFFER;r.free=function(t){if(n.isBuffer(t))A[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){A[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return f(t);case"int32":return h(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return m(t);case"data":case"dataview":return v(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=f,r.mallocInt32=h,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=v,r.mallocBuffer=m,r.clearCache=function(){for(var t=0;t<32;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,A[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":29,buffer:38,dup:57}],188:[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;e8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height= 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":51}],197:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":196}],198:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e){function r(e,r){return n.coerce(t,s,o,e,r)}var s={};r("opacity"),r("align"),r("bgcolor");var l=r("bordercolor"),u=i.opacity(l);r("borderpad");var c=r("borderwidth"),f=r("showarrow");f&&(r("arrowcolor",u?s.bordercolor:i.defaultLine),r("arrowhead"),r("arrowsize"),r("arrowwidth",2*(u&&c||1)),r("ax"),r("ay"),r("axref"),r("ayref"),n.noneOrAll(t,s,["ax","ay"])),r("text",f?" ":"new text"),r("textangle"),n.coerceFont(r,"font",e.font);for(var h=["x","y"],d=0;d<2;d++){var p=h[d],g={_fullLayout:e},v=a.coerceRef(t,s,g,p),m=a.coerceARef(t,s,g,p),y=.5;if("paper"!==v){var b=a.getFromId(g,v);if(y=b.range[0]+y*(b.range[1]-b.range[0]),["date","category"].indexOf(b.type)!==-1&&"string"==typeof t[p]){var x;if("date"===b.type){if(x=n.dateTime2ms(t[p]),x!==!1&&(t[p]=x),m===v){var _=n.dateTime2ms(t["a"+p]);_!==!1&&(t["a"+p]=_)}}else(b._categories||[]).length&&(x=b._categories.indexOf(t[p]),x!==-1&&(t[p]=x))}}r(p,y),f||r(p+"anchor")}return n.noneOrAll(t,s,["x","y"]),s}},{"../../lib":301,"../../plots/cartesian/axes":330,"../color":207,"./attributes":200}],199:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],200:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":297,"../../plots/cartesian/constants":336,"../../plots/font_attributes":351,"./arrow_paths":199}],201:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,f=s-l,h=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),f=Math.max(f,d),h=Math.max(h,d)}r&&r.autorange&&a.expand(r,[r.l2c(e.x)],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(e.y)],{ppadplus:h,ppadminus:f})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=e.annotations;if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":301,"../../plots/cartesian/axes":330,"./draw":203}],202:[function(t,e,r){"use strict";var n=t("./annotation_defaults");e.exports=function(t,e){for(var r=t.annotations||[],i=e.annotations=[],a=0;a2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=$.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,m=Math.round(u+2*tt),y=Math.round(p+2*tt);q._w=u,q._h=p;var x=!1;if(["x","y"].forEach(function(e){var n,i=q[e+"ref"]||e,a=f.getFromId(t,i),o=(W+("x"===e?0:90))*Math.PI/180,s=m*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=q[e+"anchor"];if(a){if(!a.autorange&&(q[e]-a.range[0])*(q[e]-a.range[1])>0&&(q["a"+e+"ref"]===i?(q["a"+e]-a.range[0])*(q["a"+e]-a.range[1])>0&&(x=!0):x=!0,x))return;Y[e]=a._offset+a.l2p(q[e]),n=.5}else n=q[e],"y"===e&&(n=1-n),Y[e]="x"===e?I.l+I.w*n:I.t+I.h*n;var u=0;q["a"+e+"ref"]===i?Y["aa"+e]=a._offset+a.l2p(q["a"+e]):(u=q.showarrow?q["a"+e]:s*r(n,l),Y[e]+=u),q["_"+e+"type"]=a&&a.type,q["_"+e+"size"]=s,q["_"+e+"shift"]=u}),x)return void $.remove();var _,w;q.showarrow&&(_=q.axref===q.xref?Y.x:c.constrain(Y.x-q.ax,1,k.width-1),w=q.ayref===q.yref?Y.y:c.constrain(Y.y-q.ay,1,k.height-1)),Y.x=c.constrain(Y.x,1,k.width-1),Y.y=c.constrain(Y.y,1,k.height-1);var A=tt-s.top,M=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:M,y:A}),nt.selectAll("tspan.line").attr({y:A,x:M})),et.call(d.setRect,K/2,K/2,m-K,y-K);var T=0,E=0;T=q.axref===q.xref?Math.round(Y.aax-m/2):Math.round(Y.x-m/2),E=q.ayref===q.yref?Math.round(Y.aay-y/2):Math.round(Y.y-y/2),$.call(c.setTranslate,T,E);var L="annotations["+e+"]",S=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=q.axref===q.xref?Y.aax+r:Y.x+r,s=q.ayref===q.yref?Y.aay+n:Y.y+n;var u=c.rotationXYMatrix(W,i,s),f=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,m=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!m.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){m.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=q.arrowwidth,x=q.arrowcolor,A=Z.append("g").style({opacity:h.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=A.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(h.stroke,h.rgb(x));b(k,q.arrowhead,"end",q.arrowsize);var M=A.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,S;v.init({element:M.node(),prepFn:function(){var t=c.getTranslate($);E=t.x,S=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){A.attr("transform","translate("+t+","+e+")");var r=f(E,S),n=r[0]+t,i=r[1]+e;$.call(c.setTranslate,n,i),T[L+".x"]=G?q.x+t/G._m:(_+t-I.l)/I.w,T[L+".y"]=X?q.y+e/X._m:1-(w+e-I.t)/I.h,q.axref===q.xref&&(T[L+".ax"]=G?q.ax+t/G._m:(_+t-I.l)/I.w),q.ayref===q.yref&&(T[L+".ay"]=X?q.ay+e/X._m:1-(w+e-I.t)/I.h),Q.attr({transform:"rotate("+W+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};q.showarrow&&S(0,0);var C=c.rotationXYMatrix(W,Y.x,Y.y),R=c.apply2DTransform(C);if(t._context.editable){var O,P,N;v.init({element:$.node(),prepFn:function(){var t=c.getTranslate($);O=t.x,P=t.y,N={}},moveFn:function(t,e){$.call(c.setTranslate,O+t,P+e);var r="pointer";if(q.showarrow)q.axref===q.xref?N[L+".ax"]=G.p2l(G.l2p(q.ax)+t):N[L+".ax"]=q.ax+t,q.ayref===q.yref?N[L+".ay"]=X.p2l(X.l2p(q.ay)+e):N[L+".ay"]=q.ay+e,S(t,e);else{if(G)N[L+".x"]=q.x+t/G._m;else{var n=q._xsize/I.w,i=q.x+q._xshift/I.w-n/2;N[L+".x"]=v.align(i+t/I.w,n,0,1,q.xanchor)}if(X)N[L+".y"]=q.y+e/X._m;else{var a=q._ysize/I.h,o=q.y-q._yshift/I.h-a/2;N[L+".y"]=v.align(o-e/I.h,a,0,1,q.yanchor)}G&&X||(r=v.getCursor(G?.5:N[L+".x"],X?.5:N[L+".y"],q.xanchor,q.yanchor))}var s=R(O,P),l=s[0]+t,u=s[1]+e;$.call(c.setTranslate,O+t,P+e),Q.attr({transform:"rotate("+W+","+l+","+u+")"}),g($,r)},doneFn:function(e){if(g($),e){l.relayout(t,N);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,A=t.layout,k=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return A.annotations=u,y(A,k),void n(t);if("remove"===u)return delete A.annotations,k.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)k._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}k._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=A.annotations[e],E=k.annotations[e];if(T){var L={xref:T.xref,yref:T.yref},S={};"string"==typeof r&&r?S[r]=u:c.isPlainObject(r)&&(S=r);var C=Object.keys(S);for(w=0;w4/3&&(z=H)}}else D&&(B&&(z<1/3?z+=U:z>2/3&&(z-=U)),z=(z-D.domain[0])/(D.domain[1]-D.domain[0]),z=D.range[0]+z*(D.range[1]-D.range[0]))}D&&D===N&&F&&("log"===F&&"log"!==D.type?z=Math.pow(10,z):"log"!==F&&"log"===D.type&&(z=z>0?Math.log(z)/Math.LN10:void 0)),T[P]=z}}var q=m(T,k);k.annotations[e]=q;var G=f.getFromId(t,q.xref),X=f.getFromId(t,q.yref),Y={x:0,y:0},W=+q.textangle||0,Z=k._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",q.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:q})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),K=q.borderwidth,J=q.borderpad,tt=K+J,et=$.append("rect").attr("class","bg").style("stroke-width",K+"px").call(h.stroke,q.bordercolor).call(h.fill,q.bgcolor),rt=q.font,nt=$.append("text").classed("annotation",!0).attr("data-unformatted",q.text).text(q.text);t._context.editable?nt.call(p.makeEditable,$).call(x).on("edit",function(r){q.text=r,this.attr({"data-unformatted":q.text}),this.call(x);var n={};n["annotations["+e+"].text"]=q.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(x),Q.attr({transform:"rotate("+W+","+Y.x+","+Y.y+")"}).call(d.setPosition,Y.x,Y.y)}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,f=n-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var g=(u*d-c*h)/p,v=(u*f-l*h)/p;return v<0||v>1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./annotation_defaults"),y=t("./defaults"),b=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":301,"../../lib/setcursor":311,"../../lib/svg_text_utils":315,"../../plotly":326,"../../plots/cartesian/axes":330,"../../plots/plots":359,"../color":207,"../dragelement":229,"../drawing":231,"./annotation_defaults":198,"./defaults":202,"./draw_arrow_head":204,d3:55,"fast-isnumeric":61}],204:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var f,h,d,p,g=(o.getPx(t,"stroke-width")||1)*l,v=t.style("stroke")||a.defaultLine,m=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=c.backoff*g;if("line"===u.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},h={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(f.y-h.y,f.x-h.x),p=d+Math.PI,x){var _=x*Math.cos(d),w=x*Math.sin(d);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),b&&(h.x+=_,h.y+=w,t.attr({x2:h.x,y2:h.y}))}}else if("path"===u.nodeName){var A=u.getTotalLength(),k="";if(y){var M=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(M.y-T.y,M.x-T.x),f=u.getPointAtLength(Math.min(x,A)),x&&(k="0px,"+x+"px,")}if(b){var E=u.getPointAtLength(A),L=u.getPointAtLength(A-.1);if(p=Math.atan2(E.y-L.y,E.x-L.x),h=u.getPointAtLength(Math.max(0,A-x)),x){var S=k?2*x:x;k+=A-S+"px,"+A+"px"}}else k&&(k+=A+"px");k&&t.style("stroke-dasharray",k)}var C=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:v,opacity:m,"stroke-width":0})};y&&C(f,d),b&&C(h,p)}}},{"../color":207,"../drawing":231,"./arrow_paths":199,d3:55,"fast-isnumeric":61}],205:[function(t,e,r){"use strict";var n=t("../../plotly");r.moduleType="component",r.name="annotations",r.ARROWPATHS=t("./arrow_paths"),r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.calcAutorange=t("./calc_autorange"),r.arrowhead=t("./draw_arrow_head");var i=t("./draw");r.draw=i.draw,r.drawOne=i.drawOne,r.add=function(t){var e=t._fullLayout.annotations.length;n.relayout(t,"annotations["+e+"]","add")}},{"../../plotly":326,"./arrow_paths":199,"./attributes":200,"./calc_autorange":201,"./defaults":202,"./draw":203,"./draw_arrow_head":204}],206:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],207:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(C);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?L[0]:(C[e]+C[e-1])/2,e===C.length-1?L[1]:(C[e]+C[e+1])/2].map(J.c2p).map(Math.round);e!==C.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=I(t).replace("e-",""),o=i(a).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 h=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){n.select(this).attr("d","M"+Y+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+j).call(d.lineGroupStyle,_.line.width,R(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=Y+j+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));A("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:M.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,i=x();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(a,r||{}))}function k(){var r=j+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(z=ot.select("text"),z.node()&&!z.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-Y-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-$;at.select(".cbbg").attr({x:Y-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:Y,y:$+_.ypad+("top"===_.titleside?st:0),width:Math.max(j,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var M=t._fullLayout,T=M._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void M._infolayer.selectAll("g."+e).remove();var E,L=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],C=[],R="function"==typeof _.line.color?_.line.color:function(){return _.line.color},I="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},O=_.levels.end+_.levels.size/100,P=_.levels.size,N=1.001*L[0]-.001*L[1],D=1.001*L[1]-.001*L[0];for(E=_.levels.start;(E-O)*P<0;E+=P)E>N&&EL[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+V-X],J.setScale();var at=M._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+q)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+V-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,A(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ft=c.syncOrAsync([o.previousPromises,w,o.previousPromises,k],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var ht,dt,pt;u.init({element:at.node(),prepFn:function(){ht=at.attr("transform"),h(at)},moveFn:function(t,e){at.attr("transform",ht+" translate("+t+","+e+")"),dt=u.align(W+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,V,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);h(at,r)},doneFn:function(e){h(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},x().index)}})}return ft}function x(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":301,"./flip_scale":219,"./scales":226}],215:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":297,"./attributes":213,"./scales.js":226}],216:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":226}],217:[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,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,g=f?i.nestedProperty(e,d).get()||{}:e,v=p[h+"min"],m=p[h+"max"],y=p.colorscale,b=n(v)&&n(m)&&v=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],220:[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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):e}},{"./default_scale":216,"./is_valid_scale_array":224,"./scales":226}],221:[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(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],228:[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":301}],229:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,g=o.getPlotDiv(t.element)||{},v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":301,"../../plotly":326,"../../plots/cartesian/constants":336,"./align":227,"./cursor":228,"./unhover":230}],230:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":296}],231:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,f,h;t.so?(h=o.outlierwidth,f=o.outliercolor,c=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(h||1)+"px",fill:"none"}):(e.style("stroke-width",h+"px").call(l.fill,c),h&&e.call(l.stroke,f))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),f=(c*c*i-u*u*s)*n,h=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&f/d),2),a.round(e[1]+(d&&h/d),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&h/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var v=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=(r._input||{}).marker||{},s=g.tryColorscale(i,o,""),l=g.tryColorscale(i,o,"line.");n(t,e,r,s,l,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=(e._input||{}).marker||{},i=g.tryColorscale(r,n,""),o=g.tryColorscale(r,n,"line.");t.each(function(t){g.singlePointStyle(t,a.select(this),e,i,o)})}},g.tryColorscale=function(t,e,r){var n=c.nestedProperty(t,r+"color").get(),i=c.nestedProperty(t,r+"colorscale").get(),a=c.nestedProperty(t,r+"cauto").get(),s=c.nestedProperty(t,r+"cmin"),l=c.nestedProperty(t,r+"cmax"),f=s.get(),h=l.get();return i&&Array.isArray(n)?(!a&&o(f)&&o(h)||(f=1/0,h=-(1/0),n.forEach(function(t){o(t)&&(f>t&&(f=+t),hh&&(f=0,h=1),s.set(f),l.set(h),c.nestedProperty(e,r+"cmin").set(f),c.nestedProperty(e,r+"cmax").set(h)),u.makeColorScaleFunc(u.extractScale(i,f,h))):c.identity};var b={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(f.convertToTspans);var h=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*x+1,v=b[l]*c,m=.75*u+b[s]*c+(b[s]-1)*p*u/2;h.attr("transform","translate("+v+","+m+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=M&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":291,"../../lib":301,"../../lib/svg_text_utils":315,"../../registry":366,"../../traces/scatter/make_bubble_size_func":419,"../../traces/scatter/subtypes":424,"../color":207,"../colorscale":222,"./symbol_defs":232,d3:55,"fast-isnumeric":61}],232:[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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:55}],233:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],234:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),f=0;f0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);c&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;f="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");s=!v.size(),s?v=e.append("path").classed("yerror",!0):c&&(v=v.transition().duration(r.duration).ease(r.easing)),v.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var m=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-m)+"v"+2*m+"m0,-"+m+"H"+o.xs,o.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":424,d3:55,"fast-isnumeric":61}],239:[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":207,d3:55}],240:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":336}],241:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,o,r,n)}e=e||{},n("source"),n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var s=0;s<2;s++){var l={_fullLayout:r},u=["x","y"][s];i.coerceRef(t,e,l,u,"paper")}return e}var i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var r=t.images,i=e.images=[],a=0;a=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}},{}],245:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":297,"../../plots/font_attributes":351,"../color/attributes":206}],246:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],247:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(b!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",v),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":301,"../../plots/layout_attributes":357,"../../registry":366,"./attributes":245,"./helpers":250}],248:[function(t,e,r){"use strict";function n(t,e){function r(r){m.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?f.call(m.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=r.indexOf(f);h===-1?r.push(f):r.splice(h,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;r=s*h,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cn.width-(n.margin.r+n.margin.l)&&(b=0,v+=m,i.height=i.height+m,m=0),f.setTranslate(this,a+b,5+a+e.height/2+v),i.width+=o+r,i.height=Math.max(i.height,e.height),b+=o+r,m=Math.max(e.height,m)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),b=t("./get_legend_data"),x=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(g.setRect,B,t,y.scrollBarWidth,y.scrollBarHeight),M.select("rect").attr({y:m.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var m=r.legend,_=r.showlegend&&b(t.calcdata,m),A=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var k=r._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var M=r._topdefs.selectAll("#"+a).data([0]);M.enter().append("clipPath").attr("id",a).append("rect");var T=k.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var E=k.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=k.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=E.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var C=S.selectAll("g.traces").data(f.identity);C.enter().append("g").attr("class","traces"),C.exit().remove(),C.call(x).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?A.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var R=0!==k.enter().size();R&&(o(t,S,C),s(t));var I=0,O=r.width,P=0,N=r.height;o(t,S,C),m.height>N?l(t):s(t);var D=r._size,z=D.l+D.w*m.x,F=D.t+D.h*(1-m.y);w.isRightAnchor(m)?z-=m.width:w.isCenterAnchor(m)&&(z-=m.width/2),w.isBottomAnchor(m)?F-=m.height:w.isMiddleAnchor(m)&&(F-=m.height/2);var B=m.width,j=D.w;B>j?(z=D.l,B=j):(z+B>O&&(z=O-B),zH?(F=D.t,U=H):(F+U>N&&(F=N-U),Fr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":301,"../../registry":366,"../../traces/pie/style_one":398,"../../traces/scatter/subtypes":424,"../color":207,"../drawing":231,d3:55}],253:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(v,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",o.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":301,"../color":207,"./attributes":257,"./button_attributes":258,"./constants":259}],261:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../plots/cartesian/axes"),a=t("./constants"),o=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=e.shapes;if(r.length&&t._fullData.length)for(var o=0;oe;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},i=S.line.width?S.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",S.opacity).call(_.stroke,i).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);C&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+C),t._context.editable&&f(t,a,S,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={xref:s.xref,yref:s.yref},u={};"string"==typeof r&&r?u[r]=n:b.isPlainObject(r)&&(u=r);var c=Object.keys(u);for(a=0;aX&&n>Y&&!t.shiftKey?A.getCursor(i/r,1-a/n):"move";k(e,o),G=o.split("-")[0]}function a(e){B=x.getFromId(t,r.xref),j=x.getFromId(t,r.yref),U=T.getDataToPixel(t,B),H=T.getDataToPixel(t,j,!0),V=T.getPixelToData(t,B),q=T.getPixelToData(t,j,!0);var a="shapes["+n+"]";"path"===r.type?(z=r.path,F=a+".path"):(c=U(r.x0),f=H(r.y0),h=U(r.x1),d=H(r.y1),g=a+".x0",m=a+".y0",b=a+".x1",_=a+".y1"),cY&&(u[S]=r[O]=q(s),u[C]=r[P]=q(l)),f-c>X&&(u[R]=r[N]=V(c),u[I]=r[D]=V(f))}e.attr("d",p(t,r))}var u,c,f,h,d,g,m,b,_,w,M,E,L,S,C,R,I,O,P,N,D,z,F,B,j,U,H,V,q,G,X=10,Y=10,W={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=W.element.getBoundingClientRect();A.init(W)}function h(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):b.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=x.getFromId(t,r.id,"x")._id,i=x.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=x.getFromId(t,e.xref),l=x.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.dataToLinear(s),n=function(t){return s._offset+s.l2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.dataToLinear(l),a=function(t){return l._offset+l.l2p(i(t,!0)); -}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),f=n(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,v=(h+d)/2,m=Math.abs(p-c),y=Math.abs(v-h),b="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(M.segmentRE,function(t){var n=0,i=t.charAt(0),a=M.paramIsX[i],o=M.paramIsY[i],s=M.numParams[i],l=t.substr(1).replace(M.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),b.log("Ignoring extra params in segment "+t)),i+l})}function v(t,e,r){return t.replace(M.segmentRE,function(t){var n=0,i=t.charAt(0),a=M.paramIsX[i],o=M.paramIsY[i],s=M.numParams[i],l=t.substr(1).replace(M.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var m=t("fast-isnumeric"),y=t("../../plotly"),b=t("../../lib"),x=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),A=t("../dragelement"),k=t("../../lib/setcursor"),M=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),L=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":301,"../../lib/setcursor":311,"../../plotly":326,"../../plots/cartesian/axes":330,"../color":207,"../dragelement":229,"../drawing":231,"./constants":271,"./defaults":272,"./helpers":274,"./shape_defaults":276,"fast-isnumeric":61}],274:[function(t,e,r){"use strict";r.dataToLinear=function(t){return"category"===t.type?t.c2l:t.d2l},r.linearToData=function(t){return"category"===t.type?t.l2c:t.l2d},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.dataToLinear(e);i=function(t){return e._offset+e.l2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.linearToData(e);i=function(t){return o(e.p2l(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],275:[function(t,e,r){"use strict";r.moduleType="component",r.name="shapes",r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.calcAutorange=t("./calc_autorange");var n=t("./draw");r.draw=n.draw,r.drawOne=n.drawOne},{"./attributes":269,"./calc_autorange":270,"./defaults":272,"./draw":273}],276:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e){function r(e,r){return n.coerce(t,s,a,e,r)}var s={};r("layer"),r("opacity"),r("fillcolor"),r("line.color"),r("line.width"),r("line.dash");for(var l=t.path?"path":"rect",u=r("type",l),c=["x","y"],f=0;f<2;f++){var h=c[f],d={_fullLayout:e},p=i.coerceRef(t,s,d,h);if("path"!==u){var g=.25,v=.75;if("paper"!==p){var m=i.getFromId(d,p),y=o.linearToData(m);g=y(m.range[0]+g*(m.range[1]-m.range[0])),v=y(m.range[0]+v*(m.range[1]-m.range[0]))}r(h+"0",g),r(h+"1",v)}}return"path"===u?r("path"):n.noneOrAll(t,s,["x0","x1","y0","y1"]),s}},{"../../lib":301,"../../plots/cartesian/axes":330,"./attributes":269,"./helpers":274}],277:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":297,"../../plots/animation_attributes":327,"../../plots/font_attributes":351,"../../plots/pad_attributes":358,"./constants":278}],278:[function(t,e,r){"use strict";e.exports={name:"sliders",itemName:"slider",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],279:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,o,r,n)}var s=i(t,e),l=n("visible",s.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,u,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+S.railTouchRectClass).data([0]);n.enter().append("rect").classed(S.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,S.tickOffset+r.ticklen+r.labelHeight)}).call(M.fill,r.bgcolor).attr("opacity",0),k.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+S.railRectClass).data([0]);r.enter().append("rect").classed(S.railRectClass,!0);var n=e.inputAreaLength-2*S.railInset;r.attr({width:n,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(r,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+S.groupClassName).data(r,i);l.enter().append("g").classed(S.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,L=!0,S=R,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,k=g.titlefont.family,M=g.titlefont.size,T=g.titlefont.color,E=1,L=!1,S=g.title.trim();""===S&&(E=0),S.match(/Click to enter .+ title/)&&(E=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var R="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?a.restyle(t,v,e,m):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":301,"../../lib/svg_text_utils":315,"../../plotly":326,"../../plots/plots":359,"../color":207,"../drawing":231,d3:55,"fast-isnumeric":61}],283:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":297,"../../plots/font_attributes":351,"../../plots/pad_attributes":358,"../color/attributes":206}],284:[function(t,e,r){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],285:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,o,r,n)}var s=i(t,e),l=n("visible",s.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,u,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var f=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){b.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],291:[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}},{}],292:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.19.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":205,"./components/images":243,"./components/legend":251,"./components/rangeselector":263,"./components/rangeslider":268,"./components/shapes":275,"./components/sliders":281,"./components/updatemenus":287,"./fonts/mathjax_config":293,"./lib/queue":309,"./plot_api/plot_schema":320,"./plot_api/register":321,"./plot_api/set_plot_config":322,"./plot_api/to_image":324,"./plot_api/validate":325,"./plotly":326,"./snapshot":371,"./snapshot/download":368,"./traces/scatter":414,d3:55,"es6-promise":59}],293:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],294:[function(t,e,r){"use strict";function n(t){return t&&void 0!==t.valType}var i=t("fast-isnumeric"),a=t("tinycolor2"),o=t("./nested_property"),s=t("./is_plain_object"),l=t("./filter_unique"),u=t("../components/colorscale/get_scale"),c=(Object.keys(t("../components/colorscale/scales")), -/^([2-9]|[1-9][0-9]+)$/);r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,n){!i(t)||void 0!==n.min&&tn.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,n){t%1||!i(t)||void 0!==n.min&&tn.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(u(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):i(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&c.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!c.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a2)return!1;var o=a[0].split("-");if(o.length>3||3!==o.length&&a[1])return!1;if(4===o[0].length)e=Number(o[0]);else{if(2!==o[0].length)return!1;var l=(new Date).getFullYear();e=((Number(o[0])-l+70)%100+200)%100+l-70}return!!s(e)&&(1===o.length?new Date(e,0,1).getTime():(r=Number(o[1])-1,!(o[1].length>2)&&r>=0&&r<=11&&(2===o.length?new Date(e,r,1).getTime():(n=Number(o[2]),!(o[2].length>2)&&n>=1&&n<=31&&(n=new Date(e,r,n).getTime(),a[1]?(o=a[1].split(":"),!(o.length>3)&&(i=Number(o[0]),!(o[0].length>2)&&i>=0&&i<=23&&(n+=36e5*i,1===o.length?n:(r=Number(o[1]),!(o[1].length>2)&&r>=0&&r<=59&&(n+=6e4*r,2===o.length?n:(t=Number(o[2]),t>=0&&t<60&&n+1e3*t)))))):n)))))},r.isDateTime=function(t){return r.dateTime2ms(t)!==!1},r.ms2DateTime=function(t,e){e||(e=0);var r=new Date(t),i=o.time.format("%Y-%m-%d")(r);return e<7776e6?(i+=" "+n(r.getHours(),2),e<432e6&&(i+=":"+n(r.getMinutes(),2),e<108e5&&(i+=":"+n(r.getSeconds(),2),e<3e5&&(i+="."+n(r.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var l={H:["%H:%M:%S~%L","%H:%M:%S","%H:%M"],I:["%I:%M:%S~%L%p","%I:%M:%S%p","%I:%M%p"],D:["%H","%I%p","%Hh"]},u={Y:["%Y~%m~%d","%Y%m%d","%y%m%d","%m~%d~%Y","%d~%m~%Y"],Yb:["%b~%d~%Y","%d~%b~%Y","%Y~%d~%b","%Y~%b~%d"],y:["%m~%d~%y","%d~%m~%y","%y~%m~%d"],yb:["%b~%d~%y","%d~%b~%y","%y~%d~%b","%y~%b~%d"]},c=o.time.format.utc,f={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(c),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(c)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(c)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){u[t].forEach(function(e){f[t].D.push(c(e)),["H","I","D"].forEach(function(r){l[r].forEach(function(n){var i=f[t][r];i.push(c(e+"~"+n)),i.push(c(n+"~"+e))})})})});var h=/[a-z]*/g,d=function(t){return t.substr(0,3)},p=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,g=/[\s,\/\-\.\(\)]+/g,v=/~?([ap])~?m(~|$)/,m=function(t,e){return e+"m "},y=/\d\d\d\d/,b=/(^|~)[a-z]{3}/,x=/[ap]m/,_=/:/,w=/q([1-4])/,A=["31~mar","30~jun","30~sep","31~dec"],k=function(t,e){return A[e-1]},M=/ ?([+\-]\d\d:?\d\d|Z)$/;r.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(h,d).replace(p,"").replace(g,"~").replace(v,m).replace(w,k).trim().replace(M,"");var e,r,n=null,o=i(t),s=a(t);e=f[o][s],r=e.length;for(var l=0;l",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./coerce":294,"./dates":295,"./extend":297,"./filter_unique":298,"./is_array":302,"./is_plain_object":303,"./loggers":304,"./matrix":305,"./nested_property":306,"./notifier":307,"./search":310,"./stats":313,d3:55}],302:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],303:[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}},{}],304:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,h(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;uMath.max(c,g)||l>Math.max(f,v)))if(lc||Math.abs(n(o,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":305}],309:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;f90&&l.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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":61}],314:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:10,tinycolor2:182}],315:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,v.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings"); -f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":290,"../constants/xmlns_namespaces":291,"../lib":301,d3:55}],316:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0&&u.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);var i=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lR.range[0]?[1,2]:[2,1]);else{var I=R.range[0],O=R.range[1];"log"===x?(I<=0&&O<=0&&r(E+".autorange",!0),I<=0?I=O/1e6:O<=0&&(O=I/1e6),r(E+".range[0]",Math.log(I)/Math.LN10),r(E+".range[1]",Math.log(O)/Math.LN10)):(r(E+".range[0]",Math.pow(10,I)),r(E+".range[1]",Math.pow(10,O)))}else r(E+".autorange",!0)}if("reverse"===M)L.range?L.range.reverse():(r(E+".autorange",!0),L.range=[1,0]),S.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var P=m.parts[1],N=m.parts[0],D=a[N]||[],z=D[P]||{};null===x&&(e[v]="remove"),2===m.parts.length&&("add"===e[v]||b.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?P===-1?(g[N]=D,delete g[v]):g[v]=z:b.log("???",e)),!n(z,"x")&&!n(z,"y")||b.containsAny(v,["color","opacity","align","dash"])||(d.docalc=!0);var F=w.getComponentMethod(N,"drawOne");F(t,P,m.parts.slice(2).join("."),e[v]),delete e[v]}else A.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1]?(C.manageArrayContainers(m,x,g),d.doplot=!0):(0===m.parts[0].indexOf("scene")?d.doplot=!0:0===m.parts[0].indexOf("geo")?d.doplot=!0:0===m.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===v?d.doplot=!0:!o._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?d.docalc=!0:m.parts[0].indexOf("legend")!==-1?d.dolegend=!0:v.indexOf("title")!==-1?d.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&b.containsAny(m.parts[1],["tick","exponent","grid","zeroline"])?d.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:m.parts.length>1&&m.parts[1].indexOf("line")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&"mirror"===m.parts[1]?d.doticks=d.dolayoutstyle=!0:"margin.pad"===v?d.doticks=d.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(d.doplot=!0):d.doplot=!0,m.set(x))}}var B=t._fullLayout.width,j=t._fullLayout.height;A.supplyDefaults(t),t.layout.autosize&&A.plotAutoSize(t,t.layout,t._fullLayout);var U=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==j;return U&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:b.extendDeep({},p)}}function g(t){var e=v.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];v.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=b.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(L.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),b=t("../lib"),x=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),A=t("../plots/plots"),k=t("../plots/cartesian/graph_interact"),M=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),L=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),C=t("./helpers"),R=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=I._basePlotModules,r=0;r=o.length?o[0]:o[t]:o}function i(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}if(t=C.getGraphDiv(t),!b.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 animating it. For more details, see https://plot.ly/javascript/animations/");var a=t._transitionData;a._frameQueue||(a._frameQueue=[]),r=A.supplyAnimationDefaults(r);var o=r.transition,s=r.frame;return void 0===a._frameWaitingCnt&&(a._frameWaitingCnt=0),new Promise(function(s,l){function u(){if(0!==a._frameQueue.length){for(;a._frameQueue.length;){var e=a._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function c(e){if(0!==e.length){for(var o=0;oa._timeToNext&&h()};e()}function p(t){return Array.isArray(o)?m>=o.length?t.transitionOpts=o[m]:t.transitionOpts=o[0]:t.transitionOpts=o,m++,t}var g,v,m=0,y=[],x=void 0===e||null===e,_=Array.isArray(e),w=!x&&!_&&b.isPlainObject(e);if(w)y.push({type:"object",data:p(b.extendFlat({},e))});else if(x||"string"==typeof e)for(g=0;g0&&TT)&&E.push(v);y=E}}y.length>0?c(y):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,r){if(t=C.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!b.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:A.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),A.modifyFrames(t,a)},y.purge=function(t){t=C.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return A.cleanPlot([],{},r,e),A.purge(t),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":231,"../components/errorbars":237,"../constants/xmlns_namespaces":291,"../lib":301,"../lib/events":296,"../lib/queue":309,"../lib/svg_text_utils":315,"../plotly":326,"../plots/cartesian/graph_interact":338,"../plots/plots":359,"../plots/polar":362,"../registry":366,"./helpers":317,"./subroutines":323,d3:55,"fast-isnumeric":61}],319:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],320:[function(t,e,r){"use strict";function n(t){var e=y.attributes,r=u({type:t}),n=f(t),i=d(t),a={},o={};a.type=null,A(a,e),a=s(r.attributes,a,"attributes",t),void 0!==i.attributes&&A(a,i.attributes),a.type=t,a=c(a),l(a),E.traces[t]=w({},n,{attributes:a}),void 0!==r.layoutAttributes&&(o=s(r.layoutAttributes,o,"layoutAttributes",t),l(o),E.traces[t].layoutAttributes=o)}function i(){var t=y.layoutAttributes,e={};e=s(t,e,"layoutAttributes","*"),e=h(e),e=p(e),e=c(e),l(e),g(e),E.layout={layoutAttributes:e}}function a(t){var e=m.transformsRegistry[t],r={};r=s(r,e.attributes||{},"attributes","*"),r=c(r),l(r),g(r),E.transforms[t]={attributes:r}}function o(){E.defs={valObjects:b.valObjects,metaKeys:b.UNDERSCORE_ATTRS.concat(["description","role"])}}function s(t,e,r,n){var i,a,o,l,c;return Object.keys(t).forEach(function(f){return f===M?void Object.keys(t[f]).forEach(function(l){i=u({_module:t[f][l]}),void 0!==i&&(a=i[r],o=s(a,{},r,n),b.nestedProperty(e,l).set(A({},o)))}):f===T?void Object.keys(t[f]).forEach(function(i){i===n&&(l=u({_module:t[f][i]}),void 0!==l&&(c=l[r],c=s(c,{},r,n),k(e,c)))}):void(e[f]=b.isPlainObject(t[f])?k({},t[f]):t[f])}),e}function l(t){function e(t){return{valType:"string"}}function r(t,r,n){L.isValObject(t)?"data_array"===t.valType?(t.role="data",n[r+"src"]=e(r)):t.arrayOk===!0&&(n[r+"src"]=e(r)):b.isPlainObject(t)&&(t.role="object")}b.crawl(t,r)}function u(t){if("type"in t)return"area"===t.type?{attributes:x}:m.getModule({type:t.type});var e=m.subplotsRegistry,r=m.componentsRegistry,n=t._module;return e[n]?e[n]:r[n]?r[n]:v[n]}function c(t){return Object.keys(t).forEach(function(e){"_"===e.charAt(0)&&b.UNDERSCORE_ATTRS.indexOf(e)===-1&&delete t[e]}),t}function f(t){return"area"===t?{}:m.modules[t].meta||{}}function h(t){return w(t,{radialaxis:_.radialaxis,angularaxis:_.angularaxis}),w(t,_.layout),t}function d(t){if("area"===t)return{};var e=m.subplotsRegistry,r=Object.keys(e).filter(function(e){return m.traceIs({type:t},e)})[0];return void 0===r?{}:e[r]}function p(t){var e=m.subplotsRegistry;return Object.keys(t).forEach(function(r){Object.keys(e).forEach(function(n){var i,a=e[n];a.attrRegex&&(i="cartesian"===n||"gl2d"===n?a.attrRegex.x.test(r)||a.attrRegex.y.test(r):a.attrRegex.test(r),i&&(t[r][b.IS_SUBPLOT_OBJ]=!0))})}),t}function g(t){function e(t,e,r){if(t[b.IS_LINKED_TO_ARRAY]===!0){var n=e.substr(0,e.length-1);delete t[b.IS_LINKED_TO_ARRAY],r[e]={items:{}},r[e].items[n]=t,r[e].role="object"}}b.crawl(t,e)}var v=t("../plotly"),m=t("../registry"),y=t("../plots/plots"),b=t("../lib"),x=t("../plots/polar/area_attributes"),_=t("../plots/polar/axis_attributes"),w=b.extendFlat,A=b.extendDeep,k=b.extendDeepAll,M="_nestedModules",T="_composedModules",E={traces:{},layout:{},transforms:{},defs:{}},L=e.exports={};L.get=function(){return m.allTypes.concat("area").forEach(n),i(),Object.keys(m.transformsRegistry).forEach(a),o(),E},L.crawl=b.crawl,L.isValObject=b.isValObject},{"../lib":301,"../plotly":326,"../plots/plots":359,"../plots/polar/area_attributes":360,"../plots/polar/axis_attributes":361,"../registry":366}],321:[function(t,e,r){"use strict";function n(t){o.register(t,t.name,t.categories,t.meta),o.subplotsRegistry[t.basePlotModule.name]||o.registerSubplot(t.basePlotModule)}function i(t){if("string"!=typeof t.name)throw new Error("Transform module *name* must be a string.");var e="Transform module "+t.name,r="function"==typeof t.transform,n="function"==typeof t.calcTransform;if(!r&&!n)throw new Error(e+" is missing a *transform* or *calcTransform* method.");r&&n&&s.log([e+" has both a *transform* and *calcTransform* methods.","Please note that all *transform* methods are executed","before all *calcTransform* methods."].join(" ")),s.isPlainObject(t.attributes)||s.log(e+" registered without an *attributes* object."),"function"!=typeof t.supplyDefaults&&s.log(e+" registered without a *supplyDefaults* method."),o.transformsRegistry[t.name]=t}function a(t){o.componentsRegistry[t.name]=t}var o=t("../registry"),s=t("../lib");e.exports=function(t){if(!t)throw new Error("No argument passed to Plotly.register.");t&&!Array.isArray(t)&&(t=[t]);for(var e=0;e1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.td;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":301,"../plotly":326,"../snapshot/cloneplot":367,"../snapshot/helpers":370,"../snapshot/svgtoimg":372,"../snapshot/tosvg":374,"fast-isnumeric":61}],325:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;mu&&e=864e5?t._tickround="d":r>=36e5?t._tickround="H":r>=6e4?t._tickround="M":r>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(r/2)/Math.LN10);else{b(r)||(r=Number(r.substr(1))),t._tickround=2-Math.floor(Math.log(r)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var n=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(n)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((n-1)/3):t._tickexponent=n)}else"M"===r.charAt(0)?t._tickround=2===r.length?"m":"y":t._tickround=null}function o(t,e){var r=t.match(U),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(U,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a=e.x,s=t._tickround,l=new Date(a),u="";r&&t.hoverformat?i=o(t.hoverformat,a):t.tickformat?i=o(t.tickformat,a):(n&&(b(s)?s+=2:s={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[s]),"y"===s?i=N(l):"m"===s?i=D(l):(a!==t._tmin||r||(u="
"+N(l)),"d"===s?i=z(l):"H"===s?i=F(l):(a!==t._tmin||r||(u="
"+z(l)+", "+N(l)),i=B(l),"M"!==s&&(i+=j(l),"S"!==s&&(i+=h(m(a/1e3,1),t,"none",r).substr(1)))))),e.text=i+u}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&m(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,m(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"), -e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=H[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===i){var p=n-1,g=n+1;r="tozero"===t.rangemode?n<0?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var r=T.list(t,"",!0),n=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=v-1;a>5;a--)i(a)}},T.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[a,o]};T.autoTicks(f,s);var h,d=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*x||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),a(t),t._tmin=T.tickFirst(t);var i=t.range[1]=s:l<=s)&&(o.push(l),!(o.length>1e3));l=T.tickIncrement(l,t.dtick,i));t._tmax=o[o.length-1];for(var u=new Array(o.length),c=0;c157788e5?(e/=315576e5,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,S)):e>12096e5?(e/=26298e5,t.dtick="M"+i(e,1,C)):e>432e5?(t.dtick=i(e,864e5,I),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=i(e,36e5,C):e>3e4?t.dtick=i(e,6e4,R):e>500?t.dtick=i(e,1e3,R):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,S));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var n=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/n,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,S)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,S));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var a=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(a)}},T.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?P:O,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]n:u1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("./clean_datum");e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../lib":301,"./clean_datum":335,"fast-isnumeric":61}],332:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),f=[],h=0;h0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],335:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return i.ms2DateTime(t);if("string"!=typeof t&&!n(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){i.error(e,t)}return t}},{"../../lib":301,"fast-isnumeric":61}],336:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],337:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?f.ms2DateTime(n,i):"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),b=t("./constants"),x=!0;e.exports=function(t,e,r,s,_,w,A,k){function M(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+vt+", "+mt+")").attr("d",ct+"Z"),pt=gt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+vt+", "+mt+")").attr("d","M0,0Z"),S();for(var a=0;a.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),pt.transition().style("opacity",1).duration(200),ft=!0)}function R(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),x=!1)))}function O(e,r){var i=1===(A+k).length;if(e)F();else if(2!==r||i){if(1===r&&i){var a=A?V[0]:H[0],o="s"===A||"w"===k?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",f="middle";if(a.fixedrange)return;A?(f="n"===A?"top":"bottom","right"===a.side&&(c="right")):"e"===k&&(c="right"),nt.call(h.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r="category"===a.type?a.c2l(e):a.d2l(e);void 0!==r&&u.relayout(t,s,r)})}}else z()}function P(e){function r(t,e,r){if(!t.fixedrange){T(t.range);var n=t.range,i=n[0]+(n[1]-n[0])*e;t.range=[i+(n[0]-i)*r,i+(n[1]-i)*r]}}if(t._context.scrollZoom||j._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(E(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(bt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10), -!isFinite(i))return void f.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=_t.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=yt[0]+yt[2]*l,c=(s.bottom-e.clientY)/s.height,h=yt[1]+yt[3]*(1-c);if(k){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,r){for(var n=1-e,a=0,o=0;o0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nW.width||Y<0||Y>W.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:k[0]._length/2,Y="ypx"in e?e.ypx:M[0]._length/2;if(R="xval"in e?n(a,e.xval):i(k,X),I="yval"in e?n(a,e.yval):i(M,Y),!g(R[0])||!g(I[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(P=0;P1||D.hoverinfo.indexOf("name")!==-1?D.name:void 0,index:!1,distance:Math.min(Z,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[z]&&(H.subplot=o[z]._subplot),V=q.length,"array"===B){var Q=e[P];"pointNumber"in Q?(H.index=Q.pointNumber,B="closest"):(B="","xval"in Q&&(j=Q.xval,B="x"),"yval"in Q&&(U=Q.yval,B=B?"closest":"y"))}else j=R[F],U=I[F];if(D._module&&D._module.hoverPoints){var $=D._module.hoverPoints(H,j,U,B);if($)for(var K,J=0;J<$.length;J++)K=$[J],g(K.x0)&&g(K.y0)&&q.push(l(K,C))}else v.log("Unrecognized trace type in hover:",D);"closest"===C&&q.length>V&&(q.splice(0,V),Z=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var tt="y"===C&&G.length>1;q.sort(function(t,e){return t.distance-e.distance});var et=b.combine(o.plot_bgcolor||b.background,o.paper_bgcolor),rt={hovermode:C,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(q,rt);c(q,tt?"xa":"ya"),f(nt,tt);var it=t._hoverdata,at=[];for(O=0;O128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):M&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0;r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0),v=h.node().getBoundingClientRect().width+2*I):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,E=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),P=E.width+R+I+v;t.ty0=_-E.top,t.bx=E.width+2*I,t.by=E.height+2*I,t.anchor="start",t.txwidth=E.width,t.tx2width=v,t.offset=0,a?(t.pos=L,m=S+O/2+P<=k,A=S-O/2-P>=0,"top"!==t.idealAlign&&m||!A?m?(S+=O/2,t.anchor="start"):t.anchor="middle":(S-=O/2,t.anchor="end")):(t.pos=S,m=L+C/2+P<=w,A=L-C/2-P>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(a?"rotate("+T+")":""))}),S}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?L:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var v=f[o];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(R+I),s=o+a*(t.txwidth+I),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-C,l=t.offset*S),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*R+l)+","+(R+u)+"v"+(t.by/2-R)+"h"+n*t.bx+"v-"+t.by+"H"+(n*R+l)+"V"+(u-R)+"Z"),i.call(x.setPosition,o+l,u+t.ty0-t.by/2+I).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+a*I+l,u+t.ty0-t.by/2+I),r.select("rect").call(x.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),k=t("./dragbox"),M=e.exports={};M.unhover=_.unhover,M.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},M.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,M.layoutAttributes,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=M.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},M.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},M.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},M.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":301,"fast-isnumeric":61}],344:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,k=i.xaxes[0]._length,M=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,R,I,O,P,N=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),D=[],z=i.gd,F=[];for(C=0;C0)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*c*Math.abs(n-i))}return o.BADNUM}function r(t){return Math.pow(10,t)}function u(t){return i(t)?Number(t):o.BADNUM}var c=10;if(t.c2l="log"===t.type?e:u,t.l2c="log"===t.type?r:u,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(e){var r,n=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var o=l.getFromId(t._gd,t.overlaying);t.domain=o.domain}var s=e&&t._r?t._r:t.range;for(s&&2===s.length&&s[0]!==s[1]||(s=[-1,1]),r=0;r<2;r++)i(s[r])||(s[r]=i(s[1-r])?s[1-r]*(r?10:.1):r?1:-1),s[r]<-(Number.MAX_VALUE/2)?s[r]=-(Number.MAX_VALUE/2):s[r]>Number.MAX_VALUE/2&&(s[r]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s[0]-s[1]),t._b=-t._m*s[1]):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s[1]-s[0]),t._b=-t._m*s[0]),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):o.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},["linear","log","-"].indexOf(t.type)!==-1)t.c2d=u,t.d2c=function(t){return t=s(t),i(t)?Number(t):o.BADNUM},t.d2l=function(e,r){return"log"===t.type?t.c2l(t.d2c(e),r):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return i(t)?a.ms2DateTime(t):o.BADNUM},t.d2c=function(t){return i(t)?Number(t):a.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(a.dateTime2ms);!i(t.range[0])&&i(f[0])&&(t.range[0]=f[0]),!i(t.range[1])&&i(f[1])&&(t.range[1]=f[1])}catch(e){a.error(e,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?o.BADNUM:r},t.d2l=t.d2c);t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;ar.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,b=[],x=c(e),_=Object.keys(x),w=f(y,_,x);if(!w.length)return!1;var A;u&&(A=u());var k,M,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),k=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":301,"../../plotly":326,"../../registry":366,"./axes":330,d3:55}],350:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;ff[d+2]&&(f[d]=-1,f[d+2]=1),h=this[m[d]],h._length=o.viewBox[d+2]-o.viewBox[d],s.doAutoRange(h);o.ticks=this.computeTickMarks();var y=this.xaxis.range,b=this.yaxis.range;o.dataBox=[y[0],b[0],y[1],b[1]],o.merge(r),n.update(o),this.glplot.draw()},y.updateTraces=function(t,e){var r,n,i,a=Object.keys(this.traces);this.fullData=t;t:for(r=0;r=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"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(r._initialAutoSizeIsDone){var u=r.width,f=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=f)}else{p.supplyLayoutGlobalDefaults(a,n);var h=!a.width||!a.height,d=n.autosize,g=t._context&&t._context.autosizable,v=h&&(d||g);v?p.plotAutoSize(t,a,n):h&&p.sanitizeMargins(t),!d&&h&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,n),n._has=p._hasPlotType.bind(n);var m=n._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),f=c.left+c.right,d=c.bottom+c.top,g=1-2*o,v=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(v.width-f)),i=Math.round(g*(v.height-d))}else{var m=l?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,i=parseFloat(m.height)||r.height}var y=p.layoutAttributes.width.min,b=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-i)>1;(_||x)&&(x&&(r.width=n),_&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r){var n,i;c.Axes.supplyLayoutDefaults(t,e,r);var a=e._basePlotModules;for(n=0;n.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,f=r.size,h=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(f*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(f-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var v=l[t].t.val,m=l[t].t.size;if(v>h){var y=(d*v+(m-e.height)*h)/(v-h),b=(m*(1-h)+(d-e.height)*(1-v))/(v-h);y>=0&&b>=0&&y+b>s+o&&(s=y,o=b)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):t&&t.getTime?h.ms2DateTime(t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)},p.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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,S=L?f.angularAxis.domain:n.extent(k),C=Math.abs(k[1]-k[0]);T&&!M&&(C=0);var R=S.slice();E&&M&&(R[1]+=C);var I=f.angularAxis.ticksCount||4;I>8&&(I=I/(I/8)+I%8),f.angularAxis.ticksStep&&(I=(R[1]-R[0])/I);var O=f.angularAxis.ticksStep||(R[1]-R[0])/(I*(f.minorTicks+1));A&&(O=Math.max(Math.round(O),1)),R[2]||(R[2]=O);var P=n.range.apply(this,R);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(R.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?C:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var N="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",D=(new DOMParser).parseFromString(N,"application/xml"),z=this.appendChild(this.ownerDocument.importNode(D.documentElement,!0));e=n.select(z)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,B=e.select(".chart-group"),j={fill:"none",stroke:f.tickColor},U={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var H=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();b=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,b=Math.max(10,b),_=[f.margin.left+b,f.margin.top+b],i.range([0,b]),c.layout.radialAxis.domain=i.domain(),F.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),B.attr("transform","translate("+_+")").style({cursor:"crosshair"});var q=[(f.width-(f.margin.left+f.margin.right+2*b+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2];if(q[0]=Math.max(0,q[0]),q[1]=Math.max(0,q[1]),e.select(".outer-group").attr("transform","translate("+q+")"),f.title){var G=e.select("g.title-group text").style(U).text(f.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var Y=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(i.ticks(5));W.enter().append("circle").attr({class:"grid-circle"}).style(j),W.attr("r",i),W.exit().remove()}Y.select("circle.outside-circle").attr({r:b}).style(j);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=n.svg.axis().scale(i).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Y.selectAll(".domain").style(j),Y.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),K=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),K.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(j),K.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(U);var J=$.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+f.labelOffset,i=f.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:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":A?A[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(U);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(B.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[b+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!M){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});B.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;ot=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ct.text(o.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});B.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=i.invert(o.util.getMousePos(Z).radius);var n=o.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(o.util.round(st)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var i=n.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};M&&(u.t=A[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-q[0]-h.left,f.top+f.height/2-q[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.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")})})}),h}var e,r,i,s,l={data:[],layout:{}},u={},c={},f=n.dispatch("hover"),h={};return h.render=function(e){return t(e),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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return i},h.angularScale=function(t){return s},h.svg=function(){return e},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,i=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return i},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("undefined"==typeof 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 r===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=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 s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:h(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,i,a)},"stroke-width":function(t,e){return v["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,i,a)},opacity:function(t,e){return v.opacity(r,i,a)},display:function(t,e){return v.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var v={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},m=n.select(this).selectAll("g.layer").data(l);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],i=n.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=n.merge(i);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,f=c?r.height:u*o.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.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"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(o.length),v=n.scale[c?"linear":"ordinal"]().domain(g).range(l),m=n.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,m(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return v(e)}}),x.exit().remove()}var _=n.svg.axis().scale(m).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var n=t.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(f);var h=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[i.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=i.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};n.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../lib":301,d3:55}],364:[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,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(f=i),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(r),a.config(c).render(f),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,i,a,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},u.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":207,"../../lib":301,"./micropolar":363,"./undo_manager":365,d3:55}],365:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,u=t.layout,c=l([],a),f=l({},u,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(r=0;r1;if(p&&!h&&"category"!==a.type){e=e.map(a.d2c);var g=e.length;if(!(g<=i))return f?e.slice(0,i):e.slice(0,i+1);if(f||d)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;ly;n++)o=l(t,e,a(o));return o>y&&f.log("interp2d didn't converge quickly",o),t}function s(t){var e,r,n,i,a,o,s,l,u=[],c={},f=[],h=t[0],d=[],p=[0,0,0],g=m(t);for(r=0;r=0;a--)i=f[a],r=i[0],n=i[1],o=((c[[r-1,n]]||p)[2]+(c[[r+1,n]]||p)[2]+(c[[r,n-1]]||p)[2]+(c[[r,n+1]]||p)[2])/20,o&&(s[i]=[r,n,o],f.splice(a,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,a,o,s,l,u,c,f,h,d,p,g,v=0;for(o=0;op&&(v=Math.max(v,Math.abs(t[i][a]-d)/(g-p))))}return v}var u=t("fast-isnumeric"),c=t("../../registry"),f=t("../../lib"),h=t("../../plots/cartesian/axes"),d=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),v=t("./convert_column_xyz"),m=t("./max_row_length");e.exports=function(t,e){function r(t){L=e._input.zsmooth=e.zsmooth=!1,f.notifier("cannot fast-zsmooth: "+t)}var a,l,u,y,b,x,_,w,A=h.getFromId(t,e.xaxis||"x"),k=h.getFromId(t,e.yaxis||"y"),M=c.traceIs(e,"contour"),T=c.traceIs(e,"histogram"),E=c.traceIs(e,"gl2d"),L=M?"best":e.zsmooth;if(A._minDtick=0,k._minDtick=0,T){var S=d(t,e);a=S.x,l=S.x0,u=S.dx,y=S.y,b=S.y0,x=S.dy,_=S.z}else g(e)&&v(e,A,k),a=e.x?A.makeCalcdata(e,"x"):[],y=e.y?k.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,b=e.y0||0,x=e.dy||1,_=n(e),(M||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=o(_,e._emptypoints,e._interpz));if("fast"===L)if("log"===A.type||"log"===k.type)r("log axis found");else if(!T){if(a.length){var C=(a[a.length-1]-a[0])/(a.length-1),R=Math.abs(C/100);for(w=0;wR){r("x scale is not linear");break}}if(y.length&&"fast"===L){var I=(y[y.length-1]-y[0])/(y.length-1),O=Math.abs(I/100);for(w=0;wO){r("y scale is not linear");break}}}var P=m(_),N="scaled"===e.xtype?"":e.x,D=i(e,N,l,u,P,A),z="scaled"===e.ytype?"":e.y,F=i(e,z,b,x,_.length,k);E||(h.expand(A,D),h.expand(k,F));var B={x:D,y:F,z:_};if(p(e,_,"","z"),M&&e.contours&&"heatmap"===e.contours.coloring){var j="contour"===e.type?"heatmap":"histogram2d";B.xfill=i(j,N,l,u,P,A),B.yfill=i(j,z,b,x,_.length,k)}return[B]};var y=.01,b=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":214,"../../lib":301,"../../plots/cartesian/axes":330,"../../registry":366,"../histogram2d/calc":397,"./convert_column_xyz":386,"./has_columns":388,"./max_row_length":389,"fast-isnumeric":61}],385:[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="cb"+r.uid,u=r.zmin,c=r.zmax;if(n(u)||(u=i.aggNums(Math.min,null,r.z)),n(c)||(c=i.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void a.autoMargin(t,l);var f=e[0].t.cb=s(t,l),h=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});f.fillcolor(h).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":210,"../../components/colorscale":222,"../../lib":301,"../../plots/plots":359,"fast-isnumeric":61}],386:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a=t.x.slice(),o=t.y.slice(),s=t.z,l=t.text,u=Math.min(a.length,o.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(u0&&(n=!0);for(var s=0;sa)return r[t]=a,a-r[t]}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]m&&p.splice(m,p.length-m),v.length>m&&v.splice(m,v.length-m),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(p,d,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start-=e.xbins.size,e.xbins.end+=e.xbins.size),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(v,g,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start-=e.ybins.size,e.ybins.end+=e.ybins.size),e._input.ybins=e.ybins),f=[];var y,b,x=[],_=[],w="string"==typeof e.xbins.size?[]:e.xbins,A="string"==typeof e.xbins.size?[]:e.ybins,k=0,M=[],T=e.histnorm,E=e.histfunc,L=T.indexOf("density")!==-1,S="max"===E||"min"===E,C=S?null:0,R=a.count,I=o[T],O=!1,P=[],N=[],D="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";D&&"count"!==E&&(O="avg"===E,R=a[E]);var z=e.xbins,F=z.end+(z.start-i.tickIncrement(z.start,z.size))/1e6;for(h=z.start;h=0&&y=0&&b>>1,f)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);if(h)r=h;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var p=o(t.marker.color),g=o(t.marker.border.color),v=t.opacity*t.marker.opacity;p[3]*=v,this.pointcloudOptions.color=p;var m=t.marker.blend;if(null===m){var y=100;m=l.lengthp&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var m={type:"linear"};i.setConvert(m),l=m.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},g.ppad=v.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,i.expand(c,h,g),i.expand(f,d,v);var x=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],407:[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,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=i.aggNums(Math.min,null,c)),n(h)||(h=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":210,"../../components/colorscale":222,"../../lib":301,"../../plots/plots":359,"fast-isnumeric":61}],408:[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":214,"../../components/colorscale/has_colorscale":221,"./subtypes":424}],409:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],410:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var v=s(t,e,g),m=vU!=O>=U&&(C=L[T-1][0],R=L[T][0],S=C+(R-C)*(U-I)/(O-I),z=Math.min(z,S),F=Math.max(F,S));z=Math.max(z,0),F=Math.min(F,h._length);var H=l.defaultLine;return l.opacity(f.fillcolor)?H=f.fillcolor:l.opacity((f.line||{}).color)&&(H=f.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:z,x1:F,y0:U,y1:U,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":207,"../../components/errorbars":237,"../../lib":301,"../../plots/cartesian/constants":336,"../../plots/cartesian/graph_interact":338,"./get_trace_color":412}],414:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":339,"./arrays_to_calcdata":403,"./attributes":404,"./calc":405,"./clean_data":406,"./colorbar":407,"./defaults":410,"./hover":413,"./plot":421,"./select":422,"./style":423,"./subtypes":424}],415:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":217,"../../components/colorscale/has_colorscale":221}],416:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),n=A.c2p(t[e].y);return r!==S&&n!==S&&[r,n]}function i(t){var e=t[0]/w._length,r=t[1]/A._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w=e.xaxis,A=e.yaxis,k=e.simplify,M=e.connectGaps,T=e.baseTolerance,E=e.linear,L=[],S=n.BADNUM,C=.2,R=new Array(t.length),I=0;for(k||(T=C=-1),o=0;oi(f))break;l=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,u=f,d=!1):y=t.length||!f)break;R[I++]=f,s=f}}else R[I++]=u}L.push(R.slice(0,I))}return L}},{"../../plots/cartesian/axes":330}],417:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],418:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":61}],420:[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){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":207,"../../components/colorscale/defaults":217,"../../components/colorscale/has_colorscale":221, -"./subtypes":424}],421:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function i(t,e,r,n,i,d,g){function v(t){return k?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function b(t){if(t.ids)return y}function x(){return!1}function _(t){var e,r,n=t[0].trace,i=o.select(this),a=c.hasMarkers(n),u=c.hasText(n),f=b(n),h=x,d=x;a&&(h=n.marker.maxdisplayed?m:s.identity),u&&(d=n.marker.maxdisplayed?m:s.identity),r=i.selectAll("path.point"),e=r.data(h,f);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,n).call(l.translatePoints,M,T,n),k&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=v(o.select(this));l.translatePoint(t,e,M,T),l.singlePointStyle(t,e,n)}),k?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=i.selectAll("g"),e=r.data(d,f),e.enter().append("g").append("text"),e.each(function(t){var e=v(o.select(this).select("text"));l.translatePoint(t,e,M,T)}),e.selectAll("text").call(l.textPointStyle,n).each(function(t){var e=t.xp||M.c2p(t.x),r=t.yp||T.c2p(t.y);o.select(this).selectAll("tspan").each(function(){v(o.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,A;a(t,e,r,n,i);var k=!!g&&g.duration>0,M=r.xaxis,T=r.yaxis,E=n[0].trace,L=E.line,S=o.select(d);if(S.call(u.plot,r,g),E.visible===!0){var C,R,I=E.fill.charAt(E.fill.length-1);"x"!==I&&"y"!==I&&(I=""),n[0].node3=S,f(n);var O="",P=[],N=E._prevtrace;N&&(O=N._prevRevpath||"",R=N._nextFill,P=N._polygons);var D,z,F,B,j,U,H,V,q,G="",X="",Y=[],W=[],Z=s.noop;if(C=E._ownFill,c.hasLines(E)||"none"!==E.fill){for(R&&R.datum(n),["hv","vh","hvh","vhv"].indexOf(L.shape)!==-1?(F=l.steps(L.shape),B=l.steps(L.shape.split("").reverse().join(""))):F=B="spline"===L.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),L.smoothing):l.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},j=function(t){return B(t.reverse())},Y=h(n,{xaxis:M,yaxis:T,connectGaps:E.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),q=E._polygons=new Array(Y.length),A=0;A1}),Z=function(t){return function(e){if(D=F(e),z=j(e),G?I?(G+="L"+D.substr(1),X=z+("L"+X.substr(1))):(G+="Z"+D,X=z+"Z"+X):(G=D,X=z),c.hasLines(E)&&e.length>1){var r=o.select(this);if(r.datum(n),t)v(r.style("opacity",0).attr("d",D).call(l.lineGroupStyle)).style("opacity",1);else{var i=v(r);i.attr("d",D),l.singleLineStyle(n,i)}}}}}var Q=S.selectAll(".js-line").data(W);v(Q.exit()).style("opacity",0).remove(),Q.each(Z(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Z(!0)),Y.length&&(C?U&&V&&(I?("y"===I?U[1]=V[1]=T.c2p(0,!0):"x"===I&&(U[0]=V[0]=M.c2p(0,!0)),v(C).attr("d","M"+V+"L"+U+"L"+G.substr(1))):v(C).attr("d",G+"Z")):"tonext"===E.fill.substr(0,6)&&G&&O&&("tonext"===E.fill?v(R).attr("d",G+"Z"+O+"Z"):v(R).attr("d",G+"L"+O.substr(1)+"Z"),E._polygons=E._polygons.concat(P)),E._prevRevpath=X,E._prevPolygons=q);var $=S.selectAll(".points");w=$.data([n]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,s=r.yaxis,l=o.extent(a.range.map(a.l2c)),u=o.extent(s.range.map(s.l2c)),f=n[0].trace;if(c.hasMarkers(f)){var h=f.marker.maxdisplayed;if(0!==h){var d=n.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/h),g=0;i.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),f=c.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,r),n(t,p),l=0,u=[];ln?1:-1}),v){s&&(h=s());var m=o.transition().duration(a.duration).ease(a.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()});m.each(function(){p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)})})}else p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":231,"../../components/errorbars":237,"../../lib":301,"../../lib/polygon":308,"./arrays_to_calcdata":403,"./line_points":416,"./link_traces":418,"./subtypes":424,d3:55}],422:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,g=!n.hasMarkers(h)&&!n.hasText(h);if(h.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r=e.length?i:e[a]);return n}function o(t,e,r){return l(R(t,r),C(e,r),r)}function s(t,e,r,n){var i=w(t,e,n);return i=Array.isArray(i[0])?i:a(v.identity,[i],n),l(i,C(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;i>16&255,r[1]=n>>8&255,r[2]=255&n):f.test(t)&&(n=t.match(h),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3])),!e)for(var i=0;i<3;++i)r[i]=r[i]/255;return r}function u(t,e){var r,n;if("string"!=typeof t)return t;if(r=[],"#"===t[0]?(t=t.substr(1),3===t.length&&(t+=t),n=parseInt(t,16),r[0]=n>>16&255,r[1]=n>>8&255,r[2]=255&n):f.test(t)&&(n=t.match(h),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3]),n[4]?r[3]=parseFloat(n[4]):r[3]=1),!e)for(var i=0;i<3;++i)r[i]=r[i]/255;return r}var c={},f=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,.*)?\)$/,h=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,?\s*(.*)?\)$/;return c.isPlainObject=t,c.linspace=e,c.zip3=n,c.sum=i,c.zip=r,c.isEqual=s,c.copy2D=a,c.copy1D=o,c.str2RgbArray=l,c.str2RgbaArray=u,c};e.exports=n()},{}],11:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],12:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).add(e[0].mul(t[1])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":22}],13:[function(t,e,r){"use strict";function n(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}e.exports=n},{}],14:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]),t[1].mul(e[0]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":22}],15:[function(t,e,r){"use strict";function n(t,e){if(i(t))return e?u(t,n(e)):[t[0].clone(),t[1].clone()];var r,c,f=0;if(a(t))r=t.clone();else if("string"==typeof t)r=s(t);else{if(0===t)return[o(0),o(1)];if(t===Math.floor(t))r=o(t);else{for(;t!==Math.floor(t);)t*=Math.pow(2,256),f-=256;r=o(t)}}if(i(e))r.mul(e[1]),c=e[0].clone();else if(a(e))c=e.clone();else if("string"==typeof e)c=s(e);else if(e)if(e===Math.floor(e))c=o(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),f+=256;c=o(e)}else c=o(1);return f>0?r=r.shln(f):f<0&&(c=c.shln(-f)),l(r,c)}var i=t("./is-rat"),a=t("./lib/is-bn"),o=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),u=t("./div");e.exports=n},{"./div":14,"./is-rat":16,"./lib/is-bn":20,"./lib/num-to-bn":21,"./lib/rationalize":22,"./lib/str-to-bn":23}],16:[function(t,e,r){"use strict";function n(t){return Array.isArray(t)&&2===t.length&&i(t[0])&&i(t[1])}var i=t("./lib/is-bn");e.exports=n},{"./lib/is-bn":20}],17:[function(t,e,r){"use strict";function n(t){return t.cmp(new i(0))}var i=t("bn.js");e.exports=n},{"bn.js":30}],18:[function(t,e,r){"use strict";function n(t){var e=t.length,r=t.words,n=0;if(1===e)n=r[0];else if(2===e)n=r[0]+67108864*r[1];else for(var n=0,i=0;i20?52:r+32}var i=t("double-bits"),a=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":29,"double-bits":56}],20:[function(t,e,r){"use strict";function n(t){return t&&"object"==typeof t&&Boolean(t.words)}t("bn.js");e.exports=n},{"bn.js":30}],21:[function(t,e,r){"use strict";function n(t){var e=a.exponent(t);return e<52?new i(t):new i(t*Math.pow(2,52-e)).shln(e-52)}var i=t("bn.js"),a=t("double-bits");e.exports=n},{"bn.js":30,"double-bits":56}],22:[function(t,e,r){"use strict";function n(t,e){var r=a(t),n=a(e);if(0===r)return[i(0),i(1)];if(0===n)return[i(0),i(0)];n<0&&(t=t.neg(),e=e.neg());var o=t.gcd(e);return o.cmpn(1)?[t.div(o),e.div(o)]:[t,e]}var i=t("./num-to-bn"),a=t("./bn-sign");e.exports=n},{"./bn-sign":17,"./num-to-bn":21}],23:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":30}],24:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[0]),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":22}],25:[function(t,e,r){"use strict";function n(t){return i(t[0])*i(t[1])}var i=t("./lib/bn-sign");e.exports=n},{"./lib/bn-sign":17}],26:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":22}],27:[function(t,e,r){"use strict";function n(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var n=e.divmod(r),o=n.div,s=i(o),l=n.mod;if(0===l.cmpn(0))return s;if(s){var u=a(s)+4,c=i(l.shln(u).divRound(r));return s<0&&(c=-c),s+c*Math.pow(2,-u)}var f=r.bitLength()-l.bitLength()+53,c=i(l.shln(f).divRound(r));return f<1023?c*Math.pow(2,-f):(c*=Math.pow(2,-1023),c*Math.pow(2,1023-f))}var i=t("./lib/bn-to-num"),a=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":18,"./lib/ctz":19}],28:[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){var a=new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""));return a()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],29:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return t&=-t,t&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}var i=32;r.INT_BITS=i,r.INT_MAX=2147483647,r.INT_MIN=-1<0)-(t<0)},r.abs=function(t){var e=t>>i-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,e|t>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,t&=15,27030>>>t&1};var a=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|a[t>>>16&255]<<8|a[t>>>24&255]},r.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},r.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),t=65535&(t|t>>>16),t<<16>>16},r.interleave3=function(t,e,r){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t|r<<2},r.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),t=1023&(t|t>>>16),t<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],30:[function(t,e,r){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){return null!==t&&"object"==typeof t&&Array.isArray(t.words)?t:(this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==e&&"be"!==e||(r=e,e=10),void(null!==t&&this._init(t||0,e||10,r||"be")))}function a(t,e,r){for(var n=0,i=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function o(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}function s(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function l(){s.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function u(){s.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function c(){s.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function f(){s.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function h(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function d(t){h.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.sign=!0),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){t<0&&(this.sign=!0,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3){var s=t[i]|t[i-1]<<8|t[i-2]<<16;this.words[o]|=s<>>26-a&67108863,a+=24,a>=26&&(a-=26,o++)}else if("le"===n)for(var i=0,o=0;i>>26-a&67108863,a+=24,a>=26&&(a-=26,o++)}return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6){var o=a(t,r,r+6);this.words[i]|=o<>>26-n&4194303,n+=24,n>=26&&(n-=26,i++)}if(r+6!==e){var o=a(t,e,r+6);this.words[i]|=o<>>26-n&4194303}this.strip()},i.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,s=a%n,l=Math.min(a,a-s)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function(){return(this.red?""};var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],g=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],v=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){if(t=t||10,16===t||"hex"===t){for(var n="",i=0,e=0|e||1,a=0,o=0;o>>24-i&16777215,n=0!==a||o!==this.length-1?p[6-l.length]+l+n:l+n,i+=2,i>=26&&(i-=26,o--)}for(0!==a&&(n=a.toString(16)+n);n.length%e!==0;)n="0"+n;return this.sign&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=g[t],c=v[t],n="",f=this.clone();for(f.sign=!1;0!==f.cmpn(0);){var h=f.modn(c).toString(t);f=f.idivn(c),n=0!==f.cmpn(0)?p[u-h.length]+h+n:h+n}return 0===this.cmpn(0)&&(n="0"+n),this.sign&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toArray=function(t){this.strip();var e=new Array(this.byteLength());e[0]=0;var r=this.clone();if("le"!==t)for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[e.length-n-1]=i}else for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[n]=i}return e},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},i.prototype.bitLength=function(){var t=0,e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function(t){this.sign=this.sign&&t.sign;var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function(t){this.sign=this.sign||t.sign;var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);for(var n=t/26|0,i=t%26;this.length<=n;)this.words[this.length++]=0;return e?this.words[n]=this.words[n]|1<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)},i.prototype.isub=function(t){if(t.sign){t.sign=!1;var e=this.iadd(t);return t.sign=!0,e._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t);if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var 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>>26,a=67108863&r,o=Math.min(n,t.length-1),s=Math.max(0,n-this.length+1);s<=o;s++){var l=n-s,u=0|this.words[l],c=0|t.words[s],f=u*c,h=67108863&f;i=i+(f/67108864|0)|0,h=h+a|0,a=67108863&h,i=i+(h>>>26)|0}e.words[n]=a,r=i}return 0!==r?e.words[n]=r:e.length--, +e.strip()},i.prototype._bigMulTo=function(t,e){e.sign=t.sign!==this.sign,e.length=this.length+t.length;for(var r=0,n=0,i=0;i>>26)|0,n+=a>>>26,a&=67108863}e.words[i]=o,r=a,a=n}return 0!==r?e.words[i]=r:e.length--,e.strip()},i.prototype.mulTo=function(t,e){var r;return r=this.length+t.length<63?this._smallMulTo(t,e):this._bigMulTo(t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.imul=function(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var e=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var n=this.length-2;n>=0;n--){for(var i=0,a=0,o=Math.min(n,r-1),s=Math.max(0,n-e+1);s<=o;s++){var l=n-s,u=this.words[l],c=t.words[s],f=u*c,h=67108863&f;i+=f/67108864|0,h+=a,a=67108863&h,i+=h>>>26}this.words[n]=a,this.words[n+1]+=i,i=0}for(var i=0,l=1;l>>26}return this.strip()},i.prototype.imuln=function(t){r("number"==typeof t);for(var e=0,n=0;n>=26,e+=i/67108864|0,e+=a>>>26,this.words[n]=67108863&a}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.mul(this)},i.prototype.ishln=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=67108863>>>26-e<<26-e;if(0!==e){for(var a=0,o=0;o>>26-e}a&&(this.words[o]=a,this.length++)}if(0!==n){for(var o=this.length-1;o>=0;o--)this.words[o+n]=this.words[o];for(var o=0;o=0);var i;i=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o){this.length-=o;for(var u=0;u=0&&(0!==c||u>=i);u--){var f=this.words[u];this.words[u]=c<<26-a|f>>>a,c=f&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),t<0)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&l}for(;i>26,this.words[i+n]=67108863&l}if(0===s)return this.strip();r(s===-1),s=0;for(var i=0;i>26,this.words[i]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),a=t,o=a.words[a.length-1],s=this._countBits(o);r=26-s,0!==r&&(a=a.shln(r),n.ishln(r),o=a.words[a.length-1]);var l,u=n.length-a.length;if("mod"!==e){l=new i(null),l.length=u+1,l.words=new Array(l.length);for(var c=0;c=0;h--){var d=67108864*n.words[a.length+h]+n.words[a.length+h-1];for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(a,d,h);n.sign;)d--,n.sign=!1,n._ishlnsubmul(a,1,h),0!==n.cmpn(0)&&(n.sign=!n.sign);l&&(l.words[h]=d)}return l&&l.strip(),n.strip(),"div"!==e&&0!==r&&n.ishrn(r),{div:l?l:null,mod:n}},i.prototype.divmod=function(t,e){if(r(0!==t.cmpn(0)),this.sign&&!t.sign){var n,a,o=this.neg().divmod(t,e);return"mod"!==e&&(n=o.div.neg()),"div"!==e&&(a=0===o.mod.cmpn(0)?o.mod:t.sub(o.mod)),{div:n,mod:a}}if(!this.sign&&t.sign){var n,o=this.divmod(t.neg(),e);return"mod"!==e&&(n=o.div.neg()),{div:n,mod:o.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),e):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e)},i.prototype.div=function(t){return this.divmod(t,"div").div},i.prototype.mod=function(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(0===e.mod.cmpn(0))return e.div;var r=e.div.sign?e.mod.isub(t):e.mod,n=t.shrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:e.div.sign?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+this.words[i])%t;return n},i.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=this.words[n]+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var a=new i(1),o=new i(0),s=new i(0),l=new i(1),u=0;e.isEven()&&n.isEven();)e.ishrn(1),n.ishrn(1),++u;for(var c=n.clone(),f=e.clone();0!==e.cmpn(0);){for(;e.isEven();)e.ishrn(1),a.isEven()&&o.isEven()?(a.ishrn(1),o.ishrn(1)):(a.iadd(c).ishrn(1),o.isub(f).ishrn(1));for(;n.isEven();)n.ishrn(1),s.isEven()&&l.isEven()?(s.ishrn(1),l.ishrn(1)):(s.iadd(c).ishrn(1),l.isub(f).ishrn(1));e.cmp(n)>=0?(e.isub(n),a.isub(s),o.isub(l)):(n.isub(e),s.isub(a),l.isub(o))}return{a:s,b:l,gcd:n.ishln(u)}},i.prototype._invmp=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var a=new i(1),o=new i(0),s=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(;e.isEven();)e.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(s).ishrn(1);for(;n.isEven();)n.ishrn(1),o.isEven()?o.ishrn(1):o.iadd(s).ishrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(o)):(n.isub(e),o.isub(a))}return 0===e.cmpn(1)?a:o},i.prototype.gcd=function(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var e=this.clone(),r=t.clone();e.sign=!1,r.sign=!1;for(var n=0;e.isEven()&&r.isEven();n++)e.ishrn(1),r.ishrn(1);for(;;){for(;e.isEven();)e.ishrn(1);for(;r.isEven();)r.ishrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.ishln(n)},i.prototype.invm=function(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function(){return 0===(1&this.words[0])},i.prototype.isOdd=function(){return 1===(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.cmpn=function(t){var e=t<0;if(e&&(t=-t),this.sign&&!e)return-1;if(!this.sign&&e)return 1;t&=67108863,this.strip();var r;if(this.length>1)r=1;else{var n=this.words[0];r=n===t?0:nt.length)return 1;if(this.length=0;r--){var n=this.words[r],i=t.words[r];if(n!==i){ni&&(e=1);break}}return e},i.red=function(t){return new h(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};s.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},s.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength();while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},s.prototype.split=function(t,e){t.ishrn(this.n,0,e)},s.prototype.imulK=function(t){return t.imul(this.k)},n(l,s),l.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,a=o}t.words[i-10]=a>>>22,t.length-=9},l.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e,r=0,n=0;n>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function t(e){if(m[e])return m[e];var t;if("k256"===e)t=new l;else if("p224"===e)t=new u;else if("p192"===e)t=new c;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new f}return m[e]=t,t},h.prototype._verify1=function(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},h.prototype._verify2=function(t,e){r(!t.sign&&!e.sign,"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},h.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},h.prototype.neg=function(t){var e=t.clone();return e.sign=!e.sign,e.iadd(this.m)._forceRed(this)},h.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)},h.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},h.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)},h.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},h.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.shln(e))},h.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},h.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},h.prototype.isqr=function(t){return this.imul(t,t)},h.prototype.sqr=function(t){return this.mul(t,t)},h.prototype.sqrt=function(t){if(0===t.cmpn(0))return t.clone();var e=this.m.andln(3);if(r(e%2===1),3===e){var n=this.m.add(new i(1)).ishrn(2),a=this.pow(t,n);return a}for(var o=this.m.subn(1),s=0;0!==o.cmpn(0)&&0===o.andln(1);)s++,o.ishrn(1);r(0!==o.cmpn(0));var l=new i(1).toRed(this),u=l.redNeg(),c=this.m.subn(1).ishrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,o),a=this.pow(t,o.addn(1).ishrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(l);){for(var g=d,v=0;0!==g.cmp(l);v++)g=g.redSqr();r(v=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},d.prototype.mul=function(t,e){if(0===t.cmpn(0)||0===e.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).ishrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},d.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}}("undefined"==typeof e||e,this)},{}],31:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r>>1;if(!(s<=0)){var l,u=f.mallocDouble(2*s*a),c=f.mallocInt32(a);if(a=i(t,s,u,c),a>0){if(1===s&&n)h.init(a),l=h.sweepComplete(s,r,0,a,u,c,0,a,u,c);else{var p=f.mallocDouble(2*s*o),g=f.mallocInt32(o);o=i(e,s,p,g),o>0&&(h.init(a+o),l=1===s?h.sweepBipartite(s,r,0,a,u,c,0,o,p,g):d(s,r,n,a,u,c,o,p,g),f.free(p),f.free(g))}f.free(u),f.free(c)}return l}}}function o(t,e){c.push([t,e])}function s(t){return c=[],a(t,t,o,!0),c}function l(t,e){return c=[],a(t,e,o,!1),c}function u(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?a(t,t,e,!0):l(t,e);case 3:return a(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}}e.exports=u;var c,f=t("typedarray-pool"),h=t("./lib/sweep"),d=t("./lib/intersect")},{"./lib/intersect":33,"./lib/sweep":37,"typedarray-pool":187}],32:[function(t,e,r){"use strict";function n(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),i=["function ",n,"(",w.join(),"){","var ",u,"=2*",a,";"],l="for(var i="+c+","+p+"="+u+"*"+c+";i<"+f+";++i,"+p+"+="+u+"){var x0="+h+"["+o+"+"+p+"],x1="+h+"["+o+"+"+p+"+"+a+"],xi="+d+"[i];",A="for(var j="+g+","+b+"="+u+"*"+g+";j<"+v+";++j,"+b+"+="+u+"){var y0="+m+"["+o+"+"+b+"],"+(r?"y1="+m+"["+o+"+"+b+"+"+a+"],":"")+"yi="+y+"[j];";return t?i.push(l,_,":",A):i.push(A,_,":",l),r?i.push("if(y1"+v+"-"+g+"){"),t?(e(!0,!1),o.push("}else{"),e(!1,!1)):(o.push("if("+l+"){"),e(!0,!0),o.push("}else{"),e(!0,!1),o.push("}}else{if("+l+"){"),e(!1,!0),o.push("}else{"),e(!1,!1),o.push("}")),o.push("}}return "+r);var s=i.join("")+o.join(""),u=new Function(s);return u()}var a="d",o="ax",s="vv",l="fp",u="es",c="rs",f="re",h="rb",d="ri",p="rp",g="bs",v="be",m="bb",y="bi",b="bp",x="rv",_="Q",w=[a,o,s,c,f,h,d,g,v,m,y];r.partial=i(!1),r.full=i(!0)},{}],33:[function(t,e,r){"use strict";function n(t,e){var r=8*u.log2(e+1)*(t+1)|0,n=u.nextPow2(M*r);L.length0;){R-=1;var I=R*M,P=L[I],N=L[I+1],D=L[I+2],z=L[I+3],F=L[I+4],B=L[I+5],j=R*T,U=S[j],H=S[j+1],V=1&B,q=!!(16&B),G=l,X=u,Y=g,W=E;if(V&&(G=g,X=E,Y=l,W=u),!(2&B&&(D=_(t,P,N,D,G,X,H),N>=D)||4&B&&(N=w(t,P,N,D,G,X,U),N>=D))){var Z=D-N,Q=F-z;if(q){if(t*Z*(Z+Q)=p0)&&!(p1>=hi)",["p0","p1"]),x=g("lo===p0",["p0"]),_=g("lor&&i[f+e]>u;--c,f-=o){for(var h=f,d=f+o,p=0;p>>1,h=2*t,d=f,p=a[h*f+e];u=b?(d=y,p=b):m>=_?(d=v,p=m):(d=x,p=_):b>=_?(d=y,p=b):_>=m?(d=v,p=m):(d=x,p=_);for(var w=h*(c-1),A=h*d,k=0;k=0&&n.push("lo=e[k+n]"),t.indexOf("hi")>=0&&n.push("hi=e[k+o]"),r.push(i.replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}e.exports=n;var i="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],36:[function(t,e,r){"use strict";function n(t,e){e<=4*h?i(0,e-1,t):f(0,e-1,t)}function i(t,e,r){for(var n=2*(t+1),i=t+1;i<=e;++i){for(var a=r[n++],o=r[n++],s=i,l=n-2;s-- >t;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function c(t,e,r,n){t*=2;var i=n[t];return i>1,v=g-n,m=g+n,y=d,b=v,x=g,_=m,w=p,A=t+1,k=e-1,M=0;u(y,b,r)&&(M=y,y=b,b=M),u(_,w,r)&&(M=_,_=w,w=M),u(y,x,r)&&(M=y,y=x,x=M),u(b,x,r)&&(M=b,b=x,x=M),u(y,_,r)&&(M=y,y=_,_=M),u(x,_,r)&&(M=x,x=_,_=M),u(b,w,r)&&(M=b,b=w,w=M),u(b,x,r)&&(M=b,b=x,x=M),u(_,w,r)&&(M=_,_=w,w=M);for(var T=r[2*b],E=r[2*b+1],L=r[2*_],S=r[2*_+1],C=2*y,R=2*x,O=2*w,I=2*d,P=2*g,N=2*p,D=0;D<2;++D){var z=r[C+D],F=r[R+D],B=r[O+D];r[I+D]=z,r[P+D]=F,r[N+D]=B}o(v,t,r),o(m,e,r);for(var j=A;j<=k;++j)if(c(j,T,E,r))j!==A&&a(j,A,r),++A;else if(!c(j,L,S,r))for(;;){if(c(k,L,S,r)){c(k,T,E,r)?(s(j,A,k,r),++A,--k):(a(j,k,r),--k);break}if(--k>>1;h(_,E);for(var L=0,S=0,A=0;A=d)C=C-d|0,i(m,y,S--,C);else if(C>=0)i(g,v,L--,C);else if(C<=-d){C=-C-d|0;for(var R=0;R>>1;h(_,L);for(var S=0,C=0,R=0,k=0;k>1===_[2*k+3]>>1&&(I=2,k+=1),O<0){for(var P=-(O>>1)-1,N=0;N>1)-1;0===I?i(g,v,S--,P):1===I?i(m,y,C--,P):2===I&&i(b,x,R--,P)}}}function l(t,e,r,n,o,s,l,u,c,f,p,m){var y=0,b=2*t,x=e,w=e+t,A=1,k=1;n?k=d:A=d;for(var M=o;M>>1;h(_,S);for(var C=0,M=0;M=d?(O=!n,T-=d):(O=!!n,T-=1),O)a(g,v,C++,T);else{var I=m[T],P=b*T,N=p[P+e+1],D=p[P+e+1+t];t:for(var z=0;z>>1;h(_,A);for(var k=0,y=0;y=d)g[k++]=b-d;else{b-=1;var T=c[b],E=p*b,L=u[E+e+1],S=u[E+e+1+t];t:for(var C=0;C=0;--C)if(g[C]===b){for(var P=C+1;P=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function v(t){return+t!=t&&(t=0),o.alloc(+t)}function m(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))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 G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(n)return G(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return""; +for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return O(this,e,r);case"base64":return L(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function x(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),r=+r,isNaN(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=o.from(e,n)),o.isBuffer(e))return 0===e.length?-1:_(t,e,r,n,i);if("number"==typeof e)return e&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function _(t,e,r,n,i){function a(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,s=t.length,l=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"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}var u;if(i){var c=-1;for(u=r;us&&(r=s-l),u=r;u>=0;u--){for(var f=!0,h=0;hi&&(n=i)):n=i;var a=e.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o239?4:a>223?3:a>191?2:1;if(i+s<=r){var l,u,c,f;switch(s){case 1:a<128&&(o=a);break;case 2:l=t[i+1],128===(192&l)&&(f=(31&a)<<6|63&l,f>127&&(o=f));break;case 3:l=t[i+1],u=t[i+2],128===(192&l)&&128===(192&u)&&(f=(15&a)<<12|(63&l)<<6|63&u,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:l=t[i+1],u=t[i+2],c=t[i+3],128===(192&l)&&128===(192&u)&&128===(192&c)&&(f=(15&a)<<18|(63&l)<<12|(63&u)<<6|63&c,f>65535&&f<1114112&&(o=f))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return C(n)}function C(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,r,n,i,a){if(!o.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 z(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,a=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function F(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,a=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function B(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 j(t,e,r,n,i){return i||B(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,i){return i||B(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(t,e,r,n,52,8),r+8}function H(t){if(t=V(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function V(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function q(t){return t<16?"0"+t.toString(16):t.toString(16)}function G(t,e){e=e||1/0;for(var r,n=t.length,i=null,a=[],o=0;o55295&&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=(i-55296<<10|r-56320)+65536}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 X(t){for(var e=[],r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function W(t){return $.toByteArray(H(t))}function Z(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Q(t){return t!==t}var $=t("base64-js"),K=t("ieee754"),J=t("isarray");r.Buffer=o,r.SlowBuffer=v,r.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),r.kMaxLength=i(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,r){return s(null,t,e,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,r){return u(null,t,e,r)},o.allocUnsafe=function(t){return c(null,t)},o.allocUnsafeSlow=function(t){return c(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},o.prototype.compare=function(t,e,r,n,i){if(!o.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,s=r-e,l=Math.min(a,s),u=this.slice(n,i),c=t.slice(e,r),f=0;fi)&&(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 w(this,t,e,r);case"utf8":case"utf-8":return A(this,t,e,r);case"ascii":return k(this,t,e,r);case"latin1":case"binary":return M(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length);for(var n=this[t],i=1,a=0;++a=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a},o.prototype.readInt8=function(t,e){return e||N(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},o.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),K.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),K.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),K.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),K.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){var i=Math.pow(2,8*r)-1;D(this,t,e,r,i,0)}var a=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+a]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):z(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):z(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):F(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);D(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},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);D(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},o.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):z(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):z(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):F(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var a;if("number"==typeof t)for(a=e;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function a(t){var e,r,i,a,o,s,l=t.length;o=n(t),s=new f(3*l/4-o),i=o>0?l-4:l;var u=0;for(e=0,r=0;e>16&255,s[u++]=a>>8&255,s[u++]=255&a;return 2===o?(a=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,s[u++]=255&a):1===o&&(a=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,s[u++]=a>>8&255,s[u++]=255&a),s}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var n,i=[],a=e;ac?c:l+o));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),a.push(i),a.join("")}r.byteLength=i,r.toByteArray=a,r.fromByteArray=l;for(var u=[],c=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;d0;){for(var c=r.pop(),s=r.pop(),f=-1,h=-1,l=o[s],p=1;p=0||(e.flip(s,c),n(t,e,r,f,s,h),n(t,e,r,s,h,f),n(t,e,r,h,c,f),n(t,e,r,c,f,h))}}var a=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=i},{"binary-search-bounds":46,"robust-in-sphere":164}],43:[function(t,e,r){"use strict";function n(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 i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function a(t,e){for(var r=t.cells(),a=r.length,o=0;o0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-i){u[d]=i;for(var p=(c[d],0);p<3;++p){var g=h[3*d+p];g>=0&&0===u[g]&&(f[3*d+p]?l.push(g):(s.push(g),u[g]=i))}}}var v=l;l=s,s=v,l.length=0,i=-i}var m=o(c,u,e);return r?m.concat(n.boundary):m}var l=t("binary-search-bounds");e.exports=s;var u=n.prototype;u.locate=function(){var t=[0,0,0];return function(e,r,n){var a=e,o=r,s=n;return r1&&d(r[c[f-2]],r[c[f-1]],n)>0;)t.push([c[f-1],c[f-2],i]),f-=1;c.length=f,c.push(i);for(var p=u.upperIds,f=p.length;f>1&&d(r[p[f-2]],r[p[f-1]],n)<0;)t.push([p[f-2],p[f-1],i]),f-=1;p.length=f,p.push(i)}}function l(t,e){var r;return(r=t.a[0]m[0]&&l.push(new i(m,d,v,f),new i(d,m,g,f))}l.sort(a);for(var y=l[0].a[0]-(1+Math.abs(l[0].a[0]))*Math.pow(2,-52),b=[new n([y,1],[y,0],-1,[],[],[],[])],x=[],f=0,_=l.length;f<_;++f){var w=l[f],A=w.type;A===p?s(x,b,t,w.a,w.idx):A===v?u(b,t,w):c(b,t,w)}return x}var h=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,g=1,v=2;e.exports=f},{"binary-search-bounds":46,"robust-orientation":165}],45:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function i(t,e,r){for(var n=1,i=t.length;n=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;i(n[t],e,r),i(n[e],r,t),i(n[r],t,e)},s.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},s.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;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){var a=new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""));return a()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],47:[function(t,e,r){"use strict";function n(t){var e=x(t),r=b(y(e),t);return r<0?[e,w(e,1/0)]:r>0?[w(e,-(1/0)),e]:[e,e]}function i(t,e){for(var r=new Array(e.length),n=0;n=t.length)return o[e-t.length];var r=t[e];return[y(r[0]),y(r[1])]}for(var o=[],s=0;s=0;--s){var g=n[s],u=g[0],v=e[u],m=v[0],x=v[1],w=t[m],k=t[x];if((w[0]-k[0]||w[1]-k[1])<0){var M=m;m=x,x=M}v[0]=m;var T,E=v[1]=g[1];for(i&&(T=v[2]);s>0&&n[s-1][0]===u;){var g=n[--s],L=g[1];i?e.push([E,L,T]):e.push([E,L]),E=L}i?e.push([E,x,T]):e.push([E,x])}return o}function u(t,e,r){for(var i=t.length+e.length,a=new g(i),o=r,s=0;se[2]?1:0}function h(t,e,r){if(0!==t.length){if(e)for(var n=0;n0||d.length>0)}function p(t,e,r){var n,i=!1;if(r){n=e;for(var a=new Array(e.length),o=0;o=0}function i(t,e,r,i){var s=a(e,r,i);if(0===s){var l=o(a(t,e,r)),u=o(a(t,e,i));if(l===u){if(0===l){var c=n(t,e,r),f=n(t,e,i);return c===f?0:c?1:-1}return 0}return 0===u?l>0?-1:n(t,e,i)?-1:1:0===l?u>0?1:n(t,e,r)?1:-1:o(u-l)}var h=a(t,e,r);if(h>0)return s>0&&a(t,e,i)>0?1:-1;if(h<0)return s>0||a(t,e,i)>0?1:-1;var d=a(t,e,i);return d>0?1:n(t,e,r)?1:-1}e.exports=i;var a=t("robust-orientation"),o=t("signum"),s=t("two-sum"),l=t("robust-product"),u=t("robust-sum")},{"robust-orientation":165,"robust-product":166,"robust-sum":170,signum:171,"two-sum":186}],50:[function(t,e,r){function n(t,e){return t-e}function i(t,e){var r=t.length,i=t.length-e.length;if(i)return i;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||a(t[0],t[1])-a(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];if(i=o+t[2]-(s+e[2]))return i;var l=a(t[0],t[1]),u=a(e[0],e[1]);return a(l,t[2])-a(u,e[2])||a(l+t[2],o)-a(u+e[2],s);case 4:var c=t[0],f=t[1],h=t[2],d=t[3],p=e[0],g=e[1],v=e[2],m=e[3];return c+f+h+d-(p+g+v+m)||a(c,f,h,d)-a(p,g,v,m,p)||a(c+f,c+h,c+d,f+h,f+d,h+d)-a(p+g,p+v,p+m,g+v,g+m,v+m)||a(c+f+h,c+f+d,c+h+d,f+h+d)-a(p+g+v,p+g+m,p+v+m,g+v+m);default:for(var y=t.slice().sort(n),b=e.slice().sort(n),x=0;x0)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"===o)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===o){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"===o){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,a(e)}var a=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":53}],52:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,f=0;for(n=0;n=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",f,"]-=s",f].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r,i){for(var a=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],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("")),l&&u.push(["index[",e[c],"]=j",c].join(""));for(var c=0;c0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}function l(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,l=new Array(t.arrayArgs.length),c=new Array(t.arrayArgs.length),f=0;f0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),f=0;f3&&x.push(o(t.pre,t,c));var T=o(t.body,t,c),E=a(v);E3&&x.push(o(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var L=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(c)].join(""),S=new Function(["function ",L,"(",b.join(","),"){",x.join("\n"),"} return ",L].join(""));return S()}var u=t("uniq");e.exports=l},{uniq:189}],53:[function(t,e,r){"use strict";function n(t){var e=["'use strict'","var CACHED={}"],r=[],n=t.funcName+"_cwise_thunk";e.push(["return function ",n,"(",t.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],u=[],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])+"]"))}t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+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}function a(t){return null===t?NaN:+t}function o(t){return!isNaN(t)}function s(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);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}}}function l(t){return t.length}function u(t){for(var e=1;t*e%1;)e*=10;return e}function c(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function f(){this._=Object.create(null)}function h(t){return(t+="")===_o||t[0]===wo?wo+t:t}function d(t){return(t+="")[0]===wo?t.slice(1):t}function p(t){return h(t)in this._}function g(t){return(t=h(t))in this._&&delete this._[t]}function v(){var t=[];for(var e in this._)t.push(d(e));return t}function m(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function b(){this._=Object.create(null)}function x(t){return t}function _(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=Ao.length;r=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Io.get(t);return u&&(t=u,l=Q),s?e?i:n:e?A:a}function Z(t,e){return function(r){var n=uo.event;uo.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.event=n}}}function Q(t,e){var r=Z(t,e);return function(t){var e=this,n=t.relatedTarget;n&&(n===e||8&n.compareDocumentPosition(e))||r.call(e,t)}}function $(t){var r=".dragsuppress-"+ ++No,i="click"+r,a=uo.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Po&&(Po=!("onselectstart"in t)&&w(t.style,"userSelect")),Po){var o=e(t).style,s=o[Po];o[Po]="none"}return function(t){if(a.on(r,null),Po&&(o[Po]=s),t){var e=function(){a.on(i,null)};a.on(i,function(){T(),e()},!0),setTimeout(e,0)}}}function K(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(Do<0){var a=n(t);if(a.scrollX||a.scrollY){r=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();Do=!(o.f||o.e),r.remove()}}return Do?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function J(){return uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function rt(t){return t>1?0:t<-1?Bo:Math.acos(t)}function nt(t){return t>1?Ho:t<-1?-Ho:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function at(t){return((t=Math.exp(t))+1/t)/2}function ot(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ut(t,e,r){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):At(""+t,kt,ut):new ut(t,e,r)}function ct(t,e,r){function n(t){return t>360?t-=360:t<0&&(t+=360),t<60?a+(o-a)*t/60:t<180?o:t<240?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*n(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,o=r<=.5?r*(1+e):r+e-r*e,a=2*r-o,new bt(i(t+120),i(t),i(t-120))}function ft(t,e,r){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof dt?gt(t.l,t.a,t.b):gt((t=Mt((t=uo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,r)}function ht(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(r,Math.cos(t*=Vo)*e,Math.sin(t)*e)}function dt(t,e,r){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof ft?ht(t.h,t.c,t.l):Mt((t=bt(t)).r,t.g,t.b):new dt(t,e,r)}function pt(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return i=vt(i)*ts,n=vt(n)*es,a=vt(a)*rs,new bt(yt(3.2404542*i-1.5371385*n-.4985314*a),yt(-.969266*i+1.8760108*n+.041556*a),yt(.0556434*i-.2040259*n+1.0572252*a))}function gt(t,e,r){return t>0?new ft(Math.atan2(r,e)*qo,Math.sqrt(e*e+r*r),t):new ft(NaN,NaN,t)}function vt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function mt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function bt(t,e,r){return this instanceof bt?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof bt?new bt(t.r,t.g,t.b):At(""+t,bt,ct):new bt(t,e,r)}function xt(t){return new bt(t>>16,t>>8&255,255&t)}function _t(t){return xt(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function At(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(Et(i[0]),Et(i[1]),Et(i[2]))}return(a=as.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 kt(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 Mt(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=mt((.4124564*t+.3575761*e+.1804375*r)/ts),i=mt((.2126729*t+.7151522*e+.072175*r)/es),a=mt((.0193339*t+.119192*e+.9503041*r)/rs);return dt(116*i-16,500*(n-i),200*(i-a))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Et(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Lt(t){return"function"==typeof t?t:function(){return t}}function St(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),Ct(e,r,t,n)}}function Ct(t,e,r,n){function i(){var t,e=l.status;if(!e&&Ot(l)||e>=200&&e<300||304===e){try{t=r.call(a,l)}catch(t){return void o.error.call(a,t)}o.load.call(a,t)}else o.error.call(a,l)}var a={},o=uo.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=uo.event;uo.event=t;try{o.progress.call(a,l)}finally{uo.event=e}},a.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",a)},a.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",a):e},a.responseType=function(t){return arguments.length?(u=t,a):u},a.response=function(t){return r=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(fo(arguments)))}}),a.send=function(r,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),l.open(r,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=u&&(l.responseType=u),null!=i&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==n?null:n),a},a.abort=function(){return l.abort(),a},uo.rebind(a,o,"on"),null==n?a:a.get(Rt(n))}function Rt(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function Ot(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function It(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var i=r+e,a={c:t,t:i,n:null};return ss?ss.n=a:os=a,ss=a,ls||(us=clearTimeout(us),ls=1,cs(Pt)),a}function Pt(){var t=Nt(),e=Dt()-t;e>24?(isFinite(e)&&(clearTimeout(us),us=setTimeout(Pt,e)),ls=0):(ls=1,cs(Pt))}function Nt(){for(var t=Date.now(),e=os;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Dt(){for(var t,e=os,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Bt(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,a=n&&r?function(t,e){for(var i=t.length,a=[],o=0,s=n[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=n[o=(o+1)%n.length];return a.reverse().join(r)}:x;return function(t){var r=hs.exec(t),n=r[1]||" ",o=r[2]||">",s=r[3]||"-",l=r[4]||"",u=r[5],c=+r[6],f=r[7],h=r[8],d=r[9],p=1,g="",v="",m=!1,y=!0;switch(h&&(h=+h.substring(1)),(u||"0"===n&&"="===o)&&(u=n="0",o="="),d){case"n":f=!0,d="g";break;case"%":p=100,v="%",d="f";break;case"p":p=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":y=!1;case"d":m=!0,h=0;break;case"s":p=-1,d="r"}"$"===l&&(g=i[0],v=i[1]),"r"!=d||h||(d="g"),null!=h&&("g"==d?h=Math.max(1,Math.min(21,h)):"e"!=d&&"f"!=d||(h=Math.max(0,Math.min(20,h)))),d=ds.get(d)||jt;var b=u&&f;return function(t){var r=v;if(m&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=uo.formatPrefix(t,h);t=l.scale(t),r=l.symbol+v}else t*=p;t=d(t,h);var x,_,w=t.lastIndexOf(".");if(w<0){var A=y?t.lastIndexOf("e"):-1;A<0?(x=t,_=""):(x=t.substring(0,A),_=t.substring(A))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&f&&(x=a(x,1/0));var k=g.length+x.length+_.length+(b?0:i.length),M=k"===o?M+i+t:"^"===o?M.substring(0,k>>=1)+i+t+M.substring(k):i+(b?t:M+t))+r}}}function jt(t){return t+""}function Ut(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ht(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o=u)return-1;if(i=e.charCodeAt(s++),37===i){if(o=e.charAt(s++),a=S[o in ms?e.charAt(s++):o],!a||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}function n(t,e,r){w.lastIndex=0;var n=w.exec(e.slice(r));return n?(t.w=A.get(n[0].toLowerCase()),r+n[0].length):-1}function i(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=E.get(n[0].toLowerCase()),r+n[0].length):-1}function o(t,e,r){k.lastIndex=0;var n=k.exec(e.slice(r));return n?(t.m=M.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,L.c.toString(),e,n)}function l(t,e,n){return r(t,L.x.toString(),e,n)}function u(t,e,n){return r(t,L.X.toString(),e,n)}function c(t,e,r){var n=b.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)}var f=t.dateTime,h=t.date,d=t.time,p=t.periods,g=t.days,v=t.shortDays,m=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{gs=Ut;var e=new gs;return e._=t,n(e)}finally{gs=Date}}var n=e(t);return r.parse=function(t){try{gs=Ut;var e=n.parse(t);return e&&e._}finally{gs=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Xt(g),_=Yt(g),w=Xt(v),A=Yt(v),k=Xt(m),M=Yt(m),T=Xt(y),E=Yt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var L={a:function(t){return v[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return m[t.getMonth()]},c:e(f),d:function(t,e){return Gt(t.getDate(),e,2)},e:function(t,e){return Gt(t.getDate(),e,2)},H:function(t,e){return Gt(t.getHours(),e,2)},I:function(t,e){return Gt(t.getHours()%12||12,e,2)},j:function(t,e){return Gt(1+ps.dayOfYear(t),e,3)},L:function(t,e){return Gt(t.getMilliseconds(),e,3)},m:function(t,e){return Gt(t.getMonth()+1,e,2)},M:function(t,e){return Gt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Gt(t.getSeconds(),e,2)},U:function(t,e){return Gt(ps.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(ps.mondayOfYear(t),e,2)},x:e(h),X:e(d),y:function(t,e){return Gt(t.getFullYear()%100,e,2)},Y:function(t,e){return Gt(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},S={a:n,A:i,b:a,B:o,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:ae,p:c,S:oe,U:Zt,w:Wt,W:Qt,x:l,X:u,y:Kt,Y:$t,Z:Jt,"%":ue};return e}function Gt(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3)}function ee(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ae(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function le(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=xo(e)/60|0,i=xo(e)%60;return r+Gt(n,"0",2)+Gt(i,"0",2)}function ue(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function ce(t){for(var e=t.length,r=-1;++r=0?1:-1,s=o*r,l=Math.cos(e),u=Math.sin(e),c=a*u,f=i*l+c*Math.cos(s),h=c*o*Math.sin(s);Ms.add(Math.atan2(h,f)),n=t,i=l,a=u}var e,r,n,i,a;Ts.point=function(o,s){Ts.point=t,n=(e=o)*Vo,i=Math.cos(s=(r=s)*Vo/2+Bo/4),a=Math.sin(s)},Ts.lineEnd=function(){t(e,r)}}function me(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function be(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function xe(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Ae(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function ke(t,e){return xo(t[0]-e[0])=0;--s)i.point((f=c[s])[0],f[1])}else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);i.lineEnd()}}}function Ie(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n0){for(_||(a.polygonStart(),_=!0),a.lineStart();++o1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(De))}var d,p,g,v=e(a),m=i.invert(n[0],n[1]),y={point:o,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=f,y.lineEnd=h,d=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=l,y.lineEnd=u,d=uo.merge(d);var t=He(m,p);d.length?(_||(a.polygonStart(),_=!0),Oe(d,Fe,t,r,a)):t&&(_||(a.polygonStart(),_=!0),a.lineStart(),r(null,null,1,a),a.lineEnd()),_&&(a.polygonEnd(),_=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),r(null,null,1,a),a.lineEnd(),a.polygonEnd()}},b=ze(),x=e(b),_=!1;return y}}function De(t){return t.length>1}function ze(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:A,buffer:function(){var r=e;return e=[],t=null, +r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Fe(t,e){return((t=t.x)[0]<0?t[1]-Ho-zo:Ho-t[1])-((e=e.x)[0]<0?e[1]-Ho-zo:Ho-e[1])}function Be(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?Bo:-Bo,l=xo(a-r);xo(l-Bo)0?Ho:-Ho),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=Bo&&(xo(r-i)zo?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}function Ue(t,e,r,n){var i;if(null==t)i=r*Ho,n.point(-Bo,i),n.point(0,i),n.point(Bo,i),n.point(Bo,0),n.point(Bo,-i),n.point(0,-i),n.point(-Bo,-i),n.point(-Bo,0),n.point(-Bo,i);else if(xo(t[0]-e[0])>zo){var a=t[0]=0?1:-1,A=w*_,k=A>Bo,M=p*b;if(Ms.add(Math.atan2(M*w*Math.sin(A),g*x+M*Math.cos(A))),a+=k?_+w*jo:_,k^h>=r^m>=r){var T=be(me(f),me(t));we(T);var E=be(i,T);we(E);var L=(k^_>=0?-1:1)*nt(E[2]);(n>L||n===L&&(T[0]||T[1]))&&(o+=k^_>=0?1:-1)}if(!v++)break;h=m,p=b,g=x,f=t}}return(a<-zo||aa}function r(t){var r,a,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],g=e(f,h),v=o?g?0:i(f,h):g?i(f+(f<0?Bo:-Bo),h):0;if(!r&&(u=l=g)&&t.lineStart(),g!==l&&(d=n(r,p),(ke(r,d)||ke(p,d))&&(p[0]+=zo,p[1]+=zo,g=e(p[0],p[1]))),g!==l)c=0,g?(t.lineStart(),d=n(p,r),t.point(d[0],d[1])):(d=n(r,p),t.point(d[0],d[1]),t.lineEnd()),r=d;else if(s&&r&&o^g){var m;v&a||!(m=n(p,r,!0))||(c=0,o?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||r&&ke(r,p)||t.point(p[0],p[1]),r=p,l=g,a=v},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=me(t),i=me(e),o=[1,0,0],s=be(n,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var f=a*l/c,h=-a*u/c,d=be(o,s),p=_e(o,f),g=_e(s,h);xe(p,g);var v=d,m=ye(p,v),y=ye(v,v),b=m*m-y*(ye(p,p)-1);if(!(b<0)){var x=Math.sqrt(b),_=_e(v,(-m-x)/y);if(xe(_,p),_=Ae(_),!r)return _;var w,A=t[0],k=e[0],M=t[1],T=e[1];k0^_[1]<(xo(_[0]-A)Bo^(A<=_[0]&&_[0]<=k)){var C=_e(v,(-m+x)/y);return xe(C,p),[_,Ae(C)]}}}function i(e,r){var n=o?t:Bo-t,i=0;return e<-n?i|=1:e>n&&(i|=2),r<-n?i|=4:r>n&&(i|=8),i}var a=Math.cos(t),o=a>0,s=xo(a)>zo,l=vr(t,6*Vo);return Ne(e,r,l,o?[0,-t]:[-Bo,t-Bo])}function qe(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=s.x,f=s.y,h=0,d=1,p=c-l,g=f-u;if(a=t-l,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=r-l,p||!(a<0)){if(a/=p,p<0){if(a>d)return;a>h&&(h=a)}else if(p>0){if(a0)){if(a/=g,g<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=n-u,g||!(a<0)){if(a/=g,g<0){if(a>d)return;a>h&&(h=a)}else if(g>0){if(a0&&(i.a={x:l+h*p,y:u+h*g}),d<1&&(i.b={x:l+d*p,y:u+d*g}),i}}}}}}function Ge(t,e,r,n){function i(n,i){return xo(n[0]-t)0?0:3:xo(n[0]-r)0?2:1:xo(n[1]-e)0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(t,e){var r=i(t,1),n=i(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,r=v.length,n=t[1],i=0;in&&et(u,a,t)>0&&++e:a[1]<=n&&et(u,a,t)<0&&--e,u=a;return 0!==e}function u(a,s,l,u){var c=0,f=0;if(null==a||(c=i(a,l))!==(f=i(s,l))||o(a,s)<0^l>0){do u.point(0===c||3===c?t:r,c>1?n:e);while((c=(c+l+4)%4)!==f)}else u.point(s[0],s[1])}function c(i,a){return t<=i&&i<=r&&e<=a&&a<=n}function f(t,e){c(t,e)&&s.point(t,e)}function h(){S.point=p,v&&v.push(m=[]),k=!0,A=!1,_=w=NaN}function d(){g&&(p(y,b),x&&A&&E.rejoin(),g.push(E.buffer())),S.point=f,A&&s.lineEnd()}function p(t,e){t=Math.max(-js,Math.min(js,t)),e=Math.max(-js,Math.min(js,e));var r=c(t,e);if(v&&m.push([t,e]),k)y=t,b=e,x=r,k=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&A)s.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};L(n)?(A||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),M=!1):r&&(s.lineStart(),s.point(t,e),M=!1)}_=t,w=e,A=r}var g,v,m,y,b,x,_,w,A,k,M,T=s,E=ze(),L=qe(t,e,r,n),S={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=E,g=[],v=[],M=!0},polygonEnd:function(){s=T,g=uo.merge(g);var e=l([t,n]),r=M&&e,i=g.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Oe(g,a,e,u,s),s.polygonEnd()),g=v=m=null}};return S}}function Xe(t){var e=0,r=Bo/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Bo/180,r=t[1]*Bo/180):[e/Bo*180,r/Bo*180]},i}function Ye(t,e){function r(t,e){var r=Math.sqrt(a-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),o-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,a=1+n*(2*i-n),o=Math.sqrt(a)/i;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,nt((a-(t*t+r*r)*i*i)/(2*i))]},r}function We(){function t(t,e){Hs+=i*t-n*e,n=t,i=e}var e,r,n,i;Ys.point=function(a,o){Ys.point=t,e=n=a,r=i=o},Ys.lineEnd=function(){t(e,r)}}function Ze(t,e){tGs&&(Gs=t),eXs&&(Xs=e)}function Qe(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=r}function r(t,e){o.push("L",t,",",e)}function n(){s.point=t}function i(){o.push("Z")}var a=$e(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return a=$e(t),s},result:function(){if(o.length){var t=o.join("");return o=[],t}}};return s}function $e(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ke(t,e){Ss+=t,Cs+=e,++Rs}function Je(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);Os+=o*(e+t)/2,Is+=o*(r+n)/2,Ps+=o,Ke(e=t,r=n)}var e,r;Zs.point=function(n,i){Zs.point=t,Ke(e=n,r=i)}}function tr(){Zs.point=Ke}function er(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Os+=o*(n+t)/2,Is+=o*(i+e)/2,Ps+=o,o=i*t-n*e,Ns+=o*(n+t),Ds+=o*(i+e),zs+=3*o,Ke(n=t,i=e)}var e,r,n,i;Zs.point=function(a,o){Zs.point=t,Ke(e=n=a,r=i=o)},Zs.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+o,r),t.arc(e,r,o,0,jo)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function i(){s.point=e}function a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:i,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return o=t,s},result:A};return s}function nr(t){function e(t){return(s?n:r)(t)}function r(e){return or(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})}function n(e){function r(r,n){r=t(r,n),e.point(r[0],r[1])}function n(){b=NaN,k.point=a,e.lineStart()}function a(r,n){var a=me([r,n]),o=t(r,n);i(b,x,y,_,w,A,b=o[0],x=o[1],y=r,_=a[0],w=a[1],A=a[2],s,e),e.point(b,x)}function o(){k.point=r,e.lineEnd()}function l(){n(),k.point=u,k.lineEnd=c}function u(t,e){a(f=t,h=e),d=b,p=x,g=_,v=w,m=A,k.point=a}function c(){i(b,x,y,_,w,A,d,p,f,g,v,m,s,e),k.lineEnd=o,o()}var f,h,d,p,g,v,m,y,b,x,_,w,A,k={point:r,lineStart:n,lineEnd:o,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=n}};return k}function i(e,r,n,s,l,u,c,f,h,d,p,g,v,m){var y=c-e,b=f-r,x=y*y+b*b;if(x>4*a&&v--){var _=s+d,w=l+p,A=u+g,k=Math.sqrt(_*_+w*w+A*A),M=Math.asin(A/=k),T=xo(xo(A)-1)a||xo((y*C+b*R)/x-.5)>.3||s*d+l*p+u*g0&&16,e):Math.sqrt(a)},e}function ir(t){var e=nr(function(e,r){return t([e*qo,r*qo])});return function(t){return ur(e(t))}}function ar(t){this.stream=t}function or(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function sr(t){return lr(function(){return t})()}function lr(t){function e(t){return t=s(t[0]*Vo,t[1]*Vo),[t[0]*h+l,u-t[1]*h]}function r(t){return t=s.invert((t[0]-l)/h,(u-t[1])/h),t&&[t[0]*qo,t[1]*qo]}function n(){s=Ce(o=hr(m,y,b),a);var t=a(g,v);return l=d-t[0]*h,u=p+t[1]*h,i()}function i(){return c&&(c.valid=!1,c=null),e}var a,o,s,l,u,c,f=nr(function(t,e){return t=a(t,e),[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,g=0,v=0,m=0,y=0,b=0,_=Bs,w=x,A=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(o,f(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(A=t,Bs):Ve((A=+t)*Vo),i()):A},e.clipExtent=function(t){return arguments.length?(k=t,w=t?Ge(t[0][0],t[0][1],t[1][0],t[1][1]):x,i()):k},e.scale=function(t){return arguments.length?(h=+t,n()):h},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],n()):[d,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Vo,v=t[1]%360*Vo,n()):[g*qo,v*qo]},e.rotate=function(t){return arguments.length?(m=t[0]%360*Vo,y=t[1]%360*Vo,b=t.length>2?t[2]%360*Vo:0,n()):[m*qo,y*qo,b*qo]},uo.rebind(e,f,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&r,n()}}function ur(t){return or(t,function(e,r){t.point(e*Vo,r*Vo)})}function cr(t,e){return[t,e]}function fr(t,e){return[t>Bo?t-jo:t<-Bo?t+jo:t,e]}function hr(t,e,r){return t?e||r?Ce(pr(t),gr(e,r)):pr(t):e||r?gr(e,r):fr}function dr(t){return function(e,r){return e+=t,[e>Bo?e-jo:e<-Bo?e+jo:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function gr(t,e){function r(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*n+s*i;return[Math.atan2(l*a-c*o,s*n-u*i),nt(c*a+l*o)]}var n=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*a-l*o;return[Math.atan2(l*a+u*o,s*n+c*i),nt(c*n-s*i)]},r}function vr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=mr(r,i),a=mr(r,a),(o>0?ia)&&(i+=o*jo)):(i=t+o*jo,a=t-.5*l);for(var u,c=i;o>0?c>a:c0?e<-Ho+zo&&(e=-Ho+zo):e>Ho-zo&&(e=Ho-zo);var r=o/Math.pow(i(e),a);return[r*Math.sin(a*t),o-r*Math.cos(a*t)]}var n=Math.cos(t),i=function(t){return Math.tan(Bo/4+t/2)},a=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),o=n*Math.pow(i(t),a)/a;return a?(r.invert=function(t,e){var r=o-e,n=tt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(o/n,1/a))-Ho]},r):Er}function Tr(t,e){function r(t,e){var r=a-e;return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),a=n/i+t;return xo(i)1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Ir(t,e){return t[0]-e[0]||t[1]-e[1]}function Pr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Nr(t,e,r,n){var i=t[0],a=r[0],o=e[0]-i,s=n[0]-a,l=t[1],u=r[1],c=e[1]-l,f=n[1]-u,h=(s*(l-u)-f*(i-a))/(f*o-s*c);return[i+h*o,l+h*c]}function Dr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function zr(){an(this),this.edge=this.site=this.circle=null}function Fr(t){var e=ul.pop()||new zr;return e.site=t,e}function Br(t){Zr(t),ol.remove(t),ul.push(t),an(t)}function jr(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},a=t.P,o=t.N,s=[t];Br(t);for(var l=a;l.circle&&xo(r-l.circle.x)zo)s=s.L;else{if(i=a-Vr(s,o),!(i>zo)){n>-zo?(e=s.P,r=s):i>-zo?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=Fr(t);if(ol.insert(e,l),e||r){if(e===r)return Zr(e),r=Fr(e.site),ol.insert(l,r),l.edge=r.edge=Jr(e.site,l.site),Wr(e),void Wr(r);if(!r)return void(l.edge=Jr(e.site,l.site));Zr(e),Zr(r);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=r.site,g=p.x-c,v=p.y-f,m=2*(h*v-d*g),y=h*h+d*d,b=g*g+v*v,x={x:(v*y-d*b)/m+c,y:(h*b-g*y)/m+f};en(r.edge,u,p,x),l.edge=Jr(u,t,null,x),r.edge=Jr(t,p,null,x),Wr(e),Wr(r)}}function Hr(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);r=o.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,f=1/a-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+i-a/2)))/f+n:(n+s)/2}function Vr(t,e){var r=t.N;if(r)return Hr(r,e);var n=t.site;return n.y===e?n.x:1/0}function qr(t){this.site=t,this.edges=[]}function Gr(t){for(var e,r,n,i,a,o,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],g=al,v=g.length;v--;)if(a=g[v],a&&a.prepare())for(s=a.edges,l=s.length,o=0;ozo||xo(i-r)>zo)&&(s.splice(o,0,new rn(tn(a.site,c,xo(n-f)zo?{x:f,y:xo(e-f)zo?{x:xo(r-p)zo?{x:h,y:xo(e-h)zo?{x:xo(r-d)=-Fo)){var d=l*l+u*u,p=c*c+f*f,g=(f*d-u*p)/h,v=(l*p-c*d)/h,f=v+s,m=cl.pop()||new Yr;m.arc=t,m.site=i,m.x=g+o,m.y=f+Math.sqrt(g*g+v*v),m.cy=f,t.circle=m;for(var y=null,b=ll._;b;)if(m.y=s)return;if(h>p){if(a){if(a.y>=u)return}else a={x:v,y:l};r={x:v,y:u}}else{if(a){if(a.y1)if(h>p){if(a){if(a.y>=u)return}else a={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}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.xa||f>o||h=x,A=r>=_,k=A<<1|w,M=k+4;ka&&(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:bn(r,n)})),a=dl.lastIndex;return a=0&&!(r=uo.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function kn(t){return function(e){return 1-t(1-e)}}function Mn(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Ln(t){if(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 Sn(t){return function(e){return Math.pow(e,t)}}function Cn(t){return 1-Math.cos(t*Ho)}function Rn(t){return Math.pow(2,10*(t-1))}function On(t){return 1-Math.sqrt(1-t*t)}function In(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/jo*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*jo/e)}}function Pn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Nn(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 Dn(t,e){t=uo.hcl(t),e=uo.hcl(e);var r=t.h,n=t.c,i=t.l,a=e.h-r,o=e.c-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ht(r+a*t,n+o*t,i+s*t)+""}}function zn(t,e){t=uo.hsl(t),e=uo.hsl(e);var r=t.h,n=t.s,i=t.l,a=e.h-r,o=e.s-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ct(r+a*t,n+o*t,i+s*t)+""}}function Fn(t,e){t=uo.lab(t),e=uo.lab(e);var r=t.l,n=t.a,i=t.b,a=e.l-r,o=e.a-n,s=e.b-i;return function(t){return pt(r+a*t,n+o*t,i+s*t)+""}}function Bn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function jn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Hn(e),i=Un(e,r),a=Hn(Vn(r,e,-i))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(qn(r)+"rotate(",null,")")-2,x:bn(t,e)})):e&&r.push(qn(r)+"rotate("+e+")")}function Yn(t,e,r,n){t!==e?n.push({i:r.push(qn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(qn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(qn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:bn(t[0],e[0])},{i:i-2,x:bn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(qn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=uo.transform(t),e=uo.transform(e),Gn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Yn(t.skew,e.skew,r,n),Wn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,a=n.length;++i=0;)r.push(i[n])}function li(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;++oi&&(n=r,i=e);return n}function bi(t){return t.reduce(xi,0)}function xi(t,e){return t+e[1]}function _i(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,a=[];++r<=e;)a[r]=i*r+n;return a}function Ai(t){return[uo.min(t),uo.max(t)]}function ki(t,e){return t.value-e.value}function Mi(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ti(t,e){t._pack_next=e,e._pack_prev=t}function Ei(t,e){var r=e.x-t.x,n=e.y-t.y,i=t.r+e.r;return.999*i*i>r*r+n*n}function Li(t){function e(t){c=Math.min(t.x-t.r,c),f=Math.max(t.x+t.r,f),h=Math.min(t.y-t.r,h),d=Math.max(t.y+t.r,d)}if((r=t.children)&&(u=r.length)){var r,n,i,a,o,s,l,u,c=1/0,f=-(1/0),h=1/0,d=-(1/0);if(r.forEach(Si),n=r[0],n.x=-n.r,n.y=0,e(n),u>1&&(i=r[1],i.x=i.r,i.y=0,e(i),u>2))for(a=r[2],Oi(n,i,a),e(a),Mi(n,a),n._pack_prev=a,Mi(a,i),i=n._pack_next,o=3;o=0;)e=i[a],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function Fi(t,e,r){return t.a.parent===e.parent?t.a:r}function Bi(t){return 1+uo.max(t,function(t){return t.y})}function ji(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ui(t){var e=t.children;return e&&e.length?Ui(e[0]):t}function Hi(t){var e,r=t.children;return r&&(e=r.length)?Hi(r[e-1]):t}function Vi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function qi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(r+=i/2,i=0),a<0&&(n+=a/2,a=0),{x:r,y:n,dx:i,dy:a}}function Gi(t){var e=t[0],r=t[t.length-1];return e2?Qi:Yi,l=n?$n:Qn;return o=i(t,e,l,r),s=i(e,t,l,_n),a}function a(t){return o(t)}var o,s;return a.invert=function(t){return s(t)},a.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},a.range=function(t){return arguments.length?(e=t,i()):e},a.rangeRound=function(t){return a.range(t).interpolate(Bn)},a.clamp=function(t){return arguments.length?(n=t,i()):n},a.interpolate=function(t){return arguments.length?(r=t,i()):r},a.ticks=function(e){return ea(t,e)},a.tickFormat=function(e,r){return ra(t,e,r)},a.nice=function(e){return Ji(t,e),i()},a.copy=function(){return $i(t,e,r,n)},i()}function Ki(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ji(t,e){return Wi(t,Zi(ta(t,e)[2])),Wi(t,Zi(ta(t,e)[2])),t}function ta(t,e){null==e&&(e=10);var r=Gi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),a=e/n*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function ea(t,e){return uo.range.apply(uo,ta(t,e))}function ra(t,e,r){var n=ta(t,e);if(r){var i=hs.exec(r);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(xo(n[0]),xo(n[1])));return i[7]||(i[7]="."+na(a.scale(n[2]))),i[8]="f",r=uo.format(i.join("")),function(t){return r(a.scale(t))+a.symbol}}i[7]||(i[7]="."+ia(i[8],n)),r=i.join("")}else r=",."+na(n[2])+"f";return uo.format(r)}function na(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ia(t,e){var r=na(e[2]);return t in Ml?Math.abs(r-na(Math.max(xo(e[0]),xo(e[1]))))+ +("e"!==t):r-2*("%"===t)}function aa(t,e,r,n){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(i(e))}return o.invert=function(e){return a(t.invert(e))},o.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),o):e},o.nice=function(){var e=Wi(n.map(i),r?Math:El);return t.domain(e),n=e.map(a),o},o.ticks=function(){var t=Gi(n),o=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),f=e%1?2:e;if(isFinite(c-u)){if(r){for(;u0;h--)o.push(a(u)*h);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,r){if(!arguments.length)return Tl;arguments.length<2?r=Tl:"function"!=typeof r&&(r=uo.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e0?s[r-1]:t[0],r0?0:1}function xa(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,u=-s*a,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,g=(f+d)/2,v=h-c,m=d-f,y=v*v+m*m,b=r-n,x=c*d-h*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*m-v*_)/y,A=(-x*v-m*_)/y,k=(x*m+v*_)/y,M=(-x*v+m*_)/y,T=w-p,E=A-g,L=k-p,S=M-g;return T*T+E*E>L*L+S*S&&(w=k,A=M),[[w-l,A-u],[w*r/b,A*r/b]]}function _a(t){function e(e){function o(){u.push("M",a(t(c),s))}for(var l,u=[],c=[],f=-1,h=e.length,d=Lt(r),p=Lt(n);++f1?t.join("L"):t+"Z"}function Aa(t){return t.join("L")+"Z"}function ka(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1&&i.push("H",n[0]),i.join("")}function Ma(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 u=2;u9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[s+1]=i*n));for(s=-1;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}function Ua(t){return t.length<3?wa(t):t[0]+Ca(t,ja(t))}function Ha(t){for(var e,r,n,i=-1,a=t.length;++i0;)d[--s].call(t,o);if(a>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var l,u,c,h,d,p=t[r]||(t[r]={active:0,count:0}),g=p[n];g||(l=i.time,u=It(a,0,l),g=p[n]={tween:new f,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function ro(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function no(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function io(t){return t.toISOString()}function ao(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,a=uo.bisect(Kl,i);return a==Kl.length?[e.year,ta(t.map(function(t){return t/31536e6}),r)[2]]:a?e[i/Kl[a-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Gi(n.domain()),a=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(r[0],oo(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return ao(t.copy(),e,r)},Ki(n,t)}function oo(t){return new Date(t)}function so(t){return JSON.parse(t.responseText)}function lo(t){var e=ho.createRange();return e.selectNode(ho.body),e.createContextualFragment(t.responseText)}var uo={version:"3.5.17"},co=[].slice,fo=function(t){return co.call(t)},ho=this.document;if(ho)try{fo(ho.documentElement.childNodes)[0].nodeType}catch(t){fo=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}),ho)try{ho.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var po=this.Element.prototype,go=po.setAttribute,vo=po.setAttributeNS,mo=this.CSSStyleDeclaration.prototype,yo=mo.setProperty;po.setAttribute=function(t,e){go.call(this,t,e+"")},po.setAttributeNS=function(t,e,r){vo.call(this,t,e,r+"")},mo.setProperty=function(t,e,r){yo.call(this,t,e+"",r)}}uo.ascending=i,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.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},uo.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},uo.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 l/(c-1)},uo.deviation=function(){var t=uo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var bo=s(i);uo.bisectLeft=bo.left,uo.bisect=uo.bisectRight=bo.right,uo.bisector=function(t){return s(1===t.length?function(e,r){return i(t(e),r)}:t)},uo.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},uo.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},uo.pairs=function(t){for(var e,r=0,n=t.length-1,i=t[0],a=new Array(n<0?0:n);r=0;)for(n=t[i],e=n.length;--e>=0;)r[--o]=n[e];return r};var xo=Math.abs;uo.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=u(xo(r)),o=-1;if(t*=a,e*=a,r*=a,r<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=a.length)return n?n.call(i,o):r?o.sort(r):o;for(var l,u,c,h,d=-1,p=o.length,g=a[s++],v=new f;++d=a.length)return t;var n=[],i=o[r++];return t.forEach(function(t,i){n.push({key:t,values:e(i,r)})}),i?n.sort(function(t,e){return i(t.key,e.key)}):n}var r,n,i={},a=[],o=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(uo.map,r,0),0)},i.key=function(t){return a.push(t),i},i.sortKeys=function(t){return o[a.length-1]=t,i},i.sortValues=function(t){return r=t,i},i.rollup=function(t){return n=t,i},i},uo.set=function(t){var e=new b;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}},uo.event=null,uo.requote=function(t){return t.replace(ko,"\\$&")};var ko=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Mo={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},To=function(t,e){return e.querySelector(t)},Eo=function(t,e){return e.querySelectorAll(t)},Lo=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Lo=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(To=function(t,e){return Sizzle(t,e)[0]||null},Eo=Sizzle,Lo=Sizzle.matchesSelector),uo.selection=function(){return uo.select(ho.documentElement)};var So=uo.selection.prototype=[];So.select=function(t){var e,r,n,i,a=[];t=C(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Ro.hasOwnProperty(r)?{space:Ro[r],local:t}:t}},So.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=uo.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(O(e,t[e]));return this}return this.each(O(t,e))},So.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=N(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},So.sort=function(t){t=q.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.transition().duration(S)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-k.x)/k.k}).map(x.invert)),A&&A.domain(w.range().map(function(t){return(t-k.y)/k.k}).map(w.invert))}function l(t){C++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--C||(t({type:"zoomend"}),v=null)}function f(){function t(){s=1,a(uo.mouse(i),h),u(o)}function r(){f.on(O,null).on(I,null),d(s),c(o)}var i=this,o=N.of(i,arguments),s=0,f=uo.select(n(i)).on(O,t).on(I,r),h=e(uo.mouse(i)),d=$(i);Hl.call(i),l(o)}function h(){function t(){var t=uo.touches(p);return d=k.k,t.forEach(function(t){t.identifier in v&&(v[t.identifier]=e(t))}),t}function r(){var e=uo.event.target;uo.select(e).on(x,n).on(_,s),w.push(e);for(var r=uo.event.changedTouches,i=0,a=r.length;i1){var c=l[0],f=l[1],h=c[0]-f[0],d=c[1]-f[1];m=h*h+d*d}}function n(){var t,e,r,n,o=uo.touches(p);Hl.call(p);for(var s=0,l=o.length;s=u)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ds=uo.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=uo.round(t,zt(t,e))).toFixed(Math.max(0,Math.min(20,zt(t*(1+1e-15),e))))}}),ps=uo.time={},gs=Date;Ut.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){vs.setUTCDate.apply(this._,arguments)},setDay:function(){vs.setUTCDay.apply(this._,arguments)},setFullYear:function(){vs.setUTCFullYear.apply(this._,arguments)},setHours:function(){vs.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){vs.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){vs.setUTCMinutes.apply(this._,arguments)},setMonth:function(){vs.setUTCMonth.apply(this._,arguments)},setSeconds:function(){vs.setUTCSeconds.apply(this._,arguments)},setTime:function(){vs.setTime.apply(this._,arguments)}};var vs=Date.prototype;ps.year=Ht(function(t){return t=ps.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),ps.years=ps.year.range,ps.years.utc=ps.year.utc.range,ps.day=Ht(function(t){var e=new gs(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),ps.days=ps.day.range,ps.days.utc=ps.day.utc.range,ps.dayOfYear=function(t){var e=ps.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var r=ps[t]=Ht(function(t){return(t=ps.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var r=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});ps[t+"s"]=r.range,ps[t+"s"].utc=r.utc.range,ps[t+"OfYear"]=function(t){var r=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(r+e)%7)/7)}}),ps.week=ps.sunday,ps.weeks=ps.sunday.range,ps.weeks.utc=ps.sunday.utc.range,ps.weekOfYear=ps.sundayOfYear;var ms={"-":"",_:" ",0:"0"},ys=/^\s*\d+/,bs=/^%/;uo.locale=function(t){return{numberFormat:Bt(t),timeFormat:qt(t)}};var xs=uo.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"]});uo.format=xs.numberFormat,uo.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,_s),he(_s.s,this.s,this),this.s?this.t+=_s.t:this.s=_s.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _s=new fe;uo.geo.stream=function(t,e){t&&ws.hasOwnProperty(t.type)?ws[t.type](t,e):de(t,e)};var ws={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nd&&(d=e)}function e(e,r){var n=me([e*Vo,r*Vo]);if(m){var i=be(m,n),a=[i[1],-i[0],0],o=be(a,i);we(o),o=Ae(o);var l=e-p,u=l>0?1:-1,g=o[0]*qo*u,v=xo(l)>180;if(v^(u*pd&&(d=y)}else if(g=(g+360)%360-180,v^(u*pd&&(d=r);v?es(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e):h>=c?(eh&&(h=e)):e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,r);m=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=h,_.point=t,m=null}function i(t,r){if(m){var n=t-p;y+=xo(n)>180?n+(n>0?360:-360):n}else g=t,v=r;Ts.point(t,r),e(t,r)}function a(){Ts.lineStart()}function o(){i(g,v),Ts.lineEnd(),xo(y)>zo&&(c=-(h=180)),x[0]=c,x[1]=h,m=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tzo?d=90:y<-zo&&(f=-90),x[0]=c,x[1]=h}};return function(t){d=h=-(c=f=1/0),b=[],uo.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,i=b[0],a=[i];ns(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):a.push(i=r);for(var o,r,p=-(1/0),e=a.length-1,n=0,i=a[e];n<=e;i=r,++n)r=a[n],(o=s(i[1],r[0]))>p&&(p=o,c=r[0],h=i[1])}return b=x=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){Es=Ls=Ss=Cs=Rs=Os=Is=Ps=Ns=Ds=zs=0,uo.geo.stream(t,Fs);var e=Ns,r=Ds,n=zs,i=e*e+r*r+n*n;return i=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},t.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()}}},t.precision=function(e){return arguments.length?(a.precision(e),o.precision(e),s.precision(e),t):a.precision()},t.scale=function(e){return arguments.length?(a.scale(e),o.scale(.35*e),s.scale(e),t.translate(a.translate())):a.scale()},t.translate=function(e){if(!arguments.length)return a.translate();var u=a.scale(),c=+e[0],f=+e[1];return r=a.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,n=o.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+zo,f+.12*u+zo],[c-.214*u-zo,f+.234*u-zo]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+zo,f+.166*u+zo],[c-.115*u-zo,f+.234*u-zo]]).stream(l).point,t},t.scale(1070)};var Us,Hs,Vs,qs,Gs,Xs,Ys={point:A,lineStart:A,lineEnd:A,polygonStart:function(){Hs=0,Ys.lineStart=We},polygonEnd:function(){Ys.lineStart=Ys.lineEnd=Ys.point=A,Us+=xo(Hs/2)}},Ws={point:Ze,lineStart:A,lineEnd:A,polygonStart:A,polygonEnd:A},Zs={point:Ke,lineStart:Je,lineEnd:tr,polygonStart:function(){Zs.lineStart=er},polygonEnd:function(){Zs.point=Ke,Zs.lineStart=Je,Zs.lineEnd=tr}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),uo.geo.stream(t,o)),a.result()}function e(){return o=null,t}var r,n,i,a,o,s=4.5;return t.area=function(t){return Us=0,uo.geo.stream(t,i(Ys)),Us},t.centroid=function(t){return Ss=Cs=Rs=Os=Is=Ps=Ns=Ds=zs=0,uo.geo.stream(t,i(Zs)),zs?[Ns/zs,Ds/zs]:Ps?[Os/Ps,Is/Ps]:Rs?[Ss/Rs,Cs/Rs]:[NaN,NaN]},t.bounds=function(t){return Gs=Xs=-(Vs=qs=1/0),uo.geo.stream(t,i(Ws)),[[Vs,qs],[Gs,Xs]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):x,e()):r},t.context=function(t){return arguments.length?(a=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&a.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(a.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var r=new ar(e);for(var n in t)r[n]=t[n];return r}}},ar.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()}},uo.geo.projection=sr,uo.geo.projectionMutator=lr,(uo.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*Vo,e[1]*Vo),e[0]*=qo,e[1]*=qo,e}return t=hr(t[0]%360*Vo,t[1]*Vo,t.length>2?t[2]*Vo:0),e.invert=function(e){return e=t.invert(e[0]*Vo,e[1]*Vo),e[0]*=qo,e[1]*=qo,e},e},fr.invert=cr,uo.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=hr(-t[0]*Vo,-t[1]*Vo,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=qo,t[1]*=qo}}),{type:"Polygon",coordinates:[i]}}var e,r,n=[0,0],i=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=vr((e=+n)*Vo,i*Vo),t):e},t.precision=function(n){return arguments.length?(r=vr(e*Vo,(i=+n)*Vo),t):i},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Vo,i=t[1]*Vo,a=e[1]*Vo,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((r=f*o)*r+(r=u*c-l*f*s)*r),l*c+u*f*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/v)*v,i,v).map(h).concat(uo.range(Math.ceil(u/m)*m,l,m).map(d)).concat(uo.range(Math.ceil(n/p)*p,r,p).filter(function(t){return xo(t%v)>zo}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return xo(t%m)>zo}).map(f))}var r,n,i,a,o,s,l,u,c,f,h,d,p=10,g=p,v=90,m=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[h(a).concat(d(l).slice(1),h(i).reverse().slice(1),d(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(a=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],a>i&&(e=a,a=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[a,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(v=+e[0],m=+e[1],t):[v,m]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,o,90),f=br(n,r,y),h=yr(u,l,90),d=br(a,i,y),t):y},t.majorExtent([[-180,-90+zo],[180,90-zo]]).minorExtent([[-180,-80-zo],[180,80+zo]])},uo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}var e,r,n=xr,i=_r;return t.distance=function(){return uo.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(i=e,r="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},uo.geo.interpolate=function(t,e){return wr(t[0]*Vo,t[1]*Vo,e[0]*Vo,e[1]*Vo)},uo.geo.length=function(t){return Qs=0,uo.geo.stream(t,$s),Qs};var Qs,$s={sphere:A,point:A,lineStart:Ar,lineEnd:A,polygonStart:A,polygonEnd:A},Ks=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Ks)}).raw=Ks;var Js=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr(Js)}).raw=Js,(uo.geo.conicConformal=function(){return Xe(Mr)}).raw=Mr,(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var tl=kr(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(tl)}).raw=tl,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Ho]},(uo.geo.mercator=function(){return Lr(Er)}).raw=Er;var el=kr(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr(el)}).raw=el;var rl=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(rl)}).raw=rl,Sr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ho]},(uo.geo.transverseMercator=function(){var t=Lr(Sr),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=Sr,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Lt(r),a=Lt(n),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e=n&&u.x<=a&&u.y>=i&&u.y<=o?[[n,o],[a,o],[a,i],[n,i]]:[];c.point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/zo)*zo,y:Math.round(o(t,e)/zo)*zo,i:e}})}var n=Cr,i=Rr,a=n,o=i,s=fl;return t?e(t):(e.links=function(t){return un(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return un(r(t)).cells.forEach(function(r,n){for(var i,a,o=r.site,s=r.edges.sort(Xr),l=-1,u=s.length,c=s[u-1].edge,f=c.l===o?c.r:c.l;++l=u,h=n>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),f?i=u:s=u,h?o=c:l=c,a(t,e,r,n,i,o,s,l)}var c,f,h,d,p,g,v,m,y,b=Lt(s),x=Lt(l);if(null!=e)g=e,v=r,m=n,y=i;else if(m=y=-(g=v=1/0),f=[],h=[],p=t.length,o)for(d=0;dm&&(m=c.x),c.y>y&&(y=c.y),f.push(c.x),h.push(c.y);else for(d=0;dm&&(m=_),w>y&&(y=w),f.push(_),h.push(w)}var A=m-g,k=y-v;A>k?y=v+A:m=g+k;var M=pn();if(M.add=function(t){a(M,t,+b(t,++d),+x(t,d),g,v,m,y)},M.visit=function(t){gn(t,M,g,v,m,y)},M.find=function(t){return vn(M,t[0],t[1],g,v,m,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=gl.get(r)||pl,n=vl.get(n)||x,An(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=Dn,uo.interpolateHsl=zn,uo.interpolateLab=Fn,uo.interpolateRound=Bn,uo.transform=function(t){var e=ho.createElementNS(uo.ns.prefix.svg,"g");return(uo.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new jn(r?r.matrix:ml)})(t)},jn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ml={a:1,b:0,c:0,d:1,e:0,f:0};uo.interpolateTransform=Zn,uo.layout={},uo.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r0?i=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),r=It(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;l=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;n&&(a.value=0),a.children=u}else n&&(a.value=+n.call(t,a,a.depth)||0),delete a.children;return li(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=fi,r=ui,n=ci;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0),(r=e.parent)&&(r.value+=e.value); +})),e},t},uo.layout.partition=function(){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,u=-1;for(n=e.value?n/e.value:0;++us&&(s=n),o.push(n)}for(r=0;r0)for(a=-1;++a=c[0]&&s<=c[1]&&(o=l[uo.bisect(f,s,1,d)-1],o.y+=p,o.push(t[a]));return l}var e=!0,r=Number,n=Ai,i=_i;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=Lt(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:Lt(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},uo.layout.pack=function(){function t(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,Li),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=f}),li(s,Li),li(s,function(t){t.r-=f})}return Ri(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),o}var e,r=uo.layout.hierarchy().sort(ki),n=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},oi(t,r)},uo.layout.tree=function(){function t(t,i){var c=o.call(this,t,i),f=c[0],h=e(f);if(li(h,r),h.parent.m=-h.z,si(h,n),u)si(f,a);else{var d=f,p=f,g=f;si(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var v=s(d,p)/2-d.x,m=l[0]/(p.x+s(p,d)/2+v),y=l[1]/(g.depth||1);si(f,function(t){t.x=(t.x+v)*m,t.y=t.depth*y})}return c}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var i,a=e.children,o=0,s=a.length;o0&&(Di(Fi(o,t,r),t,n),u+=n,c+=n),f+=o.m,u+=i.m,h+=l.m,c+=a.m;o&&!Ni(a)&&(a.t=o,a.m+=f-c),i&&!Pi(l)&&(l.t=i,l.m+=u-h,r=t)}return r}function a(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Ii,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?a:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:a,t):u?l:null},oi(t,o)},uo.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=ji(e),t.y=Bi(e)):(t.x=o?u+=r(t,o):0,t.y=0,o=t)});var c=Ui(l),f=Hi(l),h=c.x-r(c,f)/2,d=f.x+r(f,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*n[0],t.y=(l.y-t.y)*n[1]}:function(t){t.x=(t.x-h)/(d-h)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=uo.layout.hierarchy().sort(null).value(null),r=Ii,n=[1,1],i=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(i=null==(n=e),t):i?null:n},t.nodeSize=function(e){return arguments.length?(i=null!=(n=e),t):i?n:null},oi(t,e)},uo.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,a=t.length;++i0;)c.push(o=h[l-1]),c.area+=o.area,"squarify"!==d||(s=n(c,g))<=p?(h.pop(),p=s):(c.area-=c.pop().area,i(c,g,u,!1),g=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,g,u,!0),c.length=c.area=0),a.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var a,o=f(e),s=n.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(i(l,a.z?o.dx:o.dy,o,!s.length),l.length=l.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=r));return n*=n,e*=e,n?Math.max(e*i*p/n,n/(e*a*p)):1/0}function i(t,e,r,n){var i,a=-1,o=t.length,s=r.x,u=r.y,c=e?l(t.area/e):0;if(e==r.dx){for((n||c>r.dy)&&(c=r.dy);++ar.dx)&&(c=r.dx);++a1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=uo.random.normal.apply(uo,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=uo.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;rf?0:1;if(u=Uo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,v,m,y,b,x,_,w,A,k,M,T=0,E=0,L=[];if((m=(+l.apply(this,arguments)||0)/2)&&(v=a===Ol?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(E*=-1),u&&(E=nt(v/u*Math.sin(m))),t&&(T=nt(v/t*Math.sin(m)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(f-E),_=u*Math.sin(f-E);var S=Math.abs(f-c-2*E)<=Bo?0:1;if(E&&ba(y,b,x,_)===d^S){var C=(c+f)/2;y=u*Math.cos(C),b=u*Math.sin(C),x=_=null}}else y=b=0;if(t){w=t*Math.cos(f-T),A=t*Math.sin(f-T),k=t*Math.cos(c+T),M=t*Math.sin(c+T);var R=Math.abs(c-f+2*T)<=Bo?0:1;if(T&&ba(w,A,k,M)===1-d^R){var O=(c+f)/2;w=t*Math.cos(O),A=t*Math.sin(O),k=M=null}}else w=A=0;if(h>zo&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){g=tBo)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var a=xr,o=_r,s=qa,l=va,u=ma;return t.radius=function(e){return arguments.length?(s=Lt(e),t):s},t.source=function(e){return arguments.length?(a=Lt(e),t):a},t.target=function(e){return arguments.length?(o=Lt(e),t):o},t.startAngle=function(e){return arguments.length?(l=Lt(e),t):l},t.endAngle=function(e){return arguments.length?(u=Lt(e),t):u},t},uo.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=r.call(this,t,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return l=l.map(n),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=xr,r=_r,n=Ga;return t.source=function(r){return arguments.length?(e=Lt(r),t):e},t.target=function(e){return arguments.length?(r=Lt(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},uo.svg.diagonal.radial=function(){var t=uo.svg.diagonal(),e=Ga,r=t.projection;return t.projection=function(t){return arguments.length?r(Xa(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(zl.get(e.call(this,t,n))||Za)(r.call(this,t,n))}var e=Wa,r=Ya;return t.type=function(r){return arguments.length?(e=Lt(r),t):e},t.size=function(e){return arguments.length?(r=Lt(e),t):r},t};var zl=uo.map({circle:Za,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Bl)),r=e*Bl;return"M0,"+-e+"L"+r+",0 0,"+e+" "+-r+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/Fl),r=e*Fl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Fl),r=e*Fl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=zl.keys();var Fl=Math.sqrt(3),Bl=Math.tan(30*Vo);So.transition=function(t){for(var e,r,n=jl||++ql,i=to(t),a=[],o=Ul||{time:Date.now(),ease:Ln,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",f[1]-f[0])}function i(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function a(){function a(){32==uo.event.keyCode&&(S||(b=null,R[0]-=f[1],R[1]-=h[1],S=2),T())}function g(){32==uo.event.keyCode&&2==S&&(R[0]+=f[1],R[1]+=h[1],S=0,T())}function v(){var t=uo.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),S||(uo.event.altKey?(b||(b=[(f[0]+f[1])/2,(h[0]+h[1])/2]),R[0]=f[+(t[0]>>31},e.exports.exponent=function(t){var r=e.exports.hi(t);return(r<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){var r=e.exports.hi(t);return!(2146435072&r)}}).call(this,t("buffer").Buffer)},{buffer:38}],57:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(i<=0)return[];var a,o=new Array(i);if(r===t.length-1)for(a=0;a0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=a},{}],58:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;n0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],a=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(s=a;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(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],61:[function(t,e,r){"use strict";function n(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}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],62:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=a}function i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function a(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}function l(t,e){if(e.left){var r=l(t,e.left);if(r)return r}var r=t(e.key,e.value);return r?r:e.right?l(t,e.right):void 0}function u(t,e,r,n){var i=e(t,n.key);if(i<=0){if(n.left){var a=u(t,e,r,n.left);if(a)return a}var a=r(n.key,n.value);if(a)return a}if(n.right)return u(t,e,r,n.right)}function c(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=c(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return c(t,e,r,n,i.right)}function f(t,e){this.tree=t,this._stack=e}function h(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t._color=e._color,t._count=e._count}function d(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=m);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===v){if(n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=m,r._color=m,s._color=m,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}return void(t[l-1]=n)}if(n.left&&n.left._color===v){if(n=r.right=i(n),s=n.left=i(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=m,n._color=m,e._color=m,o(r),o(n),o(s),l>1){var u=t[l-2];u.left===r?u.left=s:u.right=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.right=a(v,n));r.right=a(v,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=v,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}t[l-1]=n,t[l]=r,l+11){var u=t[l-2];u.right===r?u.right=n:u.left=n}return void(t[l-1]=n)}if(n.right&&n.right._color===v){if(n=r.left=i(n),s=n.right=i(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=m,n._color=m,e._color=m,o(r),o(n),o(s),l>1){var u=t[l-2];u.right===r?u.right=s:u.left=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.left=a(v,n));r.left=a(v,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=v,o(r),o(n),l>1){var u=t[l-2];u.right===r?u.right=n:u.left=n}t[l-1]=n,t[l]=r,l+1e?1:0}function g(t){return new s(t||p,null)}e.exports=g;var v=0,m=1,y=s.prototype;Object.defineProperty(y,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(y,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(y,"length",{get:function(){return this.root?this.root._count:0}}),y.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],u=[];i;){var c=r(t,i.key);l.push(i),u.push(c),i=c<=0?i.left:i.right}l.push(new n(v,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){var i=l[f];u[f]<=0?l[f]=new n(i._color,i.key,i.value,l[f+1],i.right,i._count+1):l[f]=new n(i._color,i.key,i.value,i.left,l[f+1],i._count+1)}for(var f=l.length-1;f>1;--f){var h=l[f-1],i=l[f];if(h._color===m||i._color===m)break;var d=l[f-2];if(d.left===h)if(h.left===i){var p=d.right;if(!p||p._color!==v){if(d._color=v,d.left=h.right,h._color=m,h.right=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3){var g=l[f-3];g.left===d?g.left=h:g.right=h}break}h._color=m,d.right=a(m,p),d._color=v,f-=1}else{var p=d.right;if(!p||p._color!==v){if(h.right=i.left,d._color=v,d.left=i.right,i._color=m,i.left=h,i.right=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3){var g=l[f-3];g.left===d?g.left=i:g.right=i}break}h._color=m,d.right=a(m,p),d._color=v,f-=1}else if(h.right===i){var p=d.left;if(!p||p._color!==v){if(d._color=v,d.right=h.left,h._color=m,h.left=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3){var g=l[f-3];g.right===d?g.right=h:g.left=h}break}h._color=m,d.left=a(m,p),d._color=v,f-=1}else{var p=d.left;if(!p||p._color!==v){if(h.left=i.right,d._color=v,d.right=i.left,i._color=m,i.right=h,i.left=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3){var g=l[f-3];g.right===d?g.right=i:g.left=i}break}h._color=m,d.left=a(m,p),d._color=v,f-=1}}return l[0]._color=m,new s(r,l[0])},y.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return c(e,r,this._compare,t,this.root)}},Object.defineProperty(y,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new f(this,t)}}),Object.defineProperty(y,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new f(this,t)}}),y.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,[])},y.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)},y.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)},y.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)},y.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)},y.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var i=e(t,r.key);if(n.push(r),0===i)return new f(this,n);r=i<=0?r.left:r.right}return new f(this,[])},y.remove=function(t){var e=this.find(t);return e?e.remove():this},y.get=function(t){for(var e=this._compare,r=this.root;r;){var n=e(t,r.key);if(0===n)return r.value;r=n<=0?r.left:r.right}};var b=f.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new f(this.tree,this._stack.slice())},b.remove=function(){var t=this._stack;if(0===t.length)return this.tree;var e=new Array(t.length),r=t[t.length-1];e[e.length-1]=new n(r._color,r.key,r.value,r.left,r.right,r._count);for(var i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var a=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var o=e[a-1];e.push(new n(r._color,o.key,o.value,r.left,r.right,r._count)),e[a-1].key=r.key,e[a-1].value=r.value;for(var i=e.length-2;i>=a;--i)r=e[i],e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count);e[a-1].left=e[a]}if(r=e[e.length-1],r._color===v){var l=e[e.length-2];l.left===r?l.left=null:l.right===r&&(l.right=null),e.pop();for(var i=0;i0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(b,"index",{get:function(){var t=0,e=this._stack;if(0===e.length){var r=this.tree.root;return r?r._count:0}e[e.length-1].left&&(t=e[e.length-1].left._count);for(var n=e.length-2;n>=0;--n)e[n+1]===e[n].right&&(++t,e[n].left&&(t+=e[n].left._count));return t},enumerable:!0}),b.next=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.right)for(e=e.right;e;)t.push(e),e=e.left;else for(t.pop();t.length>0&&t[t.length-1].right===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(b,"hasNext",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].right)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].left===t[e])return!0;return!1}}),b.update=function(t){var e=this._stack;if(0===e.length)throw new Error("Can't update empty node!");var r=new Array(e.length),i=e[e.length-1];r[r.length-1]=new n(i._color,i.key,t,i.left,i.right,i._count);for(var a=e.length-2;a>=0;--a)i=e[a],i.left===e[a+1]?r[a]=new n(i._color,i.key,i.value,r[a+1],i.right,i._count):r[a]=new n(i._color,i.key,i.value,i.left,r[a+1],i._count);return new s(this.tree._compare,r[0])},b.prev=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.left)for(e=e.left;e;)t.push(e),e=e.right;else for(t.pop();t.length>0&&t[t.length-1].left===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(b,"hasPrev",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].left)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].right===t[e])return!0;return!1}})},{}],63:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=s[0],r=s.length-1;r>0;--r)e+=s[r]/(t+r);var n=t+o+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=7,a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],o=607/128,s=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];e.exports=function t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(n(e));e-=1;for(var r=a[0],o=1;or)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,a,i),r}function a(t,e){for(var r=l.malloc(t.length,e),n=t.length,i=0;i=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,i){if(r=r||t.ARRAY_BUFFER,i=i||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var a=t.createBuffer(),o=new n(t,r,a,0,i);return o.update(e),o}var l=t("typedarray-pool"),u=t("ndarray-ops"),c=t("ndarray"),f=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],h=n.prototype;h.bind=function(){this.gl.bindBuffer(this.type,this.handle)},h.unbind=function(){this.gl.bindBuffer(this.type,null)},h.dispose=function(){this.gl.deleteBuffer(this.handle)},h.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&"undefined"!=typeof t.shape){var r=t.dtype;if(f.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var n=gl.getExtension("OES_element_index_uint");r=n&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&o(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=l.malloc(t.size,r),h=c(s,t.shape);u.assign(h,t),e<0?this.length=i(this.gl,this.type,this.length,this.usage,s,e):this.length=i(this.gl,this.type,this.length,this.usage,s.subarray(0,t.size),e),l.free(s)}}else if(Array.isArray(t)){var d;d=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),e<0?this.length=i(this.gl,this.type,this.length,this.usage,d,e):this.length=i(this.gl,this.type,this.length,this.usage,d.subarray(0,t.length),e),l.free(d)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");t|=0,t<=0&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:148,"ndarray-ops":147,"typedarray-pool":187}],66:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE", +36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],67:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":66}],68:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){this.plot=t,this.shader=e,this.fillShader=r,this.positionBuffer=n,this.colorBuffer=i,this.idBuffer=a,this.fillPositionBuffer=o,this.fillColorBuffer=s,this.fillVerts=0,this.shape=[0,0],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numVertices=0,this.lineWidth=1}function i(t,e){var r=Math.floor(e);if(r<0)return t[0];if(r>=t.length-1)return t[t.length-1];var n=e-r;return(1-n)*t[r]+n*t[r+1]}function a(t,e){var r=t.gl,i=s(r,p.vertex,p.fragment),a=s(r,p.fillVertex,p.fragment),o=l(r),u=l(r),c=l(r),f=l(r),h=l(r),d=new n(t,i,a,o,u,c,f,h);return d.update(e),t.addObject(d),d}e.exports=a;var o=t("iota-array"),s=t("gl-shader"),l=t("gl-buffer"),u=t("ndarray"),c=t("surface-nets"),f=t("cdt2d"),h=t("clean-pslg"),d=t("binary-search-bounds"),p=t("./lib/shaders"),g=n.prototype,v=[1,0,0,0,0,1,1,0,1,1,0,1];g.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0];return function(){var r,n,i=this.plot,a=this.shader,o=this.fillShader,s=this.bounds,l=this.numVertices,u=this.fillVerts,c=i.gl,f=i.viewBox,h=i.dataBox,d=s[2]-s[0],p=s[3]-s[1],g=h[2]-h[0],v=h[3]-h[1];if(t[0]=2*d/g,t[4]=2*p/v,t[6]=2*(s[0]-h[0])/g-1,t[7]=2*(s[1]-h[1])/v-1,e[0]=f[2]-f[0],e[1]=f[3]-f[1],u>0&&(o.bind(),r=o.uniforms,r.viewTransform=t,r.screenShape=e,n=a.attributes,this.fillPositionBuffer.bind(),n.position.pointer(),this.fillColorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0),c.drawArrays(c.TRIANGLES,0,u)),l>0){a.bind();var m=this.lineWidth*i.pixelRatio;r=a.uniforms,r.viewTransform=t,r.screenShape=e,r.lineWidth=m,r.pointSize=1e3,n=a.attributes,this.positionBuffer.bind(),n.position.pointer(c.FLOAT,!1,16,0),n.tangent.pointer(c.FLOAT,!1,16,8),this.colorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0),c.drawArrays(c.TRIANGLES,0,l),r.lineWidth=0,r.pointSize=m,this.positionBuffer.bind(),n.position.pointer(c.FLOAT,!1,48,0),n.tangent.pointer(c.FLOAT,!1,48,8),this.colorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0,12,0),c.drawArrays(c.POINTS,0,l/3)}}}(),g.drawPick=function(){return function(t){return t}}(),g.pick=function(t,e,r){return null},g.update=function(t){function e(t,e,r,n){var i=n-r;return Math.abs(i)<1e-6?e:Math.floor(e)+Math.max(.001,Math.min(.999,(t-r)/i))}t=t||{};var r=t.shape||[0,0],n=t.x||o(r[0]),a=t.y||o(r[1]),s=t.z||new Float32Array(r[0]*r[1]),l=t.levels||[],p=t.levelColors||[],g=this.bounds,m=g[0]=n[0],y=g[1]=a[0],b=g[2]=n[n.length-1],x=g[3]=a[a.length-1];m===b&&(g[2]+=1,b+=1),y===x&&(g[3]+=1,x+=1);var _=1/(b-m),w=1/(x-y);this.lineWidth=t.lineWidth||1;for(var A=u(s,r),k=[],M=[],T=[],E=[],L=[[0,0],[r[0]-1,0],[0,r[1]-1],[r[0]-1,r[1]-1]],S=0;S0&&C===l[S-1])){for(var R=c(A,C),O=255*p[4*S]|0,I=255*p[4*S+1]|0,P=255*p[4*S+2]|0,N=255*p[4*S+3]|0,D=R.cells,z=R.positions,F=Array(z.length),B=0;B1)){var V,q=H[0],G=H[1],X=A.get(Math.floor(q),Math.floor(G)),Y=A.get(Math.floor(q),Math.ceil(G)),W=A.get(Math.ceil(q),Math.floor(G)),Z=A.get(Math.ceil(q),Math.ceil(G));0===Math.floor(H[0])&&X<=C!=Y>1;for(e=0;e0&&(T*=_),E<0?E*=w:E>0&&(E*=A),v[b++]=h*(r-p+T),v[b++]=d*(n-g+E),v[b++]=o*M[2]+(l+o)*M[4],v[b++]=o*M[3]+(l+o)*M[5]}}for(e=0;e1&&h.drawBuffersWEBGL(y[f]);var m=r.getExtension("WEBGL_depth_texture");m?d?t.depth=s(r,u,c,m.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=s(r,u,c,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=l(r,u,c,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=l(r,u,c,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=l(r,u,c,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var v=0;vs||r<0||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(a),u=0;uo||r<0||r>o)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),s<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var f=!0;"depth"in n&&(f=!!n.depth);var h=!1;return"stencil"in n&&(h=!!n.stencil),new c(t,e,r,l,s,f,h,i)}var d=t("gl-texture2d");e.exports=h;var p,g,v,m,y=null,b=c.prototype;Object.defineProperties(b,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return f(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t|=0,f(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t|=0,f(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e>8*h&255;this.pickOffset=r,i.bind();var d=i.uniforms;d.viewTransform=t,d.pickOffset=e;var p=i.attributes;return this.positionBuffer.bind(),p.position.pointer(),this.idBuffer.bind(),p.pickId.pointer(o.UNSIGNED_BYTE,!1),o.drawArrays(o.TRIANGLES,0,this.numVertices),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){t=t||{};var e=t.shape||[0,0],r=t.x||o(e[0]),n=t.y||o(e[1]),i=t.z||new Float32Array(e[0]*e[1]);this.xData=r,this.yData=n;var l=t.colorLevels||[0],u=t.colorValues||[0,0,0,1],c=l.length,f=this.bounds,d=f[0]=r[0],p=f[1]=n[0],g=f[2]=r[r.length-1],v=f[3]=n[n.length-1],m=1/(g-d),y=1/(v-p),b=e[0]*e[1]*(h.length>>>1);this.numVertices=b;var x=s.mallocUint8(4*b),_=s.mallocFloat32(2*b),w=s.mallocUint32(b),A=e[0],k=e[1];this.shape=[A,k];for(var M=0,T=0;T2&&!this.usingDashes){var b=this.mitreShader;this.lineBufferLo.bind(),b.attributes.aLo.pointer(l.FLOAT,!1,48,0),this.lineBufferHi.bind(),b.bind();var x=b.uniforms;this.setProjectionUniforms(x,a),x.color=c,x.radius=s*u,b.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,i/3|0)}}}}(),h.drawPick=function(){var t=[0,0,0,0];return function(e){var r=this.vertCount,n=this.numPoints;if(this.pickOffset=e,!r)return e+n;var i=this.setProjectionModel(),a=this.plot,o=this.width,s=a.gl,l=a.pickPixelRatio,u=this.pickShader,c=this.pickBuffer;t[0]=255&e,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24,u.bind();var f=u.uniforms;this.setProjectionUniforms(f,i),f.width=o*l,f.pickOffset=t;var h=u.attributes;return this.lineBufferHi.bind(),h.aHi.pointer(s.FLOAT,!1,16,0),h.dHi.pointer(s.FLOAT,!1,16,8),this.lineBufferLo.bind(),h.aLo.pointer(s.FLOAT,!1,16,0),c.bind(),h.pick0.pointer(s.UNSIGNED_BYTE,!1,8,0),h.pick1.pointer(s.UNSIGNED_BYTE,!1,8,4),s.drawArrays(s.TRIANGLES,0,r),e+n}}(),h.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(r=n+i)return null;var a=r-n,o=this.data;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}},h.update=function(t){t=t||{};var e,r,n,a,o,s=this.plot.gl;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=i(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var f=t.dashes||[1],h=0;for(e=0;e1,this.dashPattern=l(s,u(d,[h,1,4],[1,0,0])),this.dashPattern.minFilter=s.NEAREST,this.dashPattern.magFilter=s.NEAREST,this.dashLength=h,c.free(d);var g=t.positions;this.data=g;var v=this.bounds;v[0]=v[1]=1/0,v[2]=v[3]=-(1/0);var m=this.numPoints=g.length>>>1;if(0!==m){for(e=0;e1;){var M=--n;a=g[2*n],o=g[2*n+1];var T=M-1,E=g[2*T],L=g[2*T+1];if(!(isNaN(a)||isNaN(o)||isNaN(E)||isNaN(L))){k+=1,a=(a-v[0])/(v[2]-v[0]),o=(o-v[1])/(v[3]-v[1]),E=(E-v[0])/(v[2]-v[0]),L=(L-v[1])/(v[3]-v[1]);var S=E-a,C=L-o,R=M|1<<24,O=M-1,I=M,P=M-1|1<<24;y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=a,_[--A]=R,_[--A]=O,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=I,_[--A]=P,y[--w]=-C,y[--w]=-S,y[--w]=L,y[--w]=E,_[--A]=I,_[--A]=P,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=I,_[--A]=P,y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=a,_[--A]=R,_[--A]=O,y[--w]=C,y[--w]=S,y[--w]=o,y[--w]=a,_[--A]=R,_[--A]=O}}for(e=0;es[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n],a.uniforms.angle=m[n],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n]&&A&&(e[1^n]-=T*d*b[n],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n],a.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,A)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*g[n+2],ks[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n+2],a.uniforms.angle=m[n+2],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n+2]&&A&&(e[1^n]+=T*d*b[n+2],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n+2],a.uniforms.angle=_[n+2],u.drawArrays(u.TRIANGLES,w,A))}}(),c.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,u=r.pixelRatio;if(this.titleCount){for(var c=0;c<2;++c)e[c]=2*(o[c]*u-a[c])/(a[2+c]-a[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,a=n._tickBounds,o=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var u=0;u<2;++u){var c=a[u],f=a[u+2],h=f-c,d=.5*(o[u+2]+o[u]),p=o[u+2]-o[u],g=l[u],v=l[u+2],m=v-g,y=s[u],b=s[u+2],x=b-y;e[u]=2*h/p*m/x,t[u]=2*(c-d)/p*m/x}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){var e,r,n,i,a,o=[],l=t.ticks,u=t.bounds;for(a=0;a<2;++a){var c=[Math.floor(o.length/3)],f=[-(1/0)],h=l[a];for(e=0;er)for(t=r;te)for(t=e;t=0){for(var k=0|A.type.charAt(A.type.length-1),M=new Array(k),T=0;T=0;)E+=1;w[b]=E}var L=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,x,w),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=a},{"./lib/GLError":88,"./lib/create-attributes":89,"./lib/create-uniforms":90,"./lib/reflect":91,"./lib/runtime-reflect":92,"./lib/shader-cache":93}],88:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="GLError",n.prototype.constructor=n,e.exports=n},{}],89:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}function i(t,e,r,i,a,o,s){for(var l=["gl","v"],u=[],c=0;c=0){var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);i(t,e,d[0],n,p,o,f)}else{if(!(h.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+f+": "+h);var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);a(t,e,d,n,p,o,f)}}}return o}e.exports=o;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,a=i._gl,o=i._locations[i._index];a.vertexAttribPointer(o,i._dimension,t||a.FLOAT,!!e,r||0,n||0),a.enableVertexAttribArray(o)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":88}],90:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;n4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(i<2||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],a=t;a+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function f(e){for(var n=["return function updateProperty(obj){"],i=c("",e),o=0;o4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var o=p(i);Object.defineProperty(t,e,{get:n(o),set:f(i),enumerable:!0,configurable:!1})}else a[i]?Object.defineProperty(t,e,{get:l(i),set:f(i),enumerable:!0,configurable:!1}):t[e]=h(r[i].type)}function p(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 u=1;u1)for(var l=0;l=0){var g=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(g,e[1],g,e[3],d[p],h[p]):o.drawLine(e[0],g,e[2],g,d[p],h[p])}}for(var p=0;p=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},h.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},h.removeObject=function(t){ +for(var e=this.objects,r=0;r>>1;for(r=0;r=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}function a(t,e){var r=t.gl,i=s(r),a=s(r),l=o(r,u.pointVertex,u.pointFragment),c=o(r,u.pickVertex,u.pickFragment),f=new n(t,i,a,l,c);return f.update(e),t.addObject(f),f}var o=t("gl-shader"),s=t("gl-buffer"),l=t("typedarray-pool"),u=t("./lib/shader");e.exports=a;var c=n.prototype;c.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},c.update=function(t){function e(e,r){return e in t?t[e]:r}var r;t=t||{},this.sizeMin=e("sizeMin",.5),this.sizeMax=e("sizeMax",20),this.color=e("color",[1,0,0,1]).slice(),this.areaRatio=e("areaRatio",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.blend=e("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,a=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,o=t.positions,s=i?o:l.mallocFloat32(o.length),u=a?t.idToIndex:l.mallocInt32(n);if(i||s.set(o),!a)for(s.set(o),r=0;r>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),a.attributes.pickId.pointer(o.UNSIGNED_BYTE),a.uniforms.pickOffset=e,this.pickOffset=r);var h=o.getParameter(o.BLEND),d=o.getParameter(o.DITHER);return h&&!this.blend&&o.disable(o.BLEND),d&&o.disable(o.DITHER),o.drawArrays(o.POINTS,0,this.pointCount),h&&!this.blend&&o.enable(o.BLEND),d&&o.enable(o.DITHER),r+this.pointCount}}(),c.draw=c.unifiedDraw,c.drawPick=c.unifiedDraw,c.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":95,"gl-buffer":65,"gl-shader":96,"typedarray-pool":187}],104:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4((posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n",fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4((posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],105:[function(t,e,r){arguments[4][87][0].apply(r,arguments)},{"./lib/GLError":106,"./lib/create-attributes":107,"./lib/create-uniforms":108,"./lib/reflect":109,"./lib/runtime-reflect":110,"./lib/shader-cache":111,dup:87}],106:[function(t,e,r){arguments[4][88][0].apply(r,arguments)},{dup:88}],107:[function(t,e,r){arguments[4][89][0].apply(r,arguments)},{"./GLError":106,dup:89}],108:[function(t,e,r){arguments[4][90][0].apply(r,arguments)},{"./GLError":106,"./reflect":109,dup:90}],109:[function(t,e,r){arguments[4][91][0].apply(r,arguments)},{dup:91}],110:[function(t,e,r){arguments[4][92][0].apply(r,arguments)},{dup:92}],111:[function(t,e,r){arguments[4][93][0].apply(r,arguments)},{"./GLError":106,dup:93,"gl-format-compiler-error":74,"weakmap-shim":194}],112:[function(t,e,r){"use strict";function n(t){if(t in h)return h[t];var e=c(t,{polygons:!0,font:"sans-serif",textAlign:"left",textBaseline:"alphabetic"}),r=[],n=[];e.forEach(function(t){t.forEach(function(t){for(var e=0;e>8*d&255;h.uniforms.pickOffset=o,this.idBuffer.bind(),h.attributes.id.pointer(f.UNSIGNED_BYTE,!1)}else this.colorBuffer.bind(),h.attributes.color.pointer(f.UNSIGNED_BYTE,!0);return this.posHiBuffer.bind(),h.attributes.positionHi.pointer(),this.posLoBuffer.bind(),h.attributes.positionLo.pointer(),this.offsetBuffer.bind(),h.attributes.offset.pointer(),h.uniforms.pixelScale=a,h.uniforms.scaleHi=e,h.uniforms.scaleLo=r,h.uniforms.translateHi=n,h.uniforms.translateLo=i,f.drawArrays(f.TRIANGLES,0,c),l?s+this.numPoints:void 0}}(),d.draw=d.drawPick,d.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;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]]}},d.update=function(t){t=t||{};var e,r,i=t.positions||[],a=t.colors||[],o=t.glyphs||[],s=t.sizes||[],c=t.borderWidths||[],f=t.borderColors||[];this.points=i;var h,d,p=this.bounds=[1/0,1/0,-(1/0),-(1/0)],g=0,v=[],m=[];for(e=0;e>1,r=0;r<2;++r)p[r]=Math.min(p[r],i[2*e+r]),p[2+r]=Math.max(p[2+r],i[2*e+r]);p[0]===p[2]&&(p[2]+=1),p[3]===p[1]&&(p[3]+=1);var y=1/(p[2]-p[0]),b=1/(p[3]-p[1]),x=p[0],_=p[1],w=u.mallocFloat64(2*g),A=u.mallocFloat32(2*g),k=u.mallocFloat32(2*g),M=u.mallocFloat32(2*g),T=u.mallocUint8(4*g),E=u.mallocUint32(g),L=0;for(e=0;et;){var d=r[h-1],p=n[2*(h-1)];if((d-s||l-p)>=0)break;r[h]=d,n[2*h]=p,n[2*h+1]=n[2*h-1],i[h]=i[h-1],a[h]=a[h-1],h-=1}r[h]=s,n[2*h]=l,n[2*h+1]=u,i[h]=c,a[h]=f}}function a(t,e,r,n,i,a){var o=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=a[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,i[e]=u,a[e]=c}function o(t,e,r,n,i,a){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e]}function s(t,e,r,n,i,a,o){var s=n[t],l=i[2*t],u=i[2*t+1],c=a[t],f=o[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],a[t]=a[e],o[t]=o[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],a[e]=a[r],o[e]=o[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,a[r]=c,o[r]=f}function l(t,e,r,n,i,a,o,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=a,c[e]=o}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,a,o,s){return(e-a[t]||o[2*t]-r||i-s[t])<0}function f(t,e,r,n,d,p){var g=(e-t+1)/6|0,v=t+g,m=e-g,y=t+e>>1,b=y-g,x=y+g,_=v,w=b,A=y,k=x,M=m,T=t+1,E=e-1,L=0;u(_,w,r,n,d,p)&&(L=_,_=w,w=L),u(k,M,r,n,d,p)&&(L=k,k=M,M=L),u(_,A,r,n,d,p)&&(L=_,_=A,A=L),u(w,A,r,n,d,p)&&(L=w,w=A,A=L),u(_,k,r,n,d,p)&&(L=_,_=k,k=L),u(A,k,r,n,d,p)&&(L=A,A=k,k=L),u(w,M,r,n,d,p)&&(L=w,w=M,M=L),u(w,A,r,n,d,p)&&(L=w,w=A,A=L),u(k,M,r,n,d,p)&&(L=k,k=M,M=L);var S=r[w],C=n[2*w],R=n[2*w+1],O=d[w],I=p[w],P=r[k],N=n[2*k],D=n[2*k+1],z=d[k],F=p[k],B=_,j=A,U=M,H=v,V=y,q=m,G=r[B],X=r[j],Y=r[U];r[H]=G,r[V]=X,r[q]=Y;for(var W=0;W<2;++W){var Z=n[2*B+W],Q=n[2*j+W],$=n[2*U+W];n[2*H+W]=Z,n[2*V+W]=Q,n[2*q+W]=$}var K=d[B],J=d[j],tt=d[U];d[H]=K,d[V]=J,d[q]=tt;var et=p[B],rt=p[j],nt=p[U];p[H]=et,p[V]=rt,p[q]=nt,o(b,t,r,n,d,p),o(x,e,r,n,d,p);for(var it=T;it<=E;++it)if(c(it,S,C,R,O,r,n,d))it!==T&&a(it,T,r,n,d,p),++T;else if(!c(it,P,N,D,z,r,n,d))for(;;){if(c(E,P,N,D,z,r,n,d)){c(E,S,C,R,O,r,n,d)?(s(it,T,E,r,n,d,p),++T,--E):(a(it,E,r,n,d,p),--E);break}if(--E=Math.max(.9*d,32)){var b=u+s>>>1;l(v,m,f,h,b,c+1),h=b}l(v,m,f,h,y,c+1),h=y}}}var u=t.length>>>1;if(u<1)return[];for(var c=1/0,f=1/0,h=-(1/0),d=-(1/0),p=0;p=0;--_){t[2*_]=(t[2*_]-c)*m,t[2*_+1]=(t[2*_+1]-f)*y;var M=x[_];M!==A&&(w.push(new i(b*Math.pow(.5,M),_+1,k-(_+1))),k=_+1,A=M)}return w.push(new i(b*Math.pow(.5,M+1),0,k)),o.free(x),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=a},{"./lib/sort":115,"typedarray-pool":187}],117:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.plot=t,this.positionBufferHi=e,this.positionBufferLo=r,this.pickBuffer=n,this.weightBuffer=i,this.shader=a,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=o(r),s=o(r),l=o(r),u=o(r),f=a(r,c.pointVertex,c.pointFragment),h=a(r,c.pickVertex,c.pickFragment),d=new n(t,i,s,l,u,f,h);return d.update(e),t.addObject(d),d}var a=t("gl-shader"),o=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var f=n.prototype,h=new Float32Array(2),d=new Float32Array(2),p=new Float32Array(2),g=new Float32Array(2),v=[0,0,0,0];f.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBufferHi.dispose(),this.positionBufferLo.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},f.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords),this.points=t.positions;var r=this.points.length>>>1,n=u.mallocInt32(r),i=u.mallocFloat32(2*r),a=u.mallocFloat64(2*r);a.set(this.points),this.scales=l(a,n,i,this.bounds);var o=u.mallocFloat64(r),s=u.mallocFloat32(2*r),c=u.mallocFloat32(2*r);s.set(a);for(var f=0,h=0;f>8&255,v[2]=t>>16&255,v[3]=t>>24&255,n.uniforms.pickOffset=v,l.bind(),n.attributes.pickId.pointer(m.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());for(var O=this.xCoords,I=(x[0]-u[0]-E*c*y)/_,P=(x[2]-u[0]+E*c*y)/_,N=!0,D=i.length-1;D>=0;D--){var z=i[D];if(!(z.pixelSize1)){var F=z.offset,B=z.count+F,j=s.ge(O,I,F,B-1),U=s.lt(O,P,j,B-1)+1;U>j&&m.drawArrays(m.POINTS,j,U-j),!e&&N&&(N=!1,n.uniforms.useWeight=0)}}return t+this.pointCount},f.drawPick=f.draw,f.pick=function(t,e,r){var n=r-this.pickOffset;return n<0||n>=this.pointCount?null:{object:this,pointId:n,dataCoord:[this.points[2*n],this.points[2*n+1]]}}},{"./lib/shader":113,"binary-search-bounds":114,"gl-buffer":65,"gl-shader":121,"snap-points-2d":116,"typedarray-pool":187}],118:[function(t,e,r){"use strict";r.boxVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n",r.boxFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"},{}],119:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.boxBuffer=e,this.boxShader=r,this.enabled=!0,this.selectBox=[1/0,1/0,-(1/0),-(1/0)],this.borderColor=[0,0,0,1],this.innerFill=!1,this.innerColor=[0,0,0,.25],this.outerFill=!0,this.outerColor=[0,0,0,.5],this.borderWidth=10}function i(t,e){var r=t.gl,i=o(r,[0,0,0,1,1,0,1,1]),l=a(r,s.boxVertex,s.boxFragment),u=new n(t,i,l);return u.update(e),t.addOverlay(u),u}var a=t("gl-shader"),o=t("gl-buffer"),s=t("./lib/shaders");e.exports=i;var l=n.prototype;l.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),i=(this.outerFill,this.outerColor),a=this.borderColor,o=t.box,s=t.screenBox,l=t.dataBox,u=t.viewBox,c=t.pixelRatio,f=(e[0]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],h=(e[1]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1],d=(e[2]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],p=(e[3]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1];if(f=Math.max(f,u[0]),h=Math.max(h,u[1]),d=Math.min(d,u[2]),p=Math.min(p,u[3]),!(d0){var m=r*c;o.drawBox(f-m,h-m,d+m,h+m,a),o.drawBox(f-m,p-m,d+m,p+m,a),o.drawBox(f-m,h-m,f+m,p+m,a),o.drawBox(d-m,h-m,d+m,p+m,a)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":118,"gl-buffer":65,"gl-shader":121}],120:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function a(t,e){var r=o(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=a;var o=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(_inline_55_arg0_<255||_inline_55_arg1_<255||_inline_55_arg2_<255||_inline_55_arg3_<255){var _inline_55_l=_inline_55_arg4_-_inline_55_arg6_[0],_inline_55_a=_inline_55_arg5_-_inline_55_arg6_[1],_inline_55_f=_inline_55_l*_inline_55_l+_inline_55_a*_inline_55_a;_inline_55_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;i=0){for(var k=0|A.type.charAt(A.type.length-1),M=new Array(k),T=0;T=0;)E+=1;_[w]=E}var L=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n) +},d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=a},{"./lib/GLError":122,"./lib/create-attributes":123,"./lib/create-uniforms":124,"./lib/reflect":125,"./lib/runtime-reflect":126,"./lib/shader-cache":127}],122:[function(t,e,r){arguments[4][88][0].apply(r,arguments)},{dup:88}],123:[function(t,e,r){arguments[4][89][0].apply(r,arguments)},{"./GLError":122,dup:89}],124:[function(t,e,r){arguments[4][90][0].apply(r,arguments)},{"./GLError":122,"./reflect":125,dup:90}],125:[function(t,e,r){arguments[4][91][0].apply(r,arguments)},{dup:91}],126:[function(t,e,r){arguments[4][92][0].apply(r,arguments)},{dup:92}],127:[function(t,e,r){arguments[4][93][0].apply(r,arguments)},{"./GLError":122,dup:93,"gl-format-compiler-error":74,"weakmap-shim":194}],128:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}function i(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=i;var a=n.prototype;a.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},a.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,a=i.line,o=i.dataBox,s=i.viewBox;if(a.bind(),o[0]<=n[0]&&n[0]<=o[2]&&o[1]<=n[1]&&n[1]<=o[3]){var l=s[0]+(n[0]-o[0])/(o[2]-o[0])*(s[2]-s[0]),u=s[1]+(n[1]-o[1])/(o[3]-o[1])*(s[3]-s[1]);t[0]&&a.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&a.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&a.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&a.drawLine(l,u,l,s[3],e[3],r[3])}},a.dispose=function(){this.plot.removeOverlay(this)}},{}],129:[function(t,e,r){"use strict";function n(t){v=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],m=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],y=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function i(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(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 a(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}function o(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,a,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var f=0,h=0,v=o(c,l.stride.slice());"float32"===u?f=t.FLOAT:"float64"===u?(f=t.FLOAT,v=!1,u="float32"):"uint8"===u?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,v=!1,u="uint8");var m=1;if(2===c.length)h=t.LUMINANCE,c=[c[0],c[1],1],l=d(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])h=t.ALPHA;else if(2===c[2])h=t.LUMINANCE_ALPHA;else if(3===c[2])h=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");h=t.RGBA}m=c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(h=i),h!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,x=s.indexOf(n)<0;if(x&&s.push(n),f===a&&v)0===l.offset&&l.data.length===y?x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data):x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var _;_=a===t.FLOAT?g.mallocFloat32(y):g.mallocUint8(y);var w=d(_,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&a===t.UNSIGNED_BYTE?b(w,l):p.assign(w,l),x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,_.subarray(0,y)),a===t.FLOAT?g.freeFloat32(_):g.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var o=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>o||r<0||r>o)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new a(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new a(t,i,0|e.width,0|e.height,r,n)}function f(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=o(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=d(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var f,h,v=e.size;if(s)f=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var m=[n[2],n[2]*n[0],1];h=g.malloc(v,r);var y=d(h,n,m,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?p.assign(y,e):b(y,e),f=h.subarray(0,v)}var x=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,f),s||g.free(h),new a(t,x,n[0],n[1],c,u)}function h(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(v||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return f(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var d=t("ndarray"),p=t("ndarray-ops"),g=t("typedarray-pool");e.exports=h;var v=null,m=null,y=null,b=function(t,e){p.muls(t,e,255)},x=a.prototype;Object.defineProperties(x,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=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(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t|=0,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,i(this,this._shape[0],t),t}}}),x.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},x.dispose=function(){this.gl.deleteTexture(this.handle)},x.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},x.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var a=this._mipLevels.indexOf(n)<0;a?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:148,"ndarray-ops":147,"typedarray-pool":187}],130:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function R(){return/[^a-fA-F0-9]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function O(){return"."===N?(U.push(N),j=v,D=N,F+1):/[eE]/.test(N)?(U.push(N),j=v,D=N,F+1):"x"===N&&1===U.length&&"0"===U[0]?(j=w,U.push(N),D=N,F+1):/[^\d]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function I(){return"f"===N&&(U.push(N),D=N,F+=1),/[eE]/.test(N)?(U.push(N),D=N,F+1):"-"===N&&/[eE]/.test(D)?(U.push(N),D=N,F+1):/[^\d]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function P(){if(/[^\d\w_]/.test(N)){var t=U.join("");return j=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:m,e(U.join("")),j=u,F}return U.push(N),D=N,F+1}var N,D,z,F=0,B=0,j=u,U=[],H=[],V=1,q=0,G=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return H=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var i=t("./lib/literals"),a=t("./lib/operators"),o=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,f=0,h=1,d=2,p=3,g=4,v=5,m=6,y=7,b=8,x=9,_=10,w=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":133,"./lib/builtins-300es":132,"./lib/literals":135,"./lib/literals-300es":134,"./lib/operators":136}],132:[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":133}],133:[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"]},{}],134:[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":135}],135:[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"]},{}],136:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],137:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":131}],138:[function(t,e,r){r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=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=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),e*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):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+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],139:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function a(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),a(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],a=[],o=[],s=[],r=0;r3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=m.ge(this.leftPoints,t,h),n=m.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var a=this.left?this.left.count:0;if(4*a>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var o=this,l=this.left;l.right;)o=l,l=l.right;if(o===this)l.right=this.right;else{var u=this.left,n=this.right;o.count-=l.count,o.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var u=m.ge(this.leftPoints,t,h);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===x&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},w.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":28}],140:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;r0)return 1<=0)return 1<=0;--e)S(e,0);for(var r=[],e=0;e0;_=_-1&g)x.push(w+"["+T+"+"+v(_)+"]");x.push(m(0));for(var _=0;_0){",h(x[t]),"=1;"),P(t-1,e|1<0&&G.push(s(U,x[H-1])+"*"+o(x[H-1])),B.push(d(U,x[H])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)X.push(o(x[U]));B.push(M+"=("+X.join("*")+")|0",A+"=mallocUint32("+M+")",w+"=mallocUint32("+M+")",T+"=0"),B.push(p(0)+"=0");for(var H=1;H<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 a=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return b(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",A="P",k="N",M="Q",T="X",E="T"},{"typedarray-pool":187}],147:[function(t,e,r){"use strict";function n(t){if(!t)return s;for(var e=0;e>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=a({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]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,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=o({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=o({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=o({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=a({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=a({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=o({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":51}],148:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;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("+u.join(",")+",v){"),n?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var v=0;v=0){d=i"+v+"|0;b+=c"+v+"*d;a"+v+"-=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var v=0;v=0){c=(c+this.stride["+v+"]*i"+v+")|0}else{a.push(this.shape["+v+"]);b.push(this.stride["+v+"])}");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,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",a.join("\n"));return o(f[t],i)}function o(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=f.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),a=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":56}],150:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r="undefined"!=typeof r?r+"":" ",n(r,e)+t}},{"repeat-string":163}],151:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],152:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return a.freeUint32(l),a.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,a,o=1;for(r[0]=0,a=1;a0;--a)n=e/o|0,e=e-n*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}var a=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":140,"typedarray-pool":187}],154:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,s,l,c=0;c<2;++c)if(u[c][n].length>0){o=u[c][n][0],l=c;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=u[f][n],d=0;d0&&(o=p,s=g,l=f)}return a?s:(o&&r(o,l),s)}function a(t,a){var o=u[a][t][0],s=[t];r(o,a);for(var l=o[1^a];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],f=t,h=s[1],d=n(c,f,!0);if(i(e[c],e[f],e[h],e[d])<0)break;s.push(t),l=n(c,f)}return s}function o(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;c0;){var g=(u[0][c].length,a(c,d));o(p,g)?p.push.apply(p,g):(p.length>0&&h.push(p),p=g)}p.length>0&&h.push(p)}return h}e.exports=n;var i=t("compare-angle")},{"compare-angle":49}],155:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function a(t){for(var e=t.length,r=0;r0;){var U=B.pop(),H=O[U];f(H,function(t,e){return t-e});var V,q=H.length,G=j[U];if(0===G){var T=m[U];V=[T]}for(var v=0;v=0)&&(j[X]=1^G,B.push(X),0===G)){var T=m[X];a(T)||(T.reverse(),V.push(T))}}0===G&&d.push(V)}return d}e.exports=a;var o=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),f=t("uniq"),h=t("./lib/trim-leaves")},{"./lib/trim-leaves":155,"edges-to-adjacency-list":58,"planar-dual":154,"point-in-big-polygon":157,"robust-sum":170,"two-product":185,uniq:189}],157:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return!!i&&!!i.queryPoint(r,n)}}function a(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var o=i.key,s=f(r,o[0],o[1]);if(o[0][0]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))return 0;a=1,i=i.right}}return a}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;i1)for(var r=1;ra.length&&e>0&&(1&e&&(a+=t),e>>=1);)t+=t;return a.substr(0,r)}var i,a="";e.exports=n},{}],164:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;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=m*n;return o>=s||o<=-s?o:b(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],u=r[1]-n[1],c=t[2]-n[2],f=e[2]-n[2],h=r[2]-n[2],d=a*u,p=o*l,g=o*s,v=i*u,m=i*l,b=a*s,_=c*(d-p)+f*(g-v)+h*(m-b),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(m)+Math.abs(b))*Math.abs(h),A=y*w;return _>A||-_>A?_:x(t,e,r,n)}];c()},{"robust-scale":167,"robust-subtract":169,"robust-sum":170,"two-product":185}],166:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return a(e,t[0]);if(1===e.length)return a(t,e[0]);if(0===t.length||0===e.length)return[0]; +var r=[0];if(t.length0&&s>0||o<0&&s<0)return!1;var l=a(r,t,e),u=a(i,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,i))}e.exports=i;var a=t("robust-orientation")[3]},{"robust-orientation":165}],169:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],v=h(g);p=i?(a=d,c+=1,c=i?(a=d,c+=1,c0?1:0}},{}],172:[function(t,e,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],173:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,i=t.length;n>1,s=o(t[a],e);s<=0?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function f(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[g],a))break}return r}function h(t,e){if(!e)return f(u(p(t,0)),t,0);for(var r=new Array(e),n=0;n>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){var n=s(r);if(e0){var t=M[0];return a(0,L-1),L-=1,u(0),t}return-1}function h(t,e){var r=M[t];return b[r]===e?t:(b[r]=-(1/0),c(t),f(),b[r]=e,L+=1,c(L-1))}function d(t){if(!x[t]){x[t]=!0;var e=m[t],r=y[t];m[r]>=0&&(m[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&h(T[e],i(e)),T[r]>=0&&h(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||i<0||i===n)break;if(n=i,i=t[n],!x[n]||i<0||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var g=e.length,v=t.length,m=new Array(g),y=new Array(g),b=new Array(g),x=new Array(g),_=0;_>1;_>=0;--_)u(_);for(;;){var S=f();if(S<0||b[S]>r)break;d(S)}for(var C=[],_=0;_=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&R.push([n,i])}}),o.unique(o.normalize(R)),{positions:C,edges:R}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":165,"simplicial-complex":173}],176:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return ol?i-l:o-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=a(r,i,s),u=a(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;if(l=a(s,o,i),u=a(s,o,r),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]}e.exports=i;var a=t("robust-orientation")},{"robust-orientation":165}],177:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=a(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=a(t.right,e);if(l)return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;a0){var s=a(this.slabs[e-1],t);s&&(o?h(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(o){var p=f(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":176,"binary-search-bounds":28,"functional-red-black-tree":62,"robust-orientation":165}],178:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function a(t,e){return Array(e+1).join(t)}var o={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,f,h,d=1,p=t.length,g="",v=[],m=!0,y="";for(s=0;s=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?v[v.length]=n:(!o.number.test(u[8])||m&&!u[3]?y="":(y=m?"+":"-",n=n.toString().replace(o.sign,"")),f=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",h=u[6]-(y+n).length,c=u[6]&&h>0?a(f,h):"",v[v.length]=u[5]?y+n+c:"0"===f?y+c+n:c+y+n)}return v.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],179:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],180:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128===0){f.length>0&&h.push("}}");var d="vExtra"+f.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(M="+"+v[x]+"*c");var T=.5*(p[x].length/y),E=.5+.5*(m[x]/y);k.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+M+")/("+g[x].join("+")+")")}h.push("a.push([",k.join(),"]);","break;")}n.push("}},"),f.length>0&&h.push("}}");for(var L=[],u=0;u<1<0&&(h+=.02);for(var p=new Float32Array(f),g=0,v=-.5*h,d=0;d.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=L(t,360),e=L(e,100),r=L(r,100),0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,i,a=G(t,e,r),o=q(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function M(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){R(t)&&(t="100%");var n=O(t);return t=q(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function S(t){return q(1,G(0,t))}function C(t){return parseInt(t,16)}function R(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function O(t){return"string"==typeof t&&t.indexOf("%")!=-1}function I(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function N(t){return e.round(255*parseFloat(t)).toString(16)}function D(t){return C(t)/255}function z(t){return!!Z.CSS_UNIT.exec(t)}function F(t){t=t.replace(j,"").replace(U,"").toLowerCase();var e=!1;if(Y[t])t=Y[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Z.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),a:D(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),a:D(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.hex3.exec(t))&&{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),format:e?"name":"hex"}}function B(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var j=/^\s+/,U=/\s+$/,H=0,V=e.round,q=e.min,G=e.max,X=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=E(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*L(this._r,255))+"%",g:V(100*L(this._g,255))+"%",b:V(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*L(this._r,255))+"%, "+V(100*L(this._g,255))+"%, "+V(100*L(this._b,255))+"%)":"rgba("+V(100*L(this._r,255))+"%, "+V(100*L(this._g,255))+"%, "+V(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(W[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,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(k,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=P(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return n(s)},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=B(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},n.mostReadable=function(t,e,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var Y=n.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"},W=n.hexNames=T(Y),Z=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],183:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":151}],184:[function(t,e,r){"use strict";function n(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(o(t+1)),r=[],n=0;n0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function f(t){return new Int16Array(o(2*t),0,t)}function h(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return x?new Uint8ClampedArray(o(t),0,t):s(t)}function v(t){return new DataView(o(t),0,t)}function m(t){t=y.nextPow2(t);var e=y.log2(t),r=A[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,A=_.BUFFER;r.free=function(t){if(n.isBuffer(t))A[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){A[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return f(t);case"int32":return h(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return m(t);case"data":case"dataview":return v(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=f,r.mallocInt32=h,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=v,r.mallocBuffer=m,r.clearCache=function(){for(var t=0;t<32;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,A[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":29,buffer:38,dup:57}],188:[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;e8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height= 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":51}],197:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":196}],198:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("opacity"),u("align"),u("bgcolor");var f=u("bordercolor"),h=i.opacity(f);u("borderpad");var d=u("borderwidth"),p=u("showarrow");u("text",p?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font);for(var g=["x","y"],v=[-10,-30],m={_fullLayout:r},y=0;y<2;y++){var b=g[y],x=a.coerceRef(t,e,m,b,"","paper");if(a.coercePosition(e,m,u,x,b,.5),p){var _="a"+b,w=a.coerceRef(t,e,m,_,"pixel");"pixel"!==w&&w!==x&&(w=e[_]="pixel");var A="pixel"===w?v[y]:.4;a.coercePosition(e,m,u,w,_,A)}else u(b+"anchor")}return n.noneOrAll(t,e,["x","y"]),p&&(u("arrowcolor",h?e.bordercolor:i.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(h&&d||1)),n.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":303,"../../plots/cartesian/axes":333,"../color":207,"./attributes":200}],199:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],200:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":298,"../../plots/cartesian/constants":338,"../../plots/font_attributes":353,"./arrow_paths":199}],201:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,f=s-l,h=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),f=Math.max(f,d),h=Math.max(h,d)}r&&r.autorange&&a.expand(r,[r.l2c(r.r2l(e.x))],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(n.r2l(e.y))],{ppadplus:h,ppadminus:f})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":303,"../../plots/cartesian/axes":333,"./draw":203}],202:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),i=t("./annotation_defaults");e.exports=function(t,e){var r={name:"annotations",handleItemDefaults:i};n(t,e,r)}},{"../../plots/array_container_defaults":330,"./annotation_defaults":198}],203:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=$.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,m=Math.round(u+2*tt),y=Math.round(p+2*tt);q._w=u,q._h=p;var x=!1;if(["x","y"].forEach(function(e){var n,i=q[e+"ref"]||e,a=f.getFromId(t,i),o=(W+("x"===e?0:90))*Math.PI/180,s=m*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=q[e+"anchor"];if(a){var u=a.r2fraction(q[e]);if(!a.autorange&&(u<0||u>1)&&(q["a"+e+"ref"]===i?(u=a.r2fraction(q["a"+e]),(u<0||u>1)&&(x=!0)):x=!0,x))return;Y[e]=a._offset+a.r2p(q[e]),n=.5}else n=q[e],"y"===e&&(n=1-n),Y[e]="x"===e?R.l+R.w*n:R.t+R.h*n;var c=0;q["a"+e+"ref"]===i?Y["aa"+e]=a._offset+a.r2p(q["a"+e]):(c=q.showarrow?q["a"+e]:s*r(n,l),Y[e]+=c),q["_"+e+"type"]=a&&a.type,q["_"+e+"size"]=s,q["_"+e+"shift"]=c}),x)return void $.remove();var _,w;q.showarrow&&(_=q.axref===q.xref?Y.x:c.constrain(Y.x-q.ax,1,k.width-1),w=q.ayref===q.yref?Y.y:c.constrain(Y.y-q.ay,1,k.height-1)),Y.x=c.constrain(Y.x,1,k.width-1),Y.y=c.constrain(Y.y,1,k.height-1);var A=tt-s.top,M=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:M,y:A}),nt.selectAll("tspan.line").attr({y:A,x:M})),et.call(d.setRect,K/2,K/2,m-K,y-K);var T=0,E=0;T=q.axref===q.xref?Math.round(Y.aax-m/2):Math.round(Y.x-m/2),E=q.ayref===q.yref?Math.round(Y.aay-y/2):Math.round(Y.y-y/2),$.call(c.setTranslate,T,E);var L="annotations["+e+"]",S=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=q.axref===q.xref?Y.aax+r:Y.x+r,s=q.ayref===q.yref?Y.aay+n:Y.y+n;var u=c.rotationXYMatrix(W,i,s),f=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,m=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!m.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){m.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=q.arrowwidth,x=q.arrowcolor,A=Z.append("g").style({opacity:h.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=A.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(h.stroke,h.rgb(x));b(k,q.arrowhead,"end",q.arrowsize);var M=A.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,S;v.init({element:M.node(),prepFn:function(){var t=c.getTranslate($);E=t.x,S=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){A.attr("transform","translate("+t+","+e+")");var r=f(E,S),n=r[0]+t,i=r[1]+e;$.call(c.setTranslate,n,i),T[L+".x"]=G?G.p2r(G.r2p(q.x)+t):(_+t-R.l)/R.w,T[L+".y"]=X?X.p2r(X.r2p(q.y)+e):1-(w+e-R.t)/R.h,q.axref===q.xref&&(T[L+".ax"]=G?G.p2r(G.r2p(q.ax)+t):(_+t-R.l)/R.w),q.ayref===q.yref&&(T[L+".ay"]=X?X.p2r(X.r2p(q.ay)+e):1-(w+e-R.t)/R.h),Q.attr({transform:"rotate("+W+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};q.showarrow&&S(0,0);var C=c.rotationXYMatrix(W,Y.x,Y.y),O=c.apply2DTransform(C);if(t._context.editable){var I,P,N;v.init({element:$.node(),prepFn:function(){var t=c.getTranslate($);I=t.x,P=t.y,N={}},moveFn:function(t,e){$.call(c.setTranslate,I+t,P+e);var r="pointer";if(q.showarrow)q.axref===q.xref?N[L+".ax"]=G.p2r(G.r2p(q.ax)+t):N[L+".ax"]=q.ax+t,q.ayref===q.yref?N[L+".ay"]=X.p2r(X.r2p(q.ay)+e):N[L+".ay"]=q.ay+e,S(t,e);else{if(G)N[L+".x"]=q.x+t/G._m;else{var n=q._xsize/R.w,i=q.x+q._xshift/R.w-n/2;N[L+".x"]=v.align(i+t/R.w,n,0,1,q.xanchor)}if(X)N[L+".y"]=q.y+e/X._m;else{var a=q._ysize/R.h,o=q.y-q._yshift/R.h-a/2;N[L+".y"]=v.align(o-e/R.h,a,0,1,q.yanchor)}G&&X||(r=v.getCursor(G?.5:N[L+".x"],X?.5:N[L+".y"],q.xanchor,q.yanchor))}var s=O(I,P),l=s[0]+t,u=s[1]+e;$.call(c.setTranslate,I+t,P+e),Q.attr({transform:"rotate("+W+","+l+","+u+")"}),g($,r)},doneFn:function(e){if(g($),e){l.relayout(t,N);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,A=t.layout,k=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return A.annotations=u,y(A,k),void n(t);if("remove"===u)return delete A.annotations,k.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)k._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}k._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=A.annotations[e],E=k.annotations[e];if(T){var L={};"string"==typeof r&&r?L[r]=u:c.isPlainObject(r)&&(L=r);var S=Object.keys(L);for(w=0;w4/3&&(z=H)}}else D&&(B&&(z<1/3?z+=U:z>2/3&&(z-=U)),z=(z-D.domain[0])/(D.domain[1]-D.domain[0]),z=D.fraction2r(z))}D&&D===N&&F&&("log"===F&&"log"!==D.type?z=Math.pow(10,z):"log"!==F&&"log"===D.type&&(z=z>0?Math.log(z)/Math.LN10:void 0)),T[P]=z}}var q={};m(T,q,k),k.annotations[e]=q;var G=f.getFromId(t,q.xref),X=f.getFromId(t,q.yref),Y={x:0,y:0},W=+q.textangle||0,Z=k._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",q.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:q})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),K=q.borderwidth,J=q.borderpad,tt=K+J,et=$.append("rect").attr("class","bg").style("stroke-width",K+"px").call(h.stroke,q.bordercolor).call(h.fill,q.bgcolor),rt=q.font,nt=$.append("text").classed("annotation",!0).attr("data-unformatted",q.text).text(q.text);t._context.editable?nt.call(p.makeEditable,$).call(x).on("edit",function(r){q.text=r,this.attr({"data-unformatted":q.text}),this.call(x);var n={};n["annotations["+e+"].text"]=q.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(x),Q.attr({transform:"rotate("+W+","+Y.x+","+Y.y+")"}).call(d.setPosition,Y.x,Y.y)}}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,f=n-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var g=(u*d-c*h)/p,v=(u*f-l*h)/p;return v<0||v>1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./annotation_defaults"),y=t("./defaults"),b=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":303,"../../lib/setcursor":313,"../../lib/svg_text_utils":317,"../../plotly":328,"../../plots/cartesian/axes":333,"../../plots/plots":361,"../color":207,"../dragelement":228,"../drawing":230,"./annotation_defaults":198,"./defaults":202,"./draw_arrow_head":204,d3:55,"fast-isnumeric":61}],204:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var f,h,d,p,g=(o.getPx(t,"stroke-width")||1)*l,v=t.style("stroke")||a.defaultLine,m=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=c.backoff*g;if("line"===u.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},h={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(f.y-h.y,f.x-h.x),p=d+Math.PI,x){var _=x*Math.cos(d),w=x*Math.sin(d);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),b&&(h.x+=_,h.y+=w,t.attr({x2:h.x,y2:h.y}))}}else if("path"===u.nodeName){var A=u.getTotalLength(),k="";if(y){var M=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(M.y-T.y,M.x-T.x),f=u.getPointAtLength(Math.min(x,A)),x&&(k="0px,"+x+"px,")}if(b){var E=u.getPointAtLength(A),L=u.getPointAtLength(A-.1);if(p=Math.atan2(E.y-L.y,E.x-L.x),h=u.getPointAtLength(Math.max(0,A-x)),x){var S=k?2*x:x;k+=A-S+"px,"+A+"px"}}else k&&(k+=A+"px");k&&t.style("stroke-dasharray",k)}var C=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:v,opacity:m,"stroke-width":0})};y&&C(f,d),b&&C(h,p)}}},{"../color":207,"../drawing":230,"./arrow_paths":199,d3:55,"fast-isnumeric":61}],205:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":200,"./calc_autorange":201,"./defaults":202,"./draw":203}],206:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],207:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(C);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?L[0]:(C[e]+C[e-1])/2,e===C.length-1?L[1]:(C[e]+C[e+1])/2].map(J.c2p).map(Math.round);e!==C.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=O(t).replace("e-",""),o=i(a).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 h=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){n.select(this).attr("d","M"+Y+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+j).call(d.lineGroupStyle,_.line.width,R(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=Y+j+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));A("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:M.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,i=x();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(a,r||{}))}function k(){var r=j+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(z=ot.select("text"),z.node()&&!z.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-Y-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-$;at.select(".cbbg").attr({x:Y-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:Y,y:$+_.ypad+("top"===_.titleside?st:0),width:Math.max(j,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var M=t._fullLayout,T=M._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void M._infolayer.selectAll("g."+e).remove();var E,L=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],C=[],R="function"==typeof _.line.color?_.line.color:function(){return _.line.color},O="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},I=_.levels.end+_.levels.size/100,P=_.levels.size,N=1.001*L[0]-.001*L[1],D=1.001*L[1]-.001*L[0];for(E=_.levels.start;(E-I)*P<0;E+=P)E>N&&EL[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+V-X],J.setScale();var at=M._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+q)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+V-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,A(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ft=c.syncOrAsync([o.previousPromises,w,o.previousPromises,k],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var ht,dt,pt;u.init({element:at.node(),prepFn:function(){ht=at.attr("transform"),h(at)},moveFn:function(t,e){at.attr("transform",ht+" translate("+t+","+e+")"),dt=u.align(W+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,V,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);h(at,r)},doneFn:function(e){h(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},x().index)}})}return ft}function x(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":303,"./flip_scale":218,"./scales":225}],214:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":298,"./attributes":212,"./scales.js":225}],215:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":225}],216:[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,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,g=f?i.nestedProperty(e,d).get()||{}:e,v=p[h+"min"],m=p[h+"max"],y=p.colorscale,b=n(v)&&n(m)&&v=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],219:[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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):e}},{"./default_scale":215,"./is_valid_scale_array":223,"./scales":225}],220:[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(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],227:[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":303}],228:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,g=o.getPlotDiv(t.element)||{},v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":303,"../../plotly":328,"../../plots/cartesian/constants":338,"./align":226,"./cursor":227,"./unhover":229}],229:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":297}],230:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,f,h;t.so?(h=o.outlierwidth,f=o.outliercolor,c=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(h||1)+"px",fill:"none"}):(e.style("stroke-width",h+"px").call(l.fill,c),h&&e.call(l.stroke,f))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),f=(c*c*i-u*u*s)*n,h=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&f/d),2),a.round(e[1]+(d&&h/d),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&h/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var v=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=g.tryColorscale(i,""),s=g.tryColorscale(i,"line");n(t,e,r,o,s,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),i=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,a.select(this),e,n,i)})}},g.tryColorscale=function(t,e){var r=e?c.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):c.identity};var b={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(f.convertToTspans);var h=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*x+1,v=b[l]*c,m=.75*u+b[s]*c+(b[s]-1)*p*u/2;h.attr("transform","translate("+v+","+m+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=M&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":291,"../../lib":303,"../../lib/svg_text_utils":317,"../../registry":368,"../../traces/scatter/make_bubble_size_func":422,"../../traces/scatter/subtypes":427,"../color":207,"../colorscale":221,"./symbol_defs":231,d3:55,"fast-isnumeric":61}],231:[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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:55}],232:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],233:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),f=0;f0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);c&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;f="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");s=!v.size(),s?v=e.append("path").classed("yerror",!0):c&&(v=v.transition().duration(r.duration).ease(r.easing)),v.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var m=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-m)+"v"+2*m+"m0,-"+m+"H"+o.xs,o.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":427,d3:55,"fast-isnumeric":61}],238:[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":207,d3:55}],239:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":338}],240:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}var o=n("source"),l=n("visible",!!o);if(!l)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var u={_fullLayout:r},c=["x","y"],f=0;f<2;f++)a.coerceRef(t,e,u,c[f],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var r={name:l,handleItemDefaults:n};o(t,e,r)}},{"../../lib":303,"../../plots/array_container_defaults":330,"../../plots/cartesian/axes":333,"./attributes":239}],241:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,f=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,h=c*d.x[e.xanchor].offset,p=f*d.y[e.yanchor].offset,g=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,v=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+h,m=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:v,y:m,width:c,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=o?o._id:"",b=l?l._id:"",x=y+b;x&&r.call(i.setClipUrl,"clip"+s._uid+x)}for(var s=t._fullLayout,l=[],u=[],c=[],f=0;f=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}},{}],244:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":298,"../../plots/font_attributes":353,"../color/attributes":206}],245:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],246:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(b!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",v),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":303,"../../plots/layout_attributes":359,"../../registry":368,"./attributes":244,"./helpers":249}],247:[function(t,e,r){"use strict";function n(t,e){function r(r){m.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?f.call(m.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=r.indexOf(f);h===-1?r.push(f):r.splice(h,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;r=s*h,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cn.width-(n.margin.r+n.margin.l)&&(b=0,v+=m,i.height=i.height+m,m=0),f.setTranslate(this,a+b,5+a+e.height/2+v),i.width+=o+r,i.height=Math.max(i.height,e.height),b+=o+r,m=Math.max(e.height,m)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),b=t("./get_legend_data"),x=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(g.setRect,B,t,y.scrollBarWidth,y.scrollBarHeight),M.select("rect").attr({y:m.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var m=r.legend,_=r.showlegend&&b(t.calcdata,m),A=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var k=r._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var M=r._topdefs.selectAll("#"+a).data([0]);M.enter().append("clipPath").attr("id",a).append("rect");var T=k.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var E=k.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=k.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=E.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var C=S.selectAll("g.traces").data(f.identity);C.enter().append("g").attr("class","traces"),C.exit().remove(),C.call(x).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?A.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var R=0!==k.enter().size();R&&(o(t,S,C),s(t));var O=0,I=r.width,P=0,N=r.height;o(t,S,C),m.height>N?l(t):s(t);var D=r._size,z=D.l+D.w*m.x,F=D.t+D.h*(1-m.y);w.isRightAnchor(m)?z-=m.width:w.isCenterAnchor(m)&&(z-=m.width/2),w.isBottomAnchor(m)?F-=m.height:w.isMiddleAnchor(m)&&(F-=m.height/2);var B=m.width,j=D.w;B>j?(z=D.l,B=j):(z+B>I&&(z=I-B),zH?(F=D.t,U=H):(F+U>N&&(F=N-U),Fr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":303,"../../registry":368,"../../traces/pie/style_one":401,"../../traces/scatter/subtypes":427,"../color":207,"../drawing":230,d3:55}],252:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(v,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",o.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":303,"../color":207,"./attributes":256,"./button_attributes":257,"./constants":258}],260:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},i=S.line.width?S.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",S.opacity).call(_.stroke,i).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);C&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+C),t._context.editable&&f(t,a,S,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:b.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>Y&&!t.shiftKey?A.getCursor(i/r,1-a/n):"move";k(e,o),G=o.split("-")[0]}function a(e){B=x.getFromId(t,r.xref),j=x.getFromId(t,r.yref),U=T.getDataToPixel(t,B),H=T.getDataToPixel(t,j,!0),V=T.getPixelToData(t,B),q=T.getPixelToData(t,j,!0);var a="shapes["+n+"]";"path"===r.type?(z=r.path,F=a+".path"):(c=U(r.x0),f=H(r.y0),h=U(r.x1),d=H(r.y1),g=a+".x0",m=a+".y0",b=a+".x1",_=a+".y1"),cY&&(u[S]=r[I]=q(s),u[C]=r[P]=q(l)),f-c>X&&(u[R]=r[N]=V(c),u[O]=r[D]=V(f))}e.attr("d",p(t,r))}var u,c,f,h,d,g,m,b,_,w,M,E,L,S,C,R,O,I,P,N,D,z,F,B,j,U,H,V,q,G,X=10,Y=10,W={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=W.element.getBoundingClientRect();A.init(W)}function h(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):b.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=x.getFromId(t,r.id,"x")._id,i=x.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=x.getFromId(t,e.xref),l=x.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),f=n(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z"; +var p=(c+f)/2,v=(h+d)/2,m=Math.abs(p-c),y=Math.abs(v-h),b="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(M.segmentRE,function(t){var n=0,i=t.charAt(0),a=M.paramIsX[i],o=M.paramIsY[i],s=M.numParams[i],l=t.substr(1).replace(M.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),b.log("Ignoring extra params in segment "+t)),i+l})}function v(t,e,r){return t.replace(M.segmentRE,function(t){var n=0,i=t.charAt(0),a=M.paramIsX[i],o=M.paramIsY[i],s=M.numParams[i],l=t.substr(1).replace(M.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var m=t("fast-isnumeric"),y=t("../../plotly"),b=t("../../lib"),x=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),A=t("../dragelement"),k=t("../../lib/setcursor"),M=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),L=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":303,"../../lib/setcursor":313,"../../plotly":328,"../../plots/cartesian/axes":333,"../color":207,"../dragelement":228,"../drawing":230,"./constants":270,"./defaults":271,"./helpers":273,"./shape_defaults":275,"fast-isnumeric":61}],273:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],274:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":268,"./calc_autorange":269,"./defaults":271,"./draw":272}],275:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var f=t.path?"path":"rect",h=u("type",f),d=["x","y"],p=0;p<2;p++){var g=d[p],v={_fullLayout:r},m=i.coerceRef(t,e,v,g,"","paper");if("path"!==h){var y,b,x,_=.25,w=.75;"paper"!==m?(y=i.getFromId(v,m),x=o.rangeToShapePosition(y),b=o.shapePositionToRange(y)):b=x=n.identity;var A=g+"0",k=g+"1",M=t[A],T=t[k];t[A]=b(t[A],!0),t[k]=b(t[k],!0),i.coercePosition(e,v,u,m,A,_),i.coercePosition(e,v,u,m,k,w),e[A]=x(e[A]),e[k]=x(e[k]),t[A]=M,t[k]=T}}return"path"===h?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":303,"../../plots/cartesian/axes":333,"./attributes":268,"./helpers":273}],276:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":298,"../../plots/animation_attributes":329,"../../plots/font_attributes":353,"../../plots/pad_attributes":360,"./constants":277}],277:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],278:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+S.railTouchRectClass).data([0]);n.enter().append("rect").classed(S.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,S.tickOffset+r.ticklen+r.labelHeight)}).call(M.fill,r.bgcolor).attr("opacity",0),k.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+S.railRectClass).data([0]);r.enter().append("rect").classed(S.railRectClass,!0);var n=e.inputAreaLength-2*S.railInset;r.attr({width:n,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(r,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+S.groupClassName).data(r,i);l.enter().append("g").classed(S.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,L=!0,S=R,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,k=g.titlefont.family,M=g.titlefont.size,T=g.titlefont.color,E=1,L=!1,S=g.title.trim();""===S&&(E=0),S.match(/Click to enter .+ title/)&&(E=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var R="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?a.restyle(t,v,e,m):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":303,"../../lib/svg_text_utils":317,"../../plotly":328,"../../plots/plots":361,"../color":207,"../drawing":230,d3:55,"fast-isnumeric":61}],282:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":298,"../../plots/font_attributes":353,"../../plots/pad_attributes":360,"../color/attributes":206}],283:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],284:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var f=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){b.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],291:[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}},{}],292:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":205,"./components/images":242,"./components/legend":250,"./components/rangeselector":262,"./components/rangeslider":267,"./components/shapes":274,"./components/sliders":280,"./components/updatemenus":286,"./fonts/mathjax_config":293,"./lib/queue":311,"./plot_api/plot_schema":322,"./plot_api/register":323,"./plot_api/set_plot_config":324,"./plot_api/to_image":326,"./plot_api/validate":327,"./plotly":328,"./snapshot":373,"./snapshot/download":370,"./traces/scatter":417,d3:55,"es6-promise":59}],293:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]] +}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],294:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":289,"fast-isnumeric":61}],295:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var v=(new Date).getFullYear();e=((Number(u[0])-v+70)%100+200)%100+v-70}if(!a(e))return l;var m=new Date(0,0,1);if(m.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(m.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(m.setDate(i),m.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(m.setHours(o),m.getHours()!==o)return l;if(u.length>1)return i=m.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=f*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return m.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,v=3*c,m=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":294,"./coerce":295,"./dates":296,"./extend":298,"./filter_unique":299,"./filter_visible":300,"./is_array":304,"./is_plain_object":305,"./loggers":306,"./matrix":307,"./nested_property":308,"./notifier":309,"./search":312,"./stats":315,d3:55}],304:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],305:[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}},{}],306:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,h(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;uMath.max(c,g)||l>Math.max(f,v)))if(lc||Math.abs(n(o,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":307}],311:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;f90&&l.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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":61}],316:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:10,tinycolor2:182}],317:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,v.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math", +d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":290,"../constants/xmlns_namespaces":291,"../lib":303,d3:55}],318:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0&&u.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);var i=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lR.range[0]?[1,2]:[2,1]);else{var O=R.range[0],I=R.range[1];"log"===x?(O<=0&&I<=0&&r(E+".autorange",!0),O<=0?O=I/1e6:I<=0&&(I=O/1e6),r(E+".range[0]",Math.log(O)/Math.LN10),r(E+".range[1]",Math.log(I)/Math.LN10)):(r(E+".range[0]",Math.pow(10,O)),r(E+".range[1]",Math.pow(10,I)))}else r(E+".autorange",!0)}if("reverse"===M)L.range?L.range.reverse():(r(E+".autorange",!0),L.range=[1,0]),S.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var P=m.parts[1],N=m.parts[0],D=a[N]||[],z=D[P]||{};2===m.parts.length&&(null===x&&(e[v]="remove"),"add"===e[v]||b.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?P===-1?(g[N]=D,delete g[v]):g[v]=z:b.log("???",e)),!n(z,"x")&&!n(z,"y")||b.containsAny(v,["color","opacity","align","dash"])||(d.docalc=!0);var F=w.getComponentMethod(N,"drawOne");F(t,P,m.parts.slice(2).join("."),e[v]),delete e[v]}else if(A.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1])C.manageArrayContainers(m,x,g),d.doplot=!0;else{var B=String(m.parts[1]||"");0===m.parts[0].indexOf("scene")?d.doplot=!0:0===m.parts[0].indexOf("geo")?d.doplot=!0:0===m.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===v?d.doplot=!0:!o._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?d.docalc=!0:m.parts[0].indexOf("legend")!==-1?d.dolegend=!0:v.indexOf("title")!==-1?d.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&b.containsAny(B,["tick","exponent","grid","zeroline"])?d.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:m.parts.length>1&&B.indexOf("line")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&"mirror"===B?d.doticks=d.dolayoutstyle=!0:"margin.pad"===v?d.doticks=d.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(d.doplot=!0):d.doplot=!0,m.set(x)}}}var j=t._fullLayout.width,U=t._fullLayout.height;A.supplyDefaults(t),t.layout.autosize&&A.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==j||t._fullLayout.height!==U;return H&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:b.extendDeep({},p)}}function g(t){var e=v.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];v.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=b.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(L.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),b=t("../lib"),x=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),A=t("../plots/plots"),k=t("../plots/cartesian/graph_interact"),M=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),L=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),C=t("./helpers"),R=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=O._basePlotModules,r=0;r=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=C.getGraphDiv(t),!b.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=A.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function g(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var v,m,y=0,x=[],_=void 0===e||null===e,w=Array.isArray(e),k=!_&&!w&&b.isPlainObject(e);if(k)x.push({type:"object",data:g(b.extendFlat({},e))});else if(_||"string"==typeof e)for(v=0;v0&&EE)&&L.push(m);x=L}}x.length>0?f(x):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=C.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!b.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:A.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),A.modifyFrames(t,a)},y.purge=function(t){t=C.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return A.cleanPlot([],{},r,e),A.purge(t),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":230,"../components/errorbars":236,"../constants/xmlns_namespaces":291,"../lib":303,"../lib/events":297,"../lib/queue":311,"../lib/svg_text_utils":317,"../plotly":328,"../plots/cartesian/graph_interact":340,"../plots/plots":361,"../plots/polar":364,"../registry":368,"./helpers":319,"./subroutines":325,d3:55,"fast-isnumeric":61}],321:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],322:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};_(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return _(t,g),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)c(t,r,"xaxis"),c(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;c(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){f(t,r,e+r.name)}):f(t,r,r.name))}),{layoutAttributes:o(t)}}function a(t){var e=h.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):t.arrayOk===!0&&(i[n+"src"]=e(n)):d.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function l(t){function e(t,e,r){if(t){var n=t[A];n&&(delete t[A],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return x(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),x(t,b.layout),t}function c(t,e,r){var n=d.nestedProperty(t,r),i=_({},e.layoutAttributes);i[w]=!0,n.set(i)}function f(t,e,r){var n=d.nestedProperty(t,r),i=_(n.get()||{},e.layoutAttributes);n.set(i)}var h=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),m=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),x=d.extendFlat,_=d.extendDeep,w="_isSubplotObj",A="_isLinkedToArray",k="_deprecated",M=[w,A,k];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=A,r.DEPRECATED=k,r.UNDERSCORE_ATTRS=M,r.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:M.concat.role},traces:t,layout:i(),transforms:e,frames:o(v),animation:o(m)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];M.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||d.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){a=a.slice(0,s).concat([r]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=n(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":303,"../plotly":328,"../snapshot/cloneplot":369,"../snapshot/helpers":372,"../snapshot/svgtoimg":374,"../snapshot/tosvg":376,"fast-isnumeric":61}],327:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;mc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=C&&i<=10||e>=15*C)t._tickround="d";else if(e>=O&&i<=16||e>=R)t._tickround="M";else if(e>=I&&i<=19||e>=O)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(b(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);b(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(W),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(W,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(b(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=H(c):"m"===l?a=V(c):"d"===l?(r||(i="
"+H(c)),a=q(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=Y(c),"S"!==l&&(a+=h(y.round(m(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=q(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&m(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,m(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},P.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===i){var g=n-1,v=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,v)]:[g,v]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r.map(t.l2r||Number)},P.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=P.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},P.saveRangeInitial=function(t,e){for(var r=P.list(t,"",!0),n=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=v-1;a>5;a--)i(a)}},P.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},P.autoTicks(f,s);var h,d=P.tickIncrement(P.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*x||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&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),a(t),t._tmin=P.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=P.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),f=0;fL?(e/=L,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,D)):n>S?(e/=S,t.dtick="M"+i(e,1,z)):n>C?(t.dtick=i(e,C,B),t.tick0="2000-01-02"):n>R?t.dtick=i(e,R,z):n>O?t.dtick=i(e,O,F):n>I?t.dtick=i(e,I,F):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,D))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,D)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,D));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},P.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?U:j,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},P.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]a:f1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],335:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),f=[],h=0;h0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],338:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],339:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),b=t("./constants"),x=!0;e.exports=function(t,e,r,s,_,w,A,k){function M(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+vt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+vt+")").attr("d","M0,0Z"),L()}function L(){pt.selectAll(".select-outline").remove()}function S(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(V,e+at)),i=Math.max(0,Math.min(q,r+ot)),a=Math.abs(n-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,X)/2);st.l=Math.min(at,n),st.r=Math.max(at,n),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!J||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function C(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),x=!1)))}function O(e,r){var i=1===(A+k).length;if(e)z();else if(2!==r||i){if(1===r&&i){var a=A?H[0]:U[0],o="s"===A||"w"===k?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",f="middle";if(a.fixedrange)return;A?(f="n"===A?"top":"bottom","right"===a.side&&(c="right")):"e"===k&&(c="right"),rt.call(h.makeEditable,null,{immediate:!0,background:B.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&u.relayout(t,s,r)})}}else D()}function I(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||B._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void f.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=mt[0]+mt[2]*l,c=(s.bottom-e.clientY)/s.height,h=mt[1]+mt[3]*(1-c);if(k){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222)); +}function a(t,e,r){for(var n,a,o=1-e,s=0;s0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nW.width||Y<0||Y>W.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:k[0]._length/2,Y="ypx"in e?e.ypx:M[0]._length/2;if(R="xval"in e?n(a,e.xval):i(k,X),O="yval"in e?n(a,e.yval):i(M,Y),!g(R[0])||!g(O[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(P=0;P1||D.hoverinfo.indexOf("name")!==-1?D.name:void 0,index:!1,distance:Math.min(Z,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[z]&&(H.subplot=o[z]._subplot),V=q.length,"array"===B){var Q=e[P];"pointNumber"in Q?(H.index=Q.pointNumber,B="closest"):(B="","xval"in Q&&(j=Q.xval,B="x"),"yval"in Q&&(U=Q.yval,B=B?"closest":"y"))}else j=R[F],U=O[F];if(D._module&&D._module.hoverPoints){var $=D._module.hoverPoints(H,j,U,B);if($)for(var K,J=0;J<$.length;J++)K=$[J],g(K.x0)&&g(K.y0)&&q.push(l(K,C))}else v.log("Unrecognized trace type in hover:",D);"closest"===C&&q.length>V&&(q.splice(0,V),Z=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var tt="y"===C&&G.length>1;q.sort(function(t,e){return t.distance-e.distance});var et=b.combine(o.plot_bgcolor||b.background,o.paper_bgcolor),rt={hovermode:C,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(q,rt);c(q,tt?"xa":"ya"),f(nt,tt);var it=t._hoverdata,at=[];for(I=0;I128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):M&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0;r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0),v=h.node().getBoundingClientRect().width+2*I):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,T=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),R=Math.abs(t.y1-t.y0),P=T.width+O+I+v;t.ty0=_-T.top,t.bx=T.width+2*I,t.by=T.height+2*I,t.anchor="start",t.txwidth=T.width,t.tx2width=v,t.offset=0,a?(t.pos=L,m=S+R/2+P<=k,A=S-R/2-P>=0,"top"!==t.idealAlign&&m||!A?m?(S+=R/2,t.anchor="start"):t.anchor="middle":(S-=R/2,t.anchor="end")):(t.pos=S,m=L+C/2+P<=w,A=L-C/2-P>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(a?"rotate("+E+")":""))}),S}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?S:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var v=f[o];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(O+I),s=o+a*(t.txwidth+I),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-R,l=t.offset*C),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*O+l)+","+(O+u)+"v"+(t.by/2-O)+"h"+n*t.bx+"v-"+t.by+"H"+(n*O+l)+"V"+(u-O)+"Z"),i.call(x.setPosition,o+l,u+t.ty0-t.by/2+I).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+a*I+l,u+t.ty0-t.by/2+I),r.select("rect").call(x.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),k=t("./dragbox"),M=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,M,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=T.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":303,"fast-isnumeric":61}],346:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,k=i.xaxes[0]._length,M=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,R,O,I,P,N=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),D=[],z=i.gd,F=[];for(C=0;C0)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*f*Math.abs(n-i))}return l}function r(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var f=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?r:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,o=t[e],l=(t._id||"x").charAt(0);if(n="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,n=n.slice(),!o||2!==o.length)return void(t[e]=n);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),r=0;r<2;r++)if("date"===t.type){if(!a.isDateTime(o[r])){t[e]=n;break}if(o[r]a.MAX_MS&&(o[r]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[r])){if(!i(o[1-r])){t[e]=n;break}o[r]=o[1-r]*(r?10:.1)}if(o[r]<-s?o[r]=-s:o[r]>s&&(o[r]=s),o[0]===o[1]){var f=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=f,o[1]+=f}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?l:r},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var f=c.charAt(0),h=c.substr(1);h=n(h)?Number(h):0,(h<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],351:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(t){var e,r,n,i,a,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,b.push(s),o[s]=a}return o}function f(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=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[u]?r[u].to:f,a=r[c]?r[c].to:h,f[0]===i[0]&&f[1]===i[1]&&h[0]===a[0]&&h[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function h(e,r){function n(e,r){for(i=0;ir.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,b=[],x=c(e),_=Object.keys(x),w=f(y,_,x);if(!w.length)return!1;var A;u&&(A=u());var k,M,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),k=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":303,"../../plotly":328,"../../registry":368,"./axes":333,d3:55}],352:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;ff[d+2]&&(f[d]=-1,f[d+2]=1),h=this[m[d]],h._length=o.viewBox[d+2]-o.viewBox[d],s.doAutoRange(h);o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},y.calcDataBox=function(){var t=this.xaxis,e=this.yaxis,r=t.range,n=e.range,i=t.r2l,a=e.r2l;return[i(r[0]),a(n[0]),i(r[1]),a(n[1])]},y.setRanges=function(t){var e=this.xaxis,r=this.yaxis,n=e.l2r,i=r.l2r;e.range=[n(t[0]),n(t[2])],r.range=[i(t[1]),i(t[3])]},y.updateTraces=function(t,e){var r,n,i,a=Object.keys(this.traces);this.fullData=t;t:for(r=0;r=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"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,f=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=f)}else{p.supplyLayoutGlobalDefaults(a,n);var h=!a.width||!a.height,d=n.autosize,g=t._context&&t._context.autosizable,v=h&&(d||g);v?p.plotAutoSize(t,a,n):h&&p.sanitizeMargins(t),!d&&h&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,n),n._has=p._hasPlotType.bind(n);var m=n._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),f=c.left+c.right,d=c.bottom+c.top,g=1-2*o,v=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(v.width-f)),i=Math.round(g*(v.height-d))}else{var m=l?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,i=parseFloat(m.height)||r.height}var y=p.layoutAttributes.width.min,b=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-i)>1;(_||x)&&(x&&(r.width=n),_&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a;c.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(i=0;i.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,f=r.size,h=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(f*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(f-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var v=l[t].t.val,m=l[t].t.size;if(v>h){var y=(d*v+(m-e.height)*h)/(v-h),b=(m*(1-h)+(d-e.height)*(1-v))/(v-h);y>=0&&b>=0&&y+b>s+o&&(s=y,o=b)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):h.isJSDate(t)?h.ms2DateTime(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)},p.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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,S=L?f.angularAxis.domain:n.extent(k),C=Math.abs(k[1]-k[0]);T&&!M&&(C=0);var R=S.slice();E&&M&&(R[1]+=C);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(R[1]-R[0])/O);var I=f.angularAxis.ticksStep||(R[1]-R[0])/(O*(f.minorTicks+1));A&&(I=Math.max(Math.round(I),1)),R[2]||(R[2]=I);var P=n.range.apply(this,R);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(R.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?C:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var N="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",D=(new DOMParser).parseFromString(N,"application/xml"),z=this.appendChild(this.ownerDocument.importNode(D.documentElement,!0));e=n.select(z)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,B=e.select(".chart-group"),j={fill:"none",stroke:f.tickColor},U={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var H=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();b=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,b=Math.max(10,b),_=[f.margin.left+b,f.margin.top+b],i.range([0,b]),c.layout.radialAxis.domain=i.domain(),F.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),B.attr("transform","translate("+_+")").style({cursor:"crosshair"});var q=[(f.width-(f.margin.left+f.margin.right+2*b+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2];if(q[0]=Math.max(0,q[0]),q[1]=Math.max(0,q[1]),e.select(".outer-group").attr("transform","translate("+q+")"),f.title){var G=e.select("g.title-group text").style(U).text(f.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var Y=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(i.ticks(5));W.enter().append("circle").attr({class:"grid-circle"}).style(j),W.attr("r",i),W.exit().remove()}Y.select("circle.outside-circle").attr({r:b}).style(j);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=n.svg.axis().scale(i).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Y.selectAll(".domain").style(j),Y.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),K=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),K.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(j),K.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(U);var J=$.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+f.labelOffset,i=f.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:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":A?A[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(U);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(B.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[b+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!M){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});B.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;ot=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ct.text(o.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});B.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=i.invert(o.util.getMousePos(Z).radius);var n=o.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(o.util.round(st)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var i=n.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};M&&(u.t=A[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-q[0]-h.left,f.top+f.height/2-q[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.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")})})}),h}var e,r,i,s,l={data:[],layout:{}},u={},c={},f=n.dispatch("hover"),h={};return h.render=function(e){return t(e),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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return i},h.angularScale=function(t){return s},h.svg=function(){return e},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,i=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return i},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("undefined"==typeof 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 r===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=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 s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:h(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,i,a)},"stroke-width":function(t,e){return v["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,i,a)},opacity:function(t,e){return v.opacity(r,i,a)},display:function(t,e){return v.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var v={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},m=n.select(this).selectAll("g.layer").data(l);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],i=n.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=n.merge(i);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,f=c?r.height:u*o.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.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"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(o.length),v=n.scale[c?"linear":"ordinal"]().domain(g).range(l),m=n.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,m(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return v(e)}}),x.exit().remove()}var _=n.svg.axis().scale(m).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var n=t.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(f);var h=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[i.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=i.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};n.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../lib":303,d3:55}],366:[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,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(f=i),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(r),a.config(c).render(f),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,i,a,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},u.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":207,"../../lib":303,"./micropolar":365,"./undo_manager":367,d3:55}],367:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,u=t.layout,c=l([],a),f=l({},u,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(r=0;r1;if(p&&!h&&"category"!==a.type){var g=e.length;if(!(g<=i))return f?e.slice(0,i):e.slice(0,i+1);if(f||d)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;ly;n++)o=l(t,e,a(o));return o>y&&f.log("interp2d didn't converge quickly",o),t}function s(t){var e,r,n,i,a,o,s,l,u=[],c={},f=[],h=t[0],d=[],p=[0,0,0],g=m(t);for(r=0;r=0;a--)i=f[a],r=i[0],n=i[1],o=((c[[r-1,n]]||p)[2]+(c[[r+1,n]]||p)[2]+(c[[r,n-1]]||p)[2]+(c[[r,n+1]]||p)[2])/20,o&&(s[i]=[r,n,o],f.splice(a,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,a,o,s,l,u,c,f,h,d,p,g,v=0;for(o=0;op&&(v=Math.max(v,Math.abs(t[i][a]-d)/(g-p))))}return v}var u=t("fast-isnumeric"),c=t("../../registry"),f=t("../../lib"),h=t("../../plots/cartesian/axes"),d=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),v=t("./convert_column_xyz"),m=t("./max_row_length");e.exports=function(t,e){function r(t){L=e._input.zsmooth=e.zsmooth=!1,f.notifier("cannot fast-zsmooth: "+t)}var a,l,u,y,b,x,_,w,A=h.getFromId(t,e.xaxis||"x"),k=h.getFromId(t,e.yaxis||"y"),M=c.traceIs(e,"contour"),T=c.traceIs(e,"histogram"),E=c.traceIs(e,"gl2d"),L=M?"best":e.zsmooth;if(A._minDtick=0,k._minDtick=0,T){var S=d(t,e);a=S.x,l=S.x0,u=S.dx,y=S.y,b=S.y0,x=S.dy,_=S.z}else g(e)&&v(e,A,k),a=e.x?A.makeCalcdata(e,"x"):[],y=e.y?k.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,b=e.y0||0,x=e.dy||1,_=n(e),(M||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=o(_,e._emptypoints,e._interpz));if("fast"===L)if("log"===A.type||"log"===k.type)r("log axis found");else if(!T){if(a.length){var C=(a[a.length-1]-a[0])/(a.length-1),R=Math.abs(C/100);for(w=0;wR){r("x scale is not linear");break}}if(y.length&&"fast"===L){var O=(y[y.length-1]-y[0])/(y.length-1),I=Math.abs(O/100);for(w=0;wI){r("y scale is not linear");break}}}var P=m(_),N="scaled"===e.xtype?"":a,D=i(e,N,l,u,P,A),z="scaled"===e.ytype?"":y,F=i(e,z,b,x,_.length,k);E||(h.expand(A,D),h.expand(k,F));var B={x:D,y:F,z:_};if(p(e,_,"","z"),M&&e.contours&&"heatmap"===e.contours.coloring){var j="contour"===e.type?"heatmap":"histogram2d";B.xfill=i(j,N,l,u,P,A),B.yfill=i(j,z,b,x,_.length,k)}return[B]};var y=.01,b=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":213,"../../lib":303,"../../plots/cartesian/axes":333,"../../registry":368,"../histogram2d/calc":400,"./convert_column_xyz":388,"./has_columns":390,"./max_row_length":391,"fast-isnumeric":61}],387:[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="cb"+r.uid,u=r.zmin,c=r.zmax;if(n(u)||(u=i.aggNums(Math.min,null,r.z)),n(c)||(c=i.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void a.autoMargin(t,l);var f=e[0].t.cb=s(t,l),h=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});f.fillcolor(h).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":210,"../../components/colorscale":221,"../../lib":303,"../../plots/plots":361,"fast-isnumeric":61}],388:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a=t.x.slice(),o=t.y.slice(),s=t.z,l=t.text,u=Math.min(a.length,o.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(u0&&(n=!0);for(var s=0;sa)return r[t]=a,a-r[t]}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]0?Number(f):c;else if("string"!=typeof f)l.size=c;else{var h=f.charAt(0),d=f.substr(1);d=n(d)?Number(d):0,(d<=0||"date"!==o||"M"!==h||d!==Math.round(d))&&(l.size=c)}var p="autobin"+r;"boolean"!=typeof t[p]&&(t[p]=!((l.start||0===l.start)&&(l.end||0===l.end))),t[p]||delete t["nbins"+r]}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],399:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;iy&&g.splice(y,g.length-y),m.length>y&&m.splice(y,m.length-y),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(g,p,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start=p.c2r(i.tickIncrement(p.r2c(e.xbins.start),e.xbins.size,!0)),e.xbins.end=p.c2r(i.tickIncrement(p.r2c(e.xbins.end),e.xbins.size))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(m,v,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start=v.c2r(i.tickIncrement(v.r2c(e.ybins.start),e.ybins.size,!0)),e.ybins.end=v.c2r(i.tickIncrement(v.r2c(e.ybins.end),e.ybins.size))),e._input.ybins=e.ybins),h=[];var b,x,_=[],w=[],A="string"==typeof e.xbins.size?[]:e.xbins,k="string"==typeof e.xbins.size?[]:e.ybins,M=0,T=[],E=e.histnorm,L=e.histfunc,S=E.indexOf("density")!==-1,C="max"===L||"min"===L,R=C?null:0,O=a.count,I=o[E],P=!1,N=[],D=[],z="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";z&&"count"!==L&&(P="avg"===L,O=a[L]);var F=e.xbins,B=p.r2c(F.start),j=p.r2c(F.end)+(B-i.tickIncrement(B,F.size))/1e6;for(d=B;d=0&&b=0&&x>>1,f)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);if(h)r=h;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var p=o(t.marker.color),g=o(t.marker.border.color),v=t.opacity*t.marker.opacity;p[3]*=v,this.pointcloudOptions.color=p;var m=t.marker.blend;if(null===m){var y=100;m=l.lengthp&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var m={type:"linear"};i.setConvert(m),l=m.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},g.ppad=v.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,i.expand(c,h,g),i.expand(f,d,v);var x=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],410:[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,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=i.aggNums(Math.min,null,c)),n(h)||(h=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":210,"../../components/colorscale":221,"../../lib":303,"../../plots/plots":361,"fast-isnumeric":61}],411:[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":213,"../../components/colorscale/has_colorscale":220,"./subtypes":427}],412:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],413:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var v=s(t,e,g),m=vU!=I>=U&&(C=L[T-1][0],R=L[T][0],S=C+(R-C)*(U-O)/(I-O),z=Math.min(z,S),F=Math.max(F,S));z=Math.max(z,0),F=Math.min(F,h._length);var H=l.defaultLine;return l.opacity(f.fillcolor)?H=f.fillcolor:l.opacity((f.line||{}).color)&&(H=f.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:z,x1:F,y0:U,y1:U,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":207,"../../components/errorbars":236,"../../lib":303,"../../plots/cartesian/constants":338,"../../plots/cartesian/graph_interact":340,"./get_trace_color":415}],417:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":341,"./arrays_to_calcdata":406,"./attributes":407,"./calc":408,"./clean_data":409,"./colorbar":410,"./defaults":413,"./hover":416,"./plot":424,"./select":425,"./style":426,"./subtypes":427}],418:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":216,"../../components/colorscale/has_colorscale":220 +}],419:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),i=A.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/w._length,r=t[1]/A._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w=e.xaxis,A=e.yaxis,k=e.simplify,M=e.connectGaps,T=e.baseTolerance,E=e.linear,L=[],S=.2,C=new Array(t.length),R=0;for(k||(T=S=-1),o=0;oi(f))break;l=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,u=f,d=!1):y=t.length||!f)break;C[R++]=f,s=f}}else C[R++]=u}L.push(C.slice(0,R))}return L}},{"../../constants/numerical":289}],420:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],421:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":61}],423:[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){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":207,"../../components/colorscale/defaults":216,"../../components/colorscale/has_colorscale":220,"./subtypes":427}],424:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function i(t,e,r,n,i,d,g){function v(t){return k?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function b(t){if(t.ids)return y}function x(){return!1}function _(t){var e,r,n=t[0].trace,i=o.select(this),a=c.hasMarkers(n),u=c.hasText(n),f=b(n),h=x,d=x;a&&(h=n.marker.maxdisplayed?m:s.identity),u&&(d=n.marker.maxdisplayed?m:s.identity),r=i.selectAll("path.point"),e=r.data(h,f);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,n).call(l.translatePoints,M,T,n),k&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=v(o.select(this));l.translatePoint(t,e,M,T),l.singlePointStyle(t,e,n)}),k?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=i.selectAll("g"),e=r.data(d,f),e.enter().append("g").append("text"),e.each(function(t){var e=v(o.select(this).select("text"));l.translatePoint(t,e,M,T)}),e.selectAll("text").call(l.textPointStyle,n).each(function(t){var e=t.xp||M.c2p(t.x),r=t.yp||T.c2p(t.y);o.select(this).selectAll("tspan").each(function(){v(o.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,A;a(t,e,r,n,i);var k=!!g&&g.duration>0,M=r.xaxis,T=r.yaxis,E=n[0].trace,L=E.line,S=o.select(d);if(S.call(u.plot,r,g),E.visible===!0){v(S).style("opacity",E.opacity);var C,R,O=E.fill.charAt(E.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=S,f(n);var I="",P=[],N=E._prevtrace;N&&(I=N._prevRevpath||"",R=N._nextFill,P=N._polygons);var D,z,F,B,j,U,H,V,q,G="",X="",Y=[],W=[],Z=s.noop;if(C=E._ownFill,c.hasLines(E)||"none"!==E.fill){for(R&&R.datum(n),["hv","vh","hvh","vhv"].indexOf(L.shape)!==-1?(F=l.steps(L.shape),B=l.steps(L.shape.split("").reverse().join(""))):F=B="spline"===L.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),L.smoothing):l.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},j=function(t){return B(t.reverse())},Y=h(n,{xaxis:M,yaxis:T,connectGaps:E.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),q=E._polygons=new Array(Y.length),A=0;A1}),Z=function(t){return function(e){if(D=F(e),z=j(e),G?O?(G+="L"+D.substr(1),X=z+("L"+X.substr(1))):(G+="Z"+D,X=z+"Z"+X):(G=D,X=z),c.hasLines(E)&&e.length>1){var r=o.select(this);if(r.datum(n),t)v(r.style("opacity",0).attr("d",D).call(l.lineGroupStyle)).style("opacity",1);else{var i=v(r);i.attr("d",D),l.singleLineStyle(n,i)}}}}}var Q=S.selectAll(".js-line").data(W);v(Q.exit()).style("opacity",0).remove(),Q.each(Z(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Z(!0)),Y.length&&(C?U&&V&&(O?("y"===O?U[1]=V[1]=T.c2p(0,!0):"x"===O&&(U[0]=V[0]=M.c2p(0,!0)),v(C).attr("d","M"+V+"L"+U+"L"+G.substr(1))):v(C).attr("d",G+"Z")):"tonext"===E.fill.substr(0,6)&&G&&I&&("tonext"===E.fill?v(R).attr("d",G+"Z"+I+"Z"):v(R).attr("d",G+"L"+I.substr(1)+"Z"),E._polygons=E._polygons.concat(P)),E._prevRevpath=X,E._prevPolygons=q);var $=S.selectAll(".points");w=$.data([n]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,s=r.yaxis,l=o.extent(a.range.map(a.r2l).map(a.l2c)),u=o.extent(s.range.map(s.r2l).map(s.l2c)),f=n[0].trace;if(c.hasMarkers(f)){var h=f.marker.maxdisplayed;if(0!==h){var d=n.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/h),g=0;i.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),f=c.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,r),n(t,p),l=0,u=[];ln?1:-1}),v){s&&(h=s());var m=o.transition().duration(a.duration).ease(a.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()});m.each(function(){p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)})})}else p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":230,"../../components/errorbars":236,"../../lib":303,"../../lib/polygon":310,"./arrays_to_calcdata":406,"./line_points":419,"./link_traces":421,"./subtypes":427,d3:55}],425:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,g=!n.hasMarkers(h)&&!n.hasText(h);if(h.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r=e.length?i:e[a]);return n}function o(t,e,r){return l(R(t,r),C(e,r),r)}function s(t,e,r,n){var i=w(t,e,n);return i=Array.isArray(i[0])?i:a(v.identity,[i],n),l(i,C(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;i paper // first convert to fraction of the axis - position = (position - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + position = axOld.r2fraction(position); // next scale the axis to the whole plot position = axOld.domain[0] + @@ -47355,8 +47354,7 @@ function drawOne(gd, index, opt, value) { (axNew.domain[1] - axNew.domain[0]); // finally convert to data coordinates - position = axNew.range[0] + - position * (axNew.range[1] - axNew.range[0]); + position = axNew.fraction2r(position); } } @@ -47373,7 +47371,8 @@ function drawOne(gd, index, opt, value) { optionsIn[axLetter] = position; } - var options = handleAnnotationDefaults(optionsIn, fullLayout); + var options = {}; + handleAnnotationDefaults(optionsIn, options, fullLayout); fullLayout.annotations[index] = options; var xa = Axes.getFromId(gd, options.xref), @@ -47487,20 +47486,21 @@ function drawOne(gd, index, opt, value) { // outside the visible plot (as long as the axis // isn't autoranged - then we need to draw it // anyway to get its bounding box) - if(!ax.autorange && ((options[axLetter] - ax.range[0]) * - (options[axLetter] - ax.range[1]) > 0)) { + var posFraction = ax.r2fraction(options[axLetter]); + if(!ax.autorange && (posFraction < 0 || posFraction > 1)) { if(options['a' + axLetter + 'ref'] === axRef) { - if((options['a' + axLetter] - ax.range[0]) * - (options['a' + axLetter] - ax.range[1]) > 0) { + posFraction = ax.r2fraction(options['a' + axLetter]); + if(posFraction < 0 || posFraction > 1) { annotationIsOffscreen = true; } - } else { + } + else { annotationIsOffscreen = true; } if(annotationIsOffscreen) return; } - annPosPx[axLetter] = ax._offset + ax.l2p(options[axLetter]); + annPosPx[axLetter] = ax._offset + ax.r2p(options[axLetter]); alignPosition = 0.5; } else { @@ -47513,7 +47513,7 @@ function drawOne(gd, index, opt, value) { var alignShift = 0; if(options['a' + axLetter + 'ref'] === axRef) { - annPosPx['aa' + axLetter] = ax._offset + ax.l2p(options['a' + axLetter]); + annPosPx['aa' + axLetter] = ax._offset + ax.r2p(options['a' + axLetter]); } else { if(options.showarrow) { alignShift = options['a' + axLetter]; @@ -47713,22 +47713,22 @@ function drawOne(gd, index, opt, value) { ann.call(Lib.setTranslate, xcenter, ycenter); update[annbase + '.x'] = xa ? - (options.x + dx / xa._m) : + xa.p2r(xa.r2p(options.x) + dx) : ((arrowX + dx - gs.l) / gs.w); update[annbase + '.y'] = ya ? - (options.y + dy / ya._m) : + ya.p2r(ya.r2p(options.y) + dy) : (1 - ((arrowY + dy - gs.t) / gs.h)); if(options.axref === options.xref) { update[annbase + '.ax'] = xa ? - (options.ax + dx / xa._m) : - ((arrowX + dx - gs.l) / gs.w); + xa.p2r(xa.r2p(options.ax) + dx) : + ((arrowX + dx - gs.l) / gs.w); } if(options.ayref === options.yref) { update[annbase + '.ay'] = ya ? - (options.ay + dy / ya._m) : - (1 - ((arrowY + dy - gs.t) / gs.h)); + ya.p2r(ya.r2p(options.ay) + dy) : + (1 - ((arrowY + dy - gs.t) / gs.h)); } anng.attr({ @@ -47774,13 +47774,13 @@ function drawOne(gd, index, opt, value) { var csr = 'pointer'; if(options.showarrow) { if(options.axref === options.xref) { - update[annbase + '.ax'] = xa.p2l(xa.l2p(options.ax) + dx); + update[annbase + '.ax'] = xa.p2r(xa.r2p(options.ax) + dx); } else { update[annbase + '.ax'] = options.ax + dx; } if(options.ayref === options.yref) { - update[annbase + '.ay'] = ya.p2l(ya.l2p(options.ay) + dy); + update[annbase + '.ay'] = ya.p2r(ya.r2p(options.ay) + dy); } else { update[annbase + '.ay'] = options.ay + dy; } @@ -47886,7 +47886,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":362,"../../lib/setcursor":372,"../../lib/svg_text_utils":376,"../../plotly":386,"../../plots/cartesian/axes":390,"../../plots/plots":428,"../color":268,"../dragelement":290,"../drawing":292,"./annotation_defaults":259,"./defaults":263,"./draw_arrow_head":265,"d3":74,"fast-isnumeric":82}],265:[function(require,module,exports){ +},{"../../lib":364,"../../lib/setcursor":374,"../../lib/svg_text_utils":378,"../../plotly":388,"../../plots/cartesian/axes":393,"../../plots/plots":430,"../color":268,"../dragelement":289,"../drawing":291,"./annotation_defaults":259,"./defaults":263,"./draw_arrow_head":265,"d3":74,"fast-isnumeric":82}],265:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48005,7 +48005,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { if(doEnd) drawhead(end, endRot); }; -},{"../color":268,"../drawing":292,"./arrow_paths":260,"d3":74,"fast-isnumeric":82}],266:[function(require,module,exports){ +},{"../color":268,"../drawing":291,"./arrow_paths":260,"d3":74,"fast-isnumeric":82}],266:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48017,33 +48017,21 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { 'use strict'; -var Plotly = require('../../plotly'); - -exports.moduleType = 'component'; - -exports.name = 'annotations'; - -exports.ARROWPATHS = require('./arrow_paths'); - -exports.layoutAttributes = require('./attributes'); - -exports.supplyLayoutDefaults = require('./defaults'); - -exports.calcAutorange = require('./calc_autorange'); - -exports.arrowhead = require('./draw_arrow_head'); - var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; -exports.add = function(gd) { - var nextAnn = gd._fullLayout.annotations.length; +module.exports = { + moduleType: 'component', + name: 'annotations', + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), - Plotly.relayout(gd, 'annotations[' + nextAnn + ']', 'add'); + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne }; -},{"../../plotly":386,"./arrow_paths":260,"./attributes":261,"./calc_autorange":262,"./defaults":263,"./draw":264,"./draw_arrow_head":265}],267:[function(require,module,exports){ +},{"./attributes":261,"./calc_autorange":262,"./defaults":263,"./draw":264}],267:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48396,7 +48384,7 @@ module.exports = { } }; -},{"../../lib/extend":358,"../../plots/cartesian/layout_attributes":400,"../../plots/font_attributes":411}],270:[function(require,module,exports){ +},{"../../lib/extend":359,"../../plots/cartesian/layout_attributes":402,"../../plots/font_attributes":413}],270:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48463,7 +48451,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":362,"../../plots/cartesian/tick_label_defaults":406,"../../plots/cartesian/tick_mark_defaults":407,"../../plots/cartesian/tick_value_defaults":408,"./attributes":269}],271:[function(require,module,exports){ +},{"../../lib":364,"../../plots/cartesian/tick_label_defaults":408,"../../plots/cartesian/tick_mark_defaults":409,"../../plots/cartesian/tick_value_defaults":410,"./attributes":269}],271:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49095,7 +49083,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":362,"../../lib/extend":358,"../../lib/setcursor":372,"../../plotly":386,"../../plots/cartesian/axes":390,"../../plots/cartesian/axis_defaults":392,"../../plots/cartesian/layout_attributes":400,"../../plots/cartesian/position_defaults":403,"../../plots/plots":428,"../../registry":436,"../color":268,"../dragelement":290,"../drawing":292,"../titles":343,"./attributes":269,"d3":74,"tinycolor2":241}],272:[function(require,module,exports){ +},{"../../lib":364,"../../lib/extend":359,"../../lib/setcursor":374,"../../plotly":388,"../../plots/cartesian/axes":393,"../../plots/cartesian/axis_defaults":395,"../../plots/cartesian/layout_attributes":402,"../../plots/cartesian/position_defaults":405,"../../plots/plots":430,"../../registry":438,"../color":268,"../dragelement":289,"../drawing":291,"../titles":342,"./attributes":269,"d3":74,"tinycolor2":241}],272:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49114,28 +49102,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":362}],273:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -exports.attributes = require('./attributes'); - -exports.supplyDefaults = require('./defaults'); - -exports.draw = require('./draw'); - -exports.hasColorbar = require('./has_colorbar'); - -},{"./attributes":269,"./defaults":270,"./draw":271,"./has_colorbar":272}],274:[function(require,module,exports){ +},{"../../lib":364}],273:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49190,7 +49157,7 @@ module.exports = { } }; -},{}],275:[function(require,module,exports){ +},{}],274:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49256,7 +49223,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":362,"./flip_scale":280,"./scales":287}],276:[function(require,module,exports){ +},{"../../lib":364,"./flip_scale":279,"./scales":286}],275:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49300,7 +49267,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":358,"./attributes":274,"./scales.js":287}],277:[function(require,module,exports){ +},{"../../lib/extend":359,"./attributes":273,"./scales.js":286}],276:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49316,7 +49283,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":287}],278:[function(require,module,exports){ +},{"./scales":286}],277:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49380,7 +49347,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":362,"../colorbar/defaults":270,"../colorbar/has_colorbar":272,"./flip_scale":280,"./is_valid_scale":284,"fast-isnumeric":82}],279:[function(require,module,exports){ +},{"../../lib":364,"../colorbar/defaults":270,"../colorbar/has_colorbar":272,"./flip_scale":279,"./is_valid_scale":283,"fast-isnumeric":82}],278:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49417,7 +49384,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],280:[function(require,module,exports){ +},{}],279:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49442,7 +49409,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],281:[function(require,module,exports){ +},{}],280:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49482,7 +49449,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":277,"./is_valid_scale_array":285,"./scales":287}],282:[function(require,module,exports){ +},{"./default_scale":276,"./is_valid_scale_array":284,"./scales":286}],281:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49528,7 +49495,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":362,"./is_valid_scale":284,"fast-isnumeric":82}],283:[function(require,module,exports){ +},{"../../lib":364,"./is_valid_scale":283,"fast-isnumeric":82}],282:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49562,7 +49529,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":274,"./calc":275,"./default_scale":277,"./defaults":278,"./extract_scale":279,"./flip_scale":280,"./get_scale":281,"./has_colorscale":282,"./is_valid_scale":284,"./make_color_scale_func":286,"./scales":287}],284:[function(require,module,exports){ +},{"./attributes":273,"./calc":274,"./default_scale":276,"./defaults":277,"./extract_scale":278,"./flip_scale":279,"./get_scale":280,"./has_colorscale":281,"./is_valid_scale":283,"./make_color_scale_func":285,"./scales":286}],283:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49583,7 +49550,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":285,"./scales":287}],285:[function(require,module,exports){ +},{"./is_valid_scale_array":284,"./scales":286}],284:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49620,7 +49587,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":241}],286:[function(require,module,exports){ +},{"tinycolor2":241}],285:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49716,7 +49683,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":268,"d3":74,"fast-isnumeric":82,"tinycolor2":241}],287:[function(require,module,exports){ +},{"../color":268,"d3":74,"fast-isnumeric":82,"tinycolor2":241}],286:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49847,7 +49814,7 @@ module.exports = { ] }; -},{}],288:[function(require,module,exports){ +},{}],287:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49880,7 +49847,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],289:[function(require,module,exports){ +},{}],288:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49918,7 +49885,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":362}],290:[function(require,module,exports){ +},{"../../lib":364}],289:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50105,7 +50072,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../lib":362,"../../plotly":386,"../../plots/cartesian/constants":396,"./align":288,"./cursor":289,"./unhover":291}],291:[function(require,module,exports){ +},{"../../lib":364,"../../plotly":388,"../../plots/cartesian/constants":398,"./align":287,"./cursor":288,"./unhover":290}],290:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50156,7 +50123,7 @@ unhover.raw = function unhoverRaw(gd, evt) { gd._hoverdata = undefined; }; -},{"../../lib/events":357}],292:[function(require,module,exports){ +},{"../../lib/events":358}],291:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50234,14 +50201,14 @@ drawing.getPx = function(s, styleAttr) { return Number(s.style(styleAttr).replace(/px$/, '')); }; -drawing.crispRound = function(td, lineWidth, dflt) { +drawing.crispRound = function(gd, lineWidth, dflt) { // for lines that disable antialiasing we want to // make sure the width is an integer, and at least 1 if it's nonzero if(!lineWidth || !isNumeric(lineWidth)) return dflt || 0; // but not for static plots - these don't get antialiased anyway. - if(td._context.staticPlot) return lineWidth; + if(gd._context.staticPlot) return lineWidth; if(lineWidth < 1) return 1; return Math.round(lineWidth); @@ -50435,9 +50402,8 @@ drawing.singlePointStyle = function(d, sel, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); singlePointStyle(d, sel, trace, markerScale, lineScale, marker, markerLine); @@ -50449,50 +50415,22 @@ drawing.pointStyle = function(s, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales var marker = trace.marker; - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale); }); }; -// for a given color attribute (ie m -> mc = marker.color) look to see if we -// have a colorscale for it (ie mscl, mcmin, mcmax) - if we do, translate -// all numeric color values according to that scale -drawing.tryColorscale = function(cont, contIn, prefix) { - var colorArray = Lib.nestedProperty(cont, prefix + 'color').get(), - scl = Lib.nestedProperty(cont, prefix + 'colorscale').get(), - auto = Lib.nestedProperty(cont, prefix + 'cauto').get(), - minProp = Lib.nestedProperty(cont, prefix + 'cmin'), - maxProp = Lib.nestedProperty(cont, prefix + 'cmax'), - min = minProp.get(), - max = maxProp.get(); +drawing.tryColorscale = function(marker, prefix) { + var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker, + scl = cont.colorscale, + colorArray = cont.color; - // TODO handle this in Colorscale.calc if(scl && Array.isArray(colorArray)) { - if(auto || !isNumeric(min) || !isNumeric(max)) { - min = Infinity; - max = -Infinity; - colorArray.forEach(function(color) { - if(isNumeric(color)) { - if(min > color) min = +color; - if(max < color) max = +color; - } - }); - if(min > max) { - min = 0; - max = 1; - } - minProp.set(min); - maxProp.set(max); - Lib.nestedProperty(contIn, prefix + 'cmin').set(min); - Lib.nestedProperty(contIn, prefix + 'cmax').set(max); - } - return Colorscale.makeColorScaleFunc( - Colorscale.extractScale(scl, min, max) + Colorscale.extractScale(scl, cont.cmin, cont.cmax) ); } else return Lib.identity; @@ -50760,7 +50698,7 @@ drawing.setClipUrl = function(s, localId) { s.attr('clip-path', 'url(' + url + ')'); }; -},{"../../constants/xmlns_namespaces":352,"../../lib":362,"../../lib/svg_text_utils":376,"../../registry":436,"../../traces/scatter/make_bubble_size_func":467,"../../traces/scatter/subtypes":472,"../color":268,"../colorscale":283,"./symbol_defs":293,"d3":74,"fast-isnumeric":82}],293:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":352,"../../lib":364,"../../lib/svg_text_utils":378,"../../registry":438,"../../traces/scatter/make_bubble_size_func":469,"../../traces/scatter/subtypes":474,"../color":268,"../colorscale":282,"./symbol_defs":292,"d3":74,"fast-isnumeric":82}],292:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51236,7 +51174,7 @@ module.exports = { } }; -},{"d3":74}],294:[function(require,module,exports){ +},{"d3":74}],293:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51335,7 +51273,7 @@ module.exports = { } }; -},{}],295:[function(require,module,exports){ +},{}],294:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51398,7 +51336,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":390,"../../registry":436,"./compute_error":296,"fast-isnumeric":82}],296:[function(require,module,exports){ +},{"../../plots/cartesian/axes":393,"../../registry":438,"./compute_error":295,"fast-isnumeric":82}],295:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51494,7 +51432,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],297:[function(require,module,exports){ +},{}],296:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51571,7 +51509,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":362,"../../registry":436,"./attributes":294,"fast-isnumeric":82}],298:[function(require,module,exports){ +},{"../../lib":364,"../../registry":438,"./attributes":293,"fast-isnumeric":82}],297:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51630,7 +51568,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":294,"./calc":295,"./defaults":297,"./plot":299,"./style":300}],299:[function(require,module,exports){ +},{"./attributes":293,"./calc":294,"./defaults":296,"./plot":298,"./style":299}],298:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51794,7 +51732,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":472,"d3":74,"fast-isnumeric":82}],300:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":474,"d3":74,"fast-isnumeric":82}],299:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51831,7 +51769,7 @@ module.exports = function style(traces) { }); }; -},{"../color":268,"d3":74}],301:[function(require,module,exports){ +},{"../color":268,"d3":74}],300:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51846,7 +51784,14 @@ var cartesianConstants = require('../../plots/cartesian/constants'); module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'image', + + visible: { + valType: 'boolean', + + dflt: true, + + }, source: { valType: 'string', @@ -51894,14 +51839,14 @@ module.exports = { }, x: { - valType: 'number', + valType: 'any', dflt: 0, }, y: { - valType: 'number', + valType: 'any', dflt: 0, @@ -51946,7 +51891,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":396}],302:[function(require,module,exports){ +},{"../../plots/cartesian/constants":398}],301:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51957,40 +51902,34 @@ module.exports = { 'use strict'; -var Axes = require('../../plots/cartesian/axes'); var Lib = require('../../lib'); -var attributes = require('./attributes'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var attributes = require('./attributes'); +var name = 'images'; module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { + var opts = { + name: name, + handleItemDefaults: imageDefaults + }; - if(!layoutIn.images || !Array.isArray(layoutIn.images)) return; - - - var containerIn = layoutIn.images, - containerOut = layoutOut.images = []; - - - for(var i = 0; i < containerIn.length; i++) { - var image = containerIn[i]; - - if(!image.source) continue; - - var defaulted = imageDefaults(containerIn[i] || {}, containerOut[i] || {}, layoutOut); - containerOut.push(defaulted); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function imageDefaults(imageIn, imageOut, fullLayout) { - imageOut = imageOut || {}; - function coerce(attr, dflt) { return Lib.coerce(imageIn, imageOut, attributes, attr, dflt); } - coerce('source'); + var source = coerce('source'); + var visible = coerce('visible', !!source); + + if(!visible) return imageOut; + coerce('layer'); coerce('x'); coerce('y'); @@ -52001,18 +51940,18 @@ function imageDefaults(imageIn, imageOut, fullLayout) { coerce('sizing'); coerce('opacity'); - for(var i = 0; i < 2; i++) { - var tdMock = { _fullLayout: fullLayout }, - axLetter = ['x', 'y'][i]; + var gdMock = { _fullLayout: fullLayout }, + axLetters = ['x', 'y']; + for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref - Axes.coerceRef(imageIn, imageOut, tdMock, axLetter, 'paper'); + Axes.coerceRef(imageIn, imageOut, gdMock, axLetters[i], 'paper'); } return imageOut; } -},{"../../lib":362,"../../plots/cartesian/axes":390,"./attributes":301}],303:[function(require,module,exports){ +},{"../../lib":364,"../../plots/array_container_defaults":390,"../../plots/cartesian/axes":393,"./attributes":300}],302:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52029,25 +51968,23 @@ var Axes = require('../../plots/cartesian/axes'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, imageDataAbove = [], imageDataSubplot = [], imageDataBelow = []; - if(!fullLayout.images) return; - - // Sort into top, subplot, and bottom layers for(var i = 0; i < fullLayout.images.length; i++) { var img = fullLayout.images[i]; - if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - imageDataSubplot.push(img); - } else if(img.layer === 'above') { - imageDataAbove.push(img); - } else { - imageDataBelow.push(img); + if(img.visible) { + if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { + imageDataSubplot.push(img); + } else if(img.layer === 'above') { + imageDataAbove.push(img); + } else { + imageDataBelow.push(img); + } } } @@ -52116,12 +52053,12 @@ module.exports = function draw(gd) { var thisImage = d3.select(this); // Axes if specified - var xref = Axes.getFromId(gd, d.xref), - yref = Axes.getFromId(gd, d.yref); + var xa = Axes.getFromId(gd, d.xref), + ya = Axes.getFromId(gd, d.yref); var size = fullLayout._size, - width = xref ? Math.abs(xref.l2p(d.sizex) - xref.l2p(0)) : d.sizex * size.w, - height = yref ? Math.abs(yref.l2p(d.sizey) - yref.l2p(0)) : d.sizey * size.h; + width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w, + height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset, @@ -52130,8 +52067,8 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xref ? xref.l2p(d.x) + xref._offset : d.x * size.w + size.l) + xOffset, - yPos = (yref ? yref.l2p(d.y) + yref._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset, + yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; // Construct the proper aspectRatio attribute @@ -52156,8 +52093,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xref ? xref._id : '', - yId = yref ? yref._id : '', + var xId = xa ? xa._id : '', + yId = ya ? ya._id : '', clipAxes = xId + yId; if(clipAxes) { @@ -52194,7 +52131,7 @@ module.exports = function draw(gd) { }); }; -},{"../../constants/xmlns_namespaces":352,"../../plots/cartesian/axes":390,"../drawing":292,"d3":74}],304:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":352,"../../plots/cartesian/axes":393,"../drawing":291,"d3":74}],303:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52205,21 +52142,17 @@ module.exports = function draw(gd) { 'use strict'; - -var draw = require('./draw'); -var supplyLayoutDefaults = require('./defaults'); -var attributes = require('./attributes'); - - module.exports = { moduleType: 'component', name: 'images', - draw: draw, - layoutAttributes: attributes, - supplyLayoutDefaults: supplyLayoutDefaults + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), + + draw: require('./draw') }; -},{"./attributes":301,"./defaults":302,"./draw":303}],305:[function(require,module,exports){ +},{"./attributes":300,"./defaults":301,"./draw":302}],304:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52268,7 +52201,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],306:[function(require,module,exports){ +},{}],305:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52359,7 +52292,7 @@ module.exports = { } }; -},{"../../lib/extend":358,"../../plots/font_attributes":411,"../color/attributes":267}],307:[function(require,module,exports){ +},{"../../lib/extend":359,"../../plots/font_attributes":413,"../color/attributes":267}],306:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52377,7 +52310,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],308:[function(require,module,exports){ +},{}],307:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52470,7 +52403,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":362,"../../plots/layout_attributes":426,"../../registry":436,"./attributes":306,"./helpers":311}],309:[function(require,module,exports){ +},{"../../lib":364,"../../plots/layout_attributes":428,"../../registry":438,"./attributes":305,"./helpers":310}],308:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53186,7 +53119,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../lib":362,"../../lib/svg_text_utils":376,"../../plotly":386,"../../plots/plots":428,"../../registry":436,"../color":268,"../dragelement":290,"../drawing":292,"./anchor_utils":305,"./constants":307,"./get_legend_data":310,"./helpers":311,"./style":313,"d3":74}],310:[function(require,module,exports){ +},{"../../lib":364,"../../lib/svg_text_utils":378,"../../plotly":388,"../../plots/plots":430,"../../registry":438,"../color":268,"../dragelement":289,"../drawing":291,"./anchor_utils":304,"./constants":306,"./get_legend_data":309,"./helpers":310,"./style":312,"d3":74}],309:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53291,7 +53224,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":436,"./helpers":311}],311:[function(require,module,exports){ +},{"../../registry":438,"./helpers":310}],310:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53322,7 +53255,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":436}],312:[function(require,module,exports){ +},{"../../registry":438}],311:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53335,22 +53268,18 @@ exports.isReversed = function isReversed(legendLayout) { 'use strict'; -var legend = module.exports = {}; - - -legend.moduleType = 'component'; - -legend.name = 'legend'; - -legend.layoutAttributes = require('./attributes'); - -legend.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'legend', -legend.draw = require('./draw'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -legend.style = require('./style'); + draw: require('./draw'), + style: require('./style') +}; -},{"./attributes":306,"./defaults":308,"./draw":309,"./style":313}],313:[function(require,module,exports){ +},{"./attributes":305,"./defaults":307,"./draw":308,"./style":312}],312:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53572,7 +53501,7 @@ function stylePies(d) { if(pts.size()) pts.call(stylePie, d[0], trace); } -},{"../../lib":362,"../../registry":436,"../../traces/pie/style_one":450,"../../traces/scatter/subtypes":472,"../color":268,"../drawing":292,"d3":74}],314:[function(require,module,exports){ +},{"../../lib":364,"../../registry":438,"../../traces/pie/style_one":452,"../../traces/scatter/subtypes":474,"../color":268,"../drawing":291,"d3":74}],313:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54082,7 +54011,7 @@ modeBarButtons.resetViews = { } }; -},{"../../../build/ploticon":2,"../../lib":362,"../../plotly":386,"../../plots/cartesian/axes":390,"../../plots/plots":428,"../../snapshot/download":438}],315:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":364,"../../plotly":388,"../../plots/cartesian/axes":393,"../../plots/plots":430,"../../snapshot/download":440}],314:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54096,7 +54025,7 @@ modeBarButtons.resetViews = { exports.manage = require('./manage'); -},{"./manage":316}],316:[function(require,module,exports){ +},{"./manage":315}],315:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54324,7 +54253,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":390,"../../traces/scatter/subtypes":472,"./buttons":314,"./modebar":317}],317:[function(require,module,exports){ +},{"../../plots/cartesian/axes":393,"../../traces/scatter/subtypes":474,"./buttons":313,"./modebar":316}],316:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54614,7 +54543,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":362,"d3":74}],318:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":364,"d3":74}],317:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54631,7 +54560,8 @@ var extendFlat = require('../../lib/extend').extendFlat; var buttonAttrs = require('./button_attributes'); buttonAttrs = extendFlat(buttonAttrs, { - _isLinkedToArray: true, + _isLinkedToArray: 'button', + }); @@ -54703,7 +54633,7 @@ module.exports = { } }; -},{"../../lib/extend":358,"../../plots/font_attributes":411,"../color/attributes":267,"./button_attributes":319}],319:[function(require,module,exports){ +},{"../../lib/extend":359,"../../plots/font_attributes":413,"../color/attributes":267,"./button_attributes":318}],318:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54744,7 +54674,7 @@ module.exports = { } }; -},{}],320:[function(require,module,exports){ +},{}],319:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54773,7 +54703,7 @@ module.exports = { darkAmount: 10 }; -},{}],321:[function(require,module,exports){ +},{}],320:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54866,7 +54796,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":362,"../color":268,"./attributes":318,"./button_attributes":319,"./constants":320}],322:[function(require,module,exports){ +},{"../../lib":364,"../color":268,"./attributes":317,"./button_attributes":318,"./constants":319}],321:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55141,7 +55071,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":376,"../../plotly":386,"../../plots/cartesian/axis_ids":393,"../../plots/plots":428,"../color":268,"../drawing":292,"../legend/anchor_utils":305,"./constants":320,"./get_update_object":323,"d3":74}],323:[function(require,module,exports){ +},{"../../lib/svg_text_utils":378,"../../plotly":388,"../../plots/cartesian/axis_ids":396,"../../plots/plots":430,"../color":268,"../drawing":291,"../legend/anchor_utils":304,"./constants":319,"./get_update_object":322,"d3":74}],322:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55155,6 +55085,8 @@ function reposition(gd, buttons, opts, axName) { var d3 = require('d3'); +var Lib = require('../../lib'); + module.exports = function getUpdateObject(axisLayout, buttonLayout) { var axName = axisLayout._name; @@ -55175,7 +55107,7 @@ module.exports = function getUpdateObject(axisLayout, buttonLayout) { function getXRange(axisLayout, buttonLayout) { var currentRange = axisLayout.range; - var base = new Date(currentRange[1]); + var base = new Date(Lib.dateTime2ms(currentRange[1])); var step = buttonLayout.step, count = buttonLayout.count; @@ -55184,13 +55116,13 @@ function getXRange(axisLayout, buttonLayout) { switch(buttonLayout.stepmode) { case 'backward': - range0 = d3.time[step].offset(base, -count).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].offset(base, -count)); break; case 'todate': - var base2 = d3.time[step].offset(base, -(count - 1)); + var base2 = d3.time[step].offset(base, -count); - range0 = d3.time[step].floor(base2).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].ceil(base2)); break; } @@ -55199,7 +55131,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":74}],324:[function(require,module,exports){ +},{"../../lib":364,"d3":74}],323:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55210,18 +55142,18 @@ function getXRange(axisLayout, buttonLayout) { 'use strict'; +module.exports = { + moduleType: 'component', + name: 'rangeselector', -exports.moduleType = 'component'; - -exports.name = 'rangeselector'; - -exports.layoutAttributes = require('./attributes'); - -exports.handleDefaults = require('./defaults'); + layoutNodes: ['xaxis.'], + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":318,"./defaults":321,"./draw":322}],325:[function(require,module,exports){ +},{"./attributes":317,"./defaults":320,"./draw":321}],324:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55258,8 +55190,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -55279,7 +55211,7 @@ module.exports = { } }; -},{"../color/attributes":267}],326:[function(require,module,exports){ +},{"../color/attributes":267}],325:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55332,7 +55264,7 @@ module.exports = { handleStroke: '#666', }; -},{}],327:[function(require,module,exports){ +},{}],326:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55356,7 +55288,8 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe } var containerIn = layoutIn[axName].rangeslider, - containerOut = layoutOut[axName].rangeslider = {}; + axOut = layoutOut[axName], + containerOut = axOut.rangeslider = {}; function coerce(attr, dflt) { return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); @@ -55370,14 +55303,16 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe coerce('range'); // Expand slider range to the axis range - if(containerOut.range && !layoutOut[axName].autorange) { + if(containerOut.range && !axOut.autorange) { var outRange = containerOut.range, - axRange = layoutOut[axName].range; + axRange = axOut.range, + l2r = axOut.l2r, + r2l = axOut.r2l; - outRange[0] = Math.min(outRange[0], axRange[0]); - outRange[1] = Math.max(outRange[1], axRange[1]); + outRange[0] = l2r(Math.min(r2l(outRange[0]), r2l(axRange[0]))); + outRange[1] = l2r(Math.max(r2l(outRange[1]), r2l(axRange[1]))); } else { - layoutOut[axName]._needsExpand = true; + axOut._needsExpand = true; } if(containerOut.visible) { @@ -55392,7 +55327,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe containerOut._input = containerIn; }; -},{"../../lib":362,"./attributes":325}],328:[function(require,module,exports){ +},{"../../lib":364,"./attributes":324}],327:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55499,20 +55434,10 @@ module.exports = function(gd) { rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); - // update inner nodes - - rangeSlider - .call(drawBg, gd, axisOpts, opts) - .call(addClipPath, gd, axisOpts, opts) - .call(drawRangePlot, gd, axisOpts, opts) - .call(drawMasks, gd, axisOpts, opts) - .call(drawSlideBox, gd, axisOpts, opts) - .call(drawGrabbers, gd, axisOpts, opts); - // update data <--> pixel coordinate conversion methods - var range0 = opts.range[0], - range1 = opts.range[1], + var range0 = axisOpts.r2l(opts.range[0]), + range1 = axisOpts.r2l(opts.range[1]), dist = range1 - range0; opts.p2d = function(v) { @@ -55523,6 +55448,18 @@ module.exports = function(gd) { return (v - range0) / dist * opts._width; }; + opts._rl = [range0, range1]; + + // update inner nodes + + rangeSlider + .call(drawBg, gd, axisOpts, opts) + .call(addClipPath, gd, axisOpts, opts) + .call(drawRangePlot, gd, axisOpts, opts) + .call(drawMasks, gd, axisOpts, opts) + .call(drawSlideBox, gd, axisOpts, opts) + .call(drawGrabbers, gd, axisOpts, opts); + // setup drag element setupDragElement(rangeSlider, gd, axisOpts, opts); @@ -55560,8 +55497,8 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { target = event.target, startX = event.clientX, offsetX = startX - rangeSlider.node().getBoundingClientRect().left, - minVal = opts.d2p(axisOpts.range[0]), - maxVal = opts.d2p(axisOpts.range[1]); + minVal = opts.d2p(axisOpts._rl[0]), + maxVal = opts.d2p(axisOpts._rl[1]); var dragCover = dragElement.coverSlip(); @@ -55622,7 +55559,7 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { function setDataRange(rangeSlider, gd, axisOpts, opts) { function clamp(v) { - return Lib.constrain(v, opts.range[0], opts.range[1]); + return axisOpts.l2r(Lib.constrain(v, opts._rl[0], opts._rl[1])); } var dataMin = clamp(opts.p2d(opts._pixelMin)), @@ -55639,8 +55576,8 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts) { return Lib.constrain(v, 0, opts._width); } - var pixelMin = clamp(opts.d2p(axisOpts.range[0])), - pixelMax = clamp(opts.d2p(axisOpts.range[1])); + var pixelMin = clamp(opts.d2p(axisOpts._rl[0])), + pixelMax = clamp(opts.d2p(axisOpts._rl[1])); rangeSlider.select('rect.' + constants.slideBoxClassName) .attr('x', pixelMin) @@ -55733,6 +55670,7 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) { data: [], layout: { xaxis: { + type: axisOpts.type, domain: [0, 1], range: opts.range.slice() }, @@ -55914,7 +55852,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":362,"../../lib/setcursor":372,"../../plotly":386,"../../plots/cartesian":399,"../../plots/cartesian/axes":390,"../../plots/plots":428,"../color":268,"../dragelement":290,"../drawing":292,"./constants":326,"d3":74}],329:[function(require,module,exports){ +},{"../../lib":364,"../../lib/setcursor":374,"../../plotly":388,"../../plots/cartesian":401,"../../plots/cartesian/axes":393,"../../plots/plots":430,"../color":268,"../dragelement":289,"../drawing":291,"./constants":325,"d3":74}],328:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55928,12 +55866,15 @@ function clearPushMargins(gd) { module.exports = { moduleType: 'component', name: 'rangeslider', + + layoutNodes: ['xaxis.'], layoutAttributes: require('./attributes'), handleDefaults: require('./defaults'), + draw: require('./draw') }; -},{"./attributes":325,"./defaults":327,"./draw":328}],330:[function(require,module,exports){ +},{"./attributes":324,"./defaults":326,"./draw":327}],329:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55951,7 +55892,14 @@ var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'shape', + + visible: { + valType: 'boolean', + + dflt: true, + + }, type: { valType: 'enumerated', @@ -56024,7 +55972,7 @@ module.exports = { } }; -},{"../../lib/extend":358,"../../traces/scatter/attributes":452,"../annotations/attributes":261}],331:[function(require,module,exports){ +},{"../../lib/extend":359,"../../traces/scatter/attributes":454,"../annotations/attributes":261}],330:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56036,6 +55984,7 @@ module.exports = { 'use strict'; +var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); var constants = require('./constants'); @@ -56044,7 +55993,7 @@ var helpers = require('./helpers'); module.exports = function calcAutorange(gd) { var fullLayout = gd._fullLayout, - shapeList = fullLayout.shapes; + shapeList = Lib.filterVisible(fullLayout.shapes); if(!shapeList.length || !gd._fullData.length) return; @@ -56100,7 +56049,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../plots/cartesian/axes":390,"./constants":332,"./helpers":335}],332:[function(require,module,exports){ +},{"../../lib":364,"../../plots/cartesian/axes":393,"./constants":331,"./helpers":334}],331:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56164,7 +56113,7 @@ module.exports = { } }; -},{}],333:[function(require,module,exports){ +},{}],332:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56176,22 +56125,20 @@ module.exports = { 'use strict'; +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var handleShapeDefaults = require('./shape_defaults'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - var containerIn = layoutIn.shapes || [], - containerOut = layoutOut.shapes = []; - - for(var i = 0; i < containerIn.length; i++) { - var shapeIn = containerIn[i] || {}, - shapeOut = handleShapeDefaults(shapeIn, layoutOut); + var opts = { + name: 'shapes', + handleItemDefaults: handleShapeDefaults + }; - containerOut.push(shapeOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"./shape_defaults":337}],334:[function(require,module,exports){ +},{"../../plots/array_container_defaults":390,"./shape_defaults":336}],333:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56243,7 +56190,9 @@ function draw(gd) { fullLayout._shapeSubplotLayer.selectAll('path').remove(); for(var i = 0; i < fullLayout.shapes.length; i++) { - drawOne(gd, i); + if(fullLayout.shapes[i].visible) { + drawOne(gd, i); + } } // may need to resurrect this if we put text (LaTeX) in shapes @@ -56363,8 +56312,6 @@ function updateShape(gd, index, opt, value) { // TODO: clean this up and remove it. if(!optionsIn) return; - var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; - // alter the input shape as requested var optionsEdit = {}; if(typeof opt === 'string' && opt) optionsEdit[opt] = value; @@ -56376,7 +56323,12 @@ function updateShape(gd, index, opt, value) { Lib.nestedProperty(optionsIn, k).set(optionsEdit[k]); } - var posAttrs = ['x0', 'x1', 'y0', 'y1']; + // return early in visible: false updates + if(optionsIn.visible === false) return; + + var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}, + posAttrs = ['x0', 'x1', 'y0', 'y1']; + for(i = 0; i < 4; i++) { var posAttr = posAttrs[i]; // if we don't have an explicit position already, @@ -56391,18 +56343,17 @@ function updateShape(gd, index, opt, value) { var axLetter = posAttr.charAt(0), axOld = Axes.getFromId(gd, - Axes.coerceRef(oldRef, {}, gd, axLetter)), + Axes.coerceRef(oldRef, {}, gd, axLetter, '', 'paper')), axNew = Axes.getFromId(gd, - Axes.coerceRef(optionsIn, {}, gd, axLetter)), + Axes.coerceRef(optionsIn, {}, gd, axLetter, '', 'paper')), position = optionsIn[posAttr], - linearizedPosition; + rangePosition; if(optionsEdit[axLetter + 'ref'] !== undefined) { // first convert to fraction of the axis if(axOld) { - linearizedPosition = helpers.dataToLinear(axOld)(position); - position = (linearizedPosition - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + rangePosition = helpers.shapePositionToRange(axOld)(position); + position = axOld.r2fraction(rangePosition); } else { position = (position - axNew.domain[0]) / (axNew.domain[1] - axNew.domain[0]); @@ -56410,9 +56361,8 @@ function updateShape(gd, index, opt, value) { if(axNew) { // then convert to new data coordinates at the same fraction - linearizedPosition = axNew.range[0] + position * - (axNew.range[1] - axNew.range[0]); - position = helpers.linearToData(axNew)(linearizedPosition); + rangePosition = axNew.fraction2r(position); + position = helpers.rangeToShapePosition(axNew)(rangePosition); } else { // or scale to the whole plot position = axOld.domain[0] + @@ -56423,7 +56373,8 @@ function updateShape(gd, index, opt, value) { optionsIn[posAttr] = position; } - var options = handleShapeDefaults(optionsIn, gd._fullLayout); + var options = {}; + handleShapeDefaults(optionsIn, options, gd._fullLayout); gd._fullLayout.shapes[index] = options; var clipAxes; @@ -56657,22 +56608,22 @@ function getPathString(gd, options) { xa = Axes.getFromId(gd, options.xref), ya = Axes.getFromId(gd, options.yref), gs = gd._fullLayout._size, - x2l, + x2r, x2p, - y2l, + y2r, y2p; if(xa) { - x2l = helpers.dataToLinear(xa); - x2p = function(v) { return xa._offset + xa.l2p(x2l(v, true)); }; + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2l = helpers.dataToLinear(ya); - y2p = function(v) { return ya._offset + ya.l2p(y2l(v, true)); }; + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; @@ -56754,7 +56705,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":362,"../../lib/setcursor":372,"../../plotly":386,"../../plots/cartesian/axes":390,"../color":268,"../dragelement":290,"../drawing":292,"./constants":332,"./defaults":333,"./helpers":335,"./shape_defaults":337,"fast-isnumeric":82}],335:[function(require,module,exports){ +},{"../../lib":364,"../../lib/setcursor":374,"../../plotly":388,"../../plots/cartesian/axes":393,"../color":268,"../dragelement":289,"../drawing":291,"./constants":331,"./defaults":332,"./helpers":334,"./shape_defaults":336,"fast-isnumeric":82}],334:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56771,16 +56722,16 @@ function movePath(pathIn, moveX, moveY) { // so these have to be specified in terms of the category serial numbers, // but can take fractional values. Other axis types we specify position based on // the actual data values. -// TODO: this should really be part of axes, but for now it's only used here. -// eventually annotations and axis ranges will use this too. -// what should we do, invent a new letter for "data except if it's category"? +// TODO: in V2.0 (when log axis ranges are in data units) range and shape position +// will be identical, so rangeToShapePosition and shapePositionToRange can be +// removed entirely. -exports.dataToLinear = function(ax) { - return ax.type === 'category' ? ax.c2l : ax.d2l; +exports.rangeToShapePosition = function(ax) { + return (ax.type === 'log') ? ax.r2d : function(v) { return v; }; }; -exports.linearToData = function(ax) { - return ax.type === 'category' ? ax.l2c : ax.l2d; +exports.shapePositionToRange = function(ax) { + return (ax.type === 'log') ? ax.d2r : function(v) { return v; }; }; exports.decodeDate = function(convertToPx) { @@ -56799,10 +56750,10 @@ exports.getDataToPixel = function(gd, axis, isVertical) { dataToPixel; if(axis) { - var d2l = exports.dataToLinear(axis); + var d2r = exports.shapePositionToRange(axis); dataToPixel = function(v) { - return axis._offset + axis.l2p(d2l(v, true)); + return axis._offset + axis.r2p(d2r(v, true)); }; if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); @@ -56822,8 +56773,8 @@ exports.getPixelToData = function(gd, axis, isVertical) { pixelToData; if(axis) { - var l2d = exports.linearToData(axis); - pixelToData = function(p) { return l2d(axis.p2l(p - axis._offset)); }; + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; @@ -56835,7 +56786,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],336:[function(require,module,exports){ +},{}],335:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56847,21 +56798,21 @@ exports.getPixelToData = function(gd, axis, isVertical) { 'use strict'; -exports.moduleType = 'component'; - -exports.name = 'shapes'; - -exports.layoutAttributes = require('./attributes'); +var drawModule = require('./draw'); -exports.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'shapes', -exports.calcAutorange = require('./calc_autorange'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne +}; -},{"./attributes":330,"./calc_autorange":331,"./defaults":333,"./draw":334}],337:[function(require,module,exports){ +},{"./attributes":329,"./calc_autorange":330,"./defaults":332,"./draw":333}],336:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56879,13 +56830,19 @@ var Axes = require('../../plots/cartesian/axes'); var attributes = require('./attributes'); var helpers = require('./helpers'); -module.exports = function handleShapeDefaults(shapeIn, fullLayout) { - var shapeOut = {}; + +module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opts, itemOpts) { + opts = opts || {}; + itemOpts = itemOpts || {}; function coerce(attr, dflt) { return Lib.coerce(shapeIn, shapeOut, attributes, attr, dflt); } + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + + if(!visible) return shapeOut; + coerce('layer'); coerce('opacity'); coerce('fillcolor'); @@ -56900,39 +56857,61 @@ module.exports = function handleShapeDefaults(shapeIn, fullLayout) { var axLetters = ['x', 'y']; for(var i = 0; i < 2; i++) { var axLetter = axLetters[i], - tdMock = {_fullLayout: fullLayout}; + gdMock = {_fullLayout: fullLayout}; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, tdMock, axLetter); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); if(shapeType !== 'path') { var dflt0 = 0.25, - dflt1 = 0.75; + dflt1 = 0.75, + ax, + pos2r, + r2pos; if(axRef !== 'paper') { - var ax = Axes.getFromId(tdMock, axRef), - convertFn = helpers.linearToData(ax); - - dflt0 = convertFn(ax.range[0] + dflt0 * (ax.range[1] - ax.range[0])); - dflt1 = convertFn(ax.range[0] + dflt1 * (ax.range[1] - ax.range[0])); + ax = Axes.getFromId(gdMock, axRef); + r2pos = helpers.rangeToShapePosition(ax); + pos2r = helpers.shapePositionToRange(ax); + } + else { + pos2r = r2pos = Lib.identity; } + // hack until V2.0 when log has regular range behavior - make it look like other + // ranges to send to coerce, then put it back after + // this is all to give reasonable default position behavior on log axes, which is + // a pretty unimportant edge case so we could just ignore this. + var attr0 = axLetter + '0', + attr1 = axLetter + '1', + in0 = shapeIn[attr0], + in1 = shapeIn[attr1]; + shapeIn[attr0] = pos2r(shapeIn[attr0], true); + shapeIn[attr1] = pos2r(shapeIn[attr1], true); + // x0, x1 (and y0, y1) - coerce(axLetter + '0', dflt0); - coerce(axLetter + '1', dflt1); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr0, dflt0); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr1, dflt1); + + // hack part 2 + shapeOut[attr0] = r2pos(shapeOut[attr0]); + shapeOut[attr1] = r2pos(shapeOut[attr1]); + shapeIn[attr0] = in0; + shapeIn[attr1] = in1; } } if(shapeType === 'path') { coerce('path'); - } else { + } + else { Lib.noneOrAll(shapeIn, shapeOut, ['x0', 'x1', 'y0', 'y1']); } return shapeOut; }; -},{"../../lib":362,"../../plots/cartesian/axes":390,"./attributes":330,"./helpers":335}],338:[function(require,module,exports){ +},{"../../lib":364,"../../plots/cartesian/axes":393,"./attributes":329,"./helpers":334}],337:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56951,7 +56930,7 @@ var animationAttrs = require('../../plots/animation_attributes'); var constants = require('./constants'); var stepsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'step', method: { valType: 'enumerated', @@ -56984,6 +56963,8 @@ var stepsAttrs = { }; module.exports = { + _isLinkedToArray: 'slider', + visible: { valType: 'boolean', @@ -57164,7 +57145,7 @@ module.exports = { }, }; -},{"../../lib/extend":358,"../../plots/animation_attributes":387,"../../plots/font_attributes":411,"../../plots/pad_attributes":427,"./constants":339}],339:[function(require,module,exports){ +},{"../../lib/extend":359,"../../plots/animation_attributes":389,"../../plots/font_attributes":413,"../../plots/pad_attributes":429,"./constants":338}],338:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -57179,9 +57160,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'sliders', - itemName: 'slider', // class names containerClassName: 'slider-container', @@ -57262,7 +57242,7 @@ module.exports = { currentValueInset: 0, }; -},{}],340:[function(require,module,exports){ +},{}],339:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -57274,6 +57254,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -57283,23 +57264,12 @@ var stepAttrs = attributes.steps; module.exports = function slidersDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var sliderIn = contIn[i] || {}, - sliderOut = {}; - - sliderDefaults(sliderIn, sliderOut, layoutOut); - - // used on button click to update the 'active' field - sliderOut._input = sliderIn; - - // used to determine object constancy - sliderOut._index = i; + var opts = { + name: name, + handleItemDefaults: sliderDefaults + }; - contOut.push(sliderOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function sliderDefaults(sliderIn, sliderOut, layoutOut) { @@ -57385,7 +57355,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":362,"./attributes":338,"./constants":339}],341:[function(require,module,exports){ +},{"../../lib":364,"../../plots/array_container_defaults":390,"./attributes":337,"./constants":338}],340:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -57754,6 +57724,7 @@ function handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, doTransiti } function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) { + var previousActive = sliderOpts.active; sliderOpts._input.active = sliderOpts.active = index; var step = sliderOpts.steps[sliderOpts.active]; @@ -57761,6 +57732,13 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) sliderGroup.call(setGripPosition, sliderOpts, sliderOpts.active / (sliderOpts.steps.length - 1), doTransition); sliderGroup.call(drawCurrentValue, sliderOpts); + gd.emit('plotly_sliderchange', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active], + interaction: doCallback, + previousActive: previousActive + }); + if(step && step.method && doCallback) { if(sliderGroup._nextMethod) { // If we've already queued up an update, just overwrite it with the most recent: @@ -57787,6 +57765,8 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { var $gd = d3.select(gd); item.on('mousedown', function() { + gd.emit('plotly_sliderstart', {slider: sliderOpts}); + var grip = sliderGroup.select('.' + constants.gripRectClass); d3.event.stopPropagation(); @@ -57807,6 +57787,11 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { grip.call(Color.fill, sliderOpts.bgcolor); $gd.on('mouseup', null); $gd.on('mousemove', null); + + gd.emit('plotly_sliderend', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active] + }); }); }); } @@ -57944,7 +57929,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":362,"../../lib/svg_text_utils":376,"../../plots/plots":428,"../color":268,"../drawing":292,"../legend/anchor_utils":305,"./constants":339,"d3":74}],342:[function(require,module,exports){ +},{"../../lib":364,"../../lib/svg_text_utils":378,"../../plots/plots":430,"../color":268,"../drawing":291,"../legend/anchor_utils":304,"./constants":338,"d3":74}],341:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -57955,18 +57940,19 @@ function clearPushMargins(gd) { 'use strict'; +var constants = require('./constants'); -exports.moduleType = 'component'; - -exports.name = 'sliders'; - -exports.layoutAttributes = require('./attributes'); +module.exports = { + moduleType: 'component', + name: constants.name, -exports.supplyLayoutDefaults = require('./defaults'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":338,"./defaults":340,"./draw":341}],343:[function(require,module,exports){ +},{"./attributes":337,"./constants":338,"./defaults":339,"./draw":340}],342:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58196,7 +58182,7 @@ Titles.draw = function(gd, titleClass, options) { el.classed('js-placeholder', isplaceholder); }; -},{"../../lib":362,"../../lib/svg_text_utils":376,"../../plotly":386,"../../plots/plots":428,"../color":268,"../drawing":292,"d3":74,"fast-isnumeric":82}],344:[function(require,module,exports){ +},{"../../lib":364,"../../lib/svg_text_utils":378,"../../plotly":388,"../../plots/plots":430,"../color":268,"../drawing":291,"d3":74,"fast-isnumeric":82}],343:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58213,7 +58199,7 @@ var extendFlat = require('../../lib/extend').extendFlat; var padAttrs = require('../../plots/pad_attributes'); var buttonsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'button', method: { valType: 'enumerated', @@ -58242,7 +58228,7 @@ var buttonsAttrs = { }; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'updatemenu', visible: { valType: 'boolean', @@ -58342,7 +58328,7 @@ module.exports = { } }; -},{"../../lib/extend":358,"../../plots/font_attributes":411,"../../plots/pad_attributes":427,"../color/attributes":267}],345:[function(require,module,exports){ +},{"../../lib/extend":359,"../../plots/font_attributes":413,"../../plots/pad_attributes":429,"../color/attributes":267}],344:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58357,9 +58343,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'updatemenus', - itemName: 'updatemenu', // class names containerClassName: 'updatemenu-container', @@ -58419,7 +58404,7 @@ module.exports = { hoverColor: '#F4FAFF' }; -},{}],346:[function(require,module,exports){ +},{}],345:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58431,6 +58416,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -58440,23 +58426,12 @@ var buttonAttrs = attributes.buttons; module.exports = function updateMenusDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var menuIn = contIn[i] || {}, - menuOut = {}; - - menuDefaults(menuIn, menuOut, layoutOut); - - // used on button click to update the 'active' field - menuOut._input = menuIn; - - // used to determine object constancy - menuOut._index = i; + var opts = { + name: name, + handleItemDefaults: menuDefaults + }; - contOut.push(menuOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function menuDefaults(menuIn, menuOut, layoutOut) { @@ -58523,7 +58498,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":362,"./attributes":344,"./constants":345}],347:[function(require,module,exports){ +},{"../../lib":364,"../../plots/array_container_defaults":390,"./attributes":343,"./constants":344}],346:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58825,6 +58800,8 @@ function drawButtons(gd, gHeader, gButton, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, buttonIndex); Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + + gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); button.on('mouseover', function() { @@ -59104,29 +59081,9 @@ function clearPushMargins(gd) { } } -},{"../../lib":362,"../../lib/svg_text_utils":376,"../../plots/plots":428,"../color":268,"../drawing":292,"../legend/anchor_utils":305,"./constants":345,"d3":74}],348:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - - -exports.moduleType = 'component'; - -exports.name = 'updatemenus'; - -exports.layoutAttributes = require('./attributes'); - -exports.supplyLayoutDefaults = require('./defaults'); - -exports.draw = require('./draw'); - -},{"./attributes":344,"./defaults":346,"./draw":347}],349:[function(require,module,exports){ +},{"../../lib":364,"../../lib/svg_text_utils":378,"../../plots/plots":430,"../color":268,"../drawing":291,"../legend/anchor_utils":304,"./constants":344,"d3":74}],347:[function(require,module,exports){ +arguments[4][341][0].apply(exports,arguments) +},{"./attributes":343,"./constants":344,"./defaults":345,"./draw":346,"dup":341}],348:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -59147,7 +59104,7 @@ module.exports = { longdashdot: [[0.5, 0.7, 0.8, 1], 10] }; -},{}],350:[function(require,module,exports){ +},{}],349:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -59170,6 +59127,48 @@ module.exports = { x: '❌' }; +},{}],350:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + + +module.exports = { + /** + * Standardize all missing data in calcdata to use undefined + * never null or NaN. + * That way we can use !==undefined, or !== BADNUM, + * to test for real data + */ + BADNUM: undefined, + + /* + * Limit certain operations to well below floating point max value + * to avoid glitches: Make sure that even when you multiply it by the + * number of pixels on a giant screen it still works + */ + FP_SAFE: Number.MAX_VALUE / 10000, + + /* + * conversion of date units to milliseconds + * year and month constants are marked "AVG" + * to remind us that not all years and months + * have the same length + */ + ONEAVGYEAR: 31557600000, // 365.25 days + ONEAVGMONTH: 2629800000, // 1/12 of ONEAVGYEAR + ONEDAY: 86400000, + ONEHOUR: 3600000, + ONEMIN: 60000, + ONESEC: 1000 +}; + },{}],351:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. @@ -59250,7 +59249,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.19.2'; +exports.version = '1.20.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -59311,7 +59310,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":266,"./components/images":304,"./components/legend":312,"./components/rangeselector":324,"./components/rangeslider":329,"./components/shapes":336,"./components/sliders":342,"./components/updatemenus":348,"./fonts/mathjax_config":354,"./lib/queue":370,"./plot_api/plot_schema":380,"./plot_api/register":381,"./plot_api/set_plot_config":382,"./plot_api/to_image":384,"./plot_api/validate":385,"./plotly":386,"./snapshot":441,"./snapshot/download":438,"./traces/scatter":462,"d3":74,"es6-promise":79}],354:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":266,"./components/images":303,"./components/legend":311,"./components/rangeselector":323,"./components/rangeslider":328,"./components/shapes":335,"./components/sliders":341,"./components/updatemenus":347,"./fonts/mathjax_config":354,"./lib/queue":372,"./plot_api/plot_schema":382,"./plot_api/register":383,"./plot_api/set_plot_config":384,"./plot_api/to_image":386,"./plot_api/validate":387,"./plotly":388,"./snapshot":443,"./snapshot/download":440,"./traces/scatter":464,"d3":74,"es6-promise":79}],354:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -59354,22 +59353,50 @@ if(typeof MathJax !== 'undefined') { */ +'use strict'; + +var isNumeric = require('fast-isnumeric'); + +var BADNUM = require('../constants/numerical').BADNUM; + +// precompile these regex's for speed +var FRONTJUNK = /^['"%,$#\s']+/; +var ENDJUNK = /['"%,$#\s']+$/; + +/** + * cleanNumber: remove common leading and trailing cruft + * Always returns either a number or BADNUM. + */ +module.exports = function cleanNumber(v) { + if(typeof v === 'string') { + v = v.replace(FRONTJUNK, '').replace(ENDJUNK, ''); + } + + if(isNumeric(v)) return Number(v); + + return BADNUM; +}; + +},{"../constants/numerical":350,"fast-isnumeric":82}],356:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + 'use strict'; var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); -var nestedProperty = require('./nested_property'); -var isPlainObject = require('./is_plain_object'); -var filterUnique = require('./filter_unique'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); +var nestedProperty = require('./nested_property'); -var idRegex = /^([2-9]|[1-9][0-9]+)$/; - -function isValObject(obj) { - return obj && obj.valType !== undefined; -} +var ID_REGEX = /^([2-9]|[1-9][0-9]+)$/; exports.valObjects = { data_array: { @@ -59480,7 +59507,7 @@ exports.valObjects = { coerceFunction: function(v, propOut, dflt) { var dlen = dflt.length; if(typeof v === 'string' && v.substr(0, dlen) === dflt && - idRegex.test(v.substr(dlen))) { + ID_REGEX.test(v.substr(dlen))) { propOut.set(v); return; } @@ -59492,7 +59519,7 @@ exports.valObjects = { if(v === dflt) return true; if(typeof v !== 'string') return false; - if(v.substr(0, dlen) === dflt && idRegex.test(v.substr(dlen))) { + if(v.substr(0, dlen) === dflt && ID_REGEX.test(v.substr(dlen))) { return true; } @@ -59660,129 +59687,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -/* - * returns true for a valid value object and false for tree nodes in the attribute hierarchy - */ -exports.isValObject = isValObject; - -exports.IS_SUBPLOT_OBJ = '_isSubplotObj'; -exports.IS_LINKED_TO_ARRAY = '_isLinkedToArray'; -exports.DEPRECATED = '_deprecated'; - -// list of underscore attributes to keep in schema as is -exports.UNDERSCORE_ATTRS = [exports.IS_SUBPLOT_OBJ, exports.IS_LINKED_TO_ARRAY, exports.DEPRECATED]; - -/** - * Crawl the attribute tree, recursively calling a callback function - * - * @param {object} attrs - * The node of the attribute tree (e.g. the root) from which recursion originates - * @param {Function} callback - * A callback function with the signature: - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * @param {Number} [specifiedLevel] - * The level in the tree, in order to let the callback function detect descend or backtrack, - * typically unsupplied (implied 0), just used by the self-recursive call. - * The necessity arises because the tree traversal is not controlled by callback return values. - * The decision to not use callback return values for controlling tree pruning arose from - * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions - * precedes the callback call. - * - * @return {object} transformOut - * copy of transformIn that contains attribute defaults - */ -exports.crawl = function(attrs, callback, specifiedLevel) { - var level = specifiedLevel || 0; - Object.keys(attrs).forEach(function(attrName) { - var attr = attrs[attrName]; - - if(exports.UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - - callback(attr, attrName, attrs, level); - - if(isValObject(attr)) return; - if(isPlainObject(attr)) exports.crawl(attr, callback, level + 1); - }); -}; - -/** - * Find all data array attributes in a given trace object - including - * `arrayOk` attributes. - * - * @param {object} trace - * full trace object that contains a reference to `_module.attributes` - * - * @return {array} arrayAttributes - * list of array attributes for the given trace - */ -exports.findArrayAttributes = function(trace) { - var arrayAttributes = [], - stack = []; - - /** - * A closure that gathers attribute paths into its enclosed arraySplitAttributes - * Attribute paths are collected iff their leaf node is a splittable attribute - * - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * - * @closureVariable {String[][]} arrayAttributes the set of gathered attributes - * Example of filled closure variable (expected to be initialized to []): - * [["marker","size"],["marker","line","width"],["marker","line","color"]] - */ - function callback(attr, attrName, attrs, level) { - stack = stack.slice(0, level).concat([attrName]); - - var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; - if(!splittableAttr) return; - - var astr = toAttrString(stack); - var val = nestedProperty(trace, astr).get(); - if(!Array.isArray(val)) return; - - arrayAttributes.push(astr); - } - - function toAttrString(stack) { - return stack.join('.'); - } - - exports.crawl(trace._module.attributes, callback); - - if(trace.transforms) { - var transforms = trace.transforms; - - for(var i = 0; i < transforms.length; i++) { - var transform = transforms[i]; - - stack = ['transforms[' + i + ']']; - exports.crawl(transform._module.attributes, callback, 1); - } - } - - // Look into the fullInput module attributes for array attributes - // to make sure that 'custom' array attributes are detected. - // - // At the moment, we need this block to make sure that - // ohlc and candlestick 'open', 'high', 'low', 'close' can be - // used with filter ang groupby transforms. - if(trace._fullInput) { - exports.crawl(trace._fullInput._module.attributes, callback); - - arrayAttributes = filterUnique(arrayAttributes); - } - - return arrayAttributes; -}; - -},{"../components/colorscale/get_scale":281,"../components/colorscale/scales":287,"./filter_unique":359,"./is_plain_object":364,"./nested_property":367,"fast-isnumeric":82,"tinycolor2":241}],356:[function(require,module,exports){ +},{"../components/colorscale/get_scale":280,"../components/colorscale/scales":286,"./nested_property":369,"fast-isnumeric":82,"tinycolor2":241}],357:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -59797,6 +59702,24 @@ exports.findArrayAttributes = function(trace) { var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); +var logError = require('./loggers').error; + +var constants = require('../constants/numerical'); +var BADNUM = constants.BADNUM; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + +// is an object a javascript date? +exports.isJSDate = function(v) { + return typeof v === 'object' && v !== null && typeof v.getTime === 'function'; +}; + +// The absolute limits of our date-time system +// This is a little weird: we use MIN_MS and MAX_MS in dateTime2ms +// but we use dateTime2ms to calculate them (after defining it!) +var MIN_MS, MAX_MS; /** * dateTime2ms - turn a date object or string s of the form @@ -59804,7 +59727,13 @@ var isNumeric = require('fast-isnumeric'); * per javascript standard) * may truncate after any full field, and sss can be any length * even >3 digits, though javascript dates truncate to milliseconds - * returns false if it doesn't find a date + * returns BADNUM if it doesn't find a date + * + * Expanded to support negative years to -9999 but you must always + * give 4 digits, except for 2-digit positive years which we assume are + * near the present time. + * Note that we follow ISO 8601:2004: there *is* a year 0, which + * is 1BC/BCE, and -1===2BC etc. * * 2-digit to 4-digit year conversion, where to cut off? * from http://support.microsoft.com/kb/244664: @@ -59812,85 +59741,123 @@ var isNumeric = require('fast-isnumeric'); * but in my mac chrome from eg. d=new Date(Date.parse('8/19/50')): * 1950-2049 * by Java, from http://stackoverflow.com/questions/2024273/: - * now-80 - now+20 + * now-80 - now+19 * or FileMaker Pro, from * http://www.filemaker.com/12help/html/add_view_data.4.21.html: - * now-70 - now+30 + * now-70 - now+29 * but python strptime etc, via * http://docs.python.org/py3k/library/time.html: * 1969-2068 (super forward-looking, but static, not sliding!) * - * lets go with now-70 to now+30, and if anyone runs into this problem + * lets go with now-70 to now+29, and if anyone runs into this problem * they can learn the hard way not to use 2-digit years, as no choice we * make now will cover all possibilities. mostly this will all be taken * care of in initial parsing, should only be an issue for hand-entered data - * currently (2012) this range is: - * 1942-2041 + * currently (2016) this range is: + * 1946-2045 */ exports.dateTime2ms = function(s) { // first check if s is a date object - try { - if(s.getTime) return +s; - } - catch(e) { - return false; + if(exports.isJSDate(s)) { + s = Number(s); + if(s >= MIN_MS && s <= MAX_MS) return s; + return BADNUM; } + // otherwise only accept strings and numbers + if(typeof s !== 'string' && typeof s !== 'number') return BADNUM; var y, m, d, h; // split date and time parts - var datetime = String(s).split(' '); - if(datetime.length > 2) return false; + // TODO: we strip leading/trailing whitespace but not other + // characters like we do for numbers - do we want to? + var datetime = String(s).trim().split(' '); + if(datetime.length > 2) return BADNUM; var p = datetime[0].split('-'); // date part - if(p.length > 3 || (p.length !== 3 && datetime[1])) return false; + + var CE = true; // common era, ie positive year + if(p[0] === '') { + // first part is blank: year starts with a minus sign + CE = false; + p.splice(0, 1); + } + + var plen = p.length; + if(plen > 3 || (plen !== 3 && datetime[1]) || !plen) return BADNUM; // year if(p[0].length === 4) y = Number(p[0]); else if(p[0].length === 2) { + if(!CE) return BADNUM; var yNow = new Date().getFullYear(); y = ((Number(p[0]) - yNow + 70) % 100 + 200) % 100 + yNow - 70; } - else return false; - if(!isNumeric(y)) return false; - if(p.length === 1) return new Date(y, 0, 1).getTime(); // year only + else return BADNUM; + if(!isNumeric(y)) return BADNUM; + + // javascript takes new Date(0..99,m,d) to mean 1900-1999, so + // to support years 0-99 we need to use setFullYear explicitly + var baseDate = new Date(0, 0, 1); + baseDate.setFullYear(CE ? y : -y); + if(p.length > 1) { + + // month - may be 1 or 2 digits + m = Number(p[1]) - 1; // new Date() uses zero-based months + if(p[1].length > 2 || !(m >= 0 && m <= 11)) return BADNUM; + baseDate.setMonth(m); + + if(p.length > 2) { - // month - m = Number(p[1]) - 1; // new Date() uses zero-based months - if(p[1].length > 2 || !(m >= 0 && m <= 11)) return false; - if(p.length === 2) return new Date(y, m, 1).getTime(); // year-month + // day - may be 1 or 2 digits + d = Number(p[2]); + if(p[2].length > 2 || !(d >= 1 && d <= 31)) return BADNUM; + baseDate.setDate(d); - // day - d = Number(p[2]); - if(p[2].length > 2 || !(d >= 1 && d <= 31)) return false; + // does that date exist in this month? + if(baseDate.getDate() !== d) return BADNUM; - // now save the date part - d = new Date(y, m, d).getTime(); - if(!datetime[1]) return d; // year-month-day - p = datetime[1].split(':'); - if(p.length > 3) return false; + if(datetime[1]) { - // hour - h = Number(p[0]); - if(p[0].length > 2 || !(h >= 0 && h <= 23)) return false; - d += 3600000 * h; - if(p.length === 1) return d; + p = datetime[1].split(':'); + if(p.length > 3) return BADNUM; - // minute - m = Number(p[1]); - if(p[1].length > 2 || !(m >= 0 && m <= 59)) return false; - d += 60000 * m; - if(p.length === 2) return d; + // hour - may be 1 or 2 digits + h = Number(p[0]); + if(p[0].length > 2 || !p[0].length || !(h >= 0 && h <= 23)) return BADNUM; + baseDate.setHours(h); - // second - s = Number(p[2]); - if(!(s >= 0 && s < 60)) return false; - return d + s * 1000; + // does that hour exist in this day? (Daylight time!) + // (TODO: remove this check when we move to UTC) + if(baseDate.getHours() !== h) return BADNUM; + + if(p.length > 1) { + d = baseDate.getTime(); + + // minute - must be 2 digits + m = Number(p[1]); + if(p[1].length !== 2 || !(m >= 0 && m <= 59)) return BADNUM; + d += ONEMIN * m; + if(p.length === 2) return d; + + // second (and milliseconds) - must have 2-digit seconds + if(p[2].split('.')[0].length !== 2) return BADNUM; + s = Number(p[2]); + if(!(s >= 0 && s < 60)) return BADNUM; + return d + s * ONESEC; + } + } + } + } + return baseDate.getTime(); }; +MIN_MS = exports.MIN_MS = exports.dateTime2ms('-9999'); +MAX_MS = exports.MAX_MS = exports.dateTime2ms('9999-12-31 23:59:59.9999'); + // is string s a date? (see above) exports.isDateTime = function(s) { - return (exports.dateTime2ms(s) !== false); + return (exports.dateTime2ms(s) !== BADNUM); }; // pad a number with zeroes, to given # of digits before the decimal point @@ -59899,224 +59866,68 @@ function lpad(val, digits) { } /** - * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.sss - * Crop any trailing zeros in time, but always leave full date - * (we could choose to crop '-01' from date too)... + * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.ssss + * Crop any trailing zeros in time, except never stop right after hours + * (we could choose to crop '-01' from date too but for now we always + * show the whole date) * Optional range r is the data range that applies, also in ms. * If rng is big, the later parts of time will be omitted */ +var NINETYDAYS = 90 * ONEDAY; +var THREEHOURS = 3 * ONEHOUR; +var FIVEMIN = 5 * ONEMIN; exports.ms2DateTime = function(ms, r) { + if(typeof ms !== 'number' || !(ms >= MIN_MS && ms <= MAX_MS)) return BADNUM; + if(!r) r = 0; - var d = new Date(ms), - s = d3.time.format('%Y-%m-%d')(d); - - if(r < 7776000000) { - // <90 days: add hours - s += ' ' + lpad(d.getHours(), 2); - if(r < 432000000) { - // <5 days: add minutes - s += ':' + lpad(d.getMinutes(), 2); - if(r < 10800000) { - // <3 hours: add seconds - s += ':' + lpad(d.getSeconds(), 2); - if(r < 300000) { - // <5 minutes: add ms - s += '.' + lpad(d.getMilliseconds(), 3); + var d = new Date(Math.floor(ms)), + dateStr = d3.time.format('%Y-%m-%d')(d), + // <90 days: add hours and minutes - never *only* add hours + h = (r < NINETYDAYS) ? d.getHours() : 0, + m = (r < NINETYDAYS) ? d.getMinutes() : 0, + // <3 hours: add seconds + s = (r < THREEHOURS) ? d.getSeconds() : 0, + // <5 minutes: add ms (plus one extra digit, this is msec*10) + msec10 = (r < FIVEMIN) ? Math.round((d.getMilliseconds() + (((ms % 1) + 1) % 1)) * 10) : 0; + + // include each part that has nonzero data in or after it + if(h || m || s || msec10) { + dateStr += ' ' + lpad(h, 2) + ':' + lpad(m, 2); + if(s || msec10) { + dateStr += ':' + lpad(s, 2); + if(msec10) { + var digits = 4; + while(msec10 % 10 === 0) { + digits -= 1; + msec10 /= 10; } + dateStr += '.' + lpad(msec10, digits); } } - // strip trailing zeros - return s.replace(/([:\s]00)*\.?[0]*$/, ''); } - return s; -}; - -/** - * parseDate: forgiving attempt to turn any date string - * into a javascript date object - * - * first collate all the date formats we want to support, precompiled - * to d3 format objects see below for the string cleaning that happens - * before this separate out 2-digit (y) and 4-digit-year (Y) formats, - * formats with month names (b), and formats with am/pm (I) or no time (D) - * (also includes hour only, as the test is really for a colon) so we can - * cut down the number of tests we need to run for any given string - * (right now all are between 15 and 32 tests) - */ - -// TODO: this is way out of date vs. the server-side version -var timeFormats = { - // 24 hour - H: ['%H:%M:%S~%L', '%H:%M:%S', '%H:%M'], - // with am/pm - I: ['%I:%M:%S~%L%p', '%I:%M:%S%p', '%I:%M%p'], - // no colon, ie only date or date with hour (could also support eg 12h34m?) - D: ['%H', '%I%p', '%Hh'] -}; - -var dateFormats = { - Y: [ - '%Y~%m~%d', - '%Y%m%d', - '%y%m%d', // YYMMDD, has 6 digits together so will match Y, not y - '%m~%d~%Y', // MM/DD/YYYY has first precedence - '%d~%m~%Y' // then DD/MM/YYYY - ], - Yb: [ - '%b~%d~%Y', // eg nov 21 2013 - '%d~%b~%Y', // eg 21 nov 2013 - '%Y~%d~%b', // eg 2013 21 nov (or 2013 q3, after replacement) - '%Y~%b~%d' // eg 2013 nov 21 - ], - /** - * the two-digit year cases have so many potential ambiguities - * it's not even funny, but we'll try them anyway. - */ - y: [ - '%m~%d~%y', - '%d~%m~%y', - '%y~%m~%d' - ], - yb: [ - '%b~%d~%y', - '%d~%b~%y', - '%y~%d~%b', - '%y~%b~%d' - ] + return dateStr; }; -// use utc formatter since we're ignoring timezone info -var formatter = d3.time.format.utc; - -/** - * ISO8601 and YYYYMMDDHHMMSS are the only ones where date and time - * are not separated by a space, so they get inserted specially here. - * Also a couple formats with no day (so time makes no sense) - */ -var dateTimeFormats = { - Y: { - H: ['%Y~%m~%dT%H:%M:%S', '%Y~%m~%dT%H:%M:%S~%L'].map(formatter), - I: [], - D: ['%Y%m%d%H%M%S', '%Y~%m', '%m~%Y'].map(formatter) - }, - Yb: {H: [], I: [], D: ['%Y~%b', '%b~%Y'].map(formatter)}, - y: {H: [], I: [], D: []}, - yb: {H: [], I: [], D: []} -}; -// all others get inserted in all possible combinations from dateFormats and timeFormats -['Y', 'Yb', 'y', 'yb'].forEach(function(dateType) { - dateFormats[dateType].forEach(function(dateFormat) { - // just a date (don't do just a time) - dateTimeFormats[dateType].D.push(formatter(dateFormat)); - ['H', 'I', 'D'].forEach(function(timeType) { - timeFormats[timeType].forEach(function(timeFormat) { - var a = dateTimeFormats[dateType][timeType]; - - // 'date time', then 'time date' - a.push(formatter(dateFormat + '~' + timeFormat)); - a.push(formatter(timeFormat + '~' + dateFormat)); - }); - }); - }); -}); - -// precompiled regexps for performance -var matchword = /[a-z]*/g, - shortenword = function(m) { return m.substr(0, 3); }, - weekdaymatch = /(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g, - separatormatch = /[\s,\/\-\.\(\)]+/g, - ampmmatch = /~?([ap])~?m(~|$)/, - replaceampm = function(m, ap) { return ap + 'm '; }, - match4Y = /\d\d\d\d/, - matchMonthName = /(^|~)[a-z]{3}/, - matchAMPM = /[ap]m/, - matchcolon = /:/, - matchquarter = /q([1-4])/, - quarters = ['31~mar', '30~jun', '30~sep', '31~dec'], - replacequarter = function(m, n) { return quarters[n - 1]; }, - matchTZ = / ?([+\-]\d\d:?\d\d|Z)$/; - -function getDateType(v) { - var dateType; - dateType = (match4Y.test(v) ? 'Y' : 'y'); - dateType = dateType + (matchMonthName.test(v) ? 'b' : ''); - return dateType; -} - -function getTimeType(v) { - var timeType; - timeType = matchcolon.test(v) ? (matchAMPM.test(v) ? 'I' : 'H') : 'D'; - return timeType; -} - -exports.parseDate = function(v) { - // is it already a date? just return it - if(v.getTime) return v; - /** - * otherwise, if it's not a string, return nothing - * the case of numbers that just have years will get - * dealt with elsewhere. - */ - if(typeof v !== 'string') return false; - - // first clean up the string a bit to reduce the number of formats we have to test - v = v.toLowerCase() - /** - * cut all words down to 3 characters - this will result in - * some spurious matches, ie whenever the first three characters - * of a word match a month or weekday but that seems more likely - * to fix typos than to make dates where they shouldn't be... - * and then we can omit the long form of months from our testing - */ - .replace(matchword, shortenword) - /** - * remove weekday names, as they get overridden anyway if they're - * inconsistent also removes a few more words - * (ie "tuesday the 26th of november") - * TODO: language support? - * for months too, but these seem to be built into d3 - */ - .replace(weekdaymatch, '') - /** - * collapse all separators one ~ at a time, except : which seems - * pretty consistent for the time part use ~ instead of space or - * something since d3 can eat a space as padding on 1-digit numbers - */ - .replace(separatormatch, '~') - // in case of a.m. or p.m. (also take off any space before am/pm) - .replace(ampmmatch, replaceampm) - // turn quarters Q1-4 into dates (quarter ends) - .replace(matchquarter, replacequarter) - .trim() - // also try to ignore timezone info, at least for now - .replace(matchTZ, ''); - - // now test against the various formats that might match - var out = null, - dateType = getDateType(v), - timeType = getTimeType(v), - formatList, - len; - - formatList = dateTimeFormats[dateType][timeType]; - len = formatList.length; - - for(var i = 0; i < len; i++) { - out = formatList[i].parse(v); - if(out) break; +// normalize date format to date string, in case it starts as +// a Date object or milliseconds +// optional dflt is the return value if cleaning fails +exports.cleanDate = function(v, dflt) { + if(exports.isJSDate(v) || typeof v === 'number') { + // NOTE: if someone puts in a year as a number rather than a string, + // this will mistakenly convert it thinking it's milliseconds from 1970 + // that is: '2012' -> Jan. 1, 2012, but 2012 -> 2012 epoch milliseconds + v = exports.ms2DateTime(+v); + if(!v && dflt !== undefined) return dflt; } - - // If not an instance of Date at this point, just return it. - if(!(out instanceof Date)) return false; - // parse() method interprets arguments with local time zone. - var tzoff = out.getTimezoneOffset(); - // In general (default) this is not what we want, so force into UTC: - out.setTime(out.getTime() + tzoff * 60 * 1000); - return out; + else if(!exports.isDateTime(v)) { + logError('unrecognized date', v); + return dflt; + } + return v; }; -},{"d3":74,"fast-isnumeric":82}],357:[function(require,module,exports){ +},{"../constants/numerical":350,"./loggers":367,"d3":74,"fast-isnumeric":82}],358:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60282,7 +60093,7 @@ var Events = { module.exports = Events; -},{"events":80}],358:[function(require,module,exports){ +},{"events":80}],359:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60396,7 +60207,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":364}],359:[function(require,module,exports){ +},{"./is_plain_object.js":366}],360:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60447,7 +60258,38 @@ module.exports = function filterUnique(array) { return out; }; -},{}],360:[function(require,module,exports){ +},{}],361:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +/** Filter out object items with visible !== true + * insider array container. + * + * @param {array of objects} container + * @return {array of objects} of length <= container + * + */ +module.exports = function filterVisible(container) { + var out = []; + + for(var i = 0; i < container.length; i++) { + var item = container[i]; + + if(item.visible === true) out.push(item); + } + + return out; +}; + +},{}],362:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60530,7 +60372,7 @@ function formatColor(containerIn, opacityIn, len) { module.exports = formatColor; -},{"../components/color/attributes":267,"../components/colorscale":283,"./str2rgbarray":375,"fast-isnumeric":82,"tinycolor2":241}],361:[function(require,module,exports){ +},{"../components/color/attributes":267,"../components/colorscale":282,"./str2rgbarray":377,"fast-isnumeric":82,"tinycolor2":241}],363:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60599,7 +60441,7 @@ function convertHTMLToUnicode(html) { module.exports = convertHTMLToUnicode; -},{"../constants/string_mappings":351,"superscript-text":239}],362:[function(require,module,exports){ +},{"../constants/string_mappings":351,"superscript-text":239}],364:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60625,19 +60467,15 @@ lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; lib.validate = coerceModule.validate; -lib.isValObject = coerceModule.isValObject; -lib.crawl = coerceModule.crawl; -lib.findArrayAttributes = coerceModule.findArrayAttributes; -lib.IS_SUBPLOT_OBJ = coerceModule.IS_SUBPLOT_OBJ; -lib.IS_LINKED_TO_ARRAY = coerceModule.IS_LINKED_TO_ARRAY; -lib.DEPRECATED = coerceModule.DEPRECATED; -lib.UNDERSCORE_ATTRS = coerceModule.UNDERSCORE_ATTRS; var datesModule = require('./dates'); lib.dateTime2ms = datesModule.dateTime2ms; lib.isDateTime = datesModule.isDateTime; lib.ms2DateTime = datesModule.ms2DateTime; -lib.parseDate = datesModule.parseDate; +lib.cleanDate = datesModule.cleanDate; +lib.isJSDate = datesModule.isJSDate; +lib.MIN_MS = datesModule.MIN_MS; +lib.MAX_MS = datesModule.MAX_MS; var searchModule = require('./search'); lib.findBin = searchModule.findBin; @@ -60678,6 +60516,10 @@ lib.error = loggersModule.error; lib.notifier = require('./notifier'); lib.filterUnique = require('./filter_unique'); +lib.filterVisible = require('./filter_visible'); + + +lib.cleanNumber = require('./clean_number'); /** * swap x and y of the same attribute in container cont @@ -60854,7 +60696,7 @@ lib.smooth = function(arrayIn, FWHM) { * as long as its returns are not promises (ie have no .then) * includes one argument arg to send to all functions... * this is mainly just to prevent us having to make wrapper functions - * when the only purpose of the wrapper is to reference gd / td + * when the only purpose of the wrapper is to reference gd * and a final step to be executed at the end * TODO: if there's an error and everything is sync, * this doesn't happen yet because we want to make sure @@ -61327,7 +61169,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./coerce":355,"./dates":356,"./extend":358,"./filter_unique":359,"./is_array":363,"./is_plain_object":364,"./loggers":365,"./matrix":366,"./nested_property":367,"./notifier":368,"./search":371,"./stats":374,"d3":74}],363:[function(require,module,exports){ +},{"./clean_number":355,"./coerce":356,"./dates":357,"./extend":359,"./filter_unique":360,"./filter_visible":361,"./is_array":365,"./is_plain_object":366,"./loggers":367,"./matrix":368,"./nested_property":369,"./notifier":370,"./search":373,"./stats":376,"d3":74}],365:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61345,7 +61187,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ArrayBuffer.isView(a); }; -},{}],364:[function(require,module,exports){ +},{}],366:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61374,7 +61216,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],365:[function(require,module,exports){ +},{}],367:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61441,7 +61283,7 @@ loggers.error = function() { } }; -},{"../plot_api/plot_config":379}],366:[function(require,module,exports){ +},{"../plot_api/plot_config":381}],368:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61551,7 +61393,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],367:[function(require,module,exports){ +},{}],369:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61808,7 +61650,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./is_array":363,"fast-isnumeric":82}],368:[function(require,module,exports){ +},{"./is_array":365,"fast-isnumeric":82}],370:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61885,7 +61727,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":74,"fast-isnumeric":82}],369:[function(require,module,exports){ +},{"d3":74,"fast-isnumeric":82}],371:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -62125,7 +61967,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"./matrix":366}],370:[function(require,module,exports){ +},{"./matrix":368}],372:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -62336,7 +62178,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":362,"../plot_api/plot_config":379}],371:[function(require,module,exports){ +},{"../lib":364,"../plot_api/plot_config":381}],373:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -62447,7 +62289,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":365,"fast-isnumeric":82}],372:[function(require,module,exports){ +},{"./loggers":367,"fast-isnumeric":82}],374:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -62470,7 +62312,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],373:[function(require,module,exports){ +},{}],375:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -62519,7 +62361,7 @@ module.exports = function showWebGlMsg(scene) { return false; }; -},{"../components/color":268}],374:[function(require,module,exports){ +},{"../components/color":268}],376:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -62615,7 +62457,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":82}],375:[function(require,module,exports){ +},{"fast-isnumeric":82}],377:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -62637,7 +62479,7 @@ function str2RgbaArray(color) { module.exports = str2RgbaArray; -},{"arraytools":15,"tinycolor2":241}],376:[function(require,module,exports){ +},{"arraytools":15,"tinycolor2":241}],378:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -62751,8 +62593,8 @@ exports.convertToTspans = function(_context, _callback) { } if(tex) { - var td = Lib.getPlotDiv(that.node()); - ((td && td._promises) || []).push(new Promise(function(resolve) { + var gd = Lib.getPlotDiv(that.node()); + ((gd && gd._promises) || []).push(new Promise(function(resolve) { that.style({visibility: 'hidden'}); var config = {fontSize: parseInt(that.style('font-size'), 10)}; @@ -63164,7 +63006,7 @@ exports.makeEditable = function(context, _delegate, options) { return d3.rebind(this, dispatch, 'on'); }; -},{"../constants/string_mappings":351,"../constants/xmlns_namespaces":352,"../lib":362,"d3":74}],377:[function(require,module,exports){ +},{"../constants/string_mappings":351,"../constants/xmlns_namespaces":352,"../lib":364,"d3":74}],379:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -63269,13 +63111,12 @@ exports.cleanLayout = function(layout) { } } - if(layout.annotations !== undefined && !Array.isArray(layout.annotations)) { - Lib.warn('Annotations must be an array.'); - delete layout.annotations; - } - var annotationsLen = (layout.annotations || []).length; + var annotationsLen = Array.isArray(layout.annotations) ? layout.annotations.length : 0; for(i = 0; i < annotationsLen; i++) { var ann = layout.annotations[i]; + + if(!Lib.isPlainObject(ann)) continue; + if(ann.ref) { if(ann.ref === 'paper') { ann.xref = 'paper'; @@ -63287,17 +63128,17 @@ exports.cleanLayout = function(layout) { } delete ann.ref; } + cleanAxRef(ann, 'xref'); cleanAxRef(ann, 'yref'); } - if(layout.shapes !== undefined && !Array.isArray(layout.shapes)) { - Lib.warn('Shapes must be an array.'); - delete layout.shapes; - } - var shapesLen = (layout.shapes || []).length; + var shapesLen = Array.isArray(layout.shapes) ? layout.shapes.length : 0; for(i = 0; i < shapesLen; i++) { var shape = layout.shapes[i]; + + if(!Lib.isPlainObject(shape)) continue; + cleanAxRef(shape, 'xref'); cleanAxRef(shape, 'yref'); } @@ -63646,7 +63487,7 @@ exports.manageArrayContainers = function(np, newVal, undoit) { } }; -},{"../components/color":268,"../lib":362,"../plots/cartesian/axes":390,"../plots/plots":428,"../registry":436,"fast-isnumeric":82,"gl-mat4/fromQuat":109}],378:[function(require,module,exports){ +},{"../components/color":268,"../lib":364,"../plots/cartesian/axes":393,"../plots/plots":430,"../registry":438,"fast-isnumeric":82,"gl-mat4/fromQuat":109}],380:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -65566,13 +65407,14 @@ function _relayout(gd, aobj) { objList = layout[objType] || [], obji = objList[objNum] || {}; - // new API, remove annotation / shape with `null` - if(vi === null) aobj[ai] = 'remove'; - // if p.parts is just an annotation number, and val is either // 'add' or an entire annotation to add, the undo is 'remove' // if val is 'remove' then undo is the whole annotation object if(p.parts.length === 2) { + + // new API, remove annotation / shape with `null` + if(vi === null) aobj[ai] = 'remove'; + if(aobj[ai] === 'add' || Lib.isPlainObject(aobj[ai])) { undoit[ai] = 'remove'; } @@ -65607,6 +65449,7 @@ function _relayout(gd, aobj) { } // alter gd.layout else { + var pp1 = String(p.parts[1] || ''); // check whether we can short-circuit a full redraw // 3d or geo at this point just needs to redraw. if(p.parts[0].indexOf('scene') === 0) flags.doplot = true; @@ -65621,17 +65464,17 @@ function _relayout(gd, aobj) { else if(ai.indexOf('title') !== -1) flags.doticks = true; else if(p.parts[0].indexOf('bgcolor') !== -1) flags.dolayoutstyle = true; else if(p.parts.length > 1 && - Lib.containsAny(p.parts[1], ['tick', 'exponent', 'grid', 'zeroline'])) { + Lib.containsAny(pp1, ['tick', 'exponent', 'grid', 'zeroline'])) { flags.doticks = true; } else if(ai.indexOf('.linewidth') !== -1 && ai.indexOf('axis') !== -1) { flags.doticks = flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1].indexOf('line') !== -1) { + else if(p.parts.length > 1 && pp1.indexOf('line') !== -1) { flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1] === 'mirror') { + else if(p.parts.length > 1 && pp1 === 'mirror') { flags.doticks = flags.dolayoutstyle = true; } else if(ai === 'margin.pad') { @@ -65653,7 +65496,7 @@ function _relayout(gd, aobj) { */ else if(['hovermode', 'dragmode'].indexOf(ai) !== -1) flags.domodebar = true; else if(['hovermode', 'dragmode', 'height', - 'width', 'autosize'].indexOf(ai) === -1) { + 'width', 'autosize'].indexOf(ai) === -1) { flags.doplot = true; } @@ -65862,6 +65705,20 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } } + // Execute a callback after the wrapper function has been called n times. + // This is used to defer the resolution until a transition has resovled *and* + // the frame has completed. If it's not done this way, then we get a race + // condition in which the animation might resolve before a transition is complete + // or vice versa. + function callbackOnNthTime(cb, n) { + var cnt = 0; + return function() { + if(cb && ++cnt === n) { + return cb(); + } + }; + } + return new Promise(function(resolve, reject) { function discardExistingFrames() { if(trans._frameQueue.length === 0) { @@ -65906,14 +65763,13 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { frameOpts: frameOpts, transitionOpts: transitionOpts, }; - if(i === frameList.length - 1) { // The last frame in this .animate call stores the promise resolve // and reject callbacks. This is how we ensure that the animation // loop (which may exist as a result of a *different* .animate call) // still resolves or rejecdts this .animate call's promise. once it's // complete. - nextFrame.onComplete = resolve; + nextFrame.onComplete = callbackOnNthTime(resolve, 2); nextFrame.onInterrupt = reject; } @@ -65951,7 +65807,6 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { // Execute the callback and unset it to ensure it doesn't // accidentally get called twice trans._currentFrame.onComplete(); - trans._currentFrame.onComplete = null; } var newFrame = trans._currentFrame = trans._frameQueue.shift(); @@ -65971,7 +65826,12 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { helpers.coerceTraceIndices(gd, newFrame.frame.traces), newFrame.frameOpts, newFrame.transitionOpts - ); + ).then(function() { + if(newFrame.onComplete) { + newFrame.onComplete(); + } + + }); gd.emit('plotly_animatingframe', { name: newFrame.name, @@ -66047,6 +65907,8 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { for(i = 0; i < trans._frames.length; i++) { frame = trans._frames[i]; + if(!frame) continue; + if(allFrames || frame.group === frameOrGroupNameOrFrameList) { frameList.push({ type: 'byname', @@ -66058,14 +65920,15 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } else if(isFrameArray) { for(i = 0; i < frameOrGroupNameOrFrameList.length; i++) { var frameOrName = frameOrGroupNameOrFrameList[i]; - if(typeof frameOrName === 'string') { + if(['number', 'string'].indexOf(typeof frameOrName) !== -1) { + frameOrName = String(frameOrName); // In this case, there's an array and this frame is a string name: frameList.push({ type: 'byname', name: frameOrName, data: setTransitionConfig({name: frameOrName}) }); - } else { + } else if(Lib.isPlainObject(frameOrName)) { frameList.push({ type: 'object', data: setTransitionConfig(Lib.extendFlat({}, frameOrName)) @@ -66209,7 +66072,7 @@ Plotly.addFrames = function(gd, frameList, indices) { if(_hash[frame.name]) { // If frame is present, overwrite its definition: for(j = 0; j < _frames.length; j++) { - if(_frames[j].name === frame.name) break; + if((_frames[j] || {}).name === frame.name) break; } ops.push({type: 'replace', index: j, value: frame}); revops.unshift({type: 'replace', index: j, value: _frames[j]}); @@ -66409,7 +66272,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":292,"../components/errorbars":298,"../constants/xmlns_namespaces":352,"../lib":362,"../lib/events":357,"../lib/queue":370,"../lib/svg_text_utils":376,"../plotly":386,"../plots/cartesian/graph_interact":398,"../plots/plots":428,"../plots/polar":431,"../registry":436,"./helpers":377,"./subroutines":383,"d3":74,"fast-isnumeric":82}],379:[function(require,module,exports){ +},{"../components/drawing":291,"../components/errorbars":297,"../constants/xmlns_namespaces":352,"../lib":364,"../lib/events":358,"../lib/queue":372,"../lib/svg_text_utils":378,"../plotly":388,"../plots/cartesian/graph_interact":400,"../plots/plots":430,"../plots/polar":433,"../registry":438,"./helpers":379,"./subroutines":385,"d3":74,"fast-isnumeric":82}],381:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66529,7 +66392,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],380:[function(require,module,exports){ +},{}],382:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66541,185 +66404,287 @@ function defaultSetBackground(gd, bgColor) { 'use strict'; -var Plotly = require('../plotly'); var Registry = require('../registry'); -var Plots = require('../plots/plots'); var Lib = require('../lib'); -// FIXME polar attribute are not part of Plotly yet +var baseAttributes = require('../plots/attributes'); +var baseLayoutAttributes = require('../plots/layout_attributes'); +var frameAttributes = require('../plots/frame_attributes'); +var animationAttributes = require('../plots/animation_attributes'); + +// polar attributes are not part of the Registry yet var polarAreaAttrs = require('../plots/polar/area_attributes'); var polarAxisAttrs = require('../plots/polar/axis_attributes'); var extendFlat = Lib.extendFlat; var extendDeep = Lib.extendDeep; -var extendDeepAll = Lib.extendDeepAll; -var NESTED_MODULE = '_nestedModules', - COMPOSED_MODULE = '_composedModules'; +var IS_SUBPLOT_OBJ = '_isSubplotObj'; +var IS_LINKED_TO_ARRAY = '_isLinkedToArray'; +var DEPRECATED = '_deprecated'; +var UNDERSCORE_ATTRS = [IS_SUBPLOT_OBJ, IS_LINKED_TO_ARRAY, DEPRECATED]; -var plotSchema = { - traces: {}, - layout: {}, - transforms: {}, - defs: {} -}; +exports.IS_SUBPLOT_OBJ = IS_SUBPLOT_OBJ; +exports.IS_LINKED_TO_ARRAY = IS_LINKED_TO_ARRAY; +exports.DEPRECATED = DEPRECATED; +exports.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS; +/** Outputs the full plotly.js plot schema + * + * @return {object} + * - defs + * - traces + * - layout + * - transforms + * - frames + * - animations + * - config (coming soon ...) + */ +exports.get = function() { + var traces = {}; -var PlotSchema = module.exports = {}; + Registry.allTypes.concat('area').forEach(function(type) { + traces[type] = getTraceAttributes(type); + }); + var transforms = {}; -PlotSchema.get = function() { - Registry.allTypes - .concat('area') // FIXME polar 'area' attributes - .forEach(getTraceAttributes); + Object.keys(Registry.transformsRegistry).forEach(function(type) { + transforms[type] = getTransformAttributes(type); + }); - getLayoutAttributes(); + return { + defs: { + valObjects: Lib.valObjects, + metaKeys: UNDERSCORE_ATTRS.concat['description', 'role'] + }, - Object.keys(Registry.transformsRegistry).forEach(getTransformAttributes); + traces: traces, + layout: getLayoutAttributes(), - getDefs(); + transforms: transforms, - return plotSchema; + frames: formatAttributes(frameAttributes), + animation: formatAttributes(animationAttributes) + }; }; -PlotSchema.crawl = Lib.crawl; +/** + * Crawl the attribute tree, recursively calling a callback function + * + * @param {object} attrs + * The node of the attribute tree (e.g. the root) from which recursion originates + * @param {Function} callback + * A callback function with the signature: + * @callback callback + * @param {object} attr an attribute + * @param {String} attrName name string + * @param {object[]} attrs all the attributes + * @param {Number} level the recursion level, 0 at the root + * @param {Number} [specifiedLevel] + * The level in the tree, in order to let the callback function detect descend or backtrack, + * typically unsupplied (implied 0), just used by the self-recursive call. + * The necessity arises because the tree traversal is not controlled by callback return values. + * The decision to not use callback return values for controlling tree pruning arose from + * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions + * precedes the callback call. + * + * @return {object} transformOut + * copy of transformIn that contains attribute defaults + */ +exports.crawl = function(attrs, callback, specifiedLevel) { + var level = specifiedLevel || 0; -PlotSchema.isValObject = Lib.isValObject; + Object.keys(attrs).forEach(function(attrName) { + var attr = attrs[attrName]; -function getTraceAttributes(type) { - var globalAttributes = Plots.attributes, - _module = getModule({type: type}), - meta = getMeta(type), - subplotRegistry = getSubplotRegistry(type); + if(UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - var attributes = {}, - layoutAttributes = {}; + callback(attr, attrName, attrs, level); - // make 'type' the first attribute in the object - attributes.type = null; + if(exports.isValObject(attr)) return; - // global attributes (same for all trace types) - extendDeep(attributes, globalAttributes); + if(Lib.isPlainObject(attr)) exports.crawl(attr, callback, level + 1); + }); +}; - // module attributes (+ nested + composed) - attributes = coupleAttrs( - _module.attributes, attributes, 'attributes', type - ); +/** Is object a value object (or a container object)? + * + * @param {object} obj + * @return {boolean} + * returns true for a valid value object and + * false for tree nodes in the attribute hierarchy + */ +exports.isValObject = function(obj) { + return obj && obj.valType !== undefined; +}; - // subplot attributes - if(subplotRegistry.attributes !== undefined) { - extendDeep(attributes, subplotRegistry.attributes); +/** + * Find all data array attributes in a given trace object - including + * `arrayOk` attributes. + * + * @param {object} trace + * full trace object that contains a reference to `_module.attributes` + * + * @return {array} arrayAttributes + * list of array attributes for the given trace + */ +exports.findArrayAttributes = function(trace) { + var arrayAttributes = [], + stack = []; + + function callback(attr, attrName, attrs, level) { + stack = stack.slice(0, level).concat([attrName]); + + var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; + if(!splittableAttr) return; + + var astr = toAttrString(stack); + var val = Lib.nestedProperty(trace, astr).get(); + if(!Array.isArray(val)) return; + + arrayAttributes.push(astr); } - // 'type' gets overwritten by globalAttributes; reset it here - attributes.type = type; + function toAttrString(stack) { + return stack.join('.'); + } - attributes = removeUnderscoreAttrs(attributes); - mergeValTypeAndRole(attributes); - plotSchema.traces[type] = extendFlat({}, - meta, - { attributes: attributes } - ); + exports.crawl(trace._module.attributes, callback); - // trace-specific layout attributes - if(_module.layoutAttributes !== undefined) { - layoutAttributes = coupleAttrs( - _module.layoutAttributes, layoutAttributes, 'layoutAttributes', type - ); + if(trace.transforms) { + var transforms = trace.transforms; + + for(var i = 0; i < transforms.length; i++) { + var transform = transforms[i]; - mergeValTypeAndRole(layoutAttributes); - plotSchema.traces[type].layoutAttributes = layoutAttributes; + stack = ['transforms[' + i + ']']; + exports.crawl(transform._module.attributes, callback, 1); + } } -} -function getLayoutAttributes() { - var globalLayoutAttributes = Plots.layoutAttributes, - layoutAttributes = {}; + // Look into the fullInput module attributes for array attributes + // to make sure that 'custom' array attributes are detected. + // + // At the moment, we need this block to make sure that + // ohlc and candlestick 'open', 'high', 'low', 'close' can be + // used with filter ang groupby transforms. + if(trace._fullInput) { + exports.crawl(trace._fullInput._module.attributes, callback); - // layout module attributes (+ nested + composed) - layoutAttributes = coupleAttrs( - globalLayoutAttributes, layoutAttributes, 'layoutAttributes', '*' - ); + arrayAttributes = Lib.filterUnique(arrayAttributes); + } - // FIXME polar layout attributes - layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); + return arrayAttributes; +}; - // add crawler.IS_SUBPLOT_OBJ attribute - layoutAttributes = handleSubplotObjs(layoutAttributes); +function getTraceAttributes(type) { + var _module, basePlotModule; - layoutAttributes = removeUnderscoreAttrs(layoutAttributes); - mergeValTypeAndRole(layoutAttributes); + if(type === 'area') { + _module = { attributes: polarAreaAttrs }; + basePlotModule = {}; + } + else { + _module = Registry.modules[type]._module, + basePlotModule = _module.basePlotModule; + } - // generate crawler.IS_LINKED_TO_ARRAY structure - handleLinkedToArray(layoutAttributes); + var attributes = {}; - plotSchema.layout = { layoutAttributes: layoutAttributes }; -} + // make 'type' the first attribute in the object + attributes.type = null; -function getTransformAttributes(name) { - var _module = Registry.transformsRegistry[name], - _schema = {}; + // base attributes (same for all trace types) + extendDeep(attributes, baseAttributes); - _schema = coupleAttrs(_schema, _module.attributes || {}, 'attributes', '*'); - _schema = removeUnderscoreAttrs(_schema); - mergeValTypeAndRole(_schema); - handleLinkedToArray(_schema); + // module attributes + extendDeep(attributes, _module.attributes); - plotSchema.transforms[name] = { attributes: _schema }; -} + // subplot attributes + if(basePlotModule.attributes) { + extendDeep(attributes, basePlotModule.attributes); + } + + // 'type' gets overwritten by baseAttributes; reset it here + attributes.type = type; -function getDefs() { - plotSchema.defs = { - valObjects: Lib.valObjects, - metaKeys: Lib.UNDERSCORE_ATTRS.concat(['description', 'role']) + var out = { + meta: _module.meta || {}, + attributes: formatAttributes(attributes), }; + + // trace-specific layout attributes + if(_module.layoutAttributes) { + var layoutAttributes = {}; + + extendDeep(layoutAttributes, _module.layoutAttributes); + out.layoutAttributes = formatAttributes(layoutAttributes); + } + + return out; } -function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) { - var nestedModule, nestedAttrs, nestedReference, - composedModule, composedAttrs; +function getLayoutAttributes() { + var layoutAttributes = {}; - Object.keys(attrsIn).forEach(function(k) { + // global layout attributes + extendDeep(layoutAttributes, baseLayoutAttributes); - if(k === NESTED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - nestedModule = getModule({_module: attrsIn[k][kk]}); - if(nestedModule === undefined) return; + // add base plot module layout attributes + Object.keys(Registry.subplotsRegistry).forEach(function(k) { + var _module = Registry.subplotsRegistry[k]; - nestedAttrs = nestedModule[whichAttrs]; - nestedReference = coupleAttrs( - nestedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - Lib.nestedProperty(attrsOut, kk) - .set(extendDeep({}, nestedReference)); - }); - return; + if(_module.name === 'cartesian') { + handleBasePlotModule(layoutAttributes, _module, 'xaxis'); + handleBasePlotModule(layoutAttributes, _module, 'yaxis'); } + else { + var astr = _module.attr === 'subplot' ? _module.name : _module.attr; - if(k === COMPOSED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - if(kk !== type) return; + handleBasePlotModule(layoutAttributes, _module, astr); + } + }); - composedModule = getModule({_module: attrsIn[k][kk]}); - if(composedModule === undefined) return; + // polar layout attributes + layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); - composedAttrs = composedModule[whichAttrs]; - composedAttrs = coupleAttrs( - composedAttrs, {}, whichAttrs, type - ); + // add registered components layout attribute + Object.keys(Registry.componentsRegistry).forEach(function(k) { + var _module = Registry.componentsRegistry[k]; - extendDeepAll(attrsOut, composedAttrs); + if(!_module.layoutAttributes) return; + + if(Array.isArray(_module.layoutNodes)) { + _module.layoutNodes.forEach(function(v) { + handleRegisteredComponent(layoutAttributes, _module, v + _module.name); }); - return; } - - attrsOut[k] = Lib.isPlainObject(attrsIn[k]) ? - extendDeepAll({}, attrsIn[k]) : - attrsIn[k]; + else { + handleRegisteredComponent(layoutAttributes, _module, _module.name); + } }); - return attrsOut; + return { + layoutAttributes: formatAttributes(layoutAttributes) + }; +} + +function getTransformAttributes(type) { + var _module = Registry.transformsRegistry[type]; + + return { + attributes: formatAttributes(_module.attributes) + }; +} + +function formatAttributes(attrs) { + mergeValTypeAndRole(attrs); + formatArrayContainers(attrs); + + return attrs; } function mergeValTypeAndRole(attrs) { @@ -66733,7 +66698,7 @@ function mergeValTypeAndRole(attrs) { } function callback(attr, attrName, attrs) { - if(PlotSchema.isValObject(attr)) { + if(exports.isValObject(attr)) { if(attr.valType === 'data_array') { // all 'data_array' attrs have role 'data' attr.role = 'data'; @@ -66751,40 +66716,26 @@ function mergeValTypeAndRole(attrs) { } } - Lib.crawl(attrs, callback); + exports.crawl(attrs, callback); } -// helper methods +function formatArrayContainers(attrs) { -function getModule(arg) { - if('type' in arg) { - return (arg.type === 'area') ? // FIXME - { attributes: polarAreaAttrs } : - Registry.getModule({type: arg.type}); - } + function callback(attr, attrName, attrs) { + if(!attr) return; - var subplotsRegistry = Registry.subplotsRegistry, - componentsRegistry = Registry.componentsRegistry, - _module = arg._module; + var itemName = attr[IS_LINKED_TO_ARRAY]; - if(subplotsRegistry[_module]) return subplotsRegistry[_module]; - else if(componentsRegistry[_module]) return componentsRegistry[_module]; + if(!itemName) return; - // look it internal Plotly if all previous attempts fail - return Plotly[_module]; -} + delete attr[IS_LINKED_TO_ARRAY]; -function removeUnderscoreAttrs(attributes) { - Object.keys(attributes).forEach(function(k) { - if(k.charAt(0) === '_' && - Lib.UNDERSCORE_ATTRS.indexOf(k) === -1) delete attributes[k]; - }); - return attributes; -} + attrs[attrName] = { items: {} }; + attrs[attrName].items[itemName] = attr; + attrs[attrName].role = 'object'; + } -function getMeta(type) { - if(type === 'area') return {}; // FIXME - return Registry.modules[type].meta || {}; + exports.crawl(attrs, callback); } function assignPolarLayoutAttrs(layoutAttributes) { @@ -66795,68 +66746,25 @@ function assignPolarLayoutAttrs(layoutAttributes) { extendFlat(layoutAttributes, polarAxisAttrs.layout); - return layoutAttributes; // FIXME + return layoutAttributes; } -function getSubplotRegistry(traceType) { - if(traceType === 'area') return {}; // FIXME - - var subplotsRegistry = Registry.subplotsRegistry, - subplotType = Object.keys(subplotsRegistry).filter(function(subplotType) { - return Registry.traceIs({type: traceType}, subplotType); - })[0]; - - if(subplotType === undefined) return {}; +function handleBasePlotModule(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep({}, _module.layoutAttributes); - return subplotsRegistry[subplotType]; + attrs[IS_SUBPLOT_OBJ] = true; + np.set(attrs); } -function handleSubplotObjs(layoutAttributes) { - var subplotsRegistry = Registry.subplotsRegistry; - - Object.keys(layoutAttributes).forEach(function(k) { - Object.keys(subplotsRegistry).forEach(function(subplotType) { - var subplotRegistry = subplotsRegistry[subplotType], - isSubplotObj; - - if(!subplotRegistry.attrRegex) return; - - if(subplotType === 'cartesian' || subplotType === 'gl2d') { - isSubplotObj = ( - subplotRegistry.attrRegex.x.test(k) || - subplotRegistry.attrRegex.y.test(k) - ); - } - else { - isSubplotObj = subplotRegistry.attrRegex.test(k); - } - - if(isSubplotObj) layoutAttributes[k][Lib.IS_SUBPLOT_OBJ] = true; - }); - }); +function handleRegisteredComponent(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep(np.get() || {}, _module.layoutAttributes); - return layoutAttributes; + np.set(attrs); } -function handleLinkedToArray(layoutAttributes) { - - function callback(attr, attrName, attrs) { - if(attr[Lib.IS_LINKED_TO_ARRAY] !== true) return; - - // TODO more robust logic - var itemName = attrName.substr(0, attrName.length - 1); - - delete attr[Lib.IS_LINKED_TO_ARRAY]; - - attrs[attrName] = { items: {} }; - attrs[attrName].items[itemName] = attr; - attrs[attrName].role = 'object'; - } - - Lib.crawl(layoutAttributes, callback); -} - -},{"../lib":362,"../plotly":386,"../plots/plots":428,"../plots/polar/area_attributes":429,"../plots/polar/axis_attributes":430,"../registry":436}],381:[function(require,module,exports){ +},{"../lib":364,"../plots/animation_attributes":389,"../plots/attributes":391,"../plots/frame_attributes":414,"../plots/layout_attributes":428,"../plots/polar/area_attributes":431,"../plots/polar/axis_attributes":432,"../registry":438}],383:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66948,10 +66856,14 @@ function registerTransformModule(newModule) { } function registerComponentModule(newModule) { - Registry.componentsRegistry[newModule.name] = newModule; + if(typeof newModule.name !== 'string') { + throw new Error('Component module *name* must be a string.'); + } + + Registry.registerComponent(newModule); } -},{"../lib":362,"../registry":436}],382:[function(require,module,exports){ +},{"../lib":364,"../registry":438}],384:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66977,7 +66889,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":362,"../plotly":386}],383:[function(require,module,exports){ +},{"../lib":364,"../plotly":388}],385:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67299,7 +67211,7 @@ exports.doModeBar = function(gd) { return Plots.previousPromises(gd); }; -},{"../components/color":268,"../components/drawing":292,"../components/modebar":315,"../components/titles":343,"../lib":362,"../plotly":386,"../plots/plots":428,"../registry":436}],384:[function(require,module,exports){ +},{"../components/color":268,"../components/drawing":291,"../components/modebar":314,"../components/titles":342,"../lib":364,"../plotly":388,"../plots/plots":430,"../registry":438}],386:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67354,7 +67266,7 @@ function toImage(gd, opts) { // first clone the GD so we can operate in a clean environment var clone = clonePlot(gd, {format: 'png', height: opts.height, width: opts.width}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -67409,7 +67321,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":362,"../plotly":386,"../snapshot/cloneplot":437,"../snapshot/helpers":440,"../snapshot/svgtoimg":442,"../snapshot/tosvg":444,"fast-isnumeric":82}],385:[function(require,module,exports){ +},{"../lib":364,"../plotly":388,"../snapshot/cloneplot":439,"../snapshot/helpers":442,"../snapshot/svgtoimg":444,"../snapshot/tosvg":446,"fast-isnumeric":82}],387:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67585,7 +67497,8 @@ function crawl(objIn, objOut, schema, list, base, path) { crawl(valIn, valOut, nestedSchema, list, base, p); } else if(nestedSchema.items && !isInfoArray && isArray(valIn)) { - var itemName = k.substr(0, k.length - 1), + var items = nestedSchema.items, + _nestedSchema = items[Object.keys(items)[0]], indexList = []; var j, _p; @@ -67593,8 +67506,7 @@ function crawl(objIn, objOut, schema, list, base, path) { // loop over valOut items while keeping track of their // corresponding input container index (given by _index) for(j = 0; j < valOut.length; j++) { - var _nestedSchema = nestedSchema.items[itemName], - _index = valOut[j]._index || j; + var _index = valOut[j]._index || j; _p = p.slice(); _p.push(_index); @@ -67779,7 +67691,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":362,"../plots/plots":428,"./plot_schema":380}],386:[function(require,module,exports){ +},{"../lib":364,"../plots/plots":430,"./plot_schema":382}],388:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67807,25 +67719,12 @@ exports.defaultConfig = require('./plot_api/plot_config'); exports.Plots = require('./plots/plots'); exports.Axes = require('./plots/cartesian/axes'); exports.Fx = require('./plots/cartesian/graph_interact'); - -// components -exports.Color = require('./components/color'); -exports.Drawing = require('./components/drawing'); -exports.Colorscale = require('./components/colorscale'); -exports.Colorbar = require('./components/colorbar'); -exports.ErrorBars = require('./components/errorbars'); -exports.Annotations = require('./components/annotations'); -exports.Shapes = require('./components/shapes'); -exports.Legend = require('./components/legend'); -exports.Images = require('./components/images'); -exports.UpdateMenus = require('./components/updatemenus'); -exports.Sliders = require('./components/sliders'); exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/annotations":266,"./components/color":268,"./components/colorbar":273,"./components/colorscale":283,"./components/drawing":292,"./components/errorbars":298,"./components/images":304,"./components/legend":312,"./components/modebar":315,"./components/shapes":336,"./components/sliders":342,"./components/updatemenus":348,"./plot_api/plot_api":378,"./plot_api/plot_config":379,"./plots/cartesian/axes":390,"./plots/cartesian/graph_interact":398,"./plots/plots":428}],387:[function(require,module,exports){ +},{"./components/modebar":314,"./plot_api/plot_api":380,"./plot_api/plot_config":381,"./plots/cartesian/axes":393,"./plots/cartesian/graph_interact":400,"./plots/plots":430}],389:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67927,7 +67826,76 @@ module.exports = { } }; -},{}],388:[function(require,module,exports){ +},{}],390:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var Lib = require('../lib'); + + +/** Convenience wrapper for making array container logic DRY and consistent + * + * @param {object} parentObjIn + * user input object where the container in question is linked + * (i.e. either a user trace object or the user layout object) + * + * @param {object} parentObjOut + * full object where the coerced container will be linked + * (i.e. either a full trace object or the full layout object) + * + * @param {object} opts + * options object: + * - name {string} + * name of the key linking the container in question + * - handleItemDefaults {function} + * defaults method to be called on each item in the array container in question + * + * Its arguments are: + * - itemIn {object} item in user layout + * - itemOut {object} item in full layout + * - parentObj {object} (as in closure) + * - opts {object} (as in closure) + * - itemOpts {object} + * - itemIsNotPlainObject {boolean} + * N.B. + * + * - opts is passed to handleItemDefaults so it can also store + * links to supplementary data (e.g. fullData for layout components) + * + */ +module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut, opts) { + var name = opts.name; + + var contIn = Array.isArray(parentObjIn[name]) ? parentObjIn[name] : [], + contOut = parentObjOut[name] = []; + + for(var i = 0; i < contIn.length; i++) { + var itemIn = contIn[i], + itemOut = {}, + itemOpts = {}; + + if(!Lib.isPlainObject(itemIn)) { + itemOpts.itemIsNotPlainObject = true; + itemIn = {}; + } + + opts.handleItemDefaults(itemIn, itemOut, parentObjOut, opts, itemOpts); + + itemOut._input = itemIn; + itemOut._index = i; + + contOut.push(itemOut); + } +}; + +},{"../lib":364}],391:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -68010,7 +67978,7 @@ module.exports = { } }; -},{}],389:[function(require,module,exports){ +},{}],392:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -68037,7 +68005,7 @@ module.exports = { } }; -},{}],390:[function(require,module,exports){ +},{}],393:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -68059,6 +68027,15 @@ var Titles = require('../../components/titles'); var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); +var constants = require('../../constants/numerical'); +var FP_SAFE = constants.FP_SAFE; +var ONEAVGYEAR = constants.ONEAVGYEAR; +var ONEAVGMONTH = constants.ONEAVGMONTH; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + var axes = module.exports = {}; @@ -68076,43 +68053,88 @@ axes.getFromId = axisIds.getFromId; axes.getFromTrace = axisIds.getFromTrace; -// find the list of possible axes to reference with an xref or yref attribute -// and coerce it to that list -axes.coerceRef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = axLetter + 'ref', +/* + * find the list of possible axes to reference with an xref or yref attribute + * and coerce it to that list + * + * attr: the attribute we're generating a reference for. Should end in 'x' or 'y' + * but can be prefixed, like 'ax' for annotation's arrow x + * dflt: the default to coerce to, or blank to use the first axis (falling back on + * extraOption if there is no axis) + * extraOption: aside from existing axes with this letter, what non-axis value is allowed? + * Only required if it's different from `dflt` + */ +axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption) { + var axLetter = attr.charAt(attr.length - 1), + axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), + refAttr = attr + 'ref', attrDef = {}; + if(!dflt) dflt = axlist[0] || extraOption; + if(!extraOption) extraOption = dflt; + // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(['paper']), - dflt: dflt || axlist[0] || 'paper' + values: axlist.concat(extraOption ? [extraOption] : []), + dflt: dflt }; // xref, yref return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; -// todo: duplicated per github PR 610. Should be consolidated with axes.coerceRef. -// find the list of possible axes to reference with an axref or ayref attribute -// and coerce it to that list -axes.coerceARef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = 'a' + axLetter + 'ref', - attrDef = {}; +/* + * coerce position attributes (range-type) that can be either on axes or absolute + * (paper or pixel) referenced. The biggest complication here is that we don't know + * before looking at the axis whether the value must be a number or not (it may be + * a date string), so we can't use the regular valType='number' machinery + * + * axRef (string): the axis this position is referenced to, or: + * paper: fraction of the plot area + * pixel: pixels relative to some starting position + * attr (string): the attribute in containerOut we are coercing + * dflt (number): the default position, as a fraction or pixels. If the attribute + * is to be axis-referenced, this will be converted to an axis data value + * + * Also cleans the values, since the attribute definition itself has to say + * valType: 'any' to handle date axes. This allows us to accept: + * - for category axes: category names, and convert them here into serial numbers. + * Note that this will NOT work for axis range endpoints, because we don't know + * the category list yet (it's set by ax.makeCalcdata during calc) + * but it works for component (note, shape, images) positions. + * - for date axes: JS Dates or milliseconds, and convert to date strings + * - for other types: coerce them to numbers + */ +axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { + var pos, + newPos; - // data-ref annotations are not supported in gl2d yet + if(axRef === 'paper' || axRef === 'pixel') { + pos = coerce(attr, dflt); + } + else { + var ax = axes.getFromId(gd, axRef); - attrDef[refAttr] = { - valType: 'enumerated', - values: axlist.concat(['pixel']), - dflt: dflt || 'pixel' || axlist[0] - }; + dflt = ax.fraction2r(dflt); + pos = coerce(attr, dflt); - // axref, ayref - return Lib.coerce(containerIn, containerOut, attrDef, refAttr); + if(ax.type === 'category') { + // if position is given as a category name, convert it to a number + if(typeof pos === 'string' && (ax._categories || []).length) { + newPos = ax._categories.indexOf(pos); + containerOut[attr] = (newPos !== -1) ? dflt : newPos; + return; + } + } + else if(ax.type === 'date') { + containerOut[attr] = Lib.cleanDate(pos); + return; + } + } + // finally make sure we have a number (unless date type already returned a string) + containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; }; // empty out types for all axes containing these traces @@ -68138,14 +68160,16 @@ axes.counterLetter = function(id) { // incorporate a new minimum difference and first tick into // forced +// note that _forceTick0 is linearized, so needs to be turned into +// a range value for setting tick0 axes.minDtick = function(ax, newDiff, newFirst, allow) { // doesn't make sense to do forced min dTick on log or category axes, // and the plot itself may decide to cancel (ie non-grouped bars) if(['log', 'category'].indexOf(ax.type) !== -1 || !allow) { ax._minDtick = 0; } - // null means there's nothing there yet - else if(ax._minDtick === null) { + // undefined means there's nothing there yet + else if(ax._minDtick === undefined) { ax._minDtick = newDiff; ax._forceTick0 = newFirst; } @@ -68170,6 +68194,19 @@ axes.minDtick = function(ax, newDiff, newFirst, allow) { } }; +// Find the autorange for this axis +// +// assumes ax._min and ax._max have already been set by calling axes.expand +// using calcdata from all traces. These are arrays of: +// {val: calcdata value, pad: extra pixels beyond this value} +// +// Returns an array of [min, max]. These are calcdata for log and category axes +// and data for linear and date axes. +// +// TODO: we want to change log to data as well, but it's hard to do this +// maintaining backward compatibility. category will always have to use calcdata +// though, because otherwise values between categories (or outside all categories) +// would be impossible. axes.getAutoRange = function(ax) { var newRange = []; @@ -68188,7 +68225,12 @@ axes.getAutoRange = function(ax) { var j, minpt, maxpt, minbest, maxbest, dp, dv, mbest = 0, - axReverse = (ax.range && ax.range[1] < ax.range[0]); + axReverse = false; + + if(ax.range) { + var rng = ax.range.map(ax.r2l); + axReverse = rng[1] < rng[0]; + } // one-time setting to easily reverse the axis // when plotting from code @@ -68277,11 +68319,9 @@ axes.getAutoRange = function(ax) { } // maintain reversal - if(axReverse) { - newRange.reverse(); - } + if(axReverse) newRange.reverse(); - return newRange; + return newRange.map(ax.l2r || Number); }; axes.doAutoRange = function(ax) { @@ -68344,7 +68384,6 @@ axes.saveRangeInitial = function(gd, overwrite) { // (unless one end is overridden by tozero) // tozero: (boolean) make sure to include zero if axis is linear, // and make it a tight bound if possible -var FP_SAFE = Number.MAX_VALUE / 2; axes.expand = function(ax, data, options) { if(!(ax.autorange || ax._needsExpand) || !data) return; if(!ax._min) ax._min = []; @@ -68483,10 +68522,24 @@ axes.autoBin = function(data, ax, nbins, is2d) { } // piggyback off autotick code to make "nice" bin sizes - var dummyax = { - type: ax.type === 'log' ? 'linear' : ax.type, - range: [datamin, datamax] - }; + var dummyax; + if(ax.type === 'log') { + dummyax = { + type: 'linear', + range: [datamin, datamax], + r2l: Number + }; + } + else { + dummyax = { + type: ax.type, + // conversion below would be ax.c2r but that's only different from l2r + // for log, and this is the only place (so far?) we would want c2r. + range: [datamin, datamax].map(ax.l2r), + r2l: ax.r2l + }; + } + axes.autoTicks(dummyax, size0); var binstart = axes.tickIncrement( axes.tickFirst(dummyax), dummyax.dtick, 'reverse'), @@ -68550,8 +68603,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { } return { - start: binstart, - end: binend, + start: ax.c2r(binstart), + end: ax.c2r(binend), size: dummyax.dtick }; }; @@ -68568,6 +68621,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { axes.calcTicks = function calcTicks(ax) { if(ax.tickmode === 'array') return arrayTicks(ax); + var rng = ax.range.map(ax.r2l); + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks, @@ -68582,18 +68637,17 @@ axes.calcTicks = function calcTicks(ax) { nt = Lib.constrain(ax._length / minPx, 4, 9) + 1; } } - axes.autoTicks(ax, Math.abs(ax.range[1] - ax.range[0]) / nt); + axes.autoTicks(ax, Math.abs(rng[1] - rng[0]) / nt); // check for a forced minimum dtick if(ax._minDtick > 0 && ax.dtick < ax._minDtick * 2) { ax.dtick = ax._minDtick; - ax.tick0 = ax._forceTick0; + ax.tick0 = ax.l2r(ax._forceTick0); } } // check for missing tick0 if(!ax.tick0) { - ax.tick0 = (ax.type === 'date') ? - new Date(2000, 0, 1).getTime() : 0; + ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; } // now figure out rounding of tick values @@ -68603,12 +68657,12 @@ axes.calcTicks = function calcTicks(ax) { ax._tmin = axes.tickFirst(ax); // check for reversed axis - var axrev = (ax.range[1] < ax.range[0]); + var axrev = (rng[1] < rng[0]); // return the full set of tick vals var vals = [], // add a tiny bit so we get ticks which may have rounded out - endtick = ax.range[1] * 1.0001 - ax.range[0] * 0.0001; + endtick = rng[1] * 1.0001 - rng[0] * 0.0001; if(ax.type === 'category') { endtick = (axrev) ? Math.max(-0.5, endtick) : Math.min(ax._categories.length - 0.5, endtick); @@ -68626,9 +68680,18 @@ axes.calcTicks = function calcTicks(ax) { // show the exponent only on the last one ax._tmax = vals[vals.length - 1]; + // for showing date suffixes: ax._prevSuffix holds what we showed most + // recently. Start with it cleared and mark that we're in calcTicks (ie + // calculating a whole string of these so we should care what the previous + // suffix was!) + ax._prevSuffix = ''; + ax._inCalcTicks = true; + var ticksOut = new Array(vals.length); for(var i = 0; i < vals.length; i++) ticksOut[i] = axes.tickText(ax, vals[i]); + ax._inCalcTicks = false; + return ticksOut; }; @@ -68636,15 +68699,15 @@ function arrayTicks(ax) { var vals = ax.tickvals, text = ax.ticktext, ticksOut = new Array(vals.length), - r0expanded = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, - r1expanded = ax.range[1] * 1.0001 - ax.range[0] * 0.0001, + rng = ax.range.map(ax.r2l), + r0expanded = rng[0] * 1.0001 - rng[1] * 0.0001, + r1expanded = rng[1] * 1.0001 - rng[0] * 0.0001, tickMin = Math.min(r0expanded, r1expanded), tickMax = Math.max(r0expanded, r1expanded), vali, i, j = 0; - // without a text array, just format the given values as any other ticks // except with more precision to the numbers if(!Array.isArray(text)) text = []; @@ -68684,7 +68747,7 @@ function roundDTick(roughDTick, base, roundingSet) { // outputs (into ax): // tick0: starting point for ticks (not necessarily on the graph) // usually 0 for numeric (=10^0=1 for log) or jan 1, 2000 for dates -// dtick: the actual, nice round tick spacing, somewhat larger than roughDTick +// dtick: the actual, nice round tick spacing, usually a little larger than roughDTick // if the ticks are spaced linearly (linear scale, categories, // log with only full powers, date ticks < month), // this will just be a number @@ -68697,36 +68760,35 @@ axes.autoTicks = function(ax, roughDTick) { var base; if(ax.type === 'date') { - ax.tick0 = new Date(2000, 0, 1).getTime(); + ax.tick0 = '2000-01-01'; + // the criteria below are all based on the rough spacing we calculate + // being > half of the final unit - so precalculate twice the rough val + var roughX2 = 2 * roughDTick; - if(roughDTick > 15778800000) { - // years if roughDTick > 6mo - roughDTick /= 31557600000; + if(roughX2 > ONEAVGYEAR) { + roughDTick /= ONEAVGYEAR; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'M' + (12 * roundDTick(roughDTick, base, roundBase10)); } - else if(roughDTick > 1209600000) { - // months if roughDTick > 2wk - roughDTick /= 2629800000; + else if(roughX2 > ONEAVGMONTH) { + roughDTick /= ONEAVGMONTH; ax.dtick = 'M' + roundDTick(roughDTick, 1, roundBase24); } - else if(roughDTick > 43200000) { - // days if roughDTick > 12h - ax.dtick = roundDTick(roughDTick, 86400000, roundDays); + else if(roughX2 > ONEDAY) { + ax.dtick = roundDTick(roughDTick, ONEDAY, roundDays); // get week ticks on sunday - ax.tick0 = new Date(2000, 0, 2).getTime(); + // this will also move the base tick off 2000-01-01 if dtick is + // 2 or 3 days... but that's a weird enough case that we'll ignore it. + ax.tick0 = '2000-01-02'; } - else if(roughDTick > 1800000) { - // hours if roughDTick > 30m - ax.dtick = roundDTick(roughDTick, 3600000, roundBase24); + else if(roughX2 > ONEHOUR) { + ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } - else if(roughDTick > 30000) { - // minutes if roughDTick > 30sec - ax.dtick = roundDTick(roughDTick, 60000, roundBase60); + else if(roughX2 > ONEMIN) { + ax.dtick = roundDTick(roughDTick, ONEMIN, roundBase60); } - else if(roughDTick > 500) { - // seconds if roughDTick > 0.5sec - ax.dtick = roundDTick(roughDTick, 1000, roundBase60); + else if(roughX2 > ONESEC) { + ax.dtick = roundDTick(roughDTick, ONESEC, roundBase60); } else { // milliseconds @@ -68736,16 +68798,19 @@ axes.autoTicks = function(ax, roughDTick) { } else if(ax.type === 'log') { ax.tick0 = 0; + var rng = ax.range.map(ax.r2l); - // only show powers of 10 - if(roughDTick > 0.7) ax.dtick = Math.ceil(roughDTick); - else if(Math.abs(ax.range[1] - ax.range[0]) < 1) { + if(roughDTick > 0.7) { + // only show powers of 10 + ax.dtick = Math.ceil(roughDTick); + } + else if(Math.abs(rng[1] - rng[0]) < 1) { // span is less than one power of 10 - var nt = 1.5 * Math.abs((ax.range[1] - ax.range[0]) / roughDTick); + var nt = 1.5 * Math.abs((rng[1] - rng[0]) / roughDTick); // ticks on a linear scale, labeled fully - roughDTick = Math.abs(Math.pow(10, ax.range[1]) - - Math.pow(10, ax.range[0])) / nt; + roughDTick = Math.abs(Math.pow(10, rng[1]) - + Math.pow(10, rng[0])) / nt; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'L' + roundDTick(roughDTick, base, roundBase10); } @@ -68784,41 +68849,59 @@ axes.autoTicks = function(ax, roughDTick) { // for date ticks, the last date part to show (y,m,d,H,M,S) // or an integer # digits past seconds function autoTickRound(ax) { - var dtick = ax.dtick, - maxend; + var dtick = ax.dtick; ax._tickexponent = 0; - if(!isNumeric(dtick) && typeof dtick !== 'string') dtick = 1; + if(!isNumeric(dtick) && typeof dtick !== 'string') { + dtick = 1; + } - if(ax.type === 'category') ax._tickround = null; - else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { - if(ax.type === 'date') { - if(dtick >= 86400000) ax._tickround = 'd'; - else if(dtick >= 3600000) ax._tickround = 'H'; - else if(dtick >= 60000) ax._tickround = 'M'; - else if(dtick >= 1000) ax._tickround = 'S'; - else ax._tickround = 3 - Math.round(Math.log(dtick / 2) / Math.LN10); - } + if(ax.type === 'category') { + ax._tickround = null; + } + if(ax.type === 'date') { + // If tick0 is unusual, give tickround a bit more information + // not necessarily *all* the information in tick0 though, if it's really odd + // minimal string length for tick0: 'd' is 10, 'M' is 16, 'S' is 19 + // take off a leading minus (year < 0 so length is consistent) + var tick0ms = Lib.dateTime2ms(ax.tick0), + tick0str = Lib.ms2DateTime(tick0ms).replace(/^-/, ''), + tick0len = tick0str.length; + + if(String(dtick).charAt(0) === 'M') { + // any tick0 more specific than a year: alway show the full date + if(tick0len > 10 || tick0str.substr(5) !== '01-01') ax._tickround = 'd'; + // show the month unless ticks are full multiples of a year + else ax._tickround = (+(dtick.substr(1)) % 12 === 0) ? 'y' : 'm'; + } + else if((dtick >= ONEDAY && tick0len <= 10) || (dtick >= ONEDAY * 15)) ax._tickround = 'd'; + else if((dtick >= ONEMIN && tick0len <= 16) || (dtick >= ONEHOUR)) ax._tickround = 'M'; + else if((dtick >= ONESEC && tick0len <= 19) || (dtick >= ONEMIN)) ax._tickround = 'S'; else { - if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); - // 2 digits past largest digit of dtick - ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); - - if(ax.type === 'log') { - maxend = Math.pow(10, Math.max(ax.range[0], ax.range[1])); - } - else maxend = Math.max(Math.abs(ax.range[0]), Math.abs(ax.range[1])); - - var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { - if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { - ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); - } - else ax._tickexponent = rangeexp; + // of any two adjacent ticks, at least one will have the maximum fractional digits + // of all possible ticks - so take the max. length of tick0 and the next one + var tick1len = Lib.ms2DateTime(tick0ms + dtick).replace(/^-/, '').length; + ax._tickround = Math.max(tick0len, tick1len) - 20; + } + } + else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { + // linear or log (except D1, D2) + var rng = ax.range.map(ax.r2d || Number); + if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); + // 2 digits past largest digit of dtick + ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); + + var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); + + var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); + if(Math.abs(rangeexp) > 3) { + if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { + ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } + else ax._tickexponent = rangeexp; } } - else if(dtick.charAt(0) === 'M') ax._tickround = (dtick.length === 2) ? 'm' : 'y'; + // D1 or D2 (log) else ax._tickround = null; } @@ -68863,13 +68946,16 @@ axes.tickIncrement = function(x, dtick, axrev) { // calculate the first tick on an axis axes.tickFirst = function(ax) { - var axrev = ax.range[1] < ax.range[0], + var r2l = ax.r2l || Number, + rng = ax.range.map(r2l), + axrev = rng[1] < rng[0], sRound = axrev ? Math.floor : Math.ceil, // add a tiny extra bit to make sure we get ticks // that may have been rounded out - r0 = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, + r0 = rng[0] * 1.0001 - rng[1] * 0.0001, dtick = ax.dtick, - tick0 = ax.tick0; + tick0 = r2l(ax.tick0); + if(isNumeric(dtick)) { var tmin = sRound((r0 - tick0) / dtick) * dtick + tick0; @@ -68919,7 +69005,7 @@ axes.tickFirst = function(ax) { var yearFormat = d3.time.format('%Y'), monthFormat = d3.time.format('%b %Y'), dayFormat = d3.time.format('%b %-d'), - hourFormat = d3.time.format('%b %-d %Hh'), + yearMonthDayFormat = d3.time.format('%b %-d, %Y'), minuteFormat = d3.time.format('%H:%M'), secondFormat = d3.time.format(':%S'); @@ -68955,7 +69041,8 @@ axes.tickText = function(ax, x, hover) { i; if(arrayMode && Array.isArray(ax.ticktext)) { - var minDiff = Math.abs(ax.range[1] - ax.range[0]) / 10000; + var rng = ax.range.map(ax.r2l), + minDiff = Math.abs(rng[1] - rng[0]) / 10000; for(i = 0; i < ax.ticktext.length; i++) { if(Math.abs(x - ax.d2l(ax.tickvals[i])) < minDiff) break; } @@ -69010,10 +69097,12 @@ function tickTextObj(ax, x, text) { function formatDate(ax, out, hover, extraPrecision) { var x = out.x, tr = ax._tickround, + trOriginal = tr, d = new Date(x), // suffix completes the full date info, to be included - // with only the first tick - suffix = '', + // with only the first tick or if any info before what's + // shown has changed + suffix, tt; if(hover && ax.hoverformat) { tt = modDateFormat(ax.hoverformat, x); @@ -69026,34 +69115,40 @@ function formatDate(ax, out, hover, extraPrecision) { else { if(extraPrecision) { if(isNumeric(tr)) tr += 2; - else tr = {y: 'm', m: 'd', d: 'H', H: 'M', M: 'S', S: 2}[tr]; + else tr = {y: 'm', m: 'd', d: 'M', M: 'S', S: 2}[tr]; } if(tr === 'y') tt = yearFormat(d); else if(tr === 'm') tt = monthFormat(d); else { - if(x === ax._tmin && !hover) { - suffix = '
' + yearFormat(d); - } + if(tr === 'd') { + if(!hover) suffix = '
' + yearFormat(d); - if(tr === 'd') tt = dayFormat(d); - else if(tr === 'H') tt = hourFormat(d); + tt = dayFormat(d); + } else { - if(x === ax._tmin && !hover) { - suffix = '
' + dayFormat(d) + ', ' + yearFormat(d); - } + if(!hover) suffix = '
' + yearMonthDayFormat(d); tt = minuteFormat(d); if(tr !== 'M') { tt += secondFormat(d); if(tr !== 'S') { - tt += numFormat(mod(x / 1000, 1), ax, 'none', hover) + tt += numFormat(d3.round(mod(x / 1000, 1), 4), ax, 'none', hover) .substr(1); } } + else if(trOriginal === 'd') { + // for hover on axes with day ticks, minuteFormat (which + // only includes %H:%M) isn't enough, you want the date too + tt = dayFormat(d) + ' ' + tt; + } } } } - out.text = tt + suffix; + if(suffix && (!ax._inCalcTicks || (suffix !== ax._prevSuffix))) { + tt += suffix; + ax._prevSuffix = suffix; + } + out.text = tt; } function formatLog(ax, out, hover, extraPrecision, hideexp) { @@ -69145,7 +69240,7 @@ function numFormat(v, ax, fmtoverride, hover) { (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent // from what we calculate - range: ax.showexponent === 'none' ? ax.range : [0, v || 1] + range: ax.showexponent === 'none' ? ax.range.map(ax.r2d) : [0, v || 1] }; autoTickRound(ah); tickRound = (Number(ah._tickround) || 0) + 4; @@ -69393,8 +69488,9 @@ axes.makeClipPaths = function(gd) { // doTicks: draw ticks, grids, and tick labels // axid: 'x', 'y', 'x2' etc, // blank to do all, -// 'redraw' to force full redraw, and reset ax._r -// (stored range for use by zoom/pan) +// 'redraw' to force full redraw, and reset: +// ax._r (stored range for use by zoom/pan) +// ax._rl (stored linearized range for use by zoom/pan) // or can pass in an axis object directly axes.doTicks = function(gd, axid, skipTitle) { var fullLayout = gd._fullLayout, @@ -69432,7 +69528,10 @@ axes.doTicks = function(gd, axid, skipTitle) { return function() { if(!ax._id) return; var axDone = axes.doTicks(gd, ax._id); - if(axid === 'redraw') ax._r = ax.range.slice(); + if(axid === 'redraw') { + ax._r = ax.range.slice(); + ax._rl = ax._r.map(ax.r2l); + } return axDone; }; })); @@ -69450,9 +69549,6 @@ axes.doTicks = function(gd, axid, skipTitle) { } } - // in case a val turns into string somehow - ax.range = [+ax.range[0], +ax.range[1]]; - // set scaling to pixels ax.setScale(); @@ -69841,7 +69937,8 @@ axes.doTicks = function(gd, axid, skipTitle) { break; } } - var showZl = (ax.range[0] * ax.range[1] <= 0) && ax.zeroline && + var rng = ax.range.map(ax.r2l), + showZl = (rng[0] * rng[1] <= 0) && ax.zeroline && (ax.type === 'linear' || ax.type === '-') && gridvals.length && (hasBarsOrFill || clipEnds({x: 0}) || !ax.showline); var zl = zlcontainer.selectAll('path.' + zcls) @@ -70065,7 +70162,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { // rather than built-in % which gives a negative value for negative v function mod(v, d) { return ((v % d) + d) % d; } -},{"../../components/color":268,"../../components/drawing":292,"../../components/titles":343,"../../lib":362,"../../lib/svg_text_utils":376,"../../registry":436,"./axis_ids":393,"./layout_attributes":400,"./layout_defaults":401,"./set_convert":405,"d3":74,"fast-isnumeric":82}],391:[function(require,module,exports){ +},{"../../components/color":268,"../../components/drawing":291,"../../components/titles":342,"../../constants/numerical":350,"../../lib":364,"../../lib/svg_text_utils":378,"../../registry":438,"./axis_ids":396,"./layout_attributes":402,"./layout_defaults":403,"./set_convert":407,"d3":74,"fast-isnumeric":82}],394:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70080,7 +70177,7 @@ function mod(v, d) { return ((v % d) + d) % d; } var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); -var cleanDatum = require('./clean_datum'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function autoType(array) { if(moreDates(array)) return 'date'; @@ -70122,7 +70219,7 @@ function moreDates(a) { return (dcnt > ncnt * 2); } -// are the (x,y)-values in td.data mostly text? +// are the (x,y)-values in gd.data mostly text? // require twice as many categories as numbers function category(a) { // test at most 1000 points @@ -70132,15 +70229,15 @@ function category(a) { ai; for(var i = 0; i < a.length; i += inc) { - ai = cleanDatum(a[Math.round(i)]); - if(isNumeric(ai)) curvenums++; + ai = a[Math.round(i)]; + if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; else if(typeof ai === 'string' && ai !== '' && ai !== 'None') curvecats++; } return curvecats > curvenums * 2; } -},{"../../lib":362,"./clean_datum":395,"fast-isnumeric":82}],392:[function(require,module,exports){ +},{"../../constants/numerical":350,"../../lib":364,"fast-isnumeric":82}],395:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70233,17 +70330,15 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var validRange = ( (containerIn.range || []).length === 2 && - isNumeric(containerIn.range[0]) && - isNumeric(containerIn.range[1]) + isNumeric(containerOut.r2l(containerIn.range[0])) && + isNumeric(containerOut.r2l(containerIn.range[1])) ); var autoRange = coerce('autorange', !validRange); if(autoRange) coerce('rangemode'); - var range = coerce('range', [-1, letter === 'x' ? 6 : 4]); - if(range[0] === range[1]) { - containerOut.range = [range[0] - 1, range[0] + 1]; - } - Lib.noneOrAll(containerIn.range, containerOut.range, [0, 1]); + + coerce('range'); + containerOut.cleanRange(); coerce('fixedrange'); @@ -70365,7 +70460,7 @@ function getFirstNonEmptyTrace(data, id, axLetter) { } } -},{"../../components/color/attributes":267,"../../lib":362,"../../registry":436,"./axis_autotype":391,"./axis_ids":393,"./category_order_defaults":394,"./layout_attributes":400,"./ordered_categories":402,"./set_convert":405,"./tick_label_defaults":406,"./tick_mark_defaults":407,"./tick_value_defaults":408,"fast-isnumeric":82,"tinycolor2":241}],393:[function(require,module,exports){ +},{"../../components/color/attributes":267,"../../lib":364,"../../registry":438,"./axis_autotype":394,"./axis_ids":396,"./category_order_defaults":397,"./layout_attributes":402,"./ordered_categories":404,"./set_convert":407,"./tick_label_defaults":408,"./tick_mark_defaults":409,"./tick_value_defaults":410,"fast-isnumeric":82,"tinycolor2":241}],396:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70487,7 +70582,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":362,"../../registry":436,"../plots":428,"./constants":396}],394:[function(require,module,exports){ +},{"../../lib":364,"../../registry":438,"../plots":430,"./constants":398}],397:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70521,46 +70616,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],395:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = require('fast-isnumeric'); - -var Lib = require('../../lib'); - - -/** - * cleanDatum: removes characters - * same replace criteria used in the grid.js:scrapeCol - * but also handling dates, numbers, and NaN, null, Infinity etc - */ -module.exports = function cleanDatum(c) { - try { - if(typeof c === 'object' && c !== null && c.getTime) { - return Lib.ms2DateTime(c); - } - if(typeof c !== 'string' && !isNumeric(c)) { - return ''; - } - c = c.toString().replace(/['"%,$# ]/g, ''); - } - catch(e) { - Lib.error(e, c); - } - - return c; -}; - -},{"../../lib":362,"fast-isnumeric":82}],396:[function(require,module,exports){ +},{}],398:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70584,14 +70640,6 @@ module.exports = { y: /^yaxis([2-9]|[1-9][0-9]+)?$/ }, - /** - * standardize all missing data in calcdata to use undefined - * never null or NaN. - * that way we can use !==undefined, or !== BADNUM, - * to test for real data - */ - BADNUM: undefined, - // axis match regular expression xAxisMatch: /^xaxis[0-9]*$/, yAxisMatch: /^yaxis[0-9]*$/, @@ -70635,10 +70683,15 @@ module.exports = { BENDPX: 1.5, // delay before a redraw (relayout) after smooth panning and zooming - REDRAWDELAY: 50 + REDRAWDELAY: 50, + + // last resort axis ranges for x, y, and date axes if we have no data + DFLTRANGEX: [-1, 6], + DFLTRANGEY: [-1, 4], + DFLTRANGEDATE: ['2000-01-01', '2001-01-01'], }; -},{}],397:[function(require,module,exports){ +},{}],399:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70739,11 +70792,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { return dragger; } - function forceNumbers(axRange) { - axRange[0] = Number(axRange[0]); - axRange[1] = Number(axRange[1]); - } - var dragOptions = { element: dragger, gd: gd, @@ -70854,7 +70902,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { .attr('d', 'M0,0Z'); clearSelect(); - for(var i = 0; i < allaxes.length; i++) forceNumbers(allaxes[i].range); } function clearSelect() { @@ -70945,16 +70992,16 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomAxRanges(axList, r0Fraction, r1Fraction) { var i, axi, - axRange; + axRangeLinear; for(i = 0; i < axList.length; i++) { axi = axList[i]; if(axi.fixedrange) continue; - axRange = axi.range; + axRangeLinear = axi.range.map(axi.r2l); axi.range = [ - axRange[0] + (axRange[1] - axRange[0]) * r0Fraction, - axRange[0] + (axRange[1] - axRange[0]) * r1Fraction + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r0Fraction), + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r1Fraction) ]; } } @@ -71008,7 +71055,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { verticalAlign: vAlign }) .on('edit', function(text) { - var v = ax.type === 'category' ? ax.c2l(text) : ax.d2l(text); + var v = ax.d2r(text); if(v !== undefined) { Plotly.relayout(gd, attrStr, v); } @@ -71068,10 +71115,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomWheelOneAxis(ax, centerFraction, zoom) { if(ax.fixedrange) return; - forceNumbers(ax.range); - var axRange = ax.range, + + var axRange = ax.range.map(ax.r2l), v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; - ax.range = [v0 + (axRange[0] - v0) * zoom, v0 + (axRange[1] - v0) * zoom]; + function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); } + ax.range = axRange.map(doZoom); } if(ew) { @@ -71119,7 +71167,10 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { for(var i = 0; i < axList.length; i++) { var axi = axList[i]; if(!axi.fixedrange) { - axi.range = [axi._r[0] - pix / axi._m, axi._r[1] - pix / axi._m]; + axi.range = [ + axi.l2r(axi._rl[0] - pix / axi._m), + axi.l2r(axi._rl[1] - pix / axi._m) + ]; } } } @@ -71142,23 +71193,29 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { 1 / (1 / Math.max(d, -0.3) + 3.222)); } - // dz: set a new value for one end (0 or 1) of an axis array ax, + // dz: set a new value for one end (0 or 1) of an axis array axArray, // and return a pixel shift for that end for the viewbox // based on pixel drag distance d // TODO: this makes (generally non-fatal) errors when you get // near floating point limits - function dz(ax, end, d) { + function dz(axArray, end, d) { var otherEnd = 1 - end, - movedi = 0; - for(var i = 0; i < ax.length; i++) { - var axi = ax[i]; + movedAx, + newLinearizedEnd; + for(var i = 0; i < axArray.length; i++) { + var axi = axArray[i]; if(axi.fixedrange) continue; - movedi = i; - axi.range[end] = axi._r[otherEnd] + - (axi._r[end] - axi._r[otherEnd]) / dZoom(d / axi._length); + movedAx = axi; + newLinearizedEnd = axi._rl[otherEnd] + + (axi._rl[end] - axi._rl[otherEnd]) / dZoom(d / axi._length); + var newEnd = axi.l2r(newLinearizedEnd); + + // if l2r comes back false or undefined, it means we've dragged off + // the end of valid ranges - so stop. + if(newEnd !== false && newEnd !== undefined) axi.range[end] = newEnd; } - return ax[movedi]._length * (ax[movedi]._r[end] - ax[movedi].range[end]) / - (ax[movedi]._r[end] - ax[movedi]._r[otherEnd]); + return movedAx._length * (movedAx._rl[end] - newLinearizedEnd) / + (movedAx._rl[end] - movedAx._rl[otherEnd]); } if(xActive === 'w') dx = dz(xa, 0, dx); @@ -71360,8 +71417,10 @@ function getEndText(ax, end) { diff = Math.abs(initialVal - ax.range[1 - end]), dig; + // TODO: this should basically be ax.r2d but we're doing extra + // rounding here... can we clean up at all? if(ax.type === 'date') { - return Lib.ms2DateTime(initialVal, diff); + return initialVal; } else if(ax.type === 'log') { dig = Math.ceil(Math.max(0, -Math.log(diff) / Math.LN10)) + 3; @@ -71395,7 +71454,7 @@ function isSelectOrLasso(dragmode) { return modes.indexOf(dragmode) !== -1; } -},{"../../components/color":268,"../../components/dragelement":290,"../../components/drawing":292,"../../lib":362,"../../lib/setcursor":372,"../../lib/svg_text_utils":376,"../../plotly":386,"../../registry":436,"./axes":390,"./constants":396,"./select":404,"d3":74,"tinycolor2":241}],398:[function(require,module,exports){ +},{"../../components/color":268,"../../components/dragelement":289,"../../components/drawing":291,"../../lib":364,"../../lib/setcursor":374,"../../lib/svg_text_utils":378,"../../plotly":388,"../../registry":438,"./axes":393,"./constants":398,"./select":406,"d3":74,"tinycolor2":241}],400:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71421,6 +71480,7 @@ var dragElement = require('../../components/dragelement'); var Axes = require('./axes'); var constants = require('./constants'); var dragBox = require('./dragbox'); +var layoutAttributes = require('../layout_attributes'); var fx = module.exports = {}; @@ -71430,24 +71490,12 @@ var fx = module.exports = {}; fx.unhover = dragElement.unhover; fx.layoutAttributes = { - dragmode: { - valType: 'enumerated', - - values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], - dflt: 'zoom', - - }, - hovermode: { - valType: 'enumerated', - - values: ['x', 'y', 'closest', false], - - } }; fx.supplyLayoutDefaults = function(layoutIn, layoutOut, fullData) { + function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, fx.layoutAttributes, attr, dflt); + return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } coerce('dragmode'); @@ -72750,7 +72798,7 @@ fx.inbox = function(v0, v1) { return Infinity; }; -},{"../../components/color":268,"../../components/dragelement":290,"../../components/drawing":292,"../../lib":362,"../../lib/events":357,"../../lib/svg_text_utils":376,"./axes":390,"./constants":396,"./dragbox":397,"d3":74,"fast-isnumeric":82,"tinycolor2":241}],399:[function(require,module,exports){ +},{"../../components/color":268,"../../components/dragelement":289,"../../components/drawing":291,"../../lib":364,"../../lib/events":358,"../../lib/svg_text_utils":378,"../layout_attributes":428,"./axes":393,"./constants":398,"./dragbox":399,"d3":74,"fast-isnumeric":82,"tinycolor2":241}],401:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72780,6 +72828,8 @@ exports.attrRegex = constants.attrRegex; exports.attributes = require('./attributes'); +exports.layoutAttributes = require('./layout_attributes'); + exports.transitionAxes = require('./transition_axes'); exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) { @@ -73122,7 +73172,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":362,"../plots":428,"./attributes":389,"./axes":390,"./constants":396,"./transition_axes":409,"d3":74}],400:[function(require,module,exports){ +},{"../../lib":364,"../plots":430,"./attributes":392,"./axes":393,"./constants":398,"./layout_attributes":402,"./transition_axes":411,"d3":74}],402:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73158,8 +73208,8 @@ module.exports = { type: { valType: 'enumerated', // '-' means we haven't yet run autotype or couldn't find any data - // it gets turned into linear in td._fullLayout but not copied back - // to td.data like the others are. + // it gets turned into linear in gd._fullLayout but not copied back + // to gd.data like the others are. values: ['-', 'linear', 'log', 'date', 'category'], dflt: '-', @@ -73183,8 +73233,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -73210,14 +73260,12 @@ module.exports = { }, tick0: { - valType: 'number', - dflt: 0, + valType: 'any', }, dtick: { valType: 'any', - dflt: 1, }, @@ -73458,11 +73506,6 @@ module.exports = { }, - _nestedModules: { - 'rangeslider': 'rangeslider', - 'rangeselector': 'rangeselector', - }, - _deprecated: { autotick: { valType: 'boolean', @@ -73472,7 +73515,7 @@ module.exports = { } }; -},{"../../components/color/attributes":267,"../../lib/extend":358,"../font_attributes":411,"./constants":396}],401:[function(require,module,exports){ +},{"../../components/color/attributes":267,"../../lib/extend":359,"../font_attributes":413,"./constants":398}],403:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73646,7 +73689,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { }); }; -},{"../../components/color":268,"../../lib":362,"../../registry":436,"../layout_attributes":426,"./axis_defaults":392,"./axis_ids":393,"./constants":396,"./layout_attributes":400,"./position_defaults":403}],402:[function(require,module,exports){ +},{"../../components/color":268,"../../lib":364,"../../registry":438,"../layout_attributes":428,"./axis_defaults":395,"./axis_ids":396,"./constants":398,"./layout_attributes":402,"./position_defaults":405}],404:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73725,7 +73768,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":74}],403:[function(require,module,exports){ +},{"d3":74}],405:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73790,7 +73833,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":362,"fast-isnumeric":82}],404:[function(require,module,exports){ +},{"../../lib":364,"fast-isnumeric":82}],406:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73990,7 +74033,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":268,"../../lib/polygon":369,"./axes":390,"./constants":396}],405:[function(require,module,exports){ +},{"../../components/color":268,"../../lib/polygon":371,"./axes":393,"./constants":398}],407:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74006,27 +74049,38 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); +var numConstants = require('../../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var constants = require('./constants'); -var cleanDatum = require('./clean_datum'); var axisIds = require('./axis_ids'); /** - * Define the conversion functions for an axis data is used in 4 ways: + * Define the conversion functions for an axis data is used in 5 ways: * * d: data, in whatever form it's provided * c: calcdata: turned into numbers, but not linearized - * l: linearized - same as c except for log axes (and other - * mappings later?) this is used by ranges, and when we - * need to know if it's *possible* to show some data on - * this axis, without caring about the current range + * l: linearized - same as c except for log axes (and other nonlinear + * mappings later?) this is used when we need to know if it's + * *possible* to show some data on this axis, without caring about + * the current range * p: pixel value - mapped to the screen with current size and zoom + * r: ranges, tick0, and annotation positions match one of the above + * but are handled differently for different types: + * - linear and date: data format (d) + * - category: calcdata format (c), and will stay that way because + * the data format has no continuous mapping + * - log: linearized (l) format + * TODO: in v2.0 we plan to change it to data format. At that point + * shapes will work the same way as ranges, tick0, and annotations + * so they can use this conversion too. * - * Creates/updates these conversion functions + * Creates/updates these conversion functions, as well as cleaner functions: + * ax.d2d and ax.clean2r * also clears the autorange bounds ._min and ._max - * and the autotick constraints ._minDtick, ._forceTick0, - * and looks for date ranges that aren't yet in numeric format + * and the autotick constraints ._minDtick, ._forceTick0 */ module.exports = function setConvert(ax) { @@ -74046,20 +74100,119 @@ module.exports = function setConvert(ax) { return 0.5 * (r0 + r1 - 3 * clipMult * Math.abs(r0 - r1)); } - else return constants.BADNUM; + else return BADNUM; + } + + function fromLog(v) { + return Math.pow(10, v); + } + + function num(v) { + if(!isNumeric(v)) return BADNUM; + v = Number(v); + if(v < -FP_SAFE || v > FP_SAFE) return BADNUM; + return isNumeric(v) ? Number(v) : BADNUM; } - function fromLog(v) { return Math.pow(10, v); } - function num(v) { return isNumeric(v) ? Number(v) : constants.BADNUM; } ax.c2l = (ax.type === 'log') ? toLog : num; ax.l2c = (ax.type === 'log') ? fromLog : num; ax.l2d = function(v) { return ax.c2d(ax.l2c(v)); }; ax.p2d = function(v) { return ax.l2d(ax.p2l(v)); }; + /* + * fn to make sure range is a couplet of valid & distinct values + * keep numbers away from the limits of floating point numbers, + * and dates away from the ends of our date system (+/- 9999 years) + * + * optional param rangeAttr: operate on a different attribute, like + * ax._r, rather than ax.range + */ + ax.cleanRange = function(rangeAttr) { + if(!rangeAttr) rangeAttr = 'range'; + var range = ax[rangeAttr], + axLetter = (ax._id || 'x').charAt(0), + i, dflt; + + if(ax.type === 'date') dflt = constants.DFLTRANGEDATE; + else if(axLetter === 'y') dflt = constants.DFLTRANGEY; + else dflt = constants.DFLTRANGEX; + + // make sure we don't later mutate the defaults + dflt = dflt.slice(); + + if(!range || range.length !== 2) { + ax[rangeAttr] = dflt; + return; + } + + if(ax.type === 'date') { + // check if milliseconds or js date objects are provided for range + // and convert to date strings + range[0] = Lib.cleanDate(range[0]); + range[1] = Lib.cleanDate(range[1]); + } + + for(i = 0; i < 2; i++) { + if(ax.type === 'date') { + if(!Lib.isDateTime(range[i])) { + ax[rangeAttr] = dflt; + break; + } + + if(range[i] < Lib.MIN_MS) range[i] = Lib.MIN_MS; + if(range[i] > Lib.MAX_MS) range[i] = Lib.MAX_MS; + + if(ax.r2l(range[0]) === ax.r2l(range[1])) { + // split by +/- 1 second + var linCenter = Lib.constrain(ax.r2l(range[0]), + Lib.MIN_MS + 1000, Lib.MAX_MS - 1000); + range[0] = ax.l2r(linCenter - 1000); + range[1] = ax.l2r(linCenter + 1000); + break; + } + } + else { + if(!isNumeric(range[i])) { + if(isNumeric(range[1 - i])) { + range[i] = range[1 - i] * (i ? 10 : 0.1); + } + else { + ax[rangeAttr] = dflt; + break; + } + } + + if(range[i] < -FP_SAFE) range[i] = -FP_SAFE; + else if(range[i] > FP_SAFE) range[i] = FP_SAFE; + + if(range[0] === range[1]) { + // somewhat arbitrary: split by 1 or 1ppm, whichever is bigger + var inc = Math.max(1, Math.abs(range[0] * 1e-6)); + range[0] -= inc; + range[1] += inc; + } + } + } + }; + + // find the range value at the specified (linear) fraction of the axis + ax.fraction2r = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return ax.l2r(rl0 + v * (rl1 - rl0)); + }; + + // find the fraction of the range at the specified range value + ax.r2fraction = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return (ax.r2l(v) - rl0) / (rl1 - rl0); + }; + // set scaling to pixels ax.setScale = function(usePrivateRange) { var gs = ax._gd._fullLayout._size, - i; + axLetter = ax._id.charAt(0); // TODO cleaner way to handle this case if(!ax._categories) ax._categories = []; @@ -74075,40 +74228,23 @@ module.exports = function setConvert(ax) { // issue if we transform the drawn layer *and* use the new axis range to // draw the data. This allows us to construct setConvert using the pre- // interaction values of the range: - var range = (usePrivateRange && ax._r) ? ax._r : ax.range; + var rangeAttr = (usePrivateRange && ax._r) ? '_r' : 'range'; + ax.cleanRange(rangeAttr); - // make sure we have a range (linearized data values) - // and that it stays away from the limits of javascript numbers - if(!range || range.length !== 2 || range[0] === range[1]) { - range = [-1, 1]; - } - for(i = 0; i < 2; i++) { - if(!isNumeric(range[i])) { - range[i] = isNumeric(range[1 - i]) ? - (range[1 - i] * (i ? 10 : 0.1)) : - (i ? 1 : -1); - } - - if(range[i] < -(Number.MAX_VALUE / 2)) { - range[i] = -(Number.MAX_VALUE / 2); - } - else if(range[i] > Number.MAX_VALUE / 2) { - range[i] = Number.MAX_VALUE / 2; - } + var rl0 = ax.r2l(ax[rangeAttr][0]), + rl1 = ax.r2l(ax[rangeAttr][1]); - } - - if(ax._id.charAt(0) === 'y') { + if(axLetter === 'y') { ax._offset = gs.t + (1 - ax.domain[1]) * gs.h; ax._length = gs.h * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[0] - range[1]); - ax._b = -ax._m * range[1]; + ax._m = ax._length / (rl0 - rl1); + ax._b = -ax._m * rl1; } else { ax._offset = gs.l + ax.domain[0] * gs.w; ax._length = gs.w * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[1] - range[0]); - ax._b = -ax._m * range[0]; + ax._m = ax._length / (rl1 - rl0); + ax._b = -ax._m * rl0; } if(!isFinite(ax._m) || !isFinite(ax._b)) { @@ -74121,7 +74257,7 @@ module.exports = function setConvert(ax) { }; ax.l2p = function(v) { - if(!isNumeric(v)) return constants.BADNUM; + if(!isNumeric(v)) return BADNUM; // include 2 fractional digits on pixel, for PDF zooming etc return d3.round(ax._b + ax._m * v, 2); @@ -74132,42 +74268,62 @@ module.exports = function setConvert(ax) { ax.c2p = function(v, clip) { return ax.l2p(ax.c2l(v, clip)); }; ax.p2c = function(px) { return ax.l2c(ax.p2l(px)); }; + // clip doesn't do anything here yet, but in v2.0 when log axes get + // refactored it will... so including it now so we don't forget. + ax.r2p = function(v, clip) { return ax.l2p(ax.r2l(v, clip)); }; + ax.p2r = function(px) { return ax.l2r(ax.p2l(px)); }; + + ax.r2c = function(v) { return ax.l2c(ax.r2l(v)); }; + ax.c2r = function(v) { return ax.l2r(ax.c2l(v)); }; + if(['linear', 'log', '-'].indexOf(ax.type) !== -1) { ax.c2d = num; - ax.d2c = function(v) { - v = cleanDatum(v); - return isNumeric(v) ? Number(v) : constants.BADNUM; - }; - ax.d2l = function(v, clip) { - if(ax.type === 'log') return ax.c2l(ax.d2c(v), clip); - else return ax.d2c(v); - }; + ax.d2c = Lib.cleanNumber; + if(ax.type === 'log') { + ax.d2l = function(v, clip) { + return ax.c2l(ax.d2c(v), clip); + }; + ax.d2r = ax.d2l; + ax.r2d = ax.l2d; + } + else { + ax.d2l = Lib.cleanNumber; + ax.d2r = Lib.cleanNumber; + ax.r2d = num; + } + ax.r2l = num; + ax.l2r = num; } else if(ax.type === 'date') { - ax.c2d = function(v) { - return isNumeric(v) ? Lib.ms2DateTime(v) : constants.BADNUM; - }; + ax.c2d = Lib.ms2DateTime; ax.d2c = function(v) { - return (isNumeric(v)) ? Number(v) : Lib.dateTime2ms(v); + // NOTE: Changed this behavior: previously we took any numeric value + // to be a ms, even if it was a string that could be a bare year. + // Now we convert it as a date if at all possible, and only try + // as ms if that fails. + var ms = Lib.dateTime2ms(v); + if(ms === BADNUM) { + if(isNumeric(v)) ms = Number(v); + else return BADNUM; + } + return Lib.constrain(ms, Lib.MIN_MS, Lib.MAX_MS); }; ax.d2l = ax.d2c; - - // check if date strings or js date objects are provided for range - // and convert to ms - if(ax.range && ax.range.length > 1) { - try { - var ar1 = ax.range.map(Lib.dateTime2ms); - if(!isNumeric(ax.range[0]) && isNumeric(ar1[0])) { - ax.range[0] = ar1[0]; - } - if(!isNumeric(ax.range[1]) && isNumeric(ar1[1])) { - ax.range[1] = ar1[1]; - } - } - catch(e) { Lib.error(e, ax.range); } - } + ax.r2l = ax.d2c; + ax.l2r = ax.c2d; + ax.d2r = Lib.identity; + ax.r2d = Lib.identity; + ax.cleanr = function(v) { + /* + * If v is already a date string this is a noop, but running it + * through d2c and back validates the value: + * normalizes Date objects, milliseconds, and out-of-bounds dates + * so we always end up with either a clean date string or BADNUM + */ + return ax.c2d(ax.d2c(v)); + }; } else if(ax.type === 'category') { @@ -74190,38 +74346,42 @@ module.exports = function setConvert(ax) { } var c = ax._categories.indexOf(v); - return c === -1 ? constants.BADNUM : c; + return c === -1 ? BADNUM : c; }; ax.d2l = ax.d2c; + ax.r2l = num; + ax.l2r = num; + ax.d2r = ax.d2c; + ax.r2d = ax.c2d; } // makeCalcdata: takes an x or y array and converts it // to a position on the axis object "ax" // inputs: - // tdc - a data object from td.data - // axletter - a string, either 'x' or 'y', for which item + // trace - a data object from gd.data + // axLetter - a string, either 'x' or 'y', for which item // to convert (TODO: is this now always the same as // the first letter of ax._id?) // in case the expected data isn't there, make a list of // integers based on the opposite data - ax.makeCalcdata = function(tdc, axletter) { + ax.makeCalcdata = function(trace, axLetter) { var arrayIn, arrayOut, i; - if(axletter in tdc) { - arrayIn = tdc[axletter]; + if(axLetter in trace) { + arrayIn = trace[axLetter]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = ax.d2c(arrayIn[i]); } else { - var v0 = ((axletter + '0') in tdc) ? - ax.d2c(tdc[axletter + '0']) : 0, - dv = (tdc['d' + axletter]) ? - Number(tdc['d' + axletter]) : 1; + var v0 = ((axLetter + '0') in trace) ? + ax.d2c(trace[axLetter + '0']) : 0, + dv = (trace['d' + axLetter]) ? + Number(trace['d' + axLetter]) : 1; // the opposing data, for size if we have x and dx etc - arrayIn = tdc[{x: 'y', y: 'x'}[axletter]]; + arrayIn = trace[{x: 'y', y: 'x'}[axLetter]]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = v0 + i * dv; @@ -74236,11 +74396,11 @@ module.exports = function setConvert(ax) { ax._max = []; // and for bar charts and box plots: reset forced minimum tick spacing - ax._minDtick = null; - ax._forceTick0 = null; + delete ax._minDtick; + delete ax._forceTick0; }; -},{"../../lib":362,"./axis_ids":393,"./clean_datum":395,"./constants":396,"d3":74,"fast-isnumeric":82}],406:[function(require,module,exports){ +},{"../../constants/numerical":350,"../../lib":364,"./axis_ids":396,"./constants":398,"d3":74,"fast-isnumeric":82}],408:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74310,8 +74470,8 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe */ function getShowAttrDflt(containerIn) { var showAttrsAll = ['showexponent', - 'showtickprefix', - 'showticksuffix'], + 'showtickprefix', + 'showticksuffix'], showAttrs = showAttrsAll.filter(function(a) { return containerIn[a] !== undefined; }), @@ -74324,7 +74484,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":362}],407:[function(require,module,exports){ +},{"../../lib":364}],409:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74357,7 +74517,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":362,"./layout_attributes":400}],408:[function(require,module,exports){ +},{"../../lib":364,"./layout_attributes":402}],410:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74370,6 +74530,8 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, 'use strict'; var isNumeric = require('fast-isnumeric'); +var Lib = require('../../lib'); +var ONEDAY = require('../../constants/numerical').ONEDAY; module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType) { @@ -74381,15 +74543,56 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } if(Array.isArray(containerIn.tickvals)) tickmodeDefault = 'array'; - else if(containerIn.dtick && isNumeric(containerIn.dtick)) { + else if(containerIn.dtick) { tickmodeDefault = 'linear'; } var tickmode = coerce('tickmode', tickmodeDefault); if(tickmode === 'auto') coerce('nticks'); else if(tickmode === 'linear') { - coerce('tick0'); - coerce('dtick'); + // dtick is usually a positive number, but there are some + // special strings available for log or date axes + // default is 1 day for dates, otherwise 1 + var dtickDflt = (axType === 'date') ? ONEDAY : 1; + var dtick = coerce('dtick', dtickDflt); + if(isNumeric(dtick)) { + containerOut.dtick = (dtick > 0) ? Number(dtick) : dtickDflt; + } + else if(typeof dtick !== 'string') { + containerOut.dtick = dtickDflt; + } + else { + // date and log special cases are all one character plus a number + var prefix = dtick.charAt(0), + dtickNum = dtick.substr(1); + + dtickNum = isNumeric(dtickNum) ? Number(dtickNum) : 0; + if((dtickNum <= 0) || !( + // "M" gives ticks every (integer) n months + (axType === 'date' && prefix === 'M' && dtickNum === Math.round(dtickNum)) || + // "L" gives ticks linearly spaced in data (not in position) every (float) f + (axType === 'log' && prefix === 'L') || + // "D1" gives powers of 10 with all small digits between, "D2" gives only 2 and 5 + (axType === 'log' && prefix === 'D' && (dtickNum === 1 || dtickNum === 2)) + )) { + containerOut.dtick = dtickDflt; + } + } + + // tick0 can have different valType for different axis types, so + // validate that now. Also for dates, change milliseconds to date strings + var tick0Dflt = (axType === 'date') ? '2000-01-01' : 0; + var tick0 = coerce('tick0', tick0Dflt); + if(axType === 'date') { + containerOut.tick0 = Lib.cleanDate(tick0, tick0Dflt); + } + // Aside from date axes, dtick must be numeric; D1 and D2 modes ignore tick0 entirely + else if(isNumeric(tick0) && dtick !== 'D1' && dtick !== 'D2') { + containerOut.tick0 = Number(tick0); + } + else { + containerOut.tick0 = tick0Dflt; + } } else { var tickvals = coerce('tickvals'); @@ -74398,7 +74601,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"fast-isnumeric":82}],409:[function(require,module,exports){ +},{"../../constants/numerical":350,"../../lib":364,"fast-isnumeric":82}],411:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74710,7 +74913,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../lib":362,"../../plotly":386,"../../registry":436,"./axes":390,"d3":74}],410:[function(require,module,exports){ +},{"../../lib":364,"../../plotly":388,"../../registry":438,"./axes":393,"d3":74}],412:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75122,7 +75325,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":362,"../plotly":386}],411:[function(require,module,exports){ +},{"../lib":364,"../plotly":388}],413:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75153,7 +75356,7 @@ module.exports = { } }; -},{}],412:[function(require,module,exports){ +},{}],414:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75194,7 +75397,7 @@ module.exports = { } }; -},{}],413:[function(require,module,exports){ +},{}],415:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75437,7 +75640,7 @@ function createCamera(element, options) { return camera; } -},{"3d-view":9,"mouse-change":178,"mouse-wheel":180,"right-now":214}],414:[function(require,module,exports){ +},{"3d-view":9,"mouse-change":178,"mouse-wheel":180,"right-now":214}],416:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75571,7 +75774,7 @@ function initAxes(gd, sceneLayout) { } } -},{"../../constants/xmlns_namespaces":352,"../plots":428,"./layout/attributes":415,"./layout/defaults":419,"./layout/layout_attributes":420,"./scene":424,"./set_convert":425}],415:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":352,"../plots":430,"./layout/attributes":417,"./layout/defaults":421,"./layout/layout_attributes":422,"./scene":426,"./set_convert":427}],417:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75592,7 +75795,7 @@ module.exports = { } }; -},{}],416:[function(require,module,exports){ +},{}],418:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75699,7 +75902,7 @@ module.exports = { zerolinewidth: axesAttrs.zerolinewidth }; -},{"../../../components/color":268,"../../../lib/extend":358,"../../cartesian/layout_attributes":400}],417:[function(require,module,exports){ +},{"../../../components/color":268,"../../../lib/extend":359,"../../cartesian/layout_attributes":402}],419:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75767,7 +75970,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { } }; -},{"../../../lib":362,"../../cartesian/axis_defaults":392,"./axis_attributes":416,"tinycolor2":241}],418:[function(require,module,exports){ +},{"../../../lib":364,"../../cartesian/axis_defaults":395,"./axis_attributes":418,"tinycolor2":241}],420:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75922,7 +76125,7 @@ function createAxesOptions(plotlyOptions) { module.exports = createAxesOptions; -},{"../../../lib/html2unicode":361,"../../../lib/str2rgbarray":375,"arraytools":15}],419:[function(require,module,exports){ +},{"../../../lib/html2unicode":363,"../../../lib/str2rgbarray":377,"arraytools":15}],421:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -76029,7 +76232,7 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { coerce('hovermode', opts.getDfltFromLayout('hovermode')); } -},{"../../../components/color":268,"../../subplot_defaults":435,"./axis_defaults":417,"./layout_attributes":420}],420:[function(require,module,exports){ +},{"../../../components/color":268,"../../subplot_defaults":437,"./axis_defaults":419,"./layout_attributes":422}],422:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -76157,7 +76360,7 @@ module.exports = { } }; -},{"../../../lib/extend":358,"./axis_attributes":416}],421:[function(require,module,exports){ +},{"../../../lib/extend":359,"./axis_attributes":418}],423:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -76203,7 +76406,7 @@ function createSpikeOptions(layout) { module.exports = createSpikeOptions; -},{"../../../lib/str2rgbarray":375}],422:[function(require,module,exports){ +},{"../../../lib/str2rgbarray":377}],424:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -76299,7 +76502,7 @@ function computeTickMarks(scene) { scene.contourLevels = contourLevelsFromTicks(ticks); } -},{"../../../lib":362,"../../../lib/html2unicode":361,"../../cartesian/axes":390}],423:[function(require,module,exports){ +},{"../../../lib":364,"../../../lib/html2unicode":363,"../../cartesian/axes":393}],425:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -76333,7 +76536,7 @@ function project(camera, v) { module.exports = project; -},{}],424:[function(require,module,exports){ +},{}],426:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -77062,7 +77265,7 @@ proto.toImage = function(format) { module.exports = Scene; -},{"../../lib":362,"../../lib/show_no_webgl_msg":373,"../../lib/str2rgbarray":375,"../../plots/cartesian/axes":390,"../../plots/cartesian/graph_interact":398,"./camera":413,"./layout/convert":418,"./layout/spikes":421,"./layout/tick_marks":422,"./project":423,"./set_convert":425,"gl-plot3d":128,"webgl-context":256}],425:[function(require,module,exports){ +},{"../../lib":364,"../../lib/show_no_webgl_msg":375,"../../lib/str2rgbarray":377,"../../plots/cartesian/axes":393,"../../plots/cartesian/graph_interact":400,"./camera":415,"./layout/convert":420,"./layout/spikes":423,"./layout/tick_marks":424,"./project":425,"./set_convert":427,"gl-plot3d":128,"webgl-context":256}],427:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -77083,7 +77286,7 @@ module.exports = function setConvert(containerOut) { containerOut.setScale = Lib.noop; }; -},{"../../lib":362,"../cartesian/axes":390}],426:[function(require,module,exports){ +},{"../../lib":364,"../cartesian/axes":393}],428:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -77225,28 +77428,22 @@ module.exports = { }, - _composedModules: { - '*': 'Fx' + dragmode: { + valType: 'enumerated', + + values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], + dflt: 'zoom', + }, - - _nestedModules: { - 'xaxis': 'Axes', - 'yaxis': 'Axes', - 'scene': 'gl3d', - 'geo': 'geo', - 'ternary': 'ternary', - 'mapbox': 'mapbox', - - 'legend': 'legend', - 'annotations': 'annotations', - 'shapes': 'shapes', - 'images': 'images', - 'updatemenus': 'updatemenus', - 'sliders': 'sliders' + hovermode: { + valType: 'enumerated', + + values: ['x', 'y', 'closest', false], + } }; -},{"../components/color/attributes":267,"../lib":362,"./font_attributes":411}],427:[function(require,module,exports){ +},{"../components/color/attributes":267,"../lib":364,"./font_attributes":413}],429:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -77284,7 +77481,7 @@ module.exports = { } }; -},{}],428:[function(require,module,exports){ +},{}],430:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -77651,6 +77848,9 @@ plots.sendDataToCloud = function(gd) { // gd._fullLayout._basePlotModules // is a list of all the plot modules required to draw the plot. // +// gd._fullLayout._transformModules +// is a list of all the transform modules invoked. +// plots.supplyDefaults = function(gd) { var oldFullLayout = gd._fullLayout || {}, newFullLayout = gd._fullLayout = {}, @@ -77662,6 +77862,9 @@ plots.supplyDefaults = function(gd) { var i; + // Create all the storage space for frames, but only if doesn't already exist + if(!gd._transitionData) plots.createTransitionData(gd); + // first fill in what we can of layout without looking at data // because fullData needs a few things from layout @@ -77722,7 +77925,7 @@ plots.supplyDefaults = function(gd) { } // finally, fill in the pieces of layout that may need to look at data - plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData); + plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData); // TODO remove in v2.0.0 // add has-plot-type refs to fullLayout for backward compatibility @@ -77761,12 +77964,6 @@ plots.supplyDefaults = function(gd) { (gd.calcdata[i][0] || {}).trace = trace; } } - - // Create all the storage space for frames, but only if doesn't already - // exist: - if(!gd._transitionData) { - plots.createTransitionData(gd); - } }; // Create storage for all of the data related to frames and transitions: @@ -77933,6 +78130,8 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) { basePlotModules = fullLayout._basePlotModules = [], cnt = 0; + fullLayout._transformModules = []; + function pushModule(fullTrace) { dataOut.push(fullTrace); @@ -78150,6 +78349,8 @@ function supplyTransformDefaults(traceIn, traceOut, layout) { transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn); transformOut.type = type; transformOut._module = _module; + + Lib.pushUnique(layout._transformModules, _module); } else { transformOut = Lib.extendFlat({}, transformIn); @@ -78319,7 +78520,7 @@ function calculateReservedMargins(margins) { return resultingMargin; } -plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { +plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, transitionData) { var i, _module; // can't be be part of basePlotModules loop @@ -78350,6 +78551,16 @@ plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { } } + // transform module layout defaults + var transformModules = layoutOut._transformModules; + for(i = 0; i < transformModules.length; i++) { + _module = transformModules[i]; + + if(_module.supplyLayoutDefaults) { + _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData, transitionData); + } + } + // should FX be a component? Plotly.Fx.supplyLayoutDefaults(layoutIn, layoutOut, fullData); @@ -78377,8 +78588,16 @@ plots.purge = function(gd) { // remove modebar if(fullLayout._modeBar) fullLayout._modeBar.destroy(); - if(gd._transitionData && gd._transitionData._animationRaf) { - window.cancelAnimationFrame(gd._transitionData._animationRaf); + if(gd._transitionData) { + // Ensure any dangling callbacks are simply dropped if the plot is purged. + // This is more or less only actually important for testing. + if(gd._transitionData._interruptCallbacks) { + gd._transitionData._interruptCallbacks.length = 0; + } + + if(gd._transitionData._animationRaf) { + window.cancelAnimationFrame(gd._transitionData._animationRaf); + } } // data and layout @@ -78655,9 +78874,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { // convert native dates to date strings... // mostly for external users exporting to plotly - if(d && d.getTime) { - return Lib.ms2DateTime(d); - } + if(Lib.isJSDate(d)) return Lib.ms2DateTime(+d); return d; } @@ -78702,7 +78919,7 @@ plots.modifyFrames = function(gd, operations) { break;*/ case 'replace': frame = op.value; - var oldName = _frames[op.index].name; + var oldName = (_frames[op.index] || {}).name; var newName = frame.name; _frames[op.index] = _hash[newName] = frame; @@ -78836,8 +79053,14 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { for(i = 0; i < containerPaths.length; i++) { containerProp = Lib.nestedProperty(expandedObj, containerPaths[i]); containerVal = containerProp.get(); - containerProp.set(null); - Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + + if(containerVal === undefined) { + Lib.nestedProperty(containerObj, containerPaths[i]).set(null); + } + else { + containerProp.set(null); + Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + } } } @@ -78851,15 +79074,20 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { if(!srcContainer) continue; destProp = Lib.nestedProperty(dest, containerPaths[i]); - destContainer = destProp.get(); + if(!Array.isArray(destContainer)) { destContainer = []; destProp.set(destContainer); } for(j = 0; j < srcContainer.length; j++) { - destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcContainer[j]); + var srcObj = srcContainer[j]; + + if(srcObj === null) destContainer[j] = null; + else { + destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcObj); + } } destProp.set(destContainer); @@ -78870,7 +79098,7 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { }; plots.dataArrayContainers = ['transforms']; -plots.layoutArrayContainers = ['annotations', 'shapes', 'images', 'sliders', 'updatemenus']; +plots.layoutArrayContainers = Registry.layoutArrayContainers; /* * Extend a trace definition. This method: @@ -78929,11 +79157,15 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var trace = gd._fullData[traceIdx]; var module = trace._module; - if(!module || !module.animatable) { - continue; - } + // There's nothing to do if this module is not defined: + if(!module) continue; - transitionedTraces.push(traceIdx); + // Don't register the trace as transitioned if it doens't know what to do. + // If it *is* registered, it will receive a callback that it's responsible + // for calling in order to register the transition as having completed. + if(module.animatable) { + transitionedTraces.push(traceIdx); + } gd.data[traceIndices[i]] = plots.extendTrace(gd.data[traceIndices[i]], data[i]); } @@ -78987,6 +79219,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var aborted = false; function executeTransitions() { + + gd.emit('plotly_transitioning', []); + return new Promise(function(resolve) { // This flag is used to disabled things like autorange: gd._transitioning = true; @@ -79071,6 +79306,11 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function completeTransition(callback) { + // This a simple workaround for tests which purge the graph before animations + // have completed. That's not a very common case, so this is the simplest + // fix. + if(!gd._transitionData) return; + flushCallbacks(gd._transitionData._interruptCallbacks); return Promise.resolve().then(function() { @@ -79088,6 +79328,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function interruptPreviousTransitions() { + // Fail-safe against purged plot: + if(!gd._transitionData) return; + // If a transition is interrupted, set this to false. At the moment, the only thing that would // interrupt a transition is another transition, so that it will momentarily be set to true // again, but this determines whether autorange or dragbox work, so it's for the sake of @@ -79115,13 +79358,13 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var seq = [plots.previousPromises, interruptPreviousTransitions, prepareTransitions, executeTransitions]; - var transitionStarting = Lib.syncOrAsync(seq, gd); - if(!transitionStarting || !transitionStarting.then) transitionStarting = Promise.resolve(); + if(!transitionStarting || !transitionStarting.then) { + transitionStarting = Promise.resolve(); + } return transitionStarting.then(function() { - gd.emit('plotly_transitioning', []); return gd; }); }; @@ -79224,7 +79467,7 @@ plots.doCalcdata = function(gd, traces) { } }; -},{"../components/color":268,"../components/errorbars":298,"../lib":362,"../plotly":386,"../registry":436,"./animation_attributes":387,"./attributes":388,"./command":410,"./font_attributes":411,"./frame_attributes":412,"./layout_attributes":426,"d3":74,"fast-isnumeric":82}],429:[function(require,module,exports){ +},{"../components/color":268,"../components/errorbars":297,"../lib":364,"../plotly":388,"../registry":438,"./animation_attributes":389,"./attributes":391,"./command":412,"./font_attributes":413,"./frame_attributes":414,"./layout_attributes":428,"d3":74,"fast-isnumeric":82}],431:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -79249,7 +79492,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":452}],430:[function(require,module,exports){ +},{"../../traces/scatter/attributes":454}],432:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -79364,7 +79607,7 @@ module.exports = { } }; -},{"../../lib/extend":358,"../cartesian/layout_attributes":400}],431:[function(require,module,exports){ +},{"../../lib/extend":359,"../cartesian/layout_attributes":402}],433:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -79379,7 +79622,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":432,"./micropolar_manager":433}],432:[function(require,module,exports){ +},{"./micropolar":434,"./micropolar_manager":435}],434:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80798,7 +81041,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":362,"d3":74}],433:[function(require,module,exports){ +},{"../../lib":364,"d3":74}],435:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80884,7 +81127,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":268,"../../lib":362,"./micropolar":432,"./undo_manager":434,"d3":74}],434:[function(require,module,exports){ +},{"../../components/color":268,"../../lib":364,"./micropolar":434,"./undo_manager":436,"d3":74}],436:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80950,7 +81193,7 @@ module.exports = function UndoManager() { }; }; -},{}],435:[function(require,module,exports){ +},{}],437:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81025,7 +81268,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":362,"./plots":428}],436:[function(require,module,exports){ +},{"../lib":364,"./plots":430}],438:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81041,11 +81284,12 @@ var Lib = require('./lib'); var basePlotAttributes = require('./plots/attributes'); exports.modules = {}; -exports.allTypes = []; exports.allCategories = {}; +exports.allTypes = []; exports.subplotsRegistry = {}; exports.transformsRegistry = {}; exports.componentsRegistry = {}; +exports.layoutArrayContainers = []; /** * register a module as the handler for a trace type @@ -81111,6 +81355,16 @@ exports.registerSubplot = function(_module) { exports.subplotsRegistry[plotType] = _module; }; +exports.registerComponent = function(_module) { + var name = _module.name; + + exports.componentsRegistry[name] = _module; + + if(_module.layoutAttributes && _module.layoutAttributes._isLinkedToArray) { + Lib.pushUnique(exports.layoutArrayContainers, name); + } +}; + /** * Get registered module using trace object or trace type * @@ -81182,7 +81436,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib":362,"./plots/attributes":388}],437:[function(require,module,exports){ +},{"./lib":364,"./plots/attributes":391}],439:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81309,11 +81563,12 @@ module.exports = function clonePlot(graphObj, options) { } } - var td = document.createElement('div'); - if(options.tileClass) td.className = options.tileClass; + var gd = document.createElement('div'); + if(options.tileClass) gd.className = options.tileClass; var plotTile = { - td: td, + gd: gd, + td: gd, // for external (image server) compatibility layout: newLayout, data: newData, config: { @@ -81333,13 +81588,13 @@ module.exports = function clonePlot(graphObj, options) { plotTile.config.setBackground = options.setBackground || 'opaque'; } - // attaching the default Layout the td, so you can grab it later - plotTile.td.defaultLayout = cloneLayoutOverride(options.tileClass); + // attaching the default Layout the gd, so you can grab it later + plotTile.gd.defaultLayout = cloneLayoutOverride(options.tileClass); return plotTile; }; -},{"../lib":362,"../plots/plots":428}],438:[function(require,module,exports){ +},{"../lib":364,"../plots/plots":430}],440:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81405,7 +81660,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":362,"../plot_api/to_image":384,"./filesaver":439}],439:[function(require,module,exports){ +},{"../lib":364,"../plot_api/to_image":386,"./filesaver":441}],441:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81473,7 +81728,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],440:[function(require,module,exports){ +},{}],442:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81506,7 +81761,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],441:[function(require,module,exports){ +},{}],443:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81532,7 +81787,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":437,"./download":438,"./helpers":440,"./svgtoimg":442,"./toimage":443,"./tosvg":444}],442:[function(require,module,exports){ +},{"./cloneplot":439,"./download":440,"./helpers":442,"./svgtoimg":444,"./toimage":445,"./tosvg":446}],444:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81663,7 +81918,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":362,"events":80}],443:[function(require,module,exports){ +},{"../lib":364,"events":80}],445:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81696,7 +81951,7 @@ function toImage(gd, opts) { var ev = new EventEmitter(); var clone = clonePlot(gd, {format: 'png'}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -81743,7 +81998,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":362,"../plotly":386,"./cloneplot":437,"./helpers":440,"./svgtoimg":442,"./tosvg":444,"events":80}],444:[function(require,module,exports){ +},{"../lib":364,"../plotly":388,"./cloneplot":439,"./helpers":442,"./svgtoimg":444,"./tosvg":446,"events":80}],446:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81862,7 +82117,7 @@ module.exports = function toSVG(gd, format) { return s; }; -},{"../components/color":268,"../components/drawing":292,"../constants/xmlns_namespaces":352,"../lib/svg_text_utils":376,"d3":74}],445:[function(require,module,exports){ +},{"../components/color":268,"../components/drawing":291,"../constants/xmlns_namespaces":352,"../lib/svg_text_utils":378,"d3":74}],447:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81913,7 +82168,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":271,"../../components/colorscale":283,"../../lib":362,"../../plots/plots":428,"fast-isnumeric":82}],446:[function(require,module,exports){ +},{"../../components/colorbar/draw":271,"../../components/colorscale":282,"../../lib":364,"../../plots/plots":430,"fast-isnumeric":82}],448:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81925,7 +82180,9 @@ module.exports = function colorbar(gd, cd) { 'use strict'; var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var surfaceAtts = require('../surface/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; @@ -82017,6 +82274,7 @@ module.exports = { colorscale: colorscaleAttrs.colorscale, reversescale: colorscaleAttrs.reversescale, showscale: colorscaleAttrs.showscale, + colorbar: colorbarAttrs, lightposition: { 'x': extendFlat({}, surfaceAtts.lightposition.x, {dflt: 1e5}), @@ -82040,14 +82298,10 @@ module.exports = { dflt: 1e-6, // even the brain model doesn't appear to need finer than this } - }, surfaceAtts.lighting), - - _nestedModules: { // nested module coupling - 'colorbar': 'Colorbar' - } + }, surfaceAtts.lighting) }; -},{"../../components/colorscale/attributes":274,"../../lib/extend":358,"../surface/attributes":481}],447:[function(require,module,exports){ +},{"../../components/colorbar/attributes":269,"../../components/colorscale/attributes":273,"../../lib/extend":359,"../surface/attributes":483}],449:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82209,7 +82463,7 @@ function createMesh3DTrace(scene, data) { module.exports = createMesh3DTrace; -},{"../../lib/str2rgbarray":375,"alpha-shape":14,"convex-hull":65,"delaunay-triangulate":75,"gl-mesh3d":126,"tinycolor2":241}],448:[function(require,module,exports){ +},{"../../lib/str2rgbarray":377,"alpha-shape":14,"convex-hull":65,"delaunay-triangulate":75,"gl-mesh3d":126,"tinycolor2":241}],450:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82306,7 +82560,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/colorbar/defaults":270,"../../lib":362,"./attributes":446}],449:[function(require,module,exports){ +},{"../../components/colorbar/defaults":270,"../../lib":364,"./attributes":448}],451:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82335,7 +82589,7 @@ Mesh3D.meta = { module.exports = Mesh3D; -},{"../../plots/gl3d":414,"../heatmap/colorbar":445,"./attributes":446,"./convert":447,"./defaults":448}],450:[function(require,module,exports){ +},{"../../plots/gl3d":416,"../heatmap/colorbar":447,"./attributes":448,"./convert":449,"./defaults":450}],452:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82362,7 +82616,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":268}],451:[function(require,module,exports){ +},{"../../components/color":268}],453:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82400,7 +82654,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":362}],452:[function(require,module,exports){ +},{"../../lib":364}],454:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82412,11 +82666,11 @@ module.exports = function arraysToCalcdata(cd) { 'use strict'; var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var Drawing = require('../../components/drawing'); - var constants = require('./constants'); - var extendFlat = require('../../lib/extend').extendFlat; module.exports = { @@ -82592,12 +82846,15 @@ module.exports = { }, + showscale: { valType: 'boolean', dflt: false, }, + colorbar: colorbarAttrs, + line: extendFlat({}, { width: { valType: 'number', @@ -82645,6 +82902,7 @@ module.exports = { }, }, + r: { valType: 'data_array', @@ -82653,14 +82911,12 @@ module.exports = { valType: 'data_array', }, - _nestedModules: { // nested module coupling - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_y: errorBarAttrs, + error_x: errorBarAttrs }; -},{"../../components/colorscale/color_attributes":276,"../../components/drawing":292,"../../lib/extend":358,"./constants":457}],453:[function(require,module,exports){ +},{"../../components/colorbar/attributes":269,"../../components/colorscale/color_attributes":275,"../../components/drawing":291,"../../components/errorbars/attributes":293,"../../lib/extend":359,"./constants":459}],455:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82791,7 +83047,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":362,"../../plots/cartesian/axes":390,"./colorscale_calc":456,"./subtypes":472,"fast-isnumeric":82}],454:[function(require,module,exports){ +},{"../../lib":364,"../../plots/cartesian/axes":393,"./colorscale_calc":458,"./subtypes":474,"fast-isnumeric":82}],456:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82830,7 +83086,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],455:[function(require,module,exports){ +},{}],457:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82887,7 +83143,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":271,"../../components/colorscale":283,"../../lib":362,"../../plots/plots":428,"fast-isnumeric":82}],456:[function(require,module,exports){ +},{"../../components/colorbar/draw":271,"../../components/colorscale":282,"../../lib":364,"../../plots/plots":430,"fast-isnumeric":82}],458:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82920,7 +83176,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":275,"../../components/colorscale/has_colorscale":282,"./subtypes":472}],457:[function(require,module,exports){ +},{"../../components/colorscale/calc":274,"../../components/colorscale/has_colorscale":281,"./subtypes":474}],459:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82936,7 +83192,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],458:[function(require,module,exports){ +},{}],460:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83016,7 +83272,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":297,"../../lib":362,"./attributes":452,"./constants":457,"./fillcolor_defaults":459,"./line_defaults":463,"./line_shape_defaults":465,"./marker_defaults":468,"./subtypes":472,"./text_defaults":473,"./xy_defaults":474}],459:[function(require,module,exports){ +},{"../../components/errorbars/defaults":296,"../../lib":364,"./attributes":454,"./constants":459,"./fillcolor_defaults":461,"./line_defaults":465,"./line_shape_defaults":467,"./marker_defaults":470,"./subtypes":474,"./text_defaults":475,"./xy_defaults":476}],461:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83054,7 +83310,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":268}],460:[function(require,module,exports){ +},{"../../components/color":268}],462:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83107,7 +83363,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":268,"./subtypes":472}],461:[function(require,module,exports){ +},{"../../components/color":268,"./subtypes":474}],463:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83276,7 +83532,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":268,"../../components/errorbars":298,"../../lib":362,"../../plots/cartesian/constants":396,"../../plots/cartesian/graph_interact":398,"./get_trace_color":460}],462:[function(require,module,exports){ +},{"../../components/color":268,"../../components/errorbars":297,"../../lib":364,"../../plots/cartesian/constants":398,"../../plots/cartesian/graph_interact":400,"./get_trace_color":462}],464:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83320,7 +83576,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":399,"./arrays_to_calcdata":451,"./attributes":452,"./calc":453,"./clean_data":454,"./colorbar":455,"./defaults":458,"./hover":461,"./plot":469,"./select":470,"./style":471,"./subtypes":472}],463:[function(require,module,exports){ +},{"../../plots/cartesian":401,"./arrays_to_calcdata":453,"./attributes":454,"./calc":455,"./clean_data":456,"./colorbar":457,"./defaults":460,"./hover":463,"./plot":471,"./select":472,"./style":473,"./subtypes":474}],465:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83353,7 +83609,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce('line.dash'); }; -},{"../../components/colorscale/defaults":278,"../../components/colorscale/has_colorscale":282}],464:[function(require,module,exports){ +},{"../../components/colorscale/defaults":277,"../../components/colorscale/has_colorscale":281}],466:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83365,7 +83621,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, 'use strict'; -var Axes = require('../../plots/cartesian/axes'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function linePoints(d, opts) { @@ -83376,7 +83632,6 @@ module.exports = function linePoints(d, opts) { baseTolerance = opts.baseTolerance, linear = opts.linear, segments = [], - badnum = Axes.BADNUM, minTolerance = 0.2, // fraction of tolerance "so close we don't even consider it a new point" pts = new Array(d.length), pti = 0, @@ -83413,7 +83668,7 @@ module.exports = function linePoints(d, opts) { function getPt(index) { var x = xa.c2p(d[index].x), y = ya.c2p(d[index].y); - if(x === badnum || y === badnum) return false; + if(x === BADNUM || y === BADNUM) return false; return [x, y]; } @@ -83527,7 +83782,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../plots/cartesian/axes":390}],465:[function(require,module,exports){ +},{"../../constants/numerical":350}],467:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83546,7 +83801,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],466:[function(require,module,exports){ +},{}],468:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83587,7 +83842,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],467:[function(require,module,exports){ +},{}],469:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83629,7 +83884,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":82}],468:[function(require,module,exports){ +},{"fast-isnumeric":82}],470:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83689,7 +83944,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":268,"../../components/colorscale/defaults":278,"../../components/colorscale/has_colorscale":282,"./subtypes":472}],469:[function(require,module,exports){ +},{"../../components/color":268,"../../components/colorscale/defaults":277,"../../components/colorscale/has_colorscale":281,"./subtypes":474}],471:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83861,6 +84116,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.visible !== true) return; + transition(tr).style('opacity', trace.opacity); + // BUILD LINES AND FILLS var ownFillEl3, tonext; var ownFillDir = trace.fill.charAt(trace.fill.length - 1); @@ -84186,8 +84443,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { var xa = plotinfo.xaxis, ya = plotinfo.yaxis, - xr = d3.extent(xa.range.map(xa.l2c)), - yr = d3.extent(ya.range.map(ya.l2c)); + xr = d3.extent(xa.range.map(xa.r2l).map(xa.l2c)), + yr = d3.extent(ya.range.map(ya.r2l).map(ya.l2c)); var trace = cdscatter[0].trace; if(!subTypes.hasMarkers(trace)) return; @@ -84225,7 +84482,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":292,"../../components/errorbars":298,"../../lib":362,"../../lib/polygon":369,"./arrays_to_calcdata":451,"./line_points":464,"./link_traces":466,"./subtypes":472,"d3":74}],470:[function(require,module,exports){ +},{"../../components/drawing":291,"../../components/errorbars":297,"../../lib":364,"../../lib/polygon":371,"./arrays_to_calcdata":453,"./line_points":466,"./link_traces":468,"./subtypes":474,"d3":74}],472:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84297,7 +84554,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":472}],471:[function(require,module,exports){ +},{"./subtypes":474}],473:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84339,7 +84596,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":292,"../../components/errorbars":298,"d3":74}],472:[function(require,module,exports){ +},{"../../components/drawing":291,"../../components/errorbars":297,"d3":74}],474:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84375,7 +84632,7 @@ module.exports = { } }; -},{"../../lib":362}],473:[function(require,module,exports){ +},{"../../lib":364}],475:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84396,7 +84653,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":362}],474:[function(require,module,exports){ +},{"../../lib":364}],476:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84441,7 +84698,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { return len; }; -},{}],475:[function(require,module,exports){ +},{}],477:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84454,6 +84711,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { var scatterAttrs = require('../scatter/attributes'); var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); var MARKER_SYMBOLS = require('../../constants/gl_markers'); var extendFlat = require('../../lib/extend').extendFlat; @@ -84555,6 +84813,8 @@ module.exports = { }), showscale: scatterMarkerAttrs.showscale, + colorbar: scatterMarkerAttrs.colorbar, + line: extendFlat({}, {width: extendFlat({}, scatterMarkerLineAttrs.width, {arrayOk: false})}, colorAttributes('marker.line') @@ -84562,17 +84822,16 @@ module.exports = { }, colorAttributes('marker') ), + textposition: extendFlat({}, scatterAttrs.textposition, {dflt: 'top center'}), textfont: scatterAttrs.textfont, - _nestedModules: { - 'error_x': 'ErrorBars', - 'error_y': 'ErrorBars', - 'error_z': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_x: errorBarAttrs, + error_y: errorBarAttrs, + error_z: errorBarAttrs, }; -},{"../../components/colorscale/color_attributes":276,"../../constants/gl_markers":350,"../../lib/extend":358,"../scatter/attributes":452}],476:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":275,"../../components/errorbars/attributes":293,"../../constants/gl_markers":349,"../../lib/extend":359,"../scatter/attributes":454}],478:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84601,7 +84860,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":451,"../scatter/colorscale_calc":456}],477:[function(require,module,exports){ +},{"../scatter/arrays_to_calcdata":453,"../scatter/colorscale_calc":458}],479:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -84672,7 +84931,7 @@ function calculateErrors(data, scaleFactor) { module.exports = calculateErrors; -},{"../../components/errorbars/compute_error":296}],478:[function(require,module,exports){ +},{"../../components/errorbars/compute_error":295}],480:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85131,7 +85390,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../constants/gl3d_dashes":349,"../../constants/gl_markers":350,"../../lib":362,"../../lib/gl_format_color":360,"../../lib/str2rgbarray":375,"../scatter/make_bubble_size_func":467,"./calc_errors":477,"delaunay-triangulate":75,"gl-error3d":98,"gl-line3d":103,"gl-mesh3d":126,"gl-scatter3d":132}],479:[function(require,module,exports){ +},{"../../constants/gl3d_dashes":348,"../../constants/gl_markers":349,"../../lib":364,"../../lib/gl_format_color":362,"../../lib/str2rgbarray":377,"../scatter/make_bubble_size_func":469,"./calc_errors":479,"delaunay-triangulate":75,"gl-error3d":98,"gl-line3d":103,"gl-mesh3d":126,"gl-scatter3d":132}],481:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85216,7 +85475,7 @@ function handleXYZDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../components/errorbars/defaults":297,"../../lib":362,"../scatter/line_defaults":463,"../scatter/marker_defaults":468,"../scatter/subtypes":472,"../scatter/text_defaults":473,"./attributes":475}],480:[function(require,module,exports){ +},{"../../components/errorbars/defaults":296,"../../lib":364,"../scatter/line_defaults":465,"../scatter/marker_defaults":470,"../scatter/subtypes":474,"../scatter/text_defaults":475,"./attributes":477}],482:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85247,7 +85506,7 @@ Scatter3D.meta = { module.exports = Scatter3D; -},{"../../constants/gl_markers":350,"../../plots/gl3d":414,"../scatter/colorbar":455,"./attributes":475,"./calc":476,"./convert":478,"./defaults":479}],481:[function(require,module,exports){ +},{"../../constants/gl_markers":349,"../../plots/gl3d":416,"../scatter/colorbar":457,"./attributes":477,"./calc":478,"./convert":480,"./defaults":481}],483:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85260,6 +85519,8 @@ module.exports = Scatter3D; var Color = require('../../components/color'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; function makeContourProjAttr(axLetter) { @@ -85358,6 +85619,7 @@ module.exports = { {dflt: false}), reversescale: colorscaleAttrs.reversescale, showscale: colorscaleAttrs.showscale, + colorbar: colorbarAttrs, contours: { x: makeContourAttr('x'), @@ -85450,10 +85712,6 @@ module.exports = { }, - _nestedModules: { // nested module coupling - 'colorbar': 'Colorbar' - }, - _deprecated: { zauto: extendFlat({}, colorscaleAttrs.zauto, { @@ -85467,7 +85725,7 @@ module.exports = { } }; -},{"../../components/color":268,"../../components/colorscale/attributes":274,"../../lib/extend":358}],482:[function(require,module,exports){ +},{"../../components/color":268,"../../components/colorbar/attributes":269,"../../components/colorscale/attributes":273,"../../lib/extend":359}],484:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85491,7 +85749,7 @@ module.exports = function calc(gd, trace) { } }; -},{"../../components/colorscale/calc":275}],483:[function(require,module,exports){ +},{"../../components/colorscale/calc":274}],485:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85543,7 +85801,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":271,"../../components/colorscale":283,"../../lib":362,"../../plots/plots":428,"fast-isnumeric":82}],484:[function(require,module,exports){ +},{"../../components/colorbar/draw":271,"../../components/colorscale":282,"../../lib":364,"../../plots/plots":430,"fast-isnumeric":82}],486:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85697,8 +85955,8 @@ function refine(coords) { var padImg = padField(coords[i]); var scaledImg = ndarray(new Float32Array(nsize), nshape); homography(scaledImg, padImg, [scaleF, 0, 0, - 0, scaleF, 0, - 0, 0, 1]); + 0, scaleF, 0, + 0, 0, 1]); coords[i] = scaledImg; } @@ -85922,7 +86180,7 @@ function createSurfaceTrace(scene, data) { module.exports = createSurfaceTrace; -},{"../../lib/str2rgbarray":375,"gl-surface3d":144,"ndarray":192,"ndarray-fill":182,"ndarray-homography":184,"ndarray-ops":186,"tinycolor2":241}],485:[function(require,module,exports){ +},{"../../lib/str2rgbarray":377,"gl-surface3d":144,"ndarray":192,"ndarray-fill":182,"ndarray-homography":184,"ndarray-ops":186,"tinycolor2":241}],487:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86039,7 +86297,7 @@ function mapLegacy(traceIn, oldAttr, newAttr) { } } -},{"../../components/colorscale/defaults":278,"../../lib":362,"./attributes":481}],486:[function(require,module,exports){ +},{"../../components/colorscale/defaults":277,"../../lib":364,"./attributes":483}],488:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86069,5 +86327,5 @@ Surface.meta = { module.exports = Surface; -},{"../../plots/gl3d":414,"./attributes":481,"./calc":482,"./colorbar":483,"./convert":484,"./defaults":485}]},{},[4])(4) +},{"../../plots/gl3d":416,"./attributes":483,"./calc":484,"./colorbar":485,"./convert":486,"./defaults":487}]},{},[4])(4) }); \ No newline at end of file diff --git a/dist/plotly-gl3d.min.js b/dist/plotly-gl3d.min.js index db30550ab32..4903bd8a498 100644 --- a/dist/plotly-gl3d.min.js +++ b/dist/plotly-gl3d.min.js @@ -1,40 +1,40 @@ /** -* plotly.js (gl3d - minified) v1.19.2 +* plotly.js (gl3d - minified) v1.20.0 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function 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 u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){var r=e[o][1][t];return i(r?r:t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;oMath.abs(e))n.rotate(s,0,0,-t*a*Math.PI*h.rotateSpeed/window.innerWidth);else{var l=h.zoomSpeed*o*e/window.innerHeight*(s-n.lastT())/100;n.pan(s,0,0,u*(Math.exp(l)-1))}},!0),h}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":9,"mouse-change":178,"mouse-wheel":180,"right-now":214}],9:[function(t,e,r){"use strict";function n(t,e){this._controllerNames=Object.keys(t),this._controllerList=this._controllerNames.map(function(e){return t[e]}),this._mode=e,this._active=t[e],this._active||(this._mode="turntable",this._active=t.turntable),this.modes=this._controllerNames,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}function i(t){t=t||{};var e=t.eye||[0,0,1],r=t.center||[0,0,0],i=t.up||[0,1,0],l=t.distanceLimits||[0,1/0],u=t.mode||"turntable",c=a(),f=o(),h=s();return c.setDistanceLimits(l[0],l[1]),c.lookAt(0,e,r,i),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,i),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,i),new n({turntable:c,orbit:f,matrix:h},u)}e.exports=i;var a=t("turntable-camera-controller"),o=t("orbit-camera-controller"),s=t("matrix-camera-controller"),l=n.prototype,u=[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]];u.forEach(function(t){for(var e=t[0],r=[],n=0;n>16&255,r[1]=n>>8&255,r[2]=255&n):f.test(t)&&(n=t.match(h),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3])),!e)for(var i=0;i<3;++i)r[i]=r[i]/255;return r}function u(t,e){var r,n;if("string"!=typeof t)return t;if(r=[],"#"===t[0]?(t=t.substr(1),3===t.length&&(t+=t),n=parseInt(t,16),r[0]=n>>16&255,r[1]=n>>8&255,r[2]=255&n):f.test(t)&&(n=t.match(h),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3]),n[4]?r[3]=parseFloat(n[4]):r[3]=1),!e)for(var i=0;i<3;++i)r[i]=r[i]/255;return r}var c={},f=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,.*)?\)$/,h=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,?\s*(.*)?\)$/;return c.isPlainObject=t,c.linspace=e,c.zip3=n,c.sum=i,c.zip=r,c.isEqual=s,c.copy2D=a,c.copy1D=o,c.str2RgbArray=l,c.str2RgbaArray=u,c};e.exports=n()},{}],16:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],17:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0;r0?r=r.shln(f):f<0&&(c=c.shln(-f)),l(r,c)}var i=t("./is-rat"),a=t("./lib/is-bn"),o=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),u=t("./div");e.exports=n},{"./div":20,"./is-rat":22,"./lib/is-bn":26,"./lib/num-to-bn":27,"./lib/rationalize":28,"./lib/str-to-bn":29}],22:[function(t,e,r){"use strict";function n(t){return Array.isArray(t)&&2===t.length&&i(t[0])&&i(t[1])}var i=t("./lib/is-bn");e.exports=n},{"./lib/is-bn":26}],23:[function(t,e,r){"use strict";function n(t){return t.cmp(new i(0))}var i=t("bn.js");e.exports=n},{"bn.js":36}],24:[function(t,e,r){"use strict";function n(t){var e=t.length,r=t.words,n=0;if(1===e)n=r[0];else if(2===e)n=r[0]+67108864*r[1];else for(var n=0,i=0;i20?52:r+32}var i=t("double-bits"),a=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":35,"double-bits":76}],26:[function(t,e,r){"use strict";function n(t){return t&&"object"==typeof t&&Boolean(t.words)}t("bn.js");e.exports=n},{"bn.js":36}],27:[function(t,e,r){"use strict";function n(t){var e=a.exponent(t);return e<52?new i(t):new i(t*Math.pow(2,52-e)).shln(e-52)}var i=t("bn.js"),a=t("double-bits");e.exports=n},{"bn.js":36,"double-bits":76}],28:[function(t,e,r){"use strict";function n(t,e){var r=a(t),n=a(e);if(0===r)return[i(0),i(1)];if(0===n)return[i(0),i(0)];n<0&&(t=t.neg(),e=e.neg());var o=t.gcd(e);return o.cmpn(1)?[t.div(o),e.div(o)]:[t,e]}var i=t("./num-to-bn"),a=t("./bn-sign");e.exports=n},{"./bn-sign":23,"./num-to-bn":27}],29:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":36}],30:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[0]),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":28}],31:[function(t,e,r){"use strict";function n(t){return i(t[0])*i(t[1])}var i=t("./lib/bn-sign");e.exports=n},{"./lib/bn-sign":23}],32:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":28}],33:[function(t,e,r){"use strict";function n(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var n=e.divmod(r),o=n.div,s=i(o),l=n.mod;if(0===l.cmpn(0))return s;if(s){var u=a(s)+4,c=i(l.shln(u).divRound(r));return s<0&&(c=-c),s+c*Math.pow(2,-u)}var f=r.bitLength()-l.bitLength()+53,c=i(l.shln(f).divRound(r));return f<1023?c*Math.pow(2,-f):(c*=Math.pow(2,-1023),c*Math.pow(2,1023-f))}var i=t("./lib/bn-to-num"),a=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":24,"./lib/ctz":25}],34:[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){var a=new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""));return a()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],35:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return t&=-t,t&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}var i=32;r.INT_BITS=i,r.INT_MAX=2147483647,r.INT_MIN=-1<0)-(t<0)},r.abs=function(t){var e=t>>i-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,e|t>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,t&=15,27030>>>t&1};var a=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|a[t>>>16&255]<<8|a[t>>>24&255]},r.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},r.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),t=65535&(t|t>>>16),t<<16>>16},r.interleave3=function(t,e,r){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t|r<<2},r.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),t=1023&(t|t>>>16),t<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],36:[function(t,e,r){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){return null!==t&&"object"==typeof t&&Array.isArray(t.words)?t:(this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==e&&"be"!==e||(r=e,e=10),void(null!==t&&this._init(t||0,e||10,r||"be")))}function a(t,e,r){for(var n=0,i=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function o(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}function s(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function l(){s.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function u(){s.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function c(){s.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function f(){s.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function h(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function d(t){h.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.sign=!0),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){t<0&&(this.sign=!0,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3){var s=t[i]|t[i-1]<<8|t[i-2]<<16;this.words[o]|=s<>>26-a&67108863,a+=24,a>=26&&(a-=26,o++)}else if("le"===n)for(var i=0,o=0;i>>26-a&67108863,a+=24,a>=26&&(a-=26,o++)}return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6){var o=a(t,r,r+6);this.words[i]|=o<>>26-n&4194303,n+=24,n>=26&&(n-=26,i++)}if(r+6!==e){ -var o=a(t,e,r+6);this.words[i]|=o<>>26-n&4194303}this.strip()},i.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,s=a%n,l=Math.min(a,a-s)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function(){return(this.red?""};var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],g=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],v=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){if(t=t||10,16===t||"hex"===t){for(var n="",i=0,e=0|e||1,a=0,o=0;o>>24-i&16777215,n=0!==a||o!==this.length-1?p[6-l.length]+l+n:l+n,i+=2,i>=26&&(i-=26,o--)}for(0!==a&&(n=a.toString(16)+n);n.length%e!==0;)n="0"+n;return this.sign&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=g[t],c=v[t],n="",f=this.clone();for(f.sign=!1;0!==f.cmpn(0);){var h=f.modn(c).toString(t);f=f.idivn(c),n=0!==f.cmpn(0)?p[u-h.length]+h+n:h+n}return 0===this.cmpn(0)&&(n="0"+n),this.sign&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toArray=function(t){this.strip();var e=new Array(this.byteLength());e[0]=0;var r=this.clone();if("le"!==t)for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[e.length-n-1]=i}else for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[n]=i}return e},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},i.prototype.bitLength=function(){var t=0,e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function(t){this.sign=this.sign&&t.sign;var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function(t){this.sign=this.sign||t.sign;var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);for(var n=t/26|0,i=t%26;this.length<=n;)this.words[this.length++]=0;return e?this.words[n]=this.words[n]|1<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)},i.prototype.isub=function(t){if(t.sign){t.sign=!1;var e=this.iadd(t);return t.sign=!0,e._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t);if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var 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>>26,a=67108863&r,o=Math.min(n,t.length-1),s=Math.max(0,n-this.length+1);s<=o;s++){var l=n-s,u=0|this.words[l],c=0|t.words[s],f=u*c,h=67108863&f;i=i+(f/67108864|0)|0,h=h+a|0,a=67108863&h,i=i+(h>>>26)|0}e.words[n]=a,r=i}return 0!==r?e.words[n]=r:e.length--,e.strip()},i.prototype._bigMulTo=function(t,e){e.sign=t.sign!==this.sign,e.length=this.length+t.length;for(var r=0,n=0,i=0;i>>26)|0,n+=a>>>26,a&=67108863}e.words[i]=o,r=a,a=n}return 0!==r?e.words[i]=r:e.length--,e.strip()},i.prototype.mulTo=function(t,e){var r;return r=this.length+t.length<63?this._smallMulTo(t,e):this._bigMulTo(t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.imul=function(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var e=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var n=this.length-2;n>=0;n--){for(var i=0,a=0,o=Math.min(n,r-1),s=Math.max(0,n-e+1);s<=o;s++){var l=n-s,u=this.words[l],c=t.words[s],f=u*c,h=67108863&f;i+=f/67108864|0,h+=a,a=67108863&h,i+=h>>>26}this.words[n]=a,this.words[n+1]+=i,i=0}for(var i=0,l=1;l>>26}return this.strip()},i.prototype.imuln=function(t){r("number"==typeof t);for(var e=0,n=0;n>=26,e+=i/67108864|0,e+=a>>>26,this.words[n]=67108863&a}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.mul(this)},i.prototype.ishln=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=67108863>>>26-e<<26-e;if(0!==e){for(var a=0,o=0;o>>26-e}a&&(this.words[o]=a,this.length++)}if(0!==n){for(var o=this.length-1;o>=0;o--)this.words[o+n]=this.words[o];for(var o=0;o=0);var i;i=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o){this.length-=o;for(var u=0;u=0&&(0!==c||u>=i);u--){var f=this.words[u];this.words[u]=c<<26-a|f>>>a,c=f&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),t<0)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&l}for(;i>26,this.words[i+n]=67108863&l}if(0===s)return this.strip();r(s===-1),s=0;for(var i=0;i>26,this.words[i]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),a=t,o=a.words[a.length-1],s=this._countBits(o);r=26-s,0!==r&&(a=a.shln(r),n.ishln(r),o=a.words[a.length-1]);var l,u=n.length-a.length;if("mod"!==e){l=new i(null),l.length=u+1,l.words=new Array(l.length);for(var c=0;c=0;h--){var d=67108864*n.words[a.length+h]+n.words[a.length+h-1];for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(a,d,h);n.sign;)d--,n.sign=!1,n._ishlnsubmul(a,1,h),0!==n.cmpn(0)&&(n.sign=!n.sign);l&&(l.words[h]=d)}return l&&l.strip(),n.strip(),"div"!==e&&0!==r&&n.ishrn(r),{div:l?l:null,mod:n}},i.prototype.divmod=function(t,e){if(r(0!==t.cmpn(0)),this.sign&&!t.sign){var n,a,o=this.neg().divmod(t,e);return"mod"!==e&&(n=o.div.neg()),"div"!==e&&(a=0===o.mod.cmpn(0)?o.mod:t.sub(o.mod)),{div:n,mod:a}}if(!this.sign&&t.sign){var n,o=this.divmod(t.neg(),e);return"mod"!==e&&(n=o.div.neg()),{div:n,mod:o.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),e):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e)},i.prototype.div=function(t){return this.divmod(t,"div").div},i.prototype.mod=function(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(0===e.mod.cmpn(0))return e.div;var r=e.div.sign?e.mod.isub(t):e.mod,n=t.shrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:e.div.sign?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+this.words[i])%t;return n},i.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=this.words[n]+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var a=new i(1),o=new i(0),s=new i(0),l=new i(1),u=0;e.isEven()&&n.isEven();)e.ishrn(1),n.ishrn(1),++u;for(var c=n.clone(),f=e.clone();0!==e.cmpn(0);){for(;e.isEven();)e.ishrn(1),a.isEven()&&o.isEven()?(a.ishrn(1),o.ishrn(1)):(a.iadd(c).ishrn(1),o.isub(f).ishrn(1));for(;n.isEven();)n.ishrn(1),s.isEven()&&l.isEven()?(s.ishrn(1),l.ishrn(1)):(s.iadd(c).ishrn(1),l.isub(f).ishrn(1));e.cmp(n)>=0?(e.isub(n),a.isub(s),o.isub(l)):(n.isub(e),s.isub(a),l.isub(o))}return{a:s,b:l,gcd:n.ishln(u)}},i.prototype._invmp=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var a=new i(1),o=new i(0),s=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(;e.isEven();)e.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(s).ishrn(1);for(;n.isEven();)n.ishrn(1),o.isEven()?o.ishrn(1):o.iadd(s).ishrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(o)):(n.isub(e),o.isub(a))}return 0===e.cmpn(1)?a:o},i.prototype.gcd=function(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var e=this.clone(),r=t.clone();e.sign=!1,r.sign=!1;for(var n=0;e.isEven()&&r.isEven();n++)e.ishrn(1),r.ishrn(1);for(;;){for(;e.isEven();)e.ishrn(1);for(;r.isEven();)r.ishrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.ishln(n)},i.prototype.invm=function(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function(){return 0===(1&this.words[0])},i.prototype.isOdd=function(){return 1===(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.cmpn=function(t){var e=t<0;if(e&&(t=-t),this.sign&&!e)return-1;if(!this.sign&&e)return 1;t&=67108863,this.strip();var r;if(this.length>1)r=1;else{var n=this.words[0];r=n===t?0:nt.length)return 1;if(this.length=0;r--){var n=this.words[r],i=t.words[r];if(n!==i){ni&&(e=1);break}}return e},i.red=function(t){return new h(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};s.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},s.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength();while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},s.prototype.split=function(t,e){t.ishrn(this.n,0,e)},s.prototype.imulK=function(t){return t.imul(this.k)},n(l,s),l.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,a=o}t.words[i-10]=a>>>22,t.length-=9},l.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e,r=0,n=0;n>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function t(e){if(m[e])return m[e];var t;if("k256"===e)t=new l;else if("p224"===e)t=new u;else if("p192"===e)t=new c;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new f}return m[e]=t,t},h.prototype._verify1=function(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},h.prototype._verify2=function(t,e){r(!t.sign&&!e.sign,"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},h.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},h.prototype.neg=function(t){var e=t.clone();return e.sign=!e.sign,e.iadd(this.m)._forceRed(this)},h.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)},h.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},h.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)},h.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},h.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.shln(e))},h.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},h.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},h.prototype.isqr=function(t){return this.imul(t,t)},h.prototype.sqr=function(t){return this.mul(t,t)},h.prototype.sqrt=function(t){if(0===t.cmpn(0))return t.clone();var e=this.m.andln(3);if(r(e%2===1),3===e){var n=this.m.add(new i(1)).ishrn(2),a=this.pow(t,n);return a}for(var o=this.m.subn(1),s=0;0!==o.cmpn(0)&&0===o.andln(1);)s++,o.ishrn(1);r(0!==o.cmpn(0));var l=new i(1).toRed(this),u=l.redNeg(),c=this.m.subn(1).ishrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,o),a=this.pow(t,o.addn(1).ishrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(l);){for(var g=d,v=0;0!==g.cmp(l);v++)g=g.redSqr();r(v=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},d.prototype.mul=function(t,e){if(0===t.cmpn(0)||0===e.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).ishrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},d.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}}("undefined"==typeof e||e,this)},{}],37:[function(t,e,r){"use strict";function n(t){var e,r,n,i=t.length,a=0;for(e=0;e>>1;if(!(s<=0)){var l,u=f.mallocDouble(2*s*a),c=f.mallocInt32(a);if(a=i(t,s,u,c),a>0){if(1===s&&n)h.init(a),l=h.sweepComplete(s,r,0,a,u,c,0,a,u,c);else{var p=f.mallocDouble(2*s*o),g=f.mallocInt32(o);o=i(e,s,p,g),o>0&&(h.init(a+o),l=1===s?h.sweepBipartite(s,r,0,a,u,c,0,o,p,g):d(s,r,n,a,u,c,o,p,g),f.free(p),f.free(g))}f.free(u),f.free(c)}return l}}}function o(t,e){c.push([t,e])}function s(t){return c=[],a(t,t,o,!0),c}function l(t,e){return c=[],a(t,e,o,!1),c}function u(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?a(t,t,e,!0):l(t,e);case 3:return a(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}}e.exports=u;var c,f=t("typedarray-pool"),h=t("./lib/sweep"),d=t("./lib/intersect")},{"./lib/intersect":40,"./lib/sweep":44,"typedarray-pool":247}],39:[function(t,e,r){"use strict";function n(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),i=["function ",n,"(",w.join(),"){","var ",u,"=2*",a,";"],l="for(var i="+c+","+p+"="+u+"*"+c+";i<"+f+";++i,"+p+"+="+u+"){var x0="+h+"["+o+"+"+p+"],x1="+h+"["+o+"+"+p+"+"+a+"],xi="+d+"[i];",A="for(var j="+g+","+b+"="+u+"*"+g+";j<"+v+";++j,"+b+"+="+u+"){var y0="+m+"["+o+"+"+b+"],"+(r?"y1="+m+"["+o+"+"+b+"+"+a+"],":"")+"yi="+y+"[j];";return t?i.push(l,_,":",A):i.push(A,_,":",l),r?i.push("if(y1"+v+"-"+g+"){"),t?(e(!0,!1),o.push("}else{"),e(!1,!1)):(o.push("if("+l+"){"),e(!0,!0),o.push("}else{"),e(!0,!1),o.push("}}else{if("+l+"){"),e(!1,!0),o.push("}else{"),e(!1,!1),o.push("}")),o.push("}}return "+r);var s=i.join("")+o.join(""),u=new Function(s);return u()}var a="d",o="ax",s="vv",l="fp",u="es",c="rs",f="re",h="rb",d="ri",p="rp",g="bs",v="be",m="bb",y="bi",b="bp",x="rv",_="Q",w=[a,o,s,c,f,h,d,g,v,m,y];r.partial=i(!1),r.full=i(!0)},{}],40:[function(t,e,r){"use strict";function n(t,e){var r=8*u.log2(e+1)*(t+1)|0,n=u.nextPow2(k*r);L.length0;){R-=1;var O=R*k,N=L[O],I=L[O+1],z=L[O+2],j=L[O+3],D=L[O+4],F=L[O+5],B=R*T,U=S[B],V=S[B+1],H=1&F,q=!!(16&F),G=l,X=u,Y=g,W=E;if(H&&(G=g,X=E,Y=l,W=u),!(2&F&&(z=_(t,N,I,z,G,X,V),I>=z)||4&F&&(I=w(t,N,I,z,G,X,U),I>=z))){var Z=z-I,Q=D-j;if(q){if(t*Z*(Z+Q)=p0)&&!(p1>=hi)",["p0","p1"]),x=g("lo===p0",["p0"]),_=g("lor&&i[f+e]>u;--c,f-=o){for(var h=f,d=f+o,p=0;p>>1,h=2*t,d=f,p=a[h*f+e];u=b?(d=y,p=b):m>=_?(d=v,p=m):(d=x,p=_):b>=_?(d=y,p=b):_>=m?(d=v,p=m):(d=x,p=_);for(var w=h*(c-1),A=h*d,M=0;M=0&&n.push("lo=e[k+n]"),t.indexOf("hi")>=0&&n.push("hi=e[k+o]"),r.push(i.replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}e.exports=n;var i="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],43:[function(t,e,r){"use strict";function n(t,e){e<=4*h?i(0,e-1,t):f(0,e-1,t)}function i(t,e,r){for(var n=2*(t+1),i=t+1;i<=e;++i){for(var a=r[n++],o=r[n++],s=i,l=n-2;s-- >t;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function c(t,e,r,n){t*=2;var i=n[t];return i>1,v=g-n,m=g+n,y=d,b=v,x=g,_=m,w=p,A=t+1,M=e-1,k=0;u(y,b,r)&&(k=y,y=b,b=k),u(_,w,r)&&(k=_,_=w,w=k),u(y,x,r)&&(k=y,y=x,x=k),u(b,x,r)&&(k=b,b=x,x=k),u(y,_,r)&&(k=y,y=_,_=k),u(x,_,r)&&(k=x,x=_,_=k),u(b,w,r)&&(k=b,b=w,w=k),u(b,x,r)&&(k=b,b=x,x=k),u(_,w,r)&&(k=_,_=w,w=k);for(var T=r[2*b],E=r[2*b+1],L=r[2*_],S=r[2*_+1],C=2*y,R=2*x,P=2*w,O=2*d,N=2*g,I=2*p,z=0;z<2;++z){ -var j=r[C+z],D=r[R+z],F=r[P+z];r[O+z]=j,r[N+z]=D,r[I+z]=F}o(v,t,r),o(m,e,r);for(var B=A;B<=M;++B)if(c(B,T,E,r))B!==A&&a(B,A,r),++A;else if(!c(B,L,S,r))for(;;){if(c(M,L,S,r)){c(M,T,E,r)?(s(B,A,M,r),++A,--M):(a(B,M,r),--M);break}if(--M>>1;h(_,E);for(var L=0,S=0,A=0;A=d)C=C-d|0,i(m,y,S--,C);else if(C>=0)i(g,v,L--,C);else if(C<=-d){C=-C-d|0;for(var R=0;R>>1;h(_,L);for(var S=0,C=0,R=0,M=0;M>1===_[2*M+3]>>1&&(O=2,M+=1),P<0){for(var N=-(P>>1)-1,I=0;I>1)-1;0===O?i(g,v,S--,N):1===O?i(m,y,C--,N):2===O&&i(b,x,R--,N)}}}function l(t,e,r,n,o,s,l,u,c,f,p,m){var y=0,b=2*t,x=e,w=e+t,A=1,M=1;n?M=d:A=d;for(var k=o;k>>1;h(_,S);for(var C=0,k=0;k=d?(P=!n,T-=d):(P=!!n,T-=1),P)a(g,v,C++,T);else{var O=m[T],N=b*T,I=p[N+e+1],z=p[N+e+1+t];t:for(var j=0;j>>1;h(_,A);for(var M=0,y=0;y=d)g[M++]=b-d;else{b-=1;var T=c[b],E=p*b,L=u[E+e+1],S=u[E+e+1+t];t:for(var C=0;C=0;--C)if(g[C]===b){for(var N=C+1;N=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function v(t){return+t!=t&&(t=0),o.alloc(+t)}function m(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))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 G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(n)return G(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return L(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function x(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),r=+r,isNaN(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=o.from(e,n)),o.isBuffer(e))return 0===e.length?-1:_(t,e,r,n,i);if("number"==typeof e)return e=255&e,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function _(t,e,r,n,i){function a(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,s=t.length,l=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"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}var u;if(i){var c=-1;for(u=r;us&&(r=s-l),u=r;u>=0;u--){for(var f=!0,h=0;hi&&(n=i)):n=i;var a=e.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o239?4:a>223?3:a>191?2:1;if(i+s<=r){var l,u,c,f;switch(s){case 1:a<128&&(o=a);break;case 2:l=t[i+1],128===(192&l)&&(f=(31&a)<<6|63&l,f>127&&(o=f));break;case 3:l=t[i+1],u=t[i+2],128===(192&l)&&128===(192&u)&&(f=(15&a)<<12|(63&l)<<6|63&u,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:l=t[i+1],u=t[i+2],c=t[i+3],128===(192&l)&&128===(192&u)&&128===(192&c)&&(f=(15&a)<<18|(63&l)<<12|(63&u)<<6|63&c,f>65535&&f<1114112&&(o=f))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return C(n)}function C(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(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(!o.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 j(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,a=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function D(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,a=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function F(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 B(t,e,r,n,i){return i||F(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,i){return i||F(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(t,e,r,n,52,8),r+8}function V(t){if(t=H(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function H(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function q(t){return t<16?"0"+t.toString(16):t.toString(16)}function G(t,e){e=e||1/0;for(var r,n=t.length,i=null,a=[],o=0;o55295&&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=(i-55296<<10|r-56320)+65536}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 X(t){for(var e=[],r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function W(t){return $.toByteArray(V(t))}function Z(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Q(t){return t!==t}var $=t("base64-js"),K=t("ieee754"),J=t("isarray");r.Buffer=o,r.SlowBuffer=v,r.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),r.kMaxLength=i(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,r){return s(null,t,e,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,r){return u(null,t,e,r)},o.allocUnsafe=function(t){return c(null,t)},o.allocUnsafeSlow=function(t){return c(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},o.prototype.compare=function(t,e,r,n,i){if(!o.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,s=r-e,l=Math.min(a,s),u=this.slice(n,i),c=t.slice(e,r),f=0;fi)&&(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 w(this,t,e,r);case"utf8":case"utf-8":return A(this,t,e,r);case"ascii":return M(this,t,e,r);case"latin1":case"binary":return k(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||I(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||I(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||I(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||I(t,e,this.length);for(var n=this[t],i=1,a=0;++a=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||I(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a},o.prototype.readInt8=function(t,e){return e||I(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},o.prototype.readInt16LE=function(t,e){e||I(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||I(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||I(t,4,this.length),K.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||I(t,4,this.length),K.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||I(t,8,this.length),K.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||I(t,8,this.length),K.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e=0|e,r=0|r,!n){var i=Math.pow(2,8*r)-1;z(this,t,e,r,i,0)}var a=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+a]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e=0|e,r||z(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=0|e,r||z(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=0|e,r||z(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=0|e,r||z(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):D(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=0|e,r||z(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);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},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!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},o.prototype.writeInt8=function(t,e,r){return t=+t,e=0|e,r||z(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e=0|e,r||z(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e=0|e,r||z(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e=0|e,r||z(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):D(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e=0|e,r||z(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var a;if("number"==typeof t)for(a=e;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function a(t){var e,r,i,a,o,s,l=t.length;o=n(t),s=new f(3*l/4-o),i=o>0?l-4:l;var u=0;for(e=0,r=0;e>16&255,s[u++]=a>>8&255,s[u++]=255&a;return 2===o?(a=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,s[u++]=255&a):1===o&&(a=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,s[u++]=a>>8&255,s[u++]=255&a),s}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var n,i=[],a=e;ac?c:l+o));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),a.push(i),a.join("")}r.byteLength=i,r.toByteArray=a,r.fromByteArray=l;for(var u=[],c=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;d0;){for(var c=r.pop(),s=r.pop(),f=-1,h=-1,l=o[s],p=1;p=0||(e.flip(s,c),n(t,e,r,f,s,h),n(t,e,r,s,h,f),n(t,e,r,h,c,f),n(t,e,r,c,f,h))}}var a=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=i},{"binary-search-bounds":53,"robust-in-sphere":218}],50:[function(t,e,r){"use strict";function n(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 i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function a(t,e){for(var r=t.cells(),a=r.length,o=0;o0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-i){u[d]=i;for(var p=(c[d],0);p<3;++p){var g=h[3*d+p];g>=0&&0===u[g]&&(f[3*d+p]?l.push(g):(s.push(g),u[g]=i))}}}var v=l;l=s,s=v,l.length=0,i=-i}var m=o(c,u,e);return r?m.concat(n.boundary):m}var l=t("binary-search-bounds");e.exports=s;var u=n.prototype;u.locate=function(){var t=[0,0,0];return function(e,r,n){var a=e,o=r,s=n;return r1&&d(r[c[f-2]],r[c[f-1]],n)>0;)t.push([c[f-1],c[f-2],i]),f-=1;c.length=f,c.push(i);for(var p=u.upperIds,f=p.length;f>1&&d(r[p[f-2]],r[p[f-1]],n)<0;)t.push([p[f-2],p[f-1],i]),f-=1;p.length=f,p.push(i)}}function l(t,e){var r;return(r=t.a[0]m[0]&&l.push(new i(m,d,v,f),new i(d,m,g,f))}l.sort(a);for(var y=l[0].a[0]-(1+Math.abs(l[0].a[0]))*Math.pow(2,-52),b=[new n([y,1],[y,0],-1,[],[],[],[])],x=[],f=0,_=l.length;f<_;++f){var w=l[f],A=w.type;A===p?s(x,b,t,w.a,w.idx):A===v?u(b,t,w):c(b,t,w)}return x}var h=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,g=1,v=2;e.exports=f},{"binary-search-bounds":53,"robust-orientation":220}],52:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function i(t,e,r){for(var n=1,i=t.length;n=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;i(n[t],e,r),i(n[e],r,t),i(n[r],t,e)},s.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},s.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;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){var a=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("")); +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function 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 u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){var r=e[o][1][t];return i(r?r:t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;oMath.abs(e))n.rotate(s,0,0,-t*a*Math.PI*h.rotateSpeed/window.innerWidth);else{var l=h.zoomSpeed*o*e/window.innerHeight*(s-n.lastT())/100;n.pan(s,0,0,u*(Math.exp(l)-1))}},!0),h}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":9,"mouse-change":178,"mouse-wheel":180,"right-now":214}],9:[function(t,e,r){"use strict";function n(t,e){this._controllerNames=Object.keys(t),this._controllerList=this._controllerNames.map(function(e){return t[e]}),this._mode=e,this._active=t[e],this._active||(this._mode="turntable",this._active=t.turntable),this.modes=this._controllerNames,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}function i(t){t=t||{};var e=t.eye||[0,0,1],r=t.center||[0,0,0],i=t.up||[0,1,0],l=t.distanceLimits||[0,1/0],u=t.mode||"turntable",c=a(),f=o(),h=s();return c.setDistanceLimits(l[0],l[1]),c.lookAt(0,e,r,i),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,i),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,i),new n({turntable:c,orbit:f,matrix:h},u)}e.exports=i;var a=t("turntable-camera-controller"),o=t("orbit-camera-controller"),s=t("matrix-camera-controller"),l=n.prototype,u=[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]];u.forEach(function(t){for(var e=t[0],r=[],n=0;n>16&255,r[1]=n>>8&255,r[2]=255&n):f.test(t)&&(n=t.match(h),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3])),!e)for(var i=0;i<3;++i)r[i]=r[i]/255;return r}function u(t,e){var r,n;if("string"!=typeof t)return t;if(r=[],"#"===t[0]?(t=t.substr(1),3===t.length&&(t+=t),n=parseInt(t,16),r[0]=n>>16&255,r[1]=n>>8&255,r[2]=255&n):f.test(t)&&(n=t.match(h),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3]),n[4]?r[3]=parseFloat(n[4]):r[3]=1),!e)for(var i=0;i<3;++i)r[i]=r[i]/255;return r}var c={},f=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,.*)?\)$/,h=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,?\s*(.*)?\)$/;return c.isPlainObject=t,c.linspace=e,c.zip3=n,c.sum=i,c.zip=r,c.isEqual=s,c.copy2D=a,c.copy1D=o,c.str2RgbArray=l,c.str2RgbaArray=u,c};e.exports=n()},{}],16:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],17:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0;r0?r=r.shln(f):f<0&&(c=c.shln(-f)),l(r,c)}var i=t("./is-rat"),a=t("./lib/is-bn"),o=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),u=t("./div");e.exports=n},{"./div":20,"./is-rat":22,"./lib/is-bn":26,"./lib/num-to-bn":27,"./lib/rationalize":28,"./lib/str-to-bn":29}],22:[function(t,e,r){"use strict";function n(t){return Array.isArray(t)&&2===t.length&&i(t[0])&&i(t[1])}var i=t("./lib/is-bn");e.exports=n},{"./lib/is-bn":26}],23:[function(t,e,r){"use strict";function n(t){return t.cmp(new i(0))}var i=t("bn.js");e.exports=n},{"bn.js":36}],24:[function(t,e,r){"use strict";function n(t){var e=t.length,r=t.words,n=0;if(1===e)n=r[0];else if(2===e)n=r[0]+67108864*r[1];else for(var n=0,i=0;i20?52:r+32}var i=t("double-bits"),a=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":35,"double-bits":76}],26:[function(t,e,r){"use strict";function n(t){return t&&"object"==typeof t&&Boolean(t.words)}t("bn.js");e.exports=n},{"bn.js":36}],27:[function(t,e,r){"use strict";function n(t){var e=a.exponent(t);return e<52?new i(t):new i(t*Math.pow(2,52-e)).shln(e-52)}var i=t("bn.js"),a=t("double-bits");e.exports=n},{"bn.js":36,"double-bits":76}],28:[function(t,e,r){"use strict";function n(t,e){var r=a(t),n=a(e);if(0===r)return[i(0),i(1)];if(0===n)return[i(0),i(0)];n<0&&(t=t.neg(),e=e.neg());var o=t.gcd(e);return o.cmpn(1)?[t.div(o),e.div(o)]:[t,e]}var i=t("./num-to-bn"),a=t("./bn-sign");e.exports=n},{"./bn-sign":23,"./num-to-bn":27}],29:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":36}],30:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[0]),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":28}],31:[function(t,e,r){"use strict";function n(t){return i(t[0])*i(t[1])}var i=t("./lib/bn-sign");e.exports=n},{"./lib/bn-sign":23}],32:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":28}],33:[function(t,e,r){"use strict";function n(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var n=e.divmod(r),o=n.div,s=i(o),l=n.mod;if(0===l.cmpn(0))return s;if(s){var u=a(s)+4,c=i(l.shln(u).divRound(r));return s<0&&(c=-c),s+c*Math.pow(2,-u)}var f=r.bitLength()-l.bitLength()+53,c=i(l.shln(f).divRound(r));return f<1023?c*Math.pow(2,-f):(c*=Math.pow(2,-1023),c*Math.pow(2,1023-f))}var i=t("./lib/bn-to-num"),a=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":24,"./lib/ctz":25}],34:[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){var a=new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""));return a()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],35:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return t&=-t,t&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}var i=32;r.INT_BITS=i,r.INT_MAX=2147483647,r.INT_MIN=-1<0)-(t<0)},r.abs=function(t){var e=t>>i-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,e|t>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,t&=15,27030>>>t&1};var a=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|a[t>>>16&255]<<8|a[t>>>24&255]},r.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},r.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),t=65535&(t|t>>>16),t<<16>>16},r.interleave3=function(t,e,r){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t|r<<2},r.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),t=1023&(t|t>>>16),t<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],36:[function(t,e,r){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){return null!==t&&"object"==typeof t&&Array.isArray(t.words)?t:(this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==e&&"be"!==e||(r=e,e=10),void(null!==t&&this._init(t||0,e||10,r||"be")))}function a(t,e,r){for(var n=0,i=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function o(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}function s(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function l(){s.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function u(){s.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function c(){s.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function f(){s.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function h(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function d(t){h.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.sign=!0),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){t<0&&(this.sign=!0,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3){var s=t[i]|t[i-1]<<8|t[i-2]<<16;this.words[o]|=s<>>26-a&67108863,a+=24,a>=26&&(a-=26,o++)}else if("le"===n)for(var i=0,o=0;i>>26-a&67108863,a+=24,a>=26&&(a-=26,o++)}return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6){var o=a(t,r,r+6);this.words[i]|=o<>>26-n&4194303,n+=24,n>=26&&(n-=26,i++)}if(r+6!==e){ +var o=a(t,e,r+6);this.words[i]|=o<>>26-n&4194303}this.strip()},i.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,s=a%n,l=Math.min(a,a-s)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function(){return(this.red?""};var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],g=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],v=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){if(t=t||10,16===t||"hex"===t){for(var n="",i=0,e=0|e||1,a=0,o=0;o>>24-i&16777215,n=0!==a||o!==this.length-1?p[6-l.length]+l+n:l+n,i+=2,i>=26&&(i-=26,o--)}for(0!==a&&(n=a.toString(16)+n);n.length%e!==0;)n="0"+n;return this.sign&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=g[t],c=v[t],n="",f=this.clone();for(f.sign=!1;0!==f.cmpn(0);){var h=f.modn(c).toString(t);f=f.idivn(c),n=0!==f.cmpn(0)?p[u-h.length]+h+n:h+n}return 0===this.cmpn(0)&&(n="0"+n),this.sign&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toArray=function(t){this.strip();var e=new Array(this.byteLength());e[0]=0;var r=this.clone();if("le"!==t)for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[e.length-n-1]=i}else for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[n]=i}return e},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},i.prototype.bitLength=function(){var t=0,e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function(t){this.sign=this.sign&&t.sign;var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function(t){this.sign=this.sign||t.sign;var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);for(var n=t/26|0,i=t%26;this.length<=n;)this.words[this.length++]=0;return e?this.words[n]=this.words[n]|1<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)},i.prototype.isub=function(t){if(t.sign){t.sign=!1;var e=this.iadd(t);return t.sign=!0,e._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t);if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var 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>>26,a=67108863&r,o=Math.min(n,t.length-1),s=Math.max(0,n-this.length+1);s<=o;s++){var l=n-s,u=0|this.words[l],c=0|t.words[s],f=u*c,h=67108863&f;i=i+(f/67108864|0)|0,h=h+a|0,a=67108863&h,i=i+(h>>>26)|0}e.words[n]=a,r=i}return 0!==r?e.words[n]=r:e.length--,e.strip()},i.prototype._bigMulTo=function(t,e){e.sign=t.sign!==this.sign,e.length=this.length+t.length;for(var r=0,n=0,i=0;i>>26)|0,n+=a>>>26,a&=67108863}e.words[i]=o,r=a,a=n}return 0!==r?e.words[i]=r:e.length--,e.strip()},i.prototype.mulTo=function(t,e){var r;return r=this.length+t.length<63?this._smallMulTo(t,e):this._bigMulTo(t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.imul=function(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var e=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var n=this.length-2;n>=0;n--){for(var i=0,a=0,o=Math.min(n,r-1),s=Math.max(0,n-e+1);s<=o;s++){var l=n-s,u=this.words[l],c=t.words[s],f=u*c,h=67108863&f;i+=f/67108864|0,h+=a,a=67108863&h,i+=h>>>26}this.words[n]=a,this.words[n+1]+=i,i=0}for(var i=0,l=1;l>>26}return this.strip()},i.prototype.imuln=function(t){r("number"==typeof t);for(var e=0,n=0;n>=26,e+=i/67108864|0,e+=a>>>26,this.words[n]=67108863&a}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.mul(this)},i.prototype.ishln=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=67108863>>>26-e<<26-e;if(0!==e){for(var a=0,o=0;o>>26-e}a&&(this.words[o]=a,this.length++)}if(0!==n){for(var o=this.length-1;o>=0;o--)this.words[o+n]=this.words[o];for(var o=0;o=0);var i;i=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o){this.length-=o;for(var u=0;u=0&&(0!==c||u>=i);u--){var f=this.words[u];this.words[u]=c<<26-a|f>>>a,c=f&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),t<0)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&l}for(;i>26,this.words[i+n]=67108863&l}if(0===s)return this.strip();r(s===-1),s=0;for(var i=0;i>26,this.words[i]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),a=t,o=a.words[a.length-1],s=this._countBits(o);r=26-s,0!==r&&(a=a.shln(r),n.ishln(r),o=a.words[a.length-1]);var l,u=n.length-a.length;if("mod"!==e){l=new i(null),l.length=u+1,l.words=new Array(l.length);for(var c=0;c=0;h--){var d=67108864*n.words[a.length+h]+n.words[a.length+h-1];for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(a,d,h);n.sign;)d--,n.sign=!1,n._ishlnsubmul(a,1,h),0!==n.cmpn(0)&&(n.sign=!n.sign);l&&(l.words[h]=d)}return l&&l.strip(),n.strip(),"div"!==e&&0!==r&&n.ishrn(r),{div:l?l:null,mod:n}},i.prototype.divmod=function(t,e){if(r(0!==t.cmpn(0)),this.sign&&!t.sign){var n,a,o=this.neg().divmod(t,e);return"mod"!==e&&(n=o.div.neg()),"div"!==e&&(a=0===o.mod.cmpn(0)?o.mod:t.sub(o.mod)),{div:n,mod:a}}if(!this.sign&&t.sign){var n,o=this.divmod(t.neg(),e);return"mod"!==e&&(n=o.div.neg()),{div:n,mod:o.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),e):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e)},i.prototype.div=function(t){return this.divmod(t,"div").div},i.prototype.mod=function(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(0===e.mod.cmpn(0))return e.div;var r=e.div.sign?e.mod.isub(t):e.mod,n=t.shrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:e.div.sign?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+this.words[i])%t;return n},i.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=this.words[n]+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var a=new i(1),o=new i(0),s=new i(0),l=new i(1),u=0;e.isEven()&&n.isEven();)e.ishrn(1),n.ishrn(1),++u;for(var c=n.clone(),f=e.clone();0!==e.cmpn(0);){for(;e.isEven();)e.ishrn(1),a.isEven()&&o.isEven()?(a.ishrn(1),o.ishrn(1)):(a.iadd(c).ishrn(1),o.isub(f).ishrn(1));for(;n.isEven();)n.ishrn(1),s.isEven()&&l.isEven()?(s.ishrn(1),l.ishrn(1)):(s.iadd(c).ishrn(1),l.isub(f).ishrn(1));e.cmp(n)>=0?(e.isub(n),a.isub(s),o.isub(l)):(n.isub(e),s.isub(a),l.isub(o))}return{a:s,b:l,gcd:n.ishln(u)}},i.prototype._invmp=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var a=new i(1),o=new i(0),s=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(;e.isEven();)e.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(s).ishrn(1);for(;n.isEven();)n.ishrn(1),o.isEven()?o.ishrn(1):o.iadd(s).ishrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(o)):(n.isub(e),o.isub(a))}return 0===e.cmpn(1)?a:o},i.prototype.gcd=function(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var e=this.clone(),r=t.clone();e.sign=!1,r.sign=!1;for(var n=0;e.isEven()&&r.isEven();n++)e.ishrn(1),r.ishrn(1);for(;;){for(;e.isEven();)e.ishrn(1);for(;r.isEven();)r.ishrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.ishln(n)},i.prototype.invm=function(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function(){return 0===(1&this.words[0])},i.prototype.isOdd=function(){return 1===(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.cmpn=function(t){var e=t<0;if(e&&(t=-t),this.sign&&!e)return-1;if(!this.sign&&e)return 1;t&=67108863,this.strip();var r;if(this.length>1)r=1;else{var n=this.words[0];r=n===t?0:nt.length)return 1;if(this.length=0;r--){var n=this.words[r],i=t.words[r];if(n!==i){ni&&(e=1);break}}return e},i.red=function(t){return new h(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};s.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},s.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength();while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},s.prototype.split=function(t,e){t.ishrn(this.n,0,e)},s.prototype.imulK=function(t){return t.imul(this.k)},n(l,s),l.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,a=o}t.words[i-10]=a>>>22,t.length-=9},l.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e,r=0,n=0;n>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function t(e){if(m[e])return m[e];var t;if("k256"===e)t=new l;else if("p224"===e)t=new u;else if("p192"===e)t=new c;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new f}return m[e]=t,t},h.prototype._verify1=function(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},h.prototype._verify2=function(t,e){r(!t.sign&&!e.sign,"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},h.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},h.prototype.neg=function(t){var e=t.clone();return e.sign=!e.sign,e.iadd(this.m)._forceRed(this)},h.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)},h.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},h.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)},h.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},h.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.shln(e))},h.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},h.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},h.prototype.isqr=function(t){return this.imul(t,t)},h.prototype.sqr=function(t){return this.mul(t,t)},h.prototype.sqrt=function(t){if(0===t.cmpn(0))return t.clone();var e=this.m.andln(3);if(r(e%2===1),3===e){var n=this.m.add(new i(1)).ishrn(2),a=this.pow(t,n);return a}for(var o=this.m.subn(1),s=0;0!==o.cmpn(0)&&0===o.andln(1);)s++,o.ishrn(1);r(0!==o.cmpn(0));var l=new i(1).toRed(this),u=l.redNeg(),c=this.m.subn(1).ishrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,o),a=this.pow(t,o.addn(1).ishrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(l);){for(var g=d,v=0;0!==g.cmp(l);v++)g=g.redSqr();r(v=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},d.prototype.mul=function(t,e){if(0===t.cmpn(0)||0===e.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).ishrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},d.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}}("undefined"==typeof e||e,this)},{}],37:[function(t,e,r){"use strict";function n(t){var e,r,n,i=t.length,a=0;for(e=0;e>>1;if(!(s<=0)){var l,u=f.mallocDouble(2*s*a),c=f.mallocInt32(a);if(a=i(t,s,u,c),a>0){if(1===s&&n)h.init(a),l=h.sweepComplete(s,r,0,a,u,c,0,a,u,c);else{var p=f.mallocDouble(2*s*o),g=f.mallocInt32(o);o=i(e,s,p,g),o>0&&(h.init(a+o),l=1===s?h.sweepBipartite(s,r,0,a,u,c,0,o,p,g):d(s,r,n,a,u,c,o,p,g),f.free(p),f.free(g))}f.free(u),f.free(c)}return l}}}function o(t,e){c.push([t,e])}function s(t){return c=[],a(t,t,o,!0),c}function l(t,e){return c=[],a(t,e,o,!1),c}function u(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?a(t,t,e,!0):l(t,e);case 3:return a(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}}e.exports=u;var c,f=t("typedarray-pool"),h=t("./lib/sweep"),d=t("./lib/intersect")},{"./lib/intersect":40,"./lib/sweep":44,"typedarray-pool":247}],39:[function(t,e,r){"use strict";function n(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),i=["function ",n,"(",w.join(),"){","var ",u,"=2*",a,";"],l="for(var i="+c+","+p+"="+u+"*"+c+";i<"+f+";++i,"+p+"+="+u+"){var x0="+h+"["+o+"+"+p+"],x1="+h+"["+o+"+"+p+"+"+a+"],xi="+d+"[i];",A="for(var j="+g+","+b+"="+u+"*"+g+";j<"+v+";++j,"+b+"+="+u+"){var y0="+m+"["+o+"+"+b+"],"+(r?"y1="+m+"["+o+"+"+b+"+"+a+"],":"")+"yi="+y+"[j];";return t?i.push(l,_,":",A):i.push(A,_,":",l),r?i.push("if(y1"+v+"-"+g+"){"),t?(e(!0,!1),o.push("}else{"),e(!1,!1)):(o.push("if("+l+"){"),e(!0,!0),o.push("}else{"),e(!0,!1),o.push("}}else{if("+l+"){"),e(!1,!0),o.push("}else{"),e(!1,!1),o.push("}")),o.push("}}return "+r);var s=i.join("")+o.join(""),u=new Function(s);return u()}var a="d",o="ax",s="vv",l="fp",u="es",c="rs",f="re",h="rb",d="ri",p="rp",g="bs",v="be",m="bb",y="bi",b="bp",x="rv",_="Q",w=[a,o,s,c,f,h,d,g,v,m,y];r.partial=i(!1),r.full=i(!0)},{}],40:[function(t,e,r){"use strict";function n(t,e){var r=8*u.log2(e+1)*(t+1)|0,n=u.nextPow2(k*r);L.length0;){P-=1;var N=P*k,O=L[N],I=L[N+1],z=L[N+2],j=L[N+3],D=L[N+4],F=L[N+5],B=P*T,U=S[B],V=S[B+1],H=1&F,q=!!(16&F),G=l,X=u,W=g,Y=E;if(H&&(G=g,X=E,W=l,Y=u),!(2&F&&(z=_(t,O,I,z,G,X,V),I>=z)||4&F&&(I=w(t,O,I,z,G,X,U),I>=z))){var Z=z-I,Q=D-j;if(q){if(t*Z*(Z+Q)=p0)&&!(p1>=hi)",["p0","p1"]),x=g("lo===p0",["p0"]),_=g("lor&&i[f+e]>u;--c,f-=o){for(var h=f,d=f+o,p=0;p>>1,h=2*t,d=f,p=a[h*f+e];u=b?(d=y,p=b):m>=_?(d=v,p=m):(d=x,p=_):b>=_?(d=y,p=b):_>=m?(d=v,p=m):(d=x,p=_);for(var w=h*(c-1),A=h*d,M=0;M=0&&n.push("lo=e[k+n]"),t.indexOf("hi")>=0&&n.push("hi=e[k+o]"),r.push(i.replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}e.exports=n;var i="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],43:[function(t,e,r){"use strict";function n(t,e){e<=4*h?i(0,e-1,t):f(0,e-1,t)}function i(t,e,r){for(var n=2*(t+1),i=t+1;i<=e;++i){for(var a=r[n++],o=r[n++],s=i,l=n-2;s-- >t;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function c(t,e,r,n){t*=2;var i=n[t];return i>1,v=g-n,m=g+n,y=d,b=v,x=g,_=m,w=p,A=t+1,M=e-1,k=0;u(y,b,r)&&(k=y,y=b,b=k),u(_,w,r)&&(k=_,_=w,w=k),u(y,x,r)&&(k=y,y=x,x=k),u(b,x,r)&&(k=b,b=x,x=k),u(y,_,r)&&(k=y,y=_,_=k),u(x,_,r)&&(k=x,x=_,_=k),u(b,w,r)&&(k=b,b=w,w=k),u(b,x,r)&&(k=b,b=x,x=k),u(_,w,r)&&(k=_,_=w,w=k);for(var T=r[2*b],E=r[2*b+1],L=r[2*_],S=r[2*_+1],C=2*y,P=2*x,R=2*w,N=2*d,O=2*g,I=2*p,z=0;z<2;++z){ +var j=r[C+z],D=r[P+z],F=r[R+z];r[N+z]=j,r[O+z]=D,r[I+z]=F}o(v,t,r),o(m,e,r);for(var B=A;B<=M;++B)if(c(B,T,E,r))B!==A&&a(B,A,r),++A;else if(!c(B,L,S,r))for(;;){if(c(M,L,S,r)){c(M,T,E,r)?(s(B,A,M,r),++A,--M):(a(B,M,r),--M);break}if(--M>>1;h(_,E);for(var L=0,S=0,A=0;A=d)C=C-d|0,i(m,y,S--,C);else if(C>=0)i(g,v,L--,C);else if(C<=-d){C=-C-d|0;for(var P=0;P>>1;h(_,L);for(var S=0,C=0,P=0,M=0;M>1===_[2*M+3]>>1&&(N=2,M+=1),R<0){for(var O=-(R>>1)-1,I=0;I>1)-1;0===N?i(g,v,S--,O):1===N?i(m,y,C--,O):2===N&&i(b,x,P--,O)}}}function l(t,e,r,n,o,s,l,u,c,f,p,m){var y=0,b=2*t,x=e,w=e+t,A=1,M=1;n?M=d:A=d;for(var k=o;k>>1;h(_,S);for(var C=0,k=0;k=d?(R=!n,T-=d):(R=!!n,T-=1),R)a(g,v,C++,T);else{var N=m[T],O=b*T,I=p[O+e+1],z=p[O+e+1+t];t:for(var j=0;j>>1;h(_,A);for(var M=0,y=0;y=d)g[M++]=b-d;else{b-=1;var T=c[b],E=p*b,L=u[E+e+1],S=u[E+e+1+t];t:for(var C=0;C=0;--C)if(g[C]===b){for(var O=C+1;O=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function v(t){return+t!=t&&(t=0),o.alloc(+t)}function m(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))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 G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(t).length;default:if(n)return G(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return N(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return P(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return L(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function x(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),r=+r,isNaN(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=o.from(e,n)),o.isBuffer(e))return 0===e.length?-1:_(t,e,r,n,i);if("number"==typeof e)return e&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function _(t,e,r,n,i){function a(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,s=t.length,l=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"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}var u;if(i){var c=-1;for(u=r;us&&(r=s-l),u=r;u>=0;u--){for(var f=!0,h=0;hi&&(n=i)):n=i;var a=e.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o239?4:a>223?3:a>191?2:1;if(i+s<=r){var l,u,c,f;switch(s){case 1:a<128&&(o=a);break;case 2:l=t[i+1],128===(192&l)&&(f=(31&a)<<6|63&l,f>127&&(o=f));break;case 3:l=t[i+1],u=t[i+2],128===(192&l)&&128===(192&u)&&(f=(15&a)<<12|(63&l)<<6|63&u,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:l=t[i+1],u=t[i+2],c=t[i+3],128===(192&l)&&128===(192&u)&&128===(192&c)&&(f=(15&a)<<18|(63&l)<<12|(63&u)<<6|63&c,f>65535&&f<1114112&&(o=f))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return C(n)}function C(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(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(!o.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 j(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,a=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function D(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,a=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function F(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 B(t,e,r,n,i){return i||F(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,i){return i||F(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(t,e,r,n,52,8),r+8}function V(t){if(t=H(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function H(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function q(t){return t<16?"0"+t.toString(16):t.toString(16)}function G(t,e){e=e||1/0;for(var r,n=t.length,i=null,a=[],o=0;o55295&&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=(i-55296<<10|r-56320)+65536}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 X(t){for(var e=[],r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function Y(t){return $.toByteArray(V(t))}function Z(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Q(t){return t!==t}var $=t("base64-js"),K=t("ieee754"),J=t("isarray");r.Buffer=o,r.SlowBuffer=v,r.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),r.kMaxLength=i(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,r){return s(null,t,e,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,r){return u(null,t,e,r)},o.allocUnsafe=function(t){return c(null,t)},o.allocUnsafeSlow=function(t){return c(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},o.prototype.compare=function(t,e,r,n,i){if(!o.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,s=r-e,l=Math.min(a,s),u=this.slice(n,i),c=t.slice(e,r),f=0;fi)&&(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 w(this,t,e,r);case"utf8":case"utf-8":return A(this,t,e,r);case"ascii":return M(this,t,e,r);case"latin1":case"binary":return k(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||I(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||I(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||I(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||I(t,e,this.length);for(var n=this[t],i=1,a=0;++a=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||I(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a},o.prototype.readInt8=function(t,e){return e||I(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},o.prototype.readInt16LE=function(t,e){e||I(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||I(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||I(t,4,this.length),K.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||I(t,4,this.length),K.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||I(t,8,this.length),K.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||I(t,8,this.length),K.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){var i=Math.pow(2,8*r)-1;z(this,t,e,r,i,0)}var a=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+a]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||z(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||z(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||z(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||z(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):D(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||z(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},o.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},o.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},o.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||z(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||z(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||z(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||z(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):D(this,t,e,!0),e+4},o.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),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var a;if("number"==typeof t)for(a=e;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function a(t){var e,r,i,a,o,s,l=t.length;o=n(t),s=new f(3*l/4-o),i=o>0?l-4:l;var u=0;for(e=0,r=0;e>16&255,s[u++]=a>>8&255,s[u++]=255&a;return 2===o?(a=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,s[u++]=255&a):1===o&&(a=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,s[u++]=a>>8&255,s[u++]=255&a),s}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var n,i=[],a=e;ac?c:l+o));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),a.push(i),a.join("")}r.byteLength=i,r.toByteArray=a,r.fromByteArray=l;for(var u=[],c=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;d0;){for(var c=r.pop(),s=r.pop(),f=-1,h=-1,l=o[s],p=1;p=0||(e.flip(s,c),n(t,e,r,f,s,h),n(t,e,r,s,h,f),n(t,e,r,h,c,f),n(t,e,r,c,f,h))}}var a=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=i},{"binary-search-bounds":53,"robust-in-sphere":218}],50:[function(t,e,r){"use strict";function n(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 i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function a(t,e){for(var r=t.cells(),a=r.length,o=0;o0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-i){u[d]=i;for(var p=(c[d],0);p<3;++p){var g=h[3*d+p];g>=0&&0===u[g]&&(f[3*d+p]?l.push(g):(s.push(g),u[g]=i))}}}var v=l;l=s,s=v,l.length=0,i=-i}var m=o(c,u,e);return r?m.concat(n.boundary):m}var l=t("binary-search-bounds");e.exports=s;var u=n.prototype;u.locate=function(){var t=[0,0,0];return function(e,r,n){var a=e,o=r,s=n;return r1&&d(r[c[f-2]],r[c[f-1]],n)>0;)t.push([c[f-1],c[f-2],i]),f-=1;c.length=f,c.push(i);for(var p=u.upperIds,f=p.length;f>1&&d(r[p[f-2]],r[p[f-1]],n)<0;)t.push([p[f-2],p[f-1],i]),f-=1;p.length=f,p.push(i)}}function l(t,e){var r;return(r=t.a[0]m[0]&&l.push(new i(m,d,v,f),new i(d,m,g,f))}l.sort(a);for(var y=l[0].a[0]-(1+Math.abs(l[0].a[0]))*Math.pow(2,-52),b=[new n([y,1],[y,0],-1,[],[],[],[])],x=[],f=0,_=l.length;f<_;++f){var w=l[f],A=w.type;A===p?s(x,b,t,w.a,w.idx):A===v?u(b,t,w):c(b,t,w)}return x}var h=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,g=1,v=2;e.exports=f},{"binary-search-bounds":53,"robust-orientation":220}],52:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function i(t,e,r){for(var n=1,i=t.length;n=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;i(n[t],e,r),i(n[e],r,t),i(n[r],t,e)},s.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},s.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;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){var a=new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join("")); return a()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],54:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;r0?[w(e,-(1/0)),e]:[e,e]}function i(t,e){for(var r=new Array(e.length),n=0;n=t.length)return o[e-t.length];var r=t[e];return[y(r[0]),y(r[1])]}for(var o=[],s=0;s=0;--s){var g=n[s],u=g[0],v=e[u],m=v[0],x=v[1],w=t[m],M=t[x];if((w[0]-M[0]||w[1]-M[1])<0){var k=m;m=x,x=k}v[0]=m;var T,E=v[1]=g[1];for(i&&(T=v[2]);s>0&&n[s-1][0]===u;){var g=n[--s],L=g[1];i?e.push([E,L,T]):e.push([E,L]),E=L}i?e.push([E,x,T]):e.push([E,x])}return o}function u(t,e,r){for(var i=t.length+e.length,a=new g(i),o=r,s=0;se[2]?1:0}function h(t,e,r){if(0!==t.length){if(e)for(var n=0;n0||d.length>0)}function p(t,e,r){var n,i=!1;if(r){n=e;for(var a=new Array(e.length),o=0;op)throw new Error(h+" map requires nshades to be at least size "+f.length);for(v=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:s(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=f.map(function(t){return Math.round(t.index*p)}),v[0]<0&&(v[0]=0),v[1]<0&&(v[0]=0),v[0]>1&&(v[0]=1),v[1]>1&&(v[0]=1),y=0;y=0&&r[3]<=1||(r[3]=v[0]+(v[1]-v[0])*m);for(y=0;y=0}function i(t,e,r,i){var s=a(e,r,i);if(0===s){var l=o(a(t,e,r)),u=o(a(t,e,i));if(l===u){if(0===l){var c=n(t,e,r),f=n(t,e,i);return c===f?0:c?1:-1}return 0}return 0===u?l>0?-1:n(t,e,i)?-1:1:0===l?u>0?1:n(t,e,r)?1:-1:o(u-l)}var h=a(t,e,r);if(h>0)return s>0&&a(t,e,i)>0?1:-1;if(h<0)return s>0||a(t,e,i)>0?1:-1;var d=a(t,e,i);return d>0?1:n(t,e,r)?1:-1}e.exports=i;var a=t("robust-orientation"),o=t("signum"),s=t("two-sum"),l=t("robust-product"),u=t("robust-sum")},{"robust-orientation":220,"robust-product":221,"robust-sum":225,signum:226,"two-sum":246}],63:[function(t,e,r){function n(t,e){return t-e}function i(t,e){var r=t.length,i=t.length-e.length;if(i)return i;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||a(t[0],t[1])-a(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];if(i=o+t[2]-(s+e[2]))return i;var l=a(t[0],t[1]),u=a(e[0],e[1]);return a(l,t[2])-a(u,e[2])||a(l+t[2],o)-a(u+e[2],s);case 4:var c=t[0],f=t[1],h=t[2],d=t[3],p=e[0],g=e[1],v=e[2],m=e[3];return c+f+h+d-(p+g+v+m)||a(c,f,h,d)-a(p,g,v,m,p)||a(c+f,c+h,c+d,f+h,f+d,h+d)-a(p+g,p+v,p+m,g+v,g+m,v+m)||a(c+f+h,c+f+d,c+h+d,f+h+d)-a(p+g+v,p+g+m,p+v+m,g+v+m);default:for(var y=t.slice().sort(n),b=e.slice().sort(n),x=0;xt[r][0]&&(r=n);return er?[[r],[e]]:[[e]]}e.exports=n},{}],67:[function(t,e,r){"use strict";function n(t){var e=i(t),r=e.length;if(r<=2)return[];for(var n=new Array(r),a=e[r-1],o=0;o=e[l]&&(s+=1);a[o]=s}}return t}function a(t,e){try{return o(t,!0)}catch(u){var r=s(t);if(r.length<=e)return[];var a=n(t,r),l=o(a,!0);return i(l,r)}}e.exports=a;var o=t("incremental-convex-hull"),s=t("affine-hull")},{"affine-hull":12,"incremental-convex-hull":166}],69:[function(t,e,r){"use strict";function n(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,u=3*i*i-2*i;if(t.length){a||(a=new Array(t.length));for(var c=t.length-1;c>=0;--c)a[c]=o*t[c]+s*e[c]+l*r[c]+u*n[c];return a}return o*t+s*e+l*r[c]+u*n}function i(t,e,r,n,i,a){var o=i-1,s=i*i,l=o*o,u=(1+2*i)*l,c=i*l,f=s*(3-2*i),h=s*o;if(t.length){a||(a=new Array(t.length));for(var d=t.length-1;d>=0;--d)a[d]=u*t[d]+c*e[d]+f*r[d]+h*n[d];return a}return u*t+c*e+f*r+h*n}e.exports=i,e.exports.derivative=n},{}],70:[function(t,e,r){"use strict";function n(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function i(t){var e=new n;e.pre=t.pre,e.body=t.body,e.post=t.post;var r=t.args.slice(0);e.argTypes=r;for(var i=0;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"===o)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===o){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"===o){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,a(e)}var a=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":72}],71:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,f=0;for(n=0;n=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",f,"]-=s",f].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r,i){for(var a=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],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("")),l&&u.push(["index[",e[c],"]=j",c].join(""));for(var c=0;c0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}function l(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,l=new Array(t.arrayArgs.length),c=new Array(t.arrayArgs.length),f=0;f0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),f=0;f3&&x.push(o(t.pre,t,c));var T=o(t.body,t,c),E=a(v);E3&&x.push(o(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var L=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(c)].join(""),S=new Function(["function ",L,"(",b.join(","),"){",x.join("\n"),"} return ",L].join(""));return S()}var u=t("uniq");e.exports=l},{uniq:249}],72:[function(t,e,r){"use strict";function n(t){var e=["'use strict'","var CACHED={}"],r=[],n=t.funcName+"_cwise_thunk";e.push(["return function ",n,"(",t.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],u=[],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])+"]"))}t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+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}function a(t){return null===t?NaN:+t}function o(t){return!isNaN(t)}function s(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);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}}}function l(t){return t.length}function u(t){for(var e=1;t*e%1;)e*=10;return e}function c(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function f(){this._=Object.create(null)}function h(t){return(t+="")===_o||t[0]===wo?wo+t:t}function d(t){return(t+="")[0]===wo?t.slice(1):t}function p(t){return h(t)in this._}function g(t){return(t=h(t))in this._&&delete this._[t]}function v(){var t=[];for(var e in this._)t.push(d(e));return t}function m(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function b(){this._=Object.create(null)}function x(t){return t}function _(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=Ao.length;r=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Oo.get(t);return u&&(t=u,l=Q),s?e?i:n:e?A:a}function Z(t,e){return function(r){var n=uo.event;uo.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.event=n}}}function Q(t,e){var r=Z(t,e);return function(t){var e=this,n=t.relatedTarget;n&&(n===e||8&n.compareDocumentPosition(e))||r.call(e,t)}}function $(t){var r=".dragsuppress-"+ ++Io,i="click"+r,a=uo.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==No&&(No=!("onselectstart"in t)&&w(t.style,"userSelect")),No){var o=e(t).style,s=o[No];o[No]="none"}return function(t){if(a.on(r,null),No&&(o[No]=s),t){var e=function(){a.on(i,null)};a.on(i,function(){T(),e()},!0),setTimeout(e,0)}}}function K(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(zo<0){var a=n(t);if(a.scrollX||a.scrollY){r=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();zo=!(o.f||o.e),r.remove()}}return zo?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function J(){return uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function rt(t){return t>1?0:t<-1?Fo:Math.acos(t)}function nt(t){return t>1?Vo:t<-1?-Vo:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function at(t){return((t=Math.exp(t))+1/t)/2}function ot(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ut(t,e,r){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):At(""+t,Mt,ut):new ut(t,e,r)}function ct(t,e,r){function n(t){return t>360?t-=360:t<0&&(t+=360),t<60?a+(o-a)*t/60:t<180?o:t<240?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*n(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,o=r<=.5?r*(1+e):r+e-r*e,a=2*r-o,new bt(i(t+120),i(t),i(t-120))}function ft(t,e,r){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof dt?gt(t.l,t.a,t.b):gt((t=kt((t=uo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,r)}function ht(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(r,Math.cos(t*=Ho)*e,Math.sin(t)*e)}function dt(t,e,r){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof ft?ht(t.h,t.c,t.l):kt((t=bt(t)).r,t.g,t.b):new dt(t,e,r)}function pt(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return i=vt(i)*ts,n=vt(n)*es,a=vt(a)*rs,new bt(yt(3.2404542*i-1.5371385*n-.4985314*a),yt(-.969266*i+1.8760108*n+.041556*a),yt(.0556434*i-.2040259*n+1.0572252*a))}function gt(t,e,r){return t>0?new ft(Math.atan2(r,e)*qo,Math.sqrt(e*e+r*r),t):new ft(NaN,NaN,t)}function vt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function mt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function bt(t,e,r){return this instanceof bt?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof bt?new bt(t.r,t.g,t.b):At(""+t,bt,ct):new bt(t,e,r)}function xt(t){return new bt(t>>16,t>>8&255,255&t)}function _t(t){return xt(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function At(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(Et(i[0]),Et(i[1]),Et(i[2]))}return(a=as.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|o,s=240&a,s=s>>4|s,l=15&a,l=l<<4|l):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function Mt(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 kt(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=mt((.4124564*t+.3575761*e+.1804375*r)/ts),i=mt((.2126729*t+.7151522*e+.072175*r)/es),a=mt((.0193339*t+.119192*e+.9503041*r)/rs);return dt(116*i-16,500*(n-i),200*(i-a))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Et(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Lt(t){return"function"==typeof t?t:function(){return t}}function St(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),Ct(e,r,t,n)}}function Ct(t,e,r,n){function i(){var t,e=l.status;if(!e&&Pt(l)||e>=200&&e<300||304===e){try{t=r.call(a,l)}catch(t){return void o.error.call(a,t)}o.load.call(a,t)}else o.error.call(a,l)}var a={},o=uo.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=uo.event;uo.event=t;try{o.progress.call(a,l)}finally{uo.event=e}},a.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",a)},a.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",a):e},a.responseType=function(t){return arguments.length?(u=t,a):u},a.response=function(t){return r=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(fo(arguments)))}}),a.send=function(r,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),l.open(r,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=u&&(l.responseType=u),null!=i&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==n?null:n),a},a.abort=function(){return l.abort(),a},uo.rebind(a,o,"on"),null==n?a:a.get(Rt(n))}function Rt(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function Pt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Ot(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var i=r+e,a={c:t,t:i,n:null};return ss?ss.n=a:os=a,ss=a,ls||(us=clearTimeout(us),ls=1,cs(Nt)),a}function Nt(){var t=It(),e=zt()-t;e>24?(isFinite(e)&&(clearTimeout(us),us=setTimeout(Nt,e)),ls=0):(ls=1,cs(Nt))}function It(){for(var t=Date.now(),e=os;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function zt(){for(var t,e=os,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Ft(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,a=n&&r?function(t,e){for(var i=t.length,a=[],o=0,s=n[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=n[o=(o+1)%n.length];return a.reverse().join(r)}:x;return function(t){var r=hs.exec(t),n=r[1]||" ",o=r[2]||">",s=r[3]||"-",l=r[4]||"",u=r[5],c=+r[6],f=r[7],h=r[8],d=r[9],p=1,g="",v="",m=!1,y=!0;switch(h&&(h=+h.substring(1)),(u||"0"===n&&"="===o)&&(u=n="0",o="="),d){case"n":f=!0,d="g";break;case"%":p=100,v="%",d="f";break;case"p":p=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":y=!1;case"d":m=!0,h=0;break;case"s":p=-1,d="r"}"$"===l&&(g=i[0],v=i[1]),"r"!=d||h||(d="g"),null!=h&&("g"==d?h=Math.max(1,Math.min(21,h)):"e"!=d&&"f"!=d||(h=Math.max(0,Math.min(20,h)))),d=ds.get(d)||Bt;var b=u&&f;return function(t){var r=v;if(m&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=uo.formatPrefix(t,h);t=l.scale(t),r=l.symbol+v}else t*=p;t=d(t,h);var x,_,w=t.lastIndexOf(".");if(w<0){var A=y?t.lastIndexOf("e"):-1;A<0?(x=t,_=""):(x=t.substring(0,A),_=t.substring(A))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&f&&(x=a(x,1/0));var M=g.length+x.length+_.length+(b?0:i.length),k=M"===o?k+i+t:"^"===o?k.substring(0,M>>=1)+i+t+k.substring(M):i+(b?t:k+t))+r}}}function Bt(t){return t+""}function Ut(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Vt(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o=u)return-1;if(i=e.charCodeAt(s++),37===i){if(o=e.charAt(s++),a=S[o in ms?e.charAt(s++):o],!a||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}function n(t,e,r){w.lastIndex=0;var n=w.exec(e.slice(r));return n?(t.w=A.get(n[0].toLowerCase()),r+n[0].length):-1}function i(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=E.get(n[0].toLowerCase()),r+n[0].length):-1}function o(t,e,r){M.lastIndex=0;var n=M.exec(e.slice(r));return n?(t.m=k.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,L.c.toString(),e,n)}function l(t,e,n){return r(t,L.x.toString(),e,n)}function u(t,e,n){return r(t,L.X.toString(),e,n)}function c(t,e,r){var n=b.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)}var f=t.dateTime,h=t.date,d=t.time,p=t.periods,g=t.days,v=t.shortDays,m=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{gs=Ut;var e=new gs;return e._=t,n(e)}finally{gs=Date}}var n=e(t);return r.parse=function(t){try{gs=Ut;var e=n.parse(t);return e&&e._}finally{gs=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Xt(g),_=Yt(g),w=Xt(v),A=Yt(v),M=Xt(m),k=Yt(m),T=Xt(y),E=Yt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var L={a:function(t){return v[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return m[t.getMonth()]},c:e(f),d:function(t,e){return Gt(t.getDate(),e,2)},e:function(t,e){return Gt(t.getDate(),e,2)},H:function(t,e){return Gt(t.getHours(),e,2)},I:function(t,e){return Gt(t.getHours()%12||12,e,2)},j:function(t,e){return Gt(1+ps.dayOfYear(t),e,3)},L:function(t,e){return Gt(t.getMilliseconds(),e,3)},m:function(t,e){return Gt(t.getMonth()+1,e,2)},M:function(t,e){return Gt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Gt(t.getSeconds(),e,2)},U:function(t,e){return Gt(ps.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(ps.mondayOfYear(t),e,2)},x:e(h),X:e(d),y:function(t,e){return Gt(t.getFullYear()%100,e,2)},Y:function(t,e){return Gt(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},S={a:n,A:i,b:a,B:o,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:ae,p:c,S:oe,U:Zt,w:Wt,W:Qt,x:l,X:u,y:Kt,Y:$t,Z:Jt,"%":ue};return e}function Gt(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3)}function ee(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ae(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function le(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=xo(e)/60|0,i=xo(e)%60;return r+Gt(n,"0",2)+Gt(i,"0",2)}function ue(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function ce(t){for(var e=t.length,r=-1;++r=0?1:-1,s=o*r,l=Math.cos(e),u=Math.sin(e),c=a*u,f=i*l+c*Math.cos(s),h=c*o*Math.sin(s);ks.add(Math.atan2(h,f)),n=t,i=l,a=u}var e,r,n,i,a;Ts.point=function(o,s){Ts.point=t,n=(e=o)*Ho,i=Math.cos(s=(r=s)*Ho/2+Fo/4),a=Math.sin(s)},Ts.lineEnd=function(){t(e,r)}}function me(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function be(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function xe(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Ae(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function Me(t,e){return xo(t[0]-e[0])=0;--s)i.point((f=c[s])[0],f[1])}else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);i.lineEnd()}}}function Oe(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n0){for(_||(a.polygonStart(),_=!0),a.lineStart();++o1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(ze))}var d,p,g,v=e(a),m=i.invert(n[0],n[1]),y={point:o,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=f,y.lineEnd=h,d=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=l,y.lineEnd=u,d=uo.merge(d);var t=Ve(m,p);d.length?(_||(a.polygonStart(),_=!0),Pe(d,De,t,r,a)):t&&(_||(a.polygonStart(),_=!0),a.lineStart(),r(null,null,1,a),a.lineEnd()),_&&(a.polygonEnd(),_=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),r(null,null,1,a),a.lineEnd(),a.polygonEnd()}},b=je(),x=e(b),_=!1;return y}}function ze(t){return t.length>1}function je(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:A,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function De(t,e){return((t=t.x)[0]<0?t[1]-Vo-jo:Vo-t[1])-((e=e.x)[0]<0?e[1]-Vo-jo:Vo-e[1])}function Fe(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?Fo:-Fo,l=xo(a-r);xo(l-Fo)0?Vo:-Vo),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=Fo&&(xo(r-i)jo?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}function Ue(t,e,r,n){var i;if(null==t)i=r*Vo,n.point(-Fo,i),n.point(0,i),n.point(Fo,i),n.point(Fo,0),n.point(Fo,-i),n.point(0,-i),n.point(-Fo,-i),n.point(-Fo,0),n.point(-Fo,i);else if(xo(t[0]-e[0])>jo){var a=t[0]=0?1:-1,A=w*_,M=A>Fo,k=p*b;if(ks.add(Math.atan2(k*w*Math.sin(A),g*x+k*Math.cos(A))),a+=M?_+w*Bo:_,M^h>=r^m>=r){var T=be(me(f),me(t));we(T);var E=be(i,T);we(E);var L=(M^_>=0?-1:1)*nt(E[2]);(n>L||n===L&&(T[0]||T[1]))&&(o+=M^_>=0?1:-1)}if(!v++)break;h=m,p=b,g=x,f=t}}return(a<-jo||aa}function r(t){var r,a,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],g=e(f,h),v=o?g?0:i(f,h):g?i(f+(f<0?Fo:-Fo),h):0;if(!r&&(u=l=g)&&t.lineStart(),g!==l&&(d=n(r,p),(Me(r,d)||Me(p,d))&&(p[0]+=jo,p[1]+=jo,g=e(p[0],p[1]))),g!==l)c=0,g?(t.lineStart(),d=n(p,r),t.point(d[0],d[1])):(d=n(r,p),t.point(d[0],d[1]),t.lineEnd()),r=d;else if(s&&r&&o^g){var m;v&a||!(m=n(p,r,!0))||(c=0,o?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||r&&Me(r,p)||t.point(p[0],p[1]),r=p,l=g,a=v},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=me(t),i=me(e),o=[1,0,0],s=be(n,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var f=a*l/c,h=-a*u/c,d=be(o,s),p=_e(o,f),g=_e(s,h);xe(p,g);var v=d,m=ye(p,v),y=ye(v,v),b=m*m-y*(ye(p,p)-1);if(!(b<0)){var x=Math.sqrt(b),_=_e(v,(-m-x)/y);if(xe(_,p),_=Ae(_),!r)return _;var w,A=t[0],M=e[0],k=t[1],T=e[1];M0^_[1]<(xo(_[0]-A)Fo^(A<=_[0]&&_[0]<=M)){var C=_e(v,(-m+x)/y);return xe(C,p),[_,Ae(C)]}}}function i(e,r){var n=o?t:Fo-t,i=0;return e<-n?i|=1:e>n&&(i|=2),r<-n?i|=4:r>n&&(i|=8),i}var a=Math.cos(t),o=a>0,s=xo(a)>jo,l=vr(t,6*Ho);return Ie(e,r,l,o?[0,-t]:[-Fo,t-Fo])}function qe(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=s.x,f=s.y,h=0,d=1,p=c-l,g=f-u;if(a=t-l,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=r-l,p||!(a<0)){if(a/=p,p<0){if(a>d)return;a>h&&(h=a)}else if(p>0){if(a0)){if(a/=g,g<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=n-u,g||!(a<0)){if(a/=g,g<0){if(a>d)return;a>h&&(h=a)}else if(g>0){if(a0&&(i.a={x:l+h*p,y:u+h*g}),d<1&&(i.b={x:l+d*p,y:u+d*g}),i}}}}}}function Ge(t,e,r,n){function i(n,i){return xo(n[0]-t)0?0:3:xo(n[0]-r)0?2:1:xo(n[1]-e)0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(t,e){var r=i(t,1),n=i(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,r=v.length,n=t[1],i=0;in&&et(u,a,t)>0&&++e:a[1]<=n&&et(u,a,t)<0&&--e,u=a;return 0!==e}function u(a,s,l,u){var c=0,f=0;if(null==a||(c=i(a,l))!==(f=i(s,l))||o(a,s)<0^l>0){do u.point(0===c||3===c?t:r,c>1?n:e);while((c=(c+l+4)%4)!==f)}else u.point(s[0],s[1])}function c(i,a){return t<=i&&i<=r&&e<=a&&a<=n}function f(t,e){c(t,e)&&s.point(t,e)}function h(){S.point=p,v&&v.push(m=[]),M=!0,A=!1,_=w=NaN}function d(){g&&(p(y,b),x&&A&&E.rejoin(),g.push(E.buffer())),S.point=f,A&&s.lineEnd()}function p(t,e){t=Math.max(-Bs,Math.min(Bs,t)),e=Math.max(-Bs,Math.min(Bs,e));var r=c(t,e);if(v&&m.push([t,e]),M)y=t,b=e,x=r,M=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&A)s.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};L(n)?(A||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),k=!1):r&&(s.lineStart(),s.point(t,e),k=!1)}_=t,w=e,A=r}var g,v,m,y,b,x,_,w,A,M,k,T=s,E=je(),L=qe(t,e,r,n),S={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=E,g=[],v=[],k=!0},polygonEnd:function(){s=T,g=uo.merge(g);var e=l([t,n]),r=k&&e,i=g.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Pe(g,a,e,u,s),s.polygonEnd()),g=v=m=null}};return S}}function Xe(t){var e=0,r=Fo/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Fo/180,r=t[1]*Fo/180):[e/Fo*180,r/Fo*180]},i}function Ye(t,e){function r(t,e){var r=Math.sqrt(a-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),o-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,a=1+n*(2*i-n),o=Math.sqrt(a)/i;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,nt((a-(t*t+r*r)*i*i)/(2*i))]},r}function We(){function t(t,e){Vs+=i*t-n*e,n=t,i=e}var e,r,n,i;Ys.point=function(a,o){Ys.point=t,e=n=a,r=i=o},Ys.lineEnd=function(){t(e,r)}}function Ze(t,e){tGs&&(Gs=t),eXs&&(Xs=e)}function Qe(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=r}function r(t,e){o.push("L",t,",",e)}function n(){s.point=t}function i(){o.push("Z")}var a=$e(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return a=$e(t),s},result:function(){if(o.length){var t=o.join("");return o=[],t}}};return s}function $e(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ke(t,e){Ss+=t,Cs+=e,++Rs}function Je(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);Ps+=o*(e+t)/2,Os+=o*(r+n)/2,Ns+=o,Ke(e=t,r=n)}var e,r;Zs.point=function(n,i){Zs.point=t,Ke(e=n,r=i)}}function tr(){Zs.point=Ke}function er(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Ps+=o*(n+t)/2,Os+=o*(i+e)/2,Ns+=o,o=i*t-n*e,Is+=o*(n+t),zs+=o*(i+e),js+=3*o,Ke(n=t,i=e)}var e,r,n,i;Zs.point=function(a,o){Zs.point=t,Ke(e=n=a,r=i=o)},Zs.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+o,r),t.arc(e,r,o,0,Bo)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function i(){s.point=e}function a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:i,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return o=t,s},result:A};return s}function nr(t){function e(t){return(s?n:r)(t)}function r(e){return or(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})}function n(e){function r(r,n){r=t(r,n),e.point(r[0],r[1])}function n(){b=NaN,M.point=a,e.lineStart()}function a(r,n){var a=me([r,n]),o=t(r,n);i(b,x,y,_,w,A,b=o[0],x=o[1],y=r,_=a[0],w=a[1],A=a[2],s,e),e.point(b,x)}function o(){M.point=r,e.lineEnd()}function l(){n(),M.point=u,M.lineEnd=c}function u(t,e){a(f=t,h=e),d=b,p=x,g=_,v=w,m=A,M.point=a}function c(){i(b,x,y,_,w,A,d,p,f,g,v,m,s,e),M.lineEnd=o,o()}var f,h,d,p,g,v,m,y,b,x,_,w,A,M={point:r,lineStart:n,lineEnd:o,polygonStart:function(){e.polygonStart(),M.lineStart=l},polygonEnd:function(){e.polygonEnd(),M.lineStart=n}};return M}function i(e,r,n,s,l,u,c,f,h,d,p,g,v,m){var y=c-e,b=f-r,x=y*y+b*b;if(x>4*a&&v--){var _=s+d,w=l+p,A=u+g,M=Math.sqrt(_*_+w*w+A*A),k=Math.asin(A/=M),T=xo(xo(A)-1)a||xo((y*C+b*R)/x-.5)>.3||s*d+l*p+u*g0&&16,e):Math.sqrt(a)},e}function ir(t){var e=nr(function(e,r){return t([e*qo,r*qo])});return function(t){return ur(e(t))}}function ar(t){this.stream=t}function or(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function sr(t){return lr(function(){return t})()}function lr(t){function e(t){return t=s(t[0]*Ho,t[1]*Ho),[t[0]*h+l,u-t[1]*h]}function r(t){return t=s.invert((t[0]-l)/h,(u-t[1])/h),t&&[t[0]*qo,t[1]*qo]}function n(){s=Ce(o=hr(m,y,b),a);var t=a(g,v);return l=d-t[0]*h,u=p+t[1]*h,i()}function i(){return c&&(c.valid=!1,c=null),e}var a,o,s,l,u,c,f=nr(function(t,e){return t=a(t,e),[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,g=0,v=0,m=0,y=0,b=0,_=Fs,w=x,A=null,M=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(o,f(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(A=t,Fs):He((A=+t)*Ho),i()):A},e.clipExtent=function(t){return arguments.length?(M=t, -w=t?Ge(t[0][0],t[0][1],t[1][0],t[1][1]):x,i()):M},e.scale=function(t){return arguments.length?(h=+t,n()):h},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],n()):[d,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Ho,v=t[1]%360*Ho,n()):[g*qo,v*qo]},e.rotate=function(t){return arguments.length?(m=t[0]%360*Ho,y=t[1]%360*Ho,b=t.length>2?t[2]%360*Ho:0,n()):[m*qo,y*qo,b*qo]},uo.rebind(e,f,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&r,n()}}function ur(t){return or(t,function(e,r){t.point(e*Ho,r*Ho)})}function cr(t,e){return[t,e]}function fr(t,e){return[t>Fo?t-Bo:t<-Fo?t+Bo:t,e]}function hr(t,e,r){return t?e||r?Ce(pr(t),gr(e,r)):pr(t):e||r?gr(e,r):fr}function dr(t){return function(e,r){return e+=t,[e>Fo?e-Bo:e<-Fo?e+Bo:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function gr(t,e){function r(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*n+s*i;return[Math.atan2(l*a-c*o,s*n-u*i),nt(c*a+l*o)]}var n=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*a-l*o;return[Math.atan2(l*a+u*o,s*n+c*i),nt(c*n-s*i)]},r}function vr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=mr(r,i),a=mr(r,a),(o>0?ia)&&(i+=o*Bo)):(i=t+o*Bo,a=t-.5*l);for(var u,c=i;o>0?c>a:c0?e<-Vo+jo&&(e=-Vo+jo):e>Vo-jo&&(e=Vo-jo);var r=o/Math.pow(i(e),a);return[r*Math.sin(a*t),o-r*Math.cos(a*t)]}var n=Math.cos(t),i=function(t){return Math.tan(Fo/4+t/2)},a=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),o=n*Math.pow(i(t),a)/a;return a?(r.invert=function(t,e){var r=o-e,n=tt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(o/n,1/a))-Vo]},r):Er}function Tr(t,e){function r(t,e){var r=a-e;return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),a=n/i+t;return xo(i)1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Or(t,e){return t[0]-e[0]||t[1]-e[1]}function Nr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Ir(t,e,r,n){var i=t[0],a=r[0],o=e[0]-i,s=n[0]-a,l=t[1],u=r[1],c=e[1]-l,f=n[1]-u,h=(s*(l-u)-f*(i-a))/(f*o-s*c);return[i+h*o,l+h*c]}function zr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function jr(){an(this),this.edge=this.site=this.circle=null}function Dr(t){var e=ul.pop()||new jr;return e.site=t,e}function Fr(t){Zr(t),ol.remove(t),ul.push(t),an(t)}function Br(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},a=t.P,o=t.N,s=[t];Fr(t);for(var l=a;l.circle&&xo(r-l.circle.x)jo)s=s.L;else{if(i=a-Hr(s,o),!(i>jo)){n>-jo?(e=s.P,r=s):i>-jo?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=Dr(t);if(ol.insert(e,l),e||r){if(e===r)return Zr(e),r=Dr(e.site),ol.insert(l,r),l.edge=r.edge=Jr(e.site,l.site),Wr(e),void Wr(r);if(!r)return void(l.edge=Jr(e.site,l.site));Zr(e),Zr(r);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=r.site,g=p.x-c,v=p.y-f,m=2*(h*v-d*g),y=h*h+d*d,b=g*g+v*v,x={x:(v*y-d*b)/m+c,y:(h*b-g*y)/m+f};en(r.edge,u,p,x),l.edge=Jr(u,t,null,x),r.edge=Jr(t,p,null,x),Wr(e),Wr(r)}}function Vr(t,e){var r=t.site,n=r.x,i=r.y,a=i-e;if(!a)return n;var o=t.P;if(!o)return-(1/0);r=o.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,f=1/a-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+i-a/2)))/f+n:(n+s)/2}function Hr(t,e){var r=t.N;if(r)return Vr(r,e);var n=t.site;return n.y===e?n.x:1/0}function qr(t){this.site=t,this.edges=[]}function Gr(t){for(var e,r,n,i,a,o,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],g=al,v=g.length;v--;)if(a=g[v],a&&a.prepare())for(s=a.edges,l=s.length,o=0;ojo||xo(i-r)>jo)&&(s.splice(o,0,new rn(tn(a.site,c,xo(n-f)jo?{x:f,y:xo(e-f)jo?{x:xo(r-p)jo?{x:h,y:xo(e-h)jo?{x:xo(r-d)=-Do)){var d=l*l+u*u,p=c*c+f*f,g=(f*d-u*p)/h,v=(l*p-c*d)/h,f=v+s,m=cl.pop()||new Yr;m.arc=t,m.site=i,m.x=g+o,m.y=f+Math.sqrt(g*g+v*v),m.cy=f,t.circle=m;for(var y=null,b=ll._;b;)if(m.y=s)return;if(h>p){if(a){if(a.y>=u)return}else a={x:v,y:l};r={x:v,y:u}}else{if(a){if(a.y1)if(h>p){if(a){if(a.y>=u)return}else a={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}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.xa||f>o||h=x,A=r>=_,M=A<<1|w,k=M+4;Ma&&(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:bn(r,n)})),a=dl.lastIndex;return a=0&&!(r=uo.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function Mn(t){return function(e){return 1-t(1-e)}}function kn(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Ln(t){if(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 Sn(t){return function(e){return Math.pow(e,t)}}function Cn(t){return 1-Math.cos(t*Vo)}function Rn(t){return Math.pow(2,10*(t-1))}function Pn(t){return 1-Math.sqrt(1-t*t)}function On(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Bo*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Bo/e)}}function Nn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function In(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 zn(t,e){t=uo.hcl(t),e=uo.hcl(e);var r=t.h,n=t.c,i=t.l,a=e.h-r,o=e.c-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ht(r+a*t,n+o*t,i+s*t)+""}}function jn(t,e){t=uo.hsl(t),e=uo.hsl(e);var r=t.h,n=t.s,i=t.l,a=e.h-r,o=e.s-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ct(r+a*t,n+o*t,i+s*t)+""}}function Dn(t,e){t=uo.lab(t),e=uo.lab(e);var r=t.l,n=t.a,i=t.b,a=e.l-r,o=e.a-n,s=e.b-i;return function(t){return pt(r+a*t,n+o*t,i+s*t)+""}}function Fn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function Bn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Vn(e),i=Un(e,r),a=Vn(Hn(r,e,-i))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(qn(r)+"rotate(",null,")")-2,x:bn(t,e)})):e&&r.push(qn(r)+"rotate("+e+")")}function Yn(t,e,r,n){t!==e?n.push({i:r.push(qn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(qn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(qn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:bn(t[0],e[0])},{i:i-2,x:bn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(qn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=uo.transform(t),e=uo.transform(e),Gn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Yn(t.skew,e.skew,r,n),Wn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,a=n.length;++i=0;)r.push(i[n])}function li(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;++oi&&(n=r,i=e);return n}function bi(t){return t.reduce(xi,0)}function xi(t,e){return t+e[1]}function _i(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,a=[];++r<=e;)a[r]=i*r+n;return a}function Ai(t){return[uo.min(t),uo.max(t)]}function Mi(t,e){return t.value-e.value}function ki(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ti(t,e){t._pack_next=e,e._pack_prev=t}function Ei(t,e){var r=e.x-t.x,n=e.y-t.y,i=t.r+e.r;return.999*i*i>r*r+n*n}function Li(t){function e(t){c=Math.min(t.x-t.r,c),f=Math.max(t.x+t.r,f),h=Math.min(t.y-t.r,h),d=Math.max(t.y+t.r,d)}if((r=t.children)&&(u=r.length)){var r,n,i,a,o,s,l,u,c=1/0,f=-(1/0),h=1/0,d=-(1/0);if(r.forEach(Si),n=r[0],n.x=-n.r,n.y=0,e(n),u>1&&(i=r[1],i.x=i.r,i.y=0,e(i),u>2))for(a=r[2],Pi(n,i,a),e(a),ki(n,a),n._pack_prev=a,ki(a,i),i=n._pack_next,o=3;o=0;)e=i[a],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function Di(t,e,r){return t.a.parent===e.parent?t.a:r}function Fi(t){return 1+uo.max(t,function(t){return t.y})}function Bi(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ui(t){var e=t.children;return e&&e.length?Ui(e[0]):t}function Vi(t){var e,r=t.children;return r&&(e=r.length)?Vi(r[e-1]):t}function Hi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function qi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(r+=i/2,i=0),a<0&&(n+=a/2,a=0),{x:r,y:n,dx:i,dy:a}}function Gi(t){var e=t[0],r=t[t.length-1];return e2?Qi:Yi,l=n?$n:Qn;return o=i(t,e,l,r),s=i(e,t,l,_n),a}function a(t){return o(t)}var o,s;return a.invert=function(t){return s(t)},a.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},a.range=function(t){return arguments.length?(e=t,i()):e},a.rangeRound=function(t){return a.range(t).interpolate(Fn)},a.clamp=function(t){return arguments.length?(n=t,i()):n},a.interpolate=function(t){return arguments.length?(r=t,i()):r},a.ticks=function(e){return ea(t,e)},a.tickFormat=function(e,r){return ra(t,e,r)},a.nice=function(e){return Ji(t,e),i()},a.copy=function(){return $i(t,e,r,n)},i()}function Ki(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ji(t,e){return Wi(t,Zi(ta(t,e)[2])),Wi(t,Zi(ta(t,e)[2])),t}function ta(t,e){null==e&&(e=10);var r=Gi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),a=e/n*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function ea(t,e){return uo.range.apply(uo,ta(t,e))}function ra(t,e,r){var n=ta(t,e);if(r){var i=hs.exec(r);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(xo(n[0]),xo(n[1])));return i[7]||(i[7]="."+na(a.scale(n[2]))),i[8]="f",r=uo.format(i.join("")),function(t){return r(a.scale(t))+a.symbol}}i[7]||(i[7]="."+ia(i[8],n)),r=i.join("")}else r=",."+na(n[2])+"f";return uo.format(r)}function na(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ia(t,e){var r=na(e[2]);return t in kl?Math.abs(r-na(Math.max(xo(e[0]),xo(e[1]))))+ +("e"!==t):r-2*("%"===t)}function aa(t,e,r,n){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(i(e))}return o.invert=function(e){return a(t.invert(e))},o.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),o):e},o.nice=function(){var e=Wi(n.map(i),r?Math:El);return t.domain(e),n=e.map(a),o},o.ticks=function(){var t=Gi(n),o=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),f=e%1?2:e;if(isFinite(c-u)){if(r){for(;u0;h--)o.push(a(u)*h);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,r){if(!arguments.length)return Tl;arguments.length<2?r=Tl:"function"!=typeof r&&(r=uo.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e0?s[r-1]:t[0],r0?0:1}function xa(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,u=-s*a,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,g=(f+d)/2,v=h-c,m=d-f,y=v*v+m*m,b=r-n,x=c*d-h*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*m-v*_)/y,A=(-x*v-m*_)/y,M=(x*m+v*_)/y,k=(-x*v+m*_)/y,T=w-p,E=A-g,L=M-p,S=k-g;return T*T+E*E>L*L+S*S&&(w=M,A=k),[[w-l,A-u],[w*r/b,A*r/b]]}function _a(t){function e(e){function o(){u.push("M",a(t(c),s))}for(var l,u=[],c=[],f=-1,h=e.length,d=Lt(r),p=Lt(n);++f1?t.join("L"):t+"Z"}function Aa(t){return t.join("L")+"Z"}function Ma(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1&&i.push("H",n[0]),i.join("")}function ka(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 u=2;u9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[s+1]=i*n));for(s=-1;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}function Ua(t){return t.length<3?wa(t):t[0]+Ca(t,Ba(t))}function Va(t){for(var e,r,n,i=-1,a=t.length;++i0;)d[--s].call(t,o);if(a>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var l,u,c,h,d,p=t[r]||(t[r]={active:0,count:0}),g=p[n];g||(l=i.time,u=Ot(a,0,l),g=p[n]={tween:new f,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function ro(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function no(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function io(t){return t.toISOString()}function ao(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,a=uo.bisect(Kl,i);return a==Kl.length?[e.year,ta(t.map(function(t){return t/31536e6}),r)[2]]:a?e[i/Kl[a-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Gi(n.domain()),a=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(r[0],oo(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return ao(t.copy(),e,r)},Ki(n,t)}function oo(t){return new Date(t)}function so(t){return JSON.parse(t.responseText)}function lo(t){var e=ho.createRange();return e.selectNode(ho.body),e.createContextualFragment(t.responseText)}var uo={version:"3.5.17"},co=[].slice,fo=function(t){return co.call(t)},ho=this.document;if(ho)try{fo(ho.documentElement.childNodes)[0].nodeType}catch(t){fo=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}),ho)try{ho.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var po=this.Element.prototype,go=po.setAttribute,vo=po.setAttributeNS,mo=this.CSSStyleDeclaration.prototype,yo=mo.setProperty;po.setAttribute=function(t,e){go.call(this,t,e+"")},po.setAttributeNS=function(t,e,r){vo.call(this,t,e,r+"")},mo.setProperty=function(t,e,r){yo.call(this,t,e+"",r)}}uo.ascending=i,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.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},uo.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},uo.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 l/(c-1)},uo.deviation=function(){var t=uo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var bo=s(i);uo.bisectLeft=bo.left,uo.bisect=uo.bisectRight=bo.right,uo.bisector=function(t){return s(1===t.length?function(e,r){return i(t(e),r)}:t)},uo.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},uo.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},uo.pairs=function(t){for(var e,r=0,n=t.length-1,i=t[0],a=new Array(n<0?0:n);r=0;)for(n=t[i],e=n.length;--e>=0;)r[--o]=n[e];return r};var xo=Math.abs;uo.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=u(xo(r)),o=-1;if(t*=a,e*=a,r*=a,r<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=a.length)return n?n.call(i,o):r?o.sort(r):o;for(var l,u,c,h,d=-1,p=o.length,g=a[s++],v=new f;++d=a.length)return t;var n=[],i=o[r++];return t.forEach(function(t,i){n.push({key:t,values:e(i,r)})}),i?n.sort(function(t,e){return i(t.key,e.key)}):n}var r,n,i={},a=[],o=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(uo.map,r,0),0)},i.key=function(t){return a.push(t),i},i.sortKeys=function(t){return o[a.length-1]=t,i},i.sortValues=function(t){return r=t,i},i.rollup=function(t){return n=t,i},i},uo.set=function(t){var e=new b;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}},uo.event=null,uo.requote=function(t){return t.replace(Mo,"\\$&")};var Mo=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ko={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},To=function(t,e){return e.querySelector(t)},Eo=function(t,e){return e.querySelectorAll(t)},Lo=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Lo=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(To=function(t,e){return Sizzle(t,e)[0]||null},Eo=Sizzle,Lo=Sizzle.matchesSelector),uo.selection=function(){return uo.select(ho.documentElement)};var So=uo.selection.prototype=[];So.select=function(t){var e,r,n,i,a=[];t=C(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Ro.hasOwnProperty(r)?{space:Ro[r],local:t}:t}},So.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=uo.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(P(e,t[e]));return this}return this.each(P(t,e))},So.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=I(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},So.sort=function(t){t=q.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.transition().duration(S)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-M.x)/M.k}).map(x.invert)),A&&A.domain(w.range().map(function(t){return(t-M.y)/M.k}).map(w.invert))}function l(t){C++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:M.k,translate:[M.x,M.y]})}function c(t){--C||(t({type:"zoomend"}),v=null)}function f(){function t(){s=1,a(uo.mouse(i),h),u(o)}function r(){f.on(P,null).on(O,null),d(s),c(o)}var i=this,o=I.of(i,arguments),s=0,f=uo.select(n(i)).on(P,t).on(O,r),h=e(uo.mouse(i)),d=$(i);Vl.call(i),l(o)}function h(){function t(){var t=uo.touches(p);return d=M.k,t.forEach(function(t){t.identifier in v&&(v[t.identifier]=e(t))}),t}function r(){var e=uo.event.target;uo.select(e).on(x,n).on(_,s),w.push(e);for(var r=uo.event.changedTouches,i=0,a=r.length;i1){var c=l[0],f=l[1],h=c[0]-f[0],d=c[1]-f[1];m=h*h+d*d}}function n(){var t,e,r,n,o=uo.touches(p);Vl.call(p);for(var s=0,l=o.length;s=u)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ds=uo.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=uo.round(t,jt(t,e))).toFixed(Math.max(0,Math.min(20,jt(t*(1+1e-15),e))))}}),ps=uo.time={},gs=Date;Ut.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){vs.setUTCDate.apply(this._,arguments)},setDay:function(){vs.setUTCDay.apply(this._,arguments)},setFullYear:function(){vs.setUTCFullYear.apply(this._,arguments)},setHours:function(){vs.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){vs.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){vs.setUTCMinutes.apply(this._,arguments)},setMonth:function(){vs.setUTCMonth.apply(this._,arguments)},setSeconds:function(){vs.setUTCSeconds.apply(this._,arguments)},setTime:function(){vs.setTime.apply(this._,arguments)}};var vs=Date.prototype;ps.year=Vt(function(t){return t=ps.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),ps.years=ps.year.range,ps.years.utc=ps.year.utc.range,ps.day=Vt(function(t){var e=new gs(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),ps.days=ps.day.range,ps.days.utc=ps.day.utc.range,ps.dayOfYear=function(t){var e=ps.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var r=ps[t]=Vt(function(t){return(t=ps.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var r=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});ps[t+"s"]=r.range,ps[t+"s"].utc=r.utc.range,ps[t+"OfYear"]=function(t){var r=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(r+e)%7)/7)}}),ps.week=ps.sunday,ps.weeks=ps.sunday.range,ps.weeks.utc=ps.sunday.utc.range,ps.weekOfYear=ps.sundayOfYear;var ms={"-":"",_:" ",0:"0"},ys=/^\s*\d+/,bs=/^%/;uo.locale=function(t){return{numberFormat:Ft(t),timeFormat:qt(t)}};var xs=uo.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"]});uo.format=xs.numberFormat,uo.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,_s),he(_s.s,this.s,this),this.s?this.t+=_s.t:this.s=_s.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _s=new fe;uo.geo.stream=function(t,e){t&&ws.hasOwnProperty(t.type)?ws[t.type](t,e):de(t,e)};var ws={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nd&&(d=e)}function e(e,r){var n=me([e*Ho,r*Ho]);if(m){var i=be(m,n),a=[i[1],-i[0],0],o=be(a,i);we(o),o=Ae(o);var l=e-p,u=l>0?1:-1,g=o[0]*qo*u,v=xo(l)>180; -if(v^(u*pd&&(d=y)}else if(g=(g+360)%360-180,v^(u*pd&&(d=r);v?es(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e):h>=c?(eh&&(h=e)):e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,r);m=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=h,_.point=t,m=null}function i(t,r){if(m){var n=t-p;y+=xo(n)>180?n+(n>0?360:-360):n}else g=t,v=r;Ts.point(t,r),e(t,r)}function a(){Ts.lineStart()}function o(){i(g,v),Ts.lineEnd(),xo(y)>jo&&(c=-(h=180)),x[0]=c,x[1]=h,m=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tjo?d=90:y<-jo&&(f=-90),x[0]=c,x[1]=h}};return function(t){d=h=-(c=f=1/0),b=[],uo.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,i=b[0],a=[i];ns(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):a.push(i=r);for(var o,r,p=-(1/0),e=a.length-1,n=0,i=a[e];n<=e;i=r,++n)r=a[n],(o=s(i[1],r[0]))>p&&(p=o,c=r[0],h=i[1])}return b=x=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){Es=Ls=Ss=Cs=Rs=Ps=Os=Ns=Is=zs=js=0,uo.geo.stream(t,Ds);var e=Is,r=zs,n=js,i=e*e+r*r+n*n;return i=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},t.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()}}},t.precision=function(e){return arguments.length?(a.precision(e),o.precision(e),s.precision(e),t):a.precision()},t.scale=function(e){return arguments.length?(a.scale(e),o.scale(.35*e),s.scale(e),t.translate(a.translate())):a.scale()},t.translate=function(e){if(!arguments.length)return a.translate();var u=a.scale(),c=+e[0],f=+e[1];return r=a.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,n=o.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+jo,f+.12*u+jo],[c-.214*u-jo,f+.234*u-jo]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+jo,f+.166*u+jo],[c-.115*u-jo,f+.234*u-jo]]).stream(l).point,t},t.scale(1070)};var Us,Vs,Hs,qs,Gs,Xs,Ys={point:A,lineStart:A,lineEnd:A,polygonStart:function(){Vs=0,Ys.lineStart=We},polygonEnd:function(){Ys.lineStart=Ys.lineEnd=Ys.point=A,Us+=xo(Vs/2)}},Ws={point:Ze,lineStart:A,lineEnd:A,polygonStart:A,polygonEnd:A},Zs={point:Ke,lineStart:Je,lineEnd:tr,polygonStart:function(){Zs.lineStart=er},polygonEnd:function(){Zs.point=Ke,Zs.lineStart=Je,Zs.lineEnd=tr}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),uo.geo.stream(t,o)),a.result()}function e(){return o=null,t}var r,n,i,a,o,s=4.5;return t.area=function(t){return Us=0,uo.geo.stream(t,i(Ys)),Us},t.centroid=function(t){return Ss=Cs=Rs=Ps=Os=Ns=Is=zs=js=0,uo.geo.stream(t,i(Zs)),js?[Is/js,zs/js]:Ns?[Ps/Ns,Os/Ns]:Rs?[Ss/Rs,Cs/Rs]:[NaN,NaN]},t.bounds=function(t){return Gs=Xs=-(Hs=qs=1/0),uo.geo.stream(t,i(Ws)),[[Hs,qs],[Gs,Xs]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):x,e()):r},t.context=function(t){return arguments.length?(a=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&a.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(a.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var r=new ar(e);for(var n in t)r[n]=t[n];return r}}},ar.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()}},uo.geo.projection=sr,uo.geo.projectionMutator=lr,(uo.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*Ho,e[1]*Ho),e[0]*=qo,e[1]*=qo,e}return t=hr(t[0]%360*Ho,t[1]*Ho,t.length>2?t[2]*Ho:0),e.invert=function(e){return e=t.invert(e[0]*Ho,e[1]*Ho),e[0]*=qo,e[1]*=qo,e},e},fr.invert=cr,uo.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=hr(-t[0]*Ho,-t[1]*Ho,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=qo,t[1]*=qo}}),{type:"Polygon",coordinates:[i]}}var e,r,n=[0,0],i=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=vr((e=+n)*Ho,i*Ho),t):e},t.precision=function(n){return arguments.length?(r=vr(e*Ho,(i=+n)*Ho),t):i},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ho,i=t[1]*Ho,a=e[1]*Ho,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((r=f*o)*r+(r=u*c-l*f*s)*r),l*c+u*f*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/v)*v,i,v).map(h).concat(uo.range(Math.ceil(u/m)*m,l,m).map(d)).concat(uo.range(Math.ceil(n/p)*p,r,p).filter(function(t){return xo(t%v)>jo}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return xo(t%m)>jo}).map(f))}var r,n,i,a,o,s,l,u,c,f,h,d,p=10,g=p,v=90,m=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[h(a).concat(d(l).slice(1),h(i).reverse().slice(1),d(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(a=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],a>i&&(e=a,a=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[a,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(v=+e[0],m=+e[1],t):[v,m]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,o,90),f=br(n,r,y),h=yr(u,l,90),d=br(a,i,y),t):y},t.majorExtent([[-180,-90+jo],[180,90-jo]]).minorExtent([[-180,-80-jo],[180,80+jo]])},uo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}var e,r,n=xr,i=_r;return t.distance=function(){return uo.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(i=e,r="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},uo.geo.interpolate=function(t,e){return wr(t[0]*Ho,t[1]*Ho,e[0]*Ho,e[1]*Ho)},uo.geo.length=function(t){return Qs=0,uo.geo.stream(t,$s),Qs};var Qs,$s={sphere:A,point:A,lineStart:Ar,lineEnd:A,polygonStart:A,polygonEnd:A},Ks=Mr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Ks)}).raw=Ks;var Js=Mr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr(Js)}).raw=Js,(uo.geo.conicConformal=function(){return Xe(kr)}).raw=kr,(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var tl=Mr(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(tl)}).raw=tl,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return Lr(Er)}).raw=Er;var el=Mr(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr(el)}).raw=el;var rl=Mr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(rl)}).raw=rl,Sr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Vo]},(uo.geo.transverseMercator=function(){var t=Lr(Sr),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=Sr,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Lt(r),a=Lt(n),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e=n&&u.x<=a&&u.y>=i&&u.y<=o?[[n,o],[a,o],[a,i],[n,i]]:[];c.point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/jo)*jo,y:Math.round(o(t,e)/jo)*jo,i:e}})}var n=Cr,i=Rr,a=n,o=i,s=fl;return t?e(t):(e.links=function(t){return un(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return un(r(t)).cells.forEach(function(r,n){for(var i,a,o=r.site,s=r.edges.sort(Xr),l=-1,u=s.length,c=s[u-1].edge,f=c.l===o?c.r:c.l;++l=u,h=n>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),f?i=u:s=u,h?o=c:l=c,a(t,e,r,n,i,o,s,l)}var c,f,h,d,p,g,v,m,y,b=Lt(s),x=Lt(l);if(null!=e)g=e,v=r,m=n,y=i;else if(m=y=-(g=v=1/0),f=[],h=[],p=t.length,o)for(d=0;dm&&(m=c.x),c.y>y&&(y=c.y),f.push(c.x),h.push(c.y);else for(d=0;dm&&(m=_),w>y&&(y=w),f.push(_),h.push(w)}var A=m-g,M=y-v;A>M?y=v+A:m=g+M;var k=pn();if(k.add=function(t){a(k,t,+b(t,++d),+x(t,d),g,v,m,y)},k.visit=function(t){gn(t,k,g,v,m,y)},k.find=function(t){return vn(k,t[0],t[1],g,v,m,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=gl.get(r)||pl,n=vl.get(n)||x,An(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=zn,uo.interpolateHsl=jn,uo.interpolateLab=Dn,uo.interpolateRound=Fn,uo.transform=function(t){var e=ho.createElementNS(uo.ns.prefix.svg,"g");return(uo.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Bn(r?r.matrix:ml)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ml={a:1,b:0,c:0,d:1,e:0,f:0};uo.interpolateTransform=Zn,uo.layout={},uo.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r0?i=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),r=Ot(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;l=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;n&&(a.value=0),a.children=u}else n&&(a.value=+n.call(t,a,a.depth)||0),delete a.children;return li(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=fi,r=ui,n=ci;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0),(r=e.parent)&&(r.value+=e.value)})),e},t},uo.layout.partition=function(){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,u=-1;for(n=e.value?n/e.value:0;++us&&(s=n),o.push(n)}for(r=0;r0)for(a=-1;++a=c[0]&&s<=c[1]&&(o=l[uo.bisect(f,s,1,d)-1],o.y+=p,o.push(t[a]));return l}var e=!0,r=Number,n=Ai,i=_i;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=Lt(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:Lt(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},uo.layout.pack=function(){function t(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,Li),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=f}),li(s,Li),li(s,function(t){t.r-=f})}return Ri(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),o}var e,r=uo.layout.hierarchy().sort(Mi),n=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},oi(t,r)},uo.layout.tree=function(){function t(t,i){var c=o.call(this,t,i),f=c[0],h=e(f);if(li(h,r),h.parent.m=-h.z,si(h,n),u)si(f,a);else{var d=f,p=f,g=f;si(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var v=s(d,p)/2-d.x,m=l[0]/(p.x+s(p,d)/2+v),y=l[1]/(g.depth||1);si(f,function(t){t.x=(t.x+v)*m,t.y=t.depth*y})}return c}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var i,a=e.children,o=0,s=a.length;o0&&(zi(Di(o,t,r),t,n),u+=n,c+=n),f+=o.m,u+=i.m,h+=l.m,c+=a.m;o&&!Ii(a)&&(a.t=o,a.m+=f-c),i&&!Ni(l)&&(l.t=i,l.m+=u-h,r=t)}return r}function a(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Oi,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?a:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:a,t):u?l:null},oi(t,o)},uo.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=Bi(e),t.y=Fi(e)):(t.x=o?u+=r(t,o):0,t.y=0,o=t)});var c=Ui(l),f=Vi(l),h=c.x-r(c,f)/2,d=f.x+r(f,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*n[0],t.y=(l.y-t.y)*n[1]}:function(t){t.x=(t.x-h)/(d-h)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=uo.layout.hierarchy().sort(null).value(null),r=Oi,n=[1,1],i=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(i=null==(n=e),t):i?null:n},t.nodeSize=function(e){return arguments.length?(i=null!=(n=e),t):i?n:null},oi(t,e)},uo.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,a=t.length;++i0;)c.push(o=h[l-1]),c.area+=o.area,"squarify"!==d||(s=n(c,g))<=p?(h.pop(),p=s):(c.area-=c.pop().area,i(c,g,u,!1),g=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,g,u,!0),c.length=c.area=0),a.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var a,o=f(e),s=n.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(i(l,a.z?o.dx:o.dy,o,!s.length),l.length=l.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=r));return n*=n,e*=e,n?Math.max(e*i*p/n,n/(e*a*p)):1/0}function i(t,e,r,n){var i,a=-1,o=t.length,s=r.x,u=r.y,c=e?l(t.area/e):0;if(e==r.dx){for((n||c>r.dy)&&(c=r.dy);++ar.dx)&&(c=r.dx);++a1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=uo.random.normal.apply(uo,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=uo.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;rf?0:1;if(u=Uo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,v,m,y,b,x,_,w,A,M,k,T=0,E=0,L=[];if((m=(+l.apply(this,arguments)||0)/2)&&(v=a===Pl?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(E*=-1),u&&(E=nt(v/u*Math.sin(m))),t&&(T=nt(v/t*Math.sin(m)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(f-E),_=u*Math.sin(f-E);var S=Math.abs(f-c-2*E)<=Fo?0:1;if(E&&ba(y,b,x,_)===d^S){var C=(c+f)/2;y=u*Math.cos(C),b=u*Math.sin(C),x=_=null}}else y=b=0;if(t){w=t*Math.cos(f-T),A=t*Math.sin(f-T),M=t*Math.cos(c+T),k=t*Math.sin(c+T);var R=Math.abs(c-f+2*T)<=Fo?0:1;if(T&&ba(w,A,M,k)===1-d^R){var P=(c+f)/2;w=t*Math.cos(P),A=t*Math.sin(P),M=k=null}}else w=A=0;if(h>jo&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){g=tFo)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var a=xr,o=_r,s=qa,l=va,u=ma;return t.radius=function(e){return arguments.length?(s=Lt(e),t):s},t.source=function(e){return arguments.length?(a=Lt(e),t):a},t.target=function(e){return arguments.length?(o=Lt(e),t):o},t.startAngle=function(e){return arguments.length?(l=Lt(e),t):l},t.endAngle=function(e){return arguments.length?(u=Lt(e),t):u},t},uo.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=r.call(this,t,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return l=l.map(n),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=xr,r=_r,n=Ga;return t.source=function(r){return arguments.length?(e=Lt(r),t):e},t.target=function(e){return arguments.length?(r=Lt(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},uo.svg.diagonal.radial=function(){var t=uo.svg.diagonal(),e=Ga,r=t.projection;return t.projection=function(t){return arguments.length?r(Xa(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(jl.get(e.call(this,t,n))||Za)(r.call(this,t,n))}var e=Wa,r=Ya;return t.type=function(r){return arguments.length?(e=Lt(r),t):e},t.size=function(e){return arguments.length?(r=Lt(e),t):r},t};var jl=uo.map({circle:Za,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*Fl)),r=e*Fl;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/Dl),r=e*Dl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Dl),r=e*Dl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=jl.keys();var Dl=Math.sqrt(3),Fl=Math.tan(30*Ho);So.transition=function(t){for(var e,r,n=Bl||++ql,i=to(t),a=[],o=Ul||{time:Date.now(),ease:Ln,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",f[1]-f[0])}function i(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function a(){function a(){32==uo.event.keyCode&&(S||(b=null,R[0]-=f[1],R[1]-=h[1],S=2),T())}function g(){32==uo.event.keyCode&&2==S&&(R[0]+=f[1],R[1]+=h[1],S=0,T())}function v(){var t=uo.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),S||(uo.event.altKey?(b||(b=[(f[0]+f[1])/2,(h[0]+h[1])/2]),R[0]=f[+(t[0]=2)return!1;t[r]=n}return!0}):w.filter(function(t){for(var e=0;e<=o;++e){var r=y[t[e]];if(r<0)return!1;t[e]=r}return!0}),1&o)for(var f=0;f>>31},e.exports.exponent=function(t){var r=e.exports.hi(t);return(r<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){var r=e.exports.hi(t);return!(2146435072&r)}}).call(this,t("buffer").Buffer)},{buffer:45}],77:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(i<=0)return[];var a,o=new Array(i);if(r===t.length-1)for(a=0;a0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=a},{}],78:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;n0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],a=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(s=a;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(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],81:[function(t,e,r){"use strict";function n(t,e,r){var n=e||0,i=r||1;return[[t[12]+t[0],t[13]+t[1],t[14]+t[2],t[15]+t[3]],[t[12]-t[0],t[13]-t[1],t[14]-t[2],t[15]-t[3]],[t[12]+t[4],t[13]+t[5],t[14]+t[6],t[15]+t[7]],[t[12]-t[4],t[13]-t[5],t[14]-t[6],t[15]-t[7]],[n*t[12]+t[8],n*t[13]+t[9],n*t[14]+t[10],n*t[15]+t[11]],[i*t[12]-t[8],i*t[13]-t[9],i*t[14]-t[10],i*t[15]-t[11]]]}e.exports=n},{}],82:[function(t,e,r){"use strict";function n(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}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],83:[function(t,e,r){"use strict";function n(t,e,r){return Math.min(e,Math.max(t,r))}function i(t,e,r){this.dimension=t.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n=r-1)for(var h=o.length-1,p=t-e[r-1],d=0;d=r-1)for(var c=a.length-1,f=(t-e[r-1],0);f=0;--r)if(t[--e])return!1;return!0},u.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t0;--f)i.push(n(l[f-1],u[f-1],arguments[f])),a.push(0)}},u.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 d=n(u[h-1],c[h-1],arguments[h]);i.push(d),a.push((d-i[o++])*f)}}},u.set=function(t){var e=this.dimension;if(!(t0;--l)r.push(n(o[l-1],s[l-1],arguments[l])),i.push(0)}},u.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var i=this._state,a=this._velocity,o=i.length-this.dimension,s=this.bounds,l=s[0],u=s[1],c=t-e,f=c>1e-6?1/c:0;this._time.push(t);for(var h=r;h>0;--h){var d=arguments[h];i.push(n(l[h-1],u[h-1],i[o++]+d)),a.push(d*f)}}},u.idle=function(t){var e=this.lastT();if(!(t=0;--f)i.push(n(l[f],u[f],i[o]+c*a[o])),a.push(0),o+=1}}},{"binary-search-bounds":34,"cubic-hermite":69}],84:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=a}function i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function a(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}function l(t,e){if(e.left){var r=l(t,e.left);if(r)return r}var r=t(e.key,e.value);return r?r:e.right?l(t,e.right):void 0}function u(t,e,r,n){var i=e(t,n.key);if(i<=0){if(n.left){var a=u(t,e,r,n.left);if(a)return a}var a=r(n.key,n.value);if(a)return a}if(n.right)return u(t,e,r,n.right)}function c(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=c(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return c(t,e,r,n,i.right)}function f(t,e){this.tree=t,this._stack=e}function h(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t._color=e._color,t._count=e._count}function d(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=m);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===v){if(n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=m,r._color=m,s._color=m,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}return void(t[l-1]=n)}if(n.left&&n.left._color===v){if(n=r.right=i(n),s=n.left=i(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=m,n._color=m,e._color=m,o(r),o(n),o(s),l>1){var u=t[l-2];u.left===r?u.left=s:u.right=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.right=a(v,n));r.right=a(v,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=v,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}t[l-1]=n,t[l]=r,l+11){var u=t[l-2];u.right===r?u.right=n:u.left=n}return void(t[l-1]=n)}if(n.right&&n.right._color===v){if(n=r.left=i(n),s=n.right=i(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=m,n._color=m,e._color=m,o(r),o(n),o(s),l>1){var u=t[l-2];u.right===r?u.right=s:u.left=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.left=a(v,n));r.left=a(v,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=v,o(r),o(n),l>1){var u=t[l-2];u.right===r?u.right=n:u.left=n}t[l-1]=n,t[l]=r,l+1e?1:0}function g(t){return new s(t||p,null)}e.exports=g;var v=0,m=1,y=s.prototype;Object.defineProperty(y,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(y,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(y,"length",{get:function(){return this.root?this.root._count:0}}),y.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],u=[];i;){var c=r(t,i.key);l.push(i),u.push(c),i=c<=0?i.left:i.right}l.push(new n(v,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){var i=l[f];u[f]<=0?l[f]=new n(i._color,i.key,i.value,l[f+1],i.right,i._count+1):l[f]=new n(i._color,i.key,i.value,i.left,l[f+1],i._count+1)}for(var f=l.length-1;f>1;--f){var h=l[f-1],i=l[f];if(h._color===m||i._color===m)break;var d=l[f-2];if(d.left===h)if(h.left===i){var p=d.right;if(!p||p._color!==v){if(d._color=v,d.left=h.right,h._color=m,h.right=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3){var g=l[f-3];g.left===d?g.left=h:g.right=h}break}h._color=m,d.right=a(m,p),d._color=v,f-=1}else{var p=d.right;if(!p||p._color!==v){if(h.right=i.left,d._color=v,d.left=i.right,i._color=m,i.left=h,i.right=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3){var g=l[f-3];g.left===d?g.left=i:g.right=i}break}h._color=m,d.right=a(m,p),d._color=v,f-=1}else if(h.right===i){var p=d.left;if(!p||p._color!==v){if(d._color=v,d.right=h.left,h._color=m,h.left=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3){var g=l[f-3];g.right===d?g.right=h:g.left=h}break}h._color=m,d.left=a(m,p),d._color=v,f-=1}else{var p=d.left;if(!p||p._color!==v){if(h.left=i.right,d._color=v,d.right=i.left,i._color=m,i.right=h,i.left=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3){var g=l[f-3];g.right===d?g.right=i:g.left=i}break}h._color=m,d.left=a(m,p),d._color=v,f-=1}}return l[0]._color=m,new s(r,l[0])},y.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return c(e,r,this._compare,t,this.root)}},Object.defineProperty(y,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new f(this,t)}}),Object.defineProperty(y,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new f(this,t)}}),y.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,[])},y.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)},y.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)},y.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)},y.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)},y.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var i=e(t,r.key);if(n.push(r),0===i)return new f(this,n);r=i<=0?r.left:r.right}return new f(this,[])},y.remove=function(t){var e=this.find(t);return e?e.remove():this},y.get=function(t){for(var e=this._compare,r=this.root;r;){var n=e(t,r.key);if(0===n)return r.value;r=n<=0?r.left:r.right}};var b=f.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new f(this.tree,this._stack.slice())},b.remove=function(){var t=this._stack;if(0===t.length)return this.tree;var e=new Array(t.length),r=t[t.length-1];e[e.length-1]=new n(r._color,r.key,r.value,r.left,r.right,r._count);for(var i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var a=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var o=e[a-1];e.push(new n(r._color,o.key,o.value,r.left,r.right,r._count)),e[a-1].key=r.key,e[a-1].value=r.value;for(var i=e.length-2;i>=a;--i)r=e[i],e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count);e[a-1].left=e[a]}if(r=e[e.length-1],r._color===v){var l=e[e.length-2];l.left===r?l.left=null:l.right===r&&(l.right=null),e.pop();for(var i=0;i0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(b,"index",{get:function(){var t=0,e=this._stack;if(0===e.length){var r=this.tree.root;return r?r._count:0}e[e.length-1].left&&(t=e[e.length-1].left._count);for(var n=e.length-2;n>=0;--n)e[n+1]===e[n].right&&(++t,e[n].left&&(t+=e[n].left._count));return t},enumerable:!0}),b.next=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.right)for(e=e.right;e;)t.push(e),e=e.left;else for(t.pop();t.length>0&&t[t.length-1].right===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(b,"hasNext",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].right)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].left===t[e])return!0;return!1}}),b.update=function(t){var e=this._stack;if(0===e.length)throw new Error("Can't update empty node!");var r=new Array(e.length),i=e[e.length-1];r[r.length-1]=new n(i._color,i.key,t,i.left,i.right,i._count);for(var a=e.length-2;a>=0;--a)i=e[a],i.left===e[a+1]?r[a]=new n(i._color,i.key,i.value,r[a+1],i.right,i._count):r[a]=new n(i._color,i.key,i.value,i.left,r[a+1],i._count);return new s(this.tree._compare,r[0])},b.prev=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.left)for(e=e.left;e;)t.push(e),e=e.right;else for(t.pop();t.length>0&&t[t.length-1].left===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(b,"hasPrev",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].left)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].right===t[e])return!0;return!1}})},{}],85:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=s[0],r=s.length-1;r>0;--r)e+=s[r]/(t+r);var n=t+o+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=7,a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],o=607/128,s=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];e.exports=function t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(n(e));e-=1;for(var r=a[0],o=1;o0?(d[c]=-1,p[c]=0):(d[c]=0,p[c]=1)}}function s(t,e){var r=new i(t);return r.update(e),r}e.exports=s;var l=t("./lib/text.js"),u=t("./lib/lines.js"),c=t("./lib/background.js"),f=t("./lib/cube.js"),h=t("./lib/ticks.js"),d=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),p=i.prototype;p.update=function(t){function e(e,r,n){if(n in t){var i,a=t[n],o=this[n];(e?Array.isArray(a)&&Array.isArray(a[0]):Array.isArray(a))?this[n]=i=[r(a[0]),r(a[1]),r(a[2])]:this[n]=i=[r(a),r(a),r(a)];for(var s=0;s<3;++s)if(i[s]!==o[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),a=e.bind(this,!1,String),o=e.bind(this,!0,function(t){if(Array.isArray(t)){if(3===t.length)return[+t[0],+t[1],+t[2],1];if(4===t.length)return[+t[0],+t[1],+t[2],+t[3]]}return[0,0,0,1]}),s=!1,c=!1;if("bounds"in t)for(var f=t.bounds,d=0;d<2;++d)for(var p=0;p<3;++p)f[d][p]!==this.bounds[d][p]&&(c=!0),this.bounds[d][p]=f[d][p];if("ticks"in t){r=t.ticks,s=!0,this.autoTicks=!1;for(var d=0;d<3;++d)this.tickSpacing[d]=0}else n("tickSpacing")&&(this.autoTicks=!0,c=!0);if(this._firstInit&&("ticks"in t||"tickSpacing"in t||(this.autoTicks=!0),c=!0,s=!0,this._firstInit=!1),c&&this.autoTicks&&(r=h.create(this.bounds,this.tickSpacing),s=!0),s){for(var d=0;d<3;++d)r[d].sort(function(t,e){return t.x-e.x});h.equal(r,this.ticks)?s=!1:this.ticks=r}i("tickEnable"),a("tickFont")&&(s=!0),n("tickSize"),n("tickAngle"),n("tickPad"),o("tickColor");var g=a("labels");a("labelFont")&&(g=!0),i("labelEnable"),n("labelSize"),n("labelPad"),o("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),o("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),o("lineTickColor"),i("gridEnable"),n("gridWidth"),o("gridColor"),i("zeroEnable"),o("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),o("backgroundColor"),this._text?this._text&&(g||s)&&this._text.update(this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont):this._text=l(this.gl,this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont),this._lines&&s&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=u(this.gl,this.bounds,this.ticks))};var g=[new a,new a,new a],v=[0,0,0],m={model:d,view:d,projection:d};p.isOpaque=function(){return!0},p.isTransparent=function(){return!1},p.drawTransparent=function(t){};var y=[0,0,0],b=[0,0,0],x=[0,0,0];p.draw=function(t){t=t||m;for(var e=this.gl,r=t.model||d,i=t.view||d,a=t.projection||d,s=this.bounds,l=f(r,i,a,s),u=l.cubeEdges,c=l.axis,h=i[12],p=i[13],_=i[14],w=i[15],A=this.pixelRatio*(a[3]*h+a[7]*p+a[11]*_+a[15]*w)/e.drawingBufferHeight,M=0;M<3;++M)this.lastCubeProps.cubeEdges[M]=u[M],this.lastCubeProps.axis[M]=c[M];for(var k=g,M=0;M<3;++M)o(g[M],M,this.bounds,u,c);for(var e=this.gl,T=v,M=0;M<3;++M)this.backgroundEnable[M]?T[M]=c[M]:T[M]=0;this._background.draw(r,i,a,s,T,this.backgroundColor),this._lines.bind(r,i,a,this);for(var M=0;M<3;++M){var E=[0,0,0];c[M]>0?E[M]=s[1][M]:E[M]=s[0][M];for(var L=0;L<2;++L){var S=(M+1+L)%3,C=(M+1+(1^L))%3;this.gridEnable[S]&&this._lines.drawGrid(S,C,this.bounds,E,this.gridColor[S],this.gridWidth[S]*this.pixelRatio)}for(var L=0;L<2;++L){var S=(M+1+L)%3,C=(M+1+(1^L))%3;this.zeroEnable[C]&&s[0][C]<=0&&s[1][C]>=0&&this._lines.drawZero(S,C,this.bounds,E,this.zeroLineColor[C],this.zeroLineWidth[C]*this.pixelRatio)}}for(var M=0;M<3;++M){this.lineEnable[M]&&this._lines.drawAxisLine(M,this.bounds,k[M].primalOffset,this.lineColor[M],this.lineWidth[M]*this.pixelRatio),this.lineMirror[M]&&this._lines.drawAxisLine(M,this.bounds,k[M].mirrorOffset,this.lineColor[M],this.lineWidth[M]*this.pixelRatio);for(var R=n(y,k[M].primalMinor),P=n(b,k[M].mirrorMinor),O=this.lineTickLength,L=0;L<3;++L){var N=A/r[5*L];R[L]*=O[L]*N,P[L]*=O[L]*N}this.lineTickEnable[M]&&this._lines.drawAxisTicks(M,k[M].primalOffset,R,this.lineTickColor[M],this.lineTickWidth[M]*this.pixelRatio),this.lineTickMirror[M]&&this._lines.drawAxisTicks(M,k[M].mirrorOffset,P,this.lineTickColor[M],this.lineTickWidth[M]*this.pixelRatio)}this._text.bind(r,i,a,this.pixelRatio);for(var M=0;M<3;++M){for(var I=k[M].primalMinor,z=n(x,k[M].primalOffset),L=0;L<3;++L)this.lineTickEnable[M]&&(z[L]+=A*I[L]*Math.max(this.lineTickLength[L],0)/r[5*L]);if(this.tickEnable[M]){for(var L=0;L<3;++L)z[L]+=A*I[L]*this.tickPad[L]/r[5*L];this._text.drawTicks(M,this.tickSize[M],this.tickAngle[M],z,this.tickColor[M])}if(this.labelEnable[M]){for(var L=0;L<3;++L)z[L]+=A*I[L]*this.labelPad[L]/r[5*L];z[M]+=.5*(s[0][M]+s[1][M]),this._text.drawLabel(M,this.labelSize[M],this.labelAngle[M],z,this.labelColor[M])}}},p.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null}},{"./lib/background.js":88,"./lib/cube.js":89,"./lib/lines.js":90,"./lib/text.js":92,"./lib/ticks.js":93}],88:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}function i(t){for(var e=[],r=[],i=0,l=0;l<3;++l)for(var u=(l+1)%3,c=(l+2)%3,f=[0,0,0],h=[0,0,0],d=-1;d<=1;d+=2){r.push(i,i+2,i+1,i+1,i+2,i+3),f[l]=d,h[l]=d;for(var p=-1;p<=1;p+=2){f[u]=p;for(var g=-1;g<=1;g+=2)f[c]=g,e.push(f[0],f[1],f[2],h[0],h[1],h[2]),i+=1}var v=u;u=c,c=v}var m=a(t,new Float32Array(e)),y=a(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=o(t,[{buffer:m,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:m,type:t.FLOAT,size:3,offset:12,stride:24}],y),x=s(t);return x.attributes.position.location=0,x.attributes.normal.location=1,new n(t,m,b,x)}e.exports=i;var a=t("gl-buffer"),o=t("gl-vao"),s=t("./shaders").bg,l=n.prototype;l.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),l.disable(l.POLYGON_OFFSET_FILL)}},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":91,"gl-buffer":95,"gl-vao":149}],89:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;n<4;++n){t[n]=r[12+n];for(var i=0;i<3;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;eE&&(_|=1<E&&(_|=1<h[g][1]&&(I=g));for(var z=-1,g=0;g<3;++g){var j=I^1<h[D][0]&&(D=j)}}var F=v;F[0]=F[1]=F[2]=0,F[o.log2(z^I)]=I&z,F[o.log2(I^D)]=I&D;var B=7^D;B===_||B===N?(B=7^z,F[o.log2(D^B)]=B&D):F[o.log2(z^B)]=B&z;for(var U=m,V=_,M=0;M<3;++M)V&1<=0;--g){var v=u[p[g]];s.push(l*v[0],-l*v[1],t)}}for(var s=(this.gl,[]),l=[0,0,0],u=[0,0,0],c=[0,0,0],d=[0,0,0],p=0;p<3;++p){c[p]=s.length/h|0,o(.5*(t[0][p]+t[1][p]),e[p],r),d[p]=(s.length/h|0)-c[p],l[p]=s.length/h|0;for(var g=0;g=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,u=o%a;o<0?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u=0|u);var c=""+l;if(o<0&&(c="-"+c),i){for(var f=""+u;f.length=t[0][i];--o)a.push({x:o*e[i],text:n(e[i],o)});r.push(a)}return r}function a(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 a(t,e){for(var r=l.malloc(t.length,e),n=t.length,i=0;i=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,i){if(r=r||t.ARRAY_BUFFER,i=i||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var a=t.createBuffer(),o=new n(t,r,a,0,i);return o.update(e),o}var l=t("typedarray-pool"),u=t("ndarray-ops"),c=t("ndarray"),f=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],h=n.prototype;h.bind=function(){this.gl.bindBuffer(this.type,this.handle)},h.unbind=function(){this.gl.bindBuffer(this.type,null)},h.dispose=function(){this.gl.deleteBuffer(this.handle)},h.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&"undefined"!=typeof t.shape){var r=t.dtype;if(f.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var n=gl.getExtension("OES_element_index_uint");r=n&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&o(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=l.malloc(t.size,r),h=c(s,t.shape);u.assign(h,t),e<0?this.length=i(this.gl,this.type,this.length,this.usage,s,e):this.length=i(this.gl,this.type,this.length,this.usage,s.subarray(0,t.size),e),l.free(s)}}else if(Array.isArray(t)){var d;d=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),e<0?this.length=i(this.gl,this.type,this.length,this.usage,d,e):this.length=i(this.gl,this.type,this.length,this.usage,d.subarray(0,t.length),e),l.free(d)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");t=0|t,t<=0&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:192,"ndarray-ops":186,"typedarray-pool":247}],96:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],97:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":96}],98:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=n,this.buffer=e,this.vao=r,this.pixelRatio=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lineWidth=[1,1,1],this.capSize=[10,10,10],this.lineCount=[0,0,0],this.lineOffset=[0,0,0],this.opacity=1}function i(t,e){for(var r=0;r<3;++r)t[0][r]=Math.min(t[0][r],e[r]),t[1][r]=Math.max(t[1][r],e[r])}function a(t,e,r,n){for(var i=h[n],a=0;a=1},f.isTransparent=function(){return this.opacity<1},f.drawTransparent=f.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||c,i=r.projection=t.projection||c;r.model=t.model||c,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var a=n[12],o=n[13],s=n[14],l=n[15],u=this.pixelRatio*(i[3]*a+i[7]*o+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var f=0;f<3;++f)e.lineWidth(this.lineWidth[f]),r.capSize=this.capSize[f]*u,e.drawArrays(e.LINES,this.lineOffset[f],this.lineCount[f]);this.vao.unbind()};var h=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=(n+e)%3,o=[0,0,0];o[a]=i,r.push(o)}t[e]=r}return t}();f.update=function(t){t=t||{},"lineWidth"in t&&(this.lineWidth=t.lineWidth,Array.isArray(this.lineWidth)||(this.lineWidth=[this.lineWidth,this.lineWidth,this.lineWidth])),"capSize"in t&&(this.capSize=t.capSize,Array.isArray(this.capSize)||(this.capSize=[this.capSize,this.capSize,this.capSize])),"opacity"in t&&(this.opacity=t.opacity);var e=t.color||[[0,0,0],[0,0,0],[0,0,0]],r=t.position,n=t.error;if(Array.isArray(e[0])||(e=[e,e,e]),r&&n){var o=[],s=r.length,l=0;this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.lineCount=[0,0,0];for(var u=0;u<3;++u){this.lineOffset[u]=l;t:for(var c=0;c0){var g=f.slice();g[u]+=d[1][u],o.push(f[0],f[1],f[2],p[0],p[1],p[2],p[3],0,0,0,g[0],g[1],g[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,g),l+=2+a(o,g,p,u)}}}this.lineCount[u]=l-this.lineOffset[u]}this.buffer.update(o)}},f.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":99,"gl-buffer":95,"gl-vao":149}],99:[function(t,e,r){"use strict";var n=t("gl-shader"),i="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}",a="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 n(t,i,a,null,[{name:"position",type:"vec3"},{name:"offset",type:"vec3"},{name:"color",type:"vec4"}])}},{"gl-shader":134}],100:[function(t,e,r){"use strict";function n(t){var e=t.getParameter(t.FRAMEBUFFER_BINDING),r=t.getParameter(t.RENDERBUFFER_BINDING),n=t.getParameter(t.TEXTURE_BINDING_2D);return[e,r,n]}function i(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function a(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);y=new Array(r+1);for(var n=0;n<=r;++n){for(var i=new Array(r),a=0;a1&&h.drawBuffersWEBGL(y[f]);var m=r.getExtension("WEBGL_depth_texture");m?d?t.depth=s(r,u,c,m.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=s(r,u,c,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=l(r,u,c,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=l(r,u,c,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=l(r,u,c,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var v=0;vs||r<0||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(a),u=0;uo||r<0||r>o)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),s<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var f=!0;"depth"in n&&(f=!!n.depth);var h=!1;return"stencil"in n&&(h=!!n.stencil),new c(t,e,r,l,s,f,h,i)}var d=t("gl-texture2d");e.exports=h;var p,g,v,m,y=null,b=c.prototype;Object.defineProperties(b,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return f(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t=0|t,f(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t=0|t,f(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e=1},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||m,view:t.view||m,projection:t.projection||m,clipBounds:i(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||m,view:t.view||m,projection:t.projection||m,pickId:this.pickId,clipBounds:i(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.update=function(t){var e,r;this.dirty=!0;var i=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var a=t.position||t.positions;if(a){var o=t.color||t.colors||[0,0,0,1],s=t.lineWidth||1,l=[],u=[],c=[],f=0,p=0,g=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],v=!1;t:for(e=1;e0){for(var b=0;b<24;++b)l.push(l[l.length-12]);p+=2,v=!0}continue t}g[0][r]=Math.min(g[0][r],m[r],y[r]),g[1][r]=Math.max(g[1][r],m[r],y[r])}var x,_;Array.isArray(o[0])?(x=o[e-1],_=o[e]):x=_=o,3===x.length&&(x=[x[0],x[1],x[2],1]),3===_.length&&(_=[_[0],_[1],_[2],1]);var w;w=Array.isArray(s)?s[e-1]:s;var A=f;if(f+=n(m,y),v){for(r=0;r<2;++r)l.push(m[0],m[1],m[2],y[0],y[1],y[2],A,w,x[0],x[1],x[2],x[3]);p+=2,v=!1}l.push(m[0],m[1],m[2],y[0],y[1],y[2],A,w,x[0],x[1],x[2],x[3],m[0],m[1],m[2],y[0],y[1],y[2],A,-w,x[0],x[1],x[2],x[3],y[0],y[1],y[2],m[0],m[1],m[2],f,-w,_[0],_[1],_[2],_[3],y[0],y[1],y[2],m[0],m[1],m[2],f,w,_[0],_[1],_[2],_[3]),p+=4}if(this.buffer.update(l),u.push(f),c.push(a[a.length-1].slice()),this.bounds=g,this.vertexCount=p,this.points=c,this.arcLength=u,"dashes"in t){var M=t.dashes,k=M.slice();for(k.unshift(0),e=1;e1.0001)return null;v+=g[c]}return Math.abs(v-1)>.001?null:[f,o(t,g),g]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:17,"polytope-closest-point/lib/closest_point_2d.js":205}],125:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}",i="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat cookTorranceSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution_2_0(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\n\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n \n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular_1_1(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}",a="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}",o="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",u="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}",c="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}",f="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}",h="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="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n";r.meshShader={vertex:n,fragment:i,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:a,fragment:o,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:s,fragment:l,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:f,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:h,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{}],126:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w,A,M,k,T){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=a,this.pointPickShader=o,this.contourShader=s,this.trianglePositions=l,this.triangleColors=c,this.triangleNormals=h,this.triangleUVs=f,this.triangleIds=u,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=v,this.edgeUVs=m,this.edgeIds=g,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=b,this.pointColors=_,this.pointUVs=w,this.pointSizes=A,this.pointIds=x,this.pointVAO=M,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=k,this.contourVAO=T,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=I,this._view=I,this._projection=I,this._resolution=[1,1]}function i(t){for(var e=M({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return A(r,[256,256,4],[4,0,1])}function a(t,e,r){for(var n=new Array(e),i=0;i=1},z.isTransparent=function(){return this.opacity<1},z.pickSlots=1,z.setPickBase=function(t){this.pickId=t},z.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=k(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=T.mallocFloat32(6*a),s=0,l=0;l0){var h=this.triShader;h.bind(),h.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var h=this.lineShader;h.bind(),h.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){var h=this.pointShader;h.bind(),h.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 h=this.contourShader;h.bind(),h.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind()}},z.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||I,n=t.view||I,i=t.projection||I,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={model:r,view:n,projection:i,clipBounds:a,pickId:this.pickId/255},l=this.pickShader;if(l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0){var l=this.pointPickShader;l.bind(),l.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}},z.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;a0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function o(t){return"boolean"!=typeof t||t}function s(t){function e(){if(!_&&q.autoResize){var t=w.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*q.pixelRatio),i=0|Math.ceil(r*q.pixelRatio);if(n!==w.width||i!==w.height){w.width=n,w.height=i;var a=w.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",D=!0}}}function r(){for(var t=N.length,e=j.length,r=0;r0&&0===z[e-1];)z.pop(),j.pop().dispose()}function s(){return!!q.contextLost||void(M.isContextLost()&&(q.contextLost=!0,q.mouseListener.enabled=!1,q.selection.object=null,q.oncontextloss&&q.oncontextloss()))}function y(){if(!s()){M.colorMask(!0,!0,!0,!0),M.depthMask(!0),M.disable(M.BLEND),M.enable(M.DEPTH_TEST);for(var t=N.length,e=j.length,r=0;rT.distance)continue;for(var u=0;u1e-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),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*f+l*g,t[3]=s*h+l*v,t}e.exports=n},{}],130:[function(t,e,r){"use strict";function n(t,e){var r=a[e];if(r||(r=a[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-(1/0),-(1/0)]],l=0;lMath.abs(z[1])){var j=I;I=z,z=j,j=O,O=N,N=j;var D=R;R=P,P=D}I[0]<0&&(O[R]=-1),z[1]>0&&(N[P]=-1);for(var F=0,B=0,C=0;C<4;++C)F+=Math.pow(p[4*R+C],2),B+=Math.pow(p[4*P+C],2);O[R]/=Math.sqrt(F),N[P]/=Math.sqrt(B),d.axes[0]=O,d.axes[1]=N,d.fragClipBounds[0]=u(L,b[0],_,-1e8),d.fragClipBounds[1]=u(L,b[1],_,1e8),e.vao.draw(h.TRIANGLES,e.vertexCount),e.lineWidth>0&&(h.lineWidth(e.lineWidth),e.vao.draw(h.LINES,e.lineVertexCount,e.vertexCount))}}function h(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||x,s.view=n.view||x,s.projection=n.projection||x,w[0]=2/o.drawingBufferWidth,w[1]=2/o.drawingBufferHeight,s.screenSize=w,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=P,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(o.TRIANGLES,r.vertexCount),r.lineWidth>0&&(o.lineWidth(r.lineWidth),r.vao.draw(o.LINES,r.lineVertexCount,r.vertexCount))}f(e,r,n,i,a),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),a=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=p(e),c=p(e),f=p(e),h=p(e),d=g(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:f,size:2,type:e.FLOAT},{buffer:h,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),v=new o(e,r,n,i,u,c,f,h,d,a,s,l);return v.update(t),v}var p=t("gl-buffer"),g=t("gl-vao"),v=t("typedarray-pool"),m=t("gl-mat4/multiply"),y=t("./lib/shaders"),b=t("./lib/glyphs"),x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=d;var _=o.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],A=[0,0,0],M=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=x.slice(),L=[0,0,0],S=[[0,0,0],[0,0,0]],C=[-1e8,-1e8,-1e8],R=[1e8,1e8,1e8],P=[C,R];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;h(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;h(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;h(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||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},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",a=t.alignment||[0,0],o=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,f=t.angle,h=t.lineColor,d=0,p=0,g=0,m=n.length;t:for(var y=0;y0&&(R[0]=-a[0]*(1+k[0][0]));for(var H=A.cells,q=A.positions,_=0;_this.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;i=0){for(var M=0|A.type.charAt(A.type.length-1),k=new Array(M),T=0;T=0;)E+=1;_[w]=E}var L=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=a},{"./lib/GLError":135,"./lib/create-attributes":136,"./lib/create-uniforms":137,"./lib/reflect":138,"./lib/runtime-reflect":139,"./lib/shader-cache":140}],135:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="GLError",n.prototype.constructor=n,e.exports=n},{}],136:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}function i(t,e,r,i,a,o,s){for(var l=["gl","v"],u=[],c=0;c=0){var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);i(t,e,d[0],n,p,o,f)}else{if(!(h.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+f+": "+h);var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);a(t,e,d,n,p,o,f)}}}return o}e.exports=o;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,a=i._gl,o=i._locations[i._index];a.vertexAttribPointer(o,i._dimension,t||a.FLOAT,!!e,r||0,n||0),a.enableVertexAttribArray(o)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":135}],137:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;n4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(i<2||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],a=t;a+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function f(e){for(var n=["return function updateProperty(obj){"],i=c("",e),o=0;o4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var o=p(i);Object.defineProperty(t,e,{get:n(o),set:f(i),enumerable:!0,configurable:!1})}else a[i]?Object.defineProperty(t,e,{get:l(i),set:f(i),enumerable:!0,configurable:!1}):t[e]=h(r[i].type)}function p(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 u=1;u1)for(var l=0;l0)][r],A(l,t.model,l);var u=F.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return F.showSurface=o,F.showContour=s,F}function s(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=B;n.model=t.model||O,n.view=t.view||O,n.projection=t.projection||O,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=M(n.inverseModel,n.model);for(var i=0;i<2;++i)for(var a=n.clipBounds[i],s=0;s<3;++s)a[s]=Math.min(Math.max(this.clipBounds[i][s],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=V,n.vertexColor=this.vertexColor;var l=U;for(A(l,n.view,n.model),A(l,n.projection,l),M(l,l),i=0;i<3;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;i<3;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;i<3;++i){var c=l[12+i];for(s=0;s<3;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var f=o(n,this);if(f.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=f.projections[i],this._shader.uniforms.clipBounds=f.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(f.showContour&&!e){var h=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,h.bind(),h.uniforms=n;var d=this._contourVAO;for(d.bind(),i=0;i<3;++i)for(h.uniforms.permutation=I[i],r.lineWidth(this.contourWidth[i]),s=0;s=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},j.pickSlots=1,j.setPickBase=function(t){this.pickId=t};var D=[0,0,0],F={showSurface:!1,showContour:!1,projections:[O.slice(),O.slice(),O.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:O,view:O,projection:O,inverseModel:O.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},U=O.slice(),V=[1,0,0,0,1,0,0,0,1];j.draw=function(t){return s.call(this,t,!1)},j.drawTransparent=function(t){return s.call(this,t,!0)};var H={model:O,view:O,projection:O,inverseModel:O,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};j.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=H;r.model=t.model||O,r.view=t.view||O,r.projection=t.projection||O,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.permutation=V;for(var n=0;n<2;++n)for(var i=r.clipBounds[n],a=0;a<3;++a)i[a]=Math.min(Math.max(this.clipBounds[n][a],-1e8),1e8);var s=o(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;n<3;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var u=this._contourVAO;for(u.bind(),a=0;a<3;++a)for(e.lineWidth(this.contourWidth[a]),l.uniforms.permutation=I[a],n=0;n>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 u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;c<2;++c)for(var f=c?a:1-a,h=0;h<2;++h)for(var d=h?l:1-l,p=i+c,g=s+h,v=f*d,m=0;m<3;++m)u[m]+=this._field[m].get(p,g)*v;for(var y=this._pickResult.level,b=0;b<3;++b)if(y[b]=k.le(this.contourLevels[b],u[b]),y[b]<0)this.contourLevels[b].length>0&&(y[b]=0);else if(y[b]Math.abs(_-u[b])&&(y[b]+=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],m=0;m<3;++m)r.dataCoordinate[m]=this._field[m].get(r.index[0],r.index[1]);return r},j.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=u(t.contourWidth,Number)),"showContour"in t&&(this.showContour=u(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=u(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=f(t.contourColor)),"contourProject"in t&&(this.contourProject=u(t.contourProject,function(t){return u(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=f(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=u(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=u(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"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 n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(m.freeFloat(this._field[2].data),this._field[2].data=m.mallocFloat(d.nextPow2(n))),this._field[2]=_(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),l(this._field[2],e),this.shape=e.shape.slice();for(var a=this.shape,o=0;o<2;++o)this._field[2].size>this._field[o].data.length&&(m.freeFloat(this._field[o].data),this._field[o].data=m.mallocFloat(this._field[2].size)),this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2]);if(t.coords){var s=t.coords;if(!Array.isArray(s)||3!==s.length)throw new Error("gl-surface: invalid coordinates for x/y");for(o=0;o<2;++o){var c=s[o];for(y=0;y<2;++y)if(c.shape[y]!==a[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[o],c)}}else if(t.ticks){var h=t.ticks;if(!Array.isArray(h)||2!==h.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var p=h[o];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var g=_(p.data,a);g.stride[o]=p.stride[0],g.stride[1^o]=0,l(this._field[o],g)}}else{for(o=0;o<2;++o){var v=[0,0];v[o]=1,this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2],v,0)}this._field[0].set(0,0,0);for(var y=0;y0){for(var xt=0;xt<5;++xt)tt.pop();H-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),H+=1}}nt.push(H)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=m.mallocFloat(tt.length);for(o=0;oi||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 a(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}function o(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,a,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var f=0,h=0,v=o(c,l.stride.slice());"float32"===u?f=t.FLOAT:"float64"===u?(f=t.FLOAT,v=!1,u="float32"):"uint8"===u?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,v=!1,u="uint8");var m=1;if(2===c.length)h=t.LUMINANCE,c=[c[0],c[1],1],l=d(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])h=t.ALPHA;else if(2===c[2])h=t.LUMINANCE_ALPHA;else if(3===c[2])h=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");h=t.RGBA}m=c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(h=i),h!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,x=s.indexOf(n)<0;if(x&&s.push(n),f===a&&v)0===l.offset&&l.data.length===y?x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data):x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var _;_=a===t.FLOAT?g.mallocFloat32(y):g.mallocUint8(y);var w=d(_,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&a===t.UNSIGNED_BYTE?b(w,l):p.assign(w,l),x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,_.subarray(0,y)),a===t.FLOAT?g.freeFloat32(_):g.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var o=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>o||r<0||r>o)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new a(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new a(t,i,0|e.width,0|e.height,r,n)}function f(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=o(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=d(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var f,h,v=e.size;if(s)f=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var m=[n[2],n[2]*n[0],1];h=g.malloc(v,r);var y=d(h,n,m,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?p.assign(y,e):b(y,e),f=h.subarray(0,v)}var x=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,f),s||g.free(h),new a(t,x,n[0],n[1],c,u)}function h(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(v||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return f(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var d=t("ndarray"),p=t("ndarray-ops"),g=t("typedarray-pool");e.exports=h;var v=null,m=null,y=null,b=function(t,e){p.muls(t,e,255)},x=a.prototype;Object.defineProperties(x,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=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(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t=0|t,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t=0|t,i(this,this._shape[0],t),t}}}),x.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},x.dispose=function(){this.gl.deleteTexture(this.handle)},x.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},x.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var a=this._mipLevels.indexOf(n)<0;a?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:192,"ndarray-ops":186,"typedarray-pool":247}],146:[function(t,e,r){"use strict";function n(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;i0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}e.exports=n},{}],155:[function(t,e,r){function n(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}e.exports=n},{}],156:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,a[0]}e.exports=n;var i=new Uint8Array(4),a=new Float32Array(i.buffer)},{}],157:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function R(){return/[^a-fA-F0-9]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),z=I,D+1)}function P(){return"."===I?(U.push(I),B=v,z=I,D+1):/[eE]/.test(I)?(U.push(I),B=v,z=I,D+1):"x"===I&&1===U.length&&"0"===U[0]?(B=w,U.push(I),z=I,D+1):/[^\d]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),z=I,D+1)}function O(){return"f"===I&&(U.push(I),z=I,D+=1),/[eE]/.test(I)?(U.push(I),z=I,D+1):"-"===I&&/[eE]/.test(z)?(U.push(I),z=I,D+1):/[^\d]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),z=I,D+1)}function N(){if(/[^\d\w_]/.test(I)){var t=U.join("");return B=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:m,e(U.join("")),B=u,D}return U.push(I),z=I,D+1}var I,z,j,D=0,F=0,B=u,U=[],V=[],H=1,q=0,G=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return V=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var i=t("./lib/literals"),a=t("./lib/operators"),o=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,f=0,h=1,d=2,p=3,g=4,v=5,m=6,y=7,b=8,x=9,_=10,w=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":160,"./lib/builtins-300es":159,"./lib/literals":162,"./lib/literals-300es":161,"./lib/operators":163}],159:[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":160}],160:[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"]},{}],161:[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":162}],162:[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"]},{}],163:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],164:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":158}],165:[function(t,e,r){r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=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=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),e*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):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+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],166:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function a(t,e){return c(t.vertices,e.vertices)}function o(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;r<=t;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=u[t+1];return i||(i=u),n(i)}function s(t,e,r){this.dimension=t,this.vertices=e,this.simplices=r,this.interior=r.filter(function(t){return!t.boundary}),this.tuple=new Array(t+1);for(var n=0;n<=t;++n)this.tuple[n]=this.vertices[n];var i=f[t];i||(i=f[t]=o(t)),this.orient=i}function l(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var i=t[0].length;if(r<=i)throw new Error("Must input at least d+1 points");var a=t.slice(0,i+1),o=u.apply(void 0,a);if(0===o)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;c<=i;++c)l[c]=c;o<0&&(l[0]=1,l[1]=0);for(var f=new n(l,new Array(i+1),!1),h=f.adjacent,d=new Array(i+2),c=0;c<=i;++c){for(var p=l.slice(),g=0;g<=i;++g)g===c&&(p[g]=-1);var v=p[0];p[0]=p[1],p[1]=v;var m=new n(p,new Array(i+1),!0);h[c]=m,d[c]=m}d[i+1]=f;for(var c=0;c<=i;++c)for(var p=h[c].vertices,y=h[c].adjacent,g=0;g<=i;++g){var b=p[g];if(b<0)y[g]=f;else for(var x=0;x<=i;++x)h[x].vertices.indexOf(b)<0&&(y[g]=h[x])}for(var _=new s(i,a,d),w=!!e,c=i+1;c0;){t=o.pop();for(var s=(t.vertices,t.adjacent),l=0;l<=r;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,f=0;f<=r;++f){var h=c[f];h<0?i[f]=e:i[f]=a[h]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&o.push(u)}}}return null},h.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,u=s.adjacent,c=0;c<=n;++c)a[c]=i[l[c]];s.lastVisited=r;for(var c=0;c<=n;++c){var f=u[c];if(!(f.lastVisited>=r)){var h=a[c];a[c]=t;var d=this.orient();if(a[c]=h,d<0){s=f;continue t}f.boundary?f.lastVisited=-r:f.lastVisited=r}}return}return s},h.addPeaks=function(t,e){var r=this.vertices.length-1,o=this.dimension,s=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,f=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var h=[];f.length>0;){var e=f.pop(),d=e.vertices,p=e.adjacent,g=d.indexOf(r);if(!(g<0))for(var v=0;v<=o;++v)if(v!==g){var m=p[v];if(m.boundary&&!(m.lastVisited>=r)){var y=m.vertices;if(m.lastVisited!==-r){for(var b=0,x=0;x<=o;++x)y[x]<0?(b=x,l[x]=t):l[x]=s[y[x]];var _=this.orient();if(_>0){y[b]=r,m.boundary=!1,u.push(m),f.push(m),m.lastVisited=r;continue}m.lastVisited=-r}var w=m.adjacent,A=d.slice(),M=p.slice(),k=new n(A,M,!0);c.push(k);var T=w.indexOf(e);if(!(T<0)){w[T]=k,M[g]=m,A[v]=-1,M[v]=e,p[v]=k,k.flip();for(var x=0;x<=o;++x){var E=A[x];if(!(E<0||E===r)){for(var L=new Array(o-1),S=0,C=0;C<=o;++C){var R=A[C];R<0||C===x||(L[S++]=R)}h.push(new i(L,k,x))}}}}}}h.sort(a);for(var v=0;v+1=0?o[l++]=s[c]:u=1&c;if(u===(1&t)){var f=o[0];o[0]=o[1],o[1]=f}e.push(o)}}return e}},{"robust-orientation":220,"simplicial-complex":230}],167:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function a(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),a(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],a=[],o=[],s=[],r=0;r3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=m.ge(this.leftPoints,t,h),n=m.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var a=this.left?this.left.count:0;if(4*a>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var o=this,l=this.left;l.right;)o=l,l=l.right;if(o===this)l.right=this.right;else{var u=this.left,n=this.right;o.count-=l.count,o.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var u=m.ge(this.leftPoints,t,h);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===x&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},w.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":34}],168:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;rv[1][2]&&(b[0]=-b[0]),v[0][2]>v[2][0]&&(b[1]=-b[1]),v[1][0]>v[0][1]&&(b[2]=-b[2]),!0}},{"./normalize":173,"gl-mat4/clone":106,"gl-mat4/create":107,"gl-mat4/determinant":108,"gl-mat4/invert":112,"gl-mat4/transpose":122,"gl-vec3/cross":150,"gl-vec3/dot":151,"gl-vec3/length":152,"gl-vec3/normalize":154}],173:[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}},{}],174:[function(t,e,r){function n(t,e,r,n){if(0===c(e)||0===c(r))return!1;var i=u(e,h.translate,h.scale,h.skew,h.perspective,h.quaternion),a=u(r,d.translate,d.scale,d.skew,d.perspective,d.quaternion);return!(!i||!a)&&(s(p.translate,h.translate,d.translate,n),s(p.skew,h.skew,d.skew,n),s(p.scale,h.scale,d.scale,n),s(p.perspective,h.perspective,d.perspective,n),f(p.quaternion,h.quaternion,d.quaternion,n),l(t,p.translate,p.scale,p.skew,p.perspective,p.quaternion),!0)}function i(){return{translate:a(),scale:a(1),skew:a(),perspective:o(),quaternion:o()}}function a(t){return[t||0,t||0,t||0]}function o(){return[0,0,0,1]}var s=t("gl-vec3/lerp"),l=t("mat4-recompose"),u=t("mat4-decompose"),c=t("gl-mat4/determinant"),f=t("quat-slerp"),h=i(),d=i(),p=i();e.exports=n},{"gl-mat4/determinant":108,"gl-vec3/lerp":153,"mat4-decompose":172,"mat4-recompose":175,"quat-slerp":207}],175:[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":107,"gl-mat4/fromRotationTranslation":110,"gl-mat4/identity":111,"gl-mat4/multiply":114,"gl-mat4/scale":120,"gl-mat4/translate":121}],176:[function(t,e,r){"use strict";function n(t){this._components=t.slice(),this._time=[0],this.prevMatrix=t.slice(),this.nextMatrix=t.slice(),this.computedMatrix=t.slice(),this.computedInverse=t.slice(),this.computedEye=[0,0,0],this.computedUp=[0,0,0],this.computedCenter=[0,0,0],this.computedRadius=[0],this._limits=[-(1/0),1/0]}function i(t){t=t||{};var e=t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return new n(e)}var a=t("binary-search-bounds"),o=t("mat4-interpolate"),s=t("gl-mat4/invert"),l=t("gl-mat4/rotateX"),u=t("gl-mat4/rotateY"),c=t("gl-mat4/rotateZ"),f=t("gl-mat4/lookAt"),h=t("gl-mat4/translate"),d=(t("gl-mat4/scale"),t("gl-vec3/normalize")),p=[0,0,0];e.exports=i;var g=n.prototype;g.recalcMatrix=function(t){var e=this._time,r=a.le(e,t),n=this.computedMatrix;if(!(r<0)){var i=this._components;if(r===e.length-1)for(var l=16*r,u=0;u<16;++u)n[u]=i[l++];else{for(var c=e[r+1]-e[r],l=16*r,f=this.prevMatrix,h=!0,u=0;u<16;++u)f[u]=i[l++];for(var p=this.nextMatrix,u=0;u<16;++u)p[u]=i[l++],h=h&&f[u]===p[u];if(c<1e-6||h)for(var u=0;u<16;++u)n[u]=f[u];else o(n,f,p,(t-e[r])/c)}var g=this.computedUp;g[0]=n[1],g[1]=n[5],g[2]=n[6],d(g,g);var v=this.computedInverse;s(v,n);var m=this.computedEye,y=v[15];m[0]=v[12]/y,m[1]=v[13]/y,m[2]=v[14]/y;for(var b=this.computedCenter,x=Math.exp(this.computedRadius[0]),u=0;u<3;++u)b[u]=m[u]-n[2+4*u]*x}},g.idle=function(t){if(!(t1&&i(t[o[c-2]],t[o[c-1]],u)<=0;)c-=1,o.pop();for(o.push(l),c=s.length;c>1&&i(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(l)}for(var r=new Array(s.length+o.length-2),f=0,n=0,h=o.length;n0;--d)r[f++]=s[d];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":220}],178:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==g.alt,g.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==g.shift,g.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==g.control,g.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==g.meta,g.meta=!!t.metaKey),e}function n(t,n){var a=i.x(n),o=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==h||a!==d||o!==p||r(n))&&(h=0|t,d=a||0,p=o||0,e&&e(h,d,p,g))}function a(t){n(0,t)}function o(){(h||d||p||g.shift||g.alt||g.meta||g.control)&&(d=p=0,h=0,g.shift=g.alt=g.control=g.meta=!1,e&&e(0,0,0,g))}function s(t){r(t)&&e&&e(h,d,p,g)}function l(t){0===i.buttons(t)?n(0,t):n(h,t)}function u(t){n(h|i.buttons(t),t)}function c(t){n(h&~i.buttons(t),t)}function f(){v||(v=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",a),t.addEventListener("mouseenter",a),t.addEventListener("mouseout",a),t.addEventListener("mouseover",a),t.addEventListener("blur",o),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",o),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var h=0,d=0,p=0,g={shift:!1,alt:!1,control:!1,meta:!1},v=!1;f();var m={element:t};return Object.defineProperties(m,{enabled:{get:function(){return v},set:function(t){t&&f()},enumerable:!0},buttons:{get:function(){return h},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return g},enumerable:!0}}),m}e.exports=n;var i=t("mouse-event")},{"mouse-event":179}],179:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<=0;--e)S(e,0);for(var r=[],e=0;e0;_=_-1&g)x.push(w+"["+T+"+"+v(_)+"]");x.push(m(0));for(var _=0;_0){",h(x[t]),"=1;"),N(t-1,e|1<0&&G.push(s(U,x[V-1])+"*"+o(x[V-1])),F.push(d(U,x[V])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)X.push(o(x[U]));F.push(k+"=("+X.join("*")+")|0",A+"=mallocUint32("+k+")",w+"=mallocUint32("+k+")",T+"=0"),F.push(p(0)+"=0");for(var V=1;V<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 a=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return b(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",A="P",M="N",k="Q",T="X",E="T"},{"typedarray-pool":247}],182:[function(t,e,r){"use strict";var n=t("cwise/lib/wrapper")({args:["index","array","scalar"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{_inline_7_arg1_=_inline_7_arg2_.apply(void 0,_inline_7_arg0_)}",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}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":73}],183:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;r=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){o.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push("&&s[",l,"]>2");o.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push(",dst.pick(",s.join(),",",l,")",u);o.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",h.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>1){diff(",f,",src.pick(",h.join(),")",u,",src.pick(",d.join(),")",u,");}else{zero(",f,");};");break;case"mirror":0===r?o.push("dst.set(",s.join(),",",c,",0);"):o.push("zero(",f,");");break;case"wrap":var p=s.slice(),g=s.slice();e[l]<0?(p[c]="s["+c+"]-2",g[c]="0"):(p[c]="s["+c+"]-1",g[c]="1"),0===r?o.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>2){diff(",f,",src.pick(",p.join(),")",u,",src.pick(",g.join(),")",u,");}else{zero(",f,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&o.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var a=t.length,o=["function gradient(dst,src){var s=src.shape.slice();"],s=0;s<1<>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=a({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]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,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=o({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=o({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=o({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=a({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=a({args:["array","array"],body:{ -args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=o({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":70}],187:[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":188,ndarray:192}],188:[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":70}],189:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;r1){for(var f=[],h=1;h1){o.push("dptr=0;sptr=ptr");for(var h=t.length-1;h>=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"left){","dptr=0","sptr=cptr-s0");for(var h=1;hb){break __l}"].join(""));for(var h=t.length-1;h>=1;--h)o.push("sptr+=e"+h,"dptr+=f"+h,"}");o.push("dptr=cptr;sptr=cptr-s0");for(var h=t.length-1;h>=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"left)&&("+r("cptr-s0")+">scratch)){",a("cptr",r("cptr-s0")),"cptr-=s0","}",a("cptr","scratch"));if(o.push("}"),t.length>1&&u&&o.push("free(scratch)"),o.push("} return "+s),u){var p=new Function("malloc","free",o.join("\n"));return p(u[0],u[1])}var p=new Function(o.join("\n"));return p()}function o(t,e,r){function a(t){return["(offset+",t,"*s0)"].join("")}function o(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+a(e[0]));else for(var i=0;i=0;--i){var o=t[i];0!==o&&_.push(["for(i",o,"=0;i",o,"1)for(var i=0;i1?_.push("ptr_shift+=d"+o):_.push("ptr0+=d"+o),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+a(r[0]));else{for(var o=0;o1)for(var o=0;o=1;--o)n&&_.push("pivot_ptr+=f"+o),r.length>1?_.push("ptr_shift+=e"+o):_.push("ptr0+=e"+o),_.push("}")}function f(){t.length>1&&M&&_.push("free(pivot1)","free(pivot2)")}function h(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++k;c(s,[n,i],!1,["comp=",o("ptr0"),"-",o("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",o(a(n)),">",o(a(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?l([e,r],!1,s("ptr0",o("ptr1"))):_.push(s(a(e),o(a(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++k;c(i,[r],!0,[e,"=",o("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",o(a(r)),"-pivot",n].join(""))}function g(e,r){t.length>1?l([e,r],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join(""))}function v(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","ptr2=",a(n),"\n","++",r,"\n","--",n,"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join(""))}function m(t,e){g(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",o("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(a(e),o(a(r))),s(a(r),"pivot"+n))}function b(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function x(e,r,n){t.length>1?(_.push(["__l",++k,":while(true){"].join("")),l([e],!0,["if(",o("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",k,"}"].join("")),_.push(n,"}")):_.push(["while(",o(a(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),A=["left","right","data","offset"].concat(i(t.length)),M=n(e),k=0;_.push(["function ",w,"(",A.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],L=1;L1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",o("ptr1"),"\n","pivot2[pivot_ptr]=",o("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",o("ptr0"),"\n","y=",o("ptr2"),"\n","z=",o("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",o(a("el2")),"\n","pivot2=",o(a("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",o(a("el1")),"\n","y=",o(a("el3")),"\n","z=",o(a("el5")),"\n",s(a("index1"),"x"),"\n",s(a("index3"),"y"),"\n",s(a("index5"),"z")].join("")),d("index2","left"),d("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),p("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),p("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),v("k","less","great"),_.push("break"),_.push("}else{"),m("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp>0){"),_.push("if(--greatindex5){"),x("less",1,"++less"),x("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp===0){"),_.push("if(--great1&&M){var S=new Function("insertionSort","malloc","free",_.join("\n"));return S(r,M[0],M[1])}var S=new Function("insertionSort",_.join("\n"));return S(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c0?l.push(["d",v,"=s",v,"-d",p,"*n",p].join("")):l.push(["d",v,"=s",v].join("")),p=v);var d=t.length-1-c;0!==d&&(g>0?l.push(["e",d,"=s",d,"-e",g,"*n",g,",f",d,"=",f[d],"-f",g,"*n",g].join("")):l.push(["e",d,"=s",d,",f",d,"=",f[d]].join("")),g=d)}r.push("var "+l.join(","));var m=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",m.join(","),")}else{","quickSort(",m.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),b=a(t,e),x=o(t,e,b);return y(b,x)}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":247}],190:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],o=n.join(":"),s=a[o];return s||(a[o]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),a={};e.exports=n},{"./lib/compile_sort.js":189}],191:[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_33_arg4_)}",args:[{name:"_inline_33_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_34_arg2_(this_warped,_inline_34_arg0_),_inline_34_arg1_=_inline_34_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_34_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_34_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_34_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_34_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_34_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_37_arg2_(this_warped,_inline_37_arg0_),_inline_37_arg1_=_inline_37_arg3_(_inline_37_arg4_,this_warped[0])}",args:[{name:"_inline_37_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_37_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_37_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_37_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_37_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_40_arg2_(this_warped,_inline_40_arg0_),_inline_40_arg1_=_inline_40_arg3_(_inline_40_arg4_,this_warped[0],this_warped[1])}",args:[{name:"_inline_40_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_40_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_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_43_arg2_(this_warped,_inline_43_arg0_),_inline_43_arg1_=_inline_43_arg3_(_inline_43_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_43_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_43_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_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":73,"ndarray-linear-interpolate":185}],192:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;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("+u.join(",")+",v){"),n?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var v=0;v=0){d=i"+v+"|0;b+=c"+v+"*d;a"+v+"-=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var v=0;v=0){c=(c+this.stride["+v+"]*i"+v+")|0}else{a.push(this.shape["+v+"]);b.push(this.stride["+v+"])}");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,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",a.join("\n"));return o(f[t],i)}function o(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=f.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),a=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":76}],194:[function(t,e,r){var n=1e-6,i=1e-6;r.vertexNormals=function(t,e,r){for(var i=e.length,a=new Array(i),o=void 0===r?n:r,s=0;so)for(var _=a[c],w=1/Math.sqrt(m*b),x=0;x<3;++x){var A=(x+1)%3,M=(x+2)%3;_[x]+=w*(y[A]*v[M]-y[M]*v[A])}}for(var s=0;so)for(var w=1/Math.sqrt(k),x=0;x<3;++x)_[x]*=w;else for(var x=0;x<3;++x)_[x]=0}return a},r.faceNormals=function(t,e,r){for(var n=t.length,a=new Array(n),o=void 0===r?i:r,s=0;so?1/Math.sqrt(p):0;for(var c=0;c<3;++c)d[c]*=p;a[s]=d}return a}},{}],195:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u){var c=e+a+u;if(f>0){var f=Math.sqrt(c+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,u),f=Math.sqrt(2*h-c+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}e.exports=n},{}],196:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function a(t,e){var r=e[0],n=e[1],a=e[2],o=e[3],s=i(r,n,a,o);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=a/s,t[3]=o/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function o(t,e,r){this.radius=l([r]),this.center=l(e),this.rotation=l(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),r=[].slice.call(r,0,4),a(r,r);var i=new o(r,e,Math.log(n));return i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up),i}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/lookAt"),c=t("gl-mat4/fromQuat"),f=t("gl-mat4/invert"),h=t("./lib/quatFromFrame"),d=o.prototype;d.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},d.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;a(e,e);var r=this.computedMatrix;c(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 u=0,f=0;f<3;++f)u+=r[l+4*f]*i[f];r[12+l]=-u}},d.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},d.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},d.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},d.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=a[1],s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],f=a[4],h=a[8],d=c*o+f*s+h*l;c-=o*d,f-=s*d,h-=l*d;var p=n(c,f,h);c/=p,f/=p,h/=p;var g=a[2],v=a[6],m=a[10],y=g*o+v*s+m*l,b=g*c+v*f+m*h;g-=y*o+b*c,v-=y*s+b*f,m-=y*l+b*h;var x=n(g,v,m);g/=x,v/=x,m/=x;var _=c*e+o*r,w=f*e+s*r,A=h*e+l*r;this.center.move(t,_,w,A);var M=Math.exp(this.computedRadius[0]);M=Math.max(1e-4,M+i),this.radius.set(t,Math.log(M))},d.rotate=function(t,e,r,a){this.recalcMatrix(t),e=e||0,r=r||0;var o=this.computedMatrix,s=o[0],l=o[4],u=o[8],c=o[1],f=o[5],h=o[9],d=o[2],p=o[6],g=o[10],v=e*s+r*c,m=e*l+r*f,y=e*u+r*h,b=-(p*y-g*m),x=-(g*v-d*y),_=-(d*m-p*v),w=Math.sqrt(Math.max(0,1-Math.pow(b,2)-Math.pow(x,2)-Math.pow(_,2))),A=i(b,x,_,w);A>1e-6?(b/=A,x/=A,_/=A,w/=A):(b=x=_=0,w=1);var M=this.computedRotation,k=M[0],T=M[1],E=M[2],L=M[3],S=k*w+L*b+T*_-E*x,C=T*w+L*x+E*b-k*_,R=E*w+L*_+k*x-T*b,P=L*w-k*b-T*x-E*_;if(a){b=d,x=p,_=g;var O=Math.sin(a)/n(b,x,_);b*=O,x*=O,_*=O,w=Math.cos(e),S=S*w+P*b+C*_-R*x,C=C*w+P*x+R*b-S*_,R=R*w+P*_+S*x-C*b,P=P*w-S*b-C*x-R*_}var N=i(S,C,R,P);N>1e-6?(S/=N,C/=N,R/=N,P/=N):(S=C=R=0,P=1),this.rotation.set(t,S,C,R,P)},d.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var i=this.computedMatrix;u(i,e,r,n);var o=this.computedRotation;h(o,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),a(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var s=0,l=0;l<3;++l)s+=Math.pow(r[l]-e[l],2);this.radius.set(t,.5*Math.log(Math.max(s,1e-6))),this.center.set(t,r[0],r[1],r[2])},d.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},d.setMatrix=function(t,e){var r=this.computedRotation;h(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),a(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;f(n,e);var i=n[15];if(Math.abs(i)>1e-6){var o=n[12]/i,s=n[13]/i,l=n[14]/i;this.recalcMatrix(t);var u=Math.exp(this.computedRadius[0]);this.center.set(t,o-n[2]*u,s-n[6]*u,l-n[10]*u),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},d.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},d.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},d.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},d.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":195,"filtered-vector":83,"gl-mat4/fromQuat":109,"gl-mat4/invert":112,"gl-mat4/lookAt":113}],197:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r="undefined"!=typeof r?r+"":" ",n(r,e)+t}},{"repeat-string":213}],198:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],199:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return a.freeUint32(l),a.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,a,o=1;for(r[0]=0,a=1;a0;--a)n=e/o|0,e=e-n*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}var a=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":168,"typedarray-pool":247}],201:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,s,l,c=0;c<2;++c)if(u[c][n].length>0){o=u[c][n][0],l=c;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=u[f][n],d=0;d0&&(o=p,s=g,l=f)}return a?s:(o&&r(o,l),s)}function a(t,a){var o=u[a][t][0],s=[t];r(o,a);for(var l=o[1^a];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],f=t,h=s[1],d=n(c,f,!0);if(i(e[c],e[f],e[h],e[d])<0)break;s.push(t),l=n(c,f)}return s}function o(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;c0;){var g=(u[0][c].length,a(c,d));o(p,g)?p.push.apply(p,g):(p.length>0&&h.push(p),p=g)}p.length>0&&h.push(p)}return h}e.exports=n;var i=t("compare-angle")},{"compare-angle":62}],202:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function a(t){for(var e=t.length,r=0;r0;){var U=F.pop(),V=P[U];f(V,function(t,e){return t-e});var H,q=V.length,G=B[U];if(0===G){var T=m[U];H=[T]}for(var v=0;v=0)&&(B[X]=1^G,F.push(X),0===G)){var T=m[X];a(T)||(T.reverse(),H.push(T))}}0===G&&d.push(H)}return d}e.exports=a;var o=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),f=t("uniq"),h=t("./lib/trim-leaves")},{"./lib/trim-leaves":202,"edges-to-adjacency-list":78,"planar-dual":201,"point-in-big-polygon":204,"robust-sum":225,"two-product":245,uniq:249}],204:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return!!i&&!!i.queryPoint(r,n)}}function a(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var o=i.key,s=f(r,o[0],o[1]);if(o[0][0]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))return 0;a=1,i=i.right}}return a}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;i=u?(x=1,y=u+2*h+p):(x=-h/u,y=h*x+p)):(x=0,d>=0?(_=0,y=p):-d>=f?(_=1,y=f+2*d+p):(_=-d/f,y=d*_+p));else if(_<0)_=0,h>=0?(x=0,y=p):-h>=u?(x=1,y=u+2*h+p):(x=-h/u,y=h*x+p);else{var w=1/b;x*=w,_*=w,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p}else{var A,M,k,T;x<0?(A=c+h,M=f+d,M>A?(k=M-A,T=u-2*c+f,k>=T?(x=1,_=0,y=u+2*h+p):(x=k/T,_=1-x,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)):(x=0,M<=0?(_=1,y=f+2*d+p):d>=0?(_=0,y=p):(_=-d/f,y=d*_+p))):_<0?(A=c+d,M=u+h,M>A?(k=M-A,T=u-2*c+f,k>=T?(_=1,x=0,y=f+2*d+p):(_=k/T,x=1-_,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)):(_=0,M<=0?(x=1,y=u+2*h+p):h>=0?(x=0,y=p):(x=-h/u,y=h*x+p))):(k=f+d-c-h,k<=0?(x=0,_=1,y=f+2*d+p):(T=u-2*c+f,k>=T?(x=1,_=0,y=u+2*h+p):(x=k/T,_=1-x,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)))}for(var E=1-x-_,l=0;l1)for(var r=1;r0){var u=t[r-1];if(0===i(s,u)&&o(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}var i=t("compare-cell"),a=t("compare-oriented-cell"),o=t("cell-orientation");e.exports=n},{"cell-orientation":54,"compare-cell":63,"compare-oriented-cell":64}],213:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("repeat-string expects a string.");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;for(i===t&&"undefined"!=typeof i||(i=t,a="");r>a.length&&e>0&&(1&e&&(a+=t),e>>=1);)t+=t;return a.substr(0,r)}var i,a="";e.exports=n},{}],214:[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:{})},{}],215:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var a=r,o=t[i];r=a+o;var s=r-a,l=o-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;i>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;r>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r0&&r.push(","),r.push("[");for(var a=0;a0&&r.push(","),a===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",a,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var o=new Function("det",r.join(""));return o(t<6?s[t]:s)}function i(){return[0]}function a(t,e){return[[e[0]],[t[0][0]]]}function o(){for(;u.length>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;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=m*n;return o>=s||o<=-s?o:b(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],u=r[1]-n[1],c=t[2]-n[2],f=e[2]-n[2],h=r[2]-n[2],d=a*u,p=o*l,g=o*s,v=i*u,m=i*l,b=a*s,_=c*(d-p)+f*(g-v)+h*(m-b),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(m)+Math.abs(b))*Math.abs(h),A=y*w;return _>A||-_>A?_:x(t,e,r,n)}];c()},{"robust-scale":222,"robust-subtract":224,"robust-sum":225,"two-product":245}],221:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return a(e,t[0]);if(1===e.length)return a(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.length0&&s>0||o<0&&s<0)return!1;var l=a(r,t,e),u=a(i,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,i))}e.exports=i;var a=t("robust-orientation")[3]},{"robust-orientation":220}],224:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],v=h(g);p=i?(a=d,c+=1,c=i?(a=d,c+=1,c0?1:0}},{}],227:[function(t,e,r){"use strict";function n(t){return a(i(t))}e.exports=n;var i=t("boundary-cells"),a=t("reduce-simplicial-complex")},{"boundary-cells":37,"reduce-simplicial-complex":212}],228:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;n0&&u.push(","),u.push("[");for(var n=0;n0&&u.push(","),u.push("B(C,E,c[",i[0],"],c[",i[1],"])")}u.push("]")}u.push(");")}}var r=0,n=new Array(t+1);n[0]=[[]];for(var i=1;i<=t;++i)for(var s=n[i]=o(i),l=0;l>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--i){i>1,s=o(t[a],e);s<=0?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function f(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[g],a))break}return r}function h(t,e){if(!e)return f(u(p(t,0)),t,0);for(var r=new Array(e),n=0;n>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){var n=s(r);if(e0){var t=k[0];return a(0,L-1),L-=1,u(0),t}return-1}function h(t,e){var r=k[t];return b[r]===e?t:(b[r]=-(1/0),c(t),f(),b[r]=e,L+=1,c(L-1))}function d(t){if(!x[t]){x[t]=!0;var e=m[t],r=y[t];m[r]>=0&&(m[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&h(T[e],i(e)),T[r]>=0&&h(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||i<0||i===n)break;if(n=i,i=t[n],!x[n]||i<0||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var g=e.length,v=t.length,m=new Array(g),y=new Array(g),b=new Array(g),x=new Array(g),_=0;_>1;_>=0;--_)u(_);for(;;){var S=f();if(S<0||b[S]>r)break;d(S)}for(var C=[],_=0;_=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&R.push([n,i])}}),o.unique(o.normalize(R)),{positions:C,edges:R}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":220,"simplicial-complex":232}],235:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return ol?i-l:o-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=a(r,i,s),u=a(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;if(l=a(s,o,i),u=a(s,o,r),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]}e.exports=i;var a=t("robust-orientation")},{"robust-orientation":220}],236:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=a(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=a(t.right,e);if(l)return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;a0){var s=a(this.slabs[e-1],t);s&&(o?h(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(o){var p=f(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":235,"binary-search-bounds":34,"functional-red-black-tree":84,"robust-orientation":220 -}],237:[function(t,e,r){"use strict";function n(t,e){var r=u(l(t,e),[e[e.length-1]]);return r[r.length-1]}function i(t,e,r,n){var i=n-e,a=-e/i;a<0?a=0:a>1&&(a=1);for(var o=1-a,s=t.length,l=new Array(s),u=0;u0||o>0&&c<0){var f=i(s,c,l,o);r.push(f),a.push(f.slice())}c<0?a.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),a.push(l.slice())),o=c}return{positive:r,negative:a}}function o(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u>=0&&r.push(s.slice()),a=u}return r}function s(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u<=0&&r.push(s.slice()),a=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=a,e.exports.positive=o,e.exports.negative=s},{"robust-dot-product":217,"robust-sum":225}],238:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function a(t,e){return Array(e+1).join(t)}var o={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,f,h,d=1,p=t.length,g="",v=[],m=!0,y="";for(s=0;s=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?v[v.length]=n:(!o.number.test(u[8])||m&&!u[3]?y="":(y=m?"+":"-",n=n.toString().replace(o.sign,"")),f=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",h=u[6]-(y+n).length,c=u[6]&&h>0?a(f,h):"",v[v.length]=u[5]?y+n+c:"0"===f?y+c+n:c+y+n)}return v.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],239:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],240:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128===0){f.length>0&&h.push("}}");var d="vExtra"+f.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(k="+"+v[x]+"*c");var T=.5*(p[x].length/y),E=.5+.5*(m[x]/y);M.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+k+")/("+g[x].join("+")+")")}h.push("a.push([",M.join(),"]);","break;")}n.push("}},"),f.length>0&&h.push("}}");for(var L=[],u=0;u<1<.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=L(t,360),e=L(e,100),r=L(r,100),0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,i,a=G(t,e,r),o=q(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function k(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){R(t)&&(t="100%");var n=P(t);return t=q(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function S(t){return q(1,G(0,t))}function C(t){return parseInt(t,16)}function R(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function P(t){return"string"==typeof t&&t.indexOf("%")!=-1}function O(t){return 1==t.length?"0"+t:""+t}function N(t){return t<=1&&(t=100*t+"%"),t}function I(t){return e.round(255*parseFloat(t)).toString(16)}function z(t){return C(t)/255}function j(t){return!!Z.CSS_UNIT.exec(t)}function D(t){t=t.replace(B,"").replace(U,"").toLowerCase();var e=!1;if(Y[t])t=Y[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Z.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),a:z(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),a:z(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.hex3.exec(t))&&{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),format:e?"name":"hex"}}function F(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var B=/^\s+/,U=/\s+$/,V=0,H=e.round,q=e.min,G=e.max,X=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=E(t),this._roundA=H(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=H(360*t.h),r=H(100*t.s),n=H(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=H(360*t.h),r=H(100*t.s),n=H(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:H(this._r),g:H(this._g),b:H(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+H(this._r)+", "+H(this._g)+", "+H(this._b)+")":"rgba("+H(this._r)+", "+H(this._g)+", "+H(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:H(100*L(this._r,255))+"%",g:H(100*L(this._g,255))+"%",b:H(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+H(100*L(this._r,255))+"%, "+H(100*L(this._g,255))+"%, "+H(100*L(this._b,255))+"%)":"rgba("+H(100*L(this._r,255))+"%, "+H(100*L(this._g,255))+"%, "+H(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(W[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,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(M,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=N(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return n(s)},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=F(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},n.mostReadable=function(t,e,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var Y=n.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"},W=n.hexNames=T(Y),Z=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],242:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":198}],243:[function(t,e,r){"use strict";function n(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(o(t+1)),r=[],n=0;nMath.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var a=0,o=0,s=0;s<3;++s)a+=t[s]*t[s],o+=i[s]*t[s];for(var s=0;s<3;++s)i[s]-=o/a*t[s];return h(i,i),i}function o(t,e,r,n,i,a,o,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([a]),this.angle=l([o,s]),this.angle.bounds=[[-(1/0),-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;u<16;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.up||[0,1,0],i=t.right||a(r),s=t.radius||1,l=t.theta||0,u=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),h(r,r),i=[].slice.call(i,0,3),h(i,i),"eye"in t){var c=t.eye,p=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];f(i,p,r),n(i[0],i[1],i[2])<1e-6?i=a(r):h(i,i),s=n(p[0],p[1],p[2]);var g=d(r,p)/s,v=d(i,p)/s;u=Math.acos(g),l=Math.acos(v)}return s=Math.log(s),new o(t.zoomMin,t.zoomMax,e,r,i,s,l,u)}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),f=t("gl-vec3/cross"),h=t("gl-vec3/normalize"),d=t("gl-vec3/dot"),p=o.prototype;p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,i=0,a=0,o=0;o<3;++o)a+=e[o]*r[o],i+=e[o]*e[o];for(var s=Math.sqrt(i),l=0,o=0;o<3;++o)r[o]-=e[o]*a/i,l+=r[o]*r[o],e[o]/=s;for(var u=Math.sqrt(l),o=0;o<3;++o)r[o]/=u;var c=this.computedToward;f(c,e,r),h(c,c);for(var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],g=this.computedAngle[1],v=Math.cos(p),m=Math.sin(p),y=Math.cos(g),b=Math.sin(g),x=this.computedCenter,_=v*y,w=m*y,A=b,M=-v*b,k=-m*b,T=y,E=this.computedEye,L=this.computedMatrix,o=0;o<3;++o){var S=_*r[o]+w*c[o]+A*e[o];L[4*o+1]=M*r[o]+k*c[o]+T*e[o],L[4*o+2]=S,L[4*o+3]=0}var C=L[1],R=L[5],P=L[9],O=L[2],N=L[6],I=L[10],z=R*I-P*N,j=P*O-C*I,D=C*N-R*O,F=n(z,j,D);z/=F,j/=F,D/=F,L[0]=z,L[4]=j,L[8]=D;for(var o=0;o<3;++o)E[o]=x[o]+L[2+4*o]*d;for(var o=0;o<3;++o){for(var l=0,B=0;B<3;++B)l+=L[o+4*B]*E[B];L[12+o]=-l}L[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 g=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;g[0]=i[2],g[1]=i[6],g[2]=i[10];for(var a=this.computedUp,o=this.computedRight,s=this.computedToward,l=0;l<3;++l)i[4*l]=a[l],i[4*l+1]=o[l],i[4*l+2]=s[l];c(i,i,n,g);for(var l=0;l<3;++l)a[l]=i[4*l],o[l]=i[4*l+1];this.up.set(t,a[0],a[1],a[2]),this.right.set(t,o[0],o[1],o[2])}},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=(Math.exp(this.computedRadius[0]),a[1]),s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],f=a[4],h=a[8],d=c*o+f*s+h*l;c-=o*d,f-=s*d,h-=l*d;var p=n(c,f,h);c/=p,f/=p,h/=p;var g=c*e+o*r,v=f*e+s*r,m=h*e+l*r;this.center.move(t,g,v,m);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e,r,a){var o=1;"number"==typeof r&&(o=0|r),(o<0||o>3)&&(o=1);var s=(o+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[o],c=e[o+4],f=e[o+8];if(a){var h=Math.abs(l),d=Math.abs(c),p=Math.abs(f),g=Math.max(h,d,p);h===g?(l=l<0?-1:1,c=f=0):p===g?(f=f<0?-1:1,l=c=0):(c=c<0?-1:1,l=f=0)}else{var v=n(l,c,f);l/=v,c/=v,f/=v}var m=e[s],y=e[s+4],b=e[s+8],x=m*l+y*c+b*f;m-=l*x,y-=c*x,b-=f*x;var _=n(m,y,b);m/=_,y/=_,b/=_;var w=c*b-f*y,A=f*m-l*b,M=l*y-c*m,k=n(w,A,M);w/=k,A/=k,M/=k,this.center.jump(t,q,G,X),this.radius.idle(t),this.up.jump(t,l,c,f),this.right.jump(t,m,y,b);var T,E;if(2===o){var L=e[1],S=e[5],C=e[9],R=L*m+S*y+C*b,P=L*w+S*A+C*M;T=z<0?-Math.PI/2:Math.PI/2,E=Math.atan2(P,R)}else{var O=e[2],N=e[6],I=e[10],z=O*l+N*c+I*f,j=O*m+N*y+I*b,D=O*w+N*A+I*M;T=Math.asin(i(z)),E=Math.atan2(D,j)}this.angle.jump(t,E,T),this.recalcMatrix(t);var F=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var H=V[15],q=V[12]/H,G=V[13]/H,X=V[14]/H,Y=Math.exp(this.computedRadius[0]);this.center.jump(t,q-F*Y,G-B*Y,X-U*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,a){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,a=a||this.computedUp;var o=a[0],s=a[1],l=a[2],u=n(o,s,l);if(!(u<1e-6)){o/=u,s/=u,l/=u;var c=e[0]-r[0],f=e[1]-r[1],h=e[2]-r[2],d=n(c,f,h);if(!(d<1e-6)){c/=d,f/=d,h/=d;var p=this.computedRight,g=p[0],v=p[1],m=p[2],y=o*g+s*v+l*m;g-=y*o,v-=y*s,m-=y*l;var b=n(g,v,m);if(!(b<.01&&(g=s*h-l*f,v=l*c-o*h,m=o*f-s*c,b=n(g,v,m),b<1e-6))){g/=b,v/=b,m/=b,this.up.set(t,o,s,l),this.right.set(t,g,v,m),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=s*m-l*v,_=l*g-o*m,w=o*v-s*g,A=n(x,_,w);x/=A,_/=A,w/=A;var M=o*c+s*f+l*h,k=g*c+v*f+m*h,T=x*c+_*f+w*h,E=Math.asin(i(M)),L=Math.atan2(T,k),S=this.angle._state,C=S[S.length-1],R=S[S.length-2];C%=2*Math.PI;var P=Math.abs(C+2*Math.PI-L),O=Math.abs(C-L),N=Math.abs(C-2*Math.PI-L);P0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function f(t){return new Int16Array(o(2*t),0,t)}function h(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return x?new Uint8ClampedArray(o(t),0,t):s(t)}function v(t){return new DataView(o(t),0,t)}function m(t){t=y.nextPow2(t);var e=y.log2(t),r=A[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,A=_.BUFFER;r.free=function(t){if(n.isBuffer(t))A[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){A[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8": -return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return f(t);case"int32":return h(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return m(t);case"data":case"dataview":return v(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=f,r.mallocInt32=h,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=v,r.mallocBuffer=m,r.clearCache=function(){for(var t=0;t<32;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,A[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":35,buffer:45,dup:77}],248:[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;e8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function o(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),!(e<0)&&(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof x||a();var s=[],l=[],u=b++;return Object.create(x.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(o)}})};x.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||!!c&&c.has___(t)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof x||a();var l,u=new s,c=void 0,f=!1;return l=o?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new x),c.set(t,e)),this}:function(t,e){if(f)try{u.set(t,e)}catch(r){c||(c=new x),c.set___(t,e)}else u.set(t,e);return this},Object.create(x.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");f=!0})}})}o&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=x.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=x)}}()},{}],253:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":254}],254:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],255:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":253}],256:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":86}],257:[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":70}],258:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":257}],259:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e){function r(e,r){return n.coerce(t,s,o,e,r)}var s={};r("opacity"),r("align"),r("bgcolor");var l=r("bordercolor"),u=i.opacity(l);r("borderpad");var c=r("borderwidth"),f=r("showarrow");f&&(r("arrowcolor",u?s.bordercolor:i.defaultLine),r("arrowhead"),r("arrowsize"),r("arrowwidth",2*(u&&c||1)),r("ax"),r("ay"),r("axref"),r("ayref"),n.noneOrAll(t,s,["ax","ay"])),r("text",f?" ":"new text"),r("textangle"),n.coerceFont(r,"font",e.font);for(var h=["x","y"],d=0;d<2;d++){var p=h[d],g={_fullLayout:e},v=a.coerceRef(t,s,g,p),m=a.coerceARef(t,s,g,p),y=.5;if("paper"!==v){var b=a.getFromId(g,v);if(y=b.range[0]+y*(b.range[1]-b.range[0]),["date","category"].indexOf(b.type)!==-1&&"string"==typeof t[p]){var x;if("date"===b.type){if(x=n.dateTime2ms(t[p]),x!==!1&&(t[p]=x),m===v){var _=n.dateTime2ms(t["a"+p]);_!==!1&&(t["a"+p]=_)}}else(b._categories||[]).length&&(x=b._categories.indexOf(t[p]),x!==-1&&(t[p]=x))}}r(p,y),f||r(p+"anchor")}return n.noneOrAll(t,s,["x","y"]),s}},{"../../lib":362,"../../plots/cartesian/axes":390,"../color":268,"./attributes":261}],260:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],261:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":358,"../../plots/cartesian/constants":396,"../../plots/font_attributes":411,"./arrow_paths":260}],262:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,f=s-l,h=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),f=Math.max(f,d),h=Math.max(h,d)}r&&r.autorange&&a.expand(r,[r.l2c(e.x)],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(e.y)],{ppadplus:h,ppadminus:f})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=e.annotations;if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":362,"../../plots/cartesian/axes":390,"./draw":264}],263:[function(t,e,r){"use strict";var n=t("./annotation_defaults");e.exports=function(t,e){for(var r=t.annotations||[],i=e.annotations=[],a=0;a2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=$.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,m=Math.round(u+2*tt),y=Math.round(p+2*tt);q._w=u,q._h=p;var x=!1;if(["x","y"].forEach(function(e){var n,i=q[e+"ref"]||e,a=f.getFromId(t,i),o=(W+("x"===e?0:90))*Math.PI/180,s=m*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=q[e+"anchor"];if(a){if(!a.autorange&&(q[e]-a.range[0])*(q[e]-a.range[1])>0&&(q["a"+e+"ref"]===i?(q["a"+e]-a.range[0])*(q["a"+e]-a.range[1])>0&&(x=!0):x=!0,x))return;Y[e]=a._offset+a.l2p(q[e]),n=.5}else n=q[e],"y"===e&&(n=1-n),Y[e]="x"===e?P.l+P.w*n:P.t+P.h*n;var u=0;q["a"+e+"ref"]===i?Y["aa"+e]=a._offset+a.l2p(q["a"+e]):(u=q.showarrow?q["a"+e]:s*r(n,l),Y[e]+=u),q["_"+e+"type"]=a&&a.type,q["_"+e+"size"]=s,q["_"+e+"shift"]=u}),x)return void $.remove();var _,w;q.showarrow&&(_=q.axref===q.xref?Y.x:c.constrain(Y.x-q.ax,1,M.width-1),w=q.ayref===q.yref?Y.y:c.constrain(Y.y-q.ay,1,M.height-1)),Y.x=c.constrain(Y.x,1,M.width-1),Y.y=c.constrain(Y.y,1,M.height-1);var A=tt-s.top,k=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:k,y:A}),nt.selectAll("tspan.line").attr({y:A,x:k})),et.call(d.setRect,K/2,K/2,m-K,y-K);var T=0,E=0;T=q.axref===q.xref?Math.round(Y.aax-m/2):Math.round(Y.x-m/2),E=q.ayref===q.yref?Math.round(Y.aay-y/2):Math.round(Y.y-y/2),$.call(c.setTranslate,T,E);var L="annotations["+e+"]",S=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=q.axref===q.xref?Y.aax+r:Y.x+r,s=q.ayref===q.yref?Y.aay+n:Y.y+n;var u=c.rotationXYMatrix(W,i,s),f=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,m=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!m.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){m.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=q.arrowwidth,x=q.arrowcolor,A=Z.append("g").style({opacity:h.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=A.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(h.stroke,h.rgb(x));b(M,q.arrowhead,"end",q.arrowsize);var k=A.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,S;v.init({element:k.node(),prepFn:function(){var t=c.getTranslate($);E=t.x,S=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){A.attr("transform","translate("+t+","+e+")");var r=f(E,S),n=r[0]+t,i=r[1]+e;$.call(c.setTranslate,n,i),T[L+".x"]=G?q.x+t/G._m:(_+t-P.l)/P.w,T[L+".y"]=X?q.y+e/X._m:1-(w+e-P.t)/P.h,q.axref===q.xref&&(T[L+".ax"]=G?q.ax+t/G._m:(_+t-P.l)/P.w),q.ayref===q.yref&&(T[L+".ay"]=X?q.ay+e/X._m:1-(w+e-P.t)/P.h),Q.attr({transform:"rotate("+W+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};q.showarrow&&S(0,0);var C=c.rotationXYMatrix(W,Y.x,Y.y),R=c.apply2DTransform(C);if(t._context.editable){var O,N,I;v.init({element:$.node(),prepFn:function(){var t=c.getTranslate($);O=t.x,N=t.y,I={}},moveFn:function(t,e){$.call(c.setTranslate,O+t,N+e);var r="pointer";if(q.showarrow)q.axref===q.xref?I[L+".ax"]=G.p2l(G.l2p(q.ax)+t):I[L+".ax"]=q.ax+t,q.ayref===q.yref?I[L+".ay"]=X.p2l(X.l2p(q.ay)+e):I[L+".ay"]=q.ay+e,S(t,e);else{if(G)I[L+".x"]=q.x+t/G._m;else{var n=q._xsize/P.w,i=q.x+q._xshift/P.w-n/2;I[L+".x"]=v.align(i+t/P.w,n,0,1,q.xanchor)}if(X)I[L+".y"]=q.y+e/X._m;else{var a=q._ysize/P.h,o=q.y-q._yshift/P.h-a/2;I[L+".y"]=v.align(o-e/P.h,a,0,1,q.yanchor)}G&&X||(r=v.getCursor(G?.5:I[L+".x"],X?.5:I[L+".y"],q.xanchor,q.yanchor))}var s=R(O,N),l=s[0]+t,u=s[1]+e;$.call(c.setTranslate,O+t,N+e),Q.attr({transform:"rotate("+W+","+l+","+u+")"}),g($,r)},doneFn:function(e){if(g($),e){l.relayout(t,I);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,A=t.layout,M=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return A.annotations=u,y(A,M),void n(t);if("remove"===u)return delete A.annotations,M.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)M._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}M._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=A.annotations[e],E=M.annotations[e];if(T){var L={xref:T.xref,yref:T.yref},S={};"string"==typeof r&&r?S[r]=u:c.isPlainObject(r)&&(S=r);var C=Object.keys(S);for(w=0;w4/3&&(j=V)}}else z&&(F&&(j<1/3?j+=U:j>2/3&&(j-=U)),j=(j-z.domain[0])/(z.domain[1]-z.domain[0]),j=z.range[0]+j*(z.range[1]-z.range[0]))}z&&z===I&&D&&("log"===D&&"log"!==z.type?j=Math.pow(10,j):"log"!==D&&"log"===z.type&&(j=j>0?Math.log(j)/Math.LN10:void 0)),T[N]=j}}var q=m(T,M);M.annotations[e]=q;var G=f.getFromId(t,q.xref),X=f.getFromId(t,q.yref),Y={x:0,y:0},W=+q.textangle||0,Z=M._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",q.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:q})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),K=q.borderwidth,J=q.borderpad,tt=K+J,et=$.append("rect").attr("class","bg").style("stroke-width",K+"px").call(h.stroke,q.bordercolor).call(h.fill,q.bgcolor),rt=q.font,nt=$.append("text").classed("annotation",!0).attr("data-unformatted",q.text).text(q.text);t._context.editable?nt.call(p.makeEditable,$).call(x).on("edit",function(r){q.text=r,this.attr({"data-unformatted":q.text}),this.call(x);var n={};n["annotations["+e+"].text"]=q.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(x),Q.attr({transform:"rotate("+W+","+Y.x+","+Y.y+")"}).call(d.setPosition,Y.x,Y.y)}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,f=n-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var g=(u*d-c*h)/p,v=(u*f-l*h)/p;return v<0||v>1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./annotation_defaults"),y=t("./defaults"),b=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":362,"../../lib/setcursor":372,"../../lib/svg_text_utils":376,"../../plotly":386,"../../plots/cartesian/axes":390,"../../plots/plots":428,"../color":268,"../dragelement":290,"../drawing":292,"./annotation_defaults":259,"./defaults":263,"./draw_arrow_head":265,d3:74,"fast-isnumeric":82}],265:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var f,h,d,p,g=(o.getPx(t,"stroke-width")||1)*l,v=t.style("stroke")||a.defaultLine,m=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=c.backoff*g;if("line"===u.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},h={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(f.y-h.y,f.x-h.x),p=d+Math.PI,x){var _=x*Math.cos(d),w=x*Math.sin(d);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),b&&(h.x+=_,h.y+=w,t.attr({x2:h.x,y2:h.y}))}}else if("path"===u.nodeName){var A=u.getTotalLength(),M="";if(y){var k=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(k.y-T.y,k.x-T.x),f=u.getPointAtLength(Math.min(x,A)),x&&(M="0px,"+x+"px,")}if(b){var E=u.getPointAtLength(A),L=u.getPointAtLength(A-.1);if(p=Math.atan2(E.y-L.y,E.x-L.x),h=u.getPointAtLength(Math.max(0,A-x)),x){var S=M?2*x:x;M+=A-S+"px,"+A+"px"}}else M&&(M+=A+"px");M&&t.style("stroke-dasharray",M)}var C=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:v,opacity:m,"stroke-width":0})};y&&C(f,d),b&&C(h,p)}}},{"../color":268,"../drawing":292,"./arrow_paths":260,d3:74,"fast-isnumeric":82}],266:[function(t,e,r){"use strict";var n=t("../../plotly");r.moduleType="component",r.name="annotations",r.ARROWPATHS=t("./arrow_paths"),r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.calcAutorange=t("./calc_autorange"),r.arrowhead=t("./draw_arrow_head");var i=t("./draw");r.draw=i.draw,r.drawOne=i.drawOne,r.add=function(t){var e=t._fullLayout.annotations.length;n.relayout(t,"annotations["+e+"]","add")}},{"../../plotly":386,"./arrow_paths":260,"./attributes":261,"./calc_autorange":262,"./defaults":263,"./draw":264,"./draw_arrow_head":265}],267:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],268:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(C);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"), -f.exit().remove(),f.each(function(t,e){var r=[0===e?L[0]:(C[e]+C[e-1])/2,e===C.length-1?L[1]:(C[e]+C[e+1])/2].map(J.c2p).map(Math.round);e!==C.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=P(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({x:Y,width:Math.max(B,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var h=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){n.select(this).attr("d","M"+Y+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+B).call(d.lineGroupStyle,_.line.width,R(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=Y+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));A("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:k.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,i=x();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(a,r||{}))}function M(){var r=B+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(j=ot.select("text"),j.node()&&!j.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-Y-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-$;at.select(".cbbg").attr({x:Y-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:Y,y:$+_.ypad+("top"===_.titleside?st:0),width:Math.max(B,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var k=t._fullLayout,T=k._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void k._infolayer.selectAll("g."+e).remove();var E,L=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],C=[],R="function"==typeof _.line.color?_.line.color:function(){return _.line.color},P="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},O=_.levels.end+_.levels.size/100,N=_.levels.size,I=1.001*L[0]-.001*L[1],z=1.001*L[1]-.001*L[0];for(E=_.levels.start;(E-O)*N<0;E+=N)E>I&&EL[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+H-X],J.setScale();var at=k._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+q)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+H-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,A(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ft=c.syncOrAsync([o.previousPromises,w,o.previousPromises,M],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var ht,dt,pt;u.init({element:at.node(),prepFn:function(){ht=at.attr("transform"),h(at)},moveFn:function(t,e){at.attr("transform",ht+" translate("+t+","+e+")"),dt=u.align(W+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,H,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);h(at,r)},doneFn:function(e){h(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},x().index)}})}return ft}function x(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":362,"./flip_scale":280,"./scales":287}],276:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":358,"./attributes":274,"./scales.js":287}],277:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":287}],278:[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,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,g=f?i.nestedProperty(e,d).get()||{}:e,v=p[h+"min"],m=p[h+"max"],y=p.colorscale,b=n(v)&&n(m)&&v=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],281:[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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):e}},{"./default_scale":277,"./is_valid_scale_array":285,"./scales":287}],282:[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(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],289:[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":362}],290:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,g=o.getPlotDiv(t.element)||{},v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":362,"../../plotly":386,"../../plots/cartesian/constants":396,"./align":288,"./cursor":289,"./unhover":291}],291:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":357}],292:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,f,h;t.so?(h=o.outlierwidth,f=o.outliercolor,c=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(h||1)+"px",fill:"none"}):(e.style("stroke-width",h+"px").call(l.fill,c),h&&e.call(l.stroke,f))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),f=(c*c*i-u*u*s)*n,h=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&f/d),2),a.round(e[1]+(d&&h/d),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&h/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var v=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=(r._input||{}).marker||{},s=g.tryColorscale(i,o,""),l=g.tryColorscale(i,o,"line.");n(t,e,r,s,l,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=(e._input||{}).marker||{},i=g.tryColorscale(r,n,""),o=g.tryColorscale(r,n,"line.");t.each(function(t){g.singlePointStyle(t,a.select(this),e,i,o)})}},g.tryColorscale=function(t,e,r){var n=c.nestedProperty(t,r+"color").get(),i=c.nestedProperty(t,r+"colorscale").get(),a=c.nestedProperty(t,r+"cauto").get(),s=c.nestedProperty(t,r+"cmin"),l=c.nestedProperty(t,r+"cmax"),f=s.get(),h=l.get();return i&&Array.isArray(n)?(!a&&o(f)&&o(h)||(f=1/0,h=-(1/0),n.forEach(function(t){o(t)&&(f>t&&(f=+t),hh&&(f=0,h=1),s.set(f),l.set(h),c.nestedProperty(e,r+"cmin").set(f),c.nestedProperty(e,r+"cmax").set(h)),u.makeColorScaleFunc(u.extractScale(i,f,h))):c.identity};var b={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(f.convertToTspans);var h=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*x+1,v=b[l]*c,m=.75*u+b[s]*c+(b[s]-1)*p*u/2;h.attr("transform","translate("+v+","+m+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=k&&(a.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":352,"../../lib":362,"../../lib/svg_text_utils":376,"../../registry":436,"../../traces/scatter/make_bubble_size_func":467,"../../traces/scatter/subtypes":472,"../color":268,"../colorscale":283,"./symbol_defs":293,d3:74,"fast-isnumeric":82}],293:[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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:74}],294:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],295:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),f=0;f0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);c&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;f="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");s=!v.size(),s?v=e.append("path").classed("yerror",!0):c&&(v=v.transition().duration(r.duration).ease(r.easing)),v.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var m=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-m)+"v"+2*m+"m0,-"+m+"H"+o.xs,o.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":472,d3:74,"fast-isnumeric":82}],300:[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":268,d3:74}],301:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":396}],302:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,o,r,n)}e=e||{},n("source"),n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var s=0;s<2;s++){var l={_fullLayout:r},u=["x","y"][s];i.coerceRef(t,e,l,u,"paper")}return e}var i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var r=t.images,i=e.images=[],a=0;a=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}},{}],306:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":358,"../../plots/font_attributes":411,"../color/attributes":267}],307:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],308:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(b!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",v),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":362,"../../plots/layout_attributes":426,"../../registry":436,"./attributes":306,"./helpers":311}],309:[function(t,e,r){"use strict";function n(t,e){function r(r){m.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?f.call(m.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=r.indexOf(f);h===-1?r.push(f):r.splice(h,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;r=s*h,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cn.width-(n.margin.r+n.margin.l)&&(b=0,v+=m,i.height=i.height+m,m=0),f.setTranslate(this,a+b,5+a+e.height/2+v),i.width+=o+r,i.height=Math.max(i.height,e.height),b+=o+r,m=Math.max(e.height,m)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),b=t("./get_legend_data"),x=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(g.setRect,F,t,y.scrollBarWidth,y.scrollBarHeight),k.select("rect").attr({y:m.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var m=r.legend,_=r.showlegend&&b(t.calcdata,m),A=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var E=M.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=M.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=E.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var C=S.selectAll("g.traces").data(f.identity);C.enter().append("g").attr("class","traces"),C.exit().remove(),C.call(x).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?A.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var R=0!==M.enter().size();R&&(o(t,S,C),s(t));var P=0,O=r.width,N=0,I=r.height;o(t,S,C),m.height>I?l(t):s(t);var z=r._size,j=z.l+z.w*m.x,D=z.t+z.h*(1-m.y);w.isRightAnchor(m)?j-=m.width:w.isCenterAnchor(m)&&(j-=m.width/2),w.isBottomAnchor(m)?D-=m.height:w.isMiddleAnchor(m)&&(D-=m.height/2);var F=m.width,B=z.w;F>B?(j=z.l,F=B):(j+F>O&&(j=O-F),jV?(D=z.t,U=V):(D+U>I&&(D=I-U),Dr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":362,"../../registry":436,"../../traces/pie/style_one":450,"../../traces/scatter/subtypes":472,"../color":268,"../drawing":292,d3:74}],314:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(v,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",o.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":362,"../color":268,"./attributes":318,"./button_attributes":319,"./constants":320}],322:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../plots/cartesian/axes"),a=t("./constants"),o=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=e.shapes;if(r.length&&t._fullData.length)for(var o=0;oe;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},i=S.line.width?S.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",S.opacity).call(_.stroke,i).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);C&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+C),t._context.editable&&f(t,a,S,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={xref:s.xref,yref:s.yref},u={};"string"==typeof r&&r?u[r]=n:b.isPlainObject(r)&&(u=r);var c=Object.keys(u);for(a=0;aX&&n>Y&&!t.shiftKey?A.getCursor(i/r,1-a/n):"move";M(e,o),G=o.split("-")[0]}function a(e){F=x.getFromId(t,r.xref),B=x.getFromId(t,r.yref),U=T.getDataToPixel(t,F),V=T.getDataToPixel(t,B,!0),H=T.getPixelToData(t,F),q=T.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(j=r.path,D=a+".path"):(c=U(r.x0),f=V(r.y0),h=U(r.x1),d=V(r.y1),g=a+".x0",m=a+".y0",b=a+".x1",_=a+".y1"),cY&&(u[S]=r[O]=q(s),u[C]=r[N]=q(l)),f-c>X&&(u[R]=r[I]=H(c),u[P]=r[z]=H(f))}e.attr("d",p(t,r))}var u,c,f,h,d,g,m,b,_,w,k,E,L,S,C,R,P,O,N,I,z,j,D,F,B,U,V,H,q,G,X=10,Y=10,W={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=W.element.getBoundingClientRect();A.init(W)}function h(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):b.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=x.getFromId(t,r.id,"x")._id,i=x.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=x.getFromId(t,e.xref),l=x.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.dataToLinear(s),n=function(t){return s._offset+s.l2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.dataToLinear(l),a=function(t){return l._offset+l.l2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),f=n(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,v=(h+d)/2,m=Math.abs(p-c),y=Math.abs(v-h),b="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),b.log("Ignoring extra params in segment "+t)),i+l})}function v(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var m=t("fast-isnumeric"),y=t("../../plotly"),b=t("../../lib"),x=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),A=t("../dragelement"),M=t("../../lib/setcursor"),k=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),L=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":362,"../../lib/setcursor":372,"../../plotly":386,"../../plots/cartesian/axes":390,"../color":268,"../dragelement":290,"../drawing":292,"./constants":332,"./defaults":333,"./helpers":335,"./shape_defaults":337,"fast-isnumeric":82}],335:[function(t,e,r){"use strict";r.dataToLinear=function(t){return"category"===t.type?t.c2l:t.d2l},r.linearToData=function(t){return"category"===t.type?t.l2c:t.l2d},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")), -t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.dataToLinear(e);i=function(t){return e._offset+e.l2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.linearToData(e);i=function(t){return o(e.p2l(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],336:[function(t,e,r){"use strict";r.moduleType="component",r.name="shapes",r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.calcAutorange=t("./calc_autorange");var n=t("./draw");r.draw=n.draw,r.drawOne=n.drawOne},{"./attributes":330,"./calc_autorange":331,"./defaults":333,"./draw":334}],337:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e){function r(e,r){return n.coerce(t,s,a,e,r)}var s={};r("layer"),r("opacity"),r("fillcolor"),r("line.color"),r("line.width"),r("line.dash");for(var l=t.path?"path":"rect",u=r("type",l),c=["x","y"],f=0;f<2;f++){var h=c[f],d={_fullLayout:e},p=i.coerceRef(t,s,d,h);if("path"!==u){var g=.25,v=.75;if("paper"!==p){var m=i.getFromId(d,p),y=o.linearToData(m);g=y(m.range[0]+g*(m.range[1]-m.range[0])),v=y(m.range[0]+v*(m.range[1]-m.range[0]))}r(h+"0",g),r(h+"1",v)}}return"path"===u?r("path"):n.noneOrAll(t,s,["x0","x1","y0","y1"]),s}},{"../../lib":362,"../../plots/cartesian/axes":390,"./attributes":330,"./helpers":335}],338:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":358,"../../plots/animation_attributes":387,"../../plots/font_attributes":411,"../../plots/pad_attributes":427,"./constants":339}],339:[function(t,e,r){"use strict";e.exports={name:"sliders",itemName:"slider",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],340:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,o,r,n)}var s=i(t,e),l=n("visible",s.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,u,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+S.railTouchRectClass).data([0]);n.enter().append("rect").classed(S.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,S.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),M.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+S.railRectClass).data([0]);r.enter().append("rect").classed(S.railRectClass,!0);var n=e.inputAreaLength-2*S.railInset;r.attr({width:n,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(r,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+S.groupClassName).data(r,i);l.enter().append("g").classed(S.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,L=!0,S=R,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,M=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,L=!1,S=g.title.trim();""===S&&(E=0),S.match(/Click to enter .+ title/)&&(E=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var R="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?a.restyle(t,v,e,m):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":362,"../../lib/svg_text_utils":376,"../../plotly":386,"../../plots/plots":428,"../color":268,"../drawing":292,d3:74,"fast-isnumeric":82}],344:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":358,"../../plots/font_attributes":411,"../../plots/pad_attributes":427,"../color/attributes":267}],345:[function(t,e,r){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],346:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,o,r,n)}var s=i(t,e),l=n("visible",s.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,u,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var f=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){b.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],352:[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}},{}],353:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.19.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":266,"./components/images":304,"./components/legend":312,"./components/rangeselector":324,"./components/rangeslider":329,"./components/shapes":336,"./components/sliders":342,"./components/updatemenus":348,"./fonts/mathjax_config":354,"./lib/queue":370,"./plot_api/plot_schema":380,"./plot_api/register":381,"./plot_api/set_plot_config":382,"./plot_api/to_image":384,"./plot_api/validate":385,"./plotly":386,"./snapshot":441,"./snapshot/download":438,"./traces/scatter":462,d3:74,"es6-promise":79}],354:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],355:[function(t,e,r){"use strict";function n(t){return t&&void 0!==t.valType}var i=t("fast-isnumeric"),a=t("tinycolor2"),o=t("./nested_property"),s=t("./is_plain_object"),l=t("./filter_unique"),u=t("../components/colorscale/get_scale"),c=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,n){!i(t)||void 0!==n.min&&tn.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,n){t%1||!i(t)||void 0!==n.min&&tn.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(u(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):i(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&c.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!c.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a2)return!1;var o=a[0].split("-");if(o.length>3||3!==o.length&&a[1])return!1;if(4===o[0].length)e=Number(o[0]);else{if(2!==o[0].length)return!1;var l=(new Date).getFullYear();e=((Number(o[0])-l+70)%100+200)%100+l-70}return!!s(e)&&(1===o.length?new Date(e,0,1).getTime():(r=Number(o[1])-1,!(o[1].length>2)&&r>=0&&r<=11&&(2===o.length?new Date(e,r,1).getTime():(n=Number(o[2]),!(o[2].length>2)&&n>=1&&n<=31&&(n=new Date(e,r,n).getTime(),a[1]?(o=a[1].split(":"),!(o.length>3)&&(i=Number(o[0]),!(o[0].length>2)&&i>=0&&i<=23&&(n+=36e5*i,1===o.length?n:(r=Number(o[1]),!(o[1].length>2)&&r>=0&&r<=59&&(n+=6e4*r,2===o.length?n:(t=Number(o[2]),t>=0&&t<60&&n+1e3*t)))))):n)))))},r.isDateTime=function(t){return r.dateTime2ms(t)!==!1},r.ms2DateTime=function(t,e){e||(e=0);var r=new Date(t),i=o.time.format("%Y-%m-%d")(r);return e<7776e6?(i+=" "+n(r.getHours(),2),e<432e6&&(i+=":"+n(r.getMinutes(),2),e<108e5&&(i+=":"+n(r.getSeconds(),2),e<3e5&&(i+="."+n(r.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var l={H:["%H:%M:%S~%L","%H:%M:%S","%H:%M"],I:["%I:%M:%S~%L%p","%I:%M:%S%p","%I:%M%p"],D:["%H","%I%p","%Hh"]},u={Y:["%Y~%m~%d","%Y%m%d","%y%m%d","%m~%d~%Y","%d~%m~%Y"],Yb:["%b~%d~%Y","%d~%b~%Y","%Y~%d~%b","%Y~%b~%d"],y:["%m~%d~%y","%d~%m~%y","%y~%m~%d"],yb:["%b~%d~%y","%d~%b~%y","%y~%d~%b","%y~%b~%d"]},c=o.time.format.utc,f={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(c),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(c)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(c)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){u[t].forEach(function(e){f[t].D.push(c(e)),["H","I","D"].forEach(function(r){l[r].forEach(function(n){var i=f[t][r];i.push(c(e+"~"+n)),i.push(c(n+"~"+e))})})})});var h=/[a-z]*/g,d=function(t){return t.substr(0,3)},p=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,g=/[\s,\/\-\.\(\)]+/g,v=/~?([ap])~?m(~|$)/,m=function(t,e){return e+"m "},y=/\d\d\d\d/,b=/(^|~)[a-z]{3}/,x=/[ap]m/,_=/:/,w=/q([1-4])/,A=["31~mar","30~jun","30~sep","31~dec"],M=function(t,e){return A[e-1]},k=/ ?([+\-]\d\d:?\d\d|Z)$/;r.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(h,d).replace(p,"").replace(g,"~").replace(v,m).replace(w,M).trim().replace(k,"");var e,r,n=null,o=i(t),s=a(t);e=f[o][s],r=e.length;for(var l=0;l",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./coerce":355,"./dates":356,"./extend":358,"./filter_unique":359,"./is_array":363,"./is_plain_object":364,"./loggers":365,"./matrix":366,"./nested_property":367,"./notifier":368,"./search":371,"./stats":374,d3:74}],363:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],364:[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}},{}],365:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,h(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;uMath.max(c,g)||l>Math.max(f,v)))if(lc||Math.abs(n(o,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":366}],370:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;f90&&l.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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":82}],375:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:15,tinycolor2:241}],376:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,v.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(), -void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":351,"../constants/xmlns_namespaces":352,"../lib":362,d3:74}],377:[function(t,e,r){"use strict";function n(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=f.cleanId(r,n))}function i(t){var e="middle",r="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?r="left":t.indexOf("right")!==-1&&(r="right"),e+" "+r}function a(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var o=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),l=t("../registry"),u=t("../lib"),c=t("../plots/plots"),f=t("../plots/cartesian/axes"),h=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.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);var i=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lR.range[0]?[1,2]:[2,1]);else{var P=R.range[0],O=R.range[1];"log"===x?(P<=0&&O<=0&&r(E+".autorange",!0),P<=0?P=O/1e6:O<=0&&(O=P/1e6),r(E+".range[0]",Math.log(P)/Math.LN10),r(E+".range[1]",Math.log(O)/Math.LN10)):(r(E+".range[0]",Math.pow(10,P)),r(E+".range[1]",Math.pow(10,O)))}else r(E+".autorange",!0)}if("reverse"===k)L.range?L.range.reverse():(r(E+".autorange",!0),L.range=[1,0]),S.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var N=m.parts[1],I=m.parts[0],z=a[I]||[],j=z[N]||{};null===x&&(e[v]="remove"),2===m.parts.length&&("add"===e[v]||b.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?N===-1?(g[I]=z,delete g[v]):g[v]=j:b.log("???",e)),!n(j,"x")&&!n(j,"y")||b.containsAny(v,["color","opacity","align","dash"])||(d.docalc=!0);var D=w.getComponentMethod(I,"drawOne");D(t,N,m.parts.slice(2).join("."),e[v]),delete e[v]}else A.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1]?(C.manageArrayContainers(m,x,g),d.doplot=!0):(0===m.parts[0].indexOf("scene")?d.doplot=!0:0===m.parts[0].indexOf("geo")?d.doplot=!0:0===m.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===v?d.doplot=!0:!o._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?d.docalc=!0:m.parts[0].indexOf("legend")!==-1?d.dolegend=!0:v.indexOf("title")!==-1?d.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&b.containsAny(m.parts[1],["tick","exponent","grid","zeroline"])?d.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:m.parts.length>1&&m.parts[1].indexOf("line")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&"mirror"===m.parts[1]?d.doticks=d.dolayoutstyle=!0:"margin.pad"===v?d.doticks=d.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(d.doplot=!0):d.doplot=!0,m.set(x))}}var F=t._fullLayout.width,B=t._fullLayout.height;A.supplyDefaults(t),t.layout.autosize&&A.plotAutoSize(t,t.layout,t._fullLayout);var U=e.height||e.width||t._fullLayout.width!==F||t._fullLayout.height!==B;return U&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:b.extendDeep({},p)}}function g(t){var e=v.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];v.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=b.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(L.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),b=t("../lib"),x=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),A=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),k=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),L=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),C=t("./helpers"),R=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=P._basePlotModules,r=0;r=o.length?o[0]:o[t]:o}function i(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}if(t=C.getGraphDiv(t),!b.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 animating it. For more details, see https://plot.ly/javascript/animations/");var a=t._transitionData;a._frameQueue||(a._frameQueue=[]),r=A.supplyAnimationDefaults(r);var o=r.transition,s=r.frame;return void 0===a._frameWaitingCnt&&(a._frameWaitingCnt=0),new Promise(function(s,l){function u(){if(0!==a._frameQueue.length){for(;a._frameQueue.length;){var e=a._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function c(e){if(0!==e.length){for(var o=0;oa._timeToNext&&h()};e()}function p(t){return Array.isArray(o)?m>=o.length?t.transitionOpts=o[m]:t.transitionOpts=o[0]:t.transitionOpts=o,m++,t}var g,v,m=0,y=[],x=void 0===e||null===e,_=Array.isArray(e),w=!x&&!_&&b.isPlainObject(e);if(w)y.push({type:"object",data:p(b.extendFlat({},e))});else if(x||"string"==typeof e)for(g=0;g0&&TT)&&E.push(v);y=E}}y.length>0?c(y):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,r){if(t=C.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!b.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:A.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),A.modifyFrames(t,a)},y.purge=function(t){t=C.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return A.cleanPlot([],{},r,e),A.purge(t),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":292,"../components/errorbars":298,"../constants/xmlns_namespaces":352,"../lib":362,"../lib/events":357,"../lib/queue":370,"../lib/svg_text_utils":376,"../plotly":386,"../plots/cartesian/graph_interact":398,"../plots/plots":428,"../plots/polar":431,"../registry":436,"./helpers":377,"./subroutines":383,d3:74,"fast-isnumeric":82}],379:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],380:[function(t,e,r){"use strict";function n(t){var e=y.attributes,r=u({type:t}),n=f(t),i=d(t),a={},o={};a.type=null,A(a,e),a=s(r.attributes,a,"attributes",t),void 0!==i.attributes&&A(a,i.attributes),a.type=t,a=c(a),l(a),E.traces[t]=w({},n,{attributes:a}),void 0!==r.layoutAttributes&&(o=s(r.layoutAttributes,o,"layoutAttributes",t),l(o),E.traces[t].layoutAttributes=o)}function i(){var t=y.layoutAttributes,e={};e=s(t,e,"layoutAttributes","*"),e=h(e),e=p(e),e=c(e),l(e),g(e),E.layout={layoutAttributes:e}}function a(t){var e=m.transformsRegistry[t],r={};r=s(r,e.attributes||{},"attributes","*"),r=c(r),l(r),g(r),E.transforms[t]={attributes:r}}function o(){E.defs={valObjects:b.valObjects,metaKeys:b.UNDERSCORE_ATTRS.concat(["description","role"])}}function s(t,e,r,n){var i,a,o,l,c;return Object.keys(t).forEach(function(f){return f===k?void Object.keys(t[f]).forEach(function(l){i=u({_module:t[f][l]}),void 0!==i&&(a=i[r],o=s(a,{},r,n),b.nestedProperty(e,l).set(A({},o)))}):f===T?void Object.keys(t[f]).forEach(function(i){i===n&&(l=u({_module:t[f][i]}),void 0!==l&&(c=l[r],c=s(c,{},r,n),M(e,c)))}):void(e[f]=b.isPlainObject(t[f])?M({},t[f]):t[f])}),e}function l(t){function e(t){return{valType:"string"}}function r(t,r,n){L.isValObject(t)?"data_array"===t.valType?(t.role="data",n[r+"src"]=e(r)):t.arrayOk===!0&&(n[r+"src"]=e(r)):b.isPlainObject(t)&&(t.role="object")}b.crawl(t,r)}function u(t){if("type"in t)return"area"===t.type?{attributes:x}:m.getModule({type:t.type});var e=m.subplotsRegistry,r=m.componentsRegistry,n=t._module;return e[n]?e[n]:r[n]?r[n]:v[n]}function c(t){return Object.keys(t).forEach(function(e){"_"===e.charAt(0)&&b.UNDERSCORE_ATTRS.indexOf(e)===-1&&delete t[e]}),t}function f(t){return"area"===t?{}:m.modules[t].meta||{}}function h(t){return w(t,{radialaxis:_.radialaxis,angularaxis:_.angularaxis}),w(t,_.layout),t}function d(t){if("area"===t)return{};var e=m.subplotsRegistry,r=Object.keys(e).filter(function(e){return m.traceIs({type:t},e)})[0];return void 0===r?{}:e[r]}function p(t){var e=m.subplotsRegistry;return Object.keys(t).forEach(function(r){Object.keys(e).forEach(function(n){var i,a=e[n];a.attrRegex&&(i="cartesian"===n||"gl2d"===n?a.attrRegex.x.test(r)||a.attrRegex.y.test(r):a.attrRegex.test(r),i&&(t[r][b.IS_SUBPLOT_OBJ]=!0))})}),t}function g(t){function e(t,e,r){if(t[b.IS_LINKED_TO_ARRAY]===!0){var n=e.substr(0,e.length-1);delete t[b.IS_LINKED_TO_ARRAY],r[e]={items:{}},r[e].items[n]=t,r[e].role="object"}}b.crawl(t,e)}var v=t("../plotly"),m=t("../registry"),y=t("../plots/plots"),b=t("../lib"),x=t("../plots/polar/area_attributes"),_=t("../plots/polar/axis_attributes"),w=b.extendFlat,A=b.extendDeep,M=b.extendDeepAll,k="_nestedModules",T="_composedModules",E={traces:{},layout:{},transforms:{},defs:{}},L=e.exports={};L.get=function(){return m.allTypes.concat("area").forEach(n),i(),Object.keys(m.transformsRegistry).forEach(a),o(),E},L.crawl=b.crawl,L.isValObject=b.isValObject},{"../lib":362,"../plotly":386,"../plots/plots":428,"../plots/polar/area_attributes":429,"../plots/polar/axis_attributes":430,"../registry":436}],381:[function(t,e,r){"use strict";function n(t){o.register(t,t.name,t.categories,t.meta),o.subplotsRegistry[t.basePlotModule.name]||o.registerSubplot(t.basePlotModule)}function i(t){if("string"!=typeof t.name)throw new Error("Transform module *name* must be a string.");var e="Transform module "+t.name,r="function"==typeof t.transform,n="function"==typeof t.calcTransform;if(!r&&!n)throw new Error(e+" is missing a *transform* or *calcTransform* method.");r&&n&&s.log([e+" has both a *transform* and *calcTransform* methods.","Please note that all *transform* methods are executed","before all *calcTransform* methods."].join(" ")),s.isPlainObject(t.attributes)||s.log(e+" registered without an *attributes* object."),"function"!=typeof t.supplyDefaults&&s.log(e+" registered without a *supplyDefaults* method."),o.transformsRegistry[t.name]=t}function a(t){o.componentsRegistry[t.name]=t}var o=t("../registry"),s=t("../lib");e.exports=function(t){if(!t)throw new Error("No argument passed to Plotly.register.");t&&!Array.isArray(t)&&(t=[t]);for(var e=0;e1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.td;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":362,"../plotly":386,"../snapshot/cloneplot":437,"../snapshot/helpers":440,"../snapshot/svgtoimg":442,"../snapshot/tosvg":444,"fast-isnumeric":82}],385:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;mu&&e=864e5?t._tickround="d":r>=36e5?t._tickround="H":r>=6e4?t._tickround="M":r>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(r/2)/Math.LN10);else{b(r)||(r=Number(r.substr(1))),t._tickround=2-Math.floor(Math.log(r)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var n=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(n)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((n-1)/3):t._tickexponent=n)}else"M"===r.charAt(0)?t._tickround=2===r.length?"m":"y":t._tickround=null}function o(t,e){var r=t.match(U),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(U,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a=e.x,s=t._tickround,l=new Date(a),u="";r&&t.hoverformat?i=o(t.hoverformat,a):t.tickformat?i=o(t.tickformat,a):(n&&(b(s)?s+=2:s={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[s]),"y"===s?i=I(l):"m"===s?i=z(l):(a!==t._tmin||r||(u="
"+I(l)),"d"===s?i=j(l):"H"===s?i=D(l):(a!==t._tmin||r||(u="
"+j(l)+", "+I(l)),i=F(l),"M"!==s&&(i+=B(l),"S"!==s&&(i+=h(m(a/1e3,1),t,"none",r).substr(1)))))),e.text=i+u}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&m(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,m(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=V[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===i){var p=n-1,g=n+1;r="tozero"===t.rangemode?n<0?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var r=T.list(t,"",!0),n=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=v-1;a>5;a--)i(a)}},T.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[a,o]};T.autoTicks(f,s);var h,d=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*x||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),a(t),t._tmin=T.tickFirst(t);var i=t.range[1]=s:l<=s)&&(o.push(l),!(o.length>1e3));l=T.tickIncrement(l,t.dtick,i));t._tmax=o[o.length-1];for(var u=new Array(o.length),c=0;c157788e5?(e/=315576e5,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,S)):e>12096e5?(e/=26298e5,t.dtick="M"+i(e,1,C)):e>432e5?(t.dtick=i(e,864e5,P),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=i(e,36e5,C):e>3e4?t.dtick=i(e,6e4,R):e>500?t.dtick=i(e,1e3,R):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,S));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var n=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/n,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,S)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,S));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var a=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(a)}},T.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?N:O,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]n:u1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("./clean_datum");e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../lib":362,"./clean_datum":395,"fast-isnumeric":82}],392:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),f=[],h=0;h0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],395:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return i.ms2DateTime(t);if("string"!=typeof t&&!n(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){i.error(e,t)}return t}},{"../../lib":362,"fast-isnumeric":82}],396:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],397:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?f.ms2DateTime(n,i):"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),b=t("./constants"),x=!0;e.exports=function(t,e,r,s,_,w,A,M){function k(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+vt+", "+mt+")").attr("d",ct+"Z"),pt=gt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+vt+", "+mt+")").attr("d","M0,0Z"),S();for(var a=0;a.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),pt.transition().style("opacity",1).duration(200),ft=!0)}function R(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),x=!1)))}function O(e,r){var i=1===(A+M).length;if(e)D();else if(2!==r||i){if(1===r&&i){var a=A?H[0]:V[0],o="s"===A||"w"===M?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",f="middle";if(a.fixedrange)return;A?(f="n"===A?"top":"bottom","right"===a.side&&(c="right")):"e"===M&&(c="right"),nt.call(h.makeEditable,null,{immediate:!0,background:B.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r="category"===a.type?a.c2l(e):a.d2l(e);void 0!==r&&u.relayout(t,s,r)})}}else j()}function N(e){function r(t,e,r){if(!t.fixedrange){T(t.range);var n=t.range,i=n[0]+(n[1]-n[0])*e;t.range=[i+(n[0]-i)*r,i+(n[1]-i)*r]}}if(t._context.scrollZoom||B._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(E(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(bt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void f.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=_t.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=yt[0]+yt[2]*l,c=(s.bottom-e.clientY)/s.height,h=yt[1]+yt[3]*(1-c);if(M){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,r){for(var n=1-e,a=0,o=0;o0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nW.width||Y<0||Y>W.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:M[0]._length/2,Y="ypx"in e?e.ypx:k[0]._length/2;if(R="xval"in e?n(a,e.xval):i(M,X),P="yval"in e?n(a,e.yval):i(k,Y),!g(R[0])||!g(P[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(N=0;N1||z.hoverinfo.indexOf("name")!==-1?z.name:void 0,index:!1,distance:Math.min(Z,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[j]&&(V.subplot=o[j]._subplot),H=q.length,"array"===F){var Q=e[N];"pointNumber"in Q?(V.index=Q.pointNumber,F="closest"):(F="","xval"in Q&&(B=Q.xval,F="x"),"yval"in Q&&(U=Q.yval,F=F?"closest":"y"))}else B=R[D],U=P[D];if(z._module&&z._module.hoverPoints){var $=z._module.hoverPoints(V,B,U,F);if($)for(var K,J=0;J<$.length;J++)K=$[J],g(K.x0)&&g(K.y0)&&q.push(l(K,C))}else v.log("Unrecognized trace type in hover:",z);"closest"===C&&q.length>H&&(q.splice(0,H),Z=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var tt="y"===C&&G.length>1;q.sort(function(t,e){return t.distance-e.distance});var et=b.combine(o.plot_bgcolor||b.background,o.paper_bgcolor),rt={hovermode:C,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(q,rt);c(q,tt?"xa":"ya"),f(nt,tt);var it=t._hoverdata,at=[];for(O=0;O128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):k&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0;r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0),v=h.node().getBoundingClientRect().width+2*P):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,E=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),N=E.width+R+P+v;t.ty0=_-E.top,t.bx=E.width+2*P,t.by=E.height+2*P,t.anchor="start",t.txwidth=E.width,t.tx2width=v,t.offset=0,a?(t.pos=L,m=S+O/2+N<=M,A=S-O/2-N>=0,"top"!==t.idealAlign&&m||!A?m?(S+=O/2,t.anchor="start"):t.anchor="middle":(S-=O/2,t.anchor="end")):(t.pos=S,m=L+C/2+N<=w,A=L-C/2-N>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(a?"rotate("+T+")":""))}),S}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?L:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var v=f[o];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(R+P),s=o+a*(t.txwidth+P),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-C,l=t.offset*S),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*R+l)+","+(R+u)+"v"+(t.by/2-R)+"h"+n*t.bx+"v-"+t.by+"H"+(n*R+l)+"V"+(u-R)+"Z"),i.call(x.setPosition,o+l,u+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+a*P+l,u+t.ty0-t.by/2+P),r.select("rect").call(x.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),M=t("./dragbox"),k=e.exports={};k.unhover=_.unhover,k.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},k.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,k.layoutAttributes,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=k.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},k.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},k.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},k.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":362,"fast-isnumeric":82}],404:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,M=i.xaxes[0]._length,k=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,R,P,O,N,I=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),z=[],j=i.gd,D=[];for(C=0;C0)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*c*Math.abs(n-i))}return o.BADNUM}function r(t){return Math.pow(10,t)}function u(t){return i(t)?Number(t):o.BADNUM}var c=10;if(t.c2l="log"===t.type?e:u,t.l2c="log"===t.type?r:u,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(e){var r,n=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var o=l.getFromId(t._gd,t.overlaying);t.domain=o.domain}var s=e&&t._r?t._r:t.range;for(s&&2===s.length&&s[0]!==s[1]||(s=[-1,1]),r=0;r<2;r++)i(s[r])||(s[r]=i(s[1-r])?s[1-r]*(r?10:.1):r?1:-1),s[r]<-(Number.MAX_VALUE/2)?s[r]=-(Number.MAX_VALUE/2):s[r]>Number.MAX_VALUE/2&&(s[r]=Number.MAX_VALUE/2); -if("y"===t._id.charAt(0)?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s[0]-s[1]),t._b=-t._m*s[1]):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s[1]-s[0]),t._b=-t._m*s[0]),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):o.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},["linear","log","-"].indexOf(t.type)!==-1)t.c2d=u,t.d2c=function(t){return t=s(t),i(t)?Number(t):o.BADNUM},t.d2l=function(e,r){return"log"===t.type?t.c2l(t.d2c(e),r):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return i(t)?a.ms2DateTime(t):o.BADNUM},t.d2c=function(t){return i(t)?Number(t):a.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(a.dateTime2ms);!i(t.range[0])&&i(f[0])&&(t.range[0]=f[0]),!i(t.range[1])&&i(f[1])&&(t.range[1]=f[1])}catch(e){a.error(e,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?o.BADNUM:r},t.d2l=t.d2c);t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;ar.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,b=[],x=c(e),_=Object.keys(x),w=f(y,_,x);if(!w.length)return!1;var A;u&&(A=u());var M,k,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),M=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":362,"../../plotly":386,"../../registry":436,"./axes":390,d3:74}],410:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;fMath.abs(e))n.rotate(o,0,0,-t*r*Math.PI*h.rotateSpeed/window.innerWidth);else{var s=-h.zoomSpeed*a*e/window.innerHeight*(o-n.lastT())/100;n.pan(o,0,0,u*(Math.exp(s)-1))}},!0),h}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":9,"mouse-change":178,"mouse-wheel":180,"right-now":214}],414:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<3;++r){var n=s[r];e[n]._gd=t}}var i=t("./scene"),a=t("../plots"),o=t("../../constants/xmlns_namespaces"),s=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,o=a.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var s=0;sh[1][o]?d[o]=1:h[1][o]===h[0][o]?d[o]=1:d[o]=1/(h[1][o]-h[0][o]);for(this.dataScale=d,a=0;ag[1][a])g[0][a]=-1,g[1][a]=1;else{var x=g[1][a]-g[0][a];g[0][a]-=x/32,g[1][a]+=x/32}}else{var w=c[T[a]].range;g[0][a]=w[0],g[1][a]=w[1]}g[0][a]===g[1][a]&&(g[0][a]-=1,g[1][a]+=1),v[a]=g[1][a]-g[0][a],this.glplot.bounds[0][a]=g[0][a]*d[a],this.glplot.bounds[1][a]=g[1][a]*d[a]}var A=[1,1,1];for(a=0;a<3;++a){l=c[T[a]],u=l.type;var M=y[u];A[a]=Math.pow(M.acc,1/M.count)/d[a]}var k,E=4; -if("auto"===c.aspectmode)k=Math.max.apply(null,A)/Math.min.apply(null,A)<=E?A:[1,1,1];else if("cube"===c.aspectmode)k=[1,1,1];else if("data"===c.aspectmode)k=A;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var L=c.aspectratio;k=[L.x,L.y,L.z]}c.aspectratio.x=f.aspectratio.x=k[0],c.aspectratio.y=f.aspectratio.y=k[1],c.aspectratio.z=f.aspectratio.z=k[2],this.glplot.aspect=k;var S=c.domain||null,C=e._size||null;if(S&&C){var R=this.container.style;R.position="absolute",R.left=C.l+S.x[0]*C.w+"px",R.top=C.t+(1-S.y[1])*C.h+"px",R.width=C.w*(S.x[1]-S.x[0])+"px",R.height=C.h*(S.y[1]-S.y[0])+"px"}this.glplot.redraw()}},k.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},k.setCameraToDefault=function(){this.setCamera({eye:{x:1.25,y:1.25,z:1.25},center:{x:0,y:0,z:0},up:{x:0,y:0,z:1}})},k.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},k.setCamera=function(t){var e={};e[this.id]=t,this.glplot.camera.lookAt.apply(this,l(t)),this.graphDiv.emit("plotly_relayout",e)},k.saveCamera=function(t){function e(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]]}var r=this.getCamera(),n=p.nestedProperty(t,this.id+".camera"),i=n.get(),a=!1;if(void 0===i)a=!0;else for(var o=0;o<3;o++)for(var s=0;s<3;s++)if(!e(r,i,o,s)){a=!0;break}return a&&n.set(r),a},k.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},k.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(c),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var a=0,o=n-1;a=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"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(r._initialAutoSizeIsDone){var u=r.width,f=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=f)}else{p.supplyLayoutGlobalDefaults(a,n);var h=!a.width||!a.height,d=n.autosize,g=t._context&&t._context.autosizable,v=h&&(d||g);v?p.plotAutoSize(t,a,n):h&&p.sanitizeMargins(t),!d&&h&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,n),n._has=p._hasPlotType.bind(n);var m=n._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),f=c.left+c.right,d=c.bottom+c.top,g=1-2*o,v=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(v.width-f)),i=Math.round(g*(v.height-d))}else{var m=l?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,i=parseFloat(m.height)||r.height}var y=p.layoutAttributes.width.min,b=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-i)>1;(_||x)&&(x&&(r.width=n),_&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r){var n,i;c.Axes.supplyLayoutDefaults(t,e,r);var a=e._basePlotModules;for(n=0;n.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,f=r.size,h=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(f*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(f-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var v=l[t].t.val,m=l[t].t.size;if(v>h){var y=(d*v+(m-e.height)*h)/(v-h),b=(m*(1-h)+(d-e.height)*(1-v))/(v-h);y>=0&&b>=0&&y+b>s+o&&(s=y,o=b)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):t&&t.getTime?h.ms2DateTime(t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)},p.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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,S=L?f.angularAxis.domain:n.extent(M),C=Math.abs(M[1]-M[0]);T&&!k&&(C=0);var R=S.slice();E&&k&&(R[1]+=C);var P=f.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),f.angularAxis.ticksStep&&(P=(R[1]-R[0])/P);var O=f.angularAxis.ticksStep||(R[1]-R[0])/(P*(f.minorTicks+1));A&&(O=Math.max(Math.round(O),1)),R[2]||(R[2]=O);var N=n.range.apply(this,R);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(R.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?C:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var I="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",z=(new DOMParser).parseFromString(I,"application/xml"),j=this.appendChild(this.ownerDocument.importNode(z.documentElement,!0));e=n.select(j)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var D,F=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},U={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){D=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:D,elements:V,reverseOrder:f.legend.reverseOrder})})();var H=D.node().getBBox();b=Math.min(f.width-H.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,b=Math.max(10,b),_=[f.margin.left+b,f.margin.top+b],i.range([0,b]),c.layout.radialAxis.domain=i.domain(),D.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else D=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var q=[(f.width-(f.margin.left+f.margin.right+2*b+(H?H.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2];if(q[0]=Math.max(0,q[0]),q[1]=Math.max(0,q[1]),e.select(".outer-group").attr("transform","translate("+q+")"),f.title){var G=e.select("g.title-group text").style(U).text(f.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var Y=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(i.ticks(5));W.enter().append("circle").attr({class:"grid-circle"}).style(B),W.attr("r",i),W.exit().remove()}Y.select("circle.outside-circle").attr({r:b}).style(B);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=n.svg.axis().scale(i).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Y.selectAll(".domain").style(B), -Y.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),K=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),K.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),K.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(U);var J=$.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+f.labelOffset,i=f.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:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":A?A[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(U);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));D.attr({transform:"translate("+[b+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!k){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;ot=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ct.text(o.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=i.invert(o.util.getMousePos(Z).radius);var n=o.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(o.util.round(st)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var i=n.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(u.t=A[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-q[0]-h.left,f.top+f.height/2-q[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.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")})})}),h}var e,r,i,s,l={data:[],layout:{}},u={},c={},f=n.dispatch("hover"),h={};return h.render=function(e){return t(e),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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return i},h.angularScale=function(t){return s},h.svg=function(){return e},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,i=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return i},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("undefined"==typeof 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 r===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=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 s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:h(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,i,a)},"stroke-width":function(t,e){return v["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,i,a)},opacity:function(t,e){return v.opacity(r,i,a)},display:function(t,e){return v.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var v={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},m=n.select(this).selectAll("g.layer").data(l);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],i=n.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=n.merge(i);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,f=c?r.height:u*o.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.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"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(o.length),v=n.scale[c?"linear":"ordinal"]().domain(g).range(l),m=n.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,m(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return v(e)}}),x.exit().remove()}var _=n.svg.axis().scale(m).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var n=t.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(f);var h=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[i.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=i.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};n.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../lib":362,d3:74}],433:[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,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(f=i),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(r),a.config(c).render(f),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,i,a,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},u.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":268,"../../lib":362,"./micropolar":432,"./undo_manager":434,d3:74}],434:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,u=t.layout,c=l([],a),f=l({},u,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(r=0;r0)s=f(t.alphahull,l);else{var u=["x","y","z"].indexOf(t.delaunayaxis);s=c(l.map(function(t){return[t[(u+1)%3],t[(u+2)%3]]}))}var p={positions:l,cells:s,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:d(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",p.vertexIntensity=t.intensity,p.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolors[0],p.vertexColors=a(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],p.cellColors=a(t.facecolor)):(this.color=t.color,p.meshColor=d(t.color)),this.mesh.update(p)},p.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=s},{"../../lib/str2rgbarray":375,"alpha-shape":14,"convex-hull":65,"delaunay-triangulate":75,"gl-mesh3d":126,tinycolor2:241}],448:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorbar/defaults"),a=t("./attributes");e.exports=function(t,e,r,o){function s(r,i){return n.coerce(t,e,a,r,i)}function l(t){var e=t.map(function(t){var e=s(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=l(["x","y","z"]),c=l(["i","j","k"]);return u?(c&&c.forEach(function(t){for(var e=0;ep&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var m={type:"linear"};i.setConvert(m),l=m.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},g.ppad=v.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,i.expand(c,h,g),i.expand(f,d,v);var x=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],455:[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,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=i.aggNums(Math.min,null,c)),n(h)||(h=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":271,"../../components/colorscale":283,"../../lib":362,"../../plots/plots":428,"fast-isnumeric":82}],456:[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":275,"../../components/colorscale/has_colorscale":282,"./subtypes":472}],457:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],458:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var v=s(t,e,g),m=vU!=O>=U&&(C=L[T-1][0],R=L[T][0],S=C+(R-C)*(U-P)/(O-P),j=Math.min(j,S),D=Math.max(D,S));j=Math.max(j,0),D=Math.min(D,h._length);var V=l.defaultLine;return l.opacity(f.fillcolor)?V=f.fillcolor:l.opacity((f.line||{}).color)&&(V=f.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:j,x1:D,y0:U,y1:U,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":268,"../../components/errorbars":298,"../../lib":362,"../../plots/cartesian/constants":396,"../../plots/cartesian/graph_interact":398,"./get_trace_color":460}],462:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":399,"./arrays_to_calcdata":451,"./attributes":452,"./calc":453,"./clean_data":454,"./colorbar":455,"./defaults":458,"./hover":461,"./plot":469,"./select":470,"./style":471,"./subtypes":472}],463:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":278,"../../components/colorscale/has_colorscale":282}],464:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),n=A.c2p(t[e].y);return r!==S&&n!==S&&[r,n]}function i(t){var e=t[0]/w._length,r=t[1]/A._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w=e.xaxis,A=e.yaxis,M=e.simplify,k=e.connectGaps,T=e.baseTolerance,E=e.linear,L=[],S=n.BADNUM,C=.2,R=new Array(t.length),P=0;for(M||(T=C=-1),o=0;oi(f))break;l=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,u=f,d=!1):y=t.length||!f)break;R[P++]=f,s=f}}else R[P++]=u}L.push(R.slice(0,P))}return L}},{"../../plots/cartesian/axes":390}],465:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],466:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":82}],468:[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){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":268,"../../components/colorscale/defaults":278,"../../components/colorscale/has_colorscale":282,"./subtypes":472}],469:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function i(t,e,r,n,i,d,g){function v(t){return M?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function b(t){if(t.ids)return y}function x(){return!1}function _(t){var e,r,n=t[0].trace,i=o.select(this),a=c.hasMarkers(n),u=c.hasText(n),f=b(n),h=x,d=x;a&&(h=n.marker.maxdisplayed?m:s.identity),u&&(d=n.marker.maxdisplayed?m:s.identity),r=i.selectAll("path.point"),e=r.data(h,f);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,n).call(l.translatePoints,k,T,n),M&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=v(o.select(this));l.translatePoint(t,e,k,T),l.singlePointStyle(t,e,n)}),M?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=i.selectAll("g"),e=r.data(d,f),e.enter().append("g").append("text"),e.each(function(t){var e=v(o.select(this).select("text"));l.translatePoint(t,e,k,T)}),e.selectAll("text").call(l.textPointStyle,n).each(function(t){var e=t.xp||k.c2p(t.x),r=t.yp||T.c2p(t.y);o.select(this).selectAll("tspan").each(function(){v(o.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,A;a(t,e,r,n,i);var M=!!g&&g.duration>0,k=r.xaxis,T=r.yaxis,E=n[0].trace,L=E.line,S=o.select(d);if(S.call(u.plot,r,g),E.visible===!0){var C,R,P=E.fill.charAt(E.fill.length-1);"x"!==P&&"y"!==P&&(P=""),n[0].node3=S,f(n);var O="",N=[],I=E._prevtrace;I&&(O=I._prevRevpath||"",R=I._nextFill,N=I._polygons);var z,j,D,F,B,U,V,H,q,G="",X="",Y=[],W=[],Z=s.noop;if(C=E._ownFill,c.hasLines(E)||"none"!==E.fill){for(R&&R.datum(n),["hv","vh","hvh","vhv"].indexOf(L.shape)!==-1?(D=l.steps(L.shape),F=l.steps(L.shape.split("").reverse().join(""))):D=F="spline"===L.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),L.smoothing):l.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return F(t.reverse())},Y=h(n,{xaxis:k,yaxis:T,connectGaps:E.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),q=E._polygons=new Array(Y.length),A=0;A1}),Z=function(t){return function(e){if(z=D(e),j=B(e),G?P?(G+="L"+z.substr(1),X=j+("L"+X.substr(1))):(G+="Z"+z,X=j+"Z"+X):(G=z,X=j),c.hasLines(E)&&e.length>1){var r=o.select(this);if(r.datum(n),t)v(r.style("opacity",0).attr("d",z).call(l.lineGroupStyle)).style("opacity",1);else{var i=v(r);i.attr("d",z),l.singleLineStyle(n,i)}}}}}var Q=S.selectAll(".js-line").data(W);v(Q.exit()).style("opacity",0).remove(),Q.each(Z(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Z(!0)),Y.length&&(C?U&&H&&(P?("y"===P?U[1]=H[1]=T.c2p(0,!0):"x"===P&&(U[0]=H[0]=k.c2p(0,!0)),v(C).attr("d","M"+H+"L"+U+"L"+G.substr(1))):v(C).attr("d",G+"Z")):"tonext"===E.fill.substr(0,6)&&G&&O&&("tonext"===E.fill?v(R).attr("d",G+"Z"+O+"Z"):v(R).attr("d",G+"L"+O.substr(1)+"Z"),E._polygons=E._polygons.concat(N)),E._prevRevpath=X,E._prevPolygons=q);var $=S.selectAll(".points");w=$.data([n]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,s=r.yaxis,l=o.extent(a.range.map(a.l2c)),u=o.extent(s.range.map(s.l2c)),f=n[0].trace;if(c.hasMarkers(f)){var h=f.marker.maxdisplayed;if(0!==h){var d=n.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/h),g=0;i.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),f=c.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,r),n(t,p),l=0,u=[];ln?1:-1}),v){s&&(h=s());var m=o.transition().duration(a.duration).ease(a.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()});m.each(function(){p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)})})}else p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":292,"../../components/errorbars":298,"../../lib":362,"../../lib/polygon":369,"./arrays_to_calcdata":451,"./line_points":464,"./link_traces":466,"./subtypes":472,d3:74}],470:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,g=!n.hasMarkers(h)&&!n.hasText(h);if(h.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return A[t]}function u(t,e,r,n,i){var a=null;if(Array.isArray(t)){a=[];for(var o=0;o=0){var h=i(l.position,l.delaunayColor,l.delaunayAxis);h.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(h):(h.gl=o,this.delaunayMesh=v(h),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},k.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=h},{"../../constants/gl3d_dashes":349,"../../constants/gl_markers":350,"../../lib":362,"../../lib/gl_format_color":360,"../../lib/str2rgbarray":375,"../scatter/make_bubble_size_func":467,"./calc_errors":477,"delaunay-triangulate":75,"gl-error3d":98,"gl-line3d":103,"gl-mesh3d":126,"gl-scatter3d":132}],479:[function(t,e,r){"use strict";function n(t,e,r){var n=0,i=r("x"),a=r("y"),o=r("z");return i&&a&&o&&(n=Math.min(i.length,a.length,o.length),n=0&&h("surfacecolor",p||g);for(var v=["x","y","z"],m=0;m<3;++m){var y="projection."+v[m];h(y+".show")&&(h(y+".opacity"),h(y+".scale"))}u(t,e,r,{axis:"z"}),u(t,e,r,{axis:"y",inherit:"z"}),u(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":297,"../../lib":362,"../scatter/line_defaults":463,"../scatter/marker_defaults":468,"../scatter/subtypes":472,"../scatter/text_defaults":473,"./attributes":475}],480:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl_markers":350,"../../plots/gl3d":414,"../scatter/colorbar":455,"./attributes":475,"./calc":476,"./convert":478,"./defaults":479}],481:[function(t,e,r){"use strict";function n(t){return{valType:"boolean",dflt:!1}}function i(t){return{show:{valType:"boolean",dflt:!1},project:{x:n("x"),y:n("y"),z:n("z")},color:{valType:"color",dflt:a.defaultLine},usecolormap:{valType:"boolean",dflt:!1},width:{valType:"number",min:1,max:16,dflt:2},highlight:{valType:"boolean",dflt:!0},highlightcolor:{valType:"color",dflt:a.defaultLine},highlightwidth:{valType:"number",min:1,max:16,dflt:2}}}var a=t("../../components/color"),o=t("../../components/colorscale/attributes"),s=t("../../lib/extend").extendFlat;e.exports={z:{valType:"data_array"},x:{valType:"data_array"},y:{valType:"data_array"},text:{valType:"data_array"},surfacecolor:{valType:"data_array"},cauto:o.zauto,cmin:o.zmin,cmax:o.zmax,colorscale:o.colorscale,autocolorscale:s({},o.autocolorscale,{dflt:!1}),reversescale:o.reversescale,showscale:o.showscale,contours:{x:i("x"),y:i("y"),z:i("z")},hidesurface:{valType:"boolean",dflt:!1},lightposition:{x:{valType:"number",min:-1e5,max:1e5,dflt:10},y:{valType:"number",min:-1e5,max:1e5,dflt:1e4},z:{valType:"number",min:-1e5,max:1e5,dflt:0}},lighting:{ambient:{valType:"number",min:0,max:1,dflt:.8},diffuse:{valType:"number",min:0,max:1,dflt:.8},specular:{valType:"number",min:0,max:2,dflt:.05},roughness:{valType:"number",min:0,max:1,dflt:.5},fresnel:{valType:"number",min:0,max:5,dflt:.2}},opacity:{valType:"number",min:0,max:1,dflt:1},_nestedModules:{colorbar:"Colorbar"},_deprecated:{zauto:s({},o.zauto,{}),zmin:s({},o.zmin,{}),zmax:s({},o.zmax,{})}}},{"../../components/color":268,"../../components/colorscale/attributes":274,"../../lib/extend":358}],482:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){e.surfacecolor?n(e,e.surfacecolor,"","c"):n(e,e.z,"","c")}},{"../../components/colorscale/calc":275}],483:[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="cb"+r.uid,u=r.cmin,c=r.cmax,f=r.surfacecolor||r.z;if(n(u)||(u=i.aggNums(Math.min,null,f)),n(c)||(c=i.aggNums(Math.max,null,f)),t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void a.autoMargin(t,l);var h=e[0].t.cb=s(t,l),d=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});h.fillcolor(d).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":271,"../../components/colorscale":283,"../../lib":362,"../../plots/plots":428,"fast-isnumeric":82}],484:[function(t,e,r){"use strict";function n(t,e,r){this.scene=t,this.uid=r,this.surface=e,this.data=null,this.showContour=[!1,!1,!1],this.dataScale=1}function i(t,e){return void 0===e&&(e=1),t.map(function(t){var r=t[0],n=p(t[1]),i=n.toRgb();return{index:r,rgb:[i.r,i.g,i.b,e]}})}function a(t){var e=t[0].rgb,r=t[t.length-1].rgb;return e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]&&e[3]===r[3]}function o(t){var e=t.shape,r=[e[0]+2,e[1]+2],n=c(new Float32Array(r[0]*r[1]),r);return d.assign(n.lo(1,1).hi(e[0],e[1]),t),d.assign(n.lo(1).hi(e[0],1),t.hi(e[0],1)),d.assign(n.lo(1,r[1]-1).hi(e[0],1),t.lo(0,e[1]-1).hi(e[0],1)),d.assign(n.lo(0,1).hi(1,e[1]),t.hi(1)),d.assign(n.lo(r[0]-1,1).hi(1,e[1]),t.lo(e[0]-1)),n.set(0,0,t.get(0,0)),n.set(0,r[1]-1,t.get(0,e[1]-1)),n.set(r[0]-1,0,t.get(e[0]-1,0)),n.set(r[0]-1,r[1]-1,t.get(e[0]-1,e[1]-1)),n}function s(t){var e=Math.max(t[0].shape[0],t[0].shape[1]);if(e=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=No.get(t);return u&&(t=u,l=Q),s?e?i:n:e?A:a}function Z(t,e){return function(r){var n=uo.event;uo.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.event=n}}}function Q(t,e){var r=Z(t,e);return function(t){var e=this,n=t.relatedTarget;n&&(n===e||8&n.compareDocumentPosition(e))||r.call(e,t)}}function $(t){var r=".dragsuppress-"+ ++Io,i="click"+r,a=uo.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Oo&&(Oo=!("onselectstart"in t)&&w(t.style,"userSelect")),Oo){var o=e(t).style,s=o[Oo];o[Oo]="none"}return function(t){if(a.on(r,null),Oo&&(o[Oo]=s),t){var e=function(){a.on(i,null)};a.on(i,function(){T(),e()},!0),setTimeout(e,0)}}}function K(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(zo<0){var a=n(t);if(a.scrollX||a.scrollY){r=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();zo=!(o.f||o.e),r.remove()}}return zo?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function J(){return uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function rt(t){return t>1?0:t<-1?Fo:Math.acos(t)}function nt(t){return t>1?Vo:t<-1?-Vo:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function at(t){return((t=Math.exp(t))+1/t)/2}function ot(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ut(t,e,r){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):At(""+t,Mt,ut):new ut(t,e,r)}function ct(t,e,r){function n(t){return t>360?t-=360:t<0&&(t+=360),t<60?a+(o-a)*t/60:t<180?o:t<240?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*n(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,o=r<=.5?r*(1+e):r+e-r*e,a=2*r-o,new bt(i(t+120),i(t),i(t-120))}function ft(t,e,r){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof dt?gt(t.l,t.a,t.b):gt((t=kt((t=uo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,r)}function ht(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(r,Math.cos(t*=Ho)*e,Math.sin(t)*e)}function dt(t,e,r){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof ft?ht(t.h,t.c,t.l):kt((t=bt(t)).r,t.g,t.b):new dt(t,e,r)}function pt(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return i=vt(i)*ts,n=vt(n)*es,a=vt(a)*rs,new bt(yt(3.2404542*i-1.5371385*n-.4985314*a),yt(-.969266*i+1.8760108*n+.041556*a),yt(.0556434*i-.2040259*n+1.0572252*a))}function gt(t,e,r){return t>0?new ft(Math.atan2(r,e)*qo,Math.sqrt(e*e+r*r),t):new ft(NaN,NaN,t)}function vt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function mt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function bt(t,e,r){return this instanceof bt?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof bt?new bt(t.r,t.g,t.b):At(""+t,bt,ct):new bt(t,e,r)}function xt(t){return new bt(t>>16,t>>8&255,255&t)}function _t(t){return xt(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function At(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(Et(i[0]),Et(i[1]),Et(i[2]))}return(a=as.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 Mt(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 kt(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=mt((.4124564*t+.3575761*e+.1804375*r)/ts),i=mt((.2126729*t+.7151522*e+.072175*r)/es),a=mt((.0193339*t+.119192*e+.9503041*r)/rs);return dt(116*i-16,500*(n-i),200*(i-a))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Et(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Lt(t){return"function"==typeof t?t:function(){return t}}function St(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),Ct(e,r,t,n)}}function Ct(t,e,r,n){function i(){var t,e=l.status;if(!e&&Rt(l)||e>=200&&e<300||304===e){try{t=r.call(a,l)}catch(t){return void o.error.call(a,t)}o.load.call(a,t)}else o.error.call(a,l)}var a={},o=uo.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=uo.event;uo.event=t;try{o.progress.call(a,l)}finally{uo.event=e}},a.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",a)},a.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",a):e},a.responseType=function(t){return arguments.length?(u=t,a):u},a.response=function(t){return r=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(fo(arguments)))}}),a.send=function(r,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),l.open(r,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=u&&(l.responseType=u),null!=i&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==n?null:n),a},a.abort=function(){return l.abort(),a},uo.rebind(a,o,"on"),null==n?a:a.get(Pt(n))}function Pt(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function Rt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Nt(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var i=r+e,a={c:t,t:i,n:null};return ss?ss.n=a:os=a,ss=a,ls||(us=clearTimeout(us),ls=1,cs(Ot)),a}function Ot(){var t=It(),e=zt()-t;e>24?(isFinite(e)&&(clearTimeout(us),us=setTimeout(Ot,e)),ls=0):(ls=1,cs(Ot))}function It(){for(var t=Date.now(),e=os;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function zt(){for(var t,e=os,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Ft(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,a=n&&r?function(t,e){for(var i=t.length,a=[],o=0,s=n[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=n[o=(o+1)%n.length];return a.reverse().join(r)}:x;return function(t){var r=hs.exec(t),n=r[1]||" ",o=r[2]||">",s=r[3]||"-",l=r[4]||"",u=r[5],c=+r[6],f=r[7],h=r[8],d=r[9],p=1,g="",v="",m=!1,y=!0;switch(h&&(h=+h.substring(1)),(u||"0"===n&&"="===o)&&(u=n="0",o="="),d){case"n":f=!0,d="g";break;case"%":p=100,v="%",d="f";break;case"p":p=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":y=!1;case"d":m=!0,h=0;break;case"s":p=-1,d="r"}"$"===l&&(g=i[0],v=i[1]),"r"!=d||h||(d="g"),null!=h&&("g"==d?h=Math.max(1,Math.min(21,h)):"e"!=d&&"f"!=d||(h=Math.max(0,Math.min(20,h)))),d=ds.get(d)||Bt;var b=u&&f;return function(t){var r=v;if(m&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=uo.formatPrefix(t,h);t=l.scale(t),r=l.symbol+v}else t*=p;t=d(t,h);var x,_,w=t.lastIndexOf(".");if(w<0){var A=y?t.lastIndexOf("e"):-1;A<0?(x=t,_=""):(x=t.substring(0,A),_=t.substring(A))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&f&&(x=a(x,1/0));var M=g.length+x.length+_.length+(b?0:i.length),k=M"===o?k+i+t:"^"===o?k.substring(0,M>>=1)+i+t+k.substring(M):i+(b?t:k+t))+r}}}function Bt(t){return t+""}function Ut(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Vt(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o=u)return-1;if(i=e.charCodeAt(s++),37===i){if(o=e.charAt(s++),a=S[o in ms?e.charAt(s++):o],!a||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}function n(t,e,r){w.lastIndex=0;var n=w.exec(e.slice(r));return n?(t.w=A.get(n[0].toLowerCase()),r+n[0].length):-1}function i(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=E.get(n[0].toLowerCase()),r+n[0].length):-1}function o(t,e,r){M.lastIndex=0;var n=M.exec(e.slice(r));return n?(t.m=k.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,L.c.toString(),e,n)}function l(t,e,n){return r(t,L.x.toString(),e,n)}function u(t,e,n){return r(t,L.X.toString(),e,n)}function c(t,e,r){var n=b.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)}var f=t.dateTime,h=t.date,d=t.time,p=t.periods,g=t.days,v=t.shortDays,m=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{gs=Ut;var e=new gs;return e._=t,n(e)}finally{gs=Date}}var n=e(t);return r.parse=function(t){try{gs=Ut;var e=n.parse(t);return e&&e._}finally{gs=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Xt(g),_=Wt(g),w=Xt(v),A=Wt(v),M=Xt(m),k=Wt(m),T=Xt(y),E=Wt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var L={a:function(t){return v[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return m[t.getMonth()]},c:e(f),d:function(t,e){return Gt(t.getDate(),e,2)},e:function(t,e){return Gt(t.getDate(),e,2)},H:function(t,e){return Gt(t.getHours(),e,2)},I:function(t,e){return Gt(t.getHours()%12||12,e,2)},j:function(t,e){return Gt(1+ps.dayOfYear(t),e,3)},L:function(t,e){return Gt(t.getMilliseconds(),e,3)},m:function(t,e){return Gt(t.getMonth()+1,e,2)},M:function(t,e){return Gt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Gt(t.getSeconds(),e,2)},U:function(t,e){return Gt(ps.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(ps.mondayOfYear(t),e,2)},x:e(h),X:e(d),y:function(t,e){return Gt(t.getFullYear()%100,e,2)},Y:function(t,e){return Gt(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},S={a:n,A:i,b:a,B:o,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:ae,p:c,S:oe,U:Zt,w:Yt,W:Qt,x:l,X:u,y:Kt,Y:$t,Z:Jt,"%":ue};return e}function Gt(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3)}function ee(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ae(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function le(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=xo(e)/60|0,i=xo(e)%60;return r+Gt(n,"0",2)+Gt(i,"0",2)}function ue(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function ce(t){for(var e=t.length,r=-1;++r=0?1:-1,s=o*r,l=Math.cos(e),u=Math.sin(e),c=a*u,f=i*l+c*Math.cos(s),h=c*o*Math.sin(s);ks.add(Math.atan2(h,f)),n=t,i=l,a=u}var e,r,n,i,a;Ts.point=function(o,s){Ts.point=t,n=(e=o)*Ho,i=Math.cos(s=(r=s)*Ho/2+Fo/4),a=Math.sin(s)},Ts.lineEnd=function(){t(e,r)}}function me(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function be(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function xe(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Ae(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function Me(t,e){return xo(t[0]-e[0])=0;--s)i.point((f=c[s])[0],f[1])}else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);i.lineEnd()}}}function Ne(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n0){for(_||(a.polygonStart(),_=!0),a.lineStart();++o1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(ze))}var d,p,g,v=e(a),m=i.invert(n[0],n[1]),y={point:o,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=f,y.lineEnd=h,d=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=l,y.lineEnd=u,d=uo.merge(d);var t=Ve(m,p);d.length?(_||(a.polygonStart(),_=!0),Re(d,De,t,r,a)):t&&(_||(a.polygonStart(),_=!0),a.lineStart(),r(null,null,1,a),a.lineEnd()),_&&(a.polygonEnd(),_=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),r(null,null,1,a),a.lineEnd(),a.polygonEnd()}},b=je(),x=e(b),_=!1;return y}}function ze(t){return t.length>1}function je(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:A,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function De(t,e){return((t=t.x)[0]<0?t[1]-Vo-jo:Vo-t[1])-((e=e.x)[0]<0?e[1]-Vo-jo:Vo-e[1])}function Fe(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?Fo:-Fo,l=xo(a-r);xo(l-Fo)0?Vo:-Vo),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=Fo&&(xo(r-i)jo?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}function Ue(t,e,r,n){var i;if(null==t)i=r*Vo,n.point(-Fo,i),n.point(0,i),n.point(Fo,i),n.point(Fo,0),n.point(Fo,-i),n.point(0,-i),n.point(-Fo,-i),n.point(-Fo,0),n.point(-Fo,i);else if(xo(t[0]-e[0])>jo){var a=t[0]=0?1:-1,A=w*_,M=A>Fo,k=p*b;if(ks.add(Math.atan2(k*w*Math.sin(A),g*x+k*Math.cos(A))),a+=M?_+w*Bo:_,M^h>=r^m>=r){var T=be(me(f),me(t));we(T);var E=be(i,T);we(E);var L=(M^_>=0?-1:1)*nt(E[2]);(n>L||n===L&&(T[0]||T[1]))&&(o+=M^_>=0?1:-1)}if(!v++)break;h=m,p=b,g=x,f=t}}return(a<-jo||aa}function r(t){var r,a,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],g=e(f,h),v=o?g?0:i(f,h):g?i(f+(f<0?Fo:-Fo),h):0;if(!r&&(u=l=g)&&t.lineStart(),g!==l&&(d=n(r,p),(Me(r,d)||Me(p,d))&&(p[0]+=jo,p[1]+=jo,g=e(p[0],p[1]))),g!==l)c=0,g?(t.lineStart(),d=n(p,r),t.point(d[0],d[1])):(d=n(r,p),t.point(d[0],d[1]),t.lineEnd()),r=d;else if(s&&r&&o^g){var m;v&a||!(m=n(p,r,!0))||(c=0,o?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||r&&Me(r,p)||t.point(p[0],p[1]),r=p,l=g,a=v},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=me(t),i=me(e),o=[1,0,0],s=be(n,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var f=a*l/c,h=-a*u/c,d=be(o,s),p=_e(o,f),g=_e(s,h);xe(p,g);var v=d,m=ye(p,v),y=ye(v,v),b=m*m-y*(ye(p,p)-1);if(!(b<0)){var x=Math.sqrt(b),_=_e(v,(-m-x)/y);if(xe(_,p),_=Ae(_),!r)return _;var w,A=t[0],M=e[0],k=t[1],T=e[1];M0^_[1]<(xo(_[0]-A)Fo^(A<=_[0]&&_[0]<=M)){var C=_e(v,(-m+x)/y);return xe(C,p),[_,Ae(C)]}}}function i(e,r){var n=o?t:Fo-t,i=0;return e<-n?i|=1:e>n&&(i|=2),r<-n?i|=4:r>n&&(i|=8),i}var a=Math.cos(t),o=a>0,s=xo(a)>jo,l=vr(t,6*Ho);return Ie(e,r,l,o?[0,-t]:[-Fo,t-Fo])}function qe(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=s.x,f=s.y,h=0,d=1,p=c-l,g=f-u;if(a=t-l,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=r-l,p||!(a<0)){if(a/=p,p<0){if(a>d)return;a>h&&(h=a)}else if(p>0){if(a0)){if(a/=g,g<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=n-u,g||!(a<0)){if(a/=g,g<0){if(a>d)return;a>h&&(h=a)}else if(g>0){if(a0&&(i.a={x:l+h*p,y:u+h*g}),d<1&&(i.b={x:l+d*p,y:u+d*g}),i}}}}}}function Ge(t,e,r,n){function i(n,i){return xo(n[0]-t)0?0:3:xo(n[0]-r)0?2:1:xo(n[1]-e)0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(t,e){var r=i(t,1),n=i(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,r=v.length,n=t[1],i=0;in&&et(u,a,t)>0&&++e:a[1]<=n&&et(u,a,t)<0&&--e,u=a;return 0!==e}function u(a,s,l,u){var c=0,f=0;if(null==a||(c=i(a,l))!==(f=i(s,l))||o(a,s)<0^l>0){do u.point(0===c||3===c?t:r,c>1?n:e);while((c=(c+l+4)%4)!==f)}else u.point(s[0],s[1])}function c(i,a){return t<=i&&i<=r&&e<=a&&a<=n}function f(t,e){c(t,e)&&s.point(t,e)}function h(){S.point=p,v&&v.push(m=[]),M=!0,A=!1,_=w=NaN}function d(){g&&(p(y,b),x&&A&&E.rejoin(),g.push(E.buffer())),S.point=f,A&&s.lineEnd()}function p(t,e){t=Math.max(-Bs,Math.min(Bs,t)),e=Math.max(-Bs,Math.min(Bs,e));var r=c(t,e);if(v&&m.push([t,e]),M)y=t,b=e,x=r,M=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&A)s.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};L(n)?(A||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),k=!1):r&&(s.lineStart(),s.point(t,e),k=!1)}_=t,w=e,A=r}var g,v,m,y,b,x,_,w,A,M,k,T=s,E=je(),L=qe(t,e,r,n),S={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=E,g=[],v=[],k=!0},polygonEnd:function(){s=T,g=uo.merge(g);var e=l([t,n]),r=k&&e,i=g.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Re(g,a,e,u,s),s.polygonEnd()),g=v=m=null}};return S}}function Xe(t){var e=0,r=Fo/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Fo/180,r=t[1]*Fo/180):[e/Fo*180,r/Fo*180]},i}function We(t,e){function r(t,e){var r=Math.sqrt(a-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),o-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,a=1+n*(2*i-n),o=Math.sqrt(a)/i;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,nt((a-(t*t+r*r)*i*i)/(2*i))]},r}function Ye(){function t(t,e){Vs+=i*t-n*e,n=t,i=e}var e,r,n,i;Ws.point=function(a,o){Ws.point=t,e=n=a,r=i=o},Ws.lineEnd=function(){t(e,r)}}function Ze(t,e){tGs&&(Gs=t),eXs&&(Xs=e)}function Qe(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=r}function r(t,e){o.push("L",t,",",e)}function n(){s.point=t}function i(){o.push("Z")}var a=$e(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return a=$e(t),s},result:function(){if(o.length){var t=o.join("");return o=[],t}}};return s}function $e(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ke(t,e){Ss+=t,Cs+=e,++Ps}function Je(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);Rs+=o*(e+t)/2,Ns+=o*(r+n)/2,Os+=o,Ke(e=t,r=n)}var e,r;Zs.point=function(n,i){Zs.point=t,Ke(e=n,r=i)}}function tr(){Zs.point=Ke}function er(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Rs+=o*(n+t)/2,Ns+=o*(i+e)/2,Os+=o,o=i*t-n*e,Is+=o*(n+t),zs+=o*(i+e),js+=3*o,Ke(n=t,i=e)}var e,r,n,i;Zs.point=function(a,o){Zs.point=t,Ke(e=n=a,r=i=o)},Zs.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+o,r),t.arc(e,r,o,0,Bo)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function i(){s.point=e}function a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:i,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return o=t,s},result:A};return s}function nr(t){function e(t){return(s?n:r)(t)}function r(e){return or(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})}function n(e){function r(r,n){r=t(r,n),e.point(r[0],r[1])}function n(){b=NaN,M.point=a,e.lineStart()}function a(r,n){var a=me([r,n]),o=t(r,n);i(b,x,y,_,w,A,b=o[0],x=o[1],y=r,_=a[0],w=a[1],A=a[2],s,e),e.point(b,x)}function o(){M.point=r,e.lineEnd()}function l(){n(),M.point=u,M.lineEnd=c}function u(t,e){a(f=t,h=e),d=b,p=x,g=_,v=w,m=A,M.point=a}function c(){i(b,x,y,_,w,A,d,p,f,g,v,m,s,e),M.lineEnd=o,o()}var f,h,d,p,g,v,m,y,b,x,_,w,A,M={point:r,lineStart:n,lineEnd:o,polygonStart:function(){e.polygonStart(),M.lineStart=l},polygonEnd:function(){e.polygonEnd(),M.lineStart=n}};return M}function i(e,r,n,s,l,u,c,f,h,d,p,g,v,m){var y=c-e,b=f-r,x=y*y+b*b;if(x>4*a&&v--){var _=s+d,w=l+p,A=u+g,M=Math.sqrt(_*_+w*w+A*A),k=Math.asin(A/=M),T=xo(xo(A)-1)a||xo((y*C+b*P)/x-.5)>.3||s*d+l*p+u*g0&&16,e):Math.sqrt(a)},e}function ir(t){var e=nr(function(e,r){return t([e*qo,r*qo])});return function(t){return ur(e(t))}}function ar(t){this.stream=t}function or(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function sr(t){return lr(function(){return t})()}function lr(t){function e(t){return t=s(t[0]*Ho,t[1]*Ho),[t[0]*h+l,u-t[1]*h]}function r(t){return t=s.invert((t[0]-l)/h,(u-t[1])/h),t&&[t[0]*qo,t[1]*qo]}function n(){s=Ce(o=hr(m,y,b),a);var t=a(g,v);return l=d-t[0]*h,u=p+t[1]*h,i()}function i(){return c&&(c.valid=!1,c=null),e}var a,o,s,l,u,c,f=nr(function(t,e){return t=a(t,e),[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,g=0,v=0,m=0,y=0,b=0,_=Fs,w=x,A=null,M=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(o,f(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(A=t,Fs):He((A=+t)*Ho),i()):A},e.clipExtent=function(t){return arguments.length?(M=t, +w=t?Ge(t[0][0],t[0][1],t[1][0],t[1][1]):x,i()):M},e.scale=function(t){return arguments.length?(h=+t,n()):h},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],n()):[d,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Ho,v=t[1]%360*Ho,n()):[g*qo,v*qo]},e.rotate=function(t){return arguments.length?(m=t[0]%360*Ho,y=t[1]%360*Ho,b=t.length>2?t[2]%360*Ho:0,n()):[m*qo,y*qo,b*qo]},uo.rebind(e,f,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&r,n()}}function ur(t){return or(t,function(e,r){t.point(e*Ho,r*Ho)})}function cr(t,e){return[t,e]}function fr(t,e){return[t>Fo?t-Bo:t<-Fo?t+Bo:t,e]}function hr(t,e,r){return t?e||r?Ce(pr(t),gr(e,r)):pr(t):e||r?gr(e,r):fr}function dr(t){return function(e,r){return e+=t,[e>Fo?e-Bo:e<-Fo?e+Bo:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function gr(t,e){function r(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*n+s*i;return[Math.atan2(l*a-c*o,s*n-u*i),nt(c*a+l*o)]}var n=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*a-l*o;return[Math.atan2(l*a+u*o,s*n+c*i),nt(c*n-s*i)]},r}function vr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=mr(r,i),a=mr(r,a),(o>0?ia)&&(i+=o*Bo)):(i=t+o*Bo,a=t-.5*l);for(var u,c=i;o>0?c>a:c0?e<-Vo+jo&&(e=-Vo+jo):e>Vo-jo&&(e=Vo-jo);var r=o/Math.pow(i(e),a);return[r*Math.sin(a*t),o-r*Math.cos(a*t)]}var n=Math.cos(t),i=function(t){return Math.tan(Fo/4+t/2)},a=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),o=n*Math.pow(i(t),a)/a;return a?(r.invert=function(t,e){var r=o-e,n=tt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(o/n,1/a))-Vo]},r):Er}function Tr(t,e){function r(t,e){var r=a-e;return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),a=n/i+t;return xo(i)1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Nr(t,e){return t[0]-e[0]||t[1]-e[1]}function Or(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Ir(t,e,r,n){var i=t[0],a=r[0],o=e[0]-i,s=n[0]-a,l=t[1],u=r[1],c=e[1]-l,f=n[1]-u,h=(s*(l-u)-f*(i-a))/(f*o-s*c);return[i+h*o,l+h*c]}function zr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function jr(){an(this),this.edge=this.site=this.circle=null}function Dr(t){var e=ul.pop()||new jr;return e.site=t,e}function Fr(t){Zr(t),ol.remove(t),ul.push(t),an(t)}function Br(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},a=t.P,o=t.N,s=[t];Fr(t);for(var l=a;l.circle&&xo(r-l.circle.x)jo)s=s.L;else{if(i=a-Hr(s,o),!(i>jo)){n>-jo?(e=s.P,r=s):i>-jo?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=Dr(t);if(ol.insert(e,l),e||r){if(e===r)return Zr(e),r=Dr(e.site),ol.insert(l,r),l.edge=r.edge=Jr(e.site,l.site),Yr(e),void Yr(r);if(!r)return void(l.edge=Jr(e.site,l.site));Zr(e),Zr(r);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=r.site,g=p.x-c,v=p.y-f,m=2*(h*v-d*g),y=h*h+d*d,b=g*g+v*v,x={x:(v*y-d*b)/m+c,y:(h*b-g*y)/m+f};en(r.edge,u,p,x),l.edge=Jr(u,t,null,x),r.edge=Jr(t,p,null,x),Yr(e),Yr(r)}}function Vr(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);r=o.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,f=1/a-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+i-a/2)))/f+n:(n+s)/2}function Hr(t,e){var r=t.N;if(r)return Vr(r,e);var n=t.site;return n.y===e?n.x:1/0}function qr(t){this.site=t,this.edges=[]}function Gr(t){for(var e,r,n,i,a,o,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],g=al,v=g.length;v--;)if(a=g[v],a&&a.prepare())for(s=a.edges,l=s.length,o=0;ojo||xo(i-r)>jo)&&(s.splice(o,0,new rn(tn(a.site,c,xo(n-f)jo?{x:f,y:xo(e-f)jo?{x:xo(r-p)jo?{x:h,y:xo(e-h)jo?{x:xo(r-d)=-Do)){var d=l*l+u*u,p=c*c+f*f,g=(f*d-u*p)/h,v=(l*p-c*d)/h,f=v+s,m=cl.pop()||new Wr;m.arc=t,m.site=i,m.x=g+o,m.y=f+Math.sqrt(g*g+v*v),m.cy=f,t.circle=m;for(var y=null,b=ll._;b;)if(m.y=s)return;if(h>p){if(a){if(a.y>=u)return}else a={x:v,y:l};r={x:v,y:u}}else{if(a){if(a.y1)if(h>p){if(a){if(a.y>=u)return}else a={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}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.xa||f>o||h=x,A=r>=_,M=A<<1|w,k=M+4;Ma&&(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:bn(r,n)})),a=dl.lastIndex;return a=0&&!(r=uo.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function Mn(t){return function(e){return 1-t(1-e)}}function kn(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Ln(t){if(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 Sn(t){return function(e){return Math.pow(e,t)}}function Cn(t){return 1-Math.cos(t*Vo)}function Pn(t){return Math.pow(2,10*(t-1))}function Rn(t){return 1-Math.sqrt(1-t*t)}function Nn(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Bo*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Bo/e)}}function On(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function In(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 zn(t,e){t=uo.hcl(t),e=uo.hcl(e);var r=t.h,n=t.c,i=t.l,a=e.h-r,o=e.c-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ht(r+a*t,n+o*t,i+s*t)+""}}function jn(t,e){t=uo.hsl(t),e=uo.hsl(e);var r=t.h,n=t.s,i=t.l,a=e.h-r,o=e.s-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ct(r+a*t,n+o*t,i+s*t)+""}}function Dn(t,e){t=uo.lab(t),e=uo.lab(e);var r=t.l,n=t.a,i=t.b,a=e.l-r,o=e.a-n,s=e.b-i;return function(t){return pt(r+a*t,n+o*t,i+s*t)+""}}function Fn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function Bn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Vn(e),i=Un(e,r),a=Vn(Hn(r,e,-i))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(qn(r)+"rotate(",null,")")-2,x:bn(t,e)})):e&&r.push(qn(r)+"rotate("+e+")")}function Wn(t,e,r,n){t!==e?n.push({i:r.push(qn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(qn(r)+"skewX("+e+")")}function Yn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(qn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:bn(t[0],e[0])},{i:i-2,x:bn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(qn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=uo.transform(t),e=uo.transform(e),Gn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Wn(t.skew,e.skew,r,n),Yn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,a=n.length;++i=0;)r.push(i[n])}function li(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;++oi&&(n=r,i=e);return n}function bi(t){return t.reduce(xi,0)}function xi(t,e){return t+e[1]}function _i(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,a=[];++r<=e;)a[r]=i*r+n;return a}function Ai(t){return[uo.min(t),uo.max(t)]}function Mi(t,e){return t.value-e.value}function ki(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ti(t,e){t._pack_next=e,e._pack_prev=t}function Ei(t,e){var r=e.x-t.x,n=e.y-t.y,i=t.r+e.r;return.999*i*i>r*r+n*n}function Li(t){function e(t){c=Math.min(t.x-t.r,c),f=Math.max(t.x+t.r,f),h=Math.min(t.y-t.r,h),d=Math.max(t.y+t.r,d)}if((r=t.children)&&(u=r.length)){var r,n,i,a,o,s,l,u,c=1/0,f=-(1/0),h=1/0,d=-(1/0);if(r.forEach(Si),n=r[0],n.x=-n.r,n.y=0,e(n),u>1&&(i=r[1],i.x=i.r,i.y=0,e(i),u>2))for(a=r[2],Ri(n,i,a),e(a),ki(n,a),n._pack_prev=a,ki(a,i),i=n._pack_next,o=3;o=0;)e=i[a],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function Di(t,e,r){return t.a.parent===e.parent?t.a:r}function Fi(t){return 1+uo.max(t,function(t){return t.y})}function Bi(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ui(t){var e=t.children;return e&&e.length?Ui(e[0]):t}function Vi(t){var e,r=t.children;return r&&(e=r.length)?Vi(r[e-1]):t}function Hi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function qi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(r+=i/2,i=0),a<0&&(n+=a/2,a=0),{x:r,y:n,dx:i,dy:a}}function Gi(t){var e=t[0],r=t[t.length-1];return e2?Qi:Wi,l=n?$n:Qn;return o=i(t,e,l,r),s=i(e,t,l,_n),a}function a(t){return o(t)}var o,s;return a.invert=function(t){return s(t)},a.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},a.range=function(t){return arguments.length?(e=t,i()):e},a.rangeRound=function(t){return a.range(t).interpolate(Fn)},a.clamp=function(t){return arguments.length?(n=t,i()):n},a.interpolate=function(t){return arguments.length?(r=t,i()):r},a.ticks=function(e){return ea(t,e)},a.tickFormat=function(e,r){return ra(t,e,r)},a.nice=function(e){return Ji(t,e),i()},a.copy=function(){return $i(t,e,r,n)},i()}function Ki(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ji(t,e){return Yi(t,Zi(ta(t,e)[2])),Yi(t,Zi(ta(t,e)[2])),t}function ta(t,e){null==e&&(e=10);var r=Gi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),a=e/n*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function ea(t,e){return uo.range.apply(uo,ta(t,e))}function ra(t,e,r){var n=ta(t,e);if(r){var i=hs.exec(r);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(xo(n[0]),xo(n[1])));return i[7]||(i[7]="."+na(a.scale(n[2]))),i[8]="f",r=uo.format(i.join("")),function(t){return r(a.scale(t))+a.symbol}}i[7]||(i[7]="."+ia(i[8],n)),r=i.join("")}else r=",."+na(n[2])+"f";return uo.format(r)}function na(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ia(t,e){var r=na(e[2]);return t in kl?Math.abs(r-na(Math.max(xo(e[0]),xo(e[1]))))+ +("e"!==t):r-2*("%"===t)}function aa(t,e,r,n){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(i(e))}return o.invert=function(e){return a(t.invert(e))},o.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),o):e},o.nice=function(){var e=Yi(n.map(i),r?Math:El);return t.domain(e),n=e.map(a),o},o.ticks=function(){var t=Gi(n),o=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),f=e%1?2:e;if(isFinite(c-u)){if(r){for(;u0;h--)o.push(a(u)*h);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,r){if(!arguments.length)return Tl;arguments.length<2?r=Tl:"function"!=typeof r&&(r=uo.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e0?s[r-1]:t[0],r0?0:1}function xa(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,u=-s*a,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,g=(f+d)/2,v=h-c,m=d-f,y=v*v+m*m,b=r-n,x=c*d-h*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*m-v*_)/y,A=(-x*v-m*_)/y,M=(x*m+v*_)/y,k=(-x*v+m*_)/y,T=w-p,E=A-g,L=M-p,S=k-g;return T*T+E*E>L*L+S*S&&(w=M,A=k),[[w-l,A-u],[w*r/b,A*r/b]]}function _a(t){function e(e){function o(){u.push("M",a(t(c),s))}for(var l,u=[],c=[],f=-1,h=e.length,d=Lt(r),p=Lt(n);++f1?t.join("L"):t+"Z"}function Aa(t){return t.join("L")+"Z"}function Ma(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1&&i.push("H",n[0]),i.join("")}function ka(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 u=2;u9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[s+1]=i*n));for(s=-1;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}function Ua(t){return t.length<3?wa(t):t[0]+Ca(t,Ba(t))}function Va(t){for(var e,r,n,i=-1,a=t.length;++i0;)d[--s].call(t,o);if(a>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var l,u,c,h,d,p=t[r]||(t[r]={active:0,count:0}),g=p[n];g||(l=i.time,u=Nt(a,0,l),g=p[n]={tween:new f,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function ro(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function no(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function io(t){return t.toISOString()}function ao(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,a=uo.bisect(Kl,i);return a==Kl.length?[e.year,ta(t.map(function(t){return t/31536e6}),r)[2]]:a?e[i/Kl[a-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Gi(n.domain()),a=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(r[0],oo(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return ao(t.copy(),e,r)},Ki(n,t)}function oo(t){return new Date(t)}function so(t){return JSON.parse(t.responseText)}function lo(t){var e=ho.createRange();return e.selectNode(ho.body),e.createContextualFragment(t.responseText)}var uo={version:"3.5.17"},co=[].slice,fo=function(t){return co.call(t)},ho=this.document;if(ho)try{fo(ho.documentElement.childNodes)[0].nodeType}catch(t){fo=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}),ho)try{ho.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var po=this.Element.prototype,go=po.setAttribute,vo=po.setAttributeNS,mo=this.CSSStyleDeclaration.prototype,yo=mo.setProperty;po.setAttribute=function(t,e){go.call(this,t,e+"")},po.setAttributeNS=function(t,e,r){vo.call(this,t,e,r+"")},mo.setProperty=function(t,e,r){yo.call(this,t,e+"",r)}}uo.ascending=i,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.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},uo.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},uo.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 l/(c-1)},uo.deviation=function(){var t=uo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var bo=s(i);uo.bisectLeft=bo.left,uo.bisect=uo.bisectRight=bo.right,uo.bisector=function(t){return s(1===t.length?function(e,r){return i(t(e),r)}:t)},uo.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},uo.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},uo.pairs=function(t){for(var e,r=0,n=t.length-1,i=t[0],a=new Array(n<0?0:n);r=0;)for(n=t[i],e=n.length;--e>=0;)r[--o]=n[e];return r};var xo=Math.abs;uo.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=u(xo(r)),o=-1;if(t*=a,e*=a,r*=a,r<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=a.length)return n?n.call(i,o):r?o.sort(r):o;for(var l,u,c,h,d=-1,p=o.length,g=a[s++],v=new f;++d=a.length)return t;var n=[],i=o[r++];return t.forEach(function(t,i){n.push({key:t,values:e(i,r)})}),i?n.sort(function(t,e){return i(t.key,e.key)}):n}var r,n,i={},a=[],o=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(uo.map,r,0),0)},i.key=function(t){return a.push(t),i},i.sortKeys=function(t){return o[a.length-1]=t,i},i.sortValues=function(t){return r=t,i},i.rollup=function(t){return n=t,i},i},uo.set=function(t){var e=new b;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}},uo.event=null,uo.requote=function(t){return t.replace(Mo,"\\$&")};var Mo=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ko={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},To=function(t,e){return e.querySelector(t)},Eo=function(t,e){return e.querySelectorAll(t)},Lo=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Lo=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(To=function(t,e){return Sizzle(t,e)[0]||null},Eo=Sizzle,Lo=Sizzle.matchesSelector),uo.selection=function(){return uo.select(ho.documentElement)};var So=uo.selection.prototype=[];So.select=function(t){var e,r,n,i,a=[];t=C(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Po.hasOwnProperty(r)?{space:Po[r],local:t}:t}},So.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=uo.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(R(e,t[e]));return this}return this.each(R(t,e))},So.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=I(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},So.sort=function(t){t=q.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.transition().duration(S)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-M.x)/M.k}).map(x.invert)),A&&A.domain(w.range().map(function(t){return(t-M.y)/M.k}).map(w.invert))}function l(t){C++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:M.k,translate:[M.x,M.y]})}function c(t){--C||(t({type:"zoomend"}),v=null)}function f(){function t(){s=1,a(uo.mouse(i),h),u(o)}function r(){f.on(R,null).on(N,null),d(s),c(o)}var i=this,o=I.of(i,arguments),s=0,f=uo.select(n(i)).on(R,t).on(N,r),h=e(uo.mouse(i)),d=$(i);Vl.call(i),l(o)}function h(){function t(){var t=uo.touches(p);return d=M.k,t.forEach(function(t){t.identifier in v&&(v[t.identifier]=e(t))}),t}function r(){var e=uo.event.target;uo.select(e).on(x,n).on(_,s),w.push(e);for(var r=uo.event.changedTouches,i=0,a=r.length;i1){var c=l[0],f=l[1],h=c[0]-f[0],d=c[1]-f[1];m=h*h+d*d}}function n(){var t,e,r,n,o=uo.touches(p);Vl.call(p);for(var s=0,l=o.length;s=u)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ds=uo.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=uo.round(t,jt(t,e))).toFixed(Math.max(0,Math.min(20,jt(t*(1+1e-15),e))))}}),ps=uo.time={},gs=Date;Ut.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){vs.setUTCDate.apply(this._,arguments)},setDay:function(){vs.setUTCDay.apply(this._,arguments)},setFullYear:function(){vs.setUTCFullYear.apply(this._,arguments)},setHours:function(){vs.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){vs.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){vs.setUTCMinutes.apply(this._,arguments)},setMonth:function(){vs.setUTCMonth.apply(this._,arguments)},setSeconds:function(){vs.setUTCSeconds.apply(this._,arguments)},setTime:function(){vs.setTime.apply(this._,arguments)}};var vs=Date.prototype;ps.year=Vt(function(t){return t=ps.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),ps.years=ps.year.range,ps.years.utc=ps.year.utc.range,ps.day=Vt(function(t){var e=new gs(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),ps.days=ps.day.range,ps.days.utc=ps.day.utc.range,ps.dayOfYear=function(t){var e=ps.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var r=ps[t]=Vt(function(t){return(t=ps.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var r=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});ps[t+"s"]=r.range,ps[t+"s"].utc=r.utc.range,ps[t+"OfYear"]=function(t){var r=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(r+e)%7)/7)}}),ps.week=ps.sunday,ps.weeks=ps.sunday.range,ps.weeks.utc=ps.sunday.utc.range,ps.weekOfYear=ps.sundayOfYear;var ms={"-":"",_:" ",0:"0"},ys=/^\s*\d+/,bs=/^%/;uo.locale=function(t){return{numberFormat:Ft(t),timeFormat:qt(t)}};var xs=uo.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"]});uo.format=xs.numberFormat,uo.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,_s),he(_s.s,this.s,this),this.s?this.t+=_s.t:this.s=_s.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _s=new fe;uo.geo.stream=function(t,e){t&&ws.hasOwnProperty(t.type)?ws[t.type](t,e):de(t,e)};var ws={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nd&&(d=e)}function e(e,r){var n=me([e*Ho,r*Ho]);if(m){var i=be(m,n),a=[i[1],-i[0],0],o=be(a,i);we(o),o=Ae(o);var l=e-p,u=l>0?1:-1,g=o[0]*qo*u,v=xo(l)>180; +if(v^(u*pd&&(d=y)}else if(g=(g+360)%360-180,v^(u*pd&&(d=r);v?es(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e):h>=c?(eh&&(h=e)):e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,r);m=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=h,_.point=t,m=null}function i(t,r){if(m){var n=t-p;y+=xo(n)>180?n+(n>0?360:-360):n}else g=t,v=r;Ts.point(t,r),e(t,r)}function a(){Ts.lineStart()}function o(){i(g,v),Ts.lineEnd(),xo(y)>jo&&(c=-(h=180)),x[0]=c,x[1]=h,m=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tjo?d=90:y<-jo&&(f=-90),x[0]=c,x[1]=h}};return function(t){d=h=-(c=f=1/0),b=[],uo.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,i=b[0],a=[i];ns(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):a.push(i=r);for(var o,r,p=-(1/0),e=a.length-1,n=0,i=a[e];n<=e;i=r,++n)r=a[n],(o=s(i[1],r[0]))>p&&(p=o,c=r[0],h=i[1])}return b=x=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){Es=Ls=Ss=Cs=Ps=Rs=Ns=Os=Is=zs=js=0,uo.geo.stream(t,Ds);var e=Is,r=zs,n=js,i=e*e+r*r+n*n;return i=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},t.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()}}},t.precision=function(e){return arguments.length?(a.precision(e),o.precision(e),s.precision(e),t):a.precision()},t.scale=function(e){return arguments.length?(a.scale(e),o.scale(.35*e),s.scale(e),t.translate(a.translate())):a.scale()},t.translate=function(e){if(!arguments.length)return a.translate();var u=a.scale(),c=+e[0],f=+e[1];return r=a.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,n=o.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+jo,f+.12*u+jo],[c-.214*u-jo,f+.234*u-jo]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+jo,f+.166*u+jo],[c-.115*u-jo,f+.234*u-jo]]).stream(l).point,t},t.scale(1070)};var Us,Vs,Hs,qs,Gs,Xs,Ws={point:A,lineStart:A,lineEnd:A,polygonStart:function(){Vs=0,Ws.lineStart=Ye},polygonEnd:function(){Ws.lineStart=Ws.lineEnd=Ws.point=A,Us+=xo(Vs/2)}},Ys={point:Ze,lineStart:A,lineEnd:A,polygonStart:A,polygonEnd:A},Zs={point:Ke,lineStart:Je,lineEnd:tr,polygonStart:function(){Zs.lineStart=er},polygonEnd:function(){Zs.point=Ke,Zs.lineStart=Je,Zs.lineEnd=tr}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),uo.geo.stream(t,o)),a.result()}function e(){return o=null,t}var r,n,i,a,o,s=4.5;return t.area=function(t){return Us=0,uo.geo.stream(t,i(Ws)),Us},t.centroid=function(t){return Ss=Cs=Ps=Rs=Ns=Os=Is=zs=js=0,uo.geo.stream(t,i(Zs)),js?[Is/js,zs/js]:Os?[Rs/Os,Ns/Os]:Ps?[Ss/Ps,Cs/Ps]:[NaN,NaN]},t.bounds=function(t){return Gs=Xs=-(Hs=qs=1/0),uo.geo.stream(t,i(Ys)),[[Hs,qs],[Gs,Xs]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):x,e()):r},t.context=function(t){return arguments.length?(a=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&a.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(a.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var r=new ar(e);for(var n in t)r[n]=t[n];return r}}},ar.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()}},uo.geo.projection=sr,uo.geo.projectionMutator=lr,(uo.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*Ho,e[1]*Ho),e[0]*=qo,e[1]*=qo,e}return t=hr(t[0]%360*Ho,t[1]*Ho,t.length>2?t[2]*Ho:0),e.invert=function(e){return e=t.invert(e[0]*Ho,e[1]*Ho),e[0]*=qo,e[1]*=qo,e},e},fr.invert=cr,uo.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=hr(-t[0]*Ho,-t[1]*Ho,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=qo,t[1]*=qo}}),{type:"Polygon",coordinates:[i]}}var e,r,n=[0,0],i=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=vr((e=+n)*Ho,i*Ho),t):e},t.precision=function(n){return arguments.length?(r=vr(e*Ho,(i=+n)*Ho),t):i},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ho,i=t[1]*Ho,a=e[1]*Ho,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((r=f*o)*r+(r=u*c-l*f*s)*r),l*c+u*f*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/v)*v,i,v).map(h).concat(uo.range(Math.ceil(u/m)*m,l,m).map(d)).concat(uo.range(Math.ceil(n/p)*p,r,p).filter(function(t){return xo(t%v)>jo}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return xo(t%m)>jo}).map(f))}var r,n,i,a,o,s,l,u,c,f,h,d,p=10,g=p,v=90,m=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[h(a).concat(d(l).slice(1),h(i).reverse().slice(1),d(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(a=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],a>i&&(e=a,a=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[a,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(v=+e[0],m=+e[1],t):[v,m]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,o,90),f=br(n,r,y),h=yr(u,l,90),d=br(a,i,y),t):y},t.majorExtent([[-180,-90+jo],[180,90-jo]]).minorExtent([[-180,-80-jo],[180,80+jo]])},uo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}var e,r,n=xr,i=_r;return t.distance=function(){return uo.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(i=e,r="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},uo.geo.interpolate=function(t,e){return wr(t[0]*Ho,t[1]*Ho,e[0]*Ho,e[1]*Ho)},uo.geo.length=function(t){return Qs=0,uo.geo.stream(t,$s),Qs};var Qs,$s={sphere:A,point:A,lineStart:Ar,lineEnd:A,polygonStart:A,polygonEnd:A},Ks=Mr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Ks)}).raw=Ks;var Js=Mr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr(Js)}).raw=Js,(uo.geo.conicConformal=function(){return Xe(kr)}).raw=kr,(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var tl=Mr(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(tl)}).raw=tl,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return Lr(Er)}).raw=Er;var el=Mr(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr(el)}).raw=el;var rl=Mr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(rl)}).raw=rl,Sr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Vo]},(uo.geo.transverseMercator=function(){var t=Lr(Sr),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=Sr,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Lt(r),a=Lt(n),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e=n&&u.x<=a&&u.y>=i&&u.y<=o?[[n,o],[a,o],[a,i],[n,i]]:[];c.point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/jo)*jo,y:Math.round(o(t,e)/jo)*jo,i:e}})}var n=Cr,i=Pr,a=n,o=i,s=fl;return t?e(t):(e.links=function(t){return un(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return un(r(t)).cells.forEach(function(r,n){for(var i,a,o=r.site,s=r.edges.sort(Xr),l=-1,u=s.length,c=s[u-1].edge,f=c.l===o?c.r:c.l;++l=u,h=n>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),f?i=u:s=u,h?o=c:l=c,a(t,e,r,n,i,o,s,l)}var c,f,h,d,p,g,v,m,y,b=Lt(s),x=Lt(l);if(null!=e)g=e,v=r,m=n,y=i;else if(m=y=-(g=v=1/0),f=[],h=[],p=t.length,o)for(d=0;dm&&(m=c.x),c.y>y&&(y=c.y),f.push(c.x),h.push(c.y);else for(d=0;dm&&(m=_),w>y&&(y=w),f.push(_),h.push(w)}var A=m-g,M=y-v;A>M?y=v+A:m=g+M;var k=pn();if(k.add=function(t){a(k,t,+b(t,++d),+x(t,d),g,v,m,y)},k.visit=function(t){gn(t,k,g,v,m,y)},k.find=function(t){return vn(k,t[0],t[1],g,v,m,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=gl.get(r)||pl,n=vl.get(n)||x,An(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=zn,uo.interpolateHsl=jn,uo.interpolateLab=Dn,uo.interpolateRound=Fn,uo.transform=function(t){var e=ho.createElementNS(uo.ns.prefix.svg,"g");return(uo.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Bn(r?r.matrix:ml)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ml={a:1,b:0,c:0,d:1,e:0,f:0};uo.interpolateTransform=Zn,uo.layout={},uo.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r0?i=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),r=Nt(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;l=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;n&&(a.value=0),a.children=u}else n&&(a.value=+n.call(t,a,a.depth)||0),delete a.children;return li(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=fi,r=ui,n=ci;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0),(r=e.parent)&&(r.value+=e.value)})),e},t},uo.layout.partition=function(){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,u=-1;for(n=e.value?n/e.value:0;++us&&(s=n),o.push(n)}for(r=0;r0)for(a=-1;++a=c[0]&&s<=c[1]&&(o=l[uo.bisect(f,s,1,d)-1],o.y+=p,o.push(t[a]));return l}var e=!0,r=Number,n=Ai,i=_i;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=Lt(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:Lt(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},uo.layout.pack=function(){function t(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,Li),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=f}),li(s,Li),li(s,function(t){t.r-=f})}return Pi(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),o}var e,r=uo.layout.hierarchy().sort(Mi),n=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},oi(t,r)},uo.layout.tree=function(){function t(t,i){var c=o.call(this,t,i),f=c[0],h=e(f);if(li(h,r),h.parent.m=-h.z,si(h,n),u)si(f,a);else{var d=f,p=f,g=f;si(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var v=s(d,p)/2-d.x,m=l[0]/(p.x+s(p,d)/2+v),y=l[1]/(g.depth||1);si(f,function(t){t.x=(t.x+v)*m,t.y=t.depth*y})}return c}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var i,a=e.children,o=0,s=a.length;o0&&(zi(Di(o,t,r),t,n),u+=n,c+=n),f+=o.m,u+=i.m,h+=l.m,c+=a.m;o&&!Ii(a)&&(a.t=o,a.m+=f-c),i&&!Oi(l)&&(l.t=i,l.m+=u-h,r=t)}return r}function a(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Ni,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?a:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:a,t):u?l:null},oi(t,o)},uo.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=Bi(e),t.y=Fi(e)):(t.x=o?u+=r(t,o):0,t.y=0,o=t)});var c=Ui(l),f=Vi(l),h=c.x-r(c,f)/2,d=f.x+r(f,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*n[0],t.y=(l.y-t.y)*n[1]}:function(t){t.x=(t.x-h)/(d-h)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=uo.layout.hierarchy().sort(null).value(null),r=Ni,n=[1,1],i=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(i=null==(n=e),t):i?null:n},t.nodeSize=function(e){return arguments.length?(i=null!=(n=e),t):i?n:null},oi(t,e)},uo.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,a=t.length;++i0;)c.push(o=h[l-1]),c.area+=o.area,"squarify"!==d||(s=n(c,g))<=p?(h.pop(),p=s):(c.area-=c.pop().area,i(c,g,u,!1),g=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,g,u,!0),c.length=c.area=0),a.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var a,o=f(e),s=n.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(i(l,a.z?o.dx:o.dy,o,!s.length),l.length=l.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=r));return n*=n,e*=e,n?Math.max(e*i*p/n,n/(e*a*p)):1/0}function i(t,e,r,n){var i,a=-1,o=t.length,s=r.x,u=r.y,c=e?l(t.area/e):0;if(e==r.dx){for((n||c>r.dy)&&(c=r.dy);++ar.dx)&&(c=r.dx);++a1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=uo.random.normal.apply(uo,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=uo.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;rf?0:1;if(u=Uo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,v,m,y,b,x,_,w,A,M,k,T=0,E=0,L=[];if((m=(+l.apply(this,arguments)||0)/2)&&(v=a===Rl?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(E*=-1),u&&(E=nt(v/u*Math.sin(m))),t&&(T=nt(v/t*Math.sin(m)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(f-E),_=u*Math.sin(f-E);var S=Math.abs(f-c-2*E)<=Fo?0:1;if(E&&ba(y,b,x,_)===d^S){var C=(c+f)/2;y=u*Math.cos(C),b=u*Math.sin(C),x=_=null}}else y=b=0;if(t){w=t*Math.cos(f-T),A=t*Math.sin(f-T),M=t*Math.cos(c+T),k=t*Math.sin(c+T);var P=Math.abs(c-f+2*T)<=Fo?0:1;if(T&&ba(w,A,M,k)===1-d^P){var R=(c+f)/2;w=t*Math.cos(R),A=t*Math.sin(R),M=k=null}}else w=A=0;if(h>jo&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){g=tFo)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var a=xr,o=_r,s=qa,l=va,u=ma;return t.radius=function(e){return arguments.length?(s=Lt(e),t):s},t.source=function(e){return arguments.length?(a=Lt(e),t):a},t.target=function(e){return arguments.length?(o=Lt(e),t):o},t.startAngle=function(e){return arguments.length?(l=Lt(e),t):l},t.endAngle=function(e){return arguments.length?(u=Lt(e),t):u},t},uo.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=r.call(this,t,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return l=l.map(n),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=xr,r=_r,n=Ga;return t.source=function(r){return arguments.length?(e=Lt(r),t):e},t.target=function(e){return arguments.length?(r=Lt(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},uo.svg.diagonal.radial=function(){var t=uo.svg.diagonal(),e=Ga,r=t.projection;return t.projection=function(t){return arguments.length?r(Xa(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(jl.get(e.call(this,t,n))||Za)(r.call(this,t,n))}var e=Ya,r=Wa;return t.type=function(r){return arguments.length?(e=Lt(r),t):e},t.size=function(e){return arguments.length?(r=Lt(e),t):r},t};var jl=uo.map({circle:Za,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*Fl)),r=e*Fl;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/Dl),r=e*Dl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Dl),r=e*Dl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=jl.keys();var Dl=Math.sqrt(3),Fl=Math.tan(30*Ho);So.transition=function(t){for(var e,r,n=Bl||++ql,i=to(t),a=[],o=Ul||{time:Date.now(),ease:Ln,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",f[1]-f[0])}function i(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function a(){function a(){32==uo.event.keyCode&&(S||(b=null,P[0]-=f[1],P[1]-=h[1],S=2),T())}function g(){32==uo.event.keyCode&&2==S&&(P[0]+=f[1],P[1]+=h[1],S=0,T())}function v(){var t=uo.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),S||(uo.event.altKey?(b||(b=[(f[0]+f[1])/2,(h[0]+h[1])/2]),P[0]=f[+(t[0]=2)return!1;t[r]=n}return!0}):w.filter(function(t){for(var e=0;e<=o;++e){var r=y[t[e]];if(r<0)return!1;t[e]=r}return!0}),1&o)for(var f=0;f>>31},e.exports.exponent=function(t){var r=e.exports.hi(t);return(r<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){var r=e.exports.hi(t);return!(2146435072&r)}}).call(this,t("buffer").Buffer)},{buffer:45}],77:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(i<=0)return[];var a,o=new Array(i);if(r===t.length-1)for(a=0;a0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=a},{}],78:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;n0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],a=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(s=a;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(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],81:[function(t,e,r){"use strict";function n(t,e,r){var n=e||0,i=r||1;return[[t[12]+t[0],t[13]+t[1],t[14]+t[2],t[15]+t[3]],[t[12]-t[0],t[13]-t[1],t[14]-t[2],t[15]-t[3]],[t[12]+t[4],t[13]+t[5],t[14]+t[6],t[15]+t[7]],[t[12]-t[4],t[13]-t[5],t[14]-t[6],t[15]-t[7]],[n*t[12]+t[8],n*t[13]+t[9],n*t[14]+t[10],n*t[15]+t[11]],[i*t[12]-t[8],i*t[13]-t[9],i*t[14]-t[10],i*t[15]-t[11]]]}e.exports=n},{}],82:[function(t,e,r){"use strict";function n(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}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],83:[function(t,e,r){"use strict";function n(t,e,r){return Math.min(e,Math.max(t,r))}function i(t,e,r){this.dimension=t.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n=r-1)for(var h=o.length-1,p=t-e[r-1],d=0;d=r-1)for(var c=a.length-1,f=(t-e[r-1],0);f=0;--r)if(t[--e])return!1;return!0},u.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t0;--f)i.push(n(l[f-1],u[f-1],arguments[f])),a.push(0)}},u.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 d=n(u[h-1],c[h-1],arguments[h]);i.push(d),a.push((d-i[o++])*f)}}},u.set=function(t){var e=this.dimension;if(!(t0;--l)r.push(n(o[l-1],s[l-1],arguments[l])),i.push(0)}},u.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var i=this._state,a=this._velocity,o=i.length-this.dimension,s=this.bounds,l=s[0],u=s[1],c=t-e,f=c>1e-6?1/c:0;this._time.push(t);for(var h=r;h>0;--h){var d=arguments[h];i.push(n(l[h-1],u[h-1],i[o++]+d)),a.push(d*f)}}},u.idle=function(t){var e=this.lastT();if(!(t=0;--f)i.push(n(l[f],u[f],i[o]+c*a[o])),a.push(0),o+=1}}},{"binary-search-bounds":34,"cubic-hermite":69}],84:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=a}function i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function a(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}function l(t,e){if(e.left){var r=l(t,e.left);if(r)return r}var r=t(e.key,e.value);return r?r:e.right?l(t,e.right):void 0}function u(t,e,r,n){var i=e(t,n.key);if(i<=0){if(n.left){var a=u(t,e,r,n.left);if(a)return a}var a=r(n.key,n.value);if(a)return a}if(n.right)return u(t,e,r,n.right)}function c(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=c(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return c(t,e,r,n,i.right)}function f(t,e){this.tree=t,this._stack=e}function h(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t._color=e._color,t._count=e._count}function d(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=m);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===v){if(n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=m,r._color=m,s._color=m,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}return void(t[l-1]=n)}if(n.left&&n.left._color===v){if(n=r.right=i(n),s=n.left=i(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=m,n._color=m,e._color=m,o(r),o(n),o(s),l>1){var u=t[l-2];u.left===r?u.left=s:u.right=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.right=a(v,n));r.right=a(v,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=v,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}t[l-1]=n,t[l]=r,l+11){var u=t[l-2];u.right===r?u.right=n:u.left=n}return void(t[l-1]=n)}if(n.right&&n.right._color===v){if(n=r.left=i(n),s=n.right=i(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=m,n._color=m,e._color=m,o(r),o(n),o(s),l>1){var u=t[l-2];u.right===r?u.right=s:u.left=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.left=a(v,n));r.left=a(v,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=v,o(r),o(n),l>1){var u=t[l-2];u.right===r?u.right=n:u.left=n}t[l-1]=n,t[l]=r,l+1e?1:0}function g(t){return new s(t||p,null)}e.exports=g;var v=0,m=1,y=s.prototype;Object.defineProperty(y,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(y,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(y,"length",{get:function(){return this.root?this.root._count:0}}),y.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],u=[];i;){var c=r(t,i.key);l.push(i),u.push(c),i=c<=0?i.left:i.right}l.push(new n(v,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){var i=l[f];u[f]<=0?l[f]=new n(i._color,i.key,i.value,l[f+1],i.right,i._count+1):l[f]=new n(i._color,i.key,i.value,i.left,l[f+1],i._count+1)}for(var f=l.length-1;f>1;--f){var h=l[f-1],i=l[f];if(h._color===m||i._color===m)break;var d=l[f-2];if(d.left===h)if(h.left===i){var p=d.right;if(!p||p._color!==v){if(d._color=v,d.left=h.right,h._color=m,h.right=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3){var g=l[f-3];g.left===d?g.left=h:g.right=h}break}h._color=m,d.right=a(m,p),d._color=v,f-=1}else{var p=d.right;if(!p||p._color!==v){if(h.right=i.left,d._color=v,d.left=i.right,i._color=m,i.left=h,i.right=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3){var g=l[f-3];g.left===d?g.left=i:g.right=i}break}h._color=m,d.right=a(m,p),d._color=v,f-=1}else if(h.right===i){var p=d.left;if(!p||p._color!==v){if(d._color=v,d.right=h.left,h._color=m,h.left=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3){var g=l[f-3];g.right===d?g.right=h:g.left=h}break}h._color=m,d.left=a(m,p),d._color=v,f-=1}else{var p=d.left;if(!p||p._color!==v){if(h.left=i.right,d._color=v,d.right=i.left,i._color=m,i.right=h,i.left=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3){var g=l[f-3];g.right===d?g.right=i:g.left=i}break}h._color=m,d.left=a(m,p),d._color=v,f-=1}}return l[0]._color=m,new s(r,l[0])},y.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return c(e,r,this._compare,t,this.root)}},Object.defineProperty(y,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new f(this,t)}}),Object.defineProperty(y,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new f(this,t)}}),y.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,[])},y.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)},y.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)},y.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)},y.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)},y.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var i=e(t,r.key);if(n.push(r),0===i)return new f(this,n);r=i<=0?r.left:r.right}return new f(this,[])},y.remove=function(t){var e=this.find(t);return e?e.remove():this},y.get=function(t){for(var e=this._compare,r=this.root;r;){var n=e(t,r.key);if(0===n)return r.value;r=n<=0?r.left:r.right}};var b=f.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new f(this.tree,this._stack.slice())},b.remove=function(){var t=this._stack;if(0===t.length)return this.tree;var e=new Array(t.length),r=t[t.length-1];e[e.length-1]=new n(r._color,r.key,r.value,r.left,r.right,r._count);for(var i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var a=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var o=e[a-1];e.push(new n(r._color,o.key,o.value,r.left,r.right,r._count)),e[a-1].key=r.key,e[a-1].value=r.value;for(var i=e.length-2;i>=a;--i)r=e[i],e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count);e[a-1].left=e[a]}if(r=e[e.length-1],r._color===v){var l=e[e.length-2];l.left===r?l.left=null:l.right===r&&(l.right=null),e.pop();for(var i=0;i0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(b,"index",{get:function(){var t=0,e=this._stack;if(0===e.length){var r=this.tree.root;return r?r._count:0}e[e.length-1].left&&(t=e[e.length-1].left._count);for(var n=e.length-2;n>=0;--n)e[n+1]===e[n].right&&(++t,e[n].left&&(t+=e[n].left._count));return t},enumerable:!0}),b.next=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.right)for(e=e.right;e;)t.push(e),e=e.left;else for(t.pop();t.length>0&&t[t.length-1].right===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(b,"hasNext",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].right)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].left===t[e])return!0;return!1}}),b.update=function(t){var e=this._stack;if(0===e.length)throw new Error("Can't update empty node!");var r=new Array(e.length),i=e[e.length-1];r[r.length-1]=new n(i._color,i.key,t,i.left,i.right,i._count);for(var a=e.length-2;a>=0;--a)i=e[a],i.left===e[a+1]?r[a]=new n(i._color,i.key,i.value,r[a+1],i.right,i._count):r[a]=new n(i._color,i.key,i.value,i.left,r[a+1],i._count);return new s(this.tree._compare,r[0])},b.prev=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.left)for(e=e.left;e;)t.push(e),e=e.right;else for(t.pop();t.length>0&&t[t.length-1].left===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(b,"hasPrev",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].left)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].right===t[e])return!0;return!1}})},{}],85:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=s[0],r=s.length-1;r>0;--r)e+=s[r]/(t+r);var n=t+o+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=7,a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],o=607/128,s=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];e.exports=function t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(n(e));e-=1;for(var r=a[0],o=1;o0?(d[c]=-1,p[c]=0):(d[c]=0,p[c]=1)}}function s(t,e){var r=new i(t);return r.update(e),r}e.exports=s;var l=t("./lib/text.js"),u=t("./lib/lines.js"),c=t("./lib/background.js"),f=t("./lib/cube.js"),h=t("./lib/ticks.js"),d=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),p=i.prototype;p.update=function(t){function e(e,r,n){if(n in t){var i,a=t[n],o=this[n];(e?Array.isArray(a)&&Array.isArray(a[0]):Array.isArray(a))?this[n]=i=[r(a[0]),r(a[1]),r(a[2])]:this[n]=i=[r(a),r(a),r(a)];for(var s=0;s<3;++s)if(i[s]!==o[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),a=e.bind(this,!1,String),o=e.bind(this,!0,function(t){if(Array.isArray(t)){if(3===t.length)return[+t[0],+t[1],+t[2],1];if(4===t.length)return[+t[0],+t[1],+t[2],+t[3]]}return[0,0,0,1]}),s=!1,c=!1;if("bounds"in t)for(var f=t.bounds,d=0;d<2;++d)for(var p=0;p<3;++p)f[d][p]!==this.bounds[d][p]&&(c=!0),this.bounds[d][p]=f[d][p];if("ticks"in t){r=t.ticks,s=!0,this.autoTicks=!1;for(var d=0;d<3;++d)this.tickSpacing[d]=0}else n("tickSpacing")&&(this.autoTicks=!0,c=!0);if(this._firstInit&&("ticks"in t||"tickSpacing"in t||(this.autoTicks=!0),c=!0,s=!0,this._firstInit=!1),c&&this.autoTicks&&(r=h.create(this.bounds,this.tickSpacing),s=!0),s){for(var d=0;d<3;++d)r[d].sort(function(t,e){return t.x-e.x});h.equal(r,this.ticks)?s=!1:this.ticks=r}i("tickEnable"),a("tickFont")&&(s=!0),n("tickSize"),n("tickAngle"),n("tickPad"),o("tickColor");var g=a("labels");a("labelFont")&&(g=!0),i("labelEnable"),n("labelSize"),n("labelPad"),o("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),o("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),o("lineTickColor"),i("gridEnable"),n("gridWidth"),o("gridColor"),i("zeroEnable"),o("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),o("backgroundColor"),this._text?this._text&&(g||s)&&this._text.update(this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont):this._text=l(this.gl,this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont),this._lines&&s&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=u(this.gl,this.bounds,this.ticks))};var g=[new a,new a,new a],v=[0,0,0],m={model:d,view:d,projection:d};p.isOpaque=function(){return!0},p.isTransparent=function(){return!1},p.drawTransparent=function(t){};var y=[0,0,0],b=[0,0,0],x=[0,0,0];p.draw=function(t){t=t||m;for(var e=this.gl,r=t.model||d,i=t.view||d,a=t.projection||d,s=this.bounds,l=f(r,i,a,s),u=l.cubeEdges,c=l.axis,h=i[12],p=i[13],_=i[14],w=i[15],A=this.pixelRatio*(a[3]*h+a[7]*p+a[11]*_+a[15]*w)/e.drawingBufferHeight,M=0;M<3;++M)this.lastCubeProps.cubeEdges[M]=u[M],this.lastCubeProps.axis[M]=c[M];for(var k=g,M=0;M<3;++M)o(g[M],M,this.bounds,u,c);for(var e=this.gl,T=v,M=0;M<3;++M)this.backgroundEnable[M]?T[M]=c[M]:T[M]=0;this._background.draw(r,i,a,s,T,this.backgroundColor),this._lines.bind(r,i,a,this);for(var M=0;M<3;++M){var E=[0,0,0];c[M]>0?E[M]=s[1][M]:E[M]=s[0][M];for(var L=0;L<2;++L){var S=(M+1+L)%3,C=(M+1+(1^L))%3;this.gridEnable[S]&&this._lines.drawGrid(S,C,this.bounds,E,this.gridColor[S],this.gridWidth[S]*this.pixelRatio)}for(var L=0;L<2;++L){var S=(M+1+L)%3,C=(M+1+(1^L))%3;this.zeroEnable[C]&&s[0][C]<=0&&s[1][C]>=0&&this._lines.drawZero(S,C,this.bounds,E,this.zeroLineColor[C],this.zeroLineWidth[C]*this.pixelRatio)}}for(var M=0;M<3;++M){this.lineEnable[M]&&this._lines.drawAxisLine(M,this.bounds,k[M].primalOffset,this.lineColor[M],this.lineWidth[M]*this.pixelRatio),this.lineMirror[M]&&this._lines.drawAxisLine(M,this.bounds,k[M].mirrorOffset,this.lineColor[M],this.lineWidth[M]*this.pixelRatio);for(var P=n(y,k[M].primalMinor),R=n(b,k[M].mirrorMinor),N=this.lineTickLength,L=0;L<3;++L){var O=A/r[5*L];P[L]*=N[L]*O,R[L]*=N[L]*O}this.lineTickEnable[M]&&this._lines.drawAxisTicks(M,k[M].primalOffset,P,this.lineTickColor[M],this.lineTickWidth[M]*this.pixelRatio),this.lineTickMirror[M]&&this._lines.drawAxisTicks(M,k[M].mirrorOffset,R,this.lineTickColor[M],this.lineTickWidth[M]*this.pixelRatio)}this._text.bind(r,i,a,this.pixelRatio);for(var M=0;M<3;++M){for(var I=k[M].primalMinor,z=n(x,k[M].primalOffset),L=0;L<3;++L)this.lineTickEnable[M]&&(z[L]+=A*I[L]*Math.max(this.lineTickLength[L],0)/r[5*L]);if(this.tickEnable[M]){for(var L=0;L<3;++L)z[L]+=A*I[L]*this.tickPad[L]/r[5*L];this._text.drawTicks(M,this.tickSize[M],this.tickAngle[M],z,this.tickColor[M])}if(this.labelEnable[M]){for(var L=0;L<3;++L)z[L]+=A*I[L]*this.labelPad[L]/r[5*L];z[M]+=.5*(s[0][M]+s[1][M]),this._text.drawLabel(M,this.labelSize[M],this.labelAngle[M],z,this.labelColor[M])}}},p.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null}},{"./lib/background.js":88,"./lib/cube.js":89,"./lib/lines.js":90,"./lib/text.js":92,"./lib/ticks.js":93}],88:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}function i(t){for(var e=[],r=[],i=0,l=0;l<3;++l)for(var u=(l+1)%3,c=(l+2)%3,f=[0,0,0],h=[0,0,0],d=-1;d<=1;d+=2){r.push(i,i+2,i+1,i+1,i+2,i+3),f[l]=d,h[l]=d;for(var p=-1;p<=1;p+=2){f[u]=p;for(var g=-1;g<=1;g+=2)f[c]=g,e.push(f[0],f[1],f[2],h[0],h[1],h[2]),i+=1}var v=u;u=c,c=v}var m=a(t,new Float32Array(e)),y=a(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=o(t,[{buffer:m,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:m,type:t.FLOAT,size:3,offset:12,stride:24}],y),x=s(t);return x.attributes.position.location=0,x.attributes.normal.location=1,new n(t,m,b,x)}e.exports=i;var a=t("gl-buffer"),o=t("gl-vao"),s=t("./shaders").bg,l=n.prototype;l.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),l.disable(l.POLYGON_OFFSET_FILL)}},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":91,"gl-buffer":95,"gl-vao":149}],89:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;n<4;++n){t[n]=r[12+n];for(var i=0;i<3;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;eE&&(_|=1<E&&(_|=1<h[g][1]&&(I=g));for(var z=-1,g=0;g<3;++g){var j=I^1<h[D][0]&&(D=j)}}var F=v;F[0]=F[1]=F[2]=0,F[o.log2(z^I)]=I&z,F[o.log2(I^D)]=I&D;var B=7^D;B===_||B===O?(B=7^z,F[o.log2(D^B)]=B&D):F[o.log2(z^B)]=B&z;for(var U=m,V=_,M=0;M<3;++M)V&1<=0;--g){var v=u[p[g]];s.push(l*v[0],-l*v[1],t)}}for(var s=(this.gl,[]),l=[0,0,0],u=[0,0,0],c=[0,0,0],d=[0,0,0],p=0;p<3;++p){c[p]=s.length/h|0,o(.5*(t[0][p]+t[1][p]),e[p],r),d[p]=(s.length/h|0)-c[p],l[p]=s.length/h|0;for(var g=0;g=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,u=o%a;o<0?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u|=0);var c=""+l;if(o<0&&(c="-"+c),i){for(var f=""+u;f.length=t[0][i];--o)a.push({x:o*e[i],text:n(e[i],o)});r.push(a)}return r}function a(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 a(t,e){for(var r=l.malloc(t.length,e),n=t.length,i=0;i=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,i){if(r=r||t.ARRAY_BUFFER,i=i||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var a=t.createBuffer(),o=new n(t,r,a,0,i);return o.update(e),o}var l=t("typedarray-pool"),u=t("ndarray-ops"),c=t("ndarray"),f=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],h=n.prototype;h.bind=function(){this.gl.bindBuffer(this.type,this.handle)},h.unbind=function(){this.gl.bindBuffer(this.type,null)},h.dispose=function(){this.gl.deleteBuffer(this.handle)},h.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&"undefined"!=typeof t.shape){var r=t.dtype;if(f.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var n=gl.getExtension("OES_element_index_uint");r=n&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&o(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=l.malloc(t.size,r),h=c(s,t.shape);u.assign(h,t),e<0?this.length=i(this.gl,this.type,this.length,this.usage,s,e):this.length=i(this.gl,this.type,this.length,this.usage,s.subarray(0,t.size),e),l.free(s)}}else if(Array.isArray(t)){var d;d=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),e<0?this.length=i(this.gl,this.type,this.length,this.usage,d,e):this.length=i(this.gl,this.type,this.length,this.usage,d.subarray(0,t.length),e),l.free(d)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");t|=0,t<=0&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:192,"ndarray-ops":186,"typedarray-pool":247}],96:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],97:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":96}],98:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=n,this.buffer=e,this.vao=r,this.pixelRatio=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lineWidth=[1,1,1],this.capSize=[10,10,10],this.lineCount=[0,0,0],this.lineOffset=[0,0,0],this.opacity=1}function i(t,e){for(var r=0;r<3;++r)t[0][r]=Math.min(t[0][r],e[r]),t[1][r]=Math.max(t[1][r],e[r])}function a(t,e,r,n){for(var i=h[n],a=0;a=1},f.isTransparent=function(){return this.opacity<1},f.drawTransparent=f.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||c,i=r.projection=t.projection||c;r.model=t.model||c,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var a=n[12],o=n[13],s=n[14],l=n[15],u=this.pixelRatio*(i[3]*a+i[7]*o+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var f=0;f<3;++f)e.lineWidth(this.lineWidth[f]),r.capSize=this.capSize[f]*u,e.drawArrays(e.LINES,this.lineOffset[f],this.lineCount[f]);this.vao.unbind()};var h=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=(n+e)%3,o=[0,0,0];o[a]=i,r.push(o)}t[e]=r}return t}();f.update=function(t){t=t||{},"lineWidth"in t&&(this.lineWidth=t.lineWidth,Array.isArray(this.lineWidth)||(this.lineWidth=[this.lineWidth,this.lineWidth,this.lineWidth])),"capSize"in t&&(this.capSize=t.capSize,Array.isArray(this.capSize)||(this.capSize=[this.capSize,this.capSize,this.capSize])),"opacity"in t&&(this.opacity=t.opacity);var e=t.color||[[0,0,0],[0,0,0],[0,0,0]],r=t.position,n=t.error;if(Array.isArray(e[0])||(e=[e,e,e]),r&&n){var o=[],s=r.length,l=0;this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.lineCount=[0,0,0];for(var u=0;u<3;++u){this.lineOffset[u]=l;t:for(var c=0;c0){var g=f.slice();g[u]+=d[1][u],o.push(f[0],f[1],f[2],p[0],p[1],p[2],p[3],0,0,0,g[0],g[1],g[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,g),l+=2+a(o,g,p,u)}}}this.lineCount[u]=l-this.lineOffset[u]}this.buffer.update(o)}},f.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":99,"gl-buffer":95,"gl-vao":149}],99:[function(t,e,r){"use strict";var n=t("gl-shader"),i="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}",a="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 n(t,i,a,null,[{name:"position",type:"vec3"},{name:"offset",type:"vec3"},{name:"color",type:"vec4"}])}},{"gl-shader":134}],100:[function(t,e,r){"use strict";function n(t){var e=t.getParameter(t.FRAMEBUFFER_BINDING),r=t.getParameter(t.RENDERBUFFER_BINDING),n=t.getParameter(t.TEXTURE_BINDING_2D);return[e,r,n]}function i(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function a(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);y=new Array(r+1);for(var n=0;n<=r;++n){for(var i=new Array(r),a=0;a1&&h.drawBuffersWEBGL(y[f]);var m=r.getExtension("WEBGL_depth_texture");m?d?t.depth=s(r,u,c,m.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=s(r,u,c,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=l(r,u,c,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=l(r,u,c,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=l(r,u,c,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var v=0;vs||r<0||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(a),u=0;uo||r<0||r>o)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),s<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var f=!0;"depth"in n&&(f=!!n.depth);var h=!1;return"stencil"in n&&(h=!!n.stencil),new c(t,e,r,l,s,f,h,i)}var d=t("gl-texture2d");e.exports=h;var p,g,v,m,y=null,b=c.prototype;Object.defineProperties(b,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return f(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t|=0,f(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t|=0,f(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e=1},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||m,view:t.view||m,projection:t.projection||m,clipBounds:i(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||m,view:t.view||m,projection:t.projection||m,pickId:this.pickId,clipBounds:i(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.update=function(t){var e,r;this.dirty=!0;var i=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var a=t.position||t.positions;if(a){var o=t.color||t.colors||[0,0,0,1],s=t.lineWidth||1,l=[],u=[],c=[],f=0,p=0,g=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],v=!1;t:for(e=1;e0){for(var b=0;b<24;++b)l.push(l[l.length-12]);p+=2,v=!0}continue t}g[0][r]=Math.min(g[0][r],m[r],y[r]),g[1][r]=Math.max(g[1][r],m[r],y[r])}var x,_;Array.isArray(o[0])?(x=o[e-1],_=o[e]):x=_=o,3===x.length&&(x=[x[0],x[1],x[2],1]),3===_.length&&(_=[_[0],_[1],_[2],1]);var w;w=Array.isArray(s)?s[e-1]:s;var A=f;if(f+=n(m,y),v){for(r=0;r<2;++r)l.push(m[0],m[1],m[2],y[0],y[1],y[2],A,w,x[0],x[1],x[2],x[3]);p+=2,v=!1}l.push(m[0],m[1],m[2],y[0],y[1],y[2],A,w,x[0],x[1],x[2],x[3],m[0],m[1],m[2],y[0],y[1],y[2],A,-w,x[0],x[1],x[2],x[3],y[0],y[1],y[2],m[0],m[1],m[2],f,-w,_[0],_[1],_[2],_[3],y[0],y[1],y[2],m[0],m[1],m[2],f,w,_[0],_[1],_[2],_[3]),p+=4}if(this.buffer.update(l),u.push(f),c.push(a[a.length-1].slice()),this.bounds=g,this.vertexCount=p,this.points=c,this.arcLength=u,"dashes"in t){var M=t.dashes,k=M.slice();for(k.unshift(0),e=1;e1.0001)return null;v+=g[c]}return Math.abs(v-1)>.001?null:[f,o(t,g),g]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:17,"polytope-closest-point/lib/closest_point_2d.js":205}],125:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}",i="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat cookTorranceSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution_2_0(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\n\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n \n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular_1_1(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}",a="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}",o="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",u="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}",c="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}",f="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}",h="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="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n";r.meshShader={vertex:n,fragment:i,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:a,fragment:o,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:s,fragment:l,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:f,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:h,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{}],126:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w,A,M,k,T){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=a,this.pointPickShader=o,this.contourShader=s,this.trianglePositions=l,this.triangleColors=c,this.triangleNormals=h,this.triangleUVs=f,this.triangleIds=u,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=v,this.edgeUVs=m,this.edgeIds=g,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=b,this.pointColors=_,this.pointUVs=w,this.pointSizes=A,this.pointIds=x,this.pointVAO=M,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=k,this.contourVAO=T,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=I,this._view=I,this._projection=I,this._resolution=[1,1]}function i(t){for(var e=M({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return A(r,[256,256,4],[4,0,1])}function a(t,e,r){for(var n=new Array(e),i=0;i=1},z.isTransparent=function(){return this.opacity<1},z.pickSlots=1,z.setPickBase=function(t){this.pickId=t},z.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=k(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=T.mallocFloat32(6*a),s=0,l=0;l0){var h=this.triShader;h.bind(),h.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var h=this.lineShader;h.bind(),h.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){var h=this.pointShader;h.bind(),h.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 h=this.contourShader;h.bind(),h.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind()}},z.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||I,n=t.view||I,i=t.projection||I,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={model:r,view:n,projection:i,clipBounds:a,pickId:this.pickId/255},l=this.pickShader;if(l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0){var l=this.pointPickShader;l.bind(),l.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}},z.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;a0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function o(t){return"boolean"!=typeof t||t}function s(t){function e(){if(!_&&q.autoResize){var t=w.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*q.pixelRatio),i=0|Math.ceil(r*q.pixelRatio);if(n!==w.width||i!==w.height){w.width=n,w.height=i;var a=w.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",D=!0}}}function r(){for(var t=O.length,e=j.length,r=0;r0&&0===z[e-1];)z.pop(),j.pop().dispose()}function s(){return!!q.contextLost||void(M.isContextLost()&&(q.contextLost=!0,q.mouseListener.enabled=!1,q.selection.object=null,q.oncontextloss&&q.oncontextloss()))}function y(){if(!s()){M.colorMask(!0,!0,!0,!0),M.depthMask(!0),M.disable(M.BLEND),M.enable(M.DEPTH_TEST);for(var t=O.length,e=j.length,r=0;rT.distance)continue;for(var u=0;u1e-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),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*f+l*g,t[3]=s*h+l*v,t}e.exports=n},{}],130:[function(t,e,r){"use strict";function n(t,e){var r=a[e];if(r||(r=a[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-(1/0),-(1/0)]],l=0;lMath.abs(z[1])){var j=I;I=z,z=j,j=N,N=O,O=j;var D=P;P=R,R=D}I[0]<0&&(N[P]=-1),z[1]>0&&(O[R]=-1);for(var F=0,B=0,C=0;C<4;++C)F+=Math.pow(p[4*P+C],2),B+=Math.pow(p[4*R+C],2);N[P]/=Math.sqrt(F),O[R]/=Math.sqrt(B),d.axes[0]=N,d.axes[1]=O,d.fragClipBounds[0]=u(L,b[0],_,-1e8),d.fragClipBounds[1]=u(L,b[1],_,1e8),e.vao.draw(h.TRIANGLES,e.vertexCount),e.lineWidth>0&&(h.lineWidth(e.lineWidth),e.vao.draw(h.LINES,e.lineVertexCount,e.vertexCount))}}function h(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||x,s.view=n.view||x,s.projection=n.projection||x,w[0]=2/o.drawingBufferWidth,w[1]=2/o.drawingBufferHeight,s.screenSize=w,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=R,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))}f(e,r,n,i,a),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),a=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=p(e),c=p(e),f=p(e),h=p(e),d=g(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:f,size:2,type:e.FLOAT},{buffer:h,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),v=new o(e,r,n,i,u,c,f,h,d,a,s,l);return v.update(t),v}var p=t("gl-buffer"),g=t("gl-vao"),v=t("typedarray-pool"),m=t("gl-mat4/multiply"),y=t("./lib/shaders"),b=t("./lib/glyphs"),x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=d;var _=o.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],A=[0,0,0],M=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=x.slice(),L=[0,0,0],S=[[0,0,0],[0,0,0]],C=[-1e8,-1e8,-1e8],P=[1e8,1e8,1e8],R=[C,P];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;h(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;h(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;h(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||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},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",a=t.alignment||[0,0],o=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,f=t.angle,h=t.lineColor,d=0,p=0,g=0,m=n.length;t:for(var y=0;y0&&(P[0]=-a[0]*(1+k[0][0]));for(var H=A.cells,q=A.positions,_=0;_this.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;i=0){for(var M=0|A.type.charAt(A.type.length-1),k=new Array(M),T=0;T=0;)E+=1;_[w]=E}var L=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=a},{"./lib/GLError":135,"./lib/create-attributes":136,"./lib/create-uniforms":137,"./lib/reflect":138,"./lib/runtime-reflect":139,"./lib/shader-cache":140}],135:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="GLError",n.prototype.constructor=n,e.exports=n},{}],136:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}function i(t,e,r,i,a,o,s){for(var l=["gl","v"],u=[],c=0;c=0){var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);i(t,e,d[0],n,p,o,f)}else{if(!(h.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+f+": "+h);var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);a(t,e,d,n,p,o,f)}}}return o}e.exports=o;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,a=i._gl,o=i._locations[i._index];a.vertexAttribPointer(o,i._dimension,t||a.FLOAT,!!e,r||0,n||0),a.enableVertexAttribArray(o)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":135}],137:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;n4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(i<2||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],a=t;a+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function f(e){for(var n=["return function updateProperty(obj){"],i=c("",e),o=0;o4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var o=p(i);Object.defineProperty(t,e,{get:n(o),set:f(i),enumerable:!0,configurable:!1})}else a[i]?Object.defineProperty(t,e,{get:l(i),set:f(i),enumerable:!0,configurable:!1}):t[e]=h(r[i].type)}function p(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 u=1;u1)for(var l=0;l0)][r],A(l,t.model,l);var u=F.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return F.showSurface=o,F.showContour=s,F}function s(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=B;n.model=t.model||N,n.view=t.view||N,n.projection=t.projection||N,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=M(n.inverseModel,n.model);for(var i=0;i<2;++i)for(var a=n.clipBounds[i],s=0;s<3;++s)a[s]=Math.min(Math.max(this.clipBounds[i][s],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=V,n.vertexColor=this.vertexColor;var l=U;for(A(l,n.view,n.model),A(l,n.projection,l),M(l,l),i=0;i<3;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;i<3;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;i<3;++i){var c=l[12+i];for(s=0;s<3;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var f=o(n,this);if(f.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=f.projections[i],this._shader.uniforms.clipBounds=f.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(f.showContour&&!e){var h=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,h.bind(),h.uniforms=n;var d=this._contourVAO;for(d.bind(),i=0;i<3;++i)for(h.uniforms.permutation=I[i],r.lineWidth(this.contourWidth[i]),s=0;s=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},j.pickSlots=1,j.setPickBase=function(t){this.pickId=t};var D=[0,0,0],F={showSurface:!1,showContour:!1,projections:[N.slice(),N.slice(),N.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:N,view:N,projection:N,inverseModel:N.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},U=N.slice(),V=[1,0,0,0,1,0,0,0,1];j.draw=function(t){return s.call(this,t,!1)},j.drawTransparent=function(t){return s.call(this,t,!0)};var H={model:N,view:N,projection:N,inverseModel:N,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};j.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=H;r.model=t.model||N,r.view=t.view||N,r.projection=t.projection||N,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.permutation=V;for(var n=0;n<2;++n)for(var i=r.clipBounds[n],a=0;a<3;++a)i[a]=Math.min(Math.max(this.clipBounds[n][a],-1e8),1e8);var s=o(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;n<3;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var u=this._contourVAO;for(u.bind(),a=0;a<3;++a)for(e.lineWidth(this.contourWidth[a]),l.uniforms.permutation=I[a],n=0;n>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 u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;c<2;++c)for(var f=c?a:1-a,h=0;h<2;++h)for(var d=h?l:1-l,p=i+c,g=s+h,v=f*d,m=0;m<3;++m)u[m]+=this._field[m].get(p,g)*v;for(var y=this._pickResult.level,b=0;b<3;++b)if(y[b]=k.le(this.contourLevels[b],u[b]),y[b]<0)this.contourLevels[b].length>0&&(y[b]=0);else if(y[b]Math.abs(_-u[b])&&(y[b]+=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],m=0;m<3;++m)r.dataCoordinate[m]=this._field[m].get(r.index[0],r.index[1]);return r},j.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=u(t.contourWidth,Number)),"showContour"in t&&(this.showContour=u(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=u(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=f(t.contourColor)),"contourProject"in t&&(this.contourProject=u(t.contourProject,function(t){return u(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=f(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=u(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=u(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"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 n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(m.freeFloat(this._field[2].data),this._field[2].data=m.mallocFloat(d.nextPow2(n))),this._field[2]=_(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),l(this._field[2],e),this.shape=e.shape.slice();for(var a=this.shape,o=0;o<2;++o)this._field[2].size>this._field[o].data.length&&(m.freeFloat(this._field[o].data),this._field[o].data=m.mallocFloat(this._field[2].size)),this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2]);if(t.coords){var s=t.coords;if(!Array.isArray(s)||3!==s.length)throw new Error("gl-surface: invalid coordinates for x/y");for(o=0;o<2;++o){var c=s[o];for(y=0;y<2;++y)if(c.shape[y]!==a[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[o],c)}}else if(t.ticks){var h=t.ticks;if(!Array.isArray(h)||2!==h.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var p=h[o];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var g=_(p.data,a);g.stride[o]=p.stride[0],g.stride[1^o]=0,l(this._field[o],g)}}else{for(o=0;o<2;++o){var v=[0,0];v[o]=1,this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2],v,0)}this._field[0].set(0,0,0);for(var y=0;y0){for(var xt=0;xt<5;++xt)tt.pop();H-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),H+=1}}nt.push(H)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=m.mallocFloat(tt.length);for(o=0;oi||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 a(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}function o(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,a,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var f=0,h=0,v=o(c,l.stride.slice());"float32"===u?f=t.FLOAT:"float64"===u?(f=t.FLOAT,v=!1,u="float32"):"uint8"===u?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,v=!1,u="uint8");var m=1;if(2===c.length)h=t.LUMINANCE,c=[c[0],c[1],1],l=d(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])h=t.ALPHA;else if(2===c[2])h=t.LUMINANCE_ALPHA;else if(3===c[2])h=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");h=t.RGBA}m=c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(h=i),h!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,x=s.indexOf(n)<0;if(x&&s.push(n),f===a&&v)0===l.offset&&l.data.length===y?x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data):x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var _;_=a===t.FLOAT?g.mallocFloat32(y):g.mallocUint8(y);var w=d(_,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&a===t.UNSIGNED_BYTE?b(w,l):p.assign(w,l),x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,_.subarray(0,y)),a===t.FLOAT?g.freeFloat32(_):g.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var o=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>o||r<0||r>o)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new a(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new a(t,i,0|e.width,0|e.height,r,n)}function f(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=o(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=d(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var f,h,v=e.size;if(s)f=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var m=[n[2],n[2]*n[0],1];h=g.malloc(v,r);var y=d(h,n,m,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?p.assign(y,e):b(y,e),f=h.subarray(0,v)}var x=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,f),s||g.free(h),new a(t,x,n[0],n[1],c,u)}function h(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(v||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return f(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var d=t("ndarray"),p=t("ndarray-ops"),g=t("typedarray-pool");e.exports=h;var v=null,m=null,y=null,b=function(t,e){p.muls(t,e,255)},x=a.prototype;Object.defineProperties(x,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=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(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t|=0,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,i(this,this._shape[0],t),t}}}),x.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},x.dispose=function(){this.gl.deleteTexture(this.handle)},x.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},x.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var a=this._mipLevels.indexOf(n)<0;a?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:192,"ndarray-ops":186,"typedarray-pool":247}],146:[function(t,e,r){"use strict";function n(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;i0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}e.exports=n},{}],155:[function(t,e,r){function n(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}e.exports=n},{}],156:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,a[0]}e.exports=n;var i=new Uint8Array(4),a=new Float32Array(i.buffer)},{}],157:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function P(){return/[^a-fA-F0-9]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),z=I,D+1)}function R(){return"."===I?(U.push(I),B=v,z=I,D+1):/[eE]/.test(I)?(U.push(I),B=v,z=I,D+1):"x"===I&&1===U.length&&"0"===U[0]?(B=w,U.push(I),z=I,D+1):/[^\d]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),z=I,D+1)}function N(){return"f"===I&&(U.push(I),z=I,D+=1),/[eE]/.test(I)?(U.push(I),z=I,D+1):"-"===I&&/[eE]/.test(z)?(U.push(I),z=I,D+1):/[^\d]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),z=I,D+1)}function O(){if(/[^\d\w_]/.test(I)){var t=U.join("");return B=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:m,e(U.join("")),B=u,D}return U.push(I),z=I,D+1}var I,z,j,D=0,F=0,B=u,U=[],V=[],H=1,q=0,G=0,X=!1,W=!1,Y="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return V=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var i=t("./lib/literals"),a=t("./lib/operators"),o=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,f=0,h=1,d=2,p=3,g=4,v=5,m=6,y=7,b=8,x=9,_=10,w=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":160,"./lib/builtins-300es":159,"./lib/literals":162,"./lib/literals-300es":161,"./lib/operators":163}],159:[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":160}],160:[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"]},{}],161:[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":162}],162:[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"]},{}],163:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],164:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":158}],165:[function(t,e,r){r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=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=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),e*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):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+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],166:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function a(t,e){return c(t.vertices,e.vertices)}function o(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;r<=t;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=u[t+1];return i||(i=u),n(i)}function s(t,e,r){this.dimension=t,this.vertices=e,this.simplices=r,this.interior=r.filter(function(t){return!t.boundary}),this.tuple=new Array(t+1);for(var n=0;n<=t;++n)this.tuple[n]=this.vertices[n];var i=f[t];i||(i=f[t]=o(t)),this.orient=i}function l(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var i=t[0].length;if(r<=i)throw new Error("Must input at least d+1 points");var a=t.slice(0,i+1),o=u.apply(void 0,a);if(0===o)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;c<=i;++c)l[c]=c;o<0&&(l[0]=1,l[1]=0);for(var f=new n(l,new Array(i+1),!1),h=f.adjacent,d=new Array(i+2),c=0;c<=i;++c){for(var p=l.slice(),g=0;g<=i;++g)g===c&&(p[g]=-1);var v=p[0];p[0]=p[1],p[1]=v;var m=new n(p,new Array(i+1),!0);h[c]=m,d[c]=m}d[i+1]=f;for(var c=0;c<=i;++c)for(var p=h[c].vertices,y=h[c].adjacent,g=0;g<=i;++g){var b=p[g];if(b<0)y[g]=f;else for(var x=0;x<=i;++x)h[x].vertices.indexOf(b)<0&&(y[g]=h[x])}for(var _=new s(i,a,d),w=!!e,c=i+1;c0;){t=o.pop();for(var s=(t.vertices,t.adjacent),l=0;l<=r;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,f=0;f<=r;++f){var h=c[f];h<0?i[f]=e:i[f]=a[h]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&o.push(u)}}}return null},h.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,u=s.adjacent,c=0;c<=n;++c)a[c]=i[l[c]];s.lastVisited=r;for(var c=0;c<=n;++c){var f=u[c];if(!(f.lastVisited>=r)){var h=a[c];a[c]=t;var d=this.orient();if(a[c]=h,d<0){s=f;continue t}f.boundary?f.lastVisited=-r:f.lastVisited=r}}return}return s},h.addPeaks=function(t,e){var r=this.vertices.length-1,o=this.dimension,s=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,f=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var h=[];f.length>0;){var e=f.pop(),d=e.vertices,p=e.adjacent,g=d.indexOf(r);if(!(g<0))for(var v=0;v<=o;++v)if(v!==g){var m=p[v];if(m.boundary&&!(m.lastVisited>=r)){var y=m.vertices;if(m.lastVisited!==-r){for(var b=0,x=0;x<=o;++x)y[x]<0?(b=x,l[x]=t):l[x]=s[y[x]];var _=this.orient();if(_>0){y[b]=r,m.boundary=!1,u.push(m),f.push(m),m.lastVisited=r;continue}m.lastVisited=-r}var w=m.adjacent,A=d.slice(),M=p.slice(),k=new n(A,M,!0);c.push(k);var T=w.indexOf(e);if(!(T<0)){w[T]=k,M[g]=m,A[v]=-1,M[v]=e,p[v]=k,k.flip();for(var x=0;x<=o;++x){var E=A[x];if(!(E<0||E===r)){for(var L=new Array(o-1),S=0,C=0;C<=o;++C){var P=A[C];P<0||C===x||(L[S++]=P)}h.push(new i(L,k,x))}}}}}}h.sort(a);for(var v=0;v+1=0?o[l++]=s[c]:u=1&c;if(u===(1&t)){var f=o[0];o[0]=o[1],o[1]=f}e.push(o)}}return e}},{"robust-orientation":220,"simplicial-complex":230}],167:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function a(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),a(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],a=[],o=[],s=[],r=0;r3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=m.ge(this.leftPoints,t,h),n=m.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var a=this.left?this.left.count:0;if(4*a>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var o=this,l=this.left;l.right;)o=l,l=l.right;if(o===this)l.right=this.right;else{var u=this.left,n=this.right;o.count-=l.count,o.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var u=m.ge(this.leftPoints,t,h);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===x&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},w.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":34}],168:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;rv[1][2]&&(b[0]=-b[0]),v[0][2]>v[2][0]&&(b[1]=-b[1]),v[1][0]>v[0][1]&&(b[2]=-b[2]),!0}},{"./normalize":173,"gl-mat4/clone":106,"gl-mat4/create":107,"gl-mat4/determinant":108,"gl-mat4/invert":112,"gl-mat4/transpose":122,"gl-vec3/cross":150,"gl-vec3/dot":151,"gl-vec3/length":152,"gl-vec3/normalize":154}],173:[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}},{}],174:[function(t,e,r){function n(t,e,r,n){if(0===c(e)||0===c(r))return!1;var i=u(e,h.translate,h.scale,h.skew,h.perspective,h.quaternion),a=u(r,d.translate,d.scale,d.skew,d.perspective,d.quaternion);return!(!i||!a)&&(s(p.translate,h.translate,d.translate,n),s(p.skew,h.skew,d.skew,n),s(p.scale,h.scale,d.scale,n),s(p.perspective,h.perspective,d.perspective,n),f(p.quaternion,h.quaternion,d.quaternion,n),l(t,p.translate,p.scale,p.skew,p.perspective,p.quaternion),!0)}function i(){return{translate:a(),scale:a(1),skew:a(),perspective:o(),quaternion:o()}}function a(t){return[t||0,t||0,t||0]}function o(){return[0,0,0,1]}var s=t("gl-vec3/lerp"),l=t("mat4-recompose"),u=t("mat4-decompose"),c=t("gl-mat4/determinant"),f=t("quat-slerp"),h=i(),d=i(),p=i();e.exports=n},{"gl-mat4/determinant":108,"gl-vec3/lerp":153,"mat4-decompose":172,"mat4-recompose":175,"quat-slerp":207}],175:[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":107,"gl-mat4/fromRotationTranslation":110,"gl-mat4/identity":111,"gl-mat4/multiply":114,"gl-mat4/scale":120,"gl-mat4/translate":121}],176:[function(t,e,r){"use strict";function n(t){this._components=t.slice(),this._time=[0],this.prevMatrix=t.slice(),this.nextMatrix=t.slice(),this.computedMatrix=t.slice(),this.computedInverse=t.slice(),this.computedEye=[0,0,0],this.computedUp=[0,0,0],this.computedCenter=[0,0,0],this.computedRadius=[0],this._limits=[-(1/0),1/0]}function i(t){t=t||{};var e=t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return new n(e)}var a=t("binary-search-bounds"),o=t("mat4-interpolate"),s=t("gl-mat4/invert"),l=t("gl-mat4/rotateX"),u=t("gl-mat4/rotateY"),c=t("gl-mat4/rotateZ"),f=t("gl-mat4/lookAt"),h=t("gl-mat4/translate"),d=(t("gl-mat4/scale"),t("gl-vec3/normalize")),p=[0,0,0];e.exports=i;var g=n.prototype;g.recalcMatrix=function(t){var e=this._time,r=a.le(e,t),n=this.computedMatrix;if(!(r<0)){var i=this._components;if(r===e.length-1)for(var l=16*r,u=0;u<16;++u)n[u]=i[l++];else{for(var c=e[r+1]-e[r],l=16*r,f=this.prevMatrix,h=!0,u=0;u<16;++u)f[u]=i[l++];for(var p=this.nextMatrix,u=0;u<16;++u)p[u]=i[l++],h=h&&f[u]===p[u];if(c<1e-6||h)for(var u=0;u<16;++u)n[u]=f[u];else o(n,f,p,(t-e[r])/c)}var g=this.computedUp;g[0]=n[1],g[1]=n[5],g[2]=n[6],d(g,g);var v=this.computedInverse;s(v,n);var m=this.computedEye,y=v[15];m[0]=v[12]/y,m[1]=v[13]/y,m[2]=v[14]/y;for(var b=this.computedCenter,x=Math.exp(this.computedRadius[0]),u=0;u<3;++u)b[u]=m[u]-n[2+4*u]*x}},g.idle=function(t){if(!(t1&&i(t[o[c-2]],t[o[c-1]],u)<=0;)c-=1,o.pop();for(o.push(l),c=s.length;c>1&&i(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(l)}for(var r=new Array(s.length+o.length-2),f=0,n=0,h=o.length;n0;--d)r[f++]=s[d];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":220}],178:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==g.alt,g.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==g.shift,g.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==g.control,g.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==g.meta,g.meta=!!t.metaKey),e}function n(t,n){var a=i.x(n),o=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==h||a!==d||o!==p||r(n))&&(h=0|t,d=a||0,p=o||0,e&&e(h,d,p,g))}function a(t){n(0,t)}function o(){(h||d||p||g.shift||g.alt||g.meta||g.control)&&(d=p=0,h=0,g.shift=g.alt=g.control=g.meta=!1,e&&e(0,0,0,g))}function s(t){r(t)&&e&&e(h,d,p,g)}function l(t){0===i.buttons(t)?n(0,t):n(h,t)}function u(t){n(h|i.buttons(t),t)}function c(t){n(h&~i.buttons(t),t)}function f(){v||(v=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",a),t.addEventListener("mouseenter",a),t.addEventListener("mouseout",a),t.addEventListener("mouseover",a),t.addEventListener("blur",o),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",o),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var h=0,d=0,p=0,g={shift:!1,alt:!1,control:!1,meta:!1},v=!1;f();var m={element:t};return Object.defineProperties(m,{enabled:{get:function(){return v},set:function(t){t&&f()},enumerable:!0},buttons:{get:function(){return h},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return g},enumerable:!0}}),m}e.exports=n;var i=t("mouse-event")},{"mouse-event":179}],179:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<=0;--e)S(e,0);for(var r=[],e=0;e0;_=_-1&g)x.push(w+"["+T+"+"+v(_)+"]");x.push(m(0));for(var _=0;_0){",h(x[t]),"=1;"),O(t-1,e|1<0&&G.push(s(U,x[V-1])+"*"+o(x[V-1])),F.push(d(U,x[V])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)X.push(o(x[U]));F.push(k+"=("+X.join("*")+")|0",A+"=mallocUint32("+k+")",w+"=mallocUint32("+k+")",T+"=0"),F.push(p(0)+"=0");for(var V=1;V<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 a=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return b(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",A="P",M="N",k="Q",T="X",E="T"},{"typedarray-pool":247}],182:[function(t,e,r){"use strict";var n=t("cwise/lib/wrapper")({args:["index","array","scalar"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{_inline_7_arg1_=_inline_7_arg2_.apply(void 0,_inline_7_arg0_)}",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}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":73}],183:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;r=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){o.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push("&&s[",l,"]>2");o.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push(",dst.pick(",s.join(),",",l,")",u);o.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",h.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>1){diff(",f,",src.pick(",h.join(),")",u,",src.pick(",d.join(),")",u,");}else{zero(",f,");};");break;case"mirror":0===r?o.push("dst.set(",s.join(),",",c,",0);"):o.push("zero(",f,");");break;case"wrap":var p=s.slice(),g=s.slice();e[l]<0?(p[c]="s["+c+"]-2",g[c]="0"):(p[c]="s["+c+"]-1",g[c]="1"),0===r?o.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>2){diff(",f,",src.pick(",p.join(),")",u,",src.pick(",g.join(),")",u,");}else{zero(",f,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&o.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var a=t.length,o=["function gradient(dst,src){var s=src.shape.slice();"],s=0;s<1<>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=a({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]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,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=o({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=o({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=o({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=a({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=a({args:["array","array"],body:{ +args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=o({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":70}],187:[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":188,ndarray:192}],188:[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":70}],189:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;r1){for(var f=[],h=1;h1){o.push("dptr=0;sptr=ptr");for(var h=t.length-1;h>=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"left){","dptr=0","sptr=cptr-s0");for(var h=1;hb){break __l}"].join(""));for(var h=t.length-1;h>=1;--h)o.push("sptr+=e"+h,"dptr+=f"+h,"}");o.push("dptr=cptr;sptr=cptr-s0");for(var h=t.length-1;h>=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"left)&&("+r("cptr-s0")+">scratch)){",a("cptr",r("cptr-s0")),"cptr-=s0","}",a("cptr","scratch"));if(o.push("}"),t.length>1&&u&&o.push("free(scratch)"),o.push("} return "+s),u){var p=new Function("malloc","free",o.join("\n"));return p(u[0],u[1])}var p=new Function(o.join("\n"));return p()}function o(t,e,r){function a(t){return["(offset+",t,"*s0)"].join("")}function o(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+a(e[0]));else for(var i=0;i=0;--i){var o=t[i];0!==o&&_.push(["for(i",o,"=0;i",o,"1)for(var i=0;i1?_.push("ptr_shift+=d"+o):_.push("ptr0+=d"+o),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+a(r[0]));else{for(var o=0;o1)for(var o=0;o=1;--o)n&&_.push("pivot_ptr+=f"+o),r.length>1?_.push("ptr_shift+=e"+o):_.push("ptr0+=e"+o),_.push("}")}function f(){t.length>1&&M&&_.push("free(pivot1)","free(pivot2)")}function h(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++k;c(s,[n,i],!1,["comp=",o("ptr0"),"-",o("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",o(a(n)),">",o(a(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?l([e,r],!1,s("ptr0",o("ptr1"))):_.push(s(a(e),o(a(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++k;c(i,[r],!0,[e,"=",o("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",o(a(r)),"-pivot",n].join(""))}function g(e,r){t.length>1?l([e,r],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join(""))}function v(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","ptr2=",a(n),"\n","++",r,"\n","--",n,"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join(""))}function m(t,e){g(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",o("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(a(e),o(a(r))),s(a(r),"pivot"+n))}function b(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function x(e,r,n){t.length>1?(_.push(["__l",++k,":while(true){"].join("")),l([e],!0,["if(",o("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",k,"}"].join("")),_.push(n,"}")):_.push(["while(",o(a(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),A=["left","right","data","offset"].concat(i(t.length)),M=n(e),k=0;_.push(["function ",w,"(",A.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],L=1;L1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",o("ptr1"),"\n","pivot2[pivot_ptr]=",o("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",o("ptr0"),"\n","y=",o("ptr2"),"\n","z=",o("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",o(a("el2")),"\n","pivot2=",o(a("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",o(a("el1")),"\n","y=",o(a("el3")),"\n","z=",o(a("el5")),"\n",s(a("index1"),"x"),"\n",s(a("index3"),"y"),"\n",s(a("index5"),"z")].join("")),d("index2","left"),d("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),p("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),p("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),v("k","less","great"),_.push("break"),_.push("}else{"),m("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp>0){"),_.push("if(--greatindex5){"),x("less",1,"++less"),x("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp===0){"),_.push("if(--great1&&M){var S=new Function("insertionSort","malloc","free",_.join("\n"));return S(r,M[0],M[1])}var S=new Function("insertionSort",_.join("\n"));return S(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c0?l.push(["d",v,"=s",v,"-d",p,"*n",p].join("")):l.push(["d",v,"=s",v].join("")),p=v);var d=t.length-1-c;0!==d&&(g>0?l.push(["e",d,"=s",d,"-e",g,"*n",g,",f",d,"=",f[d],"-f",g,"*n",g].join("")):l.push(["e",d,"=s",d,",f",d,"=",f[d]].join("")),g=d)}r.push("var "+l.join(","));var m=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",m.join(","),")}else{","quickSort(",m.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),b=a(t,e),x=o(t,e,b);return y(b,x)}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":247}],190:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],o=n.join(":"),s=a[o];return s||(a[o]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),a={};e.exports=n},{"./lib/compile_sort.js":189}],191:[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_33_arg4_)}",args:[{name:"_inline_33_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_34_arg2_(this_warped,_inline_34_arg0_),_inline_34_arg1_=_inline_34_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_34_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_34_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_34_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_34_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_34_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_37_arg2_(this_warped,_inline_37_arg0_),_inline_37_arg1_=_inline_37_arg3_(_inline_37_arg4_,this_warped[0])}",args:[{name:"_inline_37_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_37_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_37_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_37_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_37_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_40_arg2_(this_warped,_inline_40_arg0_),_inline_40_arg1_=_inline_40_arg3_(_inline_40_arg4_,this_warped[0],this_warped[1])}",args:[{name:"_inline_40_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_40_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_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_43_arg2_(this_warped,_inline_43_arg0_),_inline_43_arg1_=_inline_43_arg3_(_inline_43_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_43_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_43_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_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":73,"ndarray-linear-interpolate":185}],192:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;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("+u.join(",")+",v){"),n?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var v=0;v=0){d=i"+v+"|0;b+=c"+v+"*d;a"+v+"-=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var v=0;v=0){c=(c+this.stride["+v+"]*i"+v+")|0}else{a.push(this.shape["+v+"]);b.push(this.stride["+v+"])}");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,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",a.join("\n"));return o(f[t],i)}function o(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=f.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),a=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":76}],194:[function(t,e,r){var n=1e-6,i=1e-6;r.vertexNormals=function(t,e,r){for(var i=e.length,a=new Array(i),o=void 0===r?n:r,s=0;so)for(var _=a[c],w=1/Math.sqrt(m*b),x=0;x<3;++x){var A=(x+1)%3,M=(x+2)%3;_[x]+=w*(y[A]*v[M]-y[M]*v[A])}}for(var s=0;so)for(var w=1/Math.sqrt(k),x=0;x<3;++x)_[x]*=w;else for(var x=0;x<3;++x)_[x]=0}return a},r.faceNormals=function(t,e,r){for(var n=t.length,a=new Array(n),o=void 0===r?i:r,s=0;so?1/Math.sqrt(p):0;for(var c=0;c<3;++c)d[c]*=p;a[s]=d}return a}},{}],195:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u){var c=e+a+u;if(f>0){var f=Math.sqrt(c+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,u),f=Math.sqrt(2*h-c+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}e.exports=n},{}],196:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function a(t,e){var r=e[0],n=e[1],a=e[2],o=e[3],s=i(r,n,a,o);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=a/s,t[3]=o/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function o(t,e,r){this.radius=l([r]),this.center=l(e),this.rotation=l(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),r=[].slice.call(r,0,4),a(r,r);var i=new o(r,e,Math.log(n));return i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up),i}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/lookAt"),c=t("gl-mat4/fromQuat"),f=t("gl-mat4/invert"),h=t("./lib/quatFromFrame"),d=o.prototype;d.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},d.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;a(e,e);var r=this.computedMatrix;c(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 u=0,f=0;f<3;++f)u+=r[l+4*f]*i[f];r[12+l]=-u}},d.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},d.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},d.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},d.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=a[1],s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],f=a[4],h=a[8],d=c*o+f*s+h*l;c-=o*d,f-=s*d,h-=l*d;var p=n(c,f,h);c/=p,f/=p,h/=p;var g=a[2],v=a[6],m=a[10],y=g*o+v*s+m*l,b=g*c+v*f+m*h;g-=y*o+b*c,v-=y*s+b*f,m-=y*l+b*h;var x=n(g,v,m);g/=x,v/=x,m/=x;var _=c*e+o*r,w=f*e+s*r,A=h*e+l*r;this.center.move(t,_,w,A);var M=Math.exp(this.computedRadius[0]);M=Math.max(1e-4,M+i),this.radius.set(t,Math.log(M))},d.rotate=function(t,e,r,a){this.recalcMatrix(t),e=e||0,r=r||0;var o=this.computedMatrix,s=o[0],l=o[4],u=o[8],c=o[1],f=o[5],h=o[9],d=o[2],p=o[6],g=o[10],v=e*s+r*c,m=e*l+r*f,y=e*u+r*h,b=-(p*y-g*m),x=-(g*v-d*y),_=-(d*m-p*v),w=Math.sqrt(Math.max(0,1-Math.pow(b,2)-Math.pow(x,2)-Math.pow(_,2))),A=i(b,x,_,w);A>1e-6?(b/=A,x/=A,_/=A,w/=A):(b=x=_=0,w=1);var M=this.computedRotation,k=M[0],T=M[1],E=M[2],L=M[3],S=k*w+L*b+T*_-E*x,C=T*w+L*x+E*b-k*_,P=E*w+L*_+k*x-T*b,R=L*w-k*b-T*x-E*_;if(a){b=d,x=p,_=g;var N=Math.sin(a)/n(b,x,_);b*=N,x*=N,_*=N,w=Math.cos(e),S=S*w+R*b+C*_-P*x,C=C*w+R*x+P*b-S*_,P=P*w+R*_+S*x-C*b,R=R*w-S*b-C*x-P*_}var O=i(S,C,P,R);O>1e-6?(S/=O,C/=O,P/=O,R/=O):(S=C=P=0,R=1),this.rotation.set(t,S,C,P,R)},d.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var i=this.computedMatrix;u(i,e,r,n);var o=this.computedRotation;h(o,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),a(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var s=0,l=0;l<3;++l)s+=Math.pow(r[l]-e[l],2);this.radius.set(t,.5*Math.log(Math.max(s,1e-6))),this.center.set(t,r[0],r[1],r[2])},d.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},d.setMatrix=function(t,e){var r=this.computedRotation;h(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),a(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;f(n,e);var i=n[15];if(Math.abs(i)>1e-6){var o=n[12]/i,s=n[13]/i,l=n[14]/i;this.recalcMatrix(t);var u=Math.exp(this.computedRadius[0]);this.center.set(t,o-n[2]*u,s-n[6]*u,l-n[10]*u),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},d.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},d.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},d.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},d.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":195,"filtered-vector":83,"gl-mat4/fromQuat":109,"gl-mat4/invert":112,"gl-mat4/lookAt":113}],197:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r="undefined"!=typeof r?r+"":" ",n(r,e)+t}},{"repeat-string":213}],198:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],199:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return a.freeUint32(l),a.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,a,o=1;for(r[0]=0,a=1;a0;--a)n=e/o|0,e=e-n*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}var a=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":168,"typedarray-pool":247}],201:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,s,l,c=0;c<2;++c)if(u[c][n].length>0){o=u[c][n][0],l=c;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=u[f][n],d=0;d0&&(o=p,s=g,l=f)}return a?s:(o&&r(o,l),s)}function a(t,a){var o=u[a][t][0],s=[t];r(o,a);for(var l=o[1^a];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],f=t,h=s[1],d=n(c,f,!0);if(i(e[c],e[f],e[h],e[d])<0)break;s.push(t),l=n(c,f)}return s}function o(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;c0;){var g=(u[0][c].length,a(c,d));o(p,g)?p.push.apply(p,g):(p.length>0&&h.push(p),p=g)}p.length>0&&h.push(p)}return h}e.exports=n;var i=t("compare-angle")},{"compare-angle":62}],202:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function a(t){for(var e=t.length,r=0;r0;){var U=F.pop(),V=R[U];f(V,function(t,e){return t-e});var H,q=V.length,G=B[U];if(0===G){var T=m[U];H=[T]}for(var v=0;v=0)&&(B[X]=1^G,F.push(X),0===G)){var T=m[X];a(T)||(T.reverse(),H.push(T))}}0===G&&d.push(H)}return d}e.exports=a;var o=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),f=t("uniq"),h=t("./lib/trim-leaves")},{"./lib/trim-leaves":202,"edges-to-adjacency-list":78,"planar-dual":201,"point-in-big-polygon":204,"robust-sum":225,"two-product":245,uniq:249}],204:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return!!i&&!!i.queryPoint(r,n)}}function a(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var o=i.key,s=f(r,o[0],o[1]);if(o[0][0]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))return 0;a=1,i=i.right}}return a}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;i=u?(x=1,y=u+2*h+p):(x=-h/u,y=h*x+p)):(x=0,d>=0?(_=0,y=p):-d>=f?(_=1,y=f+2*d+p):(_=-d/f,y=d*_+p));else if(_<0)_=0,h>=0?(x=0,y=p):-h>=u?(x=1,y=u+2*h+p):(x=-h/u,y=h*x+p);else{var w=1/b;x*=w,_*=w,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p}else{var A,M,k,T;x<0?(A=c+h,M=f+d,M>A?(k=M-A,T=u-2*c+f,k>=T?(x=1,_=0,y=u+2*h+p):(x=k/T,_=1-x,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)):(x=0,M<=0?(_=1,y=f+2*d+p):d>=0?(_=0,y=p):(_=-d/f,y=d*_+p))):_<0?(A=c+d,M=u+h,M>A?(k=M-A,T=u-2*c+f,k>=T?(_=1,x=0,y=f+2*d+p):(_=k/T,x=1-_,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)):(_=0,M<=0?(x=1,y=u+2*h+p):h>=0?(x=0,y=p):(x=-h/u,y=h*x+p))):(k=f+d-c-h,k<=0?(x=0,_=1,y=f+2*d+p):(T=u-2*c+f,k>=T?(x=1,_=0,y=u+2*h+p):(x=k/T,_=1-x,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)))}for(var E=1-x-_,l=0;l1)for(var r=1;r0){var u=t[r-1];if(0===i(s,u)&&o(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}var i=t("compare-cell"),a=t("compare-oriented-cell"),o=t("cell-orientation");e.exports=n},{"cell-orientation":54,"compare-cell":63,"compare-oriented-cell":64}],213:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("repeat-string expects a string.");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;for(i===t&&"undefined"!=typeof i||(i=t,a="");r>a.length&&e>0&&(1&e&&(a+=t),e>>=1);)t+=t;return a.substr(0,r)}var i,a="";e.exports=n},{}],214:[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:{})},{}],215:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var a=r,o=t[i];r=a+o;var s=r-a,l=o-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;i>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;r>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r0&&r.push(","),r.push("[");for(var a=0;a0&&r.push(","),a===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",a,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var o=new Function("det",r.join(""));return o(t<6?s[t]:s)}function i(){return[0]}function a(t,e){return[[e[0]],[t[0][0]]]}function o(){for(;u.length>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;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=m*n;return o>=s||o<=-s?o:b(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],u=r[1]-n[1],c=t[2]-n[2],f=e[2]-n[2],h=r[2]-n[2],d=a*u,p=o*l,g=o*s,v=i*u,m=i*l,b=a*s,_=c*(d-p)+f*(g-v)+h*(m-b),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(m)+Math.abs(b))*Math.abs(h),A=y*w;return _>A||-_>A?_:x(t,e,r,n)}];c()},{"robust-scale":222,"robust-subtract":224,"robust-sum":225,"two-product":245}],221:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return a(e,t[0]);if(1===e.length)return a(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.length0&&s>0||o<0&&s<0)return!1;var l=a(r,t,e),u=a(i,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,i))}e.exports=i;var a=t("robust-orientation")[3]},{"robust-orientation":220}],224:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],v=h(g);p=i?(a=d,c+=1,c=i?(a=d,c+=1,c0?1:0}},{}],227:[function(t,e,r){"use strict";function n(t){return a(i(t))}e.exports=n;var i=t("boundary-cells"),a=t("reduce-simplicial-complex")},{"boundary-cells":37,"reduce-simplicial-complex":212}],228:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;n0&&u.push(","),u.push("[");for(var n=0;n0&&u.push(","),u.push("B(C,E,c[",i[0],"],c[",i[1],"])")}u.push("]")}u.push(");")}}var r=0,n=new Array(t+1);n[0]=[[]];for(var i=1;i<=t;++i)for(var s=n[i]=o(i),l=0;l>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--i){i>1,s=o(t[a],e);s<=0?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function f(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[g],a))break}return r}function h(t,e){if(!e)return f(u(p(t,0)),t,0);for(var r=new Array(e),n=0;n>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){var n=s(r);if(e0){var t=k[0];return a(0,L-1),L-=1,u(0),t}return-1}function h(t,e){var r=k[t];return b[r]===e?t:(b[r]=-(1/0),c(t),f(),b[r]=e,L+=1,c(L-1))}function d(t){if(!x[t]){x[t]=!0;var e=m[t],r=y[t];m[r]>=0&&(m[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&h(T[e],i(e)),T[r]>=0&&h(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||i<0||i===n)break;if(n=i,i=t[n],!x[n]||i<0||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var g=e.length,v=t.length,m=new Array(g),y=new Array(g),b=new Array(g),x=new Array(g),_=0;_>1;_>=0;--_)u(_);for(;;){var S=f();if(S<0||b[S]>r)break;d(S)}for(var C=[],_=0;_=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&P.push([n,i])}}),o.unique(o.normalize(P)),{positions:C,edges:P}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":220,"simplicial-complex":232}],235:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return ol?i-l:o-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=a(r,i,s),u=a(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;if(l=a(s,o,i),u=a(s,o,r),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]}e.exports=i;var a=t("robust-orientation")},{"robust-orientation":220}],236:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=a(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=a(t.right,e);if(l)return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;a0){var s=a(this.slabs[e-1],t);s&&(o?h(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(o){var p=f(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":235,"binary-search-bounds":34,"functional-red-black-tree":84,"robust-orientation":220 +}],237:[function(t,e,r){"use strict";function n(t,e){var r=u(l(t,e),[e[e.length-1]]);return r[r.length-1]}function i(t,e,r,n){var i=n-e,a=-e/i;a<0?a=0:a>1&&(a=1);for(var o=1-a,s=t.length,l=new Array(s),u=0;u0||o>0&&c<0){var f=i(s,c,l,o);r.push(f),a.push(f.slice())}c<0?a.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),a.push(l.slice())),o=c}return{positive:r,negative:a}}function o(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u>=0&&r.push(s.slice()),a=u}return r}function s(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u<=0&&r.push(s.slice()),a=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=a,e.exports.positive=o,e.exports.negative=s},{"robust-dot-product":217,"robust-sum":225}],238:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function a(t,e){return Array(e+1).join(t)}var o={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,f,h,d=1,p=t.length,g="",v=[],m=!0,y="";for(s=0;s=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?v[v.length]=n:(!o.number.test(u[8])||m&&!u[3]?y="":(y=m?"+":"-",n=n.toString().replace(o.sign,"")),f=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",h=u[6]-(y+n).length,c=u[6]&&h>0?a(f,h):"",v[v.length]=u[5]?y+n+c:"0"===f?y+c+n:c+y+n)}return v.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],239:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],240:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128===0){f.length>0&&h.push("}}");var d="vExtra"+f.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(k="+"+v[x]+"*c");var T=.5*(p[x].length/y),E=.5+.5*(m[x]/y);M.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+k+")/("+g[x].join("+")+")")}h.push("a.push([",M.join(),"]);","break;")}n.push("}},"),f.length>0&&h.push("}}");for(var L=[],u=0;u<1<.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=L(t,360),e=L(e,100),r=L(r,100),0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,i,a=G(t,e,r),o=q(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function k(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){P(t)&&(t="100%");var n=R(t);return t=q(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function S(t){return q(1,G(0,t))}function C(t){return parseInt(t,16)}function P(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function R(t){return"string"==typeof t&&t.indexOf("%")!=-1}function N(t){return 1==t.length?"0"+t:""+t}function O(t){return t<=1&&(t=100*t+"%"),t}function I(t){return e.round(255*parseFloat(t)).toString(16)}function z(t){return C(t)/255}function j(t){return!!Z.CSS_UNIT.exec(t)}function D(t){t=t.replace(B,"").replace(U,"").toLowerCase();var e=!1;if(W[t])t=W[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Z.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),a:z(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),a:z(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.hex3.exec(t))&&{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),format:e?"name":"hex"}}function F(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var B=/^\s+/,U=/\s+$/,V=0,H=e.round,q=e.min,G=e.max,X=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=E(t),this._roundA=H(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=H(360*t.h),r=H(100*t.s),n=H(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=H(360*t.h),r=H(100*t.s),n=H(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:H(this._r),g:H(this._g),b:H(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+H(this._r)+", "+H(this._g)+", "+H(this._b)+")":"rgba("+H(this._r)+", "+H(this._g)+", "+H(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:H(100*L(this._r,255))+"%",g:H(100*L(this._g,255))+"%",b:H(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+H(100*L(this._r,255))+"%, "+H(100*L(this._g,255))+"%, "+H(100*L(this._b,255))+"%)":"rgba("+H(100*L(this._r,255))+"%, "+H(100*L(this._g,255))+"%, "+H(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,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(M,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=O(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return n(s)},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=F(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},n.mostReadable=function(t,e,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var W=n.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=n.hexNames=T(W),Z=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],242:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":198}],243:[function(t,e,r){"use strict";function n(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(o(t+1)),r=[],n=0;nMath.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var a=0,o=0,s=0;s<3;++s)a+=t[s]*t[s],o+=i[s]*t[s];for(var s=0;s<3;++s)i[s]-=o/a*t[s];return h(i,i),i}function o(t,e,r,n,i,a,o,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([a]),this.angle=l([o,s]),this.angle.bounds=[[-(1/0),-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;u<16;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.up||[0,1,0],i=t.right||a(r),s=t.radius||1,l=t.theta||0,u=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),h(r,r),i=[].slice.call(i,0,3),h(i,i),"eye"in t){var c=t.eye,p=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];f(i,p,r),n(i[0],i[1],i[2])<1e-6?i=a(r):h(i,i),s=n(p[0],p[1],p[2]);var g=d(r,p)/s,v=d(i,p)/s;u=Math.acos(g),l=Math.acos(v)}return s=Math.log(s),new o(t.zoomMin,t.zoomMax,e,r,i,s,l,u)}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),f=t("gl-vec3/cross"),h=t("gl-vec3/normalize"),d=t("gl-vec3/dot"),p=o.prototype;p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,i=0,a=0,o=0;o<3;++o)a+=e[o]*r[o],i+=e[o]*e[o];for(var s=Math.sqrt(i),l=0,o=0;o<3;++o)r[o]-=e[o]*a/i,l+=r[o]*r[o],e[o]/=s;for(var u=Math.sqrt(l),o=0;o<3;++o)r[o]/=u;var c=this.computedToward;f(c,e,r),h(c,c);for(var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],g=this.computedAngle[1],v=Math.cos(p),m=Math.sin(p),y=Math.cos(g),b=Math.sin(g),x=this.computedCenter,_=v*y,w=m*y,A=b,M=-v*b,k=-m*b,T=y,E=this.computedEye,L=this.computedMatrix,o=0;o<3;++o){var S=_*r[o]+w*c[o]+A*e[o];L[4*o+1]=M*r[o]+k*c[o]+T*e[o],L[4*o+2]=S,L[4*o+3]=0}var C=L[1],P=L[5],R=L[9],N=L[2],O=L[6],I=L[10],z=P*I-R*O,j=R*N-C*I,D=C*O-P*N,F=n(z,j,D);z/=F,j/=F,D/=F,L[0]=z,L[4]=j,L[8]=D;for(var o=0;o<3;++o)E[o]=x[o]+L[2+4*o]*d;for(var o=0;o<3;++o){for(var l=0,B=0;B<3;++B)l+=L[o+4*B]*E[B];L[12+o]=-l}L[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 g=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;g[0]=i[2],g[1]=i[6],g[2]=i[10];for(var a=this.computedUp,o=this.computedRight,s=this.computedToward,l=0;l<3;++l)i[4*l]=a[l],i[4*l+1]=o[l],i[4*l+2]=s[l];c(i,i,n,g);for(var l=0;l<3;++l)a[l]=i[4*l],o[l]=i[4*l+1];this.up.set(t,a[0],a[1],a[2]),this.right.set(t,o[0],o[1],o[2])}},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=(Math.exp(this.computedRadius[0]),a[1]),s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],f=a[4],h=a[8],d=c*o+f*s+h*l;c-=o*d,f-=s*d,h-=l*d;var p=n(c,f,h);c/=p,f/=p,h/=p;var g=c*e+o*r,v=f*e+s*r,m=h*e+l*r;this.center.move(t,g,v,m);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e,r,a){var o=1;"number"==typeof r&&(o=0|r),(o<0||o>3)&&(o=1);var s=(o+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[o],c=e[o+4],f=e[o+8];if(a){var h=Math.abs(l),d=Math.abs(c),p=Math.abs(f),g=Math.max(h,d,p);h===g?(l=l<0?-1:1,c=f=0):p===g?(f=f<0?-1:1,l=c=0):(c=c<0?-1:1,l=f=0)}else{var v=n(l,c,f);l/=v,c/=v,f/=v}var m=e[s],y=e[s+4],b=e[s+8],x=m*l+y*c+b*f;m-=l*x,y-=c*x,b-=f*x;var _=n(m,y,b);m/=_,y/=_,b/=_;var w=c*b-f*y,A=f*m-l*b,M=l*y-c*m,k=n(w,A,M);w/=k,A/=k,M/=k,this.center.jump(t,q,G,X),this.radius.idle(t),this.up.jump(t,l,c,f),this.right.jump(t,m,y,b);var T,E;if(2===o){var L=e[1],S=e[5],C=e[9],P=L*m+S*y+C*b,R=L*w+S*A+C*M;T=z<0?-Math.PI/2:Math.PI/2,E=Math.atan2(R,P)}else{var N=e[2],O=e[6],I=e[10],z=N*l+O*c+I*f,j=N*m+O*y+I*b,D=N*w+O*A+I*M;T=Math.asin(i(z)),E=Math.atan2(D,j)}this.angle.jump(t,E,T),this.recalcMatrix(t);var F=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var H=V[15],q=V[12]/H,G=V[13]/H,X=V[14]/H,W=Math.exp(this.computedRadius[0]);this.center.jump(t,q-F*W,G-B*W,X-U*W)},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,a){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,a=a||this.computedUp;var o=a[0],s=a[1],l=a[2],u=n(o,s,l);if(!(u<1e-6)){o/=u,s/=u,l/=u;var c=e[0]-r[0],f=e[1]-r[1],h=e[2]-r[2],d=n(c,f,h);if(!(d<1e-6)){c/=d,f/=d,h/=d;var p=this.computedRight,g=p[0],v=p[1],m=p[2],y=o*g+s*v+l*m;g-=y*o,v-=y*s,m-=y*l;var b=n(g,v,m);if(!(b<.01&&(g=s*h-l*f,v=l*c-o*h,m=o*f-s*c,b=n(g,v,m),b<1e-6))){g/=b,v/=b,m/=b,this.up.set(t,o,s,l),this.right.set(t,g,v,m),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=s*m-l*v,_=l*g-o*m,w=o*v-s*g,A=n(x,_,w);x/=A,_/=A,w/=A;var M=o*c+s*f+l*h,k=g*c+v*f+m*h,T=x*c+_*f+w*h,E=Math.asin(i(M)),L=Math.atan2(T,k),S=this.angle._state,C=S[S.length-1],P=S[S.length-2];C%=2*Math.PI;var R=Math.abs(C+2*Math.PI-L),N=Math.abs(C-L),O=Math.abs(C-2*Math.PI-L);R0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function f(t){return new Int16Array(o(2*t),0,t)}function h(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return x?new Uint8ClampedArray(o(t),0,t):s(t)}function v(t){return new DataView(o(t),0,t)}function m(t){t=y.nextPow2(t);var e=y.log2(t),r=A[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,A=_.BUFFER;r.free=function(t){if(n.isBuffer(t))A[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){A[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8": +return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return f(t);case"int32":return h(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return m(t);case"data":case"dataview":return v(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=f,r.mallocInt32=h,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=v,r.mallocBuffer=m,r.clearCache=function(){for(var t=0;t<32;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,A[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":35,buffer:45,dup:77}],248:[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;e8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function o(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),!(e<0)&&(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof x||a();var s=[],l=[],u=b++;return Object.create(x.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(o)}})};x.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||!!c&&c.has___(t)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof x||a();var l,u=new s,c=void 0,f=!1;return l=o?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new x),c.set(t,e)),this}:function(t,e){if(f)try{u.set(t,e)}catch(r){c||(c=new x),c.set___(t,e)}else u.set(t,e);return this},Object.create(x.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");f=!0})}})}o&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=x.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=x)}}()},{}],253:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":254}],254:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],255:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":253}],256:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":86}],257:[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":70}],258:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":257}],259:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("opacity"),u("align"),u("bgcolor");var f=u("bordercolor"),h=i.opacity(f);u("borderpad");var d=u("borderwidth"),p=u("showarrow");u("text",p?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font);for(var g=["x","y"],v=[-10,-30],m={_fullLayout:r},y=0;y<2;y++){var b=g[y],x=a.coerceRef(t,e,m,b,"","paper");if(a.coercePosition(e,m,u,x,b,.5),p){var _="a"+b,w=a.coerceRef(t,e,m,_,"pixel");"pixel"!==w&&w!==x&&(w=e[_]="pixel");var A="pixel"===w?v[y]:.4;a.coercePosition(e,m,u,w,_,A)}else u(b+"anchor")}return n.noneOrAll(t,e,["x","y"]),p&&(u("arrowcolor",h?e.bordercolor:i.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(h&&d||1)),n.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":364,"../../plots/cartesian/axes":393,"../color":268,"./attributes":261}],260:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],261:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":359,"../../plots/cartesian/constants":398,"../../plots/font_attributes":413,"./arrow_paths":260}],262:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,f=s-l,h=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),f=Math.max(f,d),h=Math.max(h,d)}r&&r.autorange&&a.expand(r,[r.l2c(r.r2l(e.x))],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(n.r2l(e.y))],{ppadplus:h,ppadminus:f})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":364,"../../plots/cartesian/axes":393,"./draw":264}],263:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),i=t("./annotation_defaults");e.exports=function(t,e){var r={name:"annotations",handleItemDefaults:i};n(t,e,r)}},{"../../plots/array_container_defaults":390,"./annotation_defaults":259}],264:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=$.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,m=Math.round(u+2*tt),y=Math.round(p+2*tt);q._w=u,q._h=p;var x=!1;if(["x","y"].forEach(function(e){var n,i=q[e+"ref"]||e,a=f.getFromId(t,i),o=(Y+("x"===e?0:90))*Math.PI/180,s=m*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=q[e+"anchor"];if(a){var u=a.r2fraction(q[e]);if(!a.autorange&&(u<0||u>1)&&(q["a"+e+"ref"]===i?(u=a.r2fraction(q["a"+e]),(u<0||u>1)&&(x=!0)):x=!0,x))return;W[e]=a._offset+a.r2p(q[e]),n=.5}else n=q[e],"y"===e&&(n=1-n),W[e]="x"===e?P.l+P.w*n:P.t+P.h*n;var c=0;q["a"+e+"ref"]===i?W["aa"+e]=a._offset+a.r2p(q["a"+e]):(c=q.showarrow?q["a"+e]:s*r(n,l),W[e]+=c),q["_"+e+"type"]=a&&a.type,q["_"+e+"size"]=s,q["_"+e+"shift"]=c}),x)return void $.remove();var _,w;q.showarrow&&(_=q.axref===q.xref?W.x:c.constrain(W.x-q.ax,1,M.width-1),w=q.ayref===q.yref?W.y:c.constrain(W.y-q.ay,1,M.height-1)),W.x=c.constrain(W.x,1,M.width-1),W.y=c.constrain(W.y,1,M.height-1);var A=tt-s.top,k=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:k,y:A}),nt.selectAll("tspan.line").attr({y:A,x:k})),et.call(d.setRect,K/2,K/2,m-K,y-K);var T=0,E=0;T=q.axref===q.xref?Math.round(W.aax-m/2):Math.round(W.x-m/2),E=q.ayref===q.yref?Math.round(W.aay-y/2):Math.round(W.y-y/2),$.call(c.setTranslate,T,E);var L="annotations["+e+"]",S=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=q.axref===q.xref?W.aax+r:W.x+r,s=q.ayref===q.yref?W.aay+n:W.y+n;var u=c.rotationXYMatrix(Y,i,s),f=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,m=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!m.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){m.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=q.arrowwidth,x=q.arrowcolor,A=Z.append("g").style({opacity:h.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=A.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(h.stroke,h.rgb(x));b(M,q.arrowhead,"end",q.arrowsize);var k=A.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,S;v.init({element:k.node(),prepFn:function(){var t=c.getTranslate($);E=t.x,S=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){A.attr("transform","translate("+t+","+e+")");var r=f(E,S),n=r[0]+t,i=r[1]+e;$.call(c.setTranslate,n,i),T[L+".x"]=G?G.p2r(G.r2p(q.x)+t):(_+t-P.l)/P.w,T[L+".y"]=X?X.p2r(X.r2p(q.y)+e):1-(w+e-P.t)/P.h,q.axref===q.xref&&(T[L+".ax"]=G?G.p2r(G.r2p(q.ax)+t):(_+t-P.l)/P.w),q.ayref===q.yref&&(T[L+".ay"]=X?X.p2r(X.r2p(q.ay)+e):1-(w+e-P.t)/P.h),Q.attr({transform:"rotate("+Y+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};q.showarrow&&S(0,0);var C=c.rotationXYMatrix(Y,W.x,W.y),R=c.apply2DTransform(C);if(t._context.editable){var N,O,I;v.init({element:$.node(),prepFn:function(){var t=c.getTranslate($);N=t.x,O=t.y,I={}},moveFn:function(t,e){$.call(c.setTranslate,N+t,O+e);var r="pointer";if(q.showarrow)q.axref===q.xref?I[L+".ax"]=G.p2r(G.r2p(q.ax)+t):I[L+".ax"]=q.ax+t,q.ayref===q.yref?I[L+".ay"]=X.p2r(X.r2p(q.ay)+e):I[L+".ay"]=q.ay+e,S(t,e);else{if(G)I[L+".x"]=q.x+t/G._m;else{var n=q._xsize/P.w,i=q.x+q._xshift/P.w-n/2;I[L+".x"]=v.align(i+t/P.w,n,0,1,q.xanchor)}if(X)I[L+".y"]=q.y+e/X._m;else{var a=q._ysize/P.h,o=q.y-q._yshift/P.h-a/2;I[L+".y"]=v.align(o-e/P.h,a,0,1,q.yanchor)}G&&X||(r=v.getCursor(G?.5:I[L+".x"],X?.5:I[L+".y"],q.xanchor,q.yanchor))}var s=R(N,O),l=s[0]+t,u=s[1]+e;$.call(c.setTranslate,N+t,O+e),Q.attr({transform:"rotate("+Y+","+l+","+u+")"}),g($,r)},doneFn:function(e){if(g($),e){l.relayout(t,I);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,A=t.layout,M=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return A.annotations=u,y(A,M),void n(t);if("remove"===u)return delete A.annotations,M.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)M._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}M._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=A.annotations[e],E=M.annotations[e];if(T){var L={};"string"==typeof r&&r?L[r]=u:c.isPlainObject(r)&&(L=r);var S=Object.keys(L);for(w=0;w4/3&&(j=V)}}else z&&(F&&(j<1/3?j+=U:j>2/3&&(j-=U)),j=(j-z.domain[0])/(z.domain[1]-z.domain[0]),j=z.fraction2r(j))}z&&z===I&&D&&("log"===D&&"log"!==z.type?j=Math.pow(10,j):"log"!==D&&"log"===z.type&&(j=j>0?Math.log(j)/Math.LN10:void 0)),T[O]=j}}var q={};m(T,q,M),M.annotations[e]=q;var G=f.getFromId(t,q.xref),X=f.getFromId(t,q.yref),W={x:0,y:0},Y=+q.textangle||0,Z=M._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",q.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:q})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),K=q.borderwidth,J=q.borderpad,tt=K+J,et=$.append("rect").attr("class","bg").style("stroke-width",K+"px").call(h.stroke,q.bordercolor).call(h.fill,q.bgcolor),rt=q.font,nt=$.append("text").classed("annotation",!0).attr("data-unformatted",q.text).text(q.text);t._context.editable?nt.call(p.makeEditable,$).call(x).on("edit",function(r){q.text=r,this.attr({"data-unformatted":q.text}),this.call(x);var n={};n["annotations["+e+"].text"]=q.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(x),Q.attr({transform:"rotate("+Y+","+W.x+","+W.y+")"}).call(d.setPosition,W.x,W.y)}}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,f=n-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var g=(u*d-c*h)/p,v=(u*f-l*h)/p;return v<0||v>1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./annotation_defaults"),y=t("./defaults"),b=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":364,"../../lib/setcursor":374,"../../lib/svg_text_utils":378,"../../plotly":388,"../../plots/cartesian/axes":393,"../../plots/plots":430,"../color":268,"../dragelement":289,"../drawing":291,"./annotation_defaults":259,"./defaults":263,"./draw_arrow_head":265,d3:74,"fast-isnumeric":82}],265:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var f,h,d,p,g=(o.getPx(t,"stroke-width")||1)*l,v=t.style("stroke")||a.defaultLine,m=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=c.backoff*g;if("line"===u.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},h={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(f.y-h.y,f.x-h.x),p=d+Math.PI,x){var _=x*Math.cos(d),w=x*Math.sin(d);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),b&&(h.x+=_,h.y+=w,t.attr({x2:h.x,y2:h.y}))}}else if("path"===u.nodeName){var A=u.getTotalLength(),M="";if(y){var k=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(k.y-T.y,k.x-T.x),f=u.getPointAtLength(Math.min(x,A)),x&&(M="0px,"+x+"px,")}if(b){var E=u.getPointAtLength(A),L=u.getPointAtLength(A-.1);if(p=Math.atan2(E.y-L.y,E.x-L.x),h=u.getPointAtLength(Math.max(0,A-x)),x){var S=M?2*x:x;M+=A-S+"px,"+A+"px"}}else M&&(M+=A+"px");M&&t.style("stroke-dasharray",M)}var C=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:v,opacity:m,"stroke-width":0})};y&&C(f,d),b&&C(h,p)}}},{"../color":268,"../drawing":291,"./arrow_paths":260,d3:74,"fast-isnumeric":82}],266:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":261,"./calc_autorange":262,"./defaults":263,"./draw":264}],267:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],268:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(C);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?L[0]:(C[e]+C[e-1])/2,e===C.length-1?L[1]:(C[e]+C[e+1])/2].map(J.c2p).map(Math.round);e!==C.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=R(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({x:W,width:Math.max(B,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2), +fill:o})});var h=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){n.select(this).attr("d","M"+W+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+B).call(d.lineGroupStyle,_.line.width,P(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=W+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));A("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:k.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,i=x();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(a,r||{}))}function M(){var r=B+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(j=ot.select("text"),j.node()&&!j.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-W-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-$;at.select(".cbbg").attr({x:W-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:W,y:$+_.ypad+("top"===_.titleside?st:0),width:Math.max(B,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var k=t._fullLayout,T=k._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void k._infolayer.selectAll("g."+e).remove();var E,L=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],C=[],P="function"==typeof _.line.color?_.line.color:function(){return _.line.color},R="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},N=_.levels.end+_.levels.size/100,O=_.levels.size,I=1.001*L[0]-.001*L[1],z=1.001*L[1]-.001*L[0];for(E=_.levels.start;(E-N)*O<0;E+=O)E>I&&EL[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+H-X],J.setScale();var at=k._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+q)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+H-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,A(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ft=c.syncOrAsync([o.previousPromises,w,o.previousPromises,M],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var ht,dt,pt;u.init({element:at.node(),prepFn:function(){ht=at.attr("transform"),h(at)},moveFn:function(t,e){at.attr("transform",ht+" translate("+t+","+e+")"),dt=u.align(Y+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,H,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);h(at,r)},doneFn:function(e){h(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},x().index)}})}return ft}function x(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":364,"./flip_scale":279,"./scales":286}],275:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":359,"./attributes":273,"./scales.js":286}],276:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":286}],277:[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,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,g=f?i.nestedProperty(e,d).get()||{}:e,v=p[h+"min"],m=p[h+"max"],y=p.colorscale,b=n(v)&&n(m)&&v=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],280:[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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):e}},{"./default_scale":276,"./is_valid_scale_array":284,"./scales":286}],281:[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(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],288:[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":364}],289:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,g=o.getPlotDiv(t.element)||{},v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":364,"../../plotly":388,"../../plots/cartesian/constants":398,"./align":287,"./cursor":288,"./unhover":290}],290:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":358}],291:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,f,h;t.so?(h=o.outlierwidth,f=o.outliercolor,c=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(h||1)+"px",fill:"none"}):(e.style("stroke-width",h+"px").call(l.fill,c),h&&e.call(l.stroke,f))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),f=(c*c*i-u*u*s)*n,h=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&f/d),2),a.round(e[1]+(d&&h/d),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&h/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var v=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=g.tryColorscale(i,""),s=g.tryColorscale(i,"line");n(t,e,r,o,s,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),i=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,a.select(this),e,n,i)})}},g.tryColorscale=function(t,e){var r=e?c.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):c.identity};var b={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(f.convertToTspans);var h=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*x+1,v=b[l]*c,m=.75*u+b[s]*c+(b[s]-1)*p*u/2;h.attr("transform","translate("+v+","+m+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=k&&(a.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":352,"../../lib":364,"../../lib/svg_text_utils":378,"../../registry":438,"../../traces/scatter/make_bubble_size_func":469,"../../traces/scatter/subtypes":474,"../color":268,"../colorscale":282,"./symbol_defs":292,d3:74,"fast-isnumeric":82}],292:[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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r; +},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:74}],293:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],294:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),f=0;f0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);c&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;f="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");s=!v.size(),s?v=e.append("path").classed("yerror",!0):c&&(v=v.transition().duration(r.duration).ease(r.easing)),v.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var m=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-m)+"v"+2*m+"m0,-"+m+"H"+o.xs,o.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":474,d3:74,"fast-isnumeric":82}],299:[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":268,d3:74}],300:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":398}],301:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}var o=n("source"),l=n("visible",!!o);if(!l)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var u={_fullLayout:r},c=["x","y"],f=0;f<2;f++)a.coerceRef(t,e,u,c[f],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var r={name:l,handleItemDefaults:n};o(t,e,r)}},{"../../lib":364,"../../plots/array_container_defaults":390,"../../plots/cartesian/axes":393,"./attributes":300}],302:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,f=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,h=c*d.x[e.xanchor].offset,p=f*d.y[e.yanchor].offset,g=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,v=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+h,m=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:v,y:m,width:c,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=o?o._id:"",b=l?l._id:"",x=y+b;x&&r.call(i.setClipUrl,"clip"+s._uid+x)}for(var s=t._fullLayout,l=[],u=[],c=[],f=0;f=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}},{}],305:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":359,"../../plots/font_attributes":413,"../color/attributes":267}],306:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],307:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(b!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",v),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":364,"../../plots/layout_attributes":428,"../../registry":438,"./attributes":305,"./helpers":310}],308:[function(t,e,r){"use strict";function n(t,e){function r(r){m.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?f.call(m.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=r.indexOf(f);h===-1?r.push(f):r.splice(h,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;r=s*h,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cn.width-(n.margin.r+n.margin.l)&&(b=0,v+=m,i.height=i.height+m,m=0),f.setTranslate(this,a+b,5+a+e.height/2+v),i.width+=o+r,i.height=Math.max(i.height,e.height),b+=o+r,m=Math.max(e.height,m)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),b=t("./get_legend_data"),x=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(g.setRect,F,t,y.scrollBarWidth,y.scrollBarHeight),k.select("rect").attr({y:m.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var m=r.legend,_=r.showlegend&&b(t.calcdata,m),A=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var E=M.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=M.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=E.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var C=S.selectAll("g.traces").data(f.identity);C.enter().append("g").attr("class","traces"),C.exit().remove(),C.call(x).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?A.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var P=0!==M.enter().size();P&&(o(t,S,C),s(t));var R=0,N=r.width,O=0,I=r.height;o(t,S,C),m.height>I?l(t):s(t);var z=r._size,j=z.l+z.w*m.x,D=z.t+z.h*(1-m.y);w.isRightAnchor(m)?j-=m.width:w.isCenterAnchor(m)&&(j-=m.width/2),w.isBottomAnchor(m)?D-=m.height:w.isMiddleAnchor(m)&&(D-=m.height/2);var F=m.width,B=z.w;F>B?(j=z.l,F=B):(j+F>N&&(j=N-F),jV?(D=z.t,U=V):(D+U>I&&(D=I-U),Dr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":364,"../../registry":438,"../../traces/pie/style_one":452,"../../traces/scatter/subtypes":474,"../color":268,"../drawing":291,d3:74}],313:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(v,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",o.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":364,"../color":268,"./attributes":317,"./button_attributes":318,"./constants":319}],321:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},i=S.line.width?S.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",S.opacity).call(_.stroke,i).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);C&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+C),t._context.editable&&f(t,a,S,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:b.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>W&&!t.shiftKey?A.getCursor(i/r,1-a/n):"move";M(e,o),G=o.split("-")[0]}function a(e){F=x.getFromId(t,r.xref),B=x.getFromId(t,r.yref),U=T.getDataToPixel(t,F),V=T.getDataToPixel(t,B,!0),H=T.getPixelToData(t,F),q=T.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(j=r.path,D=a+".path"):(c=U(r.x0),f=V(r.y0),h=U(r.x1),d=V(r.y1),g=a+".x0",m=a+".y0",b=a+".x1",_=a+".y1"),cW&&(u[S]=r[N]=q(s),u[C]=r[O]=q(l)),f-c>X&&(u[P]=r[I]=H(c),u[R]=r[z]=H(f))}e.attr("d",p(t,r))}var u,c,f,h,d,g,m,b,_,w,k,E,L,S,C,P,R,N,O,I,z,j,D,F,B,U,V,H,q,G,X=10,W=10,Y={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=Y.element.getBoundingClientRect();A.init(Y)}function h(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):b.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=x.getFromId(t,r.id,"x")._id,i=x.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=x.getFromId(t,e.xref),l=x.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),f=n(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,v=(h+d)/2,m=Math.abs(p-c),y=Math.abs(v-h),b="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),b.log("Ignoring extra params in segment "+t)),i+l})}function v(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var m=t("fast-isnumeric"),y=t("../../plotly"),b=t("../../lib"),x=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),A=t("../dragelement"),M=t("../../lib/setcursor"),k=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),L=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":364,"../../lib/setcursor":374,"../../plotly":388,"../../plots/cartesian/axes":393,"../color":268,"../dragelement":289,"../drawing":291,"./constants":331,"./defaults":332,"./helpers":334,"./shape_defaults":336,"fast-isnumeric":82}],334:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){ +return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],335:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":329,"./calc_autorange":330,"./defaults":332,"./draw":333}],336:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var f=t.path?"path":"rect",h=u("type",f),d=["x","y"],p=0;p<2;p++){var g=d[p],v={_fullLayout:r},m=i.coerceRef(t,e,v,g,"","paper");if("path"!==h){var y,b,x,_=.25,w=.75;"paper"!==m?(y=i.getFromId(v,m),x=o.rangeToShapePosition(y),b=o.shapePositionToRange(y)):b=x=n.identity;var A=g+"0",M=g+"1",k=t[A],T=t[M];t[A]=b(t[A],!0),t[M]=b(t[M],!0),i.coercePosition(e,v,u,m,A,_),i.coercePosition(e,v,u,m,M,w),e[A]=x(e[A]),e[M]=x(e[M]),t[A]=k,t[M]=T}}return"path"===h?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":364,"../../plots/cartesian/axes":393,"./attributes":329,"./helpers":334}],337:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":359,"../../plots/animation_attributes":389,"../../plots/font_attributes":413,"../../plots/pad_attributes":429,"./constants":338}],338:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],339:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+S.railTouchRectClass).data([0]);n.enter().append("rect").classed(S.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,S.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),M.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+S.railRectClass).data([0]);r.enter().append("rect").classed(S.railRectClass,!0);var n=e.inputAreaLength-2*S.railInset;r.attr({width:n,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(r,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+S.groupClassName).data(r,i);l.enter().append("g").classed(S.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,L=!0,S=P,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,M=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,L=!1,S=g.title.trim();""===S&&(E=0),S.match(/Click to enter .+ title/)&&(E=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var P="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?a.restyle(t,v,e,m):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":364,"../../lib/svg_text_utils":378,"../../plotly":388,"../../plots/plots":430,"../color":268,"../drawing":291,d3:74,"fast-isnumeric":82}],343:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":359,"../../plots/font_attributes":413,"../../plots/pad_attributes":429,"../color/attributes":267}],344:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],345:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var f=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){b.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],352:[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}},{}],353:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":266,"./components/images":303,"./components/legend":311,"./components/rangeselector":323,"./components/rangeslider":328,"./components/shapes":335,"./components/sliders":341,"./components/updatemenus":347,"./fonts/mathjax_config":354,"./lib/queue":372,"./plot_api/plot_schema":382,"./plot_api/register":383,"./plot_api/set_plot_config":384,"./plot_api/to_image":386,"./plot_api/validate":387,"./plotly":388,"./snapshot":443,"./snapshot/download":440,"./traces/scatter":464,d3:74,"es6-promise":79}],354:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],355:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":350,"fast-isnumeric":82}],356:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t); +for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var v=(new Date).getFullYear();e=((Number(u[0])-v+70)%100+200)%100+v-70}if(!a(e))return l;var m=new Date(0,0,1);if(m.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(m.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(m.setDate(i),m.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(m.setHours(o),m.getHours()!==o)return l;if(u.length>1)return i=m.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=f*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return m.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,v=3*c,m=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":355,"./coerce":356,"./dates":357,"./extend":359,"./filter_unique":360,"./filter_visible":361,"./is_array":365,"./is_plain_object":366,"./loggers":367,"./matrix":368,"./nested_property":369,"./notifier":370,"./search":373,"./stats":376,d3:74}],365:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],366:[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}},{}],367:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,h(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;uMath.max(c,g)||l>Math.max(f,v)))if(lc||Math.abs(n(o,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":368}],372:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;f90&&l.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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":82}],377:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:15,tinycolor2:241}],378:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,v.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){ +return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":351,"../constants/xmlns_namespaces":352,"../lib":364,d3:74}],379:[function(t,e,r){"use strict";function n(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=f.cleanId(r,n))}function i(t){var e="middle",r="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?r="left":t.indexOf("right")!==-1&&(r="right"),e+" "+r}function a(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var o=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),l=t("../registry"),u=t("../lib"),c=t("../plots/plots"),f=t("../plots/cartesian/axes"),h=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.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);var i=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lP.range[0]?[1,2]:[2,1]);else{var R=P.range[0],N=P.range[1];"log"===x?(R<=0&&N<=0&&r(E+".autorange",!0),R<=0?R=N/1e6:N<=0&&(N=R/1e6),r(E+".range[0]",Math.log(R)/Math.LN10),r(E+".range[1]",Math.log(N)/Math.LN10)):(r(E+".range[0]",Math.pow(10,R)),r(E+".range[1]",Math.pow(10,N)))}else r(E+".autorange",!0)}if("reverse"===k)L.range?L.range.reverse():(r(E+".autorange",!0),L.range=[1,0]),S.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var O=m.parts[1],I=m.parts[0],z=a[I]||[],j=z[O]||{};2===m.parts.length&&(null===x&&(e[v]="remove"),"add"===e[v]||b.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?O===-1?(g[I]=z,delete g[v]):g[v]=j:b.log("???",e)),!n(j,"x")&&!n(j,"y")||b.containsAny(v,["color","opacity","align","dash"])||(d.docalc=!0);var D=w.getComponentMethod(I,"drawOne");D(t,O,m.parts.slice(2).join("."),e[v]),delete e[v]}else if(A.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1])C.manageArrayContainers(m,x,g),d.doplot=!0;else{var F=String(m.parts[1]||"");0===m.parts[0].indexOf("scene")?d.doplot=!0:0===m.parts[0].indexOf("geo")?d.doplot=!0:0===m.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===v?d.doplot=!0:!o._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?d.docalc=!0:m.parts[0].indexOf("legend")!==-1?d.dolegend=!0:v.indexOf("title")!==-1?d.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&b.containsAny(F,["tick","exponent","grid","zeroline"])?d.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:m.parts.length>1&&F.indexOf("line")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&"mirror"===F?d.doticks=d.dolayoutstyle=!0:"margin.pad"===v?d.doticks=d.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(d.doplot=!0):d.doplot=!0,m.set(x)}}}var B=t._fullLayout.width,U=t._fullLayout.height;A.supplyDefaults(t),t.layout.autosize&&A.plotAutoSize(t,t.layout,t._fullLayout);var V=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==U;return V&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:b.extendDeep({},p)}}function g(t){var e=v.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];v.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=b.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(L.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),b=t("../lib"),x=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),A=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),k=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),L=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),C=t("./helpers"),P=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=R._basePlotModules,r=0;r=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=C.getGraphDiv(t),!b.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=A.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function g(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var v,m,y=0,x=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&b.isPlainObject(e);if(M)x.push({type:"object",data:g(b.extendFlat({},e))});else if(_||"string"==typeof e)for(v=0;v0&&EE)&&L.push(m);x=L}}x.length>0?f(x):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=C.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!b.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:A.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),A.modifyFrames(t,a)},y.purge=function(t){t=C.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return A.cleanPlot([],{},r,e),A.purge(t),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":291,"../components/errorbars":297,"../constants/xmlns_namespaces":352,"../lib":364,"../lib/events":358,"../lib/queue":372,"../lib/svg_text_utils":378,"../plotly":388,"../plots/cartesian/graph_interact":400,"../plots/plots":430,"../plots/polar":433,"../registry":438,"./helpers":379,"./subroutines":385,d3:74,"fast-isnumeric":82}],381:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],382:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};_(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return _(t,g),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)c(t,r,"xaxis"),c(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;c(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){f(t,r,e+r.name)}):f(t,r,r.name))}),{layoutAttributes:o(t)}}function a(t){var e=h.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):t.arrayOk===!0&&(i[n+"src"]=e(n)):d.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function l(t){function e(t,e,r){if(t){var n=t[A];n&&(delete t[A],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return x(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),x(t,b.layout),t}function c(t,e,r){var n=d.nestedProperty(t,r),i=_({},e.layoutAttributes);i[w]=!0,n.set(i)}function f(t,e,r){var n=d.nestedProperty(t,r),i=_(n.get()||{},e.layoutAttributes);n.set(i)}var h=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),m=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),x=d.extendFlat,_=d.extendDeep,w="_isSubplotObj",A="_isLinkedToArray",M="_deprecated",k=[w,A,M];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=A,r.DEPRECATED=M,r.UNDERSCORE_ATTRS=k,r.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:k.concat.role},traces:t,layout:i(),transforms:e,frames:o(v),animation:o(m)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];k.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||d.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){a=a.slice(0,s).concat([r]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=n(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":364,"../plotly":388,"../snapshot/cloneplot":439,"../snapshot/helpers":442,"../snapshot/svgtoimg":444,"../snapshot/tosvg":446,"fast-isnumeric":82}],387:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;mc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=C&&i<=10||e>=15*C)t._tickround="d";else if(e>=R&&i<=16||e>=P)t._tickround="M";else if(e>=N&&i<=19||e>=R)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(b(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);b(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(Y),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(b(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=V(c):"m"===l?a=H(c):"d"===l?(r||(i="
"+V(c)),a=q(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=W(c),"S"!==l&&(a+=h(y.round(m(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=q(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&m(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,m(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},O.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===i){var g=n-1,v=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,v)]:[g,v]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r.map(t.l2r||Number)},O.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=O.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},O.saveRangeInitial=function(t,e){for(var r=O.list(t,"",!0),n=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=v-1;a>5;a--)i(a)}},O.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},O.autoTicks(f,s);var h,d=O.tickIncrement(O.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*x||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&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),a(t),t._tmin=O.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=O.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),f=0;fL?(e/=L,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,z)):n>S?(e/=S,t.dtick="M"+i(e,1,j)):n>C?(t.dtick=i(e,C,F),t.tick0="2000-01-02"):n>P?t.dtick=i(e,P,j):n>R?t.dtick=i(e,R,D):n>N?t.dtick=i(e,N,D):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,z))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,z)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,z));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},O.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?U:B,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},O.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]a:f1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":350,"../../lib":364,"fast-isnumeric":82}],395:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),f=[],h=0;h0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],398:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],399:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),b=t("./constants"),x=!0;e.exports=function(t,e,r,s,_,w,A,M){function k(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+vt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+vt+")").attr("d","M0,0Z"),L()}function L(){pt.selectAll(".select-outline").remove()}function S(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(H,e+at)),i=Math.max(0,Math.min(q,r+ot)),a=Math.abs(n-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,X)/2);st.l=Math.min(at,n),st.r=Math.max(at,n),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!J||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function C(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),x=!1)))}function R(e,r){var i=1===(A+M).length;if(e)j();else if(2!==r||i){if(1===r&&i){var a=A?V[0]:U[0],o="s"===A||"w"===M?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",f="middle";if(a.fixedrange)return;A?(f="n"===A?"top":"bottom","right"===a.side&&(c="right")):"e"===M&&(c="right"),rt.call(h.makeEditable,null,{immediate:!0,background:F.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&u.relayout(t,s,r)})}}else z()}function N(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||F._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void f.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=mt[0]+mt[2]*l,c=(s.bottom-e.clientY)/s.height,h=mt[1]+mt[3]*(1-c);if(M){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,r){for(var n,a,o=1-e,s=0;s0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nY.width||W<0||W>Y.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:M[0]._length/2,W="ypx"in e?e.ypx:k[0]._length/2;if(P="xval"in e?n(a,e.xval):i(M,X),R="yval"in e?n(a,e.yval):i(k,W),!g(P[0])||!g(R[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(O=0;O1||z.hoverinfo.indexOf("name")!==-1?z.name:void 0,index:!1,distance:Math.min(Z,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[j]&&(V.subplot=o[j]._subplot),H=q.length,"array"===F){var Q=e[O];"pointNumber"in Q?(V.index=Q.pointNumber,F="closest"):(F="","xval"in Q&&(B=Q.xval,F="x"),"yval"in Q&&(U=Q.yval,F=F?"closest":"y"))}else B=P[D],U=R[D];if(z._module&&z._module.hoverPoints){var $=z._module.hoverPoints(V,B,U,F);if($)for(var K,J=0;J<$.length;J++)K=$[J],g(K.x0)&&g(K.y0)&&q.push(l(K,C))}else v.log("Unrecognized trace type in hover:",z);"closest"===C&&q.length>H&&(q.splice(0,H),Z=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var tt="y"===C&&G.length>1;q.sort(function(t,e){return t.distance-e.distance});var et=b.combine(o.plot_bgcolor||b.background,o.paper_bgcolor),rt={hovermode:C,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(q,rt);c(q,tt?"xa":"ya"),f(nt,tt);var it=t._hoverdata,at=[];for(N=0;N128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):k&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0;r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0),v=h.node().getBoundingClientRect().width+2*N):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,T=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),O=T.width+R+N+v;t.ty0=_-T.top,t.bx=T.width+2*N,t.by=T.height+2*N,t.anchor="start",t.txwidth=T.width,t.tx2width=v,t.offset=0,a?(t.pos=L,m=S+P/2+O<=M,A=S-P/2-O>=0,"top"!==t.idealAlign&&m||!A?m?(S+=P/2,t.anchor="start"):t.anchor="middle":(S-=P/2,t.anchor="end")):(t.pos=S,m=L+C/2+O<=w,A=L-C/2-O>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(a?"rotate("+E+")":""))}),S}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?S:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var v=f[o];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(R+N),s=o+a*(t.txwidth+N),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-P,l=t.offset*C),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*R+l)+","+(R+u)+"v"+(t.by/2-R)+"h"+n*t.bx+"v-"+t.by+"H"+(n*R+l)+"V"+(u-R)+"Z"),i.call(x.setPosition,o+l,u+t.ty0-t.by/2+N).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+a*N+l,u+t.ty0-t.by/2+N),r.select("rect").call(x.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),M=t("./dragbox"),k=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,k,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=T.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":364,"fast-isnumeric":82}],406:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,M=i.xaxes[0]._length,k=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,P,R,N,O,I=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),z=[],j=i.gd,D=[];for(C=0;C0)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*f*Math.abs(n-i))}return l}function r(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var f=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?r:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,o=t[e],l=(t._id||"x").charAt(0);if(n="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,n=n.slice(),!o||2!==o.length)return void(t[e]=n);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),r=0;r<2;r++)if("date"===t.type){if(!a.isDateTime(o[r])){t[e]=n;break}if(o[r]a.MAX_MS&&(o[r]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[r])){if(!i(o[1-r])){t[e]=n;break}o[r]=o[1-r]*(r?10:.1)}if(o[r]<-s?o[r]=-s:o[r]>s&&(o[r]=s),o[0]===o[1]){var f=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=f,o[1]+=f}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s), +!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?l:r},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var f=c.charAt(0),h=c.substr(1);h=n(h)?Number(h):0,(h<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":350,"../../lib":364,"fast-isnumeric":82}],411:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(t){var e,r,n,i,a,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,b.push(s),o[s]=a}return o}function f(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=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[u]?r[u].to:f,a=r[c]?r[c].to:h,f[0]===i[0]&&f[1]===i[1]&&h[0]===a[0]&&h[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function h(e,r){function n(e,r){for(i=0;ir.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,b=[],x=c(e),_=Object.keys(x),w=f(y,_,x);if(!w.length)return!1;var A;u&&(A=u());var M,k,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),M=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":364,"../../plotly":388,"../../registry":438,"./axes":393,d3:74}],412:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;fMath.abs(e))n.rotate(o,0,0,-t*r*Math.PI*h.rotateSpeed/window.innerWidth);else{var s=-h.zoomSpeed*a*e/window.innerHeight*(o-n.lastT())/100;n.pan(o,0,0,u*(Math.exp(s)-1))}},!0),h}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":9,"mouse-change":178,"mouse-wheel":180,"right-now":214}],416:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<3;++r){var n=s[r];e[n]._gd=t}}var i=t("./scene"),a=t("../plots"),o=t("../../constants/xmlns_namespaces"),s=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,o=a.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var s=0;sh[1][o]?d[o]=1:h[1][o]===h[0][o]?d[o]=1:d[o]=1/(h[1][o]-h[0][o]);for(this.dataScale=d,a=0;ag[1][a])g[0][a]=-1,g[1][a]=1;else{var x=g[1][a]-g[0][a];g[0][a]-=x/32,g[1][a]+=x/32}}else{var w=c[T[a]].range;g[0][a]=w[0],g[1][a]=w[1]}g[0][a]===g[1][a]&&(g[0][a]-=1,g[1][a]+=1),v[a]=g[1][a]-g[0][a],this.glplot.bounds[0][a]=g[0][a]*d[a],this.glplot.bounds[1][a]=g[1][a]*d[a]}var A=[1,1,1];for(a=0;a<3;++a){l=c[T[a]],u=l.type;var M=y[u];A[a]=Math.pow(M.acc,1/M.count)/d[a]}var k,E=4;if("auto"===c.aspectmode)k=Math.max.apply(null,A)/Math.min.apply(null,A)<=E?A:[1,1,1];else if("cube"===c.aspectmode)k=[1,1,1];else if("data"===c.aspectmode)k=A;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var L=c.aspectratio;k=[L.x,L.y,L.z]}c.aspectratio.x=f.aspectratio.x=k[0],c.aspectratio.y=f.aspectratio.y=k[1],c.aspectratio.z=f.aspectratio.z=k[2],this.glplot.aspect=k;var S=c.domain||null,C=e._size||null;if(S&&C){var P=this.container.style;P.position="absolute",P.left=C.l+S.x[0]*C.w+"px",P.top=C.t+(1-S.y[1])*C.h+"px",P.width=C.w*(S.x[1]-S.x[0])+"px",P.height=C.h*(S.y[1]-S.y[0])+"px"}this.glplot.redraw()}},k.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},k.setCameraToDefault=function(){this.setCamera({eye:{x:1.25,y:1.25,z:1.25},center:{x:0,y:0,z:0},up:{x:0,y:0,z:1}})},k.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},k.setCamera=function(t){var e={};e[this.id]=t,this.glplot.camera.lookAt.apply(this,l(t)),this.graphDiv.emit("plotly_relayout",e)},k.saveCamera=function(t){function e(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]]}var r=this.getCamera(),n=p.nestedProperty(t,this.id+".camera"),i=n.get(),a=!1;if(void 0===i)a=!0;else for(var o=0;o<3;o++)for(var s=0;s<3;s++)if(!e(r,i,o,s)){a=!0;break}return a&&n.set(r),a},k.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},k.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(c),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var a=0,o=n-1;a=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"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,f=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=f)}else{p.supplyLayoutGlobalDefaults(a,n);var h=!a.width||!a.height,d=n.autosize,g=t._context&&t._context.autosizable,v=h&&(d||g);v?p.plotAutoSize(t,a,n):h&&p.sanitizeMargins(t),!d&&h&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,n),n._has=p._hasPlotType.bind(n);var m=n._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),f=c.left+c.right,d=c.bottom+c.top,g=1-2*o,v=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(v.width-f)),i=Math.round(g*(v.height-d))}else{var m=l?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,i=parseFloat(m.height)||r.height}var y=p.layoutAttributes.width.min,b=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-i)>1;(_||x)&&(x&&(r.width=n),_&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a;c.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(i=0;i.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,f=r.size,h=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(f*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(f-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var v=l[t].t.val,m=l[t].t.size;if(v>h){var y=(d*v+(m-e.height)*h)/(v-h),b=(m*(1-h)+(d-e.height)*(1-v))/(v-h);y>=0&&b>=0&&y+b>s+o&&(s=y,o=b)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):h.isJSDate(t)?h.ms2DateTime(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)},p.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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,S=L?f.angularAxis.domain:n.extent(M),C=Math.abs(M[1]-M[0]);T&&!k&&(C=0);var P=S.slice();E&&k&&(P[1]+=C);var R=f.angularAxis.ticksCount||4;R>8&&(R=R/(R/8)+R%8),f.angularAxis.ticksStep&&(R=(P[1]-P[0])/R);var N=f.angularAxis.ticksStep||(P[1]-P[0])/(R*(f.minorTicks+1));A&&(N=Math.max(Math.round(N),1)),P[2]||(P[2]=N);var O=n.range.apply(this,P);if(O=O.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(P.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?C:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var I="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",z=(new DOMParser).parseFromString(I,"application/xml"),j=this.appendChild(this.ownerDocument.importNode(z.documentElement,!0));e=n.select(j)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var D,F=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},U={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){D=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:D,elements:V,reverseOrder:f.legend.reverseOrder})})();var H=D.node().getBBox();b=Math.min(f.width-H.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,b=Math.max(10,b),_=[f.margin.left+b,f.margin.top+b],i.range([0,b]),c.layout.radialAxis.domain=i.domain(),D.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else D=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var q=[(f.width-(f.margin.left+f.margin.right+2*b+(H?H.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2];if(q[0]=Math.max(0,q[0]),q[1]=Math.max(0,q[1]), +e.select(".outer-group").attr("transform","translate("+q+")"),f.title){var G=e.select("g.title-group text").style(U).text(f.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var W=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=W.selectAll("circle.grid-circle").data(i.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(B),Y.attr("r",i),Y.exit().remove()}W.select("circle.outside-circle").attr({r:b}).style(B);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=n.svg.axis().scale(i).ticks(5).tickSize(5);W.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),W.selectAll(".domain").style(B),W.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),W.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(O),K=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),K.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),K.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(U);var J=$.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+f.labelOffset,i=f.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:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":A?A[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(U);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));D.attr({transform:"translate("+[b+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!k){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;ot=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ct.text(o.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=i.invert(o.util.getMousePos(Z).radius);var n=o.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(o.util.round(st)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var i=n.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(u.t=A[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-q[0]-h.left,f.top+f.height/2-q[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.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")})})}),h}var e,r,i,s,l={data:[],layout:{}},u={},c={},f=n.dispatch("hover"),h={};return h.render=function(e){return t(e),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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return i},h.angularScale=function(t){return s},h.svg=function(){return e},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,i=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return i},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("undefined"==typeof 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 r===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=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 s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:h(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,i,a)},"stroke-width":function(t,e){return v["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,i,a)},opacity:function(t,e){return v.opacity(r,i,a)},display:function(t,e){return v.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var v={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},m=n.select(this).selectAll("g.layer").data(l);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],i=n.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=n.merge(i);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,f=c?r.height:u*o.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.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"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(o.length),v=n.scale[c?"linear":"ordinal"]().domain(g).range(l),m=n.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,m(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return v(e)}}),x.exit().remove()}var _=n.svg.axis().scale(m).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var n=t.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(f);var h=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[i.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=i.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};n.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../lib":364,d3:74}],435:[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,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(f=i),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(r),a.config(c).render(f),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,i,a,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},u.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":268,"../../lib":364,"./micropolar":434,"./undo_manager":436,d3:74}],436:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,u=t.layout,c=l([],a),f=l({},u,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(r=0;r0)s=f(t.alphahull,l);else{var u=["x","y","z"].indexOf(t.delaunayaxis);s=c(l.map(function(t){return[t[(u+1)%3],t[(u+2)%3]]}))}var p={positions:l,cells:s,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:d(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",p.vertexIntensity=t.intensity,p.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolors[0],p.vertexColors=a(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],p.cellColors=a(t.facecolor)):(this.color=t.color,p.meshColor=d(t.color)),this.mesh.update(p)},p.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=s},{"../../lib/str2rgbarray":377,"alpha-shape":14,"convex-hull":65,"delaunay-triangulate":75,"gl-mesh3d":126,tinycolor2:241}],450:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorbar/defaults"),a=t("./attributes");e.exports=function(t,e,r,o){function s(r,i){return n.coerce(t,e,a,r,i)}function l(t){var e=t.map(function(t){var e=s(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=l(["x","y","z"]),c=l(["i","j","k"]);return u?(c&&c.forEach(function(t){for(var e=0;ep&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var m={type:"linear"};i.setConvert(m),l=m.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},g.ppad=v.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,i.expand(c,h,g),i.expand(f,d,v);var x=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],457:[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,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=i.aggNums(Math.min,null,c)),n(h)||(h=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":271,"../../components/colorscale":282,"../../lib":364,"../../plots/plots":430,"fast-isnumeric":82}],458:[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":274,"../../components/colorscale/has_colorscale":281,"./subtypes":474}],459:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],460:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var v=s(t,e,g),m=vU!=N>=U&&(C=L[T-1][0],P=L[T][0],S=C+(P-C)*(U-R)/(N-R),j=Math.min(j,S),D=Math.max(D,S));j=Math.max(j,0),D=Math.min(D,h._length);var V=l.defaultLine;return l.opacity(f.fillcolor)?V=f.fillcolor:l.opacity((f.line||{}).color)&&(V=f.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:j,x1:D,y0:U,y1:U,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":268,"../../components/errorbars":297,"../../lib":364,"../../plots/cartesian/constants":398,"../../plots/cartesian/graph_interact":400,"./get_trace_color":462}],464:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":401,"./arrays_to_calcdata":453,"./attributes":454,"./calc":455,"./clean_data":456,"./colorbar":457,"./defaults":460,"./hover":463,"./plot":471,"./select":472,"./style":473,"./subtypes":474}],465:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":277,"../../components/colorscale/has_colorscale":281}],466:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),i=A.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/w._length,r=t[1]/A._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w=e.xaxis,A=e.yaxis,M=e.simplify,k=e.connectGaps,T=e.baseTolerance,E=e.linear,L=[],S=.2,C=new Array(t.length),P=0;for(M||(T=S=-1),o=0;oi(f))break;l=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,u=f,d=!1):y=t.length||!f)break;C[P++]=f,s=f}}else C[P++]=u}L.push(C.slice(0,P))}return L}},{"../../constants/numerical":350}],467:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],468:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":82}],470:[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){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":268,"../../components/colorscale/defaults":277,"../../components/colorscale/has_colorscale":281,"./subtypes":474}],471:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function i(t,e,r,n,i,d,g){function v(t){return M?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function b(t){if(t.ids)return y}function x(){return!1}function _(t){var e,r,n=t[0].trace,i=o.select(this),a=c.hasMarkers(n),u=c.hasText(n),f=b(n),h=x,d=x;a&&(h=n.marker.maxdisplayed?m:s.identity),u&&(d=n.marker.maxdisplayed?m:s.identity),r=i.selectAll("path.point"),e=r.data(h,f);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,n).call(l.translatePoints,k,T,n),M&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=v(o.select(this));l.translatePoint(t,e,k,T),l.singlePointStyle(t,e,n)}),M?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=i.selectAll("g"),e=r.data(d,f),e.enter().append("g").append("text"),e.each(function(t){var e=v(o.select(this).select("text"));l.translatePoint(t,e,k,T)}),e.selectAll("text").call(l.textPointStyle,n).each(function(t){var e=t.xp||k.c2p(t.x),r=t.yp||T.c2p(t.y);o.select(this).selectAll("tspan").each(function(){v(o.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,A;a(t,e,r,n,i);var M=!!g&&g.duration>0,k=r.xaxis,T=r.yaxis,E=n[0].trace,L=E.line,S=o.select(d);if(S.call(u.plot,r,g),E.visible===!0){v(S).style("opacity",E.opacity);var C,P,R=E.fill.charAt(E.fill.length-1);"x"!==R&&"y"!==R&&(R=""),n[0].node3=S,f(n);var N="",O=[],I=E._prevtrace;I&&(N=I._prevRevpath||"",P=I._nextFill,O=I._polygons);var z,j,D,F,B,U,V,H,q,G="",X="",W=[],Y=[],Z=s.noop;if(C=E._ownFill,c.hasLines(E)||"none"!==E.fill){for(P&&P.datum(n),["hv","vh","hvh","vhv"].indexOf(L.shape)!==-1?(D=l.steps(L.shape),F=l.steps(L.shape.split("").reverse().join(""))):D=F="spline"===L.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),L.smoothing):l.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return F(t.reverse())},W=h(n,{xaxis:k,yaxis:T,connectGaps:E.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),q=E._polygons=new Array(W.length),A=0;A1}),Z=function(t){return function(e){if(z=D(e),j=B(e),G?R?(G+="L"+z.substr(1),X=j+("L"+X.substr(1))):(G+="Z"+z,X=j+"Z"+X):(G=z,X=j),c.hasLines(E)&&e.length>1){var r=o.select(this);if(r.datum(n),t)v(r.style("opacity",0).attr("d",z).call(l.lineGroupStyle)).style("opacity",1);else{var i=v(r);i.attr("d",z),l.singleLineStyle(n,i)}}}}}var Q=S.selectAll(".js-line").data(Y);v(Q.exit()).style("opacity",0).remove(),Q.each(Z(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Z(!0)),W.length&&(C?U&&H&&(R?("y"===R?U[1]=H[1]=T.c2p(0,!0):"x"===R&&(U[0]=H[0]=k.c2p(0,!0)),v(C).attr("d","M"+H+"L"+U+"L"+G.substr(1))):v(C).attr("d",G+"Z")):"tonext"===E.fill.substr(0,6)&&G&&N&&("tonext"===E.fill?v(P).attr("d",G+"Z"+N+"Z"):v(P).attr("d",G+"L"+N.substr(1)+"Z"),E._polygons=E._polygons.concat(O)),E._prevRevpath=X,E._prevPolygons=q);var $=S.selectAll(".points");w=$.data([n]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,s=r.yaxis,l=o.extent(a.range.map(a.r2l).map(a.l2c)),u=o.extent(s.range.map(s.r2l).map(s.l2c)),f=n[0].trace;if(c.hasMarkers(f)){var h=f.marker.maxdisplayed;if(0!==h){var d=n.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/h),g=0;i.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),f=c.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,r),n(t,p),l=0,u=[];ln?1:-1}),v){s&&(h=s());var m=o.transition().duration(a.duration).ease(a.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()});m.each(function(){p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)})})}else p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":291,"../../components/errorbars":297,"../../lib":364,"../../lib/polygon":371,"./arrays_to_calcdata":453,"./line_points":466,"./link_traces":468,"./subtypes":474,d3:74}],472:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,g=!n.hasMarkers(h)&&!n.hasText(h);if(h.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return A[t]}function u(t,e,r,n,i){var a=null;if(Array.isArray(t)){a=[];for(var o=0;o=0){var h=i(l.position,l.delaunayColor,l.delaunayAxis);h.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(h):(h.gl=o,this.delaunayMesh=v(h),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},k.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=h},{"../../constants/gl3d_dashes":348,"../../constants/gl_markers":349,"../../lib":364,"../../lib/gl_format_color":362,"../../lib/str2rgbarray":377,"../scatter/make_bubble_size_func":469,"./calc_errors":479,"delaunay-triangulate":75,"gl-error3d":98,"gl-line3d":103,"gl-mesh3d":126,"gl-scatter3d":132}],481:[function(t,e,r){"use strict";function n(t,e,r){var n=0,i=r("x"),a=r("y"),o=r("z");return i&&a&&o&&(n=Math.min(i.length,a.length,o.length),n=0&&h("surfacecolor",p||g);for(var v=["x","y","z"],m=0;m<3;++m){var y="projection."+v[m];h(y+".show")&&(h(y+".opacity"),h(y+".scale"))}u(t,e,r,{axis:"z"}),u(t,e,r,{axis:"y",inherit:"z"}),u(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":296,"../../lib":364,"../scatter/line_defaults":465,"../scatter/marker_defaults":470,"../scatter/subtypes":474,"../scatter/text_defaults":475,"./attributes":477}],482:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl_markers":349,"../../plots/gl3d":416,"../scatter/colorbar":457,"./attributes":477,"./calc":478,"./convert":480,"./defaults":481}],483:[function(t,e,r){"use strict";function n(t){return{valType:"boolean",dflt:!1}}function i(t){return{show:{valType:"boolean",dflt:!1},project:{x:n("x"),y:n("y"),z:n("z")},color:{valType:"color",dflt:a.defaultLine},usecolormap:{valType:"boolean",dflt:!1},width:{valType:"number",min:1,max:16,dflt:2},highlight:{valType:"boolean",dflt:!0},highlightcolor:{valType:"color",dflt:a.defaultLine},highlightwidth:{valType:"number",min:1,max:16,dflt:2}}}var a=t("../../components/color"),o=t("../../components/colorscale/attributes"),s=t("../../components/colorbar/attributes"),l=t("../../lib/extend").extendFlat;e.exports={z:{valType:"data_array"},x:{valType:"data_array"},y:{valType:"data_array"},text:{valType:"data_array"},surfacecolor:{valType:"data_array"},cauto:o.zauto,cmin:o.zmin,cmax:o.zmax,colorscale:o.colorscale,autocolorscale:l({},o.autocolorscale,{dflt:!1}),reversescale:o.reversescale,showscale:o.showscale,colorbar:s,contours:{x:i("x"),y:i("y"),z:i("z")},hidesurface:{valType:"boolean",dflt:!1},lightposition:{x:{valType:"number",min:-1e5,max:1e5,dflt:10},y:{valType:"number",min:-1e5,max:1e5,dflt:1e4},z:{valType:"number",min:-1e5,max:1e5,dflt:0}},lighting:{ambient:{valType:"number",min:0,max:1,dflt:.8},diffuse:{valType:"number",min:0,max:1,dflt:.8},specular:{valType:"number",min:0,max:2,dflt:.05},roughness:{valType:"number",min:0,max:1,dflt:.5},fresnel:{valType:"number",min:0,max:5,dflt:.2}},opacity:{valType:"number",min:0,max:1,dflt:1},_deprecated:{zauto:l({},o.zauto,{}),zmin:l({},o.zmin,{}),zmax:l({},o.zmax,{})}}},{"../../components/color":268,"../../components/colorbar/attributes":269,"../../components/colorscale/attributes":273,"../../lib/extend":359}],484:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){e.surfacecolor?n(e,e.surfacecolor,"","c"):n(e,e.z,"","c")}},{"../../components/colorscale/calc":274}],485:[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="cb"+r.uid,u=r.cmin,c=r.cmax,f=r.surfacecolor||r.z;if(n(u)||(u=i.aggNums(Math.min,null,f)),n(c)||(c=i.aggNums(Math.max,null,f)),t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void a.autoMargin(t,l);var h=e[0].t.cb=s(t,l),d=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});h.fillcolor(d).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":271,"../../components/colorscale":282,"../../lib":364,"../../plots/plots":430,"fast-isnumeric":82}],486:[function(t,e,r){"use strict";function n(t,e,r){this.scene=t,this.uid=r,this.surface=e,this.data=null,this.showContour=[!1,!1,!1],this.dataScale=1}function i(t,e){return void 0===e&&(e=1),t.map(function(t){var r=t[0],n=p(t[1]),i=n.toRgb();return{index:r,rgb:[i.r,i.g,i.b,e]}})}function a(t){var e=t[0].rgb,r=t[t.length-1].rgb;return e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]&&e[3]===r[3]}function o(t){var e=t.shape,r=[e[0]+2,e[1]+2],n=c(new Float32Array(r[0]*r[1]),r);return d.assign(n.lo(1,1).hi(e[0],e[1]),t),d.assign(n.lo(1).hi(e[0],1),t.hi(e[0],1)),d.assign(n.lo(1,r[1]-1).hi(e[0],1),t.lo(0,e[1]-1).hi(e[0],1)),d.assign(n.lo(0,1).hi(1,e[1]),t.hi(1)),d.assign(n.lo(r[0]-1,1).hi(1,e[1]),t.lo(e[0]-1)),n.set(0,0,t.get(0,0)),n.set(0,r[1]-1,t.get(0,e[1]-1)),n.set(r[0]-1,0,t.get(e[0]-1,0)),n.set(r[0]-1,r[1]-1,t.get(e[0]-1,e[1]-1)),n}function s(t){var e=Math.max(t[0].shape[0],t[0].shape[1]);if(e paper // first convert to fraction of the axis - position = (position - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + position = axOld.r2fraction(position); // next scale the axis to the whole plot position = axOld.domain[0] + @@ -47201,8 +47200,7 @@ function drawOne(gd, index, opt, value) { (axNew.domain[1] - axNew.domain[0]); // finally convert to data coordinates - position = axNew.range[0] + - position * (axNew.range[1] - axNew.range[0]); + position = axNew.fraction2r(position); } } @@ -47219,7 +47217,8 @@ function drawOne(gd, index, opt, value) { optionsIn[axLetter] = position; } - var options = handleAnnotationDefaults(optionsIn, fullLayout); + var options = {}; + handleAnnotationDefaults(optionsIn, options, fullLayout); fullLayout.annotations[index] = options; var xa = Axes.getFromId(gd, options.xref), @@ -47333,20 +47332,21 @@ function drawOne(gd, index, opt, value) { // outside the visible plot (as long as the axis // isn't autoranged - then we need to draw it // anyway to get its bounding box) - if(!ax.autorange && ((options[axLetter] - ax.range[0]) * - (options[axLetter] - ax.range[1]) > 0)) { + var posFraction = ax.r2fraction(options[axLetter]); + if(!ax.autorange && (posFraction < 0 || posFraction > 1)) { if(options['a' + axLetter + 'ref'] === axRef) { - if((options['a' + axLetter] - ax.range[0]) * - (options['a' + axLetter] - ax.range[1]) > 0) { + posFraction = ax.r2fraction(options['a' + axLetter]); + if(posFraction < 0 || posFraction > 1) { annotationIsOffscreen = true; } - } else { + } + else { annotationIsOffscreen = true; } if(annotationIsOffscreen) return; } - annPosPx[axLetter] = ax._offset + ax.l2p(options[axLetter]); + annPosPx[axLetter] = ax._offset + ax.r2p(options[axLetter]); alignPosition = 0.5; } else { @@ -47359,7 +47359,7 @@ function drawOne(gd, index, opt, value) { var alignShift = 0; if(options['a' + axLetter + 'ref'] === axRef) { - annPosPx['aa' + axLetter] = ax._offset + ax.l2p(options['a' + axLetter]); + annPosPx['aa' + axLetter] = ax._offset + ax.r2p(options['a' + axLetter]); } else { if(options.showarrow) { alignShift = options['a' + axLetter]; @@ -47559,22 +47559,22 @@ function drawOne(gd, index, opt, value) { ann.call(Lib.setTranslate, xcenter, ycenter); update[annbase + '.x'] = xa ? - (options.x + dx / xa._m) : + xa.p2r(xa.r2p(options.x) + dx) : ((arrowX + dx - gs.l) / gs.w); update[annbase + '.y'] = ya ? - (options.y + dy / ya._m) : + ya.p2r(ya.r2p(options.y) + dy) : (1 - ((arrowY + dy - gs.t) / gs.h)); if(options.axref === options.xref) { update[annbase + '.ax'] = xa ? - (options.ax + dx / xa._m) : - ((arrowX + dx - gs.l) / gs.w); + xa.p2r(xa.r2p(options.ax) + dx) : + ((arrowX + dx - gs.l) / gs.w); } if(options.ayref === options.yref) { update[annbase + '.ay'] = ya ? - (options.ay + dy / ya._m) : - (1 - ((arrowY + dy - gs.t) / gs.h)); + ya.p2r(ya.r2p(options.ay) + dy) : + (1 - ((arrowY + dy - gs.t) / gs.h)); } anng.attr({ @@ -47620,13 +47620,13 @@ function drawOne(gd, index, opt, value) { var csr = 'pointer'; if(options.showarrow) { if(options.axref === options.xref) { - update[annbase + '.ax'] = xa.p2l(xa.l2p(options.ax) + dx); + update[annbase + '.ax'] = xa.p2r(xa.r2p(options.ax) + dx); } else { update[annbase + '.ax'] = options.ax + dx; } if(options.ayref === options.yref) { - update[annbase + '.ay'] = ya.p2l(ya.l2p(options.ay) + dy); + update[annbase + '.ay'] = ya.p2r(ya.r2p(options.ay) + dy); } else { update[annbase + '.ay'] = options.ay + dy; } @@ -47732,7 +47732,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":314,"../../lib/setcursor":324,"../../lib/svg_text_utils":326,"../../plotly":336,"../../plots/cartesian/axes":340,"../../plots/plots":372,"../color":223,"../dragelement":245,"../drawing":247,"./annotation_defaults":214,"./defaults":218,"./draw_arrow_head":220,"d3":8,"fast-isnumeric":12}],220:[function(require,module,exports){ +},{"../../lib":316,"../../lib/setcursor":326,"../../lib/svg_text_utils":328,"../../plotly":338,"../../plots/cartesian/axes":343,"../../plots/plots":374,"../color":223,"../dragelement":244,"../drawing":246,"./annotation_defaults":214,"./defaults":218,"./draw_arrow_head":220,"d3":8,"fast-isnumeric":12}],220:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47851,7 +47851,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { if(doEnd) drawhead(end, endRot); }; -},{"../color":223,"../drawing":247,"./arrow_paths":215,"d3":8,"fast-isnumeric":12}],221:[function(require,module,exports){ +},{"../color":223,"../drawing":246,"./arrow_paths":215,"d3":8,"fast-isnumeric":12}],221:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -47863,33 +47863,21 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { 'use strict'; -var Plotly = require('../../plotly'); - -exports.moduleType = 'component'; - -exports.name = 'annotations'; - -exports.ARROWPATHS = require('./arrow_paths'); - -exports.layoutAttributes = require('./attributes'); - -exports.supplyLayoutDefaults = require('./defaults'); - -exports.calcAutorange = require('./calc_autorange'); - -exports.arrowhead = require('./draw_arrow_head'); - var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; -exports.add = function(gd) { - var nextAnn = gd._fullLayout.annotations.length; +module.exports = { + moduleType: 'component', + name: 'annotations', + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), - Plotly.relayout(gd, 'annotations[' + nextAnn + ']', 'add'); + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne }; -},{"../../plotly":336,"./arrow_paths":215,"./attributes":216,"./calc_autorange":217,"./defaults":218,"./draw":219,"./draw_arrow_head":220}],222:[function(require,module,exports){ +},{"./attributes":216,"./calc_autorange":217,"./defaults":218,"./draw":219}],222:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48242,7 +48230,7 @@ module.exports = { } }; -},{"../../lib/extend":311,"../../plots/cartesian/layout_attributes":350,"../../plots/font_attributes":361}],225:[function(require,module,exports){ +},{"../../lib/extend":312,"../../plots/cartesian/layout_attributes":352,"../../plots/font_attributes":363}],225:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48309,7 +48297,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":314,"../../plots/cartesian/tick_label_defaults":356,"../../plots/cartesian/tick_mark_defaults":357,"../../plots/cartesian/tick_value_defaults":358,"./attributes":224}],226:[function(require,module,exports){ +},{"../../lib":316,"../../plots/cartesian/tick_label_defaults":358,"../../plots/cartesian/tick_mark_defaults":359,"../../plots/cartesian/tick_value_defaults":360,"./attributes":224}],226:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48941,7 +48929,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":314,"../../lib/extend":311,"../../lib/setcursor":324,"../../plotly":336,"../../plots/cartesian/axes":340,"../../plots/cartesian/axis_defaults":342,"../../plots/cartesian/layout_attributes":350,"../../plots/cartesian/position_defaults":353,"../../plots/plots":372,"../../registry":380,"../color":223,"../dragelement":245,"../drawing":247,"../titles":298,"./attributes":224,"d3":8,"tinycolor2":197}],227:[function(require,module,exports){ +},{"../../lib":316,"../../lib/extend":312,"../../lib/setcursor":326,"../../plotly":338,"../../plots/cartesian/axes":343,"../../plots/cartesian/axis_defaults":345,"../../plots/cartesian/layout_attributes":352,"../../plots/cartesian/position_defaults":355,"../../plots/plots":374,"../../registry":382,"../color":223,"../dragelement":244,"../drawing":246,"../titles":297,"./attributes":224,"d3":8,"tinycolor2":197}],227:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -48960,28 +48948,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":314}],228:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -exports.attributes = require('./attributes'); - -exports.supplyDefaults = require('./defaults'); - -exports.draw = require('./draw'); - -exports.hasColorbar = require('./has_colorbar'); - -},{"./attributes":224,"./defaults":225,"./draw":226,"./has_colorbar":227}],229:[function(require,module,exports){ +},{"../../lib":316}],228:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49036,7 +49003,7 @@ module.exports = { } }; -},{}],230:[function(require,module,exports){ +},{}],229:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49102,7 +49069,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":314,"./flip_scale":235,"./scales":242}],231:[function(require,module,exports){ +},{"../../lib":316,"./flip_scale":234,"./scales":241}],230:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49146,7 +49113,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":311,"./attributes":229,"./scales.js":242}],232:[function(require,module,exports){ +},{"../../lib/extend":312,"./attributes":228,"./scales.js":241}],231:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49162,7 +49129,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":242}],233:[function(require,module,exports){ +},{"./scales":241}],232:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49226,7 +49193,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":314,"../colorbar/defaults":225,"../colorbar/has_colorbar":227,"./flip_scale":235,"./is_valid_scale":239,"fast-isnumeric":12}],234:[function(require,module,exports){ +},{"../../lib":316,"../colorbar/defaults":225,"../colorbar/has_colorbar":227,"./flip_scale":234,"./is_valid_scale":238,"fast-isnumeric":12}],233:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49263,7 +49230,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],235:[function(require,module,exports){ +},{}],234:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49288,7 +49255,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],236:[function(require,module,exports){ +},{}],235:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49328,7 +49295,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":232,"./is_valid_scale_array":240,"./scales":242}],237:[function(require,module,exports){ +},{"./default_scale":231,"./is_valid_scale_array":239,"./scales":241}],236:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49374,7 +49341,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":314,"./is_valid_scale":239,"fast-isnumeric":12}],238:[function(require,module,exports){ +},{"../../lib":316,"./is_valid_scale":238,"fast-isnumeric":12}],237:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49408,7 +49375,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":229,"./calc":230,"./default_scale":232,"./defaults":233,"./extract_scale":234,"./flip_scale":235,"./get_scale":236,"./has_colorscale":237,"./is_valid_scale":239,"./make_color_scale_func":241,"./scales":242}],239:[function(require,module,exports){ +},{"./attributes":228,"./calc":229,"./default_scale":231,"./defaults":232,"./extract_scale":233,"./flip_scale":234,"./get_scale":235,"./has_colorscale":236,"./is_valid_scale":238,"./make_color_scale_func":240,"./scales":241}],238:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49429,7 +49396,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":240,"./scales":242}],240:[function(require,module,exports){ +},{"./is_valid_scale_array":239,"./scales":241}],239:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49466,7 +49433,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":197}],241:[function(require,module,exports){ +},{"tinycolor2":197}],240:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49562,7 +49529,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":223,"d3":8,"fast-isnumeric":12,"tinycolor2":197}],242:[function(require,module,exports){ +},{"../color":223,"d3":8,"fast-isnumeric":12,"tinycolor2":197}],241:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49693,7 +49660,7 @@ module.exports = { ] }; -},{}],243:[function(require,module,exports){ +},{}],242:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49726,7 +49693,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],244:[function(require,module,exports){ +},{}],243:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49764,7 +49731,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":314}],245:[function(require,module,exports){ +},{"../../lib":316}],244:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -49951,7 +49918,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../lib":314,"../../plotly":336,"../../plots/cartesian/constants":346,"./align":243,"./cursor":244,"./unhover":246}],246:[function(require,module,exports){ +},{"../../lib":316,"../../plotly":338,"../../plots/cartesian/constants":348,"./align":242,"./cursor":243,"./unhover":245}],245:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50002,7 +49969,7 @@ unhover.raw = function unhoverRaw(gd, evt) { gd._hoverdata = undefined; }; -},{"../../lib/events":310}],247:[function(require,module,exports){ +},{"../../lib/events":311}],246:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -50080,14 +50047,14 @@ drawing.getPx = function(s, styleAttr) { return Number(s.style(styleAttr).replace(/px$/, '')); }; -drawing.crispRound = function(td, lineWidth, dflt) { +drawing.crispRound = function(gd, lineWidth, dflt) { // for lines that disable antialiasing we want to // make sure the width is an integer, and at least 1 if it's nonzero if(!lineWidth || !isNumeric(lineWidth)) return dflt || 0; // but not for static plots - these don't get antialiased anyway. - if(td._context.staticPlot) return lineWidth; + if(gd._context.staticPlot) return lineWidth; if(lineWidth < 1) return 1; return Math.round(lineWidth); @@ -50281,9 +50248,8 @@ drawing.singlePointStyle = function(d, sel, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); singlePointStyle(d, sel, trace, markerScale, lineScale, marker, markerLine); @@ -50295,50 +50261,22 @@ drawing.pointStyle = function(s, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales var marker = trace.marker; - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale); }); }; -// for a given color attribute (ie m -> mc = marker.color) look to see if we -// have a colorscale for it (ie mscl, mcmin, mcmax) - if we do, translate -// all numeric color values according to that scale -drawing.tryColorscale = function(cont, contIn, prefix) { - var colorArray = Lib.nestedProperty(cont, prefix + 'color').get(), - scl = Lib.nestedProperty(cont, prefix + 'colorscale').get(), - auto = Lib.nestedProperty(cont, prefix + 'cauto').get(), - minProp = Lib.nestedProperty(cont, prefix + 'cmin'), - maxProp = Lib.nestedProperty(cont, prefix + 'cmax'), - min = minProp.get(), - max = maxProp.get(); +drawing.tryColorscale = function(marker, prefix) { + var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker, + scl = cont.colorscale, + colorArray = cont.color; - // TODO handle this in Colorscale.calc if(scl && Array.isArray(colorArray)) { - if(auto || !isNumeric(min) || !isNumeric(max)) { - min = Infinity; - max = -Infinity; - colorArray.forEach(function(color) { - if(isNumeric(color)) { - if(min > color) min = +color; - if(max < color) max = +color; - } - }); - if(min > max) { - min = 0; - max = 1; - } - minProp.set(min); - maxProp.set(max); - Lib.nestedProperty(contIn, prefix + 'cmin').set(min); - Lib.nestedProperty(contIn, prefix + 'cmax').set(max); - } - return Colorscale.makeColorScaleFunc( - Colorscale.extractScale(scl, min, max) + Colorscale.extractScale(scl, cont.cmin, cont.cmax) ); } else return Lib.identity; @@ -50606,7 +50544,7 @@ drawing.setClipUrl = function(s, localId) { s.attr('clip-path', 'url(' + url + ')'); }; -},{"../../constants/xmlns_namespaces":305,"../../lib":314,"../../lib/svg_text_utils":326,"../../registry":380,"../../traces/scatter/make_bubble_size_func":406,"../../traces/scatter/subtypes":411,"../color":223,"../colorscale":238,"./symbol_defs":248,"d3":8,"fast-isnumeric":12}],248:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":305,"../../lib":316,"../../lib/svg_text_utils":328,"../../registry":382,"../../traces/scatter/make_bubble_size_func":408,"../../traces/scatter/subtypes":413,"../color":223,"../colorscale":237,"./symbol_defs":247,"d3":8,"fast-isnumeric":12}],247:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51082,7 +51020,7 @@ module.exports = { } }; -},{"d3":8}],249:[function(require,module,exports){ +},{"d3":8}],248:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51181,7 +51119,7 @@ module.exports = { } }; -},{}],250:[function(require,module,exports){ +},{}],249:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51244,7 +51182,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":340,"../../registry":380,"./compute_error":251,"fast-isnumeric":12}],251:[function(require,module,exports){ +},{"../../plots/cartesian/axes":343,"../../registry":382,"./compute_error":250,"fast-isnumeric":12}],250:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51340,7 +51278,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],252:[function(require,module,exports){ +},{}],251:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51417,7 +51355,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":314,"../../registry":380,"./attributes":249,"fast-isnumeric":12}],253:[function(require,module,exports){ +},{"../../lib":316,"../../registry":382,"./attributes":248,"fast-isnumeric":12}],252:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51476,7 +51414,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":249,"./calc":250,"./defaults":252,"./plot":254,"./style":255}],254:[function(require,module,exports){ +},{"./attributes":248,"./calc":249,"./defaults":251,"./plot":253,"./style":254}],253:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51640,7 +51578,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":411,"d3":8,"fast-isnumeric":12}],255:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":413,"d3":8,"fast-isnumeric":12}],254:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51677,7 +51615,7 @@ module.exports = function style(traces) { }); }; -},{"../color":223,"d3":8}],256:[function(require,module,exports){ +},{"../color":223,"d3":8}],255:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51692,7 +51630,14 @@ var cartesianConstants = require('../../plots/cartesian/constants'); module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'image', + + visible: { + valType: 'boolean', + + dflt: true, + + }, source: { valType: 'string', @@ -51740,14 +51685,14 @@ module.exports = { }, x: { - valType: 'number', + valType: 'any', dflt: 0, }, y: { - valType: 'number', + valType: 'any', dflt: 0, @@ -51792,7 +51737,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":346}],257:[function(require,module,exports){ +},{"../../plots/cartesian/constants":348}],256:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51803,40 +51748,34 @@ module.exports = { 'use strict'; -var Axes = require('../../plots/cartesian/axes'); var Lib = require('../../lib'); -var attributes = require('./attributes'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var attributes = require('./attributes'); +var name = 'images'; module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { + var opts = { + name: name, + handleItemDefaults: imageDefaults + }; - if(!layoutIn.images || !Array.isArray(layoutIn.images)) return; - - - var containerIn = layoutIn.images, - containerOut = layoutOut.images = []; - - - for(var i = 0; i < containerIn.length; i++) { - var image = containerIn[i]; - - if(!image.source) continue; - - var defaulted = imageDefaults(containerIn[i] || {}, containerOut[i] || {}, layoutOut); - containerOut.push(defaulted); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function imageDefaults(imageIn, imageOut, fullLayout) { - imageOut = imageOut || {}; - function coerce(attr, dflt) { return Lib.coerce(imageIn, imageOut, attributes, attr, dflt); } - coerce('source'); + var source = coerce('source'); + var visible = coerce('visible', !!source); + + if(!visible) return imageOut; + coerce('layer'); coerce('x'); coerce('y'); @@ -51847,18 +51786,18 @@ function imageDefaults(imageIn, imageOut, fullLayout) { coerce('sizing'); coerce('opacity'); - for(var i = 0; i < 2; i++) { - var tdMock = { _fullLayout: fullLayout }, - axLetter = ['x', 'y'][i]; + var gdMock = { _fullLayout: fullLayout }, + axLetters = ['x', 'y']; + for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref - Axes.coerceRef(imageIn, imageOut, tdMock, axLetter, 'paper'); + Axes.coerceRef(imageIn, imageOut, gdMock, axLetters[i], 'paper'); } return imageOut; } -},{"../../lib":314,"../../plots/cartesian/axes":340,"./attributes":256}],258:[function(require,module,exports){ +},{"../../lib":316,"../../plots/array_container_defaults":340,"../../plots/cartesian/axes":343,"./attributes":255}],257:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -51875,25 +51814,23 @@ var Axes = require('../../plots/cartesian/axes'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, imageDataAbove = [], imageDataSubplot = [], imageDataBelow = []; - if(!fullLayout.images) return; - - // Sort into top, subplot, and bottom layers for(var i = 0; i < fullLayout.images.length; i++) { var img = fullLayout.images[i]; - if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - imageDataSubplot.push(img); - } else if(img.layer === 'above') { - imageDataAbove.push(img); - } else { - imageDataBelow.push(img); + if(img.visible) { + if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { + imageDataSubplot.push(img); + } else if(img.layer === 'above') { + imageDataAbove.push(img); + } else { + imageDataBelow.push(img); + } } } @@ -51962,12 +51899,12 @@ module.exports = function draw(gd) { var thisImage = d3.select(this); // Axes if specified - var xref = Axes.getFromId(gd, d.xref), - yref = Axes.getFromId(gd, d.yref); + var xa = Axes.getFromId(gd, d.xref), + ya = Axes.getFromId(gd, d.yref); var size = fullLayout._size, - width = xref ? Math.abs(xref.l2p(d.sizex) - xref.l2p(0)) : d.sizex * size.w, - height = yref ? Math.abs(yref.l2p(d.sizey) - yref.l2p(0)) : d.sizey * size.h; + width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w, + height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset, @@ -51976,8 +51913,8 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xref ? xref.l2p(d.x) + xref._offset : d.x * size.w + size.l) + xOffset, - yPos = (yref ? yref.l2p(d.y) + yref._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset, + yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; // Construct the proper aspectRatio attribute @@ -52002,8 +51939,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xref ? xref._id : '', - yId = yref ? yref._id : '', + var xId = xa ? xa._id : '', + yId = ya ? ya._id : '', clipAxes = xId + yId; if(clipAxes) { @@ -52040,7 +51977,7 @@ module.exports = function draw(gd) { }); }; -},{"../../constants/xmlns_namespaces":305,"../../plots/cartesian/axes":340,"../drawing":247,"d3":8}],259:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":305,"../../plots/cartesian/axes":343,"../drawing":246,"d3":8}],258:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52051,21 +51988,17 @@ module.exports = function draw(gd) { 'use strict'; - -var draw = require('./draw'); -var supplyLayoutDefaults = require('./defaults'); -var attributes = require('./attributes'); - - module.exports = { moduleType: 'component', name: 'images', - draw: draw, - layoutAttributes: attributes, - supplyLayoutDefaults: supplyLayoutDefaults + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), + + draw: require('./draw') }; -},{"./attributes":256,"./defaults":257,"./draw":258}],260:[function(require,module,exports){ +},{"./attributes":255,"./defaults":256,"./draw":257}],259:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52114,7 +52047,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],261:[function(require,module,exports){ +},{}],260:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52205,7 +52138,7 @@ module.exports = { } }; -},{"../../lib/extend":311,"../../plots/font_attributes":361,"../color/attributes":222}],262:[function(require,module,exports){ +},{"../../lib/extend":312,"../../plots/font_attributes":363,"../color/attributes":222}],261:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52223,7 +52156,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],263:[function(require,module,exports){ +},{}],262:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -52316,7 +52249,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":314,"../../plots/layout_attributes":363,"../../registry":380,"./attributes":261,"./helpers":266}],264:[function(require,module,exports){ +},{"../../lib":316,"../../plots/layout_attributes":365,"../../registry":382,"./attributes":260,"./helpers":265}],263:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53032,7 +52965,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../lib":314,"../../lib/svg_text_utils":326,"../../plotly":336,"../../plots/plots":372,"../../registry":380,"../color":223,"../dragelement":245,"../drawing":247,"./anchor_utils":260,"./constants":262,"./get_legend_data":265,"./helpers":266,"./style":268,"d3":8}],265:[function(require,module,exports){ +},{"../../lib":316,"../../lib/svg_text_utils":328,"../../plotly":338,"../../plots/plots":374,"../../registry":382,"../color":223,"../dragelement":244,"../drawing":246,"./anchor_utils":259,"./constants":261,"./get_legend_data":264,"./helpers":265,"./style":267,"d3":8}],264:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53137,7 +53070,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":380,"./helpers":266}],266:[function(require,module,exports){ +},{"../../registry":382,"./helpers":265}],265:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53168,7 +53101,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":380}],267:[function(require,module,exports){ +},{"../../registry":382}],266:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53181,22 +53114,18 @@ exports.isReversed = function isReversed(legendLayout) { 'use strict'; -var legend = module.exports = {}; - - -legend.moduleType = 'component'; - -legend.name = 'legend'; - -legend.layoutAttributes = require('./attributes'); - -legend.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'legend', -legend.draw = require('./draw'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -legend.style = require('./style'); + draw: require('./draw'), + style: require('./style') +}; -},{"./attributes":261,"./defaults":263,"./draw":264,"./style":268}],268:[function(require,module,exports){ +},{"./attributes":260,"./defaults":262,"./draw":263,"./style":267}],267:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53418,7 +53347,7 @@ function stylePies(d) { if(pts.size()) pts.call(stylePie, d[0], trace); } -},{"../../lib":314,"../../registry":380,"../../traces/pie/style_one":389,"../../traces/scatter/subtypes":411,"../color":223,"../drawing":247,"d3":8}],269:[function(require,module,exports){ +},{"../../lib":316,"../../registry":382,"../../traces/pie/style_one":391,"../../traces/scatter/subtypes":413,"../color":223,"../drawing":246,"d3":8}],268:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53928,7 +53857,7 @@ modeBarButtons.resetViews = { } }; -},{"../../../build/ploticon":2,"../../lib":314,"../../plotly":336,"../../plots/cartesian/axes":340,"../../plots/plots":372,"../../snapshot/download":382}],270:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":316,"../../plotly":338,"../../plots/cartesian/axes":343,"../../plots/plots":374,"../../snapshot/download":384}],269:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -53942,7 +53871,7 @@ modeBarButtons.resetViews = { exports.manage = require('./manage'); -},{"./manage":271}],271:[function(require,module,exports){ +},{"./manage":270}],270:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54170,7 +54099,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":340,"../../traces/scatter/subtypes":411,"./buttons":269,"./modebar":272}],272:[function(require,module,exports){ +},{"../../plots/cartesian/axes":343,"../../traces/scatter/subtypes":413,"./buttons":268,"./modebar":271}],271:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54460,7 +54389,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":314,"d3":8}],273:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":316,"d3":8}],272:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54477,7 +54406,8 @@ var extendFlat = require('../../lib/extend').extendFlat; var buttonAttrs = require('./button_attributes'); buttonAttrs = extendFlat(buttonAttrs, { - _isLinkedToArray: true, + _isLinkedToArray: 'button', + }); @@ -54549,7 +54479,7 @@ module.exports = { } }; -},{"../../lib/extend":311,"../../plots/font_attributes":361,"../color/attributes":222,"./button_attributes":274}],274:[function(require,module,exports){ +},{"../../lib/extend":312,"../../plots/font_attributes":363,"../color/attributes":222,"./button_attributes":273}],273:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54590,7 +54520,7 @@ module.exports = { } }; -},{}],275:[function(require,module,exports){ +},{}],274:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54619,7 +54549,7 @@ module.exports = { darkAmount: 10 }; -},{}],276:[function(require,module,exports){ +},{}],275:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54712,7 +54642,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":314,"../color":223,"./attributes":273,"./button_attributes":274,"./constants":275}],277:[function(require,module,exports){ +},{"../../lib":316,"../color":223,"./attributes":272,"./button_attributes":273,"./constants":274}],276:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -54987,7 +54917,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":326,"../../plotly":336,"../../plots/cartesian/axis_ids":343,"../../plots/plots":372,"../color":223,"../drawing":247,"../legend/anchor_utils":260,"./constants":275,"./get_update_object":278,"d3":8}],278:[function(require,module,exports){ +},{"../../lib/svg_text_utils":328,"../../plotly":338,"../../plots/cartesian/axis_ids":346,"../../plots/plots":374,"../color":223,"../drawing":246,"../legend/anchor_utils":259,"./constants":274,"./get_update_object":277,"d3":8}],277:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55001,6 +54931,8 @@ function reposition(gd, buttons, opts, axName) { var d3 = require('d3'); +var Lib = require('../../lib'); + module.exports = function getUpdateObject(axisLayout, buttonLayout) { var axName = axisLayout._name; @@ -55021,7 +54953,7 @@ module.exports = function getUpdateObject(axisLayout, buttonLayout) { function getXRange(axisLayout, buttonLayout) { var currentRange = axisLayout.range; - var base = new Date(currentRange[1]); + var base = new Date(Lib.dateTime2ms(currentRange[1])); var step = buttonLayout.step, count = buttonLayout.count; @@ -55030,13 +54962,13 @@ function getXRange(axisLayout, buttonLayout) { switch(buttonLayout.stepmode) { case 'backward': - range0 = d3.time[step].offset(base, -count).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].offset(base, -count)); break; case 'todate': - var base2 = d3.time[step].offset(base, -(count - 1)); + var base2 = d3.time[step].offset(base, -count); - range0 = d3.time[step].floor(base2).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].ceil(base2)); break; } @@ -55045,7 +54977,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":8}],279:[function(require,module,exports){ +},{"../../lib":316,"d3":8}],278:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55056,18 +54988,18 @@ function getXRange(axisLayout, buttonLayout) { 'use strict'; +module.exports = { + moduleType: 'component', + name: 'rangeselector', -exports.moduleType = 'component'; - -exports.name = 'rangeselector'; - -exports.layoutAttributes = require('./attributes'); - -exports.handleDefaults = require('./defaults'); + layoutNodes: ['xaxis.'], + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":273,"./defaults":276,"./draw":277}],280:[function(require,module,exports){ +},{"./attributes":272,"./defaults":275,"./draw":276}],279:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55104,8 +55036,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -55125,7 +55057,7 @@ module.exports = { } }; -},{"../color/attributes":222}],281:[function(require,module,exports){ +},{"../color/attributes":222}],280:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55178,7 +55110,7 @@ module.exports = { handleStroke: '#666', }; -},{}],282:[function(require,module,exports){ +},{}],281:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55202,7 +55134,8 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe } var containerIn = layoutIn[axName].rangeslider, - containerOut = layoutOut[axName].rangeslider = {}; + axOut = layoutOut[axName], + containerOut = axOut.rangeslider = {}; function coerce(attr, dflt) { return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); @@ -55216,14 +55149,16 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe coerce('range'); // Expand slider range to the axis range - if(containerOut.range && !layoutOut[axName].autorange) { + if(containerOut.range && !axOut.autorange) { var outRange = containerOut.range, - axRange = layoutOut[axName].range; + axRange = axOut.range, + l2r = axOut.l2r, + r2l = axOut.r2l; - outRange[0] = Math.min(outRange[0], axRange[0]); - outRange[1] = Math.max(outRange[1], axRange[1]); + outRange[0] = l2r(Math.min(r2l(outRange[0]), r2l(axRange[0]))); + outRange[1] = l2r(Math.max(r2l(outRange[1]), r2l(axRange[1]))); } else { - layoutOut[axName]._needsExpand = true; + axOut._needsExpand = true; } if(containerOut.visible) { @@ -55238,7 +55173,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe containerOut._input = containerIn; }; -},{"../../lib":314,"./attributes":280}],283:[function(require,module,exports){ +},{"../../lib":316,"./attributes":279}],282:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55345,20 +55280,10 @@ module.exports = function(gd) { rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); - // update inner nodes - - rangeSlider - .call(drawBg, gd, axisOpts, opts) - .call(addClipPath, gd, axisOpts, opts) - .call(drawRangePlot, gd, axisOpts, opts) - .call(drawMasks, gd, axisOpts, opts) - .call(drawSlideBox, gd, axisOpts, opts) - .call(drawGrabbers, gd, axisOpts, opts); - // update data <--> pixel coordinate conversion methods - var range0 = opts.range[0], - range1 = opts.range[1], + var range0 = axisOpts.r2l(opts.range[0]), + range1 = axisOpts.r2l(opts.range[1]), dist = range1 - range0; opts.p2d = function(v) { @@ -55369,6 +55294,18 @@ module.exports = function(gd) { return (v - range0) / dist * opts._width; }; + opts._rl = [range0, range1]; + + // update inner nodes + + rangeSlider + .call(drawBg, gd, axisOpts, opts) + .call(addClipPath, gd, axisOpts, opts) + .call(drawRangePlot, gd, axisOpts, opts) + .call(drawMasks, gd, axisOpts, opts) + .call(drawSlideBox, gd, axisOpts, opts) + .call(drawGrabbers, gd, axisOpts, opts); + // setup drag element setupDragElement(rangeSlider, gd, axisOpts, opts); @@ -55406,8 +55343,8 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { target = event.target, startX = event.clientX, offsetX = startX - rangeSlider.node().getBoundingClientRect().left, - minVal = opts.d2p(axisOpts.range[0]), - maxVal = opts.d2p(axisOpts.range[1]); + minVal = opts.d2p(axisOpts._rl[0]), + maxVal = opts.d2p(axisOpts._rl[1]); var dragCover = dragElement.coverSlip(); @@ -55468,7 +55405,7 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { function setDataRange(rangeSlider, gd, axisOpts, opts) { function clamp(v) { - return Lib.constrain(v, opts.range[0], opts.range[1]); + return axisOpts.l2r(Lib.constrain(v, opts._rl[0], opts._rl[1])); } var dataMin = clamp(opts.p2d(opts._pixelMin)), @@ -55485,8 +55422,8 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts) { return Lib.constrain(v, 0, opts._width); } - var pixelMin = clamp(opts.d2p(axisOpts.range[0])), - pixelMax = clamp(opts.d2p(axisOpts.range[1])); + var pixelMin = clamp(opts.d2p(axisOpts._rl[0])), + pixelMax = clamp(opts.d2p(axisOpts._rl[1])); rangeSlider.select('rect.' + constants.slideBoxClassName) .attr('x', pixelMin) @@ -55579,6 +55516,7 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) { data: [], layout: { xaxis: { + type: axisOpts.type, domain: [0, 1], range: opts.range.slice() }, @@ -55760,7 +55698,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":314,"../../lib/setcursor":324,"../../plotly":336,"../../plots/cartesian":349,"../../plots/cartesian/axes":340,"../../plots/plots":372,"../color":223,"../dragelement":245,"../drawing":247,"./constants":281,"d3":8}],284:[function(require,module,exports){ +},{"../../lib":316,"../../lib/setcursor":326,"../../plotly":338,"../../plots/cartesian":351,"../../plots/cartesian/axes":343,"../../plots/plots":374,"../color":223,"../dragelement":244,"../drawing":246,"./constants":280,"d3":8}],283:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55774,12 +55712,15 @@ function clearPushMargins(gd) { module.exports = { moduleType: 'component', name: 'rangeslider', + + layoutNodes: ['xaxis.'], layoutAttributes: require('./attributes'), handleDefaults: require('./defaults'), + draw: require('./draw') }; -},{"./attributes":280,"./defaults":282,"./draw":283}],285:[function(require,module,exports){ +},{"./attributes":279,"./defaults":281,"./draw":282}],284:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55797,7 +55738,14 @@ var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'shape', + + visible: { + valType: 'boolean', + + dflt: true, + + }, type: { valType: 'enumerated', @@ -55870,7 +55818,7 @@ module.exports = { } }; -},{"../../lib/extend":311,"../../traces/scatter/attributes":391,"../annotations/attributes":216}],286:[function(require,module,exports){ +},{"../../lib/extend":312,"../../traces/scatter/attributes":393,"../annotations/attributes":216}],285:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -55882,6 +55830,7 @@ module.exports = { 'use strict'; +var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); var constants = require('./constants'); @@ -55890,7 +55839,7 @@ var helpers = require('./helpers'); module.exports = function calcAutorange(gd) { var fullLayout = gd._fullLayout, - shapeList = fullLayout.shapes; + shapeList = Lib.filterVisible(fullLayout.shapes); if(!shapeList.length || !gd._fullData.length) return; @@ -55946,7 +55895,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../plots/cartesian/axes":340,"./constants":287,"./helpers":290}],287:[function(require,module,exports){ +},{"../../lib":316,"../../plots/cartesian/axes":343,"./constants":286,"./helpers":289}],286:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56010,7 +55959,7 @@ module.exports = { } }; -},{}],288:[function(require,module,exports){ +},{}],287:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56022,22 +55971,20 @@ module.exports = { 'use strict'; +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var handleShapeDefaults = require('./shape_defaults'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - var containerIn = layoutIn.shapes || [], - containerOut = layoutOut.shapes = []; - - for(var i = 0; i < containerIn.length; i++) { - var shapeIn = containerIn[i] || {}, - shapeOut = handleShapeDefaults(shapeIn, layoutOut); + var opts = { + name: 'shapes', + handleItemDefaults: handleShapeDefaults + }; - containerOut.push(shapeOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"./shape_defaults":292}],289:[function(require,module,exports){ +},{"../../plots/array_container_defaults":340,"./shape_defaults":291}],288:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56089,7 +56036,9 @@ function draw(gd) { fullLayout._shapeSubplotLayer.selectAll('path').remove(); for(var i = 0; i < fullLayout.shapes.length; i++) { - drawOne(gd, i); + if(fullLayout.shapes[i].visible) { + drawOne(gd, i); + } } // may need to resurrect this if we put text (LaTeX) in shapes @@ -56209,8 +56158,6 @@ function updateShape(gd, index, opt, value) { // TODO: clean this up and remove it. if(!optionsIn) return; - var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; - // alter the input shape as requested var optionsEdit = {}; if(typeof opt === 'string' && opt) optionsEdit[opt] = value; @@ -56222,7 +56169,12 @@ function updateShape(gd, index, opt, value) { Lib.nestedProperty(optionsIn, k).set(optionsEdit[k]); } - var posAttrs = ['x0', 'x1', 'y0', 'y1']; + // return early in visible: false updates + if(optionsIn.visible === false) return; + + var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}, + posAttrs = ['x0', 'x1', 'y0', 'y1']; + for(i = 0; i < 4; i++) { var posAttr = posAttrs[i]; // if we don't have an explicit position already, @@ -56237,18 +56189,17 @@ function updateShape(gd, index, opt, value) { var axLetter = posAttr.charAt(0), axOld = Axes.getFromId(gd, - Axes.coerceRef(oldRef, {}, gd, axLetter)), + Axes.coerceRef(oldRef, {}, gd, axLetter, '', 'paper')), axNew = Axes.getFromId(gd, - Axes.coerceRef(optionsIn, {}, gd, axLetter)), + Axes.coerceRef(optionsIn, {}, gd, axLetter, '', 'paper')), position = optionsIn[posAttr], - linearizedPosition; + rangePosition; if(optionsEdit[axLetter + 'ref'] !== undefined) { // first convert to fraction of the axis if(axOld) { - linearizedPosition = helpers.dataToLinear(axOld)(position); - position = (linearizedPosition - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + rangePosition = helpers.shapePositionToRange(axOld)(position); + position = axOld.r2fraction(rangePosition); } else { position = (position - axNew.domain[0]) / (axNew.domain[1] - axNew.domain[0]); @@ -56256,9 +56207,8 @@ function updateShape(gd, index, opt, value) { if(axNew) { // then convert to new data coordinates at the same fraction - linearizedPosition = axNew.range[0] + position * - (axNew.range[1] - axNew.range[0]); - position = helpers.linearToData(axNew)(linearizedPosition); + rangePosition = axNew.fraction2r(position); + position = helpers.rangeToShapePosition(axNew)(rangePosition); } else { // or scale to the whole plot position = axOld.domain[0] + @@ -56269,7 +56219,8 @@ function updateShape(gd, index, opt, value) { optionsIn[posAttr] = position; } - var options = handleShapeDefaults(optionsIn, gd._fullLayout); + var options = {}; + handleShapeDefaults(optionsIn, options, gd._fullLayout); gd._fullLayout.shapes[index] = options; var clipAxes; @@ -56503,22 +56454,22 @@ function getPathString(gd, options) { xa = Axes.getFromId(gd, options.xref), ya = Axes.getFromId(gd, options.yref), gs = gd._fullLayout._size, - x2l, + x2r, x2p, - y2l, + y2r, y2p; if(xa) { - x2l = helpers.dataToLinear(xa); - x2p = function(v) { return xa._offset + xa.l2p(x2l(v, true)); }; + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2l = helpers.dataToLinear(ya); - y2p = function(v) { return ya._offset + ya.l2p(y2l(v, true)); }; + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; @@ -56600,7 +56551,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":314,"../../lib/setcursor":324,"../../plotly":336,"../../plots/cartesian/axes":340,"../color":223,"../dragelement":245,"../drawing":247,"./constants":287,"./defaults":288,"./helpers":290,"./shape_defaults":292,"fast-isnumeric":12}],290:[function(require,module,exports){ +},{"../../lib":316,"../../lib/setcursor":326,"../../plotly":338,"../../plots/cartesian/axes":343,"../color":223,"../dragelement":244,"../drawing":246,"./constants":286,"./defaults":287,"./helpers":289,"./shape_defaults":291,"fast-isnumeric":12}],289:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56617,16 +56568,16 @@ function movePath(pathIn, moveX, moveY) { // so these have to be specified in terms of the category serial numbers, // but can take fractional values. Other axis types we specify position based on // the actual data values. -// TODO: this should really be part of axes, but for now it's only used here. -// eventually annotations and axis ranges will use this too. -// what should we do, invent a new letter for "data except if it's category"? +// TODO: in V2.0 (when log axis ranges are in data units) range and shape position +// will be identical, so rangeToShapePosition and shapePositionToRange can be +// removed entirely. -exports.dataToLinear = function(ax) { - return ax.type === 'category' ? ax.c2l : ax.d2l; +exports.rangeToShapePosition = function(ax) { + return (ax.type === 'log') ? ax.r2d : function(v) { return v; }; }; -exports.linearToData = function(ax) { - return ax.type === 'category' ? ax.l2c : ax.l2d; +exports.shapePositionToRange = function(ax) { + return (ax.type === 'log') ? ax.d2r : function(v) { return v; }; }; exports.decodeDate = function(convertToPx) { @@ -56645,10 +56596,10 @@ exports.getDataToPixel = function(gd, axis, isVertical) { dataToPixel; if(axis) { - var d2l = exports.dataToLinear(axis); + var d2r = exports.shapePositionToRange(axis); dataToPixel = function(v) { - return axis._offset + axis.l2p(d2l(v, true)); + return axis._offset + axis.r2p(d2r(v, true)); }; if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); @@ -56668,8 +56619,8 @@ exports.getPixelToData = function(gd, axis, isVertical) { pixelToData; if(axis) { - var l2d = exports.linearToData(axis); - pixelToData = function(p) { return l2d(axis.p2l(p - axis._offset)); }; + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; @@ -56681,7 +56632,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],291:[function(require,module,exports){ +},{}],290:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56693,21 +56644,21 @@ exports.getPixelToData = function(gd, axis, isVertical) { 'use strict'; -exports.moduleType = 'component'; - -exports.name = 'shapes'; - -exports.layoutAttributes = require('./attributes'); +var drawModule = require('./draw'); -exports.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'shapes', -exports.calcAutorange = require('./calc_autorange'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne +}; -},{"./attributes":285,"./calc_autorange":286,"./defaults":288,"./draw":289}],292:[function(require,module,exports){ +},{"./attributes":284,"./calc_autorange":285,"./defaults":287,"./draw":288}],291:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56725,13 +56676,19 @@ var Axes = require('../../plots/cartesian/axes'); var attributes = require('./attributes'); var helpers = require('./helpers'); -module.exports = function handleShapeDefaults(shapeIn, fullLayout) { - var shapeOut = {}; + +module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opts, itemOpts) { + opts = opts || {}; + itemOpts = itemOpts || {}; function coerce(attr, dflt) { return Lib.coerce(shapeIn, shapeOut, attributes, attr, dflt); } + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + + if(!visible) return shapeOut; + coerce('layer'); coerce('opacity'); coerce('fillcolor'); @@ -56746,39 +56703,61 @@ module.exports = function handleShapeDefaults(shapeIn, fullLayout) { var axLetters = ['x', 'y']; for(var i = 0; i < 2; i++) { var axLetter = axLetters[i], - tdMock = {_fullLayout: fullLayout}; + gdMock = {_fullLayout: fullLayout}; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, tdMock, axLetter); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); if(shapeType !== 'path') { var dflt0 = 0.25, - dflt1 = 0.75; + dflt1 = 0.75, + ax, + pos2r, + r2pos; if(axRef !== 'paper') { - var ax = Axes.getFromId(tdMock, axRef), - convertFn = helpers.linearToData(ax); - - dflt0 = convertFn(ax.range[0] + dflt0 * (ax.range[1] - ax.range[0])); - dflt1 = convertFn(ax.range[0] + dflt1 * (ax.range[1] - ax.range[0])); + ax = Axes.getFromId(gdMock, axRef); + r2pos = helpers.rangeToShapePosition(ax); + pos2r = helpers.shapePositionToRange(ax); + } + else { + pos2r = r2pos = Lib.identity; } + // hack until V2.0 when log has regular range behavior - make it look like other + // ranges to send to coerce, then put it back after + // this is all to give reasonable default position behavior on log axes, which is + // a pretty unimportant edge case so we could just ignore this. + var attr0 = axLetter + '0', + attr1 = axLetter + '1', + in0 = shapeIn[attr0], + in1 = shapeIn[attr1]; + shapeIn[attr0] = pos2r(shapeIn[attr0], true); + shapeIn[attr1] = pos2r(shapeIn[attr1], true); + // x0, x1 (and y0, y1) - coerce(axLetter + '0', dflt0); - coerce(axLetter + '1', dflt1); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr0, dflt0); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr1, dflt1); + + // hack part 2 + shapeOut[attr0] = r2pos(shapeOut[attr0]); + shapeOut[attr1] = r2pos(shapeOut[attr1]); + shapeIn[attr0] = in0; + shapeIn[attr1] = in1; } } if(shapeType === 'path') { coerce('path'); - } else { + } + else { Lib.noneOrAll(shapeIn, shapeOut, ['x0', 'x1', 'y0', 'y1']); } return shapeOut; }; -},{"../../lib":314,"../../plots/cartesian/axes":340,"./attributes":285,"./helpers":290}],293:[function(require,module,exports){ +},{"../../lib":316,"../../plots/cartesian/axes":343,"./attributes":284,"./helpers":289}],292:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -56797,7 +56776,7 @@ var animationAttrs = require('../../plots/animation_attributes'); var constants = require('./constants'); var stepsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'step', method: { valType: 'enumerated', @@ -56830,6 +56809,8 @@ var stepsAttrs = { }; module.exports = { + _isLinkedToArray: 'slider', + visible: { valType: 'boolean', @@ -57010,7 +56991,7 @@ module.exports = { }, }; -},{"../../lib/extend":311,"../../plots/animation_attributes":337,"../../plots/font_attributes":361,"../../plots/pad_attributes":371,"./constants":294}],294:[function(require,module,exports){ +},{"../../lib/extend":312,"../../plots/animation_attributes":339,"../../plots/font_attributes":363,"../../plots/pad_attributes":373,"./constants":293}],293:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -57025,9 +57006,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'sliders', - itemName: 'slider', // class names containerClassName: 'slider-container', @@ -57108,7 +57088,7 @@ module.exports = { currentValueInset: 0, }; -},{}],295:[function(require,module,exports){ +},{}],294:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -57120,6 +57100,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -57129,23 +57110,12 @@ var stepAttrs = attributes.steps; module.exports = function slidersDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var sliderIn = contIn[i] || {}, - sliderOut = {}; - - sliderDefaults(sliderIn, sliderOut, layoutOut); - - // used on button click to update the 'active' field - sliderOut._input = sliderIn; - - // used to determine object constancy - sliderOut._index = i; + var opts = { + name: name, + handleItemDefaults: sliderDefaults + }; - contOut.push(sliderOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function sliderDefaults(sliderIn, sliderOut, layoutOut) { @@ -57231,7 +57201,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":314,"./attributes":293,"./constants":294}],296:[function(require,module,exports){ +},{"../../lib":316,"../../plots/array_container_defaults":340,"./attributes":292,"./constants":293}],295:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -57600,6 +57570,7 @@ function handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, doTransiti } function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) { + var previousActive = sliderOpts.active; sliderOpts._input.active = sliderOpts.active = index; var step = sliderOpts.steps[sliderOpts.active]; @@ -57607,6 +57578,13 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) sliderGroup.call(setGripPosition, sliderOpts, sliderOpts.active / (sliderOpts.steps.length - 1), doTransition); sliderGroup.call(drawCurrentValue, sliderOpts); + gd.emit('plotly_sliderchange', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active], + interaction: doCallback, + previousActive: previousActive + }); + if(step && step.method && doCallback) { if(sliderGroup._nextMethod) { // If we've already queued up an update, just overwrite it with the most recent: @@ -57633,6 +57611,8 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { var $gd = d3.select(gd); item.on('mousedown', function() { + gd.emit('plotly_sliderstart', {slider: sliderOpts}); + var grip = sliderGroup.select('.' + constants.gripRectClass); d3.event.stopPropagation(); @@ -57653,6 +57633,11 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { grip.call(Color.fill, sliderOpts.bgcolor); $gd.on('mouseup', null); $gd.on('mousemove', null); + + gd.emit('plotly_sliderend', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active] + }); }); }); } @@ -57790,7 +57775,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":314,"../../lib/svg_text_utils":326,"../../plots/plots":372,"../color":223,"../drawing":247,"../legend/anchor_utils":260,"./constants":294,"d3":8}],297:[function(require,module,exports){ +},{"../../lib":316,"../../lib/svg_text_utils":328,"../../plots/plots":374,"../color":223,"../drawing":246,"../legend/anchor_utils":259,"./constants":293,"d3":8}],296:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -57801,18 +57786,19 @@ function clearPushMargins(gd) { 'use strict'; +var constants = require('./constants'); -exports.moduleType = 'component'; - -exports.name = 'sliders'; - -exports.layoutAttributes = require('./attributes'); +module.exports = { + moduleType: 'component', + name: constants.name, -exports.supplyLayoutDefaults = require('./defaults'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":293,"./defaults":295,"./draw":296}],298:[function(require,module,exports){ +},{"./attributes":292,"./constants":293,"./defaults":294,"./draw":295}],297:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58042,7 +58028,7 @@ Titles.draw = function(gd, titleClass, options) { el.classed('js-placeholder', isplaceholder); }; -},{"../../lib":314,"../../lib/svg_text_utils":326,"../../plotly":336,"../../plots/plots":372,"../color":223,"../drawing":247,"d3":8,"fast-isnumeric":12}],299:[function(require,module,exports){ +},{"../../lib":316,"../../lib/svg_text_utils":328,"../../plotly":338,"../../plots/plots":374,"../color":223,"../drawing":246,"d3":8,"fast-isnumeric":12}],298:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58059,7 +58045,7 @@ var extendFlat = require('../../lib/extend').extendFlat; var padAttrs = require('../../plots/pad_attributes'); var buttonsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'button', method: { valType: 'enumerated', @@ -58088,7 +58074,7 @@ var buttonsAttrs = { }; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'updatemenu', visible: { valType: 'boolean', @@ -58188,7 +58174,7 @@ module.exports = { } }; -},{"../../lib/extend":311,"../../plots/font_attributes":361,"../../plots/pad_attributes":371,"../color/attributes":222}],300:[function(require,module,exports){ +},{"../../lib/extend":312,"../../plots/font_attributes":363,"../../plots/pad_attributes":373,"../color/attributes":222}],299:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58203,9 +58189,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'updatemenus', - itemName: 'updatemenu', // class names containerClassName: 'updatemenu-container', @@ -58265,7 +58250,7 @@ module.exports = { hoverColor: '#F4FAFF' }; -},{}],301:[function(require,module,exports){ +},{}],300:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58277,6 +58262,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -58286,23 +58272,12 @@ var buttonAttrs = attributes.buttons; module.exports = function updateMenusDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var menuIn = contIn[i] || {}, - menuOut = {}; - - menuDefaults(menuIn, menuOut, layoutOut); - - // used on button click to update the 'active' field - menuOut._input = menuIn; - - // used to determine object constancy - menuOut._index = i; + var opts = { + name: name, + handleItemDefaults: menuDefaults + }; - contOut.push(menuOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function menuDefaults(menuIn, menuOut, layoutOut) { @@ -58369,7 +58344,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":314,"./attributes":299,"./constants":300}],302:[function(require,module,exports){ +},{"../../lib":316,"../../plots/array_container_defaults":340,"./attributes":298,"./constants":299}],301:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58671,6 +58646,8 @@ function drawButtons(gd, gHeader, gButton, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, buttonIndex); Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + + gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); button.on('mouseover', function() { @@ -58950,7 +58927,9 @@ function clearPushMargins(gd) { } } -},{"../../lib":314,"../../lib/svg_text_utils":326,"../../plots/plots":372,"../color":223,"../drawing":247,"../legend/anchor_utils":260,"./constants":300,"d3":8}],303:[function(require,module,exports){ +},{"../../lib":316,"../../lib/svg_text_utils":328,"../../plots/plots":374,"../color":223,"../drawing":246,"../legend/anchor_utils":259,"./constants":299,"d3":8}],302:[function(require,module,exports){ +arguments[4][296][0].apply(exports,arguments) +},{"./attributes":298,"./constants":299,"./defaults":300,"./draw":301,"dup":296}],303:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -58962,17 +58941,37 @@ function clearPushMargins(gd) { 'use strict'; -exports.moduleType = 'component'; - -exports.name = 'updatemenus'; - -exports.layoutAttributes = require('./attributes'); +module.exports = { + /** + * Standardize all missing data in calcdata to use undefined + * never null or NaN. + * That way we can use !==undefined, or !== BADNUM, + * to test for real data + */ + BADNUM: undefined, -exports.supplyLayoutDefaults = require('./defaults'); + /* + * Limit certain operations to well below floating point max value + * to avoid glitches: Make sure that even when you multiply it by the + * number of pixels on a giant screen it still works + */ + FP_SAFE: Number.MAX_VALUE / 10000, -exports.draw = require('./draw'); + /* + * conversion of date units to milliseconds + * year and month constants are marked "AVG" + * to remind us that not all years and months + * have the same length + */ + ONEAVGYEAR: 31557600000, // 365.25 days + ONEAVGMONTH: 2629800000, // 1/12 of ONEAVGYEAR + ONEDAY: 86400000, + ONEHOUR: 3600000, + ONEMIN: 60000, + ONESEC: 1000 +}; -},{"./attributes":299,"./defaults":301,"./draw":302}],304:[function(require,module,exports){ +},{}],304:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -59052,7 +59051,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.19.2'; +exports.version = '1.20.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -59113,7 +59112,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":221,"./components/images":259,"./components/legend":267,"./components/rangeselector":279,"./components/rangeslider":284,"./components/shapes":291,"./components/sliders":297,"./components/updatemenus":303,"./fonts/mathjax_config":307,"./lib/queue":322,"./plot_api/plot_schema":330,"./plot_api/register":331,"./plot_api/set_plot_config":332,"./plot_api/to_image":334,"./plot_api/validate":335,"./plotly":336,"./snapshot":385,"./snapshot/download":382,"./traces/scatter":401,"d3":8,"es6-promise":10}],307:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":221,"./components/images":258,"./components/legend":266,"./components/rangeselector":278,"./components/rangeslider":283,"./components/shapes":290,"./components/sliders":296,"./components/updatemenus":302,"./fonts/mathjax_config":307,"./lib/queue":324,"./plot_api/plot_schema":332,"./plot_api/register":333,"./plot_api/set_plot_config":334,"./plot_api/to_image":336,"./plot_api/validate":337,"./plotly":338,"./snapshot":387,"./snapshot/download":384,"./traces/scatter":403,"d3":8,"es6-promise":10}],307:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -59156,22 +59155,50 @@ if(typeof MathJax !== 'undefined') { */ +'use strict'; + +var isNumeric = require('fast-isnumeric'); + +var BADNUM = require('../constants/numerical').BADNUM; + +// precompile these regex's for speed +var FRONTJUNK = /^['"%,$#\s']+/; +var ENDJUNK = /['"%,$#\s']+$/; + +/** + * cleanNumber: remove common leading and trailing cruft + * Always returns either a number or BADNUM. + */ +module.exports = function cleanNumber(v) { + if(typeof v === 'string') { + v = v.replace(FRONTJUNK, '').replace(ENDJUNK, ''); + } + + if(isNumeric(v)) return Number(v); + + return BADNUM; +}; + +},{"../constants/numerical":303,"fast-isnumeric":12}],309:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + 'use strict'; var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); -var nestedProperty = require('./nested_property'); -var isPlainObject = require('./is_plain_object'); -var filterUnique = require('./filter_unique'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); +var nestedProperty = require('./nested_property'); -var idRegex = /^([2-9]|[1-9][0-9]+)$/; - -function isValObject(obj) { - return obj && obj.valType !== undefined; -} +var ID_REGEX = /^([2-9]|[1-9][0-9]+)$/; exports.valObjects = { data_array: { @@ -59282,7 +59309,7 @@ exports.valObjects = { coerceFunction: function(v, propOut, dflt) { var dlen = dflt.length; if(typeof v === 'string' && v.substr(0, dlen) === dflt && - idRegex.test(v.substr(dlen))) { + ID_REGEX.test(v.substr(dlen))) { propOut.set(v); return; } @@ -59294,7 +59321,7 @@ exports.valObjects = { if(v === dflt) return true; if(typeof v !== 'string') return false; - if(v.substr(0, dlen) === dflt && idRegex.test(v.substr(dlen))) { + if(v.substr(0, dlen) === dflt && ID_REGEX.test(v.substr(dlen))) { return true; } @@ -59462,129 +59489,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -/* - * returns true for a valid value object and false for tree nodes in the attribute hierarchy - */ -exports.isValObject = isValObject; - -exports.IS_SUBPLOT_OBJ = '_isSubplotObj'; -exports.IS_LINKED_TO_ARRAY = '_isLinkedToArray'; -exports.DEPRECATED = '_deprecated'; - -// list of underscore attributes to keep in schema as is -exports.UNDERSCORE_ATTRS = [exports.IS_SUBPLOT_OBJ, exports.IS_LINKED_TO_ARRAY, exports.DEPRECATED]; - -/** - * Crawl the attribute tree, recursively calling a callback function - * - * @param {object} attrs - * The node of the attribute tree (e.g. the root) from which recursion originates - * @param {Function} callback - * A callback function with the signature: - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * @param {Number} [specifiedLevel] - * The level in the tree, in order to let the callback function detect descend or backtrack, - * typically unsupplied (implied 0), just used by the self-recursive call. - * The necessity arises because the tree traversal is not controlled by callback return values. - * The decision to not use callback return values for controlling tree pruning arose from - * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions - * precedes the callback call. - * - * @return {object} transformOut - * copy of transformIn that contains attribute defaults - */ -exports.crawl = function(attrs, callback, specifiedLevel) { - var level = specifiedLevel || 0; - Object.keys(attrs).forEach(function(attrName) { - var attr = attrs[attrName]; - - if(exports.UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - - callback(attr, attrName, attrs, level); - - if(isValObject(attr)) return; - if(isPlainObject(attr)) exports.crawl(attr, callback, level + 1); - }); -}; - -/** - * Find all data array attributes in a given trace object - including - * `arrayOk` attributes. - * - * @param {object} trace - * full trace object that contains a reference to `_module.attributes` - * - * @return {array} arrayAttributes - * list of array attributes for the given trace - */ -exports.findArrayAttributes = function(trace) { - var arrayAttributes = [], - stack = []; - - /** - * A closure that gathers attribute paths into its enclosed arraySplitAttributes - * Attribute paths are collected iff their leaf node is a splittable attribute - * - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * - * @closureVariable {String[][]} arrayAttributes the set of gathered attributes - * Example of filled closure variable (expected to be initialized to []): - * [["marker","size"],["marker","line","width"],["marker","line","color"]] - */ - function callback(attr, attrName, attrs, level) { - stack = stack.slice(0, level).concat([attrName]); - - var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; - if(!splittableAttr) return; - - var astr = toAttrString(stack); - var val = nestedProperty(trace, astr).get(); - if(!Array.isArray(val)) return; - - arrayAttributes.push(astr); - } - - function toAttrString(stack) { - return stack.join('.'); - } - - exports.crawl(trace._module.attributes, callback); - - if(trace.transforms) { - var transforms = trace.transforms; - - for(var i = 0; i < transforms.length; i++) { - var transform = transforms[i]; - - stack = ['transforms[' + i + ']']; - exports.crawl(transform._module.attributes, callback, 1); - } - } - - // Look into the fullInput module attributes for array attributes - // to make sure that 'custom' array attributes are detected. - // - // At the moment, we need this block to make sure that - // ohlc and candlestick 'open', 'high', 'low', 'close' can be - // used with filter ang groupby transforms. - if(trace._fullInput) { - exports.crawl(trace._fullInput._module.attributes, callback); - - arrayAttributes = filterUnique(arrayAttributes); - } - - return arrayAttributes; -}; - -},{"../components/colorscale/get_scale":236,"../components/colorscale/scales":242,"./filter_unique":312,"./is_plain_object":316,"./nested_property":319,"fast-isnumeric":12,"tinycolor2":197}],309:[function(require,module,exports){ +},{"../components/colorscale/get_scale":235,"../components/colorscale/scales":241,"./nested_property":321,"fast-isnumeric":12,"tinycolor2":197}],310:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -59599,6 +59504,24 @@ exports.findArrayAttributes = function(trace) { var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); +var logError = require('./loggers').error; + +var constants = require('../constants/numerical'); +var BADNUM = constants.BADNUM; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + +// is an object a javascript date? +exports.isJSDate = function(v) { + return typeof v === 'object' && v !== null && typeof v.getTime === 'function'; +}; + +// The absolute limits of our date-time system +// This is a little weird: we use MIN_MS and MAX_MS in dateTime2ms +// but we use dateTime2ms to calculate them (after defining it!) +var MIN_MS, MAX_MS; /** * dateTime2ms - turn a date object or string s of the form @@ -59606,7 +59529,13 @@ var isNumeric = require('fast-isnumeric'); * per javascript standard) * may truncate after any full field, and sss can be any length * even >3 digits, though javascript dates truncate to milliseconds - * returns false if it doesn't find a date + * returns BADNUM if it doesn't find a date + * + * Expanded to support negative years to -9999 but you must always + * give 4 digits, except for 2-digit positive years which we assume are + * near the present time. + * Note that we follow ISO 8601:2004: there *is* a year 0, which + * is 1BC/BCE, and -1===2BC etc. * * 2-digit to 4-digit year conversion, where to cut off? * from http://support.microsoft.com/kb/244664: @@ -59614,85 +59543,123 @@ var isNumeric = require('fast-isnumeric'); * but in my mac chrome from eg. d=new Date(Date.parse('8/19/50')): * 1950-2049 * by Java, from http://stackoverflow.com/questions/2024273/: - * now-80 - now+20 + * now-80 - now+19 * or FileMaker Pro, from * http://www.filemaker.com/12help/html/add_view_data.4.21.html: - * now-70 - now+30 + * now-70 - now+29 * but python strptime etc, via * http://docs.python.org/py3k/library/time.html: * 1969-2068 (super forward-looking, but static, not sliding!) * - * lets go with now-70 to now+30, and if anyone runs into this problem + * lets go with now-70 to now+29, and if anyone runs into this problem * they can learn the hard way not to use 2-digit years, as no choice we * make now will cover all possibilities. mostly this will all be taken * care of in initial parsing, should only be an issue for hand-entered data - * currently (2012) this range is: - * 1942-2041 + * currently (2016) this range is: + * 1946-2045 */ exports.dateTime2ms = function(s) { // first check if s is a date object - try { - if(s.getTime) return +s; - } - catch(e) { - return false; + if(exports.isJSDate(s)) { + s = Number(s); + if(s >= MIN_MS && s <= MAX_MS) return s; + return BADNUM; } + // otherwise only accept strings and numbers + if(typeof s !== 'string' && typeof s !== 'number') return BADNUM; var y, m, d, h; // split date and time parts - var datetime = String(s).split(' '); - if(datetime.length > 2) return false; + // TODO: we strip leading/trailing whitespace but not other + // characters like we do for numbers - do we want to? + var datetime = String(s).trim().split(' '); + if(datetime.length > 2) return BADNUM; var p = datetime[0].split('-'); // date part - if(p.length > 3 || (p.length !== 3 && datetime[1])) return false; + + var CE = true; // common era, ie positive year + if(p[0] === '') { + // first part is blank: year starts with a minus sign + CE = false; + p.splice(0, 1); + } + + var plen = p.length; + if(plen > 3 || (plen !== 3 && datetime[1]) || !plen) return BADNUM; // year if(p[0].length === 4) y = Number(p[0]); else if(p[0].length === 2) { + if(!CE) return BADNUM; var yNow = new Date().getFullYear(); y = ((Number(p[0]) - yNow + 70) % 100 + 200) % 100 + yNow - 70; } - else return false; - if(!isNumeric(y)) return false; - if(p.length === 1) return new Date(y, 0, 1).getTime(); // year only + else return BADNUM; + if(!isNumeric(y)) return BADNUM; + + // javascript takes new Date(0..99,m,d) to mean 1900-1999, so + // to support years 0-99 we need to use setFullYear explicitly + var baseDate = new Date(0, 0, 1); + baseDate.setFullYear(CE ? y : -y); + if(p.length > 1) { + + // month - may be 1 or 2 digits + m = Number(p[1]) - 1; // new Date() uses zero-based months + if(p[1].length > 2 || !(m >= 0 && m <= 11)) return BADNUM; + baseDate.setMonth(m); + + if(p.length > 2) { + + // day - may be 1 or 2 digits + d = Number(p[2]); + if(p[2].length > 2 || !(d >= 1 && d <= 31)) return BADNUM; + baseDate.setDate(d); + + // does that date exist in this month? + if(baseDate.getDate() !== d) return BADNUM; + + if(datetime[1]) { - // month - m = Number(p[1]) - 1; // new Date() uses zero-based months - if(p[1].length > 2 || !(m >= 0 && m <= 11)) return false; - if(p.length === 2) return new Date(y, m, 1).getTime(); // year-month + p = datetime[1].split(':'); + if(p.length > 3) return BADNUM; - // day - d = Number(p[2]); - if(p[2].length > 2 || !(d >= 1 && d <= 31)) return false; + // hour - may be 1 or 2 digits + h = Number(p[0]); + if(p[0].length > 2 || !p[0].length || !(h >= 0 && h <= 23)) return BADNUM; + baseDate.setHours(h); - // now save the date part - d = new Date(y, m, d).getTime(); - if(!datetime[1]) return d; // year-month-day - p = datetime[1].split(':'); - if(p.length > 3) return false; + // does that hour exist in this day? (Daylight time!) + // (TODO: remove this check when we move to UTC) + if(baseDate.getHours() !== h) return BADNUM; - // hour - h = Number(p[0]); - if(p[0].length > 2 || !(h >= 0 && h <= 23)) return false; - d += 3600000 * h; - if(p.length === 1) return d; + if(p.length > 1) { + d = baseDate.getTime(); - // minute - m = Number(p[1]); - if(p[1].length > 2 || !(m >= 0 && m <= 59)) return false; - d += 60000 * m; - if(p.length === 2) return d; + // minute - must be 2 digits + m = Number(p[1]); + if(p[1].length !== 2 || !(m >= 0 && m <= 59)) return BADNUM; + d += ONEMIN * m; + if(p.length === 2) return d; - // second - s = Number(p[2]); - if(!(s >= 0 && s < 60)) return false; - return d + s * 1000; + // second (and milliseconds) - must have 2-digit seconds + if(p[2].split('.')[0].length !== 2) return BADNUM; + s = Number(p[2]); + if(!(s >= 0 && s < 60)) return BADNUM; + return d + s * ONESEC; + } + } + } + } + return baseDate.getTime(); }; +MIN_MS = exports.MIN_MS = exports.dateTime2ms('-9999'); +MAX_MS = exports.MAX_MS = exports.dateTime2ms('9999-12-31 23:59:59.9999'); + // is string s a date? (see above) exports.isDateTime = function(s) { - return (exports.dateTime2ms(s) !== false); + return (exports.dateTime2ms(s) !== BADNUM); }; // pad a number with zeroes, to given # of digits before the decimal point @@ -59701,224 +59668,68 @@ function lpad(val, digits) { } /** - * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.sss - * Crop any trailing zeros in time, but always leave full date - * (we could choose to crop '-01' from date too)... + * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.ssss + * Crop any trailing zeros in time, except never stop right after hours + * (we could choose to crop '-01' from date too but for now we always + * show the whole date) * Optional range r is the data range that applies, also in ms. * If rng is big, the later parts of time will be omitted */ +var NINETYDAYS = 90 * ONEDAY; +var THREEHOURS = 3 * ONEHOUR; +var FIVEMIN = 5 * ONEMIN; exports.ms2DateTime = function(ms, r) { + if(typeof ms !== 'number' || !(ms >= MIN_MS && ms <= MAX_MS)) return BADNUM; + if(!r) r = 0; - var d = new Date(ms), - s = d3.time.format('%Y-%m-%d')(d); - - if(r < 7776000000) { - // <90 days: add hours - s += ' ' + lpad(d.getHours(), 2); - if(r < 432000000) { - // <5 days: add minutes - s += ':' + lpad(d.getMinutes(), 2); - if(r < 10800000) { - // <3 hours: add seconds - s += ':' + lpad(d.getSeconds(), 2); - if(r < 300000) { - // <5 minutes: add ms - s += '.' + lpad(d.getMilliseconds(), 3); + var d = new Date(Math.floor(ms)), + dateStr = d3.time.format('%Y-%m-%d')(d), + // <90 days: add hours and minutes - never *only* add hours + h = (r < NINETYDAYS) ? d.getHours() : 0, + m = (r < NINETYDAYS) ? d.getMinutes() : 0, + // <3 hours: add seconds + s = (r < THREEHOURS) ? d.getSeconds() : 0, + // <5 minutes: add ms (plus one extra digit, this is msec*10) + msec10 = (r < FIVEMIN) ? Math.round((d.getMilliseconds() + (((ms % 1) + 1) % 1)) * 10) : 0; + + // include each part that has nonzero data in or after it + if(h || m || s || msec10) { + dateStr += ' ' + lpad(h, 2) + ':' + lpad(m, 2); + if(s || msec10) { + dateStr += ':' + lpad(s, 2); + if(msec10) { + var digits = 4; + while(msec10 % 10 === 0) { + digits -= 1; + msec10 /= 10; } + dateStr += '.' + lpad(msec10, digits); } } - // strip trailing zeros - return s.replace(/([:\s]00)*\.?[0]*$/, ''); } - return s; -}; - -/** - * parseDate: forgiving attempt to turn any date string - * into a javascript date object - * - * first collate all the date formats we want to support, precompiled - * to d3 format objects see below for the string cleaning that happens - * before this separate out 2-digit (y) and 4-digit-year (Y) formats, - * formats with month names (b), and formats with am/pm (I) or no time (D) - * (also includes hour only, as the test is really for a colon) so we can - * cut down the number of tests we need to run for any given string - * (right now all are between 15 and 32 tests) - */ - -// TODO: this is way out of date vs. the server-side version -var timeFormats = { - // 24 hour - H: ['%H:%M:%S~%L', '%H:%M:%S', '%H:%M'], - // with am/pm - I: ['%I:%M:%S~%L%p', '%I:%M:%S%p', '%I:%M%p'], - // no colon, ie only date or date with hour (could also support eg 12h34m?) - D: ['%H', '%I%p', '%Hh'] -}; - -var dateFormats = { - Y: [ - '%Y~%m~%d', - '%Y%m%d', - '%y%m%d', // YYMMDD, has 6 digits together so will match Y, not y - '%m~%d~%Y', // MM/DD/YYYY has first precedence - '%d~%m~%Y' // then DD/MM/YYYY - ], - Yb: [ - '%b~%d~%Y', // eg nov 21 2013 - '%d~%b~%Y', // eg 21 nov 2013 - '%Y~%d~%b', // eg 2013 21 nov (or 2013 q3, after replacement) - '%Y~%b~%d' // eg 2013 nov 21 - ], - /** - * the two-digit year cases have so many potential ambiguities - * it's not even funny, but we'll try them anyway. - */ - y: [ - '%m~%d~%y', - '%d~%m~%y', - '%y~%m~%d' - ], - yb: [ - '%b~%d~%y', - '%d~%b~%y', - '%y~%d~%b', - '%y~%b~%d' - ] -}; - -// use utc formatter since we're ignoring timezone info -var formatter = d3.time.format.utc; - -/** - * ISO8601 and YYYYMMDDHHMMSS are the only ones where date and time - * are not separated by a space, so they get inserted specially here. - * Also a couple formats with no day (so time makes no sense) - */ -var dateTimeFormats = { - Y: { - H: ['%Y~%m~%dT%H:%M:%S', '%Y~%m~%dT%H:%M:%S~%L'].map(formatter), - I: [], - D: ['%Y%m%d%H%M%S', '%Y~%m', '%m~%Y'].map(formatter) - }, - Yb: {H: [], I: [], D: ['%Y~%b', '%b~%Y'].map(formatter)}, - y: {H: [], I: [], D: []}, - yb: {H: [], I: [], D: []} + return dateStr; }; -// all others get inserted in all possible combinations from dateFormats and timeFormats -['Y', 'Yb', 'y', 'yb'].forEach(function(dateType) { - dateFormats[dateType].forEach(function(dateFormat) { - // just a date (don't do just a time) - dateTimeFormats[dateType].D.push(formatter(dateFormat)); - ['H', 'I', 'D'].forEach(function(timeType) { - timeFormats[timeType].forEach(function(timeFormat) { - var a = dateTimeFormats[dateType][timeType]; - - // 'date time', then 'time date' - a.push(formatter(dateFormat + '~' + timeFormat)); - a.push(formatter(timeFormat + '~' + dateFormat)); - }); - }); - }); -}); - -// precompiled regexps for performance -var matchword = /[a-z]*/g, - shortenword = function(m) { return m.substr(0, 3); }, - weekdaymatch = /(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g, - separatormatch = /[\s,\/\-\.\(\)]+/g, - ampmmatch = /~?([ap])~?m(~|$)/, - replaceampm = function(m, ap) { return ap + 'm '; }, - match4Y = /\d\d\d\d/, - matchMonthName = /(^|~)[a-z]{3}/, - matchAMPM = /[ap]m/, - matchcolon = /:/, - matchquarter = /q([1-4])/, - quarters = ['31~mar', '30~jun', '30~sep', '31~dec'], - replacequarter = function(m, n) { return quarters[n - 1]; }, - matchTZ = / ?([+\-]\d\d:?\d\d|Z)$/; - -function getDateType(v) { - var dateType; - dateType = (match4Y.test(v) ? 'Y' : 'y'); - dateType = dateType + (matchMonthName.test(v) ? 'b' : ''); - return dateType; -} - -function getTimeType(v) { - var timeType; - timeType = matchcolon.test(v) ? (matchAMPM.test(v) ? 'I' : 'H') : 'D'; - return timeType; -} - -exports.parseDate = function(v) { - // is it already a date? just return it - if(v.getTime) return v; - /** - * otherwise, if it's not a string, return nothing - * the case of numbers that just have years will get - * dealt with elsewhere. - */ - if(typeof v !== 'string') return false; - - // first clean up the string a bit to reduce the number of formats we have to test - v = v.toLowerCase() - /** - * cut all words down to 3 characters - this will result in - * some spurious matches, ie whenever the first three characters - * of a word match a month or weekday but that seems more likely - * to fix typos than to make dates where they shouldn't be... - * and then we can omit the long form of months from our testing - */ - .replace(matchword, shortenword) - /** - * remove weekday names, as they get overridden anyway if they're - * inconsistent also removes a few more words - * (ie "tuesday the 26th of november") - * TODO: language support? - * for months too, but these seem to be built into d3 - */ - .replace(weekdaymatch, '') - /** - * collapse all separators one ~ at a time, except : which seems - * pretty consistent for the time part use ~ instead of space or - * something since d3 can eat a space as padding on 1-digit numbers - */ - .replace(separatormatch, '~') - // in case of a.m. or p.m. (also take off any space before am/pm) - .replace(ampmmatch, replaceampm) - // turn quarters Q1-4 into dates (quarter ends) - .replace(matchquarter, replacequarter) - .trim() - // also try to ignore timezone info, at least for now - .replace(matchTZ, ''); - - // now test against the various formats that might match - var out = null, - dateType = getDateType(v), - timeType = getTimeType(v), - formatList, - len; - - formatList = dateTimeFormats[dateType][timeType]; - len = formatList.length; - for(var i = 0; i < len; i++) { - out = formatList[i].parse(v); - if(out) break; +// normalize date format to date string, in case it starts as +// a Date object or milliseconds +// optional dflt is the return value if cleaning fails +exports.cleanDate = function(v, dflt) { + if(exports.isJSDate(v) || typeof v === 'number') { + // NOTE: if someone puts in a year as a number rather than a string, + // this will mistakenly convert it thinking it's milliseconds from 1970 + // that is: '2012' -> Jan. 1, 2012, but 2012 -> 2012 epoch milliseconds + v = exports.ms2DateTime(+v); + if(!v && dflt !== undefined) return dflt; } - - // If not an instance of Date at this point, just return it. - if(!(out instanceof Date)) return false; - // parse() method interprets arguments with local time zone. - var tzoff = out.getTimezoneOffset(); - // In general (default) this is not what we want, so force into UTC: - out.setTime(out.getTime() + tzoff * 60 * 1000); - return out; + else if(!exports.isDateTime(v)) { + logError('unrecognized date', v); + return dflt; + } + return v; }; -},{"d3":8,"fast-isnumeric":12}],310:[function(require,module,exports){ +},{"../constants/numerical":303,"./loggers":319,"d3":8,"fast-isnumeric":12}],311:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60084,7 +59895,7 @@ var Events = { module.exports = Events; -},{"events":11}],311:[function(require,module,exports){ +},{"events":11}],312:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60198,7 +60009,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":316}],312:[function(require,module,exports){ +},{"./is_plain_object.js":318}],313:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60249,7 +60060,38 @@ module.exports = function filterUnique(array) { return out; }; -},{}],313:[function(require,module,exports){ +},{}],314:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +/** Filter out object items with visible !== true + * insider array container. + * + * @param {array of objects} container + * @return {array of objects} of length <= container + * + */ +module.exports = function filterVisible(container) { + var out = []; + + for(var i = 0; i < container.length; i++) { + var item = container[i]; + + if(item.visible === true) out.push(item); + } + + return out; +}; + +},{}],315:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60381,7 +60223,7 @@ exports.makeBlank = function() { }; }; -},{}],314:[function(require,module,exports){ +},{}],316:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -60407,19 +60249,15 @@ lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; lib.validate = coerceModule.validate; -lib.isValObject = coerceModule.isValObject; -lib.crawl = coerceModule.crawl; -lib.findArrayAttributes = coerceModule.findArrayAttributes; -lib.IS_SUBPLOT_OBJ = coerceModule.IS_SUBPLOT_OBJ; -lib.IS_LINKED_TO_ARRAY = coerceModule.IS_LINKED_TO_ARRAY; -lib.DEPRECATED = coerceModule.DEPRECATED; -lib.UNDERSCORE_ATTRS = coerceModule.UNDERSCORE_ATTRS; var datesModule = require('./dates'); lib.dateTime2ms = datesModule.dateTime2ms; lib.isDateTime = datesModule.isDateTime; lib.ms2DateTime = datesModule.ms2DateTime; -lib.parseDate = datesModule.parseDate; +lib.cleanDate = datesModule.cleanDate; +lib.isJSDate = datesModule.isJSDate; +lib.MIN_MS = datesModule.MIN_MS; +lib.MAX_MS = datesModule.MAX_MS; var searchModule = require('./search'); lib.findBin = searchModule.findBin; @@ -60460,6 +60298,10 @@ lib.error = loggersModule.error; lib.notifier = require('./notifier'); lib.filterUnique = require('./filter_unique'); +lib.filterVisible = require('./filter_visible'); + + +lib.cleanNumber = require('./clean_number'); /** * swap x and y of the same attribute in container cont @@ -60636,7 +60478,7 @@ lib.smooth = function(arrayIn, FWHM) { * as long as its returns are not promises (ie have no .then) * includes one argument arg to send to all functions... * this is mainly just to prevent us having to make wrapper functions - * when the only purpose of the wrapper is to reference gd / td + * when the only purpose of the wrapper is to reference gd * and a final step to be executed at the end * TODO: if there's an error and everything is sync, * this doesn't happen yet because we want to make sure @@ -61109,7 +60951,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./coerce":308,"./dates":309,"./extend":311,"./filter_unique":312,"./is_array":315,"./is_plain_object":316,"./loggers":317,"./matrix":318,"./nested_property":319,"./notifier":320,"./search":323,"./stats":325,"d3":8}],315:[function(require,module,exports){ +},{"./clean_number":308,"./coerce":309,"./dates":310,"./extend":312,"./filter_unique":313,"./filter_visible":314,"./is_array":317,"./is_plain_object":318,"./loggers":319,"./matrix":320,"./nested_property":321,"./notifier":322,"./search":325,"./stats":327,"d3":8}],317:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61127,7 +60969,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ArrayBuffer.isView(a); }; -},{}],316:[function(require,module,exports){ +},{}],318:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61156,7 +60998,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],317:[function(require,module,exports){ +},{}],319:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61223,7 +61065,7 @@ loggers.error = function() { } }; -},{"../plot_api/plot_config":329}],318:[function(require,module,exports){ +},{"../plot_api/plot_config":331}],320:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61333,7 +61175,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],319:[function(require,module,exports){ +},{}],321:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61590,7 +61432,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./is_array":315,"fast-isnumeric":12}],320:[function(require,module,exports){ +},{"./is_array":317,"fast-isnumeric":12}],322:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61667,7 +61509,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":8,"fast-isnumeric":12}],321:[function(require,module,exports){ +},{"d3":8,"fast-isnumeric":12}],323:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -61907,7 +61749,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"./matrix":318}],322:[function(require,module,exports){ +},{"./matrix":320}],324:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -62118,7 +61960,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":314,"../plot_api/plot_config":329}],323:[function(require,module,exports){ +},{"../lib":316,"../plot_api/plot_config":331}],325:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -62229,7 +62071,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":317,"fast-isnumeric":12}],324:[function(require,module,exports){ +},{"./loggers":319,"fast-isnumeric":12}],326:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -62252,7 +62094,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],325:[function(require,module,exports){ +},{}],327:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -62348,7 +62190,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":12}],326:[function(require,module,exports){ +},{"fast-isnumeric":12}],328:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -62462,8 +62304,8 @@ exports.convertToTspans = function(_context, _callback) { } if(tex) { - var td = Lib.getPlotDiv(that.node()); - ((td && td._promises) || []).push(new Promise(function(resolve) { + var gd = Lib.getPlotDiv(that.node()); + ((gd && gd._promises) || []).push(new Promise(function(resolve) { that.style({visibility: 'hidden'}); var config = {fontSize: parseInt(that.style('font-size'), 10)}; @@ -62875,7 +62717,7 @@ exports.makeEditable = function(context, _delegate, options) { return d3.rebind(this, dispatch, 'on'); }; -},{"../constants/string_mappings":304,"../constants/xmlns_namespaces":305,"../lib":314,"d3":8}],327:[function(require,module,exports){ +},{"../constants/string_mappings":304,"../constants/xmlns_namespaces":305,"../lib":316,"d3":8}],329:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -62980,13 +62822,12 @@ exports.cleanLayout = function(layout) { } } - if(layout.annotations !== undefined && !Array.isArray(layout.annotations)) { - Lib.warn('Annotations must be an array.'); - delete layout.annotations; - } - var annotationsLen = (layout.annotations || []).length; + var annotationsLen = Array.isArray(layout.annotations) ? layout.annotations.length : 0; for(i = 0; i < annotationsLen; i++) { var ann = layout.annotations[i]; + + if(!Lib.isPlainObject(ann)) continue; + if(ann.ref) { if(ann.ref === 'paper') { ann.xref = 'paper'; @@ -62998,17 +62839,17 @@ exports.cleanLayout = function(layout) { } delete ann.ref; } + cleanAxRef(ann, 'xref'); cleanAxRef(ann, 'yref'); } - if(layout.shapes !== undefined && !Array.isArray(layout.shapes)) { - Lib.warn('Shapes must be an array.'); - delete layout.shapes; - } - var shapesLen = (layout.shapes || []).length; + var shapesLen = Array.isArray(layout.shapes) ? layout.shapes.length : 0; for(i = 0; i < shapesLen; i++) { var shape = layout.shapes[i]; + + if(!Lib.isPlainObject(shape)) continue; + cleanAxRef(shape, 'xref'); cleanAxRef(shape, 'yref'); } @@ -63357,7 +63198,7 @@ exports.manageArrayContainers = function(np, newVal, undoit) { } }; -},{"../components/color":223,"../lib":314,"../plots/cartesian/axes":340,"../plots/plots":372,"../registry":380,"fast-isnumeric":12,"gl-mat4/fromQuat":24}],328:[function(require,module,exports){ +},{"../components/color":223,"../lib":316,"../plots/cartesian/axes":343,"../plots/plots":374,"../registry":382,"fast-isnumeric":12,"gl-mat4/fromQuat":24}],330:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -65277,13 +65118,14 @@ function _relayout(gd, aobj) { objList = layout[objType] || [], obji = objList[objNum] || {}; - // new API, remove annotation / shape with `null` - if(vi === null) aobj[ai] = 'remove'; - // if p.parts is just an annotation number, and val is either // 'add' or an entire annotation to add, the undo is 'remove' // if val is 'remove' then undo is the whole annotation object if(p.parts.length === 2) { + + // new API, remove annotation / shape with `null` + if(vi === null) aobj[ai] = 'remove'; + if(aobj[ai] === 'add' || Lib.isPlainObject(aobj[ai])) { undoit[ai] = 'remove'; } @@ -65318,6 +65160,7 @@ function _relayout(gd, aobj) { } // alter gd.layout else { + var pp1 = String(p.parts[1] || ''); // check whether we can short-circuit a full redraw // 3d or geo at this point just needs to redraw. if(p.parts[0].indexOf('scene') === 0) flags.doplot = true; @@ -65332,17 +65175,17 @@ function _relayout(gd, aobj) { else if(ai.indexOf('title') !== -1) flags.doticks = true; else if(p.parts[0].indexOf('bgcolor') !== -1) flags.dolayoutstyle = true; else if(p.parts.length > 1 && - Lib.containsAny(p.parts[1], ['tick', 'exponent', 'grid', 'zeroline'])) { + Lib.containsAny(pp1, ['tick', 'exponent', 'grid', 'zeroline'])) { flags.doticks = true; } else if(ai.indexOf('.linewidth') !== -1 && ai.indexOf('axis') !== -1) { flags.doticks = flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1].indexOf('line') !== -1) { + else if(p.parts.length > 1 && pp1.indexOf('line') !== -1) { flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1] === 'mirror') { + else if(p.parts.length > 1 && pp1 === 'mirror') { flags.doticks = flags.dolayoutstyle = true; } else if(ai === 'margin.pad') { @@ -65364,7 +65207,7 @@ function _relayout(gd, aobj) { */ else if(['hovermode', 'dragmode'].indexOf(ai) !== -1) flags.domodebar = true; else if(['hovermode', 'dragmode', 'height', - 'width', 'autosize'].indexOf(ai) === -1) { + 'width', 'autosize'].indexOf(ai) === -1) { flags.doplot = true; } @@ -65573,6 +65416,20 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } } + // Execute a callback after the wrapper function has been called n times. + // This is used to defer the resolution until a transition has resovled *and* + // the frame has completed. If it's not done this way, then we get a race + // condition in which the animation might resolve before a transition is complete + // or vice versa. + function callbackOnNthTime(cb, n) { + var cnt = 0; + return function() { + if(cb && ++cnt === n) { + return cb(); + } + }; + } + return new Promise(function(resolve, reject) { function discardExistingFrames() { if(trans._frameQueue.length === 0) { @@ -65617,14 +65474,13 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { frameOpts: frameOpts, transitionOpts: transitionOpts, }; - if(i === frameList.length - 1) { // The last frame in this .animate call stores the promise resolve // and reject callbacks. This is how we ensure that the animation // loop (which may exist as a result of a *different* .animate call) // still resolves or rejecdts this .animate call's promise. once it's // complete. - nextFrame.onComplete = resolve; + nextFrame.onComplete = callbackOnNthTime(resolve, 2); nextFrame.onInterrupt = reject; } @@ -65662,7 +65518,6 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { // Execute the callback and unset it to ensure it doesn't // accidentally get called twice trans._currentFrame.onComplete(); - trans._currentFrame.onComplete = null; } var newFrame = trans._currentFrame = trans._frameQueue.shift(); @@ -65682,7 +65537,12 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { helpers.coerceTraceIndices(gd, newFrame.frame.traces), newFrame.frameOpts, newFrame.transitionOpts - ); + ).then(function() { + if(newFrame.onComplete) { + newFrame.onComplete(); + } + + }); gd.emit('plotly_animatingframe', { name: newFrame.name, @@ -65758,6 +65618,8 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { for(i = 0; i < trans._frames.length; i++) { frame = trans._frames[i]; + if(!frame) continue; + if(allFrames || frame.group === frameOrGroupNameOrFrameList) { frameList.push({ type: 'byname', @@ -65769,14 +65631,15 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } else if(isFrameArray) { for(i = 0; i < frameOrGroupNameOrFrameList.length; i++) { var frameOrName = frameOrGroupNameOrFrameList[i]; - if(typeof frameOrName === 'string') { + if(['number', 'string'].indexOf(typeof frameOrName) !== -1) { + frameOrName = String(frameOrName); // In this case, there's an array and this frame is a string name: frameList.push({ type: 'byname', name: frameOrName, data: setTransitionConfig({name: frameOrName}) }); - } else { + } else if(Lib.isPlainObject(frameOrName)) { frameList.push({ type: 'object', data: setTransitionConfig(Lib.extendFlat({}, frameOrName)) @@ -65920,7 +65783,7 @@ Plotly.addFrames = function(gd, frameList, indices) { if(_hash[frame.name]) { // If frame is present, overwrite its definition: for(j = 0; j < _frames.length; j++) { - if(_frames[j].name === frame.name) break; + if((_frames[j] || {}).name === frame.name) break; } ops.push({type: 'replace', index: j, value: frame}); revops.unshift({type: 'replace', index: j, value: _frames[j]}); @@ -66120,7 +65983,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":247,"../components/errorbars":253,"../constants/xmlns_namespaces":305,"../lib":314,"../lib/events":310,"../lib/queue":322,"../lib/svg_text_utils":326,"../plotly":336,"../plots/cartesian/graph_interact":348,"../plots/plots":372,"../plots/polar":375,"../registry":380,"./helpers":327,"./subroutines":333,"d3":8,"fast-isnumeric":12}],329:[function(require,module,exports){ +},{"../components/drawing":246,"../components/errorbars":252,"../constants/xmlns_namespaces":305,"../lib":316,"../lib/events":311,"../lib/queue":324,"../lib/svg_text_utils":328,"../plotly":338,"../plots/cartesian/graph_interact":350,"../plots/plots":374,"../plots/polar":377,"../registry":382,"./helpers":329,"./subroutines":335,"d3":8,"fast-isnumeric":12}],331:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66240,7 +66103,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],330:[function(require,module,exports){ +},{}],332:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66252,185 +66115,287 @@ function defaultSetBackground(gd, bgColor) { 'use strict'; -var Plotly = require('../plotly'); var Registry = require('../registry'); -var Plots = require('../plots/plots'); var Lib = require('../lib'); -// FIXME polar attribute are not part of Plotly yet +var baseAttributes = require('../plots/attributes'); +var baseLayoutAttributes = require('../plots/layout_attributes'); +var frameAttributes = require('../plots/frame_attributes'); +var animationAttributes = require('../plots/animation_attributes'); + +// polar attributes are not part of the Registry yet var polarAreaAttrs = require('../plots/polar/area_attributes'); var polarAxisAttrs = require('../plots/polar/axis_attributes'); var extendFlat = Lib.extendFlat; var extendDeep = Lib.extendDeep; -var extendDeepAll = Lib.extendDeepAll; -var NESTED_MODULE = '_nestedModules', - COMPOSED_MODULE = '_composedModules'; +var IS_SUBPLOT_OBJ = '_isSubplotObj'; +var IS_LINKED_TO_ARRAY = '_isLinkedToArray'; +var DEPRECATED = '_deprecated'; +var UNDERSCORE_ATTRS = [IS_SUBPLOT_OBJ, IS_LINKED_TO_ARRAY, DEPRECATED]; -var plotSchema = { - traces: {}, - layout: {}, - transforms: {}, - defs: {} -}; +exports.IS_SUBPLOT_OBJ = IS_SUBPLOT_OBJ; +exports.IS_LINKED_TO_ARRAY = IS_LINKED_TO_ARRAY; +exports.DEPRECATED = DEPRECATED; +exports.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS; +/** Outputs the full plotly.js plot schema + * + * @return {object} + * - defs + * - traces + * - layout + * - transforms + * - frames + * - animations + * - config (coming soon ...) + */ +exports.get = function() { + var traces = {}; + + Registry.allTypes.concat('area').forEach(function(type) { + traces[type] = getTraceAttributes(type); + }); -var PlotSchema = module.exports = {}; - + var transforms = {}; -PlotSchema.get = function() { - Registry.allTypes - .concat('area') // FIXME polar 'area' attributes - .forEach(getTraceAttributes); + Object.keys(Registry.transformsRegistry).forEach(function(type) { + transforms[type] = getTransformAttributes(type); + }); - getLayoutAttributes(); + return { + defs: { + valObjects: Lib.valObjects, + metaKeys: UNDERSCORE_ATTRS.concat['description', 'role'] + }, - Object.keys(Registry.transformsRegistry).forEach(getTransformAttributes); + traces: traces, + layout: getLayoutAttributes(), - getDefs(); + transforms: transforms, - return plotSchema; + frames: formatAttributes(frameAttributes), + animation: formatAttributes(animationAttributes) + }; }; -PlotSchema.crawl = Lib.crawl; +/** + * Crawl the attribute tree, recursively calling a callback function + * + * @param {object} attrs + * The node of the attribute tree (e.g. the root) from which recursion originates + * @param {Function} callback + * A callback function with the signature: + * @callback callback + * @param {object} attr an attribute + * @param {String} attrName name string + * @param {object[]} attrs all the attributes + * @param {Number} level the recursion level, 0 at the root + * @param {Number} [specifiedLevel] + * The level in the tree, in order to let the callback function detect descend or backtrack, + * typically unsupplied (implied 0), just used by the self-recursive call. + * The necessity arises because the tree traversal is not controlled by callback return values. + * The decision to not use callback return values for controlling tree pruning arose from + * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions + * precedes the callback call. + * + * @return {object} transformOut + * copy of transformIn that contains attribute defaults + */ +exports.crawl = function(attrs, callback, specifiedLevel) { + var level = specifiedLevel || 0; -PlotSchema.isValObject = Lib.isValObject; + Object.keys(attrs).forEach(function(attrName) { + var attr = attrs[attrName]; -function getTraceAttributes(type) { - var globalAttributes = Plots.attributes, - _module = getModule({type: type}), - meta = getMeta(type), - subplotRegistry = getSubplotRegistry(type); + if(UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - var attributes = {}, - layoutAttributes = {}; + callback(attr, attrName, attrs, level); - // make 'type' the first attribute in the object - attributes.type = null; + if(exports.isValObject(attr)) return; - // global attributes (same for all trace types) - extendDeep(attributes, globalAttributes); + if(Lib.isPlainObject(attr)) exports.crawl(attr, callback, level + 1); + }); +}; - // module attributes (+ nested + composed) - attributes = coupleAttrs( - _module.attributes, attributes, 'attributes', type - ); +/** Is object a value object (or a container object)? + * + * @param {object} obj + * @return {boolean} + * returns true for a valid value object and + * false for tree nodes in the attribute hierarchy + */ +exports.isValObject = function(obj) { + return obj && obj.valType !== undefined; +}; - // subplot attributes - if(subplotRegistry.attributes !== undefined) { - extendDeep(attributes, subplotRegistry.attributes); +/** + * Find all data array attributes in a given trace object - including + * `arrayOk` attributes. + * + * @param {object} trace + * full trace object that contains a reference to `_module.attributes` + * + * @return {array} arrayAttributes + * list of array attributes for the given trace + */ +exports.findArrayAttributes = function(trace) { + var arrayAttributes = [], + stack = []; + + function callback(attr, attrName, attrs, level) { + stack = stack.slice(0, level).concat([attrName]); + + var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; + if(!splittableAttr) return; + + var astr = toAttrString(stack); + var val = Lib.nestedProperty(trace, astr).get(); + if(!Array.isArray(val)) return; + + arrayAttributes.push(astr); } - // 'type' gets overwritten by globalAttributes; reset it here - attributes.type = type; + function toAttrString(stack) { + return stack.join('.'); + } - attributes = removeUnderscoreAttrs(attributes); - mergeValTypeAndRole(attributes); - plotSchema.traces[type] = extendFlat({}, - meta, - { attributes: attributes } - ); + exports.crawl(trace._module.attributes, callback); - // trace-specific layout attributes - if(_module.layoutAttributes !== undefined) { - layoutAttributes = coupleAttrs( - _module.layoutAttributes, layoutAttributes, 'layoutAttributes', type - ); + if(trace.transforms) { + var transforms = trace.transforms; + + for(var i = 0; i < transforms.length; i++) { + var transform = transforms[i]; - mergeValTypeAndRole(layoutAttributes); - plotSchema.traces[type].layoutAttributes = layoutAttributes; + stack = ['transforms[' + i + ']']; + exports.crawl(transform._module.attributes, callback, 1); + } } -} -function getLayoutAttributes() { - var globalLayoutAttributes = Plots.layoutAttributes, - layoutAttributes = {}; + // Look into the fullInput module attributes for array attributes + // to make sure that 'custom' array attributes are detected. + // + // At the moment, we need this block to make sure that + // ohlc and candlestick 'open', 'high', 'low', 'close' can be + // used with filter ang groupby transforms. + if(trace._fullInput) { + exports.crawl(trace._fullInput._module.attributes, callback); - // layout module attributes (+ nested + composed) - layoutAttributes = coupleAttrs( - globalLayoutAttributes, layoutAttributes, 'layoutAttributes', '*' - ); + arrayAttributes = Lib.filterUnique(arrayAttributes); + } - // FIXME polar layout attributes - layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); + return arrayAttributes; +}; - // add crawler.IS_SUBPLOT_OBJ attribute - layoutAttributes = handleSubplotObjs(layoutAttributes); +function getTraceAttributes(type) { + var _module, basePlotModule; - layoutAttributes = removeUnderscoreAttrs(layoutAttributes); - mergeValTypeAndRole(layoutAttributes); + if(type === 'area') { + _module = { attributes: polarAreaAttrs }; + basePlotModule = {}; + } + else { + _module = Registry.modules[type]._module, + basePlotModule = _module.basePlotModule; + } - // generate crawler.IS_LINKED_TO_ARRAY structure - handleLinkedToArray(layoutAttributes); + var attributes = {}; - plotSchema.layout = { layoutAttributes: layoutAttributes }; -} + // make 'type' the first attribute in the object + attributes.type = null; -function getTransformAttributes(name) { - var _module = Registry.transformsRegistry[name], - _schema = {}; + // base attributes (same for all trace types) + extendDeep(attributes, baseAttributes); - _schema = coupleAttrs(_schema, _module.attributes || {}, 'attributes', '*'); - _schema = removeUnderscoreAttrs(_schema); - mergeValTypeAndRole(_schema); - handleLinkedToArray(_schema); + // module attributes + extendDeep(attributes, _module.attributes); - plotSchema.transforms[name] = { attributes: _schema }; -} + // subplot attributes + if(basePlotModule.attributes) { + extendDeep(attributes, basePlotModule.attributes); + } -function getDefs() { - plotSchema.defs = { - valObjects: Lib.valObjects, - metaKeys: Lib.UNDERSCORE_ATTRS.concat(['description', 'role']) + // 'type' gets overwritten by baseAttributes; reset it here + attributes.type = type; + + var out = { + meta: _module.meta || {}, + attributes: formatAttributes(attributes), }; + + // trace-specific layout attributes + if(_module.layoutAttributes) { + var layoutAttributes = {}; + + extendDeep(layoutAttributes, _module.layoutAttributes); + out.layoutAttributes = formatAttributes(layoutAttributes); + } + + return out; } -function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) { - var nestedModule, nestedAttrs, nestedReference, - composedModule, composedAttrs; +function getLayoutAttributes() { + var layoutAttributes = {}; - Object.keys(attrsIn).forEach(function(k) { + // global layout attributes + extendDeep(layoutAttributes, baseLayoutAttributes); - if(k === NESTED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - nestedModule = getModule({_module: attrsIn[k][kk]}); - if(nestedModule === undefined) return; + // add base plot module layout attributes + Object.keys(Registry.subplotsRegistry).forEach(function(k) { + var _module = Registry.subplotsRegistry[k]; - nestedAttrs = nestedModule[whichAttrs]; - nestedReference = coupleAttrs( - nestedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - Lib.nestedProperty(attrsOut, kk) - .set(extendDeep({}, nestedReference)); - }); - return; + if(_module.name === 'cartesian') { + handleBasePlotModule(layoutAttributes, _module, 'xaxis'); + handleBasePlotModule(layoutAttributes, _module, 'yaxis'); } + else { + var astr = _module.attr === 'subplot' ? _module.name : _module.attr; - if(k === COMPOSED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - if(kk !== type) return; + handleBasePlotModule(layoutAttributes, _module, astr); + } + }); + + // polar layout attributes + layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); - composedModule = getModule({_module: attrsIn[k][kk]}); - if(composedModule === undefined) return; + // add registered components layout attribute + Object.keys(Registry.componentsRegistry).forEach(function(k) { + var _module = Registry.componentsRegistry[k]; - composedAttrs = composedModule[whichAttrs]; - composedAttrs = coupleAttrs( - composedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - extendDeepAll(attrsOut, composedAttrs); + if(Array.isArray(_module.layoutNodes)) { + _module.layoutNodes.forEach(function(v) { + handleRegisteredComponent(layoutAttributes, _module, v + _module.name); }); - return; } - - attrsOut[k] = Lib.isPlainObject(attrsIn[k]) ? - extendDeepAll({}, attrsIn[k]) : - attrsIn[k]; + else { + handleRegisteredComponent(layoutAttributes, _module, _module.name); + } }); - return attrsOut; + return { + layoutAttributes: formatAttributes(layoutAttributes) + }; +} + +function getTransformAttributes(type) { + var _module = Registry.transformsRegistry[type]; + + return { + attributes: formatAttributes(_module.attributes) + }; +} + +function formatAttributes(attrs) { + mergeValTypeAndRole(attrs); + formatArrayContainers(attrs); + + return attrs; } function mergeValTypeAndRole(attrs) { @@ -66444,7 +66409,7 @@ function mergeValTypeAndRole(attrs) { } function callback(attr, attrName, attrs) { - if(PlotSchema.isValObject(attr)) { + if(exports.isValObject(attr)) { if(attr.valType === 'data_array') { // all 'data_array' attrs have role 'data' attr.role = 'data'; @@ -66462,40 +66427,26 @@ function mergeValTypeAndRole(attrs) { } } - Lib.crawl(attrs, callback); + exports.crawl(attrs, callback); } -// helper methods +function formatArrayContainers(attrs) { -function getModule(arg) { - if('type' in arg) { - return (arg.type === 'area') ? // FIXME - { attributes: polarAreaAttrs } : - Registry.getModule({type: arg.type}); - } + function callback(attr, attrName, attrs) { + if(!attr) return; - var subplotsRegistry = Registry.subplotsRegistry, - componentsRegistry = Registry.componentsRegistry, - _module = arg._module; + var itemName = attr[IS_LINKED_TO_ARRAY]; - if(subplotsRegistry[_module]) return subplotsRegistry[_module]; - else if(componentsRegistry[_module]) return componentsRegistry[_module]; + if(!itemName) return; - // look it internal Plotly if all previous attempts fail - return Plotly[_module]; -} + delete attr[IS_LINKED_TO_ARRAY]; -function removeUnderscoreAttrs(attributes) { - Object.keys(attributes).forEach(function(k) { - if(k.charAt(0) === '_' && - Lib.UNDERSCORE_ATTRS.indexOf(k) === -1) delete attributes[k]; - }); - return attributes; -} + attrs[attrName] = { items: {} }; + attrs[attrName].items[itemName] = attr; + attrs[attrName].role = 'object'; + } -function getMeta(type) { - if(type === 'area') return {}; // FIXME - return Registry.modules[type].meta || {}; + exports.crawl(attrs, callback); } function assignPolarLayoutAttrs(layoutAttributes) { @@ -66506,68 +66457,25 @@ function assignPolarLayoutAttrs(layoutAttributes) { extendFlat(layoutAttributes, polarAxisAttrs.layout); - return layoutAttributes; // FIXME -} - -function getSubplotRegistry(traceType) { - if(traceType === 'area') return {}; // FIXME - - var subplotsRegistry = Registry.subplotsRegistry, - subplotType = Object.keys(subplotsRegistry).filter(function(subplotType) { - return Registry.traceIs({type: traceType}, subplotType); - })[0]; - - if(subplotType === undefined) return {}; - - return subplotsRegistry[subplotType]; -} - -function handleSubplotObjs(layoutAttributes) { - var subplotsRegistry = Registry.subplotsRegistry; - - Object.keys(layoutAttributes).forEach(function(k) { - Object.keys(subplotsRegistry).forEach(function(subplotType) { - var subplotRegistry = subplotsRegistry[subplotType], - isSubplotObj; - - if(!subplotRegistry.attrRegex) return; - - if(subplotType === 'cartesian' || subplotType === 'gl2d') { - isSubplotObj = ( - subplotRegistry.attrRegex.x.test(k) || - subplotRegistry.attrRegex.y.test(k) - ); - } - else { - isSubplotObj = subplotRegistry.attrRegex.test(k); - } - - if(isSubplotObj) layoutAttributes[k][Lib.IS_SUBPLOT_OBJ] = true; - }); - }); - return layoutAttributes; } -function handleLinkedToArray(layoutAttributes) { - - function callback(attr, attrName, attrs) { - if(attr[Lib.IS_LINKED_TO_ARRAY] !== true) return; +function handleBasePlotModule(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep({}, _module.layoutAttributes); - // TODO more robust logic - var itemName = attrName.substr(0, attrName.length - 1); + attrs[IS_SUBPLOT_OBJ] = true; + np.set(attrs); +} - delete attr[Lib.IS_LINKED_TO_ARRAY]; +function handleRegisteredComponent(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep(np.get() || {}, _module.layoutAttributes); - attrs[attrName] = { items: {} }; - attrs[attrName].items[itemName] = attr; - attrs[attrName].role = 'object'; - } - - Lib.crawl(layoutAttributes, callback); + np.set(attrs); } -},{"../lib":314,"../plotly":336,"../plots/plots":372,"../plots/polar/area_attributes":373,"../plots/polar/axis_attributes":374,"../registry":380}],331:[function(require,module,exports){ +},{"../lib":316,"../plots/animation_attributes":339,"../plots/attributes":341,"../plots/frame_attributes":364,"../plots/layout_attributes":365,"../plots/polar/area_attributes":375,"../plots/polar/axis_attributes":376,"../registry":382}],333:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66659,10 +66567,14 @@ function registerTransformModule(newModule) { } function registerComponentModule(newModule) { - Registry.componentsRegistry[newModule.name] = newModule; + if(typeof newModule.name !== 'string') { + throw new Error('Component module *name* must be a string.'); + } + + Registry.registerComponent(newModule); } -},{"../lib":314,"../registry":380}],332:[function(require,module,exports){ +},{"../lib":316,"../registry":382}],334:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -66688,7 +66600,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":314,"../plotly":336}],333:[function(require,module,exports){ +},{"../lib":316,"../plotly":338}],335:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67010,7 +66922,7 @@ exports.doModeBar = function(gd) { return Plots.previousPromises(gd); }; -},{"../components/color":223,"../components/drawing":247,"../components/modebar":270,"../components/titles":298,"../lib":314,"../plotly":336,"../plots/plots":372,"../registry":380}],334:[function(require,module,exports){ +},{"../components/color":223,"../components/drawing":246,"../components/modebar":269,"../components/titles":297,"../lib":316,"../plotly":338,"../plots/plots":374,"../registry":382}],336:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67065,7 +66977,7 @@ function toImage(gd, opts) { // first clone the GD so we can operate in a clean environment var clone = clonePlot(gd, {format: 'png', height: opts.height, width: opts.width}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -67120,7 +67032,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":314,"../plotly":336,"../snapshot/cloneplot":381,"../snapshot/helpers":384,"../snapshot/svgtoimg":386,"../snapshot/tosvg":388,"fast-isnumeric":12}],335:[function(require,module,exports){ +},{"../lib":316,"../plotly":338,"../snapshot/cloneplot":383,"../snapshot/helpers":386,"../snapshot/svgtoimg":388,"../snapshot/tosvg":390,"fast-isnumeric":12}],337:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67296,7 +67208,8 @@ function crawl(objIn, objOut, schema, list, base, path) { crawl(valIn, valOut, nestedSchema, list, base, p); } else if(nestedSchema.items && !isInfoArray && isArray(valIn)) { - var itemName = k.substr(0, k.length - 1), + var items = nestedSchema.items, + _nestedSchema = items[Object.keys(items)[0]], indexList = []; var j, _p; @@ -67304,8 +67217,7 @@ function crawl(objIn, objOut, schema, list, base, path) { // loop over valOut items while keeping track of their // corresponding input container index (given by _index) for(j = 0; j < valOut.length; j++) { - var _nestedSchema = nestedSchema.items[itemName], - _index = valOut[j]._index || j; + var _index = valOut[j]._index || j; _p = p.slice(); _p.push(_index); @@ -67490,7 +67402,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":314,"../plots/plots":372,"./plot_schema":330}],336:[function(require,module,exports){ +},{"../lib":316,"../plots/plots":374,"./plot_schema":332}],338:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67518,25 +67430,12 @@ exports.defaultConfig = require('./plot_api/plot_config'); exports.Plots = require('./plots/plots'); exports.Axes = require('./plots/cartesian/axes'); exports.Fx = require('./plots/cartesian/graph_interact'); - -// components -exports.Color = require('./components/color'); -exports.Drawing = require('./components/drawing'); -exports.Colorscale = require('./components/colorscale'); -exports.Colorbar = require('./components/colorbar'); -exports.ErrorBars = require('./components/errorbars'); -exports.Annotations = require('./components/annotations'); -exports.Shapes = require('./components/shapes'); -exports.Legend = require('./components/legend'); -exports.Images = require('./components/images'); -exports.UpdateMenus = require('./components/updatemenus'); -exports.Sliders = require('./components/sliders'); exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/annotations":221,"./components/color":223,"./components/colorbar":228,"./components/colorscale":238,"./components/drawing":247,"./components/errorbars":253,"./components/images":259,"./components/legend":267,"./components/modebar":270,"./components/shapes":291,"./components/sliders":297,"./components/updatemenus":303,"./plot_api/plot_api":328,"./plot_api/plot_config":329,"./plots/cartesian/axes":340,"./plots/cartesian/graph_interact":348,"./plots/plots":372}],337:[function(require,module,exports){ +},{"./components/modebar":269,"./plot_api/plot_api":330,"./plot_api/plot_config":331,"./plots/cartesian/axes":343,"./plots/cartesian/graph_interact":350,"./plots/plots":374}],339:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67638,7 +67537,76 @@ module.exports = { } }; -},{}],338:[function(require,module,exports){ +},{}],340:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var Lib = require('../lib'); + + +/** Convenience wrapper for making array container logic DRY and consistent + * + * @param {object} parentObjIn + * user input object where the container in question is linked + * (i.e. either a user trace object or the user layout object) + * + * @param {object} parentObjOut + * full object where the coerced container will be linked + * (i.e. either a full trace object or the full layout object) + * + * @param {object} opts + * options object: + * - name {string} + * name of the key linking the container in question + * - handleItemDefaults {function} + * defaults method to be called on each item in the array container in question + * + * Its arguments are: + * - itemIn {object} item in user layout + * - itemOut {object} item in full layout + * - parentObj {object} (as in closure) + * - opts {object} (as in closure) + * - itemOpts {object} + * - itemIsNotPlainObject {boolean} + * N.B. + * + * - opts is passed to handleItemDefaults so it can also store + * links to supplementary data (e.g. fullData for layout components) + * + */ +module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut, opts) { + var name = opts.name; + + var contIn = Array.isArray(parentObjIn[name]) ? parentObjIn[name] : [], + contOut = parentObjOut[name] = []; + + for(var i = 0; i < contIn.length; i++) { + var itemIn = contIn[i], + itemOut = {}, + itemOpts = {}; + + if(!Lib.isPlainObject(itemIn)) { + itemOpts.itemIsNotPlainObject = true; + itemIn = {}; + } + + opts.handleItemDefaults(itemIn, itemOut, parentObjOut, opts, itemOpts); + + itemOut._input = itemIn; + itemOut._index = i; + + contOut.push(itemOut); + } +}; + +},{"../lib":316}],341:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67721,7 +67689,7 @@ module.exports = { } }; -},{}],339:[function(require,module,exports){ +},{}],342:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67748,7 +67716,7 @@ module.exports = { } }; -},{}],340:[function(require,module,exports){ +},{}],343:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -67770,6 +67738,15 @@ var Titles = require('../../components/titles'); var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); +var constants = require('../../constants/numerical'); +var FP_SAFE = constants.FP_SAFE; +var ONEAVGYEAR = constants.ONEAVGYEAR; +var ONEAVGMONTH = constants.ONEAVGMONTH; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + var axes = module.exports = {}; @@ -67787,43 +67764,88 @@ axes.getFromId = axisIds.getFromId; axes.getFromTrace = axisIds.getFromTrace; -// find the list of possible axes to reference with an xref or yref attribute -// and coerce it to that list -axes.coerceRef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = axLetter + 'ref', +/* + * find the list of possible axes to reference with an xref or yref attribute + * and coerce it to that list + * + * attr: the attribute we're generating a reference for. Should end in 'x' or 'y' + * but can be prefixed, like 'ax' for annotation's arrow x + * dflt: the default to coerce to, or blank to use the first axis (falling back on + * extraOption if there is no axis) + * extraOption: aside from existing axes with this letter, what non-axis value is allowed? + * Only required if it's different from `dflt` + */ +axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption) { + var axLetter = attr.charAt(attr.length - 1), + axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), + refAttr = attr + 'ref', attrDef = {}; + if(!dflt) dflt = axlist[0] || extraOption; + if(!extraOption) extraOption = dflt; + // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(['paper']), - dflt: dflt || axlist[0] || 'paper' + values: axlist.concat(extraOption ? [extraOption] : []), + dflt: dflt }; // xref, yref return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; -// todo: duplicated per github PR 610. Should be consolidated with axes.coerceRef. -// find the list of possible axes to reference with an axref or ayref attribute -// and coerce it to that list -axes.coerceARef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = 'a' + axLetter + 'ref', - attrDef = {}; - - // data-ref annotations are not supported in gl2d yet +/* + * coerce position attributes (range-type) that can be either on axes or absolute + * (paper or pixel) referenced. The biggest complication here is that we don't know + * before looking at the axis whether the value must be a number or not (it may be + * a date string), so we can't use the regular valType='number' machinery + * + * axRef (string): the axis this position is referenced to, or: + * paper: fraction of the plot area + * pixel: pixels relative to some starting position + * attr (string): the attribute in containerOut we are coercing + * dflt (number): the default position, as a fraction or pixels. If the attribute + * is to be axis-referenced, this will be converted to an axis data value + * + * Also cleans the values, since the attribute definition itself has to say + * valType: 'any' to handle date axes. This allows us to accept: + * - for category axes: category names, and convert them here into serial numbers. + * Note that this will NOT work for axis range endpoints, because we don't know + * the category list yet (it's set by ax.makeCalcdata during calc) + * but it works for component (note, shape, images) positions. + * - for date axes: JS Dates or milliseconds, and convert to date strings + * - for other types: coerce them to numbers + */ +axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { + var pos, + newPos; + + if(axRef === 'paper' || axRef === 'pixel') { + pos = coerce(attr, dflt); + } + else { + var ax = axes.getFromId(gd, axRef); - attrDef[refAttr] = { - valType: 'enumerated', - values: axlist.concat(['pixel']), - dflt: dflt || 'pixel' || axlist[0] - }; + dflt = ax.fraction2r(dflt); + pos = coerce(attr, dflt); - // axref, ayref - return Lib.coerce(containerIn, containerOut, attrDef, refAttr); + if(ax.type === 'category') { + // if position is given as a category name, convert it to a number + if(typeof pos === 'string' && (ax._categories || []).length) { + newPos = ax._categories.indexOf(pos); + containerOut[attr] = (newPos !== -1) ? dflt : newPos; + return; + } + } + else if(ax.type === 'date') { + containerOut[attr] = Lib.cleanDate(pos); + return; + } + } + // finally make sure we have a number (unless date type already returned a string) + containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; }; // empty out types for all axes containing these traces @@ -67849,14 +67871,16 @@ axes.counterLetter = function(id) { // incorporate a new minimum difference and first tick into // forced +// note that _forceTick0 is linearized, so needs to be turned into +// a range value for setting tick0 axes.minDtick = function(ax, newDiff, newFirst, allow) { // doesn't make sense to do forced min dTick on log or category axes, // and the plot itself may decide to cancel (ie non-grouped bars) if(['log', 'category'].indexOf(ax.type) !== -1 || !allow) { ax._minDtick = 0; } - // null means there's nothing there yet - else if(ax._minDtick === null) { + // undefined means there's nothing there yet + else if(ax._minDtick === undefined) { ax._minDtick = newDiff; ax._forceTick0 = newFirst; } @@ -67881,6 +67905,19 @@ axes.minDtick = function(ax, newDiff, newFirst, allow) { } }; +// Find the autorange for this axis +// +// assumes ax._min and ax._max have already been set by calling axes.expand +// using calcdata from all traces. These are arrays of: +// {val: calcdata value, pad: extra pixels beyond this value} +// +// Returns an array of [min, max]. These are calcdata for log and category axes +// and data for linear and date axes. +// +// TODO: we want to change log to data as well, but it's hard to do this +// maintaining backward compatibility. category will always have to use calcdata +// though, because otherwise values between categories (or outside all categories) +// would be impossible. axes.getAutoRange = function(ax) { var newRange = []; @@ -67899,7 +67936,12 @@ axes.getAutoRange = function(ax) { var j, minpt, maxpt, minbest, maxbest, dp, dv, mbest = 0, - axReverse = (ax.range && ax.range[1] < ax.range[0]); + axReverse = false; + + if(ax.range) { + var rng = ax.range.map(ax.r2l); + axReverse = rng[1] < rng[0]; + } // one-time setting to easily reverse the axis // when plotting from code @@ -67988,11 +68030,9 @@ axes.getAutoRange = function(ax) { } // maintain reversal - if(axReverse) { - newRange.reverse(); - } + if(axReverse) newRange.reverse(); - return newRange; + return newRange.map(ax.l2r || Number); }; axes.doAutoRange = function(ax) { @@ -68055,7 +68095,6 @@ axes.saveRangeInitial = function(gd, overwrite) { // (unless one end is overridden by tozero) // tozero: (boolean) make sure to include zero if axis is linear, // and make it a tight bound if possible -var FP_SAFE = Number.MAX_VALUE / 2; axes.expand = function(ax, data, options) { if(!(ax.autorange || ax._needsExpand) || !data) return; if(!ax._min) ax._min = []; @@ -68194,10 +68233,24 @@ axes.autoBin = function(data, ax, nbins, is2d) { } // piggyback off autotick code to make "nice" bin sizes - var dummyax = { - type: ax.type === 'log' ? 'linear' : ax.type, - range: [datamin, datamax] - }; + var dummyax; + if(ax.type === 'log') { + dummyax = { + type: 'linear', + range: [datamin, datamax], + r2l: Number + }; + } + else { + dummyax = { + type: ax.type, + // conversion below would be ax.c2r but that's only different from l2r + // for log, and this is the only place (so far?) we would want c2r. + range: [datamin, datamax].map(ax.l2r), + r2l: ax.r2l + }; + } + axes.autoTicks(dummyax, size0); var binstart = axes.tickIncrement( axes.tickFirst(dummyax), dummyax.dtick, 'reverse'), @@ -68261,8 +68314,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { } return { - start: binstart, - end: binend, + start: ax.c2r(binstart), + end: ax.c2r(binend), size: dummyax.dtick }; }; @@ -68279,6 +68332,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { axes.calcTicks = function calcTicks(ax) { if(ax.tickmode === 'array') return arrayTicks(ax); + var rng = ax.range.map(ax.r2l); + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks, @@ -68293,18 +68348,17 @@ axes.calcTicks = function calcTicks(ax) { nt = Lib.constrain(ax._length / minPx, 4, 9) + 1; } } - axes.autoTicks(ax, Math.abs(ax.range[1] - ax.range[0]) / nt); + axes.autoTicks(ax, Math.abs(rng[1] - rng[0]) / nt); // check for a forced minimum dtick if(ax._minDtick > 0 && ax.dtick < ax._minDtick * 2) { ax.dtick = ax._minDtick; - ax.tick0 = ax._forceTick0; + ax.tick0 = ax.l2r(ax._forceTick0); } } // check for missing tick0 if(!ax.tick0) { - ax.tick0 = (ax.type === 'date') ? - new Date(2000, 0, 1).getTime() : 0; + ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; } // now figure out rounding of tick values @@ -68314,12 +68368,12 @@ axes.calcTicks = function calcTicks(ax) { ax._tmin = axes.tickFirst(ax); // check for reversed axis - var axrev = (ax.range[1] < ax.range[0]); + var axrev = (rng[1] < rng[0]); // return the full set of tick vals var vals = [], // add a tiny bit so we get ticks which may have rounded out - endtick = ax.range[1] * 1.0001 - ax.range[0] * 0.0001; + endtick = rng[1] * 1.0001 - rng[0] * 0.0001; if(ax.type === 'category') { endtick = (axrev) ? Math.max(-0.5, endtick) : Math.min(ax._categories.length - 0.5, endtick); @@ -68337,9 +68391,18 @@ axes.calcTicks = function calcTicks(ax) { // show the exponent only on the last one ax._tmax = vals[vals.length - 1]; + // for showing date suffixes: ax._prevSuffix holds what we showed most + // recently. Start with it cleared and mark that we're in calcTicks (ie + // calculating a whole string of these so we should care what the previous + // suffix was!) + ax._prevSuffix = ''; + ax._inCalcTicks = true; + var ticksOut = new Array(vals.length); for(var i = 0; i < vals.length; i++) ticksOut[i] = axes.tickText(ax, vals[i]); + ax._inCalcTicks = false; + return ticksOut; }; @@ -68347,15 +68410,15 @@ function arrayTicks(ax) { var vals = ax.tickvals, text = ax.ticktext, ticksOut = new Array(vals.length), - r0expanded = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, - r1expanded = ax.range[1] * 1.0001 - ax.range[0] * 0.0001, + rng = ax.range.map(ax.r2l), + r0expanded = rng[0] * 1.0001 - rng[1] * 0.0001, + r1expanded = rng[1] * 1.0001 - rng[0] * 0.0001, tickMin = Math.min(r0expanded, r1expanded), tickMax = Math.max(r0expanded, r1expanded), vali, i, j = 0; - // without a text array, just format the given values as any other ticks // except with more precision to the numbers if(!Array.isArray(text)) text = []; @@ -68395,7 +68458,7 @@ function roundDTick(roughDTick, base, roundingSet) { // outputs (into ax): // tick0: starting point for ticks (not necessarily on the graph) // usually 0 for numeric (=10^0=1 for log) or jan 1, 2000 for dates -// dtick: the actual, nice round tick spacing, somewhat larger than roughDTick +// dtick: the actual, nice round tick spacing, usually a little larger than roughDTick // if the ticks are spaced linearly (linear scale, categories, // log with only full powers, date ticks < month), // this will just be a number @@ -68408,36 +68471,35 @@ axes.autoTicks = function(ax, roughDTick) { var base; if(ax.type === 'date') { - ax.tick0 = new Date(2000, 0, 1).getTime(); + ax.tick0 = '2000-01-01'; + // the criteria below are all based on the rough spacing we calculate + // being > half of the final unit - so precalculate twice the rough val + var roughX2 = 2 * roughDTick; - if(roughDTick > 15778800000) { - // years if roughDTick > 6mo - roughDTick /= 31557600000; + if(roughX2 > ONEAVGYEAR) { + roughDTick /= ONEAVGYEAR; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'M' + (12 * roundDTick(roughDTick, base, roundBase10)); } - else if(roughDTick > 1209600000) { - // months if roughDTick > 2wk - roughDTick /= 2629800000; + else if(roughX2 > ONEAVGMONTH) { + roughDTick /= ONEAVGMONTH; ax.dtick = 'M' + roundDTick(roughDTick, 1, roundBase24); } - else if(roughDTick > 43200000) { - // days if roughDTick > 12h - ax.dtick = roundDTick(roughDTick, 86400000, roundDays); + else if(roughX2 > ONEDAY) { + ax.dtick = roundDTick(roughDTick, ONEDAY, roundDays); // get week ticks on sunday - ax.tick0 = new Date(2000, 0, 2).getTime(); + // this will also move the base tick off 2000-01-01 if dtick is + // 2 or 3 days... but that's a weird enough case that we'll ignore it. + ax.tick0 = '2000-01-02'; } - else if(roughDTick > 1800000) { - // hours if roughDTick > 30m - ax.dtick = roundDTick(roughDTick, 3600000, roundBase24); + else if(roughX2 > ONEHOUR) { + ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } - else if(roughDTick > 30000) { - // minutes if roughDTick > 30sec - ax.dtick = roundDTick(roughDTick, 60000, roundBase60); + else if(roughX2 > ONEMIN) { + ax.dtick = roundDTick(roughDTick, ONEMIN, roundBase60); } - else if(roughDTick > 500) { - // seconds if roughDTick > 0.5sec - ax.dtick = roundDTick(roughDTick, 1000, roundBase60); + else if(roughX2 > ONESEC) { + ax.dtick = roundDTick(roughDTick, ONESEC, roundBase60); } else { // milliseconds @@ -68447,16 +68509,19 @@ axes.autoTicks = function(ax, roughDTick) { } else if(ax.type === 'log') { ax.tick0 = 0; + var rng = ax.range.map(ax.r2l); - // only show powers of 10 - if(roughDTick > 0.7) ax.dtick = Math.ceil(roughDTick); - else if(Math.abs(ax.range[1] - ax.range[0]) < 1) { + if(roughDTick > 0.7) { + // only show powers of 10 + ax.dtick = Math.ceil(roughDTick); + } + else if(Math.abs(rng[1] - rng[0]) < 1) { // span is less than one power of 10 - var nt = 1.5 * Math.abs((ax.range[1] - ax.range[0]) / roughDTick); + var nt = 1.5 * Math.abs((rng[1] - rng[0]) / roughDTick); // ticks on a linear scale, labeled fully - roughDTick = Math.abs(Math.pow(10, ax.range[1]) - - Math.pow(10, ax.range[0])) / nt; + roughDTick = Math.abs(Math.pow(10, rng[1]) - + Math.pow(10, rng[0])) / nt; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'L' + roundDTick(roughDTick, base, roundBase10); } @@ -68495,41 +68560,59 @@ axes.autoTicks = function(ax, roughDTick) { // for date ticks, the last date part to show (y,m,d,H,M,S) // or an integer # digits past seconds function autoTickRound(ax) { - var dtick = ax.dtick, - maxend; + var dtick = ax.dtick; ax._tickexponent = 0; - if(!isNumeric(dtick) && typeof dtick !== 'string') dtick = 1; + if(!isNumeric(dtick) && typeof dtick !== 'string') { + dtick = 1; + } - if(ax.type === 'category') ax._tickround = null; - else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { - if(ax.type === 'date') { - if(dtick >= 86400000) ax._tickround = 'd'; - else if(dtick >= 3600000) ax._tickround = 'H'; - else if(dtick >= 60000) ax._tickround = 'M'; - else if(dtick >= 1000) ax._tickround = 'S'; - else ax._tickround = 3 - Math.round(Math.log(dtick / 2) / Math.LN10); - } + if(ax.type === 'category') { + ax._tickround = null; + } + if(ax.type === 'date') { + // If tick0 is unusual, give tickround a bit more information + // not necessarily *all* the information in tick0 though, if it's really odd + // minimal string length for tick0: 'd' is 10, 'M' is 16, 'S' is 19 + // take off a leading minus (year < 0 so length is consistent) + var tick0ms = Lib.dateTime2ms(ax.tick0), + tick0str = Lib.ms2DateTime(tick0ms).replace(/^-/, ''), + tick0len = tick0str.length; + + if(String(dtick).charAt(0) === 'M') { + // any tick0 more specific than a year: alway show the full date + if(tick0len > 10 || tick0str.substr(5) !== '01-01') ax._tickround = 'd'; + // show the month unless ticks are full multiples of a year + else ax._tickround = (+(dtick.substr(1)) % 12 === 0) ? 'y' : 'm'; + } + else if((dtick >= ONEDAY && tick0len <= 10) || (dtick >= ONEDAY * 15)) ax._tickround = 'd'; + else if((dtick >= ONEMIN && tick0len <= 16) || (dtick >= ONEHOUR)) ax._tickround = 'M'; + else if((dtick >= ONESEC && tick0len <= 19) || (dtick >= ONEMIN)) ax._tickround = 'S'; else { - if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); - // 2 digits past largest digit of dtick - ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); + // of any two adjacent ticks, at least one will have the maximum fractional digits + // of all possible ticks - so take the max. length of tick0 and the next one + var tick1len = Lib.ms2DateTime(tick0ms + dtick).replace(/^-/, '').length; + ax._tickround = Math.max(tick0len, tick1len) - 20; + } + } + else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { + // linear or log (except D1, D2) + var rng = ax.range.map(ax.r2d || Number); + if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); + // 2 digits past largest digit of dtick + ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); - if(ax.type === 'log') { - maxend = Math.pow(10, Math.max(ax.range[0], ax.range[1])); - } - else maxend = Math.max(Math.abs(ax.range[0]), Math.abs(ax.range[1])); + var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); - var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { - if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { - ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); - } - else ax._tickexponent = rangeexp; + var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); + if(Math.abs(rangeexp) > 3) { + if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { + ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } + else ax._tickexponent = rangeexp; } } - else if(dtick.charAt(0) === 'M') ax._tickround = (dtick.length === 2) ? 'm' : 'y'; + // D1 or D2 (log) else ax._tickround = null; } @@ -68574,13 +68657,16 @@ axes.tickIncrement = function(x, dtick, axrev) { // calculate the first tick on an axis axes.tickFirst = function(ax) { - var axrev = ax.range[1] < ax.range[0], + var r2l = ax.r2l || Number, + rng = ax.range.map(r2l), + axrev = rng[1] < rng[0], sRound = axrev ? Math.floor : Math.ceil, // add a tiny extra bit to make sure we get ticks // that may have been rounded out - r0 = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, + r0 = rng[0] * 1.0001 - rng[1] * 0.0001, dtick = ax.dtick, - tick0 = ax.tick0; + tick0 = r2l(ax.tick0); + if(isNumeric(dtick)) { var tmin = sRound((r0 - tick0) / dtick) * dtick + tick0; @@ -68630,7 +68716,7 @@ axes.tickFirst = function(ax) { var yearFormat = d3.time.format('%Y'), monthFormat = d3.time.format('%b %Y'), dayFormat = d3.time.format('%b %-d'), - hourFormat = d3.time.format('%b %-d %Hh'), + yearMonthDayFormat = d3.time.format('%b %-d, %Y'), minuteFormat = d3.time.format('%H:%M'), secondFormat = d3.time.format(':%S'); @@ -68666,7 +68752,8 @@ axes.tickText = function(ax, x, hover) { i; if(arrayMode && Array.isArray(ax.ticktext)) { - var minDiff = Math.abs(ax.range[1] - ax.range[0]) / 10000; + var rng = ax.range.map(ax.r2l), + minDiff = Math.abs(rng[1] - rng[0]) / 10000; for(i = 0; i < ax.ticktext.length; i++) { if(Math.abs(x - ax.d2l(ax.tickvals[i])) < minDiff) break; } @@ -68721,10 +68808,12 @@ function tickTextObj(ax, x, text) { function formatDate(ax, out, hover, extraPrecision) { var x = out.x, tr = ax._tickround, + trOriginal = tr, d = new Date(x), // suffix completes the full date info, to be included - // with only the first tick - suffix = '', + // with only the first tick or if any info before what's + // shown has changed + suffix, tt; if(hover && ax.hoverformat) { tt = modDateFormat(ax.hoverformat, x); @@ -68737,34 +68826,40 @@ function formatDate(ax, out, hover, extraPrecision) { else { if(extraPrecision) { if(isNumeric(tr)) tr += 2; - else tr = {y: 'm', m: 'd', d: 'H', H: 'M', M: 'S', S: 2}[tr]; + else tr = {y: 'm', m: 'd', d: 'M', M: 'S', S: 2}[tr]; } if(tr === 'y') tt = yearFormat(d); else if(tr === 'm') tt = monthFormat(d); else { - if(x === ax._tmin && !hover) { - suffix = '
' + yearFormat(d); - } + if(tr === 'd') { + if(!hover) suffix = '
' + yearFormat(d); - if(tr === 'd') tt = dayFormat(d); - else if(tr === 'H') tt = hourFormat(d); + tt = dayFormat(d); + } else { - if(x === ax._tmin && !hover) { - suffix = '
' + dayFormat(d) + ', ' + yearFormat(d); - } + if(!hover) suffix = '
' + yearMonthDayFormat(d); tt = minuteFormat(d); if(tr !== 'M') { tt += secondFormat(d); if(tr !== 'S') { - tt += numFormat(mod(x / 1000, 1), ax, 'none', hover) + tt += numFormat(d3.round(mod(x / 1000, 1), 4), ax, 'none', hover) .substr(1); } } + else if(trOriginal === 'd') { + // for hover on axes with day ticks, minuteFormat (which + // only includes %H:%M) isn't enough, you want the date too + tt = dayFormat(d) + ' ' + tt; + } } } } - out.text = tt + suffix; + if(suffix && (!ax._inCalcTicks || (suffix !== ax._prevSuffix))) { + tt += suffix; + ax._prevSuffix = suffix; + } + out.text = tt; } function formatLog(ax, out, hover, extraPrecision, hideexp) { @@ -68856,7 +68951,7 @@ function numFormat(v, ax, fmtoverride, hover) { (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent // from what we calculate - range: ax.showexponent === 'none' ? ax.range : [0, v || 1] + range: ax.showexponent === 'none' ? ax.range.map(ax.r2d) : [0, v || 1] }; autoTickRound(ah); tickRound = (Number(ah._tickround) || 0) + 4; @@ -69104,8 +69199,9 @@ axes.makeClipPaths = function(gd) { // doTicks: draw ticks, grids, and tick labels // axid: 'x', 'y', 'x2' etc, // blank to do all, -// 'redraw' to force full redraw, and reset ax._r -// (stored range for use by zoom/pan) +// 'redraw' to force full redraw, and reset: +// ax._r (stored range for use by zoom/pan) +// ax._rl (stored linearized range for use by zoom/pan) // or can pass in an axis object directly axes.doTicks = function(gd, axid, skipTitle) { var fullLayout = gd._fullLayout, @@ -69143,7 +69239,10 @@ axes.doTicks = function(gd, axid, skipTitle) { return function() { if(!ax._id) return; var axDone = axes.doTicks(gd, ax._id); - if(axid === 'redraw') ax._r = ax.range.slice(); + if(axid === 'redraw') { + ax._r = ax.range.slice(); + ax._rl = ax._r.map(ax.r2l); + } return axDone; }; })); @@ -69161,9 +69260,6 @@ axes.doTicks = function(gd, axid, skipTitle) { } } - // in case a val turns into string somehow - ax.range = [+ax.range[0], +ax.range[1]]; - // set scaling to pixels ax.setScale(); @@ -69552,7 +69648,8 @@ axes.doTicks = function(gd, axid, skipTitle) { break; } } - var showZl = (ax.range[0] * ax.range[1] <= 0) && ax.zeroline && + var rng = ax.range.map(ax.r2l), + showZl = (rng[0] * rng[1] <= 0) && ax.zeroline && (ax.type === 'linear' || ax.type === '-') && gridvals.length && (hasBarsOrFill || clipEnds({x: 0}) || !ax.showline); var zl = zlcontainer.selectAll('path.' + zcls) @@ -69776,7 +69873,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { // rather than built-in % which gives a negative value for negative v function mod(v, d) { return ((v % d) + d) % d; } -},{"../../components/color":223,"../../components/drawing":247,"../../components/titles":298,"../../lib":314,"../../lib/svg_text_utils":326,"../../registry":380,"./axis_ids":343,"./layout_attributes":350,"./layout_defaults":351,"./set_convert":355,"d3":8,"fast-isnumeric":12}],341:[function(require,module,exports){ +},{"../../components/color":223,"../../components/drawing":246,"../../components/titles":297,"../../constants/numerical":303,"../../lib":316,"../../lib/svg_text_utils":328,"../../registry":382,"./axis_ids":346,"./layout_attributes":352,"./layout_defaults":353,"./set_convert":357,"d3":8,"fast-isnumeric":12}],344:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -69791,7 +69888,7 @@ function mod(v, d) { return ((v % d) + d) % d; } var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); -var cleanDatum = require('./clean_datum'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function autoType(array) { if(moreDates(array)) return 'date'; @@ -69833,7 +69930,7 @@ function moreDates(a) { return (dcnt > ncnt * 2); } -// are the (x,y)-values in td.data mostly text? +// are the (x,y)-values in gd.data mostly text? // require twice as many categories as numbers function category(a) { // test at most 1000 points @@ -69843,15 +69940,15 @@ function category(a) { ai; for(var i = 0; i < a.length; i += inc) { - ai = cleanDatum(a[Math.round(i)]); - if(isNumeric(ai)) curvenums++; + ai = a[Math.round(i)]; + if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; else if(typeof ai === 'string' && ai !== '' && ai !== 'None') curvecats++; } return curvecats > curvenums * 2; } -},{"../../lib":314,"./clean_datum":345,"fast-isnumeric":12}],342:[function(require,module,exports){ +},{"../../constants/numerical":303,"../../lib":316,"fast-isnumeric":12}],345:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -69944,17 +70041,15 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var validRange = ( (containerIn.range || []).length === 2 && - isNumeric(containerIn.range[0]) && - isNumeric(containerIn.range[1]) + isNumeric(containerOut.r2l(containerIn.range[0])) && + isNumeric(containerOut.r2l(containerIn.range[1])) ); var autoRange = coerce('autorange', !validRange); if(autoRange) coerce('rangemode'); - var range = coerce('range', [-1, letter === 'x' ? 6 : 4]); - if(range[0] === range[1]) { - containerOut.range = [range[0] - 1, range[0] + 1]; - } - Lib.noneOrAll(containerIn.range, containerOut.range, [0, 1]); + + coerce('range'); + containerOut.cleanRange(); coerce('fixedrange'); @@ -70076,7 +70171,7 @@ function getFirstNonEmptyTrace(data, id, axLetter) { } } -},{"../../components/color/attributes":222,"../../lib":314,"../../registry":380,"./axis_autotype":341,"./axis_ids":343,"./category_order_defaults":344,"./layout_attributes":350,"./ordered_categories":352,"./set_convert":355,"./tick_label_defaults":356,"./tick_mark_defaults":357,"./tick_value_defaults":358,"fast-isnumeric":12,"tinycolor2":197}],343:[function(require,module,exports){ +},{"../../components/color/attributes":222,"../../lib":316,"../../registry":382,"./axis_autotype":344,"./axis_ids":346,"./category_order_defaults":347,"./layout_attributes":352,"./ordered_categories":354,"./set_convert":357,"./tick_label_defaults":358,"./tick_mark_defaults":359,"./tick_value_defaults":360,"fast-isnumeric":12,"tinycolor2":197}],346:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70198,7 +70293,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":314,"../../registry":380,"../plots":372,"./constants":346}],344:[function(require,module,exports){ +},{"../../lib":316,"../../registry":382,"../plots":374,"./constants":348}],347:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70232,46 +70327,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],345:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = require('fast-isnumeric'); - -var Lib = require('../../lib'); - - -/** - * cleanDatum: removes characters - * same replace criteria used in the grid.js:scrapeCol - * but also handling dates, numbers, and NaN, null, Infinity etc - */ -module.exports = function cleanDatum(c) { - try { - if(typeof c === 'object' && c !== null && c.getTime) { - return Lib.ms2DateTime(c); - } - if(typeof c !== 'string' && !isNumeric(c)) { - return ''; - } - c = c.toString().replace(/['"%,$# ]/g, ''); - } - catch(e) { - Lib.error(e, c); - } - - return c; -}; - -},{"../../lib":314,"fast-isnumeric":12}],346:[function(require,module,exports){ +},{}],348:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70295,14 +70351,6 @@ module.exports = { y: /^yaxis([2-9]|[1-9][0-9]+)?$/ }, - /** - * standardize all missing data in calcdata to use undefined - * never null or NaN. - * that way we can use !==undefined, or !== BADNUM, - * to test for real data - */ - BADNUM: undefined, - // axis match regular expression xAxisMatch: /^xaxis[0-9]*$/, yAxisMatch: /^yaxis[0-9]*$/, @@ -70346,10 +70394,15 @@ module.exports = { BENDPX: 1.5, // delay before a redraw (relayout) after smooth panning and zooming - REDRAWDELAY: 50 + REDRAWDELAY: 50, + + // last resort axis ranges for x, y, and date axes if we have no data + DFLTRANGEX: [-1, 6], + DFLTRANGEY: [-1, 4], + DFLTRANGEDATE: ['2000-01-01', '2001-01-01'], }; -},{}],347:[function(require,module,exports){ +},{}],349:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -70450,11 +70503,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { return dragger; } - function forceNumbers(axRange) { - axRange[0] = Number(axRange[0]); - axRange[1] = Number(axRange[1]); - } - var dragOptions = { element: dragger, gd: gd, @@ -70565,7 +70613,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { .attr('d', 'M0,0Z'); clearSelect(); - for(var i = 0; i < allaxes.length; i++) forceNumbers(allaxes[i].range); } function clearSelect() { @@ -70656,16 +70703,16 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomAxRanges(axList, r0Fraction, r1Fraction) { var i, axi, - axRange; + axRangeLinear; for(i = 0; i < axList.length; i++) { axi = axList[i]; if(axi.fixedrange) continue; - axRange = axi.range; + axRangeLinear = axi.range.map(axi.r2l); axi.range = [ - axRange[0] + (axRange[1] - axRange[0]) * r0Fraction, - axRange[0] + (axRange[1] - axRange[0]) * r1Fraction + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r0Fraction), + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r1Fraction) ]; } } @@ -70719,7 +70766,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { verticalAlign: vAlign }) .on('edit', function(text) { - var v = ax.type === 'category' ? ax.c2l(text) : ax.d2l(text); + var v = ax.d2r(text); if(v !== undefined) { Plotly.relayout(gd, attrStr, v); } @@ -70779,10 +70826,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomWheelOneAxis(ax, centerFraction, zoom) { if(ax.fixedrange) return; - forceNumbers(ax.range); - var axRange = ax.range, + + var axRange = ax.range.map(ax.r2l), v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; - ax.range = [v0 + (axRange[0] - v0) * zoom, v0 + (axRange[1] - v0) * zoom]; + function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); } + ax.range = axRange.map(doZoom); } if(ew) { @@ -70830,7 +70878,10 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { for(var i = 0; i < axList.length; i++) { var axi = axList[i]; if(!axi.fixedrange) { - axi.range = [axi._r[0] - pix / axi._m, axi._r[1] - pix / axi._m]; + axi.range = [ + axi.l2r(axi._rl[0] - pix / axi._m), + axi.l2r(axi._rl[1] - pix / axi._m) + ]; } } } @@ -70853,23 +70904,29 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { 1 / (1 / Math.max(d, -0.3) + 3.222)); } - // dz: set a new value for one end (0 or 1) of an axis array ax, + // dz: set a new value for one end (0 or 1) of an axis array axArray, // and return a pixel shift for that end for the viewbox // based on pixel drag distance d // TODO: this makes (generally non-fatal) errors when you get // near floating point limits - function dz(ax, end, d) { + function dz(axArray, end, d) { var otherEnd = 1 - end, - movedi = 0; - for(var i = 0; i < ax.length; i++) { - var axi = ax[i]; + movedAx, + newLinearizedEnd; + for(var i = 0; i < axArray.length; i++) { + var axi = axArray[i]; if(axi.fixedrange) continue; - movedi = i; - axi.range[end] = axi._r[otherEnd] + - (axi._r[end] - axi._r[otherEnd]) / dZoom(d / axi._length); + movedAx = axi; + newLinearizedEnd = axi._rl[otherEnd] + + (axi._rl[end] - axi._rl[otherEnd]) / dZoom(d / axi._length); + var newEnd = axi.l2r(newLinearizedEnd); + + // if l2r comes back false or undefined, it means we've dragged off + // the end of valid ranges - so stop. + if(newEnd !== false && newEnd !== undefined) axi.range[end] = newEnd; } - return ax[movedi]._length * (ax[movedi]._r[end] - ax[movedi].range[end]) / - (ax[movedi]._r[end] - ax[movedi]._r[otherEnd]); + return movedAx._length * (movedAx._rl[end] - newLinearizedEnd) / + (movedAx._rl[end] - movedAx._rl[otherEnd]); } if(xActive === 'w') dx = dz(xa, 0, dx); @@ -71071,8 +71128,10 @@ function getEndText(ax, end) { diff = Math.abs(initialVal - ax.range[1 - end]), dig; + // TODO: this should basically be ax.r2d but we're doing extra + // rounding here... can we clean up at all? if(ax.type === 'date') { - return Lib.ms2DateTime(initialVal, diff); + return initialVal; } else if(ax.type === 'log') { dig = Math.ceil(Math.max(0, -Math.log(diff) / Math.LN10)) + 3; @@ -71106,7 +71165,7 @@ function isSelectOrLasso(dragmode) { return modes.indexOf(dragmode) !== -1; } -},{"../../components/color":223,"../../components/dragelement":245,"../../components/drawing":247,"../../lib":314,"../../lib/setcursor":324,"../../lib/svg_text_utils":326,"../../plotly":336,"../../registry":380,"./axes":340,"./constants":346,"./select":354,"d3":8,"tinycolor2":197}],348:[function(require,module,exports){ +},{"../../components/color":223,"../../components/dragelement":244,"../../components/drawing":246,"../../lib":316,"../../lib/setcursor":326,"../../lib/svg_text_utils":328,"../../plotly":338,"../../registry":382,"./axes":343,"./constants":348,"./select":356,"d3":8,"tinycolor2":197}],350:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -71132,6 +71191,7 @@ var dragElement = require('../../components/dragelement'); var Axes = require('./axes'); var constants = require('./constants'); var dragBox = require('./dragbox'); +var layoutAttributes = require('../layout_attributes'); var fx = module.exports = {}; @@ -71141,24 +71201,12 @@ var fx = module.exports = {}; fx.unhover = dragElement.unhover; fx.layoutAttributes = { - dragmode: { - valType: 'enumerated', - - values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], - dflt: 'zoom', - - }, - hovermode: { - valType: 'enumerated', - - values: ['x', 'y', 'closest', false], - - } }; fx.supplyLayoutDefaults = function(layoutIn, layoutOut, fullData) { + function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, fx.layoutAttributes, attr, dflt); + return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } coerce('dragmode'); @@ -72461,7 +72509,7 @@ fx.inbox = function(v0, v1) { return Infinity; }; -},{"../../components/color":223,"../../components/dragelement":245,"../../components/drawing":247,"../../lib":314,"../../lib/events":310,"../../lib/svg_text_utils":326,"./axes":340,"./constants":346,"./dragbox":347,"d3":8,"fast-isnumeric":12,"tinycolor2":197}],349:[function(require,module,exports){ +},{"../../components/color":223,"../../components/dragelement":244,"../../components/drawing":246,"../../lib":316,"../../lib/events":311,"../../lib/svg_text_utils":328,"../layout_attributes":365,"./axes":343,"./constants":348,"./dragbox":349,"d3":8,"fast-isnumeric":12,"tinycolor2":197}],351:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72491,6 +72539,8 @@ exports.attrRegex = constants.attrRegex; exports.attributes = require('./attributes'); +exports.layoutAttributes = require('./layout_attributes'); + exports.transitionAxes = require('./transition_axes'); exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) { @@ -72833,7 +72883,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":314,"../plots":372,"./attributes":339,"./axes":340,"./constants":346,"./transition_axes":359,"d3":8}],350:[function(require,module,exports){ +},{"../../lib":316,"../plots":374,"./attributes":342,"./axes":343,"./constants":348,"./layout_attributes":352,"./transition_axes":361,"d3":8}],352:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -72869,8 +72919,8 @@ module.exports = { type: { valType: 'enumerated', // '-' means we haven't yet run autotype or couldn't find any data - // it gets turned into linear in td._fullLayout but not copied back - // to td.data like the others are. + // it gets turned into linear in gd._fullLayout but not copied back + // to gd.data like the others are. values: ['-', 'linear', 'log', 'date', 'category'], dflt: '-', @@ -72894,8 +72944,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -72921,14 +72971,12 @@ module.exports = { }, tick0: { - valType: 'number', - dflt: 0, + valType: 'any', }, dtick: { valType: 'any', - dflt: 1, }, @@ -73169,11 +73217,6 @@ module.exports = { }, - _nestedModules: { - 'rangeslider': 'rangeslider', - 'rangeselector': 'rangeselector', - }, - _deprecated: { autotick: { valType: 'boolean', @@ -73183,7 +73226,7 @@ module.exports = { } }; -},{"../../components/color/attributes":222,"../../lib/extend":311,"../font_attributes":361,"./constants":346}],351:[function(require,module,exports){ +},{"../../components/color/attributes":222,"../../lib/extend":312,"../font_attributes":363,"./constants":348}],353:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73357,7 +73400,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { }); }; -},{"../../components/color":223,"../../lib":314,"../../registry":380,"../layout_attributes":363,"./axis_defaults":342,"./axis_ids":343,"./constants":346,"./layout_attributes":350,"./position_defaults":353}],352:[function(require,module,exports){ +},{"../../components/color":223,"../../lib":316,"../../registry":382,"../layout_attributes":365,"./axis_defaults":345,"./axis_ids":346,"./constants":348,"./layout_attributes":352,"./position_defaults":355}],354:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73436,7 +73479,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":8}],353:[function(require,module,exports){ +},{"d3":8}],355:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73501,7 +73544,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":314,"fast-isnumeric":12}],354:[function(require,module,exports){ +},{"../../lib":316,"fast-isnumeric":12}],356:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73701,7 +73744,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":223,"../../lib/polygon":321,"./axes":340,"./constants":346}],355:[function(require,module,exports){ +},{"../../components/color":223,"../../lib/polygon":323,"./axes":343,"./constants":348}],357:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -73717,27 +73760,38 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); +var numConstants = require('../../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var constants = require('./constants'); -var cleanDatum = require('./clean_datum'); var axisIds = require('./axis_ids'); /** - * Define the conversion functions for an axis data is used in 4 ways: + * Define the conversion functions for an axis data is used in 5 ways: * * d: data, in whatever form it's provided * c: calcdata: turned into numbers, but not linearized - * l: linearized - same as c except for log axes (and other - * mappings later?) this is used by ranges, and when we - * need to know if it's *possible* to show some data on - * this axis, without caring about the current range + * l: linearized - same as c except for log axes (and other nonlinear + * mappings later?) this is used when we need to know if it's + * *possible* to show some data on this axis, without caring about + * the current range * p: pixel value - mapped to the screen with current size and zoom - * - * Creates/updates these conversion functions + * r: ranges, tick0, and annotation positions match one of the above + * but are handled differently for different types: + * - linear and date: data format (d) + * - category: calcdata format (c), and will stay that way because + * the data format has no continuous mapping + * - log: linearized (l) format + * TODO: in v2.0 we plan to change it to data format. At that point + * shapes will work the same way as ranges, tick0, and annotations + * so they can use this conversion too. + * + * Creates/updates these conversion functions, as well as cleaner functions: + * ax.d2d and ax.clean2r * also clears the autorange bounds ._min and ._max - * and the autotick constraints ._minDtick, ._forceTick0, - * and looks for date ranges that aren't yet in numeric format + * and the autotick constraints ._minDtick, ._forceTick0 */ module.exports = function setConvert(ax) { @@ -73757,20 +73811,119 @@ module.exports = function setConvert(ax) { return 0.5 * (r0 + r1 - 3 * clipMult * Math.abs(r0 - r1)); } - else return constants.BADNUM; + else return BADNUM; + } + + function fromLog(v) { + return Math.pow(10, v); + } + + function num(v) { + if(!isNumeric(v)) return BADNUM; + v = Number(v); + if(v < -FP_SAFE || v > FP_SAFE) return BADNUM; + return isNumeric(v) ? Number(v) : BADNUM; } - function fromLog(v) { return Math.pow(10, v); } - function num(v) { return isNumeric(v) ? Number(v) : constants.BADNUM; } ax.c2l = (ax.type === 'log') ? toLog : num; ax.l2c = (ax.type === 'log') ? fromLog : num; ax.l2d = function(v) { return ax.c2d(ax.l2c(v)); }; ax.p2d = function(v) { return ax.l2d(ax.p2l(v)); }; + /* + * fn to make sure range is a couplet of valid & distinct values + * keep numbers away from the limits of floating point numbers, + * and dates away from the ends of our date system (+/- 9999 years) + * + * optional param rangeAttr: operate on a different attribute, like + * ax._r, rather than ax.range + */ + ax.cleanRange = function(rangeAttr) { + if(!rangeAttr) rangeAttr = 'range'; + var range = ax[rangeAttr], + axLetter = (ax._id || 'x').charAt(0), + i, dflt; + + if(ax.type === 'date') dflt = constants.DFLTRANGEDATE; + else if(axLetter === 'y') dflt = constants.DFLTRANGEY; + else dflt = constants.DFLTRANGEX; + + // make sure we don't later mutate the defaults + dflt = dflt.slice(); + + if(!range || range.length !== 2) { + ax[rangeAttr] = dflt; + return; + } + + if(ax.type === 'date') { + // check if milliseconds or js date objects are provided for range + // and convert to date strings + range[0] = Lib.cleanDate(range[0]); + range[1] = Lib.cleanDate(range[1]); + } + + for(i = 0; i < 2; i++) { + if(ax.type === 'date') { + if(!Lib.isDateTime(range[i])) { + ax[rangeAttr] = dflt; + break; + } + + if(range[i] < Lib.MIN_MS) range[i] = Lib.MIN_MS; + if(range[i] > Lib.MAX_MS) range[i] = Lib.MAX_MS; + + if(ax.r2l(range[0]) === ax.r2l(range[1])) { + // split by +/- 1 second + var linCenter = Lib.constrain(ax.r2l(range[0]), + Lib.MIN_MS + 1000, Lib.MAX_MS - 1000); + range[0] = ax.l2r(linCenter - 1000); + range[1] = ax.l2r(linCenter + 1000); + break; + } + } + else { + if(!isNumeric(range[i])) { + if(isNumeric(range[1 - i])) { + range[i] = range[1 - i] * (i ? 10 : 0.1); + } + else { + ax[rangeAttr] = dflt; + break; + } + } + + if(range[i] < -FP_SAFE) range[i] = -FP_SAFE; + else if(range[i] > FP_SAFE) range[i] = FP_SAFE; + + if(range[0] === range[1]) { + // somewhat arbitrary: split by 1 or 1ppm, whichever is bigger + var inc = Math.max(1, Math.abs(range[0] * 1e-6)); + range[0] -= inc; + range[1] += inc; + } + } + } + }; + + // find the range value at the specified (linear) fraction of the axis + ax.fraction2r = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return ax.l2r(rl0 + v * (rl1 - rl0)); + }; + + // find the fraction of the range at the specified range value + ax.r2fraction = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return (ax.r2l(v) - rl0) / (rl1 - rl0); + }; + // set scaling to pixels ax.setScale = function(usePrivateRange) { var gs = ax._gd._fullLayout._size, - i; + axLetter = ax._id.charAt(0); // TODO cleaner way to handle this case if(!ax._categories) ax._categories = []; @@ -73786,40 +73939,23 @@ module.exports = function setConvert(ax) { // issue if we transform the drawn layer *and* use the new axis range to // draw the data. This allows us to construct setConvert using the pre- // interaction values of the range: - var range = (usePrivateRange && ax._r) ? ax._r : ax.range; - - // make sure we have a range (linearized data values) - // and that it stays away from the limits of javascript numbers - if(!range || range.length !== 2 || range[0] === range[1]) { - range = [-1, 1]; - } - for(i = 0; i < 2; i++) { - if(!isNumeric(range[i])) { - range[i] = isNumeric(range[1 - i]) ? - (range[1 - i] * (i ? 10 : 0.1)) : - (i ? 1 : -1); - } - - if(range[i] < -(Number.MAX_VALUE / 2)) { - range[i] = -(Number.MAX_VALUE / 2); - } - else if(range[i] > Number.MAX_VALUE / 2) { - range[i] = Number.MAX_VALUE / 2; - } + var rangeAttr = (usePrivateRange && ax._r) ? '_r' : 'range'; + ax.cleanRange(rangeAttr); - } + var rl0 = ax.r2l(ax[rangeAttr][0]), + rl1 = ax.r2l(ax[rangeAttr][1]); - if(ax._id.charAt(0) === 'y') { + if(axLetter === 'y') { ax._offset = gs.t + (1 - ax.domain[1]) * gs.h; ax._length = gs.h * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[0] - range[1]); - ax._b = -ax._m * range[1]; + ax._m = ax._length / (rl0 - rl1); + ax._b = -ax._m * rl1; } else { ax._offset = gs.l + ax.domain[0] * gs.w; ax._length = gs.w * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[1] - range[0]); - ax._b = -ax._m * range[0]; + ax._m = ax._length / (rl1 - rl0); + ax._b = -ax._m * rl0; } if(!isFinite(ax._m) || !isFinite(ax._b)) { @@ -73832,7 +73968,7 @@ module.exports = function setConvert(ax) { }; ax.l2p = function(v) { - if(!isNumeric(v)) return constants.BADNUM; + if(!isNumeric(v)) return BADNUM; // include 2 fractional digits on pixel, for PDF zooming etc return d3.round(ax._b + ax._m * v, 2); @@ -73843,42 +73979,62 @@ module.exports = function setConvert(ax) { ax.c2p = function(v, clip) { return ax.l2p(ax.c2l(v, clip)); }; ax.p2c = function(px) { return ax.l2c(ax.p2l(px)); }; + // clip doesn't do anything here yet, but in v2.0 when log axes get + // refactored it will... so including it now so we don't forget. + ax.r2p = function(v, clip) { return ax.l2p(ax.r2l(v, clip)); }; + ax.p2r = function(px) { return ax.l2r(ax.p2l(px)); }; + + ax.r2c = function(v) { return ax.l2c(ax.r2l(v)); }; + ax.c2r = function(v) { return ax.l2r(ax.c2l(v)); }; + if(['linear', 'log', '-'].indexOf(ax.type) !== -1) { ax.c2d = num; - ax.d2c = function(v) { - v = cleanDatum(v); - return isNumeric(v) ? Number(v) : constants.BADNUM; - }; - ax.d2l = function(v, clip) { - if(ax.type === 'log') return ax.c2l(ax.d2c(v), clip); - else return ax.d2c(v); - }; + ax.d2c = Lib.cleanNumber; + if(ax.type === 'log') { + ax.d2l = function(v, clip) { + return ax.c2l(ax.d2c(v), clip); + }; + ax.d2r = ax.d2l; + ax.r2d = ax.l2d; + } + else { + ax.d2l = Lib.cleanNumber; + ax.d2r = Lib.cleanNumber; + ax.r2d = num; + } + ax.r2l = num; + ax.l2r = num; } else if(ax.type === 'date') { - ax.c2d = function(v) { - return isNumeric(v) ? Lib.ms2DateTime(v) : constants.BADNUM; - }; + ax.c2d = Lib.ms2DateTime; ax.d2c = function(v) { - return (isNumeric(v)) ? Number(v) : Lib.dateTime2ms(v); + // NOTE: Changed this behavior: previously we took any numeric value + // to be a ms, even if it was a string that could be a bare year. + // Now we convert it as a date if at all possible, and only try + // as ms if that fails. + var ms = Lib.dateTime2ms(v); + if(ms === BADNUM) { + if(isNumeric(v)) ms = Number(v); + else return BADNUM; + } + return Lib.constrain(ms, Lib.MIN_MS, Lib.MAX_MS); }; ax.d2l = ax.d2c; - - // check if date strings or js date objects are provided for range - // and convert to ms - if(ax.range && ax.range.length > 1) { - try { - var ar1 = ax.range.map(Lib.dateTime2ms); - if(!isNumeric(ax.range[0]) && isNumeric(ar1[0])) { - ax.range[0] = ar1[0]; - } - if(!isNumeric(ax.range[1]) && isNumeric(ar1[1])) { - ax.range[1] = ar1[1]; - } - } - catch(e) { Lib.error(e, ax.range); } - } + ax.r2l = ax.d2c; + ax.l2r = ax.c2d; + ax.d2r = Lib.identity; + ax.r2d = Lib.identity; + ax.cleanr = function(v) { + /* + * If v is already a date string this is a noop, but running it + * through d2c and back validates the value: + * normalizes Date objects, milliseconds, and out-of-bounds dates + * so we always end up with either a clean date string or BADNUM + */ + return ax.c2d(ax.d2c(v)); + }; } else if(ax.type === 'category') { @@ -73901,38 +74057,42 @@ module.exports = function setConvert(ax) { } var c = ax._categories.indexOf(v); - return c === -1 ? constants.BADNUM : c; + return c === -1 ? BADNUM : c; }; ax.d2l = ax.d2c; + ax.r2l = num; + ax.l2r = num; + ax.d2r = ax.d2c; + ax.r2d = ax.c2d; } // makeCalcdata: takes an x or y array and converts it // to a position on the axis object "ax" // inputs: - // tdc - a data object from td.data - // axletter - a string, either 'x' or 'y', for which item + // trace - a data object from gd.data + // axLetter - a string, either 'x' or 'y', for which item // to convert (TODO: is this now always the same as // the first letter of ax._id?) // in case the expected data isn't there, make a list of // integers based on the opposite data - ax.makeCalcdata = function(tdc, axletter) { + ax.makeCalcdata = function(trace, axLetter) { var arrayIn, arrayOut, i; - if(axletter in tdc) { - arrayIn = tdc[axletter]; + if(axLetter in trace) { + arrayIn = trace[axLetter]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = ax.d2c(arrayIn[i]); } else { - var v0 = ((axletter + '0') in tdc) ? - ax.d2c(tdc[axletter + '0']) : 0, - dv = (tdc['d' + axletter]) ? - Number(tdc['d' + axletter]) : 1; + var v0 = ((axLetter + '0') in trace) ? + ax.d2c(trace[axLetter + '0']) : 0, + dv = (trace['d' + axLetter]) ? + Number(trace['d' + axLetter]) : 1; // the opposing data, for size if we have x and dx etc - arrayIn = tdc[{x: 'y', y: 'x'}[axletter]]; + arrayIn = trace[{x: 'y', y: 'x'}[axLetter]]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = v0 + i * dv; @@ -73947,11 +74107,11 @@ module.exports = function setConvert(ax) { ax._max = []; // and for bar charts and box plots: reset forced minimum tick spacing - ax._minDtick = null; - ax._forceTick0 = null; + delete ax._minDtick; + delete ax._forceTick0; }; -},{"../../lib":314,"./axis_ids":343,"./clean_datum":345,"./constants":346,"d3":8,"fast-isnumeric":12}],356:[function(require,module,exports){ +},{"../../constants/numerical":303,"../../lib":316,"./axis_ids":346,"./constants":348,"d3":8,"fast-isnumeric":12}],358:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74021,8 +74181,8 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe */ function getShowAttrDflt(containerIn) { var showAttrsAll = ['showexponent', - 'showtickprefix', - 'showticksuffix'], + 'showtickprefix', + 'showticksuffix'], showAttrs = showAttrsAll.filter(function(a) { return containerIn[a] !== undefined; }), @@ -74035,7 +74195,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":314}],357:[function(require,module,exports){ +},{"../../lib":316}],359:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74068,7 +74228,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":314,"./layout_attributes":350}],358:[function(require,module,exports){ +},{"../../lib":316,"./layout_attributes":352}],360:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74081,6 +74241,8 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, 'use strict'; var isNumeric = require('fast-isnumeric'); +var Lib = require('../../lib'); +var ONEDAY = require('../../constants/numerical').ONEDAY; module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType) { @@ -74092,15 +74254,56 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } if(Array.isArray(containerIn.tickvals)) tickmodeDefault = 'array'; - else if(containerIn.dtick && isNumeric(containerIn.dtick)) { + else if(containerIn.dtick) { tickmodeDefault = 'linear'; } var tickmode = coerce('tickmode', tickmodeDefault); if(tickmode === 'auto') coerce('nticks'); else if(tickmode === 'linear') { - coerce('tick0'); - coerce('dtick'); + // dtick is usually a positive number, but there are some + // special strings available for log or date axes + // default is 1 day for dates, otherwise 1 + var dtickDflt = (axType === 'date') ? ONEDAY : 1; + var dtick = coerce('dtick', dtickDflt); + if(isNumeric(dtick)) { + containerOut.dtick = (dtick > 0) ? Number(dtick) : dtickDflt; + } + else if(typeof dtick !== 'string') { + containerOut.dtick = dtickDflt; + } + else { + // date and log special cases are all one character plus a number + var prefix = dtick.charAt(0), + dtickNum = dtick.substr(1); + + dtickNum = isNumeric(dtickNum) ? Number(dtickNum) : 0; + if((dtickNum <= 0) || !( + // "M" gives ticks every (integer) n months + (axType === 'date' && prefix === 'M' && dtickNum === Math.round(dtickNum)) || + // "L" gives ticks linearly spaced in data (not in position) every (float) f + (axType === 'log' && prefix === 'L') || + // "D1" gives powers of 10 with all small digits between, "D2" gives only 2 and 5 + (axType === 'log' && prefix === 'D' && (dtickNum === 1 || dtickNum === 2)) + )) { + containerOut.dtick = dtickDflt; + } + } + + // tick0 can have different valType for different axis types, so + // validate that now. Also for dates, change milliseconds to date strings + var tick0Dflt = (axType === 'date') ? '2000-01-01' : 0; + var tick0 = coerce('tick0', tick0Dflt); + if(axType === 'date') { + containerOut.tick0 = Lib.cleanDate(tick0, tick0Dflt); + } + // Aside from date axes, dtick must be numeric; D1 and D2 modes ignore tick0 entirely + else if(isNumeric(tick0) && dtick !== 'D1' && dtick !== 'D2') { + containerOut.tick0 = Number(tick0); + } + else { + containerOut.tick0 = tick0Dflt; + } } else { var tickvals = coerce('tickvals'); @@ -74109,7 +74312,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"fast-isnumeric":12}],359:[function(require,module,exports){ +},{"../../constants/numerical":303,"../../lib":316,"fast-isnumeric":12}],361:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74421,7 +74624,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../lib":314,"../../plotly":336,"../../registry":380,"./axes":340,"d3":8}],360:[function(require,module,exports){ +},{"../../lib":316,"../../plotly":338,"../../registry":382,"./axes":343,"d3":8}],362:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74833,7 +75036,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":314,"../plotly":336}],361:[function(require,module,exports){ +},{"../lib":316,"../plotly":338}],363:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74864,7 +75067,7 @@ module.exports = { } }; -},{}],362:[function(require,module,exports){ +},{}],364:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -74905,7 +75108,7 @@ module.exports = { } }; -},{}],363:[function(require,module,exports){ +},{}],365:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75047,28 +75250,22 @@ module.exports = { }, - _composedModules: { - '*': 'Fx' + dragmode: { + valType: 'enumerated', + + values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], + dflt: 'zoom', + }, - - _nestedModules: { - 'xaxis': 'Axes', - 'yaxis': 'Axes', - 'scene': 'gl3d', - 'geo': 'geo', - 'ternary': 'ternary', - 'mapbox': 'mapbox', - - 'legend': 'legend', - 'annotations': 'annotations', - 'shapes': 'shapes', - 'images': 'images', - 'updatemenus': 'updatemenus', - 'sliders': 'sliders' + hovermode: { + valType: 'enumerated', + + values: ['x', 'y', 'closest', false], + } }; -},{"../components/color/attributes":222,"../lib":314,"./font_attributes":361}],364:[function(require,module,exports){ +},{"../components/color/attributes":222,"../lib":316,"./font_attributes":363}],366:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75098,7 +75295,7 @@ module.exports = { mapOnErrorMsg: 'Mapbox error.' }; -},{}],365:[function(require,module,exports){ +},{}],367:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75172,7 +75369,7 @@ module.exports = function convertTextOpts(textposition, iconSize) { return { anchor: anchor, offset: offset }; }; -},{"../../lib":314}],366:[function(require,module,exports){ +},{"../../lib":316}],368:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75328,7 +75525,7 @@ function findAccessToken(gd, mapboxIds) { return accessToken; } -},{"../../constants/xmlns_namespaces":305,"../plots":372,"./constants":364,"./layout_attributes":368,"./layout_defaults":369,"./mapbox":370,"mapbox-gl":82}],367:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":305,"../plots":374,"./constants":366,"./layout_attributes":370,"./layout_defaults":371,"./mapbox":372,"mapbox-gl":82}],369:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75553,7 +75750,7 @@ module.exports = function createMapboxLayer(mapbox, index, opts) { return mapboxLayer; }; -},{"../../lib":314,"./convert_text_opts":365}],368:[function(require,module,exports){ +},{"../../lib":316,"./convert_text_opts":367}],370:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75644,7 +75841,7 @@ module.exports = { }, layers: { - _isLinkedToArray: true, + _isLinkedToArray: 'layer', sourcetype: { valType: 'enumerated', @@ -75756,7 +75953,7 @@ module.exports = { }; -},{"../../components/color":223,"../../lib":314,"../../traces/scatter/attributes":391,"../font_attributes":361}],369:[function(require,module,exports){ +},{"../../components/color":223,"../../lib":316,"../../traces/scatter/attributes":393,"../font_attributes":363}],371:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -75852,7 +76049,7 @@ function handleLayerDefaults(containerIn, containerOut) { } } -},{"../../lib":314,"../subplot_defaults":379,"./layout_attributes":368}],370:[function(require,module,exports){ +},{"../../lib":316,"../subplot_defaults":381,"./layout_attributes":370}],372:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -76308,7 +76505,7 @@ function convertCenter(center) { return [center.lon, center.lat]; } -},{"../../lib":314,"../cartesian/graph_interact":348,"./constants":364,"./layers":367,"./layout_attributes":368,"mapbox-gl":82}],371:[function(require,module,exports){ +},{"../../lib":316,"../cartesian/graph_interact":350,"./constants":366,"./layers":369,"./layout_attributes":370,"mapbox-gl":82}],373:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -76346,7 +76543,7 @@ module.exports = { } }; -},{}],372:[function(require,module,exports){ +},{}],374:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -76713,6 +76910,9 @@ plots.sendDataToCloud = function(gd) { // gd._fullLayout._basePlotModules // is a list of all the plot modules required to draw the plot. // +// gd._fullLayout._transformModules +// is a list of all the transform modules invoked. +// plots.supplyDefaults = function(gd) { var oldFullLayout = gd._fullLayout || {}, newFullLayout = gd._fullLayout = {}, @@ -76724,6 +76924,9 @@ plots.supplyDefaults = function(gd) { var i; + // Create all the storage space for frames, but only if doesn't already exist + if(!gd._transitionData) plots.createTransitionData(gd); + // first fill in what we can of layout without looking at data // because fullData needs a few things from layout @@ -76784,7 +76987,7 @@ plots.supplyDefaults = function(gd) { } // finally, fill in the pieces of layout that may need to look at data - plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData); + plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData); // TODO remove in v2.0.0 // add has-plot-type refs to fullLayout for backward compatibility @@ -76823,12 +77026,6 @@ plots.supplyDefaults = function(gd) { (gd.calcdata[i][0] || {}).trace = trace; } } - - // Create all the storage space for frames, but only if doesn't already - // exist: - if(!gd._transitionData) { - plots.createTransitionData(gd); - } }; // Create storage for all of the data related to frames and transitions: @@ -76995,6 +77192,8 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) { basePlotModules = fullLayout._basePlotModules = [], cnt = 0; + fullLayout._transformModules = []; + function pushModule(fullTrace) { dataOut.push(fullTrace); @@ -77212,6 +77411,8 @@ function supplyTransformDefaults(traceIn, traceOut, layout) { transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn); transformOut.type = type; transformOut._module = _module; + + Lib.pushUnique(layout._transformModules, _module); } else { transformOut = Lib.extendFlat({}, transformIn); @@ -77381,7 +77582,7 @@ function calculateReservedMargins(margins) { return resultingMargin; } -plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { +plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, transitionData) { var i, _module; // can't be be part of basePlotModules loop @@ -77412,6 +77613,16 @@ plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { } } + // transform module layout defaults + var transformModules = layoutOut._transformModules; + for(i = 0; i < transformModules.length; i++) { + _module = transformModules[i]; + + if(_module.supplyLayoutDefaults) { + _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData, transitionData); + } + } + // should FX be a component? Plotly.Fx.supplyLayoutDefaults(layoutIn, layoutOut, fullData); @@ -77439,8 +77650,16 @@ plots.purge = function(gd) { // remove modebar if(fullLayout._modeBar) fullLayout._modeBar.destroy(); - if(gd._transitionData && gd._transitionData._animationRaf) { - window.cancelAnimationFrame(gd._transitionData._animationRaf); + if(gd._transitionData) { + // Ensure any dangling callbacks are simply dropped if the plot is purged. + // This is more or less only actually important for testing. + if(gd._transitionData._interruptCallbacks) { + gd._transitionData._interruptCallbacks.length = 0; + } + + if(gd._transitionData._animationRaf) { + window.cancelAnimationFrame(gd._transitionData._animationRaf); + } } // data and layout @@ -77717,9 +77936,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { // convert native dates to date strings... // mostly for external users exporting to plotly - if(d && d.getTime) { - return Lib.ms2DateTime(d); - } + if(Lib.isJSDate(d)) return Lib.ms2DateTime(+d); return d; } @@ -77764,7 +77981,7 @@ plots.modifyFrames = function(gd, operations) { break;*/ case 'replace': frame = op.value; - var oldName = _frames[op.index].name; + var oldName = (_frames[op.index] || {}).name; var newName = frame.name; _frames[op.index] = _hash[newName] = frame; @@ -77898,8 +78115,14 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { for(i = 0; i < containerPaths.length; i++) { containerProp = Lib.nestedProperty(expandedObj, containerPaths[i]); containerVal = containerProp.get(); - containerProp.set(null); - Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + + if(containerVal === undefined) { + Lib.nestedProperty(containerObj, containerPaths[i]).set(null); + } + else { + containerProp.set(null); + Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + } } } @@ -77913,15 +78136,20 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { if(!srcContainer) continue; destProp = Lib.nestedProperty(dest, containerPaths[i]); - destContainer = destProp.get(); + if(!Array.isArray(destContainer)) { destContainer = []; destProp.set(destContainer); } for(j = 0; j < srcContainer.length; j++) { - destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcContainer[j]); + var srcObj = srcContainer[j]; + + if(srcObj === null) destContainer[j] = null; + else { + destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcObj); + } } destProp.set(destContainer); @@ -77932,7 +78160,7 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { }; plots.dataArrayContainers = ['transforms']; -plots.layoutArrayContainers = ['annotations', 'shapes', 'images', 'sliders', 'updatemenus']; +plots.layoutArrayContainers = Registry.layoutArrayContainers; /* * Extend a trace definition. This method: @@ -77991,11 +78219,15 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var trace = gd._fullData[traceIdx]; var module = trace._module; - if(!module || !module.animatable) { - continue; - } + // There's nothing to do if this module is not defined: + if(!module) continue; - transitionedTraces.push(traceIdx); + // Don't register the trace as transitioned if it doens't know what to do. + // If it *is* registered, it will receive a callback that it's responsible + // for calling in order to register the transition as having completed. + if(module.animatable) { + transitionedTraces.push(traceIdx); + } gd.data[traceIndices[i]] = plots.extendTrace(gd.data[traceIndices[i]], data[i]); } @@ -78049,6 +78281,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var aborted = false; function executeTransitions() { + + gd.emit('plotly_transitioning', []); + return new Promise(function(resolve) { // This flag is used to disabled things like autorange: gd._transitioning = true; @@ -78133,6 +78368,11 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function completeTransition(callback) { + // This a simple workaround for tests which purge the graph before animations + // have completed. That's not a very common case, so this is the simplest + // fix. + if(!gd._transitionData) return; + flushCallbacks(gd._transitionData._interruptCallbacks); return Promise.resolve().then(function() { @@ -78150,6 +78390,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function interruptPreviousTransitions() { + // Fail-safe against purged plot: + if(!gd._transitionData) return; + // If a transition is interrupted, set this to false. At the moment, the only thing that would // interrupt a transition is another transition, so that it will momentarily be set to true // again, but this determines whether autorange or dragbox work, so it's for the sake of @@ -78177,13 +78420,13 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var seq = [plots.previousPromises, interruptPreviousTransitions, prepareTransitions, executeTransitions]; - var transitionStarting = Lib.syncOrAsync(seq, gd); - if(!transitionStarting || !transitionStarting.then) transitionStarting = Promise.resolve(); + if(!transitionStarting || !transitionStarting.then) { + transitionStarting = Promise.resolve(); + } return transitionStarting.then(function() { - gd.emit('plotly_transitioning', []); return gd; }); }; @@ -78286,7 +78529,7 @@ plots.doCalcdata = function(gd, traces) { } }; -},{"../components/color":223,"../components/errorbars":253,"../lib":314,"../plotly":336,"../registry":380,"./animation_attributes":337,"./attributes":338,"./command":360,"./font_attributes":361,"./frame_attributes":362,"./layout_attributes":363,"d3":8,"fast-isnumeric":12}],373:[function(require,module,exports){ +},{"../components/color":223,"../components/errorbars":252,"../lib":316,"../plotly":338,"../registry":382,"./animation_attributes":339,"./attributes":341,"./command":362,"./font_attributes":363,"./frame_attributes":364,"./layout_attributes":365,"d3":8,"fast-isnumeric":12}],375:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -78311,7 +78554,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":391}],374:[function(require,module,exports){ +},{"../../traces/scatter/attributes":393}],376:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -78426,7 +78669,7 @@ module.exports = { } }; -},{"../../lib/extend":311,"../cartesian/layout_attributes":350}],375:[function(require,module,exports){ +},{"../../lib/extend":312,"../cartesian/layout_attributes":352}],377:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -78441,7 +78684,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":376,"./micropolar_manager":377}],376:[function(require,module,exports){ +},{"./micropolar":378,"./micropolar_manager":379}],378:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -79860,7 +80103,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":314,"d3":8}],377:[function(require,module,exports){ +},{"../../lib":316,"d3":8}],379:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -79946,7 +80189,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":223,"../../lib":314,"./micropolar":376,"./undo_manager":378,"d3":8}],378:[function(require,module,exports){ +},{"../../components/color":223,"../../lib":316,"./micropolar":378,"./undo_manager":380,"d3":8}],380:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80012,7 +80255,7 @@ module.exports = function UndoManager() { }; }; -},{}],379:[function(require,module,exports){ +},{}],381:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80087,7 +80330,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":314,"./plots":372}],380:[function(require,module,exports){ +},{"../lib":316,"./plots":374}],382:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80103,11 +80346,12 @@ var Lib = require('./lib'); var basePlotAttributes = require('./plots/attributes'); exports.modules = {}; -exports.allTypes = []; exports.allCategories = {}; +exports.allTypes = []; exports.subplotsRegistry = {}; exports.transformsRegistry = {}; exports.componentsRegistry = {}; +exports.layoutArrayContainers = []; /** * register a module as the handler for a trace type @@ -80173,6 +80417,16 @@ exports.registerSubplot = function(_module) { exports.subplotsRegistry[plotType] = _module; }; +exports.registerComponent = function(_module) { + var name = _module.name; + + exports.componentsRegistry[name] = _module; + + if(_module.layoutAttributes && _module.layoutAttributes._isLinkedToArray) { + Lib.pushUnique(exports.layoutArrayContainers, name); + } +}; + /** * Get registered module using trace object or trace type * @@ -80244,7 +80498,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib":314,"./plots/attributes":338}],381:[function(require,module,exports){ +},{"./lib":316,"./plots/attributes":341}],383:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80371,11 +80625,12 @@ module.exports = function clonePlot(graphObj, options) { } } - var td = document.createElement('div'); - if(options.tileClass) td.className = options.tileClass; + var gd = document.createElement('div'); + if(options.tileClass) gd.className = options.tileClass; var plotTile = { - td: td, + gd: gd, + td: gd, // for external (image server) compatibility layout: newLayout, data: newData, config: { @@ -80395,13 +80650,13 @@ module.exports = function clonePlot(graphObj, options) { plotTile.config.setBackground = options.setBackground || 'opaque'; } - // attaching the default Layout the td, so you can grab it later - plotTile.td.defaultLayout = cloneLayoutOverride(options.tileClass); + // attaching the default Layout the gd, so you can grab it later + plotTile.gd.defaultLayout = cloneLayoutOverride(options.tileClass); return plotTile; }; -},{"../lib":314,"../plots/plots":372}],382:[function(require,module,exports){ +},{"../lib":316,"../plots/plots":374}],384:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80467,7 +80722,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":314,"../plot_api/to_image":334,"./filesaver":383}],383:[function(require,module,exports){ +},{"../lib":316,"../plot_api/to_image":336,"./filesaver":385}],385:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80535,7 +80790,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],384:[function(require,module,exports){ +},{}],386:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80568,7 +80823,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],385:[function(require,module,exports){ +},{}],387:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80594,7 +80849,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":381,"./download":382,"./helpers":384,"./svgtoimg":386,"./toimage":387,"./tosvg":388}],386:[function(require,module,exports){ +},{"./cloneplot":383,"./download":384,"./helpers":386,"./svgtoimg":388,"./toimage":389,"./tosvg":390}],388:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80725,7 +80980,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":314,"events":11}],387:[function(require,module,exports){ +},{"../lib":316,"events":11}],389:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80758,7 +81013,7 @@ function toImage(gd, opts) { var ev = new EventEmitter(); var clone = clonePlot(gd, {format: 'png'}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -80805,7 +81060,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":314,"../plotly":336,"./cloneplot":381,"./helpers":384,"./svgtoimg":386,"./tosvg":388,"events":11}],388:[function(require,module,exports){ +},{"../lib":316,"../plotly":338,"./cloneplot":383,"./helpers":386,"./svgtoimg":388,"./tosvg":390,"events":11}],390:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80924,7 +81179,7 @@ module.exports = function toSVG(gd, format) { return s; }; -},{"../components/color":223,"../components/drawing":247,"../constants/xmlns_namespaces":305,"../lib/svg_text_utils":326,"d3":8}],389:[function(require,module,exports){ +},{"../components/color":223,"../components/drawing":246,"../constants/xmlns_namespaces":305,"../lib/svg_text_utils":328,"d3":8}],391:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80951,7 +81206,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":223}],390:[function(require,module,exports){ +},{"../../components/color":223}],392:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -80989,7 +81244,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":314}],391:[function(require,module,exports){ +},{"../../lib":316}],393:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81001,11 +81256,11 @@ module.exports = function arraysToCalcdata(cd) { 'use strict'; var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var Drawing = require('../../components/drawing'); - var constants = require('./constants'); - var extendFlat = require('../../lib/extend').extendFlat; module.exports = { @@ -81181,12 +81436,15 @@ module.exports = { }, + showscale: { valType: 'boolean', dflt: false, }, + colorbar: colorbarAttrs, + line: extendFlat({}, { width: { valType: 'number', @@ -81234,6 +81492,7 @@ module.exports = { }, }, + r: { valType: 'data_array', @@ -81242,14 +81501,12 @@ module.exports = { valType: 'data_array', }, - _nestedModules: { // nested module coupling - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_y: errorBarAttrs, + error_x: errorBarAttrs }; -},{"../../components/colorscale/color_attributes":231,"../../components/drawing":247,"../../lib/extend":311,"./constants":396}],392:[function(require,module,exports){ +},{"../../components/colorbar/attributes":224,"../../components/colorscale/color_attributes":230,"../../components/drawing":246,"../../components/errorbars/attributes":248,"../../lib/extend":312,"./constants":398}],394:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81380,7 +81637,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":314,"../../plots/cartesian/axes":340,"./colorscale_calc":395,"./subtypes":411,"fast-isnumeric":12}],393:[function(require,module,exports){ +},{"../../lib":316,"../../plots/cartesian/axes":343,"./colorscale_calc":397,"./subtypes":413,"fast-isnumeric":12}],395:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81419,7 +81676,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],394:[function(require,module,exports){ +},{}],396:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81476,7 +81733,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":226,"../../components/colorscale":238,"../../lib":314,"../../plots/plots":372,"fast-isnumeric":12}],395:[function(require,module,exports){ +},{"../../components/colorbar/draw":226,"../../components/colorscale":237,"../../lib":316,"../../plots/plots":374,"fast-isnumeric":12}],397:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81509,7 +81766,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":230,"../../components/colorscale/has_colorscale":237,"./subtypes":411}],396:[function(require,module,exports){ +},{"../../components/colorscale/calc":229,"../../components/colorscale/has_colorscale":236,"./subtypes":413}],398:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81525,7 +81782,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],397:[function(require,module,exports){ +},{}],399:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81605,7 +81862,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":252,"../../lib":314,"./attributes":391,"./constants":396,"./fillcolor_defaults":398,"./line_defaults":402,"./line_shape_defaults":404,"./marker_defaults":407,"./subtypes":411,"./text_defaults":412,"./xy_defaults":413}],398:[function(require,module,exports){ +},{"../../components/errorbars/defaults":251,"../../lib":316,"./attributes":393,"./constants":398,"./fillcolor_defaults":400,"./line_defaults":404,"./line_shape_defaults":406,"./marker_defaults":409,"./subtypes":413,"./text_defaults":414,"./xy_defaults":415}],400:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81643,7 +81900,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":223}],399:[function(require,module,exports){ +},{"../../components/color":223}],401:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81696,7 +81953,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":223,"./subtypes":411}],400:[function(require,module,exports){ +},{"../../components/color":223,"./subtypes":413}],402:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81865,7 +82122,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":223,"../../components/errorbars":253,"../../lib":314,"../../plots/cartesian/constants":346,"../../plots/cartesian/graph_interact":348,"./get_trace_color":399}],401:[function(require,module,exports){ +},{"../../components/color":223,"../../components/errorbars":252,"../../lib":316,"../../plots/cartesian/constants":348,"../../plots/cartesian/graph_interact":350,"./get_trace_color":401}],403:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81909,7 +82166,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":349,"./arrays_to_calcdata":390,"./attributes":391,"./calc":392,"./clean_data":393,"./colorbar":394,"./defaults":397,"./hover":400,"./plot":408,"./select":409,"./style":410,"./subtypes":411}],402:[function(require,module,exports){ +},{"../../plots/cartesian":351,"./arrays_to_calcdata":392,"./attributes":393,"./calc":394,"./clean_data":395,"./colorbar":396,"./defaults":399,"./hover":402,"./plot":410,"./select":411,"./style":412,"./subtypes":413}],404:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81942,7 +82199,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce('line.dash'); }; -},{"../../components/colorscale/defaults":233,"../../components/colorscale/has_colorscale":237}],403:[function(require,module,exports){ +},{"../../components/colorscale/defaults":232,"../../components/colorscale/has_colorscale":236}],405:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -81954,7 +82211,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, 'use strict'; -var Axes = require('../../plots/cartesian/axes'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function linePoints(d, opts) { @@ -81965,7 +82222,6 @@ module.exports = function linePoints(d, opts) { baseTolerance = opts.baseTolerance, linear = opts.linear, segments = [], - badnum = Axes.BADNUM, minTolerance = 0.2, // fraction of tolerance "so close we don't even consider it a new point" pts = new Array(d.length), pti = 0, @@ -82002,7 +82258,7 @@ module.exports = function linePoints(d, opts) { function getPt(index) { var x = xa.c2p(d[index].x), y = ya.c2p(d[index].y); - if(x === badnum || y === badnum) return false; + if(x === BADNUM || y === BADNUM) return false; return [x, y]; } @@ -82116,7 +82372,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../plots/cartesian/axes":340}],404:[function(require,module,exports){ +},{"../../constants/numerical":303}],406:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82135,7 +82391,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],405:[function(require,module,exports){ +},{}],407:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82176,7 +82432,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],406:[function(require,module,exports){ +},{}],408:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82218,7 +82474,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":12}],407:[function(require,module,exports){ +},{"fast-isnumeric":12}],409:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82278,7 +82534,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":223,"../../components/colorscale/defaults":233,"../../components/colorscale/has_colorscale":237,"./subtypes":411}],408:[function(require,module,exports){ +},{"../../components/color":223,"../../components/colorscale/defaults":232,"../../components/colorscale/has_colorscale":236,"./subtypes":413}],410:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82450,6 +82706,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.visible !== true) return; + transition(tr).style('opacity', trace.opacity); + // BUILD LINES AND FILLS var ownFillEl3, tonext; var ownFillDir = trace.fill.charAt(trace.fill.length - 1); @@ -82775,8 +83033,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { var xa = plotinfo.xaxis, ya = plotinfo.yaxis, - xr = d3.extent(xa.range.map(xa.l2c)), - yr = d3.extent(ya.range.map(ya.l2c)); + xr = d3.extent(xa.range.map(xa.r2l).map(xa.l2c)), + yr = d3.extent(ya.range.map(ya.r2l).map(ya.l2c)); var trace = cdscatter[0].trace; if(!subTypes.hasMarkers(trace)) return; @@ -82814,7 +83072,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":247,"../../components/errorbars":253,"../../lib":314,"../../lib/polygon":321,"./arrays_to_calcdata":390,"./line_points":403,"./link_traces":405,"./subtypes":411,"d3":8}],409:[function(require,module,exports){ +},{"../../components/drawing":246,"../../components/errorbars":252,"../../lib":316,"../../lib/polygon":323,"./arrays_to_calcdata":392,"./line_points":405,"./link_traces":407,"./subtypes":413,"d3":8}],411:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82886,7 +83144,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":411}],410:[function(require,module,exports){ +},{"./subtypes":413}],412:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82928,7 +83186,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":247,"../../components/errorbars":253,"d3":8}],411:[function(require,module,exports){ +},{"../../components/drawing":246,"../../components/errorbars":252,"d3":8}],413:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82964,7 +83222,7 @@ module.exports = { } }; -},{"../../lib":314}],412:[function(require,module,exports){ +},{"../../lib":316}],414:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -82985,7 +83243,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":314}],413:[function(require,module,exports){ +},{"../../lib":316}],415:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83030,7 +83288,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { return len; }; -},{}],414:[function(require,module,exports){ +},{}],416:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83096,6 +83354,7 @@ module.exports = { sizemin: scatterMarkerAttrs.sizemin, sizemode: scatterMarkerAttrs.sizemode, showscale: scatterMarkerAttrs.showscale, + colorbar: scatterMarkerAttrs.colorbar, line: extendFlat({}, {width: scatterMarkerLineAttrs.width}, colorAttributes('marker.line') @@ -83115,14 +83374,10 @@ module.exports = { hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['lon', 'lat', 'location', 'text', 'name'] - }), - - _nestedModules: { - 'marker.colorbar': 'Colorbar' - } + }) }; -},{"../../components/colorscale/color_attributes":231,"../../lib/extend":311,"../../plots/attributes":338,"../scatter/attributes":391}],415:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":230,"../../lib/extend":312,"../../plots/attributes":341,"../scatter/attributes":393}],417:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83137,6 +83392,8 @@ var scatterGeoAttrs = require('../scattergeo/attributes'); var scatterAttrs = require('../scatter/attributes'); var mapboxAttrs = require('../../plots/mapbox/layout_attributes'); var plotAttrs = require('../../plots/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; var lineAttrs = scatterGeoAttrs.line; @@ -83195,7 +83452,8 @@ module.exports = { cmin: markerAttrs.cmin, autocolorscale: markerAttrs.autocolorscale, reversescale: markerAttrs.reversescale, - showscale: markerAttrs.showscale + showscale: markerAttrs.showscale, + colorbar: colorbarAttrs // line }, @@ -83209,13 +83467,9 @@ module.exports = { hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['lon', 'lat', 'text', 'name'] }), - - _nestedModules: { - 'marker.colorbar': 'Colorbar' - } }; -},{"../../lib/extend":311,"../../plots/attributes":338,"../../plots/mapbox/layout_attributes":368,"../scatter/attributes":391,"../scattergeo/attributes":414}],416:[function(require,module,exports){ +},{"../../components/colorbar/attributes":224,"../../lib/extend":312,"../../plots/attributes":341,"../../plots/mapbox/layout_attributes":370,"../scatter/attributes":393,"../scattergeo/attributes":416}],418:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83318,7 +83572,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../components/colorscale":238,"../../lib":314,"../scatter/colorscale_calc":395,"../scatter/make_bubble_size_func":406,"../scatter/subtypes":411,"fast-isnumeric":12}],417:[function(require,module,exports){ +},{"../../components/colorscale":237,"../../lib":316,"../scatter/colorscale_calc":397,"../scatter/make_bubble_size_func":408,"../scatter/subtypes":413,"fast-isnumeric":12}],419:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83627,7 +83881,7 @@ function getFillFunc(attr) { function blankFillFunc() { return ''; } -},{"../../lib":314,"../../lib/geojson_utils":313,"../../plots/mapbox/convert_text_opts":365,"../scatter/subtypes":411}],418:[function(require,module,exports){ +},{"../../lib":316,"../../lib/geojson_utils":315,"../../plots/mapbox/convert_text_opts":367,"../scatter/subtypes":413}],420:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83715,7 +83969,7 @@ function handleLonLatDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":314,"../scatter/attributes":391,"../scatter/fillcolor_defaults":398,"../scatter/line_defaults":402,"../scatter/marker_defaults":407,"../scatter/subtypes":411,"../scatter/text_defaults":412,"./attributes":415}],419:[function(require,module,exports){ +},{"../../lib":316,"../scatter/attributes":393,"../scatter/fillcolor_defaults":400,"../scatter/line_defaults":404,"../scatter/marker_defaults":409,"../scatter/subtypes":413,"../scatter/text_defaults":414,"./attributes":417}],421:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83735,7 +83989,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],420:[function(require,module,exports){ +},{}],422:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83830,7 +84084,7 @@ function getExtraText(trace, di) { return text.join('
'); } -},{"../../plots/cartesian/graph_interact":348,"../scatter/get_trace_color":399}],421:[function(require,module,exports){ +},{"../../plots/cartesian/graph_interact":350,"../scatter/get_trace_color":401}],423:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83863,7 +84117,7 @@ ScatterMapbox.meta = { module.exports = ScatterMapbox; -},{"../../plots/mapbox":366,"../scatter/colorbar":394,"./attributes":415,"./calc":416,"./defaults":418,"./event_data":419,"./hover":420,"./plot":422}],422:[function(require,module,exports){ +},{"../../plots/mapbox":368,"../scatter/colorbar":396,"./attributes":417,"./calc":418,"./defaults":420,"./event_data":421,"./hover":422,"./plot":424}],424:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -83987,5 +84241,5 @@ module.exports = function createScatterMapbox(mapbox, calcTrace) { return scatterMapbox; }; -},{"./convert":417}]},{},[4])(4) +},{"./convert":419}]},{},[4])(4) }); \ No newline at end of file diff --git a/dist/plotly-mapbox.min.js b/dist/plotly-mapbox.min.js index beda4e45c04..c219a14e100 100644 --- a/dist/plotly-mapbox.min.js +++ b/dist/plotly-mapbox.min.js @@ -1,40 +1,40 @@ /** -* plotly.js (mapbox - minified) v1.19.2 +* plotly.js (mapbox - minified) v1.20.0 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function t(e,n,r){function i(o,s){if(!n[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[o]={exports:{}};e[o][0].call(c.exports,function(t){var n=e[o][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o=0;a--)if(o[a]!=s[a])return!1;for(a=o.length-1;a>=0;a--)if(i=o[a],!l(t[i],e[i]))return!1;return!0}function f(t,e){return!(!t||!e)&&("[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e||e.call({},t)===!0)}function h(t,e,n,r){var i;d.isString(n)&&(r=n,n=null);try{e()}catch(t){i=t}if(r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&o(i,n,"Missing expected exception"+r),!t&&f(i,n)&&o(i,n,"Got unwanted exception"+r),t&&i&&n&&!f(i,n)||!t&&i)throw i}var d=t("util/"),p=Array.prototype.slice,m=Object.prototype.hasOwnProperty,g=e.exports=s;g.AssertionError=function(t){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=a(this),this.generatedMessage=!0);var e=t.stackStartFunction||o;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var n=new Error;if(n.stack){var r=n.stack,i=e.name,s=r.indexOf("\n"+i);if(s>=0){var l=r.indexOf("\n",s+1);r=r.substring(l+1)}this.stack=r}}},d.inherits(g.AssertionError,Error),g.fail=o,g.ok=s,g.equal=function(t,e,n){t!=e&&o(t,e,n,"==",g.equal)},g.notEqual=function(t,e,n){t==e&&o(t,e,n,"!=",g.notEqual)},g.deepEqual=function(t,e,n){l(t,e)||o(t,e,n,"deepEqual",g.deepEqual)},g.notDeepEqual=function(t,e,n){l(t,e)&&o(t,e,n,"notDeepEqual",g.notDeepEqual)},g.strictEqual=function(t,e,n){t!==e&&o(t,e,n,"===",g.strictEqual)},g.notStrictEqual=function(t,e,n){t===e&&o(t,e,n,"!==",g.notStrictEqual)},g.throws=function(t,e,n){h.apply(this,[!0].concat(p.call(arguments)))},g.doesNotThrow=function(t,e){h.apply(this,[!1].concat(p.call(arguments)))},g.ifError=function(t){if(t)throw t};var v=Object.keys||function(t){var e=[];for(var n in t)m.call(t,n)&&e.push(n);return e}},{"util/":203}],7:[function(t,e,n){function r(t){return t=Math.round(t),t<0?0:t>255?255:t}function i(t){return t<0?0:t>1?1:t}function a(t){return r("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return i("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function s(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function l(t){var e=t.replace(/ /g,"").toLowerCase();if(e in u)return u[e].slice();if("#"===e[0]){if(4===e.length){var n=parseInt(e.substr(1),16);return n>=0&&n<=4095?[(3840&n)>>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,1]:null}if(7===e.length){var n=parseInt(e.substr(1),16);return n>=0&&n<=16777215?[(16711680&n)>>16,(65280&n)>>8,255&n,1]:null}return null}var i=e.indexOf("("),l=e.indexOf(")");if(i!==-1&&l+1===e.length){var c=e.substr(0,i),f=e.substr(i+1,l-(i+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:[a(f[0]),a(f[1]),a(f[2]),h];case"hsla":if(4!==f.length)return null;h=o(f.pop());case"hsl":if(3!==f.length)return null;var d=(parseFloat(f[0])%360+360)%360/360,p=o(f[1]),m=o(f[2]),g=m<=.5?m*(p+1):m+p-m*p,v=2*m-g;return[r(255*s(v,g,d+1/3)),r(255*s(v,g,d)),r(255*s(v,g,d-1/3)),h];default:return null}}return null}var u={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{n.parseCSSColor=l}catch(t){}},{}],8:[function(e,n,r){!function(){function e(t){return t&&(t.ownerDocument||t.document||t).documentElement}function r(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function i(t,e){return te?1:t>=e?0:NaN}function a(t){return null===t?NaN:+t}function o(t){return!isNaN(t)}function s(t){return{left:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);r>>1;t(e[a],n)<0?r=a+1:i=a}return r},right:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);r>>1;t(e[a],n)>0?i=a:r=a+1}return r}}}function l(t){return t.length}function u(t){for(var e=1;t*e%1;)e*=10;return e}function c(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function f(){this._=Object.create(null)}function h(t){return(t+="")===bo||t[0]===wo?wo+t:t}function d(t){return(t+="")[0]===wo?t.slice(1):t}function p(t){return h(t)in this._}function m(t){return(t=h(t))in this._&&delete this._[t]}function g(){var t=[];for(var e in this._)t.push(d(e));return t}function v(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function x(){this._=Object.create(null)}function _(t){return t}function b(t,e,n){return function(){var r=n.apply(e,arguments);return r===e?t:r}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,r=Mo.length;n=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Po.get(t);return u&&(t=u,l=Q),s?e?i:r:e?M:a}function W(t,e){return function(n){var r=uo.event;uo.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.event=r}}}function Q(t,e){var n=W(t,e);return function(t){var e=this,r=t.relatedTarget;r&&(r===e||8&r.compareDocumentPosition(e))||n.call(e,t)}}function J(t){var n=".dragsuppress-"+ ++Oo,i="click"+n,a=uo.select(r(t)).on("touchmove"+n,S).on("dragstart"+n,S).on("selectstart"+n,S);if(null==Co&&(Co=!("onselectstart"in t)&&w(t.style,"userSelect")),Co){var o=e(t).style,s=o[Co];o[Co]="none"}return function(t){if(a.on(n,null),Co&&(o[Co]=s),t){var e=function(){a.on(i,null)};a.on(i,function(){S(),e()},!0),setTimeout(e,0)}}}function $(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();if(Fo<0){var a=r(t);if(a.scrollX||a.scrollY){n=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=n[0][0].getScreenCTM();Fo=!(o.f||o.e),n.remove()}}return Fo?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function K(){return uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function nt(t){return t>1?0:t<-1?No:Math.acos(t)}function rt(t){return t>1?Vo:t<-1?-Vo:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function at(t){return((t=Math.exp(t))+1/t)/2}function ot(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ut(t,e,n){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):Mt(""+t,kt,ut):new ut(t,e,n)}function ct(t,e,n){function r(t){return t>360?t-=360:t<0&&(t+=360),t<60?a+(o-a)*t/60:t<180?o:t<240?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*r(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=n<0?0:n>1?1:n,o=n<=.5?n*(1+e):n+e-n*e,a=2*n-o,new xt(i(t+120),i(t),i(t-120))}function ft(t,e,n){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof dt?mt(t.l,t.a,t.b):mt((t=At((t=uo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,n)}function ht(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(n,Math.cos(t*=Uo)*e,Math.sin(t)*e)}function dt(t,e,n){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof ft?ht(t.h,t.c,t.l):At((t=xt(t)).r,t.g,t.b):new dt(t,e,n)}function pt(t,e,n){var r=(t+16)/116,i=r+e/500,a=r-n/200;return i=gt(i)*ts,r=gt(r)*es,a=gt(a)*ns,new xt(yt(3.2404542*i-1.5371385*r-.4985314*a),yt(-.969266*i+1.8760108*r+.041556*a),yt(.0556434*i-.2040259*r+1.0572252*a))}function mt(t,e,n){return t>0?new ft(Math.atan2(n,e)*Ho,Math.sqrt(e*e+n*n),t):new ft(NaN,NaN,t)}function gt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function vt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function xt(t,e,n){return this instanceof xt?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof xt?new xt(t.r,t.g,t.b):Mt(""+t,xt,ct):new xt(t,e,n)}function _t(t){return new xt(t>>16,t>>8&255,255&t)}function bt(t){return _t(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(t,e,n){var r,i,a,o=0,s=0,l=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return n(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(Tt(i[0]),Tt(i[1]),Tt(i[2]))}return(a=as.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|o,s=240&a,s=s>>4|s,l=15&a,l=l<<4|l):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function kt(t,e,n){var r,i,a=Math.min(t/=255,e/=255,n/=255),o=Math.max(t,e,n),s=o-a,l=(o+a)/2;return s?(i=l<.5?s/(o+a):s/(2-o-a),r=t==o?(e-n)/s+(e0&&l<1?0:r),new ut(r,i,l)}function At(t,e,n){t=St(t),e=St(e),n=St(n);var r=vt((.4124564*t+.3575761*e+.1804375*n)/ts),i=vt((.2126729*t+.7151522*e+.072175*n)/es),a=vt((.0193339*t+.119192*e+.9503041*n)/ns);return dt(116*i-16,500*(r-i),200*(i-a))}function St(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Tt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function zt(t){return"function"==typeof t?t:function(){return t}}function Et(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),Lt(e,n,t,r)}}function Lt(t,e,n,r){function i(){var t,e=l.status;if(!e&&Dt(l)||e>=200&&e<300||304===e){try{t=n.call(a,l)}catch(t){return void o.error.call(a,t)}o.load.call(a,t)}else o.error.call(a,l)}var a={},o=uo.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=uo.event;uo.event=t;try{o.progress.call(a,l)}finally{uo.event=e}},a.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",a)},a.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",a):e},a.responseType=function(t){return arguments.length?(u=t,a):u},a.response=function(t){return n=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(fo(arguments)))}}),a.send=function(n,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),l.open(n,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=u&&(l.responseType=u),null!=i&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==r?null:r),a},a.abort=function(){return l.abort(),a},uo.rebind(a,o,"on"),null==r?a:a.get(It(r))}function It(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}function Dt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Pt(t,e,n){var r=arguments.length;r<2&&(e=0),r<3&&(n=Date.now());var i=n+e,a={c:t,t:i,n:null};return ss?ss.n=a:os=a,ss=a,ls||(us=clearTimeout(us), -ls=1,cs(Ct)),a}function Ct(){var t=Ot(),e=Ft()-t;e>24?(isFinite(e)&&(clearTimeout(us),us=setTimeout(Ct,e)),ls=0):(ls=1,cs(Ct))}function Ot(){for(var t=Date.now(),e=os;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ft(){for(var t,e=os,n=1/0;e;)e.c?(e.t8?function(t){return t/n}:function(t){return t*n},symbol:t}}function Nt(t){var e=t.decimal,n=t.thousands,r=t.grouping,i=t.currency,a=r&&n?function(t,e){for(var i=t.length,a=[],o=0,s=r[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=r[o=(o+1)%r.length];return a.reverse().join(n)}:_;return function(t){var n=hs.exec(t),r=n[1]||" ",o=n[2]||">",s=n[3]||"-",l=n[4]||"",u=n[5],c=+n[6],f=n[7],h=n[8],d=n[9],p=1,m="",g="",v=!1,y=!0;switch(h&&(h=+h.substring(1)),(u||"0"===r&&"="===o)&&(u=r="0",o="="),d){case"n":f=!0,d="g";break;case"%":p=100,g="%",d="f";break;case"p":p=100,g="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(m="0"+d.toLowerCase());case"c":y=!1;case"d":v=!0,h=0;break;case"s":p=-1,d="r"}"$"===l&&(m=i[0],g=i[1]),"r"!=d||h||(d="g"),null!=h&&("g"==d?h=Math.max(1,Math.min(21,h)):"e"!=d&&"f"!=d||(h=Math.max(0,Math.min(20,h)))),d=ds.get(d)||Bt;var x=u&&f;return function(t){var n=g;if(v&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=uo.formatPrefix(t,h);t=l.scale(t),n=l.symbol+g}else t*=p;t=d(t,h);var _,b,w=t.lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(_=t,b=""):(_=t.substring(0,M),b=t.substring(M))}else _=t.substring(0,w),b=e+t.substring(w+1);!u&&f&&(_=a(_,1/0));var k=m.length+_.length+b.length+(x?0:i.length),A=k"===o?A+i+t:"^"===o?A.substring(0,k>>=1)+i+t+A.substring(k):i+(x?t:A+t))+n}}}function Bt(t){return t+""}function qt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Vt(t,e,n){function r(e){var n=t(e),r=a(n,1);return e-n1)for(;o=u)return-1;if(i=e.charCodeAt(s++),37===i){if(o=e.charAt(s++),a=E[o in vs?e.charAt(s++):o],!a||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function r(t,e,n){w.lastIndex=0;var r=w.exec(e.slice(n));return r?(t.w=M.get(r[0].toLowerCase()),n+r[0].length):-1}function i(t,e,n){_.lastIndex=0;var r=_.exec(e.slice(n));return r?(t.w=b.get(r[0].toLowerCase()),n+r[0].length):-1}function a(t,e,n){S.lastIndex=0;var r=S.exec(e.slice(n));return r?(t.m=T.get(r[0].toLowerCase()),n+r[0].length):-1}function o(t,e,n){k.lastIndex=0;var r=k.exec(e.slice(n));return r?(t.m=A.get(r[0].toLowerCase()),n+r[0].length):-1}function s(t,e,r){return n(t,z.c.toString(),e,r)}function l(t,e,r){return n(t,z.x.toString(),e,r)}function u(t,e,r){return n(t,z.X.toString(),e,r)}function c(t,e,n){var r=x.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)}var f=t.dateTime,h=t.date,d=t.time,p=t.periods,m=t.days,g=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function n(t){try{ms=qt;var e=new ms;return e._=t,r(e)}finally{ms=Date}}var r=e(t);return n.parse=function(t){try{ms=qt;var e=r.parse(t);return e&&e._}finally{ms=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=ce;var x=uo.map(),_=Gt(m),b=Xt(m),w=Gt(g),M=Xt(g),k=Gt(v),A=Xt(v),S=Gt(y),T=Xt(y);p.forEach(function(t,e){x.set(t.toLowerCase(),e)});var z={a:function(t){return g[t.getDay()]},A:function(t){return m[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(f),d:function(t,e){return Zt(t.getDate(),e,2)},e:function(t,e){return Zt(t.getDate(),e,2)},H:function(t,e){return Zt(t.getHours(),e,2)},I:function(t,e){return Zt(t.getHours()%12||12,e,2)},j:function(t,e){return Zt(1+ps.dayOfYear(t),e,3)},L:function(t,e){return Zt(t.getMilliseconds(),e,3)},m:function(t,e){return Zt(t.getMonth()+1,e,2)},M:function(t,e){return Zt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Zt(t.getSeconds(),e,2)},U:function(t,e){return Zt(ps.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Zt(ps.mondayOfYear(t),e,2)},x:e(h),X:e(d),y:function(t,e){return Zt(t.getFullYear()%100,e,2)},Y:function(t,e){return Zt(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},E={a:r,A:i,b:a,B:o,c:s,d:ne,e:ne,H:ie,I:ie,j:re,L:se,m:ee,M:ae,p:c,S:oe,U:Wt,w:Yt,W:Qt,x:l,X:u,y:$t,Y:Jt,Z:Kt,"%":ue};return e}function Zt(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a68?1900:2e3)}function ee(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ne(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function re(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function ie(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ae(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function oe(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function se(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function le(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=_o(e)/60|0,i=_o(e)%60;return n+Zt(r,"0",2)+Zt(i,"0",2)}function ue(t,e,n){xs.lastIndex=0;var r=xs.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function ce(t){for(var e=t.length,n=-1;++n=0?1:-1,s=o*n,l=Math.cos(e),u=Math.sin(e),c=a*u,f=i*l+c*Math.cos(s),h=c*o*Math.sin(s);As.add(Math.atan2(h,f)),r=t,i=l,a=u}var e,n,r,i,a;Ss.point=function(o,s){Ss.point=t,r=(e=o)*Uo,i=Math.cos(s=(n=s)*Uo/2+No/4),a=Math.sin(s)},Ss.lineEnd=function(){t(e,n)}}function ve(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 _e(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function be(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Me(t){return[Math.atan2(t[1],t[0]),rt(t[2])]}function ke(t,e){return _o(t[0]-e[0])=0;--s)i.point((f=c[s])[0],f[1])}else r(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);i.lineEnd()}}}function Pe(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r0){for(b||(a.polygonStart(),b=!0),a.lineStart();++o1&&2&e&&n.push(n.pop().concat(n.shift())),d.push(n.filter(Fe))}var d,p,m,g=e(a),v=i.invert(r[0],r[1]),y={point:o,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=f,y.lineEnd=h,d=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=l,y.lineEnd=u,d=uo.merge(d);var t=Ve(v,p);d.length?(b||(a.polygonStart(),b=!0),De(d,je,t,n,a)):t&&(b||(a.polygonStart(),b=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),b&&(a.polygonEnd(),b=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}},x=Re(),_=e(x),b=!1;return y}}function Fe(t){return t.length>1}function Re(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:M,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function je(t,e){return((t=t.x)[0]<0?t[1]-Vo-Ro:Vo-t[1])-((e=e.x)[0]<0?e[1]-Vo-Ro:Vo-e[1])}function Ne(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?No:-No,l=_o(a-n);_o(l-No)0?Vo:-Vo),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(a,r),e=0):i!==s&&l>=No&&(_o(n-i)Ro?Math.atan((Math.sin(e)*(a=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+r)/2}function qe(t,e,n,r){var i;if(null==t)i=n*Vo,r.point(-No,i),r.point(0,i),r.point(No,i),r.point(No,0),r.point(No,-i),r.point(0,-i),r.point(-No,-i),r.point(-No,0),r.point(-No,i);else if(_o(t[0]-e[0])>Ro){var a=t[0]=0?1:-1,M=w*b,k=M>No,A=p*x;if(As.add(Math.atan2(A*w*Math.sin(M),m*_+A*Math.cos(M))),a+=k?b+w*Bo:b,k^h>=n^v>=n){var S=xe(ve(f),ve(t));we(S);var T=xe(i,S);we(T);var z=(k^b>=0?-1:1)*rt(T[2]);(r>z||r===z&&(S[0]||S[1]))&&(o+=k^b>=0?1:-1)}if(!g++)break;h=v,p=x,m=_,f=t}}return(a<-Ro||aa}function n(t){var n,a,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],m=e(f,h),g=o?m?0:i(f,h):m?i(f+(f<0?No:-No),h):0;if(!n&&(u=l=m)&&t.lineStart(),m!==l&&(d=r(n,p),(ke(n,d)||ke(p,d))&&(p[0]+=Ro,p[1]+=Ro,m=e(p[0],p[1]))),m!==l)c=0,m?(t.lineStart(),d=r(p,n),t.point(d[0],d[1])):(d=r(n,p),t.point(d[0],d[1]),t.lineEnd()),n=d;else if(s&&n&&o^m){var v;g&a||!(v=r(p,n,!0))||(c=0,o?(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])))}!m||n&&ke(n,p)||t.point(p[0],p[1]),n=p,l=m,a=g},lineEnd:function(){l&&t.lineEnd(),n=null},clean:function(){return c|(u&&l)<<1}}}function r(t,e,n){var r=ve(t),i=ve(e),o=[1,0,0],s=xe(r,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!n&&t;var f=a*l/c,h=-a*u/c,d=xe(o,s),p=be(o,f),m=be(s,h);_e(p,m);var g=d,v=ye(p,g),y=ye(g,g),x=v*v-y*(ye(p,p)-1);if(!(x<0)){var _=Math.sqrt(x),b=be(g,(-v-_)/y);if(_e(b,p),b=Me(b),!n)return b;var w,M=t[0],k=e[0],A=t[1],S=e[1];k0^b[1]<(_o(b[0]-M)No^(M<=b[0]&&b[0]<=k)){var L=be(g,(-v+_)/y);return _e(L,p),[b,Me(L)]}}}function i(e,n){var r=o?t:No-t,i=0;return e<-r?i|=1:e>r&&(i|=2),n<-r?i|=4:n>r&&(i|=8),i}var a=Math.cos(t),o=a>0,s=_o(a)>Ro,l=vn(t,6*Uo);return Oe(e,n,l,o?[0,-t]:[-No,t-No])}function He(t,e,n,r){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=s.x,f=s.y,h=0,d=1,p=c-l,m=f-u;if(a=t-l,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=n-l,p||!(a<0)){if(a/=p,p<0){if(a>d)return;a>h&&(h=a)}else if(p>0){if(a0)){if(a/=m,m<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=r-u,m||!(a<0)){if(a/=m,m<0){if(a>d)return;a>h&&(h=a)}else if(m>0){if(a0&&(i.a={x:l+h*p,y:u+h*m}),d<1&&(i.b={x:l+d*p,y:u+d*m}),i}}}}}}function Ze(t,e,n,r){function i(r,i){return _o(r[0]-t)0?0:3:_o(r[0]-n)0?2:1:_o(r[1]-e)0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(t,e){var n=i(t,1),r=i(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,n=g.length,r=t[1],i=0;ir&&et(u,a,t)>0&&++e:a[1]<=r&&et(u,a,t)<0&&--e,u=a;return 0!==e}function u(a,s,l,u){var c=0,f=0;if(null==a||(c=i(a,l))!==(f=i(s,l))||o(a,s)<0^l>0){do u.point(0===c||3===c?t:n,c>1?r:e);while((c=(c+l+4)%4)!==f)}else u.point(s[0],s[1])}function c(i,a){return t<=i&&i<=n&&e<=a&&a<=r}function f(t,e){c(t,e)&&s.point(t,e)}function h(){E.point=p,g&&g.push(v=[]),k=!0,M=!1,b=w=NaN}function d(){m&&(p(y,x),_&&M&&T.rejoin(),m.push(T.buffer())),E.point=f,M&&s.lineEnd()}function p(t,e){t=Math.max(-Bs,Math.min(Bs,t)),e=Math.max(-Bs,Math.min(Bs,e));var n=c(t,e);if(g&&v.push([t,e]),k)y=t,x=e,_=n,k=!1,n&&(s.lineStart(),s.point(t,e));else if(n&&M)s.point(t,e);else{var r={a:{x:b,y:w},b:{x:t,y:e}};z(r)?(M||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),n||s.lineEnd(),A=!1):n&&(s.lineStart(),s.point(t,e),A=!1)}b=t,w=e,M=n}var m,g,v,y,x,_,b,w,M,k,A,S=s,T=Re(),z=He(t,e,n,r),E={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=T,m=[],g=[],A=!0},polygonEnd:function(){s=S,m=uo.merge(m);var e=l([t,r]),n=A&&e,i=m.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&De(m,a,e,u,s),s.polygonEnd()),m=g=v=null}};return E}}function Ge(t){var e=0,n=No/3,r=un(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*No/180,n=t[1]*No/180):[e/No*180,n/No*180]},i}function Xe(t,e){function n(t,e){var n=Math.sqrt(a-2*i*Math.sin(e))/i;return[n*Math.sin(t*=i),o-n*Math.cos(t)]}var r=Math.sin(t),i=(r+Math.sin(e))/2,a=1+r*(2*i-r),o=Math.sqrt(a)/i;return n.invert=function(t,e){var n=o-e;return[Math.atan2(t,n)/i,rt((a-(t*t+n*n)*i*i)/(2*i))]},n}function Ye(){function t(t,e){Vs+=i*t-r*e,r=t,i=e}var e,n,r,i;Xs.point=function(a,o){Xs.point=t,e=r=a,n=i=o},Xs.lineEnd=function(){t(e,n)}}function We(t,e){tZs&&(Zs=t),eGs&&(Gs=e)}function Qe(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=n}function n(t,e){o.push("L",t,",",e)}function r(){s.point=t}function i(){o.push("Z")}var a=Je(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:r,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=r,s.point=t},pointRadius:function(t){return a=Je(t),s},result:function(){if(o.length){var t=o.join("");return o=[],t}}};return s}function Je(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $e(t,e){Es+=t,Ls+=e,++Is}function Ke(){function t(t,r){var i=t-e,a=r-n,o=Math.sqrt(i*i+a*a);Ds+=o*(e+t)/2,Ps+=o*(n+r)/2,Cs+=o,$e(e=t,n=r)}var e,n;Ws.point=function(r,i){Ws.point=t,$e(e=r,n=i)}}function tn(){Ws.point=$e}function en(){function t(t,e){var n=t-r,a=e-i,o=Math.sqrt(n*n+a*a);Ds+=o*(r+t)/2,Ps+=o*(i+e)/2,Cs+=o,o=i*t-r*e,Os+=o*(r+t),Fs+=o*(i+e),Rs+=3*o,$e(r=t,i=e)}var e,n,r,i;Ws.point=function(a,o){Ws.point=t,$e(e=r=a,n=i=o)},Ws.lineEnd=function(){t(e,n)}}function nn(t){function e(e,n){t.moveTo(e+o,n),t.arc(e,n,o,0,Bo)}function n(e,n){t.moveTo(e,n),s.point=r}function r(e,n){t.lineTo(e,n)}function i(){s.point=e}function a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=n},lineEnd:i,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return o=t,s},result:M};return s}function rn(t){function e(t){return(s?r:n)(t)}function n(e){return sn(e,function(n,r){n=t(n,r),e.point(n[0],n[1])})}function r(e){function n(n,r){n=t(n,r),e.point(n[0],n[1])}function r(){x=NaN,k.point=a,e.lineStart()}function a(n,r){var a=ve([n,r]),o=t(n,r);i(x,_,y,b,w,M,x=o[0],_=o[1],y=n,b=a[0],w=a[1],M=a[2],s,e),e.point(x,_)}function o(){k.point=n,e.lineEnd()}function l(){r(),k.point=u,k.lineEnd=c}function u(t,e){a(f=t,h=e),d=x,p=_,m=b,g=w,v=M,k.point=a}function c(){i(x,_,y,b,w,M,d,p,f,m,g,v,s,e),k.lineEnd=o,o()}var f,h,d,p,m,g,v,y,x,_,b,w,M,k={point:n,lineStart:r,lineEnd:o,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=r}};return k}function i(e,n,r,s,l,u,c,f,h,d,p,m,g,v){var y=c-e,x=f-n,_=y*y+x*x;if(_>4*a&&g--){var b=s+d,w=l+p,M=u+m,k=Math.sqrt(b*b+w*w+M*M),A=Math.asin(M/=k),S=_o(_o(M)-1)a||_o((y*L+x*I)/_-.5)>.3||s*d+l*p+u*m0&&16,e):Math.sqrt(a)},e}function an(t){var e=rn(function(e,n){return t([e*Ho,n*Ho])});return function(t){return cn(e(t))}}function on(t){this.stream=t}function sn(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 ln(t){return un(function(){return t})()}function un(t){function e(t){return t=s(t[0]*Uo,t[1]*Uo),[t[0]*h+l,u-t[1]*h]}function n(t){return t=s.invert((t[0]-l)/h,(u-t[1])/h),t&&[t[0]*Ho,t[1]*Ho]}function r(){s=Le(o=dn(v,y,x),a);var t=a(m,g);return l=d-t[0]*h,u=p+t[1]*h,i()}function i(){return c&&(c.valid=!1,c=null),e}var a,o,s,l,u,c,f=rn(function(t,e){return t=a(t,e),[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,m=0,g=0,v=0,y=0,x=0,b=Ns,w=_,M=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=cn(b(o,f(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(b=null==t?(M=t,Ns):Ue((M=+t)*Uo),i()):M},e.clipExtent=function(t){return arguments.length?(k=t,w=t?Ze(t[0][0],t[0][1],t[1][0],t[1][1]):_,i()):k},e.scale=function(t){return arguments.length?(h=+t,r()):h},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],r()):[d,p]},e.center=function(t){return arguments.length?(m=t[0]%360*Uo,g=t[1]%360*Uo,r()):[m*Ho,g*Ho]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Uo,y=t[1]%360*Uo,x=t.length>2?t[2]%360*Uo:0,r()):[v*Ho,y*Ho,x*Ho]},uo.rebind(e,f,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&n,r()}}function cn(t){return sn(t,function(e,n){t.point(e*Uo,n*Uo)})}function fn(t,e){return[t,e]}function hn(t,e){return[t>No?t-Bo:t<-No?t+Bo:t,e]}function dn(t,e,n){return t?e||n?Le(mn(t),gn(e,n)):mn(t):e||n?gn(e,n):hn}function pn(t){return function(e,n){return e+=t,[e>No?e-Bo:e<-No?e+Bo:e,n]}}function mn(t){var e=pn(t);return e.invert=pn(-t),e}function gn(t,e){function n(t,e){var n=Math.cos(e),s=Math.cos(t)*n,l=Math.sin(t)*n,u=Math.sin(e),c=u*r+s*i;return[Math.atan2(l*a-c*o,s*r-u*i),rt(c*a+l*o)]}var r=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=Math.sin(e);return n.invert=function(t,e){var n=Math.cos(e),s=Math.cos(t)*n,l=Math.sin(t)*n,u=Math.sin(e),c=u*a-l*o;return[Math.atan2(l*a+u*o,s*r+c*i),rt(c*r-s*i)]},n}function vn(t,e){var n=Math.cos(t),r=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=yn(n,i),a=yn(n,a),(o>0?ia)&&(i+=o*Bo)):(i=t+o*Bo,a=t-.5*l);for(var u,c=i;o>0?c>a:c0?e<-Vo+Ro&&(e=-Vo+Ro):e>Vo-Ro&&(e=Vo-Ro);var n=o/Math.pow(i(e),a);return[n*Math.sin(a*t),o-n*Math.cos(a*t)]}var r=Math.cos(t),i=function(t){return Math.tan(No/4+t/2)},a=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(i(e)/i(t)),o=r*Math.pow(i(t),a)/a;return a?(n.invert=function(t,e){var n=o-e,r=tt(a)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/a,2*Math.atan(Math.pow(o/r,1/a))-Vo]},n):zn}function Tn(t,e){function n(t,e){var n=a-e;return[n*Math.sin(i*t),a-n*Math.cos(i*t)]}var r=Math.cos(t),i=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),a=r/i+t;return _o(i)1&&et(t[n[r-2]],t[n[r-1]],t[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}function Cn(t,e){return t[0]-e[0]||t[1]-e[1]}function On(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function Fn(t,e,n,r){var i=t[0],a=n[0],o=e[0]-i,s=r[0]-a,l=t[1],u=n[1],c=e[1]-l,f=r[1]-u,h=(s*(l-u)-f*(i-a))/(f*o-s*c);return[i+h*o,l+h*c]}function Rn(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function jn(){ar(this),this.edge=this.site=this.circle=null}function Nn(t){var e=ul.pop()||new jn;return e.site=t,e}function Bn(t){Qn(t),ol.remove(t),ul.push(t),ar(t)}function qn(t){var e=t.circle,n=e.x,r=e.cy,i={x:n,y:r},a=t.P,o=t.N,s=[t];Bn(t);for(var l=a;l.circle&&_o(n-l.circle.x)Ro)s=s.L;else{if(i=a-Hn(s,o),!(i>Ro)){r>-Ro?(e=s.P,n=s):i>-Ro?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}var l=Nn(t);if(ol.insert(e,l),e||n){if(e===n)return Qn(e),n=Nn(e.site),ol.insert(l,n),l.edge=n.edge=tr(e.site,l.site),Wn(e),void Wn(n);if(!n)return void(l.edge=tr(e.site,l.site));Qn(e),Qn(n);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=n.site,m=p.x-c,g=p.y-f,v=2*(h*g-d*m),y=h*h+d*d,x=m*m+g*g,_={x:(g*y-d*x)/v+c,y:(h*x-m*y)/v+f};nr(n.edge,u,p,_),l.edge=tr(u,t,null,_),n.edge=tr(t,p,null,_),Wn(e),Wn(n)}}function Un(t,e){var n=t.site,r=n.x,i=n.y,a=i-e;if(!a)return r;var o=t.P;if(!o)return-(1/0);n=o.site;var s=n.x,l=n.y,u=l-e;if(!u)return s;var c=s-r,f=1/a-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+i-a/2)))/f+r:(r+s)/2}function Hn(t,e){var n=t.N;if(n)return Un(n,e);var r=t.site;return r.y===e?r.x:1/0}function Zn(t){this.site=t,this.edges=[]}function Gn(t){for(var e,n,r,i,a,o,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],m=al,g=m.length;g--;)if(a=m[g],a&&a.prepare())for(s=a.edges,l=s.length,o=0;oRo||_o(i-n)>Ro)&&(s.splice(o,0,new rr(er(a.site,c,_o(r-f)Ro?{x:f,y:_o(e-f)Ro?{x:_o(n-p)Ro?{x:h,y:_o(e-h)Ro?{x:_o(n-d)=-jo)){var d=l*l+u*u,p=c*c+f*f,m=(f*d-u*p)/h,g=(l*p-c*d)/h,f=g+s,v=cl.pop()||new Yn;v.arc=t,v.site=i,v.x=m+o,v.y=f+Math.sqrt(m*m+g*g),v.cy=f,t.circle=v;for(var y=null,x=ll._;x;)if(v.y=s)return;if(h>p){if(a){if(a.y>=u)return}else a={x:g,y:l};n={x:g,y:u}}else{if(a){if(a.y1)if(h>p){if(a){if(a.y>=u)return}else a={x:(l-i)/r,y:l};n={x:(u-i)/r,y:u}}else{if(a){if(a.y=s)return}else a={x:o,y:r*o+i};n={x:s,y:r*s+i}}else{if(a){if(a.xa||f>o||h=_,M=n>=b,k=M<<1|w,A=k+4;ka&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,l.push({i:o,x:xr(n,r)})),a=dl.lastIndex;return a=0&&!(n=uo.interpolators[r](t,e)););return n}function wr(t,e){var n,r=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(n=0;n=1?1:t(e)}}function kr(t){return function(e){return 1-t(1-e)}}function Ar(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Sr(t){return t*t}function Tr(t){return t*t*t}function zr(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function Er(t){return function(e){return Math.pow(e,t)}}function Lr(t){return 1-Math.cos(t*Vo)}function Ir(t){return Math.pow(2,10*(t-1))}function Dr(t){return 1-Math.sqrt(1-t*t)}function Pr(t,e){var n;return arguments.length<2&&(e=.45),arguments.length?n=e/Bo*Math.asin(1/t):(t=1,n=e/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-n)*Bo/e)}}function Cr(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Or(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 Fr(t,e){t=uo.hcl(t),e=uo.hcl(e);var n=t.h,r=t.c,i=t.l,a=e.h-n,o=e.c-r,s=e.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?e.c:r),isNaN(a)?(a=0,n=isNaN(n)?e.h:n):a>180?a-=360:a<-180&&(a+=360),function(t){return ht(n+a*t,r+o*t,i+s*t)+""}}function Rr(t,e){t=uo.hsl(t),e=uo.hsl(e);var n=t.h,r=t.s,i=t.l,a=e.h-n,o=e.s-r,s=e.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?e.s:r),isNaN(a)?(a=0,n=isNaN(n)?e.h:n):a>180?a-=360:a<-180&&(a+=360),function(t){return ct(n+a*t,r+o*t,i+s*t)+""}}function jr(t,e){t=uo.lab(t),e=uo.lab(e);var n=t.l,r=t.a,i=t.b,a=e.l-n,o=e.a-r,s=e.b-i;return function(t){return pt(n+a*t,r+o*t,i+s*t)+""}}function Nr(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function Br(t){var e=[t.a,t.b],n=[t.c,t.d],r=Vr(e),i=qr(e,n),a=Vr(Ur(n,e,-i))||0;e[0]*n[1]180?e+=360:e-t>180&&(t+=360),r.push({i:n.push(Hr(n)+"rotate(",null,")")-2,x:xr(t,e)})):e&&n.push(Hr(n)+"rotate("+e+")")}function Xr(t,e,n,r){t!==e?r.push({i:n.push(Hr(n)+"skewX(",null,")")-2,x:xr(t,e)}):e&&n.push(Hr(n)+"skewX("+e+")")}function Yr(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var i=n.push(Hr(n)+"scale(",null,",",null,")");r.push({i:i-4,x:xr(t[0],e[0])},{i:i-2,x:xr(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(Hr(n)+"scale("+e+")")}function Wr(t,e){var n=[],r=[];return t=uo.transform(t),e=uo.transform(e),Zr(t.translate,e.translate,n,r),Gr(t.rotate,e.rotate,n,r),Xr(t.skew,e.skew,n,r),Yr(t.scale,e.scale,n,r),t=e=null,function(t){for(var e,i=-1,a=r.length;++i=0;)n.push(i[r])}function li(t,e){for(var n=[t],r=[];null!=(t=n.pop());)if(r.push(t),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++oi&&(r=n,i=e);return r}function xi(t){return t.reduce(_i,0)}function _i(t,e){return t+e[1]}function bi(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var n=-1,r=+t[0],i=(t[1]-r)/e,a=[];++n<=e;)a[n]=i*n+r;return a}function Mi(t){return[uo.min(t),uo.max(t)]}function ki(t,e){return t.value-e.value}function Ai(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Si(t,e){t._pack_next=e,e._pack_prev=t}function Ti(t,e){var n=e.x-t.x,r=e.y-t.y,i=t.r+e.r;return.999*i*i>n*n+r*r}function zi(t){function e(t){c=Math.min(t.x-t.r,c),f=Math.max(t.x+t.r,f),h=Math.min(t.y-t.r,h),d=Math.max(t.y+t.r,d)}if((n=t.children)&&(u=n.length)){var n,r,i,a,o,s,l,u,c=1/0,f=-(1/0),h=1/0,d=-(1/0);if(n.forEach(Ei),r=n[0],r.x=-r.r,r.y=0,e(r),u>1&&(i=n[1],i.x=i.r,i.y=0,e(i),u>2))for(a=n[2],Di(r,i,a),e(a),Ai(r,a),r._pack_prev=a,Ai(a,i),i=r._pack_next,o=3;o=0;)e=i[a],e.z+=n,e.m+=n,n+=e.s+(r+=e.c)}function ji(t,e,n){return t.a.parent===e.parent?t.a:n}function Ni(t){return 1+uo.max(t,function(t){return t.y})}function Bi(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function qi(t){var e=t.children;return e&&e.length?qi(e[0]):t}function Vi(t){var e,n=t.children;return n&&(e=n.length)?Vi(n[e-1]):t}function Ui(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Hi(t,e){var n=t.x+e[3],r=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(n+=i/2,i=0),a<0&&(r+=a/2,a=0),{x:n,y:r,dx:i,dy:a}}function Zi(t){var e=t[0],n=t[t.length-1];return e2?Qi:Xi,l=r?Jr:Qr;return o=i(t,e,l,n),s=i(e,t,l,br),a}function a(t){return o(t)}var o,s;return a.invert=function(t){return s(t)},a.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},a.range=function(t){return arguments.length?(e=t,i()):e},a.rangeRound=function(t){return a.range(t).interpolate(Nr)},a.clamp=function(t){return arguments.length?(r=t,i()):r},a.interpolate=function(t){return arguments.length?(n=t,i()):n},a.ticks=function(e){return ea(t,e)},a.tickFormat=function(e,n){return na(t,e,n)},a.nice=function(e){return Ki(t,e),i()},a.copy=function(){return Ji(t,e,n,r)},i()}function $i(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ki(t,e){return Yi(t,Wi(ta(t,e)[2])),Yi(t,Wi(ta(t,e)[2])),t}function ta(t,e){null==e&&(e=10);var n=Zi(t),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/e)/Math.LN10)),a=e/r*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+.5*i,n[2]=i,n}function ea(t,e){return uo.range.apply(uo,ta(t,e))}function na(t,e,n){var r=ta(t,e);if(n){var i=hs.exec(n);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(_o(r[0]),_o(r[1])));return i[7]||(i[7]="."+ra(a.scale(r[2]))),i[8]="f",n=uo.format(i.join("")),function(t){return n(a.scale(t))+a.symbol}}i[7]||(i[7]="."+ia(i[8],r)),n=i.join("")}else n=",."+ra(r[2])+"f";return uo.format(n)}function ra(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ia(t,e){var n=ra(e[2]);return t in Al?Math.abs(n-ra(Math.max(_o(e[0]),_o(e[1]))))+ +("e"!==t):n-2*("%"===t)}function aa(t,e,n,r){function i(t){return(n?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return n?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(i(e))}return o.invert=function(e){return a(t.invert(e))},o.domain=function(e){return arguments.length?(n=e[0]>=0,t.domain((r=e.map(Number)).map(i)),o):r},o.base=function(n){return arguments.length?(e=+n,t.domain(r.map(i)),o):e},o.nice=function(){var e=Yi(r.map(i),n?Math:Tl);return t.domain(e),r=e.map(a),o},o.ticks=function(){var t=Zi(r),o=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),f=e%1?2:e;if(isFinite(c-u)){if(n){for(;u0;h--)o.push(a(u)*h);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,n){if(!arguments.length)return Sl;arguments.length<2?n=Sl:"function"!=typeof n&&(n=uo.format(n));var r=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e0?s[n-1]:t[0],n0?0:1}function _a(t,e,n,r,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?r:-r)/Math.sqrt(a*a+o*o),l=s*o,u=-s*a,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,m=(f+d)/2,g=h-c,v=d-f,y=g*g+v*v,x=n-r,_=c*d-h*f,b=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-_*_)),w=(_*v-g*b)/y,M=(-_*g-v*b)/y,k=(_*v+g*b)/y,A=(-_*g+v*b)/y,S=w-p,T=M-m,z=k-p,E=A-m;return S*S+T*T>z*z+E*E&&(w=k,M=A),[[w-l,M-u],[w*n/x,M*n/x]]}function ba(t){function e(e){function o(){u.push("M",a(t(c),s))}for(var l,u=[],c=[],f=-1,h=e.length,d=zt(n),p=zt(r);++f1?t.join("L"):t+"Z"}function Ma(t){return t.join("L")+"Z"}function ka(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e1&&i.push("H",r[0]),i.join("")}function Aa(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e1){s=e[1],a=t[l],l++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var u=2;u9&&(i=3*e/Math.sqrt(i),o[s]=i*n,o[s+1]=i*r));for(s=-1;++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}function qa(t){return t.length<3?wa(t):t[0]+La(t,Ba(t))}function Va(t){for(var e,n,r,i=-1,a=t.length;++i0;)d[--s].call(t,o);if(a>=1)return m.event&&m.event.end.call(t,t.__data__,e),--p.count?delete p[r]:delete t[n],1}var l,u,c,h,d,p=t[n]||(t[n]={active:0,count:0}),m=p[r];m||(l=i.time,u=Pt(a,0,l),m=p[r]={tween:new f,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function no(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate("+(isFinite(r)?r:n(t))+",0)"})}function ro(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate(0,"+(isFinite(r)?r:n(t))+")"})}function io(t){return t.toISOString()}function ao(t,e,n){function r(e){return t(e)}function i(t,n){var r=t[1]-t[0],i=r/n,a=uo.bisect($l,i);return a==$l.length?[e.year,ta(t.map(function(t){return t/31536e6}),n)[2]]:a?e[i/$l[a-1]<$l[a]/i?a-1:a]:[eu,ta(t,n)[2]]}return r.invert=function(e){return oo(t.invert(e))},r.domain=function(e){return arguments.length?(t.domain(e),r):t.domain().map(oo)},r.nice=function(t,e){function n(n){return!isNaN(n)&&!t.range(n,oo(+n+1),e).length}var a=r.domain(),o=Zi(a),s=null==t?i(o,10):"number"==typeof t&&i(o,t);return s&&(t=s[0],e=s[1]),r.domain(Yi(a,e>1?{floor:function(e){for(;n(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},r.ticks=function(t,e){var n=Zi(r.domain()),a=null==t?i(n,10):"number"==typeof t?i(n,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(n[0],oo(+n[1]+1),e<1?1:e)},r.tickFormat=function(){return n},r.copy=function(){return ao(t.copy(),e,n)},$i(r,t)}function oo(t){return new Date(t)}function so(t){return JSON.parse(t.responseText)}function lo(t){var e=ho.createRange();return e.selectNode(ho.body),e.createContextualFragment(t.responseText)}var uo={version:"3.5.17"},co=[].slice,fo=function(t){return co.call(t)},ho=this.document;if(ho)try{fo(ho.documentElement.childNodes)[0].nodeType}catch(t){fo=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),ho)try{ho.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var po=this.Element.prototype,mo=po.setAttribute,go=po.setAttributeNS,vo=this.CSSStyleDeclaration.prototype,yo=vo.setProperty;po.setAttribute=function(t,e){mo.call(this,t,e+"")},po.setAttributeNS=function(t,e,n){go.call(this,t,e,n+"")},vo.setProperty=function(t,e,n){yo.call(this,t,e+"",n)}}uo.ascending=i,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.min=function(t,e){var n,r,i=-1,a=t.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++ir&&(n=r)}else{for(;++i=r){n=r;break}for(;++ir&&(n=r)}return n},uo.max=function(t,e){var n,r,i=-1,a=t.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++in&&(n=r)}else{for(;++i=r){n=r;break}for(;++in&&(n=r)}return n},uo.extent=function(t,e){var n,r,i,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=i=r;break}for(;++ar&&(n=r),i=r){n=i=r;break}for(;++ar&&(n=r),i1)return l/(c-1)},uo.deviation=function(){var t=uo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var xo=s(i);uo.bisectLeft=xo.left,uo.bisect=uo.bisectRight=xo.right,uo.bisector=function(t){return s(1===t.length?function(e,n){return i(t(e),n)}:t)},uo.shuffle=function(t,e,n){(a=arguments.length)<3&&(n=t.length,a<2&&(e=0));for(var r,i,a=n-e;a;)i=Math.random()*a--|0,r=t[a+e],t[a+e]=t[i+e],t[i+e]=r;return t},uo.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r},uo.pairs=function(t){for(var e,n=0,r=t.length-1,i=t[0],a=new Array(r<0?0:r);n=0;)for(r=t[i],e=r.length;--e>=0;)n[--o]=r[e];return n};var _o=Math.abs;uo.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n===1/0)throw new Error("infinite range");var r,i=[],a=u(_o(n)),o=-1;if(t*=a,e*=a,n*=a,n<0)for(;(r=t+n*++o)>e;)i.push(r/a);else for(;(r=t+n*++o)=a.length)return r?r.call(i,o):n?o.sort(n):o;for(var l,u,c,h,d=-1,p=o.length,m=a[s++],g=new f;++d=a.length)return t;var r=[],i=o[n++];return t.forEach(function(t,i){r.push({key:t,values:e(i,n)})}),i?r.sort(function(t,e){return i(t.key,e.key)}):r}var n,r,i={},a=[],o=[];return i.map=function(e,n){return t(n,e,0)},i.entries=function(n){return e(t(uo.map,n,0),0)},i.key=function(t){return a.push(t),i},i.sortKeys=function(t){return o[a.length-1]=t,i},i.sortValues=function(t){return n=t,i},i.rollup=function(t){return r=t,i},i},uo.set=function(t){var e=new x;if(t)for(var n=0,r=t.length;n=0&&(r=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},uo.event=null,uo.requote=function(t){return t.replace(ko,"\\$&")};var ko=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ao={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},So=function(t,e){return e.querySelector(t)},To=function(t,e){return e.querySelectorAll(t)},zo=function(t,e){var n=t.matches||t[w(t,"matchesSelector")];return(zo=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(So=function(t,e){return Sizzle(t,e)[0]||null},To=Sizzle,zo=Sizzle.matchesSelector),uo.selection=function(){return uo.select(ho.documentElement)};var Eo=uo.selection.prototype=[];Eo.select=function(t){var e,n,r,i,a=[];t=L(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Io.hasOwnProperty(n)?{space:Io[n],local:t}:t}},Eo.attr=function(t,e){if(arguments.length<2){ -if("string"==typeof t){var n=this.node();return t=uo.ns.qualify(t),t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(D(e,t[e]));return this}return this.each(D(t,e))},Eo.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=O(t)).length,i=-1;if(e=n.classList){for(;++i=0;)(n=r[i])&&(a&&a!==n.nextSibling&&a.parentNode.insertBefore(n,a),a=n);return this},Eo.sort=function(t){t=H.apply(this,arguments);for(var e=-1,n=this.length;++e0&&(e=e.transition().duration(E)),e.call(t.event)}function s(){b&&b.domain(_.range().map(function(t){return(t-k.x)/k.k}).map(_.invert)),M&&M.domain(w.range().map(function(t){return(t-k.y)/k.k}).map(w.invert))}function l(t){L++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--L||(t({type:"zoomend"}),g=null)}function f(){function t(){s=1,a(uo.mouse(i),h),u(o)}function n(){f.on(D,null).on(P,null),d(s),c(o)}var i=this,o=O.of(i,arguments),s=0,f=uo.select(r(i)).on(D,t).on(P,n),h=e(uo.mouse(i)),d=J(i);Vl.call(i),l(o)}function h(){function t(){var t=uo.touches(p);return d=k.k,t.forEach(function(t){t.identifier in g&&(g[t.identifier]=e(t))}),t}function n(){var e=uo.event.target;uo.select(e).on(_,r).on(b,s),w.push(e);for(var n=uo.event.changedTouches,i=0,a=n.length;i1){var c=l[0],f=l[1],h=c[0]-f[0],d=c[1]-f[1];v=h*h+d*d}}function r(){var t,e,n,r,o=uo.touches(p);Vl.call(p);for(var s=0,l=o.length;s=u)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var n=e;n++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ds=uo.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=uo.round(t,Rt(t,e))).toFixed(Math.max(0,Math.min(20,Rt(t*(1+1e-15),e))))}}),ps=uo.time={},ms=Date;qt.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(){gs.setUTCDate.apply(this._,arguments)},setDay:function(){gs.setUTCDay.apply(this._,arguments)},setFullYear:function(){gs.setUTCFullYear.apply(this._,arguments)},setHours:function(){gs.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){gs.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){gs.setUTCMinutes.apply(this._,arguments)},setMonth:function(){gs.setUTCMonth.apply(this._,arguments)},setSeconds:function(){gs.setUTCSeconds.apply(this._,arguments)},setTime:function(){gs.setTime.apply(this._,arguments)}};var gs=Date.prototype;ps.year=Vt(function(t){return t=ps.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),ps.years=ps.year.range,ps.years.utc=ps.year.utc.range,ps.day=Vt(function(t){var e=new ms(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),ps.days=ps.day.range,ps.days.utc=ps.day.utc.range,ps.dayOfYear=function(t){var e=ps.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=ps[t]=Vt(function(t){return(t=ps.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});ps[t+"s"]=n.range,ps[t+"s"].utc=n.utc.range,ps[t+"OfYear"]=function(t){var n=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(n+e)%7)/7)}}),ps.week=ps.sunday,ps.weeks=ps.sunday.range,ps.weeks.utc=ps.sunday.utc.range,ps.weekOfYear=ps.sundayOfYear;var vs={"-":"",_:" ",0:"0"},ys=/^\s*\d+/,xs=/^%/;uo.locale=function(t){return{numberFormat:Nt(t),timeFormat:Ht(t)}};var _s=uo.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"]});uo.format=_s.numberFormat,uo.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,bs),he(bs.s,this.s,this),this.s?this.t+=bs.t:this.s=bs.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var bs=new fe;uo.geo.stream=function(t,e){t&&ws.hasOwnProperty(t.type)?ws[t.type](t,e):de(t,e)};var ws={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rd&&(d=e)}function e(e,n){var r=ve([e*Uo,n*Uo]);if(v){var i=xe(v,r),a=[i[1],-i[0],0],o=xe(a,i);we(o),o=Me(o);var l=e-p,u=l>0?1:-1,m=o[0]*Ho*u,g=_o(l)>180;if(g^(u*pd&&(d=y)}else if(m=(m+360)%360-180,g^(u*pd&&(d=n);g?es(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e):h>=c?(eh&&(h=e)):e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,n);v=r,p=e}function n(){b.point=e}function r(){_[0]=c,_[1]=h,b.point=t,v=null}function i(t,n){if(v){var r=t-p;y+=_o(r)>180?r+(r>0?360:-360):r}else m=t,g=n;Ss.point(t,n),e(t,n)}function a(){Ss.lineStart()}function o(){i(m,g),Ss.lineEnd(),_o(y)>Ro&&(c=-(h=180)),_[0]=c,_[1]=h,v=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tRo?d=90:y<-Ro&&(f=-90),_[0]=c,_[1]=h}};return function(t){d=h=-(c=f=1/0),x=[],uo.geo.stream(t,b);var e=x.length;if(e){x.sort(l);for(var n,r=1,i=x[0],a=[i];rs(i[0],i[1])&&(i[1]=n[1]),s(n[0],i[1])>s(i[0],i[1])&&(i[0]=n[0])):a.push(i=n);for(var o,n,p=-(1/0),e=a.length-1,r=0,i=a[e];r<=e;i=n,++r)n=a[r],(o=s(i[1],n[0]))>p&&(p=o,c=n[0],h=i[1])}return x=_=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){Ts=zs=Es=Ls=Is=Ds=Ps=Cs=Os=Fs=Rs=0,uo.geo.stream(t,js);var e=Os,n=Fs,r=Rs,i=e*e+n*n+r*r;return i=.12&&i<.234&&r>=-.425&&r<-.214?o:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:a).invert(t)},t.stream=function(t){var e=a.stream(t),n=o.stream(t),r=s.stream(t);return{point:function(t,i){e.point(t,i),n.point(t,i),r.point(t,i)},sphere:function(){e.sphere(),n.sphere(),r.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},t.precision=function(e){return arguments.length?(a.precision(e),o.precision(e),s.precision(e),t):a.precision()},t.scale=function(e){return arguments.length?(a.scale(e),o.scale(.35*e),s.scale(e),t.translate(a.translate())):a.scale()},t.translate=function(e){if(!arguments.length)return a.translate();var u=a.scale(),c=+e[0],f=+e[1];return n=a.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,r=o.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+Ro,f+.12*u+Ro],[c-.214*u-Ro,f+.234*u-Ro]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+Ro,f+.166*u+Ro],[c-.115*u-Ro,f+.234*u-Ro]]).stream(l).point,t},t.scale(1070)};var qs,Vs,Us,Hs,Zs,Gs,Xs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Vs=0,Xs.lineStart=Ye},polygonEnd:function(){Xs.lineStart=Xs.lineEnd=Xs.point=M,qs+=_o(Vs/2)}},Ys={point:We,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Ws={point:$e,lineStart:Ke,lineEnd:tn,polygonStart:function(){Ws.lineStart=en},polygonEnd:function(){Ws.point=$e,Ws.lineStart=Ke,Ws.lineEnd=tn}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),uo.geo.stream(t,o)),a.result()}function e(){return o=null,t}var n,r,i,a,o,s=4.5;return t.area=function(t){return qs=0,uo.geo.stream(t,i(Xs)),qs},t.centroid=function(t){return Es=Ls=Is=Ds=Ps=Cs=Os=Fs=Rs=0,uo.geo.stream(t,i(Ws)),Rs?[Os/Rs,Fs/Rs]:Cs?[Ds/Cs,Ps/Cs]:Is?[Es/Is,Ls/Is]:[NaN,NaN]},t.bounds=function(t){return Zs=Gs=-(Us=Hs=1/0),uo.geo.stream(t,i(Ys)),[[Us,Hs],[Zs,Gs]]},t.projection=function(t){return arguments.length?(i=(n=t)?t.stream||an(t):_,e()):n},t.context=function(t){return arguments.length?(a=null==(r=t)?new Qe:new nn(t),"function"!=typeof s&&a.pointRadius(s),e()):r},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(a.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var n=new on(e);for(var r in t)n[r]=t[r];return n}}},on.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()}},uo.geo.projection=ln,uo.geo.projectionMutator=un,(uo.geo.equirectangular=function(){return ln(fn)}).raw=fn.invert=fn,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*Uo,e[1]*Uo),e[0]*=Ho,e[1]*=Ho,e}return t=dn(t[0]%360*Uo,t[1]*Uo,t.length>2?t[2]*Uo:0),e.invert=function(e){return e=t.invert(e[0]*Uo,e[1]*Uo),e[0]*=Ho,e[1]*=Ho,e},e},hn.invert=fn,uo.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,e=dn(-t[0]*Uo,-t[1]*Uo,0).invert,i=[];return n(null,null,1,{point:function(t,n){i.push(t=e(t,n)),t[0]*=Ho,t[1]*=Ho}}),{type:"Polygon",coordinates:[i]}}var e,n,r=[0,0],i=6;return t.origin=function(e){return arguments.length?(r=e,t):r},t.angle=function(r){return arguments.length?(n=vn((e=+r)*Uo,i*Uo),t):e},t.precision=function(r){return arguments.length?(n=vn(e*Uo,(i=+r)*Uo),t):i},t.angle(90)},uo.geo.distance=function(t,e){var n,r=(e[0]-t[0])*Uo,i=t[1]*Uo,a=e[1]*Uo,o=Math.sin(r),s=Math.cos(r),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((n=f*o)*n+(n=u*c-l*f*s)*n),l*c+u*f*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/g)*g,i,g).map(h).concat(uo.range(Math.ceil(u/v)*v,l,v).map(d)).concat(uo.range(Math.ceil(r/p)*p,n,p).filter(function(t){return _o(t%g)>Ro}).map(c)).concat(uo.range(Math.ceil(s/m)*m,o,m).filter(function(t){return _o(t%v)>Ro}).map(f))}var n,r,i,a,o,s,l,u,c,f,h,d,p=10,m=p,g=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[h(a).concat(d(l).slice(1),h(i).reverse().slice(1),d(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(a=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],a>i&&(e=a,a=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[a,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[r,s],[n,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],t):[g,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],m=+e[1],t):[p,m]},t.precision=function(e){return arguments.length?(y=+e,c=xn(s,o,90),f=_n(r,n,y),h=xn(u,l,90),d=_n(a,i,y),t):y},t.majorExtent([[-180,-90+Ro],[180,90-Ro]]).minorExtent([[-180,-80-Ro],[180,80+Ro]])},uo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||r.apply(this,arguments),n||i.apply(this,arguments)]}}var e,n,r=bn,i=wn;return t.distance=function(){return uo.geo.distance(e||r.apply(this,arguments),n||i.apply(this,arguments))},t.source=function(n){return arguments.length?(r=n,e="function"==typeof n?null:n,t):r},t.target=function(e){return arguments.length?(i=e,n="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},uo.geo.interpolate=function(t,e){return Mn(t[0]*Uo,t[1]*Uo,e[0]*Uo,e[1]*Uo)},uo.geo.length=function(t){return Qs=0,uo.geo.stream(t,Js),Qs};var Qs,Js={sphere:M,point:M,lineStart:kn,lineEnd:M,polygonStart:M,polygonEnd:M},$s=An(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return ln($s)}).raw=$s;var Ks=An(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},_);(uo.geo.azimuthalEquidistant=function(){return ln(Ks)}).raw=Ks,(uo.geo.conicConformal=function(){return Ge(Sn)}).raw=Sn,(uo.geo.conicEquidistant=function(){return Ge(Tn)}).raw=Tn;var tl=An(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return ln(tl)}).raw=tl,zn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return En(zn)}).raw=zn;var el=An(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return ln(el)}).raw=el;var nl=An(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return ln(nl)}).raw=nl,Ln.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Vo]},(uo.geo.transverseMercator=function(){var t=En(Ln),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(), -[t[1],-t[0]])},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):(t=n(),[t[0],t[1],t[2]-90])},n([0,0,90])}).raw=Ln,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=zt(n),a=zt(r),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e=r&&u.x<=a&&u.y>=i&&u.y<=o?[[r,o],[a,o],[a,i],[r,i]]:[];c.point=t[s]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/Ro)*Ro,y:Math.round(o(t,e)/Ro)*Ro,i:e}})}var r=In,i=Dn,a=r,o=i,s=fl;return t?e(t):(e.links=function(t){return ur(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return ur(n(t)).cells.forEach(function(n,r){for(var i,a,o=n.site,s=n.edges.sort(Xn),l=-1,u=s.length,c=s[u-1].edge,f=c.l===o?c.r:c.l;++l=u,h=r>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pr()),f?i=u:s=u,h?o=c:l=c,a(t,e,n,r,i,o,s,l)}var c,f,h,d,p,m,g,v,y,x=zt(s),_=zt(l);if(null!=e)m=e,g=n,v=r,y=i;else if(v=y=-(m=g=1/0),f=[],h=[],p=t.length,o)for(d=0;dv&&(v=c.x),c.y>y&&(y=c.y),f.push(c.x),h.push(c.y);else for(d=0;dv&&(v=b),w>y&&(y=w),f.push(b),h.push(w)}var M=v-m,k=y-g;M>k?y=g+M:v=m+k;var A=pr();if(A.add=function(t){a(A,t,+x(t,++d),+_(t,d),m,g,v,y)},A.visit=function(t){mr(t,A,m,g,v,y)},A.find=function(t){return gr(A,t[0],t[1],m,g,v,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=ml.get(n)||pl,r=gl.get(r)||_,Mr(r(n.apply(null,co.call(arguments,1))))},uo.interpolateHcl=Fr,uo.interpolateHsl=Rr,uo.interpolateLab=jr,uo.interpolateRound=Nr,uo.transform=function(t){var e=ho.createElementNS(uo.ns.prefix.svg,"g");return(uo.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new Br(n?n.matrix:vl)})(t)},Br.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var vl={a:1,b:0,c:0,d:1,e:0,f:0};uo.interpolateTransform=Wr,uo.layout={},uo.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++n0?i=t:(n.c=null,n.t=NaN,n=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),n=Pt(l.tick)),l):i},l.start=function(){function t(t,r){if(!n){for(n=new Array(i),l=0;l=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;r&&(a.value=0),a.children=u}else r&&(a.value=+r.call(t,a,a.depth)||0),delete a.children;return li(i,function(t){var n,i;e&&(n=t.children)&&n.sort(e),r&&(i=t.parent)&&(i.value+=t.value)}),s}var e=fi,n=ui,r=ci;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(r=e,t):r},t.revalue=function(e){return r&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},uo.layout.partition=function(){function t(e,n,r,i){var a=e.children;if(e.x=n,e.y=e.depth*i,e.dx=r,e.dy=i,a&&(o=a.length)){var o,s,l,u=-1;for(r=e.value?r/e.value:0;++us&&(s=r),o.push(r)}for(n=0;n0)for(a=-1;++a=c[0]&&s<=c[1]&&(o=l[uo.bisect(f,s,1,d)-1],o.y+=p,o.push(t[a]));return l}var e=!0,n=Number,r=Mi,i=bi;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(r=zt(e),t):r},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:zt(e),t):i},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},uo.layout.pack=function(){function t(t,a){var o=n.call(this,t,a),s=o[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,zi),r){var f=r*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=f}),li(s,zi),li(s,function(t){t.r-=f})}return Ii(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),o}var e,n=uo.layout.hierarchy().sort(ki),r=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(n){return arguments.length?(e=null==n||"function"==typeof n?n:+n,t):e},t.padding=function(e){return arguments.length?(r=+e,t):r},oi(t,n)},uo.layout.tree=function(){function t(t,i){var c=o.call(this,t,i),f=c[0],h=e(f);if(li(h,n),h.parent.m=-h.z,si(h,r),u)si(f,a);else{var d=f,p=f,m=f;si(f,function(t){t.xp.x&&(p=t),t.depth>m.depth&&(m=t)});var g=s(d,p)/2-d.x,v=l[0]/(p.x+s(p,d)/2+g),y=l[1]/(m.depth||1);si(f,function(t){t.x=(t.x+g)*v,t.y=t.depth*y})}return c}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var i,a=e.children,o=0,s=a.length;o0&&(Fi(ji(o,t,n),t,r),u+=r,c+=r),f+=o.m,u+=i.m,h+=l.m,c+=a.m;o&&!Oi(a)&&(a.t=o,a.m+=f-c),i&&!Ci(l)&&(l.t=i,l.m+=u-h,n=t)}return n}function a(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Pi,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?a:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:a,t):u?l:null},oi(t,o)},uo.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=Bi(e),t.y=Ni(e)):(t.x=o?u+=n(t,o):0,t.y=0,o=t)});var c=qi(l),f=Vi(l),h=c.x-n(c,f)/2,d=f.x+n(f,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*r[0],t.y=(l.y-t.y)*r[1]}:function(t){t.x=(t.x-h)/(d-h)*r[0],t.y=(1-(l.y?t.y/l.y:1))*r[1]}),s}var e=uo.layout.hierarchy().sort(null).value(null),n=Pi,r=[1,1],i=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(i=null==(r=e),t):i?null:r},t.nodeSize=function(e){return arguments.length?(i=null!=(r=e),t):i?r:null},oi(t,e)},uo.layout.treemap=function(){function t(t,e){for(var n,r,i=-1,a=t.length;++i0;)c.push(o=h[l-1]),c.area+=o.area,"squarify"!==d||(s=r(c,m))<=p?(h.pop(),p=s):(c.area-=c.pop().area,i(c,m,u,!1),m=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,m,u,!0),c.length=c.area=0),a.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var a,o=f(e),s=r.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(i(l,a.z?o.dx:o.dy,o,!s.length),l.length=l.area=0);r.forEach(n)}}function r(t,e){for(var n,r=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=n));return r*=r,e*=e,r?Math.max(e*i*p/r,r/(e*a*p)):1/0}function i(t,e,n,r){var i,a=-1,o=t.length,s=n.x,u=n.y,c=e?l(t.area/e):0;if(e==n.dx){for((r||c>n.dy)&&(c=n.dy);++an.dx)&&(c=n.dx);++a1);return t+e*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=uo.random.normal.apply(uo,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=uo.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;nf?0:1;if(u=qo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,m,g,v,y,x,_,b,w,M,k,A,S=0,T=0,z=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=a===Dl?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(T*=-1),u&&(T=rt(g/u*Math.sin(v))),t&&(S=rt(g/t*Math.sin(v)))),u){y=u*Math.cos(c+T),x=u*Math.sin(c+T),_=u*Math.cos(f-T),b=u*Math.sin(f-T);var E=Math.abs(f-c-2*T)<=No?0:1;if(T&&xa(y,x,_,b)===d^E){var L=(c+f)/2;y=u*Math.cos(L),x=u*Math.sin(L),_=b=null}}else y=x=0;if(t){w=t*Math.cos(f-S),M=t*Math.sin(f-S),k=t*Math.cos(c+S),A=t*Math.sin(c+S);var I=Math.abs(c-f+2*S)<=No?0:1;if(S&&xa(w,M,k,A)===1-d^I){var D=(c+f)/2;w=t*Math.cos(D),M=t*Math.sin(D),k=A=null}}else w=M=0;if(h>Ro&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){m=tNo)+",1 "+e}function i(t,e,n,r){return"Q 0,0 "+r}var a=bn,o=wn,s=Ha,l=ga,u=va;return t.radius=function(e){return arguments.length?(s=zt(e),t):s},t.source=function(e){return arguments.length?(a=zt(e),t):a},t.target=function(e){return arguments.length?(o=zt(e),t):o},t.startAngle=function(e){return arguments.length?(l=zt(e),t):l},t.endAngle=function(e){return arguments.length?(u=zt(e),t):u},t},uo.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=n.call(this,t,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return l=l.map(r),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=bn,n=wn,r=Za;return t.source=function(n){return arguments.length?(e=zt(n),t):e},t.target=function(e){return arguments.length?(n=zt(e),t):n},t.projection=function(e){return arguments.length?(r=e,t):r},t},uo.svg.diagonal.radial=function(){var t=uo.svg.diagonal(),e=Za,n=t.projection;return t.projection=function(t){return arguments.length?n(Ga(e=t)):e},t},uo.svg.symbol=function(){function t(t,r){return(Rl.get(e.call(this,t,r))||Wa)(n.call(this,t,r))}var e=Ya,n=Xa;return t.type=function(n){return arguments.length?(e=zt(n),t):e},t.size=function(e){return arguments.length?(n=zt(e),t):n},t};var Rl=uo.map({circle:Wa,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*Nl)),n=e*Nl;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",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/jl),n=e*jl/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/jl),n=e*jl/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});uo.svg.symbolTypes=Rl.keys();var jl=Math.sqrt(3),Nl=Math.tan(30*Uo);Eo.transition=function(t){for(var e,n,r=Bl||++Hl,i=to(t),a=[],o=ql||{time:Date.now(),ease:zr,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",f[1]-f[0])}function i(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function a(){function a(){32==uo.event.keyCode&&(E||(x=null,I[0]-=f[1],I[1]-=h[1],E=2),S())}function m(){32==uo.event.keyCode&&2==E&&(I[0]+=f[1],I[1]+=h[1],E=0,S())}function g(){var t=uo.mouse(b),r=!1;_&&(t[0]+=_[0],t[1]+=_[1]),E||(uo.event.altKey?(x||(x=[(f[0]+f[1])/2,(h[0]+h[1])/2]),I[0]=f[+(t[0]80*n){u=h=t[0],c=d=t[1];for(var v=n;vh&&(h=p),m>d&&(d=m);g=Math.max(h-u,d-c)}return o(s,l,n,u,c,g),l}function i(t,e,n,r,i){var a,o;if(i===I(t,e,n,r)>0)for(a=e;a=e;a-=r)o=z(a,t[a],t[a+1],o);return o&&w(o,o.next)&&(E(o),o=o.next),o}function a(t,e){if(!t)return t;e||(e=t);var n,r=t;do if(n=!1,r.steiner||!w(r,r.next)&&0!==b(r.prev,r,r.next))r=r.next;else{if(E(r),r=e=r.prev,r===r.next)return null;n=!0}while(n||r!==e);return e}function o(t,e,n,r,i,f,h){if(t){!h&&f&&m(t,r,i,f);for(var d,p,g=t;t.prev!==t.next;)if(d=t.prev,p=t.next,f?l(t,r,i,f):s(t))e.push(d.i/n),e.push(t.i/n),e.push(p.i/n),E(t),t=p.next,g=p.next;else if(t=p,t===g){h?1===h?(t=u(t,e,n),o(t,e,n,r,i,f,2)):2===h&&c(t,e,n,r,i,f):o(a(t),e,n,r,i,f,1);break}}}function s(t){var e=t.prev,n=t,r=t.next;if(b(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(x(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&b(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function l(t,e,n,r){var i=t.prev,a=t,o=t.next;if(b(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,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,f=v(s,l,e,n,r),h=v(u,c,e,n,r),d=t.nextZ;d&&d.z<=h;){if(d!==t.prev&&d!==t.next&&x(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&b(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=f;){if(d!==t.prev&&d!==t.next&&x(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&b(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function u(t,e,n){var r=t;do{var i=r.prev,a=r.next.next;!w(i,a)&&M(i,r,r.next,a)&&A(i,a)&&A(a,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(a.i/n),E(r),E(r.next),r=t=a),r=r.next}while(r!==t);return r}function c(t,e,n,r,i,s){var l=t;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&_(l,u)){var c=T(l,u);return l=a(l,l.next),c=a(c,c.next),o(l,e,n,r,i,s),void o(c,e,n,r,i,s)}u=u.next}l=l.next}while(l!==t)}function f(t,e,n,r){var o,s,l,u,c,f=[];for(o=0,s=e.length;o=r.next.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x=r.x&&r.x>=c&&x(an.x)&&A(r,t)&&(n=r,h=l)),r=r.next;return n}function m(t,e,n,r){var i=t;do null===i.z&&(i.z=v(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,g(i)}function g(t){var e,n,r,i,a,o,s,l,u=1;do{for(n=t,t=null,a=null,o=0;n;){for(o++,r=n,s=0,e=0;e0||l>0&&r;)0===s?(i=r,r=r.nextZ,l--):0!==l&&r?n.z<=r.z?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--):(i=n,n=n.nextZ,s--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;n=r}a.nextZ=null,u*=2}while(o>1);return t}function v(t,e,n,r,i){return t=32767*(t-n)/i,e=32767*(e-r)/i,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function y(t){var e=t,n=t;do e.x=0&&(t-o)*(r-s)-(n-o)*(e-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function _(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!k(t,e)&&A(t,e)&&A(e,t)&&S(t,e)}function b(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function w(t,e){return t.x===e.x&&t.y===e.y}function M(t,e,n,r){return!!(w(t,e)&&w(n,r)||w(t,r)&&w(n,e))||b(t,e,n)>0!=b(t,e,r)>0&&b(n,r,t)>0!=b(n,r,e)>0}function k(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&M(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function A(t,e){return b(t.prev,t,t.next)<0?b(t,e,t.next)>=0&&b(t,t.prev,e)>=0:b(t,e,t.prev)<0||b(t,t.next,e)<0}function S(t,e){var n=t,r=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do n.y>a!=n.next.y>a&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function T(t,e){var n=new L(t.i,t.x,t.y),r=new L(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function z(t,e,n,r){var i=new L(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function E(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 L(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function I(t,e,n,r){for(var i=0,a=e,o=n-r;a0&&(r+=t[i-1].length,n.holes.push(r))}return n}},{}],10:[function(e,n,r){(function(i,a){!function(e,i){"object"==typeof r&&"undefined"!=typeof n?n.exports=i():"function"==typeof t&&t.amd?t(i):e.ES6Promise=i()}(this,function(){"use strict";function t(t){return"function"==typeof t||"object"==typeof t&&null!==t}function n(t){return"function"==typeof t}function r(t){W=t}function o(t){Q=t}function s(){return function(){return i.nextTick(h)}}function l(){return function(){Y(h)}}function u(){var t=0,e=new K(h),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function c(){var t=new MessageChannel;return t.port1.onmessage=h,function(){return t.port2.postMessage(0)}}function f(){var t=setTimeout;return function(){return t(h,1)}}function h(){for(var t=0;t0&&this._events[t].length>n&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],a=n.length,r=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(n)){for(s=a;s-- >0;)if(n[s]===e||n[s].listener&&n[s].listener===e){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;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(n=this._events[t],i(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],12:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;r13)&&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}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return t-t<1}},{}],13:[function(t,e,n){"use strict";function r(t){return new Function("f","var p = (f && f.properties || {}); return "+i(t))}function i(t){if(!t)return"true";var e=t[0];if(t.length<=1)return"any"===e?"false":"true";var n="=="===e?o(t[1],t[2],"===",!1):"!="===e?o(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?o(t[1],t[2],e,!0):"any"===e?s(t.slice(1),"||"):"all"===e?s(t.slice(1),"&&"):"none"===e?c(s(t.slice(1),"||")):"in"===e?l(t[1],t.slice(2)):"!in"===e?c(l(t[1],t.slice(2))):"has"===e?u(t[1]):"!has"===e?c(u([t[1]])):"true";return"("+n+")"}function a(t){return"$type"===t?"f.type":"$id"===t?"f.id":"p["+JSON.stringify(t)+"]"}function o(t,e,n,r){var i=a(t),o="$type"===t?h.indexOf(e):JSON.stringify(e);return(r?"typeof "+i+"=== typeof "+o+"&&":"")+i+n+o}function s(t,e){return t.map(i).join(e)}function l(t,e){"$type"===t&&(e=e.map(function(t){return h.indexOf(t)}));var n=JSON.stringify(e.sort(f)),r=a(t);return e.length<=200?n+".indexOf("+r+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1; if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+r+", "+n+",0,"+(e.length-1)+")"}function u(t){return JSON.stringify(t)+" in p"}function c(t){return"!("+t+")"}function f(t,e){return te?1:0}e.exports=r;var h=["Unknown","Point","LineString","Polygon"]},{}],14:[function(t,e,n){function r(t){if("Polygon"===t.type)return i(t.coordinates);if("MultiPolygon"===t.type){for(var e=0,n=0;n0){e+=Math.abs(a(t[0]));for(var n=1;n2){for(var n,r,i=0;i=0}var u=t("geojson-area");e.exports=r},{"geojson-area":14}],16:[function(t,e,n){"use strict";function r(t,e,n,r,o,l,u,c){if(n/=e,r/=e,u>=n&&c<=r)return t;if(u>r||c=n&&p<=r)f.push(m);else if(!(d>r||p=e&&s<=n&&i.push(o)}return i}function a(t,e,n,r,i,a){for(var s=[],l=0;ln?(_.push(i(u,p,e),i(u,p,n)),a||(_=o(s,_,g,v,y))):d>=e&&_.push(i(u,p,e)):h>n?dn&&(_.push(i(u,p,n)),a||(_=o(s,_,g,v,y))));u=m[x-1],h=u[r],h>=e&&h<=n&&_.push(u),f=_[_.length-1],a&&f&&(_[0][0]!==f[0]||_[0][1]!==f[1])&&_.push(_[0]),o(s,_,g,v,y)}return s}function o(t,e,n,r,i){return e.length&&(e.area=n,e.dist=r,void 0!==i&&(e.outer=i),t.push(e)),[]}e.exports=r;var s=t("./feature")},{"./feature":18}],17:[function(t,e,n){"use strict";function r(t,e){var n=[];if("FeatureCollection"===t.type)for(var r=0;r=0;a--)if(o[a]!=s[a])return!1;for(a=o.length-1;a>=0;a--)if(i=o[a],!l(t[i],e[i]))return!1;return!0}function f(t,e){return!(!t||!e)&&("[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e||e.call({},t)===!0)}function h(t,e,n,r){var i;d.isString(n)&&(r=n,n=null);try{e()}catch(t){i=t}if(r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&o(i,n,"Missing expected exception"+r),!t&&f(i,n)&&o(i,n,"Got unwanted exception"+r),t&&i&&n&&!f(i,n)||!t&&i)throw i}var d=t("util/"),p=Array.prototype.slice,m=Object.prototype.hasOwnProperty,g=e.exports=s;g.AssertionError=function(t){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=a(this),this.generatedMessage=!0);var e=t.stackStartFunction||o;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var n=new Error;if(n.stack){var r=n.stack,i=e.name,s=r.indexOf("\n"+i);if(s>=0){var l=r.indexOf("\n",s+1);r=r.substring(l+1)}this.stack=r}}},d.inherits(g.AssertionError,Error),g.fail=o,g.ok=s,g.equal=function(t,e,n){t!=e&&o(t,e,n,"==",g.equal)},g.notEqual=function(t,e,n){t==e&&o(t,e,n,"!=",g.notEqual)},g.deepEqual=function(t,e,n){l(t,e)||o(t,e,n,"deepEqual",g.deepEqual)},g.notDeepEqual=function(t,e,n){l(t,e)&&o(t,e,n,"notDeepEqual",g.notDeepEqual)},g.strictEqual=function(t,e,n){t!==e&&o(t,e,n,"===",g.strictEqual)},g.notStrictEqual=function(t,e,n){t===e&&o(t,e,n,"!==",g.notStrictEqual)},g.throws=function(t,e,n){h.apply(this,[!0].concat(p.call(arguments)))},g.doesNotThrow=function(t,e){h.apply(this,[!1].concat(p.call(arguments)))},g.ifError=function(t){if(t)throw t};var v=Object.keys||function(t){var e=[];for(var n in t)m.call(t,n)&&e.push(n);return e}},{"util/":203}],7:[function(t,e,n){function r(t){return t=Math.round(t),t<0?0:t>255?255:t}function i(t){return t<0?0:t>1?1:t}function a(t){return r("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return i("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function s(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function l(t){var e=t.replace(/ /g,"").toLowerCase();if(e in u)return u[e].slice();if("#"===e[0]){if(4===e.length){var n=parseInt(e.substr(1),16);return n>=0&&n<=4095?[(3840&n)>>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,1]:null}if(7===e.length){var n=parseInt(e.substr(1),16);return n>=0&&n<=16777215?[(16711680&n)>>16,(65280&n)>>8,255&n,1]:null}return null}var i=e.indexOf("("),l=e.indexOf(")");if(i!==-1&&l+1===e.length){var c=e.substr(0,i),f=e.substr(i+1,l-(i+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:[a(f[0]),a(f[1]),a(f[2]),h];case"hsla":if(4!==f.length)return null;h=o(f.pop());case"hsl":if(3!==f.length)return null;var d=(parseFloat(f[0])%360+360)%360/360,p=o(f[1]),m=o(f[2]),g=m<=.5?m*(p+1):m+p-m*p,v=2*m-g;return[r(255*s(v,g,d+1/3)),r(255*s(v,g,d)),r(255*s(v,g,d-1/3)),h];default:return null}}return null}var u={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{n.parseCSSColor=l}catch(t){}},{}],8:[function(e,n,r){!function(){function e(t){return t&&(t.ownerDocument||t.document||t).documentElement}function r(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function i(t,e){return te?1:t>=e?0:NaN}function a(t){return null===t?NaN:+t}function o(t){return!isNaN(t)}function s(t){return{left:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);r>>1;t(e[a],n)<0?r=a+1:i=a}return r},right:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);r>>1;t(e[a],n)>0?i=a:r=a+1}return r}}}function l(t){return t.length}function u(t){for(var e=1;t*e%1;)e*=10;return e}function c(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function f(){this._=Object.create(null)}function h(t){return(t+="")===bo||t[0]===wo?wo+t:t}function d(t){return(t+="")[0]===wo?t.slice(1):t}function p(t){return h(t)in this._}function m(t){return(t=h(t))in this._&&delete this._[t]}function g(){var t=[];for(var e in this._)t.push(d(e));return t}function v(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function x(){this._=Object.create(null)}function _(t){return t}function b(t,e,n){return function(){var r=n.apply(e,arguments);return r===e?t:r}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,r=Mo.length;n=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Po.get(t);return u&&(t=u,l=Q),s?e?i:r:e?M:a}function W(t,e){return function(n){var r=uo.event;uo.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.event=r}}}function Q(t,e){var n=W(t,e);return function(t){var e=this,r=t.relatedTarget;r&&(r===e||8&r.compareDocumentPosition(e))||n.call(e,t)}}function J(t){var n=".dragsuppress-"+ ++Oo,i="click"+n,a=uo.select(r(t)).on("touchmove"+n,S).on("dragstart"+n,S).on("selectstart"+n,S);if(null==Co&&(Co=!("onselectstart"in t)&&w(t.style,"userSelect")),Co){var o=e(t).style,s=o[Co];o[Co]="none"}return function(t){if(a.on(n,null),Co&&(o[Co]=s),t){var e=function(){a.on(i,null)};a.on(i,function(){S(),e()},!0),setTimeout(e,0)}}}function $(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();if(Fo<0){var a=r(t);if(a.scrollX||a.scrollY){n=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=n[0][0].getScreenCTM();Fo=!(o.f||o.e),n.remove()}}return Fo?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function K(){return uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function nt(t){return t>1?0:t<-1?No:Math.acos(t)}function rt(t){return t>1?Vo:t<-1?-Vo:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function at(t){return((t=Math.exp(t))+1/t)/2}function ot(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ut(t,e,n){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):Mt(""+t,kt,ut):new ut(t,e,n)}function ct(t,e,n){function r(t){return t>360?t-=360:t<0&&(t+=360),t<60?a+(o-a)*t/60:t<180?o:t<240?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*r(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=n<0?0:n>1?1:n,o=n<=.5?n*(1+e):n+e-n*e,a=2*n-o,new xt(i(t+120),i(t),i(t-120))}function ft(t,e,n){return this instanceof ft?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof ft?new ft(t.h,t.c,t.l):t instanceof dt?mt(t.l,t.a,t.b):mt((t=At((t=uo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ft(t,e,n)}function ht(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(n,Math.cos(t*=Uo)*e,Math.sin(t)*e)}function dt(t,e,n){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof ft?ht(t.h,t.c,t.l):At((t=xt(t)).r,t.g,t.b):new dt(t,e,n)}function pt(t,e,n){var r=(t+16)/116,i=r+e/500,a=r-n/200;return i=gt(i)*ts,r=gt(r)*es,a=gt(a)*ns,new xt(yt(3.2404542*i-1.5371385*r-.4985314*a),yt(-.969266*i+1.8760108*r+.041556*a),yt(.0556434*i-.2040259*r+1.0572252*a))}function mt(t,e,n){return t>0?new ft(Math.atan2(n,e)*Go,Math.sqrt(e*e+n*n),t):new ft(NaN,NaN,t)}function gt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function vt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function xt(t,e,n){return this instanceof xt?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof xt?new xt(t.r,t.g,t.b):Mt(""+t,xt,ct):new xt(t,e,n)}function _t(t){return new xt(t>>16,t>>8&255,255&t)}function bt(t){return _t(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(t,e,n){var r,i,a,o=0,s=0,l=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return n(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(Tt(i[0]),Tt(i[1]),Tt(i[2]))}return(a=as.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 kt(t,e,n){var r,i,a=Math.min(t/=255,e/=255,n/=255),o=Math.max(t,e,n),s=o-a,l=(o+a)/2;return s?(i=l<.5?s/(o+a):s/(2-o-a),r=t==o?(e-n)/s+(e0&&l<1?0:r),new ut(r,i,l)}function At(t,e,n){t=St(t),e=St(e),n=St(n);var r=vt((.4124564*t+.3575761*e+.1804375*n)/ts),i=vt((.2126729*t+.7151522*e+.072175*n)/es),a=vt((.0193339*t+.119192*e+.9503041*n)/ns);return dt(116*i-16,500*(r-i),200*(i-a))}function St(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Tt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function zt(t){return"function"==typeof t?t:function(){return t}}function Et(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),Lt(e,n,t,r)}}function Lt(t,e,n,r){function i(){var t,e=l.status;if(!e&&Dt(l)||e>=200&&e<300||304===e){try{t=n.call(a,l)}catch(t){return void o.error.call(a,t)}o.load.call(a,t)}else o.error.call(a,l)}var a={},o=uo.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=uo.event;uo.event=t;try{o.progress.call(a,l)}finally{uo.event=e}},a.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",a)},a.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",a):e},a.responseType=function(t){return arguments.length?(u=t,a):u},a.response=function(t){return n=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(fo(arguments)))}}),a.send=function(n,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),l.open(n,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=u&&(l.responseType=u),null!=i&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==r?null:r),a},a.abort=function(){return l.abort(),a},uo.rebind(a,o,"on"),null==r?a:a.get(It(r))}function It(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}function Dt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Pt(t,e,n){var r=arguments.length;r<2&&(e=0),r<3&&(n=Date.now());var i=n+e,a={c:t,t:i,n:null};return ss?ss.n=a:os=a,ss=a,ls||(us=clearTimeout(us),ls=1, +cs(Ct)),a}function Ct(){var t=Ot(),e=Ft()-t;e>24?(isFinite(e)&&(clearTimeout(us),us=setTimeout(Ct,e)),ls=0):(ls=1,cs(Ct))}function Ot(){for(var t=Date.now(),e=os;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ft(){for(var t,e=os,n=1/0;e;)e.c?(e.t8?function(t){return t/n}:function(t){return t*n},symbol:t}}function Nt(t){var e=t.decimal,n=t.thousands,r=t.grouping,i=t.currency,a=r&&n?function(t,e){for(var i=t.length,a=[],o=0,s=r[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=r[o=(o+1)%r.length];return a.reverse().join(n)}:_;return function(t){var n=hs.exec(t),r=n[1]||" ",o=n[2]||">",s=n[3]||"-",l=n[4]||"",u=n[5],c=+n[6],f=n[7],h=n[8],d=n[9],p=1,m="",g="",v=!1,y=!0;switch(h&&(h=+h.substring(1)),(u||"0"===r&&"="===o)&&(u=r="0",o="="),d){case"n":f=!0,d="g";break;case"%":p=100,g="%",d="f";break;case"p":p=100,g="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(m="0"+d.toLowerCase());case"c":y=!1;case"d":v=!0,h=0;break;case"s":p=-1,d="r"}"$"===l&&(m=i[0],g=i[1]),"r"!=d||h||(d="g"),null!=h&&("g"==d?h=Math.max(1,Math.min(21,h)):"e"!=d&&"f"!=d||(h=Math.max(0,Math.min(20,h)))),d=ds.get(d)||Bt;var x=u&&f;return function(t){var n=g;if(v&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=uo.formatPrefix(t,h);t=l.scale(t),n=l.symbol+g}else t*=p;t=d(t,h);var _,b,w=t.lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(_=t,b=""):(_=t.substring(0,M),b=t.substring(M))}else _=t.substring(0,w),b=e+t.substring(w+1);!u&&f&&(_=a(_,1/0));var k=m.length+_.length+b.length+(x?0:i.length),A=k"===o?A+i+t:"^"===o?A.substring(0,k>>=1)+i+t+A.substring(k):i+(x?t:A+t))+n}}}function Bt(t){return t+""}function qt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Vt(t,e,n){function r(e){var n=t(e),r=a(n,1);return e-n1)for(;o=u)return-1;if(i=e.charCodeAt(s++),37===i){if(o=e.charAt(s++),a=E[o in vs?e.charAt(s++):o],!a||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function r(t,e,n){w.lastIndex=0;var r=w.exec(e.slice(n));return r?(t.w=M.get(r[0].toLowerCase()),n+r[0].length):-1}function i(t,e,n){_.lastIndex=0;var r=_.exec(e.slice(n));return r?(t.w=b.get(r[0].toLowerCase()),n+r[0].length):-1}function a(t,e,n){S.lastIndex=0;var r=S.exec(e.slice(n));return r?(t.m=T.get(r[0].toLowerCase()),n+r[0].length):-1}function o(t,e,n){k.lastIndex=0;var r=k.exec(e.slice(n));return r?(t.m=A.get(r[0].toLowerCase()),n+r[0].length):-1}function s(t,e,r){return n(t,z.c.toString(),e,r)}function l(t,e,r){return n(t,z.x.toString(),e,r)}function u(t,e,r){return n(t,z.X.toString(),e,r)}function c(t,e,n){var r=x.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)}var f=t.dateTime,h=t.date,d=t.time,p=t.periods,m=t.days,g=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function n(t){try{ms=qt;var e=new ms;return e._=t,r(e)}finally{ms=Date}}var r=e(t);return n.parse=function(t){try{ms=qt;var e=r.parse(t);return e&&e._}finally{ms=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=ce;var x=uo.map(),_=Zt(m),b=Xt(m),w=Zt(g),M=Xt(g),k=Zt(v),A=Xt(v),S=Zt(y),T=Xt(y);p.forEach(function(t,e){x.set(t.toLowerCase(),e)});var z={a:function(t){return g[t.getDay()]},A:function(t){return m[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(f),d:function(t,e){return Ht(t.getDate(),e,2)},e:function(t,e){return Ht(t.getDate(),e,2)},H:function(t,e){return Ht(t.getHours(),e,2)},I:function(t,e){return Ht(t.getHours()%12||12,e,2)},j:function(t,e){return Ht(1+ps.dayOfYear(t),e,3)},L:function(t,e){return Ht(t.getMilliseconds(),e,3)},m:function(t,e){return Ht(t.getMonth()+1,e,2)},M:function(t,e){return Ht(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Ht(t.getSeconds(),e,2)},U:function(t,e){return Ht(ps.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ht(ps.mondayOfYear(t),e,2)},x:e(h),X:e(d),y:function(t,e){return Ht(t.getFullYear()%100,e,2)},Y:function(t,e){return Ht(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},E={a:r,A:i,b:a,B:o,c:s,d:ne,e:ne,H:ie,I:ie,j:re,L:se,m:ee,M:ae,p:c,S:oe,U:Wt,w:Yt,W:Qt,x:l,X:u,y:$t,Y:Jt,Z:Kt,"%":ue};return e}function Ht(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a68?1900:2e3)}function ee(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ne(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function re(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function ie(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ae(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function oe(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function se(t,e,n){ys.lastIndex=0;var r=ys.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function le(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=_o(e)/60|0,i=_o(e)%60;return n+Ht(r,"0",2)+Ht(i,"0",2)}function ue(t,e,n){xs.lastIndex=0;var r=xs.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function ce(t){for(var e=t.length,n=-1;++n=0?1:-1,s=o*n,l=Math.cos(e),u=Math.sin(e),c=a*u,f=i*l+c*Math.cos(s),h=c*o*Math.sin(s);As.add(Math.atan2(h,f)),r=t,i=l,a=u}var e,n,r,i,a;Ss.point=function(o,s){Ss.point=t,r=(e=o)*Uo,i=Math.cos(s=(n=s)*Uo/2+No/4),a=Math.sin(s)},Ss.lineEnd=function(){t(e,n)}}function ve(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 _e(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function be(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Me(t){return[Math.atan2(t[1],t[0]),rt(t[2])]}function ke(t,e){return _o(t[0]-e[0])=0;--s)i.point((f=c[s])[0],f[1])}else r(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);i.lineEnd()}}}function Pe(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r0){for(b||(a.polygonStart(),b=!0),a.lineStart();++o1&&2&e&&n.push(n.pop().concat(n.shift())),d.push(n.filter(Fe))}var d,p,m,g=e(a),v=i.invert(r[0],r[1]),y={point:o,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=f,y.lineEnd=h,d=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=l,y.lineEnd=u,d=uo.merge(d);var t=Ve(v,p);d.length?(b||(a.polygonStart(),b=!0),De(d,je,t,n,a)):t&&(b||(a.polygonStart(),b=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),b&&(a.polygonEnd(),b=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}},x=Re(),_=e(x),b=!1;return y}}function Fe(t){return t.length>1}function Re(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:M,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function je(t,e){return((t=t.x)[0]<0?t[1]-Vo-Ro:Vo-t[1])-((e=e.x)[0]<0?e[1]-Vo-Ro:Vo-e[1])}function Ne(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?No:-No,l=_o(a-n);_o(l-No)0?Vo:-Vo),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(a,r),e=0):i!==s&&l>=No&&(_o(n-i)Ro?Math.atan((Math.sin(e)*(a=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+r)/2}function qe(t,e,n,r){var i;if(null==t)i=n*Vo,r.point(-No,i),r.point(0,i),r.point(No,i),r.point(No,0),r.point(No,-i),r.point(0,-i),r.point(-No,-i),r.point(-No,0),r.point(-No,i);else if(_o(t[0]-e[0])>Ro){var a=t[0]=0?1:-1,M=w*b,k=M>No,A=p*x;if(As.add(Math.atan2(A*w*Math.sin(M),m*_+A*Math.cos(M))),a+=k?b+w*Bo:b,k^h>=n^v>=n){var S=xe(ve(f),ve(t));we(S);var T=xe(i,S);we(T);var z=(k^b>=0?-1:1)*rt(T[2]);(r>z||r===z&&(S[0]||S[1]))&&(o+=k^b>=0?1:-1)}if(!g++)break;h=v,p=x,m=_,f=t}}return(a<-Ro||aa}function n(t){var n,a,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],m=e(f,h),g=o?m?0:i(f,h):m?i(f+(f<0?No:-No),h):0;if(!n&&(u=l=m)&&t.lineStart(),m!==l&&(d=r(n,p),(ke(n,d)||ke(p,d))&&(p[0]+=Ro,p[1]+=Ro,m=e(p[0],p[1]))),m!==l)c=0,m?(t.lineStart(),d=r(p,n),t.point(d[0],d[1])):(d=r(n,p),t.point(d[0],d[1]),t.lineEnd()),n=d;else if(s&&n&&o^m){var v;g&a||!(v=r(p,n,!0))||(c=0,o?(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])))}!m||n&&ke(n,p)||t.point(p[0],p[1]),n=p,l=m,a=g},lineEnd:function(){l&&t.lineEnd(),n=null},clean:function(){return c|(u&&l)<<1}}}function r(t,e,n){var r=ve(t),i=ve(e),o=[1,0,0],s=xe(r,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!n&&t;var f=a*l/c,h=-a*u/c,d=xe(o,s),p=be(o,f),m=be(s,h);_e(p,m);var g=d,v=ye(p,g),y=ye(g,g),x=v*v-y*(ye(p,p)-1);if(!(x<0)){var _=Math.sqrt(x),b=be(g,(-v-_)/y);if(_e(b,p),b=Me(b),!n)return b;var w,M=t[0],k=e[0],A=t[1],S=e[1];k0^b[1]<(_o(b[0]-M)No^(M<=b[0]&&b[0]<=k)){var L=be(g,(-v+_)/y);return _e(L,p),[b,Me(L)]}}}function i(e,n){var r=o?t:No-t,i=0;return e<-r?i|=1:e>r&&(i|=2),n<-r?i|=4:n>r&&(i|=8),i}var a=Math.cos(t),o=a>0,s=_o(a)>Ro,l=vn(t,6*Uo);return Oe(e,n,l,o?[0,-t]:[-No,t-No])}function Ge(t,e,n,r){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=s.x,f=s.y,h=0,d=1,p=c-l,m=f-u;if(a=t-l,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=n-l,p||!(a<0)){if(a/=p,p<0){if(a>d)return;a>h&&(h=a)}else if(p>0){if(a0)){if(a/=m,m<0){if(a0){if(a>d)return;a>h&&(h=a)}if(a=r-u,m||!(a<0)){if(a/=m,m<0){if(a>d)return;a>h&&(h=a)}else if(m>0){if(a0&&(i.a={x:l+h*p,y:u+h*m}),d<1&&(i.b={x:l+d*p,y:u+d*m}),i}}}}}}function He(t,e,n,r){function i(r,i){return _o(r[0]-t)0?0:3:_o(r[0]-n)0?2:1:_o(r[1]-e)0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(t,e){var n=i(t,1),r=i(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,n=g.length,r=t[1],i=0;ir&&et(u,a,t)>0&&++e:a[1]<=r&&et(u,a,t)<0&&--e,u=a;return 0!==e}function u(a,s,l,u){var c=0,f=0;if(null==a||(c=i(a,l))!==(f=i(s,l))||o(a,s)<0^l>0){do u.point(0===c||3===c?t:n,c>1?r:e);while((c=(c+l+4)%4)!==f)}else u.point(s[0],s[1])}function c(i,a){return t<=i&&i<=n&&e<=a&&a<=r}function f(t,e){c(t,e)&&s.point(t,e)}function h(){E.point=p,g&&g.push(v=[]),k=!0,M=!1,b=w=NaN}function d(){m&&(p(y,x),_&&M&&T.rejoin(),m.push(T.buffer())),E.point=f,M&&s.lineEnd()}function p(t,e){t=Math.max(-Bs,Math.min(Bs,t)),e=Math.max(-Bs,Math.min(Bs,e));var n=c(t,e);if(g&&v.push([t,e]),k)y=t,x=e,_=n,k=!1,n&&(s.lineStart(),s.point(t,e));else if(n&&M)s.point(t,e);else{var r={a:{x:b,y:w},b:{x:t,y:e}};z(r)?(M||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),n||s.lineEnd(),A=!1):n&&(s.lineStart(),s.point(t,e),A=!1)}b=t,w=e,M=n}var m,g,v,y,x,_,b,w,M,k,A,S=s,T=Re(),z=Ge(t,e,n,r),E={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=T,m=[],g=[],A=!0},polygonEnd:function(){s=S,m=uo.merge(m);var e=l([t,r]),n=A&&e,i=m.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&De(m,a,e,u,s),s.polygonEnd()),m=g=v=null}};return E}}function Ze(t){var e=0,n=No/3,r=un(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*No/180,n=t[1]*No/180):[e/No*180,n/No*180]},i}function Xe(t,e){function n(t,e){var n=Math.sqrt(a-2*i*Math.sin(e))/i;return[n*Math.sin(t*=i),o-n*Math.cos(t)]}var r=Math.sin(t),i=(r+Math.sin(e))/2,a=1+r*(2*i-r),o=Math.sqrt(a)/i;return n.invert=function(t,e){var n=o-e;return[Math.atan2(t,n)/i,rt((a-(t*t+n*n)*i*i)/(2*i))]},n}function Ye(){function t(t,e){Vs+=i*t-r*e,r=t,i=e}var e,n,r,i;Xs.point=function(a,o){Xs.point=t,e=r=a,n=i=o},Xs.lineEnd=function(){t(e,n)}}function We(t,e){tHs&&(Hs=t),eZs&&(Zs=e)}function Qe(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=n}function n(t,e){o.push("L",t,",",e)}function r(){s.point=t}function i(){o.push("Z")}var a=Je(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:r,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=r,s.point=t},pointRadius:function(t){return a=Je(t),s},result:function(){if(o.length){var t=o.join("");return o=[],t}}};return s}function Je(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $e(t,e){Es+=t,Ls+=e,++Is}function Ke(){function t(t,r){var i=t-e,a=r-n,o=Math.sqrt(i*i+a*a);Ds+=o*(e+t)/2,Ps+=o*(n+r)/2,Cs+=o,$e(e=t,n=r)}var e,n;Ws.point=function(r,i){Ws.point=t,$e(e=r,n=i)}}function tn(){Ws.point=$e}function en(){function t(t,e){var n=t-r,a=e-i,o=Math.sqrt(n*n+a*a);Ds+=o*(r+t)/2,Ps+=o*(i+e)/2,Cs+=o,o=i*t-r*e,Os+=o*(r+t),Fs+=o*(i+e),Rs+=3*o,$e(r=t,i=e)}var e,n,r,i;Ws.point=function(a,o){Ws.point=t,$e(e=r=a,n=i=o)},Ws.lineEnd=function(){t(e,n)}}function nn(t){function e(e,n){t.moveTo(e+o,n),t.arc(e,n,o,0,Bo)}function n(e,n){t.moveTo(e,n),s.point=r}function r(e,n){t.lineTo(e,n)}function i(){s.point=e}function a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=n},lineEnd:i,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return o=t,s},result:M};return s}function rn(t){function e(t){return(s?r:n)(t)}function n(e){return sn(e,function(n,r){n=t(n,r),e.point(n[0],n[1])})}function r(e){function n(n,r){n=t(n,r),e.point(n[0],n[1])}function r(){x=NaN,k.point=a,e.lineStart()}function a(n,r){var a=ve([n,r]),o=t(n,r);i(x,_,y,b,w,M,x=o[0],_=o[1],y=n,b=a[0],w=a[1],M=a[2],s,e),e.point(x,_)}function o(){k.point=n,e.lineEnd()}function l(){r(),k.point=u,k.lineEnd=c}function u(t,e){a(f=t,h=e),d=x,p=_,m=b,g=w,v=M,k.point=a}function c(){i(x,_,y,b,w,M,d,p,f,m,g,v,s,e),k.lineEnd=o,o()}var f,h,d,p,m,g,v,y,x,_,b,w,M,k={point:n,lineStart:r,lineEnd:o,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=r}};return k}function i(e,n,r,s,l,u,c,f,h,d,p,m,g,v){var y=c-e,x=f-n,_=y*y+x*x;if(_>4*a&&g--){var b=s+d,w=l+p,M=u+m,k=Math.sqrt(b*b+w*w+M*M),A=Math.asin(M/=k),S=_o(_o(M)-1)a||_o((y*L+x*I)/_-.5)>.3||s*d+l*p+u*m0&&16,e):Math.sqrt(a)},e}function an(t){var e=rn(function(e,n){return t([e*Go,n*Go])});return function(t){return cn(e(t))}}function on(t){this.stream=t}function sn(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 ln(t){return un(function(){return t})()}function un(t){function e(t){return t=s(t[0]*Uo,t[1]*Uo),[t[0]*h+l,u-t[1]*h]}function n(t){return t=s.invert((t[0]-l)/h,(u-t[1])/h),t&&[t[0]*Go,t[1]*Go]}function r(){s=Le(o=dn(v,y,x),a);var t=a(m,g);return l=d-t[0]*h,u=p+t[1]*h,i()}function i(){return c&&(c.valid=!1,c=null),e}var a,o,s,l,u,c,f=rn(function(t,e){return t=a(t,e),[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,m=0,g=0,v=0,y=0,x=0,b=Ns,w=_,M=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=cn(b(o,f(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(b=null==t?(M=t,Ns):Ue((M=+t)*Uo),i()):M},e.clipExtent=function(t){return arguments.length?(k=t,w=t?He(t[0][0],t[0][1],t[1][0],t[1][1]):_,i()):k},e.scale=function(t){return arguments.length?(h=+t,r()):h},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],r()):[d,p]},e.center=function(t){return arguments.length?(m=t[0]%360*Uo,g=t[1]%360*Uo,r()):[m*Go,g*Go]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Uo,y=t[1]%360*Uo,x=t.length>2?t[2]%360*Uo:0,r()):[v*Go,y*Go,x*Go]},uo.rebind(e,f,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&n,r()}}function cn(t){return sn(t,function(e,n){t.point(e*Uo,n*Uo)})}function fn(t,e){return[t,e]}function hn(t,e){return[t>No?t-Bo:t<-No?t+Bo:t,e]}function dn(t,e,n){return t?e||n?Le(mn(t),gn(e,n)):mn(t):e||n?gn(e,n):hn}function pn(t){return function(e,n){return e+=t,[e>No?e-Bo:e<-No?e+Bo:e,n]}}function mn(t){var e=pn(t);return e.invert=pn(-t),e}function gn(t,e){function n(t,e){var n=Math.cos(e),s=Math.cos(t)*n,l=Math.sin(t)*n,u=Math.sin(e),c=u*r+s*i;return[Math.atan2(l*a-c*o,s*r-u*i),rt(c*a+l*o)]}var r=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=Math.sin(e);return n.invert=function(t,e){var n=Math.cos(e),s=Math.cos(t)*n,l=Math.sin(t)*n,u=Math.sin(e),c=u*a-l*o;return[Math.atan2(l*a+u*o,s*r+c*i),rt(c*r-s*i)]},n}function vn(t,e){var n=Math.cos(t),r=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=yn(n,i),a=yn(n,a),(o>0?ia)&&(i+=o*Bo)):(i=t+o*Bo,a=t-.5*l);for(var u,c=i;o>0?c>a:c0?e<-Vo+Ro&&(e=-Vo+Ro):e>Vo-Ro&&(e=Vo-Ro);var n=o/Math.pow(i(e),a);return[n*Math.sin(a*t),o-n*Math.cos(a*t)]}var r=Math.cos(t),i=function(t){return Math.tan(No/4+t/2)},a=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(i(e)/i(t)),o=r*Math.pow(i(t),a)/a;return a?(n.invert=function(t,e){var n=o-e,r=tt(a)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/a,2*Math.atan(Math.pow(o/r,1/a))-Vo]},n):zn}function Tn(t,e){function n(t,e){var n=a-e;return[n*Math.sin(i*t),a-n*Math.cos(i*t)]}var r=Math.cos(t),i=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),a=r/i+t;return _o(i)1&&et(t[n[r-2]],t[n[r-1]],t[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}function Cn(t,e){return t[0]-e[0]||t[1]-e[1]}function On(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function Fn(t,e,n,r){var i=t[0],a=n[0],o=e[0]-i,s=r[0]-a,l=t[1],u=n[1],c=e[1]-l,f=r[1]-u,h=(s*(l-u)-f*(i-a))/(f*o-s*c);return[i+h*o,l+h*c]}function Rn(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function jn(){ar(this),this.edge=this.site=this.circle=null}function Nn(t){var e=ul.pop()||new jn;return e.site=t,e}function Bn(t){Qn(t),ol.remove(t),ul.push(t),ar(t)}function qn(t){var e=t.circle,n=e.x,r=e.cy,i={x:n,y:r},a=t.P,o=t.N,s=[t];Bn(t);for(var l=a;l.circle&&_o(n-l.circle.x)Ro)s=s.L;else{if(i=a-Gn(s,o),!(i>Ro)){r>-Ro?(e=s.P,n=s):i>-Ro?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}var l=Nn(t);if(ol.insert(e,l),e||n){if(e===n)return Qn(e),n=Nn(e.site),ol.insert(l,n),l.edge=n.edge=tr(e.site,l.site),Wn(e),void Wn(n);if(!n)return void(l.edge=tr(e.site,l.site));Qn(e),Qn(n);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=n.site,m=p.x-c,g=p.y-f,v=2*(h*g-d*m),y=h*h+d*d,x=m*m+g*g,_={x:(g*y-d*x)/v+c,y:(h*x-m*y)/v+f};nr(n.edge,u,p,_),l.edge=tr(u,t,null,_),n.edge=tr(t,p,null,_),Wn(e),Wn(n)}}function Un(t,e){var n=t.site,r=n.x,i=n.y,a=i-e;if(!a)return r;var o=t.P;if(!o)return-(1/0);n=o.site;var s=n.x,l=n.y,u=l-e;if(!u)return s;var c=s-r,f=1/a-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+i-a/2)))/f+r:(r+s)/2}function Gn(t,e){var n=t.N;if(n)return Un(n,e);var r=t.site;return r.y===e?r.x:1/0}function Hn(t){this.site=t,this.edges=[]}function Zn(t){for(var e,n,r,i,a,o,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],m=al,g=m.length;g--;)if(a=m[g],a&&a.prepare())for(s=a.edges,l=s.length,o=0;oRo||_o(i-n)>Ro)&&(s.splice(o,0,new rr(er(a.site,c,_o(r-f)Ro?{x:f,y:_o(e-f)Ro?{x:_o(n-p)Ro?{x:h,y:_o(e-h)Ro?{x:_o(n-d)=-jo)){var d=l*l+u*u,p=c*c+f*f,m=(f*d-u*p)/h,g=(l*p-c*d)/h,f=g+s,v=cl.pop()||new Yn;v.arc=t,v.site=i,v.x=m+o,v.y=f+Math.sqrt(m*m+g*g),v.cy=f,t.circle=v;for(var y=null,x=ll._;x;)if(v.y=s)return;if(h>p){if(a){if(a.y>=u)return}else a={x:g,y:l};n={x:g,y:u}}else{if(a){if(a.y1)if(h>p){if(a){if(a.y>=u)return}else a={x:(l-i)/r,y:l};n={x:(u-i)/r,y:u}}else{if(a){if(a.y=s)return}else a={x:o,y:r*o+i};n={x:s,y:r*s+i}}else{if(a){if(a.xa||f>o||h=_,M=n>=b,k=M<<1|w,A=k+4;ka&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,l.push({i:o,x:xr(n,r)})),a=dl.lastIndex;return a=0&&!(n=uo.interpolators[r](t,e)););return n}function wr(t,e){var n,r=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(n=0;n=1?1:t(e)}}function kr(t){return function(e){return 1-t(1-e)}}function Ar(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Sr(t){return t*t}function Tr(t){return t*t*t}function zr(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function Er(t){return function(e){return Math.pow(e,t)}}function Lr(t){return 1-Math.cos(t*Vo)}function Ir(t){return Math.pow(2,10*(t-1))}function Dr(t){return 1-Math.sqrt(1-t*t)}function Pr(t,e){var n;return arguments.length<2&&(e=.45),arguments.length?n=e/Bo*Math.asin(1/t):(t=1,n=e/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-n)*Bo/e)}}function Cr(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Or(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 Fr(t,e){t=uo.hcl(t),e=uo.hcl(e);var n=t.h,r=t.c,i=t.l,a=e.h-n,o=e.c-r,s=e.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?e.c:r),isNaN(a)?(a=0,n=isNaN(n)?e.h:n):a>180?a-=360:a<-180&&(a+=360),function(t){return ht(n+a*t,r+o*t,i+s*t)+""}}function Rr(t,e){t=uo.hsl(t),e=uo.hsl(e);var n=t.h,r=t.s,i=t.l,a=e.h-n,o=e.s-r,s=e.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?e.s:r),isNaN(a)?(a=0,n=isNaN(n)?e.h:n):a>180?a-=360:a<-180&&(a+=360),function(t){return ct(n+a*t,r+o*t,i+s*t)+""}}function jr(t,e){t=uo.lab(t),e=uo.lab(e);var n=t.l,r=t.a,i=t.b,a=e.l-n,o=e.a-r,s=e.b-i;return function(t){return pt(n+a*t,r+o*t,i+s*t)+""}}function Nr(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function Br(t){var e=[t.a,t.b],n=[t.c,t.d],r=Vr(e),i=qr(e,n),a=Vr(Ur(n,e,-i))||0;e[0]*n[1]180?e+=360:e-t>180&&(t+=360),r.push({i:n.push(Gr(n)+"rotate(",null,")")-2,x:xr(t,e)})):e&&n.push(Gr(n)+"rotate("+e+")")}function Xr(t,e,n,r){t!==e?r.push({i:n.push(Gr(n)+"skewX(",null,")")-2,x:xr(t,e)}):e&&n.push(Gr(n)+"skewX("+e+")")}function Yr(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var i=n.push(Gr(n)+"scale(",null,",",null,")");r.push({i:i-4,x:xr(t[0],e[0])},{i:i-2,x:xr(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(Gr(n)+"scale("+e+")")}function Wr(t,e){var n=[],r=[];return t=uo.transform(t),e=uo.transform(e),Hr(t.translate,e.translate,n,r),Zr(t.rotate,e.rotate,n,r),Xr(t.skew,e.skew,n,r),Yr(t.scale,e.scale,n,r),t=e=null,function(t){for(var e,i=-1,a=r.length;++i=0;)n.push(i[r])}function li(t,e){for(var n=[t],r=[];null!=(t=n.pop());)if(r.push(t),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++oi&&(r=n,i=e);return r}function xi(t){return t.reduce(_i,0)}function _i(t,e){return t+e[1]}function bi(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var n=-1,r=+t[0],i=(t[1]-r)/e,a=[];++n<=e;)a[n]=i*n+r;return a}function Mi(t){return[uo.min(t),uo.max(t)]}function ki(t,e){return t.value-e.value}function Ai(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Si(t,e){t._pack_next=e,e._pack_prev=t}function Ti(t,e){var n=e.x-t.x,r=e.y-t.y,i=t.r+e.r;return.999*i*i>n*n+r*r}function zi(t){function e(t){c=Math.min(t.x-t.r,c),f=Math.max(t.x+t.r,f),h=Math.min(t.y-t.r,h),d=Math.max(t.y+t.r,d)}if((n=t.children)&&(u=n.length)){var n,r,i,a,o,s,l,u,c=1/0,f=-(1/0),h=1/0,d=-(1/0);if(n.forEach(Ei),r=n[0],r.x=-r.r,r.y=0,e(r),u>1&&(i=n[1],i.x=i.r,i.y=0,e(i),u>2))for(a=n[2],Di(r,i,a),e(a),Ai(r,a),r._pack_prev=a,Ai(a,i),i=r._pack_next,o=3;o=0;)e=i[a],e.z+=n,e.m+=n,n+=e.s+(r+=e.c)}function ji(t,e,n){return t.a.parent===e.parent?t.a:n}function Ni(t){return 1+uo.max(t,function(t){return t.y})}function Bi(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function qi(t){var e=t.children;return e&&e.length?qi(e[0]):t}function Vi(t){var e,n=t.children;return n&&(e=n.length)?Vi(n[e-1]):t}function Ui(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Gi(t,e){var n=t.x+e[3],r=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(n+=i/2,i=0),a<0&&(r+=a/2,a=0),{x:n,y:r,dx:i,dy:a}}function Hi(t){var e=t[0],n=t[t.length-1];return e2?Qi:Xi,l=r?Jr:Qr;return o=i(t,e,l,n),s=i(e,t,l,br),a}function a(t){return o(t)}var o,s;return a.invert=function(t){return s(t)},a.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},a.range=function(t){return arguments.length?(e=t,i()):e},a.rangeRound=function(t){return a.range(t).interpolate(Nr)},a.clamp=function(t){return arguments.length?(r=t,i()):r},a.interpolate=function(t){return arguments.length?(n=t,i()):n},a.ticks=function(e){return ea(t,e)},a.tickFormat=function(e,n){return na(t,e,n)},a.nice=function(e){return Ki(t,e),i()},a.copy=function(){return Ji(t,e,n,r)},i()}function $i(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ki(t,e){return Yi(t,Wi(ta(t,e)[2])),Yi(t,Wi(ta(t,e)[2])),t}function ta(t,e){null==e&&(e=10);var n=Hi(t),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/e)/Math.LN10)),a=e/r*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+.5*i,n[2]=i,n}function ea(t,e){return uo.range.apply(uo,ta(t,e))}function na(t,e,n){var r=ta(t,e);if(n){var i=hs.exec(n);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(_o(r[0]),_o(r[1])));return i[7]||(i[7]="."+ra(a.scale(r[2]))),i[8]="f",n=uo.format(i.join("")),function(t){return n(a.scale(t))+a.symbol}}i[7]||(i[7]="."+ia(i[8],r)),n=i.join("")}else n=",."+ra(r[2])+"f";return uo.format(n)}function ra(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ia(t,e){var n=ra(e[2]);return t in Al?Math.abs(n-ra(Math.max(_o(e[0]),_o(e[1]))))+ +("e"!==t):n-2*("%"===t)}function aa(t,e,n,r){function i(t){return(n?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return n?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(i(e))}return o.invert=function(e){return a(t.invert(e))},o.domain=function(e){return arguments.length?(n=e[0]>=0,t.domain((r=e.map(Number)).map(i)),o):r},o.base=function(n){return arguments.length?(e=+n,t.domain(r.map(i)),o):e},o.nice=function(){var e=Yi(r.map(i),n?Math:Tl);return t.domain(e),r=e.map(a),o},o.ticks=function(){var t=Hi(r),o=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),f=e%1?2:e;if(isFinite(c-u)){if(n){for(;u0;h--)o.push(a(u)*h);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,n){if(!arguments.length)return Sl;arguments.length<2?n=Sl:"function"!=typeof n&&(n=uo.format(n));var r=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e0?s[n-1]:t[0],n0?0:1}function _a(t,e,n,r,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?r:-r)/Math.sqrt(a*a+o*o),l=s*o,u=-s*a,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,m=(f+d)/2,g=h-c,v=d-f,y=g*g+v*v,x=n-r,_=c*d-h*f,b=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-_*_)),w=(_*v-g*b)/y,M=(-_*g-v*b)/y,k=(_*v+g*b)/y,A=(-_*g+v*b)/y,S=w-p,T=M-m,z=k-p,E=A-m;return S*S+T*T>z*z+E*E&&(w=k,M=A),[[w-l,M-u],[w*n/x,M*n/x]]}function ba(t){function e(e){function o(){u.push("M",a(t(c),s))}for(var l,u=[],c=[],f=-1,h=e.length,d=zt(n),p=zt(r);++f1?t.join("L"):t+"Z"}function Ma(t){return t.join("L")+"Z"}function ka(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e1&&i.push("H",r[0]),i.join("")}function Aa(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e1){s=e[1],a=t[l],l++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var u=2;u9&&(i=3*e/Math.sqrt(i),o[s]=i*n,o[s+1]=i*r));for(s=-1;++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}function qa(t){return t.length<3?wa(t):t[0]+La(t,Ba(t))}function Va(t){for(var e,n,r,i=-1,a=t.length;++i0;)d[--s].call(t,o);if(a>=1)return m.event&&m.event.end.call(t,t.__data__,e),--p.count?delete p[r]:delete t[n],1}var l,u,c,h,d,p=t[n]||(t[n]={active:0,count:0}),m=p[r];m||(l=i.time,u=Pt(a,0,l),m=p[r]={tween:new f,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function no(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate("+(isFinite(r)?r:n(t))+",0)"})}function ro(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate(0,"+(isFinite(r)?r:n(t))+")"})}function io(t){return t.toISOString()}function ao(t,e,n){function r(e){return t(e)}function i(t,n){var r=t[1]-t[0],i=r/n,a=uo.bisect($l,i);return a==$l.length?[e.year,ta(t.map(function(t){return t/31536e6}),n)[2]]:a?e[i/$l[a-1]<$l[a]/i?a-1:a]:[eu,ta(t,n)[2]]}return r.invert=function(e){return oo(t.invert(e))},r.domain=function(e){return arguments.length?(t.domain(e),r):t.domain().map(oo)},r.nice=function(t,e){function n(n){return!isNaN(n)&&!t.range(n,oo(+n+1),e).length}var a=r.domain(),o=Hi(a),s=null==t?i(o,10):"number"==typeof t&&i(o,t);return s&&(t=s[0],e=s[1]),r.domain(Yi(a,e>1?{floor:function(e){for(;n(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},r.ticks=function(t,e){var n=Hi(r.domain()),a=null==t?i(n,10):"number"==typeof t?i(n,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(n[0],oo(+n[1]+1),e<1?1:e)},r.tickFormat=function(){return n},r.copy=function(){return ao(t.copy(),e,n)},$i(r,t)}function oo(t){return new Date(t)}function so(t){return JSON.parse(t.responseText)}function lo(t){var e=ho.createRange();return e.selectNode(ho.body),e.createContextualFragment(t.responseText)}var uo={version:"3.5.17"},co=[].slice,fo=function(t){return co.call(t)},ho=this.document;if(ho)try{fo(ho.documentElement.childNodes)[0].nodeType}catch(t){fo=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),ho)try{ho.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var po=this.Element.prototype,mo=po.setAttribute,go=po.setAttributeNS,vo=this.CSSStyleDeclaration.prototype,yo=vo.setProperty;po.setAttribute=function(t,e){mo.call(this,t,e+"")},po.setAttributeNS=function(t,e,n){go.call(this,t,e,n+"")},vo.setProperty=function(t,e,n){yo.call(this,t,e+"",n)}}uo.ascending=i,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.min=function(t,e){var n,r,i=-1,a=t.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++ir&&(n=r)}else{for(;++i=r){n=r;break}for(;++ir&&(n=r)}return n},uo.max=function(t,e){var n,r,i=-1,a=t.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++in&&(n=r)}else{for(;++i=r){n=r;break}for(;++in&&(n=r)}return n},uo.extent=function(t,e){var n,r,i,a=-1,o=t.length;if(1===arguments.length){for(;++a=r){n=i=r;break}for(;++ar&&(n=r),i=r){n=i=r;break}for(;++ar&&(n=r),i1)return l/(c-1)},uo.deviation=function(){var t=uo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var xo=s(i);uo.bisectLeft=xo.left,uo.bisect=uo.bisectRight=xo.right,uo.bisector=function(t){return s(1===t.length?function(e,n){return i(t(e),n)}:t)},uo.shuffle=function(t,e,n){(a=arguments.length)<3&&(n=t.length,a<2&&(e=0));for(var r,i,a=n-e;a;)i=Math.random()*a--|0,r=t[a+e],t[a+e]=t[i+e],t[i+e]=r;return t},uo.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r},uo.pairs=function(t){for(var e,n=0,r=t.length-1,i=t[0],a=new Array(r<0?0:r);n=0;)for(r=t[i],e=r.length;--e>=0;)n[--o]=r[e];return n};var _o=Math.abs;uo.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n===1/0)throw new Error("infinite range");var r,i=[],a=u(_o(n)),o=-1;if(t*=a,e*=a,n*=a,n<0)for(;(r=t+n*++o)>e;)i.push(r/a);else for(;(r=t+n*++o)=a.length)return r?r.call(i,o):n?o.sort(n):o;for(var l,u,c,h,d=-1,p=o.length,m=a[s++],g=new f;++d=a.length)return t;var r=[],i=o[n++];return t.forEach(function(t,i){r.push({key:t,values:e(i,n)})}),i?r.sort(function(t,e){return i(t.key,e.key)}):r}var n,r,i={},a=[],o=[];return i.map=function(e,n){return t(n,e,0)},i.entries=function(n){return e(t(uo.map,n,0),0)},i.key=function(t){return a.push(t),i},i.sortKeys=function(t){return o[a.length-1]=t,i},i.sortValues=function(t){return n=t,i},i.rollup=function(t){return r=t,i},i},uo.set=function(t){var e=new x;if(t)for(var n=0,r=t.length;n=0&&(r=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},uo.event=null,uo.requote=function(t){return t.replace(ko,"\\$&")};var ko=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ao={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},So=function(t,e){return e.querySelector(t)},To=function(t,e){return e.querySelectorAll(t)},zo=function(t,e){var n=t.matches||t[w(t,"matchesSelector")];return(zo=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(So=function(t,e){return Sizzle(t,e)[0]||null},To=Sizzle,zo=Sizzle.matchesSelector),uo.selection=function(){return uo.select(ho.documentElement)};var Eo=uo.selection.prototype=[];Eo.select=function(t){var e,n,r,i,a=[];t=L(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Io.hasOwnProperty(n)?{space:Io[n],local:t}:t}},Eo.attr=function(t,e){if(arguments.length<2){ +if("string"==typeof t){var n=this.node();return t=uo.ns.qualify(t),t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(D(e,t[e]));return this}return this.each(D(t,e))},Eo.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=O(t)).length,i=-1;if(e=n.classList){for(;++i=0;)(n=r[i])&&(a&&a!==n.nextSibling&&a.parentNode.insertBefore(n,a),a=n);return this},Eo.sort=function(t){t=G.apply(this,arguments);for(var e=-1,n=this.length;++e0&&(e=e.transition().duration(E)),e.call(t.event)}function s(){b&&b.domain(_.range().map(function(t){return(t-k.x)/k.k}).map(_.invert)),M&&M.domain(w.range().map(function(t){return(t-k.y)/k.k}).map(w.invert))}function l(t){L++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--L||(t({type:"zoomend"}),g=null)}function f(){function t(){s=1,a(uo.mouse(i),h),u(o)}function n(){f.on(D,null).on(P,null),d(s),c(o)}var i=this,o=O.of(i,arguments),s=0,f=uo.select(r(i)).on(D,t).on(P,n),h=e(uo.mouse(i)),d=J(i);Vl.call(i),l(o)}function h(){function t(){var t=uo.touches(p);return d=k.k,t.forEach(function(t){t.identifier in g&&(g[t.identifier]=e(t))}),t}function n(){var e=uo.event.target;uo.select(e).on(_,r).on(b,s),w.push(e);for(var n=uo.event.changedTouches,i=0,a=n.length;i1){var c=l[0],f=l[1],h=c[0]-f[0],d=c[1]-f[1];v=h*h+d*d}}function r(){var t,e,n,r,o=uo.touches(p);Vl.call(p);for(var s=0,l=o.length;s=u)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var n=e;n++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ds=uo.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=uo.round(t,Rt(t,e))).toFixed(Math.max(0,Math.min(20,Rt(t*(1+1e-15),e))))}}),ps=uo.time={},ms=Date;qt.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(){gs.setUTCDate.apply(this._,arguments)},setDay:function(){gs.setUTCDay.apply(this._,arguments)},setFullYear:function(){gs.setUTCFullYear.apply(this._,arguments)},setHours:function(){gs.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){gs.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){gs.setUTCMinutes.apply(this._,arguments)},setMonth:function(){gs.setUTCMonth.apply(this._,arguments)},setSeconds:function(){gs.setUTCSeconds.apply(this._,arguments)},setTime:function(){gs.setTime.apply(this._,arguments)}};var gs=Date.prototype;ps.year=Vt(function(t){return t=ps.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),ps.years=ps.year.range,ps.years.utc=ps.year.utc.range,ps.day=Vt(function(t){var e=new ms(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),ps.days=ps.day.range,ps.days.utc=ps.day.utc.range,ps.dayOfYear=function(t){var e=ps.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=ps[t]=Vt(function(t){return(t=ps.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});ps[t+"s"]=n.range,ps[t+"s"].utc=n.utc.range,ps[t+"OfYear"]=function(t){var n=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(n+e)%7)/7)}}),ps.week=ps.sunday,ps.weeks=ps.sunday.range,ps.weeks.utc=ps.sunday.utc.range,ps.weekOfYear=ps.sundayOfYear;var vs={"-":"",_:" ",0:"0"},ys=/^\s*\d+/,xs=/^%/;uo.locale=function(t){return{numberFormat:Nt(t),timeFormat:Gt(t)}};var _s=uo.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"]});uo.format=_s.numberFormat,uo.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,bs),he(bs.s,this.s,this),this.s?this.t+=bs.t:this.s=bs.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var bs=new fe;uo.geo.stream=function(t,e){t&&ws.hasOwnProperty(t.type)?ws[t.type](t,e):de(t,e)};var ws={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rd&&(d=e)}function e(e,n){var r=ve([e*Uo,n*Uo]);if(v){var i=xe(v,r),a=[i[1],-i[0],0],o=xe(a,i);we(o),o=Me(o);var l=e-p,u=l>0?1:-1,m=o[0]*Go*u,g=_o(l)>180;if(g^(u*pd&&(d=y)}else if(m=(m+360)%360-180,g^(u*pd&&(d=n);g?es(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e):h>=c?(eh&&(h=e)):e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,n);v=r,p=e}function n(){b.point=e}function r(){_[0]=c,_[1]=h,b.point=t,v=null}function i(t,n){if(v){var r=t-p;y+=_o(r)>180?r+(r>0?360:-360):r}else m=t,g=n;Ss.point(t,n),e(t,n)}function a(){Ss.lineStart()}function o(){i(m,g),Ss.lineEnd(),_o(y)>Ro&&(c=-(h=180)),_[0]=c,_[1]=h,v=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tRo?d=90:y<-Ro&&(f=-90),_[0]=c,_[1]=h}};return function(t){d=h=-(c=f=1/0),x=[],uo.geo.stream(t,b);var e=x.length;if(e){x.sort(l);for(var n,r=1,i=x[0],a=[i];rs(i[0],i[1])&&(i[1]=n[1]),s(n[0],i[1])>s(i[0],i[1])&&(i[0]=n[0])):a.push(i=n);for(var o,n,p=-(1/0),e=a.length-1,r=0,i=a[e];r<=e;i=n,++r)n=a[r],(o=s(i[1],n[0]))>p&&(p=o,c=n[0],h=i[1])}return x=_=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){Ts=zs=Es=Ls=Is=Ds=Ps=Cs=Os=Fs=Rs=0,uo.geo.stream(t,js);var e=Os,n=Fs,r=Rs,i=e*e+n*n+r*r;return i=.12&&i<.234&&r>=-.425&&r<-.214?o:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:a).invert(t)},t.stream=function(t){var e=a.stream(t),n=o.stream(t),r=s.stream(t);return{point:function(t,i){e.point(t,i),n.point(t,i),r.point(t,i)},sphere:function(){e.sphere(),n.sphere(),r.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},t.precision=function(e){return arguments.length?(a.precision(e),o.precision(e),s.precision(e),t):a.precision()},t.scale=function(e){return arguments.length?(a.scale(e),o.scale(.35*e),s.scale(e),t.translate(a.translate())):a.scale()},t.translate=function(e){if(!arguments.length)return a.translate();var u=a.scale(),c=+e[0],f=+e[1];return n=a.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,r=o.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+Ro,f+.12*u+Ro],[c-.214*u-Ro,f+.234*u-Ro]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+Ro,f+.166*u+Ro],[c-.115*u-Ro,f+.234*u-Ro]]).stream(l).point,t},t.scale(1070)};var qs,Vs,Us,Gs,Hs,Zs,Xs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Vs=0,Xs.lineStart=Ye},polygonEnd:function(){Xs.lineStart=Xs.lineEnd=Xs.point=M,qs+=_o(Vs/2)}},Ys={point:We,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Ws={point:$e,lineStart:Ke,lineEnd:tn,polygonStart:function(){Ws.lineStart=en},polygonEnd:function(){Ws.point=$e,Ws.lineStart=Ke,Ws.lineEnd=tn}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),uo.geo.stream(t,o)),a.result()}function e(){return o=null,t}var n,r,i,a,o,s=4.5;return t.area=function(t){return qs=0,uo.geo.stream(t,i(Xs)),qs},t.centroid=function(t){return Es=Ls=Is=Ds=Ps=Cs=Os=Fs=Rs=0,uo.geo.stream(t,i(Ws)),Rs?[Os/Rs,Fs/Rs]:Cs?[Ds/Cs,Ps/Cs]:Is?[Es/Is,Ls/Is]:[NaN,NaN]},t.bounds=function(t){return Hs=Zs=-(Us=Gs=1/0),uo.geo.stream(t,i(Ys)),[[Us,Gs],[Hs,Zs]]},t.projection=function(t){return arguments.length?(i=(n=t)?t.stream||an(t):_,e()):n},t.context=function(t){return arguments.length?(a=null==(r=t)?new Qe:new nn(t),"function"!=typeof s&&a.pointRadius(s),e()):r},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(a.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var n=new on(e);for(var r in t)n[r]=t[r];return n}}},on.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()}},uo.geo.projection=ln,uo.geo.projectionMutator=un,(uo.geo.equirectangular=function(){return ln(fn)}).raw=fn.invert=fn,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*Uo,e[1]*Uo),e[0]*=Go,e[1]*=Go,e}return t=dn(t[0]%360*Uo,t[1]*Uo,t.length>2?t[2]*Uo:0),e.invert=function(e){return e=t.invert(e[0]*Uo,e[1]*Uo),e[0]*=Go,e[1]*=Go,e},e},hn.invert=fn,uo.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,e=dn(-t[0]*Uo,-t[1]*Uo,0).invert,i=[];return n(null,null,1,{point:function(t,n){i.push(t=e(t,n)),t[0]*=Go,t[1]*=Go}}),{type:"Polygon",coordinates:[i]}}var e,n,r=[0,0],i=6;return t.origin=function(e){return arguments.length?(r=e,t):r},t.angle=function(r){return arguments.length?(n=vn((e=+r)*Uo,i*Uo),t):e},t.precision=function(r){return arguments.length?(n=vn(e*Uo,(i=+r)*Uo),t):i},t.angle(90)},uo.geo.distance=function(t,e){var n,r=(e[0]-t[0])*Uo,i=t[1]*Uo,a=e[1]*Uo,o=Math.sin(r),s=Math.cos(r),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((n=f*o)*n+(n=u*c-l*f*s)*n),l*c+u*f*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/g)*g,i,g).map(h).concat(uo.range(Math.ceil(u/v)*v,l,v).map(d)).concat(uo.range(Math.ceil(r/p)*p,n,p).filter(function(t){return _o(t%g)>Ro}).map(c)).concat(uo.range(Math.ceil(s/m)*m,o,m).filter(function(t){return _o(t%v)>Ro}).map(f))}var n,r,i,a,o,s,l,u,c,f,h,d,p=10,m=p,g=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[h(a).concat(d(l).slice(1),h(i).reverse().slice(1),d(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(a=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],a>i&&(e=a,a=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[a,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[r,s],[n,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],t):[g,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],m=+e[1],t):[p,m]},t.precision=function(e){return arguments.length?(y=+e,c=xn(s,o,90),f=_n(r,n,y),h=xn(u,l,90),d=_n(a,i,y),t):y},t.majorExtent([[-180,-90+Ro],[180,90-Ro]]).minorExtent([[-180,-80-Ro],[180,80+Ro]])},uo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||r.apply(this,arguments),n||i.apply(this,arguments)]}}var e,n,r=bn,i=wn;return t.distance=function(){return uo.geo.distance(e||r.apply(this,arguments),n||i.apply(this,arguments))},t.source=function(n){return arguments.length?(r=n,e="function"==typeof n?null:n,t):r},t.target=function(e){return arguments.length?(i=e,n="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},uo.geo.interpolate=function(t,e){return Mn(t[0]*Uo,t[1]*Uo,e[0]*Uo,e[1]*Uo)},uo.geo.length=function(t){return Qs=0,uo.geo.stream(t,Js),Qs};var Qs,Js={sphere:M,point:M,lineStart:kn,lineEnd:M,polygonStart:M,polygonEnd:M},$s=An(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return ln($s)}).raw=$s;var Ks=An(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},_);(uo.geo.azimuthalEquidistant=function(){return ln(Ks)}).raw=Ks,(uo.geo.conicConformal=function(){return Ze(Sn)}).raw=Sn,(uo.geo.conicEquidistant=function(){return Ze(Tn)}).raw=Tn;var tl=An(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return ln(tl)}).raw=tl,zn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return En(zn)}).raw=zn;var el=An(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return ln(el)}).raw=el;var nl=An(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return ln(nl)}).raw=nl,Ln.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Vo]},(uo.geo.transverseMercator=function(){var t=En(Ln),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(), +[t[1],-t[0]])},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):(t=n(),[t[0],t[1],t[2]-90])},n([0,0,90])}).raw=Ln,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=zt(n),a=zt(r),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e=r&&u.x<=a&&u.y>=i&&u.y<=o?[[r,o],[a,o],[a,i],[r,i]]:[];c.point=t[s]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/Ro)*Ro,y:Math.round(o(t,e)/Ro)*Ro,i:e}})}var r=In,i=Dn,a=r,o=i,s=fl;return t?e(t):(e.links=function(t){return ur(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return ur(n(t)).cells.forEach(function(n,r){for(var i,a,o=n.site,s=n.edges.sort(Xn),l=-1,u=s.length,c=s[u-1].edge,f=c.l===o?c.r:c.l;++l=u,h=r>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pr()),f?i=u:s=u,h?o=c:l=c,a(t,e,n,r,i,o,s,l)}var c,f,h,d,p,m,g,v,y,x=zt(s),_=zt(l);if(null!=e)m=e,g=n,v=r,y=i;else if(v=y=-(m=g=1/0),f=[],h=[],p=t.length,o)for(d=0;dv&&(v=c.x),c.y>y&&(y=c.y),f.push(c.x),h.push(c.y);else for(d=0;dv&&(v=b),w>y&&(y=w),f.push(b),h.push(w)}var M=v-m,k=y-g;M>k?y=g+M:v=m+k;var A=pr();if(A.add=function(t){a(A,t,+x(t,++d),+_(t,d),m,g,v,y)},A.visit=function(t){mr(t,A,m,g,v,y)},A.find=function(t){return gr(A,t[0],t[1],m,g,v,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=ml.get(n)||pl,r=gl.get(r)||_,Mr(r(n.apply(null,co.call(arguments,1))))},uo.interpolateHcl=Fr,uo.interpolateHsl=Rr,uo.interpolateLab=jr,uo.interpolateRound=Nr,uo.transform=function(t){var e=ho.createElementNS(uo.ns.prefix.svg,"g");return(uo.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new Br(n?n.matrix:vl)})(t)},Br.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var vl={a:1,b:0,c:0,d:1,e:0,f:0};uo.interpolateTransform=Wr,uo.layout={},uo.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++n0?i=t:(n.c=null,n.t=NaN,n=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),n=Pt(l.tick)),l):i},l.start=function(){function t(t,r){if(!n){for(n=new Array(i),l=0;l=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;r&&(a.value=0),a.children=u}else r&&(a.value=+r.call(t,a,a.depth)||0),delete a.children;return li(i,function(t){var n,i;e&&(n=t.children)&&n.sort(e),r&&(i=t.parent)&&(i.value+=t.value)}),s}var e=fi,n=ui,r=ci;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(r=e,t):r},t.revalue=function(e){return r&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},uo.layout.partition=function(){function t(e,n,r,i){var a=e.children;if(e.x=n,e.y=e.depth*i,e.dx=r,e.dy=i,a&&(o=a.length)){var o,s,l,u=-1;for(r=e.value?r/e.value:0;++us&&(s=r),o.push(r)}for(n=0;n0)for(a=-1;++a=c[0]&&s<=c[1]&&(o=l[uo.bisect(f,s,1,d)-1],o.y+=p,o.push(t[a]));return l}var e=!0,n=Number,r=Mi,i=bi;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(r=zt(e),t):r},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:zt(e),t):i},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},uo.layout.pack=function(){function t(t,a){var o=n.call(this,t,a),s=o[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,zi),r){var f=r*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=f}),li(s,zi),li(s,function(t){t.r-=f})}return Ii(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),o}var e,n=uo.layout.hierarchy().sort(ki),r=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(n){return arguments.length?(e=null==n||"function"==typeof n?n:+n,t):e},t.padding=function(e){return arguments.length?(r=+e,t):r},oi(t,n)},uo.layout.tree=function(){function t(t,i){var c=o.call(this,t,i),f=c[0],h=e(f);if(li(h,n),h.parent.m=-h.z,si(h,r),u)si(f,a);else{var d=f,p=f,m=f;si(f,function(t){t.xp.x&&(p=t),t.depth>m.depth&&(m=t)});var g=s(d,p)/2-d.x,v=l[0]/(p.x+s(p,d)/2+g),y=l[1]/(m.depth||1);si(f,function(t){t.x=(t.x+g)*v,t.y=t.depth*y})}return c}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var i,a=e.children,o=0,s=a.length;o0&&(Fi(ji(o,t,n),t,r),u+=r,c+=r),f+=o.m,u+=i.m,h+=l.m,c+=a.m;o&&!Oi(a)&&(a.t=o,a.m+=f-c),i&&!Ci(l)&&(l.t=i,l.m+=u-h,n=t)}return n}function a(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Pi,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?a:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:a,t):u?l:null},oi(t,o)},uo.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=Bi(e),t.y=Ni(e)):(t.x=o?u+=n(t,o):0,t.y=0,o=t)});var c=qi(l),f=Vi(l),h=c.x-n(c,f)/2,d=f.x+n(f,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*r[0],t.y=(l.y-t.y)*r[1]}:function(t){t.x=(t.x-h)/(d-h)*r[0],t.y=(1-(l.y?t.y/l.y:1))*r[1]}),s}var e=uo.layout.hierarchy().sort(null).value(null),n=Pi,r=[1,1],i=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(i=null==(r=e),t):i?null:r},t.nodeSize=function(e){return arguments.length?(i=null!=(r=e),t):i?r:null},oi(t,e)},uo.layout.treemap=function(){function t(t,e){for(var n,r,i=-1,a=t.length;++i0;)c.push(o=h[l-1]),c.area+=o.area,"squarify"!==d||(s=r(c,m))<=p?(h.pop(),p=s):(c.area-=c.pop().area,i(c,m,u,!1),m=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,m,u,!0),c.length=c.area=0),a.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var a,o=f(e),s=r.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(i(l,a.z?o.dx:o.dy,o,!s.length),l.length=l.area=0);r.forEach(n)}}function r(t,e){for(var n,r=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=n));return r*=r,e*=e,r?Math.max(e*i*p/r,r/(e*a*p)):1/0}function i(t,e,n,r){var i,a=-1,o=t.length,s=n.x,u=n.y,c=e?l(t.area/e):0;if(e==n.dx){for((r||c>n.dy)&&(c=n.dy);++an.dx)&&(c=n.dx);++a1);return t+e*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=uo.random.normal.apply(uo,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=uo.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;nf?0:1;if(u=qo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,m,g,v,y,x,_,b,w,M,k,A,S=0,T=0,z=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=a===Dl?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(T*=-1),u&&(T=rt(g/u*Math.sin(v))),t&&(S=rt(g/t*Math.sin(v)))),u){y=u*Math.cos(c+T),x=u*Math.sin(c+T),_=u*Math.cos(f-T),b=u*Math.sin(f-T);var E=Math.abs(f-c-2*T)<=No?0:1;if(T&&xa(y,x,_,b)===d^E){var L=(c+f)/2;y=u*Math.cos(L),x=u*Math.sin(L),_=b=null}}else y=x=0;if(t){w=t*Math.cos(f-S),M=t*Math.sin(f-S),k=t*Math.cos(c+S),A=t*Math.sin(c+S);var I=Math.abs(c-f+2*S)<=No?0:1;if(S&&xa(w,M,k,A)===1-d^I){var D=(c+f)/2;w=t*Math.cos(D),M=t*Math.sin(D),k=A=null}}else w=M=0;if(h>Ro&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){m=tNo)+",1 "+e}function i(t,e,n,r){return"Q 0,0 "+r}var a=bn,o=wn,s=Ga,l=ga,u=va;return t.radius=function(e){return arguments.length?(s=zt(e),t):s},t.source=function(e){return arguments.length?(a=zt(e),t):a},t.target=function(e){return arguments.length?(o=zt(e),t):o},t.startAngle=function(e){return arguments.length?(l=zt(e),t):l},t.endAngle=function(e){return arguments.length?(u=zt(e),t):u},t},uo.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=n.call(this,t,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return l=l.map(r),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=bn,n=wn,r=Ha;return t.source=function(n){return arguments.length?(e=zt(n),t):e},t.target=function(e){return arguments.length?(n=zt(e),t):n},t.projection=function(e){return arguments.length?(r=e,t):r},t},uo.svg.diagonal.radial=function(){var t=uo.svg.diagonal(),e=Ha,n=t.projection;return t.projection=function(t){return arguments.length?n(Za(e=t)):e},t},uo.svg.symbol=function(){function t(t,r){return(Rl.get(e.call(this,t,r))||Wa)(n.call(this,t,r))}var e=Ya,n=Xa;return t.type=function(n){return arguments.length?(e=zt(n),t):e},t.size=function(e){return arguments.length?(n=zt(e),t):n},t};var Rl=uo.map({circle:Wa,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*Nl)),n=e*Nl;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",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/jl),n=e*jl/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/jl),n=e*jl/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});uo.svg.symbolTypes=Rl.keys();var jl=Math.sqrt(3),Nl=Math.tan(30*Uo);Eo.transition=function(t){for(var e,n,r=Bl||++Gl,i=to(t),a=[],o=ql||{time:Date.now(),ease:zr,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",f[1]-f[0])}function i(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function a(){function a(){32==uo.event.keyCode&&(E||(x=null,I[0]-=f[1],I[1]-=h[1],E=2),S())}function m(){32==uo.event.keyCode&&2==E&&(I[0]+=f[1],I[1]+=h[1],E=0,S())}function g(){var t=uo.mouse(b),r=!1;_&&(t[0]+=_[0],t[1]+=_[1]),E||(uo.event.altKey?(x||(x=[(f[0]+f[1])/2,(h[0]+h[1])/2]),I[0]=f[+(t[0]80*n){u=h=t[0],c=d=t[1];for(var v=n;vh&&(h=p),m>d&&(d=m);g=Math.max(h-u,d-c)}return o(s,l,n,u,c,g),l}function i(t,e,n,r,i){var a,o;if(i===I(t,e,n,r)>0)for(a=e;a=e;a-=r)o=z(a,t[a],t[a+1],o);return o&&w(o,o.next)&&(E(o),o=o.next),o}function a(t,e){if(!t)return t;e||(e=t);var n,r=t;do if(n=!1,r.steiner||!w(r,r.next)&&0!==b(r.prev,r,r.next))r=r.next;else{if(E(r),r=e=r.prev,r===r.next)return null;n=!0}while(n||r!==e);return e}function o(t,e,n,r,i,f,h){if(t){!h&&f&&m(t,r,i,f);for(var d,p,g=t;t.prev!==t.next;)if(d=t.prev,p=t.next,f?l(t,r,i,f):s(t))e.push(d.i/n),e.push(t.i/n),e.push(p.i/n),E(t),t=p.next,g=p.next;else if(t=p,t===g){h?1===h?(t=u(t,e,n),o(t,e,n,r,i,f,2)):2===h&&c(t,e,n,r,i,f):o(a(t),e,n,r,i,f,1);break}}}function s(t){var e=t.prev,n=t,r=t.next;if(b(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(x(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&b(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function l(t,e,n,r){var i=t.prev,a=t,o=t.next;if(b(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,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,f=v(s,l,e,n,r),h=v(u,c,e,n,r),d=t.nextZ;d&&d.z<=h;){if(d!==t.prev&&d!==t.next&&x(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&b(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=f;){if(d!==t.prev&&d!==t.next&&x(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&b(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function u(t,e,n){var r=t;do{var i=r.prev,a=r.next.next;!w(i,a)&&M(i,r,r.next,a)&&A(i,a)&&A(a,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(a.i/n),E(r),E(r.next),r=t=a),r=r.next}while(r!==t);return r}function c(t,e,n,r,i,s){var l=t;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&_(l,u)){var c=T(l,u);return l=a(l,l.next),c=a(c,c.next),o(l,e,n,r,i,s),void o(c,e,n,r,i,s)}u=u.next}l=l.next}while(l!==t)}function f(t,e,n,r){var o,s,l,u,c,f=[];for(o=0,s=e.length;o=r.next.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x=r.x&&r.x>=c&&x(an.x)&&A(r,t)&&(n=r,h=l)),r=r.next;return n}function m(t,e,n,r){var i=t;do null===i.z&&(i.z=v(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,g(i)}function g(t){var e,n,r,i,a,o,s,l,u=1;do{for(n=t,t=null,a=null,o=0;n;){for(o++,r=n,s=0,e=0;e0||l>0&&r;)0===s?(i=r,r=r.nextZ,l--):0!==l&&r?n.z<=r.z?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--):(i=n,n=n.nextZ,s--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;n=r}a.nextZ=null,u*=2}while(o>1);return t}function v(t,e,n,r,i){return t=32767*(t-n)/i,e=32767*(e-r)/i,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function y(t){var e=t,n=t;do e.x=0&&(t-o)*(r-s)-(n-o)*(e-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function _(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!k(t,e)&&A(t,e)&&A(e,t)&&S(t,e)}function b(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function w(t,e){return t.x===e.x&&t.y===e.y}function M(t,e,n,r){return!!(w(t,e)&&w(n,r)||w(t,r)&&w(n,e))||b(t,e,n)>0!=b(t,e,r)>0&&b(n,r,t)>0!=b(n,r,e)>0}function k(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&M(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function A(t,e){return b(t.prev,t,t.next)<0?b(t,e,t.next)>=0&&b(t,t.prev,e)>=0:b(t,e,t.prev)<0||b(t,t.next,e)<0}function S(t,e){var n=t,r=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do n.y>a!=n.next.y>a&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function T(t,e){var n=new L(t.i,t.x,t.y),r=new L(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function z(t,e,n,r){var i=new L(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function E(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 L(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function I(t,e,n,r){for(var i=0,a=e,o=n-r;a0&&(r+=t[i-1].length,n.holes.push(r))}return n}},{}],10:[function(e,n,r){(function(i,a){!function(e,i){"object"==typeof r&&"undefined"!=typeof n?n.exports=i():"function"==typeof t&&t.amd?t(i):e.ES6Promise=i()}(this,function(){"use strict";function t(t){return"function"==typeof t||"object"==typeof t&&null!==t}function n(t){return"function"==typeof t}function r(t){W=t}function o(t){Q=t}function s(){return function(){return i.nextTick(h)}}function l(){return function(){Y(h)}}function u(){var t=0,e=new K(h),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function c(){var t=new MessageChannel;return t.port1.onmessage=h,function(){return t.port2.postMessage(0)}}function f(){var t=setTimeout;return function(){return t(h,1)}}function h(){for(var t=0;t0&&this._events[t].length>n&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],a=n.length,r=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(n)){for(s=a;s-- >0;)if(n[s]===e||n[s].listener&&n[s].listener===e){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;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(n=this._events[t],i(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],12:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;r13)&&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}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return t-t<1}},{}],13:[function(t,e,n){"use strict";function r(t){return new Function("f","var p = (f && f.properties || {}); return "+i(t))}function i(t){if(!t)return"true";var e=t[0];if(t.length<=1)return"any"===e?"false":"true";var n="=="===e?o(t[1],t[2],"===",!1):"!="===e?o(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?o(t[1],t[2],e,!0):"any"===e?s(t.slice(1),"||"):"all"===e?s(t.slice(1),"&&"):"none"===e?c(s(t.slice(1),"||")):"in"===e?l(t[1],t.slice(2)):"!in"===e?c(l(t[1],t.slice(2))):"has"===e?u(t[1]):"!has"===e?c(u([t[1]])):"true";return"("+n+")"}function a(t){return"$type"===t?"f.type":"$id"===t?"f.id":"p["+JSON.stringify(t)+"]"}function o(t,e,n,r){var i=a(t),o="$type"===t?h.indexOf(e):JSON.stringify(e);return(r?"typeof "+i+"=== typeof "+o+"&&":"")+i+n+o}function s(t,e){return t.map(i).join(e)}function l(t,e){"$type"===t&&(e=e.map(function(t){return h.indexOf(t)}));var n=JSON.stringify(e.sort(f)),r=a(t);return e.length<=200?n+".indexOf("+r+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1; if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+r+", "+n+",0,"+(e.length-1)+")"}function u(t){return JSON.stringify(t)+" in p"}function c(t){return"!("+t+")"}function f(t,e){return te?1:0}e.exports=r;var h=["Unknown","Point","LineString","Polygon"]},{}],14:[function(t,e,n){function r(t){if("Polygon"===t.type)return i(t.coordinates);if("MultiPolygon"===t.type){for(var e=0,n=0;n0){e+=Math.abs(a(t[0]));for(var n=1;n2){for(var n,r,i=0;i=0}var u=t("geojson-area");e.exports=r},{"geojson-area":14}],16:[function(t,e,n){"use strict";function r(t,e,n,r,o,l,u,c){if(n/=e,r/=e,u>=n&&c<=r)return t;if(u>r||c=n&&p<=r)f.push(m);else if(!(d>r||p=e&&s<=n&&i.push(o)}return i}function a(t,e,n,r,i,a){for(var s=[],l=0;ln?(_.push(i(u,p,e),i(u,p,n)),a||(_=o(s,_,g,v,y))):d>=e&&_.push(i(u,p,e)):h>n?dn&&(_.push(i(u,p,n)),a||(_=o(s,_,g,v,y))));u=m[x-1],h=u[r],h>=e&&h<=n&&_.push(u),f=_[_.length-1],a&&f&&(_[0][0]!==f[0]||_[0][1]!==f[1])&&_.push(_[0]),o(s,_,g,v,y)}return s}function o(t,e,n,r,i){return e.length&&(e.area=n,e.dist=r,void 0!==i&&(e.outer=i),t.push(e)),[]}e.exports=r;var s=t("./feature")},{"./feature":18}],17:[function(t,e,n){"use strict";function r(t,e){var n=[];if("FeatureCollection"===t.type)for(var r=0;r1?1:r,[n,r,0]}function s(t){for(var e,n,r=0,i=0,a=0;a1)return!1;var a=i.geometry[0].length;if(5!==a)return!1;for(var o=0;o1&&console.time("creation"),x=this.tiles[y]=p(t,v,n,r,_,e===d.maxZoom),this.tileCoords.push({z:e,x:n,y:r}),m)){m>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,n,r,x.numFeatures,x.numPoints,x.numSimplified),console.timeEnd("creation"));var b="z"+e;this.stats[b]=(this.stats[b]||0)+1,this.total++}if(x.source=t,i){if(e===d.maxZoom||e===i)continue;var w=1<1&&console.time("clipping");var M,k,A,S,T,z,E=.5*d.buffer/d.extent,L=.5-E,I=.5+E,D=1+E;M=k=A=S=null,T=h(t,v,n-E,n+I,0,o,x.min[0],x.max[0]),z=h(t,v,n+L,n+D,0,o,x.min[0],x.max[0]),T&&(M=h(T,v,r-E,r+I,1,s,x.min[1],x.max[1]),k=h(T,v,r+L,r+D,1,s,x.min[1],x.max[1])),z&&(A=h(z,v,r-E,r+I,1,s,x.min[1],x.max[1]),S=h(z,v,r+L,r+D,1,s,x.min[1],x.max[1])),m>1&&console.timeEnd("clipping"),t.length&&(f.push(M||[],e+1,2*n,2*r),f.push(k||[],e+1,2*n,2*r+1),f.push(A||[],e+1,2*n+1,2*r),f.push(S||[],e+1,2*n+1,2*r+1))}else i&&(g=e)}return g},i.prototype.getTile=function(t,e,n){var r=this.options,i=r.extent,o=r.debug,s=1<1&&console.log("drilling down to z%d-%d-%d",t,e,n);for(var c,h=t,d=e,p=n;!c&&h>0;)h--,d=Math.floor(d/2),p=Math.floor(p/2),c=this.tiles[a(h,d,p)];if(!c||!c.source)return null;if(o>1&&console.log("found parent tile z%d-%d-%d",h,d,p),u(c,i,r.buffer))return f.tile(c,i);o>1&&console.time("drilling down");var m=this.splitTile(c.source,h,d,p,t,e,n);if(o>1&&console.timeEnd("drilling down"),null!==m){var g=1<r&&(o=n,r=a);r>s?(t[o][2]=r,f.push(u),f.push(o),u=o):(c=f.pop(),u=f.pop())}}function i(t,e,n){var r=e[0],i=e[1],a=n[0],o=n[1],s=t[0],l=t[1],u=a-r,c=o-i;if(0!==u||0!==c){var f=((s-r)*u+(l-i)*c)/(u*u+c*c);f>1?(r=a,i=o):f>0&&(r+=u*f,i+=c*f)}return u=s-r,c=l-i,u*u+c*c}e.exports=r},{}],21:[function(t,e,n){"use strict";function r(t,e,n,r,a,o){for(var s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:r,z2:e,transformed:!1,min:[2,1],max:[-1,0]},l=0;ls.max[0]&&(s.max[0]=c[0]),c[1]>s.max[1]&&(s.max[1]=c[1])}return s}function i(t,e,n,r){var i,o,s,l,u=e.geometry,c=e.type,f=[],h=n*n;if(1===c)for(i=0;ih)&&(d.push(l),t.numSimplified++),t.numPoints++;3===c&&a(d,s.outer),f.push(d)}else t.numPoints+=s.length;if(f.length){var p={geometry:f,type:c,tags:e.tags||null};null!==e.id&&(p.id=e.id),t.features.push(p)}}function a(t,e){var n=o(t);n<0===e&&t.reverse()}function o(t){for(var e,n,r=0,i=0,a=t.length,o=a-1;i0?(r=2*Math.sqrt(n+1),t[3]=.25*r,t[0]=(e[6]-e[9])/r,t[1]=(e[8]-e[2])/r,t[2]=(e[1]-e[4])/r):e[0]>e[5]&e[0]>e[10]?(r=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/r,t[0]=.25*r,t[1]=(e[1]+e[4])/r,t[2]=(e[8]+e[2])/r):e[5]>e[10]?(r=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/r,t[0]=(e[1]+e[4])/r,t[1]=.25*r,t[2]=(e[6]+e[9])/r):(r=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/r,t[0]=(e[8]+e[2])/r,t[1]=(e[6]+e[9])/r,t[2]=.25*r),t},i.fromRotationTranslationScale=function(t,e,n,r){var i=e[0],a=e[1],o=e[2],s=e[3],l=i+i,u=a+a,c=o+o,f=i*l,h=i*u,d=i*c,p=a*u,m=a*c,g=o*c,v=s*l,y=s*u,x=s*c,_=r[0],b=r[1],w=r[2];return t[0]=(1-(p+g))*_,t[1]=(h+x)*_,t[2]=(d-y)*_,t[3]=0,t[4]=(h-x)*b,t[5]=(1-(f+g))*b,t[6]=(m+v)*b,t[7]=0,t[8]=(d+y)*w,t[9]=(m-v)*w,t[10]=(1-(f+p))*w,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},i.fromRotationTranslationScaleOrigin=function(t,e,n,r,i){var a=e[0],o=e[1],s=e[2],l=e[3],u=a+a,c=o+o,f=s+s,h=a*u,d=a*c,p=a*f,m=o*c,g=o*f,v=s*f,y=l*u,x=l*c,_=l*f,b=r[0],w=r[1],M=r[2],k=i[0],A=i[1],S=i[2];return t[0]=(1-(m+v))*b,t[1]=(d+_)*b,t[2]=(p-x)*b,t[3]=0,t[4]=(d-_)*w,t[5]=(1-(h+v))*w,t[6]=(g+y)*w,t[7]=0,t[8]=(p+x)*M,t[9]=(g-y)*M,t[10]=(1-(h+m))*M,t[11]=0,t[12]=n[0]+k-(t[0]*k+t[4]*A+t[8]*S),t[13]=n[1]+A-(t[1]*k+t[5]*A+t[9]*S),t[14]=n[2]+S-(t[2]*k+t[6]*A+t[10]*S),t[15]=1,t},i.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=n+n,s=r+r,l=i+i,u=n*o,c=r*o,f=r*s,h=i*o,d=i*s,p=i*l,m=a*o,g=a*s,v=a*l;return t[0]=1-f-p,t[1]=c+v,t[2]=h-g,t[3]=0,t[4]=c-v,t[5]=1-u-p,t[6]=d+m,t[7]=0,t[8]=h+g,t[9]=d-m,t[10]=1-u-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.frustum=function(t,e,n,r,i,a,o){var s=1/(n-e),l=1/(i-r),u=1/(a-o);return t[0]=2*a*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*l,t[6]=0,t[7]=0,t[8]=(n+e)*s,t[9]=(i+r)*l,t[10]=(o+a)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*a*2*u,t[15]=0,t},i.perspective=function(t,e,n,r,i){var a=1/Math.tan(e/2),o=1/(r-i);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+r)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*r*o,t[15]=0,t},i.perspectiveFromFieldOfView=function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(o+s),u=2/(i+a);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((o-s)*l*.5),t[9]=(i-a)*u*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},i.ortho=function(t,e,n,r,i,a,o){var s=1/(e-n),l=1/(r-i),u=1/(a-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+n)*s,t[13]=(i+r)*l,t[14]=(o+a)*u,t[15]=1,t},i.lookAt=function(t,e,n,a){var o,s,l,u,c,f,h,d,p,m,g=e[0],v=e[1],y=e[2],x=a[0],_=a[1],b=a[2],w=n[0],M=n[1],k=n[2];return Math.abs(g-w).999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(a.cross(t,i,o),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+l,s.normalize(r,r))}}(),s.setAxes=function(){var t=i.create();return function(e,n,r,i){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],s.normalize(e,s.fromMat3(e,t))}}(),s.clone=o.clone,s.fromValues=o.fromValues,s.copy=o.copy,s.set=o.set,s.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.setAxisAngle=function(t,e,n){n=.5*n;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t},s.getAxisAngle=function(t,e){var n=2*Math.acos(e[3]),r=Math.sin(n/2);return 0!=r?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=1,t[1]=0,t[2]=0),n},s.add=o.add,s.multiply=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=e[3],s=n[0],l=n[1],u=n[2],c=n[3];return t[0]=r*c+o*s+i*u-a*l,t[1]=i*c+o*l+a*s-r*u,t[2]=a*c+o*u+r*l-i*s,t[3]=o*c-r*s-i*l-a*u,t},s.mul=s.multiply,s.scale=o.scale,s.rotateX=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=r*l+o*s,t[1]=i*l+a*s,t[2]=a*l-i*s,t[3]=o*l-r*s,t},s.rotateY=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=r*l-a*s,t[1]=i*l+o*s,t[2]=a*l+r*s,t[3]=o*l-i*s,t},s.rotateZ=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=r*l+i*s,t[1]=i*l-r*s,t[2]=a*l+o*s,t[3]=o*l-a*s,t},s.calculateW=function(t,e){var n=e[0],r=e[1],i=e[2];return t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i)),t},s.dot=o.dot,s.lerp=o.lerp,s.slerp=function(t,e,n,r){var i,a,o,s,l,u=e[0],c=e[1],f=e[2],h=e[3],d=n[0],p=n[1],m=n[2],g=n[3];return a=u*d+c*p+f*m+h*g,a<0&&(a=-a,d=-d,p=-p,m=-m,g=-g),1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-r)*i)/o,l=Math.sin(r*i)/o):(s=1-r,l=r),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*f+l*m,t[3]=s*h+l*g,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(n,r,i,a,o,l){return s.slerp(t,r,o,l),s.slerp(e,i,a,l),s.slerp(n,t,e,2*l*(1-l)),n}}(),s.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=n*n+r*r+i*i+a*a,s=o?1/o:0;return t[0]=-n*s,t[1]=-r*s,t[2]=-i*s,t[3]=a*s,t},s.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},s.length=o.length,s.len=s.length,s.squaredLength=o.squaredLength,s.sqrLen=s.squaredLength,s.normalize=o.normalize,s.fromMat3=function(t,e){var n,r=e[0]+e[4]+e[8];if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*o+o]+1),t[i]=.5*n,n=.5/n,t[3]=(e[3*a+o]-e[3*o+a])*n,t[a]=(e[3*a+i]+e[3*i+a])*n,t[o]=(e[3*o+i]+e[3*i+o])*n}return t},s.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},s.exactEquals=o.exactEquals,s.equals=o.equals,e.exports=s},{"./common.js":26,"./mat3.js":29,"./vec3.js":33,"./vec4.js":34}],32:[function(t,e,n){var r=t("./common.js"),i={};i.create=function(){var t=new r.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var e=new r.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},i.fromValues=function(t,e){var n=new r.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},i.set=function(t,e,n){return t[0]=e,t[1]=n,t},i.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},i.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t},i.sub=i.subtract,i.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t},i.mul=i.multiply,i.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},i.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t},i.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},i.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},i.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t},i.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)},i.dist=i.distance,i.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)},i.len=i.length,i.squaredLength=function(t){var e=t[0],n=t[1];return e*e+n*n},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},i.normalize=function(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},i.cross=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t},i.lerp=function(t,e,n,r){var i=e[0],a=e[1];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t},i.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},i.transformMat2=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t},i.transformMat2d=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t},i.transformMat3=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t},i.transformMat4=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t},i.forEach=function(){var t=i.create();return function(e,n,r,i,a,o){var s,l;for(n||(n=2),r||(r=0),l=i?Math.min(i*n+r,e.length):e.length,s=r;s0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.cross=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=n[0],s=n[1],l=n[2];return t[0]=i*l-a*s,t[1]=a*o-r*l,t[2]=r*s-i*o,t},i.lerp=function(t,e,n,r){var i=e[0],a=e[1],o=e[2];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t[2]=o+r*(n[2]-o),t},i.hermite=function(t,e,n,r,i,a){var o=a*a,s=o*(2*a-3)+1,l=o*(a-2)+a,u=o*(a-1),c=o*(3-2*a);return t[0]=e[0]*s+n[0]*l+r[0]*u+i[0]*c,t[1]=e[1]*s+n[1]*l+r[1]*u+i[1]*c,t[2]=e[2]*s+n[2]*l+r[2]*u+i[2]*c,t},i.bezier=function(t,e,n,r,i,a){var o=1-a,s=o*o,l=a*a,u=s*o,c=3*a*s,f=3*l*o,h=l*a;return t[0]=e[0]*u+n[0]*c+r[0]*f+i[0]*h,t[1]=e[1]*u+n[1]*c+r[1]*f+i[1]*h,t[2]=e[2]*u+n[2]*c+r[2]*f+i[2]*h,t},i.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI,i=2*r.RANDOM()-1,a=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(n)*a,t[1]=Math.sin(n)*a,t[2]=i*e,t},i.transformMat4=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];return o=o||1,t[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/o,t[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/o,t[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/o,t},i.transformMat3=function(t,e,n){var r=e[0],i=e[1],a=e[2];return t[0]=r*n[0]+i*n[3]+a*n[6],t[1]=r*n[1]+i*n[4]+a*n[7],t[2]=r*n[2]+i*n[5]+a*n[8],t},i.transformQuat=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=n[0],s=n[1],l=n[2],u=n[3],c=u*r+s*a-l*i,f=u*i+l*r-o*a,h=u*a+o*i-s*r,d=-o*r-s*i-l*a;return t[0]=c*u+d*-o+f*-l-h*-s,t[1]=f*u+d*-s+h*-o-c*-l,t[2]=h*u+d*-l+c*-s-f*-o,t},i.rotateX=function(t,e,n,r){var i=[],a=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],a[0]=i[0],a[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),a[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},i.rotateY=function(t,e,n,r){var i=[],a=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],a[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),a[1]=i[1],a[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},i.rotateZ=function(t,e,n,r){var i=[],a=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],a[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),a[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),a[2]=i[2],t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},i.forEach=function(){var t=i.create();return function(e,n,r,i,a,o){var s,l;for(n||(n=3),r||(r=0),l=i?Math.min(i*n+r,e.length):e.length,s=r;s1?0:Math.acos(a)},i.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},i.equals=function(t,e){var n=t[0],i=t[1],a=t[2],o=e[0],s=e[1],l=e[2];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(a-l)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))},e.exports=i},{"./common.js":26}],34:[function(t,e,n){var r=t("./common.js"),i={};i.create=function(){var t=new r.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},i.clone=function(t){var e=new r.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.fromValues=function(t,e,n,i){var a=new r.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=n,a[3]=i,a},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.set=function(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t},i.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},i.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t},i.sub=i.subtract,i.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t},i.mul=i.multiply,i.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},i.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t},i.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},i.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},i.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t},i.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(n*n+r*r+i*i+a*a)},i.dist=i.distance,i.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return n*n+r*r+i*i+a*a},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)},i.len=i.length,i.squaredLength=function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},i.normalize=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=n*n+r*r+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),t[0]=n*o,t[1]=r*o,t[2]=i*o,t[3]=a*o),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.lerp=function(t,e,n,r){var i=e[0],a=e[1],o=e[2],s=e[3];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t[2]=o+r*(n[2]-o),t[3]=s+r*(n[3]-s),t},i.random=function(t,e){return e=e||1,t[0]=r.RANDOM(),t[1]=r.RANDOM(),t[2]=r.RANDOM(),t[3]=r.RANDOM(),i.normalize(t,t),i.scale(t,t,e),t},i.transformMat4=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*a+n[12]*o,t[1]=n[1]*r+n[5]*i+n[9]*a+n[13]*o,t[2]=n[2]*r+n[6]*i+n[10]*a+n[14]*o,t[3]=n[3]*r+n[7]*i+n[11]*a+n[15]*o,t},i.transformQuat=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=n[0],s=n[1],l=n[2],u=n[3],c=u*r+s*a-l*i,f=u*i+l*r-o*a,h=u*a+o*i-s*r,d=-o*r-s*i-l*a;return t[0]=c*u+d*-o+f*-l-h*-s,t[1]=f*u+d*-s+h*-o-c*-l,t[2]=h*u+d*-l+c*-s-f*-o,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,n,r,i,a,o){var s,l;for(n||(n=4),r||(r=0),l=i?Math.min(i*n+r,e.length):e.length,s=r;s=u[h+0]&&r>=u[h+1]?(o[f]=!0,a.push(l[f])):o[f]=!1}}},r.prototype._forEachCell=function(t,e,n,r,i,a,o){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(n),c=this._convertToCellCoord(r),f=s;f<=u;f++)for(var h=l;h<=c;h++){var d=this.d*h+f;if(i.call(this,t,e,n,r,d,a,o))return}},r.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},r.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=i+this.cells.length+1+1,n=0,r=0;r>1,c=-7,f=n?i-1:0,h=n?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,r),a-=u}return(d?-1:1)*o*Math.pow(2,a-r); +x=n[4],_=n[5],b=n[6],w=n[7],t[4]=x*r+_*s+b*f+w*m,t[5]=x*i+_*l+b*h+w*g,t[6]=x*a+_*u+b*d+w*v,t[7]=x*o+_*c+b*p+w*y,x=n[8],_=n[9],b=n[10],w=n[11],t[8]=x*r+_*s+b*f+w*m,t[9]=x*i+_*l+b*h+w*g,t[10]=x*a+_*u+b*d+w*v,t[11]=x*o+_*c+b*p+w*y,x=n[12],_=n[13],b=n[14],w=n[15],t[12]=x*r+_*s+b*f+w*m,t[13]=x*i+_*l+b*h+w*g,t[14]=x*a+_*u+b*d+w*v,t[15]=x*o+_*c+b*p+w*y,t},i.multiply=r.USE_SIMD?i.SIMD.multiply:i.scalar.multiply,i.mul=i.multiply,i.scalar.translate=function(t,e,n){var r,i,a,o,s,l,u,c,f,h,d,p,m=n[0],g=n[1],v=n[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*v+e[12],t[13]=e[1]*m+e[5]*g+e[9]*v+e[13],t[14]=e[2]*m+e[6]*g+e[10]*v+e[14],t[15]=e[3]*m+e[7]*g+e[11]*v+e[15]):(r=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],u=e[6],c=e[7],f=e[8],h=e[9],d=e[10],p=e[11],t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=l,t[6]=u,t[7]=c,t[8]=f,t[9]=h,t[10]=d,t[11]=p,t[12]=r*m+s*g+f*v+e[12],t[13]=i*m+l*g+h*v+e[13],t[14]=a*m+u*g+d*v+e[14],t[15]=o*m+c*g+p*v+e[15]),t},i.SIMD.translate=function(t,e,n){var r=SIMD.Float32x4.load(e,0),i=SIMD.Float32x4.load(e,4),a=SIMD.Float32x4.load(e,8),o=SIMD.Float32x4.load(e,12),s=SIMD.Float32x4(n[0],n[1],n[2],0);e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11]),r=SIMD.Float32x4.mul(r,SIMD.Float32x4.swizzle(s,0,0,0,0)),i=SIMD.Float32x4.mul(i,SIMD.Float32x4.swizzle(s,1,1,1,1)),a=SIMD.Float32x4.mul(a,SIMD.Float32x4.swizzle(s,2,2,2,2));var l=SIMD.Float32x4.add(r,SIMD.Float32x4.add(i,SIMD.Float32x4.add(a,o)));return SIMD.Float32x4.store(t,12,l),t},i.translate=r.USE_SIMD?i.SIMD.translate:i.scalar.translate,i.scalar.scale=function(t,e,n){var r=n[0],i=n[1],a=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},i.SIMD.scale=function(t,e,n){var r,i,a,o=SIMD.Float32x4(n[0],n[1],n[2],0);return r=SIMD.Float32x4.load(e,0),SIMD.Float32x4.store(t,0,SIMD.Float32x4.mul(r,SIMD.Float32x4.swizzle(o,0,0,0,0))),i=SIMD.Float32x4.load(e,4),SIMD.Float32x4.store(t,4,SIMD.Float32x4.mul(i,SIMD.Float32x4.swizzle(o,1,1,1,1))),a=SIMD.Float32x4.load(e,8),SIMD.Float32x4.store(t,8,SIMD.Float32x4.mul(a,SIMD.Float32x4.swizzle(o,2,2,2,2))),t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},i.scale=r.USE_SIMD?i.SIMD.scale:i.scalar.scale,i.rotate=function(t,e,n,i){var a,o,s,l,u,c,f,h,d,p,m,g,v,y,x,_,b,w,M,k,A,S,T,z,E=i[0],L=i[1],I=i[2],D=Math.sqrt(E*E+L*L+I*I);return Math.abs(D)0?(r=2*Math.sqrt(n+1),t[3]=.25*r,t[0]=(e[6]-e[9])/r,t[1]=(e[8]-e[2])/r,t[2]=(e[1]-e[4])/r):e[0]>e[5]&e[0]>e[10]?(r=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/r,t[0]=.25*r,t[1]=(e[1]+e[4])/r,t[2]=(e[8]+e[2])/r):e[5]>e[10]?(r=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/r,t[0]=(e[1]+e[4])/r,t[1]=.25*r,t[2]=(e[6]+e[9])/r):(r=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/r,t[0]=(e[8]+e[2])/r,t[1]=(e[6]+e[9])/r,t[2]=.25*r),t},i.fromRotationTranslationScale=function(t,e,n,r){var i=e[0],a=e[1],o=e[2],s=e[3],l=i+i,u=a+a,c=o+o,f=i*l,h=i*u,d=i*c,p=a*u,m=a*c,g=o*c,v=s*l,y=s*u,x=s*c,_=r[0],b=r[1],w=r[2];return t[0]=(1-(p+g))*_,t[1]=(h+x)*_,t[2]=(d-y)*_,t[3]=0,t[4]=(h-x)*b,t[5]=(1-(f+g))*b,t[6]=(m+v)*b,t[7]=0,t[8]=(d+y)*w,t[9]=(m-v)*w,t[10]=(1-(f+p))*w,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},i.fromRotationTranslationScaleOrigin=function(t,e,n,r,i){var a=e[0],o=e[1],s=e[2],l=e[3],u=a+a,c=o+o,f=s+s,h=a*u,d=a*c,p=a*f,m=o*c,g=o*f,v=s*f,y=l*u,x=l*c,_=l*f,b=r[0],w=r[1],M=r[2],k=i[0],A=i[1],S=i[2];return t[0]=(1-(m+v))*b,t[1]=(d+_)*b,t[2]=(p-x)*b,t[3]=0,t[4]=(d-_)*w,t[5]=(1-(h+v))*w,t[6]=(g+y)*w,t[7]=0,t[8]=(p+x)*M,t[9]=(g-y)*M,t[10]=(1-(h+m))*M,t[11]=0,t[12]=n[0]+k-(t[0]*k+t[4]*A+t[8]*S),t[13]=n[1]+A-(t[1]*k+t[5]*A+t[9]*S),t[14]=n[2]+S-(t[2]*k+t[6]*A+t[10]*S),t[15]=1,t},i.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=n+n,s=r+r,l=i+i,u=n*o,c=r*o,f=r*s,h=i*o,d=i*s,p=i*l,m=a*o,g=a*s,v=a*l;return t[0]=1-f-p,t[1]=c+v,t[2]=h-g,t[3]=0,t[4]=c-v,t[5]=1-u-p,t[6]=d+m,t[7]=0,t[8]=h+g,t[9]=d-m,t[10]=1-u-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.frustum=function(t,e,n,r,i,a,o){var s=1/(n-e),l=1/(i-r),u=1/(a-o);return t[0]=2*a*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*l,t[6]=0,t[7]=0,t[8]=(n+e)*s,t[9]=(i+r)*l,t[10]=(o+a)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*a*2*u,t[15]=0,t},i.perspective=function(t,e,n,r,i){var a=1/Math.tan(e/2),o=1/(r-i);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+r)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*r*o,t[15]=0,t},i.perspectiveFromFieldOfView=function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(o+s),u=2/(i+a);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((o-s)*l*.5),t[9]=(i-a)*u*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},i.ortho=function(t,e,n,r,i,a,o){var s=1/(e-n),l=1/(r-i),u=1/(a-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+n)*s,t[13]=(i+r)*l,t[14]=(o+a)*u,t[15]=1,t},i.lookAt=function(t,e,n,a){var o,s,l,u,c,f,h,d,p,m,g=e[0],v=e[1],y=e[2],x=a[0],_=a[1],b=a[2],w=n[0],M=n[1],k=n[2];return Math.abs(g-w).999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(a.cross(t,i,o),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+l,s.normalize(r,r))}}(),s.setAxes=function(){var t=i.create();return function(e,n,r,i){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],s.normalize(e,s.fromMat3(e,t))}}(),s.clone=o.clone,s.fromValues=o.fromValues,s.copy=o.copy,s.set=o.set,s.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.setAxisAngle=function(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t},s.getAxisAngle=function(t,e){var n=2*Math.acos(e[3]),r=Math.sin(n/2);return 0!=r?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=1,t[1]=0,t[2]=0),n},s.add=o.add,s.multiply=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=e[3],s=n[0],l=n[1],u=n[2],c=n[3];return t[0]=r*c+o*s+i*u-a*l,t[1]=i*c+o*l+a*s-r*u,t[2]=a*c+o*u+r*l-i*s,t[3]=o*c-r*s-i*l-a*u,t},s.mul=s.multiply,s.scale=o.scale,s.rotateX=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=r*l+o*s,t[1]=i*l+a*s,t[2]=a*l-i*s,t[3]=o*l-r*s,t},s.rotateY=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=r*l-a*s,t[1]=i*l+o*s,t[2]=a*l+r*s,t[3]=o*l-i*s,t},s.rotateZ=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=r*l+i*s,t[1]=i*l-r*s,t[2]=a*l+o*s,t[3]=o*l-a*s,t},s.calculateW=function(t,e){var n=e[0],r=e[1],i=e[2];return t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i)),t},s.dot=o.dot,s.lerp=o.lerp,s.slerp=function(t,e,n,r){var i,a,o,s,l,u=e[0],c=e[1],f=e[2],h=e[3],d=n[0],p=n[1],m=n[2],g=n[3];return a=u*d+c*p+f*m+h*g,a<0&&(a=-a,d=-d,p=-p,m=-m,g=-g),1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-r)*i)/o,l=Math.sin(r*i)/o):(s=1-r,l=r),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*f+l*m,t[3]=s*h+l*g,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(n,r,i,a,o,l){return s.slerp(t,r,o,l),s.slerp(e,i,a,l),s.slerp(n,t,e,2*l*(1-l)),n}}(),s.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=n*n+r*r+i*i+a*a,s=o?1/o:0;return t[0]=-n*s,t[1]=-r*s,t[2]=-i*s,t[3]=a*s,t},s.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},s.length=o.length,s.len=s.length,s.squaredLength=o.squaredLength,s.sqrLen=s.squaredLength,s.normalize=o.normalize,s.fromMat3=function(t,e){var n,r=e[0]+e[4]+e[8];if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*o+o]+1),t[i]=.5*n,n=.5/n,t[3]=(e[3*a+o]-e[3*o+a])*n,t[a]=(e[3*a+i]+e[3*i+a])*n,t[o]=(e[3*o+i]+e[3*i+o])*n}return t},s.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},s.exactEquals=o.exactEquals,s.equals=o.equals,e.exports=s},{"./common.js":26,"./mat3.js":29,"./vec3.js":33,"./vec4.js":34}],32:[function(t,e,n){var r=t("./common.js"),i={};i.create=function(){var t=new r.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var e=new r.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},i.fromValues=function(t,e){var n=new r.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},i.set=function(t,e,n){return t[0]=e,t[1]=n,t},i.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},i.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t},i.sub=i.subtract,i.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t},i.mul=i.multiply,i.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},i.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t},i.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},i.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},i.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t},i.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)},i.dist=i.distance,i.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)},i.len=i.length,i.squaredLength=function(t){var e=t[0],n=t[1];return e*e+n*n},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},i.normalize=function(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},i.cross=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t},i.lerp=function(t,e,n,r){var i=e[0],a=e[1];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t},i.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},i.transformMat2=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t},i.transformMat2d=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t},i.transformMat3=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t},i.transformMat4=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t},i.forEach=function(){var t=i.create();return function(e,n,r,i,a,o){var s,l;for(n||(n=2),r||(r=0),l=i?Math.min(i*n+r,e.length):e.length,s=r;s0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.cross=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=n[0],s=n[1],l=n[2];return t[0]=i*l-a*s,t[1]=a*o-r*l,t[2]=r*s-i*o,t},i.lerp=function(t,e,n,r){var i=e[0],a=e[1],o=e[2];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t[2]=o+r*(n[2]-o),t},i.hermite=function(t,e,n,r,i,a){var o=a*a,s=o*(2*a-3)+1,l=o*(a-2)+a,u=o*(a-1),c=o*(3-2*a);return t[0]=e[0]*s+n[0]*l+r[0]*u+i[0]*c,t[1]=e[1]*s+n[1]*l+r[1]*u+i[1]*c,t[2]=e[2]*s+n[2]*l+r[2]*u+i[2]*c,t},i.bezier=function(t,e,n,r,i,a){var o=1-a,s=o*o,l=a*a,u=s*o,c=3*a*s,f=3*l*o,h=l*a;return t[0]=e[0]*u+n[0]*c+r[0]*f+i[0]*h,t[1]=e[1]*u+n[1]*c+r[1]*f+i[1]*h,t[2]=e[2]*u+n[2]*c+r[2]*f+i[2]*h,t},i.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI,i=2*r.RANDOM()-1,a=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(n)*a,t[1]=Math.sin(n)*a,t[2]=i*e,t},i.transformMat4=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];return o=o||1,t[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/o,t[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/o,t[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/o,t},i.transformMat3=function(t,e,n){var r=e[0],i=e[1],a=e[2];return t[0]=r*n[0]+i*n[3]+a*n[6],t[1]=r*n[1]+i*n[4]+a*n[7],t[2]=r*n[2]+i*n[5]+a*n[8],t},i.transformQuat=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=n[0],s=n[1],l=n[2],u=n[3],c=u*r+s*a-l*i,f=u*i+l*r-o*a,h=u*a+o*i-s*r,d=-o*r-s*i-l*a;return t[0]=c*u+d*-o+f*-l-h*-s,t[1]=f*u+d*-s+h*-o-c*-l,t[2]=h*u+d*-l+c*-s-f*-o,t},i.rotateX=function(t,e,n,r){var i=[],a=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],a[0]=i[0],a[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),a[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},i.rotateY=function(t,e,n,r){var i=[],a=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],a[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),a[1]=i[1],a[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},i.rotateZ=function(t,e,n,r){var i=[],a=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],a[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),a[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),a[2]=i[2],t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},i.forEach=function(){var t=i.create();return function(e,n,r,i,a,o){var s,l;for(n||(n=3),r||(r=0),l=i?Math.min(i*n+r,e.length):e.length,s=r;s1?0:Math.acos(a)},i.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},i.equals=function(t,e){var n=t[0],i=t[1],a=t[2],o=e[0],s=e[1],l=e[2];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(a-l)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))},e.exports=i},{"./common.js":26}],34:[function(t,e,n){var r=t("./common.js"),i={};i.create=function(){var t=new r.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},i.clone=function(t){var e=new r.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.fromValues=function(t,e,n,i){var a=new r.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=n,a[3]=i,a},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.set=function(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t},i.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},i.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t},i.sub=i.subtract,i.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t},i.mul=i.multiply,i.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},i.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t},i.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},i.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},i.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t},i.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(n*n+r*r+i*i+a*a)},i.dist=i.distance,i.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return n*n+r*r+i*i+a*a},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)},i.len=i.length,i.squaredLength=function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},i.normalize=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=n*n+r*r+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),t[0]=n*o,t[1]=r*o,t[2]=i*o,t[3]=a*o),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.lerp=function(t,e,n,r){var i=e[0],a=e[1],o=e[2],s=e[3];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t[2]=o+r*(n[2]-o),t[3]=s+r*(n[3]-s),t},i.random=function(t,e){return e=e||1,t[0]=r.RANDOM(),t[1]=r.RANDOM(),t[2]=r.RANDOM(),t[3]=r.RANDOM(),i.normalize(t,t),i.scale(t,t,e),t},i.transformMat4=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*a+n[12]*o,t[1]=n[1]*r+n[5]*i+n[9]*a+n[13]*o,t[2]=n[2]*r+n[6]*i+n[10]*a+n[14]*o,t[3]=n[3]*r+n[7]*i+n[11]*a+n[15]*o,t},i.transformQuat=function(t,e,n){var r=e[0],i=e[1],a=e[2],o=n[0],s=n[1],l=n[2],u=n[3],c=u*r+s*a-l*i,f=u*i+l*r-o*a,h=u*a+o*i-s*r,d=-o*r-s*i-l*a;return t[0]=c*u+d*-o+f*-l-h*-s,t[1]=f*u+d*-s+h*-o-c*-l,t[2]=h*u+d*-l+c*-s-f*-o,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,n,r,i,a,o){var s,l;for(n||(n=4),r||(r=0),l=i?Math.min(i*n+r,e.length):e.length,s=r;s=u[h+0]&&r>=u[h+1]?(o[f]=!0,a.push(l[f])):o[f]=!1}}},r.prototype._forEachCell=function(t,e,n,r,i,a,o){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(n),c=this._convertToCellCoord(r),f=s;f<=u;f++)for(var h=l;h<=c;h++){var d=this.d*h+f;if(i.call(this,t,e,n,r,d,a,o))return}},r.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},r.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=i+this.cells.length+1+1,n=0,r=0;r>1,c=-7,f=n?i-1:0,h=n?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,r),a-=u}return(d?-1:1)*o*Math.pow(2,a-r); },n.write=function(t,e,n,r,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:a-1,p=r?1:-1,m=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),e*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):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[n+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[n+d]=255&o,d+=p,o/=256,u-=8);t[n+d-p]|=128*m}},{}],37:[function(t,e,n){"use strict";function r(t,e,n,r,a){return new i(t,e,n,r,a)}function i(t,e,n,r,i){e=e||a,n=n||o,i=i||Array,this.nodeSize=r||64,this.points=t,this.ids=new i(t.length),this.coords=new i(2*t.length);for(var l=0;l=n&&s<=i&&l>=r&&l<=a&&c.push(t[p]);else{var m=Math.floor((d+h)/2);s=e[2*m],l=e[2*m+1],s>=n&&s<=i&&l>=r&&l<=a&&c.push(t[m]);var g=(f+1)%2;(0===f?n<=s:r<=l)&&(u.push(d),u.push(m-1),u.push(g)),(0===f?i>=s:a>=l)&&(u.push(m+1),u.push(h),u.push(g))}}return c}e.exports=r},{}],39:[function(t,e,n){"use strict";function r(t,e,n,a,o,s){if(!(o-a<=n)){var l=Math.floor((a+o)/2);i(t,e,l,a,o,s%2),r(t,e,n,a,l-1,s+1),r(t,e,n,l+1,o,s+1)}}function i(t,e,n,r,o,s){for(;o>r;){if(o-r>600){var l=o-r+1,u=n-r+1,c=Math.log(l),f=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*f*(l-f)/l)*(u-l/2<0?-1:1),d=Math.max(r,Math.floor(n-u*f/l+h)),p=Math.min(o,Math.floor(n+(l-u)*f/l+h));i(t,e,n,d,p,s)}var m=e[2*n+s],g=r,v=o;for(a(t,e,r,n),e[2*o+s]>m&&a(t,e,r,o);gm;)v--}e[2*r+s]===m?a(t,e,r,v):(v++,a(t,e,v,o)),v<=n&&(r=v+1),n<=v&&(o=v-1)}}function a(t,e,n,r){o(t,n,r),o(e,2*n,2*r),o(e,2*n+1,2*r+1)}function o(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}e.exports=r},{}],40:[function(t,e,n){"use strict";function r(t,e,n,r,a,o){for(var s=[0,t.length-1,0],l=[],u=a*a;s.length;){var c=s.pop(),f=s.pop(),h=s.pop();if(f-h<=o)for(var d=h;d<=f;d++)i(e[2*d],e[2*d+1],n,r)<=u&&l.push(t[d]);else{var p=Math.floor((h+f)/2),m=e[2*p],g=e[2*p+1];i(m,g,n,r)<=u&&l.push(t[p]);var v=(c+1)%2;(0===c?n-a<=m:r-a<=g)&&(s.push(h),s.push(p-1),s.push(v)),(0===c?n+a>=m:r+a>=g)&&(s.push(p+1),s.push(f),s.push(v))}}return l}function i(t,e,n,r){var i=t-n,a=e-r;return i*i+a*a}e.exports=r},{}],41:[function(t,e,n){"use strict";function r(t,e){var n;if(f(t)){var l,u=t.stops&&"object"==typeof t.stops[0][0],c=u||void 0!==t.property,h=u||!c,d=t.type||e||"exponential";if("exponential"===d)l=o;else if("interval"===d)l=a;else if("categorical"===d)l=i;else{if("identity"!==d)throw new Error('Unknown function type "'+d+'"');l=s}if(u){for(var p={},m=[],g=0;g=t.stops.length)break;if(e<=t.stops[r][0])break;r++}return 0===r?t.stops[r][1]:r===t.stops.length?t.stops[r-1][1]:l(e,n,t.stops[r-1][0],t.stops[r][0],t.stops[r-1][1],t.stops[r][1])}function s(t,e){return e}function l(t,e,n,r,i,a){return"function"==typeof i?function(){var o=i.apply(void 0,arguments),s=a.apply(void 0,arguments);return l(t,e,n,r,o,s)}:i.length?c(t,e,n,r,i,a):u(t,e,n,r,i,a)}function u(t,e,n,r,i,a){var o,s=r-n,l=t-n;return o=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-o)+a*o}function c(t,e,n,r,i,a){for(var o=[],s=0;s -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linesdfpattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},outline:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},outlinepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\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\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},pattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform 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\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n}\n"},raster:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity0;\nuniform float u_opacity1;\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 vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\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);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform 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 v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},icon:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_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:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" },sdf:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nconst float PI = 3.141592653589793;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_data[1] / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_data[1] / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = (gl_Position.w - 0.5);\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},collisionbox:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n"}},e.exports.util="float evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n"},{path:184}],43:[function(t,e,n){"use strict";function r(t,e){this.message=(t?t+": ":"")+i.apply(i,Array.prototype.slice.call(arguments,2)),null!==e&&void 0!==e&&e.__line__&&(this.line=e.__line__)}var i=t("util").format;e.exports=r},{util:203}],44:[function(t,e,n){"use strict";e.exports=function(t){for(var e=1;e7)return[new r(c,l,"constants have been deprecated as of v8")];if(!(l in h.constants))return[new r(c,l,'constant "%s" not found',l)];e=a({},e,{value:h.constants[l]})}return u.function&&"object"===i(l)?n(e):u.type&&s[u.type]?s[u.type](e):o(a({},e,{valueSpec:u.type?f[u.type]:u}))}},{"../error/validation_error":43,"../util/extend":44,"../util/get_type":45,"./validate_array":48,"./validate_boolean":49,"./validate_color":50,"./validate_constants":51,"./validate_enum":52,"./validate_filter":53,"./validate_function":54,"./validate_layer":56,"./validate_number":58,"./validate_object":59,"./validate_source":61,"./validate_string":62}],48:[function(t,e,n){"use strict";var r=t("../util/get_type"),i=t("./validate"),a=t("../error/validation_error");e.exports=function(t){var e=t.value,n=t.valueSpec,o=t.style,s=t.styleSpec,l=t.key,u=t.arrayElementValidator||i;if("array"!==r(e))return[new a(l,e,"array expected, %s found",r(e))];if(n.length&&e.length!==n.length)return[new a(l,e,"array length %d expected, length %d found",n.length,e.length)];if(n["min-length"]&&e.length7)return n?[new r(e,n,"constants have been deprecated as of v8")]:[];var o=i(n);if("object"!==o)return[new r(e,n,"object expected, %s found",o)];var s=[];for(var l in n)"@"!==l[0]&&s.push(new r(e+"."+l,n[l],'constants must start with "@"'));return s}},{"../error/validation_error":43,"../util/get_type":45}],52:[function(t,e,n){"use strict";var r=t("../error/validation_error"),i=t("../util/unbundle_jsonlint");e.exports=function(t){var e=t.key,n=t.value,a=t.valueSpec,o=[];return a.values.indexOf(i(n))===-1&&o.push(new r(e,n,"expected one of [%s], %s found",a.values.join(", "),n)),o}},{"../error/validation_error":43,"../util/unbundle_jsonlint":46}],53:[function(t,e,n){"use strict";var r=t("../error/validation_error"),i=t("./validate_enum"),a=t("../util/get_type"),o=t("../util/unbundle_jsonlint");e.exports=function t(e){var n,s=e.value,l=e.key,u=e.styleSpec,c=[];if("array"!==a(s))return[new r(l,s,"array expected, %s found",a(s))];if(s.length<1)return[new r(l,s,"filter array must have at least 1 element")];switch(c=c.concat(i({key:l+"[0]",value:s[0],valueSpec:u.filter_operator,style:e.style,styleSpec:e.styleSpec})),o(s[0])){case"<":case"<=":case">":case">=":s.length>=2&&"$type"==s[1]&&c.push(new r(l,s,'"$type" cannot be use with operator "%s"',s[0]));case"==":case"!=":3!=s.length&&c.push(new r(l,s,'filter array for operator "%s" must have 3 elements',s[0]));case"in":case"!in":s.length>=2&&(n=a(s[1]),"string"!==n?c.push(new r(l+"[1]",s[1],"string expected, %s found",n)):"@"===s[1][0]&&c.push(new r(l+"[1]",s[1],"filter key cannot be a constant")));for(var f=2;f=8&&(h&&!t.valueSpec["property-function"]?p.push(new r(t.key,t.value,"property functions not supported")):d&&!t.valueSpec["zoom-function"]&&p.push(new r(t.key,t.value,"zoom functions not supported"))),p}},{"../error/validation_error":43,"../util/get_type":45,"./validate":47,"./validate_array":48,"./validate_number":58,"./validate_object":59}],55:[function(t,e,n){"use strict";var r=t("../error/validation_error"),i=t("./validate_string");e.exports=function(t){var e=t.value,n=t.key,a=i(t);return a.length?a:(e.indexOf("{fontstack}")===-1&&a.push(new r(n,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&a.push(new r(n,e,'"glyphs" url must include a "{range}" token')),a)}},{"../error/validation_error":43,"./validate_string":62}],56:[function(t,e,n){"use strict";var r=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"),u=t("../util/extend");e.exports=function(t){var e=[],n=t.value,c=t.key,f=t.style,h=t.styleSpec;n.type||n.ref||e.push(new r(c,n,'either "type" or "ref" is required'));var d=i(n.type),p=i(n.ref);if(n.id)for(var m=0;ma.maximum?[new i(e,n,"%s is greater than the maximum value %s",n,a.maximum)]:[]}},{"../error/validation_error":43,"../util/get_type":45}],59:[function(t,e,n){"use strict";var r=t("../error/validation_error"),i=t("../util/get_type"),a=t("./validate");e.exports=function(t){var e=t.key,n=t.value,o=t.valueSpec,s=t.objectElementValidators||{},l=t.style,u=t.styleSpec,c=[],f=i(n);if("object"!==f)return[new r(e,n,"object expected, %s found",f)];for(var h in n){var d=h.split(".")[0],p=o&&(o[d]||o["*"]),m=s[d]||s["*"];p||m?c=c.concat((m||a)({key:(e?e+".":e)+h,value:n[h],valueSpec:p,style:l,styleSpec:u,object:n,objectKey:h})):""!==e&&1!==e.split(".").length&&c.push(new r(e,n[h],'unknown property "%s"',h))}for(d in o)o[d].required&&void 0===o[d].default&&void 0===n[d]&&c.push(new r(e,n,'missing required property "%s"',d));return c}},{"../error/validation_error":43,"../util/get_type":45,"./validate":47}],60:[function(t,e,n){"use strict";var r=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,n=t.style,a=t.styleSpec,o=t.value,s=t.objectKey,l=a["paint_"+t.layerType],u=s.match(/^(.*)-transition$/);return u&&l[u[1]]&&l[u[1]].transition?r({key:e,value:o,valueSpec:a.transition,style:n,styleSpec:a}):t.valueSpec||l[s]?r({key:t.key,value:o,valueSpec:t.valueSpec||l[s],style:n,styleSpec:a}):[new i(e,o,'unknown property "%s"',s)]}},{"../error/validation_error":43,"./validate":47}],61:[function(t,e,n){"use strict";var r=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,n=t.key,s=t.styleSpec,l=t.style;if(!e.type)return[new r(n,e,'"type" is required')];var u=i(e.type);switch(u){case"vector":case"raster":var c=[];if(c=c.concat(a({key:n,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var f in e)["type","url","tileSize"].indexOf(f)<0&&c.push(new r(n+"."+f,e[f],'a source with a "url" property may not include a "%s" property',f));return c;case"geojson":return a({key:n,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s});case"video":return a({key:n,value:e,valueSpec:s.source_video,style:l,styleSpec:s});case"image":return a({key:n,value:e,valueSpec:s.source_image,style:l,styleSpec:s});default:return o({key:n+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":43,"../util/unbundle_jsonlint":46,"./validate_enum":52,"./validate_object":59}],62:[function(t,e,n){"use strict";var r=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.value,n=t.key,a=r(e);return"string"!==a?[new i(n,e,"string expected, %s found",a)]:[]}},{"../error/validation_error":43,"../util/get_type":45}],63:[function(t,e,n){"use strict";function r(t,e){e=e||l;var n=[];return n=n.concat(s({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:u}})),e.$version>7&&t.constants&&(n=n.concat(o({key:"constants",value:t.constants,style:t,styleSpec:e}))),i(n)}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.min"),u=t("./validate/validate_glyphs_url");r.source=a(t("./validate/validate_source")),r.layer=a(t("./validate/validate_layer")),r.filter=a(t("./validate/validate_filter")),r.paintProperty=a(t("./validate/validate_paint_property")),r.layoutProperty=a(t("./validate/validate_layout_property")),e.exports=r},{"../reference/latest.min":64,"./validate/validate":47,"./validate/validate_constants":51,"./validate/validate_filter":53,"./validate/validate_glyphs_url":55,"./validate/validate_layer":56,"./validate/validate_layout_property":57,"./validate/validate_paint_property":60,"./validate/validate_source":61}],64:[function(t,e,n){e.exports=t("./v8.min.json")},{"./v8.min.json":65}],65:[function(t,e,n){e.exports={$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"},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_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"]},url:{type:"string"},tiles:{type:"array",value:"string"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"]},data:{type:"*"},maxzoom:{type:"number",default:14},buffer:{type:"number",default:64},tolerance:{type:"number",default:3},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:400},clusterMaxZoom:{type:"number"}},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","raster","background"]},metadata:{type:"*"},ref:{type:"string"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:22},maxzoom:{type:"number",minimum:0,maximum:22},interactive:{type:"boolean",default:!1},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"},"paint.*":{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_fill:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_circle:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_line:{"line-cap":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number",default:1.05,function:"interpolated","zoom-function":!0,"property-function":!0,requires:[{"line-join":"round"}]},visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_symbol:{"symbol-placement":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["point","line"],default:"point"},"symbol-spacing":{type:"number",default:250,minimum:1,function:"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1},"icon-allow-overlap":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image"]},"icon-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"viewport",requires:["icon-image"]},"icon-size":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image"]},"icon-text-fit":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!1,values:["none","both","width","height"],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,"property-function":!0,requires:["icon-image","icon-text-fit","text-field"]},"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,"property-function":!0,units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-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"]},"text-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],requires:["text-field"]},"text-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"viewport",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:"em",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-line-height":{type:"number",default:1.2,units:"em",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-letter-spacing":{type:"number",default:0,units:"em",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,"property-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,"property-function":!0,requires:["text-field"]},"text-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,default:!1,requires:["text-field"]},"text-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["text-field"]},"text-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["text-field","icon-image"]},visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_raster:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,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"]},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"]},function:{stops:{type:"array",required:!0,value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],default:"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["fill-translate"]},"fill-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["circle-translate"]},"circle-pitch-scale":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map"}},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,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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:!0,units:"milliseconds"}},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"}}}},{}],66:[function(t,e,n){"use strict";function r(t){return!!(i()&&a()&&o()&&s()&&l()&&u()&&c()&&f(t&&t.failIfMajorPerformanceCaveat))}function i(){return"undefined"!=typeof window&&"undefined"!=typeof document}function a(){return 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 o(){return Function.prototype&&Function.prototype.bind}function s(){return 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}function l(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON}function u(){return"Worker"in window}function c(){return"Uint8ClampedArray"in window}function f(t){return void 0===d[t]&&(d[t]=h(t)),d[t]}function h(t){var e=document.createElement("canvas"),n=Object.create(r.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=t,e.probablySupportsContext?e.probablySupportsContext("webgl",n)||e.probablySupportsContext("experimental-webgl",n):e.supportsContext?e.supportsContext("webgl",n)||e.supportsContext("experimental-webgl",n):e.getContext("webgl",n)||e.getContext("experimental-webgl",n)}"undefined"!=typeof e&&e.exports?e.exports=r:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=r);var d={};r.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}},{}],67:[function(t,e,n){"use strict";function r(t){var e=t.layoutVertexArrayType;this.layoutVertexArray=new e;var n=t.elementArrayType;n&&(this.elementArray=new n);var r=t.elementArrayType2;r&&(this.elementArray2=new r),this.paintVertexArrays=i.mapObject(t.paintVertexArrayTypes,function(t){return new t})}var i=t("../util/util");e.exports=r,r.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,r.prototype.hasCapacityFor=function(t){return this.layoutVertexArray.length+t<=r.MAX_VERTEX_ARRAY_LENGTH},r.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},r.prototype.trim=function(){this.layoutVertexArray.trim(),this.elementArray&&this.elementArray.trim(),this.elementArray2&&this.elementArray2.trim();for(var t in this.paintVertexArrays)this.paintVertexArrays[t].trim()},r.prototype.serialize=function(){return{layoutVertexArray:this.layoutVertexArray.serialize(),elementArray:this.elementArray&&this.elementArray.serialize(),elementArray2:this.elementArray2&&this.elementArray2.serialize(),paintVertexArrays:i.mapObject(this.paintVertexArrays,function(t){return t.serialize()})}},r.prototype.getTransferables=function(t){t.push(this.layoutVertexArray.arrayBuffer),this.elementArray&&t.push(this.elementArray.arrayBuffer),this.elementArray2&&t.push(this.elementArray2.arrayBuffer);for(var e in this.paintVertexArrays)t.push(this.paintVertexArrays[e].arrayBuffer)}},{"../util/util":181}],68:[function(t,e,n){"use strict";function r(t){if(this.zoom=t.zoom,this.overscaling=t.overscaling,this.layer=t.layer,this.childLayers=t.childLayers,this.type=this.layer.type,this.features=[],this.id=this.layer.id,this.index=t.index,this.sourceLayer=this.layer.sourceLayer,this.sourceLayerIndex=t.sourceLayerIndex,this.minZoom=this.layer.minzoom,this.maxZoom=this.layer.maxzoom,this.paintAttributes=i(this),t.arrays){var e=this.programInterfaces;this.bufferGroups=c.mapObject(t.arrays,function(n,r){var i=e[r],a=t.paintVertexArrayTypes[r];return n.map(function(t){return new u(t,{layoutVertexArrayType:i.layoutVertexArrayType.serialize(),elementArrayType:i.elementArrayType&&i.elementArrayType.serialize(),elementArrayType2:i.elementArrayType2&&i.elementArrayType2.serialize(),paintVertexArrayTypes:a})})})}}function i(t){var e={};for(var n in t.programInterfaces){for(var r=e[n]={},i=0;i1?p.name+b:p.name;_[w]=m[b]*g}}},r.VertexArrayType=function(t){return new f({members:t,alignment:4})},r.ElementArrayType=function(t){return new f({members:[{type:"Uint16",name:"vertices",components:t||3}]})}},{"../util/struct_array":179,"../util/util":181,"./array_group":67,"./bucket/circle_bucket":69,"./bucket/fill_bucket":70,"./bucket/line_bucket":71,"./bucket/symbol_bucket":72,"./buffer_group":74,assert:6,"feature-filter":13}],69:[function(t,e,n){"use strict";function r(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=i.EXTENT;e.exports=r,r.prototype=a.inherit(i,{}),r.prototype.addCircleVertex=function(t,e,n,r,i){return t.emplaceBack(2*e+(r+1)/2,2*n+(i+1)/2)},r.prototype.programInterfaces={circle:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType,paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,n){return t.getPaintValue("circle-color",e,n)},multiplier:255,paintProperty:"circle-color"},{name:"a_radius",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,n){return[t.getPaintValue("circle-radius",e,n)]},multiplier:10,paintProperty:"circle-radius"},{name:"a_blur",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,n){return[t.getPaintValue("circle-blur",e,n)]},multiplier:10,paintProperty:"circle-blur"},{name:"a_opacity",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,n){return[t.getPaintValue("circle-opacity",e,n)]},multiplier:255,paintProperty:"circle-opacity"}]}},r.prototype.addFeature=function(t){for(var e={zoom:this.zoom},n=o(t),r=this.prepareArrayGroup("circle",0),i=r.layoutVertexArray.length,a=0;a=s||c<0||c>=s)){var f=this.prepareArrayGroup("circle",4),h=f.layoutVertexArray,d=this.addCircleVertex(h,u,c,-1,-1);this.addCircleVertex(h,u,c,1,-1),this.addCircleVertex(h,u,c,1,1),this.addCircleVertex(h,u,c,-1,1),f.elementArray.emplaceBack(d,d+1,d+2),f.elementArray.emplaceBack(d,d+3,d+2)}}this.populatePaintArrays("circle",e,t.properties,r,i)}},{"../../util/util":181,"../bucket":68,"../load_geometry":76}],70:[function(t,e,n){"use strict";function r(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=t("earcut"),l=t("../../util/classify_rings"),u=500;e.exports=r,r.prototype=a.inherit(i,{}),r.prototype.programInterfaces={fill:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType(1),elementArrayType2:new i.ElementArrayType(2),paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,n){return t.getPaintValue("fill-color",e,n)},multiplier:255,paintProperty:"fill-color"},{name:"a_outline_color",components:4,type:"Uint8",getValue:function(t,e,n){return t.getPaintValue("fill-outline-color",e,n)},multiplier:255,paintProperty:"fill-outline-color"},{name:"a_opacity",components:1,type:"Uint8",getValue:function(t,e,n){return[t.getPaintValue("fill-opacity",e,n)]},multiplier:255,paintProperty:"fill-opacity"}]}},r.prototype.addFeature=function(t){for(var e=o(t),n=l(e,u),r=this.prepareArrayGroup("fill",0),i=r.layoutVertexArray.length,a=0;a0&&a.push(i.length/2);for(var c=0;c=1&&r.elementArray2.emplaceBack(h-1,h),i.push(f.x),i.push(f.y)}}for(var d=s(i,a),p=0;p>6)},r.prototype.programInterfaces={line:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}]),elementArrayType:new i.ElementArrayType}},r.prototype.addFeature=function(t){for(var e=o(t,f),n=0;n2&&t[a-1].equals(t[a-2]);)a--;if(!(t.length<2)){"bevel"===e&&(r=1.05);var o=c*(s/(512*this.overscaling)),l=t[0],f=t[a-1],h=l.equals(f);if(this.prepareArrayGroup("line",10*a),2!==a||!h){this.distance=0;var d,p,m,g,v,y,x,_=n,b=h?"butt":n,w=!0;this.e1=this.e2=this.e3=-1,h&&(d=t[a-2],v=l.sub(d)._unit()._perp());for(var M=0;M0){var z=d.dist(p);if(z>2*o){var E=d.sub(d.sub(p)._mult(o/z)._round());this.distance+=E.dist(p),this.addCurrentVertex(E,this.distance,g.mult(1),0,0,!1),p=E}}var L=p&&m,I=L?e:m?_:b;if(L&&"round"===I&&(Sr&&(I="bevel"),"bevel"===I&&(S>2&&(I="flipbevel"),S100)k=v.clone();else{var D=g.x*v.y-g.y*v.x>0?-1:1,P=S*g.add(v).mag()/g.sub(v).mag();k._perp()._mult(P*D)}this.addCurrentVertex(d,this.distance,k,0,0,!1),this.addCurrentVertex(d,this.distance,k.mult(-1),0,0,!1)}else if("bevel"===I||"fakeround"===I){var C=g.x*v.y-g.y*v.x>0,O=-Math.sqrt(S*S-1);if(C?(x=0,y=O):(y=0,x=O),w||this.addCurrentVertex(d,this.distance,g,y,x,!1),"fakeround"===I){for(var F,R=Math.floor(8*(.5-(A-.5))),j=0;j=0;N--)F=g.mult((N+1)/(R+1))._add(v)._unit(),this.addPieSliceVertex(d,this.distance,F,C)}m&&this.addCurrentVertex(d,this.distance,v,-y,-x,!1)}else"butt"===I?(w||this.addCurrentVertex(d,this.distance,g,0,0,!1),m&&this.addCurrentVertex(d,this.distance,v,0,0,!1)):"square"===I?(w||(this.addCurrentVertex(d,this.distance,g,1,1,!1),this.e1=this.e2=-1),m&&this.addCurrentVertex(d,this.distance,v,-1,-1,!1)):"round"===I&&(w||(this.addCurrentVertex(d,this.distance,g,0,0,!1),this.addCurrentVertex(d,this.distance,g,1,1,!0),this.e1=this.e2=-1),m&&(this.addCurrentVertex(d,this.distance,v,-1,-1,!0),this.addCurrentVertex(d,this.distance,v,0,0,!1)));if(T&&M2*o){var q=d.add(m.sub(d)._mult(o/B)._round());this.distance+=q.dist(d),this.addCurrentVertex(q,this.distance,v.mult(1),0,0,!1),d=q}}w=!1}}}},r.prototype.addCurrentVertex=function(t,e,n,r,i,a){var o,s=a?1:0,l=this.arrayGroups.line[this.arrayGroups.line.length-1],u=l.layoutVertexArray,c=l.elementArray;o=n.clone(),r&&o._sub(n.perp()._mult(r)),this.e3=this.addLineVertex(u,t,o,s,0,r,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,o=n.mult(-1),i&&o._sub(n.perp()._mult(i)),this.e3=this.addLineVertex(u,t,o,s,1,-i,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>d/2&&(this.distance=0,this.addCurrentVertex(t,this.distance,n,r,i,a))},r.prototype.addPieSliceVertex=function(t,e,n,r){var i=r?1:0;n=n.mult(r?-1:1);var a=this.arrayGroups.line[this.arrayGroups.line.length-1],o=a.layoutVertexArray,s=a.elementArray;this.e3=this.addLineVertex(o,t,n,0,i,0,e),this.e1>=0&&this.e2>=0&&s.emplaceBack(this.e1,this.e2,this.e3),r?this.e2=this.e3:this.e1=this.e3}},{"../../util/util":181,"../bucket":68,"../load_geometry":76}],72:[function(t,e,n){"use strict";function r(t){o.apply(this,arguments),this.showCollisionBoxes=t.showCollisionBoxes,this.overscaling=t.overscaling,this.collisionBoxArray=t.collisionBoxArray,this.symbolQuadsArray=t.symbolQuadsArray,this.symbolInstancesArray=t.symbolInstancesArray,this.sdfIcons=t.sdfIcons,this.iconsNeedLinear=t.iconsNeedLinear,this.adjustedTextSize=t.adjustedTextSize,this.adjustedIconSize=t.adjustedIconSize,this.fontstack=t.fontstack}function i(t,e,n,r,i,a,o,s,l,u,c){return t.emplaceBack(e,n,Math.round(64*r),Math.round(64*i),a/4,o/4,10*(u||0),c,10*(s||0),10*Math.min(l||25,25))}var a=t("point-geometry"),o=t("../bucket"),s=t("../../symbol/anchor"),l=t("../../symbol/get_anchors"),u=t("../../util/token"),c=t("../../symbol/quads"),f=t("../../symbol/shaping"),h=t("../../symbol/resolve_text"),d=t("../../symbol/mergelines"),p=t("../../symbol/clip_line"),m=t("../../util/util"),g=t("../load_geometry"),v=t("../../symbol/collision_feature"),y=f.shapeText,x=f.shapeIcon,_=c.getGlyphQuads,b=c.getIconQuads,w=o.EXTENT;e.exports=r,r.MAX_QUADS=65535,r.prototype=m.inherit(o,{}),r.prototype.serialize=function(){var t=o.prototype.serialize.apply(this);return t.sdfIcons=this.sdfIcons,t.iconsNeedLinear=this.iconsNeedLinear,t.adjustedTextSize=this.adjustedTextSize,t.adjustedIconSize=this.adjustedIconSize,t.fontstack=this.fontstack,t};var M=new o.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_offset",components:2,type:"Int16"},{name:"a_texture_pos",components:2,type:"Uint16"},{name:"a_data",components:4,type:"Uint8"}]),k=new o.ElementArrayType;r.prototype.addCollisionBoxVertex=function(t,e,n,r,i){return t.emplaceBack(e.x,e.y,Math.round(n.x),Math.round(n.y),10*r,10*i)},r.prototype.programInterfaces={glyph:{layoutVertexArrayType:M,elementArrayType:k},icon:{layoutVertexArrayType:M,elementArrayType:k},collisionBox:{layoutVertexArrayType:new o.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}])}},r.prototype.populateArrays=function(t,e,n){var r={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",{zoom:18,zoomHistory:r}),this.adjustedTextSize=this.layer.getLayoutValue("text-size",{zoom:this.zoom+1,zoomHistory:r}),this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",{zoom:18,zoomHistory:r}),this.adjustedIconSize=this.layer.getLayoutValue("icon-size",{zoom:this.zoom+1,zoomHistory:r});var i=512*this.overscaling;this.tilePixelRatio=w/i,this.compareText={},this.iconsNeedLinear=!1,this.symbolInstancesStartIndex=this.symbolInstancesArray.length;var a=this.layer.layout,o=this.features,s=this.textFeatures,l=.5,c=.5;switch(a["text-anchor"]){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(a["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":c=1;break;case"top":case"top-right":case"top-left":c=0}for(var f="right"===a["text-justify"]?1:"left"===a["text-justify"]?0:.5,h=24,p=a["text-line-height"]*h,v="line"!==a["symbol-placement"]?a["text-max-width"]*h:0,_=a["text-letter-spacing"]*h,b=[a["text-offset"][0]*h,a["text-offset"][1]*h],M=this.fontstack=a["text-font"].join(","),k=[],A=0;Aw||L.y<0||L.y>w);if(!m||I){var D=I||b;this.addSymbolInstance(L,T,e,n,this.layer,D,this.symbolInstancesArray.length,this.collisionBoxArray,r.index,this.sourceLayerIndex,this.index,c,g,x,h,v,_,{zoom:this.zoom},r.properties)}}}}},r.prototype.anchorIsTooClose=function(t,e,n){var r=this.compareText;if(t in r){for(var i=r[t],a=i.length-1;a>=0;a--)if(n.dist(i[a])3*Math.PI/2))){var g=p.tl,v=p.tr,y=p.bl,x=p.br,_=p.tex,b=p.anchorPoint,w=Math.max(f+Math.log(p.minScale)/Math.LN2,h),M=Math.min(f+Math.log(p.maxScale)/Math.LN2,25);if(!(M<=w)){w===h&&(w=0);var k=Math.round(p.glyphAngle/(2*Math.PI)*256),A=i(c,b.x,b.y,g.x,g.y,_.x,_.y,w,M,h,k);i(c,b.x,b.y,v.x,v.y,_.x+_.w,_.y,w,M,h,k),i(c,b.x,b.y,y.x,y.y,_.x,_.y+_.h,w,M,h,k),i(c,b.x,b.y,x.x,x.y,_.x+_.w,_.y+_.h,w,M,h,k),u.emplaceBack(A,A+1,A+2),u.emplaceBack(A+1,A+2,A+3)}}}},r.prototype.updateIcons=function(t){this.recalculateStyleLayers();var e=this.layer.layout["icon-image"];if(e)for(var n=0;nr.MAX_QUADS&&m.warnOnce("Too many symbols being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),A>r.MAX_QUADS&&m.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),this.symbolInstancesArray.emplaceBack(P,C,O,F,k,A,S,T,t.x,t.y,s)},r.prototype.addSymbolQuad=function(t){return this.symbolQuadsArray.emplaceBack(t.anchorPoint.x,t.anchorPoint.y,t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y,t.tex.h,t.tex.w,t.tex.x,t.tex.y,t.anchorAngle,t.glyphAngle,t.maxScale,t.minScale)}},{"../../symbol/anchor":130,"../../symbol/clip_line":132,"../../symbol/collision_feature":134,"../../symbol/get_anchors":136,"../../symbol/mergelines":139,"../../symbol/quads":140,"../../symbol/resolve_text":141,"../../symbol/shaping":142,"../../util/token":180,"../../util/util":181,"../bucket":68,"../load_geometry":76,"point-geometry":187}],73:[function(t,e,n){"use strict";function r(t,e,n){this.arrayBuffer=t.arrayBuffer,this.length=t.length,this.attributes=e.members,this.itemSize=e.bytesPerElement,this.type=n,this.arrayType=e}e.exports=r,r.prototype.bind=function(t){var e=t[this.type];this.buffer?t.bindBuffer(e,this.buffer):(this.buffer=t.createBuffer(),t.bindBuffer(e,this.buffer),t.bufferData(e,this.arrayBuffer,t.STATIC_DRAW),this.arrayBuffer=null)};var i={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT"};r.prototype.setVertexAttribPointers=function(t,e){for(var n=0;n0?t["line-gap-width"]+2*t["line-width"]:t["line-width"]}function s(t,e,n,r,i){if(!e[0]&&!e[1])return t;e=u.convert(e),"viewport"===n&&e._rotate(-r);for(var a=[],o=0;on.max||h.yn.max)&&i.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return l}},{"../util/util":181,"./bucket":68,assert:6}],77:[function(t,e,n){"use strict";function r(t,e,n){this.column=t,this.row=e,this.zoom=n}e.exports=r,r.prototype={clone:function(){return new r(this.column,this.row,this.zoom)},zoomTo:function(t){return this.clone()._zoomTo(t)},sub:function(t){return this.clone()._sub(t)},_zoomTo:function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},_sub:function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this}}},{}],78:[function(t,e,n){"use strict";function r(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}e.exports=r;var i=t("../util/util").wrap;r.prototype.wrap=function(){return new r(i(this.lng,-180,180),this.lat)},r.prototype.toArray=function(){return[this.lng,this.lat]},r.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t}},{"../util/util":181}],79:[function(t,e,n){"use strict";function r(t,e){t&&(e?this.extend(t).extend(e):4===t.length?this.extend([t[0],t[1]]).extend([t[2],t[3]]):this.extend(t[0]).extend(t[1]))}e.exports=r;var i=t("./lng_lat");r.prototype={extend:function(t){var e,n,a=this._sw,o=this._ne;if(t instanceof i)e=t,n=t;else{if(!(t instanceof r))return t?this.extend(i.convert(t)||r.convert(t)):this;if(e=t._sw,n=t._ne,!e||!n)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(n.lng,o.lng),o.lat=Math.max(n.lat,o.lat)):(this._sw=new i(e.lng,e.lat),this._ne=new i(n.lng,n.lat)),this},getCenter:function(){return new i((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},getSouthWest:function(){return this._sw},getNorthEast:function(){return this._ne},getNorthWest:function(){return new i(this.getWest(),this.getNorth())},getSouthEast:function(){return new i(this.getEast(),this.getSouth())},getWest:function(){return this._sw.lng},getSouth:function(){return this._sw.lat},getEast:function(){return this._ne.lng},getNorth:function(){return this._ne.lat},toArray:function(){return[this._sw.toArray(),this._ne.toArray()]},toString:function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"}},r.convert=function(t){return!t||t instanceof r?t:new r(t)}},{"./lng_lat":78}],80:[function(t,e,n){"use strict";function r(t,e){this.tileSize=512,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new i(0,0),this.zoom=0,this.angle=0,this._altitude=1.5,this._pitch=0,this._unmodified=!0}var i=t("./lng_lat"),a=t("point-geometry"),o=t("./coordinate"),s=t("../util/util").wrap,l=t("../util/interpolate"),u=t("../source/tile_coord"),c=t("../data/bucket").EXTENT,f=t("gl-matrix"),h=f.vec4,d=f.mat4,p=f.mat2;e.exports=r,r.prototype={get minZoom(){return this._minZoom},set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},get maxZoom(){return this._maxZoom},set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},get worldSize(){return this.tileSize*this.scale},get centerPoint(){return this.size._div(2)},get size(){return new a(this.width,this.height)},get bearing(){return-this.angle/Math.PI*180},set bearing(t){var e=-s(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcMatrices(),this.rotationMatrix=p.create(),p.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},get pitch(){return this._pitch/Math.PI*180},set pitch(t){var e=Math.min(60,t)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcMatrices())},get altitude(){return this._altitude},set altitude(t){var e=Math.max(.75,t);this._altitude!==e&&(this._unmodified=!1,this._altitude=e,this._calcMatrices())},get zoom(){return this._zoom},set zoom(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._calcMatrices(),this._constrain())},get center(){return this._center},set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._calcMatrices(),this._constrain())},coveringZoomLevel:function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},coveringTiles:function(t){var e=this.coveringZoomLevel(t),n=e;if(et.maxzoom&&(e=t.maxzoom);var r=this,i=r.locationCoordinate(r.center)._zoomTo(e),o=new a(i.column-.5,i.row-.5);return u.cover(e,[r.pointCoordinate(new a(0,0))._zoomTo(e),r.pointCoordinate(new a(r.width,0))._zoomTo(e),r.pointCoordinate(new a(r.width,r.height))._zoomTo(e),r.pointCoordinate(new a(0,r.height))._zoomTo(e)],t.reparseOverscaled?n:e).sort(function(t,e){return o.dist(t)-o.dist(e)})},resize:function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._calcMatrices(),this._constrain()},get unmodified(){return this._unmodified},zoomScale:function(t){return Math.pow(2,t)},scaleZoom:function(t){return Math.log(t)/Math.LN2},project:function(t,e){return new a(this.lngX(t.lng,e),this.latY(t.lat,e))},unproject:function(t,e){return new i(this.xLng(t.x,e),this.yLat(t.y,e))},get x(){return this.lngX(this.center.lng)},get y(){return this.latY(this.center.lat)},get point(){return new a(this.x,this.y)},lngX:function(t,e){return(180+t)*(e||this.worldSize)/360},latY:function(t,e){var n=180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360));return(180-n)*(e||this.worldSize)/360},xLng:function(t,e){return 360*t/(e||this.worldSize)-180},yLat:function(t,e){var n=180-360*t/(e||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90},panBy:function(t){var e=this.centerPoint._add(t);this.center=this.pointLocation(e)},setLocationAtPoint:function(t,e){var n=this.locationCoordinate(t),r=this.pointCoordinate(e),i=this.pointCoordinate(this.centerPoint),a=r._sub(n);this._unmodified=!1,this.center=this.coordinateLocation(i._sub(a))},locationPoint:function(t){return this.coordinatePoint(this.locationCoordinate(t))},pointLocation:function(t){return this.coordinateLocation(this.pointCoordinate(t))},locationCoordinate:function(t){var e=this.zoomScale(this.tileZoom)/this.worldSize,n=i.convert(t);return new o(this.lngX(n.lng)*e,this.latY(n.lat)*e,this.tileZoom)},coordinateLocation:function(t){var e=this.zoomScale(t.zoom);return new i(this.xLng(t.column,e),this.yLat(t.row,e))},pointCoordinate:function(t){var e=0,n=[t.x,t.y,0,1],r=[t.x,t.y,1,1];h.transformMat4(n,n,this.pixelMatrixInverse),h.transformMat4(r,r,this.pixelMatrixInverse);var i=n[3],a=r[3],s=n[0]/i,u=r[0]/a,c=n[1]/i,f=r[1]/a,d=n[2]/i,p=r[2]/a,m=d===p?0:(e-d)/(p-d),g=this.worldSize/this.zoomScale(this.tileZoom);return new o(l(s,u,m)/g,l(c,f,m)/g,this.tileZoom)},coordinatePoint:function(t){var e=this.worldSize/this.zoomScale(t.zoom),n=[t.column*e,t.row*e,0,1];return h.transformMat4(n,n,this.pixelMatrix),new a(n[0]/n[3],n[1]/n[3])},calculatePosMatrix:function(t,e){void 0===e&&(e=1/0),t instanceof u&&(t=t.toCoordinate(e));var n=Math.min(t.zoom,e),r=this.worldSize/Math.pow(2,n),i=new Float64Array(16);return d.identity(i),d.translate(i,i,[t.column*r,t.row*r,0]),d.scale(i,i,[r/c,r/c,1]),d.multiply(i,this.projMatrix,i),new Float32Array(i)},_constrain:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,e,n,r,i,o,s,l,u=this.size,c=this._unmodified;this.latRange&&(t=this.latY(this.latRange[1]),e=this.latY(this.latRange[0]),i=e-te&&(l=e-d)}if(this.lngRange){var p=this.x,m=u.x/2;p-mr&&(s=r-m)}void 0===s&&void 0===l||(this.center=this.unproject(new a(void 0!==s?s:this.x,void 0!==l?l:this.y))),this._unmodified=c,this._constraining=!1}},_calcMatrices:function(){if(this.height){var t=Math.atan(.5/this.altitude),e=Math.sin(t)*this.altitude/Math.sin(Math.PI/2-this._pitch-t),n=Math.cos(Math.PI/2-this._pitch)*e+this.altitude,r=new Float64Array(16);if(d.perspective(r,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,n),d.translate(r,r,[0,0,-this.altitude]),d.scale(r,r,[1,-1,1/this.height]),d.rotateX(r,r,this._pitch),d.rotateZ(r,r,this.angle),d.translate(r,r,[-this.x,-this.y,0]),this.projMatrix=r,r=d.create(),d.scale(r,r,[this.width/2,-this.height/2,1]),d.translate(r,r,[1,-1,0]),this.pixelMatrix=d.multiply(new Float64Array(16),r,this.projMatrix),r=d.invert(new Float64Array(16),this.pixelMatrix),!r)throw new Error("failed to invert matrix");this.pixelMatrixInverse=r}}}},{"../data/bucket":68,"../source/tile_coord":108,"../util/interpolate":175,"../util/util":181,"./coordinate":77,"./lng_lat":78,"gl-matrix":25,"point-geometry":187}],81:[function(t,e,n){"use strict";var r={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,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]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[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]]};e.exports=function(t,e,n,i){i=i||1;var a,o,s,l,u,c,f,h,d=[];for(a=0,o=t.length;a>16,b>>16),s.uniform2f(r.u_pixel_coord_lower,65535&_,65535&b)}s.uniformMatrix4fv(r.u_matrix,!1,t.transform.calculatePosMatrix(v)),s.drawArrays(s.TRIANGLE_STRIP,0,t.tileExtentBuffer.length)}s.stencilMask(0),s.stencilFunc(s.EQUAL,128,128)}var i=t("../source/pixels_to_tile_units"),a=t("./create_uniform_pragmas"),o=512;e.exports=r},{"../source/pixels_to_tile_units":102,"./create_uniform_pragmas":83}],85:[function(t,e,n){"use strict";function r(t,e,n,r){if(!t.isOpaquePass){var a=t.gl;t.setDepthSublayer(0),t.depthMask(!1),a.disable(a.STENCIL_TEST);for(var o=0;o>16,h>>16),o.uniform2f(a.u_pixel_coord_lower,65535&f,65535&h),o.activeTexture(o.TEXTURE0),i.spriteAtlas.bind(o,!0)}}var s=t("../source/pixels_to_tile_units");e.exports=r},{"../source/pixels_to_tile_units":102}],89:[function(t,e,n){"use strict";var r=t("../util/browser"),i=t("gl-matrix").mat2,a=t("../source/pixels_to_tile_units");e.exports=function(t,e,n,o){if(!t.isOpaquePass){t.setDepthSublayer(0),t.depthMask(!1);var s=t.gl;if(s.enable(s.STENCIL_TEST),!(n.paint["line-width"]<=0)){var l=1/r.devicePixelRatio,u=n.paint["line-blur"]+l,c=n.paint["line-color"],f=t.transform,h=i.create();i.scale(h,h,[1,Math.cos(f._pitch)]),i.rotate(h,h,t.transform.angle);var d,p,m,g,v,y=Math.sqrt(f.height*f.height/4*(1+f.altitude*f.altitude)),x=f.height/2*Math.tan(f._pitch),_=(y+x)/y-1,b=n.paint["line-dasharray"],w=n.paint["line-pattern"];if(b)d=t.useProgram("linesdfpattern"),s.uniform1f(d.u_linewidth,n.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,n.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform4fv(d.u_color,c),s.uniform1f(d.u_opacity,n.paint["line-opacity"]),p=t.lineAtlas.getDash(b.from,"round"===n.layout["line-cap"]),m=t.lineAtlas.getDash(b.to,"round"===n.layout["line-cap"]),s.uniform1i(d.u_image,0),s.activeTexture(s.TEXTURE0),t.lineAtlas.bind(s),s.uniform1f(d.u_tex_y_a,p.y),s.uniform1f(d.u_tex_y_b,m.y),s.uniform1f(d.u_mix,b.t),s.uniform1f(d.u_extra,_),s.uniform1f(d.u_offset,-n.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,h);else if(w){if(g=t.spriteAtlas.getPosition(w.from,!0),v=t.spriteAtlas.getPosition(w.to,!0),!g||!v)return;d=t.useProgram("linepattern"),s.uniform1i(d.u_image,0),s.activeTexture(s.TEXTURE0),t.spriteAtlas.bind(s,!0),s.uniform1f(d.u_linewidth,n.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,n.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform2fv(d.u_pattern_tl_a,g.tl),s.uniform2fv(d.u_pattern_br_a,g.br),s.uniform2fv(d.u_pattern_tl_b,v.tl),s.uniform2fv(d.u_pattern_br_b,v.br),s.uniform1f(d.u_fade,w.t),s.uniform1f(d.u_opacity,n.paint["line-opacity"]),s.uniform1f(d.u_extra,_),s.uniform1f(d.u_offset,-n.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,h)}else d=t.useProgram("line"),s.uniform1f(d.u_linewidth,n.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,n.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform1f(d.u_extra,_),s.uniform1f(d.u_offset,-n.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,h),s.uniform4fv(d.u_color,c),s.uniform1f(d.u_opacity,n.paint["line-opacity"]);for(var M=0;M0?1/(1-t):1+t}function s(t){return t>0?1-1/(1.001-t):-t}function l(t,e,n,r){var i=[1,0],a=n.paint["raster-fade-duration"];if(t.source&&a>0){var o=(new Date).getTime(),s=(o-t.timeAdded)/a,l=e?(o-e.timeAdded)/a:-1,c=r.coveringZoomLevel(t.source),f=!!e&&Math.abs(e.coord.z-c)>Math.abs(t.coord.z-c);!e||f?(i[0]=u.clamp(s,0,1),i[1]=1-i[0]):(i[0]=u.clamp(1-l,0,1),i[1]=1-i[0])}var h=n.paint["raster-opacity"];return i[0]*=h,i[1]*=h,i}var u=t("../util/util"),c=t("../util/struct_array");e.exports=r,r.RasterBoundsArray=new c({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]})},{"../util/struct_array":179,"../util/util":181}],91:[function(t,e,n){"use strict";function r(t,e,n,r){if(!t.isOpaquePass){var a=!(n.layout["text-allow-overlap"]||n.layout["icon-allow-overlap"]||n.layout["text-ignore-placement"]||n.layout["icon-ignore-placement"]),o=t.gl;a?o.disable(o.STENCIL_TEST):o.enable(o.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),o.disable(o.DEPTH_TEST),i(t,e,n,r,!1,n.paint["icon-translate"],n.paint["icon-translate-anchor"],n.layout["icon-rotation-alignment"],n.layout["icon-rotation-alignment"],n.layout["icon-size"],n.paint["icon-halo-width"],n.paint["icon-halo-color"],n.paint["icon-halo-blur"],n.paint["icon-opacity"],n.paint["icon-color"]),i(t,e,n,r,!0,n.paint["text-translate"],n.paint["text-translate-anchor"],n.layout["text-rotation-alignment"],n.layout["text-pitch-alignment"],n.layout["text-size"],n.paint["text-halo-width"],n.paint["text-halo-color"],n.paint["text-halo-blur"],n.paint["text-opacity"],n.paint["text-color"]),o.enable(o.DEPTH_TEST),e.map.showCollisionBoxes&&s(t,e,n,r)}}function i(t,e,n,r,i,o,s,l,u,c,f,h,d,p,m){for(var g=0;gthis.previousZoom;n--)this.changeTimes[n]=e,this.changeOpacities[n]=this.opacities[n];for(n=0;n<256;n++){var r=e-this.changeTimes[n],i=r/this.fadeDuration*255;n<=t?this.opacities[n]=this.changeOpacities[n]+i:this.opacities[n]=this.changeOpacities[n]-i}this.changed=!0,this.previousZoom=t},r.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.changed&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,256,1,t.ALPHA,t.UNSIGNED_BYTE,this.array),this.changed=!1)):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,256,1,0,t.ALPHA,t.UNSIGNED_BYTE,this.array))}},{}],93:[function(t,e,n){"use strict";function r(t,e){this.width=t,this.height=e,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}}var i=t("../util/util");e.exports=r,r.prototype.setSprite=function(t){this.sprite=t},r.prototype.getDash=function(t,e){var n=t.join(",")+e;return this.positions[n]||(this.positions[n]=this.addDash(t,e)),this.positions[n]},r.prototype.addDash=function(t,e){var n=e?7:0,r=2*n+1,a=128;if(this.nextRow+r>this.height)return i.warnOnce("LineAtlas out of space"),null;for(var o=0,s=0;s0?e.pop():null},r.prototype.lineWidth=function(t){this.gl.lineWidth(c.clamp(t,this.lineWidthRange[0],this.lineWidthRange[1]))},r.prototype.showOverdrawInspector=function(t){if(t||this._showOverdrawInspector){this._showOverdrawInspector=t;var e=this.gl;if(t){e.blendFunc(e.CONSTANT_COLOR,e.ONE);var n=8,r=1/n;e.blendColor(r,r,r,0),e.clearColor(0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)}else e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}}},{"../data/bucket":68,"../data/buffer":73,"../source/pixels_to_tile_units":102,"../source/source_cache":106,"../util/browser":165,"../util/struct_array":179,"../util/util":181,"./create_uniform_pragmas":83,"./draw_background":84,"./draw_circle":85,"./draw_debug":87,"./draw_fill":88,"./draw_line":89,"./draw_raster":90,"./draw_symbol":91,"./frame_history":92,"./painter/use_program":95,"./vertex_array_object":96,"gl-matrix":25}],95:[function(t,e,n){"use strict";function r(t,e){return t.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,function(t,n,r,i,a){return e[n][a].replace(/{type}/g,i).replace(/{precision}/g,r)})}var i=t("assert"),a=t("../../util/util"),o=t("mapbox-gl-shaders"),s=o.util;e.exports._createProgram=function(t,e,n,l){for(var u=this.gl,c=u.createProgram(),f=o[t],h="#define MAPBOX_GL_JS;\n",d=0;dthis.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,r={type:this.type,uid:t.uid,coord:t.coord,zoom:t.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:n,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send("load tile",r,function(n,r){if(t.unloadVectorData(this.map.painter),!t.aborted)return n?e(n):(t.loadVectorData(r,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),e(null))}.bind(this),this.workerID)},abortTile:function(t){t.aborted=!0},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},function(){},t.workerID)},serialize:function(){return{type:this.type,data:this._data}}})},{"../data/bucket":68,"../util/evented":173,"../util/util":181,"resolve-url":194}],98:[function(t,e,n){"use strict";function r(t,e,n){n&&(this.loadGeoJSON=n),f.call(this,t,e)}var i=t("../util/util"),a=t("../util/ajax"),o=t("geojson-rewind"),s=t("./geojson_wrapper"),l=t("vt-pbf"),u=t("supercluster"),c=t("geojson-vt"),f=t("./vector_tile_worker_source");e.exports=r,r.prototype=i.inherit(f,{_geoJSONIndexes:{},loadVectorData:function(t,e){var n=t.source,r=t.coord;if(!this._geoJSONIndexes[n])return e(null,null);var i=this._geoJSONIndexes[n].getTile(Math.min(r.z,t.maxZoom),r.x,r.y);if(!i)return e(null,null);var a=new s(i.features);a.name="_geojsonTileLayer";var o=l({layers:{_geojsonTileLayer:a}});0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{tile:a,rawTileData:o.buffer})},loadData:function(t,e){var n=function(n,r){return n?e(n):"object"!=typeof r?e(new Error("Input data is not a valid GeoJSON object.")):(o(r,!0),void this._indexData(r,t,function(n,r){return n?e(n):(this._geoJSONIndexes[t.source]=r,void e(null))}.bind(this)))}.bind(this);this.loadGeoJSON(t,n)},loadGeoJSON:function(t,e){if(t.url)a.getJSON(t.url,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."))}}},_indexData:function(t,e,n){try{e.cluster?n(null,u(e.superclusterOptions).load(t.features)):n(null,c(t,e.geojsonVtOptions))}catch(t){return n(t)}}})},{"../util/ajax":164,"../util/util":181,"./geojson_wrapper":99,"./vector_tile_worker_source":110,"geojson-rewind":15,"geojson-vt":19,supercluster:196,"vt-pbf":208}],99:[function(t,e,n){"use strict";function r(t){this.features=t,this.length=t.length,this.extent=s}function i(t){if(this.type=t.type,1===t.type){this.rawGeometry=[];for(var e=0;e>16,h>>16),o.uniform2f(a.u_pixel_coord_lower,65535&f,65535&h),o.activeTexture(o.TEXTURE0),i.spriteAtlas.bind(o,!0)}}var s=t("../source/pixels_to_tile_units");e.exports=r},{"../source/pixels_to_tile_units":102}],89:[function(t,e,n){"use strict";var r=t("../util/browser"),i=t("gl-matrix").mat2,a=t("../source/pixels_to_tile_units");e.exports=function(t,e,n,o){if(!t.isOpaquePass){t.setDepthSublayer(0),t.depthMask(!1);var s=t.gl;if(s.enable(s.STENCIL_TEST),!(n.paint["line-width"]<=0)){var l=1/r.devicePixelRatio,u=n.paint["line-blur"]+l,c=n.paint["line-color"],f=t.transform,h=i.create();i.scale(h,h,[1,Math.cos(f._pitch)]),i.rotate(h,h,t.transform.angle);var d,p,m,g,v,y=Math.sqrt(f.height*f.height/4*(1+f.altitude*f.altitude)),x=f.height/2*Math.tan(f._pitch),_=(y+x)/y-1,b=n.paint["line-dasharray"],w=n.paint["line-pattern"];if(b)d=t.useProgram("linesdfpattern"),s.uniform1f(d.u_linewidth,n.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,n.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform4fv(d.u_color,c),s.uniform1f(d.u_opacity,n.paint["line-opacity"]),p=t.lineAtlas.getDash(b.from,"round"===n.layout["line-cap"]),m=t.lineAtlas.getDash(b.to,"round"===n.layout["line-cap"]),s.uniform1i(d.u_image,0),s.activeTexture(s.TEXTURE0),t.lineAtlas.bind(s),s.uniform1f(d.u_tex_y_a,p.y),s.uniform1f(d.u_tex_y_b,m.y),s.uniform1f(d.u_mix,b.t),s.uniform1f(d.u_extra,_),s.uniform1f(d.u_offset,-n.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,h);else if(w){if(g=t.spriteAtlas.getPosition(w.from,!0),v=t.spriteAtlas.getPosition(w.to,!0),!g||!v)return;d=t.useProgram("linepattern"),s.uniform1i(d.u_image,0),s.activeTexture(s.TEXTURE0),t.spriteAtlas.bind(s,!0),s.uniform1f(d.u_linewidth,n.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,n.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform2fv(d.u_pattern_tl_a,g.tl),s.uniform2fv(d.u_pattern_br_a,g.br),s.uniform2fv(d.u_pattern_tl_b,v.tl),s.uniform2fv(d.u_pattern_br_b,v.br),s.uniform1f(d.u_fade,w.t),s.uniform1f(d.u_opacity,n.paint["line-opacity"]),s.uniform1f(d.u_extra,_),s.uniform1f(d.u_offset,-n.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,h)}else d=t.useProgram("line"),s.uniform1f(d.u_linewidth,n.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,n.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform1f(d.u_extra,_),s.uniform1f(d.u_offset,-n.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,h),s.uniform4fv(d.u_color,c),s.uniform1f(d.u_opacity,n.paint["line-opacity"]);for(var M=0;M0?1/(1-t):1+t}function s(t){return t>0?1-1/(1.001-t):-t}function l(t,e,n,r){var i=[1,0],a=n.paint["raster-fade-duration"];if(t.source&&a>0){var o=(new Date).getTime(),s=(o-t.timeAdded)/a,l=e?(o-e.timeAdded)/a:-1,c=r.coveringZoomLevel(t.source),f=!!e&&Math.abs(e.coord.z-c)>Math.abs(t.coord.z-c);!e||f?(i[0]=u.clamp(s,0,1),i[1]=1-i[0]):(i[0]=u.clamp(1-l,0,1),i[1]=1-i[0])}var h=n.paint["raster-opacity"];return i[0]*=h,i[1]*=h,i}var u=t("../util/util"),c=t("../util/struct_array");e.exports=r,r.RasterBoundsArray=new c({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]})},{"../util/struct_array":179,"../util/util":181}],91:[function(t,e,n){"use strict";function r(t,e,n,r){if(!t.isOpaquePass){var a=!(n.layout["text-allow-overlap"]||n.layout["icon-allow-overlap"]||n.layout["text-ignore-placement"]||n.layout["icon-ignore-placement"]),o=t.gl;a?o.disable(o.STENCIL_TEST):o.enable(o.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),o.disable(o.DEPTH_TEST),i(t,e,n,r,!1,n.paint["icon-translate"],n.paint["icon-translate-anchor"],n.layout["icon-rotation-alignment"],n.layout["icon-rotation-alignment"],n.layout["icon-size"],n.paint["icon-halo-width"],n.paint["icon-halo-color"],n.paint["icon-halo-blur"],n.paint["icon-opacity"],n.paint["icon-color"]),i(t,e,n,r,!0,n.paint["text-translate"],n.paint["text-translate-anchor"],n.layout["text-rotation-alignment"],n.layout["text-pitch-alignment"],n.layout["text-size"],n.paint["text-halo-width"],n.paint["text-halo-color"],n.paint["text-halo-blur"],n.paint["text-opacity"],n.paint["text-color"]),o.enable(o.DEPTH_TEST),e.map.showCollisionBoxes&&s(t,e,n,r)}}function i(t,e,n,r,i,o,s,l,u,c,f,h,d,p,m){for(var g=0;gthis.previousZoom;n--)this.changeTimes[n]=e,this.changeOpacities[n]=this.opacities[n];for(n=0;n<256;n++){var r=e-this.changeTimes[n],i=r/this.fadeDuration*255;n<=t?this.opacities[n]=this.changeOpacities[n]+i:this.opacities[n]=this.changeOpacities[n]-i}this.changed=!0,this.previousZoom=t},r.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.changed&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,256,1,t.ALPHA,t.UNSIGNED_BYTE,this.array),this.changed=!1)):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,256,1,0,t.ALPHA,t.UNSIGNED_BYTE,this.array))}},{}],93:[function(t,e,n){"use strict";function r(t,e){this.width=t,this.height=e,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}}var i=t("../util/util");e.exports=r,r.prototype.setSprite=function(t){this.sprite=t},r.prototype.getDash=function(t,e){var n=t.join(",")+e;return this.positions[n]||(this.positions[n]=this.addDash(t,e)),this.positions[n]},r.prototype.addDash=function(t,e){var n=e?7:0,r=2*n+1,a=128;if(this.nextRow+r>this.height)return i.warnOnce("LineAtlas out of space"),null;for(var o=0,s=0;s0?e.pop():null},r.prototype.lineWidth=function(t){this.gl.lineWidth(c.clamp(t,this.lineWidthRange[0],this.lineWidthRange[1]))},r.prototype.showOverdrawInspector=function(t){if(t||this._showOverdrawInspector){this._showOverdrawInspector=t;var e=this.gl;if(t){e.blendFunc(e.CONSTANT_COLOR,e.ONE);var n=8,r=1/n;e.blendColor(r,r,r,0),e.clearColor(0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)}else e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}}},{"../data/bucket":68,"../data/buffer":73,"../source/pixels_to_tile_units":102,"../source/source_cache":106,"../util/browser":165,"../util/struct_array":179,"../util/util":181,"./create_uniform_pragmas":83,"./draw_background":84,"./draw_circle":85,"./draw_debug":87,"./draw_fill":88,"./draw_line":89,"./draw_raster":90,"./draw_symbol":91,"./frame_history":92,"./painter/use_program":95,"./vertex_array_object":96,"gl-matrix":25}],95:[function(t,e,n){"use strict";function r(t,e){return t.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,function(t,n,r,i,a){return e[n][a].replace(/{type}/g,i).replace(/{precision}/g,r)})}var i=t("assert"),a=t("../../util/util"),o=t("mapbox-gl-shaders"),s=o.util;e.exports._createProgram=function(t,e,n,l){for(var u=this.gl,c=u.createProgram(),f=o[t],h="#define MAPBOX_GL_JS;\n",d=0;dthis.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,r={type:this.type,uid:t.uid,coord:t.coord,zoom:t.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:n,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send("load tile",r,function(n,r){if(t.unloadVectorData(this.map.painter),!t.aborted)return n?e(n):(t.loadVectorData(r,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),e(null))}.bind(this),this.workerID)},abortTile:function(t){t.aborted=!0},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},function(){},t.workerID)},serialize:function(){return{type:this.type,data:this._data}}})},{"../data/bucket":68,"../util/evented":173,"../util/util":181,"resolve-url":194}],98:[function(t,e,n){"use strict";function r(t,e,n){n&&(this.loadGeoJSON=n),f.call(this,t,e)}var i=t("../util/util"),a=t("../util/ajax"),o=t("geojson-rewind"),s=t("./geojson_wrapper"),l=t("vt-pbf"),u=t("supercluster"),c=t("geojson-vt"),f=t("./vector_tile_worker_source");e.exports=r,r.prototype=i.inherit(f,{_geoJSONIndexes:{},loadVectorData:function(t,e){var n=t.source,r=t.coord;if(!this._geoJSONIndexes[n])return e(null,null);var i=this._geoJSONIndexes[n].getTile(Math.min(r.z,t.maxZoom),r.x,r.y);if(!i)return e(null,null);var a=new s(i.features);a.name="_geojsonTileLayer";var o=l({layers:{_geojsonTileLayer:a}});0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{tile:a,rawTileData:o.buffer})},loadData:function(t,e){var n=function(n,r){return n?e(n):"object"!=typeof r?e(new Error("Input data is not a valid GeoJSON object.")):(o(r,!0),void this._indexData(r,t,function(n,r){return n?e(n):(this._geoJSONIndexes[t.source]=r,void e(null))}.bind(this)))}.bind(this);this.loadGeoJSON(t,n)},loadGeoJSON:function(t,e){if(t.url)a.getJSON(t.url,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."))}}},_indexData:function(t,e,n){try{e.cluster?n(null,u(e.superclusterOptions).load(t.features)):n(null,c(t,e.geojsonVtOptions))}catch(t){return n(t)}}})},{"../util/ajax":164,"../util/util":181,"./geojson_wrapper":99,"./vector_tile_worker_source":110,"geojson-rewind":15,"geojson-vt":19,supercluster:196,"vt-pbf":208}],99:[function(t,e,n){"use strict";function r(t){this.features=t,this.length=t.length,this.extent=s}function i(t){if(this.type=t.type,1===t.type){this.rawGeometry=[];for(var e=0;ee)){var o=Math.pow(2,Math.min(a.coord.z,this.maxzoom)-Math.min(t.z,this.maxzoom));if(Math.floor(a.coord.x/o)===t.x&&Math.floor(a.coord.y/o)===t.y)for(n[i]=!0,r=!0;a&&a.coord.z-1>t.z;){var s=a.coord.parent(this.maxzoom).id;a=this._tiles[s],a&&a.isRenderable()&&(delete n[i],n[s]=!0)}}}return r},findLoadedParent:function(t,e,n){for(var r=t.z-1;r>=e;r--){t=t.parent(this.maxzoom);var i=this._tiles[t.id];if(i&&i.isRenderable())return n[t.id]=!0,i;if(this._cache.has(t.id))return this.addTile(t),n[t.id]=!0,this._tiles[t.id]}},updateCacheSize:function(t){var e=Math.ceil(t.width/t.tileSize)+1,n=Math.ceil(t.height/t.tileSize)+1,r=e*n,i=5;this._cache.setMaxSize(Math.floor(r*i))},update:function(t,e){if(this._sourceLoaded){var n,i,a;this.updateCacheSize(t);var o=(this.roundZoom?Math.round:Math.floor)(this.getZoom(t)),s=Math.max(o-r.maxOverzooming,this.minzoom),l=Math.max(o+r.maxUnderzooming,this.minzoom),c={},f=(new Date).getTime();this._coveredTiles={};var d=this.used?t.coveringTiles(this._source):[];for(n=0;nf-(e||0)&&(this.findLoadedChildren(i,l,c)&&(c[v]=!0),this.findLoadedParent(i,s,p))}var y;for(y in p)c[y]||(this._coveredTiles[y]=!0);for(y in p)c[y]=!0;var x=h.keysDifference(this._tiles,c);for(n=0;nthis.maxzoom?Math.pow(2,r-this.maxzoom):1;e=new s(n,this.tileSize*i,this.maxzoom),this.loadTile(e,this._tileLoaded.bind(this,e))}return e.uses++,this._tiles[t.id]=e,this.fire("tile.add",{tile:e}),this._source.fire("tile.add",{tile:e}),e},removeTile:function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this.fire("tile.remove",{tile:e}),this._source.fire("tile.remove",{tile:e}),e.uses>0||(e.isRenderable()?this._cache.add(e.coord.wrapped().id,e):(e.aborted=!0,this.abortTile(e),this.unloadTile(e))))},clearTiles:function(){for(var t in this._tiles)this.removeTile(t);this._cache.reset()},tilesIn:function(t){for(var e={},n=this.getIds(),r=1/0,a=1/0,o=-(1/0),s=-(1/0),l=t[0].zoom,c=0;c=0&&v[1].y>=0){for(var y=[],x=0;x=0&&t%1===0),l(!isNaN(e)&&e>=0&&e%1===0),l(!isNaN(n)&&n>=0&&n%1===0),isNaN(r)&&(r=0),this.z=+t,this.x=+e,this.y=+n,this.w=+r,r*=2,r<0&&(r=r*-1-1);var i=1<0;a--)r=1<e.row){var n=t;t=e,e=n}return{x0:t.column,y0:t.row,x1:e.column,y1:e.row,dx:e.column-t.column,dy:e.row-t.row}}function o(t,e,n,r,i){var a=Math.max(n,Math.floor(e.y0)),o=Math.min(r,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;hc.dy&&(l=u,u=c,c=l),u.dy>f.dy&&(l=u,u=f,f=l),c.dy>f.dy&&(l=c,c=f,f=l),u.dy&&o(f,u,r,i,s),c.dy&&o(f,c,r,i,s)}var l=t("assert"),u=t("whoots-js"),c=t("../geo/coordinate");e.exports=r,r.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y},r.prototype.toCoordinate=function(t){var e=Math.min(this.z,t),n=Math.pow(2,e),r=this.y,i=this.x+n*this.w;return new c(i,r,e)},r.fromID=function(t){var e=t%32,n=1<t?new r(this.z-1,this.x,this.y,this.w):new r(this.z-1,Math.floor(this.x/2),Math.floor(this.y/2),this.w)},r.prototype.wrapped=function(){return new r(this.z,this.x,this.y,0)},r.prototype.children=function(t){if(this.z>=t)return[new r(this.z+1,this.x,this.y,this.w)];var e=this.z+1,n=2*this.x,i=2*this.y;return[new r(e,n,i,this.w),new r(e,n+1,i,this.w),new r(e,n,i+1,this.w),new r(e,n+1,i+1,this.w)]},r.cover=function(t,e,n){function i(t,e,i){var s,l,u;if(i>=0&&i<=a)for(s=t;sthis.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,i={url:s(t.coord.url(this.tiles,this.maxzoom,this.scheme),this.url),uid:t.uid,coord:t.coord,zoom:t.coord.z,tileSize:this.tileSize*r,source:this.id,overscaling:r,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID?"loading"===t.state?t.reloadCallback=e:(i.rawTileData=t.rawTileData,this.dispatcher.send("reload tile",i,n.bind(this),t.workerID)):t.workerID=this.dispatcher.send("load tile",i,n.bind(this))},abortTile:function(t){this.dispatcher.send("abort tile",{uid:t.uid,source:this.id},null,t.workerID)},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)}})},{"../util/evented":173,"../util/mapbox":178,"../util/util":181,"./load_tilejson":101}],110:[function(t,e,n){"use strict";function r(t,e,n){this.actor=t,this.styleLayers=e,n&&(this.loadVectorData=n),this.loading={},this.loaded={}}var i=t("../util/ajax"),a=t("vector-tile"),o=t("pbf"),s=t("./worker_tile");e.exports=r,r.prototype={loadTile:function(t,e){function n(t,n){return delete this.loading[r][i],t?e(t):n?(a.data=n.tile,a.parse(a.data,this.styleLayers.getLayerFamilies(),this.actor,n.rawTileData,e),this.loaded[r]=this.loaded[r]||{},void(this.loaded[r][i]=a)):e(null,null)}var r=t.source,i=t.uid;this.loading[r]||(this.loading[r]={});var a=this.loading[r][i]=new s(t);a.abort=this.loadVectorData(t,n.bind(this))},reloadTile:function(t,e){var n=this.loaded[t.source],r=t.uid;if(n&&n[r]){var i=n[r];i.parse(i.data,this.styleLayers.getLayerFamilies(),this.actor,t.rawTileData,e)}},abortTile:function(t){var e=this.loading[t.source],n=t.uid;e&&e[n]&&e[n].abort&&(e[n].abort(),delete e[n])},removeTile:function(t){var e=this.loaded[t.source],n=t.uid;e&&e[n]&&delete e[n]},loadVectorData:function(t,e){function n(t,n){if(t)return e(t);var r=new a.VectorTile(new o(new Uint8Array(n)));e(t,{tile:r,rawTileData:n})}var r=i.getArrayBuffer(t.url,n.bind(this));return function(){r.abort()}},redoPlacement:function(t,e){var n=this.loaded[t.source],r=this.loading[t.source],i=t.uid;if(n&&n[i]){var a=n[i],o=a.redoPlacement(t.angle,t.pitch,t.showCollisionBoxes);o.result&&e(null,o.result,o.transferables)}else r&&r[i]&&(r[i].angle=t.angle)}}},{"../util/ajax":164,"./worker_tile":113,pbf:186,"vector-tile":204}],111:[function(t,e,n){"use strict";function r(t,e){this.id=t,this.urls=e.urls,this.coordinates=e.coordinates,u.getVideo(e.urls,function(t,n){if(t)return this.fire("error",{error:t});this.video=n,this.video.loop=!0;var r;this.video.addEventListener("playing",function(){r=this.map.style.animationLoop.set(1/0),this.map._rerender()}.bind(this)),this.video.addEventListener("pause",function(){this.map.style.animationLoop.cancel(r)}.bind(this)),this.map&&(this.video.play(),this.setCoordinates(e.coordinates)),this.fire("load")}.bind(this))}var i=t("../util/util"),a=t("./tile_coord"),o=t("../geo/lng_lat"),s=t("point-geometry"),l=t("../util/evented"),u=t("../util/ajax"),c=t("../data/bucket").EXTENT,f=t("../render/draw_raster").RasterBoundsArray,h=t("../data/buffer"),d=t("../render/vertex_array_object");e.exports=r,r.prototype=i.inherit(l,{minzoom:0,maxzoom:22,tileSize:512,roundZoom:!0,getVideo:function(){return this.video},onAdd:function(t){this.map||(this.map=t,this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},setCoordinates:function(t){this.coordinates=t;var e=this.map,n=t.map(function(t){return e.transform.locationCoordinate(o.convert(t)).zoomTo(0)}),r=this.centerCoord=i.getCoordinatesCenter(n);return r.column=Math.round(r.column),r.row=Math.round(r.row),this.minzoom=this.maxzoom=r.zoom,this._coord=new a(r.zoom,r.column,r.row),this._tileCoords=n.map(function(t){var e=t.zoomTo(r.zoom);return new s(Math.round((e.column-r.column)*c),Math.round((e.row-r.row)*c))}),this.fire("change"),this},_setTile:function(t){this._prepared=!1,this.tile=t;var e=32767,n=new f;n.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),n.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,e,0),n.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,e),n.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,e,e),this.tile.buckets={},this.tile.boundsBuffer=new h(n.serialize(),f.serialize(),h.BufferType.VERTEX),this.tile.boundsVAO=new d,this.tile.state="loaded"},prepare:function(){if(!(this.video.readyState<2)&&this.tile){var t=this.map.painter.gl;this._prepared?(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this._prepared=!0,this.tile.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.video)),this._currentTime=this.video.currentTime}},loadTile:function(t,e){this._coord&&this._coord.toString()===t.coord.toString()?(this._setTile(t),e(null)):(t.state="errored",e(null))},serialize:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}})},{"../data/bucket":68,"../data/buffer":73,"../geo/lng_lat":78,"../render/draw_raster":90,"../render/vertex_array_object":96,"../util/ajax":164,"../util/evented":173,"../util/util":181,"./tile_coord":108,"point-geometry":187}],112:[function(t,e,n){"use strict";function r(t){this.self=t,this.actor=new a(t,this);var e={getLayers:function(){return this.layers}.bind(this),getLayerFamilies:function(){return this.layerFamilies}.bind(this)};this.workerSources={vector:new l(this.actor,e),geojson:new u(this.actor,e)},this.self.registerWorkerSource=function(t,n){if(this.workerSources[t])throw new Error('Worker source with name "'+t+'" already registered.');this.workerSources[t]=new n(this.actor,e)}.bind(this)}function i(t){var e={};for(var n in t){var r=t[n],i=r.ref||r.id,a=t[i];a.layout&&"none"===a.layout.visibility||(e[i]=e[i]||[],n===i?e[i].unshift(r):e[i].push(r))}return e}var a=t("../util/actor"),o=t("../style/style_layer"),s=t("../util/util"),l=t("./vector_tile_worker_source"),u=t("./geojson_worker_source");e.exports=function(t){return new r(t)},s.extend(r.prototype,{"set layers":function(t){function e(t){var e=o.create(t,t.ref&&n.layers[t.ref]);e.updatePaintTransitions({},{transition:!1}),n.layers[e.id]=e}this.layers={};for(var n=this,r=[],a=0;a=0;e--)x(z,C[e]);_()}}function x(t,e){if(e.populateArrays(A,j,R),"symbol"!==e.type)for(var n=0;n=w.maxzoom||w.layout&&"none"===w.layout.visibility||t.layers&&!t.layers[w.sourceLayer]||(k=c.create({layer:w,index:I++,childLayers:e[D],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,symbolQuadsArray:this.symbolQuadsArray,symbolInstancesArray:this.symbolInstancesArray,sourceLayerIndex:T.encode(w.sourceLayer||"_geojsonTileLayer")}),k.createFilter(),E[w.id]=k,t.layers&&(M=w.sourceLayer,L[M]=L[M]||{},L[M][w.id]=k)));if(t.layers)for(M in L)1===w.version&&d.warnOnce('Vector tile source "'+this.source+'" layer "'+M+'" does not use vector tile spec v2 and therefore may have some rendering errors.'),w=t.layers[M],w&&v(w,L[M]);else v(t,E);var P=[],C=this.symbolBuckets=[],O=[];S.bucketLayerIDs={};for(var F in E)k=E[F],0!==k.features.length&&(S.bucketLayerIDs[k.index]=k.childLayers.map(s),P.push(k),"symbol"===k.type?C.push(k):O.push(k));var R={},j={},N=0;if(C.length>0){for(b=C.length-1;b>=0;b--)C[b].updateIcons(R),C[b].updateFont(j);for(var B in j)j[B]=Object.keys(j[B]).map(Number);R=Object.keys(R),n.send("get glyphs",{uid:this.uid,stacks:j},function(t,e){j=e,y(t)}),R.length?n.send("get icons",{icons:R},function(t,e){R=e,y(t)}):y()}for(b=O.length-1;b>=0;b--)x(this,O[b]);if(0===C.length)return _()},r.prototype.redoPlacement=function(t,e,n){if("done"!==this.status)return this.redoPlacementAfterDone=!0,this.angle=t,{};for(var r=new u(t,e,this.collisionBoxArray),s=this.symbolBuckets,l=s.length-1;l>=0;l--)s[l].placeFeatures(r,n);var c=r.serialize(),f=s.filter(i);return{result:{buckets:f.map(a),collisionTile:c.data},transferables:o(f).concat(c.transferables)}}},{"../data/bucket":68,"../data/feature_index":75,"../symbol/collision_box":133,"../symbol/collision_tile":135,"../symbol/symbol_instances":144,"../symbol/symbol_quads":145,"../util/dictionary_coder":171,"../util/util":181}],114:[function(t,e,n){"use strict";function r(){this.n=0,this.times=[]}e.exports=r,r.prototype.stopped=function(){return this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()}),!this.times.length},r.prototype.set=function(t){return this.times.push({id:this.n,time:t+(new Date).getTime()}),this.n++; },r.prototype.cancel=function(t){this.times=this.times.filter(function(e){return e.id!==t})}},{}],115:[function(t,e,n){"use strict";function r(t){this.base=t,this.retina=s.devicePixelRatio>1;var e=this.retina?"@2x":"";o.getJSON(l(t,e,".json"),function(t,e){return t?void this.fire("error",{error:t}):(this.data=e,void(this.img&&this.fire("load")))}.bind(this)),o.getImage(l(t,e,".png"),function(t,e){if(t)return void this.fire("error",{error:t});for(var n=e.getData(),r=e.data=new Uint8Array(n.length),i=0;i1!==this.retina){var t=new r(this.base);t.on("load",function(){this.img=t.img,this.data=t.data,this.retina=t.retina}.bind(this))}},i.prototype={x:0,y:0,width:0,height:0,pixelRatio:1,sdf:!1},r.prototype.getSpritePosition=function(t){if(!this.loaded())return new i;var e=this.data&&this.data[t];return e&&this.img?e:new i}},{"../util/ajax":164,"../util/browser":165,"../util/evented":173,"../util/mapbox":178}],116:[function(t,e,n){"use strict";var r=t("csscolorparser").parseCSSColor,i=t("../util/util"),a=t("./style_function"),o={};e.exports=function t(e){if(a.isFunctionDefinition(e))return i.extend({},e,{stops:e.stops.map(function(e){return[e[0],t(e[1])]})});if("string"==typeof e){if(!o[e]){var n=r(e);if(!n)throw new Error("Invalid color "+e);o[e]=[n[0]/255*n[3],n[1]/255*n[3],n[2]/255*n[3],n[3]]}return o[e]}throw new Error("Invalid color "+e)}},{"../util/util":181,"./style_function":119,csscolorparser:7}],117:[function(t,e,n){"use strict";function r(t,e,n){this.animationLoop=e||new m,this.dispatcher=new p(n||1,this),this.spriteAtlas=new l(1024,1024),this.lineAtlas=new u(256,512),this._layers={},this._order=[],this._groups=[],this.sources={},this.zoomHistory={},c.bindAll(["_forwardSourceEvent","_forwardTileEvent","_forwardLayerEvent","_redoPlacement"],this),this._resetUpdates();var r=function(t,e){if(t)return void this.fire("error",{error:t});if(!g.emitErrors(this,g(e))){this._loaded=!0,this.stylesheet=e,this.updateClasses();var n=e.sources;for(var r in n)this.addSource(r,n[r]);e.sprite&&(this.sprite=new o(e.sprite),this.sprite.on("load",this.fire.bind(this,"change"))),this.glyphSource=new s(e.glyphs),this._resolve(),this.fire("load")}}.bind(this);"string"==typeof t?f.getJSON(h(t),r):d.frame(r.bind(this,null,t)),this.on("source.load",function(t){var e=t.source;if(e&&e.vectorLayerIds)for(var n in this._layers){var r=this._layers[n];r.source===e.id&&this._validateLayer(r)}})}var i=t("../util/evented"),a=t("./style_layer"),o=t("./image_sprite"),s=t("../symbol/glyph_source"),l=t("../symbol/sprite_atlas"),u=t("../render/line_atlas"),c=t("../util/util"),f=t("../util/ajax"),h=t("../util/mapbox").normalizeStyleURL,d=t("../util/browser"),p=t("../util/dispatcher"),m=t("./animation_loop"),g=t("./validate_style"),v=t("../source/source"),y=t("../source/query_features"),x=t("../source/source_cache"),_=t("./style_spec"),b=t("./style_function");e.exports=r,r.prototype=c.inherit(i,{_loaded:!1,_validateLayer:function(t){var e=this.sources[t.source];t.sourceLayer&&e&&e.vectorLayerIds&&e.vectorLayerIds.indexOf(t.sourceLayer)===-1&&this.fire("error",{error:new Error('Source layer "'+t.sourceLayer+'" does not exist on source "'+e.id+'" as specified by style layer "'+t.id+'"')})},loaded:function(){if(!this._loaded)return!1;if(Object.keys(this._updates.sources).length)return!1;for(var t in this.sources)if(!this.sources[t].loaded())return!1;return!(this.sprite&&!this.sprite.loaded())},_resolve:function(){var t,e;this._layers={},this._order=this.stylesheet.layers.map(function(t){return t.id});for(var n=0;nMath.floor(t)&&(e.lastIntegerZoom=Math.floor(t+1),e.lastIntegerZoomTime=Date.now()),e.lastZoom=t},_checkLoaded:function(){if(!this._loaded)throw new Error("Style is not done loading")},update:function(t,e){if(!this._updates.changed)return this;if(this._updates.allLayers)this._groupLayers(),this._updateWorkerLayers();else{var n=Object.keys(this._updates.layers);n.length&&this._updateWorkerLayers(n)}var r,i=Object.keys(this._updates.sources);for(r=0;r=0;return r&&this._handleErrors(g.source,"sources."+t,e)?this:(e=new x(t,e,this.dispatcher),this.sources[t]=e,e.style=this,e.on("load",this._forwardSourceEvent).on("error",this._forwardSourceEvent).on("change",this._forwardSourceEvent).on("tile.add",this._forwardTileEvent).on("tile.load",this._forwardTileEvent).on("tile.error",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.add",{source:e}]),this._updates.changed=!0,this)},removeSource:function(t){if(this._checkLoaded(),void 0===this.sources[t])throw new Error("There is no source with this ID");var e=this.sources[t];return delete this.sources[t],delete this._updates.sources[t],e.off("load",this._forwardSourceEvent).off("error",this._forwardSourceEvent).off("change",this._forwardSourceEvent).off("tile.add",this._forwardTileEvent).off("tile.load",this._forwardTileEvent).off("tile.error",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.remove",{source:e}]),this._updates.changed=!0,this},getSource:function(t){return this.sources[t]&&this.sources[t].getSource()},addLayer:function(t,e){if(this._checkLoaded(),!(t instanceof a)){if(this._handleErrors(g.layer,"layers."+t.id,t,!1,{arrayIndex:-1}))return this;var n=t.ref&&this.getLayer(t.ref);t=a.create(t,n)}return this._validateLayer(t),t.on("error",this._forwardLayerEvent),this._layers[t.id]=t,this._order.splice(e?this._order.indexOf(e):1/0,0,t.id),this._updates.allLayers=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.events.push(["layer.add",{layer:t}]),this.updateClasses(t.id)},removeLayer:function(t){this._checkLoaded();var e=this._layers[t];if(void 0===e)throw new Error("There is no layer with this ID");for(var n in this._layers)this._layers[n].ref===t&&this.removeLayer(n);return e.off("error",this._forwardLayerEvent),delete this._layers[t],delete this._updates.layers[t],delete this._updates.paintProps[t],this._order.splice(this._order.indexOf(t),1),this._updates.allLayers=!0,this._updates.events.push(["layer.remove",{layer:e}]),this._updates.changed=!0,this},getLayer:function(t){return this._layers[t]},getReferentLayer:function(t){var e=this.getLayer(t);return e.ref&&(e=this.getLayer(e.ref)),e},setLayerZoomRange:function(t,e,n){this._checkLoaded();var r=this.getReferentLayer(t);return r.minzoom===e&&r.maxzoom===n?this:(null!=e&&(r.minzoom=e),null!=n&&(r.maxzoom=n),this._updateLayer(r))},setFilter:function(t,e){this._checkLoaded();var n=this.getReferentLayer(t);return null!==e&&this._handleErrors(g.filter,"layers."+n.id+".filter",e)?this:c.deepEqual(n.filter,e)?this:(n.filter=c.clone(e),this._updateLayer(n))},getFilter:function(t){return this.getReferentLayer(t).filter},setLayoutProperty:function(t,e,n){this._checkLoaded();var r=this.getReferentLayer(t);return c.deepEqual(r.getLayoutProperty(e),n)?this:(r.setLayoutProperty(e,n),this._updateLayer(r))},getLayoutProperty:function(t,e){return this.getReferentLayer(t).getLayoutProperty(e)},setPaintProperty:function(t,e,n,r){this._checkLoaded();var i=this.getLayer(t);if(c.deepEqual(i.getPaintProperty(e,r),n))return this;var a=i.isPaintValueFeatureConstant(e);i.setPaintProperty(e,n,r);var o=!(n&&b.isFunctionDefinition(n)&&"$zoom"!==n.property&&void 0!==n.property);return o&&a||(this._updates.layers[t]=!0,i.source&&(this._updates.sources[i.source]=!0)),this.updateClasses(t,e)},getPaintProperty:function(t,e,n){return this.getLayer(t).getPaintProperty(e,n)},updateClasses:function(t,e){if(this._updates.changed=!0,t){var n=this._updates.paintProps;n[t]||(n[t]={}),n[t][e||"all"]=!0}else this._updates.allPaintProps=!0;return this},serialize:function(){return c.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,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:c.mapObject(this.sources,function(t){return t.serialize()}),layers:this._order.map(function(t){return this._layers[t].serialize()},this)},function(t){return void 0!==t})},_updateLayer:function(t){return this._updates.layers[t.id]=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.changed=!0,this},_flattenRenderedFeatures:function(t){for(var e=[],n=this._order.length-1;n>=0;n--)for(var r=this._order[n],i=0;is.lastIntegerZoom?(r=u+(1-u)*c,f*=2,i=t({zoom:o-1},n),a=t({zoom:o},n)):(r=1-(1-c)*u,a=t({zoom:o},n),i=t({zoom:o+1},n),f/=2),void 0===i||void 0===a?void 0:{from:i,fromScale:f,to:a,toScale:h,t:r}}}var a=t("./style_function"),o=t("./parse_color"),s=t("../util/util");e.exports=r},{"../util/util":181,"./parse_color":116,"./style_function":119}],119:[function(t,e,n){"use strict";var r=t("mapbox-gl-function");n.interpolated=function(t){var e=r.interpolated(t),n=function(t,n){return e(t&&t.zoom,n||{})};return n.isFeatureConstant=e.isFeatureConstant,n.isZoomConstant=e.isZoomConstant,n},n["piecewise-constant"]=function(t){var e=r["piecewise-constant"](t),n=function(t,n){return e(t&&t.zoom,n||{})};return n.isFeatureConstant=e.isFeatureConstant,n.isZoomConstant=e.isZoomConstant,n},n.isFunctionDefinition=r.isFunctionDefinition},{"mapbox-gl-function":41}],120:[function(t,e,n){"use strict";function r(t,e){this.set(t,e)}function i(t){return t.value}var a=t("../util/util"),o=t("./style_transition"),s=t("./style_declaration"),l=t("./style_spec"),u=t("./validate_style"),c=t("./parse_color"),f=t("../util/evented");e.exports=r;var h="-transition";r.create=function(e,n){var r={background:t("./style_layer/background_style_layer"),circle:t("./style_layer/circle_style_layer"),fill:t("./style_layer/fill_style_layer"),line:t("./style_layer/line_style_layer"),raster:t("./style_layer/raster_style_layer"),symbol:t("./style_layer/symbol_style_layer")};return new r[(n||e).type](e,n)},r.prototype=a.inherit(f,{set:function(t,e){this.id=t.id,this.ref=t.ref,this.metadata=t.metadata,this.type=(e||t).type,this.source=(e||t).source,this.sourceLayer=(e||t)["source-layer"],this.minzoom=(e||t).minzoom,this.maxzoom=(e||t).maxzoom,this.filter=(e||t).filter,this.paint={},this.layout={},this._paintSpecifications=l["paint_"+this.type],this._layoutSpecifications=l["layout_"+this.type],this._paintTransitions={},this._paintTransitionOptions={},this._paintDeclarations={},this._layoutDeclarations={},this._layoutFunctions={};var n,r;for(var i in t){var a=i.match(/^paint(?:\.(.*))?$/);if(a){var o=a[1]||"";for(n in t[i])this.setPaintProperty(n,t[i][n],o)}}if(this.ref)this._layoutDeclarations=e._layoutDeclarations;else for(r in t.layout)this.setLayoutProperty(r,t.layout[r]);for(n in this._paintSpecifications)this.paint[n]=this.getPaintValue(n);for(r in this._layoutSpecifications)this._updateLayoutValue(r)},setLayoutProperty:function(t,e){if(null==e)delete this._layoutDeclarations[t];else{var n="layers."+this.id+".layout."+t;if(this._handleErrors(u.layoutProperty,n,t,e))return;this._layoutDeclarations[t]=new s(this._layoutSpecifications[t],e)}this._updateLayoutValue(t)},getLayoutProperty:function(t){return this._layoutDeclarations[t]&&this._layoutDeclarations[t].value},getLayoutValue:function(t,e,n){var r=this._layoutSpecifications[t],i=this._layoutDeclarations[t];return i?i.calculate(e,n):r.default},setPaintProperty:function(t,e,n){var r="layers."+this.id+(n?'["paint.'+n+'"].':".paint.")+t;if(a.endsWith(t,h))if(this._paintTransitionOptions[n||""]||(this._paintTransitionOptions[n||""]={}),null===e||void 0===e)delete this._paintTransitionOptions[n||""][t];else{if(this._handleErrors(u.paintProperty,r,t,e))return;this._paintTransitionOptions[n||""][t]=e}else if(this._paintDeclarations[n||""]||(this._paintDeclarations[n||""]={}),null===e||void 0===e)delete this._paintDeclarations[n||""][t];else{if(this._handleErrors(u.paintProperty,r,t,e))return;this._paintDeclarations[n||""][t]=new s(this._paintSpecifications[t],e)}},getPaintProperty:function(t,e){return e=e||"",a.endsWith(t,h)?this._paintTransitionOptions[e]&&this._paintTransitionOptions[e][t]:this._paintDeclarations[e]&&this._paintDeclarations[e][t]&&this._paintDeclarations[e][t].value},getPaintValue:function(t,e,n){var r=this._paintSpecifications[t],i=this._paintTransitions[t];return i?i.calculate(e,n):"color"===r.type&&r.default?c(r.default):r.default},getPaintValueStopZoomLevels:function(t){var e=this._paintTransitions[t];return e?e.declaration.stopZoomLevels:[]},getPaintInterpolationT:function(t,e){var n=this._paintTransitions[t];return n.declaration.calculateInterpolationT({zoom:e})},isPaintValueFeatureConstant:function(t){var e=this._paintTransitions[t];return!e||e.declaration.isFeatureConstant},isLayoutValueFeatureConstant:function(t){var e=this._layoutDeclarations[t];return!e||e.isFeatureConstant},isPaintValueZoomConstant:function(t){var e=this._paintTransitions[t];return!e||e.declaration.isZoomConstant},isHidden:function(t){return!!(this.minzoom&&t=this.maxzoom)||("none"===this.layout.visibility||0===this.paint[this.type+"-opacity"]))},updatePaintTransitions:function(t,e,n,r){for(var i=a.extend({},this._paintDeclarations[""]),o=0;o-n/2;){if(o--,o<0)return!1;s-=t[o].dist(a),a=t[o]}s+=t[o].dist(t[o+1]),o++;for(var l=[],u=0;sr;)u-=l.shift().angleDelta;if(u>i)return!1;o++,s+=f.dist(h)}return!0}e.exports=r},{}],132:[function(t,e,n){"use strict";function r(t,e,n,r,a){for(var o=[],s=0;s=r&&h.x>=r||(f.x>=r?f=new i(r,f.y+(h.y-f.y)*((r-f.x)/(h.x-f.x)))._round():h.x>=r&&(h=new i(r,f.y+(h.y-f.y)*((r-f.x)/(h.x-f.x)))._round()),f.y>=a&&h.y>=a||(f.y>=a?f=new i(f.x+(h.x-f.x)*((a-f.y)/(h.y-f.y)),a)._round():h.y>=a&&(h=new i(f.x+(h.x-f.x)*((a-f.y)/(h.y-f.y)),a)._round()),l&&f.equals(l[l.length-1])||(l=[f],o.push(l)),l.push(h)))))}return o}var i=t("point-geometry");e.exports=r},{"point-geometry":187}],133:[function(t,e,n){"use strict";var r=t("../util/struct_array"),i=t("../util/util"),a=t("point-geometry"),o=e.exports=new r({members:[{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Float32",name:"maxScale"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"bbox0"},{type:"Int16",name:"bbox1"},{type:"Int16",name:"bbox2"},{type:"Int16",name:"bbox3"},{type:"Float32",name:"placementScale"}]});i.extendAll(o.prototype.StructType.prototype,{get anchorPoint(){return new a(this.anchorPointX,this.anchorPointY)}})},{"../util/struct_array":179,"../util/util":181,"point-geometry":187}],134:[function(t,e,n){"use strict";function r(t,e,n,r,i,a,o,s,l,u,c){var f=o.top*s-l,h=o.bottom*s+l,d=o.left*s-l,p=o.right*s+l;if(this.boxStartIndex=t.length,u){var m=h-f,g=p-d;if(m>0)if(m=Math.max(10*s,m),c){var v=e[n.segment+1].sub(e[n.segment])._unit()._mult(g),y=[n.sub(v),n.add(v)];this._addLineCollisionBoxes(t,y,n,0,g,m,r,i,a)}else this._addLineCollisionBoxes(t,e,n,n.segment,g,m,r,i,a)}else t.emplaceBack(n.x,n.y,d,f,p,h,1/0,r,i,a,0,0,0,0,0);this.boxEndIndex=t.length}e.exports=r,r.prototype._addLineCollisionBoxes=function(t,e,n,r,i,a,o,s,l){var u=a/2,c=Math.floor(i/u),f=-a/2,h=this.boxes,d=n,p=r+1,m=f;do{if(p--,p<0)return h;m-=e[p].dist(d),d=e[p]}while(m>-i/2);for(var g=e[p].dist(e[p+1]),v=0;v=e.length)return h;g=e[p].dist(e[p+1])}var x=y-m,_=e[p],b=e[p+1],w=b.sub(_)._unit()._mult(x)._add(_)._round(),M=Math.max(Math.abs(y-f)-u/2,0),k=i/2/M;t.emplaceBack(w.x,w.y,-a/2,-a/2,a/2,a/2,k,o,s,l,0,0,0,0,0)}return h}},{}],135:[function(t,e,n){"use strict";function r(t,e,n){if("object"==typeof t){var r=t;n=e,t=r.angle,e=r.pitch,this.grid=new o(r.grid),this.ignoredGrid=new o(r.ignoredGrid)}else this.grid=new o(a,12,6),this.ignoredGrid=new o(a,12,0);this.angle=t,this.pitch=e;var i=Math.sin(t),s=Math.cos(t);if(this.rotationMatrix=[s,-i,i,s],this.reverseRotationMatrix=[s,i,-i,s],this.yStretch=1/Math.cos(e/180*Math.PI),this.yStretch=Math.pow(this.yStretch,1.3),this.collisionBoxArray=n,0===n.length){n.emplaceBack();var l=32767;n.emplaceBack(0,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),n.emplaceBack(a,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),n.emplaceBack(0,0,-l,0,l,0,l,0,0,0,0,0,0,0,0,0),n.emplaceBack(0,a,-l,0,l,0,l,0,0,0,0,0,0,0,0,0)}this.tempCollisionBox=n.get(0),this.edges=[n.get(1),n.get(2),n.get(3),n.get(4)]}var i=t("point-geometry"),a=t("../data/bucket").EXTENT,o=t("grid-index");e.exports=r,r.prototype.serialize=function(){var t={angle:this.angle,pitch:this.pitch,grid:this.grid.toArrayBuffer(),ignoredGrid:this.ignoredGrid.toArrayBuffer()};return{data:t,transferables:[t.grid,t.ignoredGrid]}},r.prototype.minScale=.25,r.prototype.maxScale=2,r.prototype.placeCollisionFeature=function(t,e,n){for(var r=this.collisionBoxArray,a=this.minScale,o=this.rotationMatrix,s=this.yStretch,l=t.boxStartIndex;l=this.maxScale)return a}if(n){var b;if(this.angle){var w=this.reverseRotationMatrix,M=new i(u.x1,u.y1).matMult(w),k=new i(u.x2,u.y1).matMult(w),A=new i(u.x1,u.y2).matMult(w),S=new i(u.x2,u.y2).matMult(w);b=this.tempCollisionBox,b.anchorPointX=u.anchorPoint.x,b.anchorPointY=u.anchorPoint.y,b.x1=Math.min(M.x,k.x,A.x,S.x),b.y1=Math.min(M.y,k.x,A.x,S.x),b.x2=Math.max(M.x,k.x,A.x,S.x),b.y2=Math.max(M.y,k.x,A.x,S.x),b.maxScale=u.maxScale}else b=u;for(var T=0;T=this.maxScale)return a}}}return a},r.prototype.queryRenderedSymbols=function(t,e,n,r,a){var o={},s=[],l=this.collisionBoxArray,u=this.rotationMatrix,c=new i(t,e)._matMult(u),f=this.tempCollisionBox;f.anchorX=c.x,f.anchorY=c.y,f.x1=0,f.y1=0,f.x2=n-t,f.y2=r-e,f.maxScale=a,a=f.maxScale;for(var h=[c.x+f.x1/a,c.y+f.y1/a*this.yStretch,c.x+f.x2/a,c.y+f.y2/a*this.yStretch],d=this.grid.query(h[0],h[1],h[2],h[3]),p=this.ignoredGrid.query(h[0],h[1],h[2],h[3]),m=0;m=a&&(o[y][x]=!0,s.push(d[g]))}}return s},r.prototype.getPlacementScale=function(t,e,n,r,i){var a=e.x-r.x,o=e.y-r.y,s=(i.x1-n.x2)/a,l=(i.x2-n.x1)/a,u=(i.y1-n.y2)*this.yStretch/o,c=(i.y2-n.y1)*this.yStretch/o;(isNaN(s)||isNaN(l))&&(s=l=1),(isNaN(u)||isNaN(c))&&(u=c=1);var f=Math.min(Math.max(s,l),Math.max(u,c)),h=i.maxScale,d=n.maxScale;return f>h&&(f=h),f>d&&(f=d),f>t&&f>=i.placementScale&&(t=f),t},r.prototype.insertCollisionFeature=function(t,e,n){for(var r=n?this.ignoredGrid:this.grid,i=this.collisionBoxArray,a=t.boxStartIndex;a=0&&A=0&&S=0&&v+d<=p){var T=new o(A,S,M,x)._round();r&&!s(t,T,u,r,l)||y.push(T)}}g+=w}return f||y.length||c||(y=i(t,g/2,n,r,l,u,c,!0,h)),y}var a=t("../util/interpolate"),o=t("../symbol/anchor"),s=t("./check_max_angle");e.exports=r},{"../symbol/anchor":130,"../util/interpolate":175,"./check_max_angle":131}],137:[function(t,e,n){"use strict";function r(){this.width=s,this.height=s,this.bin=new i(this.width,this.height),this.index={},this.ids={},this.data=new Uint8Array(this.width*this.height)}var i=t("shelf-pack"),a=t("../util/util"),o=4,s=128,l=2048;e.exports=r,r.prototype.getGlyphs=function(){var t,e,n,r={};for(var i in this.ids)t=i.split("#"),e=t[0],n=t[1],r[e]||(r[e]=[]),r[e].push(n);return r},r.prototype.getRects=function(){var t,e,n,r={};for(var i in this.ids)t=i.split("#"),e=t[0],n=t[1],r[e]||(r[e]={}),r[e][n]=this.index[i];return r},r.prototype.addGlyph=function(t,e,n,r){if(!n)return null;var i=e+"#"+n.id;if(this.index[i])return this.ids[i].indexOf(t)<0&&this.ids[i].push(t),this.index[i];if(!n.bitmap)return null;var o=n.width+2*r,s=n.height+2*r,l=1,u=o+2*l,c=s+2*l;u+=4-u%4,c+=4-c%4;var f=this.bin.packOne(u,c);if(f||(this.resize(),f=this.bin.packOne(u,c)),!f)return a.warnOnce("glyph bitmap overflow"),null;this.index[i]=f,this.ids[i]=[t];for(var h=this.data,d=n.bitmap,p=0;p=l||e>=l)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=o,this.height*=o,this.bin.resize(this.width,this.height);for(var n=new ArrayBuffer(this.width*this.height),r=0;r65535)return n("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var r=this.loading[t];if(r[e])r[e].push(n);else{r[e]=[n];var i=256*e+"-"+(256*e+255),o=a(t,i,this.url);s(o,function(t,n){for(var i=!t&&new l(new c(new Uint8Array(n))),a=0;ar&&null!==c){var _=v[c+1].x;g=Math.max(_,g);for(var b=c+1;b<=y;b++)v[b].y+=n,v[b].x-=_;if(o){var w=c;f[v[c].codePoint]&&w--,s(v,e,p,w,o)}p=c+1,c=null,d+=_,m++}h[x.codePoint]&&(c=y)}var M=v[v.length-1],k=M.x+e[M.codePoint].advance;g=Math.max(g,k);var A=(m+1)*n;s(v,e,p,v.length-1,o),l(v,o,i,a,g,n,m,u),t.top+=-a*A,t.bottom=t.top+A,t.left+=-i*g,t.right=t.left+g}function s(t,e,n,r,i){for(var a=e[t[r].codePoint].advance,o=(t[r].x+a)*i,s=n;s<=r;s++)t[s].x-=o}function l(t,e,n,r,i,a,o,s){for(var l=(e-n)*i+s[0],u=(-r*(o+1)+.5)*a+s[1],c=0;c1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},r.prototype.addIcons=function(t,e){for(var n=0;n1||(w?(clearTimeout(w),w=null,v("dblclick",e)):w=setTimeout(d,300))}function c(t){y("touchmove",t)}function f(t){y("touchend",t)}function h(t){y("touchcancel",t)}function d(){w=null}function p(t){var e=r.mousePos(x,t);e.equals(b)&&v("click",t)}function m(t){v("dblclick",t),t.preventDefault()}function g(t){_=t,t.preventDefault()}function v(e,n){var i=r.mousePos(x,n);return t.fire(e,{lngLat:t.unproject(i),point:i,originalEvent:n})}function y(e,n){var a=r.touchPos(x,n),o=a.reduce(function(t,e,n,r){return t.add(e.div(r.length))},new i(0,0));return t.fire(e,{lngLat:t.unproject(o),point:o,lngLats:a.map(function(e){return t.unproject(e)},this),points:a,originalEvent:n})}var x=t.getCanvasContainer(),_=null,b=null,w=null;for(var M in a)t[M]=new a[M](t,e),e.interactive&&e[M]&&t[M].enable();x.addEventListener("mouseout",n,!1),x.addEventListener("mousedown",o,!1),x.addEventListener("mouseup",s,!1),x.addEventListener("mousemove",l,!1),x.addEventListener("touchstart",u,!1),x.addEventListener("touchend",f,!1),x.addEventListener("touchmove",c,!1),x.addEventListener("touchcancel",h,!1),x.addEventListener("click",p,!1),x.addEventListener("dblclick",m,!1),x.addEventListener("contextmenu",g,!1)}},{"../util/dom":167,"./handler/box_zoom":152,"./handler/dblclick_zoom":153,"./handler/drag_pan":154,"./handler/drag_rotate":155,"./handler/keyboard":156,"./handler/scroll_zoom":157,"./handler/touch_zoom_rotate":158,"point-geometry":187}],147:[function(t,e,n){"use strict";var r=t("../util/util"),i=t("../util/interpolate"),a=t("../util/browser"),o=t("../geo/lng_lat"),s=t("../geo/lng_lat_bounds"),l=t("point-geometry"),u=e.exports=function(){};r.extend(u.prototype,{getCenter:function(){return this.transform.center},setCenter:function(t,e){return this.jumpTo({center:t},e),this},panBy:function(t,e,n){return this.panTo(this.transform.center,r.extend({offset:l.convert(t).mult(-1)},e),n),this},panTo:function(t,e,n){return this.easeTo(r.extend({center:t},e),n)},getZoom:function(){return this.transform.zoom},setZoom:function(t,e){return this.jumpTo({zoom:t},e),this},zoomTo:function(t,e,n){return this.easeTo(r.extend({zoom:t},e),n)},zoomIn:function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},zoomOut:function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},getBearing:function(){return this.transform.bearing},setBearing:function(t,e){return this.jumpTo({bearing:t},e),this},rotateTo:function(t,e,n){return this.easeTo(r.extend({bearing:t},e),n)},resetNorth:function(t,e){return this.rotateTo(0,r.extend({duration:1e3},t),e),this},snapToNorth:function(t,e){return Math.abs(this.getBearing())180&&(c.center.lng>0&&m.lng<0?m.lng+=360:c.center.lng<0&&m.lng>0&&(m.lng-=360));var x=c.zoomScale(g-h),_=c.point,b="center"in t?c.project(m).sub(f.div(x)):_,w=c.worldSize,M=t.curve,k=Math.max(c.width,c.height),A=k/x,S=b.sub(_).mag();if("minZoom"in t){var T=r.clamp(Math.min(t.minZoom,h,g),c.minZoom,c.maxZoom),z=k/c.zoomScale(T-h);M=Math.sqrt(z/S*2)}var E=M*M,L=n(0),I=function(t){return s(L)/s(L+M*t)},D=function(t){return k*((s(L)*u(L+M*t)-a(L))/E)/S},P=(n(1)-L)/M;if(Math.abs(S)<1e-6){if(Math.abs(k-A)<1e-6)return this.easeTo(t);var C=A=0)return!1;return!0}),e.join(" | ")},r.prototype=o.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e="mapboxgl-ctrl-attrib",n=this._container=a.create("div",e,t.getContainer());return this._update(),t.on("source.load",this._update.bind(this)),t.on("source.change",this._update.bind(this)),t.on("source.remove",this._update.bind(this)),t.on("moveend",this._updateEditLink.bind(this)),n},_update:function(){this._map.style&&(this._container.innerHTML=r.createAttributionString(this._map.style.sources)),this._editLink=this._container.getElementsByClassName("mapbox-improve-map")[0],this._updateEditLink()},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}})},{"../../util/dom":167,"../../util/util":181,"./control":149}],149:[function(t,e,n){"use strict";function r(){}var i=t("../../util/util"),a=t("../../util/evented");e.exports=r,r.prototype={addTo:function(t){this._map=t;var e=this._container=this.onAdd(t);if(this.options&&this.options.position){var n=this.options.position,r=t._controlCorners[n];e.className+=" mapboxgl-ctrl",n.indexOf("bottom")!==-1?r.insertBefore(e,r.firstChild):r.appendChild(e)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}},i.extend(r.prototype,a)},{"../../util/evented":173,"../../util/util":181}],150:[function(t,e,n){"use strict";function r(t){s.setOptions(this,t)}var i=t("./control"),a=t("../../util/browser"),o=t("../../util/dom"),s=t("../../util/util");e.exports=r;var l={enableHighAccuracy:!1,timeout:6e3};r.prototype=s.inherit(i,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",n=this._container=o.create("div",e+"-group",t.getContainer());return a.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=o.create("button",e+"-icon "+e+"-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),n):n},_onContextMenu:function(t){t.preventDefault()},_onClickGeolocate:function(){navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),l),this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this.fire("geolocate",t),this._finish()},_error:function(t){this.fire("error",t),this._finish()},_finish:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}})},{"../../util/browser":165,"../../util/dom":167,"../../util/util":181,"./control":149}],151:[function(t,e,n){"use strict";function r(t){s.setOptions(this,t)}function i(t){return new MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var a=t("./control"),o=t("../../util/dom"),s=t("../../util/util");e.exports=r,r.prototype=s.inherit(a,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",n=this._container=o.create("div",e+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(e+"-icon "+e+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(e+"-icon "+e+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(e+"-icon "+e+"-compass",t.resetNorth.bind(t)),this._compassArrow=o.create("div","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),n},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(o.disableDrag(),document.addEventListener("mousemove",this._onCompassMove),document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(document.removeEventListener("mousemove",this._onCompassMove),document.removeEventListener("mouseup",this._onCompassUp),o.enableDrag(),this._el.dispatchEvent(i(t)),t.stopPropagation())},_createButton:function(t,e){var n=o.create("button",t,this._container);return n.type="button",n.addEventListener("click",function(){e()}),n},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}})},{"../../util/dom":167,"../../util/util":181,"./control":149}],152:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../geo/lng_lat_bounds"),o=t("../../util/util");e.exports=r,r.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onMouseDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},_onMouseDown:function(t){t.shiftKey&&0===t.button&&(document.addEventListener("mousemove",this._onMouseMove,!1), +u.bbox1=p,u.bbox2=m,u.bbox3=g,!e)for(var v=this.grid.query(d,p,m,g),y=0;y=this.maxScale)return a}if(n){var b;if(this.angle){var w=this.reverseRotationMatrix,M=new i(u.x1,u.y1).matMult(w),k=new i(u.x2,u.y1).matMult(w),A=new i(u.x1,u.y2).matMult(w),S=new i(u.x2,u.y2).matMult(w);b=this.tempCollisionBox,b.anchorPointX=u.anchorPoint.x,b.anchorPointY=u.anchorPoint.y,b.x1=Math.min(M.x,k.x,A.x,S.x),b.y1=Math.min(M.y,k.x,A.x,S.x),b.x2=Math.max(M.x,k.x,A.x,S.x),b.y2=Math.max(M.y,k.x,A.x,S.x),b.maxScale=u.maxScale}else b=u;for(var T=0;T=this.maxScale)return a}}}return a},r.prototype.queryRenderedSymbols=function(t,e,n,r,a){var o={},s=[],l=this.collisionBoxArray,u=this.rotationMatrix,c=new i(t,e)._matMult(u),f=this.tempCollisionBox;f.anchorX=c.x,f.anchorY=c.y,f.x1=0,f.y1=0,f.x2=n-t,f.y2=r-e,f.maxScale=a,a=f.maxScale;for(var h=[c.x+f.x1/a,c.y+f.y1/a*this.yStretch,c.x+f.x2/a,c.y+f.y2/a*this.yStretch],d=this.grid.query(h[0],h[1],h[2],h[3]),p=this.ignoredGrid.query(h[0],h[1],h[2],h[3]),m=0;m=a&&(o[y][x]=!0,s.push(d[g]))}}return s},r.prototype.getPlacementScale=function(t,e,n,r,i){var a=e.x-r.x,o=e.y-r.y,s=(i.x1-n.x2)/a,l=(i.x2-n.x1)/a,u=(i.y1-n.y2)*this.yStretch/o,c=(i.y2-n.y1)*this.yStretch/o;(isNaN(s)||isNaN(l))&&(s=l=1),(isNaN(u)||isNaN(c))&&(u=c=1);var f=Math.min(Math.max(s,l),Math.max(u,c)),h=i.maxScale,d=n.maxScale;return f>h&&(f=h),f>d&&(f=d),f>t&&f>=i.placementScale&&(t=f),t},r.prototype.insertCollisionFeature=function(t,e,n){for(var r=n?this.ignoredGrid:this.grid,i=this.collisionBoxArray,a=t.boxStartIndex;a=0&&A=0&&S=0&&v+d<=p){var T=new o(A,S,M,x)._round();r&&!s(t,T,u,r,l)||y.push(T)}}g+=w}return f||y.length||c||(y=i(t,g/2,n,r,l,u,c,!0,h)),y}var a=t("../util/interpolate"),o=t("../symbol/anchor"),s=t("./check_max_angle");e.exports=r},{"../symbol/anchor":130,"../util/interpolate":175,"./check_max_angle":131}],137:[function(t,e,n){"use strict";function r(){this.width=s,this.height=s,this.bin=new i(this.width,this.height),this.index={},this.ids={},this.data=new Uint8Array(this.width*this.height)}var i=t("shelf-pack"),a=t("../util/util"),o=4,s=128,l=2048;e.exports=r,r.prototype.getGlyphs=function(){var t,e,n,r={};for(var i in this.ids)t=i.split("#"),e=t[0],n=t[1],r[e]||(r[e]=[]),r[e].push(n);return r},r.prototype.getRects=function(){var t,e,n,r={};for(var i in this.ids)t=i.split("#"),e=t[0],n=t[1],r[e]||(r[e]={}),r[e][n]=this.index[i];return r},r.prototype.addGlyph=function(t,e,n,r){if(!n)return null;var i=e+"#"+n.id;if(this.index[i])return this.ids[i].indexOf(t)<0&&this.ids[i].push(t),this.index[i];if(!n.bitmap)return null;var o=n.width+2*r,s=n.height+2*r,l=1,u=o+2*l,c=s+2*l;u+=4-u%4,c+=4-c%4;var f=this.bin.packOne(u,c);if(f||(this.resize(),f=this.bin.packOne(u,c)),!f)return a.warnOnce("glyph bitmap overflow"),null;this.index[i]=f,this.ids[i]=[t];for(var h=this.data,d=n.bitmap,p=0;p=l||e>=l)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=o,this.height*=o,this.bin.resize(this.width,this.height);for(var n=new ArrayBuffer(this.width*this.height),r=0;r65535)return n("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var r=this.loading[t];if(r[e])r[e].push(n);else{r[e]=[n];var i=256*e+"-"+(256*e+255),o=a(t,i,this.url);s(o,function(t,n){for(var i=!t&&new l(new c(new Uint8Array(n))),a=0;ar&&null!==c){var _=v[c+1].x;g=Math.max(_,g);for(var b=c+1;b<=y;b++)v[b].y+=n,v[b].x-=_;if(o){var w=c;f[v[c].codePoint]&&w--,s(v,e,p,w,o)}p=c+1,c=null,d+=_,m++}h[x.codePoint]&&(c=y)}var M=v[v.length-1],k=M.x+e[M.codePoint].advance;g=Math.max(g,k);var A=(m+1)*n;s(v,e,p,v.length-1,o),l(v,o,i,a,g,n,m,u),t.top+=-a*A,t.bottom=t.top+A,t.left+=-i*g,t.right=t.left+g}function s(t,e,n,r,i){for(var a=e[t[r].codePoint].advance,o=(t[r].x+a)*i,s=n;s<=r;s++)t[s].x-=o}function l(t,e,n,r,i,a,o,s){for(var l=(e-n)*i+s[0],u=(-r*(o+1)+.5)*a+s[1],c=0;c1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},r.prototype.addIcons=function(t,e){for(var n=0;n1||(w?(clearTimeout(w),w=null,v("dblclick",e)):w=setTimeout(d,300))}function c(t){y("touchmove",t)}function f(t){y("touchend",t)}function h(t){y("touchcancel",t)}function d(){w=null}function p(t){var e=r.mousePos(x,t);e.equals(b)&&v("click",t)}function m(t){v("dblclick",t),t.preventDefault()}function g(t){_=t,t.preventDefault()}function v(e,n){var i=r.mousePos(x,n);return t.fire(e,{lngLat:t.unproject(i),point:i,originalEvent:n})}function y(e,n){var a=r.touchPos(x,n),o=a.reduce(function(t,e,n,r){return t.add(e.div(r.length))},new i(0,0));return t.fire(e,{lngLat:t.unproject(o),point:o,lngLats:a.map(function(e){return t.unproject(e)},this),points:a,originalEvent:n})}var x=t.getCanvasContainer(),_=null,b=null,w=null;for(var M in a)t[M]=new a[M](t,e),e.interactive&&e[M]&&t[M].enable();x.addEventListener("mouseout",n,!1),x.addEventListener("mousedown",o,!1),x.addEventListener("mouseup",s,!1),x.addEventListener("mousemove",l,!1),x.addEventListener("touchstart",u,!1),x.addEventListener("touchend",f,!1),x.addEventListener("touchmove",c,!1),x.addEventListener("touchcancel",h,!1),x.addEventListener("click",p,!1),x.addEventListener("dblclick",m,!1),x.addEventListener("contextmenu",g,!1)}},{"../util/dom":167,"./handler/box_zoom":152,"./handler/dblclick_zoom":153,"./handler/drag_pan":154,"./handler/drag_rotate":155,"./handler/keyboard":156,"./handler/scroll_zoom":157,"./handler/touch_zoom_rotate":158,"point-geometry":187}],147:[function(t,e,n){"use strict";var r=t("../util/util"),i=t("../util/interpolate"),a=t("../util/browser"),o=t("../geo/lng_lat"),s=t("../geo/lng_lat_bounds"),l=t("point-geometry"),u=e.exports=function(){};r.extend(u.prototype,{getCenter:function(){return this.transform.center},setCenter:function(t,e){return this.jumpTo({center:t},e),this},panBy:function(t,e,n){return this.panTo(this.transform.center,r.extend({offset:l.convert(t).mult(-1)},e),n),this},panTo:function(t,e,n){return this.easeTo(r.extend({center:t},e),n)},getZoom:function(){return this.transform.zoom},setZoom:function(t,e){return this.jumpTo({zoom:t},e),this},zoomTo:function(t,e,n){return this.easeTo(r.extend({zoom:t},e),n)},zoomIn:function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},zoomOut:function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},getBearing:function(){return this.transform.bearing},setBearing:function(t,e){return this.jumpTo({bearing:t},e),this},rotateTo:function(t,e,n){return this.easeTo(r.extend({bearing:t},e),n)},resetNorth:function(t,e){return this.rotateTo(0,r.extend({duration:1e3},t),e),this},snapToNorth:function(t,e){return Math.abs(this.getBearing())180&&(c.center.lng>0&&m.lng<0?m.lng+=360:c.center.lng<0&&m.lng>0&&(m.lng-=360));var x=c.zoomScale(g-h),_=c.point,b="center"in t?c.project(m).sub(f.div(x)):_,w=c.worldSize,M=t.curve,k=Math.max(c.width,c.height),A=k/x,S=b.sub(_).mag();if("minZoom"in t){var T=r.clamp(Math.min(t.minZoom,h,g),c.minZoom,c.maxZoom),z=k/c.zoomScale(T-h);M=Math.sqrt(z/S*2)}var E=M*M,L=n(0),I=function(t){return s(L)/s(L+M*t)},D=function(t){return k*((s(L)*u(L+M*t)-a(L))/E)/S},P=(n(1)-L)/M;if(Math.abs(S)<1e-6){if(Math.abs(k-A)<1e-6)return this.easeTo(t);var C=A=0)return!1;return!0}),e.join(" | ")},r.prototype=o.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e="mapboxgl-ctrl-attrib",n=this._container=a.create("div",e,t.getContainer());return this._update(),t.on("source.load",this._update.bind(this)),t.on("source.change",this._update.bind(this)),t.on("source.remove",this._update.bind(this)),t.on("moveend",this._updateEditLink.bind(this)),n},_update:function(){this._map.style&&(this._container.innerHTML=r.createAttributionString(this._map.style.sources)),this._editLink=this._container.getElementsByClassName("mapbox-improve-map")[0],this._updateEditLink()},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}})},{"../../util/dom":167,"../../util/util":181,"./control":149}],149:[function(t,e,n){"use strict";function r(){}var i=t("../../util/util"),a=t("../../util/evented");e.exports=r,r.prototype={addTo:function(t){this._map=t;var e=this._container=this.onAdd(t);if(this.options&&this.options.position){var n=this.options.position,r=t._controlCorners[n];e.className+=" mapboxgl-ctrl",n.indexOf("bottom")!==-1?r.insertBefore(e,r.firstChild):r.appendChild(e)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}},i.extend(r.prototype,a)},{"../../util/evented":173,"../../util/util":181}],150:[function(t,e,n){"use strict";function r(t){s.setOptions(this,t)}var i=t("./control"),a=t("../../util/browser"),o=t("../../util/dom"),s=t("../../util/util");e.exports=r;var l={enableHighAccuracy:!1,timeout:6e3};r.prototype=s.inherit(i,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",n=this._container=o.create("div",e+"-group",t.getContainer());return a.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=o.create("button",e+"-icon "+e+"-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),n):n},_onContextMenu:function(t){t.preventDefault()},_onClickGeolocate:function(){navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),l),this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this.fire("geolocate",t),this._finish()},_error:function(t){this.fire("error",t),this._finish()},_finish:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}})},{"../../util/browser":165,"../../util/dom":167,"../../util/util":181,"./control":149}],151:[function(t,e,n){"use strict";function r(t){s.setOptions(this,t)}function i(t){return new MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var a=t("./control"),o=t("../../util/dom"),s=t("../../util/util");e.exports=r,r.prototype=s.inherit(a,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",n=this._container=o.create("div",e+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(e+"-icon "+e+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(e+"-icon "+e+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(e+"-icon "+e+"-compass",t.resetNorth.bind(t)),this._compassArrow=o.create("div","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),n},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(o.disableDrag(),document.addEventListener("mousemove",this._onCompassMove),document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(document.removeEventListener("mousemove",this._onCompassMove),document.removeEventListener("mouseup",this._onCompassUp),o.enableDrag(),this._el.dispatchEvent(i(t)),t.stopPropagation())},_createButton:function(t,e){var n=o.create("button",t,this._container);return n.type="button",n.addEventListener("click",function(){e()}),n},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}})},{"../../util/dom":167,"../../util/util":181,"./control":149}],152:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../geo/lng_lat_bounds"),o=t("../../util/util");e.exports=r,r.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onMouseDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},_onMouseDown:function(t){t.shiftKey&&0===t.button&&(document.addEventListener("mousemove",this._onMouseMove,!1), document.addEventListener("keydown",this._onKeyDown,!1),document.addEventListener("mouseup",this._onMouseUp,!1),i.disableDrag(),this._startPos=i.mousePos(this._el,t),this._active=!0)},_onMouseMove:function(t){var e=this._startPos,n=i.mousePos(this._el,t);this._box||(this._box=i.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var r=Math.min(e.x,n.x),a=Math.max(e.x,n.x),o=Math.min(e.y,n.y),s=Math.max(e.y,n.y);i.setTransform(this._box,"translate("+r+"px,"+o+"px)"),this._box.style.width=a-r+"px",this._box.style.height=s-o+"px"},_onMouseUp:function(t){if(0===t.button){var e=this._startPos,n=i.mousePos(this._el,t),r=new a(this._map.unproject(e),this._map.unproject(n));this._finish(),e.x===n.x&&e.y===n.y?this._fireEvent("boxzoomcancel",t):this._map.fitBounds(r,{linear:!0}).fire("boxzoomend",{originalEvent:t,boxZoomBounds:r})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},_finish:function(){this._active=!1,document.removeEventListener("mousemove",this._onMouseMove,!1),document.removeEventListener("keydown",this._onKeyDown,!1),document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),i.enableDrag()},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})}}},{"../../geo/lng_lat_bounds":79,"../../util/dom":167,"../../util/util":181}],153:[function(t,e,n){"use strict";function r(t){this._map=t,this._onDblClick=this._onDblClick.bind(this)}e.exports=r,r.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},_onDblClick:function(t){this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)}}},{}],154:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/util");e.exports=r;var o=.3,s=a.bezier(0,0,o,1),l=1400,u=2500;r.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},_onDown:function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp)),this._active=!1,this._startPos=this._pos=i.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=i.mousePos(this._el,t),n=this._map;n.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),n.transform.setLocationAtPoint(n.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},_onUp:function(t){if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=function(){this._fireEvent("moveend",t)}.bind(this),n=this._inertia;if(n.length<2)return void e();var r=n[n.length-1],i=n[0],a=r[1].sub(i[1]),c=(r[0]-i[0])/1e3;if(0===c||r[1].equals(i[1]))return void e();var f=a.mult(o/c),h=f.mag();h>l&&(h=l,f._unit()._mult(h));var d=h/(u*o),p=f.mult(-d/2);this._map.panBy(p,{duration:1e3*d,easing:s,noMoveStart:!0},{originalEvent:t})}},_onMouseUp:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onMouseUp))},_onTouchEnd:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onTouchEnd))},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragRotate&&e.dragRotate.isActive())return!0;if(t.touches)return t.touches.length>1;if(t.ctrlKey)return!0;var n=1,r=0;return"mousemove"===t.type?t.buttons&0===n:t.button!==r},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),n=160;t.length>0&&e-t[0][0]>n;)t.shift()}}},{"../../util/dom":167,"../../util/util":181}],155:[function(t,e,n){"use strict";function r(t,e){this._map=t,this._el=t.getCanvasContainer(),this._bearingSnap=e.bearingSnap,o.bindHandlers(this)}var i=t("../../util/dom"),a=t("point-geometry"),o=t("../../util/util");e.exports=r;var s=.25,l=o.bezier(0,0,s,1),u=180,c=720;r.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},_onDown:function(t){if(!this._ignoreEvent(t)&&!this.isActive()){document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onUp),this._active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=i.mousePos(this._el,t),this._center=this._map.transform.centerPoint;var e=this._startPos.sub(this._center),n=e.mag();n<200&&(this._center=this._startPos.add(new a(-200,0)._rotate(e.angle()))),t.preventDefault()}},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t));var e=this._map;e.stop();var n=this._pos,r=i.mousePos(this._el,t),a=this._center,o=n.sub(a).angleWith(r.sub(a))/Math.PI*180,s=e.getBearing()-o,l=this._inertia,u=l[l.length-1];this._drainInertiaBuffer(),l.push([Date.now(),e._normalizeBearing(s,u[1])]),e.transform.bearing=s,this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=r}},_onUp:function(t){if(!this._ignoreEvent(t)&&(document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onUp),this.isActive())){this._active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var e=this._map,n=e.getBearing(),r=this._inertia,i=function(){Math.abs(n)u&&(g=u);var v=g/(c*s),y=p*g*(v/2);h+=y,Math.abs(e._normalizeBearing(h,0))1;var n=t.ctrlKey?1:2,r=t.ctrlKey?0:2;return"mousemove"===t.type?t.buttons&0===n:t.button!==r},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),n=160;t.length>0&&e-t[0][0]>n;)t.shift()}}},{"../../util/dom":167,"../../util/util":181,"point-geometry":187}],156:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),this._onKeyDown=this._onKeyDown.bind(this)}e.exports=r;var i=80,a=2,o=5;r.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=this._map,n={originalEvent:t};if(!e.isEasing())switch(t.keyCode){case 61:case 107:case 171:case 187:e.zoomTo(Math.round(e.getZoom())+(t.shiftKey?2:1),n);break;case 189:case 109:case 173:e.zoomTo(Math.round(e.getZoom())-(t.shiftKey?2:1),n);break;case 37:t.shiftKey?e.easeTo({bearing:e.getBearing()-a},n):(t.preventDefault(),e.panBy([-i,0],n));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+a},n):(t.preventDefault(),e.panBy([i,0],n));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+o},n):(t.preventDefault(),e.panBy([0,-i],n));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-o,0)},n):(t.preventDefault(),e.panBy([0,i],n))}}}}},{}],157:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/browser"),o=t("../../util/util");e.exports=r;var s="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",l=s.indexOf("firefox")!==-1,u=s.indexOf("safari")!==-1&&s.indexOf("chrom")===-1;r.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},_onWheel:function(t){var e;"wheel"===t.type?(e=t.deltaY,l&&t.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(e/=a.devicePixelRatio),t.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(e*=40)):"mousewheel"===t.type&&(e=-t.wheelDeltaY,u&&(e/=3));var n=a.now(),r=n-(this._time||0);this._pos=i.mousePos(this._el,t),this._time=n,0!==e&&e%4.000244140625===0?(this._type="wheel",e=Math.floor(e/4)):0!==e&&Math.abs(e)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(r*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&this._zoom(-e,t),t.preventDefault()},_onTimeout:function(){this._type="wheel",this._zoom(-this._lastValue)},_zoom:function(t,e){if(0!==t){var n=this._map,r=2/(1+Math.exp(-Math.abs(t/100)));t<0&&0!==r&&(r=1/r);var i=n.ease?n.ease.to:n.transform.scale,a=n.transform.scaleZoom(i*r);n.zoomTo(a,{duration:0,around:n.unproject(this._pos),delayEndEvents:200},{originalEvent:e})}}}},{"../../util/browser":165,"../../util/dom":167,"../../util/util":181}],158:[function(t,e,n){"use strict";function r(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/util");e.exports=r;var o=.15,s=a.bezier(0,0,o,1),l=12,u=2.5,c=.15,f=4;r.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},disableRotation:function(){this._rotationDisabled=!0},enableRotation:function(){this._rotationDisabled=!1},_onStart:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),n=i.mousePos(this._el,t.touches[1]);this._startVec=e.sub(n),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],document.addEventListener("touchmove",this._onMove,!1),document.addEventListener("touchend",this._onEnd,!1)}},_onMove:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),n=i.mousePos(this._el,t.touches[1]),r=e.add(n).div(2),a=e.sub(n),o=a.mag()/this._startVec.mag(),s=this._rotationDisabled?0:180*a.angleWith(this._startVec)/Math.PI,l=this._map;if(this._gestureIntent){var u={duration:0,around:l.unproject(r)};"rotate"===this._gestureIntent&&(u.bearing=this._startBearing+s),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(u.zoom=l.transform.scaleZoom(this._startScale*o)),l.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),o,r]),l.easeTo(u,{originalEvent:t})}else{var h=Math.abs(1-o)>c,d=Math.abs(s)>f;d?this._gestureIntent="rotate":h&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=a,this._startScale=l.transform.scale,this._startBearing=l.transform.bearing)}t.preventDefault()}},_onEnd:function(t){document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,n=this._map;if(e.length<2)return void n.snapToNorth({},{originalEvent:t});var r=e[e.length-1],i=e[0],a=n.transform.scaleZoom(this._startScale*r[1]),c=n.transform.scaleZoom(this._startScale*i[1]),f=a-c,h=(r[0]-i[0])/1e3,d=r[2];if(0===h||a===c)return void n.snapToNorth({},{originalEvent:t});var p=f*o/h;Math.abs(p)>u&&(p=p>0?u:-u);var m=1e3*Math.abs(p/(l*o)),g=a+p*m/2e3;g<0&&(g=0),n.easeTo({zoom:g,duration:m,easing:s,around:n.unproject(d)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),n=160;t.length>2&&e-t[0][0]>n;)t.shift()}}},{"../../util/dom":167,"../../util/util":181}],159:[function(t,e,n){"use strict";function r(){i.bindAll(["_onHashChange","_updateHash"],this)}e.exports=r;var i=t("../util/util");r.prototype={addTo:function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},remove:function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},_onHashChange:function(){var t=location.hash.replace("#","").split("/");return t.length>=3&&(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0)}),!0)},_updateHash:function(){var t=this._map.getCenter(),e=this._map.getZoom(),n=this._map.getBearing(),r=Math.max(0,Math.ceil(Math.log(e)/Math.LN2)),i="#"+Math.round(100*e)/100+"/"+t.lat.toFixed(r)+"/"+t.lng.toFixed(r)+(n?"/"+Math.round(10*n)/10:"");window.history.replaceState("","",i)}}},{"../util/util":181}],160:[function(t,e,n){"use strict";function r(t){t.parentNode&&t.parentNode.removeChild(t)}var i=t("../util/canvas"),a=t("../util/util"),o=t("../util/browser"),s=t("../util/browser").window,l=t("../util/evented"),u=t("../util/dom"),c=t("../style/style"),f=t("../style/animation_loop"),h=t("../render/painter"),d=t("../geo/transform"),p=t("./hash"),m=t("./bind_handlers"),g=t("./camera"),v=t("../geo/lng_lat"),y=t("../geo/lng_lat_bounds"),x=t("point-geometry"),_=t("./control/attribution"),b=0,w=20,M={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:b,maxZoom:w,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,workerCount:Math.max(o.hardwareConcurrency-1,1)},k=e.exports=function(t){if(t=a.extend({},M,t),t.workerCount<1)throw new Error("workerCount must an integer greater than or equal to 1.");this._interactive=t.interactive,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._trackResize=t.trackResize,this._workerCount=t.workerCount,this._bearingSnap=t.bearingSnap,"string"==typeof t.container?this._container=document.getElementById(t.container):this._container=t.container,this.animationLoop=new f,this.transform=new d(t.minZoom,t.maxZoom),t.maxBounds&&this.setMaxBounds(t.maxBounds),a.bindAll(["_forwardStyleEvent","_forwardSourceEvent","_forwardLayerEvent","_forwardTileEvent","_onStyleLoad","_onStyleChange","_onSourceAdd","_onSourceRemove","_onSourceUpdate","_onWindowOnline","_onWindowResize","_update","_render"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){this.animationLoop.set(300),this._rerender()}.bind(this)),"undefined"!=typeof s&&(s.addEventListener("online",this._onWindowOnline,!1),s.addEventListener("resize",this._onWindowResize,!1)),m(this,t),this._hash=t.hash&&(new p).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),this.stacks={},this._classes=[],this.resize(),t.classes&&this.setClasses(t.classes),t.style&&this.setStyle(t.style),t.attributionControl&&this.addControl(new _(t.attributionControl));var e=this.fire.bind(this,"error");this.on("style.error",e),this.on("source.error",e),this.on("tile.error",e),this.on("layer.error",e)};a.extend(k.prototype,l),a.extend(k.prototype,g.prototype),a.extend(k.prototype,{addControl:function(t){return t.addTo(this),this},addClass:function(t,e){return this._classes.indexOf(t)>=0||""===t?this:(this._classes.push(t),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},removeClass:function(t,e){var n=this._classes.indexOf(t);return n<0||""===t?this:(this._classes.splice(n,1),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},setClasses:function(t,e){for(var n={},r=0;r=0},getClasses:function(){return this._classes},resize:function(){var t=0,e=0;return this._container&&(t=this._container.offsetWidth||400,e=this._container.offsetHeight||300),this._canvas.resize(t,e),this.transform.resize(t,e),this.painter.resize(t,e),this.fire("movestart").fire("move").fire("resize").fire("moveend")},getBounds:function(){var t=new y(this.transform.pointLocation(new x(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new x(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new x(0,this.transform.size.y)))),t},setMaxBounds:function(t){if(t){var e=y.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=[],this.transform.latRange=[],this._update());return this},setMinZoom:function(t){if(t=null===t||void 0===t?b:t,t>=b&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom&&t<=w)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be between the current minZoom and "+w+", inclusive")},project:function(t){return this.transform.locationPoint(v.convert(t))},unproject:function(t){return this.transform.pointLocation(x.convert(t))},queryRenderedFeatures:function(){function t(t){return t instanceof x||Array.isArray(t)}var e,n={};return 2===arguments.length?(e=arguments[0],n=arguments[1]):1===arguments.length&&t(arguments[0])?e=arguments[0]:1===arguments.length&&(n=arguments[0]),this.style.queryRenderedFeatures(this._makeQueryGeometry(e),n,this.transform.zoom,this.transform.angle)},_makeQueryGeometry:function(t){void 0===t&&(t=[x.convert([0,0]),x.convert([this.transform.width,this.transform.height])]);var e,n=t instanceof x||"number"==typeof t[0];if(n){var r=x.convert(t);e=[r]}else{var i=[x.convert(t[0]),x.convert(t[1])];e=[i[0],new x(i[1].x,i[0].y),i[1],new x(i[0].x,i[1].y),i[0]]}return e=e.map(function(t){return this.transform.pointCoordinate(t)}.bind(this))},querySourceFeatures:function(t,e){return this.style.querySourceFeatures(t,e)},setStyle:function(t){return this.style&&(this.style.off("load",this._onStyleLoad).off("error",this._forwardStyleEvent).off("change",this._onStyleChange).off("source.add",this._onSourceAdd).off("source.remove",this._onSourceRemove).off("source.load",this._onSourceUpdate).off("source.error",this._forwardSourceEvent).off("source.change",this._onSourceUpdate).off("layer.add",this._forwardLayerEvent).off("layer.remove",this._forwardLayerEvent).off("layer.error",this._forwardLayerEvent).off("tile.add",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.load",this._update).off("tile.error",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent)._remove(),this.off("rotate",this.style._redoPlacement),this.off("pitch",this.style._redoPlacement)),t?(t instanceof c?this.style=t:this.style=new c(t,this.animationLoop,this._workerCount),this.style.on("load",this._onStyleLoad).on("error",this._forwardStyleEvent).on("change",this._onStyleChange).on("source.add",this._onSourceAdd).on("source.remove",this._onSourceRemove).on("source.load",this._onSourceUpdate).on("source.error",this._forwardSourceEvent).on("source.change",this._onSourceUpdate).on("layer.add",this._forwardLayerEvent).on("layer.remove",this._forwardLayerEvent).on("layer.error",this._forwardLayerEvent).on("tile.add",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.load",this._update).on("tile.error",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this.on("rotate",this.style._redoPlacement),this.on("pitch",this.style._redoPlacement),this):(this.style=null,this)},getStyle:function(){if(this.style)return this.style.serialize()},addSource:function(t,e){return this.style.addSource(t,e),this._update(!0),this},addSourceType:function(t,e,n){return this.style.addSourceType(t,e,n)},removeSource:function(t){return this.style.removeSource(t),this._update(!0),this},getSource:function(t){return this.style.getSource(t)},addLayer:function(t,e){return this.style.addLayer(t,e),this._update(!0),this},removeLayer:function(t){return this.style.removeLayer(t),this._update(!0),this},getLayer:function(t){return this.style.getLayer(t)},setFilter:function(t,e){return this.style.setFilter(t,e),this._update(!0),this},setLayerZoomRange:function(t,e,n){return this.style.setLayerZoomRange(t,e,n),this._update(!0),this},getFilter:function(t){return this.style.getFilter(t)},setPaintProperty:function(t,e,n,r){return this.style.setPaintProperty(t,e,n,r),this._update(!0),this},getPaintProperty:function(t,e,n){return this.style.getPaintProperty(t,e,n)},setLayoutProperty:function(t,e,n){return this.style.setLayoutProperty(t,e,n),this._update(!0),this},getLayoutProperty:function(t,e){return this.style.getLayoutProperty(t,e)},getContainer:function(){return this._container},getCanvasContainer:function(){return this._canvasContainer},getCanvas:function(){return this._canvas.getElement()},_setupContainer:function(){var t=this._container;t.classList.add("mapboxgl-map");var e=this._canvasContainer=u.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=new i(this,e);var n=this._controlContainer=u.create("div","mapboxgl-control-container",t),r=this._controlCorners={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(t){r[t]=u.create("div","mapboxgl-ctrl-"+t,n)})},_setupPainter:function(){var t=this._canvas.getWebGLContext({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer});return t?void(this.painter=new h(t,this.transform)):void this.fire("error",{error:new Error("Failed to initialize WebGL")})},_contextLost:function(t){t.preventDefault(),this._frameId&&o.cancelFrame(this._frameId),this.fire("webglcontextlost",{originalEvent:t})},_contextRestored:function(t){this._setupPainter(),this.resize(),this._update(),this.fire("webglcontextrestored",{originalEvent:t})},loaded:function(){return!this._styleDirty&&!this._sourcesDirty&&!(!this.style||!this.style.loaded())},_update:function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this._rerender(),this):this},_render:function(){try{this.style&&this._styleDirty&&(this._styleDirty=!1,this.style.update(this._classes,this._classOptions),this._classOptions=null,this.style._recalculate(this.transform.zoom)),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.painter.render(this.style,{debug:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,vertices:this.vertices,rotating:this.rotating,zooming:this.zooming}),this.fire("render"),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire("load")),this._frameId=null,this.animationLoop.stopped()||(this._styleDirty=!0),(this._sourcesDirty||this._repaint||this._styleDirty)&&this._rerender()}catch(t){this.fire("error",{error:t})}return this},remove:function(){this._hash&&this._hash.remove(),o.cancelFrame(this._frameId),this.setStyle(null),"undefined"!=typeof s&&s.removeEventListener("resize",this._onWindowResize,!1);var t=this.painter.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),r(this._canvasContainer),r(this._controlContainer),this._container.classList.remove("mapboxgl-map")},_rerender:function(){this.style&&!this._frameId&&(this._frameId=o.frame(this._render))},_forwardStyleEvent:function(t){this.fire("style."+t.type,a.extend({style:t.target},t))},_forwardSourceEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_forwardLayerEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_forwardTileEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_onStyleLoad:function(t){this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this.style.update(this._classes,{transition:!1}),this._forwardStyleEvent(t)},_onStyleChange:function(t){this._update(!0),this._forwardStyleEvent(t)},_onSourceAdd:function(t){var e=t.source;e.onAdd&&e.onAdd(this),this._forwardSourceEvent(t)},_onSourceRemove:function(t){var e=t.source;e.onRemove&&e.onRemove(this),this._forwardSourceEvent(t)},_onSourceUpdate:function(t){this._update(),this._forwardSourceEvent(t)},_onWindowOnline:function(){this._update()},_onWindowResize:function(){this._trackResize&&this.stop().resize()._update()}}),a.extendAll(k.prototype,{_showTileBoundaries:!1,get showTileBoundaries(){return this._showTileBoundaries},set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},_showCollisionBoxes:!1,get showCollisionBoxes(){return this._showCollisionBoxes},set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,this.style._redoPlacement())},_showOverdrawInspector:!1,get showOverdrawInspector(){return this._showOverdrawInspector},set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},_repaint:!1,get repaint(){return this._repaint},set repaint(t){this._repaint=t,this._update()},_vertices:!1,get vertices(){return this._vertices},set vertices(t){this._vertices=t,this._update()}})},{"../geo/lng_lat":78,"../geo/lng_lat_bounds":79,"../geo/transform":80,"../render/painter":94,"../style/animation_loop":114,"../style/style":117,"../util/browser":165,"../util/canvas":166,"../util/dom":167,"../util/evented":173,"../util/util":181,"./bind_handlers":146,"./camera":147,"./control/attribution":148,"./hash":159,"point-geometry":187}],161:[function(t,e,n){"use strict";function r(t,e){t||(t=i.create("div")),t.classList.add("mapboxgl-marker"),this._el=t,this._offset=o.convert(e&&e.offset||[0,0]),this._update=this._update.bind(this)}e.exports=r;var i=t("../util/dom"),a=t("../geo/lng_lat"),o=t("point-geometry");r.prototype={addTo:function(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._el),t.on("move",this._update),this._update(),this},remove:function(){this._map&&(this._map.off("move",this._update),this._map=null);var t=this._el.parentNode;return t&&t.removeChild(this._el),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=a.convert(t),this._update(),this},getElement:function(){return this._el},_update:function(){if(this._map){var t=this._map.project(this._lngLat)._add(this._offset);i.setTransform(this._el,"translate("+t.x+"px,"+t.y+"px)")}}}},{"../geo/lng_lat":78,"../util/dom":167,"point-geometry":187}],162:[function(t,e,n){"use strict";function r(t){i.setOptions(this,t),i.bindAll(["_update","_onClickClose"],this)}e.exports=r;var i=t("../util/util"),a=t("../util/evented"),o=t("../util/dom"),s=t("../geo/lng_lat");r.prototype=i.inherit(a,{options:{closeButton:!0,closeOnClick:!0},addTo:function(t){return this._map=t,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this},remove:function(){return this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this.fire("close"),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=s.convert(t),this._update(),this},setText:function(t){return this.setDOMContent(document.createTextNode(t))},setHTML:function(t){var e,n=document.createDocumentFragment(),r=document.createElement("body");for(r.innerHTML=t;;){if(e=r.firstChild,!e)break;n.appendChild(e)}return this.setDOMContent(n)},setDOMContent:function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},_createContent:function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._content=o.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=o.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},_update:function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=o.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=o.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content));var t=this._map.project(this._lngLat).round(),e=this.options.anchor;if(!e){var n=this._container.offsetWidth,r=this._container.offsetHeight;e=t.ythis._map.transform.height-r?["bottom"]:[],t.xthis._map.transform.width-n/2&&e.push("right"),e=0===e.length?"bottom":e.join("-")}var i={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},a=this._container.classList;for(var s in i)a.remove("mapboxgl-popup-anchor-"+s);a.add("mapboxgl-popup-anchor-"+e),o.setTransform(this._container,i[e]+" translate("+t.x+"px,"+t.y+"px)")}},_onClickClose:function(){this.remove()}})},{"../geo/lng_lat":78,"../util/dom":167,"../util/evented":173,"../util/util":181}],163:[function(t,e,n){"use strict";function r(t,e){this.target=t,this.parent=e,this.callbacks={},this.callbackID=0,this.receive=this.receive.bind(this),this.target.addEventListener("message",this.receive,!1)}e.exports=r,r.prototype.receive=function(t){function e(t,e,n){this.postMessage({type:"",id:String(i),error:t?String(t):null,data:e},n)}var n,r=t.data,i=r.id;if(""===r.type)n=this.callbacks[r.id],delete this.callbacks[r.id],n&&n(r.error||null,r.data);else if("undefined"!=typeof r.id&&this.parent[r.type])this.parent[r.type](r.data,e.bind(this));else if("undefined"!=typeof r.id&&this.parent.workerSources){var a=r.type.split(".");this.parent.workerSources[a[0]][a[1]](r.data,e.bind(this)); }else this.parent[r.type](r.data)},r.prototype.send=function(t,e,n,r){var i=null;n&&(this.callbacks[i=this.callbackID++]=n),this.postMessage({type:t,id:String(i),data:e},r)},r.prototype.postMessage=function(t,e){this.target.postMessage(t,e)}},{}],164:[function(t,e,n){"use strict";function r(t){var e=document.createElement("a");return e.href=t,e.protocol===document.location.protocol&&e.host===document.location.host}n.getJSON=function(t,e){var n=new XMLHttpRequest;return n.open("GET",t,!0),n.setRequestHeader("Accept","application/json"),n.onerror=function(t){e(t)},n.onload=function(){if(n.status>=200&&n.status<300&&n.response){var t;try{t=JSON.parse(n.response)}catch(t){return e(t)}e(null,t)}else e(new Error(n.statusText))},n.send(),n},n.getArrayBuffer=function(t,e){var n=new XMLHttpRequest;return n.open("GET",t,!0),n.responseType="arraybuffer",n.onerror=function(t){e(t)},n.onload=function(){n.status>=200&&n.status<300&&n.response?e(null,n.response):e(new Error(n.statusText))},n.send(),n},n.getImage=function(t,e){return n.getArrayBuffer(t,function(t,n){if(t)return e(t);var r=new Image;r.onload=function(){e(null,r),(window.URL||window.webkitURL).revokeObjectURL(r.src)};var i=new Blob([new Uint8Array(n)],{type:"image/png"});return r.src=(window.URL||window.webkitURL).createObjectURL(i),r.getData=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return t.width=r.width,t.height=r.height,e.drawImage(r,0,0),e.getImageData(0,0,r.width,r.height).data},r})},n.getVideo=function(t,e){var n=document.createElement("video");n.onloadstart=function(){e(null,n)};for(var i=0;i=s+r?t.call(i,1):(t.call(i,(l-s)/r),n.frame(a)))}if(!r)return t.call(i,1),null;var o=!1,s=e.exports.now();return n.frame(a),function(){o=!0}},n.supported=t("mapbox-gl-supported"),n.hardwareConcurrency=navigator.hardwareConcurrency||4,Object.defineProperty(n,"devicePixelRatio",{get:function(){return window.devicePixelRatio}}),n.supportsWebp=!1;var a=document.createElement("img");a.onload=function(){n.supportsWebp=!0},a.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=",n.supportsGeolocation=!!navigator.geolocation},{"mapbox-gl-supported":66}],166:[function(t,e,n){"use strict";function r(t,e){this.canvas=document.createElement("canvas"),t&&e&&(this.canvas.style.position="absolute",this.canvas.classList.add("mapboxgl-canvas"),this.canvas.addEventListener("webglcontextlost",t._contextLost.bind(t),!1),this.canvas.addEventListener("webglcontextrestored",t._contextRestored.bind(t),!1),this.canvas.setAttribute("tabindex",0),e.appendChild(this.canvas))}var i=t("../util"),a=t("mapbox-gl-supported");e.exports=r,r.prototype.resize=function(t,e){var n=window.devicePixelRatio||1;this.canvas.width=n*t,this.canvas.height=n*e,this.canvas.style.width=t+"px",this.canvas.style.height=e+"px"},r.prototype.getWebGLContext=function(t){return t=i.extend({},t,a.webGLContextAttributes),this.canvas.getContext("webgl",t)||this.canvas.getContext("experimental-webgl",t)},r.prototype.getElement=function(){return this.canvas}},{"../util":181,"mapbox-gl-supported":66}],167:[function(t,e,n){"use strict";function r(t){for(var e=0;e1)for(var f=0;f=0&&this._events[t].splice(n,1),this._events[t].length||delete this._events[t]}else delete this._events[t];return this},once:function(t,e){var n=function(r){this.off(t,n),e.call(this,r)}.bind(this);return this.on(t,n),this},fire:function(t,e){if(!this.listens(t))return r.endsWith(t,"error")&&console.error(e&&e.error||e||"Empty error event"),this;e=r.extend({},e),r.extend(e,{type:t,target:this});for(var n=this._events[t].slice(),i=0;i=3)for(var l=0;l1){if(s(t,e))return!0;for(var r=0;r(e.y-t.y)*(n.x-t.x)}function u(t,e,n,r){return l(t,n,r)!==l(e,n,r)&&l(t,e,n)!==l(t,e,r)}function c(t,e,n){var r=n*n;if(1===e.length)return t.distSqr(e[0])1?t.distSqr(n):t.distSqr(n.sub(e)._mult(i)._add(e))}function h(t,e){for(var n,r,i,a=!1,o=0;oe.y!=i.y>e.y&&e.x<(i.x-r.x)*(e.y-r.y)/(i.y-r.y)+r.x&&(a=!a)}return a}function d(t,e){for(var n=!1,r=0,i=t.length-1;re.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(n=!n)}return n}e.exports={multiPolygonIntersectsBufferedMultiPoint:r,multiPolygonIntersectsMultiPolygon:i,multiPolygonIntersectsBufferedMultiLine:a}},{}],177:[function(t,e,n){"use strict";function r(t,e){this.max=t,this.onRemove=e,this.reset()}e.exports=r,r.prototype.reset=function(){for(var t in this.data)this.onRemove(this.data[t]);return this.data={},this.order=[],this},r.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 n=this.get(this.order[0]);n&&this.onRemove(n)}return this},r.prototype.has=function(t){return t in this.data},r.prototype.keys=function(){return this.order},r.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},r.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this.get(this.order[0]);e&&this.onRemove(e)}return this}},{}],178:[function(t,e,n){"use strict";function r(t,e,n){if(n=n||o.ACCESS_TOKEN,!n&&o.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox GL. See https://www.mapbox.com/developers/api/#access-tokens");if(t=t.replace(/^mapbox:\/\//,o.API_URL+e),t+=t.indexOf("?")!==-1?"&access_token=":"?access_token=",o.REQUIRE_ACCESS_TOKEN){if("s"===n[0])throw new Error("Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). See https://www.mapbox.com/developers/api/#access-tokens");t+=n}return t}function i(t){return t?"?"+t:""}function a(t){return t.access_token&&"tk."===t.access_token.slice(0,3)?u.extend({},t,{access_token:o.ACCESS_TOKEN}):t}var o=t("./config"),s=t("./browser"),l=t("url"),u=t("./util");e.exports.normalizeStyleURL=function(t,e){var n=l.parse(t);return"mapbox:"!==n.protocol?t:r("mapbox:/"+n.pathname+i(n.query),"/styles/v1/",e)},e.exports.normalizeSourceURL=function(t,e){var n=l.parse(t);return"mapbox:"!==n.protocol?t:r(t+".json","/v4/",e)+"&secure"},e.exports.normalizeGlyphsURL=function(t,e){var n=l.parse(t);if("mapbox:"!==n.protocol)return t;var a=n.pathname.split("/")[1];return r("mapbox://"+a+"/{fontstack}/{range}.pbf"+i(n.query),"/fonts/v1/",e)},e.exports.normalizeSpriteURL=function(t,e,n,a){var o=l.parse(t);return"mapbox:"!==o.protocol?(o.pathname+=e+n,l.format(o)):r("mapbox:/"+o.pathname+"/sprite"+e+n+i(o.query),"/styles/v1/",a)},e.exports.normalizeTileURL=function(t,e,n){var r=l.parse(t,!0);if(!e)return t;var i=l.parse(e);if("mapbox:"!==i.protocol)return t;var o=s.supportsWebp?".webp":"$1",u=s.devicePixelRatio>=2||512===n?"@2x":"";return l.format({protocol:r.protocol,hostname:r.hostname,pathname:r.pathname.replace(/(\.(?:png|jpg)\d*)/,u+o),query:a(r.query)})}},{"./browser":165,"./config":170,"./util":181,url:199}],179:[function(t,e,n){"use strict";function r(t){function e(){h.apply(this,arguments)}function n(){d.apply(this,arguments),this.members=e.prototype.members}var r=JSON.stringify(t);if(g[r])return g[r];void 0===t.alignment&&(t.alignment=1),e.prototype=Object.create(h.prototype);var s=0,u=0,v=["Uint8"];return e.prototype.members=t.members.map(function(n){n={name:n.name,type:n.type,components:n.components||1},p(n.name.length),p(n.type in m),v.indexOf(n.type)<0&&v.push(n.type);var r=o(n.type);u=Math.max(u,r),n.offset=s=a(s,Math.max(t.alignment,r));for(var i=0;ithis.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*this.RESIZE_MULTIPLIER),this.DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},d.prototype._refreshViews=function(){for(var t=0;t=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)},n.bezier=function(t,e,n,i){var a=new r(t,e,n,i);return function(t){return a.solve(t)}},n.ease=n.bezier(.25,.1,.25,1),n.clamp=function(t,e,n){return Math.min(n,Math.max(e,t))},n.wrap=function(t,e,n){var r=n-e,i=((t-e)%r+r)%r+e;return i===e?n:i},n.coalesce=function(){for(var t=0;t=0)return!0;return!1};var o={};n.warnOnce=function(t){o[t]||("undefined"!=typeof console&&console.warn(t),o[t]=!0)}},{"../geo/coordinate":77,unitbezier:198}],182:[function(t,e,n){"use strict";function r(t,e,n,r){this._vectorTileFeature=t,t._z=e,t._x=n,t._y=r,this.properties=t.properties,null!=t.id&&(this.id=t.id)}e.exports=r,r.prototype={type:"Feature",get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},set geometry(t){this._geometry=t},toJSON:function(){var t={};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&"toJSON"!==e&&(t[e]=this[e]);return t}}},{}],183:[function(t,e,n){e.exports={_args:[[{raw:"mapbox-gl@^0.22.0",scope:null,escapedName:"mapbox-gl",name:"mapbox-gl",rawSpec:"^0.22.0",spec:">=0.22.0 <0.23.0",type:"range"},"/home/etienne/Documents/plotly/plotly.js"]],_from:"mapbox-gl@>=0.22.0 <0.23.0",_id:"mapbox-gl@0.22.1",_inCache:!0,_location:"/mapbox-gl",_nodeVersion:"4.4.5",_npmOperationalInternal:{host:"packages-12-west.internal.npmjs.com",tmp:"tmp/mapbox-gl-0.22.1.tgz_1471549891670_0.8762630566488951"},_npmUser:{name:"lucaswoj",email:"lucas@lucaswoj.com"},_npmVersion:"2.15.5",_phantomChildren:{},_requested:{raw:"mapbox-gl@^0.22.0",scope:null,escapedName:"mapbox-gl",name:"mapbox-gl",rawSpec:"^0.22.0",spec:">=0.22.0 <0.23.0",type:"range"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.1.tgz",_shasum:"92a965547d4c2f24c22cbc487eeda48694cb627a",_shrinkwrap:null,_spec:"mapbox-gl@^0.22.0",_where:"/home/etienne/Documents/plotly/plotly.js",browser:{"./js/util/ajax.js":"./js/util/browser/ajax.js","./js/util/browser.js":"./js/util/browser/browser.js","./js/util/canvas.js":"./js/util/browser/canvas.js","./js/util/dom.js":"./js/util/browser/dom.js","./js/util/web_worker.js":"./js/util/browser/web_worker.js"},bugs:{url:"https://github.com/mapbox/mapbox-gl-js/issues"},dependencies:{csscolorparser:"^1.0.2",earcut:"^2.0.3","feature-filter":"^2.2.0","geojson-rewind":"^0.1.0","geojson-vt":"^2.4.0","gl-matrix":"^2.3.1","grid-index":"^1.0.0","mapbox-gl-function":"^1.2.1","mapbox-gl-shaders":"github:mapbox/mapbox-gl-shaders#de2ab007455aa2587c552694c68583f94c9f2747","mapbox-gl-style-spec":"github:mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae","mapbox-gl-supported":"^1.2.0",pbf:"^1.3.2",pngjs:"^2.2.0","point-geometry":"^0.0.0",quickselect:"^1.0.0",request:"^2.39.0","resolve-url":"^0.2.1","shelf-pack":"^1.0.0",supercluster:"^2.0.1",unassertify:"^2.0.0",unitbezier:"^0.0.0","vector-tile":"^1.3.0","vt-pbf":"^2.0.2",webworkify:"^1.3.0","whoots-js":"^2.0.0"},description:"A WebGL interactive maps library",devDependencies:{"babel-preset-react":"^6.11.1",babelify:"^7.3.0",benchmark:"~2.1.0",browserify:"^13.0.0",clipboard:"^1.5.12","concat-stream":"1.5.1",coveralls:"^2.11.8",doctrine:"^1.2.1",documentation:"https://github.com/documentationjs/documentation/archive/bb41619c734e59ef3fbc3648610032efcfdaaace.tar.gz","documentation-theme-utils":"3.0.0",envify:"^3.4.0",eslint:"^2.5.3","eslint-config-mourner":"^2.0.0","eslint-plugin-html":"^1.5.1",gl:"^4.0.1",handlebars:"4.0.5","highlight.js":"9.3.0",istanbul:"^0.4.2","json-loader":"^0.5.4",lodash:"^4.13.1","mapbox-gl-test-suite":"github:mapbox/mapbox-gl-test-suite#7babab52fb02788ebbc38384139bf350e8e38552","memory-fs":"^0.3.0",minifyify:"^7.0.1","npm-run-all":"^3.0.0",nyc:"6.4.0",proxyquire:"^1.7.9",remark:"4.2.2","remark-html":"3.0.0",sinon:"^1.15.4",st:"^1.2.0",tap:"^5.7.0","transform-loader":"^0.2.3","unist-util-visit":"1.1.0",vinyl:"1.1.1","vinyl-fs":"2.4.3",watchify:"^3.7.0",webpack:"^1.13.1","webworkify-webpack":"^1.1.3"},directories:{},dist:{shasum:"92a965547d4c2f24c22cbc487eeda48694cb627a",tarball:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.1.tgz"},engines:{node:">=4.0.0"},gitHead:"13a9015341f0602ccb55c98c53079838ad4b70b5",homepage:"https://github.com/mapbox/mapbox-gl-js#readme",license:"BSD-3-Clause",main:"js/mapbox-gl.js",maintainers:[{name:"aaronlidman",email:"aaronlidman@gmail.com"},{name:"ajashton",email:"aj.ashton@gmail.com"},{name:"ansis",email:"ansis.brammanis@gmail.com"},{name:"bergwerkgis",email:"wb@bergwerk-gis.at"},{name:"bhousel",email:"bryan@mapbox.com"},{name:"bsudekum",email:"bobby@mapbox.com"},{name:"camilleanne",email:"camille@mapbox.com"},{name:"dnomadb",email:"damon@mapbox.com"},{name:"dthompson",email:"dthompson@gmail.com"},{name:"emilymcafee",email:"emily@mapbox.com"},{name:"flippmoke",email:"flippmoke@gmail.com"},{name:"freenerd",email:"spam@freenerd.de"},{name:"gretacb",email:"carol@mapbox.com"},{name:"ian29",email:"ian.villeda@gmail.com"},{name:"ianshward",email:"ian@mapbox.com"},{name:"ingalls",email:"nicholas.ingalls@gmail.com"},{name:"jfirebaugh",email:"john.firebaugh@gmail.com"},{name:"jrpruit1",email:"jake@jakepruitt.com"},{name:"karenzshea",email:"karen@mapbox.com"},{name:"kkaefer",email:"kkaefer@gmail.com"},{name:"lbud",email:"lauren@mapbox.com"},{name:"lucaswoj",email:"lucas@lucaswoj.com"},{name:"lxbarth",email:"alex@mapbox.com"},{name:"lyzidiamond",email:"lyzi@mapbox.com"},{name:"mapbox-admin",email:"accounts@mapbox.com"},{name:"mateov",email:"matt@mapbox.com"},{name:"mcwhittemore",email:"mcwhittemore@gmail.com"},{name:"miccolis",email:"jeff@miccolis.net"},{name:"mikemorris",email:"michael.patrick.morris@gmail.com"},{name:"morganherlocker",email:"morgan.herlocker@gmail.com"},{name:"mourner",email:"agafonkin@gmail.com"},{name:"nickidlugash",email:"nicki@mapbox.com"},{name:"rclark",email:"ryan.clark.j@gmail.com"},{name:"samanbb",email:"saman@mapbox.com"},{name:"sbma44",email:"tlee@mapbox.com"},{name:"scothis",email:"scothis@gmail.com"},{name:"sgillies",email:"sean@mapbox.com"},{name:"springmeyer",email:"dane@mapbox.com"},{name:"themarex",email:"patrick@mapbox.com"},{name:"tmcw",email:"tom@macwright.org"},{name:"tristen",email:"tristen.brown@gmail.com"},{name:"willwhite",email:"will@mapbox.com"},{name:"yhahn",email:"young@mapbox.com"}],name:"mapbox-gl",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git://github.com/mapbox/mapbox-gl-js.git"},scripts:{build:"npm run build-docs # invoked by publisher when publishing docs on the mb-pages branch","build-dev":"browserify js/mapbox-gl.js --debug --standalone mapboxgl > dist/mapbox-gl-dev.js && tap --no-coverage test/build/dev.test.js","build-docs":"documentation build --github --format html -c documentation.yml --theme ./docs/_theme --output docs/api/","build-min":"browserify js/mapbox-gl.js --debug -t unassertify --plugin [minifyify --map mapbox-gl.js.map --output dist/mapbox-gl.js.map] --standalone mapboxgl > dist/mapbox-gl.js && tap --no-coverage test/build/min.test.js","build-token":"browserify debug/access-token-src.js --debug -t envify > debug/access-token.js",lint:"eslint --ignore-path .gitignore js test bench docs/_posts/examples/*.html","open-changed-examples":"git diff --name-only mb-pages HEAD -- docs/_posts/examples/*.html | awk '{print \"http://127.0.0.1:4000/mapbox-gl-js/example/\" substr($0,33,length($0)-37)}' | xargs open",start:"run-p build-token watch-dev watch-bench start-server","start-bench":"run-p build-token watch-bench start-server","start-debug":"run-p build-token watch-dev start-server","start-docs":"npm run build-min && npm run build-docs && jekyll serve -w","start-server":"st --no-cache --localhost --port 9966 --index index.html .",test:"npm run lint && tap --reporter dot test/js/*/*.js test/build/webpack.test.js","test-suite":"node test/render.test.js && node test/query.test.js","watch-bench":"node bench/download-data.js && watchify bench/index.js --plugin [minifyify --no-map] -t [babelify --presets react] -t unassertify -t envify -o bench/bench.js -v","watch-dev":"watchify js/mapbox-gl.js --debug --standalone mapboxgl -o dist/mapbox-gl-dev.js -v"},version:"0.22.1"}},{}],184:[function(t,e,n){(function(t){function e(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r=-1&&!i;a--){var o=a>=0?arguments[a]:t.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(n=o+"/"+n,i="/"===o.charAt(0))}return n=e(r(n.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(t){var i=n.isAbsolute(t),a="/"===o(t,-1);return t=e(r(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&a&&(t+="/"),(i?"/":"")+t},n.isAbsolute=function(t){return"/"===t.charAt(0)},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(r(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},n.relative=function(t,e){function r(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=n.resolve(t).substr(1),e=n.resolve(e).substr(1);for(var i=r(t.split("/")),a=r(e.split("/")),o=Math.min(i.length,a.length),s=o,l=0;l55295&&e<57344){if(!n){e>56319||a+1===r?i.push(239,191,189):n=e;continue}if(e<56320){i.push(239,191,189),n=e;continue}e=n-55296<<10|e-56320|65536,n=null}else n&&(i.push(239,191,189),n=null);e<128?i.push(e):e<2048?i.push(e>>6|192,63&e|128):e<65536?i.push(e>>12|224,e>>6&63|128,63&e|128):i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}return i}e.exports=r;var a,o,s,l=t("ieee754");a={readUInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},writeUInt32LE:function(t,e){this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24},readInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+(this[t+3]<<24)},readFloatLE:function(t){return l.read(this,t,!0,23,4)},readDoubleLE:function(t){return l.read(this,t,!0,52,8)},writeFloatLE:function(t,e){return l.write(this,t,e,!0,23,4)},writeDoubleLE:function(t,e){return l.write(this,t,e,!0,52,8)},toString:function(t,e,n){var r="",i="";e=e||0,n=Math.min(this.length,n||this.length);for(var a=e;a=1;){if(e.pos>=n)throw new Error("Given varint doesn't fit into 10 bytes");var r=255&t;e.buf[e.pos++]=r|(t>=128?128:0),t/=128}}function o(t,e,n){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=t;i--)n.buf[i+r]=n.buf[i]}function s(t,e){for(var n=0;n>3,a=this.pos;t(i,e,this),this.pos===a&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*v;return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*v;return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,e,n=this.buf;return e=n[this.pos++],t=127&e,e<128?t:(e=n[this.pos++],t|=(127&e)<<7,e<128?t:(e=n[this.pos++],t|=(127&e)<<14,e<128?t:(e=n[this.pos++],t|=(127&e)<<21,e<128?t:i(t,this))))},readVarint64:function(){var t=this.pos,e=this.readVarint();if(e127;);else if(e===r.Bytes)this.pos=this.readVarint()+this.pos;else if(e===r.Fixed32)this.pos+=4;else{if(e!==r.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455?void a(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(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);var e=g.byteLength(t);this.writeVarint(e),this.realloc(e),this.buf.write(t,this.pos),this.pos+=e},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;n=128&&o(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,n){this.writeTag(t,r.Bytes),this.writeRawMessage(e,n)},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,u,e)},writePackedDouble:function(t,e){this.writeMessage(t,c,e)},writePackedFixed32:function(t,e){this.writeMessage(t,h,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,d,e)},writePackedFixed64:function(t,e){this.writeMessage(t,p,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,m,e)},writeBytesField:function(t,e){this.writeTag(t,r.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,r.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,r.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,r.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,r.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,r.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,r.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,r.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,r.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,r.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":185}],187:[function(t,e,n){"use strict";function r(t,e){this.x=t,this.y=e}e.exports=r,r.prototype={clone:function(){return new r(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,n=t.y-this.y;return e*e+n*n},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,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),r=e*this.x-n*this.y,i=n*this.x+e*this.y;return this.x=r,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t}},{}],188:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(t){if(f===setTimeout)return setTimeout(t,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function o(t){if(h===clearTimeout)return clearTimeout(t);if((h===i||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function s(){g&&p&&(g=!1,p.length?m=p.concat(m):v=-1,m.length&&l())}function l(){if(!g){var t=a(s);g=!0;for(var e=m.length;e;){for(p=m,m=[];++v1)for(var n=1;n1&&(r=n[0]+"@",t=n[1]),t=t.replace(P,".");var i=t.split("."),a=o(i,e).join(".");return r+a}function l(t){for(var e,n,r=[],i=0,a=t.length;i=55296&&e<=56319&&i65535&&(t-=65536,e+=R(t>>>10&1023|55296),t=56320|1023&t),e+=R(t)}).join("")}function c(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:M}function f(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function h(t,e,n){var r=0;for(t=n?F(t/T):t>>1,t+=F(t/e);t>O*A>>1;r+=M)t=F(t/O);return F(r+(O+1)*t/(t+S))}function d(t){var e,n,r,i,o,s,l,f,d,p,m=[],g=t.length,v=0,y=E,x=z;for(n=t.lastIndexOf(L),n<0&&(n=0),r=0;r=128&&a("not-basic"),m.push(t.charCodeAt(r));for(i=n>0?n+1:0;i=g&&a("invalid-input"),f=c(t.charCodeAt(i++)),(f>=M||f>F((w-v)/s))&&a("overflow"),v+=f*s,d=l<=x?k:l>=x+A?A:l-x,!(fF(w/p)&&a("overflow"),s*=p;e=m.length+1,x=h(v-o,e,0==o),F(v/e)>w-y&&a("overflow"),y+=F(v/e),v%=e,m.splice(v++,0,y)}return u(m)}function p(t){var e,n,r,i,o,s,u,c,d,p,m,g,v,y,x,_=[];for(t=l(t),g=t.length,e=E,n=0,o=z,s=0;s=e&&mF((w-n)/v)&&a("overflow"),n+=(u-e)*v,e=u,s=0;sw&&a("overflow"),m==e){for(c=n,d=M;p=d<=o?k:d>=o+A?A:d-o,!(c= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=M-k,F=Math.floor,R=String.fromCharCode;if(_={version:"1.4.1",ucs2:{decode:l,encode:u},decode:d,encode:p,toASCII:g,toUnicode:m},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return _});else if(v&&y)if(n.exports==v)y.exports=_;else for(b in _)_.hasOwnProperty(b)&&(v[b]=_[b]);else i.punycode=_}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],190:[function(t,e,n){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,n,a){e=e||"&",n=n||"=";var o={};if("string"!=typeof t||0===t.length)return o;var s=/\+/g;t=t.split(e);var l=1e3;a&&"number"==typeof a.maxKeys&&(l=a.maxKeys);var u=t.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(f=m.substr(0,g),h=m.substr(g+1)):(f=m,h=""),d=decodeURIComponent(f),p=decodeURIComponent(h),r(o,d)?i(o[d])?o[d].push(p):o[d]=[o[d],p]:o[d]=p}return o};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],191:[function(t,e,n){"use strict";function r(t,e){if(t.map)return t.map(e);for(var n=[],r=0;rn;){if(o-n>600){var l=o-n+1,u=e-n+1,c=Math.log(l),f=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*f*(l-f)/l)*(u-l/2<0?-1:1),d=Math.max(n,Math.floor(e-u*f/l+h)),p=Math.min(o,Math.floor(e+(l-u)*f/l+h));r(t,e,d,p,s)}var m=t[e],g=n,v=o;for(i(t,n,e),s(t[o],m)>0&&i(t,n,o);g0;)v--}0===s(t[n],m)?i(t,n,v):(v++,i(t,v,o)),v<=e&&(n=v+1),e<=v&&(o=v-1)}}function i(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function a(t,e){return te?1:0}e.exports=r},{}],194:[function(e,n,r){void function(e,i){"function"==typeof t&&t.amd?t(i):"object"==typeof r?n.exports=i():e.resolveUrl=i()}(this,function(){function t(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var n=document.getElementsByTagName("head")[0];n.insertBefore(e,n.firstChild);for(var r,i=document.createElement("a"),a=1;a0){for(var s=0,l=0,u=0;ur.h||t>r.free||nc)&&(f=2*Math.max(t,c)),(ll)&&(u=2*Math.max(n,l)),this.resize(f,u),this.packOne(t,n)}return null},t.prototype.clear=function(){this.shelves=[],this.stats={}},t.prototype.resize=function(t,e){this.w=t,this.h=e;for(var n=0;nthis.free||e>this.h)return null;var n=this.x;return this.x+=t,this.free-=t,{x:n,y:this.y,w:t,h:e,width:t,height:e}},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t})},{}],196:[function(t,e,n){"use strict";function r(t){return new i(t)}function i(t){this.options=d(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function a(t,e,n,r){return{x:t,y:e,zoom:1/0,id:r,numPoints:n}}function o(t,e){var n=t.geometry.coordinates;return a(u(n[0]),c(n[1]),1,e)}function s(t){return{type:"Feature",properties:l(t),geometry:{type:"Point",coordinates:[f(t.x),h(t.y)]}}}function l(t){var e=t.numPoints,n=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:n}}function u(t){return t/360+.5}function c(t){var e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function f(t){return 360*(t-.5)}function h(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function d(t,e){for(var n in e)t[n]=e[n];return t}function p(t){return t.x}function m(t){return t.y}var g=t("kdbush");e.exports=r,i.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var n="prepare "+t.length+" points";e&&console.time(n),this.points=t;var r=t.map(o);e&&console.timeEnd(n);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var a=+Date.now();this.trees[i+1]=g(r,p,m,this.options.nodeSize,Float32Array),r=this._cluster(r,i),e&&console.log("z%d: %d clusters in %dms",i,r.length,+Date.now()-a)}return this.trees[this.options.minZoom]=g(r,p,m,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var n=this.trees[this._limitZoom(e)],r=n.range(u(t[0]),c(t[3]),u(t[2]),c(t[1])),i=[],a=0;a.5?l/(2-a-o):l/(a+o),a){case t:r=(e-n)/l+(e1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var i,a,o;if(t=z(t,360),e=z(e,100),n=z(n,100),0===e)i=a=o=n;else{var s=n<.5?n*(1+e):n+e-n*e,l=2*n-s;i=r(l,s,t+1/3),a=r(l,s,t),o=r(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,n){t=z(t,255),e=z(e,255),n=z(n,255);var r,i,a=Z(t,e,n),o=H(t,e,n),s=a,l=a-o;if(i=0===a?0:l/a,a==o)r=0;else{switch(a){case t:r=(e-n)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(r(i));return o}function A(t,e){e=e||6;for(var n=r(t).toHsv(),i=n.h,a=n.s,o=n.v,s=[],l=1/e;e--;)s.push(r({h:i,s:a,v:o})),o=(o+l)%1;return s}function S(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function T(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function z(t,n){I(t)&&(t="100%");var r=D(t);return t=H(n,Z(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function E(t){return H(1,Z(0,t))}function L(t){return parseInt(t,16)}function I(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function D(t){return"string"==typeof t&&t.indexOf("%")!=-1}function P(t){return 1==t.length?"0"+t:""+t}function C(t){return t<=1&&(t=100*t+"%"),t}function O(t){return e.round(255*parseFloat(t)).toString(16)}function F(t){return L(t)/255}function R(t){return!!W.CSS_UNIT.exec(t)}function j(t){t=t.replace(B,"").replace(q,"").toLowerCase();var e=!1;if(X[t])t=X[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=W.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=W.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=W.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=W.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=W.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=W.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=W.hex8.exec(t))?{r:L(n[1]),g:L(n[2]),b:L(n[3]),a:F(n[4]),format:e?"name":"hex8"}:(n=W.hex6.exec(t))?{r:L(n[1]),g:L(n[2]),b:L(n[3]),format:e?"name":"hex"}:(n=W.hex4.exec(t))?{r:L(n[1]+""+n[1]),g:L(n[2]+""+n[2]),b:L(n[3]+""+n[3]),a:F(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=W.hex3.exec(t))&&{r:L(n[1]+""+n[1]),g:L(n[2]+""+n[2]),b:L(n[3]+""+n[3]),format:e?"name":"hex"}}function N(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var B=/^\s+/,q=/\s+$/,V=0,U=e.round,H=e.min,Z=e.max,G=e.random;r.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,i,a,o,s=this.toRgb();return t=s.r/255,n=s.g/255,r=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),o=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=T(t),this._roundA=U(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=U(360*t.h),n=U(100*t.s),r=U(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=U(360*t.h),n=U(100*t.s),r=U(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:U(this._r),g:U(this._g),b:U(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+U(this._r)+", "+U(this._g)+", "+U(this._b)+")":"rgba("+U(this._r)+", "+U(this._g)+", "+U(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:U(100*z(this._r,255))+"%",g:U(100*z(this._g,255))+"%",b:U(100*z(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+U(100*z(this._r,255))+"%, "+U(100*z(this._g,255))+"%, "+U(100*z(this._b,255))+"%)":"rgba("+U(100*z(this._r,255))+"%, "+U(100*z(this._g,255))+"%, "+U(100*z(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),n=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=r(t);n="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,i=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return r(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(g,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(k,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},r.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?n[i]=t[i]:n[i]=C(t[i]));t=n}return r(t,e)},r.equals=function(t,e){return!(!t||!e)&&r(t).toRgbString()==r(e).toRgbString()},r.random=function(){return r.fromRatio({r:G(),g:G(),b:G()})},r.mix=function(t,e,n){n=0===n?0:n||50;var i=r(t).toRgb(),a=r(e).toRgb(),o=n/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return r(s)},r.readability=function(t,n){var i=r(t),a=r(n);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},r.isReadable=function(t,e,n){var i,a,o=r.readability(t,e);switch(a=!1,i=N(n),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5; -break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},r.mostReadable=function(t,e,n){var i,a,o,s,l=null,u=0;n=n||{},a=n.includeFallbackColors,o=n.level,s=n.size;for(var c=0;cu&&(u=i,l=r(e[c]));return r.isReadable(t,l,{level:o,size:s})||!a?l:(n.includeFallbackColors=!1,r.mostReadable(t,["#fff","#000"],n))};var X=r.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=r.hexNames=S(X),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof n&&n.exports?n.exports=r:"function"==typeof t&&t.amd?t(function(){return r}):window.tinycolor=r}(Math)},{}],198:[function(t,e,n){function r(t,e,n,r){this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=n,this.p2y=r}e.exports=r,r.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},r.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},r.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},r.prototype.solveCurveX=function(t,e){"undefined"==typeof e&&(e=1e-6);var n,r,i,a,o;for(i=t,o=0;o<8;o++){if(a=this.sampleCurveX(i)-t,Math.abs(a)r)return r;for(;na?n=i:r=i,i=.5*(r-n)+n}return i},r.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],199:[function(t,e,n){"use strict";function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function i(t,e,n){if(t&&u.isObject(t)&&t instanceof r)return t;var i=new r;return i.parse(t,e,n),i}function a(t){return u.isString(t)&&(t=i(t)),t instanceof r?t.format():r.prototype.format.call(t)}function o(t,e){return i(t,!1,!0).resolve(e)}function s(t,e){return t?i(t,!1,!0).resolveObject(e):e}var l=t("punycode"),u=t("./util");n.parse=i,n.resolve=o,n.resolveObject=s,n.format=a,n.Url=r;var c=/^([a-z0-9.+-]+:)/i,f=/:[0-9]*$/,h=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["<",">",'"',"`"," ","\r","\n","\t"],p=["{","}","|","\\","^","`"].concat(d),m=["'"].concat(p),g=["%","/","?",";","#"].concat(m),v=["/","?","#"],y=255,x=/^[+a-z0-9A-Z_-]{0,63}$/,_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,b={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},M={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},k=t("querystring");r.prototype.parse=function(t,e,n){if(!u.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),i=r!==-1&&r127?"x":C[F];if(!O.match(x)){var j=D.slice(0,T),N=D.slice(T+1),B=C.match(_);B&&(j.push(B[1]),N.unshift(B[2])),N.length&&(s="/"+N.join(".")+s),this.hostname=j.join(".");break}}}this.hostname.length>y?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=l.toASCII(this.hostname));var q=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+q,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!b[p])for(var T=0,P=m.length;T0)&&n.host.split("@");A&&(n.auth=A.shift(),n.host=n.hostname=A.shift())}return n.search=t.search,n.query=t.query,u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!b.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=b.slice(-1)[0],T=(n.host||t.host||b.length>1)&&("."===S||".."===S)||""===S,z=0,E=b.length;E>=0;E--)S=b[E],"."===S?b.splice(E,1):".."===S?(b.splice(E,1),z++):z&&(b.splice(E,1),z--);if(!x&&!_)for(;z--;z)b.unshift("..");!x||""===b[0]||b[0]&&"/"===b[0].charAt(0)||b.unshift(""),T&&"/"!==b.join("/").substr(-1)&&b.push("");var L=""===b[0]||b[0]&&"/"===b[0].charAt(0);if(k){n.hostname=n.host=L?"":b.length?b.shift():"";var A=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");A&&(n.auth=A.shift(),n.host=n.hostname=A.shift())}return x=x||n.host&&b.length,x&&!L&&b.unshift(""),b.length?n.pathname=b.join("/"):(n.pathname=null,n.path=null),u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var t=this.host,e=f.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":200,punycode:189,querystring:192}],200:[function(t,e,n){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],201:[function(t,e,n){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],202:[function(t,e,n){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],203:[function(t,e,n){(function(e,r){function i(t,e){var r={seen:[],stylize:o};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(e)?r.showHidden=e:e&&n._extend(r,e),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),l(r,t,r.depth)}function a(t,e){var n=i.styles[e];return n?"\x1b["+i.colors[n][0]+"m"+t+"\x1b["+i.colors[n][1]+"m":t}function o(t,e){return t}function s(t){var e={};return t.forEach(function(t,n){e[t]=!0}),e}function l(t,e,r){if(t.customInspect&&e&&S(e.inspect)&&e.inspect!==n.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(r,t);return x(i)||(i=l(t,i,r)),i}var a=u(t,e);if(a)return a;var o=Object.keys(e),m=s(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),A(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(e);if(0===o.length){if(S(e)){var g=e.name?": "+e.name:"";return t.stylize("[Function"+g+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(k(e))return t.stylize(Date.prototype.toString.call(e),"date");if(A(e))return c(e)}var v="",y=!1,_=["{","}"];if(p(e)&&(y=!0,_=["[","]"]),S(e)){var b=e.name?": "+e.name:"";v=" [Function"+b+"]"}if(w(e)&&(v=" "+RegExp.prototype.toString.call(e)),k(e)&&(v=" "+Date.prototype.toUTCString.call(e)),A(e)&&(v=" "+c(e)),0===o.length&&(!y||0==e.length))return _[0]+v+_[1];if(r<0)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=y?f(t,e,r,m,o):o.map(function(n){return h(t,e,r,m,n,y)}),t.seen.pop(),d(M,v,_)}function u(t,e){if(b(e))return t.stylize("undefined","undefined");if(x(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return y(e)?t.stylize(""+e,"number"):m(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,e,n,r,i){for(var a=[],o=0,s=e.length;o-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")),b(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.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 d(t,e,n){var r=0,i=t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}function p(t){return Array.isArray(t)}function m(t){return"boolean"==typeof t}function g(t){return null===t}function v(t){return null==t}function y(t){return"number"==typeof t}function x(t){return"string"==typeof t}function _(t){return"symbol"==typeof t}function b(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===z(t)}function M(t){return"object"==typeof t&&null!==t}function k(t){return M(t)&&"[object Date]"===z(t)}function A(t){return M(t)&&("[object Error]"===z(t)||t instanceof Error)}function S(t){return"function"==typeof t}function T(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function z(t){return Object.prototype.toString.call(t)}function E(t){return t<10?"0"+t.toString(10):t.toString(10)}function L(){var t=new Date,e=[E(t.getHours()),E(t.getMinutes()),E(t.getSeconds())].join(":");return[t.getDate(),O[t.getMonth()],e].join(" ")}function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var D=/%[sdj%]/g;n.format=function(t){if(!x(t)){for(var e=[],n=0;n=a)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}}),s=r[n];n>3}if(i--,1===r||2===r)a+=t.readSVarint(),o+=t.readSVarint(),1===r&&(e&&s.push(e),e=[]),e.push(new l(a,o));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&s.push(e),s},r.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,r=0,i=0,a=0,o=1/0,s=-(1/0),l=1/0,u=-(1/0);t.pos>3}if(r--,1===n||2===n)i+=t.readSVarint(),a+=t.readSVarint(),is&&(s=i),au&&(u=a);else if(7!==n)throw new Error("unknown command "+n)}return[o,l,s,u]},r.prototype.toGeoJSON=function(t,e,n){function i(t){for(var e=0;e>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}var o=t("./vectortilefeature.js");e.exports=r,r.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 o(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":206}],208:[function(t,e,n){function r(t){var e=[];for(var n in t.layers)e.push(a(t.layers[n]));var r=new c;return f.tile.write({layers:e},r),r.finish()}function i(t){var e={};for(var n in t)e[n]=new h(t[n].features),e[n].name=n;return r({layers:e})}function a(t){for(var e={name:t.name||"",version:t.version||1,extent:t.extent||4096,keys:[],values:[],features:[]},n={},r={},i=0;i>31}function l(t){for(var e=[],n=0,r=0,i=t.length,a=0;a2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}rt.selectAll("tspan.line").attr({y:0,x:0});var r=J.select(".annotation-math-group"),i=!r.empty(),s=d.bBox((i?r:rt).node()),u=s.width,p=s.height,v=Math.round(u+2*tt),y=Math.round(p+2*tt);H._w=u,H._h=p;var _=!1;if(["x","y"].forEach(function(e){var r,i=H[e+"ref"]||e,a=f.getFromId(t,i),o=(Y+("x"===e?0:90))*Math.PI/180,s=v*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=H[e+"anchor"];if(a){if(!a.autorange&&(H[e]-a.range[0])*(H[e]-a.range[1])>0&&(H["a"+e+"ref"]===i?(H["a"+e]-a.range[0])*(H["a"+e]-a.range[1])>0&&(_=!0):_=!0,_))return;X[e]=a._offset+a.l2p(H[e]),r=.5}else r=H[e],"y"===e&&(r=1-r),X[e]="x"===e?D.l+D.w*r:D.t+D.h*r;var u=0;H["a"+e+"ref"]===i?X["aa"+e]=a._offset+a.l2p(H["a"+e]):(u=H.showarrow?H["a"+e]:s*n(r,l),X[e]+=u),H["_"+e+"type"]=a&&a.type,H["_"+e+"size"]=s,H["_"+e+"shift"]=u}),_)return void J.remove();var b,w;H.showarrow&&(b=H.axref===H.xref?X.x:c.constrain(X.x-H.ax,1,k.width-1),w=H.ayref===H.yref?X.y:c.constrain(X.y-H.ay,1,k.height-1)),X.x=c.constrain(X.x,1,k.width-1),X.y=c.constrain(X.y,1,k.height-1);var M=tt-s.top,A=tt-s.left;i?r.select("svg").attr({x:tt-1,y:tt}):(rt.attr({x:A,y:M}),rt.selectAll("tspan.line").attr({y:M,x:A})),et.call(d.setRect,$/2,$/2,v-$,y-$);var S=0,T=0;S=H.axref===H.xref?Math.round(X.aax-v/2):Math.round(X.x-v/2),T=H.ayref===H.yref?Math.round(X.aay-y/2):Math.round(X.y-y/2),J.call(c.setTranslate,S,T);var z="annotations["+e+"]",E=function(n,r){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=H.axref===H.xref?X.aax+n:X.x+n,s=H.ayref===H.yref?X.aay+r:X.y+r;var u=c.rotationXYMatrix(Y,i,s),f=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,m=et.attr("height")/2,v=[[i-p,s-m,i-p,s+m],[i-p,s+m,i+p,s+m],[i+p,s+m,i+p,s-m],[i+p,s-m,i-p,s-m]].map(d);if(!v.reduce(function(t,e){return t^!!a(b,w,b+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=a(i,s,b,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=H.arrowwidth,_=H.arrowcolor,M=W.append("g").style({opacity:h.opacity(_)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=M.append("path").attr("d","M"+i+","+s+"L"+b+","+w).style("stroke-width",y+"px").call(h.stroke,h.rgb(_));x(k,H.arrowhead,"end",H.arrowsize);var A=M.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-b)+","+(s-w),transform:"translate("+b+","+w+")"}).style("stroke-width",y+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var S,T,E;g.init({element:A.node(),prepFn:function(){var t=c.getTranslate(J);T=t.x,E=t.y,S={},Z&&Z.autorange&&(S[Z._name+".autorange"]=!0),G&&G.autorange&&(S[G._name+".autorange"]=!0)},moveFn:function(t,e){M.attr("transform","translate("+t+","+e+")");var n=f(T,E),r=n[0]+t,i=n[1]+e;J.call(c.setTranslate,r,i),S[z+".x"]=Z?H.x+t/Z._m:(b+t-D.l)/D.w,S[z+".y"]=G?H.y+e/G._m:1-(w+e-D.t)/D.h,H.axref===H.xref&&(S[z+".ax"]=Z?H.ax+t/Z._m:(b+t-D.l)/D.w),H.ayref===H.yref&&(S[z+".ay"]=G?H.ay+e/G._m:1-(w+e-D.t)/D.h),Q.attr({transform:"rotate("+Y+","+r+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,S);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};H.showarrow&&E(0,0);var L=c.rotationXYMatrix(Y,X.x,X.y),I=c.apply2DTransform(L);if(t._context.editable){var P,C,O;g.init({element:J.node(),prepFn:function(){var t=c.getTranslate(J);P=t.x,C=t.y,O={}},moveFn:function(t,e){J.call(c.setTranslate,P+t,C+e);var n="pointer";if(H.showarrow)H.axref===H.xref?O[z+".ax"]=Z.p2l(Z.l2p(H.ax)+t):O[z+".ax"]=H.ax+t,H.ayref===H.yref?O[z+".ay"]=G.p2l(G.l2p(H.ay)+e):O[z+".ay"]=H.ay+e,E(t,e);else{if(Z)O[z+".x"]=H.x+t/Z._m;else{var r=H._xsize/D.w,i=H.x+H._xshift/D.w-r/2;O[z+".x"]=g.align(i+t/D.w,r,0,1,H.xanchor)}if(G)O[z+".y"]=H.y+e/G._m;else{var a=H._ysize/D.h,o=H.y-H._yshift/D.h-a/2;O[z+".y"]=g.align(o-e/D.h,a,0,1,H.yanchor)}Z&&G||(n=g.getCursor(Z?.5:O[z+".x"],G?.5:O[z+".y"],H.xanchor,H.yanchor))}var s=I(P,C),l=s[0]+t,u=s[1]+e;J.call(c.setTranslate,P+t,C+e),Q.attr({transform:"rotate("+Y+","+l+","+u+")"}),m(J,n)},doneFn:function(e){if(m(J),e){l.relayout(t,O);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var w,M=t.layout,k=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return M.annotations=u,y(M,k),void r(t);if("remove"===u)return delete M.annotations,k.annotations=[],void r(t);if(n&&"add"!==u){for(w=0;we;w--)k._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}k._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var S=M.annotations[e],T=k.annotations[e];if(S){var z={xref:S.xref,yref:S.yref},E={};"string"==typeof n&&n?E[n]=u:c.isPlainObject(n)&&(E=n);var L=Object.keys(E);for(w=0;w4/3&&(R=V)}}else F&&(N&&(R<1/3?R+=q:R>2/3&&(R-=q)),R=(R-F.domain[0])/(F.domain[1]-F.domain[0]),R=F.range[0]+R*(F.range[1]-F.range[0]))}F&&F===O&&j&&("log"===j&&"log"!==F.type?R=Math.pow(10,R):"log"!==j&&"log"===F.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),S[C]=R}}var H=v(S,k);k.annotations[e]=H;var Z=f.getFromId(t,H.xref),G=f.getFromId(t,H.yref),X={x:0,y:0},Y=+H.textangle||0,W=k._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",H.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:S,fullAnnotation:H})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),J=Q.append("g"),$=H.borderwidth,K=H.borderpad,tt=$+K,et=J.append("rect").attr("class","bg").style("stroke-width",$+"px").call(h.stroke,H.bordercolor).call(h.fill,H.bgcolor),nt=H.font,rt=J.append("text").classed("annotation",!0).attr("data-unformatted",H.text).text(H.text);t._context.editable?rt.call(p.makeEditable,J).call(_).on("edit",function(n){H.text=n,this.attr({"data-unformatted":H.text}),this.call(_);var r={};r["annotations["+e+"].text"]=H.text,Z&&Z.autorange&&(r[Z._name+".autorange"]=!0),G&&G.autorange&&(r[G._name+".autorange"]=!0),l.relayout(t,r)}):rt.call(_),Q.attr({transform:"rotate("+Y+","+X.x+","+X.y+")"}).call(d.setPosition,X.x,X.y)}}function a(t,e,n,r,i,a,o,s){var l=n-t,u=i-t,c=o-i,f=r-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var m=(u*d-c*h)/p,g=(u*f-l*h)/p;return g<0||g>1||m<0||m>1?null:{x:t+l*m,y:e+f*m}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),m=t("../../lib/setcursor"),g=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:r,drawOne:i}},{"../../lib":314,"../../lib/setcursor":324,"../../lib/svg_text_utils":326,"../../plotly":336,"../../plots/cartesian/axes":340,"../../plots/plots":372,"../color":223,"../dragelement":245,"../drawing":247,"./annotation_defaults":214,"./defaults":218,"./draw_arrow_head":220,d3:8,"fast-isnumeric":12}],220:[function(t,e,n){"use strict";var r=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,n,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof n&&n||(n="end");var f,h,d,p,m=(o.getPx(t,"stroke-width")||1)*l,g=t.style("stroke")||a.defaultLine,v=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,_=c.backoff*m;if("line"===u.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},h={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(f.y-h.y,f.x-h.x),p=d+Math.PI,_){var b=_*Math.cos(d),w=_*Math.sin(d);y&&(f.x-=b,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(h.x+=b,h.y+=w,t.attr({x2:h.x,y2:h.y}))}}else if("path"===u.nodeName){var M=u.getTotalLength(),k="";if(y){var A=u.getPointAtLength(0),S=u.getPointAtLength(.1);d=Math.atan2(A.y-S.y,A.x-S.x),f=u.getPointAtLength(Math.min(_,M)),_&&(k="0px,"+_+"px,")}if(x){var T=u.getPointAtLength(M),z=u.getPointAtLength(M-.1);if(p=Math.atan2(T.y-z.y,T.x-z.x),h=u.getPointAtLength(Math.max(0,M-_)),_){var E=k?2*_:_;k+=M-E+"px,"+M+"px"}}else k&&(k+=M+"px");k&&t.style("stroke-dasharray",k)}var L=function(n,i){e>5&&(i=0),r.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+n.x+","+n.y+")rotate("+180*i/Math.PI+")scale("+m+")"}).style({fill:g,opacity:v,"stroke-width":0})};y&&L(f,d),x&&L(h,p)}}},{"../color":223,"../drawing":247,"./arrow_paths":215,d3:8,"fast-isnumeric":12}],221:[function(t,e,n){"use strict";var r=t("../../plotly");n.moduleType="component",n.name="annotations",n.ARROWPATHS=t("./arrow_paths"),n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.calcAutorange=t("./calc_autorange"),n.arrowhead=t("./draw_arrow_head");var i=t("./draw");n.draw=i.draw,n.drawOne=i.drawOne,n.add=function(t){var e=t._fullLayout.annotations.length;r.relayout(t,"annotations["+e+"]","add")}},{"../../plotly":336,"./arrow_paths":215,"./attributes":216,"./calc_autorange":217,"./defaults":218,"./draw":219,"./draw_arrow_head":220}],222:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],223:[function(t,e,n){"use strict";function r(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===r.length;if(!i&&3!==r.length)return t;for(var o=0;o=0))return t;if(3===o)r[o]>1&&(r[o]=1);else if(r[o]>=1)return t}var s=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return i?"rgba("+s+", "+r[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var n=i(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},o.combine=function(t,e){var n=i(t).toRgb();if(1===n.a)return i(t).toRgbString();var r=i(e||o.background).toRgb(),a=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},s={r:a.r*(1-n.a)+n.r*n.a,g:a.g*(1-n.a)+n.g*n.a,b:a.b*(1-n.a)+n.b*n.a};return i(s).toRgbString()},o.contrast=function(t,e,n){var r=i(t),a=r.isLight()?r.darken(n):r.lighten(e);return a.toString()},o.stroke=function(t,e){var n=i(e);t.style({stroke:o.tinyRGB(n),"stroke-opacity":n.getAlpha()})},o.fill=function(t,e){var n=i(e);t.style({fill:o.tinyRGB(n),"fill-opacity":n.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,n,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):n.node()&&!n.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===b.titleside)K.domain[1]-=st/S.h,a[1]*=-1;else{K.domain[0]+=st/S.h;var u=Math.max(1,n.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),K.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(S.h*(1-K.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(L);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?z[0]:(L[e]+L[e-1])/2,e===L.length-1?z[1]:(L[e]+L[e+1])/2].map(K.c2p).map(Math.round);e!==L.length-1&&(n[1]+=n[1]>n[0]?1:-1);var a=D(t).replace("e-",""),o=i(a).toHexString();r.select(this).attr({x:X,width:Math.max(B,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:o})});var h=at.select(".cblines").selectAll("path.cbline").data(b.line.color&&b.line.width?E:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){r.select(this).attr("d","M"+X+","+(Math.round(K.c2p(t))+b.line.width/2%1)+"h"+B).call(d.lineGroupStyle,b.line.width,I(t),b.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=X+B+(b.outlinewidth||0)/2-("outside"===b.ticks?1:0),K.side="right",c.syncOrAsync([function(){return l.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(b.titleside)===-1){var e=K.titlefont.size,n=K._offset+K._length/2,i=S.l+(K.position||0)*S.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));M("h"+K._id+"title",{avoid:{selection:r.select(t).selectAll("g."+K._id+"tick"),side:b.titleside,offsetLeft:S.l,offsetTop:S.t,maxShift:A.width},attributes:{x:i,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,n){var r,i=_();r=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:K,propName:r,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),m.draw(t,e,f(a,n||{}))}function k(){var n=B+b.outlinewidth/2+d.bBox(K._axislayer.node()).width;if(R=ot.select("text"),R.node()&&!R.classed("js-placeholder")){var r,i=ot.select(".h"+K._id+"title-math-group").node();r=i&&["top","bottom"].indexOf(b.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-X-S.l,n=Math.max(n,r)}var a=2*b.xpad+n+b.borderwidth+b.outlinewidth/2,s=Q-J;at.select(".cbbg").attr({x:X-b.xpad-(b.borderwidth+b.outlinewidth)/2,y:J-Z,width:Math.max(a,2),height:Math.max(s+2*Z,2)}).call(p.fill,b.bgcolor).call(p.stroke,b.bordercolor).style({"stroke-width":b.borderwidth}),at.selectAll(".cboutline").attr({x:X,y:J+b.ypad+("top"===b.titleside?st:0),width:Math.max(B,2),height:Math.max(s-2*b.ypad-st,2)}).call(p.stroke,b.outlinecolor).style({fill:"None","stroke-width":b.outlinewidth});var l=({center:.5,right:1}[b.xanchor]||0)*a;at.attr("transform","translate("+(S.l-l)+","+S.t+")"),o.autoMargin(t,e,{x:b.x,y:b.y,l:a*({right:1,center:.5}[b.xanchor]||0),r:a*({left:1,center:.5}[b.xanchor]||0),t:s*({bottom:1,middle:.5}[b.yanchor]||0),b:s*({top:1,middle:.5}[b.yanchor]||0)})}var A=t._fullLayout,S=A._size;if("function"!=typeof b.fillcolor&&"function"!=typeof b.line.color)return void A._infolayer.selectAll("g."+e).remove();var T,z=r.extent(("function"==typeof b.fillcolor?b.fillcolor:b.line.color).domain()),E=[],L=[],I="function"==typeof b.line.color?b.line.color:function(){return b.line.color},D="function"==typeof b.fillcolor?b.fillcolor:function(){return b.fillcolor},P=b.levels.end+b.levels.size/100,C=b.levels.size,O=1.001*z[0]-.001*z[1],F=1.001*z[1]-.001*z[0];for(T=b.levels.start;(T-P)*C<0;T+=C)T>O&&Tz[0]&&T1){var it=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));et*=it*c.roundUp(rt/it,[2,5,10]),(Math.abs(b.levels.start)/b.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+G,W+U-G],K.setScale();var at=A._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(S.l)+","+Math.round(S.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(S.l)+",-"+Math.round(S.t)+")");K._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(b.titleside)!==-1){var lt,ut=S.l+(b.x+H)*S.w,ct=K.titlefont.size;lt="top"===b.titleside?(1-(W+U-G))*S.h+S.t+3+.75*ct:(1-(W+G))*S.h+S.t-3-.25*ct,M(K._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ft=c.syncOrAsync([o.previousPromises,w,o.previousPromises,k],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var ht,dt,pt;u.init({element:at.node(),prepFn:function(){ht=at.attr("transform"),h(at)},moveFn:function(t,e){at.attr("transform",ht+" translate("+t+","+e+")"),dt=u.align(Y+t/S.w,q,0,1,b.xanchor),pt=u.align(W-e/S.h,U,0,1,b.yanchor);var n=u.getCursor(dt,pt,b.xanchor,b.yanchor);h(at,n)},doneFn:function(e){h(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},_().index)}})}return ft}function _(){var n,r,i=e.substr(2);for(n=0;n=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":314,"./flip_scale":235,"./scales":242}],231:[function(t,e,n){"use strict";var r=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},r.colorscale,{}),cauto:i({},r.zauto,{}),cmax:i({},r.zmax,{}),cmin:i({},r.zmin,{}),autocolorscale:i({},r.autocolorscale,{}),reversescale:i({},r.reversescale,{})}}},{"../../lib/extend":311,"./attributes":229,"./scales.js":242}],232:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":242}],233:[function(t,e,n){"use strict";var r=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,n,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,m=f?i.nestedProperty(e,d).get()||{}:e,g=p[h+"min"],v=p[h+"max"],y=p.colorscale,x=r(g)&&r(v)&&g=0;i--,a++)e=t[i],r[a]=[1-e[0],e[1]];return r}},{}],236:[function(t,e,n){"use strict";var r=t("./scales"),i=t("./default_scale"),a=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=i),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),a(t)?t:e):e}},{"./default_scale":232,"./is_valid_scale_array":240,"./scales":242}],237:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../../lib"),a=t("./is_valid_scale");e.exports=function(t,e){var n=e?i.nestedProperty(t,e).get()||{}:t,o=n.color,s=!1;if(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],244:[function(t,e,n){"use strict";var r=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,n,a){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===a?0:"middle"===a?1:"top"===a?2:r.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":314}],245:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,m._dragged=!1,m._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-m._mouseDownTimev&&(g=Math.max(g-1,1)),t.doneFn&&t.doneFn(m._dragged,g),!m._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),d.dispatchEvent(n)}return i(m),m._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,m=o.getPlotDiv(t.element)||{},g=1,v=s.DBLCLICKDELAY;m._mouseDownTime||(m._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=r},{"../../lib":314,"../../plotly":336,"../../plots/cartesian/constants":346,"./align":243,"./cursor":244,"./unhover":246}],246:[function(t,e,n){"use strict";var r=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,n)},i.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":310}],247:[function(t,e,n){"use strict";function r(t,e,n,r,i,a,o){if(s.traceIs(n,"symbols")){var u=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(n)?u(t.ms):(a.size||6)/2,t.mrc=e;var r=m.symbolNumber(t.mx||a.symbol)||0,i=r%100;return t.om=r%200>=100,m.symbolFuncs[i](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,f,h;t.so?(h=o.outlierwidth,f=o.outliercolor,c=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=r(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(h||1)+"px",fill:"none"}):(e.style("stroke-width",h+"px").call(l.fill,c),h&&e.call(l.stroke,f))}function i(t,e,n,r){var i=t[0]-e[0],o=t[1]-e[1],s=n[0]-e[0],l=n[1]-e[1],u=Math.pow(i*i+o*o,b/2),c=Math.pow(s*s+l*l,b/2),f=(c*c*i-u*u*s)*r,h=(c*c*o-u*u*l)*r,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&f/d),2),a.round(e[1]+(d&&h/d),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&h/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),m=e.exports={};m.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(l.fill,r)},m.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},m.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},m.setRect=function(t,e,n,r,i){t.call(m.setPosition,e,n).call(m.setSize,r,i)},m.translatePoint=function(t,e,n,r){var i=t.xp||n.c2p(t.x),a=t.yp||r.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},m.translatePoints=function(t,e,n,r){t.each(function(t){var i=a.select(this);m.translatePoint(t,i,e,n,r)})},m.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},m.crispRound=function(t,e,n){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},m.singleLineStyle=function(t,e,n,r,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=n||a.width||0,s=i||a.dash||"";l.stroke(e,r||a.color),m.dashLine(e,s,o)},m.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=r||i.dash||"";a.select(this).call(l.stroke,n||i.color).call(m.dashLine,s,o)})},m.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},m.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=a.select(this);try{n.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),n.remove()}})};var g=t("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolList=[],Object.keys(g).forEach(function(t){var e=g[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"])});var v=m.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";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),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},m.singlePointStyle=function(t,e,n){var i=n.marker,a=i.line,o=(n._input||{}).marker||{},s=m.tryColorscale(i,o,""),l=m.tryColorscale(i,o,"line.");r(t,e,n,s,l,i,a)},m.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=(e._input||{}).marker||{},i=m.tryColorscale(n,r,""),o=m.tryColorscale(n,r,"line.");t.each(function(t){m.singlePointStyle(t,a.select(this),e,i,o)})}},m.tryColorscale=function(t,e,n){var r=c.nestedProperty(t,n+"color").get(),i=c.nestedProperty(t,n+"colorscale").get(),a=c.nestedProperty(t,n+"cauto").get(),s=c.nestedProperty(t,n+"cmin"),l=c.nestedProperty(t,n+"cmax"),f=s.get(),h=l.get();return i&&Array.isArray(r)?(!a&&o(f)&&o(h)||(f=1/0,h=-(1/0),r.forEach(function(t){o(t)&&(f>t&&(f=+t),hh&&(f=0,h=1),s.set(f),l.set(h),c.nestedProperty(e,n+"cmin").set(f),c.nestedProperty(e,n+"cmax").set(h)),u.makeColorScaleFunc(u.extractScale(i,f,h))):c.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},_=1.3;m.textPointStyle=function(t,e){t.each(function(t){var n=a.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,n.call(m.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(r).call(f.convertToTspans);var h=a.select(this.parentNode),d=n.selectAll("tspan.line"),p=((d[0].length||1)-1)*_+1,g=x[l]*c,v=.75*u+x[s]*c+(x[s]-1)*p*u/2;h.attr("transform","translate("+g+","+v+")"),p>1&&d.attr({x:n.attr("x"),y:n.attr("y")})})};var b=.5;m.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],a=[];for(n=1;n=A&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(l),c.extendFlat({},l)},m.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=a.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":305,"../../lib":314,"../../lib/svg_text_utils":326,"../../registry":380,"../../traces/scatter/make_bubble_size_func":406,"../../traces/scatter/subtypes":411,"../color":223,"../colorscale":238,"./symbol_defs":248,d3:8,"fast-isnumeric":12}],248:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,i="l"+e+",-"+e,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+n+i+a+i+a+o+a+o+n+o+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),i=r.round(-t,2),a=r.round(t*-.309,2),o=r.round(.809*t,2);return"M"+e+","+a+"L"+n+","+o+"H-"+n+"L-"+e+","+a+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),i=r.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+n+"V"+n+"L0,"+e+"L-"+i+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),i=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+i+"H"+n+"L"+e+",0L"+n+",-"+i+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),i=r.round(.951*e,2),a=r.round(.363*e,2),o=r.round(.588*e,2),s=r.round(-e,2),l=r.round(e*-.309,2),u=r.round(.118*e,2),c=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+n+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),i=r.round(.76*t,2);return"M-"+i+",0l-"+n+",-"+e+"h"+i+"l"+n+",-"+e+"l"+n+","+e+"h"+i+"l-"+n+","+e+"l"+n+","+e+"h-"+i+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),i=r.round(1.6*t,2),a=r.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M-"+e+","+n+o+e+","+n+o+"0,-"+i+o+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),i=r.round(1.6*t,2),a=r.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M"+e+",-"+n+o+"-"+e+",-"+n+o+"0,"+i+o+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),i="A "+n+","+n+" 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=r.round(1.4*t,2),n=r.round(1.9*t,2),i="A "+n+","+n+" 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=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:8}],249:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],250:[function(t,e,n){"use strict";function r(t,e,n,r){var a=e["error_"+r]||{},l=a.visible&&["linear","log"].indexOf(n.type)!==-1,u=[];if(l){for(var c=s(a),f=0;f0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var m=i.select(this).selectAll("g.errorbar").data(t,e);m.exit().remove(),m.style("opacity",1);var g=m.enter().append("g").classed("errorbar",!0);c&&g.style("opacity",0).transition().duration(n.duration).style("opacity",1),m.each(function(t){var e=i.select(this),o=r(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var m=d.width;f="M"+(o.x-m)+","+o.yh+"h"+2*m+"m-"+m+",0V"+o.ys,o.noYS||(f+="m-"+m+",0h"+2*m);var g=e.select("path.yerror");s=!g.size(),s?g=e.append("path").classed("yerror",!0):c&&(g=g.transition().duration(n.duration).ease(n.easing)),g.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var v=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-v)+"v"+2*v+"m0,-"+v+"H"+o.xs,o.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":411,d3:8,"fast-isnumeric":12}],255:[function(t,e,n){"use strict";var r=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},a=e.error_x||{},o=r.select(this);o.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(i.stroke,n.color),a.copy_ystyle&&(a=n),o.selectAll("path.xerror").style("stroke-width",a.thickness+"px").call(i.stroke,a.color)})}},{"../color":223,d3:8}],256:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":346}],257:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,o,n,r)}e=e||{},r("source"),r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var s=0;s<2;s++){var l={_fullLayout:n},u=["x","y"][s];i.coerceRef(t,e,l,u,"paper")}return e}var i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var n=t.images,i=e.images=[],a=0;a=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],261:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":311,"../../plots/font_attributes":361,"../color/attributes":222}],262:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],263:[function(t,e,n){"use strict";var r=t("../../registry"),i=t("../../lib"),a=t("./attributes"),o=t("../../plots/layout_attributes"),s=t("./helpers"); -e.exports=function(t,e,n){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},m=0,g="normal",v=0;v1);if(x!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var _=t.xaxis;_&&_.rangeslider&&_.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",g),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":314,"../../plots/layout_attributes":363,"../../registry":380,"./attributes":261,"./helpers":266}],264:[function(t,e,n){"use strict";function r(t,e){function n(n){v.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(a,e)})}var r=t.data()[0][0],i=e._fullLayout,o=r.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?r.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(m.font,i.legend.font).text(u),e._context.editable&&!s?f.call(v.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var i,a=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=r.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(n)}function i(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=n.indexOf(f);h===-1?n.push(f):n.splice(h,1),c.relayout(e,"hiddenlabels",n)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;n=s*h,r=u.node()&&m.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}n=Math.max(n,16)+3,i.height=n,i.width=r}function o(t,e,n){var r=t._fullLayout,i=r.legend,a=i.borderwidth,o=b.isGrouped(i);if(b.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,a,5+a+i.height+n/2),i.height+=n,i.width=Math.max(i.width,r)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),n.each(function(e){var n=e[0],r=u.select(this).select(".legendtoggle");r.call(m.setRect,0,-n.height/2,(t._context.editable?0:i.width)+40,n.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cr.width-(r.margin.r+r.margin.l)&&(x=0,g+=v,i.height=i.height+v,v=0),f.setTranslate(this,a+x,5+a+e.height/2+g),i.width+=o+n,i.height=Math.max(i.height,e.height),x+=o+n,v=Math.max(e.height,v)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),n.each(function(e){var n=e[0],r=u.select(this).select(".legendtoggle");r.call(m.setRect,0,-n.height/2,t._context.editable?0:i.width,n.height)})}}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var i="top";w.isBottomAnchor(n)?i="bottom":w.isMiddleAnchor(n)&&(i="middle"),h.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[i]||0),t:n.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),h.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),m=t("../drawing"),g=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),_=t("./style"),b=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),z.call(m.setRect,N,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,a="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,b=n.showlegend&&x(t.calcdata,v),M=n.hiddenlabels||[];if(!n.showlegend||!b.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+a).data([0]);A.enter().append("clipPath").attr("id",a).append("rect");var S=k.selectAll("rect.bg").data([0]);S.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),S.call(g.stroke,v.bordercolor),S.call(g.fill,v.bgcolor),S.style("stroke-width",v.borderwidth+"px");var T=k.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var z=k.selectAll("rect.scrollbar").data([0]);z.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var E=T.selectAll("g.groups").data(b);E.enter().append("g").attr("class","groups"),E.exit().remove();var L=E.selectAll("g.traces").data(f.identity);L.enter().append("g").attr("class","traces"),L.exit().remove(),L.call(_).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(r,t).call(i,t)});var I=0!==k.enter().size();I&&(o(t,E,L),s(t));var D=0,P=n.width,C=0,O=n.height;o(t,E,L),v.height>O?l(t):s(t);var F=n._size,R=F.l+F.w*v.x,j=F.t+F.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?j-=v.height:w.isMiddleAnchor(v)&&(j-=v.height/2);var N=v.width,B=F.w;N>B?(R=F.l,N=B):(R+N>P&&(R=P-N),RV?(j=F.t,q=V):(j+q>O&&(j=O-q),jn[1])return n[1]}return i}function n(t){return t[0]}var r,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},m={};s&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",c.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(m.line={width:e("line.width",n,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[c.minExtend(a,p)],i=c.minExtend(o,m)}var g=l.select(this).select("g.legendpoints"),v=g.selectAll("path.scatterpts").data(s?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,i),s&&(r[0].mrc=3);var y=g.selectAll("g.pointtext").data(u?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||r.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||n.color),e&&i.call(h.stroke,t.mlc||r.color)})}function o(t){var e=t[0].trace,n=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=l.select(this);r.style("stroke-width",n+"px").call(h.fill,t.fc||e.fillcolor),n&&r.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,n=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(r).each(i)}},{"../../lib":314,"../../registry":380,"../../traces/pie/style_one":389,"../../traces/scatter/subtypes":411,"../color":223,"../drawing":247,d3:8}],269:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),i=n.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===r){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),m=0;m1)return r(["resetViews","toggleHover"]),o(g,n);c&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),h&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=i(s),y=[];return((u||p)&&!v||m)&&(y=["zoom2d","pan2d"]),(u||m)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!u&&!p||v||m||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):u?r(["hoverClosestCartesian","hoverCompareCartesian"]):d&&r(["hoverClosestPie"]),o(g,n)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var m=i(e,n,l);c("x",m[0]),c("y",m[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",n.font);var g=c("bgcolor");c("activecolor",o.contrast(g,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":314,"../color":223,"./attributes":273,"./button_attributes":274,"./constants":275}],277:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../plots/cartesian/axes"),a=t("./constants"),o=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=e.shapes;if(n.length&&t._fullData.length)for(var o=0;oe;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,n,r){function i(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,E)},i=E.line.width?E.line.color:"rgba(0,0,0,0)",a=n.append("path").attr(r).style("opacity",E.opacity).call(b.stroke,i).call(b.fill,E.fillcolor).call(w.dashLine,E.line.dash,E.line.width);L&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+L),t._context.editable&&f(t,a,E,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={xref:s.xref,yref:s.yref},u={};"string"==typeof n&&n?u[n]=r:x.isPlainObject(n)&&(u=n);var c=Object.keys(u);for(a=0;aG&&r>X&&!t.shiftKey?M.getCursor(i/n,1-a/r):"move";k(e,o),Z=o.split("-")[0]}function a(e){N=_.getFromId(t,n.xref),B=_.getFromId(t,n.yref),q=S.getDataToPixel(t,N),V=S.getDataToPixel(t,B,!0),U=S.getPixelToData(t,N),H=S.getPixelToData(t,B,!0);var a="shapes["+r+"]";"path"===n.type?(R=n.path,j=a+".path"):(c=q(n.x0),f=V(n.y0),h=q(n.x1),d=V(n.y1),m=a+".x0",v=a+".y0",x=a+".x1",b=a+".y1"),cX&&(u[E]=n[P]=H(s),u[L]=n[C]=H(l)),f-c>G&&(u[I]=n[O]=U(c),u[D]=n[F]=U(f))}e.attr("d",p(t,n))}var u,c,f,h,d,m,v,x,b,w,A,T,z,E,L,I,D,P,C,O,F,R,j,N,B,q,V,U,H,Z,G=10,X=10,Y={setCursor:i,element:e.node(),prepFn:a,doneFn:o},W=Y.element.getBoundingClientRect();M.init(Y)}function h(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function d(t,e,n){var r=_.getFromId(t,n.id,"x")._id,i=_.getFromId(t,n.id,"y")._id,a="below"===e.layer,o=r===e.xref||i===e.yref,s=!!n.shapelayer;return a&&o&&s}function p(t,e){var n,r,i,a,o=e.type,s=_.getFromId(t,e.xref),l=_.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=S.dataToLinear(s),r=function(t){return s._offset+s.l2p(n(t,!0))}):r=function(t){return u.l+u.w*t},l?(i=S.dataToLinear(l),a=function(t){return l._offset+l.l2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(r=S.decodeDate(r)),l&&"date"===l.type&&(a=S.decodeDate(a)),m(e.path,r,a);var c=r(e.x0),f=r(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,g=(h+d)/2,v=Math.abs(p-c),y=Math.abs(g-h),x="A"+v+","+y,b=p+v+","+g,w=p+","+(g-y);return"M"+b+x+" 0 1,1 "+w+x+" 0 0,1 "+b+"Z"}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,i=t.charAt(0),a=A.paramIsX[i],o=A.paramIsY[i],s=A.numParams[i],l=t.substr(1).replace(A.paramRE,function(t){return a[r]?t=e(t):o[r]&&(t=n(t)),r++,r>s&&(t="X"),t});return r>s&&(l=l.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),i+l})}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,i=t.charAt(0),a=A.paramIsX[i],o=A.paramIsY[i],s=A.numParams[i],l=t.substr(1).replace(A.paramRE,function(t){return r>=s?t:(a[r]?t=e(t):o[r]&&(t=n(t)),r++,t)});return i+l})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),_=t("../../plots/cartesian/axes"),b=t("../color"),w=t("../drawing"),M=t("../dragelement"),k=t("../../lib/setcursor"),A=t("./constants"),S=t("./helpers"),T=t("./shape_defaults"),z=t("./defaults");e.exports={draw:r,drawOne:i}},{"../../lib":314,"../../lib/setcursor":324,"../../plotly":336,"../../plots/cartesian/axes":340,"../color":223,"../dragelement":245,"../drawing":247,"./constants":287,"./defaults":288,"./helpers":290,"./shape_defaults":292,"fast-isnumeric":12}],290:[function(t,e,n){"use strict";n.dataToLinear=function(t){return"category"===t.type?t.c2l:t.d2l},n.linearToData=function(t){return"category"===t.type?t.l2c:t.l2d},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var i,a=t._fullLayout._size;if(e){var o=n.dataToLinear(e);i=function(t){return e._offset+e.l2p(o(t,!0))},"date"===e.type&&(i=n.decodeDate(i))}else i=r?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},n.getPixelToData=function(t,e,r){var i,a=t._fullLayout._size;if(e){var o=n.linearToData(e);i=function(t){return o(e.p2l(t-e._offset))}}else i=r?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],291:[function(t,e,n){"use strict";n.moduleType="component",n.name="shapes",n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.calcAutorange=t("./calc_autorange");var r=t("./draw");n.draw=r.draw,n.drawOne=r.drawOne},{"./attributes":285,"./calc_autorange":286,"./defaults":288,"./draw":289}],292:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e){function n(e,n){return r.coerce(t,s,a,e,n)}var s={};n("layer"),n("opacity"),n("fillcolor"),n("line.color"),n("line.width"),n("line.dash");for(var l=t.path?"path":"rect",u=n("type",l),c=["x","y"],f=0;f<2;f++){var h=c[f],d={_fullLayout:e},p=i.coerceRef(t,s,d,h);if("path"!==u){var m=.25,g=.75;if("paper"!==p){var v=i.getFromId(d,p),y=o.linearToData(v);m=y(v.range[0]+m*(v.range[1]-v.range[0])),g=y(v.range[0]+g*(v.range[1]-v.range[0]))}n(h+"0",m),n(h+"1",g)}}return"path"===u?n("path"):r.noneOrAll(t,s,["x0","x1","y0","y1"]),s}},{"../../lib":314,"../../plots/cartesian/axes":340,"./attributes":285,"./helpers":290}],293:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},r,{})},font:a({},r,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":311,"../../plots/animation_attributes":337,"../../plots/font_attributes":361,"../../plots/pad_attributes":371,"./constants":294}],294:[function(t,e,n){"use strict";e.exports={name:"sliders",itemName:"slider",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],295:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,o,n,r)}var s=i(t,e),l=r("visible",s.length>0);if(l){r("active"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),a.coerceFont(r,"font",n.font);var u=r("currentvalue.visible");u&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),a.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function i(t,e){function n(t,e){return a.coerce(r,i,u,t,e)}for(var r,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*E.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+E.stepInset+(t.inputAreaLength-2*E.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-E.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*E.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+E.railTouchRectClass).data([0]);r.enter().append("rect").classed(E.railTouchRectClass,!0).call(d,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,E.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),k.setTranslate(r,0,n.currentValueTotalHeight)}function _(t,e){var n=t.selectAll("rect."+E.railRectClass).data([0]);n.enter().append("rect").classed(E.railRectClass,!0);var r=e.inputAreaLength-2*E.railInset;n.attr({width:r,height:E.railWidth,rx:E.railRadius,ry:E.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(n,E.railInset,.5*(e.inputAreaWidth-E.railWidth)+e.currentValueTotalHeight)}function b(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(s.enter().append("g").classed(E.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&b(t),0!==n.length){var l=s.selectAll("g."+E.groupClassName).data(n,i);l.enter().append("g").classed(E.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,E.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+d+")")}}}function p(){T=0,z=!0,E=I,M._infolayer.select("."+e).attr({"data-unformatted":E}).text(E).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var m=n.propContainer,g=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},_=n.attributes,b=n.transform,w=n.containerGroup,M=t._fullLayout,k=m.titlefont.family,A=m.titlefont.size,S=m.titlefont.color,T=1,z=!1,E=m.title.trim();""===E&&(T=0),E.match(/Click to enter .+ title/)&&(T=.2,z=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var L=w.selectAll("text").data([0]);L.enter().append("text"),L.text(E).attr("class",e),L.attr({"data-unformatted":E}).call(f);var I="Click to enter "+y+" title";t._context.editable?(E||p(),L.call(c.makeEditable).on("edit",function(e){void 0!==v?a.restyle(t,g,e,v):a.relayout(t,g,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(_).selectAll("tspan.line").attr(_)})):E&&!E.match(/Click to enter .+ title/)||L.remove(),L.classed("js-placeholder",z)}},{"../../lib":314,"../../lib/svg_text_utils":326,"../../plotly":336,"../../plots/plots":372,"../color":223,"../drawing":247,d3:8,"fast-isnumeric":12}],299:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},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:s,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({},o,{}),font:a({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":311,"../../plots/font_attributes":361,"../../plots/pad_attributes":371,"../color/attributes":222}],300:[function(t,e,n){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],301:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,o,n,r)}var s=i(t,e),l=r("visible",s.length>0);l&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),a.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function i(t,e){function n(t,e){return a.coerce(r,i,u,t,e)}for(var r,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==n.length){var c=u.selectAll("g."+S.headerGroupClassName).data(n,i);c.enter().append("g").classed(S.headerGroupClassName,!0);var f=u.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(v).attr(S.menuIndexAttrName,"-1"),c.exit().each(function(e){x.select(this).remove(),f.call(v).attr(S.menuIndexAttrName,"-1"),_.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],305:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],306:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.19.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":221,"./components/images":259,"./components/legend":267,"./components/rangeselector":279,"./components/rangeslider":284,"./components/shapes":291,"./components/sliders":297,"./components/updatemenus":303,"./fonts/mathjax_config":307,"./lib/queue":322,"./plot_api/plot_schema":330,"./plot_api/register":331,"./plot_api/set_plot_config":332,"./plot_api/to_image":334,"./plot_api/validate":335,"./plotly":336,"./snapshot":385,"./snapshot/download":382,"./traces/scatter":401,d3:8,"es6-promise":10}],307:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],308:[function(t,e,n){"use strict";function r(t){return t&&void 0!==t.valType}var i=t("fast-isnumeric"),a=t("tinycolor2"),o=t("./nested_property"),s=t("./is_plain_object"),l=t("./filter_unique"),u=t("../components/colorscale/get_scale"),c=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,r){!i(t)||void 0!==r.min&&tr.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,r){t%1||!i(t)||void 0!==r.min&&tr.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var i="number"==typeof t;r.strict!==!0&&i?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(u(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):i(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&c.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!c.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a2)return!1;var o=a[0].split("-");if(o.length>3||3!==o.length&&a[1])return!1;if(4===o[0].length)e=Number(o[0]);else{if(2!==o[0].length)return!1;var l=(new Date).getFullYear();e=((Number(o[0])-l+70)%100+200)%100+l-70}return!!s(e)&&(1===o.length?new Date(e,0,1).getTime():(n=Number(o[1])-1,!(o[1].length>2)&&n>=0&&n<=11&&(2===o.length?new Date(e,n,1).getTime():(r=Number(o[2]),!(o[2].length>2)&&r>=1&&r<=31&&(r=new Date(e,n,r).getTime(),a[1]?(o=a[1].split(":"),!(o.length>3)&&(i=Number(o[0]),!(o[0].length>2)&&i>=0&&i<=23&&(r+=36e5*i,1===o.length?r:(n=Number(o[1]),!(o[1].length>2)&&n>=0&&n<=59&&(r+=6e4*n,2===o.length?r:(t=Number(o[2]),t>=0&&t<60&&r+1e3*t)))))):r)))))},n.isDateTime=function(t){return n.dateTime2ms(t)!==!1},n.ms2DateTime=function(t,e){e||(e=0);var n=new Date(t),i=o.time.format("%Y-%m-%d")(n);return e<7776e6?(i+=" "+r(n.getHours(),2),e<432e6&&(i+=":"+r(n.getMinutes(),2),e<108e5&&(i+=":"+r(n.getSeconds(),2),e<3e5&&(i+="."+r(n.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var l={H:["%H:%M:%S~%L","%H:%M:%S","%H:%M"],I:["%I:%M:%S~%L%p","%I:%M:%S%p","%I:%M%p"],D:["%H","%I%p","%Hh"]},u={Y:["%Y~%m~%d","%Y%m%d","%y%m%d","%m~%d~%Y","%d~%m~%Y"],Yb:["%b~%d~%Y","%d~%b~%Y","%Y~%d~%b","%Y~%b~%d"],y:["%m~%d~%y","%d~%m~%y","%y~%m~%d"],yb:["%b~%d~%y","%d~%b~%y","%y~%d~%b","%y~%b~%d"]},c=o.time.format.utc,f={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(c),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(c)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(c)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){u[t].forEach(function(e){f[t].D.push(c(e)),["H","I","D"].forEach(function(n){l[n].forEach(function(r){var i=f[t][n];i.push(c(e+"~"+r)),i.push(c(r+"~"+e))})})})});var h=/[a-z]*/g,d=function(t){return t.substr(0,3)},p=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,m=/[\s,\/\-\.\(\)]+/g,g=/~?([ap])~?m(~|$)/,v=function(t,e){return e+"m "},y=/\d\d\d\d/,x=/(^|~)[a-z]{3}/,_=/[ap]m/,b=/:/,w=/q([1-4])/,M=["31~mar","30~jun","30~sep","31~dec"],k=function(t,e){return M[e-1]},A=/ ?([+\-]\d\d:?\d\d|Z)$/;n.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(h,d).replace(p,"").replace(m,"~").replace(g,v).replace(w,k).trim().replace(A,"");var e,n,r=null,o=i(t),s=a(t);e=f[o][s],n=e.length;for(var l=0;l0&&(r.push(i),i=[])}return r.push(i),r},n.makeLine=function(t,e){var n={};return n=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(n.trace=e),n},n.makePolygon=function(t,e){var n={};if(1===t.length)n={type:"Polygon",coordinates:t};else{for(var r=new Array(t.length),i=0;in?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},i.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,n))/Math.log(r),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,n/i))/Math.log(r)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,n)?t(e,n,r):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(n=0;n=s&&(i-=s*Math.floor(i/s)),i<0?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[r];c[n]=a}return c},i.syncOrAsync=function(t,e,n){function r(){return i.syncOrAsync(t,e,n)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(r).then(void 0,i.promiseError);return n&&n(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,n){if(t){var r,i,a=!1,o=!0;for(r=0;r1?i+o[1]:"";if(a&&(o.length>1||s.length>4||n))for(;r.test(s);)s=s.replace(r,"$1"+a+"$2");return s+l}},{"./coerce":308,"./dates":309,"./extend":311,"./filter_unique":312,"./is_array":315,"./is_plain_object":316,"./loggers":317,"./matrix":318,"./nested_property":319,"./notifier":320,"./search":323,"./stats":325,d3:8}],315:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],316:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],317:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],o=!1,h(r))for(n=r.length-1;n>=0;n--)u(r[n])?o?r[n]=void 0:r.pop():o=!0;else if("object"==typeof r&&null!==r)for(a=Object.keys(r),o=!1,n=a.length-1;n>=0;n--)u(r[a[n]])&&!i(r[a[n]],a[n])?delete r[a[n]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,i,o,s=0,l=e.split(".");sa||rs)&&(!e||!u(t))}function n(t,e){var n=t[0],l=t[1];if(na||ls)return!1;var u,c,f,h,d,p=r.length,m=r[0][0],g=r[0][1],v=0;for(u=1;uMath.max(c,m)||l>Math.max(f,g)))if(lc||Math.abs(r(o,h))>i)return!0;return!1};i.filter=function(t,e){function n(n){t.push(n);var s=r.length,l=i;r.splice(o+1);for(var u=l+1;u1){var s=t.pop();n(s)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":318}],322:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");n.findBin=function(t,e,n){if(s(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?n?r:i:n?o:a;f90&&l.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,i=e[r]-e[0]||1,a=i/(r||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}},n.roundUp=function(t,e,n){for(var r,i=0,a=e.length-1,o=0,s=n?0:1,l=n?1:0,u=n?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":12}],326:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,n){var r="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),n();else{var r=a.select("svg").node().getBoundingClientRect();n(a.select(".MathJax_SVG"),e,r)}a.remove()})}function o(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),i=m[r];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,g.indexOf(c.protocol)===-1?"":''}if("br"===r)return"
";if(a)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))r.push(i);var a=0;r.forEach(function(t){for(var n=t+a,r=e.slice(0,n),i="",o=r.length-1;o>=0;o--){var s=r[o].match(/<(\/?).*>/i);if(s&&"
"!==r[o]){s[1]||(i=r[o]);break}}i&&(e.splice(n+1,0,i),e.splice(n,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,n){var r,i,a,o=n.horizontalAlign,s=n.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-r.height}:"middle"===s?function(){return l.top+(l.height-r.height)/2}:function(){return l.top},a="right"===o?function(){return l.right-r.width}:"center"===o?function(){return l.left+(l.width-r.width)/2}:function(){return l.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(h.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var m=t.node();m&&m.removeAttribute;m=m.parentNode)m.removeAttribute("data-bb");if(l){var g=h.getPlotDiv(s.node());(g&&g._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return n(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=r(l,"width"),h=r(l,"height"),m=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],g=parseInt(s.style("font-size"),10)||r(s,"height"),v=-g/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,v-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:v-h/2}):"a"===p[0]?l.attr({x:0,y:v}):l.attr({x:m,y:+s.attr("y")+v-h/2}),e&&e.call(s,u),t(u)})}))}else n();return t}};var m={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},g=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:n.fill||o.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||o.attr("data-unformatted")).call(c(o,e,n)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}n||(n={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),n.immediate?r():u.on("click",r),f.rebind(this,s,"on")}},{"../constants/string_mappings":304,"../constants/xmlns_namespaces":305,"../lib":314,d3:8}],327:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function i(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function a(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var o=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),l=t("../registry"),u=t("../lib"),c=t("../plots/plots"),f=t("../plots/cartesian/axes"),h=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var i=f.list({_fullLayout:t});for(e=0;e3?(g.x=1.02,g.xanchor="left"):g.x<-2&&(g.x=-.02,g.xanchor="right"),g.y>3?(g.y=1.02,g.yanchor="bottom"):g.y<-2&&(g.y=-.02,g.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=c.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||i<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(i,r+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 "+n+" must be unique.")}}function l(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&s(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,n){var r,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&lI.range[0]?[1,2]:[2,1]);else{var D=I.range[0],P=I.range[1];"log"===_?(D<=0&&P<=0&&n(T+".autorange",!0),D<=0?D=P/1e6:P<=0&&(P=D/1e6),n(T+".range[0]",Math.log(D)/Math.LN10),n(T+".range[1]",Math.log(P)/Math.LN10)):(n(T+".range[0]",Math.pow(10,D)),n(T+".range[1]",Math.pow(10,P)))}else n(T+".autorange",!0)}if("reverse"===A)z.range?z.range.reverse():(n(T+".autorange",!0),z.range=[1,0]),E.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var C=v.parts[1],O=v.parts[0],F=a[O]||[],R=F[C]||{};null===_&&(e[g]="remove"),2===v.parts.length&&("add"===e[g]||x.isPlainObject(e[g])?m[g]="remove":"remove"===e[g]?C===-1?(m[O]=F,delete m[g]):m[g]=R:x.log("???",e)),!r(R,"x")&&!r(R,"y")||x.containsAny(g,["color","opacity","align","dash"])||(d.docalc=!0);var j=w.getComponentMethod(O,"drawOne");j(t,C,v.parts.slice(2).join("."),e[g]),delete e[g]}else M.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1]?(L.manageArrayContainers(v,_,m),d.doplot=!0):(0===v.parts[0].indexOf("scene")?d.doplot=!0:0===v.parts[0].indexOf("geo")?d.doplot=!0:0===v.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===g?d.doplot=!0:!o._has("gl2d")||g.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===g?d.docalc=!0:v.parts[0].indexOf("legend")!==-1?d.dolegend=!0:g.indexOf("title")!==-1?d.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(v.parts[1],["tick","exponent","grid","zeroline"])?d.doticks=!0:g.indexOf(".linewidth")!==-1&&g.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:v.parts.length>1&&v.parts[1].indexOf("line")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&"mirror"===v.parts[1]?d.doticks=d.dolayoutstyle=!0:"margin.pad"===g?d.doticks=d.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||g.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(g)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(g)===-1&&(d.doplot=!0):d.doplot=!0,v.set(_))}}var N=t._fullLayout.width,B=t._fullLayout.height;M.supplyDefaults(t),t.layout.autosize&&M.plotAutoSize(t,t.layout,t._fullLayout);var q=e.height||e.width||t._fullLayout.width!==N||t._fullLayout.height!==B;return q&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:m,redoit:p,eventData:x.extendDeep({},p)}}function m(t){var e=g.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];g.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(z.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var i=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=i.append("g").classed("imagelayer",!0),n._shapeLowerLayer=i.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var a=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=a.append("g").classed("imagelayer",!0),n._shapeUpperLayer=a.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var g=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),_=t("../lib/events"),b=t("../lib/queue"),w=t("../registry"),M=t("../plots/plots"),k=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),S=t("../components/drawing"),T=t("../components/errorbars"),z=t("../constants/xmlns_namespaces"),E=t("../lib/svg_text_utils"),L=t("./helpers"),I=t("./subroutines");y.plot=function(t,e,n,r){function o(){if(b)return y.addFrames(t,b)}function s(){for(var e=D._basePlotModules,n=0;n=o.length?o[0]:o[t]:o}function i(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}if(t=L.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var a=t._transitionData;a._frameQueue||(a._frameQueue=[]),n=M.supplyAnimationDefaults(n);var o=n.transition,s=n.frame;return void 0===a._frameWaitingCnt&&(a._frameWaitingCnt=0),new Promise(function(s,l){function u(){if(0!==a._frameQueue.length){for(;a._frameQueue.length;){var e=a._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function c(e){if(0!==e.length){for(var o=0;oa._timeToNext&&h()};e()}function p(t){return Array.isArray(o)?v>=o.length?t.transitionOpts=o[v]:t.transitionOpts=o[0]:t.transitionOpts=o,v++,t}var m,g,v=0,y=[],_=void 0===e||null===e,b=Array.isArray(e),w=!_&&!b&&x.isPlainObject(e);if(w)y.push({type:"object",data:p(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&SS)&&T.push(g);y=T}}y.length>0?c(y):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,n){if(t=L.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(r=e.length-1;r>=0;r--)c.push({frame:M.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:u+r});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(i=c[r].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;n--)r=e[n],a.push({type:"delete",index:r}),o.unshift({type:"insert",index:r,value:i[r]});var s=M.modifyFrames,l=M.modifyFrames,u=[t,o],c=[t,a];return b&&b.add(t,s,u,l,c),M.modifyFrames(t,a)},y.purge=function(t){t=L.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return M.cleanPlot([],{},n,e),M.purge(t),_.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":247,"../components/errorbars":253,"../constants/xmlns_namespaces":305,"../lib":314,"../lib/events":310,"../lib/queue":322,"../lib/svg_text_utils":326,"../plotly":336,"../plots/cartesian/graph_interact":348,"../plots/plots":372,"../plots/polar":375,"../registry":380,"./helpers":327,"./subroutines":333,d3:8,"fast-isnumeric":12}],329:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],330:[function(t,e,n){"use strict";function r(t){var e=y.attributes,n=u({type:t}),r=f(t),i=d(t),a={},o={};a.type=null,M(a,e),a=s(n.attributes,a,"attributes",t),void 0!==i.attributes&&M(a,i.attributes),a.type=t,a=c(a),l(a),T.traces[t]=w({},r,{attributes:a}),void 0!==n.layoutAttributes&&(o=s(n.layoutAttributes,o,"layoutAttributes",t),l(o),T.traces[t].layoutAttributes=o)}function i(){var t=y.layoutAttributes,e={};e=s(t,e,"layoutAttributes","*"),e=h(e),e=p(e),e=c(e),l(e),m(e),T.layout={layoutAttributes:e}}function a(t){var e=v.transformsRegistry[t],n={};n=s(n,e.attributes||{},"attributes","*"),n=c(n),l(n),m(n),T.transforms[t]={attributes:n}}function o(){T.defs={valObjects:x.valObjects,metaKeys:x.UNDERSCORE_ATTRS.concat(["description","role"])}}function s(t,e,n,r){var i,a,o,l,c;return Object.keys(t).forEach(function(f){return f===A?void Object.keys(t[f]).forEach(function(l){i=u({_module:t[f][l]}),void 0!==i&&(a=i[n],o=s(a,{},n,r),x.nestedProperty(e,l).set(M({},o)))}):f===S?void Object.keys(t[f]).forEach(function(i){i===r&&(l=u({_module:t[f][i]}),void 0!==l&&(c=l[n],c=s(c,{},n,r),k(e,c)))}):void(e[f]=x.isPlainObject(t[f])?k({},t[f]):t[f])}),e}function l(t){function e(t){return{valType:"string"}}function n(t,n,r){z.isValObject(t)?"data_array"===t.valType?(t.role="data",r[n+"src"]=e(n)):t.arrayOk===!0&&(r[n+"src"]=e(n)):x.isPlainObject(t)&&(t.role="object")}x.crawl(t,n)}function u(t){if("type"in t)return"area"===t.type?{attributes:_}:v.getModule({type:t.type});var e=v.subplotsRegistry,n=v.componentsRegistry,r=t._module;return e[r]?e[r]:n[r]?n[r]:g[r]}function c(t){return Object.keys(t).forEach(function(e){"_"===e.charAt(0)&&x.UNDERSCORE_ATTRS.indexOf(e)===-1&&delete t[e]}),t}function f(t){return"area"===t?{}:v.modules[t].meta||{}}function h(t){return w(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),w(t,b.layout),t}function d(t){if("area"===t)return{};var e=v.subplotsRegistry,n=Object.keys(e).filter(function(e){return v.traceIs({type:t},e)})[0];return void 0===n?{}:e[n]}function p(t){var e=v.subplotsRegistry;return Object.keys(t).forEach(function(n){Object.keys(e).forEach(function(r){var i,a=e[r];a.attrRegex&&(i="cartesian"===r||"gl2d"===r?a.attrRegex.x.test(n)||a.attrRegex.y.test(n):a.attrRegex.test(n),i&&(t[n][x.IS_SUBPLOT_OBJ]=!0))})}),t}function m(t){function e(t,e,n){if(t[x.IS_LINKED_TO_ARRAY]===!0){var r=e.substr(0,e.length-1);delete t[x.IS_LINKED_TO_ARRAY],n[e]={items:{}},n[e].items[r]=t,n[e].role="object"}}x.crawl(t,e)}var g=t("../plotly"),v=t("../registry"),y=t("../plots/plots"),x=t("../lib"),_=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),w=x.extendFlat,M=x.extendDeep,k=x.extendDeepAll,A="_nestedModules",S="_composedModules",T={traces:{},layout:{},transforms:{},defs:{}},z=e.exports={};z.get=function(){return v.allTypes.concat("area").forEach(r),i(),Object.keys(v.transformsRegistry).forEach(a),o(),T},z.crawl=x.crawl,z.isValObject=x.isValObject},{"../lib":314,"../plotly":336,"../plots/plots":372,"../plots/polar/area_attributes":373,"../plots/polar/axis_attributes":374,"../registry":380}],331:[function(t,e,n){"use strict";function r(t){o.register(t,t.name,t.categories,t.meta),o.subplotsRegistry[t.basePlotModule.name]||o.registerSubplot(t.basePlotModule)}function i(t){if("string"!=typeof t.name)throw new Error("Transform module *name* must be a string.");var e="Transform module "+t.name,n="function"==typeof t.transform,r="function"==typeof t.calcTransform;if(!n&&!r)throw new Error(e+" is missing a *transform* or *calcTransform* method.");n&&r&&s.log([e+" has both a *transform* and *calcTransform* methods.","Please note that all *transform* methods are executed","before all *calcTransform* methods."].join(" ")),s.isPlainObject(t.attributes)||s.log(e+" registered without an *attributes* object."),"function"!=typeof t.supplyDefaults&&s.log(e+" registered without a *supplyDefaults* method."),o.transformsRegistry[t.name]=t}function a(t){o.componentsRegistry[t.name]=t}var o=t("../registry"),s=t("../lib");e.exports=function(t){if(!t)throw new Error("No argument passed to Plotly.register.");t&&!Array.isArray(t)&&(t=[t]);for(var e=0;e1)};h(e.width)&&h(e.height)||r(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.td;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var m=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(m).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=r},{"../lib":314,"../plotly":336,"../snapshot/cloneplot":381,"../snapshot/helpers":384,"../snapshot/svgtoimg":386,"../snapshot/tosvg":388,"fast-isnumeric":12}],335:[function(t,e,n){"use strict";function r(t,e,n,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,g=n.length,v=0;vu&&e=864e5?t._tickround="d":n>=36e5?t._tickround="H":n>=6e4?t._tickround="M":n>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(n/2)/Math.LN10);else{x(n)||(n=Number(n.substr(1))),t._tickround=2-Math.floor(Math.log(n)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var r=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(r)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((r-1)/3):t._tickexponent=r)}else"M"===n.charAt(0)?t._tickround=2===n.length?"m":"y":t._tickround=null}function o(t,e){var n=t.match(q),r=new Date(e);if(n){var i=Math.min(+n[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(q,a))(r)}return y.time.format(t)(r)}function s(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function l(t,e,n,r){var i,a=e.x,s=t._tickround,l=new Date(a),u="";n&&t.hoverformat?i=o(t.hoverformat,a):t.tickformat?i=o(t.tickformat,a):(r&&(x(s)?s+=2:s={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[s]),"y"===s?i=O(l):"m"===s?i=F(l):(a!==t._tmin||n||(u="
"+O(l)),"d"===s?i=R(l):"H"===s?i=j(l):(a!==t._tmin||n||(u="
"+R(l)+", "+O(l)),i=N(l),"M"!==s&&(i+=B(l),"S"!==s&&(i+=h(v(a/1e3,1),t,"none",n).substr(1)))))),e.text=i+u}function u(t,e,n,r,i){var a=t.dtick,o=e.x;if(!r||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,r);else if(x(a)||"D"===a.charAt(0)&&v(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,v(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,r)}function h(t,e,n,r){var i=t<0,o=e._tickround,s=n||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+m:"E"===s?t+="E"+m:"power"===s?t+="\xd710"+m+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=V[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var n,r,i=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},S.getAutoRange=function(t){var e,n=[],r=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(r===i){var p=r-1,m=r+1;n="tozero"===t.rangemode?r<0?[p,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,m)]:[p,m]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),n=[l.val-h*l.pad,u.val+h*u.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),d&&n.reverse(),n},S.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=S.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},S.saveRangeInitial=function(t,e){for(var n=S.list(t,"",!0),r=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(r(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,m,g=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),_=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),b=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),M=r(n.vpadminus||n.vpad);for(a=0;a<6;a++)i(a);for(a=g-1;a>5;a--)i(a)}},S.autoBin=function(t,e,n,r){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=b.aggNums(Math.min,null,t),o=b.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(n)s=(o-a)/n;else{var l=b.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*b.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*b.stdev(t)/Math.pow(t.length,r?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[a,o]};S.autoTicks(f,s);var h,d=S.tickIncrement(S.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,m=0,g=0,v=0,y=0;y.3*_||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),a(t),t._tmin=S.tickFirst(t);var i=t.range[1]=s:l<=s)&&(o.push(l),!(o.length>1e3));l=S.tickIncrement(l,t.dtick,i));t._tmax=o[o.length-1];for(var u=new Array(o.length),c=0;c157788e5?(e/=315576e5,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,n,E)):e>12096e5?(e/=26298e5,t.dtick="M"+i(e,1,L)):e>432e5?(t.dtick=i(e,864e5,D),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=i(e,36e5,L):e>3e4?t.dtick=i(e,6e4,I):e>500?t.dtick=i(e,1e3,I):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,E));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var r=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/r,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,n,E)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,E));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var a=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(a)}},S.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var i=e.charAt(0),a=r*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?C:P,l=t+.01*r,u=b.roundUp(v(l,1),s,n);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},S.tickFirst=function(t){var e=t.range[1]r:u1&&e2*r}function a(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,i=0,a=0;a2*r}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("./clean_datum");e.exports=function(t){return i(t)?"date":a(t)?"category":r(t)?"linear":"-"}},{"../../lib":314,"./clean_datum":345,"fast-isnumeric":12}],342:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var s=o(e,n,r);if(s){if("histogram"===s.type&&r==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,r)){for(var l,c=i(s),f=[],h=0;h0;a&&(r="array");var o=n("categoryorder",r);"array"===o&&n("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],345:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return i.ms2DateTime(t);if("string"!=typeof t&&!r(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){i.error(e,t)}return t}},{"../../lib":314,"fast-isnumeric":12}],346:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],347:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],i=Math.abs(r-t.range[1-e]);return"date"===t.type?f.ms2DateTime(r,i):"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(n)+"g")(r))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),m=t("../../lib/setcursor"),g=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),_=!0;e.exports=function(t,e,n,s,b,w,M,k){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+vt+")").attr("d",ct+"Z"),pt=mt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+vt+")").attr("d","M0,0Z"),E();for(var a=0;a<$.length;a++)S($[a].range)}function E(){mt.selectAll(".select-outline").remove()}function L(e,n){if(t._transitioningWithDuration)return!1;var r=Math.max(0,Math.min(H,e+ot)),i=Math.max(0,Math.min(Z,n+st)),a=Math.abs(r-ot),o=Math.abs(i-st),s=Math.floor(Math.min(o,a,X)/2);lt.l=Math.min(ot,r),lt.r=Math.max(ot,r),lt.t=Math.min(st,i),lt.b=Math.max(st,i),!tt||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),pt.transition().style("opacity",1).duration(200),ft=!0)}function I(t,e,n){var r,i,a;for(r=0;rzoom back out","long"),_=!1)))}function P(e,n){var i=1===(M+k).length;if(e)j();else if(2!==n||i){if(1===n&&i){var a=M?U[0]:V[0],o="s"===M||"w"===k?0:1,s=a._name+".range["+o+"]",l=r(a,o),c="left",f="middle";if(a.fixedrange)return;M?(f="n"===M?"top":"bottom","right"===a.side&&(c="right")):"e"===k&&(c="right"),rt.call(h.makeEditable,null,{immediate:!0,background:B.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var n="category"===a.type?a.c2l(e):a.d2l(e);void 0!==n&&u.relayout(t,s,n)})}}else R()}function C(e){function n(t,e,n){if(!t.fixedrange){S(t.range);var r=t.range,i=r[0]+(r[1]-r[0])*e;t.range=[i+(r[0]-i)*n,i+(r[1]-i)*n]}}if(t._context.scrollZoom||B._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(T(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(xt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void f.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=yt[0]+yt[2]*l,c=(s.bottom-e.clientY)/s.height,h=yt[1]+yt[3]*(1-c);if(k){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,n){for(var r=1-e,a=0,o=0;o0;r--)n.push(e);return n}function i(t,e){for(var n=[],r=0;rY.width||X<0||X>Y.height)return b.unhoverRaw(t,e)}else G="xpx"in e?e.xpx:k[0]._length/2,X="ypx"in e?e.ypx:A[0]._length/2;if(I="xval"in e?r(a,e.xval):i(k,G),D="yval"in e?r(a,e.yval):i(A,X),!m(I[0])||!m(D[0]))return g.warn("Fx.hover failed",e,t),b.unhoverRaw(t,e)}var W=1/0;for(C=0;C1||F.hoverinfo.indexOf("name")!==-1?F.name:void 0,index:!1,distance:Math.min(W,M.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[R]&&(V.subplot=o[R]._subplot),U=H.length,"array"===N){var Q=e[C];"pointNumber"in Q?(V.index=Q.pointNumber,N="closest"):(N="","xval"in Q&&(B=Q.xval,N="x"),"yval"in Q&&(q=Q.yval,N=N?"closest":"y"))}else B=I[j],q=D[j];if(F._module&&F._module.hoverPoints){var J=F._module.hoverPoints(V,B,q,N);if(J)for(var $,K=0;KU&&(H.splice(0,U),W=H[0].distance)}if(0===H.length)return b.unhoverRaw(t,e);var tt="y"===L&&Z.length>1;H.sort(function(t,e){return t.distance-e.distance});var et=x.combine(o.plot_bgcolor||x.background,o.paper_bgcolor),nt={hovermode:L,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},rt=u(H,nt);c(H,tt?"xa":"ya"),f(rt,tt);var it=t._hoverdata,at=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,n=c.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[i+"Label"]===m?r=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",u).call(_.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(_.setPosition,0,0);var h=e.select("text.name"),g=0;n&&n!==r?(h.style("fill",l).text(n).call(_.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(_.setPosition,0,0),g=h.node().getBoundingClientRect().width+2*D):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var v,M,T=f.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,E=t.ya._offset+(t.y0+t.y1)/2,L=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),C=T.width+I+D+g;t.ty0=b-T.top,t.bx=T.width+2*D,t.by=T.height+2*D,t.anchor="start",t.txwidth=T.width,t.tx2width=g,t.offset=0,a?(t.pos=z,v=E+P/2+C<=k,M=E-P/2-C>=0,"top"!==t.idealAlign&&v||!M?v?(E+=P/2,t.anchor="start"):t.anchor="middle":(E-=P/2,t.anchor="end")):(t.pos=E,v=z+L/2+C<=w,M=z-L/2-C>=0,"left"!==t.idealAlign&&v||!M?v?(z+=L/2,t.anchor="start"):t.anchor="middle":(z-=L/2,t.anchor="end")),f.attr("text-anchor",t.anchor),g&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+E+")"+(a?"rotate("+S+")":""))}),E}function c(t,e){function n(t){var e=t[0],n=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,a=n.pos+n.dp+n.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;r=!1}if(!(a<.01)){if(i<-.01){for(s=t.length-1;s>=0;s--)t[s].dp-=a;r=!1}if(r){var u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var r,i,a,o,s,l,u,c=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?z:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&c<=t.length;){for(c++,r=!0,o=0;o.01&&p.pmin===m.pmin&&p.pmax===m.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;r=!1}else o++}f.forEach(n)}for(o=f.length-1;o>=0;o--){var g=f[o];for(s=g.length-1;s>=0;s--){var v=g[s],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var n=d.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,i=n.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(I+D),s=o+a*(t.txwidth+D),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-L,l=t.offset*E),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*I+l)+","+(I+u)+"v"+(t.by/2-I)+"h"+r*t.bx+"v-"+t.by+"H"+(r*I+l)+"V"+(u-I)+"Z"),i.call(_.setPosition,o+l,u+t.ty0-t.by/2+D).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(_.setPosition,s+a*D+l,u+t.ty0-t.by/2+D),n.select("rect").call(_.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var i=n[r],a=t._hoverdata[r];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),m=t("fast-isnumeric"),g=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),_=t("../../components/drawing"),b=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),k=t("./dragbox"),A=e.exports={};A.unhover=b.unhover,A.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},A.supplyLayoutDefaults=function(t,e,n){function r(n,r){return g.coerce(t,e,A.layoutAttributes,n,r)}r("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=A.isHoriz(n);i=a?"y":"x"}else i="closest";r("hovermode",i)},A.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+M.HOVERMINTIME?(o(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},A.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||a(e,n):"x"===t?e:n},A.getClosest=function(t,e,n){if(n.index!==!1)n.index>=0&&n.indexf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":314,"fast-isnumeric":12}],354:[function(t,e,n){"use strict";function r(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,n,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function d(t,e){return t-e}var p,m=i.gd._fullLayout._zoomlayer,g=i.element.getBoundingClientRect(),v=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,x=e-g.left,_=n-g.top,b=x,w=_,M="M"+x+","+_,k=i.xaxes[0]._length,A=i.yaxes[0]._length,S=i.xaxes.map(r),T=i.yaxes.map(r),z=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[x,_]],s.BENDPX));var E=m.selectAll("path.select-outline").data([1,2]);E.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",M+"Z");var L,I,D,P,C,O=m.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),F=[],R=i.gd,j=[];for(L=0;L0)return Math.log(e)/Math.LN10;if(e<=0&&n&&t.range&&2===t.range.length){var r=t.range[0],i=t.range[1];return.5*(r+i-3*c*Math.abs(r-i))}return o.BADNUM}function n(t){return Math.pow(10,t)}function u(t){return i(t)?Number(t):o.BADNUM}var c=10;if(t.c2l="log"===t.type?e:u,t.l2c="log"===t.type?n:u,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(e){var n,r=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var o=l.getFromId(t._gd,t.overlaying);t.domain=o.domain}var s=e&&t._r?t._r:t.range;for(s&&2===s.length&&s[0]!==s[1]||(s=[-1,1]),n=0;n<2;n++)i(s[n])||(s[n]=i(s[1-n])?s[1-n]*(n?10:.1):n?1:-1),s[n]<-(Number.MAX_VALUE/2)?s[n]=-(Number.MAX_VALUE/2):s[n]>Number.MAX_VALUE/2&&(s[n]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s[0]-s[1]),t._b=-t._m*s[1]):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s[1]-s[0]),t._b=-t._m*s[0]),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?r.round(t._b+t._m*e,2):o.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},["linear","log","-"].indexOf(t.type)!==-1)t.c2d=u,t.d2c=function(t){return t=s(t),i(t)?Number(t):o.BADNUM},t.d2l=function(e,n){return"log"===t.type?t.c2l(t.d2c(e),n):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return i(t)?a.ms2DateTime(t):o.BADNUM},t.d2c=function(t){return i(t)?Number(t):a.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var f=t.range.map(a.dateTime2ms);!i(t.range[0])&&i(f[0])&&(t.range[0]=f[0]),!i(t.range[1])&&i(f[1])&&(t.range[1]=f[1])}catch(e){a.error(e,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var n=t._categories.indexOf(e);return n===-1?o.BADNUM:n},t.d2l=t.d2c);t.makeCalcdata=function(e,n){var r,i,a;if(n in e)for(r=e[n],i=new Array(r.length),a=0;an.duration?(m(),S=window.cancelAnimationFrame(v)):S=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],_=c(e),b=Object.keys(_),w=f(y,b,_);if(!w.length)return!1;var M;u&&(M=u());var k,A,S,T=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(S),S=null,g()}),k=Date.now(),S=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":314,"../../plotly":336,"../../registry":380,"./axes":340,d3:8}],360:[function(t,e,n){"use strict";function r(t,e,n){var r,i,a,o=!1;if("data"===e.type)r=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;r=t._fullLayout}return i=u.nestedProperty(r,e.prop).get(),a=n[e.type]=n[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var n=[],r=e[0],i={};if("string"==typeof r)i[r]=e[1];else{if(!u.isPlainObject(r))return n;i=r}return s(i,function(t,e,r){n.push({type:"layout",prop:t,value:r})},"",0),n}function o(t,e){var n,r,i,a,o=[];if(r=e[0],i=e[1],n=e[2],a={},"string"==typeof r)a[r]=i;else{if(!u.isPlainObject(r))return o;a=r,void 0===n&&(n=i)}return void 0===n&&(n=null),s(a,function(e,r,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);n&&(s=Math.min(s,n.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,r+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");n.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=n.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){r(t,l,o.cache),o.check=function(){if(s){var e=r(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f0}function a(t){var e={},n={};switch(t.type){case"circle":s.extendFlat(n,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":s.extendFlat(n,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":s.extendFlat(n,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var r=t.symbol,i=l(r.textposition,r.iconsize);s.extendFlat(e,{"icon-image":r.icon+"-15","icon-size":r.iconsize/10,"text-field":r.text,"text-size":r.textfont.size,"text-anchor":i.anchor,"text-offset":i.offset}),s.extendFlat(n,{"icon-color":t.color,"text-color":r.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:n}}function o(t){var e,n=t.sourcetype,r=t.source,i={type:n},a="string"==typeof r;return"geojson"===n?e="data":"vector"===n&&(e=a?"url":"tiles"),i[e]=r,i}var s=t("../../lib"),l=t("./convert_text_opts"),u=r.prototype;u.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)&&this.updateLayer(t):(this.updateSource(t),this.updateLayer(t)),this.updateStyle(t),this.visible=i(t)},u.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},u.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},u.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,i(t)){var n=o(t);e.addSource(this.idSource,n)}},u.updateLayer=function(t){var e=this.map;if(e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,i(t)){e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type},t.below);var n={visibility:"visible"};this.mapbox.setOptions(this.idLayer,"setLayoutProperty",n)}},u.updateStyle=function(t){var e=a(t);i(t)&&(this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint))},u.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)},e.exports=function(t,e,n){var i=new r(t,e);return i.update(n),i}},{"../../lib":314,"./convert_text_opts":365}],368:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("../../components/color").defaultLine,a=t("../font_attributes"),o=t("../../traces/scatter/attributes").textposition;e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},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:!0,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:r.extendDeep({},a,{family:{dflt:"Open Sans Regular, Arial Unicode MS Regular"}}),textposition:r.extendFlat({},o,{arrayOk:!1})}}}},{"../../components/color":223,"../../lib":314,"../../traces/scatter/attributes":391,"../font_attributes":361}],369:[function(t,e,n){"use strict";function r(t,e,n){n("accesstoken"),n("style"),n("center.lon"),n("center.lat"),n("zoom"),n("bearing"),n("pitch"),i(t,e),e._input=t}function i(t,e){function n(t,e){return a.coerce(r,i,s.layers,t,e)}for(var r,i,o=t.layers||[],l=e.layers=[],u=0;u=e.width-20?(a["text-anchor"]="start",a.x=5):(a["text-anchor"]="end",a.x=e._paper.attr("width")-7),n.attr(a);var o=n.select(".js-link-to-tool"),s=n.select(".js-link-spacer"),u=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=l.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=r.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(n._initialAutoSizeIsDone){var u=n.width,f=n.height;p.supplyLayoutGlobalDefaults(a,r),a.width||(r.width=u),a.height||(r.height=f)}else{p.supplyLayoutGlobalDefaults(a,r);var h=!a.width||!a.height,d=r.autosize,m=t._context&&t._context.autosizable,g=h&&(d||m);g?p.plotAutoSize(t,a,r):h&&p.sanitizeMargins(t),!d&&h&&(a.width=r.width,a.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=l.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,r),r._has=p._hasPlotType.bind(r);var v=r._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),f=c.left+c.right,d=c.bottom+c.top,m=1-2*o,g=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(m*(g.width-f)),i=Math.round(m*(g.height-d))}else{var v=l?window.getComputedStyle(t):{};r=parseFloat(v.width)||n.width,i=parseFloat(v.height)||n.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;r1,b=!e.height&&Math.abs(n.height-i)>1;(b||_)&&(_&&(n.width=r),b&&(n.height=i)),t._initialAutoSize||(t._initialAutoSize={width:r,height:i}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n){var r,i;c.Axes.supplyLayoutDefaults(t,e,n);var a=e._basePlotModules;for(r=0;r.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+i},r:{val:n.x,size:n.r+i},b:{val:n.y,size:n.b+i},t:{val:n.y,size:n.t+i}}}else delete r._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var n=l[t].l||{},r=l[t].b||{},c=n.val,f=n.size,h=r.val,d=r.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var n=l[t].r.val,r=l[t].r.size;if(n>c){var p=(f*n+(r-e.width)*c)/(n-c),m=(r*(1-c)+(f-e.width)*(1-n))/(n-c);p>=0&&m>=0&&p+m>i+a&&(i=p,a=m)}}if(u(d)&&l[t].t){var g=l[t].t.val,v=l[t].t.size;if(g>h){var y=(d*g+(v-e.height)*h)/(g-h),x=(v*(1-h)+(d-e.height)*(1-g))/(g-h);y>=0&&x>=0&&y+x>s+o&&(s=y,o=x)}}})})),n.l=Math.round(i),n.r=Math.round(a),n.t=Math.round(o),n.b=Math.round(s),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!t._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,n,r,i){function a(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,r,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):t&&t.getTime?h.ms2DateTime(t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var n=a(t);return e&&delete n.fit,n})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===r?l:JSON.stringify(l)},p.modifyFrames=function(t,e){var n,r,i,a=t._transitionData._frames,o=t._transitionData._frameHash;for(n=0;n0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){b=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(n)for(s=0;s=0,E=z?f.angularAxis.domain:r.extent(k),L=Math.abs(k[1]-k[0]);S&&!A&&(L=0);var I=E.slice();T&&A&&(I[1]+=L);var D=f.angularAxis.ticksCount||4;D>8&&(D=D/(D/8)+D%8),f.angularAxis.ticksStep&&(D=(I[1]-I[0])/D);var P=f.angularAxis.ticksStep||(I[1]-I[0])/(D*(f.minorTicks+1));M&&(P=Math.max(Math.round(P),1)),I[2]||(I[2]=P);var C=r.range.apply(this,I);if(C=C.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=r.scale.linear().domain(I.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=T?L:0,e=r.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var O="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",F=(new DOMParser).parseFromString(O,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(F.documentElement,!0));e=r.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var j,N=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},q={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){j=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var n=o.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:j,elements:V,reverseOrder:f.legend.reverseOrder})})();var U=j.node().getBBox();x=Math.min(f.width-U.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),b=[f.margin.left+x,f.margin.top+x],i.range([0,x]),c.layout.radialAxis.domain=i.domain(),j.attr("transform","translate("+[b[0]+x,b[1]-x]+")")}else j=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),N.attr("transform","translate("+b+")").style({cursor:"crosshair"});var H=[(f.width-(f.margin.left+f.margin.right+2*x+(U?U.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(H[0]=Math.max(0,H[0]),H[1]=Math.max(0,H[1]),e.select(".outer-group").attr("transform","translate("+H+")"),f.title){var Z=e.select("g.title-group text").style(q).text(f.title),G=Z.node().getBBox();Z.attr({x:b[0]-G.width/2,y:b[1]-x-20})}var X=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=X.selectAll("circle.grid-circle").data(i.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(B),Y.attr("r",i),Y.exit().remove()}X.select("circle.outside-circle").attr({r:x}).style(B);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=r.svg.axis().scale(i).ticks(5).tickSize(5);X.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),X.selectAll(".domain").style(B),X.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(q).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,q["font-size"]]+")":"translate("+[0,q["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var J=e.select(".angular.axis-group").selectAll("g.angular-tick").data(C),$=J.enter().append("g").classed("angular-tick",!0);J.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),J.exit().remove(),$.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),$.selectAll(".minor").style({stroke:f.minorTickColor}),J.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(q);var K=J.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=l(t,e),r=x+f.labelOffset,i=f.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-n+" "+r+" 0)":"radial"==i?n<270&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(n<=180&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":M?M[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(q);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=r.max(N.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(nt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),d[0]||et){var rt=[];d.forEach(function(t,e){var n={};n.radialScale=i,n.angularScale=s,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var it=r.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return a(o[n].defaultConfig(),t)});o[n]().config(r)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!A){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});N.on("mousemove.angular-guide",function(t,e){var n=o.util.getMousePos(W).angle;dt.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;ot=s.invert(r);var i=o.util.convertToCartesian(x+12,n+180);ct.text(o.util.round(ot)).move([i[0]+b[0],i[1]+b[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});N.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos(W).radius;pt.attr({r:n}).style({opacity:.5}),st=i.invert(o.util.getMousePos(W).radius);var r=o.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(o.util.round(st)).move([r[0]+b[0],r[1]+b[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var i=r.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=r.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};A&&(u.t=M[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-H[0]-h.left,f.top+f.height/2-H[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=r.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==r.event.which&&void(r.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.hide();var n=r.select(this),i=n.attr("data-fill");i?n.style({fill:i,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),h}var e,n,i,s,l={data:[],layout:{}},u={},c={},f=r.dispatch("hover"),h={};return h.render=function(e){return t(e),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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return i},h.angularScale=function(t){return s},h.svg=function(){return e},r.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:r.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},o.util._extend=function(t,e){for(var n in t)e[n]=t[n]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var n=e||6,i=r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,i=t(r);return[e,i]});return i},o.util.dataFromEquation=function(t,e,n){var i=e||6,a=[],o=[];r.range(0,360+i,i).forEach(function(e,n){var r=e*Math.PI/180,i=t(r);a.push(e),o.push(i)});var s={t:a,r:o};return n&&(s.name=n),s},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return r.range(e).map(function(t,e){return n[e]||n[0]})},o.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=o.util.ensureArray(t[e],n)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},o.util.sumArrays=function(t,e){return r.zip(t,e).map(function(t,e){return r.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return n===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),i=t*Math.sin(n);return[r,i]},o.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},o.util.getMousePos=function(t){var e=r.mouse(t.node()),n=e[0],i=e[1],a={};return a.x=n,a.y=i,a.pos=e,a.angle=180*(Math.atan2(i,n)+Math.PI)/Math.PI,a.radius=Math.sqrt(n*n+i*i),a},o.util.duplicatesCount=function(t){for(var e,n={},r={},i=0,a=t.length;i0)){var s=r.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:h(o),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return g.fill(n,i,a)},"fill-opacity":0,stroke:function(t,e){return g.stroke(n,i,a)},"stroke-width":function(t,e){return g["stroke-width"](n,i,a)},"stroke-dasharray":function(t,e){return g["stroke-dasharray"](n,i,a)},opacity:function(t,e){return g.opacity(n,i,a)},display:function(t,e){return g.display(n,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,m=r.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,i){r.select(this).attr({class:"mark arc",d:m,transform:function(e,n){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var g={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return s[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},v=r.select(this).selectAll("g.layer").data(l);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(g).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,n=[o.PolyChart.defaultConfig()],i=r.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),a(n[e],o.PolyChart.defaultConfig()),a(n[e],t)}),this):n},t.getColorScale=function(){return e},r.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var n=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var i=a({},n.elements[e]);return i.name=t,i.color=[].concat(n.elements[e].color)[r],i})}),o=r.merge(i);o=o.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(o=o.reverse());var s=n.container;("string"==typeof s||s.nodeName)&&(s=r.select(s));var l=o.map(function(t,e){return t.color}),u=n.fontSize,c=null==n.isContinuous?"number"==typeof o[0]:n.isContinuous,f=c?n.height:u*o.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.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"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var m=r.range(o.length),g=r.scale[c?"linear":"ordinal"]().domain(m).range(l),v=r.scale[c?"linear":"ordinal"]().domain(m)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":r.svg.symbolTypes.indexOf(t)!=-1?r.svg.symbol().type(t).size(n)():r.svg.symbol().type("square").size(n)()};if(c){var x=d.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}}),d.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var _=d.select(".legend-marks").selectAll("path.legend-mark").data(o);_.enter().append("path").classed("legend-mark",!0),_.attr({transform:function(t,e){return"translate("+[u/2,v(e)+u/2]+")"},d:function(t,e){var n=t.symbol;return y(n,u)},fill:function(t,e){return g(e)}}),_.exit().remove()}var b=r.svg.axis().scale(v).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?n.colorBandWidth:u,u/2]+")"}).call(b);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),n=r.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},r.rebind(t,n,"on"),t},o.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},o.tooltipPanel=function(){var t,e,n,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var r=t.enter().append("g").classed(s,!0).style({"pointer-events":"none",display:"none"});return n=r.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=r.append("text").attr({dx:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=r.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(f);var h=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},m=d.width+2*h+l,g=d.height+2*h;return n.attr({d:"M"+[[l,-g/2],[l,-g/4],[i.hasTick?0:l,0],[l,g/4],[l,g/2],[m,g/2],[m,-g/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-g/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=a({},t),i=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var r=i.indexOf(t.geometry);r!=-1&&(n.data[e].groupId=r)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};r.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}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),n.layout=s}return n},t}},{"../../lib":314,d3:8}],377:[function(t,e,n){"use strict";var r=t("d3"),i=t("../../lib"),a=t("../../components/color"),o=t("./micropolar"),s=t("./undo_manager"),l=i.extendDeepAll,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(f=i),r.select(r.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?l(n,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(n),a.config(c).render(f),t.data=n.data,t.layout=n.layout,u.fillLayout(t),n}var n,i,a,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(n);!function(e,n){h.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},u.fillLayout=function(t){var e=r.select(t).selectAll(".plot-container"),n=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:n,_paper:i};t._fullLayout=l(o,t.layout)}},{"../../components/color":223,"../../lib":314,"./micropolar":376,"./undo_manager":378,d3:8}],378:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,n=[],r=-1,i=!1;return{add:function(t){return i?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=n[r];return i?(t(i,"undo"),r-=1,e&&e(i.undo),this):this},redo:function(){var i=n[r+1];return i?(t(i,"redo"),r+=1,e&&e(i.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return r!==-1},hasRedo:function(){return r-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,a=t.data,u=t.layout,c=l([],a),f=l({},u,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(n=0;np&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var m={padded:!0},g={padded:!0};if(o.hasMarkers(e)){if(n=e.marker,l=n.size,Array.isArray(l)){var v={type:"linear"};i.setConvert(v),l=v.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},m.ppad=g.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(m.padded=!1,m.ppad=0):m.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(g.padded=!1):g.tozero=!0,i.expand(c,h,m),i.expand(f,d,g);var _=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===n.xaxis&&a.yaxis===n.yaxis){a.opacity=void 0;break}}}}}},{}],394:[function(t,e,n){"use strict";var r=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 n=e[0].trace,l=n.marker,u="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;r(f)||(f=i.aggNums(Math.min,null,c)),r(h)||(h=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":226,"../../components/colorscale":238,"../../lib":314,"../../plots/plots":372,"fast-isnumeric":12}],395:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),a=t("./subtypes");e.exports=function(t){a.hasLines(t)&&r(t,"line")&&i(t,t.line.color,"line","c"),a.hasMarkers(t)&&(r(t,"marker")&&i(t,t.marker.color,"marker","c"),r(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":230,"../../components/colorscale/has_colorscale":237,"./subtypes":411}],396:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],397:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function m(n,a){return r.coerce(t,e,i,n,a)}var g=s(t,e,m),v=gq!=P>=q&&(L=z[S-1][0],I=z[S][0],E=L+(I-L)*(q-D)/(P-D),R=Math.min(R,E),j=Math.max(j,E));R=Math.max(R,0),j=Math.min(j,h._length);var V=l.defaultLine;return l.opacity(f.fillcolor)?V=f.fillcolor:l.opacity((f.line||{}).color)&&(V=f.line.color),r.extendFlat(t,{distance:a.MAXDIST+10,x0:R,x1:j,y0:q,y1:q,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":223,"../../components/errorbars":253,"../../lib":314,"../../plots/cartesian/constants":346,"../../plots/cartesian/graph_interact":348,"./get_trace_color":399}],401:[function(t,e,n){"use strict";var r={},i=t("./subtypes");r.hasLines=i.hasLines,r.hasMarkers=i.hasMarkers,r.hasText=i.hasText,r.isBubble=i.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.animatable=!0,r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":349,"./arrays_to_calcdata":390,"./attributes":391,"./calc":392,"./clean_data":393,"./colorbar":394,"./defaults":397,"./hover":400,"./plot":408,"./select":409,"./style":410,"./subtypes":411}],402:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,n,a,o){var s=(t.marker||{}).color;if(o("line.color",n),r(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||n;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":233,"../../components/colorscale/has_colorscale":237}],403:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),r=M.c2p(t[e].y);return n!==E&&r!==E&&[n,r]}function i(t){var e=t[0]/w._length,n=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*S}function a(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var o,s,l,u,c,f,h,d,p,m,g,v,y,x,_,b,w=e.xaxis,M=e.yaxis,k=e.simplify,A=e.connectGaps,S=e.baseTolerance,T=e.linear,z=[],E=r.BADNUM,L=.2,I=new Array(t.length),D=0;for(k||(S=L=-1),o=0;oi(f))break;l=f,y=m[0]*p[0]+m[1]*p[1],y>g?(g=y,u=f,d=!1):y=t.length||!f)break;I[D++]=f,s=f}}else I[D++]=u}z.push(I.slice(0,D))}return z}},{"../../plots/cartesian/axes":340}],404:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],405:[function(t,e,n){"use strict";e.exports=function(t,e,n){for(var r,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":12}],407:[function(t,e,n){"use strict";var r=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,n,s,l){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(n=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",n),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?r.background:r.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":223,"../../components/colorscale/defaults":233,"../../components/colorscale/has_colorscale":237,"./subtypes":411}],408:[function(t,e,n){"use strict";function r(t,e){var n;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(n=t[0].trace,n._nexttrace){if(n._nextFill=e.select(".js-fill.js-tonext"),!n._nextFill.size()){var r=":first-child";e.select(".js-fill.js-tozero").size()&&(r+=" + *"),n._nextFill=e.insert("path",r).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),n._nextFill=null;n.fill&&("tozero"===n.fill.substr(0,6)||"toself"===n.fill||"to"===n.fill.substr(0,2)&&!n._prevtrace)?(n._ownFill=e.select(".js-fill.js-tozero"),n._ownFill.size()||(n._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),n._ownFill=null)})}function i(t,e,n,r,i,d,m){function g(t){return k?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function _(){return!1}function b(t){var e,n,r=t[0].trace,i=o.select(this),a=c.hasMarkers(r),u=c.hasText(r),f=x(r),h=_,d=_;a&&(h=r.marker.maxdisplayed?v:s.identity),u&&(d=r.marker.maxdisplayed?v:s.identity),n=i.selectAll("path.point"),e=n.data(h,f);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,r).call(l.translatePoints,A,S,r),k&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=g(o.select(this));l.translatePoint(t,e,A,S),l.singlePointStyle(t,e,r)}),k?e.exit().transition().style("opacity",0).remove():e.exit().remove(),n=i.selectAll("g"),e=n.data(d,f),e.enter().append("g").append("text"),e.each(function(t){var e=g(o.select(this).select("text"));l.translatePoint(t,e,A,S)}),e.selectAll("text").call(l.textPointStyle,r).each(function(t){var e=t.xp||A.c2p(t.x),n=t.yp||S.c2p(t.y);o.select(this).selectAll("tspan").each(function(){g(o.select(this)).attr({x:e,y:n})})}),e.exit().remove()}var w,M;a(t,e,n,r,i);var k=!!m&&m.duration>0,A=n.xaxis,S=n.yaxis,T=r[0].trace,z=T.line,E=o.select(d);if(E.call(u.plot,n,m),T.visible===!0){var L,I,D=T.fill.charAt(T.fill.length-1);"x"!==D&&"y"!==D&&(D=""),r[0].node3=E,f(r);var P="",C=[],O=T._prevtrace;O&&(P=O._prevRevpath||"",I=O._nextFill,C=O._polygons);var F,R,j,N,B,q,V,U,H,Z="",G="",X=[],Y=[],W=s.noop;if(L=T._ownFill,c.hasLines(T)||"none"!==T.fill){for(I&&I.datum(r),["hv","vh","hvh","vhv"].indexOf(z.shape)!==-1?(j=l.steps(z.shape),N=l.steps(z.shape.split("").reverse().join(""))):j=N="spline"===z.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),z.smoothing):l.smoothopen(t,z.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return N(t.reverse())},X=h(r,{xaxis:A,yaxis:S,connectGaps:T.connectgaps,baseTolerance:Math.max(z.width||1,3)/4,linear:"linear"===z.shape,simplify:z.simplify}),H=T._polygons=new Array(X.length),M=0;M1}),W=function(t){return function(e){if(F=j(e),R=B(e),Z?D?(Z+="L"+F.substr(1),G=R+("L"+G.substr(1))):(Z+="Z"+F,G=R+"Z"+G):(Z=F,G=R),c.hasLines(T)&&e.length>1){var n=o.select(this);if(n.datum(r),t)g(n.style("opacity",0).attr("d",F).call(l.lineGroupStyle)).style("opacity",1);else{var i=g(n);i.attr("d",F),l.singleLineStyle(r,i)}}}}}var Q=E.selectAll(".js-line").data(Y);g(Q.exit()).style("opacity",0).remove(),Q.each(W(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(W(!0)),X.length&&(L?q&&U&&(D?("y"===D?q[1]=U[1]=S.c2p(0,!0):"x"===D&&(q[0]=U[0]=A.c2p(0,!0)),g(L).attr("d","M"+U+"L"+q+"L"+Z.substr(1))):g(L).attr("d",Z+"Z")):"tonext"===T.fill.substr(0,6)&&Z&&P&&("tonext"===T.fill?g(I).attr("d",Z+"Z"+P+"Z"):g(I).attr("d",Z+"L"+P.substr(1)+"Z"),T._polygons=T._polygons.concat(C)),T._prevRevpath=G,T._prevPolygons=H);var J=E.selectAll(".points");w=J.data([r]),J.each(b),w.enter().append("g").classed("points",!0).each(b),w.exit().remove()}}function a(t,e,n,r,i){var a=n.xaxis,s=n.yaxis,l=o.extent(a.range.map(a.l2c)),u=o.extent(s.range.map(s.l2c)),f=r[0].trace;if(c.hasMarkers(f)){var h=f.marker.maxdisplayed;if(0!==h){var d=r.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/h),m=0;i.forEach(function(t,n){var r=t[0].trace;c.hasMarkers(r)&&r.marker.maxdisplayed>0&&n0;for(c=p.selectAll("g.trace"),f=c.data(n,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,n),r(t,p),l=0,u=[];lr?1:-1}),g){s&&(h=s());var v=o.transition().duration(a.duration).ease(a.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()});v.each(function(){p.selectAll("g.trace").each(function(r,o){i(t,o,e,r,n,this,a)})})}else p.selectAll("g.trace").each(function(r,o){i(t,o,e,r,n,this,a)});m&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":247,"../../components/errorbars":253,"../../lib":314,"../../lib/polygon":321,"./arrays_to_calcdata":390,"./line_points":403,"./link_traces":405,"./subtypes":411,d3:8}],409:[function(t,e,n){"use strict";var r=t("./subtypes"),i=.2;e.exports=function(t,e){var n,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,m=!r.hasMarkers(h)&&!r.hasText(h);if(h.visible===!0&&!m){var g=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;n0&&(v[y-1].gapAfter=!0)}return v}},{"../../components/colorscale":238,"../../lib":314,"../scatter/colorscale_calc":395,"../scatter/make_bubble_size_func":406,"../scatter/subtypes":411,"fast-isnumeric":12}],417:[function(t,e,n){"use strict";function r(){return{geojson:f.makeBlank(),layout:{visibility:"none"},paint:{}}}function i(t,e){function n(t,n,r,i){void 0===e[n][r]&&(e[n][r]=i),t[n]=e[n][r]}for(var r=t[0].trace,i=r.marker,a=Array.isArray(i.color),o=Array.isArray(i.size),s=[],l=0;l")}var i=t("../../plots/cartesian/graph_interact"),a=t("../scatter/get_trace_color");e.exports=function(t,e,n){function o(t){var e=t.lonlat,r=Math.abs(u.c2p(e)-u.c2p([d,e[1]])),i=Math.abs(c.c2p(e)-c.c2p([e[0],n])),a=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(r*r+i*i)-a,1-3/a)}var s=t.cd,l=s[0].trace,u=t.xa,c=t.ya;if(!s[0].placeholder){var f=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),h=360*f,d=e-h;if(i.getClosest(s,o,t),t.index!==!1){var p=s[t.index],m=p.lonlat,g=[m[0]+h,m[1]],v=u.c2p(g),y=c.c2p(g),x=p.mrc||1;return t.x0=v-x,t.x1=v+x,t.y0=y-x,t.y1=y+x,t.color=a(l,p),t.extraText=r(l,p),[t]}}}},{"../../plots/cartesian/graph_interact":348,"../scatter/get_trace_color":399}],421:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../scatter/colorbar"),r.calc=t("./calc"),r.hoverPoints=t("./hover"),r.eventData=t("./event_data"),r.plot=t("./plot"),r.moduleType="trace",r.name="scattermapbox",r.basePlotModule=t("../../plots/mapbox"),r.categories=["mapbox","gl","symbols","markerColorscale","showLegend"],r.meta={},e.exports=r},{"../../plots/mapbox":366,"../scatter/colorbar":394,"./attributes":415,"./calc":416,"./defaults":418,"./event_data":419,"./hover":420,"./plot":422}],422:[function(t,e,n){"use strict";function r(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.mapbox.initSource(this.idSourceFill),this.mapbox.initSource(this.idSourceLine),this.mapbox.initSource(this.idSourceCircle),this.mapbox.initSource(this.idSourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle,source:this.idSourceCircle,type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var a=t("./convert"),o=r.prototype;o.update=function(t){var e=this.mapbox,n=a(t);e.setOptions(this.idLayerFill,"setLayoutProperty",n.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",n.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",n.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",n.symbol.layout),i(n.fill)&&(e.setSourceData(this.idSourceFill,n.fill.geojson),e.setOptions(this.idLayerFill,"setPaintProperty",n.fill.paint)),i(n.line)&&(e.setSourceData(this.idSourceLine,n.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",n.line.paint)),i(n.circle)&&(e.setSourceData(this.idSourceCircle,n.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",n.circle.paint)),i(n.symbol)&&(e.setSourceData(this.idSourceSymbol,n.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",n.symbol.paint))},o.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var n=e[0].trace,i=new r(t,n.uid);return i.update(e),i}},{"./convert":417}]},{},[4])(4)}); \ No newline at end of file +if(n=r[e.pos++],t+=4398046511104*(127&n),n<128)return t;if(n=r[e.pos++],t+=562949953421312*(127&n),n<128)return t;if(n=r[e.pos++],t+=72057594037927940*(127&n),n<128)return t;if(n=r[e.pos++],t+=0x8000000000000000*(127&n),n<128)return t;throw new Error("Expected varint not more than 10 bytes")}function a(t,e){e.realloc(10);for(var n=e.pos+10;t>=1;){if(e.pos>=n)throw new Error("Given varint doesn't fit into 10 bytes");var r=255&t;e.buf[e.pos++]=r|(t>=128?128:0),t/=128}}function o(t,e,n){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=t;i--)n.buf[i+r]=n.buf[i]}function s(t,e){for(var n=0;n>3,a=this.pos;t(i,e,this),this.pos===a&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*v;return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*v;return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,e,n=this.buf;return e=n[this.pos++],t=127&e,e<128?t:(e=n[this.pos++],t|=(127&e)<<7,e<128?t:(e=n[this.pos++],t|=(127&e)<<14,e<128?t:(e=n[this.pos++],t|=(127&e)<<21,e<128?t:i(t,this))))},readVarint64:function(){var t=this.pos,e=this.readVarint();if(e127;);else if(e===r.Bytes)this.pos=this.readVarint()+this.pos;else if(e===r.Fixed32)this.pos+=4;else{if(e!==r.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455?void a(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(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);var e=g.byteLength(t);this.writeVarint(e),this.realloc(e),this.buf.write(t,this.pos),this.pos+=e},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;n=128&&o(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,n){this.writeTag(t,r.Bytes),this.writeRawMessage(e,n)},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,u,e)},writePackedDouble:function(t,e){this.writeMessage(t,c,e)},writePackedFixed32:function(t,e){this.writeMessage(t,h,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,d,e)},writePackedFixed64:function(t,e){this.writeMessage(t,p,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,m,e)},writeBytesField:function(t,e){this.writeTag(t,r.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,r.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,r.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,r.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,r.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,r.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,r.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,r.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,r.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,r.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":185}],187:[function(t,e,n){"use strict";function r(t,e){this.x=t,this.y=e}e.exports=r,r.prototype={clone:function(){return new r(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,n=t.y-this.y;return e*e+n*n},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,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),r=e*this.x-n*this.y,i=n*this.x+e*this.y;return this.x=r,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t}},{}],188:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(t){if(f===setTimeout)return setTimeout(t,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function o(t){if(h===clearTimeout)return clearTimeout(t);if((h===i||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function s(){g&&p&&(g=!1,p.length?m=p.concat(m):v=-1,m.length&&l())}function l(){if(!g){var t=a(s);g=!0;for(var e=m.length;e;){for(p=m,m=[];++v1)for(var n=1;n1&&(r=n[0]+"@",t=n[1]),t=t.replace(P,".");var i=t.split("."),a=o(i,e).join(".");return r+a}function l(t){for(var e,n,r=[],i=0,a=t.length;i=55296&&e<=56319&&i65535&&(t-=65536,e+=R(t>>>10&1023|55296),t=56320|1023&t),e+=R(t)}).join("")}function c(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:M}function f(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function h(t,e,n){var r=0;for(t=n?F(t/T):t>>1,t+=F(t/e);t>O*A>>1;r+=M)t=F(t/O);return F(r+(O+1)*t/(t+S))}function d(t){var e,n,r,i,o,s,l,f,d,p,m=[],g=t.length,v=0,y=E,x=z;for(n=t.lastIndexOf(L),n<0&&(n=0),r=0;r=128&&a("not-basic"),m.push(t.charCodeAt(r));for(i=n>0?n+1:0;i=g&&a("invalid-input"),f=c(t.charCodeAt(i++)),(f>=M||f>F((w-v)/s))&&a("overflow"),v+=f*s,d=l<=x?k:l>=x+A?A:l-x,!(fF(w/p)&&a("overflow"),s*=p;e=m.length+1,x=h(v-o,e,0==o),F(v/e)>w-y&&a("overflow"),y+=F(v/e),v%=e,m.splice(v++,0,y)}return u(m)}function p(t){var e,n,r,i,o,s,u,c,d,p,m,g,v,y,x,_=[];for(t=l(t),g=t.length,e=E,n=0,o=z,s=0;s=e&&mF((w-n)/v)&&a("overflow"),n+=(u-e)*v,e=u,s=0;sw&&a("overflow"),m==e){for(c=n,d=M;p=d<=o?k:d>=o+A?A:d-o,!(c= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=M-k,F=Math.floor,R=String.fromCharCode;if(_={version:"1.4.1",ucs2:{decode:l,encode:u},decode:d,encode:p,toASCII:g,toUnicode:m},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return _});else if(v&&y)if(n.exports==v)y.exports=_;else for(b in _)_.hasOwnProperty(b)&&(v[b]=_[b]);else i.punycode=_}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],190:[function(t,e,n){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,n,a){e=e||"&",n=n||"=";var o={};if("string"!=typeof t||0===t.length)return o;var s=/\+/g;t=t.split(e);var l=1e3;a&&"number"==typeof a.maxKeys&&(l=a.maxKeys);var u=t.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(f=m.substr(0,g),h=m.substr(g+1)):(f=m,h=""),d=decodeURIComponent(f),p=decodeURIComponent(h),r(o,d)?i(o[d])?o[d].push(p):o[d]=[o[d],p]:o[d]=p}return o};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],191:[function(t,e,n){"use strict";function r(t,e){if(t.map)return t.map(e);for(var n=[],r=0;rn;){if(o-n>600){var l=o-n+1,u=e-n+1,c=Math.log(l),f=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*f*(l-f)/l)*(u-l/2<0?-1:1),d=Math.max(n,Math.floor(e-u*f/l+h)),p=Math.min(o,Math.floor(e+(l-u)*f/l+h));r(t,e,d,p,s)}var m=t[e],g=n,v=o;for(i(t,n,e),s(t[o],m)>0&&i(t,n,o);g0;)v--}0===s(t[n],m)?i(t,n,v):(v++,i(t,v,o)),v<=e&&(n=v+1),e<=v&&(o=v-1)}}function i(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function a(t,e){return te?1:0}e.exports=r},{}],194:[function(e,n,r){void function(e,i){"function"==typeof t&&t.amd?t(i):"object"==typeof r?n.exports=i():e.resolveUrl=i()}(this,function(){function t(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var n=document.getElementsByTagName("head")[0];n.insertBefore(e,n.firstChild);for(var r,i=document.createElement("a"),a=1;a0){for(var s=0,l=0,u=0;ur.h||t>r.free||nc)&&(f=2*Math.max(t,c)),(ll)&&(u=2*Math.max(n,l)),this.resize(f,u),this.packOne(t,n)}return null},t.prototype.clear=function(){this.shelves=[],this.stats={}},t.prototype.resize=function(t,e){this.w=t,this.h=e;for(var n=0;nthis.free||e>this.h)return null;var n=this.x;return this.x+=t,this.free-=t,{x:n,y:this.y,w:t,h:e,width:t,height:e}},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t})},{}],196:[function(t,e,n){"use strict";function r(t){return new i(t)}function i(t){this.options=d(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function a(t,e,n,r){return{x:t,y:e,zoom:1/0,id:r,numPoints:n}}function o(t,e){var n=t.geometry.coordinates;return a(u(n[0]),c(n[1]),1,e)}function s(t){return{type:"Feature",properties:l(t),geometry:{type:"Point",coordinates:[f(t.x),h(t.y)]}}}function l(t){var e=t.numPoints,n=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:n}}function u(t){return t/360+.5}function c(t){var e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function f(t){return 360*(t-.5)}function h(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function d(t,e){for(var n in e)t[n]=e[n];return t}function p(t){return t.x}function m(t){return t.y}var g=t("kdbush");e.exports=r,i.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var n="prepare "+t.length+" points";e&&console.time(n),this.points=t;var r=t.map(o);e&&console.timeEnd(n);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var a=+Date.now();this.trees[i+1]=g(r,p,m,this.options.nodeSize,Float32Array),r=this._cluster(r,i),e&&console.log("z%d: %d clusters in %dms",i,r.length,+Date.now()-a)}return this.trees[this.options.minZoom]=g(r,p,m,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var n=this.trees[this._limitZoom(e)],r=n.range(u(t[0]),c(t[3]),u(t[2]),c(t[1])),i=[],a=0;a.5?l/(2-a-o):l/(a+o),a){case t:r=(e-n)/l+(e1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var i,a,o;if(t=z(t,360),e=z(e,100),n=z(n,100),0===e)i=a=o=n;else{var s=n<.5?n*(1+e):n+e-n*e,l=2*n-s;i=r(l,s,t+1/3),a=r(l,s,t),o=r(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,n){t=z(t,255),e=z(e,255),n=z(n,255);var r,i,a=H(t,e,n),o=G(t,e,n),s=a,l=a-o;if(i=0===a?0:l/a,a==o)r=0;else{switch(a){case t:r=(e-n)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(r(i));return o}function A(t,e){e=e||6;for(var n=r(t).toHsv(),i=n.h,a=n.s,o=n.v,s=[],l=1/e;e--;)s.push(r({h:i,s:a,v:o})),o=(o+l)%1;return s}function S(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function T(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function z(t,n){I(t)&&(t="100%");var r=D(t);return t=G(n,H(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function E(t){return G(1,H(0,t))}function L(t){return parseInt(t,16)}function I(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function D(t){return"string"==typeof t&&t.indexOf("%")!=-1}function P(t){return 1==t.length?"0"+t:""+t}function C(t){return t<=1&&(t=100*t+"%"),t}function O(t){return e.round(255*parseFloat(t)).toString(16)}function F(t){return L(t)/255}function R(t){return!!W.CSS_UNIT.exec(t)}function j(t){t=t.replace(B,"").replace(q,"").toLowerCase();var e=!1;if(X[t])t=X[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=W.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=W.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=W.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=W.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=W.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=W.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=W.hex8.exec(t))?{r:L(n[1]),g:L(n[2]),b:L(n[3]),a:F(n[4]),format:e?"name":"hex8"}:(n=W.hex6.exec(t))?{r:L(n[1]),g:L(n[2]),b:L(n[3]),format:e?"name":"hex"}:(n=W.hex4.exec(t))?{r:L(n[1]+""+n[1]),g:L(n[2]+""+n[2]),b:L(n[3]+""+n[3]),a:F(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=W.hex3.exec(t))&&{r:L(n[1]+""+n[1]),g:L(n[2]+""+n[2]),b:L(n[3]+""+n[3]),format:e?"name":"hex"}}function N(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var B=/^\s+/,q=/\s+$/,V=0,U=e.round,G=e.min,H=e.max,Z=e.random;r.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,i,a,o,s=this.toRgb();return t=s.r/255,n=s.g/255,r=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),o=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=T(t),this._roundA=U(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=U(360*t.h),n=U(100*t.s),r=U(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=U(360*t.h),n=U(100*t.s),r=U(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:U(this._r),g:U(this._g),b:U(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+U(this._r)+", "+U(this._g)+", "+U(this._b)+")":"rgba("+U(this._r)+", "+U(this._g)+", "+U(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:U(100*z(this._r,255))+"%",g:U(100*z(this._g,255))+"%",b:U(100*z(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+U(100*z(this._r,255))+"%, "+U(100*z(this._g,255))+"%, "+U(100*z(this._b,255))+"%)":"rgba("+U(100*z(this._r,255))+"%, "+U(100*z(this._g,255))+"%, "+U(100*z(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),n=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=r(t);n="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,i=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return r(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(g,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(k,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},r.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?n[i]=t[i]:n[i]=C(t[i]));t=n}return r(t,e)},r.equals=function(t,e){return!(!t||!e)&&r(t).toRgbString()==r(e).toRgbString()},r.random=function(){return r.fromRatio({r:Z(),g:Z(),b:Z()})},r.mix=function(t,e,n){n=0===n?0:n||50;var i=r(t).toRgb(),a=r(e).toRgb(),o=n/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return r(s)},r.readability=function(t,n){var i=r(t),a=r(n);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},r.isReadable=function(t,e,n){var i,a,o=r.readability(t,e);switch(a=!1,i=N(n),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5; +break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},r.mostReadable=function(t,e,n){var i,a,o,s,l=null,u=0;n=n||{},a=n.includeFallbackColors,o=n.level,s=n.size;for(var c=0;cu&&(u=i,l=r(e[c]));return r.isReadable(t,l,{level:o,size:s})||!a?l:(n.includeFallbackColors=!1,r.mostReadable(t,["#fff","#000"],n))};var X=r.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=r.hexNames=S(X),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof n&&n.exports?n.exports=r:"function"==typeof t&&t.amd?t(function(){return r}):window.tinycolor=r}(Math)},{}],198:[function(t,e,n){function r(t,e,n,r){this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=n,this.p2y=r}e.exports=r,r.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},r.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},r.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},r.prototype.solveCurveX=function(t,e){"undefined"==typeof e&&(e=1e-6);var n,r,i,a,o;for(i=t,o=0;o<8;o++){if(a=this.sampleCurveX(i)-t,Math.abs(a)r)return r;for(;na?n=i:r=i,i=.5*(r-n)+n}return i},r.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],199:[function(t,e,n){"use strict";function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function i(t,e,n){if(t&&u.isObject(t)&&t instanceof r)return t;var i=new r;return i.parse(t,e,n),i}function a(t){return u.isString(t)&&(t=i(t)),t instanceof r?t.format():r.prototype.format.call(t)}function o(t,e){return i(t,!1,!0).resolve(e)}function s(t,e){return t?i(t,!1,!0).resolveObject(e):e}var l=t("punycode"),u=t("./util");n.parse=i,n.resolve=o,n.resolveObject=s,n.format=a,n.Url=r;var c=/^([a-z0-9.+-]+:)/i,f=/:[0-9]*$/,h=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["<",">",'"',"`"," ","\r","\n","\t"],p=["{","}","|","\\","^","`"].concat(d),m=["'"].concat(p),g=["%","/","?",";","#"].concat(m),v=["/","?","#"],y=255,x=/^[+a-z0-9A-Z_-]{0,63}$/,_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,b={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},M={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},k=t("querystring");r.prototype.parse=function(t,e,n){if(!u.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),i=r!==-1&&r127?"x":C[F];if(!O.match(x)){var j=D.slice(0,T),N=D.slice(T+1),B=C.match(_);B&&(j.push(B[1]),N.unshift(B[2])),N.length&&(s="/"+N.join(".")+s),this.hostname=j.join(".");break}}}this.hostname.length>y?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=l.toASCII(this.hostname));var q=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+q,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!b[p])for(var T=0,P=m.length;T0)&&n.host.split("@");A&&(n.auth=A.shift(),n.host=n.hostname=A.shift())}return n.search=t.search,n.query=t.query,u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!b.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=b.slice(-1)[0],T=(n.host||t.host||b.length>1)&&("."===S||".."===S)||""===S,z=0,E=b.length;E>=0;E--)S=b[E],"."===S?b.splice(E,1):".."===S?(b.splice(E,1),z++):z&&(b.splice(E,1),z--);if(!x&&!_)for(;z--;z)b.unshift("..");!x||""===b[0]||b[0]&&"/"===b[0].charAt(0)||b.unshift(""),T&&"/"!==b.join("/").substr(-1)&&b.push("");var L=""===b[0]||b[0]&&"/"===b[0].charAt(0);if(k){n.hostname=n.host=L?"":b.length?b.shift():"";var A=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");A&&(n.auth=A.shift(),n.host=n.hostname=A.shift())}return x=x||n.host&&b.length,x&&!L&&b.unshift(""),b.length?n.pathname=b.join("/"):(n.pathname=null,n.path=null),u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var t=this.host,e=f.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":200,punycode:189,querystring:192}],200:[function(t,e,n){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],201:[function(t,e,n){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],202:[function(t,e,n){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],203:[function(t,e,n){(function(e,r){function i(t,e){var r={seen:[],stylize:o};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(e)?r.showHidden=e:e&&n._extend(r,e),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),l(r,t,r.depth)}function a(t,e){var n=i.styles[e];return n?"\x1b["+i.colors[n][0]+"m"+t+"\x1b["+i.colors[n][1]+"m":t}function o(t,e){return t}function s(t){var e={};return t.forEach(function(t,n){e[t]=!0}),e}function l(t,e,r){if(t.customInspect&&e&&S(e.inspect)&&e.inspect!==n.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(r,t);return x(i)||(i=l(t,i,r)),i}var a=u(t,e);if(a)return a;var o=Object.keys(e),m=s(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),A(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(e);if(0===o.length){if(S(e)){var g=e.name?": "+e.name:"";return t.stylize("[Function"+g+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(k(e))return t.stylize(Date.prototype.toString.call(e),"date");if(A(e))return c(e)}var v="",y=!1,_=["{","}"];if(p(e)&&(y=!0,_=["[","]"]),S(e)){var b=e.name?": "+e.name:"";v=" [Function"+b+"]"}if(w(e)&&(v=" "+RegExp.prototype.toString.call(e)),k(e)&&(v=" "+Date.prototype.toUTCString.call(e)),A(e)&&(v=" "+c(e)),0===o.length&&(!y||0==e.length))return _[0]+v+_[1];if(r<0)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=y?f(t,e,r,m,o):o.map(function(n){return h(t,e,r,m,n,y)}),t.seen.pop(),d(M,v,_)}function u(t,e){if(b(e))return t.stylize("undefined","undefined");if(x(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return y(e)?t.stylize(""+e,"number"):m(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,e,n,r,i){for(var a=[],o=0,s=e.length;o-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")),b(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.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 d(t,e,n){var r=0,i=t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}function p(t){return Array.isArray(t)}function m(t){return"boolean"==typeof t}function g(t){return null===t}function v(t){return null==t}function y(t){return"number"==typeof t}function x(t){return"string"==typeof t}function _(t){return"symbol"==typeof t}function b(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===z(t)}function M(t){return"object"==typeof t&&null!==t}function k(t){return M(t)&&"[object Date]"===z(t)}function A(t){return M(t)&&("[object Error]"===z(t)||t instanceof Error)}function S(t){return"function"==typeof t}function T(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function z(t){return Object.prototype.toString.call(t)}function E(t){return t<10?"0"+t.toString(10):t.toString(10)}function L(){var t=new Date,e=[E(t.getHours()),E(t.getMinutes()),E(t.getSeconds())].join(":");return[t.getDate(),O[t.getMonth()],e].join(" ")}function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var D=/%[sdj%]/g;n.format=function(t){if(!x(t)){for(var e=[],n=0;n=a)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}}),s=r[n];n>3}if(i--,1===r||2===r)a+=t.readSVarint(),o+=t.readSVarint(),1===r&&(e&&s.push(e),e=[]),e.push(new l(a,o));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&s.push(e),s},r.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,r=0,i=0,a=0,o=1/0,s=-(1/0),l=1/0,u=-(1/0);t.pos>3}if(r--,1===n||2===n)i+=t.readSVarint(),a+=t.readSVarint(),is&&(s=i),au&&(u=a);else if(7!==n)throw new Error("unknown command "+n)}return[o,l,s,u]},r.prototype.toGeoJSON=function(t,e,n){function i(t){for(var e=0;e>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}var o=t("./vectortilefeature.js");e.exports=r,r.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 o(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":206}],208:[function(t,e,n){function r(t){var e=[];for(var n in t.layers)e.push(a(t.layers[n]));var r=new c;return f.tile.write({layers:e},r),r.finish()}function i(t){var e={};for(var n in t)e[n]=new h(t[n].features),e[n].name=n;return r({layers:e})}function a(t){for(var e={name:t.name||"",version:t.version||1,extent:t.extent||4096,keys:[],values:[],features:[]},n={},r={},i=0;i>31}function l(t){for(var e=[],n=0,r=0,i=t.length,a=0;a2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}rt.selectAll("tspan.line").attr({y:0,x:0});var r=J.select(".annotation-math-group"),i=!r.empty(),s=d.bBox((i?r:rt).node()),u=s.width,p=s.height,v=Math.round(u+2*tt),y=Math.round(p+2*tt);G._w=u,G._h=p;var _=!1;if(["x","y"].forEach(function(e){var r,i=G[e+"ref"]||e,a=f.getFromId(t,i),o=(Y+("x"===e?0:90))*Math.PI/180,s=v*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=G[e+"anchor"];if(a){var u=a.r2fraction(G[e]);if(!a.autorange&&(u<0||u>1)&&(G["a"+e+"ref"]===i?(u=a.r2fraction(G["a"+e]),(u<0||u>1)&&(_=!0)):_=!0,_))return;X[e]=a._offset+a.r2p(G[e]),r=.5}else r=G[e],"y"===e&&(r=1-r),X[e]="x"===e?I.l+I.w*r:I.t+I.h*r;var c=0;G["a"+e+"ref"]===i?X["aa"+e]=a._offset+a.r2p(G["a"+e]):(c=G.showarrow?G["a"+e]:s*n(r,l),X[e]+=c),G["_"+e+"type"]=a&&a.type,G["_"+e+"size"]=s,G["_"+e+"shift"]=c}),_)return void J.remove();var b,w;G.showarrow&&(b=G.axref===G.xref?X.x:c.constrain(X.x-G.ax,1,k.width-1),w=G.ayref===G.yref?X.y:c.constrain(X.y-G.ay,1,k.height-1)),X.x=c.constrain(X.x,1,k.width-1),X.y=c.constrain(X.y,1,k.height-1);var M=tt-s.top,A=tt-s.left;i?r.select("svg").attr({x:tt-1,y:tt}):(rt.attr({x:A,y:M}),rt.selectAll("tspan.line").attr({y:M,x:A})),et.call(d.setRect,$/2,$/2,v-$,y-$);var S=0,T=0;S=G.axref===G.xref?Math.round(X.aax-v/2):Math.round(X.x-v/2),T=G.ayref===G.yref?Math.round(X.aay-y/2):Math.round(X.y-y/2),J.call(c.setTranslate,S,T);var z="annotations["+e+"]",E=function(n,r){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=G.axref===G.xref?X.aax+n:X.x+n,s=G.ayref===G.yref?X.aay+r:X.y+r;var u=c.rotationXYMatrix(Y,i,s),f=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,m=et.attr("height")/2,v=[[i-p,s-m,i-p,s+m],[i-p,s+m,i+p,s+m],[i+p,s+m,i+p,s-m],[i+p,s-m,i-p,s-m]].map(d);if(!v.reduce(function(t,e){return t^!!a(b,w,b+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=a(i,s,b,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=G.arrowwidth,_=G.arrowcolor,M=W.append("g").style({opacity:h.opacity(_)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=M.append("path").attr("d","M"+i+","+s+"L"+b+","+w).style("stroke-width",y+"px").call(h.stroke,h.rgb(_));x(k,G.arrowhead,"end",G.arrowsize);var A=M.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-b)+","+(s-w),transform:"translate("+b+","+w+")"}).style("stroke-width",y+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var S,T,E;g.init({element:A.node(),prepFn:function(){var t=c.getTranslate(J);T=t.x,E=t.y,S={},H&&H.autorange&&(S[H._name+".autorange"]=!0),Z&&Z.autorange&&(S[Z._name+".autorange"]=!0)},moveFn:function(t,e){M.attr("transform","translate("+t+","+e+")");var n=f(T,E),r=n[0]+t,i=n[1]+e;J.call(c.setTranslate,r,i),S[z+".x"]=H?H.p2r(H.r2p(G.x)+t):(b+t-I.l)/I.w,S[z+".y"]=Z?Z.p2r(Z.r2p(G.y)+e):1-(w+e-I.t)/I.h,G.axref===G.xref&&(S[z+".ax"]=H?H.p2r(H.r2p(G.ax)+t):(b+t-I.l)/I.w),G.ayref===G.yref&&(S[z+".ay"]=Z?Z.p2r(Z.r2p(G.ay)+e):1-(w+e-I.t)/I.h),Q.attr({transform:"rotate("+Y+","+r+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,S);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};G.showarrow&&E(0,0);var L=c.rotationXYMatrix(Y,X.x,X.y),D=c.apply2DTransform(L);if(t._context.editable){var P,C,O;g.init({element:J.node(),prepFn:function(){var t=c.getTranslate(J);P=t.x,C=t.y,O={}},moveFn:function(t,e){J.call(c.setTranslate,P+t,C+e);var n="pointer";if(G.showarrow)G.axref===G.xref?O[z+".ax"]=H.p2r(H.r2p(G.ax)+t):O[z+".ax"]=G.ax+t,G.ayref===G.yref?O[z+".ay"]=Z.p2r(Z.r2p(G.ay)+e):O[z+".ay"]=G.ay+e,E(t,e);else{if(H)O[z+".x"]=G.x+t/H._m;else{var r=G._xsize/I.w,i=G.x+G._xshift/I.w-r/2;O[z+".x"]=g.align(i+t/I.w,r,0,1,G.xanchor)}if(Z)O[z+".y"]=G.y+e/Z._m;else{var a=G._ysize/I.h,o=G.y-G._yshift/I.h-a/2;O[z+".y"]=g.align(o-e/I.h,a,0,1,G.yanchor)}H&&Z||(n=g.getCursor(H?.5:O[z+".x"],Z?.5:O[z+".y"],G.xanchor,G.yanchor))}var s=D(P,C),l=s[0]+t,u=s[1]+e;J.call(c.setTranslate,P+t,C+e),Q.attr({transform:"rotate("+Y+","+l+","+u+")"}),m(J,n)},doneFn:function(e){if(m(J),e){l.relayout(t,O);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var w,M=t.layout,k=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return M.annotations=u,y(M,k),void r(t);if("remove"===u)return delete M.annotations,k.annotations=[],void r(t);if(n&&"add"!==u){for(w=0;we;w--)k._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}k._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var S=M.annotations[e],T=k.annotations[e];if(S){var z={};"string"==typeof n&&n?z[n]=u:c.isPlainObject(n)&&(z=n);var E=Object.keys(z);for(w=0;w4/3&&(R=V)}}else F&&(N&&(R<1/3?R+=q:R>2/3&&(R-=q)),R=(R-F.domain[0])/(F.domain[1]-F.domain[0]),R=F.fraction2r(R))}F&&F===O&&j&&("log"===j&&"log"!==F.type?R=Math.pow(10,R):"log"!==j&&"log"===F.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),S[C]=R}}var G={};v(S,G,k),k.annotations[e]=G;var H=f.getFromId(t,G.xref),Z=f.getFromId(t,G.yref),X={x:0,y:0},Y=+G.textangle||0,W=k._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",G.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:S,fullAnnotation:G})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),J=Q.append("g"),$=G.borderwidth,K=G.borderpad,tt=$+K,et=J.append("rect").attr("class","bg").style("stroke-width",$+"px").call(h.stroke,G.bordercolor).call(h.fill,G.bgcolor),nt=G.font,rt=J.append("text").classed("annotation",!0).attr("data-unformatted",G.text).text(G.text);t._context.editable?rt.call(p.makeEditable,J).call(_).on("edit",function(n){G.text=n,this.attr({"data-unformatted":G.text}),this.call(_);var r={};r["annotations["+e+"].text"]=G.text,H&&H.autorange&&(r[H._name+".autorange"]=!0),Z&&Z.autorange&&(r[Z._name+".autorange"]=!0),l.relayout(t,r)}):rt.call(_),Q.attr({transform:"rotate("+Y+","+X.x+","+X.y+")"}).call(d.setPosition,X.x,X.y)}}}function a(t,e,n,r,i,a,o,s){var l=n-t,u=i-t,c=o-i,f=r-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var m=(u*d-c*h)/p,g=(u*f-l*h)/p;return g<0||g>1||m<0||m>1?null:{x:t+l*m,y:e+f*m}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),m=t("../../lib/setcursor"),g=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:r,drawOne:i}},{"../../lib":316,"../../lib/setcursor":326,"../../lib/svg_text_utils":328,"../../plotly":338,"../../plots/cartesian/axes":343,"../../plots/plots":374,"../color":223,"../dragelement":244,"../drawing":246,"./annotation_defaults":214,"./defaults":218,"./draw_arrow_head":220,d3:8,"fast-isnumeric":12}],220:[function(t,e,n){"use strict";var r=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,n,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof n&&n||(n="end");var f,h,d,p,m=(o.getPx(t,"stroke-width")||1)*l,g=t.style("stroke")||a.defaultLine,v=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,_=c.backoff*m;if("line"===u.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},h={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(f.y-h.y,f.x-h.x),p=d+Math.PI,_){var b=_*Math.cos(d),w=_*Math.sin(d);y&&(f.x-=b,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(h.x+=b,h.y+=w,t.attr({x2:h.x,y2:h.y}))}}else if("path"===u.nodeName){var M=u.getTotalLength(),k="";if(y){var A=u.getPointAtLength(0),S=u.getPointAtLength(.1);d=Math.atan2(A.y-S.y,A.x-S.x),f=u.getPointAtLength(Math.min(_,M)),_&&(k="0px,"+_+"px,")}if(x){var T=u.getPointAtLength(M),z=u.getPointAtLength(M-.1);if(p=Math.atan2(T.y-z.y,T.x-z.x),h=u.getPointAtLength(Math.max(0,M-_)),_){var E=k?2*_:_;k+=M-E+"px,"+M+"px"}}else k&&(k+=M+"px");k&&t.style("stroke-dasharray",k)}var L=function(n,i){e>5&&(i=0),r.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+n.x+","+n.y+")rotate("+180*i/Math.PI+")scale("+m+")"}).style({fill:g,opacity:v,"stroke-width":0})};y&&L(f,d),x&&L(h,p)}}},{"../color":223,"../drawing":246,"./arrow_paths":215,d3:8,"fast-isnumeric":12}],221:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":216,"./calc_autorange":217,"./defaults":218,"./draw":219}],222:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],223:[function(t,e,n){"use strict";function r(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===r.length;if(!i&&3!==r.length)return t;for(var o=0;o=0))return t;if(3===o)r[o]>1&&(r[o]=1);else if(r[o]>=1)return t}var s=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return i?"rgba("+s+", "+r[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var n=i(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},o.combine=function(t,e){var n=i(t).toRgb();if(1===n.a)return i(t).toRgbString();var r=i(e||o.background).toRgb(),a=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},s={r:a.r*(1-n.a)+n.r*n.a,g:a.g*(1-n.a)+n.g*n.a,b:a.b*(1-n.a)+n.b*n.a};return i(s).toRgbString()},o.contrast=function(t,e,n){var r=i(t),a=r.isLight()?r.darken(n):r.lighten(e);return a.toString()},o.stroke=function(t,e){var n=i(e);t.style({stroke:o.tinyRGB(n),"stroke-opacity":n.getAlpha()})},o.fill=function(t,e){var n=i(e);t.style({fill:o.tinyRGB(n),"fill-opacity":n.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,n,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):n.node()&&!n.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===b.titleside)K.domain[1]-=st/S.h,a[1]*=-1;else{K.domain[0]+=st/S.h;var u=Math.max(1,n.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),K.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(S.h*(1-K.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(L);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?z[0]:(L[e]+L[e-1])/2,e===L.length-1?z[1]:(L[e]+L[e+1])/2].map(K.c2p).map(Math.round);e!==L.length-1&&(n[1]+=n[1]>n[0]?1:-1);var a=D(t).replace("e-",""),o=i(a).toHexString();r.select(this).attr({x:X,width:Math.max(B,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:o})});var h=at.select(".cblines").selectAll("path.cbline").data(b.line.color&&b.line.width?E:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){r.select(this).attr("d","M"+X+","+(Math.round(K.c2p(t))+b.line.width/2%1)+"h"+B).call(d.lineGroupStyle,b.line.width,I(t),b.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=X+B+(b.outlinewidth||0)/2-("outside"===b.ticks?1:0),K.side="right",c.syncOrAsync([function(){return l.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(b.titleside)===-1){var e=K.titlefont.size,n=K._offset+K._length/2,i=S.l+(K.position||0)*S.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));M("h"+K._id+"title",{avoid:{selection:r.select(t).selectAll("g."+K._id+"tick"),side:b.titleside,offsetLeft:S.l,offsetTop:S.t,maxShift:A.width},attributes:{x:i,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,n){var r,i=_();r=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:K,propName:r,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),m.draw(t,e,f(a,n||{}))}function k(){var n=B+b.outlinewidth/2+d.bBox(K._axislayer.node()).width;if(R=ot.select("text"),R.node()&&!R.classed("js-placeholder")){var r,i=ot.select(".h"+K._id+"title-math-group").node();r=i&&["top","bottom"].indexOf(b.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-X-S.l,n=Math.max(n,r)}var a=2*b.xpad+n+b.borderwidth+b.outlinewidth/2,s=Q-J;at.select(".cbbg").attr({x:X-b.xpad-(b.borderwidth+b.outlinewidth)/2,y:J-H,width:Math.max(a,2),height:Math.max(s+2*H,2)}).call(p.fill,b.bgcolor).call(p.stroke,b.bordercolor).style({"stroke-width":b.borderwidth}),at.selectAll(".cboutline").attr({x:X,y:J+b.ypad+("top"===b.titleside?st:0),width:Math.max(B,2),height:Math.max(s-2*b.ypad-st,2)}).call(p.stroke,b.outlinecolor).style({fill:"None","stroke-width":b.outlinewidth});var l=({center:.5,right:1}[b.xanchor]||0)*a;at.attr("transform","translate("+(S.l-l)+","+S.t+")"),o.autoMargin(t,e,{x:b.x,y:b.y,l:a*({right:1,center:.5}[b.xanchor]||0),r:a*({left:1,center:.5}[b.xanchor]||0),t:s*({bottom:1,middle:.5}[b.yanchor]||0),b:s*({top:1,middle:.5}[b.yanchor]||0)})}var A=t._fullLayout,S=A._size;if("function"!=typeof b.fillcolor&&"function"!=typeof b.line.color)return void A._infolayer.selectAll("g."+e).remove();var T,z=r.extent(("function"==typeof b.fillcolor?b.fillcolor:b.line.color).domain()),E=[],L=[],I="function"==typeof b.line.color?b.line.color:function(){return b.line.color},D="function"==typeof b.fillcolor?b.fillcolor:function(){return b.fillcolor},P=b.levels.end+b.levels.size/100,C=b.levels.size,O=1.001*z[0]-.001*z[1],F=1.001*z[1]-.001*z[0];for(T=b.levels.start;(T-P)*C<0;T+=C)T>O&&Tz[0]&&T1){var it=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));et*=it*c.roundUp(rt/it,[2,5,10]),(Math.abs(b.levels.start)/b.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+Z,W+U-Z],K.setScale();var at=A._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(S.l)+","+Math.round(S.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(S.l)+",-"+Math.round(S.t)+")");K._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(b.titleside)!==-1){var lt,ut=S.l+(b.x+G)*S.w,ct=K.titlefont.size;lt="top"===b.titleside?(1-(W+U-Z))*S.h+S.t+3+.75*ct:(1-(W+Z))*S.h+S.t-3-.25*ct,M(K._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ft=c.syncOrAsync([o.previousPromises,w,o.previousPromises,k],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var ht,dt,pt;u.init({element:at.node(),prepFn:function(){ht=at.attr("transform"),h(at)},moveFn:function(t,e){at.attr("transform",ht+" translate("+t+","+e+")"),dt=u.align(Y+t/S.w,q,0,1,b.xanchor),pt=u.align(W-e/S.h,U,0,1,b.yanchor);var n=u.getCursor(dt,pt,b.xanchor,b.yanchor);h(at,n)},doneFn:function(e){h(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},_().index)}})}return ft}function _(){var n,r,i=e.substr(2);for(n=0;n=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":316,"./flip_scale":234,"./scales":241}],230:[function(t,e,n){"use strict";var r=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},r.colorscale,{}),cauto:i({},r.zauto,{}),cmax:i({},r.zmax,{}),cmin:i({},r.zmin,{}),autocolorscale:i({},r.autocolorscale,{}),reversescale:i({},r.reversescale,{})}}},{"../../lib/extend":312,"./attributes":228,"./scales.js":241}],231:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":241}],232:[function(t,e,n){"use strict";var r=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,n,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,m=f?i.nestedProperty(e,d).get()||{}:e,g=p[h+"min"],v=p[h+"max"],y=p.colorscale,x=r(g)&&r(v)&&g=0;i--,a++)e=t[i],r[a]=[1-e[0],e[1]];return r}},{}],235:[function(t,e,n){"use strict";var r=t("./scales"),i=t("./default_scale"),a=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=i),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),a(t)?t:e):e}},{"./default_scale":231,"./is_valid_scale_array":239,"./scales":241}],236:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../../lib"),a=t("./is_valid_scale");e.exports=function(t,e){var n=e?i.nestedProperty(t,e).get()||{}:t,o=n.color,s=!1;if(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],243:[function(t,e,n){"use strict";var r=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,n,a){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===a?0:"middle"===a?1:"top"===a?2:r.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":316}],244:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,m._dragged=!1,m._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-m._mouseDownTimev&&(g=Math.max(g-1,1)),t.doneFn&&t.doneFn(m._dragged,g),!m._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),d.dispatchEvent(n)}return i(m),m._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,m=o.getPlotDiv(t.element)||{},g=1,v=s.DBLCLICKDELAY;m._mouseDownTime||(m._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=r},{"../../lib":316,"../../plotly":338,"../../plots/cartesian/constants":348,"./align":242,"./cursor":243,"./unhover":245}],245:[function(t,e,n){"use strict";var r=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,n)},i.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":311}],246:[function(t,e,n){"use strict";function r(t,e,n,r,i,a,o){if(s.traceIs(n,"symbols")){var u=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(n)?u(t.ms):(a.size||6)/2,t.mrc=e;var r=m.symbolNumber(t.mx||a.symbol)||0,i=r%100;return t.om=r%200>=100,m.symbolFuncs[i](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,f,h;t.so?(h=o.outlierwidth,f=o.outliercolor,c=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=r(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(h||1)+"px",fill:"none"}):(e.style("stroke-width",h+"px").call(l.fill,c),h&&e.call(l.stroke,f))}function i(t,e,n,r){var i=t[0]-e[0],o=t[1]-e[1],s=n[0]-e[0],l=n[1]-e[1],u=Math.pow(i*i+o*o,b/2),c=Math.pow(s*s+l*l,b/2),f=(c*c*i-u*u*s)*r,h=(c*c*o-u*u*l)*r,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&f/d),2),a.round(e[1]+(d&&h/d),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&h/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),m=e.exports={};m.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(l.fill,r)},m.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},m.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},m.setRect=function(t,e,n,r,i){t.call(m.setPosition,e,n).call(m.setSize,r,i)},m.translatePoint=function(t,e,n,r){var i=t.xp||n.c2p(t.x),a=t.yp||r.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},m.translatePoints=function(t,e,n,r){t.each(function(t){var i=a.select(this);m.translatePoint(t,i,e,n,r)})},m.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},m.crispRound=function(t,e,n){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},m.singleLineStyle=function(t,e,n,r,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=n||a.width||0,s=i||a.dash||"";l.stroke(e,r||a.color),m.dashLine(e,s,o)},m.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=r||i.dash||"";a.select(this).call(l.stroke,n||i.color).call(m.dashLine,s,o)})},m.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},m.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=a.select(this);try{n.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),n.remove()}})};var g=t("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolList=[],Object.keys(g).forEach(function(t){var e=g[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"])});var v=m.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";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),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},m.singlePointStyle=function(t,e,n){var i=n.marker,a=i.line,o=m.tryColorscale(i,""),s=m.tryColorscale(i,"line");r(t,e,n,o,s,i,a)},m.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=m.tryColorscale(n,""),i=m.tryColorscale(n,"line");t.each(function(t){m.singlePointStyle(t,a.select(this),e,r,i)})}},m.tryColorscale=function(t,e){var n=e?c.nestedProperty(t,e).get():t,r=n.colorscale,i=n.color;return r&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(r,n.cmin,n.cmax)):c.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},_=1.3;m.textPointStyle=function(t,e){t.each(function(t){var n=a.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,n.call(m.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(r).call(f.convertToTspans);var h=a.select(this.parentNode),d=n.selectAll("tspan.line"),p=((d[0].length||1)-1)*_+1,g=x[l]*c,v=.75*u+x[s]*c+(x[s]-1)*p*u/2;h.attr("transform","translate("+g+","+v+")"),p>1&&d.attr({x:n.attr("x"),y:n.attr("y")})})};var b=.5;m.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],a=[];for(n=1;n=A&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(l),c.extendFlat({},l)},m.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=a.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":305,"../../lib":316,"../../lib/svg_text_utils":328,"../../registry":382,"../../traces/scatter/make_bubble_size_func":408,"../../traces/scatter/subtypes":413,"../color":223,"../colorscale":237,"./symbol_defs":247,d3:8,"fast-isnumeric":12}],247:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,i="l"+e+",-"+e,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+n+i+a+i+a+o+a+o+n+o+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),i=r.round(-t,2),a=r.round(t*-.309,2),o=r.round(.809*t,2);return"M"+e+","+a+"L"+n+","+o+"H-"+n+"L-"+e+","+a+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),i=r.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+n+"V"+n+"L0,"+e+"L-"+i+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),i=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+i+"H"+n+"L"+e+",0L"+n+",-"+i+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),i=r.round(.951*e,2),a=r.round(.363*e,2),o=r.round(.588*e,2),s=r.round(-e,2),l=r.round(e*-.309,2),u=r.round(.118*e,2),c=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+n+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),i=r.round(.76*t,2);return"M-"+i+",0l-"+n+",-"+e+"h"+i+"l"+n+",-"+e+"l"+n+","+e+"h"+i+"l-"+n+","+e+"l"+n+","+e+"h-"+i+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),i=r.round(1.6*t,2),a=r.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M-"+e+","+n+o+e+","+n+o+"0,-"+i+o+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),i=r.round(1.6*t,2),a=r.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M"+e+",-"+n+o+"-"+e+",-"+n+o+"0,"+i+o+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),i="A "+n+","+n+" 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=r.round(1.4*t,2),n=r.round(1.9*t,2),i="A "+n+","+n+" 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=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:8}],248:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],249:[function(t,e,n){"use strict";function r(t,e,n,r){var a=e["error_"+r]||{},l=a.visible&&["linear","log"].indexOf(n.type)!==-1,u=[];if(l){for(var c=s(a),f=0;f0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var m=i.select(this).selectAll("g.errorbar").data(t,e);m.exit().remove(),m.style("opacity",1);var g=m.enter().append("g").classed("errorbar",!0);c&&g.style("opacity",0).transition().duration(n.duration).style("opacity",1),m.each(function(t){var e=i.select(this),o=r(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var m=d.width;f="M"+(o.x-m)+","+o.yh+"h"+2*m+"m-"+m+",0V"+o.ys,o.noYS||(f+="m-"+m+",0h"+2*m);var g=e.select("path.yerror");s=!g.size(),s?g=e.append("path").classed("yerror",!0):c&&(g=g.transition().duration(n.duration).ease(n.easing)),g.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var v=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-v)+"v"+2*v+"m0,-"+v+"H"+o.xs,o.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":413,d3:8,"fast-isnumeric":12}],254:[function(t,e,n){"use strict";var r=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},a=e.error_x||{},o=r.select(this);o.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(i.stroke,n.color),a.copy_ystyle&&(a=n),o.selectAll("path.xerror").style("stroke-width",a.thickness+"px").call(i.stroke,a.color)})}},{"../color":223,d3:8}],255:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":348}],256:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return i.coerce(t,e,s,n,r)}var o=r("source"),l=r("visible",!!o);if(!l)return e;r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var u={_fullLayout:n},c=["x","y"],f=0;f<2;f++)a.coerceRef(t,e,u,c[f],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var n={name:l,handleItemDefaults:r};o(t,e,n)}},{"../../lib":316,"../../plots/array_container_defaults":340,"../../plots/cartesian/axes":343,"./attributes":255}],257:[function(t,e,n){"use strict";var r=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var n=r.select(this);if(!this.img||this.img.src!==e.source){n.attr("xmlns",o.svg);var i=new Promise(function(t){function r(){n.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=r,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var r=t.toDataURL("image/png");n.attr("xlink:href",r)},n.on("error",r),n.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function n(e){var n=r.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,f=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,h=c*d.x[e.xanchor].offset,p=f*d.y[e.yanchor].offset,m=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,g=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+h,v=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":m+=" slice";break;case"stretch":m="none"}n.attr({x:g,y:v,width:c,height:f,preserveAspectRatio:m,opacity:e.opacity});var y=o?o._id:"",x=l?l._id:"",_=y+x;_&&n.call(i.setClipUrl,"clip"+s._uid+_)}for(var s=t._fullLayout,l=[],u=[],c=[],f=0;f=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],260:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":312,"../../plots/font_attributes":363,"../color/attributes":222}],261:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],262:[function(t,e,n){"use strict";var r=t("../../registry"),i=t("../../lib"),a=t("./attributes"),o=t("../../plots/layout_attributes"),s=t("./helpers");e.exports=function(t,e,n){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},m=0,g="normal",v=0;v1);if(x!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var _=t.xaxis;_&&_.rangeslider&&_.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",g),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"]); +}}},{"../../lib":316,"../../plots/layout_attributes":365,"../../registry":382,"./attributes":260,"./helpers":265}],263:[function(t,e,n){"use strict";function r(t,e){function n(n){v.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(a,e)})}var r=t.data()[0][0],i=e._fullLayout,o=r.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?r.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(m.font,i.legend.font).text(u),e._context.editable&&!s?f.call(v.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var i,a=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=r.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(n)}function i(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=n.indexOf(f);h===-1?n.push(f):n.splice(h,1),c.relayout(e,"hiddenlabels",n)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;n=s*h,r=u.node()&&m.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}n=Math.max(n,16)+3,i.height=n,i.width=r}function o(t,e,n){var r=t._fullLayout,i=r.legend,a=i.borderwidth,o=b.isGrouped(i);if(b.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,a,5+a+i.height+n/2),i.height+=n,i.width=Math.max(i.width,r)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),n.each(function(e){var n=e[0],r=u.select(this).select(".legendtoggle");r.call(m.setRect,0,-n.height/2,(t._context.editable?0:i.width)+40,n.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cr.width-(r.margin.r+r.margin.l)&&(x=0,g+=v,i.height=i.height+v,v=0),f.setTranslate(this,a+x,5+a+e.height/2+g),i.width+=o+n,i.height=Math.max(i.height,e.height),x+=o+n,v=Math.max(e.height,v)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),n.each(function(e){var n=e[0],r=u.select(this).select(".legendtoggle");r.call(m.setRect,0,-n.height/2,t._context.editable?0:i.width,n.height)})}}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var i="top";w.isBottomAnchor(n)?i="bottom":w.isMiddleAnchor(n)&&(i="middle"),h.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[i]||0),t:n.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),h.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),m=t("../drawing"),g=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),_=t("./style"),b=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),z.call(m.setRect,N,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,a="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,b=n.showlegend&&x(t.calcdata,v),M=n.hiddenlabels||[];if(!n.showlegend||!b.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+a).data([0]);A.enter().append("clipPath").attr("id",a).append("rect");var S=k.selectAll("rect.bg").data([0]);S.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),S.call(g.stroke,v.bordercolor),S.call(g.fill,v.bgcolor),S.style("stroke-width",v.borderwidth+"px");var T=k.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var z=k.selectAll("rect.scrollbar").data([0]);z.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var E=T.selectAll("g.groups").data(b);E.enter().append("g").attr("class","groups"),E.exit().remove();var L=E.selectAll("g.traces").data(f.identity);L.enter().append("g").attr("class","traces"),L.exit().remove(),L.call(_).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(r,t).call(i,t)});var I=0!==k.enter().size();I&&(o(t,E,L),s(t));var D=0,P=n.width,C=0,O=n.height;o(t,E,L),v.height>O?l(t):s(t);var F=n._size,R=F.l+F.w*v.x,j=F.t+F.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?j-=v.height:w.isMiddleAnchor(v)&&(j-=v.height/2);var N=v.width,B=F.w;N>B?(R=F.l,N=B):(R+N>P&&(R=P-N),RV?(j=F.t,q=V):(j+q>O&&(j=O-q),jn[1])return n[1]}return i}function n(t){return t[0]}var r,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},m={};s&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",c.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(m.line={width:e("line.width",n,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[c.minExtend(a,p)],i=c.minExtend(o,m)}var g=l.select(this).select("g.legendpoints"),v=g.selectAll("path.scatterpts").data(s?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,i),s&&(r[0].mrc=3);var y=g.selectAll("g.pointtext").data(u?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||r.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||n.color),e&&i.call(h.stroke,t.mlc||r.color)})}function o(t){var e=t[0].trace,n=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=l.select(this);r.style("stroke-width",n+"px").call(h.fill,t.fc||e.fillcolor),n&&r.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,n=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(r).each(i)}},{"../../lib":316,"../../registry":382,"../../traces/pie/style_one":391,"../../traces/scatter/subtypes":413,"../color":223,"../drawing":246,d3:8}],268:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),i=n.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===r){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),m=0;m1)return r(["resetViews","toggleHover"]),o(g,n);c&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),h&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=i(s),y=[];return((u||p)&&!v||m)&&(y=["zoom2d","pan2d"]),(u||m)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!u&&!p||v||m||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):u?r(["hoverClosestCartesian","hoverCompareCartesian"]):d&&r(["hoverClosestPie"]),o(g,n)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var m=i(e,n,l);c("x",m[0]),c("y",m[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",n.font);var g=c("bgcolor");c("activecolor",o.contrast(g,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":316,"../color":223,"./attributes":272,"./button_attributes":273,"./constants":274}],276:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=i.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var s=0;se;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,n,r){function i(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,E)},i=E.line.width?E.line.color:"rgba(0,0,0,0)",a=n.append("path").attr(r).style("opacity",E.opacity).call(b.stroke,i).call(b.fill,E.fillcolor).call(w.dashLine,E.line.dash,E.line.width);L&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+L),t._context.editable&&f(t,a,E,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof n&&n?l[n]=r:x.isPlainObject(n)&&(l=n);var u=Object.keys(l);for(a=0;aZ&&r>X&&!t.shiftKey?M.getCursor(i/n,1-a/r):"move";k(e,o),H=o.split("-")[0]}function a(e){N=_.getFromId(t,n.xref),B=_.getFromId(t,n.yref),q=S.getDataToPixel(t,N),V=S.getDataToPixel(t,B,!0),U=S.getPixelToData(t,N),G=S.getPixelToData(t,B,!0);var a="shapes["+r+"]";"path"===n.type?(R=n.path,j=a+".path"):(c=q(n.x0),f=V(n.y0),h=q(n.x1),d=V(n.y1),m=a+".x0",v=a+".y0",x=a+".x1",b=a+".y1"),cX&&(u[E]=n[P]=G(s),u[L]=n[C]=G(l)),f-c>Z&&(u[I]=n[O]=U(c),u[D]=n[F]=U(f))}e.attr("d",p(t,n))}var u,c,f,h,d,m,v,x,b,w,A,T,z,E,L,I,D,P,C,O,F,R,j,N,B,q,V,U,G,H,Z=10,X=10,Y={setCursor:i,element:e.node(),prepFn:a,doneFn:o},W=Y.element.getBoundingClientRect();M.init(Y)}function h(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function d(t,e,n){var r=_.getFromId(t,n.id,"x")._id,i=_.getFromId(t,n.id,"y")._id,a="below"===e.layer,o=r===e.xref||i===e.yref,s=!!n.shapelayer;return a&&o&&s}function p(t,e){var n,r,i,a,o=e.type,s=_.getFromId(t,e.xref),l=_.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=S.shapePositionToRange(s),r=function(t){return s._offset+s.r2p(n(t,!0))}):r=function(t){return u.l+u.w*t},l?(i=S.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(r=S.decodeDate(r)),l&&"date"===l.type&&(a=S.decodeDate(a)),m(e.path,r,a);var c=r(e.x0),f=r(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,g=(h+d)/2,v=Math.abs(p-c),y=Math.abs(g-h),x="A"+v+","+y,b=p+v+","+g,w=p+","+(g-y);return"M"+b+x+" 0 1,1 "+w+x+" 0 0,1 "+b+"Z"}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,i=t.charAt(0),a=A.paramIsX[i],o=A.paramIsY[i],s=A.numParams[i],l=t.substr(1).replace(A.paramRE,function(t){return a[r]?t=e(t):o[r]&&(t=n(t)),r++,r>s&&(t="X"),t});return r>s&&(l=l.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),i+l})}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,i=t.charAt(0),a=A.paramIsX[i],o=A.paramIsY[i],s=A.numParams[i],l=t.substr(1).replace(A.paramRE,function(t){return r>=s?t:(a[r]?t=e(t):o[r]&&(t=n(t)),r++,t)});return i+l})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),_=t("../../plots/cartesian/axes"),b=t("../color"),w=t("../drawing"),M=t("../dragelement"),k=t("../../lib/setcursor"),A=t("./constants"),S=t("./helpers"),T=t("./shape_defaults"),z=t("./defaults");e.exports={draw:r,drawOne:i}},{"../../lib":316,"../../lib/setcursor":326,"../../plotly":338,"../../plots/cartesian/axes":343,"../color":223,"../dragelement":244,"../drawing":246,"./constants":286,"./defaults":287,"./helpers":289,"./shape_defaults":291,"fast-isnumeric":12}],289:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var i,a=t._fullLayout._size;if(e){var o=n.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=n.decodeDate(i))}else i=r?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},n.getPixelToData=function(t,e,r){var i,a=t._fullLayout._size;if(e){var o=n.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=r?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],290:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":284,"./calc_autorange":285,"./defaults":287,"./draw":288}],291:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,n,s,l){function u(n,i){return r.coerce(t,e,a,n,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var f=t.path?"path":"rect",h=u("type",f),d=["x","y"],p=0;p<2;p++){var m=d[p],g={_fullLayout:n},v=i.coerceRef(t,e,g,m,"","paper");if("path"!==h){var y,x,_,b=.25,w=.75;"paper"!==v?(y=i.getFromId(g,v),_=o.rangeToShapePosition(y),x=o.shapePositionToRange(y)):x=_=r.identity;var M=m+"0",k=m+"1",A=t[M],S=t[k];t[M]=x(t[M],!0),t[k]=x(t[k],!0),i.coercePosition(e,g,u,v,M,b),i.coercePosition(e,g,u,v,k,w),e[M]=_(e[M]),e[k]=_(e[k]),t[M]=A,t[k]=S}}return"path"===h?u("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":316,"../../plots/cartesian/axes":343,"./attributes":284,"./helpers":289}],292:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},r,{})},font:a({},r,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":312,"../../plots/animation_attributes":339,"../../plots/font_attributes":363,"../../plots/pad_attributes":373,"./constants":293}],293:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],294:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}var o=i(t,e),l=r("visible",o.length>0);if(l){r("active"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),a.coerceFont(r,"font",n.font);var u=r("currentvalue.visible");u&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),a.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function i(t,e){function n(t,e){return a.coerce(r,i,c,t,e)}for(var r,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*E.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+E.stepInset+(t.inputAreaLength-2*E.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-E.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*E.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+E.railTouchRectClass).data([0]);r.enter().append("rect").classed(E.railTouchRectClass,!0).call(d,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,E.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),k.setTranslate(r,0,n.currentValueTotalHeight)}function _(t,e){var n=t.selectAll("rect."+E.railRectClass).data([0]);n.enter().append("rect").classed(E.railRectClass,!0);var r=e.inputAreaLength-2*E.railInset;n.attr({width:r,height:E.railWidth,rx:E.railRadius,ry:E.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(n,E.railInset,.5*(e.inputAreaWidth-E.railWidth)+e.currentValueTotalHeight)}function b(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(s.enter().append("g").classed(E.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&b(t),0!==n.length){var l=s.selectAll("g."+E.groupClassName).data(n,i);l.enter().append("g").classed(E.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,E.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+d+")")}}}function p(){T=0,z=!0,E=I,M._infolayer.select("."+e).attr({"data-unformatted":E}).text(E).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var m=n.propContainer,g=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},_=n.attributes,b=n.transform,w=n.containerGroup,M=t._fullLayout,k=m.titlefont.family,A=m.titlefont.size,S=m.titlefont.color,T=1,z=!1,E=m.title.trim();""===E&&(T=0),E.match(/Click to enter .+ title/)&&(T=.2,z=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var L=w.selectAll("text").data([0]);L.enter().append("text"),L.text(E).attr("class",e),L.attr({"data-unformatted":E}).call(f);var I="Click to enter "+y+" title";t._context.editable?(E||p(),L.call(c.makeEditable).on("edit",function(e){void 0!==v?a.restyle(t,g,e,v):a.relayout(t,g,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(_).selectAll("tspan.line").attr(_)})):E&&!E.match(/Click to enter .+ title/)||L.remove(),L.classed("js-placeholder",z)}},{"../../lib":316,"../../lib/svg_text_utils":328,"../../plotly":338,"../../plots/plots":374,"../color":223,"../drawing":246,d3:8,"fast-isnumeric":12}],298:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":312,"../../plots/font_attributes":363,"../../plots/pad_attributes":373,"../color/attributes":222}],299:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],300:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}var o=i(t,e),l=r("visible",o.length>0);l&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),a.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function i(t,e){function n(t,e){return a.coerce(r,i,c,t,e)}for(var r,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==n.length){var c=u.selectAll("g."+S.headerGroupClassName).data(n,i);c.enter().append("g").classed(S.headerGroupClassName,!0);var f=u.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(v).attr(S.menuIndexAttrName,"-1"),c.exit().each(function(e){x.select(this).remove(),f.call(v).attr(S.menuIndexAttrName,"-1"),_.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],305:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],306:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":221,"./components/images":258,"./components/legend":266,"./components/rangeselector":278,"./components/rangeslider":283,"./components/shapes":290,"./components/sliders":296,"./components/updatemenus":302,"./fonts/mathjax_config":307,"./lib/queue":324,"./plot_api/plot_schema":332,"./plot_api/register":333,"./plot_api/set_plot_config":334,"./plot_api/to_image":336,"./plot_api/validate":337,"./plotly":338,"./snapshot":387,"./snapshot/download":384,"./traces/scatter":403,d3:8,"es6-promise":10}],307:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],308:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),r(t)?Number(t):i}},{"../constants/numerical":303,"fast-isnumeric":12}],309:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,i){!r(t)||void 0!==i.min&&ti.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,i){t%1||!r(t)||void 0!==i.min&&ti.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var i="number"==typeof t;r.strict!==!0&&i?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){i(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(a(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!s.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,r,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var m=u.length;if(m>3||3!==m&&s[1]||!m)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var g=(new Date).getFullYear();e=((Number(u[0])-g+70)%100+200)%100+g-70}if(!a(e))return l;var v=new Date(0,0,1);if(v.setFullYear(c?e:-e),u.length>1){if(r=Number(u[1])-1,u[1].length>2||!(r>=0&&r<=11))return l;if(v.setMonth(r),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(v.setDate(i),v.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(v.setHours(o),v.getHours()!==o)return l;if(u.length>1)return i=v.getTime(),r=Number(u[1]),2===u[1].length&&r>=0&&r<=59?(i+=f*r,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return v.getTime()},d=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==l};var m=90*u,g=3*c,v=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var n=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(n),o=e0&&(r.push(i),i=[])}return r.push(i),r},n.makeLine=function(t,e){var n={};return n=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(n.trace=e),n},n.makePolygon=function(t,e){var n={};if(1===t.length)n={type:"Polygon",coordinates:t};else{for(var r=new Array(t.length),i=0;in?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},i.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,n))/Math.log(r),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,n/i))/Math.log(r)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,n)?t(e,n,r):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(n=0;n=s&&(i-=s*Math.floor(i/s)),i<0?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[r];c[n]=a}return c},i.syncOrAsync=function(t,e,n){function r(){return i.syncOrAsync(t,e,n)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(r).then(void 0,i.promiseError);return n&&n(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,n){if(t){var r,i,a=!1,o=!0;for(r=0;r1?i+o[1]:"";if(a&&(o.length>1||s.length>4||n))for(;r.test(s);)s=s.replace(r,"$1"+a+"$2");return s+l}},{"./clean_number":308,"./coerce":309,"./dates":310,"./extend":312,"./filter_unique":313,"./filter_visible":314,"./is_array":317,"./is_plain_object":318,"./loggers":319,"./matrix":320,"./nested_property":321,"./notifier":322,"./search":325,"./stats":327,d3:8}],317:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],318:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],319:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],o=!1,h(r))for(n=r.length-1;n>=0;n--)u(r[n])?o?r[n]=void 0:r.pop():o=!0;else if("object"==typeof r&&null!==r)for(a=Object.keys(r),o=!1,n=a.length-1;n>=0;n--)u(r[a[n]])&&!i(r[a[n]],a[n])?delete r[a[n]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,i,o,s=0,l=e.split(".");sa||rs)&&(!e||!u(t))}function n(t,e){var n=t[0],l=t[1];if(na||ls)return!1;var u,c,f,h,d,p=r.length,m=r[0][0],g=r[0][1],v=0;for(u=1;uMath.max(c,m)||l>Math.max(f,g)))if(lc||Math.abs(r(o,h))>i)return!0;return!1};i.filter=function(t,e){function n(n){t.push(n);var s=r.length,l=i;r.splice(o+1);for(var u=l+1;u1){var s=t.pop();n(s)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":320}],324:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");n.findBin=function(t,e,n){if(s(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?n?r:i:n?o:a;f90&&l.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,i=e[r]-e[0]||1,a=i/(r||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}},n.roundUp=function(t,e,n){for(var r,i=0,a=e.length-1,o=0,s=n?0:1,l=n?1:0,u=n?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":12}],328:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,n){var r="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),n();else{var r=a.select("svg").node().getBoundingClientRect();n(a.select(".MathJax_SVG"),e,r)}a.remove()})}function o(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),i=m[r];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,g.indexOf(c.protocol)===-1?"":''}if("br"===r)return"
";if(a)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))r.push(i);var a=0;r.forEach(function(t){for(var n=t+a,r=e.slice(0,n),i="",o=r.length-1;o>=0;o--){var s=r[o].match(/<(\/?).*>/i);if(s&&"
"!==r[o]){s[1]||(i=r[o]);break}}i&&(e.splice(n+1,0,i),e.splice(n,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,n){var r,i,a,o=n.horizontalAlign,s=n.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-r.height}:"middle"===s?function(){return l.top+(l.height-r.height)/2}:function(){return l.top},a="right"===o?function(){return l.right-r.width}:"center"===o?function(){return l.left+(l.width-r.width)/2}:function(){return l.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(h.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var m=t.node();m&&m.removeAttribute;m=m.parentNode)m.removeAttribute("data-bb");if(l){var g=h.getPlotDiv(s.node());(g&&g._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return n(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=r(l,"width"),h=r(l,"height"),m=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],g=parseInt(s.style("font-size"),10)||r(s,"height"),v=-g/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,v-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:v-h/2}):"a"===p[0]?l.attr({x:0,y:v}):l.attr({x:m,y:+s.attr("y")+v-h/2}),e&&e.call(s,u),t(u)})}))}else n();return t}};var m={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},g=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:n.fill||o.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||o.attr("data-unformatted")).call(c(o,e,n)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}n||(n={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),n.immediate?r():u.on("click",r),f.rebind(this,s,"on")}},{"../constants/string_mappings":304,"../constants/xmlns_namespaces":305,"../lib":316,d3:8}],329:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function i(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function a(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var o=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),l=t("../registry"),u=t("../lib"),c=t("../plots/plots"),f=t("../plots/cartesian/axes"),h=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var i=f.list({_fullLayout:t});for(e=0;e3?(g.x=1.02,g.xanchor="left"):g.x<-2&&(g.x=-.02,g.xanchor="right"),g.y>3?(g.y=1.02,g.yanchor="bottom"):g.y<-2&&(g.y=-.02,g.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=c.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||i<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(i,r+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 "+n+" must be unique.")}}function l(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&s(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,n){var r,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&lI.range[0]?[1,2]:[2,1]);else{var D=I.range[0],P=I.range[1];"log"===_?(D<=0&&P<=0&&n(T+".autorange",!0),D<=0?D=P/1e6:P<=0&&(P=D/1e6),n(T+".range[0]",Math.log(D)/Math.LN10),n(T+".range[1]",Math.log(P)/Math.LN10)):(n(T+".range[0]",Math.pow(10,D)),n(T+".range[1]",Math.pow(10,P)))}else n(T+".autorange",!0)}if("reverse"===A)z.range?z.range.reverse():(n(T+".autorange",!0),z.range=[1,0]),E.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var C=v.parts[1],O=v.parts[0],F=a[O]||[],R=F[C]||{};2===v.parts.length&&(null===_&&(e[g]="remove"),"add"===e[g]||x.isPlainObject(e[g])?m[g]="remove":"remove"===e[g]?C===-1?(m[O]=F,delete m[g]):m[g]=R:x.log("???",e)),!r(R,"x")&&!r(R,"y")||x.containsAny(g,["color","opacity","align","dash"])||(d.docalc=!0);var j=w.getComponentMethod(O,"drawOne");j(t,C,v.parts.slice(2).join("."),e[g]),delete e[g]}else if(M.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])L.manageArrayContainers(v,_,m),d.doplot=!0;else{var N=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?d.doplot=!0:0===v.parts[0].indexOf("geo")?d.doplot=!0:0===v.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===g?d.doplot=!0:!o._has("gl2d")||g.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===g?d.docalc=!0:v.parts[0].indexOf("legend")!==-1?d.dolegend=!0:g.indexOf("title")!==-1?d.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(N,["tick","exponent","grid","zeroline"])?d.doticks=!0:g.indexOf(".linewidth")!==-1&&g.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:v.parts.length>1&&N.indexOf("line")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&"mirror"===N?d.doticks=d.dolayoutstyle=!0:"margin.pad"===g?d.doticks=d.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||g.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(g)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(g)===-1&&(d.doplot=!0):d.doplot=!0,v.set(_)}}}var B=t._fullLayout.width,q=t._fullLayout.height;M.supplyDefaults(t),t.layout.autosize&&M.plotAutoSize(t,t.layout,t._fullLayout);var V=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==q;return V&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:m,redoit:p,eventData:x.extendDeep({},p)}}function m(t){var e=g.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];g.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(z.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var i=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=i.append("g").classed("imagelayer",!0),n._shapeLowerLayer=i.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var a=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=a.append("g").classed("imagelayer",!0),n._shapeUpperLayer=a.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var g=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),_=t("../lib/events"),b=t("../lib/queue"),w=t("../registry"),M=t("../plots/plots"),k=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),S=t("../components/drawing"),T=t("../components/errorbars"),z=t("../constants/xmlns_namespaces"),E=t("../lib/svg_text_utils"),L=t("./helpers"),I=t("./subroutines");y.plot=function(t,e,n,r){function o(){if(b)return y.addFrames(t,b)}function s(){for(var e=D._basePlotModules,n=0;n=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=L.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),n=M.supplyAnimationDefaults(n);var s=n.transition,l=n.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function m(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var g,v,y=0,_=[],b=void 0===e||null===e,w=Array.isArray(e),k=!b&&!w&&x.isPlainObject(e);if(k)_.push({type:"object",data:m(x.extendFlat({},e))});else if(b||"string"==typeof e)for(g=0;g0&&T<_.length-1){var z=[];for(g=0;g<_.length;g++)v=_[g],("byname"!==_[g].type||g>T)&&z.push(v);_=z}}_.length>0?f(_):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,n){if(t=L.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(r=e.length-1;r>=0;r--)c.push({frame:M.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:u+r});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(i=c[r].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;n--)r=e[n],a.push({type:"delete",index:r}),o.unshift({type:"insert",index:r,value:i[r]});var s=M.modifyFrames,l=M.modifyFrames,u=[t,o],c=[t,a];return b&&b.add(t,s,u,l,c),M.modifyFrames(t,a)},y.purge=function(t){t=L.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return M.cleanPlot([],{},n,e),M.purge(t),_.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":246,"../components/errorbars":252,"../constants/xmlns_namespaces":305,"../lib":316,"../lib/events":311,"../lib/queue":324,"../lib/svg_text_utils":328,"../plotly":338,"../plots/cartesian/graph_interact":350,"../plots/plots":374,"../plots/polar":377,"../registry":382,"./helpers":329,"./subroutines":335,d3:8,"fast-isnumeric":12}],331:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],332:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:y},n={}):(e=h.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,b(r,p),b(r,e.attributes),n.attributes&&b(r,n.attributes),r.type=t;var i={meta:e.meta||{},attributes:o(r)};if(e.layoutAttributes){var a={};b(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return b(t,m),Object.keys(h.subplotsRegistry).forEach(function(e){var n=h.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)c(t,n,"xaxis"),c(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;c(t,n,r)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.layoutAttributes&&(Array.isArray(n.layoutNodes)?n.layoutNodes.forEach(function(e){f(t,n,e+n.name)}):f(t,n,n.name))}),{layoutAttributes:o(t)}}function a(t){var e=h.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function r(t,r,i){n.isValObject(t)?"data_array"===t.valType?(t.role="data",i[r+"src"]=e(r)):t.arrayOk===!0&&(i[r+"src"]=e(r)):d.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function l(t){function e(t,e,n){if(t){var r=t[M];r&&(delete t[M],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function u(t){return _(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),_(t,x.layout),t}function c(t,e,n){var r=d.nestedProperty(t,n),i=b({},e.layoutAttributes);i[w]=!0,r.set(i)}function f(t,e,n){var r=d.nestedProperty(t,n),i=b(r.get()||{},e.layoutAttributes);r.set(i)}var h=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),m=t("../plots/layout_attributes"),g=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),_=d.extendFlat,b=d.extendDeep,w="_isSubplotObj",M="_isLinkedToArray",k="_deprecated",A=[w,M,k];n.IS_SUBPLOT_OBJ=w,n.IS_LINKED_TO_ARRAY=M,n.DEPRECATED=k,n.UNDERSCORE_ATTRS=A,n.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:A.concat.role},traces:t,layout:i(),transforms:e,frames:o(g),animation:o(v)}},n.crawl=function(t,e,r){var i=r||0;Object.keys(t).forEach(function(r){var a=t[r];A.indexOf(r)===-1&&(e(a,r,t,i),n.isValObject(a)||d.isPlainObject(a)&&n.crawl(a,e,i+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,o,s){a=a.slice(0,s).concat([n]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=r(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function r(t){return t.join(".")}var i=[],a=[];if(n.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};h(e.width)&&h(e.height)||r(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var m=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(m).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=r},{"../lib":316,"../plotly":338,"../snapshot/cloneplot":383,"../snapshot/helpers":386,"../snapshot/svgtoimg":388,"../snapshot/tosvg":390,"fast-isnumeric":12}],337:[function(t,e,n){"use strict";function r(t,e,n,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,g=n.length,v=0;vc&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=L&&i<=10||e>=15*L)t._tickround="d";else if(e>=D&&i<=16||e>=I)t._tickround="M";else if(e>=P&&i<=19||e>=D)t._tickround="S";else{var a=b.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(x(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var n=t.match(Y),r=new Date(e);if(n){var i=Math.min(+n[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,a))(r)}return y.time.format(t)(r)}function s(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function l(t,e,n,r){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);n&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(r&&(x(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=V(c):"m"===l?a=U(c):"d"===l?(n||(i="
"+V(c)),a=G(c)):(n||(i="
"+H(c)),a=Z(c),"M"!==l?(a+=X(c),"S"!==l&&(a+=h(y.round(v(s/1e3,1),4),t,"none",n).substr(1))):"d"===u&&(a=G(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,n,r,i){var a=t.dtick,o=e.x;if(!r||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,r);else if(x(a)||"D"===a.charAt(0)&&v(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,v(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,r)}function h(t,e,n,r){var i=t<0,o=e._tickround,s=n||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+m:"E"===s?t+="E"+m:"power"===s?t+="\xd710"+m+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=W[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var n,r,i=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},C.getAutoRange=function(t){var e,n=[],r=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(r===i){var m=r-1,g=r+1;n="tozero"===t.rangemode?r<0?[m,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,m),Math.max(0,g)]:[m,g]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),n=[l.val-h*l.pad,u.val+h*u.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),d&&n.reverse(),n.map(t.l2r||Number)},C.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=C.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},C.saveRangeInitial=function(t,e){for(var n=C.list(t,"",!0),r=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(r(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,m,g=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),_=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),b=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),M=r(n.vpadminus||n.vpad);for(a=0;a<6;a++)i(a);for(a=g-1;a>5;a--)i(a)}},C.autoBin=function(t,e,n,r){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=b.aggNums(Math.min,null,t),o=b.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(n)s=(o-a)/n;else{var l=b.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*b.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*b.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},C.autoTicks(f,s);var h,d=C.tickIncrement(C.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,m=0,g=0,v=0,y=0;y.3*_||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&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),a(t),t._tmin=C.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=C.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),f=0;fz?(e/=z,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,n,F)):r>E?(e/=E,t.dtick="M"+i(e,1,R)):r>L?(t.dtick=i(e,L,N),t.tick0="2000-01-02"):r>I?t.dtick=i(e,I,R):r>D?t.dtick=i(e,D,j):r>P?t.dtick=i(e,P,j):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,F))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,n,F)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,F));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},C.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var i=e.charAt(0),a=r*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?q:B,l=t+.01*r,u=b.roundUp(v(l,1),s,n);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},C.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]a:f1&&e2*r}function a(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,i=0,a=0;a2*r}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":303,"../../lib":316,"fast-isnumeric":12}],345:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var s=o(e,n,r);if(s){if("histogram"===s.type&&r==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,r)){for(var l,c=i(s),f=[],h=0;h0;a&&(r="array");var o=n("categoryorder",r);"array"===o&&n("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],348:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],349:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],i=Math.abs(r-t.range[1-e]);return"date"===t.type?r:"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(n)+"g")(r))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),m=t("../../lib/setcursor"),g=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),_=!0;e.exports=function(t,e,n,s,b,w,M,k){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+mt+", "+gt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+mt+", "+gt+")").attr("d","M0,0Z"),z()}function z(){pt.selectAll(".select-outline").remove()}function E(e,n){if(t._transitioningWithDuration)return!1;var r=Math.max(0,Math.min(U,e+at)),i=Math.max(0,Math.min(G,n+ot)),a=Math.abs(r-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,Z)/2);st.l=Math.min(at,r),st.r=Math.max(at,r),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!K||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function L(t,e,n){var r,i,a;for(r=0;rzoom back out","long"),_=!1)))}function D(e,n){var i=1===(M+k).length;if(e)R();else if(2!==n||i){if(1===n&&i){var a=M?V[0]:q[0],o="s"===M||"w"===k?0:1,s=a._name+".range["+o+"]",l=r(a,o),c="left",f="middle";if(a.fixedrange)return;M?(f="n"===M?"top":"bottom","right"===a.side&&(c="right")):"e"===k&&(c="right"),nt.call(h.makeEditable,null,{immediate:!0,background:N.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var n=a.d2r(e);void 0!==n&&u.relayout(t,s,n)})}}else F()}function P(e){function n(t,e,n){function r(e){return t.l2r(a+(e-a)*n)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(r)}}if(t._context.scrollZoom||N._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(S(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void f.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=_t.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=vt[0]+vt[2]*l,c=(s.bottom-e.clientY)/s.height,h=vt[1]+vt[3]*(1-c);if(k){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,n){for(var r,a,o=1-e,s=0;s0;r--)n.push(e);return n}function i(t,e){for(var n=[],r=0;rY.width||X<0||X>Y.height)return b.unhoverRaw(t,e)}else Z="xpx"in e?e.xpx:k[0]._length/2,X="ypx"in e?e.ypx:A[0]._length/2;if(I="xval"in e?r(a,e.xval):i(k,Z),D="yval"in e?r(a,e.yval):i(A,X),!m(I[0])||!m(D[0]))return g.warn("Fx.hover failed",e,t),b.unhoverRaw(t,e)}var W=1/0;for(C=0;C1||F.hoverinfo.indexOf("name")!==-1?F.name:void 0,index:!1,distance:Math.min(W,M.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[R]&&(V.subplot=o[R]._subplot),U=G.length,"array"===N){var Q=e[C];"pointNumber"in Q?(V.index=Q.pointNumber,N="closest"):(N="","xval"in Q&&(B=Q.xval,N="x"),"yval"in Q&&(q=Q.yval,N=N?"closest":"y"))}else B=I[j],q=D[j];if(F._module&&F._module.hoverPoints){var J=F._module.hoverPoints(V,B,q,N);if(J)for(var $,K=0;KU&&(G.splice(0,U),W=G[0].distance)}if(0===G.length)return b.unhoverRaw(t,e);var tt="y"===L&&H.length>1;G.sort(function(t,e){return t.distance-e.distance});var et=x.combine(o.plot_bgcolor||x.background,o.paper_bgcolor),nt={hovermode:L,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},rt=u(G,nt);c(G,tt?"xa":"ya"),f(rt,tt);var it=t._hoverdata,at=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,n=c.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[i+"Label"]===m?r=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",u).call(_.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(_.setPosition,0,0);var h=e.select("text.name"),g=0;n&&n!==r?(h.style("fill",l).text(n).call(_.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(_.setPosition,0,0),g=h.node().getBoundingClientRect().width+2*P):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var v,M,S=f.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,E=t.ya._offset+(t.y0+t.y1)/2,L=Math.abs(t.x1-t.x0),I=Math.abs(t.y1-t.y0),C=S.width+D+P+g;t.ty0=b-S.top,t.bx=S.width+2*P,t.by=S.height+2*P,t.anchor="start",t.txwidth=S.width,t.tx2width=g,t.offset=0,a?(t.pos=z,v=E+I/2+C<=k,M=E-I/2-C>=0,"top"!==t.idealAlign&&v||!M?v?(E+=I/2,t.anchor="start"):t.anchor="middle":(E-=I/2,t.anchor="end")):(t.pos=E,v=z+L/2+C<=w,M=z-L/2-C>=0,"left"!==t.idealAlign&&v||!M?v?(z+=L/2,t.anchor="start"):t.anchor="middle":(z-=L/2,t.anchor="end")),f.attr("text-anchor",t.anchor),g&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+E+")"+(a?"rotate("+T+")":""))}),E}function c(t,e){function n(t){var e=t[0],n=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,a=n.pos+n.dp+n.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;r=!1}if(!(a<.01)){if(i<-.01){for(s=t.length-1;s>=0;s--)t[s].dp-=a;r=!1}if(r){var u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var r,i,a,o,s,l,u,c=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?E:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&c<=t.length;){for(c++,r=!0,o=0;o.01&&p.pmin===m.pmin&&p.pmax===m.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;r=!1}else o++}f.forEach(n)}for(o=f.length-1;o>=0;o--){var g=f[o];for(s=g.length-1;s>=0;s--){var v=g[s],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var n=d.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,i=n.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(D+P),s=o+a*(t.txwidth+P),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-I,l=t.offset*L),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*D+l)+","+(D+u)+"v"+(t.by/2-D)+"h"+r*t.bx+"v-"+t.by+"H"+(r*D+l)+"V"+(u-D)+"Z"),i.call(_.setPosition,o+l,u+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(_.setPosition,s+a*P+l,u+t.ty0-t.by/2+P),n.select("rect").call(_.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var i=n[r],a=t._hoverdata[r];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),m=t("fast-isnumeric"),g=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),_=t("../../components/drawing"),b=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),k=t("./dragbox"),A=t("../layout_attributes"),S=e.exports={};S.unhover=b.unhover,S.layoutAttributes={},S.supplyLayoutDefaults=function(t,e,n){function r(n,r){return g.coerce(t,e,A,n,r)}r("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=S.isHoriz(n);i=a?"y":"x"}else i="closest";r("hovermode",i)},S.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+M.HOVERMINTIME?(o(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},S.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||a(e,n):"x"===t?e:n},S.getClosest=function(t,e,n){ +if(n.index!==!1)n.index>=0&&n.indexf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":316,"fast-isnumeric":12}],356:[function(t,e,n){"use strict";function r(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,n,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function d(t,e){return t-e}var p,m=i.gd._fullLayout._zoomlayer,g=i.element.getBoundingClientRect(),v=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,x=e-g.left,_=n-g.top,b=x,w=_,M="M"+x+","+_,k=i.xaxes[0]._length,A=i.yaxes[0]._length,S=i.xaxes.map(r),T=i.yaxes.map(r),z=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[x,_]],s.BENDPX));var E=m.selectAll("path.select-outline").data([1,2]);E.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",M+"Z");var L,I,D,P,C,O=m.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),F=[],R=i.gd,j=[];for(L=0;L0)return Math.log(e)/Math.LN10;if(e<=0&&n&&t.range&&2===t.range.length){var r=t.range[0],i=t.range[1];return.5*(r+i-3*f*Math.abs(r-i))}return l}function n(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var f=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?n:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var n,r,o=t[e],l=(t._id||"x").charAt(0);if(r="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,r=r.slice(),!o||2!==o.length)return void(t[e]=r);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),n=0;n<2;n++)if("date"===t.type){if(!a.isDateTime(o[n])){t[e]=r;break}if(o[n]a.MAX_MS&&(o[n]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[n])){if(!i(o[1-n])){t[e]=r;break}o[n]=o[1-n]*(n?10:.1)}if(o[n]<-s?o[n]=-s:o[n]>s&&(o[n]=s),o[0]===o[1]){var f=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=f,o[1]+=f}}},t.fraction2r=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return t.l2r(n+e*(r-n))},t.r2fraction=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return(t.r2l(e)-n)/(r-n)},t.setScale=function(e){var n=t._gd._fullLayout._size,r=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===r?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?r.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,n){return t.l2p(t.r2l(e,n))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,n){return t.c2l(t.d2c(e),n)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var n=t._categories.indexOf(e);return n===-1?l:n},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,n){var r,i,a;if(n in e)for(r=e[n],i=new Array(r.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var f=c.charAt(0),h=c.substr(1);h=r(h)?Number(h):0,(h<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=n("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):r(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var m=n("tickvals");void 0===m?e.tickmode="auto":n("ticktext")}}},{"../../constants/numerical":303,"../../lib":316,"fast-isnumeric":12}],361:[function(t,e,n){"use strict";var r=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,n,u){function c(t){var e,n,r,i,a,o={};for(e in t)if(n=e.split("."),r=n[0].match(l)){var s=r[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,x.push(s),o[s]=a}return o}function f(t,e,n){var r,i,a,o=t._plots,s=[];for(r in o){var l=o[r];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=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=n[u]?n[u].to:f,a=n[c]?n[c].to:h,f[0]===i[0]&&f[1]===i[1]&&h[0]===a[0]&&h[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function h(e,n){function r(e,n){for(i=0;in.duration?(m(),S=window.cancelAnimationFrame(v)):S=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],_=c(e),b=Object.keys(_),w=f(y,b,_);if(!w.length)return!1;var M;u&&(M=u());var k,A,S,T=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(S),S=null,g()}),k=Date.now(),S=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":316,"../../plotly":338,"../../registry":382,"./axes":343,d3:8}],362:[function(t,e,n){"use strict";function r(t,e,n){var r,i,a,o=!1;if("data"===e.type)r=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;r=t._fullLayout}return i=u.nestedProperty(r,e.prop).get(),a=n[e.type]=n[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var n=[],r=e[0],i={};if("string"==typeof r)i[r]=e[1];else{if(!u.isPlainObject(r))return n;i=r}return s(i,function(t,e,r){n.push({type:"layout",prop:t,value:r})},"",0),n}function o(t,e){var n,r,i,a,o=[];if(r=e[0],i=e[1],n=e[2],a={},"string"==typeof r)a[r]=i;else{if(!u.isPlainObject(r))return o;a=r,void 0===n&&(n=i)}return void 0===n&&(n=null),s(a,function(e,r,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);n&&(s=Math.min(s,n.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,r+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");n.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=n.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){r(t,l,o.cache),o.check=function(){if(s){var e=r(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f0}function a(t){var e={},n={};switch(t.type){case"circle":s.extendFlat(n,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":s.extendFlat(n,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":s.extendFlat(n,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var r=t.symbol,i=l(r.textposition,r.iconsize); +s.extendFlat(e,{"icon-image":r.icon+"-15","icon-size":r.iconsize/10,"text-field":r.text,"text-size":r.textfont.size,"text-anchor":i.anchor,"text-offset":i.offset}),s.extendFlat(n,{"icon-color":t.color,"text-color":r.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:n}}function o(t){var e,n=t.sourcetype,r=t.source,i={type:n},a="string"==typeof r;return"geojson"===n?e="data":"vector"===n&&(e=a?"url":"tiles"),i[e]=r,i}var s=t("../../lib"),l=t("./convert_text_opts"),u=r.prototype;u.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)&&this.updateLayer(t):(this.updateSource(t),this.updateLayer(t)),this.updateStyle(t),this.visible=i(t)},u.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},u.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},u.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,i(t)){var n=o(t);e.addSource(this.idSource,n)}},u.updateLayer=function(t){var e=this.map;if(e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,i(t)){e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type},t.below);var n={visibility:"visible"};this.mapbox.setOptions(this.idLayer,"setLayoutProperty",n)}},u.updateStyle=function(t){var e=a(t);i(t)&&(this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint))},u.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)},e.exports=function(t,e,n){var i=new r(t,e);return i.update(n),i}},{"../../lib":316,"./convert_text_opts":367}],370:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("../../components/color").defaultLine,a=t("../font_attributes"),o=t("../../traces/scatter/attributes").textposition;e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},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:r.extendDeep({},a,{family:{dflt:"Open Sans Regular, Arial Unicode MS Regular"}}),textposition:r.extendFlat({},o,{arrayOk:!1})}}}},{"../../components/color":223,"../../lib":316,"../../traces/scatter/attributes":393,"../font_attributes":363}],371:[function(t,e,n){"use strict";function r(t,e,n){n("accesstoken"),n("style"),n("center.lon"),n("center.lat"),n("zoom"),n("bearing"),n("pitch"),i(t,e),e._input=t}function i(t,e){function n(t,e){return a.coerce(r,i,s.layers,t,e)}for(var r,i,o=t.layers||[],l=e.layers=[],u=0;u=e.width-20?(a["text-anchor"]="start",a.x=5):(a["text-anchor"]="end",a.x=e._paper.attr("width")-7),n.attr(a);var o=n.select(".js-link-to-tool"),s=n.select(".js-link-spacer"),u=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=l.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=r.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),n._initialAutoSizeIsDone){var u=n.width,f=n.height;p.supplyLayoutGlobalDefaults(a,r),a.width||(r.width=u),a.height||(r.height=f)}else{p.supplyLayoutGlobalDefaults(a,r);var h=!a.width||!a.height,d=r.autosize,m=t._context&&t._context.autosizable,g=h&&(d||m);g?p.plotAutoSize(t,a,r):h&&p.sanitizeMargins(t),!d&&h&&(a.width=r.width,a.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=l.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,r),r._has=p._hasPlotType.bind(r);var v=r._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),f=c.left+c.right,d=c.bottom+c.top,m=1-2*o,g=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(m*(g.width-f)),i=Math.round(m*(g.height-d))}else{var v=l?window.getComputedStyle(t):{};r=parseFloat(v.width)||n.width,i=parseFloat(v.height)||n.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;r1,b=!e.height&&Math.abs(n.height-i)>1;(b||_)&&(_&&(n.width=r),b&&(n.height=i)),t._initialAutoSize||(t._initialAutoSize={width:r,height:i}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n,r){var i,a;c.Axes.supplyLayoutDefaults(t,e,n);var o=e._basePlotModules;for(i=0;i.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+i},r:{val:n.x,size:n.r+i},b:{val:n.y,size:n.b+i},t:{val:n.y,size:n.t+i}}}else delete r._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var n=l[t].l||{},r=l[t].b||{},c=n.val,f=n.size,h=r.val,d=r.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var n=l[t].r.val,r=l[t].r.size;if(n>c){var p=(f*n+(r-e.width)*c)/(n-c),m=(r*(1-c)+(f-e.width)*(1-n))/(n-c);p>=0&&m>=0&&p+m>i+a&&(i=p,a=m)}}if(u(d)&&l[t].t){var g=l[t].t.val,v=l[t].t.size;if(g>h){var y=(d*g+(v-e.height)*h)/(g-h),x=(v*(1-h)+(d-e.height)*(1-g))/(g-h);y>=0&&x>=0&&y+x>s+o&&(s=y,o=x)}}})})),n.l=Math.round(i),n.r=Math.round(a),n.t=Math.round(o),n.b=Math.round(s),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!t._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,n,r,i){function a(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,r,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):h.isJSDate(t)?h.ms2DateTime(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var n=a(t);return e&&delete n.fit,n})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===r?l:JSON.stringify(l)},p.modifyFrames=function(t,e){var n,r,i,a=t._transitionData._frames,o=t._transitionData._frameHash;for(n=0;n0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){b=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(n)for(s=0;s=0,E=z?f.angularAxis.domain:r.extent(k),L=Math.abs(k[1]-k[0]);S&&!A&&(L=0);var I=E.slice();T&&A&&(I[1]+=L);var D=f.angularAxis.ticksCount||4;D>8&&(D=D/(D/8)+D%8),f.angularAxis.ticksStep&&(D=(I[1]-I[0])/D);var P=f.angularAxis.ticksStep||(I[1]-I[0])/(D*(f.minorTicks+1));M&&(P=Math.max(Math.round(P),1)),I[2]||(I[2]=P);var C=r.range.apply(this,I);if(C=C.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=r.scale.linear().domain(I.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=T?L:0,e=r.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var O="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",F=(new DOMParser).parseFromString(O,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(F.documentElement,!0));e=r.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var j,N=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},q={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){j=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var n=o.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:j,elements:V,reverseOrder:f.legend.reverseOrder})})();var U=j.node().getBBox();x=Math.min(f.width-U.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),b=[f.margin.left+x,f.margin.top+x],i.range([0,x]),c.layout.radialAxis.domain=i.domain(),j.attr("transform","translate("+[b[0]+x,b[1]-x]+")")}else j=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),N.attr("transform","translate("+b+")").style({cursor:"crosshair"});var G=[(f.width-(f.margin.left+f.margin.right+2*x+(U?U.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(G[0]=Math.max(0,G[0]),G[1]=Math.max(0,G[1]),e.select(".outer-group").attr("transform","translate("+G+")"),f.title){var H=e.select("g.title-group text").style(q).text(f.title),Z=H.node().getBBox();H.attr({x:b[0]-Z.width/2,y:b[1]-x-20})}var X=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=X.selectAll("circle.grid-circle").data(i.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(B),Y.attr("r",i),Y.exit().remove()}X.select("circle.outside-circle").attr({r:x}).style(B);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=r.svg.axis().scale(i).ticks(5).tickSize(5);X.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),X.selectAll(".domain").style(B),X.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(q).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,q["font-size"]]+")":"translate("+[0,q["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var J=e.select(".angular.axis-group").selectAll("g.angular-tick").data(C),$=J.enter().append("g").classed("angular-tick",!0);J.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),J.exit().remove(),$.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),$.selectAll(".minor").style({stroke:f.minorTickColor}),J.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(q);var K=J.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=l(t,e),r=x+f.labelOffset,i=f.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-n+" "+r+" 0)":"radial"==i?n<270&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(n<=180&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":M?M[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(q);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=r.max(N.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(nt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),d[0]||et){var rt=[];d.forEach(function(t,e){var n={};n.radialScale=i,n.angularScale=s,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var it=r.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return a(o[n].defaultConfig(),t)});o[n]().config(r)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!A){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});N.on("mousemove.angular-guide",function(t,e){var n=o.util.getMousePos(W).angle;dt.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;ot=s.invert(r);var i=o.util.convertToCartesian(x+12,n+180);ct.text(o.util.round(ot)).move([i[0]+b[0],i[1]+b[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});N.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos(W).radius;pt.attr({r:n}).style({opacity:.5}),st=i.invert(o.util.getMousePos(W).radius);var r=o.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(o.util.round(st)).move([r[0]+b[0],r[1]+b[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var i=r.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=r.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};A&&(u.t=M[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-G[0]-h.left,f.top+f.height/2-G[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=r.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==r.event.which&&void(r.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.hide();var n=r.select(this),i=n.attr("data-fill");i?n.style({fill:i,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),h}var e,n,i,s,l={data:[],layout:{}},u={},c={},f=r.dispatch("hover"),h={};return h.render=function(e){return t(e),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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return i},h.angularScale=function(t){return s},h.svg=function(){return e},r.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:r.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},o.util._extend=function(t,e){for(var n in t)e[n]=t[n]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var n=e||6,i=r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,i=t(r);return[e,i]});return i},o.util.dataFromEquation=function(t,e,n){var i=e||6,a=[],o=[];r.range(0,360+i,i).forEach(function(e,n){var r=e*Math.PI/180,i=t(r);a.push(e),o.push(i)});var s={t:a,r:o};return n&&(s.name=n),s},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return r.range(e).map(function(t,e){return n[e]||n[0]})},o.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=o.util.ensureArray(t[e],n)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},o.util.sumArrays=function(t,e){return r.zip(t,e).map(function(t,e){return r.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return n===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),i=t*Math.sin(n);return[r,i]},o.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},o.util.getMousePos=function(t){var e=r.mouse(t.node()),n=e[0],i=e[1],a={};return a.x=n,a.y=i,a.pos=e,a.angle=180*(Math.atan2(i,n)+Math.PI)/Math.PI,a.radius=Math.sqrt(n*n+i*i),a},o.util.duplicatesCount=function(t){for(var e,n={},r={},i=0,a=t.length;i0)){var s=r.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:h(o),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return g.fill(n,i,a)},"fill-opacity":0,stroke:function(t,e){return g.stroke(n,i,a)},"stroke-width":function(t,e){return g["stroke-width"](n,i,a)},"stroke-dasharray":function(t,e){return g["stroke-dasharray"](n,i,a)},opacity:function(t,e){return g.opacity(n,i,a)},display:function(t,e){return g.display(n,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,m=r.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,i){r.select(this).attr({class:"mark arc",d:m,transform:function(e,n){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var g={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return s[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},v=r.select(this).selectAll("g.layer").data(l);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(g).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,n=[o.PolyChart.defaultConfig()],i=r.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),a(n[e],o.PolyChart.defaultConfig()),a(n[e],t)}),this):n},t.getColorScale=function(){return e},r.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var n=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var i=a({},n.elements[e]);return i.name=t,i.color=[].concat(n.elements[e].color)[r],i})}),o=r.merge(i);o=o.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(o=o.reverse());var s=n.container;("string"==typeof s||s.nodeName)&&(s=r.select(s));var l=o.map(function(t,e){return t.color}),u=n.fontSize,c=null==n.isContinuous?"number"==typeof o[0]:n.isContinuous,f=c?n.height:u*o.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.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"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var m=r.range(o.length),g=r.scale[c?"linear":"ordinal"]().domain(m).range(l),v=r.scale[c?"linear":"ordinal"]().domain(m)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":r.svg.symbolTypes.indexOf(t)!=-1?r.svg.symbol().type(t).size(n)():r.svg.symbol().type("square").size(n)()};if(c){var x=d.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}}),d.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var _=d.select(".legend-marks").selectAll("path.legend-mark").data(o);_.enter().append("path").classed("legend-mark",!0),_.attr({transform:function(t,e){return"translate("+[u/2,v(e)+u/2]+")"},d:function(t,e){var n=t.symbol;return y(n,u)},fill:function(t,e){return g(e)}}),_.exit().remove()}var b=r.svg.axis().scale(v).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?n.colorBandWidth:u,u/2]+")"}).call(b);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),n=r.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},r.rebind(t,n,"on"),t},o.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},o.tooltipPanel=function(){var t,e,n,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var r=t.enter().append("g").classed(s,!0).style({"pointer-events":"none",display:"none"});return n=r.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=r.append("text").attr({dx:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=r.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(f);var h=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},m=d.width+2*h+l,g=d.height+2*h;return n.attr({d:"M"+[[l,-g/2],[l,-g/4],[i.hasTick?0:l,0],[l,g/4],[l,g/2],[m,g/2],[m,-g/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-g/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=a({},t),i=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var r=i.indexOf(t.geometry);r!=-1&&(n.data[e].groupId=r)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};r.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}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),n.layout=s}return n},t}},{"../../lib":316,d3:8}],379:[function(t,e,n){"use strict";var r=t("d3"),i=t("../../lib"),a=t("../../components/color"),o=t("./micropolar"),s=t("./undo_manager"),l=i.extendDeepAll,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(f=i),r.select(r.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?l(n,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(n),a.config(c).render(f),t.data=n.data,t.layout=n.layout,u.fillLayout(t),n}var n,i,a,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(n);!function(e,n){h.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},u.fillLayout=function(t){var e=r.select(t).selectAll(".plot-container"),n=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:n,_paper:i};t._fullLayout=l(o,t.layout)}},{"../../components/color":223,"../../lib":316,"./micropolar":378,"./undo_manager":380,d3:8}],380:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,n=[],r=-1,i=!1;return{add:function(t){return i?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=n[r];return i?(t(i,"undo"),r-=1,e&&e(i.undo),this):this},redo:function(){var i=n[r+1];return i?(t(i,"redo"),r+=1,e&&e(i.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return r!==-1},hasRedo:function(){return r-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,a=t.data,u=t.layout,c=l([],a),f=l({},u,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(n=0;np&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var m={padded:!0},g={padded:!0};if(o.hasMarkers(e)){if(n=e.marker,l=n.size,Array.isArray(l)){var v={type:"linear"};i.setConvert(v),l=v.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},m.ppad=g.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(m.padded=!1,m.ppad=0):m.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(g.padded=!1):g.tozero=!0,i.expand(c,h,m),i.expand(f,d,g);var _=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===n.xaxis&&a.yaxis===n.yaxis){a.opacity=void 0;break}}}}}},{}],396:[function(t,e,n){"use strict";var r=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 n=e[0].trace,l=n.marker,u="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;r(f)||(f=i.aggNums(Math.min,null,c)),r(h)||(h=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":226,"../../components/colorscale":237,"../../lib":316,"../../plots/plots":374,"fast-isnumeric":12}],397:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),a=t("./subtypes");e.exports=function(t){a.hasLines(t)&&r(t,"line")&&i(t,t.line.color,"line","c"),a.hasMarkers(t)&&(r(t,"marker")&&i(t,t.marker.color,"marker","c"),r(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":229,"../../components/colorscale/has_colorscale":236,"./subtypes":413}],398:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],399:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function m(n,a){return r.coerce(t,e,i,n,a)}var g=s(t,e,m),v=gq!=P>=q&&(L=z[S-1][0],I=z[S][0],E=L+(I-L)*(q-D)/(P-D),R=Math.min(R,E),j=Math.max(j,E));R=Math.max(R,0),j=Math.min(j,h._length);var V=l.defaultLine;return l.opacity(f.fillcolor)?V=f.fillcolor:l.opacity((f.line||{}).color)&&(V=f.line.color),r.extendFlat(t,{distance:a.MAXDIST+10,x0:R,x1:j,y0:q,y1:q,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":223,"../../components/errorbars":252,"../../lib":316,"../../plots/cartesian/constants":348,"../../plots/cartesian/graph_interact":350,"./get_trace_color":401}],403:[function(t,e,n){"use strict";var r={},i=t("./subtypes");r.hasLines=i.hasLines,r.hasMarkers=i.hasMarkers,r.hasText=i.hasText,r.isBubble=i.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.animatable=!0,r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":351,"./arrays_to_calcdata":392,"./attributes":393,"./calc":394,"./clean_data":395,"./colorbar":396,"./defaults":399,"./hover":402,"./plot":410,"./select":411,"./style":412,"./subtypes":413}],404:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,n,a,o){var s=(t.marker||{}).color;if(o("line.color",n),r(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||n;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":232,"../../components/colorscale/has_colorscale":236}],405:[function(t,e,n){"use strict";var r=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),i=M.c2p(t[e].y);return n!==r&&i!==r&&[n,i]}function i(t){var e=t[0]/w._length,n=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*S}function a(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var o,s,l,u,c,f,h,d,p,m,g,v,y,x,_,b,w=e.xaxis,M=e.yaxis,k=e.simplify,A=e.connectGaps,S=e.baseTolerance,T=e.linear,z=[],E=.2,L=new Array(t.length),I=0;for(k||(S=E=-1),o=0;oi(f))break;l=f,y=m[0]*p[0]+m[1]*p[1],y>g?(g=y,u=f,d=!1):y=t.length||!f)break;L[I++]=f,s=f}}else L[I++]=u}z.push(L.slice(0,I))}return z}},{"../../constants/numerical":303}],406:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],407:[function(t,e,n){"use strict";e.exports=function(t,e,n){for(var r,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":12}],409:[function(t,e,n){"use strict";var r=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,n,s,l){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(n=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",n),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?r.background:r.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":223,"../../components/colorscale/defaults":232,"../../components/colorscale/has_colorscale":236,"./subtypes":413}],410:[function(t,e,n){"use strict";function r(t,e){var n;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(n=t[0].trace,n._nexttrace){if(n._nextFill=e.select(".js-fill.js-tonext"),!n._nextFill.size()){var r=":first-child";e.select(".js-fill.js-tozero").size()&&(r+=" + *"),n._nextFill=e.insert("path",r).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),n._nextFill=null;n.fill&&("tozero"===n.fill.substr(0,6)||"toself"===n.fill||"to"===n.fill.substr(0,2)&&!n._prevtrace)?(n._ownFill=e.select(".js-fill.js-tozero"),n._ownFill.size()||(n._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),n._ownFill=null)})}function i(t,e,n,r,i,d,m){function g(t){return k?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function _(){return!1}function b(t){var e,n,r=t[0].trace,i=o.select(this),a=c.hasMarkers(r),u=c.hasText(r),f=x(r),h=_,d=_;a&&(h=r.marker.maxdisplayed?v:s.identity),u&&(d=r.marker.maxdisplayed?v:s.identity),n=i.selectAll("path.point"),e=n.data(h,f);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,r).call(l.translatePoints,A,S,r),k&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=g(o.select(this));l.translatePoint(t,e,A,S),l.singlePointStyle(t,e,r)}),k?e.exit().transition().style("opacity",0).remove():e.exit().remove(),n=i.selectAll("g"),e=n.data(d,f),e.enter().append("g").append("text"),e.each(function(t){var e=g(o.select(this).select("text"));l.translatePoint(t,e,A,S)}),e.selectAll("text").call(l.textPointStyle,r).each(function(t){var e=t.xp||A.c2p(t.x),n=t.yp||S.c2p(t.y);o.select(this).selectAll("tspan").each(function(){g(o.select(this)).attr({x:e,y:n})})}),e.exit().remove()}var w,M;a(t,e,n,r,i);var k=!!m&&m.duration>0,A=n.xaxis,S=n.yaxis,T=r[0].trace,z=T.line,E=o.select(d);if(E.call(u.plot,n,m),T.visible===!0){g(E).style("opacity",T.opacity);var L,I,D=T.fill.charAt(T.fill.length-1);"x"!==D&&"y"!==D&&(D=""),r[0].node3=E,f(r);var P="",C=[],O=T._prevtrace;O&&(P=O._prevRevpath||"",I=O._nextFill,C=O._polygons);var F,R,j,N,B,q,V,U,G,H="",Z="",X=[],Y=[],W=s.noop;if(L=T._ownFill,c.hasLines(T)||"none"!==T.fill){for(I&&I.datum(r),["hv","vh","hvh","vhv"].indexOf(z.shape)!==-1?(j=l.steps(z.shape),N=l.steps(z.shape.split("").reverse().join(""))):j=N="spline"===z.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),z.smoothing):l.smoothopen(t,z.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return N(t.reverse())},X=h(r,{xaxis:A,yaxis:S,connectGaps:T.connectgaps,baseTolerance:Math.max(z.width||1,3)/4,linear:"linear"===z.shape,simplify:z.simplify}),G=T._polygons=new Array(X.length),M=0;M1}),W=function(t){return function(e){if(F=j(e),R=B(e),H?D?(H+="L"+F.substr(1),Z=R+("L"+Z.substr(1))):(H+="Z"+F,Z=R+"Z"+Z):(H=F,Z=R),c.hasLines(T)&&e.length>1){var n=o.select(this);if(n.datum(r),t)g(n.style("opacity",0).attr("d",F).call(l.lineGroupStyle)).style("opacity",1);else{var i=g(n);i.attr("d",F),l.singleLineStyle(r,i)}}}}}var Q=E.selectAll(".js-line").data(Y);g(Q.exit()).style("opacity",0).remove(),Q.each(W(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(W(!0)),X.length&&(L?q&&U&&(D?("y"===D?q[1]=U[1]=S.c2p(0,!0):"x"===D&&(q[0]=U[0]=A.c2p(0,!0)),g(L).attr("d","M"+U+"L"+q+"L"+H.substr(1))):g(L).attr("d",H+"Z")):"tonext"===T.fill.substr(0,6)&&H&&P&&("tonext"===T.fill?g(I).attr("d",H+"Z"+P+"Z"):g(I).attr("d",H+"L"+P.substr(1)+"Z"),T._polygons=T._polygons.concat(C)),T._prevRevpath=Z,T._prevPolygons=G);var J=E.selectAll(".points");w=J.data([r]),J.each(b),w.enter().append("g").classed("points",!0).each(b),w.exit().remove()}}function a(t,e,n,r,i){var a=n.xaxis,s=n.yaxis,l=o.extent(a.range.map(a.r2l).map(a.l2c)),u=o.extent(s.range.map(s.r2l).map(s.l2c)),f=r[0].trace;if(c.hasMarkers(f)){var h=f.marker.maxdisplayed;if(0!==h){var d=r.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/h),m=0;i.forEach(function(t,n){var r=t[0].trace;c.hasMarkers(r)&&r.marker.maxdisplayed>0&&n0;for(c=p.selectAll("g.trace"),f=c.data(n,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,n),r(t,p),l=0,u=[];lr?1:-1}),g){s&&(h=s());var v=o.transition().duration(a.duration).ease(a.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()});v.each(function(){p.selectAll("g.trace").each(function(r,o){i(t,o,e,r,n,this,a)})})}else p.selectAll("g.trace").each(function(r,o){i(t,o,e,r,n,this,a)});m&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":246,"../../components/errorbars":252,"../../lib":316,"../../lib/polygon":323,"./arrays_to_calcdata":392,"./line_points":405,"./link_traces":407,"./subtypes":413,d3:8}],411:[function(t,e,n){"use strict";var r=t("./subtypes"),i=.2;e.exports=function(t,e){var n,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,m=!r.hasMarkers(h)&&!r.hasText(h);if(h.visible===!0&&!m){var g=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;n0&&(v[y-1].gapAfter=!0)}return v}},{"../../components/colorscale":237,"../../lib":316,"../scatter/colorscale_calc":397,"../scatter/make_bubble_size_func":408,"../scatter/subtypes":413,"fast-isnumeric":12}],419:[function(t,e,n){"use strict";function r(){return{geojson:f.makeBlank(),layout:{visibility:"none"},paint:{}}}function i(t,e){function n(t,n,r,i){void 0===e[n][r]&&(e[n][r]=i),t[n]=e[n][r]}for(var r=t[0].trace,i=r.marker,a=Array.isArray(i.color),o=Array.isArray(i.size),s=[],l=0;l")}var i=t("../../plots/cartesian/graph_interact"),a=t("../scatter/get_trace_color");e.exports=function(t,e,n){function o(t){var e=t.lonlat,r=Math.abs(u.c2p(e)-u.c2p([d,e[1]])),i=Math.abs(c.c2p(e)-c.c2p([e[0],n])),a=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(r*r+i*i)-a,1-3/a)}var s=t.cd,l=s[0].trace,u=t.xa,c=t.ya;if(!s[0].placeholder){var f=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),h=360*f,d=e-h;if(i.getClosest(s,o,t),t.index!==!1){var p=s[t.index],m=p.lonlat,g=[m[0]+h,m[1]],v=u.c2p(g),y=c.c2p(g),x=p.mrc||1;return t.x0=v-x,t.x1=v+x,t.y0=y-x,t.y1=y+x,t.color=a(l,p),t.extraText=r(l,p),[t]}}}},{"../../plots/cartesian/graph_interact":350,"../scatter/get_trace_color":401}],423:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../scatter/colorbar"),r.calc=t("./calc"),r.hoverPoints=t("./hover"),r.eventData=t("./event_data"),r.plot=t("./plot"),r.moduleType="trace",r.name="scattermapbox",r.basePlotModule=t("../../plots/mapbox"),r.categories=["mapbox","gl","symbols","markerColorscale","showLegend"],r.meta={},e.exports=r},{"../../plots/mapbox":368,"../scatter/colorbar":396,"./attributes":417,"./calc":418,"./defaults":420,"./event_data":421,"./hover":422,"./plot":424}],424:[function(t,e,n){"use strict";function r(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.mapbox.initSource(this.idSourceFill),this.mapbox.initSource(this.idSourceLine),this.mapbox.initSource(this.idSourceCircle),this.mapbox.initSource(this.idSourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle,source:this.idSourceCircle,type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var a=t("./convert"),o=r.prototype;o.update=function(t){var e=this.mapbox,n=a(t);e.setOptions(this.idLayerFill,"setLayoutProperty",n.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",n.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",n.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",n.symbol.layout),i(n.fill)&&(e.setSourceData(this.idSourceFill,n.fill.geojson),e.setOptions(this.idLayerFill,"setPaintProperty",n.fill.paint)),i(n.line)&&(e.setSourceData(this.idSourceLine,n.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",n.line.paint)),i(n.circle)&&(e.setSourceData(this.idSourceCircle,n.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",n.circle.paint)),i(n.symbol)&&(e.setSourceData(this.idSourceSymbol,n.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",n.symbol.paint))},o.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var n=e[0].trace,i=new r(t,n.uid);return i.update(e),i}},{"./convert":419}]},{},[4])(4)}); \ No newline at end of file diff --git a/dist/plotly-with-meta.js b/dist/plotly-with-meta.js index e7d23a4cfd8..ae3d4c2b912 100644 --- a/dist/plotly-with-meta.js +++ b/dist/plotly-with-meta.js @@ -1,5 +1,5 @@ /** -* plotly.js v1.19.2 +* plotly.js v1.20.0 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -68,7 +68,7 @@ for(var selector in rules) { Lib.addStyleRule(fullSelector, rules[selector]); } -},{"../src/lib":632}],2:[function(require,module,exports){ +},{"../src/lib":633}],2:[function(require,module,exports){ 'use strict'; module.exports = { @@ -201,7 +201,7 @@ module.exports = { module.exports = require('../src/traces/bar'); -},{"../src/traces/bar":752}],4:[function(require,module,exports){ +},{"../src/traces/bar":753}],4:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -214,7 +214,7 @@ module.exports = require('../src/traces/bar'); module.exports = require('../src/traces/box'); -},{"../src/traces/box":764}],5:[function(require,module,exports){ +},{"../src/traces/box":765}],5:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -227,7 +227,7 @@ module.exports = require('../src/traces/box'); module.exports = require('../src/traces/candlestick'); -},{"../src/traces/candlestick":772}],6:[function(require,module,exports){ +},{"../src/traces/candlestick":773}],6:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -240,7 +240,7 @@ module.exports = require('../src/traces/candlestick'); module.exports = require('../src/traces/choropleth'); -},{"../src/traces/choropleth":777}],7:[function(require,module,exports){ +},{"../src/traces/choropleth":778}],7:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -253,7 +253,7 @@ module.exports = require('../src/traces/choropleth'); module.exports = require('../src/traces/contour'); -},{"../src/traces/contour":784}],8:[function(require,module,exports){ +},{"../src/traces/contour":785}],8:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -279,7 +279,7 @@ module.exports = require('../src/core'); module.exports = require('../src/transforms/filter'); -},{"../src/transforms/filter":906}],10:[function(require,module,exports){ +},{"../src/transforms/filter":908}],10:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -292,7 +292,7 @@ module.exports = require('../src/transforms/filter'); module.exports = require('../src/transforms/groupby'); -},{"../src/transforms/groupby":907}],11:[function(require,module,exports){ +},{"../src/transforms/groupby":909}],11:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -305,7 +305,7 @@ module.exports = require('../src/transforms/groupby'); module.exports = require('../src/traces/heatmap'); -},{"../src/traces/heatmap":796}],12:[function(require,module,exports){ +},{"../src/traces/heatmap":797}],12:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -318,7 +318,7 @@ module.exports = require('../src/traces/heatmap'); module.exports = require('../src/traces/histogram'); -},{"../src/traces/histogram":807}],13:[function(require,module,exports){ +},{"../src/traces/histogram":809}],13:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -331,7 +331,7 @@ module.exports = require('../src/traces/histogram'); module.exports = require('../src/traces/histogram2d'); -},{"../src/traces/histogram2d":812}],14:[function(require,module,exports){ +},{"../src/traces/histogram2d":814}],14:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -344,7 +344,7 @@ module.exports = require('../src/traces/histogram2d'); module.exports = require('../src/traces/histogram2dcontour'); -},{"../src/traces/histogram2dcontour":816}],15:[function(require,module,exports){ +},{"../src/traces/histogram2dcontour":818}],15:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -415,7 +415,7 @@ module.exports = Plotly; module.exports = require('../src/traces/mesh3d'); -},{"../src/traces/mesh3d":820}],17:[function(require,module,exports){ +},{"../src/traces/mesh3d":822}],17:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -428,7 +428,7 @@ module.exports = require('../src/traces/mesh3d'); module.exports = require('../src/traces/ohlc'); -},{"../src/traces/ohlc":825}],18:[function(require,module,exports){ +},{"../src/traces/ohlc":827}],18:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -441,7 +441,7 @@ module.exports = require('../src/traces/ohlc'); module.exports = require('../src/traces/pie'); -},{"../src/traces/pie":833}],19:[function(require,module,exports){ +},{"../src/traces/pie":835}],19:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -454,7 +454,7 @@ module.exports = require('../src/traces/pie'); module.exports = require('../src/traces/pointcloud'); -},{"../src/traces/pointcloud":842}],20:[function(require,module,exports){ +},{"../src/traces/pointcloud":844}],20:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -467,7 +467,7 @@ module.exports = require('../src/traces/pointcloud'); module.exports = require('../src/traces/scatter3d'); -},{"../src/traces/scatter3d":872}],21:[function(require,module,exports){ +},{"../src/traces/scatter3d":874}],21:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -480,7 +480,7 @@ module.exports = require('../src/traces/scatter3d'); module.exports = require('../src/traces/scattergeo'); -},{"../src/traces/scattergeo":878}],22:[function(require,module,exports){ +},{"../src/traces/scattergeo":880}],22:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -493,7 +493,7 @@ module.exports = require('../src/traces/scattergeo'); module.exports = require('../src/traces/scattergl'); -},{"../src/traces/scattergl":883}],23:[function(require,module,exports){ +},{"../src/traces/scattergl":885}],23:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -506,7 +506,7 @@ module.exports = require('../src/traces/scattergl'); module.exports = require('../src/traces/scattermapbox'); -},{"../src/traces/scattermapbox":890}],24:[function(require,module,exports){ +},{"../src/traces/scattermapbox":892}],24:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -519,7 +519,7 @@ module.exports = require('../src/traces/scattermapbox'); module.exports = require('../src/traces/scatterternary'); -},{"../src/traces/scatterternary":896}],25:[function(require,module,exports){ +},{"../src/traces/scatterternary":898}],25:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -532,7 +532,7 @@ module.exports = require('../src/traces/scatterternary'); module.exports = require('../src/traces/surface'); -},{"../src/traces/surface":905}],26:[function(require,module,exports){ +},{"../src/traces/surface":907}],26:[function(require,module,exports){ 'use strict' module.exports = createCamera @@ -27683,8 +27683,8 @@ proto.draw = (function () { var scaleX = 2 * boundX / dataX var scaleY = 2 * boundY / dataY - var translateX = 2 * (bounds[0] - dataBox[0]) / dataX - 1 - var translateY = 2 * (bounds[1] - dataBox[1]) / dataY - 1 + var translateX = (bounds[0] - dataBox[0] - 0.5 * dataX) / boundX + var translateY = (bounds[1] - dataBox[1] - 0.5 * dataY) / boundY SCALE_HI[0] = scaleX SCALE_HI[1] = scaleY @@ -27723,7 +27723,7 @@ proto.draw = (function () { })() proto.drawPick = function (offset) { return offset } -proto.pick = function (x, y) { +proto.pick = function () { return null } @@ -27840,7 +27840,7 @@ function createError2D (plot, options) { module.exports = { - vertex: "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi;\nattribute vec2 positionLo;\nattribute vec2 pixelOffset;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvec2 project(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo;\n}\n\nvoid main() {\n vec3 scrPosition = vec3(\n project(scaleHi, translateHi, scaleLo, translateLo, positionHi, positionLo),\n 1);\n gl_Position = vec4(\n scrPosition.xy + scrPosition.z * pixelScale * pixelOffset,\n 0,\n scrPosition.z);\n}\n", + vertex: "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi;\nattribute vec2 positionLo;\nattribute vec2 pixelOffset;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvec2 project(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\nvoid main() {\n vec3 scrPosition = vec3(\n project(scaleHi, translateHi, scaleLo, translateLo, positionHi, positionLo),\n 1);\n gl_Position = vec4(\n scrPosition.xy + scrPosition.z * pixelScale * pixelOffset,\n 0,\n scrPosition.z);\n}\n", fragment: "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n" } @@ -28623,13 +28623,13 @@ function formatCompilerError(errLog, src, type) { },{"add-line-numbers":29,"gl-constants/lookup":130,"glsl-shader-name":244,"sprintf-js":484}],137:[function(require,module,exports){ -exports.lineVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi, dLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, screenShape;\nuniform float width;\n\nvarying vec2 direction;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo;\n}\n\n\nvec2 project_2_1(vec2 scHi, vec2 scLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi\n + scLo * posHi\n + scHi * posLo\n + scLo * posLo;\n}\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n vec2 dir = project_2_1(scaleHi, scaleLo, dHi, dLo);\n vec2 n = 0.5 * width * normalize(screenShape.yx * vec2(dir.y, -dir.x)) / screenShape.xy;\n vec2 tangent = normalize(screenShape.xy * dir);\n if(dir.x < 0.0 || (dir.x == 0.0 && dir.y < 0.0)) {\n direction = -tangent;\n } else {\n direction = tangent;\n }\n gl_Position = vec4(p + n, 0.0, 1.0);\n}" +exports.lineVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi, dLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, screenShape;\nuniform float width;\n\nvarying vec2 direction;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvec2 project_2_1(vec2 scHi, vec2 scLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi\n + scLo * posHi\n + scHi * posLo\n + scLo * posLo;\n}\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n vec2 dir = project_2_1(scaleHi, scaleLo, dHi, dLo);\n vec2 n = 0.5 * width * normalize(screenShape.yx * vec2(dir.y, -dir.x)) / screenShape.xy;\n vec2 tangent = normalize(screenShape.xy * dir);\n if(dir.x < 0.0 || (dir.x == 0.0 && dir.y < 0.0)) {\n direction = -tangent;\n } else {\n direction = tangent;\n }\n gl_Position = vec4(p + n, 0.0, 1.0);\n}" exports.lineFragment = "precision highp float;\n#define GLSLIFY 1\n\nuniform vec4 color;\nuniform vec2 screenShape;\nuniform sampler2D dashPattern;\nuniform float dashLength;\n\nvarying vec2 direction;\n\nvoid main() {\n float t = fract(dot(direction, gl_FragCoord.xy) / dashLength);\n vec4 pcolor = color * texture2D(dashPattern, vec2(t, 0.0)).r;\n gl_FragColor = vec4(pcolor.rgb * pcolor.a, pcolor.a);\n}" -exports.mitreVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo;\nuniform float radius;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n gl_Position = vec4(p, 0.0, 1.0);\n gl_PointSize = radius;\n}" +exports.mitreVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo;\nuniform float radius;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n gl_Position = vec4(p, 0.0, 1.0);\n gl_PointSize = radius;\n}" exports.mitreFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n if(length(gl_PointCoord.xy - 0.5) > 0.25) {\n discard;\n }\n gl_FragColor = vec4(color.rgb, color.a);\n}" -exports.pickVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi;\nattribute vec4 pick0, pick1;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, screenShape;\nuniform float width;\n\nvarying vec4 pickA, pickB;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n vec2 n = width * normalize(screenShape.yx * vec2(dHi.y, -dHi.x)) / screenShape.xy;\n gl_Position = vec4(p + n, 0, 1);\n pickA = pick0;\n pickB = pick1;\n}" +exports.pickVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi;\nattribute vec4 pick0, pick1;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, screenShape;\nuniform float width;\n\nvarying vec4 pickA, pickB;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n vec2 n = width * normalize(screenShape.yx * vec2(dHi.y, -dHi.x)) / screenShape.xy;\n gl_Position = vec4(p + n, 0, 1);\n pickA = pick0;\n pickB = pick1;\n}" exports.pickFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 pickOffset;\n\nvarying vec4 pickA, pickB;\n\nvoid main() {\n vec4 fragId = vec4(pickA.xyz, 0.0);\n if(pickB.w > pickA.w) {\n fragId.xyz = pickB.xyz;\n }\n\n fragId += pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n gl_FragColor = fragId / 255.0;\n}" -exports.fillVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, projectAxis;\nuniform float projectValue, depth;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n if(dHi.y < 0.0 || (dHi.y == 0.0 && dHi.x < 0.0)) {\n if(dot(p, projectAxis) < projectValue) {\n p = p * (1.0 - abs(projectAxis)) + projectAxis * projectValue;\n }\n }\n gl_Position = vec4(p, depth, 1);\n}" +exports.fillVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, projectAxis;\nuniform float projectValue, depth;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n if(dHi.y < 0.0 || (dHi.y == 0.0 && dHi.x < 0.0)) {\n if(dot(p, projectAxis) < projectValue) {\n p = p * (1.0 - abs(projectAxis)) + projectAxis * projectValue;\n }\n }\n gl_Position = vec4(p, depth, 1);\n}" exports.fillFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}" },{}],138:[function(require,module,exports){ 'use strict' @@ -28713,8 +28713,8 @@ proto.setProjectionModel = (function() { var scaleX = 2 * boundX / dataX var scaleY = 2 * boundY / dataY - var translateX = 2 * (bounds[0] - dataBox[0]) / dataX - 1 - var translateY = 2 * (bounds[1] - dataBox[1]) / dataY - 1 + var translateX = (bounds[0] - dataBox[0] - 0.5 * dataX) / boundX + var translateY = (bounds[1] - dataBox[1] - 0.5 * dataY) / boundY pm.scaleHi[0] = scaleX pm.scaleHi[1] = scaleY @@ -41414,9 +41414,9 @@ function slerp (out, a, b, t) { module.exports = { - vertex: "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4(scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n", + vertex: "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4((posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n", fragment: "precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n", - pickVertex: "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4(scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n", + pickVertex: "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4((posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n", pickFragment: "precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n" } @@ -41577,8 +41577,8 @@ var proto = GLScatterFancy.prototype var scaleX = 2 * boundX / dataX var scaleY = 2 * boundY / dataY - var translateX = 2 * (bounds[0] - dataBox[0]) / dataX - 1 - var translateY = 2 * (bounds[1] - dataBox[1]) / dataY - 1 + var translateX = (bounds[0] - dataBox[0] - 0.5 * dataX) / boundX + var translateY = (bounds[1] - dataBox[1] - 0.5 * dataY) / boundY SCALE_HI[0] = scaleX SCALE_LO[0] = scaleX - SCALE_HI[0] @@ -41839,9 +41839,9 @@ function createFancyScatter2D(plot, options) { },{"./lib/shaders":200,"gl-buffer":128,"gl-shader":201,"text-cache":488,"typedarray-pool":496,"vectorize-text":509}],209:[function(require,module,exports){ -exports.pointVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute float weight;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pointSize, useWeight;\n\nvarying float fragWeight;\n\n\nvec4 pfx_1_0(vec2 scaleHi, vec2 scaleLo, vec2 translateHi, vec2 translateLo, vec2 positionHi, vec2 positionLo) {\n return vec4(scaleHi * positionHi + translateHi\n + scaleLo * positionHi + translateLo\n + scaleHi * positionLo\n + scaleLo * positionLo, 0.0, 1.0);\n}\n\nvoid main() {\n gl_Position = pfx_1_0(scaleHi, scaleLo, translateHi, translateLo, positionHi, positionLo);\n gl_PointSize = pointSize;\n fragWeight = mix(1.0, weight, useWeight);\n}" +exports.pointVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute float weight;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pointSize, useWeight;\n\nvarying float fragWeight;\n\n\nvec4 pfx_1_0(vec2 scaleHi, vec2 scaleLo, vec2 translateHi, vec2 translateLo, vec2 positionHi, vec2 positionLo) {\n return vec4((positionHi + translateHi) * scaleHi\n + (positionLo + translateLo) * scaleHi\n + (positionHi + translateHi) * scaleLo\n + (positionLo + translateLo) * scaleLo, 0.0, 1.0);\n}\n\nvoid main() {\n gl_Position = pfx_1_0(scaleHi, scaleLo, translateHi, translateLo, positionHi, positionLo);\n gl_PointSize = pointSize;\n fragWeight = mix(1.0, weight, useWeight);\n}" exports.pointFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color, borderColor;\nuniform float centerFraction;\n\nvarying float fragWeight;\n\nfloat smoothStep(float x, float y) {\n return 1.0 / (1.0 + exp(50.0*(x - y)));\n}\n\nvoid main() {\n float radius = length(2.0*gl_PointCoord.xy-1.0);\n if(radius > 1.0) {\n discard;\n }\n vec4 baseColor = mix(borderColor, color, smoothStep(radius, centerFraction));\n float alpha = 1.0 - pow(1.0 - baseColor.a, fragWeight);\n gl_FragColor = vec4(baseColor.rgb * alpha, alpha);\n}" -exports.pickVertex = "precision highp float;\n#define GLSLIFY 1\n\nvec4 pfx_1_0(vec2 scaleHi, vec2 scaleLo, vec2 translateHi, vec2 translateLo, vec2 positionHi, vec2 positionLo) {\n return vec4(scaleHi * positionHi + translateHi\n + scaleLo * positionHi + translateLo\n + scaleHi * positionLo\n + scaleLo * positionLo, 0.0, 1.0);\n}\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 pickId;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\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 gl_Position = pfx_1_0(scaleHi, scaleLo, translateHi, translateLo, positionHi, positionLo);\n gl_PointSize = pointSize;\n fragId = id;\n}" +exports.pickVertex = "precision highp float;\n#define GLSLIFY 1\n\nvec4 pfx_1_0(vec2 scaleHi, vec2 scaleLo, vec2 translateHi, vec2 translateLo, vec2 positionHi, vec2 positionLo) {\n return vec4((positionHi + translateHi) * scaleHi\n + (positionLo + translateLo) * scaleHi\n + (positionHi + translateHi) * scaleLo\n + (positionLo + translateLo) * scaleLo, 0.0, 1.0);\n}\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 pickId;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\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 gl_Position = pfx_1_0(scaleHi, scaleLo, translateHi, translateLo, positionHi, positionLo);\n gl_PointSize = pointSize;\n fragId = id;\n}" exports.pickFragment = "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}" },{}],210:[function(require,module,exports){ arguments[4][72][0].apply(exports,arguments) @@ -42418,8 +42418,8 @@ proto.draw = function(pickOffset) { scaleLo[0] = scaleX - scaleHi[0] scaleLo[1] = scaleY - scaleHi[1] - var translateX = 2 * (bounds[0] - dataBox[0]) / dataX - 1 - var translateY = 2 * (bounds[1] - dataBox[1]) / dataY - 1 + var translateX = (bounds[0] - dataBox[0] - 0.5 * dataX) / boundX + var translateY = (bounds[1] - dataBox[1] - 0.5 * dataY) / boundY translateHi[0] = translateX translateHi[1] = translateY @@ -42488,6 +42488,8 @@ proto.draw = function(pickOffset) { shader.uniforms.useWeight = 0 } } + + return pickOffset + this.pointCount } proto.drawPick = proto.draw @@ -80495,17 +80497,21 @@ function toPX(str, element) { return 1 } },{"parse-unit":433}],491:[function(require,module,exports){ +// https://github.com/topojson/topojson-client Version 2.1.0. Copyright 2016 Mike Bostock. (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.topojson = global.topojson || {}))); }(this, (function (exports) { 'use strict'; -function noop() {} +var identity = function(x) { + return x; +}; -function transformAbsolute(transform) { - if (!transform) return noop; - var x0, +var transform = function(topology) { + if ((transform = topology.transform) == null) return identity; + var transform, + x0, y0, kx = transform.scale[0], ky = transform.scale[1], @@ -80515,78 +80521,89 @@ function transformAbsolute(transform) { if (!i) x0 = y0 = 0; point[0] = (x0 += point[0]) * kx + dx; point[1] = (y0 += point[1]) * ky + dy; + return point; }; -} +}; -function transformRelative(transform) { - if (!transform) return noop; - var x0, - y0, - kx = transform.scale[0], - ky = transform.scale[1], - dx = transform.translate[0], - dy = transform.translate[1]; - return function(point, i) { - if (!i) x0 = y0 = 0; - var x1 = Math.round((point[0] - dx) / kx), - y1 = Math.round((point[1] - dy) / ky); - point[0] = x1 - x0; - point[1] = y1 - y0; - x0 = x1; - y0 = y1; - }; -} +var bbox = function(topology) { + var bbox = topology.bbox; -function reverse(array, n) { - var t, j = array.length, i = j - n; - while (i < --j) t = array[i], array[i++] = array[j], array[j] = t; -} + function bboxPoint(p0) { + p1[0] = p0[0], p1[1] = p0[1], t(p1); + if (p1[0] < x0) x0 = p1[0]; + if (p1[0] > x1) x1 = p1[0]; + if (p1[1] < y0) y0 = p1[1]; + if (p1[1] > y1) y1 = p1[1]; + } -function bisect(a, x) { - var lo = 0, hi = a.length; - while (lo < hi) { - var mid = lo + hi >>> 1; - if (a[mid] < x) lo = mid + 1; - else hi = mid; + function bboxGeometry(o) { + switch (o.type) { + case "GeometryCollection": o.geometries.forEach(bboxGeometry); break; + case "Point": bboxPoint(o.coordinates); break; + case "MultiPoint": o.coordinates.forEach(bboxPoint); break; + } } - return lo; -} -function feature(topology, o) { - return o.type === "GeometryCollection" ? { - type: "FeatureCollection", - features: o.geometries.map(function(o) { return feature$1(topology, o); }) - } : feature$1(topology, o); -} + if (!bbox) { + var t = transform(topology), p0, p1 = new Array(2), name, + x0 = Infinity, y0 = x0, x1 = -x0, y1 = -x0; + + topology.arcs.forEach(function(arc) { + var i = -1, n = arc.length; + while (++i < n) { + p0 = arc[i], p1[0] = p0[0], p1[1] = p0[1], t(p1, i); + if (p1[0] < x0) x0 = p1[0]; + if (p1[0] > x1) x1 = p1[0]; + if (p1[1] < y0) y0 = p1[1]; + if (p1[1] > y1) y1 = p1[1]; + } + }); + + for (name in topology.objects) { + bboxGeometry(topology.objects[name]); + } + + bbox = topology.bbox = [x0, y0, x1, y1]; + } + + return bbox; +}; + +var reverse = function(array, n) { + var t, j = array.length, i = j - n; + while (i < --j) t = array[i], array[i++] = array[j], array[j] = t; +}; + +var feature = function(topology, o) { + return o.type === "GeometryCollection" + ? {type: "FeatureCollection", features: o.geometries.map(function(o) { return feature$1(topology, o); })} + : feature$1(topology, o); +}; function feature$1(topology, o) { - var f = { - type: "Feature", - id: o.id, - properties: o.properties || {}, - geometry: object(topology, o) - }; - if (o.id == null) delete f.id; - return f; + var id = o.id, + bbox = o.bbox, + properties = o.properties == null ? {} : o.properties, + geometry = object(topology, o); + return id == null && bbox == null ? {type: "Feature", properties: properties, geometry: geometry} + : bbox == null ? {type: "Feature", id: id, properties: properties, geometry: geometry} + : {type: "Feature", id: id, bbox: bbox, properties: properties, geometry: geometry}; } function object(topology, o) { - var absolute = transformAbsolute(topology.transform), + var transformPoint = transform(topology), arcs = topology.arcs; function arc(i, points) { if (points.length) points.pop(); - for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) { - points.push(p = a[k].slice()); - absolute(p, k); + for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) { + points.push(transformPoint(a[k].slice(), k)); } if (i < 0) reverse(points, n); } function point(p) { - p = p.slice(); - absolute(p, 0); - return p; + return transformPoint(p.slice()); } function line(arcs) { @@ -80607,25 +80624,24 @@ function object(topology, o) { } function geometry(o) { - var t = o.type; - return t === "GeometryCollection" ? {type: t, geometries: o.geometries.map(geometry)} - : t in geometryType ? {type: t, coordinates: geometryType[t](o)} - : null; + var type = o.type, coordinates; + switch (type) { + case "GeometryCollection": return {type: type, geometries: o.geometries.map(geometry)}; + case "Point": coordinates = point(o.coordinates); break; + case "MultiPoint": coordinates = o.coordinates.map(point); break; + case "LineString": coordinates = line(o.arcs); break; + case "MultiLineString": coordinates = o.arcs.map(line); break; + case "Polygon": coordinates = polygon(o.arcs); break; + case "MultiPolygon": coordinates = o.arcs.map(polygon); break; + default: return null; + } + return {type: type, coordinates: coordinates}; } - var geometryType = { - Point: function(o) { return point(o.coordinates); }, - MultiPoint: function(o) { return o.coordinates.map(point); }, - LineString: function(o) { return line(o.arcs); }, - MultiLineString: function(o) { return o.arcs.map(line); }, - Polygon: function(o) { return polygon(o.arcs); }, - MultiPolygon: function(o) { return o.arcs.map(polygon); } - }; - return geometry(o); } -function stitchArcs(topology, arcs) { +var stitch = function(topology, arcs) { var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, @@ -80697,114 +80713,107 @@ function stitchArcs(topology, arcs) { arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); }); return fragments; -} +}; -function mesh(topology) { +var mesh = function(topology) { return object(topology, meshArcs.apply(this, arguments)); +}; + +function meshArcs(topology, object$$1, filter) { + var arcs, i, n; + if (arguments.length > 1) arcs = extractArcs(topology, object$$1, filter); + else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i; + return {type: "MultiLineString", arcs: stitch(topology, arcs)}; } -function meshArcs(topology, o, filter) { - var arcs = []; +function extractArcs(topology, object$$1, filter) { + var arcs = [], + geomsByArc = [], + geom; - function arc(i) { + function extract0(i) { var j = i < 0 ? ~i : i; (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom}); } - function line(arcs) { - arcs.forEach(arc); + function extract1(arcs) { + arcs.forEach(extract0); } - function polygon(arcs) { - arcs.forEach(line); + function extract2(arcs) { + arcs.forEach(extract1); } - function geometry(o) { - if (o.type === "GeometryCollection") o.geometries.forEach(geometry); - else if (o.type in geometryType) geom = o, geometryType[o.type](o.arcs); + function extract3(arcs) { + arcs.forEach(extract2); } - if (arguments.length > 1) { - var geomsByArc = [], - geom; - - var geometryType = { - LineString: line, - MultiLineString: polygon, - Polygon: polygon, - MultiPolygon: function(arcs) { arcs.forEach(polygon); } - }; - - geometry(o); - - geomsByArc.forEach(arguments.length < 3 - ? function(geoms) { arcs.push(geoms[0].i); } - : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); }); - } else { - for (var i = 0, n = topology.arcs.length; i < n; ++i) arcs.push(i); + function geometry(o) { + switch (geom = o, o.type) { + case "GeometryCollection": o.geometries.forEach(geometry); break; + case "LineString": extract1(o.arcs); break; + case "MultiLineString": case "Polygon": extract2(o.arcs); break; + case "MultiPolygon": extract3(o.arcs); break; + } } - return {type: "MultiLineString", arcs: stitchArcs(topology, arcs)}; -} + geometry(object$$1); -function cartesianTriangleArea(triangle) { - var a = triangle[0], b = triangle[1], c = triangle[2]; - return Math.abs((a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1])); -} - -function ring(ring) { - var i = -1, - n = ring.length, - a, - b = ring[n - 1], - area = 0; + geomsByArc.forEach(filter == null + ? function(geoms) { arcs.push(geoms[0].i); } + : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); }); - while (++i < n) { - a = b; - b = ring[i]; - area += a[0] * b[1] - a[1] * b[0]; - } + return arcs; +} - return area / 2; +function planarRingArea(ring) { + var i = -1, n = ring.length, a, b = ring[n - 1], area = 0; + while (++i < n) a = b, b = ring[i], area += a[0] * b[1] - a[1] * b[0]; + return Math.abs(area); // Note: doubled area! } -function merge(topology) { +var merge = function(topology) { return object(topology, mergeArcs.apply(this, arguments)); -} +}; function mergeArcs(topology, objects) { var polygonsByArc = {}, polygons = [], - components = []; + groups = []; - objects.forEach(function(o) { - if (o.type === "Polygon") register(o.arcs); - else if (o.type === "MultiPolygon") o.arcs.forEach(register); - }); + objects.forEach(geometry); - function register(polygon) { - polygon.forEach(function(ring$$) { - ring$$.forEach(function(arc) { + function geometry(o) { + switch (o.type) { + case "GeometryCollection": o.geometries.forEach(geometry); break; + case "Polygon": extract(o.arcs); break; + case "MultiPolygon": o.arcs.forEach(extract); break; + } + } + + function extract(polygon) { + polygon.forEach(function(ring) { + ring.forEach(function(arc) { (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon); }); }); polygons.push(polygon); } - function area(ring$$) { - return Math.abs(ring(object(topology, {type: "Polygon", arcs: [ring$$]}).coordinates[0])); + function area(ring) { + return planarRingArea(object(topology, {type: "Polygon", arcs: [ring]}).coordinates[0]); } polygons.forEach(function(polygon) { if (!polygon._) { - var component = [], + var group = [], neighbors = [polygon]; polygon._ = 1; - components.push(component); + groups.push(group); while (polygon = neighbors.pop()) { - component.push(polygon); - polygon.forEach(function(ring$$) { - ring$$.forEach(function(arc) { + group.push(polygon); + polygon.forEach(function(ring) { + ring.forEach(function(arc) { polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) { if (!polygon._) { polygon._ = 1; @@ -80823,13 +80832,13 @@ function mergeArcs(topology, objects) { return { type: "MultiPolygon", - arcs: components.map(function(polygons) { + arcs: groups.map(function(polygons) { var arcs = [], n; // Extract the exterior (unique) arcs. polygons.forEach(function(polygon) { - polygon.forEach(function(ring$$) { - ring$$.forEach(function(arc) { + polygon.forEach(function(ring) { + ring.forEach(function(arc) { if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) { arcs.push(arc); } @@ -80838,7 +80847,7 @@ function mergeArcs(topology, objects) { }); // Stitch the arcs into one or more rings. - arcs = stitchArcs(topology, arcs); + arcs = stitch(topology, arcs); // If more than one ring is returned, // at most one of these rings can be the exterior; @@ -80856,7 +80865,17 @@ function mergeArcs(topology, objects) { }; } -function neighbors(objects) { +var bisect = function(a, x) { + var lo = 0, hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (a[mid] < x) lo = mid + 1; + else hi = mid; + } + return lo; +}; + +var neighbors = function(objects) { var indexesByArc = {}, // arc index -> array of object indexes neighbors = objects.map(function() { return []; }); @@ -80898,150 +80917,105 @@ function neighbors(objects) { } return neighbors; -} - -function compareArea(a, b) { - return a[1][2] - b[1][2]; -} - -function minAreaHeap() { - var heap = {}, - array = [], - size = 0; - - heap.push = function(object) { - up(array[object._ = size] = object, size++); - return size; - }; +}; - heap.pop = function() { - if (size <= 0) return; - var removed = array[0], object; - if (--size > 0) object = array[size], down(array[object._ = 0] = object, 0); - return removed; - }; +var quantize = function(topology, n) { + if (!((n = Math.floor(n)) >= 2)) throw new Error("n must be ≥2"); + if (topology.transform) throw new Error("already quantized"); + var bb = bbox(topology), name, + dx = bb[0], kx = (bb[2] - dx) / (n - 1) || 1, + dy = bb[1], ky = (bb[3] - dy) / (n - 1) || 1; - heap.remove = function(removed) { - var i = removed._, object; - if (array[i] !== removed) return; // invalid request - if (i !== --size) object = array[size], (compareArea(object, removed) < 0 ? up : down)(array[object._ = i] = object, i); - return i; - }; - - function up(object, i) { - while (i > 0) { - var j = ((i + 1) >> 1) - 1, - parent = array[j]; - if (compareArea(object, parent) >= 0) break; - array[parent._ = i] = parent; - array[object._ = i = j] = object; - } + function quantizePoint(p) { + p[0] = Math.round((p[0] - dx) / kx); + p[1] = Math.round((p[1] - dy) / ky); } - function down(object, i) { - while (true) { - var r = (i + 1) << 1, - l = r - 1, - j = i, - child = array[j]; - if (l < size && compareArea(array[l], child) < 0) child = array[j = l]; - if (r < size && compareArea(array[r], child) < 0) child = array[j = r]; - if (j === i) break; - array[child._ = i] = child; - array[object._ = i = j] = object; + function quantizeGeometry(o) { + switch (o.type) { + case "GeometryCollection": o.geometries.forEach(quantizeGeometry); break; + case "Point": quantizePoint(o.coordinates); break; + case "MultiPoint": o.coordinates.forEach(quantizePoint); break; } } - return heap; -} - -function presimplify(topology, triangleArea) { - var absolute = transformAbsolute(topology.transform), - relative = transformRelative(topology.transform), - heap = minAreaHeap(); - - if (!triangleArea) triangleArea = cartesianTriangleArea; - topology.arcs.forEach(function(arc) { - var triangles = [], - maxArea = 0, - triangle, - i, - n, - p; - - // To store each point’s effective area, we create a new array rather than - // extending the passed-in point to workaround a Chrome/V8 bug (getting - // stuck in smi mode). For midpoints, the initial effective area of - // Infinity will be computed in the next step. - for (i = 0, n = arc.length; i < n; ++i) { - p = arc[i]; - absolute(arc[i] = [p[0], p[1], Infinity], i); - } - - for (i = 1, n = arc.length - 1; i < n; ++i) { - triangle = arc.slice(i - 1, i + 2); - triangle[1][2] = triangleArea(triangle); - triangles.push(triangle); - heap.push(triangle); - } - - for (i = 0, n = triangles.length; i < n; ++i) { - triangle = triangles[i]; - triangle.previous = triangles[i - 1]; - triangle.next = triangles[i + 1]; - } - - while (triangle = heap.pop()) { - var previous = triangle.previous, - next = triangle.next; - - // If the area of the current point is less than that of the previous point - // to be eliminated, use the latter's area instead. This ensures that the - // current point cannot be eliminated without eliminating previously- - // eliminated points. - if (triangle[1][2] < maxArea) triangle[1][2] = maxArea; - else maxArea = triangle[1][2]; - - if (previous) { - previous.next = next; - previous[2] = triangle[2]; - update(previous); - } - - if (next) { - next.previous = previous; - next[0] = triangle[0]; - update(next); - } - } - - arc.forEach(relative); + var i = 1, + j = 1, + n = arc.length, + pi = arc[0], + x0 = pi[0] = Math.round((pi[0] - dx) / kx), + y0 = pi[1] = Math.round((pi[1] - dy) / ky), + pj, + x1, + y1; + + for (; i < n; ++i) { + pi = arc[i]; + x1 = Math.round((pi[0] - dx) / kx); + y1 = Math.round((pi[1] - dy) / ky); + if (x1 !== x0 || y1 !== y0) { + pj = arc[j++]; + pj[0] = x1 - x0, x0 = x1; + pj[1] = y1 - y0, y0 = y1; + } + } + + if (j < 2) { + pj = arc[j++]; + pj[0] = 0; + pj[1] = 0; + } + + arc.length = j; }); - function update(triangle) { - heap.remove(triangle); - triangle[1][2] = triangleArea(triangle); - heap.push(triangle); + for (name in topology.objects) { + quantizeGeometry(topology.objects[name]); } + topology.transform = { + scale: [kx, ky], + translate: [dx, dy] + }; + return topology; -} +}; -var version = "1.6.27"; +var untransform = function(topology) { + if ((transform = topology.transform) == null) return identity; + var transform, + x0, + y0, + kx = transform.scale[0], + ky = transform.scale[1], + dx = transform.translate[0], + dy = transform.translate[1]; + return function(point, i) { + if (!i) x0 = y0 = 0; + var x1 = Math.round((point[0] - dx) / kx), + y1 = Math.round((point[1] - dy) / ky); + point[0] = x1 - x0, x0 = x1; + point[1] = y1 - y0, y0 = y1; + return point; + }; +}; -exports.version = version; +exports.bbox = bbox; +exports.feature = feature; exports.mesh = mesh; exports.meshArcs = meshArcs; exports.merge = merge; exports.mergeArcs = mergeArcs; -exports.feature = feature; exports.neighbors = neighbors; -exports.presimplify = presimplify; +exports.quantize = quantize; +exports.transform = transform; +exports.untransform = untransform; Object.defineProperty(exports, '__esModule', { value: true }); }))); + },{}],492:[function(require,module,exports){ "use strict" @@ -85431,13 +85405,18 @@ var Axes = require('../../plots/cartesian/axes'); var attributes = require('./attributes'); -module.exports = function handleAnnotationDefaults(annIn, fullLayout) { - var annOut = {}; +module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, opts, itemOpts) { + opts = opts || {}; + itemOpts = itemOpts || {}; function coerce(attr, dflt) { return Lib.coerce(annIn, annOut, attributes, attr, dflt); } + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + + if(!visible) return annOut; + coerce('opacity'); coerce('align'); coerce('bgcolor'); @@ -85450,74 +85429,61 @@ module.exports = function handleAnnotationDefaults(annIn, fullLayout) { var borderWidth = coerce('borderwidth'); var showArrow = coerce('showarrow'); - if(showArrow) { - coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); - coerce('arrowhead'); - coerce('arrowsize'); - coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); - coerce('ax'); - coerce('ay'); - coerce('axref'); - coerce('ayref'); - - // if you have one part of arrow length you should have both - Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); - } - coerce('text', showArrow ? ' ' : 'new text'); coerce('textangle'); Lib.coerceFont(coerce, 'font', fullLayout.font); // positioning - var axLetters = ['x', 'y']; + var axLetters = ['x', 'y'], + arrowPosDflt = [-10, -30], + gdMock = {_fullLayout: fullLayout}; for(var i = 0; i < 2; i++) { - var axLetter = axLetters[i], - tdMock = {_fullLayout: fullLayout}; + var axLetter = axLetters[i]; // xref, yref - var axRef = Axes.coerceRef(annIn, annOut, tdMock, axLetter); - - // TODO: should be refactored in conjunction with Axes axref, ayref - var aaxRef = Axes.coerceARef(annIn, annOut, tdMock, axLetter); + var axRef = Axes.coerceRef(annIn, annOut, gdMock, axLetter, '', 'paper'); // x, y - var defaultPosition = 0.5; - if(axRef !== 'paper') { - var ax = Axes.getFromId(tdMock, axRef); - defaultPosition = ax.range[0] + defaultPosition * (ax.range[1] - ax.range[0]); - - // convert date or category strings to numbers - if(['date', 'category'].indexOf(ax.type) !== -1 && - typeof annIn[axLetter] === 'string') { - var newval; - if(ax.type === 'date') { - newval = Lib.dateTime2ms(annIn[axLetter]); - if(newval !== false) annIn[axLetter] = newval; - - if(aaxRef === axRef) { - var newvalB = Lib.dateTime2ms(annIn['a' + axLetter]); - if(newvalB !== false) annIn['a' + axLetter] = newvalB; - } - } - else if((ax._categories || []).length) { - newval = ax._categories.indexOf(annIn[axLetter]); - if(newval !== -1) annIn[axLetter] = newval; - } + Axes.coercePosition(annOut, gdMock, coerce, axRef, axLetter, 0.5); + + if(showArrow) { + var arrowPosAttr = 'a' + axLetter, + // axref, ayref + aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + + // for now the arrow can only be on the same axis or specified as pixels + // TODO: sometime it might be interesting to allow it to be on *any* axis + // but that would require updates to drawing & autorange code and maybe more + if(aaxRef !== 'pixel' && aaxRef !== axRef) { + aaxRef = annOut[arrowPosAttr] = 'pixel'; } + + // ax, ay + var aDflt = (aaxRef === 'pixel') ? arrowPosDflt[i] : 0.4; + Axes.coercePosition(annOut, gdMock, coerce, aaxRef, arrowPosAttr, aDflt); } - coerce(axLetter, defaultPosition); // xanchor, yanchor - if(!showArrow) coerce(axLetter + 'anchor'); + else coerce(axLetter + 'anchor'); } // if you have one coordinate you should have both Lib.noneOrAll(annIn, annOut, ['x', 'y']); + if(showArrow) { + coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); + coerce('arrowhead'); + coerce('arrowsize'); + coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); + + // if you have one part of arrow length you should have both + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); + } + return annOut; }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"../color":533,"./attributes":526}],525:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"../color":533,"./attributes":526}],525:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85597,7 +85563,16 @@ var extendFlat = require('../../lib/extend').extendFlat; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'annotation', + + visible: { + valType: 'boolean', + role: 'info', + dflt: true, + description: [ + 'Determines whether or not this annotation is visible.' + ].join(' ') + }, text: { valType: 'string', @@ -85714,27 +85689,27 @@ module.exports = { description: 'Sets the width (in px) of annotation arrow.' }, ax: { - valType: 'number', - dflt: -10, + valType: 'any', role: 'info', description: [ 'Sets the x component of the arrow tail about the arrow head.', 'If `axref` is `pixel`, a positive (negative) ', 'component corresponds to an arrow pointing', 'from right to left (left to right).', - 'If `axref` is an axis, this is a value on that axis.' + 'If `axref` is an axis, this is an absolute value on that axis,', + 'like `x`, NOT a relative value.' ].join(' ') }, ay: { - valType: 'number', - dflt: -30, + valType: 'any', role: 'info', description: [ 'Sets the y component of the arrow tail about the arrow head.', 'If `ayref` is `pixel`, a positive (negative) ', 'component corresponds to an arrow pointing', 'from bottom to top (top to bottom).', - 'If `ayref` is an axis, this is a value on that axis.' + 'If `ayref` is an axis, this is an absolute value on that axis,', + 'like `y`, NOT a relative value.' ].join(' ') }, axref: { @@ -85789,11 +85764,18 @@ module.exports = { ].join(' ') }, x: { - valType: 'number', + valType: 'any', role: 'info', description: [ 'Sets the annotation\'s x position.', - 'Note that dates and categories are converted to numbers.' + 'If the axis `type` is *log*, then you must take the', + 'log of your desired range.', + 'If the axis `type` is *date*, it should be date strings,', + 'like date data, though Date objects and unix milliseconds', + 'will be accepted and converted to strings.', + 'If the axis `type` is *category*, it should be numbers,', + 'using the scale where each category is assigned a serial', + 'number from zero in the order it appears.' ].join(' ') }, xanchor: { @@ -85832,11 +85814,18 @@ module.exports = { ].join(' ') }, y: { - valType: 'number', + valType: 'any', role: 'info', description: [ 'Sets the annotation\'s y position.', - 'Note that dates and categories are converted to numbers.' + 'If the axis `type` is *log*, then you must take the', + 'log of your desired range.', + 'If the axis `type` is *date*, it should be date strings,', + 'like date data, though Date objects and unix milliseconds', + 'will be accepted and converted to strings.', + 'If the axis `type` is *category*, it should be numbers,', + 'using the scale where each category is assigned a serial', + 'number from zero in the order it appears.' ].join(' ') }, yanchor: { @@ -85870,7 +85859,7 @@ module.exports = { } }; -},{"../../lib/extend":625,"../../plots/cartesian/constants":668,"../../plots/font_attributes":683,"./arrow_paths":525}],527:[function(require,module,exports){ +},{"../../lib/extend":626,"../../plots/cartesian/constants":669,"../../plots/font_attributes":684,"./arrow_paths":525}],527:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85890,7 +85879,7 @@ var draw = require('./draw').draw; module.exports = function calcAutorange(gd) { var fullLayout = gd._fullLayout, - annotationList = fullLayout.annotations; + annotationList = Lib.filterVisible(fullLayout.annotations); if(!annotationList.length || !gd._fullData.length) return; @@ -85942,14 +85931,14 @@ function annAutorange(gd) { } if(xa && xa.autorange) { - Axes.expand(xa, [xa.l2c(ann.x)], { + Axes.expand(xa, [xa.l2c(xa.r2l(ann.x))], { ppadplus: rightSize, ppadminus: leftSize }); } if(ya && ya.autorange) { - Axes.expand(ya, [ya.l2c(ann.y)], { + Axes.expand(ya, [ya.l2c(ya.r2l(ann.y))], { ppadplus: bottomSize, ppadminus: topSize }); @@ -85957,7 +85946,7 @@ function annAutorange(gd) { }); } -},{"../../lib":632,"../../plots/cartesian/axes":662,"./draw":529}],528:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"./draw":529}],528:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85969,22 +85958,20 @@ function annAutorange(gd) { 'use strict'; +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var handleAnnotationDefaults = require('./annotation_defaults'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - var containerIn = layoutIn.annotations || [], - containerOut = layoutOut.annotations = []; - - for(var i = 0; i < containerIn.length; i++) { - var annIn = containerIn[i] || {}, - annOut = handleAnnotationDefaults(annIn, layoutOut); + var opts = { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults + }; - containerOut.push(annOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"./annotation_defaults":524}],529:[function(require,module,exports){ +},{"../../plots/array_container_defaults":661,"./annotation_defaults":524}],529:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86034,7 +86021,9 @@ function draw(gd) { fullLayout._infolayer.selectAll('.annotation').remove(); for(var i = 0; i < fullLayout.annotations.length; i++) { - drawOne(gd, i); + if(fullLayout.annotations[i].visible) { + drawOne(gd, i); + } } return Plots.previousPromises(gd); @@ -86127,8 +86116,6 @@ function drawOne(gd, index, opt, value) { // where we fail here when they add/remove annotations if(!optionsIn) return; - var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; - // alter the input annotation as requested var optionsEdit = {}; if(typeof opt === 'string' && opt) optionsEdit[opt] = value; @@ -86140,7 +86127,11 @@ function drawOne(gd, index, opt, value) { Lib.nestedProperty(optionsIn, k).set(optionsEdit[k]); } + // return early in visible: false updates + if(optionsIn.visible === false) return; + var gs = fullLayout._size; + var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; var axLetters = ['x', 'y']; for(i = 0; i < 2; i++) { @@ -86155,12 +86146,19 @@ function drawOne(gd, index, opt, value) { continue; } - var axOld = Axes.getFromId(gd, Axes.coerceRef(oldRef, {}, gd, axLetter)), - axNew = Axes.getFromId(gd, Axes.coerceRef(optionsIn, {}, gd, axLetter)), + var axOld = Axes.getFromId(gd, Axes.coerceRef(oldRef, {}, gd, axLetter, '', 'paper')), + axNew = Axes.getFromId(gd, Axes.coerceRef(optionsIn, {}, gd, axLetter, '', 'paper')), position = optionsIn[axLetter], axTypeOld = oldPrivate['_' + axLetter + 'type']; if(optionsEdit[axLetter + 'ref'] !== undefined) { + + // TODO: include ax / ay / axref / ayref here if not 'pixel' + // or even better, move all of this machinery out of here and into + // streambed as extra attributes to a regular relayout call + // we should do this after v2.0 when it can work equivalently for + // annotations, shapes, and images. + var autoAnchor = optionsIn[axLetter + 'anchor'] === 'auto', plotSize = (axLetter === 'x' ? gs.w : gs.h), halfSizeFrac = (oldPrivate['_' + axLetter + 'size'] || 0) / @@ -86169,18 +86167,11 @@ function drawOne(gd, index, opt, value) { // go to the same fraction of the axis length // whether or not these axes share a domain - // first convert to fraction of the axis - position = (position - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); - - // then convert to new data coordinates at the same fraction - position = axNew.range[0] + - position * (axNew.range[1] - axNew.range[0]); + position = axNew.fraction2r(axOld.r2fraction(position)); } else if(axOld) { // data -> paper // first convert to fraction of the axis - position = (position - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + position = axOld.r2fraction(position); // next scale the axis to the whole plot position = axOld.domain[0] + @@ -86208,8 +86199,7 @@ function drawOne(gd, index, opt, value) { (axNew.domain[1] - axNew.domain[0]); // finally convert to data coordinates - position = axNew.range[0] + - position * (axNew.range[1] - axNew.range[0]); + position = axNew.fraction2r(position); } } @@ -86226,7 +86216,8 @@ function drawOne(gd, index, opt, value) { optionsIn[axLetter] = position; } - var options = handleAnnotationDefaults(optionsIn, fullLayout); + var options = {}; + handleAnnotationDefaults(optionsIn, options, fullLayout); fullLayout.annotations[index] = options; var xa = Axes.getFromId(gd, options.xref), @@ -86340,20 +86331,21 @@ function drawOne(gd, index, opt, value) { // outside the visible plot (as long as the axis // isn't autoranged - then we need to draw it // anyway to get its bounding box) - if(!ax.autorange && ((options[axLetter] - ax.range[0]) * - (options[axLetter] - ax.range[1]) > 0)) { + var posFraction = ax.r2fraction(options[axLetter]); + if(!ax.autorange && (posFraction < 0 || posFraction > 1)) { if(options['a' + axLetter + 'ref'] === axRef) { - if((options['a' + axLetter] - ax.range[0]) * - (options['a' + axLetter] - ax.range[1]) > 0) { + posFraction = ax.r2fraction(options['a' + axLetter]); + if(posFraction < 0 || posFraction > 1) { annotationIsOffscreen = true; } - } else { + } + else { annotationIsOffscreen = true; } if(annotationIsOffscreen) return; } - annPosPx[axLetter] = ax._offset + ax.l2p(options[axLetter]); + annPosPx[axLetter] = ax._offset + ax.r2p(options[axLetter]); alignPosition = 0.5; } else { @@ -86366,7 +86358,7 @@ function drawOne(gd, index, opt, value) { var alignShift = 0; if(options['a' + axLetter + 'ref'] === axRef) { - annPosPx['aa' + axLetter] = ax._offset + ax.l2p(options['a' + axLetter]); + annPosPx['aa' + axLetter] = ax._offset + ax.r2p(options['a' + axLetter]); } else { if(options.showarrow) { alignShift = options['a' + axLetter]; @@ -86566,22 +86558,22 @@ function drawOne(gd, index, opt, value) { ann.call(Lib.setTranslate, xcenter, ycenter); update[annbase + '.x'] = xa ? - (options.x + dx / xa._m) : + xa.p2r(xa.r2p(options.x) + dx) : ((arrowX + dx - gs.l) / gs.w); update[annbase + '.y'] = ya ? - (options.y + dy / ya._m) : + ya.p2r(ya.r2p(options.y) + dy) : (1 - ((arrowY + dy - gs.t) / gs.h)); if(options.axref === options.xref) { update[annbase + '.ax'] = xa ? - (options.ax + dx / xa._m) : - ((arrowX + dx - gs.l) / gs.w); + xa.p2r(xa.r2p(options.ax) + dx) : + ((arrowX + dx - gs.l) / gs.w); } if(options.ayref === options.yref) { update[annbase + '.ay'] = ya ? - (options.ay + dy / ya._m) : - (1 - ((arrowY + dy - gs.t) / gs.h)); + ya.p2r(ya.r2p(options.ay) + dy) : + (1 - ((arrowY + dy - gs.t) / gs.h)); } anng.attr({ @@ -86627,13 +86619,13 @@ function drawOne(gd, index, opt, value) { var csr = 'pointer'; if(options.showarrow) { if(options.axref === options.xref) { - update[annbase + '.ax'] = xa.p2l(xa.l2p(options.ax) + dx); + update[annbase + '.ax'] = xa.p2r(xa.r2p(options.ax) + dx); } else { update[annbase + '.ax'] = options.ax + dx; } if(options.ayref === options.yref) { - update[annbase + '.ay'] = ya.p2l(ya.l2p(options.ay) + dy); + update[annbase + '.ay'] = ya.p2r(ya.r2p(options.ay) + dy); } else { update[annbase + '.ay'] = options.ay + dy; } @@ -86739,7 +86731,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":632,"../../lib/setcursor":642,"../../lib/svg_text_utils":646,"../../plotly":658,"../../plots/cartesian/axes":662,"../../plots/plots":723,"../color":533,"../dragelement":555,"../drawing":557,"./annotation_defaults":524,"./defaults":528,"./draw_arrow_head":530,"d3":95,"fast-isnumeric":104}],530:[function(require,module,exports){ +},{"../../lib":633,"../../lib/setcursor":643,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/cartesian/axes":664,"../../plots/plots":724,"../color":533,"../dragelement":554,"../drawing":556,"./annotation_defaults":524,"./defaults":528,"./draw_arrow_head":530,"d3":95,"fast-isnumeric":104}],530:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86858,7 +86850,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { if(doEnd) drawhead(end, endRot); }; -},{"../color":533,"../drawing":557,"./arrow_paths":525,"d3":95,"fast-isnumeric":104}],531:[function(require,module,exports){ +},{"../color":533,"../drawing":556,"./arrow_paths":525,"d3":95,"fast-isnumeric":104}],531:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86870,33 +86862,21 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { 'use strict'; -var Plotly = require('../../plotly'); - -exports.moduleType = 'component'; - -exports.name = 'annotations'; - -exports.ARROWPATHS = require('./arrow_paths'); - -exports.layoutAttributes = require('./attributes'); - -exports.supplyLayoutDefaults = require('./defaults'); - -exports.calcAutorange = require('./calc_autorange'); - -exports.arrowhead = require('./draw_arrow_head'); - var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; -exports.add = function(gd) { - var nextAnn = gd._fullLayout.annotations.length; +module.exports = { + moduleType: 'component', + name: 'annotations', + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), - Plotly.relayout(gd, 'annotations[' + nextAnn + ']', 'add'); + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne }; -},{"../../plotly":658,"./arrow_paths":525,"./attributes":526,"./calc_autorange":527,"./defaults":528,"./draw":529,"./draw_arrow_head":530}],532:[function(require,module,exports){ +},{"./attributes":526,"./calc_autorange":527,"./defaults":528,"./draw":529}],532:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87289,7 +87269,7 @@ module.exports = { } }; -},{"../../lib/extend":625,"../../plots/cartesian/layout_attributes":672,"../../plots/font_attributes":683}],535:[function(require,module,exports){ +},{"../../lib/extend":626,"../../plots/cartesian/layout_attributes":673,"../../plots/font_attributes":684}],535:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87356,7 +87336,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":632,"../../plots/cartesian/tick_label_defaults":678,"../../plots/cartesian/tick_mark_defaults":679,"../../plots/cartesian/tick_value_defaults":680,"./attributes":534}],536:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/tick_label_defaults":679,"../../plots/cartesian/tick_mark_defaults":680,"../../plots/cartesian/tick_value_defaults":681,"./attributes":534}],536:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87988,7 +87968,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":632,"../../lib/extend":625,"../../lib/setcursor":642,"../../plotly":658,"../../plots/cartesian/axes":662,"../../plots/cartesian/axis_defaults":664,"../../plots/cartesian/layout_attributes":672,"../../plots/cartesian/position_defaults":675,"../../plots/plots":723,"../../registry":738,"../color":533,"../dragelement":555,"../drawing":557,"../titles":608,"./attributes":534,"d3":95,"tinycolor2":489}],537:[function(require,module,exports){ +},{"../../lib":633,"../../lib/extend":626,"../../lib/setcursor":643,"../../plotly":659,"../../plots/cartesian/axes":664,"../../plots/cartesian/axis_defaults":666,"../../plots/cartesian/layout_attributes":673,"../../plots/cartesian/position_defaults":676,"../../plots/plots":724,"../../registry":739,"../color":533,"../dragelement":554,"../drawing":556,"../titles":607,"./attributes":534,"d3":95,"tinycolor2":489}],537:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88007,28 +87987,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":632}],538:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -exports.attributes = require('./attributes'); - -exports.supplyDefaults = require('./defaults'); - -exports.draw = require('./draw'); - -exports.hasColorbar = require('./has_colorbar'); - -},{"./attributes":534,"./defaults":535,"./draw":536,"./has_colorbar":537}],539:[function(require,module,exports){ +},{"../../lib":633}],538:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88101,7 +88060,7 @@ module.exports = { } }; -},{}],540:[function(require,module,exports){ +},{}],539:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88167,7 +88126,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":632,"./flip_scale":545,"./scales":552}],541:[function(require,module,exports){ +},{"../../lib":633,"./flip_scale":544,"./scales":551}],540:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88257,7 +88216,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":625,"./attributes":539,"./scales.js":552}],542:[function(require,module,exports){ +},{"../../lib/extend":626,"./attributes":538,"./scales.js":551}],541:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88273,7 +88232,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":552}],543:[function(require,module,exports){ +},{"./scales":551}],542:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88337,7 +88296,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":632,"../colorbar/defaults":535,"../colorbar/has_colorbar":537,"./flip_scale":545,"./is_valid_scale":549,"fast-isnumeric":104}],544:[function(require,module,exports){ +},{"../../lib":633,"../colorbar/defaults":535,"../colorbar/has_colorbar":537,"./flip_scale":544,"./is_valid_scale":548,"fast-isnumeric":104}],543:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88374,7 +88333,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],545:[function(require,module,exports){ +},{}],544:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88399,7 +88358,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],546:[function(require,module,exports){ +},{}],545:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88439,7 +88398,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":542,"./is_valid_scale_array":550,"./scales":552}],547:[function(require,module,exports){ +},{"./default_scale":541,"./is_valid_scale_array":549,"./scales":551}],546:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88485,7 +88444,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":632,"./is_valid_scale":549,"fast-isnumeric":104}],548:[function(require,module,exports){ +},{"../../lib":633,"./is_valid_scale":548,"fast-isnumeric":104}],547:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88519,7 +88478,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":539,"./calc":540,"./default_scale":542,"./defaults":543,"./extract_scale":544,"./flip_scale":545,"./get_scale":546,"./has_colorscale":547,"./is_valid_scale":549,"./make_color_scale_func":551,"./scales":552}],549:[function(require,module,exports){ +},{"./attributes":538,"./calc":539,"./default_scale":541,"./defaults":542,"./extract_scale":543,"./flip_scale":544,"./get_scale":545,"./has_colorscale":546,"./is_valid_scale":548,"./make_color_scale_func":550,"./scales":551}],548:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88540,7 +88499,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":550,"./scales":552}],550:[function(require,module,exports){ +},{"./is_valid_scale_array":549,"./scales":551}],549:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88577,7 +88536,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":489}],551:[function(require,module,exports){ +},{"tinycolor2":489}],550:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88673,7 +88632,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":533,"d3":95,"fast-isnumeric":104,"tinycolor2":489}],552:[function(require,module,exports){ +},{"../color":533,"d3":95,"fast-isnumeric":104,"tinycolor2":489}],551:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88804,7 +88763,7 @@ module.exports = { ] }; -},{}],553:[function(require,module,exports){ +},{}],552:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88837,7 +88796,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],554:[function(require,module,exports){ +},{}],553:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88875,7 +88834,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":632}],555:[function(require,module,exports){ +},{"../../lib":633}],554:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89062,7 +89021,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../lib":632,"../../plotly":658,"../../plots/cartesian/constants":668,"./align":553,"./cursor":554,"./unhover":556}],556:[function(require,module,exports){ +},{"../../lib":633,"../../plotly":659,"../../plots/cartesian/constants":669,"./align":552,"./cursor":553,"./unhover":555}],555:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89113,7 +89072,7 @@ unhover.raw = function unhoverRaw(gd, evt) { gd._hoverdata = undefined; }; -},{"../../lib/events":624}],557:[function(require,module,exports){ +},{"../../lib/events":625}],556:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89191,14 +89150,14 @@ drawing.getPx = function(s, styleAttr) { return Number(s.style(styleAttr).replace(/px$/, '')); }; -drawing.crispRound = function(td, lineWidth, dflt) { +drawing.crispRound = function(gd, lineWidth, dflt) { // for lines that disable antialiasing we want to // make sure the width is an integer, and at least 1 if it's nonzero if(!lineWidth || !isNumeric(lineWidth)) return dflt || 0; // but not for static plots - these don't get antialiased anyway. - if(td._context.staticPlot) return lineWidth; + if(gd._context.staticPlot) return lineWidth; if(lineWidth < 1) return 1; return Math.round(lineWidth); @@ -89392,9 +89351,8 @@ drawing.singlePointStyle = function(d, sel, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); singlePointStyle(d, sel, trace, markerScale, lineScale, marker, markerLine); @@ -89406,50 +89364,22 @@ drawing.pointStyle = function(s, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales var marker = trace.marker; - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale); }); }; -// for a given color attribute (ie m -> mc = marker.color) look to see if we -// have a colorscale for it (ie mscl, mcmin, mcmax) - if we do, translate -// all numeric color values according to that scale -drawing.tryColorscale = function(cont, contIn, prefix) { - var colorArray = Lib.nestedProperty(cont, prefix + 'color').get(), - scl = Lib.nestedProperty(cont, prefix + 'colorscale').get(), - auto = Lib.nestedProperty(cont, prefix + 'cauto').get(), - minProp = Lib.nestedProperty(cont, prefix + 'cmin'), - maxProp = Lib.nestedProperty(cont, prefix + 'cmax'), - min = minProp.get(), - max = maxProp.get(); +drawing.tryColorscale = function(marker, prefix) { + var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker, + scl = cont.colorscale, + colorArray = cont.color; - // TODO handle this in Colorscale.calc if(scl && Array.isArray(colorArray)) { - if(auto || !isNumeric(min) || !isNumeric(max)) { - min = Infinity; - max = -Infinity; - colorArray.forEach(function(color) { - if(isNumeric(color)) { - if(min > color) min = +color; - if(max < color) max = +color; - } - }); - if(min > max) { - min = 0; - max = 1; - } - minProp.set(min); - maxProp.set(max); - Lib.nestedProperty(contIn, prefix + 'cmin').set(min); - Lib.nestedProperty(contIn, prefix + 'cmax').set(max); - } - return Colorscale.makeColorScaleFunc( - Colorscale.extractScale(scl, min, max) + Colorscale.extractScale(scl, cont.cmin, cont.cmax) ); } else return Lib.identity; @@ -89717,7 +89647,7 @@ drawing.setClipUrl = function(s, localId) { s.attr('clip-path', 'url(' + url + ')'); }; -},{"../../constants/xmlns_namespaces":618,"../../lib":632,"../../lib/svg_text_utils":646,"../../registry":738,"../../traces/scatter/make_bubble_size_func":859,"../../traces/scatter/subtypes":864,"../color":533,"../colorscale":548,"./symbol_defs":558,"d3":95,"fast-isnumeric":104}],558:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":618,"../../lib":633,"../../lib/svg_text_utils":647,"../../registry":739,"../../traces/scatter/make_bubble_size_func":861,"../../traces/scatter/subtypes":866,"../color":533,"../colorscale":547,"./symbol_defs":557,"d3":95,"fast-isnumeric":104}],557:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90193,7 +90123,7 @@ module.exports = { } }; -},{"d3":95}],559:[function(require,module,exports){ +},{"d3":95}],558:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90335,7 +90265,7 @@ module.exports = { } }; -},{}],560:[function(require,module,exports){ +},{}],559:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90398,7 +90328,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":662,"../../registry":738,"./compute_error":561,"fast-isnumeric":104}],561:[function(require,module,exports){ +},{"../../plots/cartesian/axes":664,"../../registry":739,"./compute_error":560,"fast-isnumeric":104}],560:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90494,7 +90424,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],562:[function(require,module,exports){ +},{}],561:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90571,7 +90501,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":632,"../../registry":738,"./attributes":559,"fast-isnumeric":104}],563:[function(require,module,exports){ +},{"../../lib":633,"../../registry":739,"./attributes":558,"fast-isnumeric":104}],562:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90630,7 +90560,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":559,"./calc":560,"./defaults":562,"./plot":564,"./style":565}],564:[function(require,module,exports){ +},{"./attributes":558,"./calc":559,"./defaults":561,"./plot":563,"./style":564}],563:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90794,7 +90724,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":864,"d3":95,"fast-isnumeric":104}],565:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":866,"d3":95,"fast-isnumeric":104}],564:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90831,7 +90761,7 @@ module.exports = function style(traces) { }); }; -},{"../color":533,"d3":95}],566:[function(require,module,exports){ +},{"../color":533,"d3":95}],565:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90846,7 +90776,16 @@ var cartesianConstants = require('../../plots/cartesian/constants'); module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'image', + + visible: { + valType: 'boolean', + role: 'info', + dflt: true, + description: [ + 'Determines whether or not this image is visible.' + ].join(' ') + }, source: { valType: 'string', @@ -90915,7 +90854,7 @@ module.exports = { }, x: { - valType: 'number', + valType: 'any', role: 'info', dflt: 0, description: [ @@ -90927,7 +90866,7 @@ module.exports = { }, y: { - valType: 'number', + valType: 'any', role: 'info', dflt: 0, description: [ @@ -90991,7 +90930,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":668}],567:[function(require,module,exports){ +},{"../../plots/cartesian/constants":669}],566:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91002,40 +90941,34 @@ module.exports = { 'use strict'; -var Axes = require('../../plots/cartesian/axes'); var Lib = require('../../lib'); -var attributes = require('./attributes'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var attributes = require('./attributes'); +var name = 'images'; module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { + var opts = { + name: name, + handleItemDefaults: imageDefaults + }; - if(!layoutIn.images || !Array.isArray(layoutIn.images)) return; - - - var containerIn = layoutIn.images, - containerOut = layoutOut.images = []; - - - for(var i = 0; i < containerIn.length; i++) { - var image = containerIn[i]; - - if(!image.source) continue; - - var defaulted = imageDefaults(containerIn[i] || {}, containerOut[i] || {}, layoutOut); - containerOut.push(defaulted); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function imageDefaults(imageIn, imageOut, fullLayout) { - imageOut = imageOut || {}; - function coerce(attr, dflt) { return Lib.coerce(imageIn, imageOut, attributes, attr, dflt); } - coerce('source'); + var source = coerce('source'); + var visible = coerce('visible', !!source); + + if(!visible) return imageOut; + coerce('layer'); coerce('x'); coerce('y'); @@ -91046,18 +90979,18 @@ function imageDefaults(imageIn, imageOut, fullLayout) { coerce('sizing'); coerce('opacity'); - for(var i = 0; i < 2; i++) { - var tdMock = { _fullLayout: fullLayout }, - axLetter = ['x', 'y'][i]; + var gdMock = { _fullLayout: fullLayout }, + axLetters = ['x', 'y']; + for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref - Axes.coerceRef(imageIn, imageOut, tdMock, axLetter, 'paper'); + Axes.coerceRef(imageIn, imageOut, gdMock, axLetters[i], 'paper'); } return imageOut; } -},{"../../lib":632,"../../plots/cartesian/axes":662,"./attributes":566}],568:[function(require,module,exports){ +},{"../../lib":633,"../../plots/array_container_defaults":661,"../../plots/cartesian/axes":664,"./attributes":565}],567:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91074,25 +91007,23 @@ var Axes = require('../../plots/cartesian/axes'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, imageDataAbove = [], imageDataSubplot = [], imageDataBelow = []; - if(!fullLayout.images) return; - - // Sort into top, subplot, and bottom layers for(var i = 0; i < fullLayout.images.length; i++) { var img = fullLayout.images[i]; - if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - imageDataSubplot.push(img); - } else if(img.layer === 'above') { - imageDataAbove.push(img); - } else { - imageDataBelow.push(img); + if(img.visible) { + if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { + imageDataSubplot.push(img); + } else if(img.layer === 'above') { + imageDataAbove.push(img); + } else { + imageDataBelow.push(img); + } } } @@ -91161,12 +91092,12 @@ module.exports = function draw(gd) { var thisImage = d3.select(this); // Axes if specified - var xref = Axes.getFromId(gd, d.xref), - yref = Axes.getFromId(gd, d.yref); + var xa = Axes.getFromId(gd, d.xref), + ya = Axes.getFromId(gd, d.yref); var size = fullLayout._size, - width = xref ? Math.abs(xref.l2p(d.sizex) - xref.l2p(0)) : d.sizex * size.w, - height = yref ? Math.abs(yref.l2p(d.sizey) - yref.l2p(0)) : d.sizey * size.h; + width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w, + height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset, @@ -91175,8 +91106,8 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xref ? xref.l2p(d.x) + xref._offset : d.x * size.w + size.l) + xOffset, - yPos = (yref ? yref.l2p(d.y) + yref._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset, + yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; // Construct the proper aspectRatio attribute @@ -91201,8 +91132,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xref ? xref._id : '', - yId = yref ? yref._id : '', + var xId = xa ? xa._id : '', + yId = ya ? ya._id : '', clipAxes = xId + yId; if(clipAxes) { @@ -91239,7 +91170,7 @@ module.exports = function draw(gd) { }); }; -},{"../../constants/xmlns_namespaces":618,"../../plots/cartesian/axes":662,"../drawing":557,"d3":95}],569:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":618,"../../plots/cartesian/axes":664,"../drawing":556,"d3":95}],568:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91250,21 +91181,17 @@ module.exports = function draw(gd) { 'use strict'; - -var draw = require('./draw'); -var supplyLayoutDefaults = require('./defaults'); -var attributes = require('./attributes'); - - module.exports = { moduleType: 'component', name: 'images', - draw: draw, - layoutAttributes: attributes, - supplyLayoutDefaults: supplyLayoutDefaults + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), + + draw: require('./draw') }; -},{"./attributes":566,"./defaults":567,"./draw":568}],570:[function(require,module,exports){ +},{"./attributes":565,"./defaults":566,"./draw":567}],569:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91313,7 +91240,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],571:[function(require,module,exports){ +},{}],570:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91428,7 +91355,7 @@ module.exports = { } }; -},{"../../lib/extend":625,"../../plots/font_attributes":683,"../color/attributes":532}],572:[function(require,module,exports){ +},{"../../lib/extend":626,"../../plots/font_attributes":684,"../color/attributes":532}],571:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91446,7 +91373,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],573:[function(require,module,exports){ +},{}],572:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91539,7 +91466,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":632,"../../plots/layout_attributes":714,"../../registry":738,"./attributes":571,"./helpers":576}],574:[function(require,module,exports){ +},{"../../lib":633,"../../plots/layout_attributes":715,"../../registry":739,"./attributes":570,"./helpers":575}],573:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92255,7 +92182,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../lib":632,"../../lib/svg_text_utils":646,"../../plotly":658,"../../plots/plots":723,"../../registry":738,"../color":533,"../dragelement":555,"../drawing":557,"./anchor_utils":570,"./constants":572,"./get_legend_data":575,"./helpers":576,"./style":578,"d3":95}],575:[function(require,module,exports){ +},{"../../lib":633,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/plots":724,"../../registry":739,"../color":533,"../dragelement":554,"../drawing":556,"./anchor_utils":569,"./constants":571,"./get_legend_data":574,"./helpers":575,"./style":577,"d3":95}],574:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92360,7 +92287,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":738,"./helpers":576}],576:[function(require,module,exports){ +},{"../../registry":739,"./helpers":575}],575:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92391,7 +92318,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":738}],577:[function(require,module,exports){ +},{"../../registry":739}],576:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92404,22 +92331,18 @@ exports.isReversed = function isReversed(legendLayout) { 'use strict'; -var legend = module.exports = {}; - - -legend.moduleType = 'component'; - -legend.name = 'legend'; - -legend.layoutAttributes = require('./attributes'); - -legend.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'legend', -legend.draw = require('./draw'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -legend.style = require('./style'); + draw: require('./draw'), + style: require('./style') +}; -},{"./attributes":571,"./defaults":573,"./draw":574,"./style":578}],578:[function(require,module,exports){ +},{"./attributes":570,"./defaults":572,"./draw":573,"./style":577}],577:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92641,7 +92564,7 @@ function stylePies(d) { if(pts.size()) pts.call(stylePie, d[0], trace); } -},{"../../lib":632,"../../registry":738,"../../traces/pie/style_one":838,"../../traces/scatter/subtypes":864,"../color":533,"../drawing":557,"d3":95}],579:[function(require,module,exports){ +},{"../../lib":633,"../../registry":739,"../../traces/pie/style_one":840,"../../traces/scatter/subtypes":866,"../color":533,"../drawing":556,"d3":95}],578:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93151,7 +93074,7 @@ modeBarButtons.resetViews = { } }; -},{"../../../build/ploticon":2,"../../lib":632,"../../plotly":658,"../../plots/cartesian/axes":662,"../../plots/plots":723,"../../snapshot/download":740}],580:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":633,"../../plotly":659,"../../plots/cartesian/axes":664,"../../plots/plots":724,"../../snapshot/download":741}],579:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93165,7 +93088,7 @@ modeBarButtons.resetViews = { exports.manage = require('./manage'); -},{"./manage":581}],581:[function(require,module,exports){ +},{"./manage":580}],580:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93393,7 +93316,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":662,"../../traces/scatter/subtypes":864,"./buttons":579,"./modebar":582}],582:[function(require,module,exports){ +},{"../../plots/cartesian/axes":664,"../../traces/scatter/subtypes":866,"./buttons":578,"./modebar":581}],581:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93683,7 +93606,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":632,"d3":95}],583:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":633,"d3":95}],582:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93700,7 +93623,8 @@ var extendFlat = require('../../lib/extend').extendFlat; var buttonAttrs = require('./button_attributes'); buttonAttrs = extendFlat(buttonAttrs, { - _isLinkedToArray: true, + _isLinkedToArray: 'button', + description: [ 'Sets the specifications for each buttons.', 'By default, a range selector comes with no buttons.' @@ -93787,7 +93711,7 @@ module.exports = { } }; -},{"../../lib/extend":625,"../../plots/font_attributes":683,"../color/attributes":532,"./button_attributes":584}],584:[function(require,module,exports){ +},{"../../lib/extend":626,"../../plots/font_attributes":684,"../color/attributes":532,"./button_attributes":583}],583:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93843,7 +93767,7 @@ module.exports = { } }; -},{}],585:[function(require,module,exports){ +},{}],584:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93872,7 +93796,7 @@ module.exports = { darkAmount: 10 }; -},{}],586:[function(require,module,exports){ +},{}],585:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93965,7 +93889,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":632,"../color":533,"./attributes":583,"./button_attributes":584,"./constants":585}],587:[function(require,module,exports){ +},{"../../lib":633,"../color":533,"./attributes":582,"./button_attributes":583,"./constants":584}],586:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94240,7 +94164,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":646,"../../plotly":658,"../../plots/cartesian/axis_ids":665,"../../plots/plots":723,"../color":533,"../drawing":557,"../legend/anchor_utils":570,"./constants":585,"./get_update_object":588,"d3":95}],588:[function(require,module,exports){ +},{"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/cartesian/axis_ids":667,"../../plots/plots":724,"../color":533,"../drawing":556,"../legend/anchor_utils":569,"./constants":584,"./get_update_object":587,"d3":95}],587:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94254,6 +94178,8 @@ function reposition(gd, buttons, opts, axName) { var d3 = require('d3'); +var Lib = require('../../lib'); + module.exports = function getUpdateObject(axisLayout, buttonLayout) { var axName = axisLayout._name; @@ -94274,7 +94200,7 @@ module.exports = function getUpdateObject(axisLayout, buttonLayout) { function getXRange(axisLayout, buttonLayout) { var currentRange = axisLayout.range; - var base = new Date(currentRange[1]); + var base = new Date(Lib.dateTime2ms(currentRange[1])); var step = buttonLayout.step, count = buttonLayout.count; @@ -94283,13 +94209,13 @@ function getXRange(axisLayout, buttonLayout) { switch(buttonLayout.stepmode) { case 'backward': - range0 = d3.time[step].offset(base, -count).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].offset(base, -count)); break; case 'todate': - var base2 = d3.time[step].offset(base, -(count - 1)); + var base2 = d3.time[step].offset(base, -count); - range0 = d3.time[step].floor(base2).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].ceil(base2)); break; } @@ -94298,7 +94224,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":95}],589:[function(require,module,exports){ +},{"../../lib":633,"d3":95}],588:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94309,18 +94235,18 @@ function getXRange(axisLayout, buttonLayout) { 'use strict'; +module.exports = { + moduleType: 'component', + name: 'rangeselector', -exports.moduleType = 'component'; - -exports.name = 'rangeselector'; - -exports.layoutAttributes = require('./attributes'); - -exports.handleDefaults = require('./defaults'); + layoutNodes: ['xaxis.'], + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":583,"./defaults":586,"./draw":587}],590:[function(require,module,exports){ +},{"./attributes":582,"./defaults":585,"./draw":586}],589:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94357,16 +94283,20 @@ module.exports = { valType: 'info_array', role: 'info', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], description: [ 'Sets the range of the range slider.', 'If not set, defaults to the full xaxis range.', 'If the axis `type` is *log*, then you must take the', 'log of your desired range.', - 'If the axis `type` is *date*, then you must convert', - 'the date to unix time in milliseconds.' + 'If the axis `type` is *date*, it should be date strings,', + 'like date data, though Date objects and unix milliseconds', + 'will be accepted and converted to strings.', + 'If the axis `type` is *category*, it should be numbers,', + 'using the scale where each category is assigned a serial', + 'number from zero in the order it appears.' ].join(' ') }, thickness: { @@ -94391,7 +94321,7 @@ module.exports = { } }; -},{"../color/attributes":532}],591:[function(require,module,exports){ +},{"../color/attributes":532}],590:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94444,7 +94374,7 @@ module.exports = { handleStroke: '#666', }; -},{}],592:[function(require,module,exports){ +},{}],591:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94468,7 +94398,8 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe } var containerIn = layoutIn[axName].rangeslider, - containerOut = layoutOut[axName].rangeslider = {}; + axOut = layoutOut[axName], + containerOut = axOut.rangeslider = {}; function coerce(attr, dflt) { return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); @@ -94482,14 +94413,16 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe coerce('range'); // Expand slider range to the axis range - if(containerOut.range && !layoutOut[axName].autorange) { + if(containerOut.range && !axOut.autorange) { var outRange = containerOut.range, - axRange = layoutOut[axName].range; + axRange = axOut.range, + l2r = axOut.l2r, + r2l = axOut.r2l; - outRange[0] = Math.min(outRange[0], axRange[0]); - outRange[1] = Math.max(outRange[1], axRange[1]); + outRange[0] = l2r(Math.min(r2l(outRange[0]), r2l(axRange[0]))); + outRange[1] = l2r(Math.max(r2l(outRange[1]), r2l(axRange[1]))); } else { - layoutOut[axName]._needsExpand = true; + axOut._needsExpand = true; } if(containerOut.visible) { @@ -94504,7 +94437,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe containerOut._input = containerIn; }; -},{"../../lib":632,"./attributes":590}],593:[function(require,module,exports){ +},{"../../lib":633,"./attributes":589}],592:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94611,20 +94544,10 @@ module.exports = function(gd) { rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); - // update inner nodes - - rangeSlider - .call(drawBg, gd, axisOpts, opts) - .call(addClipPath, gd, axisOpts, opts) - .call(drawRangePlot, gd, axisOpts, opts) - .call(drawMasks, gd, axisOpts, opts) - .call(drawSlideBox, gd, axisOpts, opts) - .call(drawGrabbers, gd, axisOpts, opts); - // update data <--> pixel coordinate conversion methods - var range0 = opts.range[0], - range1 = opts.range[1], + var range0 = axisOpts.r2l(opts.range[0]), + range1 = axisOpts.r2l(opts.range[1]), dist = range1 - range0; opts.p2d = function(v) { @@ -94635,6 +94558,18 @@ module.exports = function(gd) { return (v - range0) / dist * opts._width; }; + opts._rl = [range0, range1]; + + // update inner nodes + + rangeSlider + .call(drawBg, gd, axisOpts, opts) + .call(addClipPath, gd, axisOpts, opts) + .call(drawRangePlot, gd, axisOpts, opts) + .call(drawMasks, gd, axisOpts, opts) + .call(drawSlideBox, gd, axisOpts, opts) + .call(drawGrabbers, gd, axisOpts, opts); + // setup drag element setupDragElement(rangeSlider, gd, axisOpts, opts); @@ -94672,8 +94607,8 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { target = event.target, startX = event.clientX, offsetX = startX - rangeSlider.node().getBoundingClientRect().left, - minVal = opts.d2p(axisOpts.range[0]), - maxVal = opts.d2p(axisOpts.range[1]); + minVal = opts.d2p(axisOpts._rl[0]), + maxVal = opts.d2p(axisOpts._rl[1]); var dragCover = dragElement.coverSlip(); @@ -94734,7 +94669,7 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { function setDataRange(rangeSlider, gd, axisOpts, opts) { function clamp(v) { - return Lib.constrain(v, opts.range[0], opts.range[1]); + return axisOpts.l2r(Lib.constrain(v, opts._rl[0], opts._rl[1])); } var dataMin = clamp(opts.p2d(opts._pixelMin)), @@ -94751,8 +94686,8 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts) { return Lib.constrain(v, 0, opts._width); } - var pixelMin = clamp(opts.d2p(axisOpts.range[0])), - pixelMax = clamp(opts.d2p(axisOpts.range[1])); + var pixelMin = clamp(opts.d2p(axisOpts._rl[0])), + pixelMax = clamp(opts.d2p(axisOpts._rl[1])); rangeSlider.select('rect.' + constants.slideBoxClassName) .attr('x', pixelMin) @@ -94845,6 +94780,7 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) { data: [], layout: { xaxis: { + type: axisOpts.type, domain: [0, 1], range: opts.range.slice() }, @@ -95026,7 +94962,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":632,"../../lib/setcursor":642,"../../plotly":658,"../../plots/cartesian":671,"../../plots/cartesian/axes":662,"../../plots/plots":723,"../color":533,"../dragelement":555,"../drawing":557,"./constants":591,"d3":95}],594:[function(require,module,exports){ +},{"../../lib":633,"../../lib/setcursor":643,"../../plotly":659,"../../plots/cartesian":672,"../../plots/cartesian/axes":664,"../../plots/plots":724,"../color":533,"../dragelement":554,"../drawing":556,"./constants":590,"d3":95}],593:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95040,12 +94976,15 @@ function clearPushMargins(gd) { module.exports = { moduleType: 'component', name: 'rangeslider', + + layoutNodes: ['xaxis.'], layoutAttributes: require('./attributes'), handleDefaults: require('./defaults'), + draw: require('./draw') }; -},{"./attributes":590,"./defaults":592,"./draw":593}],595:[function(require,module,exports){ +},{"./attributes":589,"./defaults":591,"./draw":592}],594:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95063,7 +95002,16 @@ var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'shape', + + visible: { + valType: 'boolean', + role: 'info', + dflt: true, + description: [ + 'Determines whether or not this shape is visible.' + ].join(' ') + }, type: { valType: 'enumerated', @@ -95203,7 +95151,7 @@ module.exports = { } }; -},{"../../lib/extend":625,"../../traces/scatter/attributes":844,"../annotations/attributes":526}],596:[function(require,module,exports){ +},{"../../lib/extend":626,"../../traces/scatter/attributes":846,"../annotations/attributes":526}],595:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95215,6 +95163,7 @@ module.exports = { 'use strict'; +var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); var constants = require('./constants'); @@ -95223,7 +95172,7 @@ var helpers = require('./helpers'); module.exports = function calcAutorange(gd) { var fullLayout = gd._fullLayout, - shapeList = fullLayout.shapes; + shapeList = Lib.filterVisible(fullLayout.shapes); if(!shapeList.length || !gd._fullData.length) return; @@ -95279,7 +95228,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../plots/cartesian/axes":662,"./constants":597,"./helpers":600}],597:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"./constants":596,"./helpers":599}],596:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95343,7 +95292,7 @@ module.exports = { } }; -},{}],598:[function(require,module,exports){ +},{}],597:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95355,22 +95304,20 @@ module.exports = { 'use strict'; +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var handleShapeDefaults = require('./shape_defaults'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - var containerIn = layoutIn.shapes || [], - containerOut = layoutOut.shapes = []; - - for(var i = 0; i < containerIn.length; i++) { - var shapeIn = containerIn[i] || {}, - shapeOut = handleShapeDefaults(shapeIn, layoutOut); + var opts = { + name: 'shapes', + handleItemDefaults: handleShapeDefaults + }; - containerOut.push(shapeOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"./shape_defaults":602}],599:[function(require,module,exports){ +},{"../../plots/array_container_defaults":661,"./shape_defaults":601}],598:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95422,7 +95369,9 @@ function draw(gd) { fullLayout._shapeSubplotLayer.selectAll('path').remove(); for(var i = 0; i < fullLayout.shapes.length; i++) { - drawOne(gd, i); + if(fullLayout.shapes[i].visible) { + drawOne(gd, i); + } } // may need to resurrect this if we put text (LaTeX) in shapes @@ -95542,8 +95491,6 @@ function updateShape(gd, index, opt, value) { // TODO: clean this up and remove it. if(!optionsIn) return; - var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; - // alter the input shape as requested var optionsEdit = {}; if(typeof opt === 'string' && opt) optionsEdit[opt] = value; @@ -95555,7 +95502,12 @@ function updateShape(gd, index, opt, value) { Lib.nestedProperty(optionsIn, k).set(optionsEdit[k]); } - var posAttrs = ['x0', 'x1', 'y0', 'y1']; + // return early in visible: false updates + if(optionsIn.visible === false) return; + + var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}, + posAttrs = ['x0', 'x1', 'y0', 'y1']; + for(i = 0; i < 4; i++) { var posAttr = posAttrs[i]; // if we don't have an explicit position already, @@ -95570,18 +95522,17 @@ function updateShape(gd, index, opt, value) { var axLetter = posAttr.charAt(0), axOld = Axes.getFromId(gd, - Axes.coerceRef(oldRef, {}, gd, axLetter)), + Axes.coerceRef(oldRef, {}, gd, axLetter, '', 'paper')), axNew = Axes.getFromId(gd, - Axes.coerceRef(optionsIn, {}, gd, axLetter)), + Axes.coerceRef(optionsIn, {}, gd, axLetter, '', 'paper')), position = optionsIn[posAttr], - linearizedPosition; + rangePosition; if(optionsEdit[axLetter + 'ref'] !== undefined) { // first convert to fraction of the axis if(axOld) { - linearizedPosition = helpers.dataToLinear(axOld)(position); - position = (linearizedPosition - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + rangePosition = helpers.shapePositionToRange(axOld)(position); + position = axOld.r2fraction(rangePosition); } else { position = (position - axNew.domain[0]) / (axNew.domain[1] - axNew.domain[0]); @@ -95589,9 +95540,8 @@ function updateShape(gd, index, opt, value) { if(axNew) { // then convert to new data coordinates at the same fraction - linearizedPosition = axNew.range[0] + position * - (axNew.range[1] - axNew.range[0]); - position = helpers.linearToData(axNew)(linearizedPosition); + rangePosition = axNew.fraction2r(position); + position = helpers.rangeToShapePosition(axNew)(rangePosition); } else { // or scale to the whole plot position = axOld.domain[0] + @@ -95602,7 +95552,8 @@ function updateShape(gd, index, opt, value) { optionsIn[posAttr] = position; } - var options = handleShapeDefaults(optionsIn, gd._fullLayout); + var options = {}; + handleShapeDefaults(optionsIn, options, gd._fullLayout); gd._fullLayout.shapes[index] = options; var clipAxes; @@ -95836,22 +95787,22 @@ function getPathString(gd, options) { xa = Axes.getFromId(gd, options.xref), ya = Axes.getFromId(gd, options.yref), gs = gd._fullLayout._size, - x2l, + x2r, x2p, - y2l, + y2r, y2p; if(xa) { - x2l = helpers.dataToLinear(xa); - x2p = function(v) { return xa._offset + xa.l2p(x2l(v, true)); }; + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2l = helpers.dataToLinear(ya); - y2p = function(v) { return ya._offset + ya.l2p(y2l(v, true)); }; + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; @@ -95933,7 +95884,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":632,"../../lib/setcursor":642,"../../plotly":658,"../../plots/cartesian/axes":662,"../color":533,"../dragelement":555,"../drawing":557,"./constants":597,"./defaults":598,"./helpers":600,"./shape_defaults":602,"fast-isnumeric":104}],600:[function(require,module,exports){ +},{"../../lib":633,"../../lib/setcursor":643,"../../plotly":659,"../../plots/cartesian/axes":664,"../color":533,"../dragelement":554,"../drawing":556,"./constants":596,"./defaults":597,"./helpers":599,"./shape_defaults":601,"fast-isnumeric":104}],599:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95950,16 +95901,16 @@ function movePath(pathIn, moveX, moveY) { // so these have to be specified in terms of the category serial numbers, // but can take fractional values. Other axis types we specify position based on // the actual data values. -// TODO: this should really be part of axes, but for now it's only used here. -// eventually annotations and axis ranges will use this too. -// what should we do, invent a new letter for "data except if it's category"? +// TODO: in V2.0 (when log axis ranges are in data units) range and shape position +// will be identical, so rangeToShapePosition and shapePositionToRange can be +// removed entirely. -exports.dataToLinear = function(ax) { - return ax.type === 'category' ? ax.c2l : ax.d2l; +exports.rangeToShapePosition = function(ax) { + return (ax.type === 'log') ? ax.r2d : function(v) { return v; }; }; -exports.linearToData = function(ax) { - return ax.type === 'category' ? ax.l2c : ax.l2d; +exports.shapePositionToRange = function(ax) { + return (ax.type === 'log') ? ax.d2r : function(v) { return v; }; }; exports.decodeDate = function(convertToPx) { @@ -95978,10 +95929,10 @@ exports.getDataToPixel = function(gd, axis, isVertical) { dataToPixel; if(axis) { - var d2l = exports.dataToLinear(axis); + var d2r = exports.shapePositionToRange(axis); dataToPixel = function(v) { - return axis._offset + axis.l2p(d2l(v, true)); + return axis._offset + axis.r2p(d2r(v, true)); }; if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); @@ -96001,8 +95952,8 @@ exports.getPixelToData = function(gd, axis, isVertical) { pixelToData; if(axis) { - var l2d = exports.linearToData(axis); - pixelToData = function(p) { return l2d(axis.p2l(p - axis._offset)); }; + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; @@ -96014,7 +95965,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],601:[function(require,module,exports){ +},{}],600:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -96026,21 +95977,21 @@ exports.getPixelToData = function(gd, axis, isVertical) { 'use strict'; -exports.moduleType = 'component'; - -exports.name = 'shapes'; - -exports.layoutAttributes = require('./attributes'); +var drawModule = require('./draw'); -exports.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'shapes', -exports.calcAutorange = require('./calc_autorange'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne +}; -},{"./attributes":595,"./calc_autorange":596,"./defaults":598,"./draw":599}],602:[function(require,module,exports){ +},{"./attributes":594,"./calc_autorange":595,"./defaults":597,"./draw":598}],601:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -96058,13 +96009,19 @@ var Axes = require('../../plots/cartesian/axes'); var attributes = require('./attributes'); var helpers = require('./helpers'); -module.exports = function handleShapeDefaults(shapeIn, fullLayout) { - var shapeOut = {}; + +module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opts, itemOpts) { + opts = opts || {}; + itemOpts = itemOpts || {}; function coerce(attr, dflt) { return Lib.coerce(shapeIn, shapeOut, attributes, attr, dflt); } + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + + if(!visible) return shapeOut; + coerce('layer'); coerce('opacity'); coerce('fillcolor'); @@ -96079,39 +96036,61 @@ module.exports = function handleShapeDefaults(shapeIn, fullLayout) { var axLetters = ['x', 'y']; for(var i = 0; i < 2; i++) { var axLetter = axLetters[i], - tdMock = {_fullLayout: fullLayout}; + gdMock = {_fullLayout: fullLayout}; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, tdMock, axLetter); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); if(shapeType !== 'path') { var dflt0 = 0.25, - dflt1 = 0.75; + dflt1 = 0.75, + ax, + pos2r, + r2pos; if(axRef !== 'paper') { - var ax = Axes.getFromId(tdMock, axRef), - convertFn = helpers.linearToData(ax); - - dflt0 = convertFn(ax.range[0] + dflt0 * (ax.range[1] - ax.range[0])); - dflt1 = convertFn(ax.range[0] + dflt1 * (ax.range[1] - ax.range[0])); + ax = Axes.getFromId(gdMock, axRef); + r2pos = helpers.rangeToShapePosition(ax); + pos2r = helpers.shapePositionToRange(ax); + } + else { + pos2r = r2pos = Lib.identity; } + // hack until V2.0 when log has regular range behavior - make it look like other + // ranges to send to coerce, then put it back after + // this is all to give reasonable default position behavior on log axes, which is + // a pretty unimportant edge case so we could just ignore this. + var attr0 = axLetter + '0', + attr1 = axLetter + '1', + in0 = shapeIn[attr0], + in1 = shapeIn[attr1]; + shapeIn[attr0] = pos2r(shapeIn[attr0], true); + shapeIn[attr1] = pos2r(shapeIn[attr1], true); + // x0, x1 (and y0, y1) - coerce(axLetter + '0', dflt0); - coerce(axLetter + '1', dflt1); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr0, dflt0); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr1, dflt1); + + // hack part 2 + shapeOut[attr0] = r2pos(shapeOut[attr0]); + shapeOut[attr1] = r2pos(shapeOut[attr1]); + shapeIn[attr0] = in0; + shapeIn[attr1] = in1; } } if(shapeType === 'path') { coerce('path'); - } else { + } + else { Lib.noneOrAll(shapeIn, shapeOut, ['x0', 'x1', 'y0', 'y1']); } return shapeOut; }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"./attributes":595,"./helpers":600}],603:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"./attributes":594,"./helpers":599}],602:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -96130,7 +96109,7 @@ var animationAttrs = require('../../plots/animation_attributes'); var constants = require('./constants'); var stepsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'step', method: { valType: 'enumerated', @@ -96171,6 +96150,8 @@ var stepsAttrs = { }; module.exports = { + _isLinkedToArray: 'slider', + visible: { valType: 'boolean', role: 'info', @@ -96383,7 +96364,7 @@ module.exports = { }, }; -},{"../../lib/extend":625,"../../plots/animation_attributes":659,"../../plots/font_attributes":683,"../../plots/pad_attributes":722,"./constants":604}],604:[function(require,module,exports){ +},{"../../lib/extend":626,"../../plots/animation_attributes":660,"../../plots/font_attributes":684,"../../plots/pad_attributes":723,"./constants":603}],603:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -96398,9 +96379,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'sliders', - itemName: 'slider', // class names containerClassName: 'slider-container', @@ -96481,7 +96461,7 @@ module.exports = { currentValueInset: 0, }; -},{}],605:[function(require,module,exports){ +},{}],604:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -96493,6 +96473,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -96502,23 +96483,12 @@ var stepAttrs = attributes.steps; module.exports = function slidersDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var sliderIn = contIn[i] || {}, - sliderOut = {}; - - sliderDefaults(sliderIn, sliderOut, layoutOut); - - // used on button click to update the 'active' field - sliderOut._input = sliderIn; - - // used to determine object constancy - sliderOut._index = i; + var opts = { + name: name, + handleItemDefaults: sliderDefaults + }; - contOut.push(sliderOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function sliderDefaults(sliderIn, sliderOut, layoutOut) { @@ -96604,7 +96574,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":632,"./attributes":603,"./constants":604}],606:[function(require,module,exports){ +},{"../../lib":633,"../../plots/array_container_defaults":661,"./attributes":602,"./constants":603}],605:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -96973,6 +96943,7 @@ function handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, doTransiti } function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) { + var previousActive = sliderOpts.active; sliderOpts._input.active = sliderOpts.active = index; var step = sliderOpts.steps[sliderOpts.active]; @@ -96980,6 +96951,13 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) sliderGroup.call(setGripPosition, sliderOpts, sliderOpts.active / (sliderOpts.steps.length - 1), doTransition); sliderGroup.call(drawCurrentValue, sliderOpts); + gd.emit('plotly_sliderchange', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active], + interaction: doCallback, + previousActive: previousActive + }); + if(step && step.method && doCallback) { if(sliderGroup._nextMethod) { // If we've already queued up an update, just overwrite it with the most recent: @@ -97006,6 +96984,8 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { var $gd = d3.select(gd); item.on('mousedown', function() { + gd.emit('plotly_sliderstart', {slider: sliderOpts}); + var grip = sliderGroup.select('.' + constants.gripRectClass); d3.event.stopPropagation(); @@ -97026,6 +97006,11 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { grip.call(Color.fill, sliderOpts.bgcolor); $gd.on('mouseup', null); $gd.on('mousemove', null); + + gd.emit('plotly_sliderend', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active] + }); }); }); } @@ -97163,7 +97148,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":632,"../../lib/svg_text_utils":646,"../../plots/plots":723,"../color":533,"../drawing":557,"../legend/anchor_utils":570,"./constants":604,"d3":95}],607:[function(require,module,exports){ +},{"../../lib":633,"../../lib/svg_text_utils":647,"../../plots/plots":724,"../color":533,"../drawing":556,"../legend/anchor_utils":569,"./constants":603,"d3":95}],606:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -97174,18 +97159,19 @@ function clearPushMargins(gd) { 'use strict'; +var constants = require('./constants'); -exports.moduleType = 'component'; - -exports.name = 'sliders'; - -exports.layoutAttributes = require('./attributes'); +module.exports = { + moduleType: 'component', + name: constants.name, -exports.supplyLayoutDefaults = require('./defaults'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":603,"./defaults":605,"./draw":606}],608:[function(require,module,exports){ +},{"./attributes":602,"./constants":603,"./defaults":604,"./draw":605}],607:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -97415,7 +97401,7 @@ Titles.draw = function(gd, titleClass, options) { el.classed('js-placeholder', isplaceholder); }; -},{"../../lib":632,"../../lib/svg_text_utils":646,"../../plotly":658,"../../plots/plots":723,"../color":533,"../drawing":557,"d3":95,"fast-isnumeric":104}],609:[function(require,module,exports){ +},{"../../lib":633,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/plots":724,"../color":533,"../drawing":556,"d3":95,"fast-isnumeric":104}],608:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -97432,7 +97418,7 @@ var extendFlat = require('../../lib/extend').extendFlat; var padAttrs = require('../../plots/pad_attributes'); var buttonsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'button', method: { valType: 'enumerated', @@ -97466,7 +97452,7 @@ var buttonsAttrs = { }; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'updatemenu', visible: { valType: 'boolean', @@ -97587,7 +97573,7 @@ module.exports = { } }; -},{"../../lib/extend":625,"../../plots/font_attributes":683,"../../plots/pad_attributes":722,"../color/attributes":532}],610:[function(require,module,exports){ +},{"../../lib/extend":626,"../../plots/font_attributes":684,"../../plots/pad_attributes":723,"../color/attributes":532}],609:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -97602,9 +97588,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'updatemenus', - itemName: 'updatemenu', // class names containerClassName: 'updatemenu-container', @@ -97664,7 +97649,7 @@ module.exports = { hoverColor: '#F4FAFF' }; -},{}],611:[function(require,module,exports){ +},{}],610:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -97676,6 +97661,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -97685,23 +97671,12 @@ var buttonAttrs = attributes.buttons; module.exports = function updateMenusDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var menuIn = contIn[i] || {}, - menuOut = {}; - - menuDefaults(menuIn, menuOut, layoutOut); - - // used on button click to update the 'active' field - menuOut._input = menuIn; - - // used to determine object constancy - menuOut._index = i; + var opts = { + name: name, + handleItemDefaults: menuDefaults + }; - contOut.push(menuOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function menuDefaults(menuIn, menuOut, layoutOut) { @@ -97768,7 +97743,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":632,"./attributes":609,"./constants":610}],612:[function(require,module,exports){ +},{"../../lib":633,"../../plots/array_container_defaults":661,"./attributes":608,"./constants":609}],611:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -98070,6 +98045,8 @@ function drawButtons(gd, gHeader, gButton, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, buttonIndex); Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + + gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); button.on('mouseover', function() { @@ -98349,29 +98326,9 @@ function clearPushMargins(gd) { } } -},{"../../lib":632,"../../lib/svg_text_utils":646,"../../plots/plots":723,"../color":533,"../drawing":557,"../legend/anchor_utils":570,"./constants":610,"d3":95}],613:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - - -exports.moduleType = 'component'; - -exports.name = 'updatemenus'; - -exports.layoutAttributes = require('./attributes'); - -exports.supplyLayoutDefaults = require('./defaults'); - -exports.draw = require('./draw'); - -},{"./attributes":609,"./defaults":611,"./draw":612}],614:[function(require,module,exports){ +},{"../../lib":633,"../../lib/svg_text_utils":647,"../../plots/plots":724,"../color":533,"../drawing":556,"../legend/anchor_utils":569,"./constants":609,"d3":95}],612:[function(require,module,exports){ +arguments[4][606][0].apply(exports,arguments) +},{"./attributes":608,"./constants":609,"./defaults":610,"./draw":611,"dup":606}],613:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -98392,7 +98349,7 @@ module.exports = { longdashdot: [8, 1, 1, 1] }; -},{}],615:[function(require,module,exports){ +},{}],614:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -98413,7 +98370,7 @@ module.exports = { longdashdot: [[0.5, 0.7, 0.8, 1], 10] }; -},{}],616:[function(require,module,exports){ +},{}],615:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -98436,6 +98393,48 @@ module.exports = { x: '❌' }; +},{}],616:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + + +module.exports = { + /** + * Standardize all missing data in calcdata to use undefined + * never null or NaN. + * That way we can use !==undefined, or !== BADNUM, + * to test for real data + */ + BADNUM: undefined, + + /* + * Limit certain operations to well below floating point max value + * to avoid glitches: Make sure that even when you multiply it by the + * number of pixels on a giant screen it still works + */ + FP_SAFE: Number.MAX_VALUE / 10000, + + /* + * conversion of date units to milliseconds + * year and month constants are marked "AVG" + * to remind us that not all years and months + * have the same length + */ + ONEAVGYEAR: 31557600000, // 365.25 days + ONEAVGMONTH: 2629800000, // 1/12 of ONEAVGYEAR + ONEDAY: 86400000, + ONEHOUR: 3600000, + ONEMIN: 60000, + ONESEC: 1000 +}; + },{}],617:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. @@ -98516,7 +98515,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.19.2'; +exports.version = '1.20.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -98577,7 +98576,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":531,"./components/images":569,"./components/legend":577,"./components/rangeselector":589,"./components/rangeslider":594,"./components/shapes":601,"./components/sliders":607,"./components/updatemenus":613,"./fonts/mathjax_config":620,"./lib/queue":640,"./plot_api/plot_schema":652,"./plot_api/register":653,"./plot_api/set_plot_config":654,"./plot_api/to_image":656,"./plot_api/validate":657,"./plotly":658,"./snapshot":743,"./snapshot/download":740,"./traces/scatter":854,"d3":95,"es6-promise":101}],620:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":531,"./components/images":568,"./components/legend":576,"./components/rangeselector":588,"./components/rangeslider":593,"./components/shapes":600,"./components/sliders":606,"./components/updatemenus":612,"./fonts/mathjax_config":620,"./lib/queue":641,"./plot_api/plot_schema":653,"./plot_api/register":654,"./plot_api/set_plot_config":655,"./plot_api/to_image":657,"./plot_api/validate":658,"./plotly":659,"./snapshot":744,"./snapshot/download":741,"./traces/scatter":856,"d3":95,"es6-promise":101}],620:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -98637,22 +98636,50 @@ module.exports = function arrayToCalcItem(traceAttr, calcItem, calcAttr, i) { */ +'use strict'; + +var isNumeric = require('fast-isnumeric'); + +var BADNUM = require('../constants/numerical').BADNUM; + +// precompile these regex's for speed +var FRONTJUNK = /^['"%,$#\s']+/; +var ENDJUNK = /['"%,$#\s']+$/; + +/** + * cleanNumber: remove common leading and trailing cruft + * Always returns either a number or BADNUM. + */ +module.exports = function cleanNumber(v) { + if(typeof v === 'string') { + v = v.replace(FRONTJUNK, '').replace(ENDJUNK, ''); + } + + if(isNumeric(v)) return Number(v); + + return BADNUM; +}; + +},{"../constants/numerical":616,"fast-isnumeric":104}],623:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + 'use strict'; var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); -var nestedProperty = require('./nested_property'); -var isPlainObject = require('./is_plain_object'); -var filterUnique = require('./filter_unique'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); +var nestedProperty = require('./nested_property'); -var idRegex = /^([2-9]|[1-9][0-9]+)$/; - -function isValObject(obj) { - return obj && obj.valType !== undefined; -} +var ID_REGEX = /^([2-9]|[1-9][0-9]+)$/; exports.valObjects = { data_array: { @@ -98804,7 +98831,7 @@ exports.valObjects = { coerceFunction: function(v, propOut, dflt) { var dlen = dflt.length; if(typeof v === 'string' && v.substr(0, dlen) === dflt && - idRegex.test(v.substr(dlen))) { + ID_REGEX.test(v.substr(dlen))) { propOut.set(v); return; } @@ -98816,7 +98843,7 @@ exports.valObjects = { if(v === dflt) return true; if(typeof v !== 'string') return false; - if(v.substr(0, dlen) === dflt && idRegex.test(v.substr(dlen))) { + if(v.substr(0, dlen) === dflt && ID_REGEX.test(v.substr(dlen))) { return true; } @@ -98992,129 +99019,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -/* - * returns true for a valid value object and false for tree nodes in the attribute hierarchy - */ -exports.isValObject = isValObject; - -exports.IS_SUBPLOT_OBJ = '_isSubplotObj'; -exports.IS_LINKED_TO_ARRAY = '_isLinkedToArray'; -exports.DEPRECATED = '_deprecated'; - -// list of underscore attributes to keep in schema as is -exports.UNDERSCORE_ATTRS = [exports.IS_SUBPLOT_OBJ, exports.IS_LINKED_TO_ARRAY, exports.DEPRECATED]; - -/** - * Crawl the attribute tree, recursively calling a callback function - * - * @param {object} attrs - * The node of the attribute tree (e.g. the root) from which recursion originates - * @param {Function} callback - * A callback function with the signature: - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * @param {Number} [specifiedLevel] - * The level in the tree, in order to let the callback function detect descend or backtrack, - * typically unsupplied (implied 0), just used by the self-recursive call. - * The necessity arises because the tree traversal is not controlled by callback return values. - * The decision to not use callback return values for controlling tree pruning arose from - * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions - * precedes the callback call. - * - * @return {object} transformOut - * copy of transformIn that contains attribute defaults - */ -exports.crawl = function(attrs, callback, specifiedLevel) { - var level = specifiedLevel || 0; - Object.keys(attrs).forEach(function(attrName) { - var attr = attrs[attrName]; - - if(exports.UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - - callback(attr, attrName, attrs, level); - - if(isValObject(attr)) return; - if(isPlainObject(attr)) exports.crawl(attr, callback, level + 1); - }); -}; - -/** - * Find all data array attributes in a given trace object - including - * `arrayOk` attributes. - * - * @param {object} trace - * full trace object that contains a reference to `_module.attributes` - * - * @return {array} arrayAttributes - * list of array attributes for the given trace - */ -exports.findArrayAttributes = function(trace) { - var arrayAttributes = [], - stack = []; - - /** - * A closure that gathers attribute paths into its enclosed arraySplitAttributes - * Attribute paths are collected iff their leaf node is a splittable attribute - * - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * - * @closureVariable {String[][]} arrayAttributes the set of gathered attributes - * Example of filled closure variable (expected to be initialized to []): - * [["marker","size"],["marker","line","width"],["marker","line","color"]] - */ - function callback(attr, attrName, attrs, level) { - stack = stack.slice(0, level).concat([attrName]); - - var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; - if(!splittableAttr) return; - - var astr = toAttrString(stack); - var val = nestedProperty(trace, astr).get(); - if(!Array.isArray(val)) return; - - arrayAttributes.push(astr); - } - - function toAttrString(stack) { - return stack.join('.'); - } - - exports.crawl(trace._module.attributes, callback); - - if(trace.transforms) { - var transforms = trace.transforms; - - for(var i = 0; i < transforms.length; i++) { - var transform = transforms[i]; - - stack = ['transforms[' + i + ']']; - exports.crawl(transform._module.attributes, callback, 1); - } - } - - // Look into the fullInput module attributes for array attributes - // to make sure that 'custom' array attributes are detected. - // - // At the moment, we need this block to make sure that - // ohlc and candlestick 'open', 'high', 'low', 'close' can be - // used with filter ang groupby transforms. - if(trace._fullInput) { - exports.crawl(trace._fullInput._module.attributes, callback); - - arrayAttributes = filterUnique(arrayAttributes); - } - - return arrayAttributes; -}; - -},{"../components/colorscale/get_scale":546,"../components/colorscale/scales":552,"./filter_unique":626,"./is_plain_object":634,"./nested_property":637,"fast-isnumeric":104,"tinycolor2":489}],623:[function(require,module,exports){ +},{"../components/colorscale/get_scale":545,"../components/colorscale/scales":551,"./nested_property":638,"fast-isnumeric":104,"tinycolor2":489}],624:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99129,6 +99034,24 @@ exports.findArrayAttributes = function(trace) { var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); +var logError = require('./loggers').error; + +var constants = require('../constants/numerical'); +var BADNUM = constants.BADNUM; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + +// is an object a javascript date? +exports.isJSDate = function(v) { + return typeof v === 'object' && v !== null && typeof v.getTime === 'function'; +}; + +// The absolute limits of our date-time system +// This is a little weird: we use MIN_MS and MAX_MS in dateTime2ms +// but we use dateTime2ms to calculate them (after defining it!) +var MIN_MS, MAX_MS; /** * dateTime2ms - turn a date object or string s of the form @@ -99136,7 +99059,13 @@ var isNumeric = require('fast-isnumeric'); * per javascript standard) * may truncate after any full field, and sss can be any length * even >3 digits, though javascript dates truncate to milliseconds - * returns false if it doesn't find a date + * returns BADNUM if it doesn't find a date + * + * Expanded to support negative years to -9999 but you must always + * give 4 digits, except for 2-digit positive years which we assume are + * near the present time. + * Note that we follow ISO 8601:2004: there *is* a year 0, which + * is 1BC/BCE, and -1===2BC etc. * * 2-digit to 4-digit year conversion, where to cut off? * from http://support.microsoft.com/kb/244664: @@ -99144,85 +99073,123 @@ var isNumeric = require('fast-isnumeric'); * but in my mac chrome from eg. d=new Date(Date.parse('8/19/50')): * 1950-2049 * by Java, from http://stackoverflow.com/questions/2024273/: - * now-80 - now+20 + * now-80 - now+19 * or FileMaker Pro, from * http://www.filemaker.com/12help/html/add_view_data.4.21.html: - * now-70 - now+30 + * now-70 - now+29 * but python strptime etc, via * http://docs.python.org/py3k/library/time.html: * 1969-2068 (super forward-looking, but static, not sliding!) * - * lets go with now-70 to now+30, and if anyone runs into this problem + * lets go with now-70 to now+29, and if anyone runs into this problem * they can learn the hard way not to use 2-digit years, as no choice we * make now will cover all possibilities. mostly this will all be taken * care of in initial parsing, should only be an issue for hand-entered data - * currently (2012) this range is: - * 1942-2041 + * currently (2016) this range is: + * 1946-2045 */ exports.dateTime2ms = function(s) { // first check if s is a date object - try { - if(s.getTime) return +s; - } - catch(e) { - return false; + if(exports.isJSDate(s)) { + s = Number(s); + if(s >= MIN_MS && s <= MAX_MS) return s; + return BADNUM; } + // otherwise only accept strings and numbers + if(typeof s !== 'string' && typeof s !== 'number') return BADNUM; var y, m, d, h; // split date and time parts - var datetime = String(s).split(' '); - if(datetime.length > 2) return false; + // TODO: we strip leading/trailing whitespace but not other + // characters like we do for numbers - do we want to? + var datetime = String(s).trim().split(' '); + if(datetime.length > 2) return BADNUM; var p = datetime[0].split('-'); // date part - if(p.length > 3 || (p.length !== 3 && datetime[1])) return false; + + var CE = true; // common era, ie positive year + if(p[0] === '') { + // first part is blank: year starts with a minus sign + CE = false; + p.splice(0, 1); + } + + var plen = p.length; + if(plen > 3 || (plen !== 3 && datetime[1]) || !plen) return BADNUM; // year if(p[0].length === 4) y = Number(p[0]); else if(p[0].length === 2) { + if(!CE) return BADNUM; var yNow = new Date().getFullYear(); y = ((Number(p[0]) - yNow + 70) % 100 + 200) % 100 + yNow - 70; } - else return false; - if(!isNumeric(y)) return false; - if(p.length === 1) return new Date(y, 0, 1).getTime(); // year only + else return BADNUM; + if(!isNumeric(y)) return BADNUM; + + // javascript takes new Date(0..99,m,d) to mean 1900-1999, so + // to support years 0-99 we need to use setFullYear explicitly + var baseDate = new Date(0, 0, 1); + baseDate.setFullYear(CE ? y : -y); + if(p.length > 1) { + + // month - may be 1 or 2 digits + m = Number(p[1]) - 1; // new Date() uses zero-based months + if(p[1].length > 2 || !(m >= 0 && m <= 11)) return BADNUM; + baseDate.setMonth(m); + + if(p.length > 2) { + + // day - may be 1 or 2 digits + d = Number(p[2]); + if(p[2].length > 2 || !(d >= 1 && d <= 31)) return BADNUM; + baseDate.setDate(d); - // month - m = Number(p[1]) - 1; // new Date() uses zero-based months - if(p[1].length > 2 || !(m >= 0 && m <= 11)) return false; - if(p.length === 2) return new Date(y, m, 1).getTime(); // year-month + // does that date exist in this month? + if(baseDate.getDate() !== d) return BADNUM; - // day - d = Number(p[2]); - if(p[2].length > 2 || !(d >= 1 && d <= 31)) return false; + if(datetime[1]) { - // now save the date part - d = new Date(y, m, d).getTime(); - if(!datetime[1]) return d; // year-month-day - p = datetime[1].split(':'); - if(p.length > 3) return false; + p = datetime[1].split(':'); + if(p.length > 3) return BADNUM; - // hour - h = Number(p[0]); - if(p[0].length > 2 || !(h >= 0 && h <= 23)) return false; - d += 3600000 * h; - if(p.length === 1) return d; + // hour - may be 1 or 2 digits + h = Number(p[0]); + if(p[0].length > 2 || !p[0].length || !(h >= 0 && h <= 23)) return BADNUM; + baseDate.setHours(h); - // minute - m = Number(p[1]); - if(p[1].length > 2 || !(m >= 0 && m <= 59)) return false; - d += 60000 * m; - if(p.length === 2) return d; + // does that hour exist in this day? (Daylight time!) + // (TODO: remove this check when we move to UTC) + if(baseDate.getHours() !== h) return BADNUM; - // second - s = Number(p[2]); - if(!(s >= 0 && s < 60)) return false; - return d + s * 1000; + if(p.length > 1) { + d = baseDate.getTime(); + + // minute - must be 2 digits + m = Number(p[1]); + if(p[1].length !== 2 || !(m >= 0 && m <= 59)) return BADNUM; + d += ONEMIN * m; + if(p.length === 2) return d; + + // second (and milliseconds) - must have 2-digit seconds + if(p[2].split('.')[0].length !== 2) return BADNUM; + s = Number(p[2]); + if(!(s >= 0 && s < 60)) return BADNUM; + return d + s * ONESEC; + } + } + } + } + return baseDate.getTime(); }; +MIN_MS = exports.MIN_MS = exports.dateTime2ms('-9999'); +MAX_MS = exports.MAX_MS = exports.dateTime2ms('9999-12-31 23:59:59.9999'); + // is string s a date? (see above) exports.isDateTime = function(s) { - return (exports.dateTime2ms(s) !== false); + return (exports.dateTime2ms(s) !== BADNUM); }; // pad a number with zeroes, to given # of digits before the decimal point @@ -99231,224 +99198,68 @@ function lpad(val, digits) { } /** - * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.sss - * Crop any trailing zeros in time, but always leave full date - * (we could choose to crop '-01' from date too)... + * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.ssss + * Crop any trailing zeros in time, except never stop right after hours + * (we could choose to crop '-01' from date too but for now we always + * show the whole date) * Optional range r is the data range that applies, also in ms. * If rng is big, the later parts of time will be omitted */ +var NINETYDAYS = 90 * ONEDAY; +var THREEHOURS = 3 * ONEHOUR; +var FIVEMIN = 5 * ONEMIN; exports.ms2DateTime = function(ms, r) { + if(typeof ms !== 'number' || !(ms >= MIN_MS && ms <= MAX_MS)) return BADNUM; + if(!r) r = 0; - var d = new Date(ms), - s = d3.time.format('%Y-%m-%d')(d); - - if(r < 7776000000) { - // <90 days: add hours - s += ' ' + lpad(d.getHours(), 2); - if(r < 432000000) { - // <5 days: add minutes - s += ':' + lpad(d.getMinutes(), 2); - if(r < 10800000) { - // <3 hours: add seconds - s += ':' + lpad(d.getSeconds(), 2); - if(r < 300000) { - // <5 minutes: add ms - s += '.' + lpad(d.getMilliseconds(), 3); + var d = new Date(Math.floor(ms)), + dateStr = d3.time.format('%Y-%m-%d')(d), + // <90 days: add hours and minutes - never *only* add hours + h = (r < NINETYDAYS) ? d.getHours() : 0, + m = (r < NINETYDAYS) ? d.getMinutes() : 0, + // <3 hours: add seconds + s = (r < THREEHOURS) ? d.getSeconds() : 0, + // <5 minutes: add ms (plus one extra digit, this is msec*10) + msec10 = (r < FIVEMIN) ? Math.round((d.getMilliseconds() + (((ms % 1) + 1) % 1)) * 10) : 0; + + // include each part that has nonzero data in or after it + if(h || m || s || msec10) { + dateStr += ' ' + lpad(h, 2) + ':' + lpad(m, 2); + if(s || msec10) { + dateStr += ':' + lpad(s, 2); + if(msec10) { + var digits = 4; + while(msec10 % 10 === 0) { + digits -= 1; + msec10 /= 10; } + dateStr += '.' + lpad(msec10, digits); } } - // strip trailing zeros - return s.replace(/([:\s]00)*\.?[0]*$/, ''); } - return s; -}; - -/** - * parseDate: forgiving attempt to turn any date string - * into a javascript date object - * - * first collate all the date formats we want to support, precompiled - * to d3 format objects see below for the string cleaning that happens - * before this separate out 2-digit (y) and 4-digit-year (Y) formats, - * formats with month names (b), and formats with am/pm (I) or no time (D) - * (also includes hour only, as the test is really for a colon) so we can - * cut down the number of tests we need to run for any given string - * (right now all are between 15 and 32 tests) - */ - -// TODO: this is way out of date vs. the server-side version -var timeFormats = { - // 24 hour - H: ['%H:%M:%S~%L', '%H:%M:%S', '%H:%M'], - // with am/pm - I: ['%I:%M:%S~%L%p', '%I:%M:%S%p', '%I:%M%p'], - // no colon, ie only date or date with hour (could also support eg 12h34m?) - D: ['%H', '%I%p', '%Hh'] + return dateStr; }; -var dateFormats = { - Y: [ - '%Y~%m~%d', - '%Y%m%d', - '%y%m%d', // YYMMDD, has 6 digits together so will match Y, not y - '%m~%d~%Y', // MM/DD/YYYY has first precedence - '%d~%m~%Y' // then DD/MM/YYYY - ], - Yb: [ - '%b~%d~%Y', // eg nov 21 2013 - '%d~%b~%Y', // eg 21 nov 2013 - '%Y~%d~%b', // eg 2013 21 nov (or 2013 q3, after replacement) - '%Y~%b~%d' // eg 2013 nov 21 - ], - /** - * the two-digit year cases have so many potential ambiguities - * it's not even funny, but we'll try them anyway. - */ - y: [ - '%m~%d~%y', - '%d~%m~%y', - '%y~%m~%d' - ], - yb: [ - '%b~%d~%y', - '%d~%b~%y', - '%y~%d~%b', - '%y~%b~%d' - ] -}; - -// use utc formatter since we're ignoring timezone info -var formatter = d3.time.format.utc; - -/** - * ISO8601 and YYYYMMDDHHMMSS are the only ones where date and time - * are not separated by a space, so they get inserted specially here. - * Also a couple formats with no day (so time makes no sense) - */ -var dateTimeFormats = { - Y: { - H: ['%Y~%m~%dT%H:%M:%S', '%Y~%m~%dT%H:%M:%S~%L'].map(formatter), - I: [], - D: ['%Y%m%d%H%M%S', '%Y~%m', '%m~%Y'].map(formatter) - }, - Yb: {H: [], I: [], D: ['%Y~%b', '%b~%Y'].map(formatter)}, - y: {H: [], I: [], D: []}, - yb: {H: [], I: [], D: []} -}; -// all others get inserted in all possible combinations from dateFormats and timeFormats -['Y', 'Yb', 'y', 'yb'].forEach(function(dateType) { - dateFormats[dateType].forEach(function(dateFormat) { - // just a date (don't do just a time) - dateTimeFormats[dateType].D.push(formatter(dateFormat)); - ['H', 'I', 'D'].forEach(function(timeType) { - timeFormats[timeType].forEach(function(timeFormat) { - var a = dateTimeFormats[dateType][timeType]; - - // 'date time', then 'time date' - a.push(formatter(dateFormat + '~' + timeFormat)); - a.push(formatter(timeFormat + '~' + dateFormat)); - }); - }); - }); -}); - -// precompiled regexps for performance -var matchword = /[a-z]*/g, - shortenword = function(m) { return m.substr(0, 3); }, - weekdaymatch = /(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g, - separatormatch = /[\s,\/\-\.\(\)]+/g, - ampmmatch = /~?([ap])~?m(~|$)/, - replaceampm = function(m, ap) { return ap + 'm '; }, - match4Y = /\d\d\d\d/, - matchMonthName = /(^|~)[a-z]{3}/, - matchAMPM = /[ap]m/, - matchcolon = /:/, - matchquarter = /q([1-4])/, - quarters = ['31~mar', '30~jun', '30~sep', '31~dec'], - replacequarter = function(m, n) { return quarters[n - 1]; }, - matchTZ = / ?([+\-]\d\d:?\d\d|Z)$/; - -function getDateType(v) { - var dateType; - dateType = (match4Y.test(v) ? 'Y' : 'y'); - dateType = dateType + (matchMonthName.test(v) ? 'b' : ''); - return dateType; -} - -function getTimeType(v) { - var timeType; - timeType = matchcolon.test(v) ? (matchAMPM.test(v) ? 'I' : 'H') : 'D'; - return timeType; -} - -exports.parseDate = function(v) { - // is it already a date? just return it - if(v.getTime) return v; - /** - * otherwise, if it's not a string, return nothing - * the case of numbers that just have years will get - * dealt with elsewhere. - */ - if(typeof v !== 'string') return false; - - // first clean up the string a bit to reduce the number of formats we have to test - v = v.toLowerCase() - /** - * cut all words down to 3 characters - this will result in - * some spurious matches, ie whenever the first three characters - * of a word match a month or weekday but that seems more likely - * to fix typos than to make dates where they shouldn't be... - * and then we can omit the long form of months from our testing - */ - .replace(matchword, shortenword) - /** - * remove weekday names, as they get overridden anyway if they're - * inconsistent also removes a few more words - * (ie "tuesday the 26th of november") - * TODO: language support? - * for months too, but these seem to be built into d3 - */ - .replace(weekdaymatch, '') - /** - * collapse all separators one ~ at a time, except : which seems - * pretty consistent for the time part use ~ instead of space or - * something since d3 can eat a space as padding on 1-digit numbers - */ - .replace(separatormatch, '~') - // in case of a.m. or p.m. (also take off any space before am/pm) - .replace(ampmmatch, replaceampm) - // turn quarters Q1-4 into dates (quarter ends) - .replace(matchquarter, replacequarter) - .trim() - // also try to ignore timezone info, at least for now - .replace(matchTZ, ''); - - // now test against the various formats that might match - var out = null, - dateType = getDateType(v), - timeType = getTimeType(v), - formatList, - len; - - formatList = dateTimeFormats[dateType][timeType]; - len = formatList.length; - - for(var i = 0; i < len; i++) { - out = formatList[i].parse(v); - if(out) break; +// normalize date format to date string, in case it starts as +// a Date object or milliseconds +// optional dflt is the return value if cleaning fails +exports.cleanDate = function(v, dflt) { + if(exports.isJSDate(v) || typeof v === 'number') { + // NOTE: if someone puts in a year as a number rather than a string, + // this will mistakenly convert it thinking it's milliseconds from 1970 + // that is: '2012' -> Jan. 1, 2012, but 2012 -> 2012 epoch milliseconds + v = exports.ms2DateTime(+v); + if(!v && dflt !== undefined) return dflt; } - - // If not an instance of Date at this point, just return it. - if(!(out instanceof Date)) return false; - // parse() method interprets arguments with local time zone. - var tzoff = out.getTimezoneOffset(); - // In general (default) this is not what we want, so force into UTC: - out.setTime(out.getTime() + tzoff * 60 * 1000); - return out; + else if(!exports.isDateTime(v)) { + logError('unrecognized date', v); + return dflt; + } + return v; }; -},{"d3":95,"fast-isnumeric":104}],624:[function(require,module,exports){ +},{"../constants/numerical":616,"./loggers":636,"d3":95,"fast-isnumeric":104}],625:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99614,7 +99425,7 @@ var Events = { module.exports = Events; -},{"events":102}],625:[function(require,module,exports){ +},{"events":102}],626:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99728,7 +99539,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":634}],626:[function(require,module,exports){ +},{"./is_plain_object.js":635}],627:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99779,7 +99590,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],627:[function(require,module,exports){ +},{}],628:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99791,19 +99602,26 @@ module.exports = function filterUnique(array) { 'use strict'; -module.exports = function filterVisible(dataIn) { - var dataOut = []; +/** Filter out object items with visible !== true + * insider array container. + * + * @param {array of objects} container + * @return {array of objects} of length <= container + * + */ +module.exports = function filterVisible(container) { + var out = []; - for(var i = 0; i < dataIn.length; i++) { - var trace = dataIn[i]; + for(var i = 0; i < container.length; i++) { + var item = container[i]; - if(trace.visible === true) dataOut.push(trace); + if(item.visible === true) out.push(item); } - return dataOut; + return out; }; -},{}],628:[function(require,module,exports){ +},{}],629:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99865,7 +99683,7 @@ function countryNameToISO3(countryName) { return false; } -},{"../lib":632,"country-regex":88}],629:[function(require,module,exports){ +},{"../lib":633,"country-regex":88}],630:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99997,7 +99815,7 @@ exports.makeBlank = function() { }; }; -},{}],630:[function(require,module,exports){ +},{}],631:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100080,7 +99898,7 @@ function formatColor(containerIn, opacityIn, len) { module.exports = formatColor; -},{"../components/color/attributes":532,"../components/colorscale":548,"./str2rgbarray":645,"fast-isnumeric":104,"tinycolor2":489}],631:[function(require,module,exports){ +},{"../components/color/attributes":532,"../components/colorscale":547,"./str2rgbarray":646,"fast-isnumeric":104,"tinycolor2":489}],632:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100149,7 +99967,7 @@ function convertHTMLToUnicode(html) { module.exports = convertHTMLToUnicode; -},{"../constants/string_mappings":617,"superscript-text":486}],632:[function(require,module,exports){ +},{"../constants/string_mappings":617,"superscript-text":486}],633:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100175,19 +99993,15 @@ lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; lib.validate = coerceModule.validate; -lib.isValObject = coerceModule.isValObject; -lib.crawl = coerceModule.crawl; -lib.findArrayAttributes = coerceModule.findArrayAttributes; -lib.IS_SUBPLOT_OBJ = coerceModule.IS_SUBPLOT_OBJ; -lib.IS_LINKED_TO_ARRAY = coerceModule.IS_LINKED_TO_ARRAY; -lib.DEPRECATED = coerceModule.DEPRECATED; -lib.UNDERSCORE_ATTRS = coerceModule.UNDERSCORE_ATTRS; var datesModule = require('./dates'); lib.dateTime2ms = datesModule.dateTime2ms; lib.isDateTime = datesModule.isDateTime; lib.ms2DateTime = datesModule.ms2DateTime; -lib.parseDate = datesModule.parseDate; +lib.cleanDate = datesModule.cleanDate; +lib.isJSDate = datesModule.isJSDate; +lib.MIN_MS = datesModule.MIN_MS; +lib.MAX_MS = datesModule.MAX_MS; var searchModule = require('./search'); lib.findBin = searchModule.findBin; @@ -100228,6 +100042,10 @@ lib.error = loggersModule.error; lib.notifier = require('./notifier'); lib.filterUnique = require('./filter_unique'); +lib.filterVisible = require('./filter_visible'); + + +lib.cleanNumber = require('./clean_number'); /** * swap x and y of the same attribute in container cont @@ -100404,7 +100222,7 @@ lib.smooth = function(arrayIn, FWHM) { * as long as its returns are not promises (ie have no .then) * includes one argument arg to send to all functions... * this is mainly just to prevent us having to make wrapper functions - * when the only purpose of the wrapper is to reference gd / td + * when the only purpose of the wrapper is to reference gd * and a final step to be executed at the end * TODO: if there's an error and everything is sync, * this doesn't happen yet because we want to make sure @@ -100877,7 +100695,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./coerce":622,"./dates":623,"./extend":625,"./filter_unique":626,"./is_array":633,"./is_plain_object":634,"./loggers":635,"./matrix":636,"./nested_property":637,"./notifier":638,"./search":641,"./stats":644,"d3":95}],633:[function(require,module,exports){ +},{"./clean_number":622,"./coerce":623,"./dates":624,"./extend":626,"./filter_unique":627,"./filter_visible":628,"./is_array":634,"./is_plain_object":635,"./loggers":636,"./matrix":637,"./nested_property":638,"./notifier":639,"./search":642,"./stats":645,"d3":95}],634:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100895,7 +100713,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ArrayBuffer.isView(a); }; -},{}],634:[function(require,module,exports){ +},{}],635:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100924,7 +100742,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],635:[function(require,module,exports){ +},{}],636:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100991,7 +100809,7 @@ loggers.error = function() { } }; -},{"../plot_api/plot_config":651}],636:[function(require,module,exports){ +},{"../plot_api/plot_config":652}],637:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101101,7 +100919,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],637:[function(require,module,exports){ +},{}],638:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101358,7 +101176,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./is_array":633,"fast-isnumeric":104}],638:[function(require,module,exports){ +},{"./is_array":634,"fast-isnumeric":104}],639:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101435,7 +101253,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":95,"fast-isnumeric":104}],639:[function(require,module,exports){ +},{"d3":95,"fast-isnumeric":104}],640:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101675,7 +101493,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"./matrix":636}],640:[function(require,module,exports){ +},{"./matrix":637}],641:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101886,7 +101704,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":632,"../plot_api/plot_config":651}],641:[function(require,module,exports){ +},{"../lib":633,"../plot_api/plot_config":652}],642:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101997,7 +101815,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":635,"fast-isnumeric":104}],642:[function(require,module,exports){ +},{"./loggers":636,"fast-isnumeric":104}],643:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102020,7 +101838,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],643:[function(require,module,exports){ +},{}],644:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102069,7 +101887,7 @@ module.exports = function showWebGlMsg(scene) { return false; }; -},{"../components/color":533}],644:[function(require,module,exports){ +},{"../components/color":533}],645:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102165,7 +101983,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":104}],645:[function(require,module,exports){ +},{"fast-isnumeric":104}],646:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102187,7 +102005,7 @@ function str2RgbaArray(color) { module.exports = str2RgbaArray; -},{"arraytools":33,"tinycolor2":489}],646:[function(require,module,exports){ +},{"arraytools":33,"tinycolor2":489}],647:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102301,8 +102119,8 @@ exports.convertToTspans = function(_context, _callback) { } if(tex) { - var td = Lib.getPlotDiv(that.node()); - ((td && td._promises) || []).push(new Promise(function(resolve) { + var gd = Lib.getPlotDiv(that.node()); + ((gd && gd._promises) || []).push(new Promise(function(resolve) { that.style({visibility: 'hidden'}); var config = {fontSize: parseInt(that.style('font-size'), 10)}; @@ -102714,7 +102532,7 @@ exports.makeEditable = function(context, _delegate, options) { return d3.rebind(this, dispatch, 'on'); }; -},{"../constants/string_mappings":617,"../constants/xmlns_namespaces":618,"../lib":632,"d3":95}],647:[function(require,module,exports){ +},{"../constants/string_mappings":617,"../constants/xmlns_namespaces":618,"../lib":633,"d3":95}],648:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102728,8 +102546,8 @@ exports.makeEditable = function(context, _delegate, options) { var topojsonUtils = module.exports = {}; -var locationmodeToLayer = require('../plots/geo/constants').locationmodeToLayer, - topojsonFeature = require('topojson').feature; +var locationmodeToLayer = require('../plots/geo/constants').locationmodeToLayer; +var topojsonFeature = require('topojson-client').feature; topojsonUtils.getTopojsonName = function(geoLayout) { @@ -102750,7 +102568,7 @@ topojsonUtils.getTopojsonFeatures = function(trace, topojson) { return topojsonFeature(topojson, obj).features; }; -},{"../plots/geo/constants":685,"topojson":491}],648:[function(require,module,exports){ +},{"../plots/geo/constants":686,"topojson-client":491}],649:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102784,7 +102602,7 @@ module.exports = function truncate(arrayIn, len) { throw new Error('This array type is not yet supported by `truncate`.'); }; -},{}],649:[function(require,module,exports){ +},{}],650:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102889,13 +102707,12 @@ exports.cleanLayout = function(layout) { } } - if(layout.annotations !== undefined && !Array.isArray(layout.annotations)) { - Lib.warn('Annotations must be an array.'); - delete layout.annotations; - } - var annotationsLen = (layout.annotations || []).length; + var annotationsLen = Array.isArray(layout.annotations) ? layout.annotations.length : 0; for(i = 0; i < annotationsLen; i++) { var ann = layout.annotations[i]; + + if(!Lib.isPlainObject(ann)) continue; + if(ann.ref) { if(ann.ref === 'paper') { ann.xref = 'paper'; @@ -102907,17 +102724,17 @@ exports.cleanLayout = function(layout) { } delete ann.ref; } + cleanAxRef(ann, 'xref'); cleanAxRef(ann, 'yref'); } - if(layout.shapes !== undefined && !Array.isArray(layout.shapes)) { - Lib.warn('Shapes must be an array.'); - delete layout.shapes; - } - var shapesLen = (layout.shapes || []).length; + var shapesLen = Array.isArray(layout.shapes) ? layout.shapes.length : 0; for(i = 0; i < shapesLen; i++) { var shape = layout.shapes[i]; + + if(!Lib.isPlainObject(shape)) continue; + cleanAxRef(shape, 'xref'); cleanAxRef(shape, 'yref'); } @@ -103266,7 +103083,7 @@ exports.manageArrayContainers = function(np, newVal, undoit) { } }; -},{"../components/color":533,"../lib":632,"../plots/cartesian/axes":662,"../plots/plots":723,"../registry":738,"fast-isnumeric":104,"gl-mat4/fromQuat":146}],650:[function(require,module,exports){ +},{"../components/color":533,"../lib":633,"../plots/cartesian/axes":664,"../plots/plots":724,"../registry":739,"fast-isnumeric":104,"gl-mat4/fromQuat":146}],651:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105186,13 +105003,14 @@ function _relayout(gd, aobj) { objList = layout[objType] || [], obji = objList[objNum] || {}; - // new API, remove annotation / shape with `null` - if(vi === null) aobj[ai] = 'remove'; - // if p.parts is just an annotation number, and val is either // 'add' or an entire annotation to add, the undo is 'remove' // if val is 'remove' then undo is the whole annotation object if(p.parts.length === 2) { + + // new API, remove annotation / shape with `null` + if(vi === null) aobj[ai] = 'remove'; + if(aobj[ai] === 'add' || Lib.isPlainObject(aobj[ai])) { undoit[ai] = 'remove'; } @@ -105227,6 +105045,7 @@ function _relayout(gd, aobj) { } // alter gd.layout else { + var pp1 = String(p.parts[1] || ''); // check whether we can short-circuit a full redraw // 3d or geo at this point just needs to redraw. if(p.parts[0].indexOf('scene') === 0) flags.doplot = true; @@ -105241,17 +105060,17 @@ function _relayout(gd, aobj) { else if(ai.indexOf('title') !== -1) flags.doticks = true; else if(p.parts[0].indexOf('bgcolor') !== -1) flags.dolayoutstyle = true; else if(p.parts.length > 1 && - Lib.containsAny(p.parts[1], ['tick', 'exponent', 'grid', 'zeroline'])) { + Lib.containsAny(pp1, ['tick', 'exponent', 'grid', 'zeroline'])) { flags.doticks = true; } else if(ai.indexOf('.linewidth') !== -1 && ai.indexOf('axis') !== -1) { flags.doticks = flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1].indexOf('line') !== -1) { + else if(p.parts.length > 1 && pp1.indexOf('line') !== -1) { flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1] === 'mirror') { + else if(p.parts.length > 1 && pp1 === 'mirror') { flags.doticks = flags.dolayoutstyle = true; } else if(ai === 'margin.pad') { @@ -105273,7 +105092,7 @@ function _relayout(gd, aobj) { */ else if(['hovermode', 'dragmode'].indexOf(ai) !== -1) flags.domodebar = true; else if(['hovermode', 'dragmode', 'height', - 'width', 'autosize'].indexOf(ai) === -1) { + 'width', 'autosize'].indexOf(ai) === -1) { flags.doplot = true; } @@ -105482,6 +105301,20 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } } + // Execute a callback after the wrapper function has been called n times. + // This is used to defer the resolution until a transition has resovled *and* + // the frame has completed. If it's not done this way, then we get a race + // condition in which the animation might resolve before a transition is complete + // or vice versa. + function callbackOnNthTime(cb, n) { + var cnt = 0; + return function() { + if(cb && ++cnt === n) { + return cb(); + } + }; + } + return new Promise(function(resolve, reject) { function discardExistingFrames() { if(trans._frameQueue.length === 0) { @@ -105526,14 +105359,13 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { frameOpts: frameOpts, transitionOpts: transitionOpts, }; - if(i === frameList.length - 1) { // The last frame in this .animate call stores the promise resolve // and reject callbacks. This is how we ensure that the animation // loop (which may exist as a result of a *different* .animate call) // still resolves or rejecdts this .animate call's promise. once it's // complete. - nextFrame.onComplete = resolve; + nextFrame.onComplete = callbackOnNthTime(resolve, 2); nextFrame.onInterrupt = reject; } @@ -105571,7 +105403,6 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { // Execute the callback and unset it to ensure it doesn't // accidentally get called twice trans._currentFrame.onComplete(); - trans._currentFrame.onComplete = null; } var newFrame = trans._currentFrame = trans._frameQueue.shift(); @@ -105591,7 +105422,12 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { helpers.coerceTraceIndices(gd, newFrame.frame.traces), newFrame.frameOpts, newFrame.transitionOpts - ); + ).then(function() { + if(newFrame.onComplete) { + newFrame.onComplete(); + } + + }); gd.emit('plotly_animatingframe', { name: newFrame.name, @@ -105667,6 +105503,8 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { for(i = 0; i < trans._frames.length; i++) { frame = trans._frames[i]; + if(!frame) continue; + if(allFrames || frame.group === frameOrGroupNameOrFrameList) { frameList.push({ type: 'byname', @@ -105678,14 +105516,15 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } else if(isFrameArray) { for(i = 0; i < frameOrGroupNameOrFrameList.length; i++) { var frameOrName = frameOrGroupNameOrFrameList[i]; - if(typeof frameOrName === 'string') { + if(['number', 'string'].indexOf(typeof frameOrName) !== -1) { + frameOrName = String(frameOrName); // In this case, there's an array and this frame is a string name: frameList.push({ type: 'byname', name: frameOrName, data: setTransitionConfig({name: frameOrName}) }); - } else { + } else if(Lib.isPlainObject(frameOrName)) { frameList.push({ type: 'object', data: setTransitionConfig(Lib.extendFlat({}, frameOrName)) @@ -105829,7 +105668,7 @@ Plotly.addFrames = function(gd, frameList, indices) { if(_hash[frame.name]) { // If frame is present, overwrite its definition: for(j = 0; j < _frames.length; j++) { - if(_frames[j].name === frame.name) break; + if((_frames[j] || {}).name === frame.name) break; } ops.push({type: 'replace', index: j, value: frame}); revops.unshift({type: 'replace', index: j, value: _frames[j]}); @@ -106029,7 +105868,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":557,"../components/errorbars":563,"../constants/xmlns_namespaces":618,"../lib":632,"../lib/events":624,"../lib/queue":640,"../lib/svg_text_utils":646,"../plotly":658,"../plots/cartesian/graph_interact":670,"../plots/plots":723,"../plots/polar":726,"../registry":738,"./helpers":649,"./subroutines":655,"d3":95,"fast-isnumeric":104}],651:[function(require,module,exports){ +},{"../components/drawing":556,"../components/errorbars":562,"../constants/xmlns_namespaces":618,"../lib":633,"../lib/events":625,"../lib/queue":641,"../lib/svg_text_utils":647,"../plotly":659,"../plots/cartesian/graph_interact":671,"../plots/plots":724,"../plots/polar":727,"../registry":739,"./helpers":650,"./subroutines":656,"d3":95,"fast-isnumeric":104}],652:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106149,7 +105988,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],652:[function(require,module,exports){ +},{}],653:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106161,185 +106000,287 @@ function defaultSetBackground(gd, bgColor) { 'use strict'; -var Plotly = require('../plotly'); var Registry = require('../registry'); -var Plots = require('../plots/plots'); var Lib = require('../lib'); -// FIXME polar attribute are not part of Plotly yet +var baseAttributes = require('../plots/attributes'); +var baseLayoutAttributes = require('../plots/layout_attributes'); +var frameAttributes = require('../plots/frame_attributes'); +var animationAttributes = require('../plots/animation_attributes'); + +// polar attributes are not part of the Registry yet var polarAreaAttrs = require('../plots/polar/area_attributes'); var polarAxisAttrs = require('../plots/polar/axis_attributes'); var extendFlat = Lib.extendFlat; var extendDeep = Lib.extendDeep; -var extendDeepAll = Lib.extendDeepAll; -var NESTED_MODULE = '_nestedModules', - COMPOSED_MODULE = '_composedModules'; +var IS_SUBPLOT_OBJ = '_isSubplotObj'; +var IS_LINKED_TO_ARRAY = '_isLinkedToArray'; +var DEPRECATED = '_deprecated'; +var UNDERSCORE_ATTRS = [IS_SUBPLOT_OBJ, IS_LINKED_TO_ARRAY, DEPRECATED]; -var plotSchema = { - traces: {}, - layout: {}, - transforms: {}, - defs: {} -}; +exports.IS_SUBPLOT_OBJ = IS_SUBPLOT_OBJ; +exports.IS_LINKED_TO_ARRAY = IS_LINKED_TO_ARRAY; +exports.DEPRECATED = DEPRECATED; +exports.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS; +/** Outputs the full plotly.js plot schema + * + * @return {object} + * - defs + * - traces + * - layout + * - transforms + * - frames + * - animations + * - config (coming soon ...) + */ +exports.get = function() { + var traces = {}; + + Registry.allTypes.concat('area').forEach(function(type) { + traces[type] = getTraceAttributes(type); + }); -var PlotSchema = module.exports = {}; - + var transforms = {}; -PlotSchema.get = function() { - Registry.allTypes - .concat('area') // FIXME polar 'area' attributes - .forEach(getTraceAttributes); + Object.keys(Registry.transformsRegistry).forEach(function(type) { + transforms[type] = getTransformAttributes(type); + }); - getLayoutAttributes(); + return { + defs: { + valObjects: Lib.valObjects, + metaKeys: UNDERSCORE_ATTRS.concat['description', 'role'] + }, - Object.keys(Registry.transformsRegistry).forEach(getTransformAttributes); + traces: traces, + layout: getLayoutAttributes(), - getDefs(); + transforms: transforms, - return plotSchema; + frames: formatAttributes(frameAttributes), + animation: formatAttributes(animationAttributes) + }; }; -PlotSchema.crawl = Lib.crawl; +/** + * Crawl the attribute tree, recursively calling a callback function + * + * @param {object} attrs + * The node of the attribute tree (e.g. the root) from which recursion originates + * @param {Function} callback + * A callback function with the signature: + * @callback callback + * @param {object} attr an attribute + * @param {String} attrName name string + * @param {object[]} attrs all the attributes + * @param {Number} level the recursion level, 0 at the root + * @param {Number} [specifiedLevel] + * The level in the tree, in order to let the callback function detect descend or backtrack, + * typically unsupplied (implied 0), just used by the self-recursive call. + * The necessity arises because the tree traversal is not controlled by callback return values. + * The decision to not use callback return values for controlling tree pruning arose from + * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions + * precedes the callback call. + * + * @return {object} transformOut + * copy of transformIn that contains attribute defaults + */ +exports.crawl = function(attrs, callback, specifiedLevel) { + var level = specifiedLevel || 0; -PlotSchema.isValObject = Lib.isValObject; + Object.keys(attrs).forEach(function(attrName) { + var attr = attrs[attrName]; -function getTraceAttributes(type) { - var globalAttributes = Plots.attributes, - _module = getModule({type: type}), - meta = getMeta(type), - subplotRegistry = getSubplotRegistry(type); + if(UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - var attributes = {}, - layoutAttributes = {}; + callback(attr, attrName, attrs, level); - // make 'type' the first attribute in the object - attributes.type = null; + if(exports.isValObject(attr)) return; - // global attributes (same for all trace types) - extendDeep(attributes, globalAttributes); + if(Lib.isPlainObject(attr)) exports.crawl(attr, callback, level + 1); + }); +}; - // module attributes (+ nested + composed) - attributes = coupleAttrs( - _module.attributes, attributes, 'attributes', type - ); +/** Is object a value object (or a container object)? + * + * @param {object} obj + * @return {boolean} + * returns true for a valid value object and + * false for tree nodes in the attribute hierarchy + */ +exports.isValObject = function(obj) { + return obj && obj.valType !== undefined; +}; - // subplot attributes - if(subplotRegistry.attributes !== undefined) { - extendDeep(attributes, subplotRegistry.attributes); +/** + * Find all data array attributes in a given trace object - including + * `arrayOk` attributes. + * + * @param {object} trace + * full trace object that contains a reference to `_module.attributes` + * + * @return {array} arrayAttributes + * list of array attributes for the given trace + */ +exports.findArrayAttributes = function(trace) { + var arrayAttributes = [], + stack = []; + + function callback(attr, attrName, attrs, level) { + stack = stack.slice(0, level).concat([attrName]); + + var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; + if(!splittableAttr) return; + + var astr = toAttrString(stack); + var val = Lib.nestedProperty(trace, astr).get(); + if(!Array.isArray(val)) return; + + arrayAttributes.push(astr); } - // 'type' gets overwritten by globalAttributes; reset it here - attributes.type = type; + function toAttrString(stack) { + return stack.join('.'); + } - attributes = removeUnderscoreAttrs(attributes); - mergeValTypeAndRole(attributes); - plotSchema.traces[type] = extendFlat({}, - meta, - { attributes: attributes } - ); + exports.crawl(trace._module.attributes, callback); - // trace-specific layout attributes - if(_module.layoutAttributes !== undefined) { - layoutAttributes = coupleAttrs( - _module.layoutAttributes, layoutAttributes, 'layoutAttributes', type - ); + if(trace.transforms) { + var transforms = trace.transforms; - mergeValTypeAndRole(layoutAttributes); - plotSchema.traces[type].layoutAttributes = layoutAttributes; + for(var i = 0; i < transforms.length; i++) { + var transform = transforms[i]; + + stack = ['transforms[' + i + ']']; + exports.crawl(transform._module.attributes, callback, 1); + } } -} -function getLayoutAttributes() { - var globalLayoutAttributes = Plots.layoutAttributes, - layoutAttributes = {}; + // Look into the fullInput module attributes for array attributes + // to make sure that 'custom' array attributes are detected. + // + // At the moment, we need this block to make sure that + // ohlc and candlestick 'open', 'high', 'low', 'close' can be + // used with filter ang groupby transforms. + if(trace._fullInput) { + exports.crawl(trace._fullInput._module.attributes, callback); - // layout module attributes (+ nested + composed) - layoutAttributes = coupleAttrs( - globalLayoutAttributes, layoutAttributes, 'layoutAttributes', '*' - ); + arrayAttributes = Lib.filterUnique(arrayAttributes); + } - // FIXME polar layout attributes - layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); + return arrayAttributes; +}; - // add crawler.IS_SUBPLOT_OBJ attribute - layoutAttributes = handleSubplotObjs(layoutAttributes); +function getTraceAttributes(type) { + var _module, basePlotModule; - layoutAttributes = removeUnderscoreAttrs(layoutAttributes); - mergeValTypeAndRole(layoutAttributes); + if(type === 'area') { + _module = { attributes: polarAreaAttrs }; + basePlotModule = {}; + } + else { + _module = Registry.modules[type]._module, + basePlotModule = _module.basePlotModule; + } - // generate crawler.IS_LINKED_TO_ARRAY structure - handleLinkedToArray(layoutAttributes); + var attributes = {}; - plotSchema.layout = { layoutAttributes: layoutAttributes }; -} + // make 'type' the first attribute in the object + attributes.type = null; -function getTransformAttributes(name) { - var _module = Registry.transformsRegistry[name], - _schema = {}; + // base attributes (same for all trace types) + extendDeep(attributes, baseAttributes); - _schema = coupleAttrs(_schema, _module.attributes || {}, 'attributes', '*'); - _schema = removeUnderscoreAttrs(_schema); - mergeValTypeAndRole(_schema); - handleLinkedToArray(_schema); + // module attributes + extendDeep(attributes, _module.attributes); - plotSchema.transforms[name] = { attributes: _schema }; -} + // subplot attributes + if(basePlotModule.attributes) { + extendDeep(attributes, basePlotModule.attributes); + } + + // 'type' gets overwritten by baseAttributes; reset it here + attributes.type = type; -function getDefs() { - plotSchema.defs = { - valObjects: Lib.valObjects, - metaKeys: Lib.UNDERSCORE_ATTRS.concat(['description', 'role']) + var out = { + meta: _module.meta || {}, + attributes: formatAttributes(attributes), }; + + // trace-specific layout attributes + if(_module.layoutAttributes) { + var layoutAttributes = {}; + + extendDeep(layoutAttributes, _module.layoutAttributes); + out.layoutAttributes = formatAttributes(layoutAttributes); + } + + return out; } -function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) { - var nestedModule, nestedAttrs, nestedReference, - composedModule, composedAttrs; +function getLayoutAttributes() { + var layoutAttributes = {}; - Object.keys(attrsIn).forEach(function(k) { + // global layout attributes + extendDeep(layoutAttributes, baseLayoutAttributes); - if(k === NESTED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - nestedModule = getModule({_module: attrsIn[k][kk]}); - if(nestedModule === undefined) return; + // add base plot module layout attributes + Object.keys(Registry.subplotsRegistry).forEach(function(k) { + var _module = Registry.subplotsRegistry[k]; - nestedAttrs = nestedModule[whichAttrs]; - nestedReference = coupleAttrs( - nestedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - Lib.nestedProperty(attrsOut, kk) - .set(extendDeep({}, nestedReference)); - }); - return; + if(_module.name === 'cartesian') { + handleBasePlotModule(layoutAttributes, _module, 'xaxis'); + handleBasePlotModule(layoutAttributes, _module, 'yaxis'); } + else { + var astr = _module.attr === 'subplot' ? _module.name : _module.attr; - if(k === COMPOSED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - if(kk !== type) return; + handleBasePlotModule(layoutAttributes, _module, astr); + } + }); - composedModule = getModule({_module: attrsIn[k][kk]}); - if(composedModule === undefined) return; + // polar layout attributes + layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); - composedAttrs = composedModule[whichAttrs]; - composedAttrs = coupleAttrs( - composedAttrs, {}, whichAttrs, type - ); + // add registered components layout attribute + Object.keys(Registry.componentsRegistry).forEach(function(k) { + var _module = Registry.componentsRegistry[k]; + + if(!_module.layoutAttributes) return; - extendDeepAll(attrsOut, composedAttrs); + if(Array.isArray(_module.layoutNodes)) { + _module.layoutNodes.forEach(function(v) { + handleRegisteredComponent(layoutAttributes, _module, v + _module.name); }); - return; } - - attrsOut[k] = Lib.isPlainObject(attrsIn[k]) ? - extendDeepAll({}, attrsIn[k]) : - attrsIn[k]; + else { + handleRegisteredComponent(layoutAttributes, _module, _module.name); + } }); - return attrsOut; + return { + layoutAttributes: formatAttributes(layoutAttributes) + }; +} + +function getTransformAttributes(type) { + var _module = Registry.transformsRegistry[type]; + + return { + attributes: formatAttributes(_module.attributes) + }; +} + +function formatAttributes(attrs) { + mergeValTypeAndRole(attrs); + formatArrayContainers(attrs); + + return attrs; } function mergeValTypeAndRole(attrs) { @@ -106356,7 +106297,7 @@ function mergeValTypeAndRole(attrs) { } function callback(attr, attrName, attrs) { - if(PlotSchema.isValObject(attr)) { + if(exports.isValObject(attr)) { if(attr.valType === 'data_array') { // all 'data_array' attrs have role 'data' attr.role = 'data'; @@ -106374,40 +106315,26 @@ function mergeValTypeAndRole(attrs) { } } - Lib.crawl(attrs, callback); + exports.crawl(attrs, callback); } -// helper methods +function formatArrayContainers(attrs) { -function getModule(arg) { - if('type' in arg) { - return (arg.type === 'area') ? // FIXME - { attributes: polarAreaAttrs } : - Registry.getModule({type: arg.type}); - } + function callback(attr, attrName, attrs) { + if(!attr) return; - var subplotsRegistry = Registry.subplotsRegistry, - componentsRegistry = Registry.componentsRegistry, - _module = arg._module; + var itemName = attr[IS_LINKED_TO_ARRAY]; - if(subplotsRegistry[_module]) return subplotsRegistry[_module]; - else if(componentsRegistry[_module]) return componentsRegistry[_module]; + if(!itemName) return; - // look it internal Plotly if all previous attempts fail - return Plotly[_module]; -} + delete attr[IS_LINKED_TO_ARRAY]; -function removeUnderscoreAttrs(attributes) { - Object.keys(attributes).forEach(function(k) { - if(k.charAt(0) === '_' && - Lib.UNDERSCORE_ATTRS.indexOf(k) === -1) delete attributes[k]; - }); - return attributes; -} + attrs[attrName] = { items: {} }; + attrs[attrName].items[itemName] = attr; + attrs[attrName].role = 'object'; + } -function getMeta(type) { - if(type === 'area') return {}; // FIXME - return Registry.modules[type].meta || {}; + exports.crawl(attrs, callback); } function assignPolarLayoutAttrs(layoutAttributes) { @@ -106418,68 +106345,25 @@ function assignPolarLayoutAttrs(layoutAttributes) { extendFlat(layoutAttributes, polarAxisAttrs.layout); - return layoutAttributes; // FIXME -} - -function getSubplotRegistry(traceType) { - if(traceType === 'area') return {}; // FIXME - - var subplotsRegistry = Registry.subplotsRegistry, - subplotType = Object.keys(subplotsRegistry).filter(function(subplotType) { - return Registry.traceIs({type: traceType}, subplotType); - })[0]; - - if(subplotType === undefined) return {}; - - return subplotsRegistry[subplotType]; -} - -function handleSubplotObjs(layoutAttributes) { - var subplotsRegistry = Registry.subplotsRegistry; - - Object.keys(layoutAttributes).forEach(function(k) { - Object.keys(subplotsRegistry).forEach(function(subplotType) { - var subplotRegistry = subplotsRegistry[subplotType], - isSubplotObj; - - if(!subplotRegistry.attrRegex) return; - - if(subplotType === 'cartesian' || subplotType === 'gl2d') { - isSubplotObj = ( - subplotRegistry.attrRegex.x.test(k) || - subplotRegistry.attrRegex.y.test(k) - ); - } - else { - isSubplotObj = subplotRegistry.attrRegex.test(k); - } - - if(isSubplotObj) layoutAttributes[k][Lib.IS_SUBPLOT_OBJ] = true; - }); - }); - return layoutAttributes; } -function handleLinkedToArray(layoutAttributes) { - - function callback(attr, attrName, attrs) { - if(attr[Lib.IS_LINKED_TO_ARRAY] !== true) return; - - // TODO more robust logic - var itemName = attrName.substr(0, attrName.length - 1); +function handleBasePlotModule(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep({}, _module.layoutAttributes); - delete attr[Lib.IS_LINKED_TO_ARRAY]; + attrs[IS_SUBPLOT_OBJ] = true; + np.set(attrs); +} - attrs[attrName] = { items: {} }; - attrs[attrName].items[itemName] = attr; - attrs[attrName].role = 'object'; - } +function handleRegisteredComponent(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep(np.get() || {}, _module.layoutAttributes); - Lib.crawl(layoutAttributes, callback); + np.set(attrs); } -},{"../lib":632,"../plotly":658,"../plots/plots":723,"../plots/polar/area_attributes":724,"../plots/polar/axis_attributes":725,"../registry":738}],653:[function(require,module,exports){ +},{"../lib":633,"../plots/animation_attributes":660,"../plots/attributes":662,"../plots/frame_attributes":685,"../plots/layout_attributes":715,"../plots/polar/area_attributes":725,"../plots/polar/axis_attributes":726,"../registry":739}],654:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106571,10 +106455,14 @@ function registerTransformModule(newModule) { } function registerComponentModule(newModule) { - Registry.componentsRegistry[newModule.name] = newModule; + if(typeof newModule.name !== 'string') { + throw new Error('Component module *name* must be a string.'); + } + + Registry.registerComponent(newModule); } -},{"../lib":632,"../registry":738}],654:[function(require,module,exports){ +},{"../lib":633,"../registry":739}],655:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106600,7 +106488,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":632,"../plotly":658}],655:[function(require,module,exports){ +},{"../lib":633,"../plotly":659}],656:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106922,7 +106810,7 @@ exports.doModeBar = function(gd) { return Plots.previousPromises(gd); }; -},{"../components/color":533,"../components/drawing":557,"../components/modebar":580,"../components/titles":608,"../lib":632,"../plotly":658,"../plots/plots":723,"../registry":738}],656:[function(require,module,exports){ +},{"../components/color":533,"../components/drawing":556,"../components/modebar":579,"../components/titles":607,"../lib":633,"../plotly":659,"../plots/plots":724,"../registry":739}],657:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106977,7 +106865,7 @@ function toImage(gd, opts) { // first clone the GD so we can operate in a clean environment var clone = clonePlot(gd, {format: 'png', height: opts.height, width: opts.width}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -107032,7 +106920,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":632,"../plotly":658,"../snapshot/cloneplot":739,"../snapshot/helpers":742,"../snapshot/svgtoimg":744,"../snapshot/tosvg":746,"fast-isnumeric":104}],657:[function(require,module,exports){ +},{"../lib":633,"../plotly":659,"../snapshot/cloneplot":740,"../snapshot/helpers":743,"../snapshot/svgtoimg":745,"../snapshot/tosvg":747,"fast-isnumeric":104}],658:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107208,7 +107096,8 @@ function crawl(objIn, objOut, schema, list, base, path) { crawl(valIn, valOut, nestedSchema, list, base, p); } else if(nestedSchema.items && !isInfoArray && isArray(valIn)) { - var itemName = k.substr(0, k.length - 1), + var items = nestedSchema.items, + _nestedSchema = items[Object.keys(items)[0]], indexList = []; var j, _p; @@ -107216,8 +107105,7 @@ function crawl(objIn, objOut, schema, list, base, path) { // loop over valOut items while keeping track of their // corresponding input container index (given by _index) for(j = 0; j < valOut.length; j++) { - var _nestedSchema = nestedSchema.items[itemName], - _index = valOut[j]._index || j; + var _index = valOut[j]._index || j; _p = p.slice(); _p.push(_index); @@ -107402,7 +107290,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":632,"../plots/plots":723,"./plot_schema":652}],658:[function(require,module,exports){ +},{"../lib":633,"../plots/plots":724,"./plot_schema":653}],659:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107430,25 +107318,12 @@ exports.defaultConfig = require('./plot_api/plot_config'); exports.Plots = require('./plots/plots'); exports.Axes = require('./plots/cartesian/axes'); exports.Fx = require('./plots/cartesian/graph_interact'); - -// components -exports.Color = require('./components/color'); -exports.Drawing = require('./components/drawing'); -exports.Colorscale = require('./components/colorscale'); -exports.Colorbar = require('./components/colorbar'); -exports.ErrorBars = require('./components/errorbars'); -exports.Annotations = require('./components/annotations'); -exports.Shapes = require('./components/shapes'); -exports.Legend = require('./components/legend'); -exports.Images = require('./components/images'); -exports.UpdateMenus = require('./components/updatemenus'); -exports.Sliders = require('./components/sliders'); exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/annotations":531,"./components/color":533,"./components/colorbar":538,"./components/colorscale":548,"./components/drawing":557,"./components/errorbars":563,"./components/images":569,"./components/legend":577,"./components/modebar":580,"./components/shapes":601,"./components/sliders":607,"./components/updatemenus":613,"./plot_api/plot_api":650,"./plot_api/plot_config":651,"./plots/cartesian/axes":662,"./plots/cartesian/graph_interact":670,"./plots/plots":723}],659:[function(require,module,exports){ +},{"./components/modebar":579,"./plot_api/plot_api":651,"./plot_api/plot_config":652,"./plots/cartesian/axes":664,"./plots/cartesian/graph_interact":671,"./plots/plots":724}],660:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107572,7 +107447,76 @@ module.exports = { } }; -},{}],660:[function(require,module,exports){ +},{}],661:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var Lib = require('../lib'); + + +/** Convenience wrapper for making array container logic DRY and consistent + * + * @param {object} parentObjIn + * user input object where the container in question is linked + * (i.e. either a user trace object or the user layout object) + * + * @param {object} parentObjOut + * full object where the coerced container will be linked + * (i.e. either a full trace object or the full layout object) + * + * @param {object} opts + * options object: + * - name {string} + * name of the key linking the container in question + * - handleItemDefaults {function} + * defaults method to be called on each item in the array container in question + * + * Its arguments are: + * - itemIn {object} item in user layout + * - itemOut {object} item in full layout + * - parentObj {object} (as in closure) + * - opts {object} (as in closure) + * - itemOpts {object} + * - itemIsNotPlainObject {boolean} + * N.B. + * + * - opts is passed to handleItemDefaults so it can also store + * links to supplementary data (e.g. fullData for layout components) + * + */ +module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut, opts) { + var name = opts.name; + + var contIn = Array.isArray(parentObjIn[name]) ? parentObjIn[name] : [], + contOut = parentObjOut[name] = []; + + for(var i = 0; i < contIn.length; i++) { + var itemIn = contIn[i], + itemOut = {}, + itemOpts = {}; + + if(!Lib.isPlainObject(itemIn)) { + itemOpts.itemIsNotPlainObject = true; + itemIn = {}; + } + + opts.handleItemDefaults(itemIn, itemOut, parentObjOut, opts, itemOpts); + + itemOut._input = itemIn; + itemOut._index = i; + + contOut.push(itemOut); + } +}; + +},{"../lib":633}],662:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107682,7 +107626,7 @@ module.exports = { } }; -},{}],661:[function(require,module,exports){ +},{}],663:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107721,7 +107665,7 @@ module.exports = { } }; -},{}],662:[function(require,module,exports){ +},{}],664:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107743,6 +107687,15 @@ var Titles = require('../../components/titles'); var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); +var constants = require('../../constants/numerical'); +var FP_SAFE = constants.FP_SAFE; +var ONEAVGYEAR = constants.ONEAVGYEAR; +var ONEAVGMONTH = constants.ONEAVGMONTH; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + var axes = module.exports = {}; @@ -107760,43 +107713,88 @@ axes.getFromId = axisIds.getFromId; axes.getFromTrace = axisIds.getFromTrace; -// find the list of possible axes to reference with an xref or yref attribute -// and coerce it to that list -axes.coerceRef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = axLetter + 'ref', +/* + * find the list of possible axes to reference with an xref or yref attribute + * and coerce it to that list + * + * attr: the attribute we're generating a reference for. Should end in 'x' or 'y' + * but can be prefixed, like 'ax' for annotation's arrow x + * dflt: the default to coerce to, or blank to use the first axis (falling back on + * extraOption if there is no axis) + * extraOption: aside from existing axes with this letter, what non-axis value is allowed? + * Only required if it's different from `dflt` + */ +axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption) { + var axLetter = attr.charAt(attr.length - 1), + axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), + refAttr = attr + 'ref', attrDef = {}; + if(!dflt) dflt = axlist[0] || extraOption; + if(!extraOption) extraOption = dflt; + // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(['paper']), - dflt: dflt || axlist[0] || 'paper' + values: axlist.concat(extraOption ? [extraOption] : []), + dflt: dflt }; // xref, yref return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; -// todo: duplicated per github PR 610. Should be consolidated with axes.coerceRef. -// find the list of possible axes to reference with an axref or ayref attribute -// and coerce it to that list -axes.coerceARef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = 'a' + axLetter + 'ref', - attrDef = {}; - - // data-ref annotations are not supported in gl2d yet +/* + * coerce position attributes (range-type) that can be either on axes or absolute + * (paper or pixel) referenced. The biggest complication here is that we don't know + * before looking at the axis whether the value must be a number or not (it may be + * a date string), so we can't use the regular valType='number' machinery + * + * axRef (string): the axis this position is referenced to, or: + * paper: fraction of the plot area + * pixel: pixels relative to some starting position + * attr (string): the attribute in containerOut we are coercing + * dflt (number): the default position, as a fraction or pixels. If the attribute + * is to be axis-referenced, this will be converted to an axis data value + * + * Also cleans the values, since the attribute definition itself has to say + * valType: 'any' to handle date axes. This allows us to accept: + * - for category axes: category names, and convert them here into serial numbers. + * Note that this will NOT work for axis range endpoints, because we don't know + * the category list yet (it's set by ax.makeCalcdata during calc) + * but it works for component (note, shape, images) positions. + * - for date axes: JS Dates or milliseconds, and convert to date strings + * - for other types: coerce them to numbers + */ +axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { + var pos, + newPos; + + if(axRef === 'paper' || axRef === 'pixel') { + pos = coerce(attr, dflt); + } + else { + var ax = axes.getFromId(gd, axRef); - attrDef[refAttr] = { - valType: 'enumerated', - values: axlist.concat(['pixel']), - dflt: dflt || 'pixel' || axlist[0] - }; + dflt = ax.fraction2r(dflt); + pos = coerce(attr, dflt); - // axref, ayref - return Lib.coerce(containerIn, containerOut, attrDef, refAttr); + if(ax.type === 'category') { + // if position is given as a category name, convert it to a number + if(typeof pos === 'string' && (ax._categories || []).length) { + newPos = ax._categories.indexOf(pos); + containerOut[attr] = (newPos !== -1) ? dflt : newPos; + return; + } + } + else if(ax.type === 'date') { + containerOut[attr] = Lib.cleanDate(pos); + return; + } + } + // finally make sure we have a number (unless date type already returned a string) + containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; }; // empty out types for all axes containing these traces @@ -107822,14 +107820,16 @@ axes.counterLetter = function(id) { // incorporate a new minimum difference and first tick into // forced +// note that _forceTick0 is linearized, so needs to be turned into +// a range value for setting tick0 axes.minDtick = function(ax, newDiff, newFirst, allow) { // doesn't make sense to do forced min dTick on log or category axes, // and the plot itself may decide to cancel (ie non-grouped bars) if(['log', 'category'].indexOf(ax.type) !== -1 || !allow) { ax._minDtick = 0; } - // null means there's nothing there yet - else if(ax._minDtick === null) { + // undefined means there's nothing there yet + else if(ax._minDtick === undefined) { ax._minDtick = newDiff; ax._forceTick0 = newFirst; } @@ -107854,6 +107854,19 @@ axes.minDtick = function(ax, newDiff, newFirst, allow) { } }; +// Find the autorange for this axis +// +// assumes ax._min and ax._max have already been set by calling axes.expand +// using calcdata from all traces. These are arrays of: +// {val: calcdata value, pad: extra pixels beyond this value} +// +// Returns an array of [min, max]. These are calcdata for log and category axes +// and data for linear and date axes. +// +// TODO: we want to change log to data as well, but it's hard to do this +// maintaining backward compatibility. category will always have to use calcdata +// though, because otherwise values between categories (or outside all categories) +// would be impossible. axes.getAutoRange = function(ax) { var newRange = []; @@ -107872,7 +107885,12 @@ axes.getAutoRange = function(ax) { var j, minpt, maxpt, minbest, maxbest, dp, dv, mbest = 0, - axReverse = (ax.range && ax.range[1] < ax.range[0]); + axReverse = false; + + if(ax.range) { + var rng = ax.range.map(ax.r2l); + axReverse = rng[1] < rng[0]; + } // one-time setting to easily reverse the axis // when plotting from code @@ -107961,11 +107979,9 @@ axes.getAutoRange = function(ax) { } // maintain reversal - if(axReverse) { - newRange.reverse(); - } + if(axReverse) newRange.reverse(); - return newRange; + return newRange.map(ax.l2r || Number); }; axes.doAutoRange = function(ax) { @@ -108028,7 +108044,6 @@ axes.saveRangeInitial = function(gd, overwrite) { // (unless one end is overridden by tozero) // tozero: (boolean) make sure to include zero if axis is linear, // and make it a tight bound if possible -var FP_SAFE = Number.MAX_VALUE / 2; axes.expand = function(ax, data, options) { if(!(ax.autorange || ax._needsExpand) || !data) return; if(!ax._min) ax._min = []; @@ -108167,10 +108182,24 @@ axes.autoBin = function(data, ax, nbins, is2d) { } // piggyback off autotick code to make "nice" bin sizes - var dummyax = { - type: ax.type === 'log' ? 'linear' : ax.type, - range: [datamin, datamax] - }; + var dummyax; + if(ax.type === 'log') { + dummyax = { + type: 'linear', + range: [datamin, datamax], + r2l: Number + }; + } + else { + dummyax = { + type: ax.type, + // conversion below would be ax.c2r but that's only different from l2r + // for log, and this is the only place (so far?) we would want c2r. + range: [datamin, datamax].map(ax.l2r), + r2l: ax.r2l + }; + } + axes.autoTicks(dummyax, size0); var binstart = axes.tickIncrement( axes.tickFirst(dummyax), dummyax.dtick, 'reverse'), @@ -108234,8 +108263,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { } return { - start: binstart, - end: binend, + start: ax.c2r(binstart), + end: ax.c2r(binend), size: dummyax.dtick }; }; @@ -108252,6 +108281,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { axes.calcTicks = function calcTicks(ax) { if(ax.tickmode === 'array') return arrayTicks(ax); + var rng = ax.range.map(ax.r2l); + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks, @@ -108266,18 +108297,17 @@ axes.calcTicks = function calcTicks(ax) { nt = Lib.constrain(ax._length / minPx, 4, 9) + 1; } } - axes.autoTicks(ax, Math.abs(ax.range[1] - ax.range[0]) / nt); + axes.autoTicks(ax, Math.abs(rng[1] - rng[0]) / nt); // check for a forced minimum dtick if(ax._minDtick > 0 && ax.dtick < ax._minDtick * 2) { ax.dtick = ax._minDtick; - ax.tick0 = ax._forceTick0; + ax.tick0 = ax.l2r(ax._forceTick0); } } // check for missing tick0 if(!ax.tick0) { - ax.tick0 = (ax.type === 'date') ? - new Date(2000, 0, 1).getTime() : 0; + ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; } // now figure out rounding of tick values @@ -108287,12 +108317,12 @@ axes.calcTicks = function calcTicks(ax) { ax._tmin = axes.tickFirst(ax); // check for reversed axis - var axrev = (ax.range[1] < ax.range[0]); + var axrev = (rng[1] < rng[0]); // return the full set of tick vals var vals = [], // add a tiny bit so we get ticks which may have rounded out - endtick = ax.range[1] * 1.0001 - ax.range[0] * 0.0001; + endtick = rng[1] * 1.0001 - rng[0] * 0.0001; if(ax.type === 'category') { endtick = (axrev) ? Math.max(-0.5, endtick) : Math.min(ax._categories.length - 0.5, endtick); @@ -108310,9 +108340,18 @@ axes.calcTicks = function calcTicks(ax) { // show the exponent only on the last one ax._tmax = vals[vals.length - 1]; + // for showing date suffixes: ax._prevSuffix holds what we showed most + // recently. Start with it cleared and mark that we're in calcTicks (ie + // calculating a whole string of these so we should care what the previous + // suffix was!) + ax._prevSuffix = ''; + ax._inCalcTicks = true; + var ticksOut = new Array(vals.length); for(var i = 0; i < vals.length; i++) ticksOut[i] = axes.tickText(ax, vals[i]); + ax._inCalcTicks = false; + return ticksOut; }; @@ -108320,15 +108359,15 @@ function arrayTicks(ax) { var vals = ax.tickvals, text = ax.ticktext, ticksOut = new Array(vals.length), - r0expanded = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, - r1expanded = ax.range[1] * 1.0001 - ax.range[0] * 0.0001, + rng = ax.range.map(ax.r2l), + r0expanded = rng[0] * 1.0001 - rng[1] * 0.0001, + r1expanded = rng[1] * 1.0001 - rng[0] * 0.0001, tickMin = Math.min(r0expanded, r1expanded), tickMax = Math.max(r0expanded, r1expanded), vali, i, j = 0; - // without a text array, just format the given values as any other ticks // except with more precision to the numbers if(!Array.isArray(text)) text = []; @@ -108368,7 +108407,7 @@ function roundDTick(roughDTick, base, roundingSet) { // outputs (into ax): // tick0: starting point for ticks (not necessarily on the graph) // usually 0 for numeric (=10^0=1 for log) or jan 1, 2000 for dates -// dtick: the actual, nice round tick spacing, somewhat larger than roughDTick +// dtick: the actual, nice round tick spacing, usually a little larger than roughDTick // if the ticks are spaced linearly (linear scale, categories, // log with only full powers, date ticks < month), // this will just be a number @@ -108381,36 +108420,35 @@ axes.autoTicks = function(ax, roughDTick) { var base; if(ax.type === 'date') { - ax.tick0 = new Date(2000, 0, 1).getTime(); + ax.tick0 = '2000-01-01'; + // the criteria below are all based on the rough spacing we calculate + // being > half of the final unit - so precalculate twice the rough val + var roughX2 = 2 * roughDTick; - if(roughDTick > 15778800000) { - // years if roughDTick > 6mo - roughDTick /= 31557600000; + if(roughX2 > ONEAVGYEAR) { + roughDTick /= ONEAVGYEAR; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'M' + (12 * roundDTick(roughDTick, base, roundBase10)); } - else if(roughDTick > 1209600000) { - // months if roughDTick > 2wk - roughDTick /= 2629800000; + else if(roughX2 > ONEAVGMONTH) { + roughDTick /= ONEAVGMONTH; ax.dtick = 'M' + roundDTick(roughDTick, 1, roundBase24); } - else if(roughDTick > 43200000) { - // days if roughDTick > 12h - ax.dtick = roundDTick(roughDTick, 86400000, roundDays); + else if(roughX2 > ONEDAY) { + ax.dtick = roundDTick(roughDTick, ONEDAY, roundDays); // get week ticks on sunday - ax.tick0 = new Date(2000, 0, 2).getTime(); + // this will also move the base tick off 2000-01-01 if dtick is + // 2 or 3 days... but that's a weird enough case that we'll ignore it. + ax.tick0 = '2000-01-02'; } - else if(roughDTick > 1800000) { - // hours if roughDTick > 30m - ax.dtick = roundDTick(roughDTick, 3600000, roundBase24); + else if(roughX2 > ONEHOUR) { + ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } - else if(roughDTick > 30000) { - // minutes if roughDTick > 30sec - ax.dtick = roundDTick(roughDTick, 60000, roundBase60); + else if(roughX2 > ONEMIN) { + ax.dtick = roundDTick(roughDTick, ONEMIN, roundBase60); } - else if(roughDTick > 500) { - // seconds if roughDTick > 0.5sec - ax.dtick = roundDTick(roughDTick, 1000, roundBase60); + else if(roughX2 > ONESEC) { + ax.dtick = roundDTick(roughDTick, ONESEC, roundBase60); } else { // milliseconds @@ -108420,16 +108458,19 @@ axes.autoTicks = function(ax, roughDTick) { } else if(ax.type === 'log') { ax.tick0 = 0; + var rng = ax.range.map(ax.r2l); - // only show powers of 10 - if(roughDTick > 0.7) ax.dtick = Math.ceil(roughDTick); - else if(Math.abs(ax.range[1] - ax.range[0]) < 1) { + if(roughDTick > 0.7) { + // only show powers of 10 + ax.dtick = Math.ceil(roughDTick); + } + else if(Math.abs(rng[1] - rng[0]) < 1) { // span is less than one power of 10 - var nt = 1.5 * Math.abs((ax.range[1] - ax.range[0]) / roughDTick); + var nt = 1.5 * Math.abs((rng[1] - rng[0]) / roughDTick); // ticks on a linear scale, labeled fully - roughDTick = Math.abs(Math.pow(10, ax.range[1]) - - Math.pow(10, ax.range[0])) / nt; + roughDTick = Math.abs(Math.pow(10, rng[1]) - + Math.pow(10, rng[0])) / nt; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'L' + roundDTick(roughDTick, base, roundBase10); } @@ -108468,41 +108509,59 @@ axes.autoTicks = function(ax, roughDTick) { // for date ticks, the last date part to show (y,m,d,H,M,S) // or an integer # digits past seconds function autoTickRound(ax) { - var dtick = ax.dtick, - maxend; + var dtick = ax.dtick; ax._tickexponent = 0; - if(!isNumeric(dtick) && typeof dtick !== 'string') dtick = 1; + if(!isNumeric(dtick) && typeof dtick !== 'string') { + dtick = 1; + } - if(ax.type === 'category') ax._tickround = null; - else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { - if(ax.type === 'date') { - if(dtick >= 86400000) ax._tickround = 'd'; - else if(dtick >= 3600000) ax._tickround = 'H'; - else if(dtick >= 60000) ax._tickround = 'M'; - else if(dtick >= 1000) ax._tickround = 'S'; - else ax._tickround = 3 - Math.round(Math.log(dtick / 2) / Math.LN10); - } + if(ax.type === 'category') { + ax._tickround = null; + } + if(ax.type === 'date') { + // If tick0 is unusual, give tickround a bit more information + // not necessarily *all* the information in tick0 though, if it's really odd + // minimal string length for tick0: 'd' is 10, 'M' is 16, 'S' is 19 + // take off a leading minus (year < 0 so length is consistent) + var tick0ms = Lib.dateTime2ms(ax.tick0), + tick0str = Lib.ms2DateTime(tick0ms).replace(/^-/, ''), + tick0len = tick0str.length; + + if(String(dtick).charAt(0) === 'M') { + // any tick0 more specific than a year: alway show the full date + if(tick0len > 10 || tick0str.substr(5) !== '01-01') ax._tickround = 'd'; + // show the month unless ticks are full multiples of a year + else ax._tickround = (+(dtick.substr(1)) % 12 === 0) ? 'y' : 'm'; + } + else if((dtick >= ONEDAY && tick0len <= 10) || (dtick >= ONEDAY * 15)) ax._tickround = 'd'; + else if((dtick >= ONEMIN && tick0len <= 16) || (dtick >= ONEHOUR)) ax._tickround = 'M'; + else if((dtick >= ONESEC && tick0len <= 19) || (dtick >= ONEMIN)) ax._tickround = 'S'; else { - if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); - // 2 digits past largest digit of dtick - ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); + // of any two adjacent ticks, at least one will have the maximum fractional digits + // of all possible ticks - so take the max. length of tick0 and the next one + var tick1len = Lib.ms2DateTime(tick0ms + dtick).replace(/^-/, '').length; + ax._tickround = Math.max(tick0len, tick1len) - 20; + } + } + else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { + // linear or log (except D1, D2) + var rng = ax.range.map(ax.r2d || Number); + if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); + // 2 digits past largest digit of dtick + ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); - if(ax.type === 'log') { - maxend = Math.pow(10, Math.max(ax.range[0], ax.range[1])); - } - else maxend = Math.max(Math.abs(ax.range[0]), Math.abs(ax.range[1])); + var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); - var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { - if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { - ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); - } - else ax._tickexponent = rangeexp; + var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); + if(Math.abs(rangeexp) > 3) { + if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { + ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } + else ax._tickexponent = rangeexp; } } - else if(dtick.charAt(0) === 'M') ax._tickround = (dtick.length === 2) ? 'm' : 'y'; + // D1 or D2 (log) else ax._tickround = null; } @@ -108547,13 +108606,16 @@ axes.tickIncrement = function(x, dtick, axrev) { // calculate the first tick on an axis axes.tickFirst = function(ax) { - var axrev = ax.range[1] < ax.range[0], + var r2l = ax.r2l || Number, + rng = ax.range.map(r2l), + axrev = rng[1] < rng[0], sRound = axrev ? Math.floor : Math.ceil, // add a tiny extra bit to make sure we get ticks // that may have been rounded out - r0 = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, + r0 = rng[0] * 1.0001 - rng[1] * 0.0001, dtick = ax.dtick, - tick0 = ax.tick0; + tick0 = r2l(ax.tick0); + if(isNumeric(dtick)) { var tmin = sRound((r0 - tick0) / dtick) * dtick + tick0; @@ -108603,7 +108665,7 @@ axes.tickFirst = function(ax) { var yearFormat = d3.time.format('%Y'), monthFormat = d3.time.format('%b %Y'), dayFormat = d3.time.format('%b %-d'), - hourFormat = d3.time.format('%b %-d %Hh'), + yearMonthDayFormat = d3.time.format('%b %-d, %Y'), minuteFormat = d3.time.format('%H:%M'), secondFormat = d3.time.format(':%S'); @@ -108639,7 +108701,8 @@ axes.tickText = function(ax, x, hover) { i; if(arrayMode && Array.isArray(ax.ticktext)) { - var minDiff = Math.abs(ax.range[1] - ax.range[0]) / 10000; + var rng = ax.range.map(ax.r2l), + minDiff = Math.abs(rng[1] - rng[0]) / 10000; for(i = 0; i < ax.ticktext.length; i++) { if(Math.abs(x - ax.d2l(ax.tickvals[i])) < minDiff) break; } @@ -108694,10 +108757,12 @@ function tickTextObj(ax, x, text) { function formatDate(ax, out, hover, extraPrecision) { var x = out.x, tr = ax._tickround, + trOriginal = tr, d = new Date(x), // suffix completes the full date info, to be included - // with only the first tick - suffix = '', + // with only the first tick or if any info before what's + // shown has changed + suffix, tt; if(hover && ax.hoverformat) { tt = modDateFormat(ax.hoverformat, x); @@ -108710,34 +108775,40 @@ function formatDate(ax, out, hover, extraPrecision) { else { if(extraPrecision) { if(isNumeric(tr)) tr += 2; - else tr = {y: 'm', m: 'd', d: 'H', H: 'M', M: 'S', S: 2}[tr]; + else tr = {y: 'm', m: 'd', d: 'M', M: 'S', S: 2}[tr]; } if(tr === 'y') tt = yearFormat(d); else if(tr === 'm') tt = monthFormat(d); else { - if(x === ax._tmin && !hover) { - suffix = '
' + yearFormat(d); - } + if(tr === 'd') { + if(!hover) suffix = '
' + yearFormat(d); - if(tr === 'd') tt = dayFormat(d); - else if(tr === 'H') tt = hourFormat(d); + tt = dayFormat(d); + } else { - if(x === ax._tmin && !hover) { - suffix = '
' + dayFormat(d) + ', ' + yearFormat(d); - } + if(!hover) suffix = '
' + yearMonthDayFormat(d); tt = minuteFormat(d); if(tr !== 'M') { tt += secondFormat(d); if(tr !== 'S') { - tt += numFormat(mod(x / 1000, 1), ax, 'none', hover) + tt += numFormat(d3.round(mod(x / 1000, 1), 4), ax, 'none', hover) .substr(1); } } + else if(trOriginal === 'd') { + // for hover on axes with day ticks, minuteFormat (which + // only includes %H:%M) isn't enough, you want the date too + tt = dayFormat(d) + ' ' + tt; + } } } } - out.text = tt + suffix; + if(suffix && (!ax._inCalcTicks || (suffix !== ax._prevSuffix))) { + tt += suffix; + ax._prevSuffix = suffix; + } + out.text = tt; } function formatLog(ax, out, hover, extraPrecision, hideexp) { @@ -108829,7 +108900,7 @@ function numFormat(v, ax, fmtoverride, hover) { (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent // from what we calculate - range: ax.showexponent === 'none' ? ax.range : [0, v || 1] + range: ax.showexponent === 'none' ? ax.range.map(ax.r2d) : [0, v || 1] }; autoTickRound(ah); tickRound = (Number(ah._tickround) || 0) + 4; @@ -109077,8 +109148,9 @@ axes.makeClipPaths = function(gd) { // doTicks: draw ticks, grids, and tick labels // axid: 'x', 'y', 'x2' etc, // blank to do all, -// 'redraw' to force full redraw, and reset ax._r -// (stored range for use by zoom/pan) +// 'redraw' to force full redraw, and reset: +// ax._r (stored range for use by zoom/pan) +// ax._rl (stored linearized range for use by zoom/pan) // or can pass in an axis object directly axes.doTicks = function(gd, axid, skipTitle) { var fullLayout = gd._fullLayout, @@ -109116,7 +109188,10 @@ axes.doTicks = function(gd, axid, skipTitle) { return function() { if(!ax._id) return; var axDone = axes.doTicks(gd, ax._id); - if(axid === 'redraw') ax._r = ax.range.slice(); + if(axid === 'redraw') { + ax._r = ax.range.slice(); + ax._rl = ax._r.map(ax.r2l); + } return axDone; }; })); @@ -109134,9 +109209,6 @@ axes.doTicks = function(gd, axid, skipTitle) { } } - // in case a val turns into string somehow - ax.range = [+ax.range[0], +ax.range[1]]; - // set scaling to pixels ax.setScale(); @@ -109525,7 +109597,8 @@ axes.doTicks = function(gd, axid, skipTitle) { break; } } - var showZl = (ax.range[0] * ax.range[1] <= 0) && ax.zeroline && + var rng = ax.range.map(ax.r2l), + showZl = (rng[0] * rng[1] <= 0) && ax.zeroline && (ax.type === 'linear' || ax.type === '-') && gridvals.length && (hasBarsOrFill || clipEnds({x: 0}) || !ax.showline); var zl = zlcontainer.selectAll('path.' + zcls) @@ -109749,7 +109822,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { // rather than built-in % which gives a negative value for negative v function mod(v, d) { return ((v % d) + d) % d; } -},{"../../components/color":533,"../../components/drawing":557,"../../components/titles":608,"../../lib":632,"../../lib/svg_text_utils":646,"../../registry":738,"./axis_ids":665,"./layout_attributes":672,"./layout_defaults":673,"./set_convert":677,"d3":95,"fast-isnumeric":104}],663:[function(require,module,exports){ +},{"../../components/color":533,"../../components/drawing":556,"../../components/titles":607,"../../constants/numerical":616,"../../lib":633,"../../lib/svg_text_utils":647,"../../registry":739,"./axis_ids":667,"./layout_attributes":673,"./layout_defaults":674,"./set_convert":678,"d3":95,"fast-isnumeric":104}],665:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109764,7 +109837,7 @@ function mod(v, d) { return ((v % d) + d) % d; } var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); -var cleanDatum = require('./clean_datum'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function autoType(array) { if(moreDates(array)) return 'date'; @@ -109806,7 +109879,7 @@ function moreDates(a) { return (dcnt > ncnt * 2); } -// are the (x,y)-values in td.data mostly text? +// are the (x,y)-values in gd.data mostly text? // require twice as many categories as numbers function category(a) { // test at most 1000 points @@ -109816,15 +109889,15 @@ function category(a) { ai; for(var i = 0; i < a.length; i += inc) { - ai = cleanDatum(a[Math.round(i)]); - if(isNumeric(ai)) curvenums++; + ai = a[Math.round(i)]; + if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; else if(typeof ai === 'string' && ai !== '' && ai !== 'None') curvecats++; } return curvecats > curvenums * 2; } -},{"../../lib":632,"./clean_datum":667,"fast-isnumeric":104}],664:[function(require,module,exports){ +},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],666:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109917,17 +109990,15 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var validRange = ( (containerIn.range || []).length === 2 && - isNumeric(containerIn.range[0]) && - isNumeric(containerIn.range[1]) + isNumeric(containerOut.r2l(containerIn.range[0])) && + isNumeric(containerOut.r2l(containerIn.range[1])) ); var autoRange = coerce('autorange', !validRange); if(autoRange) coerce('rangemode'); - var range = coerce('range', [-1, letter === 'x' ? 6 : 4]); - if(range[0] === range[1]) { - containerOut.range = [range[0] - 1, range[0] + 1]; - } - Lib.noneOrAll(containerIn.range, containerOut.range, [0, 1]); + + coerce('range'); + containerOut.cleanRange(); coerce('fixedrange'); @@ -110049,7 +110120,7 @@ function getFirstNonEmptyTrace(data, id, axLetter) { } } -},{"../../components/color/attributes":532,"../../lib":632,"../../registry":738,"./axis_autotype":663,"./axis_ids":665,"./category_order_defaults":666,"./layout_attributes":672,"./ordered_categories":674,"./set_convert":677,"./tick_label_defaults":678,"./tick_mark_defaults":679,"./tick_value_defaults":680,"fast-isnumeric":104,"tinycolor2":489}],665:[function(require,module,exports){ +},{"../../components/color/attributes":532,"../../lib":633,"../../registry":739,"./axis_autotype":665,"./axis_ids":667,"./category_order_defaults":668,"./layout_attributes":673,"./ordered_categories":675,"./set_convert":678,"./tick_label_defaults":679,"./tick_mark_defaults":680,"./tick_value_defaults":681,"fast-isnumeric":104,"tinycolor2":489}],667:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110171,7 +110242,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":632,"../../registry":738,"../plots":723,"./constants":668}],666:[function(require,module,exports){ +},{"../../lib":633,"../../registry":739,"../plots":724,"./constants":669}],668:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110205,46 +110276,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],667:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = require('fast-isnumeric'); - -var Lib = require('../../lib'); - - -/** - * cleanDatum: removes characters - * same replace criteria used in the grid.js:scrapeCol - * but also handling dates, numbers, and NaN, null, Infinity etc - */ -module.exports = function cleanDatum(c) { - try { - if(typeof c === 'object' && c !== null && c.getTime) { - return Lib.ms2DateTime(c); - } - if(typeof c !== 'string' && !isNumeric(c)) { - return ''; - } - c = c.toString().replace(/['"%,$# ]/g, ''); - } - catch(e) { - Lib.error(e, c); - } - - return c; -}; - -},{"../../lib":632,"fast-isnumeric":104}],668:[function(require,module,exports){ +},{}],669:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110268,14 +110300,6 @@ module.exports = { y: /^yaxis([2-9]|[1-9][0-9]+)?$/ }, - /** - * standardize all missing data in calcdata to use undefined - * never null or NaN. - * that way we can use !==undefined, or !== BADNUM, - * to test for real data - */ - BADNUM: undefined, - // axis match regular expression xAxisMatch: /^xaxis[0-9]*$/, yAxisMatch: /^yaxis[0-9]*$/, @@ -110319,10 +110343,15 @@ module.exports = { BENDPX: 1.5, // delay before a redraw (relayout) after smooth panning and zooming - REDRAWDELAY: 50 + REDRAWDELAY: 50, + + // last resort axis ranges for x, y, and date axes if we have no data + DFLTRANGEX: [-1, 6], + DFLTRANGEY: [-1, 4], + DFLTRANGEDATE: ['2000-01-01', '2001-01-01'], }; -},{}],669:[function(require,module,exports){ +},{}],670:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110423,11 +110452,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { return dragger; } - function forceNumbers(axRange) { - axRange[0] = Number(axRange[0]); - axRange[1] = Number(axRange[1]); - } - var dragOptions = { element: dragger, gd: gd, @@ -110538,7 +110562,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { .attr('d', 'M0,0Z'); clearSelect(); - for(var i = 0; i < allaxes.length; i++) forceNumbers(allaxes[i].range); } function clearSelect() { @@ -110629,16 +110652,16 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomAxRanges(axList, r0Fraction, r1Fraction) { var i, axi, - axRange; + axRangeLinear; for(i = 0; i < axList.length; i++) { axi = axList[i]; if(axi.fixedrange) continue; - axRange = axi.range; + axRangeLinear = axi.range.map(axi.r2l); axi.range = [ - axRange[0] + (axRange[1] - axRange[0]) * r0Fraction, - axRange[0] + (axRange[1] - axRange[0]) * r1Fraction + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r0Fraction), + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r1Fraction) ]; } } @@ -110692,7 +110715,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { verticalAlign: vAlign }) .on('edit', function(text) { - var v = ax.type === 'category' ? ax.c2l(text) : ax.d2l(text); + var v = ax.d2r(text); if(v !== undefined) { Plotly.relayout(gd, attrStr, v); } @@ -110752,10 +110775,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomWheelOneAxis(ax, centerFraction, zoom) { if(ax.fixedrange) return; - forceNumbers(ax.range); - var axRange = ax.range, + + var axRange = ax.range.map(ax.r2l), v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; - ax.range = [v0 + (axRange[0] - v0) * zoom, v0 + (axRange[1] - v0) * zoom]; + function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); } + ax.range = axRange.map(doZoom); } if(ew) { @@ -110803,7 +110827,10 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { for(var i = 0; i < axList.length; i++) { var axi = axList[i]; if(!axi.fixedrange) { - axi.range = [axi._r[0] - pix / axi._m, axi._r[1] - pix / axi._m]; + axi.range = [ + axi.l2r(axi._rl[0] - pix / axi._m), + axi.l2r(axi._rl[1] - pix / axi._m) + ]; } } } @@ -110826,23 +110853,29 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { 1 / (1 / Math.max(d, -0.3) + 3.222)); } - // dz: set a new value for one end (0 or 1) of an axis array ax, + // dz: set a new value for one end (0 or 1) of an axis array axArray, // and return a pixel shift for that end for the viewbox // based on pixel drag distance d // TODO: this makes (generally non-fatal) errors when you get // near floating point limits - function dz(ax, end, d) { + function dz(axArray, end, d) { var otherEnd = 1 - end, - movedi = 0; - for(var i = 0; i < ax.length; i++) { - var axi = ax[i]; + movedAx, + newLinearizedEnd; + for(var i = 0; i < axArray.length; i++) { + var axi = axArray[i]; if(axi.fixedrange) continue; - movedi = i; - axi.range[end] = axi._r[otherEnd] + - (axi._r[end] - axi._r[otherEnd]) / dZoom(d / axi._length); + movedAx = axi; + newLinearizedEnd = axi._rl[otherEnd] + + (axi._rl[end] - axi._rl[otherEnd]) / dZoom(d / axi._length); + var newEnd = axi.l2r(newLinearizedEnd); + + // if l2r comes back false or undefined, it means we've dragged off + // the end of valid ranges - so stop. + if(newEnd !== false && newEnd !== undefined) axi.range[end] = newEnd; } - return ax[movedi]._length * (ax[movedi]._r[end] - ax[movedi].range[end]) / - (ax[movedi]._r[end] - ax[movedi]._r[otherEnd]); + return movedAx._length * (movedAx._rl[end] - newLinearizedEnd) / + (movedAx._rl[end] - movedAx._rl[otherEnd]); } if(xActive === 'w') dx = dz(xa, 0, dx); @@ -111044,8 +111077,10 @@ function getEndText(ax, end) { diff = Math.abs(initialVal - ax.range[1 - end]), dig; + // TODO: this should basically be ax.r2d but we're doing extra + // rounding here... can we clean up at all? if(ax.type === 'date') { - return Lib.ms2DateTime(initialVal, diff); + return initialVal; } else if(ax.type === 'log') { dig = Math.ceil(Math.max(0, -Math.log(diff) / Math.LN10)) + 3; @@ -111079,7 +111114,7 @@ function isSelectOrLasso(dragmode) { return modes.indexOf(dragmode) !== -1; } -},{"../../components/color":533,"../../components/dragelement":555,"../../components/drawing":557,"../../lib":632,"../../lib/setcursor":642,"../../lib/svg_text_utils":646,"../../plotly":658,"../../registry":738,"./axes":662,"./constants":668,"./select":676,"d3":95,"tinycolor2":489}],670:[function(require,module,exports){ +},{"../../components/color":533,"../../components/dragelement":554,"../../components/drawing":556,"../../lib":633,"../../lib/setcursor":643,"../../lib/svg_text_utils":647,"../../plotly":659,"../../registry":739,"./axes":664,"./constants":669,"./select":677,"d3":95,"tinycolor2":489}],671:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111105,6 +111140,7 @@ var dragElement = require('../../components/dragelement'); var Axes = require('./axes'); var constants = require('./constants'); var dragBox = require('./dragbox'); +var layoutAttributes = require('../layout_attributes'); var fx = module.exports = {}; @@ -111114,29 +111150,12 @@ var fx = module.exports = {}; fx.unhover = dragElement.unhover; fx.layoutAttributes = { - dragmode: { - valType: 'enumerated', - role: 'info', - values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], - dflt: 'zoom', - description: [ - 'Determines the mode of drag interactions.', - '*select* and *lasso* apply only to scatter traces with', - 'markers or text. *orbit* and *turntable* apply only to', - '3D scenes.' - ].join(' ') - }, - hovermode: { - valType: 'enumerated', - role: 'info', - values: ['x', 'y', 'closest', false], - description: 'Determines the mode of hover interactions.' - } }; fx.supplyLayoutDefaults = function(layoutIn, layoutOut, fullData) { + function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, fx.layoutAttributes, attr, dflt); + return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } coerce('dragmode'); @@ -112439,7 +112458,7 @@ fx.inbox = function(v0, v1) { return Infinity; }; -},{"../../components/color":533,"../../components/dragelement":555,"../../components/drawing":557,"../../lib":632,"../../lib/events":624,"../../lib/svg_text_utils":646,"./axes":662,"./constants":668,"./dragbox":669,"d3":95,"fast-isnumeric":104,"tinycolor2":489}],671:[function(require,module,exports){ +},{"../../components/color":533,"../../components/dragelement":554,"../../components/drawing":556,"../../lib":633,"../../lib/events":625,"../../lib/svg_text_utils":647,"../layout_attributes":715,"./axes":664,"./constants":669,"./dragbox":670,"d3":95,"fast-isnumeric":104,"tinycolor2":489}],672:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112469,6 +112488,8 @@ exports.attrRegex = constants.attrRegex; exports.attributes = require('./attributes'); +exports.layoutAttributes = require('./layout_attributes'); + exports.transitionAxes = require('./transition_axes'); exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) { @@ -112811,7 +112832,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":632,"../plots":723,"./attributes":661,"./axes":662,"./constants":668,"./transition_axes":681,"d3":95}],672:[function(require,module,exports){ +},{"../../lib":633,"../plots":724,"./attributes":663,"./axes":664,"./constants":669,"./layout_attributes":673,"./transition_axes":682,"d3":95}],673:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112854,8 +112875,8 @@ module.exports = { type: { valType: 'enumerated', // '-' means we haven't yet run autotype or couldn't find any data - // it gets turned into linear in td._fullLayout but not copied back - // to td.data like the others are. + // it gets turned into linear in gd._fullLayout but not copied back + // to gd.data like the others are. values: ['-', 'linear', 'log', 'date', 'category'], dflt: '-', role: 'info', @@ -112896,16 +112917,20 @@ module.exports = { valType: 'info_array', role: 'info', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], description: [ 'Sets the range of this axis.', - 'If the axis `type` is *log*, then you must take the log of your desired range', - '(e.g. to set the range from 1 to 100, set the range from 0 to 2).', - 'If the axis `type` is *date*, then you must convert the date to unix time in milliseconds', - '(the number of milliseconds since January 1st, 1970). For example, to set the date range from', - 'January 1st 1970 to November 4th, 2013, set the range from 0 to 1380844800000.0' + 'If the axis `type` is *log*, then you must take the log of your', + 'desired range (e.g. to set the range from 1 to 100,', + 'set the range from 0 to 2).', + 'If the axis `type` is *date*, it should be date strings,', + 'like date data, though Date objects and unix milliseconds', + 'will be accepted and converted to strings.', + 'If the axis `type` is *category*, it should be numbers,', + 'using the scale where each category is assigned a serial', + 'number from zero in the order it appears.' ].join(' ') }, @@ -112947,35 +112972,42 @@ module.exports = { ].join(' ') }, tick0: { - valType: 'number', - dflt: 0, + valType: 'any', role: 'style', description: [ 'Sets the placement of the first tick on this axis.', 'Use with `dtick`.', 'If the axis `type` is *log*, then you must take the log of your starting tick', - '(e.g. to set the starting tick to 100, set the `tick0` to 2).', - 'If the axis `type` is *date*, then you must convert the date to unix time in milliseconds', - '(the number of milliseconds since January 1st, 1970).', - 'For example, to set the starting tick to', - 'November 4th, 2013, set the range to 1380844800000.0.' + '(e.g. to set the starting tick to 100, set the `tick0` to 2)', + 'except when `dtick`=*L* (see `dtick` for more info).', + 'If the axis `type` is *date*, it should be a date string, like date data.', + 'If the axis `type` is *category*, it should be a number, using the scale where', + 'each category is assigned a serial number from zero in the order it appears.' ].join(' ') }, dtick: { valType: 'any', - dflt: 1, role: 'style', description: [ - 'Sets the step in-between ticks on this axis', - 'Use with `tick0`.', + 'Sets the step in-between ticks on this axis. Use with `tick0`.', + 'Must be a positive number, or special strings available to *log* and *date* axes.', 'If the axis `type` is *log*, then ticks are set every 10^(n*dtick) where n', 'is the tick number. For example,', 'to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1.', 'To set tick marks at 1, 100, 10000, ... set dtick to 2.', 'To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433.', + '*log* has several special values; *L*, where `f` is a positive number,', + 'gives ticks linearly spaced in value (but not position).', + 'For example `tick0` = 0.1, `dtick` = *L0.5* will put ticks at 0.1, 0.6, 1.1, 1.6 etc.', + 'To show powers of 10 plus small digits between, use *D1* (all digits) or *D2* (only 2 and 5).', + '`tick0` is ignored for *D1* and *D2*.', 'If the axis `type` is *date*, then you must convert the time to milliseconds.', 'For example, to set the interval between ticks to one day,', - 'set `dtick` to 86400000.0.' + 'set `dtick` to 86400000.0.', + '*date* also has special values *M* gives ticks spaced by a number of months.', + '`n` must be a positive integer.', + 'To set ticks on the 15th of every third month, set `tick0` to *2000-01-15* and `dtick` to *M3*.', + 'To set ticks every 4 years, set `dtick` to *M48*' ].join(' ') }, tickvals: { @@ -113132,11 +113164,14 @@ module.exports = { dflt: '', role: 'style', description: [ - 'Sets the tick label formatting rule using the', - 'python/d3 number formatting language.', - 'See https://github.com/mbostock/d3/wiki/Formatting#numbers', - 'or https://docs.python.org/release/3.1.3/library/string.html#formatspec', - 'for more info.' + 'Sets the tick label formatting rule using d3 formatting mini-languages', + 'which are very similar to those in Python. For numbers, see:', + 'https://github.com/d3/d3-format/blob/master/README.md#locale_format', + 'And for dates see:', + 'https://github.com/d3/d3-time-format/blob/master/README.md#locale_format', + 'We add one item to d3\'s date formatter: *%{n}f* for fractional seconds', + 'with n digits. For example, *2016-10-13 09:15:23.456* with tickformat', + '*%H~%M~%S.%2f* would display *09~15~23.46*' ].join(' ') }, hoverformat: { @@ -113144,11 +113179,14 @@ module.exports = { dflt: '', role: 'style', description: [ - 'Sets the hover text formatting rule for data values on this axis,', - 'using the python/d3 number formatting language.', - 'See https://github.com/mbostock/d3/wiki/Formatting#numbers', - 'or https://docs.python.org/release/3.1.3/library/string.html#formatspec', - 'for more info.' + 'Sets the hover text formatting rule using d3 formatting mini-languages', + 'which are very similar to those in Python. For numbers, see:', + 'https://github.com/d3/d3-format/blob/master/README.md#locale_format', + 'And for dates see:', + 'https://github.com/d3/d3-time-format/blob/master/README.md#locale_format', + 'We add one item to d3\'s date formatter: *%{n}f* for fractional seconds', + 'with n digits. For example, *2016-10-13 09:15:23.456* with tickformat', + '*%H~%M~%S.%2f* would display *09~15~23.46*' ].join(' ') }, // lines and grids @@ -113315,11 +113353,6 @@ module.exports = { ].join(' ') }, - _nestedModules: { - 'rangeslider': 'rangeslider', - 'rangeselector': 'rangeselector', - }, - _deprecated: { autotick: { valType: 'boolean', @@ -113333,7 +113366,7 @@ module.exports = { } }; -},{"../../components/color/attributes":532,"../../lib/extend":625,"../font_attributes":683,"./constants":668}],673:[function(require,module,exports){ +},{"../../components/color/attributes":532,"../../lib/extend":626,"../font_attributes":684,"./constants":669}],674:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113507,7 +113540,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { }); }; -},{"../../components/color":533,"../../lib":632,"../../registry":738,"../layout_attributes":714,"./axis_defaults":664,"./axis_ids":665,"./constants":668,"./layout_attributes":672,"./position_defaults":675}],674:[function(require,module,exports){ +},{"../../components/color":533,"../../lib":633,"../../registry":739,"../layout_attributes":715,"./axis_defaults":666,"./axis_ids":667,"./constants":669,"./layout_attributes":673,"./position_defaults":676}],675:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113586,7 +113619,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":95}],675:[function(require,module,exports){ +},{"d3":95}],676:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113651,7 +113684,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":632,"fast-isnumeric":104}],676:[function(require,module,exports){ +},{"../../lib":633,"fast-isnumeric":104}],677:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113851,7 +113884,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":533,"../../lib/polygon":639,"./axes":662,"./constants":668}],677:[function(require,module,exports){ +},{"../../components/color":533,"../../lib/polygon":640,"./axes":664,"./constants":669}],678:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113867,27 +113900,38 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); +var numConstants = require('../../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var constants = require('./constants'); -var cleanDatum = require('./clean_datum'); var axisIds = require('./axis_ids'); /** - * Define the conversion functions for an axis data is used in 4 ways: + * Define the conversion functions for an axis data is used in 5 ways: * * d: data, in whatever form it's provided * c: calcdata: turned into numbers, but not linearized - * l: linearized - same as c except for log axes (and other - * mappings later?) this is used by ranges, and when we - * need to know if it's *possible* to show some data on - * this axis, without caring about the current range + * l: linearized - same as c except for log axes (and other nonlinear + * mappings later?) this is used when we need to know if it's + * *possible* to show some data on this axis, without caring about + * the current range * p: pixel value - mapped to the screen with current size and zoom - * - * Creates/updates these conversion functions + * r: ranges, tick0, and annotation positions match one of the above + * but are handled differently for different types: + * - linear and date: data format (d) + * - category: calcdata format (c), and will stay that way because + * the data format has no continuous mapping + * - log: linearized (l) format + * TODO: in v2.0 we plan to change it to data format. At that point + * shapes will work the same way as ranges, tick0, and annotations + * so they can use this conversion too. + * + * Creates/updates these conversion functions, as well as cleaner functions: + * ax.d2d and ax.clean2r * also clears the autorange bounds ._min and ._max - * and the autotick constraints ._minDtick, ._forceTick0, - * and looks for date ranges that aren't yet in numeric format + * and the autotick constraints ._minDtick, ._forceTick0 */ module.exports = function setConvert(ax) { @@ -113907,20 +113951,119 @@ module.exports = function setConvert(ax) { return 0.5 * (r0 + r1 - 3 * clipMult * Math.abs(r0 - r1)); } - else return constants.BADNUM; + else return BADNUM; + } + + function fromLog(v) { + return Math.pow(10, v); + } + + function num(v) { + if(!isNumeric(v)) return BADNUM; + v = Number(v); + if(v < -FP_SAFE || v > FP_SAFE) return BADNUM; + return isNumeric(v) ? Number(v) : BADNUM; } - function fromLog(v) { return Math.pow(10, v); } - function num(v) { return isNumeric(v) ? Number(v) : constants.BADNUM; } ax.c2l = (ax.type === 'log') ? toLog : num; ax.l2c = (ax.type === 'log') ? fromLog : num; ax.l2d = function(v) { return ax.c2d(ax.l2c(v)); }; ax.p2d = function(v) { return ax.l2d(ax.p2l(v)); }; + /* + * fn to make sure range is a couplet of valid & distinct values + * keep numbers away from the limits of floating point numbers, + * and dates away from the ends of our date system (+/- 9999 years) + * + * optional param rangeAttr: operate on a different attribute, like + * ax._r, rather than ax.range + */ + ax.cleanRange = function(rangeAttr) { + if(!rangeAttr) rangeAttr = 'range'; + var range = ax[rangeAttr], + axLetter = (ax._id || 'x').charAt(0), + i, dflt; + + if(ax.type === 'date') dflt = constants.DFLTRANGEDATE; + else if(axLetter === 'y') dflt = constants.DFLTRANGEY; + else dflt = constants.DFLTRANGEX; + + // make sure we don't later mutate the defaults + dflt = dflt.slice(); + + if(!range || range.length !== 2) { + ax[rangeAttr] = dflt; + return; + } + + if(ax.type === 'date') { + // check if milliseconds or js date objects are provided for range + // and convert to date strings + range[0] = Lib.cleanDate(range[0]); + range[1] = Lib.cleanDate(range[1]); + } + + for(i = 0; i < 2; i++) { + if(ax.type === 'date') { + if(!Lib.isDateTime(range[i])) { + ax[rangeAttr] = dflt; + break; + } + + if(range[i] < Lib.MIN_MS) range[i] = Lib.MIN_MS; + if(range[i] > Lib.MAX_MS) range[i] = Lib.MAX_MS; + + if(ax.r2l(range[0]) === ax.r2l(range[1])) { + // split by +/- 1 second + var linCenter = Lib.constrain(ax.r2l(range[0]), + Lib.MIN_MS + 1000, Lib.MAX_MS - 1000); + range[0] = ax.l2r(linCenter - 1000); + range[1] = ax.l2r(linCenter + 1000); + break; + } + } + else { + if(!isNumeric(range[i])) { + if(isNumeric(range[1 - i])) { + range[i] = range[1 - i] * (i ? 10 : 0.1); + } + else { + ax[rangeAttr] = dflt; + break; + } + } + + if(range[i] < -FP_SAFE) range[i] = -FP_SAFE; + else if(range[i] > FP_SAFE) range[i] = FP_SAFE; + + if(range[0] === range[1]) { + // somewhat arbitrary: split by 1 or 1ppm, whichever is bigger + var inc = Math.max(1, Math.abs(range[0] * 1e-6)); + range[0] -= inc; + range[1] += inc; + } + } + } + }; + + // find the range value at the specified (linear) fraction of the axis + ax.fraction2r = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return ax.l2r(rl0 + v * (rl1 - rl0)); + }; + + // find the fraction of the range at the specified range value + ax.r2fraction = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return (ax.r2l(v) - rl0) / (rl1 - rl0); + }; + // set scaling to pixels ax.setScale = function(usePrivateRange) { var gs = ax._gd._fullLayout._size, - i; + axLetter = ax._id.charAt(0); // TODO cleaner way to handle this case if(!ax._categories) ax._categories = []; @@ -113936,40 +114079,23 @@ module.exports = function setConvert(ax) { // issue if we transform the drawn layer *and* use the new axis range to // draw the data. This allows us to construct setConvert using the pre- // interaction values of the range: - var range = (usePrivateRange && ax._r) ? ax._r : ax.range; + var rangeAttr = (usePrivateRange && ax._r) ? '_r' : 'range'; + ax.cleanRange(rangeAttr); - // make sure we have a range (linearized data values) - // and that it stays away from the limits of javascript numbers - if(!range || range.length !== 2 || range[0] === range[1]) { - range = [-1, 1]; - } - for(i = 0; i < 2; i++) { - if(!isNumeric(range[i])) { - range[i] = isNumeric(range[1 - i]) ? - (range[1 - i] * (i ? 10 : 0.1)) : - (i ? 1 : -1); - } - - if(range[i] < -(Number.MAX_VALUE / 2)) { - range[i] = -(Number.MAX_VALUE / 2); - } - else if(range[i] > Number.MAX_VALUE / 2) { - range[i] = Number.MAX_VALUE / 2; - } - - } + var rl0 = ax.r2l(ax[rangeAttr][0]), + rl1 = ax.r2l(ax[rangeAttr][1]); - if(ax._id.charAt(0) === 'y') { + if(axLetter === 'y') { ax._offset = gs.t + (1 - ax.domain[1]) * gs.h; ax._length = gs.h * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[0] - range[1]); - ax._b = -ax._m * range[1]; + ax._m = ax._length / (rl0 - rl1); + ax._b = -ax._m * rl1; } else { ax._offset = gs.l + ax.domain[0] * gs.w; ax._length = gs.w * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[1] - range[0]); - ax._b = -ax._m * range[0]; + ax._m = ax._length / (rl1 - rl0); + ax._b = -ax._m * rl0; } if(!isFinite(ax._m) || !isFinite(ax._b)) { @@ -113982,7 +114108,7 @@ module.exports = function setConvert(ax) { }; ax.l2p = function(v) { - if(!isNumeric(v)) return constants.BADNUM; + if(!isNumeric(v)) return BADNUM; // include 2 fractional digits on pixel, for PDF zooming etc return d3.round(ax._b + ax._m * v, 2); @@ -113993,42 +114119,62 @@ module.exports = function setConvert(ax) { ax.c2p = function(v, clip) { return ax.l2p(ax.c2l(v, clip)); }; ax.p2c = function(px) { return ax.l2c(ax.p2l(px)); }; + // clip doesn't do anything here yet, but in v2.0 when log axes get + // refactored it will... so including it now so we don't forget. + ax.r2p = function(v, clip) { return ax.l2p(ax.r2l(v, clip)); }; + ax.p2r = function(px) { return ax.l2r(ax.p2l(px)); }; + + ax.r2c = function(v) { return ax.l2c(ax.r2l(v)); }; + ax.c2r = function(v) { return ax.l2r(ax.c2l(v)); }; + if(['linear', 'log', '-'].indexOf(ax.type) !== -1) { ax.c2d = num; - ax.d2c = function(v) { - v = cleanDatum(v); - return isNumeric(v) ? Number(v) : constants.BADNUM; - }; - ax.d2l = function(v, clip) { - if(ax.type === 'log') return ax.c2l(ax.d2c(v), clip); - else return ax.d2c(v); - }; + ax.d2c = Lib.cleanNumber; + if(ax.type === 'log') { + ax.d2l = function(v, clip) { + return ax.c2l(ax.d2c(v), clip); + }; + ax.d2r = ax.d2l; + ax.r2d = ax.l2d; + } + else { + ax.d2l = Lib.cleanNumber; + ax.d2r = Lib.cleanNumber; + ax.r2d = num; + } + ax.r2l = num; + ax.l2r = num; } else if(ax.type === 'date') { - ax.c2d = function(v) { - return isNumeric(v) ? Lib.ms2DateTime(v) : constants.BADNUM; - }; + ax.c2d = Lib.ms2DateTime; ax.d2c = function(v) { - return (isNumeric(v)) ? Number(v) : Lib.dateTime2ms(v); + // NOTE: Changed this behavior: previously we took any numeric value + // to be a ms, even if it was a string that could be a bare year. + // Now we convert it as a date if at all possible, and only try + // as ms if that fails. + var ms = Lib.dateTime2ms(v); + if(ms === BADNUM) { + if(isNumeric(v)) ms = Number(v); + else return BADNUM; + } + return Lib.constrain(ms, Lib.MIN_MS, Lib.MAX_MS); }; ax.d2l = ax.d2c; - - // check if date strings or js date objects are provided for range - // and convert to ms - if(ax.range && ax.range.length > 1) { - try { - var ar1 = ax.range.map(Lib.dateTime2ms); - if(!isNumeric(ax.range[0]) && isNumeric(ar1[0])) { - ax.range[0] = ar1[0]; - } - if(!isNumeric(ax.range[1]) && isNumeric(ar1[1])) { - ax.range[1] = ar1[1]; - } - } - catch(e) { Lib.error(e, ax.range); } - } + ax.r2l = ax.d2c; + ax.l2r = ax.c2d; + ax.d2r = Lib.identity; + ax.r2d = Lib.identity; + ax.cleanr = function(v) { + /* + * If v is already a date string this is a noop, but running it + * through d2c and back validates the value: + * normalizes Date objects, milliseconds, and out-of-bounds dates + * so we always end up with either a clean date string or BADNUM + */ + return ax.c2d(ax.d2c(v)); + }; } else if(ax.type === 'category') { @@ -114051,38 +114197,42 @@ module.exports = function setConvert(ax) { } var c = ax._categories.indexOf(v); - return c === -1 ? constants.BADNUM : c; + return c === -1 ? BADNUM : c; }; ax.d2l = ax.d2c; + ax.r2l = num; + ax.l2r = num; + ax.d2r = ax.d2c; + ax.r2d = ax.c2d; } // makeCalcdata: takes an x or y array and converts it // to a position on the axis object "ax" // inputs: - // tdc - a data object from td.data - // axletter - a string, either 'x' or 'y', for which item + // trace - a data object from gd.data + // axLetter - a string, either 'x' or 'y', for which item // to convert (TODO: is this now always the same as // the first letter of ax._id?) // in case the expected data isn't there, make a list of // integers based on the opposite data - ax.makeCalcdata = function(tdc, axletter) { + ax.makeCalcdata = function(trace, axLetter) { var arrayIn, arrayOut, i; - if(axletter in tdc) { - arrayIn = tdc[axletter]; + if(axLetter in trace) { + arrayIn = trace[axLetter]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = ax.d2c(arrayIn[i]); } else { - var v0 = ((axletter + '0') in tdc) ? - ax.d2c(tdc[axletter + '0']) : 0, - dv = (tdc['d' + axletter]) ? - Number(tdc['d' + axletter]) : 1; + var v0 = ((axLetter + '0') in trace) ? + ax.d2c(trace[axLetter + '0']) : 0, + dv = (trace['d' + axLetter]) ? + Number(trace['d' + axLetter]) : 1; // the opposing data, for size if we have x and dx etc - arrayIn = tdc[{x: 'y', y: 'x'}[axletter]]; + arrayIn = trace[{x: 'y', y: 'x'}[axLetter]]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = v0 + i * dv; @@ -114097,11 +114247,11 @@ module.exports = function setConvert(ax) { ax._max = []; // and for bar charts and box plots: reset forced minimum tick spacing - ax._minDtick = null; - ax._forceTick0 = null; + delete ax._minDtick; + delete ax._forceTick0; }; -},{"../../lib":632,"./axis_ids":665,"./clean_datum":667,"./constants":668,"d3":95,"fast-isnumeric":104}],678:[function(require,module,exports){ +},{"../../constants/numerical":616,"../../lib":633,"./axis_ids":667,"./constants":669,"d3":95,"fast-isnumeric":104}],679:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -114171,8 +114321,8 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe */ function getShowAttrDflt(containerIn) { var showAttrsAll = ['showexponent', - 'showtickprefix', - 'showticksuffix'], + 'showtickprefix', + 'showticksuffix'], showAttrs = showAttrsAll.filter(function(a) { return containerIn[a] !== undefined; }), @@ -114185,7 +114335,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":632}],679:[function(require,module,exports){ +},{"../../lib":633}],680:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -114218,7 +114368,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":632,"./layout_attributes":672}],680:[function(require,module,exports){ +},{"../../lib":633,"./layout_attributes":673}],681:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -114231,6 +114381,8 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, 'use strict'; var isNumeric = require('fast-isnumeric'); +var Lib = require('../../lib'); +var ONEDAY = require('../../constants/numerical').ONEDAY; module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType) { @@ -114242,15 +114394,56 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } if(Array.isArray(containerIn.tickvals)) tickmodeDefault = 'array'; - else if(containerIn.dtick && isNumeric(containerIn.dtick)) { + else if(containerIn.dtick) { tickmodeDefault = 'linear'; } var tickmode = coerce('tickmode', tickmodeDefault); if(tickmode === 'auto') coerce('nticks'); else if(tickmode === 'linear') { - coerce('tick0'); - coerce('dtick'); + // dtick is usually a positive number, but there are some + // special strings available for log or date axes + // default is 1 day for dates, otherwise 1 + var dtickDflt = (axType === 'date') ? ONEDAY : 1; + var dtick = coerce('dtick', dtickDflt); + if(isNumeric(dtick)) { + containerOut.dtick = (dtick > 0) ? Number(dtick) : dtickDflt; + } + else if(typeof dtick !== 'string') { + containerOut.dtick = dtickDflt; + } + else { + // date and log special cases are all one character plus a number + var prefix = dtick.charAt(0), + dtickNum = dtick.substr(1); + + dtickNum = isNumeric(dtickNum) ? Number(dtickNum) : 0; + if((dtickNum <= 0) || !( + // "M" gives ticks every (integer) n months + (axType === 'date' && prefix === 'M' && dtickNum === Math.round(dtickNum)) || + // "L" gives ticks linearly spaced in data (not in position) every (float) f + (axType === 'log' && prefix === 'L') || + // "D1" gives powers of 10 with all small digits between, "D2" gives only 2 and 5 + (axType === 'log' && prefix === 'D' && (dtickNum === 1 || dtickNum === 2)) + )) { + containerOut.dtick = dtickDflt; + } + } + + // tick0 can have different valType for different axis types, so + // validate that now. Also for dates, change milliseconds to date strings + var tick0Dflt = (axType === 'date') ? '2000-01-01' : 0; + var tick0 = coerce('tick0', tick0Dflt); + if(axType === 'date') { + containerOut.tick0 = Lib.cleanDate(tick0, tick0Dflt); + } + // Aside from date axes, dtick must be numeric; D1 and D2 modes ignore tick0 entirely + else if(isNumeric(tick0) && dtick !== 'D1' && dtick !== 'D2') { + containerOut.tick0 = Number(tick0); + } + else { + containerOut.tick0 = tick0Dflt; + } } else { var tickvals = coerce('tickvals'); @@ -114259,7 +114452,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"fast-isnumeric":104}],681:[function(require,module,exports){ +},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],682:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -114571,7 +114764,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../lib":632,"../../plotly":658,"../../registry":738,"./axes":662,"d3":95}],682:[function(require,module,exports){ +},{"../../lib":633,"../../plotly":659,"../../registry":739,"./axes":664,"d3":95}],683:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -114983,7 +115176,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":632,"../plotly":658}],683:[function(require,module,exports){ +},{"../lib":633,"../plotly":659}],684:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115025,7 +115218,7 @@ module.exports = { } }; -},{}],684:[function(require,module,exports){ +},{}],685:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115082,7 +115275,7 @@ module.exports = { } }; -},{}],685:[function(require,module,exports){ +},{}],686:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115240,7 +115433,7 @@ params.layerNameToAdjective = { // base layers drawn over choropleth params.baseLayersOverChoropleth = ['rivers', 'lakes']; -},{}],686:[function(require,module,exports){ +},{}],687:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115269,7 +115462,7 @@ var constants = require('./constants'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); var topojsonUtils = require('../../lib/topojson_utils'); -var topojsonFeature = require('topojson').feature; +var topojsonFeature = require('topojson-client').feature; // add a few projection types to d3.geo addProjectionsToD3(d3); @@ -115802,7 +115995,7 @@ function createMockAxis(fullLayout) { return mockAxis; } -},{"../../components/color":533,"../../components/drawing":557,"../../constants/xmlns_namespaces":618,"../../lib/topojson_utils":647,"../../plots/cartesian/axes":662,"../../plots/cartesian/graph_interact":670,"./constants":685,"./projections":693,"./set_scale":694,"./zoom":695,"./zoom_reset":696,"d3":95,"topojson":491}],687:[function(require,module,exports){ +},{"../../components/color":533,"../../components/drawing":556,"../../constants/xmlns_namespaces":618,"../../lib/topojson_utils":648,"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"./constants":686,"./projections":694,"./set_scale":695,"./zoom":696,"./zoom_reset":697,"d3":95,"topojson-client":491}],688:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115921,7 +116114,7 @@ function getSubplotCalcData(calcData, id) { return subplotCalcData; } -},{"../../plots/plots":723,"./geo":686,"./layout/attributes":688,"./layout/defaults":691,"./layout/layout_attributes":692}],688:[function(require,module,exports){ +},{"../../plots/plots":724,"./geo":687,"./layout/attributes":689,"./layout/defaults":692,"./layout/layout_attributes":693}],689:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115949,7 +116142,7 @@ module.exports = { } }; -},{}],689:[function(require,module,exports){ +},{}],690:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116012,7 +116205,7 @@ module.exports = { } }; -},{"../../../components/color/attributes":532}],690:[function(require,module,exports){ +},{"../../../components/color/attributes":532}],691:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116086,7 +116279,7 @@ module.exports = function supplyGeoAxisLayoutDefaults(geoLayoutIn, geoLayoutOut) } }; -},{"../../../lib":632,"../constants":685,"./axis_attributes":689}],691:[function(require,module,exports){ +},{"../../../lib":633,"../constants":686,"./axis_attributes":690}],692:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116205,7 +116398,7 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce) { ]; } -},{"../../subplot_defaults":730,"../constants":685,"./axis_defaults":690,"./layout_attributes":692}],692:[function(require,module,exports){ +},{"../../subplot_defaults":731,"../constants":686,"./axis_defaults":691,"./layout_attributes":693}],693:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116464,7 +116657,7 @@ module.exports = { lataxis: geoAxesAttrs }; -},{"../../../components/color/attributes":532,"../constants":685,"./axis_attributes":689}],693:[function(require,module,exports){ +},{"../../../components/color/attributes":532,"../constants":686,"./axis_attributes":690}],694:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116910,7 +117103,7 @@ function addProjectionsToD3(d3) { module.exports = addProjectionsToD3; -},{}],694:[function(require,module,exports){ +},{}],695:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117040,7 +117233,7 @@ function makeRangeBox(lon0, lat0, lon1, lat1) { return { type: 'Polygon', coordinates: [ - [ [lon0, lat0], + [ [lon0, lat0], [lon0, lat1], [lon0 + dlon4, lat1], [lon0 + 2 * dlon4, lat1], @@ -117061,7 +117254,7 @@ function getBounds(projection, rangeBox) { return d3.geo.path().projection(projection).bounds(rangeBox); } -},{"./constants":685,"d3":95}],695:[function(require,module,exports){ +},{"./constants":686,"d3":95}],696:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117488,7 +117681,7 @@ function d3_eventDispatch(target) { return dispatch; } -},{"d3":95}],696:[function(require,module,exports){ +},{"d3":95}],697:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117523,7 +117716,7 @@ function createGeoZoomReset(geo, geoLayout) { module.exports = createGeoZoomReset; -},{"../cartesian/graph_interact":670}],697:[function(require,module,exports){ +},{"../cartesian/graph_interact":671}],698:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117564,8 +117757,7 @@ function createCamera(scene) { } result.mouseListener = mouseChange(element, function(buttons, x, y) { - var xrange = scene.xaxis.range, - yrange = scene.yaxis.range, + var dataBox = scene.calcDataBox(), viewBox = plot.viewBox; var lastX = result.lastPos[0], @@ -117577,14 +117769,15 @@ function createCamera(scene) { // mouseChange gives y about top; convert to about bottom y = (viewBox[3] - viewBox[1]) - y; - function updateRange(range, start, end) { + function updateRange(i0, start, end) { var range0 = Math.min(start, end), range1 = Math.max(start, end); if(range0 !== range1) { - range[0] = range0; - range[1] = range1; - result.dataBox = range; + dataBox[i0] = range0; + dataBox[i0 + 2] = range1; + result.dataBox = dataBox; + scene.setRanges(dataBox); } else { scene.selectBox.selectBox = [0, 0, 1, 1]; @@ -117596,11 +117789,11 @@ function createCamera(scene) { case 'zoom': if(buttons) { var dataX = x / - (viewBox[2] - viewBox[0]) * (xrange[1] - xrange[0]) + - xrange[0]; + (viewBox[2] - viewBox[0]) * (dataBox[2] - dataBox[0]) + + dataBox[0]; var dataY = y / - (viewBox[3] - viewBox[1]) * (yrange[1] - yrange[0]) + - yrange[0]; + (viewBox[3] - viewBox[1]) * (dataBox[3] - dataBox[1]) + + dataBox[1]; if(!result.boxEnabled) { result.boxStart[0] = dataX; @@ -117613,8 +117806,8 @@ function createCamera(scene) { result.boxEnabled = true; } else if(result.boxEnabled) { - updateRange(xrange, result.boxStart[0], result.boxEnd[0]); - updateRange(yrange, result.boxStart[1], result.boxEnd[1]); + updateRange(0, result.boxStart[0], result.boxEnd[0]); + updateRange(1, result.boxStart[1], result.boxEnd[1]); unSetAutoRange(); result.boxEnabled = false; } @@ -117624,15 +117817,17 @@ function createCamera(scene) { result.boxEnabled = false; if(buttons) { - var dx = (lastX - x) * (xrange[1] - xrange[0]) / + var dx = (lastX - x) * (dataBox[2] - dataBox[0]) / (plot.viewBox[2] - plot.viewBox[0]); - var dy = (lastY - y) * (yrange[1] - yrange[0]) / + var dy = (lastY - y) * (dataBox[3] - dataBox[1]) / (plot.viewBox[3] - plot.viewBox[1]); - xrange[0] += dx; - xrange[1] += dx; - yrange[0] += dy; - yrange[1] += dy; + dataBox[0] += dx; + dataBox[2] += dx; + dataBox[1] += dy; + dataBox[3] += dy; + + scene.setRanges(dataBox); result.lastInputTime = Date.now(); unSetAutoRange(); @@ -117646,8 +117841,7 @@ function createCamera(scene) { }); result.wheelListener = mouseWheel(element, function(dx, dy) { - var xrange = scene.xaxis.range, - yrange = scene.yaxis.range, + var dataBox = scene.calcDataBox(), viewBox = plot.viewBox; var lastX = result.lastPos[0], @@ -117661,16 +117855,18 @@ function createCamera(scene) { var scale = Math.exp(0.1 * dy / (viewBox[3] - viewBox[1])); var cx = lastX / - (viewBox[2] - viewBox[0]) * (xrange[1] - xrange[0]) + - xrange[0]; + (viewBox[2] - viewBox[0]) * (dataBox[2] - dataBox[0]) + + dataBox[0]; var cy = lastY / - (viewBox[3] - viewBox[1]) * (yrange[1] - yrange[0]) + - yrange[0]; + (viewBox[3] - viewBox[1]) * (dataBox[3] - dataBox[1]) + + dataBox[1]; - xrange[0] = (xrange[0] - cx) * scale + cx; - xrange[1] = (xrange[1] - cx) * scale + cx; - yrange[0] = (yrange[0] - cy) * scale + cy; - yrange[1] = (yrange[1] - cy) * scale + cy; + dataBox[0] = (dataBox[0] - cx) * scale + cx; + dataBox[2] = (dataBox[2] - cx) * scale + cx; + dataBox[1] = (dataBox[1] - cy) * scale + cy; + dataBox[3] = (dataBox[3] - cy) * scale + cy; + + scene.setRanges(dataBox); result.lastInputTime = Date.now(); unSetAutoRange(); @@ -117684,7 +117880,7 @@ function createCamera(scene) { return result; } -},{"mouse-change":413,"mouse-wheel":415}],698:[function(require,module,exports){ +},{"mouse-change":413,"mouse-wheel":415}],699:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117930,7 +118126,7 @@ function createAxes2D(scene) { module.exports = createAxes2D; -},{"../../lib/html2unicode":631,"../../lib/str2rgbarray":645,"../cartesian/axes":662,"../plots":723}],699:[function(require,module,exports){ +},{"../../lib/html2unicode":632,"../../lib/str2rgbarray":646,"../cartesian/axes":664,"../plots":724}],700:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118042,7 +118238,7 @@ exports.toSVG = function(gd) { } }; -},{"../../constants/xmlns_namespaces":618,"../cartesian/attributes":661,"../plots":723,"./scene2d":700}],700:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":618,"../cartesian/attributes":663,"../plots":724,"./scene2d":701}],701:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118355,14 +118551,9 @@ var relayoutCallback = function(scene) { }; proto.cameraChanged = function() { - var camera = this.camera, - xrange = this.xaxis.range, - yrange = this.yaxis.range; + var camera = this.camera; - this.glplot.setDataBox([ - xrange[0], yrange[0], - xrange[1], yrange[1] - ]); + this.glplot.setDataBox(this.calcDataBox()); var nextTicks = this.computeTickMarks(); var curTicks = this.glplotOptions.ticks; @@ -118460,9 +118651,7 @@ proto.plot = function(fullData, calcData, fullLayout) { options.ticks = this.computeTickMarks(); - var xrange = this.xaxis.range; - var yrange = this.yaxis.range; - options.dataBox = [xrange[0], yrange[0], xrange[1], yrange[1]]; + options.dataBox = this.calcDataBox(); options.merge(fullLayout); glplot.update(options); @@ -118471,6 +118660,27 @@ proto.plot = function(fullData, calcData, fullLayout) { this.glplot.draw(); }; +proto.calcDataBox = function() { + var xaxis = this.xaxis, + yaxis = this.yaxis, + xrange = xaxis.range, + yrange = yaxis.range, + xr2l = xaxis.r2l, + yr2l = yaxis.r2l; + + return [xr2l(xrange[0]), yr2l(yrange[0]), xr2l(xrange[1]), yr2l(yrange[1])]; +}; + +proto.setRanges = function(dataBox) { + var xaxis = this.xaxis, + yaxis = this.yaxis, + xl2r = xaxis.l2r, + yl2r = yaxis.l2r; + + xaxis.range = [xl2r(dataBox[0]), xl2r(dataBox[2])]; + yaxis.range = [yl2r(dataBox[1]), yl2r(dataBox[3])]; +}; + proto.updateTraces = function(fullData, calcData) { var traceIds = Object.keys(this.traces); var i, j, fullTrace; @@ -118649,7 +118859,7 @@ proto.hoverFormatter = function(axisName, val) { return Axes.tickText(axis, axis.c2l(val), 'hover').text; }; -},{"../../lib/html2unicode":631,"../../lib/show_no_webgl_msg":643,"../../plots/cartesian/axes":662,"../../plots/cartesian/graph_interact":670,"./camera":697,"./convert":698,"gl-plot2d":187,"gl-select-box":218,"gl-spikes2d":227,"webgl-context":518}],701:[function(require,module,exports){ +},{"../../lib/html2unicode":632,"../../lib/show_no_webgl_msg":644,"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"./camera":698,"./convert":699,"gl-plot2d":187,"gl-select-box":218,"gl-spikes2d":227,"webgl-context":518}],702:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118892,7 +119102,7 @@ function createCamera(element, options) { return camera; } -},{"3d-view":27,"mouse-change":413,"mouse-wheel":415,"right-now":459}],702:[function(require,module,exports){ +},{"3d-view":27,"mouse-change":413,"mouse-wheel":415,"right-now":459}],703:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119026,7 +119236,7 @@ function initAxes(gd, sceneLayout) { } } -},{"../../constants/xmlns_namespaces":618,"../plots":723,"./layout/attributes":703,"./layout/defaults":707,"./layout/layout_attributes":708,"./scene":712,"./set_convert":713}],703:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":618,"../plots":724,"./layout/attributes":704,"./layout/defaults":708,"./layout/layout_attributes":709,"./scene":713,"./set_convert":714}],704:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119054,7 +119264,7 @@ module.exports = { } }; -},{}],704:[function(require,module,exports){ +},{}],705:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119171,7 +119381,7 @@ module.exports = { zerolinewidth: axesAttrs.zerolinewidth }; -},{"../../../components/color":533,"../../../lib/extend":625,"../../cartesian/layout_attributes":672}],705:[function(require,module,exports){ +},{"../../../components/color":533,"../../../lib/extend":626,"../../cartesian/layout_attributes":673}],706:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119239,7 +119449,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { } }; -},{"../../../lib":632,"../../cartesian/axis_defaults":664,"./axis_attributes":704,"tinycolor2":489}],706:[function(require,module,exports){ +},{"../../../lib":633,"../../cartesian/axis_defaults":666,"./axis_attributes":705,"tinycolor2":489}],707:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119394,7 +119604,7 @@ function createAxesOptions(plotlyOptions) { module.exports = createAxesOptions; -},{"../../../lib/html2unicode":631,"../../../lib/str2rgbarray":645,"arraytools":33}],707:[function(require,module,exports){ +},{"../../../lib/html2unicode":632,"../../../lib/str2rgbarray":646,"arraytools":33}],708:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119501,7 +119711,7 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { coerce('hovermode', opts.getDfltFromLayout('hovermode')); } -},{"../../../components/color":533,"../../subplot_defaults":730,"./axis_defaults":705,"./layout_attributes":708}],708:[function(require,module,exports){ +},{"../../../components/color":533,"../../subplot_defaults":731,"./axis_defaults":706,"./layout_attributes":709}],709:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119671,7 +119881,7 @@ module.exports = { } }; -},{"../../../lib/extend":625,"./axis_attributes":704}],709:[function(require,module,exports){ +},{"../../../lib/extend":626,"./axis_attributes":705}],710:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119717,7 +119927,7 @@ function createSpikeOptions(layout) { module.exports = createSpikeOptions; -},{"../../../lib/str2rgbarray":645}],710:[function(require,module,exports){ +},{"../../../lib/str2rgbarray":646}],711:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119813,7 +120023,7 @@ function computeTickMarks(scene) { scene.contourLevels = contourLevelsFromTicks(ticks); } -},{"../../../lib":632,"../../../lib/html2unicode":631,"../../cartesian/axes":662}],711:[function(require,module,exports){ +},{"../../../lib":633,"../../../lib/html2unicode":632,"../../cartesian/axes":664}],712:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119847,7 +120057,7 @@ function project(camera, v) { module.exports = project; -},{}],712:[function(require,module,exports){ +},{}],713:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120576,7 +120786,7 @@ proto.toImage = function(format) { module.exports = Scene; -},{"../../lib":632,"../../lib/show_no_webgl_msg":643,"../../lib/str2rgbarray":645,"../../plots/cartesian/axes":662,"../../plots/cartesian/graph_interact":670,"./camera":701,"./layout/convert":706,"./layout/spikes":709,"./layout/tick_marks":710,"./project":711,"./set_convert":713,"gl-plot3d":189,"webgl-context":518}],713:[function(require,module,exports){ +},{"../../lib":633,"../../lib/show_no_webgl_msg":644,"../../lib/str2rgbarray":646,"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"./camera":702,"./layout/convert":707,"./layout/spikes":710,"./layout/tick_marks":711,"./project":712,"./set_convert":714,"gl-plot3d":189,"webgl-context":518}],714:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120597,7 +120807,7 @@ module.exports = function setConvert(containerOut) { containerOut.setScale = Lib.noop; }; -},{"../../lib":632,"../cartesian/axes":662}],714:[function(require,module,exports){ +},{"../../lib":633,"../cartesian/axes":664}],715:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120771,28 +120981,27 @@ module.exports = { description: 'Determines whether or not a legend is drawn.' }, - _composedModules: { - '*': 'Fx' + dragmode: { + valType: 'enumerated', + role: 'info', + values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], + dflt: 'zoom', + description: [ + 'Determines the mode of drag interactions.', + '*select* and *lasso* apply only to scatter traces with', + 'markers or text. *orbit* and *turntable* apply only to', + '3D scenes.' + ].join(' ') }, - - _nestedModules: { - 'xaxis': 'Axes', - 'yaxis': 'Axes', - 'scene': 'gl3d', - 'geo': 'geo', - 'ternary': 'ternary', - 'mapbox': 'mapbox', - - 'legend': 'legend', - 'annotations': 'annotations', - 'shapes': 'shapes', - 'images': 'images', - 'updatemenus': 'updatemenus', - 'sliders': 'sliders' + hovermode: { + valType: 'enumerated', + role: 'info', + values: ['x', 'y', 'closest', false], + description: 'Determines the mode of hover interactions.' } }; -},{"../components/color/attributes":532,"../lib":632,"./font_attributes":683}],715:[function(require,module,exports){ +},{"../components/color/attributes":532,"../lib":633,"./font_attributes":684}],716:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120822,7 +121031,7 @@ module.exports = { mapOnErrorMsg: 'Mapbox error.' }; -},{}],716:[function(require,module,exports){ +},{}],717:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120896,7 +121105,7 @@ module.exports = function convertTextOpts(textposition, iconSize) { return { anchor: anchor, offset: offset }; }; -},{"../../lib":632}],717:[function(require,module,exports){ +},{"../../lib":633}],718:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121057,7 +121266,7 @@ function findAccessToken(gd, mapboxIds) { return accessToken; } -},{"../../constants/xmlns_namespaces":618,"../plots":723,"./constants":715,"./layout_attributes":719,"./layout_defaults":720,"./mapbox":721,"mapbox-gl":304}],718:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":618,"../plots":724,"./constants":716,"./layout_attributes":720,"./layout_defaults":721,"./mapbox":722,"mapbox-gl":304}],719:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121282,7 +121491,7 @@ module.exports = function createMapboxLayer(mapbox, index, opts) { return mapboxLayer; }; -},{"../../lib":632,"./convert_text_opts":716}],719:[function(require,module,exports){ +},{"../../lib":633,"./convert_text_opts":717}],720:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121390,7 +121599,7 @@ module.exports = { }, layers: { - _isLinkedToArray: true, + _isLinkedToArray: 'layer', sourcetype: { valType: 'enumerated', @@ -121549,7 +121758,7 @@ module.exports = { }; -},{"../../components/color":533,"../../lib":632,"../../traces/scatter/attributes":844,"../font_attributes":683}],720:[function(require,module,exports){ +},{"../../components/color":533,"../../lib":633,"../../traces/scatter/attributes":846,"../font_attributes":684}],721:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121645,7 +121854,7 @@ function handleLayerDefaults(containerIn, containerOut) { } } -},{"../../lib":632,"../subplot_defaults":730,"./layout_attributes":719}],721:[function(require,module,exports){ +},{"../../lib":633,"../subplot_defaults":731,"./layout_attributes":720}],722:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122101,7 +122310,7 @@ function convertCenter(center) { return [center.lon, center.lat]; } -},{"../../lib":632,"../cartesian/graph_interact":670,"./constants":715,"./layers":718,"./layout_attributes":719,"mapbox-gl":304}],722:[function(require,module,exports){ +},{"../../lib":633,"../cartesian/graph_interact":671,"./constants":716,"./layers":719,"./layout_attributes":720,"mapbox-gl":304}],723:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122139,7 +122348,7 @@ module.exports = { } }; -},{}],723:[function(require,module,exports){ +},{}],724:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -122506,6 +122715,9 @@ plots.sendDataToCloud = function(gd) { // gd._fullLayout._basePlotModules // is a list of all the plot modules required to draw the plot. // +// gd._fullLayout._transformModules +// is a list of all the transform modules invoked. +// plots.supplyDefaults = function(gd) { var oldFullLayout = gd._fullLayout || {}, newFullLayout = gd._fullLayout = {}, @@ -122517,6 +122729,9 @@ plots.supplyDefaults = function(gd) { var i; + // Create all the storage space for frames, but only if doesn't already exist + if(!gd._transitionData) plots.createTransitionData(gd); + // first fill in what we can of layout without looking at data // because fullData needs a few things from layout @@ -122577,7 +122792,7 @@ plots.supplyDefaults = function(gd) { } // finally, fill in the pieces of layout that may need to look at data - plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData); + plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData); // TODO remove in v2.0.0 // add has-plot-type refs to fullLayout for backward compatibility @@ -122616,12 +122831,6 @@ plots.supplyDefaults = function(gd) { (gd.calcdata[i][0] || {}).trace = trace; } } - - // Create all the storage space for frames, but only if doesn't already - // exist: - if(!gd._transitionData) { - plots.createTransitionData(gd); - } }; // Create storage for all of the data related to frames and transitions: @@ -122788,6 +122997,8 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) { basePlotModules = fullLayout._basePlotModules = [], cnt = 0; + fullLayout._transformModules = []; + function pushModule(fullTrace) { dataOut.push(fullTrace); @@ -123005,6 +123216,8 @@ function supplyTransformDefaults(traceIn, traceOut, layout) { transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn); transformOut.type = type; transformOut._module = _module; + + Lib.pushUnique(layout._transformModules, _module); } else { transformOut = Lib.extendFlat({}, transformIn); @@ -123174,7 +123387,7 @@ function calculateReservedMargins(margins) { return resultingMargin; } -plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { +plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, transitionData) { var i, _module; // can't be be part of basePlotModules loop @@ -123205,6 +123418,16 @@ plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { } } + // transform module layout defaults + var transformModules = layoutOut._transformModules; + for(i = 0; i < transformModules.length; i++) { + _module = transformModules[i]; + + if(_module.supplyLayoutDefaults) { + _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData, transitionData); + } + } + // should FX be a component? Plotly.Fx.supplyLayoutDefaults(layoutIn, layoutOut, fullData); @@ -123232,8 +123455,16 @@ plots.purge = function(gd) { // remove modebar if(fullLayout._modeBar) fullLayout._modeBar.destroy(); - if(gd._transitionData && gd._transitionData._animationRaf) { - window.cancelAnimationFrame(gd._transitionData._animationRaf); + if(gd._transitionData) { + // Ensure any dangling callbacks are simply dropped if the plot is purged. + // This is more or less only actually important for testing. + if(gd._transitionData._interruptCallbacks) { + gd._transitionData._interruptCallbacks.length = 0; + } + + if(gd._transitionData._animationRaf) { + window.cancelAnimationFrame(gd._transitionData._animationRaf); + } } // data and layout @@ -123510,9 +123741,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { // convert native dates to date strings... // mostly for external users exporting to plotly - if(d && d.getTime) { - return Lib.ms2DateTime(d); - } + if(Lib.isJSDate(d)) return Lib.ms2DateTime(+d); return d; } @@ -123557,7 +123786,7 @@ plots.modifyFrames = function(gd, operations) { break;*/ case 'replace': frame = op.value; - var oldName = _frames[op.index].name; + var oldName = (_frames[op.index] || {}).name; var newName = frame.name; _frames[op.index] = _hash[newName] = frame; @@ -123691,8 +123920,14 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { for(i = 0; i < containerPaths.length; i++) { containerProp = Lib.nestedProperty(expandedObj, containerPaths[i]); containerVal = containerProp.get(); - containerProp.set(null); - Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + + if(containerVal === undefined) { + Lib.nestedProperty(containerObj, containerPaths[i]).set(null); + } + else { + containerProp.set(null); + Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + } } } @@ -123706,15 +123941,20 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { if(!srcContainer) continue; destProp = Lib.nestedProperty(dest, containerPaths[i]); - destContainer = destProp.get(); + if(!Array.isArray(destContainer)) { destContainer = []; destProp.set(destContainer); } for(j = 0; j < srcContainer.length; j++) { - destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcContainer[j]); + var srcObj = srcContainer[j]; + + if(srcObj === null) destContainer[j] = null; + else { + destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcObj); + } } destProp.set(destContainer); @@ -123725,7 +123965,7 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { }; plots.dataArrayContainers = ['transforms']; -plots.layoutArrayContainers = ['annotations', 'shapes', 'images', 'sliders', 'updatemenus']; +plots.layoutArrayContainers = Registry.layoutArrayContainers; /* * Extend a trace definition. This method: @@ -123784,11 +124024,15 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var trace = gd._fullData[traceIdx]; var module = trace._module; - if(!module || !module.animatable) { - continue; - } + // There's nothing to do if this module is not defined: + if(!module) continue; - transitionedTraces.push(traceIdx); + // Don't register the trace as transitioned if it doens't know what to do. + // If it *is* registered, it will receive a callback that it's responsible + // for calling in order to register the transition as having completed. + if(module.animatable) { + transitionedTraces.push(traceIdx); + } gd.data[traceIndices[i]] = plots.extendTrace(gd.data[traceIndices[i]], data[i]); } @@ -123842,6 +124086,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var aborted = false; function executeTransitions() { + + gd.emit('plotly_transitioning', []); + return new Promise(function(resolve) { // This flag is used to disabled things like autorange: gd._transitioning = true; @@ -123926,6 +124173,11 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function completeTransition(callback) { + // This a simple workaround for tests which purge the graph before animations + // have completed. That's not a very common case, so this is the simplest + // fix. + if(!gd._transitionData) return; + flushCallbacks(gd._transitionData._interruptCallbacks); return Promise.resolve().then(function() { @@ -123943,6 +124195,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function interruptPreviousTransitions() { + // Fail-safe against purged plot: + if(!gd._transitionData) return; + // If a transition is interrupted, set this to false. At the moment, the only thing that would // interrupt a transition is another transition, so that it will momentarily be set to true // again, but this determines whether autorange or dragbox work, so it's for the sake of @@ -123970,13 +124225,13 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var seq = [plots.previousPromises, interruptPreviousTransitions, prepareTransitions, executeTransitions]; - var transitionStarting = Lib.syncOrAsync(seq, gd); - if(!transitionStarting || !transitionStarting.then) transitionStarting = Promise.resolve(); + if(!transitionStarting || !transitionStarting.then) { + transitionStarting = Promise.resolve(); + } return transitionStarting.then(function() { - gd.emit('plotly_transitioning', []); return gd; }); }; @@ -124079,7 +124334,7 @@ plots.doCalcdata = function(gd, traces) { } }; -},{"../components/color":533,"../components/errorbars":563,"../lib":632,"../plotly":658,"../registry":738,"./animation_attributes":659,"./attributes":660,"./command":682,"./font_attributes":683,"./frame_attributes":684,"./layout_attributes":714,"d3":95,"fast-isnumeric":104}],724:[function(require,module,exports){ +},{"../components/color":533,"../components/errorbars":562,"../lib":633,"../plotly":659,"../registry":739,"./animation_attributes":660,"./attributes":662,"./command":683,"./font_attributes":684,"./frame_attributes":685,"./layout_attributes":715,"d3":95,"fast-isnumeric":104}],725:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124104,7 +124359,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":844}],725:[function(require,module,exports){ +},{"../../traces/scatter/attributes":846}],726:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124254,7 +124509,7 @@ module.exports = { } }; -},{"../../lib/extend":625,"../cartesian/layout_attributes":672}],726:[function(require,module,exports){ +},{"../../lib/extend":626,"../cartesian/layout_attributes":673}],727:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124269,7 +124524,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":727,"./micropolar_manager":728}],727:[function(require,module,exports){ +},{"./micropolar":728,"./micropolar_manager":729}],728:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125688,7 +125943,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":632,"d3":95}],728:[function(require,module,exports){ +},{"../../lib":633,"d3":95}],729:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125774,7 +126029,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":533,"../../lib":632,"./micropolar":727,"./undo_manager":729,"d3":95}],729:[function(require,module,exports){ +},{"../../components/color":533,"../../lib":633,"./micropolar":728,"./undo_manager":730,"d3":95}],730:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125840,7 +126095,7 @@ module.exports = function UndoManager() { }; }; -},{}],730:[function(require,module,exports){ +},{}],731:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125915,7 +126170,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":632,"./plots":723}],731:[function(require,module,exports){ +},{"../lib":633,"./plots":724}],732:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125989,7 +126244,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/plots":723,"./layout/attributes":732,"./layout/defaults":735,"./layout/layout_attributes":736,"./ternary":737}],732:[function(require,module,exports){ +},{"../../plots/plots":724,"./layout/attributes":733,"./layout/defaults":736,"./layout/layout_attributes":737,"./ternary":738}],733:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126015,7 +126270,7 @@ module.exports = { } }; -},{}],733:[function(require,module,exports){ +},{}],734:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126080,7 +126335,7 @@ module.exports = { } }; -},{"../../../lib/extend":625,"../../cartesian/layout_attributes":672}],734:[function(require,module,exports){ +},{"../../../lib/extend":626,"../../cartesian/layout_attributes":673}],735:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126164,7 +126419,7 @@ module.exports = function supplyLayoutDefaults(containerIn, containerOut, option } }; -},{"../../../lib":632,"../../cartesian/tick_label_defaults":678,"../../cartesian/tick_mark_defaults":679,"../../cartesian/tick_value_defaults":680,"./axis_attributes":733,"tinycolor2":489}],735:[function(require,module,exports){ +},{"../../../lib":633,"../../cartesian/tick_label_defaults":679,"../../cartesian/tick_mark_defaults":680,"../../cartesian/tick_value_defaults":681,"./axis_attributes":734,"tinycolor2":489}],736:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126227,7 +126482,7 @@ function handleTernaryDefaults(ternaryLayoutIn, ternaryLayoutOut, coerce, option } } -},{"../../../components/color":533,"../../subplot_defaults":730,"./axis_defaults":734,"./layout_attributes":736}],736:[function(require,module,exports){ +},{"../../../components/color":533,"../../subplot_defaults":731,"./axis_defaults":735,"./layout_attributes":737}],737:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126292,7 +126547,7 @@ module.exports = { caxis: ternaryAxesAttrs }; -},{"../../../components/color/attributes":532,"./axis_attributes":733}],737:[function(require,module,exports){ +},{"../../../components/color/attributes":532,"./axis_attributes":734}],738:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126314,7 +126569,6 @@ var Drawing = require('../../components/drawing'); var setConvert = require('../cartesian/set_convert'); var extendFlat = require('../../lib/extend').extendFlat; var Axes = require('../cartesian/axes'); -var filterVisible = require('../../lib/filter_visible'); var dragElement = require('../../components/dragelement'); var Titles = require('../../components/titles'); var prepSelect = require('../cartesian/select'); @@ -126389,7 +126643,7 @@ proto.plot = function(ternaryData, fullLayout) { var moduleData = traceHash[moduleNames[i]]; var _module = moduleData[0]._module; - _module.plot(_this, filterVisible(moduleData), ternaryLayout); + _module.plot(_this, Lib.filterVisible(moduleData), ternaryLayout); } _this.traceHash = traceHash; @@ -126982,7 +127236,7 @@ function removeZoombox(gd) { .remove(); } -},{"../../components/color":533,"../../components/dragelement":555,"../../components/drawing":557,"../../components/titles":608,"../../lib":632,"../../lib/extend":625,"../../lib/filter_visible":627,"../../plotly":658,"../cartesian/axes":662,"../cartesian/constants":668,"../cartesian/graph_interact":670,"../cartesian/select":676,"../cartesian/set_convert":677,"d3":95,"tinycolor2":489}],738:[function(require,module,exports){ +},{"../../components/color":533,"../../components/dragelement":554,"../../components/drawing":556,"../../components/titles":607,"../../lib":633,"../../lib/extend":626,"../../plotly":659,"../cartesian/axes":664,"../cartesian/constants":669,"../cartesian/graph_interact":671,"../cartesian/select":677,"../cartesian/set_convert":678,"d3":95,"tinycolor2":489}],739:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126998,11 +127252,12 @@ var Lib = require('./lib'); var basePlotAttributes = require('./plots/attributes'); exports.modules = {}; -exports.allTypes = []; exports.allCategories = {}; +exports.allTypes = []; exports.subplotsRegistry = {}; exports.transformsRegistry = {}; exports.componentsRegistry = {}; +exports.layoutArrayContainers = []; /** * register a module as the handler for a trace type @@ -127068,6 +127323,16 @@ exports.registerSubplot = function(_module) { exports.subplotsRegistry[plotType] = _module; }; +exports.registerComponent = function(_module) { + var name = _module.name; + + exports.componentsRegistry[name] = _module; + + if(_module.layoutAttributes && _module.layoutAttributes._isLinkedToArray) { + Lib.pushUnique(exports.layoutArrayContainers, name); + } +}; + /** * Get registered module using trace object or trace type * @@ -127139,7 +127404,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib":632,"./plots/attributes":660}],739:[function(require,module,exports){ +},{"./lib":633,"./plots/attributes":662}],740:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127266,11 +127531,12 @@ module.exports = function clonePlot(graphObj, options) { } } - var td = document.createElement('div'); - if(options.tileClass) td.className = options.tileClass; + var gd = document.createElement('div'); + if(options.tileClass) gd.className = options.tileClass; var plotTile = { - td: td, + gd: gd, + td: gd, // for external (image server) compatibility layout: newLayout, data: newData, config: { @@ -127290,13 +127556,13 @@ module.exports = function clonePlot(graphObj, options) { plotTile.config.setBackground = options.setBackground || 'opaque'; } - // attaching the default Layout the td, so you can grab it later - plotTile.td.defaultLayout = cloneLayoutOverride(options.tileClass); + // attaching the default Layout the gd, so you can grab it later + plotTile.gd.defaultLayout = cloneLayoutOverride(options.tileClass); return plotTile; }; -},{"../lib":632,"../plots/plots":723}],740:[function(require,module,exports){ +},{"../lib":633,"../plots/plots":724}],741:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127362,7 +127628,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":632,"../plot_api/to_image":656,"./filesaver":741}],741:[function(require,module,exports){ +},{"../lib":633,"../plot_api/to_image":657,"./filesaver":742}],742:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127430,7 +127696,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],742:[function(require,module,exports){ +},{}],743:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127463,7 +127729,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],743:[function(require,module,exports){ +},{}],744:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127489,7 +127755,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":739,"./download":740,"./helpers":742,"./svgtoimg":744,"./toimage":745,"./tosvg":746}],744:[function(require,module,exports){ +},{"./cloneplot":740,"./download":741,"./helpers":743,"./svgtoimg":745,"./toimage":746,"./tosvg":747}],745:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127620,7 +127886,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":632,"events":102}],745:[function(require,module,exports){ +},{"../lib":633,"events":102}],746:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127653,7 +127919,7 @@ function toImage(gd, opts) { var ev = new EventEmitter(); var clone = clonePlot(gd, {format: 'png'}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -127700,7 +127966,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":632,"../plotly":658,"./cloneplot":739,"./helpers":742,"./svgtoimg":744,"./tosvg":746,"events":102}],746:[function(require,module,exports){ +},{"../lib":633,"../plotly":659,"./cloneplot":740,"./helpers":743,"./svgtoimg":745,"./tosvg":747,"events":102}],747:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127819,7 +128085,7 @@ module.exports = function toSVG(gd, format) { return s; }; -},{"../components/color":533,"../components/drawing":557,"../constants/xmlns_namespaces":618,"../lib/svg_text_utils":646,"d3":95}],747:[function(require,module,exports){ +},{"../components/color":533,"../components/drawing":556,"../constants/xmlns_namespaces":618,"../lib/svg_text_utils":647,"d3":95}],748:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127851,7 +128117,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":632}],748:[function(require,module,exports){ +},{"../../lib":633}],749:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127864,6 +128130,9 @@ module.exports = function arraysToCalcdata(cd) { var scatterAttrs = require('../scatter/attributes'); var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; var scatterMarkerAttrs = scatterAttrs.marker; @@ -127877,9 +128146,11 @@ var markerLine = extendFlat({}, { }, colorAttributes('marker.line')); var marker = extendFlat({}, { - showscale: scatterMarkerAttrs.showscale, line: markerLine -}, colorAttributes('marker')); +}, colorAttributes('marker'), { + showscale: scatterMarkerAttrs.showscale, + colorbar: colorbarAttrs +}); module.exports = { @@ -127945,11 +128216,8 @@ module.exports = { r: scatterAttrs.r, t: scatterAttrs.t, - _nestedModules: { // nested module coupling - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - }, + error_y: errorBarAttrs, + error_x: errorBarAttrs, _deprecated: { bardir: { @@ -127961,7 +128229,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":541,"../../lib/extend":625,"../scatter/attributes":844}],749:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/color_attributes":540,"../../components/errorbars/attributes":558,"../../lib/extend":626,"../scatter/attributes":846}],750:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128057,7 +128325,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":540,"../../components/colorscale/has_colorscale":547,"../../plots/cartesian/axes":662,"fast-isnumeric":104}],750:[function(require,module,exports){ +},{"../../components/colorscale/calc":539,"../../components/colorscale/has_colorscale":546,"../../plots/cartesian/axes":664,"fast-isnumeric":104}],751:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128102,7 +128370,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":533,"../../components/errorbars/defaults":562,"../../lib":632,"../bar/style_defaults":759,"../scatter/xy_defaults":866,"./attributes":748}],751:[function(require,module,exports){ +},{"../../components/color":533,"../../components/errorbars/defaults":561,"../../lib":633,"../bar/style_defaults":760,"../scatter/xy_defaults":868,"./attributes":749}],752:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128172,7 +128440,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { if(trace.orientation === 'h') { pointData.x0 = pointData.x1 = xa.c2p(di.x, true); - pointData.xLabelVal = di.s; + pointData.xLabelVal = di.b + di.s; pointData.y0 = ya.c2p(barPos(di) - barDelta, true); pointData.y1 = ya.c2p(barPos(di) + barDelta, true); @@ -128180,7 +128448,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } else { pointData.y0 = pointData.y1 = ya.c2p(di.y, true); - pointData.yLabelVal = di.s; + pointData.yLabelVal = di.b + di.s; pointData.x0 = xa.c2p(barPos(di) - barDelta, true); pointData.x1 = xa.c2p(barPos(di) + barDelta, true); @@ -128194,7 +128462,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return [pointData]; }; -},{"../../components/color":533,"../../components/errorbars":563,"../../plots/cartesian/graph_interact":670}],752:[function(require,module,exports){ +},{"../../components/color":533,"../../components/errorbars":562,"../../plots/cartesian/graph_interact":671}],753:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128235,7 +128503,7 @@ Bar.meta = { module.exports = Bar; -},{"../../plots/cartesian":671,"../scatter/colorbar":847,"./arrays_to_calcdata":747,"./attributes":748,"./calc":749,"./defaults":750,"./hover":751,"./layout_attributes":753,"./layout_defaults":754,"./plot":755,"./set_positions":756,"./style":758}],753:[function(require,module,exports){ +},{"../../plots/cartesian":672,"../scatter/colorbar":849,"./arrays_to_calcdata":748,"./attributes":749,"./calc":750,"./defaults":751,"./hover":752,"./layout_attributes":754,"./layout_defaults":755,"./plot":756,"./set_positions":757,"./style":759}],754:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128300,7 +128568,7 @@ module.exports = { } }; -},{}],754:[function(require,module,exports){ +},{}],755:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128358,7 +128626,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"../../registry":738,"./layout_attributes":753}],755:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"../../registry":739,"./layout_attributes":754}],756:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128479,7 +128747,7 @@ module.exports = function plot(gd, plotinfo, cdbar) { }; -},{"../../components/color":533,"../../components/errorbars":563,"../../lib":632,"./arrays_to_calcdata":747,"d3":95,"fast-isnumeric":104}],756:[function(require,module,exports){ +},{"../../components/color":533,"../../components/errorbars":562,"../../lib":633,"./arrays_to_calcdata":748,"d3":95,"fast-isnumeric":104}],757:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128967,8 +129235,8 @@ function stackBars(gd, sa, sieve) { if(!isNumeric(bar.s)) continue; // stack current bar and get previous sum - var barBase = sieve.put(bar.p, bar.s), - barTop = barBase + bar.s; + var barBase = sieve.put(bar.p, bar.b + bar.s), + barTop = barBase + bar.b + bar.s; // store the bar base and top in each calcdata item bar.b = barBase; @@ -129006,7 +129274,7 @@ function sieveBars(gd, sa, sieve) { for(var j = 0; j < trace.length; j++) { var bar = trace[j]; - if(isNumeric(bar.s)) sieve.put(bar.p, bar.s); + if(isNumeric(bar.s)) sieve.put(bar.p, bar.b + bar.s); } } } @@ -129075,7 +129343,7 @@ function getAxisLetter(ax) { return ax._id.charAt(0); } -},{"../../plots/cartesian/axes":662,"../../registry":738,"./sieve.js":757,"fast-isnumeric":104}],757:[function(require,module,exports){ +},{"../../plots/cartesian/axes":664,"../../registry":739,"./sieve.js":758,"fast-isnumeric":104}],758:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129176,7 +129444,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../lib":632}],758:[function(require,module,exports){ +},{"../../lib":633}],759:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129220,9 +129488,8 @@ module.exports = function style(gd) { var trace = d[0].trace, marker = trace.marker, markerLine = marker.line, - markerIn = (trace._input || {}).marker || {}, - markerScale = Drawing.tryColorscale(marker, markerIn, ''), - lineScale = Drawing.tryColorscale(marker, markerIn, 'line.'); + markerScale = Drawing.tryColorscale(marker, ''), + lineScale = Drawing.tryColorscale(marker, 'line'); d3.select(this).selectAll('path').each(function(d) { // allow all marker and marker line colors to be scaled @@ -129255,7 +129522,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/color":533,"../../components/drawing":557,"../../components/errorbars":563,"d3":95}],759:[function(require,module,exports){ +},{"../../components/color":533,"../../components/drawing":556,"../../components/errorbars":562,"d3":95}],760:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129292,7 +129559,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('marker.line.width'); }; -},{"../../components/color":533,"../../components/colorscale/defaults":543,"../../components/colorscale/has_colorscale":547}],760:[function(require,module,exports){ +},{"../../components/color":533,"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546}],761:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129470,7 +129737,7 @@ module.exports = { fillcolor: scatterAttrs.fillcolor }; -},{"../../components/color/attributes":532,"../../lib/extend":625,"../scatter/attributes":844}],761:[function(require,module,exports){ +},{"../../components/color/attributes":532,"../../lib/extend":626,"../scatter/attributes":846}],762:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129619,7 +129886,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"fast-isnumeric":104}],762:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"fast-isnumeric":104}],763:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129688,7 +129955,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { } }; -},{"../../components/color":533,"../../lib":632,"./attributes":760}],763:[function(require,module,exports){ +},{"../../components/color":533,"../../lib":633,"./attributes":761}],764:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129797,7 +130064,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return closeData; }; -},{"../../components/color":533,"../../lib":632,"../../plots/cartesian/axes":662,"../../plots/cartesian/graph_interact":670}],764:[function(require,module,exports){ +},{"../../components/color":533,"../../lib":633,"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671}],765:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129843,7 +130110,7 @@ Box.meta = { module.exports = Box; -},{"../../plots/cartesian":671,"./attributes":760,"./calc":761,"./defaults":762,"./hover":763,"./layout_attributes":765,"./layout_defaults":766,"./plot":767,"./set_positions":768,"./style":769}],765:[function(require,module,exports){ +},{"../../plots/cartesian":672,"./attributes":761,"./calc":762,"./defaults":763,"./hover":764,"./layout_attributes":766,"./layout_defaults":767,"./plot":768,"./set_positions":769,"./style":770}],766:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129894,7 +130161,7 @@ module.exports = { } }; -},{}],766:[function(require,module,exports){ +},{}],767:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129928,7 +130195,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { coerce('boxgroupgap'); }; -},{"../../lib":632,"../../registry":738,"./layout_attributes":765}],767:[function(require,module,exports){ +},{"../../lib":633,"../../registry":739,"./layout_attributes":766}],768:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130168,7 +130435,7 @@ module.exports = function plot(gd, plotinfo, cdbox) { }); }; -},{"../../components/drawing":557,"../../lib":632,"d3":95}],768:[function(require,module,exports){ +},{"../../components/drawing":556,"../../lib":633,"d3":95}],769:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130262,7 +130529,7 @@ module.exports = function setPositions(gd, plotinfo) { } }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"../../registry":738}],769:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"../../registry":739}],770:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130301,7 +130568,7 @@ module.exports = function style(gd) { }); }; -},{"../../components/color":533,"../../components/drawing":557,"d3":95}],770:[function(require,module,exports){ +},{"../../components/color":533,"../../components/drawing":556,"d3":95}],771:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130359,7 +130626,7 @@ module.exports = { whiskerwidth: Lib.extendFlat({}, boxAttrs.whiskerwidth, { dflt: 0 }) }; -},{"../../lib":632,"../box/attributes":760,"../ohlc/attributes":821}],771:[function(require,module,exports){ +},{"../../lib":633,"../box/attributes":761,"../ohlc/attributes":823}],772:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130407,7 +130674,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.fillcolor'); } -},{"../../lib":632,"../ohlc/direction_defaults":823,"../ohlc/helpers":824,"../ohlc/ohlc_defaults":826,"./attributes":770}],772:[function(require,module,exports){ +},{"../../lib":633,"../ohlc/direction_defaults":825,"../ohlc/helpers":826,"../ohlc/ohlc_defaults":828,"./attributes":771}],773:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130449,7 +130716,7 @@ module.exports = { register(require('../box')); register(require('./transform')); -},{"../../plot_api/register":653,"../../plots/cartesian":671,"../box":764,"./attributes":770,"./defaults":771,"./transform":773}],773:[function(require,module,exports){ +},{"../../plot_api/register":654,"../../plots/cartesian":672,"../box":765,"./attributes":771,"./defaults":772,"./transform":774}],774:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130576,7 +130843,7 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { trace.y = y; }; -},{"../../lib":632,"../ohlc/helpers":824}],774:[function(require,module,exports){ +},{"../../lib":633,"../ohlc/helpers":826}],775:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130589,7 +130856,9 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { var ScatterGeoAttrs = require('../scattergeo/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var plotAttrs = require('../../plots/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; var ScatterGeoMarkerLineAttrs = ScatterGeoAttrs.marker.line; @@ -130620,14 +130889,12 @@ module.exports = extendFlat({}, { hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['location', 'z', 'text', 'name'] }), - _nestedModules: { - 'colorbar': 'Colorbar' - } }, - colorscaleAttrs + colorscaleAttrs, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":539,"../../lib/extend":625,"../../plots/attributes":660,"../scattergeo/attributes":873}],775:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/attributes":538,"../../lib/extend":626,"../../plots/attributes":662,"../scattergeo/attributes":875}],776:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130646,7 +130913,7 @@ module.exports = function calc(gd, trace) { colorscaleCalc(trace, trace.z, '', 'z'); }; -},{"../../components/colorscale/calc":540}],776:[function(require,module,exports){ +},{"../../components/colorscale/calc":539}],777:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130701,7 +130968,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hoverinfo', (layout._dataLength === 1) ? 'location+z+text' : undefined); }; -},{"../../components/colorscale/defaults":543,"../../lib":632,"./attributes":774}],777:[function(require,module,exports){ +},{"../../components/colorscale/defaults":542,"../../lib":633,"./attributes":775}],778:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130739,7 +131006,7 @@ Choropleth.meta = { module.exports = Choropleth; -},{"../../plots/geo":687,"../heatmap/colorbar":791,"./attributes":774,"./calc":775,"./defaults":776,"./plot":778}],778:[function(require,module,exports){ +},{"../../plots/geo":688,"../heatmap/colorbar":792,"./attributes":775,"./calc":776,"./defaults":777,"./plot":779}],779:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130968,7 +131235,7 @@ function makeEventDataFunc(trace) { }; } -},{"../../components/color":533,"../../components/colorscale":548,"../../components/drawing":557,"../../lib/array_to_calc_item":621,"../../lib/geo_location_utils":628,"../../lib/topojson_utils":647,"../../plots/cartesian/axes":662,"../../plots/cartesian/graph_interact":670,"../../plots/geo/constants":685,"./attributes":774,"d3":95}],779:[function(require,module,exports){ +},{"../../components/color":533,"../../components/colorscale":547,"../../components/drawing":556,"../../lib/array_to_calc_item":621,"../../lib/geo_location_utils":629,"../../lib/topojson_utils":648,"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"../../plots/geo/constants":686,"./attributes":775,"d3":95}],780:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130982,119 +131249,116 @@ function makeEventDataFunc(trace) { var heatmapAttrs = require('../heatmap/attributes'); var scatterAttrs = require('../scatter/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line; -module.exports = extendFlat({}, - { - z: heatmapAttrs.z, - x: heatmapAttrs.x, - x0: heatmapAttrs.x0, - dx: heatmapAttrs.dx, - y: heatmapAttrs.y, - y0: heatmapAttrs.y0, - dy: heatmapAttrs.dy, - text: heatmapAttrs.text, - transpose: heatmapAttrs.transpose, - xtype: heatmapAttrs.xtype, - ytype: heatmapAttrs.ytype, - - connectgaps: heatmapAttrs.connectgaps, - - autocontour: { - valType: 'boolean', - dflt: true, +module.exports = extendFlat({}, { + z: heatmapAttrs.z, + x: heatmapAttrs.x, + x0: heatmapAttrs.x0, + dx: heatmapAttrs.dx, + y: heatmapAttrs.y, + y0: heatmapAttrs.y0, + dy: heatmapAttrs.dy, + text: heatmapAttrs.text, + transpose: heatmapAttrs.transpose, + xtype: heatmapAttrs.xtype, + ytype: heatmapAttrs.ytype, + + connectgaps: heatmapAttrs.connectgaps, + + autocontour: { + valType: 'boolean', + dflt: true, + role: 'style', + description: [ + 'Determines whether or not the contour level attributes are', + 'picked by an algorithm.', + 'If *true*, the number of contour levels can be set in `ncontours`.', + 'If *false*, set the contour level attributes in `contours`.' + ].join(' ') + }, + ncontours: { + valType: 'integer', + dflt: 0, + role: 'style', + description: [ + 'Sets the maximum number of contour levels. The actual number', + 'of contours will be chosen automatically to be less than or', + 'equal to the value of `ncontours`.', + 'Has an effect only if `autocontour` is *true*.' + ].join(' ') + }, + + contours: { + start: { + valType: 'number', + dflt: null, + role: 'style', + description: 'Sets the starting contour level value.' + }, + end: { + valType: 'number', + dflt: null, + role: 'style', + description: 'Sets the end contour level value.' + }, + size: { + valType: 'number', + dflt: null, + role: 'style', + description: 'Sets the step between each contour level.' + }, + coloring: { + valType: 'enumerated', + values: ['fill', 'heatmap', 'lines', 'none'], + dflt: 'fill', role: 'style', description: [ - 'Determines whether or not the contour level attributes are', - 'picked by an algorithm.', - 'If *true*, the number of contour levels can be set in `ncontours`.', - 'If *false*, set the contour level attributes in `contours`.' + 'Determines the coloring method showing the contour values.', + 'If *fill*, coloring is done evenly between each contour level', + 'If *heatmap*, a heatmap gradient coloring is applied', + 'between each contour level.', + 'If *lines*, coloring is done on the contour lines.', + 'If *none*, no coloring is applied on this trace.' ].join(' ') }, - ncontours: { - valType: 'integer', - dflt: 0, + showlines: { + valType: 'boolean', + dflt: true, role: 'style', description: [ - 'Sets the maximum number of contour levels. The actual number', - 'of contours will be chosen automatically to be less than or', - 'equal to the value of `ncontours`.', - 'Has an effect only if `autocontour` is *true*.' + 'Determines whether or not the contour lines are drawn.', + 'Has only an effect if `contours.coloring` is set to *fill*.' ].join(' ') - }, - - contours: { - start: { - valType: 'number', - dflt: null, - role: 'style', - description: 'Sets the starting contour level value.' - }, - end: { - valType: 'number', - dflt: null, - role: 'style', - description: 'Sets the end contour level value.' - }, - size: { - valType: 'number', - dflt: null, - role: 'style', - description: 'Sets the step between each contour level.' - }, - coloring: { - valType: 'enumerated', - values: ['fill', 'heatmap', 'lines', 'none'], - dflt: 'fill', - role: 'style', - description: [ - 'Determines the coloring method showing the contour values.', - 'If *fill*, coloring is done evenly between each contour level', - 'If *heatmap*, a heatmap gradient coloring is applied', - 'between each contour level.', - 'If *lines*, coloring is done on the contour lines.', - 'If *none*, no coloring is applied on this trace.' - ].join(' ') - }, - showlines: { - valType: 'boolean', - dflt: true, - role: 'style', - description: [ - 'Determines whether or not the contour lines are drawn.', - 'Has only an effect if `contours.coloring` is set to *fill*.' - ].join(' ') - } - }, - - line: { - color: extendFlat({}, scatterLineAttrs.color, { - description: [ - 'Sets the color of the contour level.', - 'Has no if `contours.coloring` is set to *lines*.' - ].join(' ') - }), - width: scatterLineAttrs.width, - dash: scatterLineAttrs.dash, - smoothing: extendFlat({}, scatterLineAttrs.smoothing, { - description: [ - 'Sets the amount of smoothing for the contour lines,', - 'where *0* corresponds to no smoothing.' - ].join(' ') - }) - }, - - _nestedModules: { - 'colorbar': 'Colorbar' } }, + + line: { + color: extendFlat({}, scatterLineAttrs.color, { + description: [ + 'Sets the color of the contour level.', + 'Has no if `contours.coloring` is set to *lines*.' + ].join(' ') + }), + width: scatterLineAttrs.width, + dash: scatterLineAttrs.dash, + smoothing: extendFlat({}, scatterLineAttrs.smoothing, { + description: [ + 'Sets the amount of smoothing for the contour lines,', + 'where *0* corresponds to no smoothing.' + ].join(' ') + }) + } +}, colorscaleAttrs, - {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} + { autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}) }, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":539,"../../lib/extend":625,"../heatmap/attributes":789,"../scatter/attributes":844}],780:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/attributes":538,"../../lib/extend":626,"../heatmap/attributes":790,"../scatter/attributes":846}],781:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131147,7 +131411,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../plots/cartesian/axes":662,"../heatmap/calc":790}],781:[function(require,module,exports){ +},{"../../plots/cartesian/axes":664,"../heatmap/calc":791}],782:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131208,7 +131472,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":536,"../../plots/plots":723,"./make_color_map":785}],782:[function(require,module,exports){ +},{"../../components/colorbar/draw":536,"../../plots/plots":724,"./make_color_map":786}],783:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131252,7 +131516,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":632,"../contour/style_defaults":788,"../heatmap/has_columns":794,"../heatmap/xyz_defaults":800,"./attributes":779}],783:[function(require,module,exports){ +},{"../../lib":633,"../contour/style_defaults":789,"../heatmap/has_columns":795,"../heatmap/xyz_defaults":801,"./attributes":780}],784:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131271,7 +131535,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return heatmapHoverPoints(pointData, xval, yval, hovermode, true); }; -},{"../heatmap/hover":795}],784:[function(require,module,exports){ +},{"../heatmap/hover":796}],785:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131312,7 +131576,7 @@ Contour.meta = { module.exports = Contour; -},{"../../plots/cartesian":671,"./attributes":779,"./calc":780,"./colorbar":781,"./defaults":782,"./hover":783,"./plot":786,"./style":787}],785:[function(require,module,exports){ +},{"../../plots/cartesian":672,"./attributes":780,"./calc":781,"./colorbar":782,"./defaults":783,"./hover":784,"./plot":787,"./style":788}],786:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131390,7 +131654,7 @@ module.exports = function makeColorMap(trace) { }); }; -},{"../../components/colorscale":548,"d3":95}],786:[function(require,module,exports){ +},{"../../components/colorscale":547,"d3":95}],787:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131713,7 +131977,7 @@ function makePath(pi, loc, edgeflag) { // even # of pts - average central two else { newpt = [(getpt(ptavg)[0] + getpt(ptavg + 1)[0]) / 2, - (getpt(ptavg)[1] + getpt(ptavg + 1)[1]) / 2]; + (getpt(ptavg)[1] + getpt(ptavg + 1)[1]) / 2]; } pts.splice(cnt2 + 1, cnt - cnt2 + 1, newpt); @@ -131851,12 +132115,12 @@ function getInterpPx(pi, loc, step) { if(step[1]) { var dx = (pi.level - zxy) / (pi.z[locy][locx + 1] - zxy); return [xa.c2p((1 - dx) * pi.x[locx] + dx * pi.x[locx + 1], true), - ya.c2p(pi.y[locy], true)]; + ya.c2p(pi.y[locy], true)]; } else { var dy = (pi.level - zxy) / (pi.z[locy + 1][locx] - zxy); return [xa.c2p(pi.x[locx], true), - ya.c2p((1 - dy) * pi.y[locy] + dy * pi.y[locy + 1], true)]; + ya.c2p((1 - dy) * pi.y[locy] + dy * pi.y[locy + 1], true)]; } } @@ -132100,7 +132364,7 @@ function makeClipMask(cd0) { return z; } -},{"../../components/drawing":557,"../../lib":632,"../heatmap/plot":798,"d3":95}],787:[function(require,module,exports){ +},{"../../components/drawing":556,"../../lib":633,"../heatmap/plot":799,"d3":95}],788:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132157,7 +132421,7 @@ module.exports = function style(gd) { heatmapStyle(gd); }; -},{"../../components/drawing":557,"../heatmap/style":799,"./make_color_map":785,"d3":95}],788:[function(require,module,exports){ +},{"../../components/drawing":556,"../heatmap/style":800,"./make_color_map":786,"d3":95}],789:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132193,7 +132457,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout) } }; -},{"../../components/colorscale/defaults":543}],789:[function(require,module,exports){ +},{"../../components/colorscale/defaults":542}],790:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132206,95 +132470,93 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout) var scatterAttrs = require('../scatter/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; -module.exports = extendFlat({}, - { - z: { - valType: 'data_array', - description: 'Sets the z data.' - }, - x: scatterAttrs.x, - x0: scatterAttrs.x0, - dx: scatterAttrs.dx, - y: scatterAttrs.y, - y0: scatterAttrs.y0, - dy: scatterAttrs.dy, - text: { - valType: 'data_array', - description: 'Sets the text elements associated with each z value.' - }, - transpose: { - valType: 'boolean', - dflt: false, - role: 'info', - description: 'Transposes the z data.' - }, - xtype: { - valType: 'enumerated', - values: ['array', 'scaled'], - role: 'info', - description: [ - 'If *array*, the heatmap\'s x coordinates are given by *x*', - '(the default behavior when `x` is provided).', - 'If *scaled*, the heatmap\'s x coordinates are given by *x0* and *dx*', - '(the default behavior when `x` is not provided).' - ].join(' ') - }, - ytype: { - valType: 'enumerated', - values: ['array', 'scaled'], - role: 'info', - description: [ - 'If *array*, the heatmap\'s y coordinates are given by *y*', - '(the default behavior when `y` is provided)', - 'If *scaled*, the heatmap\'s y coordinates are given by *y0* and *dy*', - '(the default behavior when `y` is not provided)' - ].join(' ') - }, - zsmooth: { - valType: 'enumerated', - values: ['fast', 'best', false], - dflt: false, - role: 'style', - description: [ - 'Picks a smoothing algorithm use to smooth `z` data.' - ].join(' ') - }, - connectgaps: { - valType: 'boolean', - dflt: false, - role: 'info', - description: [ - 'Determines whether or not gaps', - '(i.e. {nan} or missing values)', - 'in the `z` data are filled in.' - ].join(' ') - }, - xgap: { - valType: 'number', - dflt: 0, - min: 0, - role: 'style', - description: 'Sets the horizontal gap (in pixels) between bricks.' - }, - ygap: { - valType: 'number', - dflt: 0, - min: 0, - role: 'style', - description: 'Sets the vertical gap (in pixels) between bricks.' - }, - _nestedModules: { - 'colorbar': 'Colorbar' - } +module.exports = extendFlat({}, { + z: { + valType: 'data_array', + description: 'Sets the z data.' + }, + x: scatterAttrs.x, + x0: scatterAttrs.x0, + dx: scatterAttrs.dx, + y: scatterAttrs.y, + y0: scatterAttrs.y0, + dy: scatterAttrs.dy, + text: { + valType: 'data_array', + description: 'Sets the text elements associated with each z value.' }, + transpose: { + valType: 'boolean', + dflt: false, + role: 'info', + description: 'Transposes the z data.' + }, + xtype: { + valType: 'enumerated', + values: ['array', 'scaled'], + role: 'info', + description: [ + 'If *array*, the heatmap\'s x coordinates are given by *x*', + '(the default behavior when `x` is provided).', + 'If *scaled*, the heatmap\'s x coordinates are given by *x0* and *dx*', + '(the default behavior when `x` is not provided).' + ].join(' ') + }, + ytype: { + valType: 'enumerated', + values: ['array', 'scaled'], + role: 'info', + description: [ + 'If *array*, the heatmap\'s y coordinates are given by *y*', + '(the default behavior when `y` is provided)', + 'If *scaled*, the heatmap\'s y coordinates are given by *y0* and *dy*', + '(the default behavior when `y` is not provided)' + ].join(' ') + }, + zsmooth: { + valType: 'enumerated', + values: ['fast', 'best', false], + dflt: false, + role: 'style', + description: [ + 'Picks a smoothing algorithm use to smooth `z` data.' + ].join(' ') + }, + connectgaps: { + valType: 'boolean', + dflt: false, + role: 'info', + description: [ + 'Determines whether or not gaps', + '(i.e. {nan} or missing values)', + 'in the `z` data are filled in.' + ].join(' ') + }, + xgap: { + valType: 'number', + dflt: 0, + min: 0, + role: 'style', + description: 'Sets the horizontal gap (in pixels) between bricks.' + }, + ygap: { + valType: 'number', + dflt: 0, + min: 0, + role: 'style', + description: 'Sets the vertical gap (in pixels) between bricks.' + }, +}, colorscaleAttrs, - {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} + { autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}) }, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":539,"../../lib/extend":625,"../scatter/attributes":844}],790:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/attributes":538,"../../lib/extend":626,"../scatter/attributes":846}],791:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132405,9 +132667,9 @@ module.exports = function calc(gd, trace) { // create arrays of brick boundaries, to be used by autorange and heatmap.plot var xlen = maxRowLength(z), - xIn = trace.xtype === 'scaled' ? '' : trace.x, + xIn = trace.xtype === 'scaled' ? '' : x, xArray = makeBoundArray(trace, xIn, x0, dx, xlen, xa), - yIn = trace.ytype === 'scaled' ? '' : trace.y, + yIn = trace.ytype === 'scaled' ? '' : y, yArray = makeBoundArray(trace, yIn, y0, dy, z.length, ya); // handled in gl2d convert step @@ -132477,7 +132739,6 @@ function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) { var isArrayOfTwoItemsOrMore = Array.isArray(arrayIn) && arrayIn.length > 1; if(isArrayOfTwoItemsOrMore && !isHist && (ax.type !== 'category')) { - arrayIn = arrayIn.map(ax.d2c); var len = arrayIn.length; // given vals are brick centers @@ -132520,7 +132781,7 @@ function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) { else { dv = dvIn || 1; - if(isHist || ax.type === 'category') v0 = v0In || 0; + if(isHist || ax.type === 'category') v0 = ax.r2c(v0In) || 0; else if(Array.isArray(arrayIn) && arrayIn.length === 1) v0 = arrayIn[0]; else if(v0In === undefined) v0 = 0; else v0 = ax.d2c(v0In); @@ -132744,7 +133005,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../components/colorscale/calc":540,"../../lib":632,"../../plots/cartesian/axes":662,"../../registry":738,"../histogram2d/calc":810,"./convert_column_xyz":792,"./has_columns":794,"./max_row_length":797,"fast-isnumeric":104}],791:[function(require,module,exports){ +},{"../../components/colorscale/calc":539,"../../lib":633,"../../plots/cartesian/axes":664,"../../registry":739,"../histogram2d/calc":812,"./convert_column_xyz":793,"./has_columns":795,"./max_row_length":798,"fast-isnumeric":104}],792:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132795,7 +133056,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":536,"../../components/colorscale":548,"../../lib":632,"../../plots/plots":723,"fast-isnumeric":104}],792:[function(require,module,exports){ +},{"../../components/colorbar/draw":536,"../../components/colorscale":547,"../../lib":633,"../../plots/plots":724,"fast-isnumeric":104}],793:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132852,7 +133113,7 @@ module.exports = function convertColumnXYZ(trace, xa, ya) { if(hasColumnText) trace.text = text; }; -},{"../../lib":632}],793:[function(require,module,exports){ +},{"../../lib":633}],794:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132897,7 +133158,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":543,"../../lib":632,"./attributes":789,"./has_columns":794,"./xyz_defaults":800}],794:[function(require,module,exports){ +},{"../../components/colorscale/defaults":542,"../../lib":633,"./attributes":790,"./has_columns":795,"./xyz_defaults":801}],795:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132913,7 +133174,7 @@ module.exports = function(trace) { return !Array.isArray(trace.z[0]); }; -},{}],795:[function(require,module,exports){ +},{}],796:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133031,7 +133292,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, contour) })]; }; -},{"../../lib":632,"../../plots/cartesian/constants":668,"../../plots/cartesian/graph_interact":670}],796:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/constants":669,"../../plots/cartesian/graph_interact":671}],797:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133086,7 +133347,7 @@ Heatmap.meta = { module.exports = Heatmap; -},{"../../plots/cartesian":671,"./attributes":789,"./calc":790,"./colorbar":791,"./defaults":793,"./hover":795,"./plot":798,"./style":799}],797:[function(require,module,exports){ +},{"../../plots/cartesian":672,"./attributes":790,"./calc":791,"./colorbar":792,"./defaults":794,"./hover":796,"./plot":799,"./style":800}],798:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133108,7 +133369,7 @@ module.exports = function maxRowLength(z) { return len; }; -},{}],798:[function(require,module,exports){ +},{}],799:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133558,7 +133819,7 @@ function plotOne(gd, plotinfo, cd) { image3.exit().remove(); } -},{"../../components/colorscale":548,"../../constants/xmlns_namespaces":618,"../../lib":632,"../../registry":738,"./max_row_length":797,"tinycolor2":489}],799:[function(require,module,exports){ +},{"../../components/colorscale":547,"../../constants/xmlns_namespaces":618,"../../lib":633,"../../registry":739,"./max_row_length":798,"tinycolor2":489}],800:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133579,7 +133840,7 @@ module.exports = function style(gd) { }); }; -},{"d3":95}],800:[function(require,module,exports){ +},{"d3":95}],801:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133668,7 +133929,7 @@ function isValidZ(z) { return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"./has_columns":794,"fast-isnumeric":104}],801:[function(require,module,exports){ +},{"./has_columns":795,"fast-isnumeric":104}],802:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133744,7 +134005,7 @@ module.exports = { autobinx: { valType: 'boolean', - dflt: true, + dflt: null, role: 'style', description: [ 'Determines whether or not the x axis bin attributes are picked', @@ -133768,7 +134029,7 @@ module.exports = { autobiny: { valType: 'boolean', - dflt: true, + dflt: null, role: 'style', description: [ 'Determines whether or not the y axis bin attributes are picked', @@ -133792,11 +134053,8 @@ module.exports = { marker: barAttrs.marker, - _nestedModules: { - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - }, + error_y: barAttrs.error_y, + error_x: barAttrs.error_x, _deprecated: { bardir: barAttrs._deprecated.bardir @@ -133806,7 +134064,7 @@ module.exports = { function makeBinsAttr(axLetter) { return { start: { - valType: 'number', + valType: 'any', // for date axes dflt: null, role: 'style', description: [ @@ -133815,7 +134073,7 @@ function makeBinsAttr(axLetter) { ].join(' ') }, end: { - valType: 'number', + valType: 'any', // for date axes dflt: null, role: 'style', description: [ @@ -133825,7 +134083,7 @@ function makeBinsAttr(axLetter) { }, size: { valType: 'any', // for date axes - dflt: 1, + dflt: null, role: 'style', description: [ 'Sets the step in-between value each', axLetter, @@ -133835,7 +134093,7 @@ function makeBinsAttr(axLetter) { }; } -},{"../bar/attributes":748}],802:[function(require,module,exports){ +},{"../bar/attributes":749}],803:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133861,7 +134119,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],803:[function(require,module,exports){ +},{}],804:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133878,20 +134136,23 @@ module.exports = function handleBinDefaults(traceIn, traceOut, coerce, binDirect coerce('histnorm'); binDirections.forEach(function(binDirection) { - // data being binned - note that even though it's a little weird, - // it's possible to have bins without data, if there's inferred data - var binstrt = coerce(binDirection + 'bins.start'), - binend = coerce(binDirection + 'bins.end'), - autobin = coerce('autobin' + binDirection, !(binstrt && binend)); - - if(autobin) coerce('nbins' + binDirection); - else coerce(binDirection + 'bins.size'); + /* + * Because date axes have string values for start and end, + * and string options for size, we cannot validate these attributes + * now. We will do this during calc (immediately prior to binning) + * in ./clean_bins, and push the cleaned values back to _fullData. + */ + coerce(binDirection + 'bins.start'); + coerce(binDirection + 'bins.end'); + coerce(binDirection + 'bins.size'); + coerce('autobin' + binDirection); + coerce('nbins' + binDirection); }); return traceOut; }; -},{}],804:[function(require,module,exports){ +},{}],805:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133965,7 +134226,7 @@ module.exports = { } }; -},{"fast-isnumeric":104}],805:[function(require,module,exports){ +},{"fast-isnumeric":104}],806:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133985,6 +134246,7 @@ var Axes = require('../../plots/cartesian/axes'); var binFunctions = require('./bin_functions'); var normFunctions = require('./norm_functions'); var doAvg = require('./average'); +var cleanBins = require('./clean_bins'); module.exports = function calc(gd, trace) { @@ -134001,6 +134263,8 @@ module.exports = function calc(gd, trace) { maindata = trace.orientation === 'h' ? 'y' : 'x', counterdata = {x: 'y', y: 'x'}[maindata]; + cleanBins(trace, pa, maindata); + // prepare the raw data var pos0 = pa.makeCalcdata(trace, maindata); // calculate the bins @@ -134039,10 +134303,11 @@ module.exports = function calc(gd, trace) { // create the bins (and any extra arrays needed) // assume more than 5000 bins is an error, so we don't crash the browser - i = binspec.start; + i = pa.r2c(binspec.start); + // decrease end a little in case of rounding errors - binend = binspec.end + - (binspec.start - Axes.tickIncrement(binspec.start, binspec.size)) / 1e6; + binend = pa.r2c(binspec.end) + (i - Axes.tickIncrement(i, binspec.size)) / 1e6; + while(i < binend && pos.length < 5000) { i2 = Axes.tickIncrement(i, binspec.size); pos.push((i + i2) / 2); @@ -134095,7 +134360,82 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"./average":802,"./bin_functions":804,"./norm_functions":808,"fast-isnumeric":104}],806:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"./average":803,"./bin_functions":805,"./clean_bins":807,"./norm_functions":810,"fast-isnumeric":104}],807:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; +var isNumeric = require('fast-isnumeric'); +var cleanDate = require('../../lib').cleanDate; +var ONEDAY = require('../../constants/numerical').ONEDAY; + +/* + * cleanBins: validate attributes autobin[xy] and [xy]bins.(start, end, size) + * Mutates trace so all these attributes are valid. + * + * Normally this kind of thing would happen during supplyDefaults, but + * in this case we need to know the axis type, and axis type isn't set until + * after trace supplyDefaults are completed. So this gets called during the + * calc step, when data are inserted into bins. + */ +module.exports = function cleanBins(trace, ax, binDirection) { + var axType = ax.type, + binAttr = binDirection + 'bins', + bins = trace[binAttr]; + + if(!bins) bins = trace[binAttr] = {}; + + var cleanBound = (axType === 'date') ? + function(v) { return (v || v === 0) ? cleanDate(v) : null; } : + function(v) { return isNumeric(v) ? Number(v) : null; }; + + bins.start = cleanBound(bins.start); + bins.end = cleanBound(bins.end); + + // logic for bin size is very similar to dtick (cartesian/tick_value_defaults) + // but without the extra string options for log axes + // ie the only strings we accept are M for months + var sizeDflt = (axType === 'date') ? ONEDAY : 1, + binSize = bins.size; + + if(isNumeric(binSize)) { + bins.size = (binSize > 0) ? Number(binSize) : sizeDflt; + } + else if(typeof binSize !== 'string') { + bins.size = sizeDflt; + } + else { + // date special case: "M" gives bins every (integer) n months + var prefix = binSize.charAt(0), + sizeNum = binSize.substr(1); + + sizeNum = isNumeric(sizeNum) ? Number(sizeNum) : 0; + if((sizeNum <= 0) || !( + axType === 'date' && prefix === 'M' && sizeNum === Math.round(sizeNum) + )) { + bins.size = sizeDflt; + } + } + + var autoBinAttr = 'autobin' + binDirection; + + if(typeof trace[autoBinAttr] !== 'boolean') { + trace[autoBinAttr] = !( + (bins.start || bins.start === 0) && + (bins.end || bins.end === 0) + ); + } + + if(!trace[autoBinAttr]) delete trace['nbins' + binDirection]; +}; + +},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],808:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134147,7 +134487,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":533,"../../components/errorbars/defaults":562,"../../lib":632,"../bar/style_defaults":759,"./attributes":801,"./bin_defaults":803}],807:[function(require,module,exports){ +},{"../../components/color":533,"../../components/errorbars/defaults":561,"../../lib":633,"../bar/style_defaults":760,"./attributes":802,"./bin_defaults":804}],809:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134202,7 +134542,7 @@ Histogram.meta = { module.exports = Histogram; -},{"../../plots/cartesian":671,"../bar/hover":751,"../bar/layout_attributes":753,"../bar/layout_defaults":754,"../bar/plot":755,"../bar/set_positions":756,"../bar/style":758,"../scatter/colorbar":847,"./attributes":801,"./calc":805,"./defaults":806}],808:[function(require,module,exports){ +},{"../../plots/cartesian":672,"../bar/hover":752,"../bar/layout_attributes":754,"../bar/layout_defaults":755,"../bar/plot":756,"../bar/set_positions":757,"../bar/style":759,"../scatter/colorbar":849,"./attributes":802,"./calc":806,"./defaults":808}],810:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134237,7 +134577,7 @@ module.exports = { } }; -},{}],809:[function(require,module,exports){ +},{}],811:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134251,6 +134591,7 @@ module.exports = { var histogramAttrs = require('../histogram/attributes'); var heatmapAttrs = require('../heatmap/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; @@ -134281,17 +134622,14 @@ module.exports = extendFlat({}, xgap: heatmapAttrs.xgap, ygap: heatmapAttrs.ygap, - zsmooth: heatmapAttrs.zsmooth, - - _nestedModules: { - 'colorbar': 'Colorbar' - } + zsmooth: heatmapAttrs.zsmooth }, colorscaleAttrs, - {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} + { autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}) }, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":539,"../../lib/extend":625,"../heatmap/attributes":789,"../histogram/attributes":801}],810:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/attributes":538,"../../lib/extend":626,"../heatmap/attributes":790,"../histogram/attributes":802}],812:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134309,6 +134647,7 @@ var Axes = require('../../plots/cartesian/axes'); var binFunctions = require('../histogram/bin_functions'); var normFunctions = require('../histogram/norm_functions'); var doAvg = require('../histogram/average'); +var cleanBins = require('../histogram/clean_bins'); module.exports = function calc(gd, trace) { @@ -134323,6 +134662,9 @@ module.exports = function calc(gd, trace) { z, i; + cleanBins(trace, xa, 'x'); + cleanBins(trace, ya, 'y'); + var serieslen = Math.min(x.length, y.length); if(x.length > serieslen) x.splice(serieslen, x.length - serieslen); if(y.length > serieslen) y.splice(serieslen, y.length - serieslen); @@ -134332,8 +134674,10 @@ module.exports = function calc(gd, trace) { if(trace.autobinx || !('xbins' in trace)) { trace.xbins = Axes.autoBin(x, xa, trace.nbinsx, '2d'); if(trace.type === 'histogram2dcontour') { - trace.xbins.start -= trace.xbins.size; - trace.xbins.end += trace.xbins.size; + // the "true" last argument reverses the tick direction (which we can't + // just do with a minus sign because of month bins) + trace.xbins.start = xa.c2r(Axes.tickIncrement(xa.r2c(trace.xbins.start), trace.xbins.size, true)); + trace.xbins.end = xa.c2r(Axes.tickIncrement(xa.r2c(trace.xbins.end), trace.xbins.size)); } // copy bin info back to the source data. @@ -134342,8 +134686,8 @@ module.exports = function calc(gd, trace) { if(trace.autobiny || !('ybins' in trace)) { trace.ybins = Axes.autoBin(y, ya, trace.nbinsy, '2d'); if(trace.type === 'histogram2dcontour') { - trace.ybins.start -= trace.ybins.size; - trace.ybins.end += trace.ybins.size; + trace.ybins.start = ya.c2r(Axes.tickIncrement(ya.r2c(trace.ybins.start), trace.ybins.size, true)); + trace.ybins.end = ya.c2r(Axes.tickIncrement(ya.r2c(trace.ybins.end), trace.ybins.size)); } trace._input.ybins = trace.ybins; } @@ -134385,11 +134729,11 @@ module.exports = function calc(gd, trace) { // decrease end a little in case of rounding errors var binspec = trace.xbins, - binend = binspec.end + - (binspec.start - Axes.tickIncrement(binspec.start, binspec.size)) / 1e6; + binStart = xa.r2c(binspec.start), + binEnd = xa.r2c(binspec.end) + + (binStart - Axes.tickIncrement(binStart, binspec.size)) / 1e6; - for(i = binspec.start; i < binend; - i = Axes.tickIncrement(i, binspec.size)) { + for(i = binStart; i < binEnd; i = Axes.tickIncrement(i, binspec.size)) { onecol.push(sizeinit); if(Array.isArray(xbins)) xbins.push(i); if(doavg) zerocol.push(0); @@ -134398,15 +134742,16 @@ module.exports = function calc(gd, trace) { var nx = onecol.length; x0 = trace.xbins.start; - dx = (i - x0) / nx; - x0 += dx / 2; + var x0c = xa.r2c(x0); + dx = (i - x0c) / nx; + x0 = xa.c2r(x0c + dx / 2); binspec = trace.ybins; - binend = binspec.end + - (binspec.start - Axes.tickIncrement(binspec.start, binspec.size)) / 1e6; + binStart = ya.r2c(binspec.start); + binEnd = ya.r2c(binspec.end) + + (binStart - Axes.tickIncrement(binStart, binspec.size)) / 1e6; - for(i = binspec.start; i < binend; - i = Axes.tickIncrement(i, binspec.size)) { + for(i = binStart; i < binEnd; i = Axes.tickIncrement(i, binspec.size)) { z.push(onecol.concat()); if(Array.isArray(ybins)) ybins.push(i); if(doavg) counts.push(zerocol.concat()); @@ -134415,8 +134760,9 @@ module.exports = function calc(gd, trace) { var ny = z.length; y0 = trace.ybins.start; - dy = (i - y0) / ny; - y0 += dy / 2; + var y0c = ya.r2c(y0); + dy = (i - y0c) / ny; + y0 = ya.c2r(y0c + dy / 2); if(densitynorm) { xinc = onecol.map(function(v, i) { @@ -134457,7 +134803,7 @@ module.exports = function calc(gd, trace) { }; }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"../histogram/average":802,"../histogram/bin_functions":804,"../histogram/norm_functions":808}],811:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"../histogram/average":803,"../histogram/bin_functions":805,"../histogram/clean_bins":807,"../histogram/norm_functions":810}],813:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134495,7 +134841,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, layout) { ); }; -},{"../../components/colorscale/defaults":543,"../../lib":632,"./attributes":809,"./sample_defaults":813}],812:[function(require,module,exports){ +},{"../../components/colorscale/defaults":542,"../../lib":633,"./attributes":811,"./sample_defaults":815}],814:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134535,7 +134881,7 @@ Histogram2D.meta = { module.exports = Histogram2D; -},{"../../plots/cartesian":671,"../heatmap/calc":790,"../heatmap/colorbar":791,"../heatmap/hover":795,"../heatmap/plot":798,"../heatmap/style":799,"./attributes":809,"./defaults":811}],813:[function(require,module,exports){ +},{"../../plots/cartesian":672,"../heatmap/calc":791,"../heatmap/colorbar":792,"../heatmap/hover":796,"../heatmap/plot":799,"../heatmap/style":800,"./attributes":811,"./defaults":813}],815:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134571,7 +134917,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce) { handleBinDefaults(traceIn, traceOut, coerce, binDirections); }; -},{"../histogram/bin_defaults":803}],814:[function(require,module,exports){ +},{"../histogram/bin_defaults":804}],816:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134585,6 +134931,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce) { var histogram2dAttrs = require('../histogram2d/attributes'); var contourAttrs = require('../contour/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; @@ -134606,16 +134953,13 @@ module.exports = extendFlat({}, { autocontour: contourAttrs.autocontour, ncontours: contourAttrs.ncontours, contours: contourAttrs.contours, - line: contourAttrs.line, - - _nestedModules: { - 'colorbar': 'Colorbar' - } + line: contourAttrs.line }, - colorscaleAttrs + colorscaleAttrs, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":539,"../../lib/extend":625,"../contour/attributes":779,"../histogram2d/attributes":809}],815:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/attributes":538,"../../lib/extend":626,"../contour/attributes":780,"../histogram2d/attributes":811}],817:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134651,7 +134995,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":632,"../contour/style_defaults":788,"../histogram2d/sample_defaults":813,"./attributes":814}],816:[function(require,module,exports){ +},{"../../lib":633,"../contour/style_defaults":789,"../histogram2d/sample_defaults":815,"./attributes":816}],818:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134691,7 +135035,7 @@ Histogram2dContour.meta = { module.exports = Histogram2dContour; -},{"../../plots/cartesian":671,"../contour/calc":780,"../contour/colorbar":781,"../contour/hover":783,"../contour/plot":786,"../contour/style":787,"./attributes":814,"./defaults":815}],817:[function(require,module,exports){ +},{"../../plots/cartesian":672,"../contour/calc":781,"../contour/colorbar":782,"../contour/hover":784,"../contour/plot":787,"../contour/style":788,"./attributes":816,"./defaults":817}],819:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134703,7 +135047,9 @@ module.exports = Histogram2dContour; 'use strict'; var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var surfaceAtts = require('../surface/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; @@ -134860,6 +135206,7 @@ module.exports = { colorscale: colorscaleAttrs.colorscale, reversescale: colorscaleAttrs.reversescale, showscale: colorscaleAttrs.showscale, + colorbar: colorbarAttrs, lightposition: { 'x': extendFlat({}, surfaceAtts.lightposition.x, {dflt: 1e5}), @@ -134883,14 +135230,10 @@ module.exports = { dflt: 1e-6, // even the brain model doesn't appear to need finer than this description: 'Epsilon for face normals calculation avoids math issues arising from degenerate geometry.' } - }, surfaceAtts.lighting), - - _nestedModules: { // nested module coupling - 'colorbar': 'Colorbar' - } + }, surfaceAtts.lighting) }; -},{"../../components/colorscale/attributes":539,"../../lib/extend":625,"../surface/attributes":900}],818:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/attributes":538,"../../lib/extend":626,"../surface/attributes":902}],820:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -135052,7 +135395,7 @@ function createMesh3DTrace(scene, data) { module.exports = createMesh3DTrace; -},{"../../lib/str2rgbarray":645,"alpha-shape":32,"convex-hull":84,"delaunay-triangulate":96,"gl-mesh3d":173,"tinycolor2":489}],819:[function(require,module,exports){ +},{"../../lib/str2rgbarray":646,"alpha-shape":32,"convex-hull":84,"delaunay-triangulate":96,"gl-mesh3d":173,"tinycolor2":489}],821:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -135149,7 +135492,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/colorbar/defaults":535,"../../lib":632,"./attributes":817}],820:[function(require,module,exports){ +},{"../../components/colorbar/defaults":535,"../../lib":633,"./attributes":819}],822:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -135185,7 +135528,7 @@ Mesh3D.meta = { module.exports = Mesh3D; -},{"../../plots/gl3d":702,"../heatmap/colorbar":791,"./attributes":817,"./convert":818,"./defaults":819}],821:[function(require,module,exports){ +},{"../../plots/gl3d":703,"../heatmap/colorbar":792,"./attributes":819,"./convert":820,"./defaults":821}],823:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -135320,7 +135663,7 @@ module.exports = { } }; -},{"../../lib":632,"../scatter/attributes":844}],822:[function(require,module,exports){ +},{"../../lib":633,"../scatter/attributes":846}],824:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -135369,7 +135712,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.line.dash', traceOut.line.dash); } -},{"../../lib":632,"./attributes":821,"./direction_defaults":823,"./helpers":824,"./ohlc_defaults":826}],823:[function(require,module,exports){ +},{"../../lib":633,"./attributes":823,"./direction_defaults":825,"./helpers":826,"./ohlc_defaults":828}],825:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -135395,7 +135738,7 @@ module.exports = function handleDirectionDefaults(traceIn, traceOut, coerce, dir coerce(direction + '.name', nameDflt); }; -},{}],824:[function(require,module,exports){ +},{}],826:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -135507,7 +135850,7 @@ exports.addRangeSlider = function(layout) { if(!layout.xaxis.rangeslider) layout.xaxis.rangeslider = {}; }; -},{"../../lib":632}],825:[function(require,module,exports){ +},{"../../lib":633}],827:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -135549,7 +135892,7 @@ module.exports = { register(require('../scatter')); register(require('./transform')); -},{"../../plot_api/register":653,"../../plots/cartesian":671,"../scatter":854,"./attributes":821,"./defaults":822,"./transform":827}],826:[function(require,module,exports){ +},{"../../plot_api/register":654,"../../plots/cartesian":672,"../scatter":856,"./attributes":823,"./defaults":824,"./transform":829}],828:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -135585,7 +135928,7 @@ module.exports = function handleOHLC(traceIn, traceOut, coerce) { return len; }; -},{}],827:[function(require,module,exports){ +},{}],829:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -135722,18 +136065,28 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { y = [], textOut = []; - var getXItem = trace._fullInput.x ? - function(i) { return xa.d2c(trace.x[i]); } : - function(i) { return i; }; - - var getTextItem = Array.isArray(textIn) ? - function(i) { return textIn[i] || ''; } : - function() { return textIn; }; - - var appendX = function(i) { - var v = getXItem(i); - x.push(v - tickWidth, v, v, v, v, v + tickWidth, null); - }; + var appendX; + if(trace._fullInput.x) { + appendX = function(i) { + var xi = trace.x[i], + xcalc = xa.d2c(xi); + + x.push( + xa.c2d(xcalc - tickWidth), + xi, xi, xi, xi, + xa.c2d(xcalc + tickWidth), + null); + }; + } + else { + appendX = function(i) { + x.push( + i - tickWidth, + i, i, i, i, + i + tickWidth, + null); + }; + } var appendY = function(o, h, l, c) { y.push(o, o, h, l, c, c, null); @@ -135749,6 +136102,10 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { hasY = hasAll || hoverParts.indexOf('y') !== -1, hasText = hasAll || hoverParts.indexOf('text') !== -1; + var getTextItem = Array.isArray(textIn) ? + function(i) { return textIn[i] || ''; } : + function() { return textIn; }; + var appendText = function(i, o, h, l, c) { var t = []; @@ -135827,7 +136184,7 @@ function convertTickWidth(gd, xa, trace) { return minDiff * tickWidth; } -},{"../../lib":632,"../../plots/cartesian/axes":662,"../../plots/cartesian/axis_ids":665,"./helpers":824}],828:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"../../plots/cartesian/axis_ids":667,"./helpers":826}],830:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136091,7 +136448,7 @@ module.exports = { } }; -},{"../../components/color/attributes":532,"../../lib/extend":625,"../../plots/attributes":660,"../../plots/font_attributes":683}],829:[function(require,module,exports){ +},{"../../components/color/attributes":532,"../../lib/extend":626,"../../plots/attributes":662,"../../plots/font_attributes":684}],831:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136138,7 +136495,7 @@ function getCdModule(calcdata, _module) { return cdModule; } -},{"../../registry":738}],830:[function(require,module,exports){ +},{"../../registry":739}],832:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136290,7 +136647,7 @@ function nextDefaultColor(index) { return pieDefaultColors[index % pieDefaultColors.length]; } -},{"../../components/color":533,"./helpers":832,"fast-isnumeric":104,"tinycolor2":489}],831:[function(require,module,exports){ +},{"../../components/color":533,"./helpers":834,"fast-isnumeric":104,"tinycolor2":489}],833:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136374,7 +136731,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pull'); }; -},{"../../lib":632,"./attributes":828}],832:[function(require,module,exports){ +},{"../../lib":633,"./attributes":830}],834:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136403,7 +136760,7 @@ exports.formatPieValue = function formatPieValue(v, separators) { return Lib.numSeparate(vRounded, separators); }; -},{"../../lib":632}],833:[function(require,module,exports){ +},{"../../lib":633}],835:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136439,7 +136796,7 @@ Pie.meta = { module.exports = Pie; -},{"./attributes":828,"./base_plot":829,"./calc":830,"./defaults":831,"./layout_attributes":834,"./layout_defaults":835,"./plot":836,"./style":837,"./style_one":838}],834:[function(require,module,exports){ +},{"./attributes":830,"./base_plot":831,"./calc":832,"./defaults":833,"./layout_attributes":836,"./layout_defaults":837,"./plot":838,"./style":839,"./style_one":840}],836:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136459,7 +136816,7 @@ module.exports = { hiddenlabels: {valType: 'data_array'} }; -},{}],835:[function(require,module,exports){ +},{}],837:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136481,7 +136838,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('hiddenlabels'); }; -},{"../../lib":632,"./layout_attributes":834}],836:[function(require,module,exports){ +},{"../../lib":633,"./layout_attributes":836}],838:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137176,7 +137533,7 @@ function maxExtent(tilt, tiltAxisFraction, depth) { 2 * Math.sqrt(1 - sinTilt * sinTilt * tiltAxisFraction * tiltAxisFraction)); } -},{"../../components/color":533,"../../components/drawing":557,"../../lib/svg_text_utils":646,"../../plots/cartesian/graph_interact":670,"./helpers":832,"d3":95}],837:[function(require,module,exports){ +},{"../../components/color":533,"../../components/drawing":556,"../../lib/svg_text_utils":647,"../../plots/cartesian/graph_interact":671,"./helpers":834,"d3":95}],839:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137205,7 +137562,7 @@ module.exports = function style(gd) { }); }; -},{"./style_one":838,"d3":95}],838:[function(require,module,exports){ +},{"./style_one":840,"d3":95}],840:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137232,7 +137589,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":533}],839:[function(require,module,exports){ +},{"../../components/color":533}],841:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137366,7 +137723,7 @@ module.exports = { } }; -},{"../scattergl/attributes":880}],840:[function(require,module,exports){ +},{"../scattergl/attributes":882}],842:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137598,7 +137955,7 @@ function createPointcloud(scene, data) { module.exports = createPointcloud; -},{"../../lib/str2rgbarray":645,"../scatter/get_trace_color":852,"gl-pointcloud2d":198}],841:[function(require,module,exports){ +},{"../../lib/str2rgbarray":646,"../scatter/get_trace_color":854,"gl-pointcloud2d":198}],843:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137643,7 +138000,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { coerce('marker.border.arearatio'); }; -},{"../../lib":632,"./attributes":839}],842:[function(require,module,exports){ +},{"../../lib":633,"./attributes":841}],844:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137676,7 +138033,7 @@ pointcloud.meta = { module.exports = pointcloud; -},{"../../plots/gl2d":699,"../scatter3d/calc":868,"./attributes":839,"./convert":840,"./defaults":841}],843:[function(require,module,exports){ +},{"../../plots/gl2d":700,"../scatter3d/calc":870,"./attributes":841,"./convert":842,"./defaults":843}],845:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137714,7 +138071,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":632}],844:[function(require,module,exports){ +},{"../../lib":633}],846:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137726,11 +138083,11 @@ module.exports = function arraysToCalcdata(cd) { 'use strict'; var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var Drawing = require('../../components/drawing'); - var constants = require('./constants'); - var extendFlat = require('../../lib/extend').extendFlat; module.exports = { @@ -137998,6 +138355,7 @@ module.exports = { 'to pixels.' ].join(' ') }, + showscale: { valType: 'boolean', role: 'info', @@ -138007,6 +138365,8 @@ module.exports = { 'Determines whether or not a colorbar is displayed.' ].join(' ') }, + colorbar: colorbarAttrs, + line: extendFlat({}, { width: { valType: 'number', @@ -138057,6 +138417,7 @@ module.exports = { }, description: 'Sets the text font.' }, + r: { valType: 'data_array', description: [ @@ -138071,14 +138432,12 @@ module.exports = { 'Sets the angular coordinates.' ].join('') }, - _nestedModules: { // nested module coupling - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_y: errorBarAttrs, + error_x: errorBarAttrs }; -},{"../../components/colorscale/color_attributes":541,"../../components/drawing":557,"../../lib/extend":625,"./constants":849}],845:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/color_attributes":540,"../../components/drawing":556,"../../components/errorbars/attributes":558,"../../lib/extend":626,"./constants":851}],847:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138209,7 +138568,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"./colorscale_calc":848,"./subtypes":864,"fast-isnumeric":104}],846:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"./colorscale_calc":850,"./subtypes":866,"fast-isnumeric":104}],848:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138248,7 +138607,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],847:[function(require,module,exports){ +},{}],849:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138305,7 +138664,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":536,"../../components/colorscale":548,"../../lib":632,"../../plots/plots":723,"fast-isnumeric":104}],848:[function(require,module,exports){ +},{"../../components/colorbar/draw":536,"../../components/colorscale":547,"../../lib":633,"../../plots/plots":724,"fast-isnumeric":104}],850:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138338,7 +138697,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":540,"../../components/colorscale/has_colorscale":547,"./subtypes":864}],849:[function(require,module,exports){ +},{"../../components/colorscale/calc":539,"../../components/colorscale/has_colorscale":546,"./subtypes":866}],851:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138354,7 +138713,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],850:[function(require,module,exports){ +},{}],852:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138434,7 +138793,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":562,"../../lib":632,"./attributes":844,"./constants":849,"./fillcolor_defaults":851,"./line_defaults":855,"./line_shape_defaults":857,"./marker_defaults":860,"./subtypes":864,"./text_defaults":865,"./xy_defaults":866}],851:[function(require,module,exports){ +},{"../../components/errorbars/defaults":561,"../../lib":633,"./attributes":846,"./constants":851,"./fillcolor_defaults":853,"./line_defaults":857,"./line_shape_defaults":859,"./marker_defaults":862,"./subtypes":866,"./text_defaults":867,"./xy_defaults":868}],853:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138472,7 +138831,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":533}],852:[function(require,module,exports){ +},{"../../components/color":533}],854:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138525,7 +138884,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":533,"./subtypes":864}],853:[function(require,module,exports){ +},{"../../components/color":533,"./subtypes":866}],855:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138694,7 +139053,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":533,"../../components/errorbars":563,"../../lib":632,"../../plots/cartesian/constants":668,"../../plots/cartesian/graph_interact":670,"./get_trace_color":852}],854:[function(require,module,exports){ +},{"../../components/color":533,"../../components/errorbars":562,"../../lib":633,"../../plots/cartesian/constants":669,"../../plots/cartesian/graph_interact":671,"./get_trace_color":854}],856:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138744,7 +139103,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":671,"./arrays_to_calcdata":843,"./attributes":844,"./calc":845,"./clean_data":846,"./colorbar":847,"./defaults":850,"./hover":853,"./plot":861,"./select":862,"./style":863,"./subtypes":864}],855:[function(require,module,exports){ +},{"../../plots/cartesian":672,"./arrays_to_calcdata":845,"./attributes":846,"./calc":847,"./clean_data":848,"./colorbar":849,"./defaults":852,"./hover":855,"./plot":863,"./select":864,"./style":865,"./subtypes":866}],857:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138777,7 +139136,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce('line.dash'); }; -},{"../../components/colorscale/defaults":543,"../../components/colorscale/has_colorscale":547}],856:[function(require,module,exports){ +},{"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546}],858:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138789,7 +139148,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, 'use strict'; -var Axes = require('../../plots/cartesian/axes'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function linePoints(d, opts) { @@ -138800,7 +139159,6 @@ module.exports = function linePoints(d, opts) { baseTolerance = opts.baseTolerance, linear = opts.linear, segments = [], - badnum = Axes.BADNUM, minTolerance = 0.2, // fraction of tolerance "so close we don't even consider it a new point" pts = new Array(d.length), pti = 0, @@ -138837,7 +139195,7 @@ module.exports = function linePoints(d, opts) { function getPt(index) { var x = xa.c2p(d[index].x), y = ya.c2p(d[index].y); - if(x === badnum || y === badnum) return false; + if(x === BADNUM || y === BADNUM) return false; return [x, y]; } @@ -138951,7 +139309,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../plots/cartesian/axes":662}],857:[function(require,module,exports){ +},{"../../constants/numerical":616}],859:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138970,7 +139328,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],858:[function(require,module,exports){ +},{}],860:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139011,7 +139369,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],859:[function(require,module,exports){ +},{}],861:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139053,7 +139411,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":104}],860:[function(require,module,exports){ +},{"fast-isnumeric":104}],862:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139113,7 +139471,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":533,"../../components/colorscale/defaults":543,"../../components/colorscale/has_colorscale":547,"./subtypes":864}],861:[function(require,module,exports){ +},{"../../components/color":533,"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546,"./subtypes":866}],863:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139285,6 +139643,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.visible !== true) return; + transition(tr).style('opacity', trace.opacity); + // BUILD LINES AND FILLS var ownFillEl3, tonext; var ownFillDir = trace.fill.charAt(trace.fill.length - 1); @@ -139610,8 +139970,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { var xa = plotinfo.xaxis, ya = plotinfo.yaxis, - xr = d3.extent(xa.range.map(xa.l2c)), - yr = d3.extent(ya.range.map(ya.l2c)); + xr = d3.extent(xa.range.map(xa.r2l).map(xa.l2c)), + yr = d3.extent(ya.range.map(ya.r2l).map(ya.l2c)); var trace = cdscatter[0].trace; if(!subTypes.hasMarkers(trace)) return; @@ -139649,7 +140009,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":557,"../../components/errorbars":563,"../../lib":632,"../../lib/polygon":639,"./arrays_to_calcdata":843,"./line_points":856,"./link_traces":858,"./subtypes":864,"d3":95}],862:[function(require,module,exports){ +},{"../../components/drawing":556,"../../components/errorbars":562,"../../lib":633,"../../lib/polygon":640,"./arrays_to_calcdata":845,"./line_points":858,"./link_traces":860,"./subtypes":866,"d3":95}],864:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139721,7 +140081,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":864}],863:[function(require,module,exports){ +},{"./subtypes":866}],865:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139763,7 +140123,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":557,"../../components/errorbars":563,"d3":95}],864:[function(require,module,exports){ +},{"../../components/drawing":556,"../../components/errorbars":562,"d3":95}],866:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139799,7 +140159,7 @@ module.exports = { } }; -},{"../../lib":632}],865:[function(require,module,exports){ +},{"../../lib":633}],867:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139820,7 +140180,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":632}],866:[function(require,module,exports){ +},{"../../lib":633}],868:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139865,7 +140225,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { return len; }; -},{}],867:[function(require,module,exports){ +},{}],869:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139878,6 +140238,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { var scatterAttrs = require('../scatter/attributes'); var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); var MARKER_SYMBOLS = require('../../constants/gl_markers'); var extendFlat = require('../../lib/extend').extendFlat; @@ -140005,6 +140366,8 @@ module.exports = { ].join(' ') }), showscale: scatterMarkerAttrs.showscale, + colorbar: scatterMarkerAttrs.colorbar, + line: extendFlat({}, {width: extendFlat({}, scatterMarkerLineAttrs.width, {arrayOk: false})}, colorAttributes('marker.line') @@ -140012,17 +140375,16 @@ module.exports = { }, colorAttributes('marker') ), + textposition: extendFlat({}, scatterAttrs.textposition, {dflt: 'top center'}), textfont: scatterAttrs.textfont, - _nestedModules: { - 'error_x': 'ErrorBars', - 'error_y': 'ErrorBars', - 'error_z': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_x: errorBarAttrs, + error_y: errorBarAttrs, + error_z: errorBarAttrs, }; -},{"../../components/colorscale/color_attributes":541,"../../constants/gl_markers":616,"../../lib/extend":625,"../scatter/attributes":844}],868:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":540,"../../components/errorbars/attributes":558,"../../constants/gl_markers":615,"../../lib/extend":626,"../scatter/attributes":846}],870:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140051,7 +140413,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":843,"../scatter/colorscale_calc":848}],869:[function(require,module,exports){ +},{"../scatter/arrays_to_calcdata":845,"../scatter/colorscale_calc":850}],871:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140122,7 +140484,7 @@ function calculateErrors(data, scaleFactor) { module.exports = calculateErrors; -},{"../../components/errorbars/compute_error":561}],870:[function(require,module,exports){ +},{"../../components/errorbars/compute_error":560}],872:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140581,7 +140943,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../constants/gl3d_dashes":615,"../../constants/gl_markers":616,"../../lib":632,"../../lib/gl_format_color":630,"../../lib/str2rgbarray":645,"../scatter/make_bubble_size_func":859,"./calc_errors":869,"delaunay-triangulate":96,"gl-error3d":133,"gl-line3d":140,"gl-mesh3d":173,"gl-scatter3d":216}],871:[function(require,module,exports){ +},{"../../constants/gl3d_dashes":614,"../../constants/gl_markers":615,"../../lib":633,"../../lib/gl_format_color":631,"../../lib/str2rgbarray":646,"../scatter/make_bubble_size_func":861,"./calc_errors":871,"delaunay-triangulate":96,"gl-error3d":133,"gl-line3d":140,"gl-mesh3d":173,"gl-scatter3d":216}],873:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140666,7 +141028,7 @@ function handleXYZDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../components/errorbars/defaults":562,"../../lib":632,"../scatter/line_defaults":855,"../scatter/marker_defaults":860,"../scatter/subtypes":864,"../scatter/text_defaults":865,"./attributes":867}],872:[function(require,module,exports){ +},{"../../components/errorbars/defaults":561,"../../lib":633,"../scatter/line_defaults":857,"../scatter/marker_defaults":862,"../scatter/subtypes":866,"../scatter/text_defaults":867,"./attributes":869}],874:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140704,7 +141066,7 @@ Scatter3D.meta = { module.exports = Scatter3D; -},{"../../constants/gl_markers":616,"../../plots/gl3d":702,"../scatter/colorbar":847,"./attributes":867,"./calc":868,"./convert":870,"./defaults":871}],873:[function(require,module,exports){ +},{"../../constants/gl_markers":615,"../../plots/gl3d":703,"../scatter/colorbar":849,"./attributes":869,"./calc":870,"./convert":872,"./defaults":873}],875:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140784,6 +141146,7 @@ module.exports = { sizemin: scatterMarkerAttrs.sizemin, sizemode: scatterMarkerAttrs.sizemode, showscale: scatterMarkerAttrs.showscale, + colorbar: scatterMarkerAttrs.colorbar, line: extendFlat({}, {width: scatterMarkerLineAttrs.width}, colorAttributes('marker.line') @@ -140808,14 +141171,10 @@ module.exports = { hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['lon', 'lat', 'location', 'text', 'name'] - }), - - _nestedModules: { - 'marker.colorbar': 'Colorbar' - } + }) }; -},{"../../components/colorscale/color_attributes":541,"../../lib/extend":625,"../../plots/attributes":660,"../scatter/attributes":844}],874:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":540,"../../lib/extend":626,"../../plots/attributes":662,"../scatter/attributes":846}],876:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140872,7 +141231,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../scatter/colorscale_calc":848,"fast-isnumeric":104}],875:[function(require,module,exports){ +},{"../scatter/colorscale_calc":850,"fast-isnumeric":104}],877:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140952,7 +141311,7 @@ function handleLonLatLocDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":632,"../scatter/fillcolor_defaults":851,"../scatter/line_defaults":855,"../scatter/marker_defaults":860,"../scatter/subtypes":864,"../scatter/text_defaults":865,"./attributes":873}],876:[function(require,module,exports){ +},{"../../lib":633,"../scatter/fillcolor_defaults":853,"../scatter/line_defaults":857,"../scatter/marker_defaults":862,"../scatter/subtypes":866,"../scatter/text_defaults":867,"./attributes":875}],878:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140973,7 +141332,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],877:[function(require,module,exports){ +},{}],879:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141083,7 +141442,7 @@ function getExtraText(trace, pt, axis) { return text.join('
'); } -},{"../../plots/cartesian/axes":662,"../../plots/cartesian/graph_interact":670,"../scatter/get_trace_color":852,"./attributes":873}],878:[function(require,module,exports){ +},{"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"../scatter/get_trace_color":854,"./attributes":875}],880:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141120,7 +141479,7 @@ ScatterGeo.meta = { module.exports = ScatterGeo; -},{"../../plots/geo":687,"../scatter/colorbar":847,"./attributes":873,"./calc":874,"./defaults":875,"./event_data":876,"./hover":877,"./plot":879}],879:[function(require,module,exports){ +},{"../../plots/geo":688,"../scatter/colorbar":849,"./attributes":875,"./calc":876,"./defaults":877,"./event_data":878,"./hover":879,"./plot":881}],881:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141292,7 +141651,7 @@ function style(geo) { }); } -},{"../../components/color":533,"../../components/drawing":557,"../../lib":632,"../../lib/array_to_calc_item":621,"../../lib/geo_location_utils":628,"../../lib/geojson_utils":629,"../../lib/topojson_utils":647,"../scatter/subtypes":864,"d3":95}],880:[function(require,module,exports){ +},{"../../components/color":533,"../../components/drawing":556,"../../lib":633,"../../lib/array_to_calc_item":621,"../../lib/geo_location_utils":629,"../../lib/geojson_utils":630,"../../lib/topojson_utils":648,"../scatter/subtypes":866,"d3":95}],882:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141366,6 +141725,7 @@ module.exports = { sizemode: scatterMarkerAttrs.sizemode, opacity: scatterMarkerAttrs.opacity, showscale: scatterMarkerAttrs.showscale, + colorbar: scatterMarkerAttrs.colorbar, line: extendDeep({}, colorAttributes('marker.line'), { width: scatterMarkerLineAttrs.width }) @@ -141375,14 +141735,12 @@ module.exports = { values: ['none', 'tozeroy', 'tozerox'] }), fillcolor: scatterAttrs.fillcolor, - _nestedModules: { - 'error_x': 'ErrorBars', - 'error_y': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_y: scatterAttrs.error_y, + error_x: scatterAttrs.error_x }; -},{"../../components/colorscale/color_attributes":541,"../../constants/gl2d_dashes":614,"../../constants/gl_markers":616,"../../lib/extend":625,"../scatter/attributes":844}],881:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":540,"../../constants/gl2d_dashes":613,"../../constants/gl_markers":615,"../../lib/extend":626,"../scatter/attributes":846}],883:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141999,7 +142357,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../components/errorbars":563,"../../constants/gl2d_dashes":614,"../../constants/gl_markers":616,"../../lib":632,"../../lib/gl_format_color":630,"../../lib/str2rgbarray":645,"../../lib/typed_array_truncate":648,"../../plots/cartesian/axes":662,"../../plots/cartesian/axis_autotype":663,"../scatter/get_trace_color":852,"../scatter/make_bubble_size_func":859,"../scatter/subtypes":864,"fast-isnumeric":104,"gl-error2d":131,"gl-line2d":138,"gl-scatter2d":213,"gl-scatter2d-fancy":208}],882:[function(require,module,exports){ +},{"../../components/errorbars":562,"../../constants/gl2d_dashes":613,"../../constants/gl_markers":615,"../../lib":633,"../../lib/gl_format_color":631,"../../lib/str2rgbarray":646,"../../lib/typed_array_truncate":649,"../../plots/cartesian/axes":664,"../../plots/cartesian/axis_autotype":665,"../scatter/get_trace_color":854,"../scatter/make_bubble_size_func":861,"../scatter/subtypes":866,"fast-isnumeric":104,"gl-error2d":131,"gl-line2d":138,"gl-scatter2d":213,"gl-scatter2d-fancy":208}],884:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142056,7 +142414,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":562,"../../lib":632,"../scatter/constants":849,"../scatter/fillcolor_defaults":851,"../scatter/line_defaults":855,"../scatter/marker_defaults":860,"../scatter/subtypes":864,"../scatter/xy_defaults":866,"./attributes":880}],883:[function(require,module,exports){ +},{"../../components/errorbars/defaults":561,"../../lib":633,"../scatter/constants":851,"../scatter/fillcolor_defaults":853,"../scatter/line_defaults":857,"../scatter/marker_defaults":862,"../scatter/subtypes":866,"../scatter/xy_defaults":868,"./attributes":882}],885:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142092,7 +142450,7 @@ ScatterGl.meta = { module.exports = ScatterGl; -},{"../../plots/gl2d":699,"../scatter/colorbar":847,"../scatter3d/calc":868,"./attributes":880,"./convert":881,"./defaults":882}],884:[function(require,module,exports){ +},{"../../plots/gl2d":700,"../scatter/colorbar":849,"../scatter3d/calc":870,"./attributes":882,"./convert":883,"./defaults":884}],886:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142107,6 +142465,8 @@ var scatterGeoAttrs = require('../scattergeo/attributes'); var scatterAttrs = require('../scatter/attributes'); var mapboxAttrs = require('../../plots/mapbox/layout_attributes'); var plotAttrs = require('../../plots/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; var lineAttrs = scatterGeoAttrs.line; @@ -142181,7 +142541,8 @@ module.exports = { cmin: markerAttrs.cmin, autocolorscale: markerAttrs.autocolorscale, reversescale: markerAttrs.reversescale, - showscale: markerAttrs.showscale + showscale: markerAttrs.showscale, + colorbar: colorbarAttrs // line }, @@ -142195,13 +142556,9 @@ module.exports = { hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['lon', 'lat', 'text', 'name'] }), - - _nestedModules: { - 'marker.colorbar': 'Colorbar' - } }; -},{"../../lib/extend":625,"../../plots/attributes":660,"../../plots/mapbox/layout_attributes":719,"../scatter/attributes":844,"../scattergeo/attributes":873}],885:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../lib/extend":626,"../../plots/attributes":662,"../../plots/mapbox/layout_attributes":720,"../scatter/attributes":846,"../scattergeo/attributes":875}],887:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142304,7 +142661,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../components/colorscale":548,"../../lib":632,"../scatter/colorscale_calc":848,"../scatter/make_bubble_size_func":859,"../scatter/subtypes":864,"fast-isnumeric":104}],886:[function(require,module,exports){ +},{"../../components/colorscale":547,"../../lib":633,"../scatter/colorscale_calc":850,"../scatter/make_bubble_size_func":861,"../scatter/subtypes":866,"fast-isnumeric":104}],888:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142613,7 +142970,7 @@ function getFillFunc(attr) { function blankFillFunc() { return ''; } -},{"../../lib":632,"../../lib/geojson_utils":629,"../../plots/mapbox/convert_text_opts":716,"../scatter/subtypes":864}],887:[function(require,module,exports){ +},{"../../lib":633,"../../lib/geojson_utils":630,"../../plots/mapbox/convert_text_opts":717,"../scatter/subtypes":866}],889:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142701,7 +143058,7 @@ function handleLonLatDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":632,"../scatter/attributes":844,"../scatter/fillcolor_defaults":851,"../scatter/line_defaults":855,"../scatter/marker_defaults":860,"../scatter/subtypes":864,"../scatter/text_defaults":865,"./attributes":884}],888:[function(require,module,exports){ +},{"../../lib":633,"../scatter/attributes":846,"../scatter/fillcolor_defaults":853,"../scatter/line_defaults":857,"../scatter/marker_defaults":862,"../scatter/subtypes":866,"../scatter/text_defaults":867,"./attributes":886}],890:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142721,7 +143078,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],889:[function(require,module,exports){ +},{}],891:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142816,7 +143173,7 @@ function getExtraText(trace, di) { return text.join('
'); } -},{"../../plots/cartesian/graph_interact":670,"../scatter/get_trace_color":852}],890:[function(require,module,exports){ +},{"../../plots/cartesian/graph_interact":671,"../scatter/get_trace_color":854}],892:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142853,7 +143210,7 @@ ScatterMapbox.meta = { module.exports = ScatterMapbox; -},{"../../plots/mapbox":717,"../scatter/colorbar":847,"./attributes":884,"./calc":885,"./defaults":887,"./event_data":888,"./hover":889,"./plot":891}],891:[function(require,module,exports){ +},{"../../plots/mapbox":718,"../scatter/colorbar":849,"./attributes":886,"./calc":887,"./defaults":889,"./event_data":890,"./hover":891,"./plot":893}],893:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142977,7 +143334,7 @@ module.exports = function createScatterMapbox(mapbox, calcTrace) { return scatterMapbox; }; -},{"./convert":886}],892:[function(require,module,exports){ +},{"./convert":888}],894:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142991,6 +143348,7 @@ module.exports = function createScatterMapbox(mapbox, calcTrace) { var scatterAttrs = require('../scatter/attributes'); var plotAttrs = require('../../plots/attributes'); var colorAttributes = require('../../components/colorscale/color_attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; @@ -143084,26 +143442,24 @@ module.exports = { sizeref: scatterMarkerAttrs.sizeref, sizemin: scatterMarkerAttrs.sizemin, sizemode: scatterMarkerAttrs.sizemode, - showscale: scatterMarkerAttrs.showscale, line: extendFlat({}, {width: scatterMarkerLineAttrs.width}, colorAttributes('marker'.line) ) - }, - colorAttributes('marker') - ), + }, colorAttributes('marker'), { + showscale: scatterMarkerAttrs.showscale, + colorbar: colorbarAttrs + }), + textfont: scatterAttrs.textfont, textposition: scatterAttrs.textposition, hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['a', 'b', 'c', 'text', 'name'] }), hoveron: scatterAttrs.hoveron, - _nestedModules: { - 'marker.colorbar': 'Colorbar' - } }; -},{"../../components/colorscale/color_attributes":541,"../../lib/extend":625,"../../plots/attributes":660,"../scatter/attributes":844}],893:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/color_attributes":540,"../../lib/extend":626,"../../plots/attributes":662,"../scatter/attributes":846}],895:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -143202,7 +143558,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"../scatter/colorscale_calc":848,"../scatter/subtypes":864,"fast-isnumeric":104}],894:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"../scatter/colorscale_calc":850,"../scatter/subtypes":866,"fast-isnumeric":104}],896:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -143307,7 +143663,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hoveron', dfltHoverOn.join('+') || 'points'); }; -},{"../../lib":632,"../scatter/constants":849,"../scatter/fillcolor_defaults":851,"../scatter/line_defaults":855,"../scatter/line_shape_defaults":857,"../scatter/marker_defaults":860,"../scatter/subtypes":864,"../scatter/text_defaults":865,"./attributes":892}],895:[function(require,module,exports){ +},{"../../lib":633,"../scatter/constants":851,"../scatter/fillcolor_defaults":853,"../scatter/line_defaults":857,"../scatter/line_shape_defaults":859,"../scatter/marker_defaults":862,"../scatter/subtypes":866,"../scatter/text_defaults":867,"./attributes":894}],897:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -143378,7 +143734,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../../plots/cartesian/axes":662,"../scatter/hover":853}],896:[function(require,module,exports){ +},{"../../plots/cartesian/axes":664,"../scatter/hover":855}],898:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -143414,7 +143770,7 @@ ScatterTernary.meta = { module.exports = ScatterTernary; -},{"../../plots/ternary":731,"../scatter/colorbar":847,"./attributes":892,"./calc":893,"./defaults":894,"./hover":895,"./plot":897,"./select":898,"./style":899}],897:[function(require,module,exports){ +},{"../../plots/ternary":732,"../scatter/colorbar":849,"./attributes":894,"./calc":895,"./defaults":896,"./hover":897,"./plot":899,"./select":900,"./style":901}],899:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -143460,7 +143816,7 @@ module.exports = function plot(ternary, data) { scatterPlot(ternary.graphDiv, plotinfo, calcdata); }; -},{"../scatter/plot":861}],898:[function(require,module,exports){ +},{"../scatter/plot":863}],900:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -143495,7 +143851,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"../scatter/select":862}],899:[function(require,module,exports){ +},{"../scatter/select":864}],901:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -143524,7 +143880,7 @@ module.exports = function style(gd) { scatterStyle(gd); }; -},{"../scatter/style":863}],900:[function(require,module,exports){ +},{"../scatter/style":865}],902:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -143537,6 +143893,8 @@ module.exports = function style(gd) { var Color = require('../../components/color'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; function makeContourProjAttr(axLetter) { @@ -143655,6 +144013,7 @@ module.exports = { {dflt: false}), reversescale: colorscaleAttrs.reversescale, showscale: colorscaleAttrs.showscale, + colorbar: colorbarAttrs, contours: { x: makeContourAttr('x'), @@ -143755,10 +144114,6 @@ module.exports = { description: 'Sets the opacity of the surface.' }, - _nestedModules: { // nested module coupling - 'colorbar': 'Colorbar' - }, - _deprecated: { zauto: extendFlat({}, colorscaleAttrs.zauto, { description: 'Obsolete. Use `cauto` instead.' @@ -143772,7 +144127,7 @@ module.exports = { } }; -},{"../../components/color":533,"../../components/colorscale/attributes":539,"../../lib/extend":625}],901:[function(require,module,exports){ +},{"../../components/color":533,"../../components/colorbar/attributes":534,"../../components/colorscale/attributes":538,"../../lib/extend":626}],903:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -143796,7 +144151,7 @@ module.exports = function calc(gd, trace) { } }; -},{"../../components/colorscale/calc":540}],902:[function(require,module,exports){ +},{"../../components/colorscale/calc":539}],904:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -143848,7 +144203,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":536,"../../components/colorscale":548,"../../lib":632,"../../plots/plots":723,"fast-isnumeric":104}],903:[function(require,module,exports){ +},{"../../components/colorbar/draw":536,"../../components/colorscale":547,"../../lib":633,"../../plots/plots":724,"fast-isnumeric":104}],905:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -144002,8 +144357,8 @@ function refine(coords) { var padImg = padField(coords[i]); var scaledImg = ndarray(new Float32Array(nsize), nshape); homography(scaledImg, padImg, [scaleF, 0, 0, - 0, scaleF, 0, - 0, 0, 1]); + 0, scaleF, 0, + 0, 0, 1]); coords[i] = scaledImg; } @@ -144227,7 +144582,7 @@ function createSurfaceTrace(scene, data) { module.exports = createSurfaceTrace; -},{"../../lib/str2rgbarray":645,"gl-surface3d":231,"ndarray":427,"ndarray-fill":417,"ndarray-homography":419,"ndarray-ops":421,"tinycolor2":489}],904:[function(require,module,exports){ +},{"../../lib/str2rgbarray":646,"gl-surface3d":231,"ndarray":427,"ndarray-fill":417,"ndarray-homography":419,"ndarray-ops":421,"tinycolor2":489}],906:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -144344,7 +144699,7 @@ function mapLegacy(traceIn, oldAttr, newAttr) { } } -},{"../../components/colorscale/defaults":543,"../../lib":632,"./attributes":900}],905:[function(require,module,exports){ +},{"../../components/colorscale/defaults":542,"../../lib":633,"./attributes":902}],907:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -144387,7 +144742,7 @@ Surface.meta = { module.exports = Surface; -},{"../../plots/gl3d":702,"./attributes":900,"./calc":901,"./colorbar":902,"./convert":903,"./defaults":904}],906:[function(require,module,exports){ +},{"../../plots/gl3d":703,"./attributes":902,"./calc":903,"./colorbar":904,"./convert":905,"./defaults":906}],908:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -144399,6 +144754,7 @@ module.exports = Surface; 'use strict'; var Lib = require('../lib'); +var PlotSchema = require('../plot_api/plot_schema'); var axisIds = require('../plots/cartesian/axis_ids'); var autoType = require('../plots/cartesian/axis_autotype'); var setConvert = require('../plots/cartesian/set_convert'); @@ -144521,7 +144877,7 @@ exports.calcTransform = function(gd, trace, opts) { var dataToCoord = getDataToCoordFunc(gd, trace, target), filterFunc = getFilterFunc(opts, dataToCoord), - arrayAttrs = Lib.findArrayAttributes(trace), + arrayAttrs = PlotSchema.findArrayAttributes(trace), originalArrays = {}; // copy all original array attribute values, @@ -144574,7 +144930,13 @@ function getDataToCoordFunc(gd, trace, target) { type: autoType(target), _categories: [] }; + setConvert(ax); + + // build up ax._categories (usually done during ax.makeCalcdata() + for(var i = 0; i < target.length; i++) { + ax.d2c(target[i]); + } } else { ax = axisIds.getFromTrace(gd, trace, target); @@ -144693,7 +145055,7 @@ function getFilterFunc(opts, d2c) { } } -},{"../lib":632,"../plots/cartesian/axis_autotype":663,"../plots/cartesian/axis_ids":665,"../plots/cartesian/set_convert":677}],907:[function(require,module,exports){ +},{"../lib":633,"../plot_api/plot_schema":653,"../plots/cartesian/axis_autotype":665,"../plots/cartesian/axis_ids":667,"../plots/cartesian/set_convert":678}],909:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -144705,6 +145067,7 @@ function getFilterFunc(opts, d2c) { 'use strict'; var Lib = require('../lib'); +var PlotSchema = require('../plot_api/plot_schema'); exports.moduleType = 'transform'; @@ -144821,7 +145184,7 @@ function transformOne(trace, state) { newData = new Array(groupNames.length), len = groups.length; - var arrayAttrs = Lib.findArrayAttributes(trace); + var arrayAttrs = PlotSchema.findArrayAttributes(trace); var style = opts.style || {}; @@ -144848,5 +145211,5 @@ function transformOne(trace, state) { return newData; } -},{"../lib":632}]},{},[15])(15) +},{"../lib":633,"../plot_api/plot_schema":653}]},{},[15])(15) }); \ No newline at end of file diff --git a/dist/plotly.js b/dist/plotly.js index 2afddff2616..e5b39ffe16a 100644 --- a/dist/plotly.js +++ b/dist/plotly.js @@ -1,5 +1,5 @@ /** -* plotly.js v1.19.2 +* plotly.js v1.20.0 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -68,7 +68,7 @@ for(var selector in rules) { Lib.addStyleRule(fullSelector, rules[selector]); } -},{"../src/lib":632}],2:[function(require,module,exports){ +},{"../src/lib":633}],2:[function(require,module,exports){ 'use strict'; module.exports = { @@ -201,7 +201,7 @@ module.exports = { module.exports = require('../src/traces/bar'); -},{"../src/traces/bar":752}],4:[function(require,module,exports){ +},{"../src/traces/bar":753}],4:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -214,7 +214,7 @@ module.exports = require('../src/traces/bar'); module.exports = require('../src/traces/box'); -},{"../src/traces/box":764}],5:[function(require,module,exports){ +},{"../src/traces/box":765}],5:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -227,7 +227,7 @@ module.exports = require('../src/traces/box'); module.exports = require('../src/traces/candlestick'); -},{"../src/traces/candlestick":772}],6:[function(require,module,exports){ +},{"../src/traces/candlestick":773}],6:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -240,7 +240,7 @@ module.exports = require('../src/traces/candlestick'); module.exports = require('../src/traces/choropleth'); -},{"../src/traces/choropleth":777}],7:[function(require,module,exports){ +},{"../src/traces/choropleth":778}],7:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -253,7 +253,7 @@ module.exports = require('../src/traces/choropleth'); module.exports = require('../src/traces/contour'); -},{"../src/traces/contour":784}],8:[function(require,module,exports){ +},{"../src/traces/contour":785}],8:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -279,7 +279,7 @@ module.exports = require('../src/core'); module.exports = require('../src/transforms/filter'); -},{"../src/transforms/filter":906}],10:[function(require,module,exports){ +},{"../src/transforms/filter":908}],10:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -292,7 +292,7 @@ module.exports = require('../src/transforms/filter'); module.exports = require('../src/transforms/groupby'); -},{"../src/transforms/groupby":907}],11:[function(require,module,exports){ +},{"../src/transforms/groupby":909}],11:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -305,7 +305,7 @@ module.exports = require('../src/transforms/groupby'); module.exports = require('../src/traces/heatmap'); -},{"../src/traces/heatmap":796}],12:[function(require,module,exports){ +},{"../src/traces/heatmap":797}],12:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -318,7 +318,7 @@ module.exports = require('../src/traces/heatmap'); module.exports = require('../src/traces/histogram'); -},{"../src/traces/histogram":807}],13:[function(require,module,exports){ +},{"../src/traces/histogram":809}],13:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -331,7 +331,7 @@ module.exports = require('../src/traces/histogram'); module.exports = require('../src/traces/histogram2d'); -},{"../src/traces/histogram2d":812}],14:[function(require,module,exports){ +},{"../src/traces/histogram2d":814}],14:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -344,7 +344,7 @@ module.exports = require('../src/traces/histogram2d'); module.exports = require('../src/traces/histogram2dcontour'); -},{"../src/traces/histogram2dcontour":816}],15:[function(require,module,exports){ +},{"../src/traces/histogram2dcontour":818}],15:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -415,7 +415,7 @@ module.exports = Plotly; module.exports = require('../src/traces/mesh3d'); -},{"../src/traces/mesh3d":820}],17:[function(require,module,exports){ +},{"../src/traces/mesh3d":822}],17:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -428,7 +428,7 @@ module.exports = require('../src/traces/mesh3d'); module.exports = require('../src/traces/ohlc'); -},{"../src/traces/ohlc":825}],18:[function(require,module,exports){ +},{"../src/traces/ohlc":827}],18:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -441,7 +441,7 @@ module.exports = require('../src/traces/ohlc'); module.exports = require('../src/traces/pie'); -},{"../src/traces/pie":833}],19:[function(require,module,exports){ +},{"../src/traces/pie":835}],19:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -454,7 +454,7 @@ module.exports = require('../src/traces/pie'); module.exports = require('../src/traces/pointcloud'); -},{"../src/traces/pointcloud":842}],20:[function(require,module,exports){ +},{"../src/traces/pointcloud":844}],20:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -467,7 +467,7 @@ module.exports = require('../src/traces/pointcloud'); module.exports = require('../src/traces/scatter3d'); -},{"../src/traces/scatter3d":872}],21:[function(require,module,exports){ +},{"../src/traces/scatter3d":874}],21:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -480,7 +480,7 @@ module.exports = require('../src/traces/scatter3d'); module.exports = require('../src/traces/scattergeo'); -},{"../src/traces/scattergeo":878}],22:[function(require,module,exports){ +},{"../src/traces/scattergeo":880}],22:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -493,7 +493,7 @@ module.exports = require('../src/traces/scattergeo'); module.exports = require('../src/traces/scattergl'); -},{"../src/traces/scattergl":883}],23:[function(require,module,exports){ +},{"../src/traces/scattergl":885}],23:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -506,7 +506,7 @@ module.exports = require('../src/traces/scattergl'); module.exports = require('../src/traces/scattermapbox'); -},{"../src/traces/scattermapbox":890}],24:[function(require,module,exports){ +},{"../src/traces/scattermapbox":892}],24:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -519,7 +519,7 @@ module.exports = require('../src/traces/scattermapbox'); module.exports = require('../src/traces/scatterternary'); -},{"../src/traces/scatterternary":896}],25:[function(require,module,exports){ +},{"../src/traces/scatterternary":898}],25:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -532,7 +532,7 @@ module.exports = require('../src/traces/scatterternary'); module.exports = require('../src/traces/surface'); -},{"../src/traces/surface":905}],26:[function(require,module,exports){ +},{"../src/traces/surface":907}],26:[function(require,module,exports){ 'use strict' module.exports = createCamera @@ -27683,8 +27683,8 @@ proto.draw = (function () { var scaleX = 2 * boundX / dataX var scaleY = 2 * boundY / dataY - var translateX = 2 * (bounds[0] - dataBox[0]) / dataX - 1 - var translateY = 2 * (bounds[1] - dataBox[1]) / dataY - 1 + var translateX = (bounds[0] - dataBox[0] - 0.5 * dataX) / boundX + var translateY = (bounds[1] - dataBox[1] - 0.5 * dataY) / boundY SCALE_HI[0] = scaleX SCALE_HI[1] = scaleY @@ -27723,7 +27723,7 @@ proto.draw = (function () { })() proto.drawPick = function (offset) { return offset } -proto.pick = function (x, y) { +proto.pick = function () { return null } @@ -27840,7 +27840,7 @@ function createError2D (plot, options) { module.exports = { - vertex: "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi;\nattribute vec2 positionLo;\nattribute vec2 pixelOffset;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvec2 project(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo;\n}\n\nvoid main() {\n vec3 scrPosition = vec3(\n project(scaleHi, translateHi, scaleLo, translateLo, positionHi, positionLo),\n 1);\n gl_Position = vec4(\n scrPosition.xy + scrPosition.z * pixelScale * pixelOffset,\n 0,\n scrPosition.z);\n}\n", + vertex: "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi;\nattribute vec2 positionLo;\nattribute vec2 pixelOffset;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvec2 project(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\nvoid main() {\n vec3 scrPosition = vec3(\n project(scaleHi, translateHi, scaleLo, translateLo, positionHi, positionLo),\n 1);\n gl_Position = vec4(\n scrPosition.xy + scrPosition.z * pixelScale * pixelOffset,\n 0,\n scrPosition.z);\n}\n", fragment: "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n" } @@ -28623,13 +28623,13 @@ function formatCompilerError(errLog, src, type) { },{"add-line-numbers":29,"gl-constants/lookup":130,"glsl-shader-name":244,"sprintf-js":484}],137:[function(require,module,exports){ -exports.lineVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi, dLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, screenShape;\nuniform float width;\n\nvarying vec2 direction;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo;\n}\n\n\nvec2 project_2_1(vec2 scHi, vec2 scLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi\n + scLo * posHi\n + scHi * posLo\n + scLo * posLo;\n}\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n vec2 dir = project_2_1(scaleHi, scaleLo, dHi, dLo);\n vec2 n = 0.5 * width * normalize(screenShape.yx * vec2(dir.y, -dir.x)) / screenShape.xy;\n vec2 tangent = normalize(screenShape.xy * dir);\n if(dir.x < 0.0 || (dir.x == 0.0 && dir.y < 0.0)) {\n direction = -tangent;\n } else {\n direction = tangent;\n }\n gl_Position = vec4(p + n, 0.0, 1.0);\n}" +exports.lineVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi, dLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, screenShape;\nuniform float width;\n\nvarying vec2 direction;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvec2 project_2_1(vec2 scHi, vec2 scLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi\n + scLo * posHi\n + scHi * posLo\n + scLo * posLo;\n}\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n vec2 dir = project_2_1(scaleHi, scaleLo, dHi, dLo);\n vec2 n = 0.5 * width * normalize(screenShape.yx * vec2(dir.y, -dir.x)) / screenShape.xy;\n vec2 tangent = normalize(screenShape.xy * dir);\n if(dir.x < 0.0 || (dir.x == 0.0 && dir.y < 0.0)) {\n direction = -tangent;\n } else {\n direction = tangent;\n }\n gl_Position = vec4(p + n, 0.0, 1.0);\n}" exports.lineFragment = "precision highp float;\n#define GLSLIFY 1\n\nuniform vec4 color;\nuniform vec2 screenShape;\nuniform sampler2D dashPattern;\nuniform float dashLength;\n\nvarying vec2 direction;\n\nvoid main() {\n float t = fract(dot(direction, gl_FragCoord.xy) / dashLength);\n vec4 pcolor = color * texture2D(dashPattern, vec2(t, 0.0)).r;\n gl_FragColor = vec4(pcolor.rgb * pcolor.a, pcolor.a);\n}" -exports.mitreVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo;\nuniform float radius;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n gl_Position = vec4(p, 0.0, 1.0);\n gl_PointSize = radius;\n}" +exports.mitreVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo;\nuniform float radius;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n gl_Position = vec4(p, 0.0, 1.0);\n gl_PointSize = radius;\n}" exports.mitreFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n if(length(gl_PointCoord.xy - 0.5) > 0.25) {\n discard;\n }\n gl_FragColor = vec4(color.rgb, color.a);\n}" -exports.pickVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi;\nattribute vec4 pick0, pick1;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, screenShape;\nuniform float width;\n\nvarying vec4 pickA, pickB;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n vec2 n = width * normalize(screenShape.yx * vec2(dHi.y, -dHi.x)) / screenShape.xy;\n gl_Position = vec4(p + n, 0, 1);\n pickA = pick0;\n pickB = pick1;\n}" +exports.pickVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi;\nattribute vec4 pick0, pick1;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, screenShape;\nuniform float width;\n\nvarying vec4 pickA, pickB;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n vec2 n = width * normalize(screenShape.yx * vec2(dHi.y, -dHi.x)) / screenShape.xy;\n gl_Position = vec4(p + n, 0, 1);\n pickA = pick0;\n pickB = pick1;\n}" exports.pickFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 pickOffset;\n\nvarying vec4 pickA, pickB;\n\nvoid main() {\n vec4 fragId = vec4(pickA.xyz, 0.0);\n if(pickB.w > pickA.w) {\n fragId.xyz = pickB.xyz;\n }\n\n fragId += pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n gl_FragColor = fragId / 255.0;\n}" -exports.fillVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, projectAxis;\nuniform float projectValue, depth;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n if(dHi.y < 0.0 || (dHi.y == 0.0 && dHi.x < 0.0)) {\n if(dot(p, projectAxis) < projectValue) {\n p = p * (1.0 - abs(projectAxis)) + projectAxis * projectValue;\n }\n }\n gl_Position = vec4(p, depth, 1);\n}" +exports.fillVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, projectAxis;\nuniform float projectValue, depth;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n if(dHi.y < 0.0 || (dHi.y == 0.0 && dHi.x < 0.0)) {\n if(dot(p, projectAxis) < projectValue) {\n p = p * (1.0 - abs(projectAxis)) + projectAxis * projectValue;\n }\n }\n gl_Position = vec4(p, depth, 1);\n}" exports.fillFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}" },{}],138:[function(require,module,exports){ 'use strict' @@ -28713,8 +28713,8 @@ proto.setProjectionModel = (function() { var scaleX = 2 * boundX / dataX var scaleY = 2 * boundY / dataY - var translateX = 2 * (bounds[0] - dataBox[0]) / dataX - 1 - var translateY = 2 * (bounds[1] - dataBox[1]) / dataY - 1 + var translateX = (bounds[0] - dataBox[0] - 0.5 * dataX) / boundX + var translateY = (bounds[1] - dataBox[1] - 0.5 * dataY) / boundY pm.scaleHi[0] = scaleX pm.scaleHi[1] = scaleY @@ -41414,9 +41414,9 @@ function slerp (out, a, b, t) { module.exports = { - vertex: "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4(scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n", + vertex: "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4((posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n", fragment: "precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n", - pickVertex: "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4(scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n", + pickVertex: "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4((posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n", pickFragment: "precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n" } @@ -41577,8 +41577,8 @@ var proto = GLScatterFancy.prototype var scaleX = 2 * boundX / dataX var scaleY = 2 * boundY / dataY - var translateX = 2 * (bounds[0] - dataBox[0]) / dataX - 1 - var translateY = 2 * (bounds[1] - dataBox[1]) / dataY - 1 + var translateX = (bounds[0] - dataBox[0] - 0.5 * dataX) / boundX + var translateY = (bounds[1] - dataBox[1] - 0.5 * dataY) / boundY SCALE_HI[0] = scaleX SCALE_LO[0] = scaleX - SCALE_HI[0] @@ -41839,9 +41839,9 @@ function createFancyScatter2D(plot, options) { },{"./lib/shaders":200,"gl-buffer":128,"gl-shader":201,"text-cache":488,"typedarray-pool":496,"vectorize-text":509}],209:[function(require,module,exports){ -exports.pointVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute float weight;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pointSize, useWeight;\n\nvarying float fragWeight;\n\n\nvec4 pfx_1_0(vec2 scaleHi, vec2 scaleLo, vec2 translateHi, vec2 translateLo, vec2 positionHi, vec2 positionLo) {\n return vec4(scaleHi * positionHi + translateHi\n + scaleLo * positionHi + translateLo\n + scaleHi * positionLo\n + scaleLo * positionLo, 0.0, 1.0);\n}\n\nvoid main() {\n gl_Position = pfx_1_0(scaleHi, scaleLo, translateHi, translateLo, positionHi, positionLo);\n gl_PointSize = pointSize;\n fragWeight = mix(1.0, weight, useWeight);\n}" +exports.pointVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute float weight;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pointSize, useWeight;\n\nvarying float fragWeight;\n\n\nvec4 pfx_1_0(vec2 scaleHi, vec2 scaleLo, vec2 translateHi, vec2 translateLo, vec2 positionHi, vec2 positionLo) {\n return vec4((positionHi + translateHi) * scaleHi\n + (positionLo + translateLo) * scaleHi\n + (positionHi + translateHi) * scaleLo\n + (positionLo + translateLo) * scaleLo, 0.0, 1.0);\n}\n\nvoid main() {\n gl_Position = pfx_1_0(scaleHi, scaleLo, translateHi, translateLo, positionHi, positionLo);\n gl_PointSize = pointSize;\n fragWeight = mix(1.0, weight, useWeight);\n}" exports.pointFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color, borderColor;\nuniform float centerFraction;\n\nvarying float fragWeight;\n\nfloat smoothStep(float x, float y) {\n return 1.0 / (1.0 + exp(50.0*(x - y)));\n}\n\nvoid main() {\n float radius = length(2.0*gl_PointCoord.xy-1.0);\n if(radius > 1.0) {\n discard;\n }\n vec4 baseColor = mix(borderColor, color, smoothStep(radius, centerFraction));\n float alpha = 1.0 - pow(1.0 - baseColor.a, fragWeight);\n gl_FragColor = vec4(baseColor.rgb * alpha, alpha);\n}" -exports.pickVertex = "precision highp float;\n#define GLSLIFY 1\n\nvec4 pfx_1_0(vec2 scaleHi, vec2 scaleLo, vec2 translateHi, vec2 translateLo, vec2 positionHi, vec2 positionLo) {\n return vec4(scaleHi * positionHi + translateHi\n + scaleLo * positionHi + translateLo\n + scaleHi * positionLo\n + scaleLo * positionLo, 0.0, 1.0);\n}\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 pickId;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\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 gl_Position = pfx_1_0(scaleHi, scaleLo, translateHi, translateLo, positionHi, positionLo);\n gl_PointSize = pointSize;\n fragId = id;\n}" +exports.pickVertex = "precision highp float;\n#define GLSLIFY 1\n\nvec4 pfx_1_0(vec2 scaleHi, vec2 scaleLo, vec2 translateHi, vec2 translateLo, vec2 positionHi, vec2 positionLo) {\n return vec4((positionHi + translateHi) * scaleHi\n + (positionLo + translateLo) * scaleHi\n + (positionHi + translateHi) * scaleLo\n + (positionLo + translateLo) * scaleLo, 0.0, 1.0);\n}\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 pickId;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\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 gl_Position = pfx_1_0(scaleHi, scaleLo, translateHi, translateLo, positionHi, positionLo);\n gl_PointSize = pointSize;\n fragId = id;\n}" exports.pickFragment = "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}" },{}],210:[function(require,module,exports){ arguments[4][72][0].apply(exports,arguments) @@ -42418,8 +42418,8 @@ proto.draw = function(pickOffset) { scaleLo[0] = scaleX - scaleHi[0] scaleLo[1] = scaleY - scaleHi[1] - var translateX = 2 * (bounds[0] - dataBox[0]) / dataX - 1 - var translateY = 2 * (bounds[1] - dataBox[1]) / dataY - 1 + var translateX = (bounds[0] - dataBox[0] - 0.5 * dataX) / boundX + var translateY = (bounds[1] - dataBox[1] - 0.5 * dataY) / boundY translateHi[0] = translateX translateHi[1] = translateY @@ -42488,6 +42488,8 @@ proto.draw = function(pickOffset) { shader.uniforms.useWeight = 0 } } + + return pickOffset + this.pointCount } proto.drawPick = proto.draw @@ -80495,17 +80497,21 @@ function toPX(str, element) { return 1 } },{"parse-unit":433}],491:[function(require,module,exports){ +// https://github.com/topojson/topojson-client Version 2.1.0. Copyright 2016 Mike Bostock. (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.topojson = global.topojson || {}))); }(this, (function (exports) { 'use strict'; -function noop() {} +var identity = function(x) { + return x; +}; -function transformAbsolute(transform) { - if (!transform) return noop; - var x0, +var transform = function(topology) { + if ((transform = topology.transform) == null) return identity; + var transform, + x0, y0, kx = transform.scale[0], ky = transform.scale[1], @@ -80515,78 +80521,89 @@ function transformAbsolute(transform) { if (!i) x0 = y0 = 0; point[0] = (x0 += point[0]) * kx + dx; point[1] = (y0 += point[1]) * ky + dy; + return point; }; -} +}; -function transformRelative(transform) { - if (!transform) return noop; - var x0, - y0, - kx = transform.scale[0], - ky = transform.scale[1], - dx = transform.translate[0], - dy = transform.translate[1]; - return function(point, i) { - if (!i) x0 = y0 = 0; - var x1 = Math.round((point[0] - dx) / kx), - y1 = Math.round((point[1] - dy) / ky); - point[0] = x1 - x0; - point[1] = y1 - y0; - x0 = x1; - y0 = y1; - }; -} +var bbox = function(topology) { + var bbox = topology.bbox; -function reverse(array, n) { - var t, j = array.length, i = j - n; - while (i < --j) t = array[i], array[i++] = array[j], array[j] = t; -} + function bboxPoint(p0) { + p1[0] = p0[0], p1[1] = p0[1], t(p1); + if (p1[0] < x0) x0 = p1[0]; + if (p1[0] > x1) x1 = p1[0]; + if (p1[1] < y0) y0 = p1[1]; + if (p1[1] > y1) y1 = p1[1]; + } -function bisect(a, x) { - var lo = 0, hi = a.length; - while (lo < hi) { - var mid = lo + hi >>> 1; - if (a[mid] < x) lo = mid + 1; - else hi = mid; + function bboxGeometry(o) { + switch (o.type) { + case "GeometryCollection": o.geometries.forEach(bboxGeometry); break; + case "Point": bboxPoint(o.coordinates); break; + case "MultiPoint": o.coordinates.forEach(bboxPoint); break; + } } - return lo; -} -function feature(topology, o) { - return o.type === "GeometryCollection" ? { - type: "FeatureCollection", - features: o.geometries.map(function(o) { return feature$1(topology, o); }) - } : feature$1(topology, o); -} + if (!bbox) { + var t = transform(topology), p0, p1 = new Array(2), name, + x0 = Infinity, y0 = x0, x1 = -x0, y1 = -x0; + + topology.arcs.forEach(function(arc) { + var i = -1, n = arc.length; + while (++i < n) { + p0 = arc[i], p1[0] = p0[0], p1[1] = p0[1], t(p1, i); + if (p1[0] < x0) x0 = p1[0]; + if (p1[0] > x1) x1 = p1[0]; + if (p1[1] < y0) y0 = p1[1]; + if (p1[1] > y1) y1 = p1[1]; + } + }); + + for (name in topology.objects) { + bboxGeometry(topology.objects[name]); + } + + bbox = topology.bbox = [x0, y0, x1, y1]; + } + + return bbox; +}; + +var reverse = function(array, n) { + var t, j = array.length, i = j - n; + while (i < --j) t = array[i], array[i++] = array[j], array[j] = t; +}; + +var feature = function(topology, o) { + return o.type === "GeometryCollection" + ? {type: "FeatureCollection", features: o.geometries.map(function(o) { return feature$1(topology, o); })} + : feature$1(topology, o); +}; function feature$1(topology, o) { - var f = { - type: "Feature", - id: o.id, - properties: o.properties || {}, - geometry: object(topology, o) - }; - if (o.id == null) delete f.id; - return f; + var id = o.id, + bbox = o.bbox, + properties = o.properties == null ? {} : o.properties, + geometry = object(topology, o); + return id == null && bbox == null ? {type: "Feature", properties: properties, geometry: geometry} + : bbox == null ? {type: "Feature", id: id, properties: properties, geometry: geometry} + : {type: "Feature", id: id, bbox: bbox, properties: properties, geometry: geometry}; } function object(topology, o) { - var absolute = transformAbsolute(topology.transform), + var transformPoint = transform(topology), arcs = topology.arcs; function arc(i, points) { if (points.length) points.pop(); - for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) { - points.push(p = a[k].slice()); - absolute(p, k); + for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) { + points.push(transformPoint(a[k].slice(), k)); } if (i < 0) reverse(points, n); } function point(p) { - p = p.slice(); - absolute(p, 0); - return p; + return transformPoint(p.slice()); } function line(arcs) { @@ -80607,25 +80624,24 @@ function object(topology, o) { } function geometry(o) { - var t = o.type; - return t === "GeometryCollection" ? {type: t, geometries: o.geometries.map(geometry)} - : t in geometryType ? {type: t, coordinates: geometryType[t](o)} - : null; + var type = o.type, coordinates; + switch (type) { + case "GeometryCollection": return {type: type, geometries: o.geometries.map(geometry)}; + case "Point": coordinates = point(o.coordinates); break; + case "MultiPoint": coordinates = o.coordinates.map(point); break; + case "LineString": coordinates = line(o.arcs); break; + case "MultiLineString": coordinates = o.arcs.map(line); break; + case "Polygon": coordinates = polygon(o.arcs); break; + case "MultiPolygon": coordinates = o.arcs.map(polygon); break; + default: return null; + } + return {type: type, coordinates: coordinates}; } - var geometryType = { - Point: function(o) { return point(o.coordinates); }, - MultiPoint: function(o) { return o.coordinates.map(point); }, - LineString: function(o) { return line(o.arcs); }, - MultiLineString: function(o) { return o.arcs.map(line); }, - Polygon: function(o) { return polygon(o.arcs); }, - MultiPolygon: function(o) { return o.arcs.map(polygon); } - }; - return geometry(o); } -function stitchArcs(topology, arcs) { +var stitch = function(topology, arcs) { var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, @@ -80697,114 +80713,107 @@ function stitchArcs(topology, arcs) { arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); }); return fragments; -} +}; -function mesh(topology) { +var mesh = function(topology) { return object(topology, meshArcs.apply(this, arguments)); +}; + +function meshArcs(topology, object$$1, filter) { + var arcs, i, n; + if (arguments.length > 1) arcs = extractArcs(topology, object$$1, filter); + else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i; + return {type: "MultiLineString", arcs: stitch(topology, arcs)}; } -function meshArcs(topology, o, filter) { - var arcs = []; +function extractArcs(topology, object$$1, filter) { + var arcs = [], + geomsByArc = [], + geom; - function arc(i) { + function extract0(i) { var j = i < 0 ? ~i : i; (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom}); } - function line(arcs) { - arcs.forEach(arc); + function extract1(arcs) { + arcs.forEach(extract0); } - function polygon(arcs) { - arcs.forEach(line); + function extract2(arcs) { + arcs.forEach(extract1); } - function geometry(o) { - if (o.type === "GeometryCollection") o.geometries.forEach(geometry); - else if (o.type in geometryType) geom = o, geometryType[o.type](o.arcs); + function extract3(arcs) { + arcs.forEach(extract2); } - if (arguments.length > 1) { - var geomsByArc = [], - geom; - - var geometryType = { - LineString: line, - MultiLineString: polygon, - Polygon: polygon, - MultiPolygon: function(arcs) { arcs.forEach(polygon); } - }; - - geometry(o); - - geomsByArc.forEach(arguments.length < 3 - ? function(geoms) { arcs.push(geoms[0].i); } - : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); }); - } else { - for (var i = 0, n = topology.arcs.length; i < n; ++i) arcs.push(i); + function geometry(o) { + switch (geom = o, o.type) { + case "GeometryCollection": o.geometries.forEach(geometry); break; + case "LineString": extract1(o.arcs); break; + case "MultiLineString": case "Polygon": extract2(o.arcs); break; + case "MultiPolygon": extract3(o.arcs); break; + } } - return {type: "MultiLineString", arcs: stitchArcs(topology, arcs)}; -} - -function cartesianTriangleArea(triangle) { - var a = triangle[0], b = triangle[1], c = triangle[2]; - return Math.abs((a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1])); -} + geometry(object$$1); -function ring(ring) { - var i = -1, - n = ring.length, - a, - b = ring[n - 1], - area = 0; + geomsByArc.forEach(filter == null + ? function(geoms) { arcs.push(geoms[0].i); } + : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); }); - while (++i < n) { - a = b; - b = ring[i]; - area += a[0] * b[1] - a[1] * b[0]; - } + return arcs; +} - return area / 2; +function planarRingArea(ring) { + var i = -1, n = ring.length, a, b = ring[n - 1], area = 0; + while (++i < n) a = b, b = ring[i], area += a[0] * b[1] - a[1] * b[0]; + return Math.abs(area); // Note: doubled area! } -function merge(topology) { +var merge = function(topology) { return object(topology, mergeArcs.apply(this, arguments)); -} +}; function mergeArcs(topology, objects) { var polygonsByArc = {}, polygons = [], - components = []; + groups = []; - objects.forEach(function(o) { - if (o.type === "Polygon") register(o.arcs); - else if (o.type === "MultiPolygon") o.arcs.forEach(register); - }); + objects.forEach(geometry); + + function geometry(o) { + switch (o.type) { + case "GeometryCollection": o.geometries.forEach(geometry); break; + case "Polygon": extract(o.arcs); break; + case "MultiPolygon": o.arcs.forEach(extract); break; + } + } - function register(polygon) { - polygon.forEach(function(ring$$) { - ring$$.forEach(function(arc) { + function extract(polygon) { + polygon.forEach(function(ring) { + ring.forEach(function(arc) { (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon); }); }); polygons.push(polygon); } - function area(ring$$) { - return Math.abs(ring(object(topology, {type: "Polygon", arcs: [ring$$]}).coordinates[0])); + function area(ring) { + return planarRingArea(object(topology, {type: "Polygon", arcs: [ring]}).coordinates[0]); } polygons.forEach(function(polygon) { if (!polygon._) { - var component = [], + var group = [], neighbors = [polygon]; polygon._ = 1; - components.push(component); + groups.push(group); while (polygon = neighbors.pop()) { - component.push(polygon); - polygon.forEach(function(ring$$) { - ring$$.forEach(function(arc) { + group.push(polygon); + polygon.forEach(function(ring) { + ring.forEach(function(arc) { polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) { if (!polygon._) { polygon._ = 1; @@ -80823,13 +80832,13 @@ function mergeArcs(topology, objects) { return { type: "MultiPolygon", - arcs: components.map(function(polygons) { + arcs: groups.map(function(polygons) { var arcs = [], n; // Extract the exterior (unique) arcs. polygons.forEach(function(polygon) { - polygon.forEach(function(ring$$) { - ring$$.forEach(function(arc) { + polygon.forEach(function(ring) { + ring.forEach(function(arc) { if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) { arcs.push(arc); } @@ -80838,7 +80847,7 @@ function mergeArcs(topology, objects) { }); // Stitch the arcs into one or more rings. - arcs = stitchArcs(topology, arcs); + arcs = stitch(topology, arcs); // If more than one ring is returned, // at most one of these rings can be the exterior; @@ -80856,7 +80865,17 @@ function mergeArcs(topology, objects) { }; } -function neighbors(objects) { +var bisect = function(a, x) { + var lo = 0, hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (a[mid] < x) lo = mid + 1; + else hi = mid; + } + return lo; +}; + +var neighbors = function(objects) { var indexesByArc = {}, // arc index -> array of object indexes neighbors = objects.map(function() { return []; }); @@ -80898,150 +80917,105 @@ function neighbors(objects) { } return neighbors; -} - -function compareArea(a, b) { - return a[1][2] - b[1][2]; -} - -function minAreaHeap() { - var heap = {}, - array = [], - size = 0; - - heap.push = function(object) { - up(array[object._ = size] = object, size++); - return size; - }; - - heap.pop = function() { - if (size <= 0) return; - var removed = array[0], object; - if (--size > 0) object = array[size], down(array[object._ = 0] = object, 0); - return removed; - }; +}; - heap.remove = function(removed) { - var i = removed._, object; - if (array[i] !== removed) return; // invalid request - if (i !== --size) object = array[size], (compareArea(object, removed) < 0 ? up : down)(array[object._ = i] = object, i); - return i; - }; +var quantize = function(topology, n) { + if (!((n = Math.floor(n)) >= 2)) throw new Error("n must be ≥2"); + if (topology.transform) throw new Error("already quantized"); + var bb = bbox(topology), name, + dx = bb[0], kx = (bb[2] - dx) / (n - 1) || 1, + dy = bb[1], ky = (bb[3] - dy) / (n - 1) || 1; - function up(object, i) { - while (i > 0) { - var j = ((i + 1) >> 1) - 1, - parent = array[j]; - if (compareArea(object, parent) >= 0) break; - array[parent._ = i] = parent; - array[object._ = i = j] = object; - } + function quantizePoint(p) { + p[0] = Math.round((p[0] - dx) / kx); + p[1] = Math.round((p[1] - dy) / ky); } - function down(object, i) { - while (true) { - var r = (i + 1) << 1, - l = r - 1, - j = i, - child = array[j]; - if (l < size && compareArea(array[l], child) < 0) child = array[j = l]; - if (r < size && compareArea(array[r], child) < 0) child = array[j = r]; - if (j === i) break; - array[child._ = i] = child; - array[object._ = i = j] = object; + function quantizeGeometry(o) { + switch (o.type) { + case "GeometryCollection": o.geometries.forEach(quantizeGeometry); break; + case "Point": quantizePoint(o.coordinates); break; + case "MultiPoint": o.coordinates.forEach(quantizePoint); break; } } - return heap; -} - -function presimplify(topology, triangleArea) { - var absolute = transformAbsolute(topology.transform), - relative = transformRelative(topology.transform), - heap = minAreaHeap(); - - if (!triangleArea) triangleArea = cartesianTriangleArea; - topology.arcs.forEach(function(arc) { - var triangles = [], - maxArea = 0, - triangle, - i, - n, - p; - - // To store each point’s effective area, we create a new array rather than - // extending the passed-in point to workaround a Chrome/V8 bug (getting - // stuck in smi mode). For midpoints, the initial effective area of - // Infinity will be computed in the next step. - for (i = 0, n = arc.length; i < n; ++i) { - p = arc[i]; - absolute(arc[i] = [p[0], p[1], Infinity], i); - } - - for (i = 1, n = arc.length - 1; i < n; ++i) { - triangle = arc.slice(i - 1, i + 2); - triangle[1][2] = triangleArea(triangle); - triangles.push(triangle); - heap.push(triangle); - } - - for (i = 0, n = triangles.length; i < n; ++i) { - triangle = triangles[i]; - triangle.previous = triangles[i - 1]; - triangle.next = triangles[i + 1]; - } - - while (triangle = heap.pop()) { - var previous = triangle.previous, - next = triangle.next; - - // If the area of the current point is less than that of the previous point - // to be eliminated, use the latter's area instead. This ensures that the - // current point cannot be eliminated without eliminating previously- - // eliminated points. - if (triangle[1][2] < maxArea) triangle[1][2] = maxArea; - else maxArea = triangle[1][2]; - - if (previous) { - previous.next = next; - previous[2] = triangle[2]; - update(previous); - } - - if (next) { - next.previous = previous; - next[0] = triangle[0]; - update(next); - } - } - - arc.forEach(relative); + var i = 1, + j = 1, + n = arc.length, + pi = arc[0], + x0 = pi[0] = Math.round((pi[0] - dx) / kx), + y0 = pi[1] = Math.round((pi[1] - dy) / ky), + pj, + x1, + y1; + + for (; i < n; ++i) { + pi = arc[i]; + x1 = Math.round((pi[0] - dx) / kx); + y1 = Math.round((pi[1] - dy) / ky); + if (x1 !== x0 || y1 !== y0) { + pj = arc[j++]; + pj[0] = x1 - x0, x0 = x1; + pj[1] = y1 - y0, y0 = y1; + } + } + + if (j < 2) { + pj = arc[j++]; + pj[0] = 0; + pj[1] = 0; + } + + arc.length = j; }); - function update(triangle) { - heap.remove(triangle); - triangle[1][2] = triangleArea(triangle); - heap.push(triangle); + for (name in topology.objects) { + quantizeGeometry(topology.objects[name]); } + topology.transform = { + scale: [kx, ky], + translate: [dx, dy] + }; + return topology; -} +}; -var version = "1.6.27"; +var untransform = function(topology) { + if ((transform = topology.transform) == null) return identity; + var transform, + x0, + y0, + kx = transform.scale[0], + ky = transform.scale[1], + dx = transform.translate[0], + dy = transform.translate[1]; + return function(point, i) { + if (!i) x0 = y0 = 0; + var x1 = Math.round((point[0] - dx) / kx), + y1 = Math.round((point[1] - dy) / ky); + point[0] = x1 - x0, x0 = x1; + point[1] = y1 - y0, y0 = y1; + return point; + }; +}; -exports.version = version; +exports.bbox = bbox; +exports.feature = feature; exports.mesh = mesh; exports.meshArcs = meshArcs; exports.merge = merge; exports.mergeArcs = mergeArcs; -exports.feature = feature; exports.neighbors = neighbors; -exports.presimplify = presimplify; +exports.quantize = quantize; +exports.transform = transform; +exports.untransform = untransform; Object.defineProperty(exports, '__esModule', { value: true }); }))); + },{}],492:[function(require,module,exports){ "use strict" @@ -85431,13 +85405,18 @@ var Axes = require('../../plots/cartesian/axes'); var attributes = require('./attributes'); -module.exports = function handleAnnotationDefaults(annIn, fullLayout) { - var annOut = {}; +module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, opts, itemOpts) { + opts = opts || {}; + itemOpts = itemOpts || {}; function coerce(attr, dflt) { return Lib.coerce(annIn, annOut, attributes, attr, dflt); } + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + + if(!visible) return annOut; + coerce('opacity'); coerce('align'); coerce('bgcolor'); @@ -85450,74 +85429,61 @@ module.exports = function handleAnnotationDefaults(annIn, fullLayout) { var borderWidth = coerce('borderwidth'); var showArrow = coerce('showarrow'); - if(showArrow) { - coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); - coerce('arrowhead'); - coerce('arrowsize'); - coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); - coerce('ax'); - coerce('ay'); - coerce('axref'); - coerce('ayref'); - - // if you have one part of arrow length you should have both - Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); - } - coerce('text', showArrow ? ' ' : 'new text'); coerce('textangle'); Lib.coerceFont(coerce, 'font', fullLayout.font); // positioning - var axLetters = ['x', 'y']; + var axLetters = ['x', 'y'], + arrowPosDflt = [-10, -30], + gdMock = {_fullLayout: fullLayout}; for(var i = 0; i < 2; i++) { - var axLetter = axLetters[i], - tdMock = {_fullLayout: fullLayout}; + var axLetter = axLetters[i]; // xref, yref - var axRef = Axes.coerceRef(annIn, annOut, tdMock, axLetter); - - // TODO: should be refactored in conjunction with Axes axref, ayref - var aaxRef = Axes.coerceARef(annIn, annOut, tdMock, axLetter); + var axRef = Axes.coerceRef(annIn, annOut, gdMock, axLetter, '', 'paper'); // x, y - var defaultPosition = 0.5; - if(axRef !== 'paper') { - var ax = Axes.getFromId(tdMock, axRef); - defaultPosition = ax.range[0] + defaultPosition * (ax.range[1] - ax.range[0]); - - // convert date or category strings to numbers - if(['date', 'category'].indexOf(ax.type) !== -1 && - typeof annIn[axLetter] === 'string') { - var newval; - if(ax.type === 'date') { - newval = Lib.dateTime2ms(annIn[axLetter]); - if(newval !== false) annIn[axLetter] = newval; - - if(aaxRef === axRef) { - var newvalB = Lib.dateTime2ms(annIn['a' + axLetter]); - if(newvalB !== false) annIn['a' + axLetter] = newvalB; - } - } - else if((ax._categories || []).length) { - newval = ax._categories.indexOf(annIn[axLetter]); - if(newval !== -1) annIn[axLetter] = newval; - } + Axes.coercePosition(annOut, gdMock, coerce, axRef, axLetter, 0.5); + + if(showArrow) { + var arrowPosAttr = 'a' + axLetter, + // axref, ayref + aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + + // for now the arrow can only be on the same axis or specified as pixels + // TODO: sometime it might be interesting to allow it to be on *any* axis + // but that would require updates to drawing & autorange code and maybe more + if(aaxRef !== 'pixel' && aaxRef !== axRef) { + aaxRef = annOut[arrowPosAttr] = 'pixel'; } + + // ax, ay + var aDflt = (aaxRef === 'pixel') ? arrowPosDflt[i] : 0.4; + Axes.coercePosition(annOut, gdMock, coerce, aaxRef, arrowPosAttr, aDflt); } - coerce(axLetter, defaultPosition); // xanchor, yanchor - if(!showArrow) coerce(axLetter + 'anchor'); + else coerce(axLetter + 'anchor'); } // if you have one coordinate you should have both Lib.noneOrAll(annIn, annOut, ['x', 'y']); + if(showArrow) { + coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); + coerce('arrowhead'); + coerce('arrowsize'); + coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); + + // if you have one part of arrow length you should have both + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); + } + return annOut; }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"../color":533,"./attributes":526}],525:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"../color":533,"./attributes":526}],525:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85597,7 +85563,14 @@ var extendFlat = require('../../lib/extend').extendFlat; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'annotation', + + visible: { + valType: 'boolean', + + dflt: true, + + }, text: { valType: 'string', @@ -85688,14 +85661,12 @@ module.exports = { }, ax: { - valType: 'number', - dflt: -10, + valType: 'any', }, ay: { - valType: 'number', - dflt: -30, + valType: 'any', }, @@ -85730,7 +85701,7 @@ module.exports = { }, x: { - valType: 'number', + valType: 'any', }, @@ -85751,7 +85722,7 @@ module.exports = { }, y: { - valType: 'number', + valType: 'any', }, @@ -85772,7 +85743,7 @@ module.exports = { } }; -},{"../../lib/extend":625,"../../plots/cartesian/constants":668,"../../plots/font_attributes":683,"./arrow_paths":525}],527:[function(require,module,exports){ +},{"../../lib/extend":626,"../../plots/cartesian/constants":669,"../../plots/font_attributes":684,"./arrow_paths":525}],527:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85792,7 +85763,7 @@ var draw = require('./draw').draw; module.exports = function calcAutorange(gd) { var fullLayout = gd._fullLayout, - annotationList = fullLayout.annotations; + annotationList = Lib.filterVisible(fullLayout.annotations); if(!annotationList.length || !gd._fullData.length) return; @@ -85844,14 +85815,14 @@ function annAutorange(gd) { } if(xa && xa.autorange) { - Axes.expand(xa, [xa.l2c(ann.x)], { + Axes.expand(xa, [xa.l2c(xa.r2l(ann.x))], { ppadplus: rightSize, ppadminus: leftSize }); } if(ya && ya.autorange) { - Axes.expand(ya, [ya.l2c(ann.y)], { + Axes.expand(ya, [ya.l2c(ya.r2l(ann.y))], { ppadplus: bottomSize, ppadminus: topSize }); @@ -85859,7 +85830,7 @@ function annAutorange(gd) { }); } -},{"../../lib":632,"../../plots/cartesian/axes":662,"./draw":529}],528:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"./draw":529}],528:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85871,22 +85842,20 @@ function annAutorange(gd) { 'use strict'; +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var handleAnnotationDefaults = require('./annotation_defaults'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - var containerIn = layoutIn.annotations || [], - containerOut = layoutOut.annotations = []; - - for(var i = 0; i < containerIn.length; i++) { - var annIn = containerIn[i] || {}, - annOut = handleAnnotationDefaults(annIn, layoutOut); + var opts = { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults + }; - containerOut.push(annOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"./annotation_defaults":524}],529:[function(require,module,exports){ +},{"../../plots/array_container_defaults":661,"./annotation_defaults":524}],529:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -85936,7 +85905,9 @@ function draw(gd) { fullLayout._infolayer.selectAll('.annotation').remove(); for(var i = 0; i < fullLayout.annotations.length; i++) { - drawOne(gd, i); + if(fullLayout.annotations[i].visible) { + drawOne(gd, i); + } } return Plots.previousPromises(gd); @@ -86029,8 +86000,6 @@ function drawOne(gd, index, opt, value) { // where we fail here when they add/remove annotations if(!optionsIn) return; - var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; - // alter the input annotation as requested var optionsEdit = {}; if(typeof opt === 'string' && opt) optionsEdit[opt] = value; @@ -86042,7 +86011,11 @@ function drawOne(gd, index, opt, value) { Lib.nestedProperty(optionsIn, k).set(optionsEdit[k]); } + // return early in visible: false updates + if(optionsIn.visible === false) return; + var gs = fullLayout._size; + var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; var axLetters = ['x', 'y']; for(i = 0; i < 2; i++) { @@ -86057,12 +86030,19 @@ function drawOne(gd, index, opt, value) { continue; } - var axOld = Axes.getFromId(gd, Axes.coerceRef(oldRef, {}, gd, axLetter)), - axNew = Axes.getFromId(gd, Axes.coerceRef(optionsIn, {}, gd, axLetter)), + var axOld = Axes.getFromId(gd, Axes.coerceRef(oldRef, {}, gd, axLetter, '', 'paper')), + axNew = Axes.getFromId(gd, Axes.coerceRef(optionsIn, {}, gd, axLetter, '', 'paper')), position = optionsIn[axLetter], axTypeOld = oldPrivate['_' + axLetter + 'type']; if(optionsEdit[axLetter + 'ref'] !== undefined) { + + // TODO: include ax / ay / axref / ayref here if not 'pixel' + // or even better, move all of this machinery out of here and into + // streambed as extra attributes to a regular relayout call + // we should do this after v2.0 when it can work equivalently for + // annotations, shapes, and images. + var autoAnchor = optionsIn[axLetter + 'anchor'] === 'auto', plotSize = (axLetter === 'x' ? gs.w : gs.h), halfSizeFrac = (oldPrivate['_' + axLetter + 'size'] || 0) / @@ -86071,18 +86051,11 @@ function drawOne(gd, index, opt, value) { // go to the same fraction of the axis length // whether or not these axes share a domain - // first convert to fraction of the axis - position = (position - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); - - // then convert to new data coordinates at the same fraction - position = axNew.range[0] + - position * (axNew.range[1] - axNew.range[0]); + position = axNew.fraction2r(axOld.r2fraction(position)); } else if(axOld) { // data -> paper // first convert to fraction of the axis - position = (position - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + position = axOld.r2fraction(position); // next scale the axis to the whole plot position = axOld.domain[0] + @@ -86110,8 +86083,7 @@ function drawOne(gd, index, opt, value) { (axNew.domain[1] - axNew.domain[0]); // finally convert to data coordinates - position = axNew.range[0] + - position * (axNew.range[1] - axNew.range[0]); + position = axNew.fraction2r(position); } } @@ -86128,7 +86100,8 @@ function drawOne(gd, index, opt, value) { optionsIn[axLetter] = position; } - var options = handleAnnotationDefaults(optionsIn, fullLayout); + var options = {}; + handleAnnotationDefaults(optionsIn, options, fullLayout); fullLayout.annotations[index] = options; var xa = Axes.getFromId(gd, options.xref), @@ -86242,20 +86215,21 @@ function drawOne(gd, index, opt, value) { // outside the visible plot (as long as the axis // isn't autoranged - then we need to draw it // anyway to get its bounding box) - if(!ax.autorange && ((options[axLetter] - ax.range[0]) * - (options[axLetter] - ax.range[1]) > 0)) { + var posFraction = ax.r2fraction(options[axLetter]); + if(!ax.autorange && (posFraction < 0 || posFraction > 1)) { if(options['a' + axLetter + 'ref'] === axRef) { - if((options['a' + axLetter] - ax.range[0]) * - (options['a' + axLetter] - ax.range[1]) > 0) { + posFraction = ax.r2fraction(options['a' + axLetter]); + if(posFraction < 0 || posFraction > 1) { annotationIsOffscreen = true; } - } else { + } + else { annotationIsOffscreen = true; } if(annotationIsOffscreen) return; } - annPosPx[axLetter] = ax._offset + ax.l2p(options[axLetter]); + annPosPx[axLetter] = ax._offset + ax.r2p(options[axLetter]); alignPosition = 0.5; } else { @@ -86268,7 +86242,7 @@ function drawOne(gd, index, opt, value) { var alignShift = 0; if(options['a' + axLetter + 'ref'] === axRef) { - annPosPx['aa' + axLetter] = ax._offset + ax.l2p(options['a' + axLetter]); + annPosPx['aa' + axLetter] = ax._offset + ax.r2p(options['a' + axLetter]); } else { if(options.showarrow) { alignShift = options['a' + axLetter]; @@ -86468,22 +86442,22 @@ function drawOne(gd, index, opt, value) { ann.call(Lib.setTranslate, xcenter, ycenter); update[annbase + '.x'] = xa ? - (options.x + dx / xa._m) : + xa.p2r(xa.r2p(options.x) + dx) : ((arrowX + dx - gs.l) / gs.w); update[annbase + '.y'] = ya ? - (options.y + dy / ya._m) : + ya.p2r(ya.r2p(options.y) + dy) : (1 - ((arrowY + dy - gs.t) / gs.h)); if(options.axref === options.xref) { update[annbase + '.ax'] = xa ? - (options.ax + dx / xa._m) : - ((arrowX + dx - gs.l) / gs.w); + xa.p2r(xa.r2p(options.ax) + dx) : + ((arrowX + dx - gs.l) / gs.w); } if(options.ayref === options.yref) { update[annbase + '.ay'] = ya ? - (options.ay + dy / ya._m) : - (1 - ((arrowY + dy - gs.t) / gs.h)); + ya.p2r(ya.r2p(options.ay) + dy) : + (1 - ((arrowY + dy - gs.t) / gs.h)); } anng.attr({ @@ -86529,13 +86503,13 @@ function drawOne(gd, index, opt, value) { var csr = 'pointer'; if(options.showarrow) { if(options.axref === options.xref) { - update[annbase + '.ax'] = xa.p2l(xa.l2p(options.ax) + dx); + update[annbase + '.ax'] = xa.p2r(xa.r2p(options.ax) + dx); } else { update[annbase + '.ax'] = options.ax + dx; } if(options.ayref === options.yref) { - update[annbase + '.ay'] = ya.p2l(ya.l2p(options.ay) + dy); + update[annbase + '.ay'] = ya.p2r(ya.r2p(options.ay) + dy); } else { update[annbase + '.ay'] = options.ay + dy; } @@ -86641,7 +86615,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":632,"../../lib/setcursor":642,"../../lib/svg_text_utils":646,"../../plotly":658,"../../plots/cartesian/axes":662,"../../plots/plots":723,"../color":533,"../dragelement":555,"../drawing":557,"./annotation_defaults":524,"./defaults":528,"./draw_arrow_head":530,"d3":95,"fast-isnumeric":104}],530:[function(require,module,exports){ +},{"../../lib":633,"../../lib/setcursor":643,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/cartesian/axes":664,"../../plots/plots":724,"../color":533,"../dragelement":554,"../drawing":556,"./annotation_defaults":524,"./defaults":528,"./draw_arrow_head":530,"d3":95,"fast-isnumeric":104}],530:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86760,7 +86734,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { if(doEnd) drawhead(end, endRot); }; -},{"../color":533,"../drawing":557,"./arrow_paths":525,"d3":95,"fast-isnumeric":104}],531:[function(require,module,exports){ +},{"../color":533,"../drawing":556,"./arrow_paths":525,"d3":95,"fast-isnumeric":104}],531:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -86772,33 +86746,21 @@ module.exports = function drawArrowHead(el3, style, ends, mag) { 'use strict'; -var Plotly = require('../../plotly'); - -exports.moduleType = 'component'; - -exports.name = 'annotations'; - -exports.ARROWPATHS = require('./arrow_paths'); - -exports.layoutAttributes = require('./attributes'); - -exports.supplyLayoutDefaults = require('./defaults'); - -exports.calcAutorange = require('./calc_autorange'); - -exports.arrowhead = require('./draw_arrow_head'); - var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; -exports.add = function(gd) { - var nextAnn = gd._fullLayout.annotations.length; +module.exports = { + moduleType: 'component', + name: 'annotations', + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), - Plotly.relayout(gd, 'annotations[' + nextAnn + ']', 'add'); + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne }; -},{"../../plotly":658,"./arrow_paths":525,"./attributes":526,"./calc_autorange":527,"./defaults":528,"./draw":529,"./draw_arrow_head":530}],532:[function(require,module,exports){ +},{"./attributes":526,"./calc_autorange":527,"./defaults":528,"./draw":529}],532:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87151,7 +87113,7 @@ module.exports = { } }; -},{"../../lib/extend":625,"../../plots/cartesian/layout_attributes":672,"../../plots/font_attributes":683}],535:[function(require,module,exports){ +},{"../../lib/extend":626,"../../plots/cartesian/layout_attributes":673,"../../plots/font_attributes":684}],535:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87218,7 +87180,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":632,"../../plots/cartesian/tick_label_defaults":678,"../../plots/cartesian/tick_mark_defaults":679,"../../plots/cartesian/tick_value_defaults":680,"./attributes":534}],536:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/tick_label_defaults":679,"../../plots/cartesian/tick_mark_defaults":680,"../../plots/cartesian/tick_value_defaults":681,"./attributes":534}],536:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87850,7 +87812,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":632,"../../lib/extend":625,"../../lib/setcursor":642,"../../plotly":658,"../../plots/cartesian/axes":662,"../../plots/cartesian/axis_defaults":664,"../../plots/cartesian/layout_attributes":672,"../../plots/cartesian/position_defaults":675,"../../plots/plots":723,"../../registry":738,"../color":533,"../dragelement":555,"../drawing":557,"../titles":608,"./attributes":534,"d3":95,"tinycolor2":489}],537:[function(require,module,exports){ +},{"../../lib":633,"../../lib/extend":626,"../../lib/setcursor":643,"../../plotly":659,"../../plots/cartesian/axes":664,"../../plots/cartesian/axis_defaults":666,"../../plots/cartesian/layout_attributes":673,"../../plots/cartesian/position_defaults":676,"../../plots/plots":724,"../../registry":739,"../color":533,"../dragelement":554,"../drawing":556,"../titles":607,"./attributes":534,"d3":95,"tinycolor2":489}],537:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87869,28 +87831,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":632}],538:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -exports.attributes = require('./attributes'); - -exports.supplyDefaults = require('./defaults'); - -exports.draw = require('./draw'); - -exports.hasColorbar = require('./has_colorbar'); - -},{"./attributes":534,"./defaults":535,"./draw":536,"./has_colorbar":537}],539:[function(require,module,exports){ +},{"../../lib":633}],538:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -87945,7 +87886,7 @@ module.exports = { } }; -},{}],540:[function(require,module,exports){ +},{}],539:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88011,7 +87952,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":632,"./flip_scale":545,"./scales":552}],541:[function(require,module,exports){ +},{"../../lib":633,"./flip_scale":544,"./scales":551}],540:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88055,7 +87996,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":625,"./attributes":539,"./scales.js":552}],542:[function(require,module,exports){ +},{"../../lib/extend":626,"./attributes":538,"./scales.js":551}],541:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88071,7 +88012,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":552}],543:[function(require,module,exports){ +},{"./scales":551}],542:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88135,7 +88076,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":632,"../colorbar/defaults":535,"../colorbar/has_colorbar":537,"./flip_scale":545,"./is_valid_scale":549,"fast-isnumeric":104}],544:[function(require,module,exports){ +},{"../../lib":633,"../colorbar/defaults":535,"../colorbar/has_colorbar":537,"./flip_scale":544,"./is_valid_scale":548,"fast-isnumeric":104}],543:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88172,7 +88113,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],545:[function(require,module,exports){ +},{}],544:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88197,7 +88138,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],546:[function(require,module,exports){ +},{}],545:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88237,7 +88178,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":542,"./is_valid_scale_array":550,"./scales":552}],547:[function(require,module,exports){ +},{"./default_scale":541,"./is_valid_scale_array":549,"./scales":551}],546:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88283,7 +88224,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":632,"./is_valid_scale":549,"fast-isnumeric":104}],548:[function(require,module,exports){ +},{"../../lib":633,"./is_valid_scale":548,"fast-isnumeric":104}],547:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88317,7 +88258,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":539,"./calc":540,"./default_scale":542,"./defaults":543,"./extract_scale":544,"./flip_scale":545,"./get_scale":546,"./has_colorscale":547,"./is_valid_scale":549,"./make_color_scale_func":551,"./scales":552}],549:[function(require,module,exports){ +},{"./attributes":538,"./calc":539,"./default_scale":541,"./defaults":542,"./extract_scale":543,"./flip_scale":544,"./get_scale":545,"./has_colorscale":546,"./is_valid_scale":548,"./make_color_scale_func":550,"./scales":551}],548:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88338,7 +88279,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":550,"./scales":552}],550:[function(require,module,exports){ +},{"./is_valid_scale_array":549,"./scales":551}],549:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88375,7 +88316,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":489}],551:[function(require,module,exports){ +},{"tinycolor2":489}],550:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88471,7 +88412,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":533,"d3":95,"fast-isnumeric":104,"tinycolor2":489}],552:[function(require,module,exports){ +},{"../color":533,"d3":95,"fast-isnumeric":104,"tinycolor2":489}],551:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88602,7 +88543,7 @@ module.exports = { ] }; -},{}],553:[function(require,module,exports){ +},{}],552:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88635,7 +88576,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],554:[function(require,module,exports){ +},{}],553:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88673,7 +88614,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":632}],555:[function(require,module,exports){ +},{"../../lib":633}],554:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88860,7 +88801,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../lib":632,"../../plotly":658,"../../plots/cartesian/constants":668,"./align":553,"./cursor":554,"./unhover":556}],556:[function(require,module,exports){ +},{"../../lib":633,"../../plotly":659,"../../plots/cartesian/constants":669,"./align":552,"./cursor":553,"./unhover":555}],555:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88911,7 +88852,7 @@ unhover.raw = function unhoverRaw(gd, evt) { gd._hoverdata = undefined; }; -},{"../../lib/events":624}],557:[function(require,module,exports){ +},{"../../lib/events":625}],556:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -88989,14 +88930,14 @@ drawing.getPx = function(s, styleAttr) { return Number(s.style(styleAttr).replace(/px$/, '')); }; -drawing.crispRound = function(td, lineWidth, dflt) { +drawing.crispRound = function(gd, lineWidth, dflt) { // for lines that disable antialiasing we want to // make sure the width is an integer, and at least 1 if it's nonzero if(!lineWidth || !isNumeric(lineWidth)) return dflt || 0; // but not for static plots - these don't get antialiased anyway. - if(td._context.staticPlot) return lineWidth; + if(gd._context.staticPlot) return lineWidth; if(lineWidth < 1) return 1; return Math.round(lineWidth); @@ -89190,9 +89131,8 @@ drawing.singlePointStyle = function(d, sel, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); singlePointStyle(d, sel, trace, markerScale, lineScale, marker, markerLine); @@ -89204,50 +89144,22 @@ drawing.pointStyle = function(s, trace) { // allow array marker and marker line colors to be // scaled by given max and min to colorscales var marker = trace.marker; - var markerIn = (trace._input || {}).marker || {}, - markerScale = drawing.tryColorscale(marker, markerIn, ''), - lineScale = drawing.tryColorscale(marker, markerIn, 'line.'); + var markerScale = drawing.tryColorscale(marker, ''), + lineScale = drawing.tryColorscale(marker, 'line'); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale); }); }; -// for a given color attribute (ie m -> mc = marker.color) look to see if we -// have a colorscale for it (ie mscl, mcmin, mcmax) - if we do, translate -// all numeric color values according to that scale -drawing.tryColorscale = function(cont, contIn, prefix) { - var colorArray = Lib.nestedProperty(cont, prefix + 'color').get(), - scl = Lib.nestedProperty(cont, prefix + 'colorscale').get(), - auto = Lib.nestedProperty(cont, prefix + 'cauto').get(), - minProp = Lib.nestedProperty(cont, prefix + 'cmin'), - maxProp = Lib.nestedProperty(cont, prefix + 'cmax'), - min = minProp.get(), - max = maxProp.get(); +drawing.tryColorscale = function(marker, prefix) { + var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker, + scl = cont.colorscale, + colorArray = cont.color; - // TODO handle this in Colorscale.calc if(scl && Array.isArray(colorArray)) { - if(auto || !isNumeric(min) || !isNumeric(max)) { - min = Infinity; - max = -Infinity; - colorArray.forEach(function(color) { - if(isNumeric(color)) { - if(min > color) min = +color; - if(max < color) max = +color; - } - }); - if(min > max) { - min = 0; - max = 1; - } - minProp.set(min); - maxProp.set(max); - Lib.nestedProperty(contIn, prefix + 'cmin').set(min); - Lib.nestedProperty(contIn, prefix + 'cmax').set(max); - } - return Colorscale.makeColorScaleFunc( - Colorscale.extractScale(scl, min, max) + Colorscale.extractScale(scl, cont.cmin, cont.cmax) ); } else return Lib.identity; @@ -89515,7 +89427,7 @@ drawing.setClipUrl = function(s, localId) { s.attr('clip-path', 'url(' + url + ')'); }; -},{"../../constants/xmlns_namespaces":618,"../../lib":632,"../../lib/svg_text_utils":646,"../../registry":738,"../../traces/scatter/make_bubble_size_func":859,"../../traces/scatter/subtypes":864,"../color":533,"../colorscale":548,"./symbol_defs":558,"d3":95,"fast-isnumeric":104}],558:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":618,"../../lib":633,"../../lib/svg_text_utils":647,"../../registry":739,"../../traces/scatter/make_bubble_size_func":861,"../../traces/scatter/subtypes":866,"../color":533,"../colorscale":547,"./symbol_defs":557,"d3":95,"fast-isnumeric":104}],557:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -89991,7 +89903,7 @@ module.exports = { } }; -},{"d3":95}],559:[function(require,module,exports){ +},{"d3":95}],558:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90090,7 +90002,7 @@ module.exports = { } }; -},{}],560:[function(require,module,exports){ +},{}],559:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90153,7 +90065,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":662,"../../registry":738,"./compute_error":561,"fast-isnumeric":104}],561:[function(require,module,exports){ +},{"../../plots/cartesian/axes":664,"../../registry":739,"./compute_error":560,"fast-isnumeric":104}],560:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90249,7 +90161,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],562:[function(require,module,exports){ +},{}],561:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90326,7 +90238,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":632,"../../registry":738,"./attributes":559,"fast-isnumeric":104}],563:[function(require,module,exports){ +},{"../../lib":633,"../../registry":739,"./attributes":558,"fast-isnumeric":104}],562:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90385,7 +90297,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":559,"./calc":560,"./defaults":562,"./plot":564,"./style":565}],564:[function(require,module,exports){ +},{"./attributes":558,"./calc":559,"./defaults":561,"./plot":563,"./style":564}],563:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90549,7 +90461,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":864,"d3":95,"fast-isnumeric":104}],565:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":866,"d3":95,"fast-isnumeric":104}],564:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90586,7 +90498,7 @@ module.exports = function style(traces) { }); }; -},{"../color":533,"d3":95}],566:[function(require,module,exports){ +},{"../color":533,"d3":95}],565:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90601,7 +90513,14 @@ var cartesianConstants = require('../../plots/cartesian/constants'); module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'image', + + visible: { + valType: 'boolean', + + dflt: true, + + }, source: { valType: 'string', @@ -90649,14 +90568,14 @@ module.exports = { }, x: { - valType: 'number', + valType: 'any', dflt: 0, }, y: { - valType: 'number', + valType: 'any', dflt: 0, @@ -90701,7 +90620,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":668}],567:[function(require,module,exports){ +},{"../../plots/cartesian/constants":669}],566:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90712,40 +90631,34 @@ module.exports = { 'use strict'; -var Axes = require('../../plots/cartesian/axes'); var Lib = require('../../lib'); -var attributes = require('./attributes'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var attributes = require('./attributes'); +var name = 'images'; module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { + var opts = { + name: name, + handleItemDefaults: imageDefaults + }; - if(!layoutIn.images || !Array.isArray(layoutIn.images)) return; - - - var containerIn = layoutIn.images, - containerOut = layoutOut.images = []; - - - for(var i = 0; i < containerIn.length; i++) { - var image = containerIn[i]; - - if(!image.source) continue; - - var defaulted = imageDefaults(containerIn[i] || {}, containerOut[i] || {}, layoutOut); - containerOut.push(defaulted); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function imageDefaults(imageIn, imageOut, fullLayout) { - imageOut = imageOut || {}; - function coerce(attr, dflt) { return Lib.coerce(imageIn, imageOut, attributes, attr, dflt); } - coerce('source'); + var source = coerce('source'); + var visible = coerce('visible', !!source); + + if(!visible) return imageOut; + coerce('layer'); coerce('x'); coerce('y'); @@ -90756,18 +90669,18 @@ function imageDefaults(imageIn, imageOut, fullLayout) { coerce('sizing'); coerce('opacity'); - for(var i = 0; i < 2; i++) { - var tdMock = { _fullLayout: fullLayout }, - axLetter = ['x', 'y'][i]; + var gdMock = { _fullLayout: fullLayout }, + axLetters = ['x', 'y']; + for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref - Axes.coerceRef(imageIn, imageOut, tdMock, axLetter, 'paper'); + Axes.coerceRef(imageIn, imageOut, gdMock, axLetters[i], 'paper'); } return imageOut; } -},{"../../lib":632,"../../plots/cartesian/axes":662,"./attributes":566}],568:[function(require,module,exports){ +},{"../../lib":633,"../../plots/array_container_defaults":661,"../../plots/cartesian/axes":664,"./attributes":565}],567:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90784,25 +90697,23 @@ var Axes = require('../../plots/cartesian/axes'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, imageDataAbove = [], imageDataSubplot = [], imageDataBelow = []; - if(!fullLayout.images) return; - - // Sort into top, subplot, and bottom layers for(var i = 0; i < fullLayout.images.length; i++) { var img = fullLayout.images[i]; - if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - imageDataSubplot.push(img); - } else if(img.layer === 'above') { - imageDataAbove.push(img); - } else { - imageDataBelow.push(img); + if(img.visible) { + if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { + imageDataSubplot.push(img); + } else if(img.layer === 'above') { + imageDataAbove.push(img); + } else { + imageDataBelow.push(img); + } } } @@ -90871,12 +90782,12 @@ module.exports = function draw(gd) { var thisImage = d3.select(this); // Axes if specified - var xref = Axes.getFromId(gd, d.xref), - yref = Axes.getFromId(gd, d.yref); + var xa = Axes.getFromId(gd, d.xref), + ya = Axes.getFromId(gd, d.yref); var size = fullLayout._size, - width = xref ? Math.abs(xref.l2p(d.sizex) - xref.l2p(0)) : d.sizex * size.w, - height = yref ? Math.abs(yref.l2p(d.sizey) - yref.l2p(0)) : d.sizey * size.h; + width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w, + height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset, @@ -90885,8 +90796,8 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xref ? xref.l2p(d.x) + xref._offset : d.x * size.w + size.l) + xOffset, - yPos = (yref ? yref.l2p(d.y) + yref._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset, + yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; // Construct the proper aspectRatio attribute @@ -90911,8 +90822,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xref ? xref._id : '', - yId = yref ? yref._id : '', + var xId = xa ? xa._id : '', + yId = ya ? ya._id : '', clipAxes = xId + yId; if(clipAxes) { @@ -90949,7 +90860,7 @@ module.exports = function draw(gd) { }); }; -},{"../../constants/xmlns_namespaces":618,"../../plots/cartesian/axes":662,"../drawing":557,"d3":95}],569:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":618,"../../plots/cartesian/axes":664,"../drawing":556,"d3":95}],568:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -90960,21 +90871,17 @@ module.exports = function draw(gd) { 'use strict'; - -var draw = require('./draw'); -var supplyLayoutDefaults = require('./defaults'); -var attributes = require('./attributes'); - - module.exports = { moduleType: 'component', name: 'images', - draw: draw, - layoutAttributes: attributes, - supplyLayoutDefaults: supplyLayoutDefaults + + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), + + draw: require('./draw') }; -},{"./attributes":566,"./defaults":567,"./draw":568}],570:[function(require,module,exports){ +},{"./attributes":565,"./defaults":566,"./draw":567}],569:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91023,7 +90930,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],571:[function(require,module,exports){ +},{}],570:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91114,7 +91021,7 @@ module.exports = { } }; -},{"../../lib/extend":625,"../../plots/font_attributes":683,"../color/attributes":532}],572:[function(require,module,exports){ +},{"../../lib/extend":626,"../../plots/font_attributes":684,"../color/attributes":532}],571:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91132,7 +91039,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],573:[function(require,module,exports){ +},{}],572:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91225,7 +91132,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":632,"../../plots/layout_attributes":714,"../../registry":738,"./attributes":571,"./helpers":576}],574:[function(require,module,exports){ +},{"../../lib":633,"../../plots/layout_attributes":715,"../../registry":739,"./attributes":570,"./helpers":575}],573:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -91941,7 +91848,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../lib":632,"../../lib/svg_text_utils":646,"../../plotly":658,"../../plots/plots":723,"../../registry":738,"../color":533,"../dragelement":555,"../drawing":557,"./anchor_utils":570,"./constants":572,"./get_legend_data":575,"./helpers":576,"./style":578,"d3":95}],575:[function(require,module,exports){ +},{"../../lib":633,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/plots":724,"../../registry":739,"../color":533,"../dragelement":554,"../drawing":556,"./anchor_utils":569,"./constants":571,"./get_legend_data":574,"./helpers":575,"./style":577,"d3":95}],574:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92046,7 +91953,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":738,"./helpers":576}],576:[function(require,module,exports){ +},{"../../registry":739,"./helpers":575}],575:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92077,7 +91984,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":738}],577:[function(require,module,exports){ +},{"../../registry":739}],576:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92090,22 +91997,18 @@ exports.isReversed = function isReversed(legendLayout) { 'use strict'; -var legend = module.exports = {}; - - -legend.moduleType = 'component'; - -legend.name = 'legend'; - -legend.layoutAttributes = require('./attributes'); - -legend.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'legend', -legend.draw = require('./draw'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -legend.style = require('./style'); + draw: require('./draw'), + style: require('./style') +}; -},{"./attributes":571,"./defaults":573,"./draw":574,"./style":578}],578:[function(require,module,exports){ +},{"./attributes":570,"./defaults":572,"./draw":573,"./style":577}],577:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92327,7 +92230,7 @@ function stylePies(d) { if(pts.size()) pts.call(stylePie, d[0], trace); } -},{"../../lib":632,"../../registry":738,"../../traces/pie/style_one":838,"../../traces/scatter/subtypes":864,"../color":533,"../drawing":557,"d3":95}],579:[function(require,module,exports){ +},{"../../lib":633,"../../registry":739,"../../traces/pie/style_one":840,"../../traces/scatter/subtypes":866,"../color":533,"../drawing":556,"d3":95}],578:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92837,7 +92740,7 @@ modeBarButtons.resetViews = { } }; -},{"../../../build/ploticon":2,"../../lib":632,"../../plotly":658,"../../plots/cartesian/axes":662,"../../plots/plots":723,"../../snapshot/download":740}],580:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":633,"../../plotly":659,"../../plots/cartesian/axes":664,"../../plots/plots":724,"../../snapshot/download":741}],579:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -92851,7 +92754,7 @@ modeBarButtons.resetViews = { exports.manage = require('./manage'); -},{"./manage":581}],581:[function(require,module,exports){ +},{"./manage":580}],580:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93079,7 +92982,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":662,"../../traces/scatter/subtypes":864,"./buttons":579,"./modebar":582}],582:[function(require,module,exports){ +},{"../../plots/cartesian/axes":664,"../../traces/scatter/subtypes":866,"./buttons":578,"./modebar":581}],581:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93369,7 +93272,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":632,"d3":95}],583:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":633,"d3":95}],582:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93386,7 +93289,8 @@ var extendFlat = require('../../lib/extend').extendFlat; var buttonAttrs = require('./button_attributes'); buttonAttrs = extendFlat(buttonAttrs, { - _isLinkedToArray: true, + _isLinkedToArray: 'button', + }); @@ -93458,7 +93362,7 @@ module.exports = { } }; -},{"../../lib/extend":625,"../../plots/font_attributes":683,"../color/attributes":532,"./button_attributes":584}],584:[function(require,module,exports){ +},{"../../lib/extend":626,"../../plots/font_attributes":684,"../color/attributes":532,"./button_attributes":583}],583:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93499,7 +93403,7 @@ module.exports = { } }; -},{}],585:[function(require,module,exports){ +},{}],584:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93528,7 +93432,7 @@ module.exports = { darkAmount: 10 }; -},{}],586:[function(require,module,exports){ +},{}],585:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93621,7 +93525,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":632,"../color":533,"./attributes":583,"./button_attributes":584,"./constants":585}],587:[function(require,module,exports){ +},{"../../lib":633,"../color":533,"./attributes":582,"./button_attributes":583,"./constants":584}],586:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93896,7 +93800,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":646,"../../plotly":658,"../../plots/cartesian/axis_ids":665,"../../plots/plots":723,"../color":533,"../drawing":557,"../legend/anchor_utils":570,"./constants":585,"./get_update_object":588,"d3":95}],588:[function(require,module,exports){ +},{"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/cartesian/axis_ids":667,"../../plots/plots":724,"../color":533,"../drawing":556,"../legend/anchor_utils":569,"./constants":584,"./get_update_object":587,"d3":95}],587:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93910,6 +93814,8 @@ function reposition(gd, buttons, opts, axName) { var d3 = require('d3'); +var Lib = require('../../lib'); + module.exports = function getUpdateObject(axisLayout, buttonLayout) { var axName = axisLayout._name; @@ -93930,7 +93836,7 @@ module.exports = function getUpdateObject(axisLayout, buttonLayout) { function getXRange(axisLayout, buttonLayout) { var currentRange = axisLayout.range; - var base = new Date(currentRange[1]); + var base = new Date(Lib.dateTime2ms(currentRange[1])); var step = buttonLayout.step, count = buttonLayout.count; @@ -93939,13 +93845,13 @@ function getXRange(axisLayout, buttonLayout) { switch(buttonLayout.stepmode) { case 'backward': - range0 = d3.time[step].offset(base, -count).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].offset(base, -count)); break; case 'todate': - var base2 = d3.time[step].offset(base, -(count - 1)); + var base2 = d3.time[step].offset(base, -count); - range0 = d3.time[step].floor(base2).getTime(); + range0 = Lib.ms2DateTime(+d3.time[step].ceil(base2)); break; } @@ -93954,7 +93860,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":95}],589:[function(require,module,exports){ +},{"../../lib":633,"d3":95}],588:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -93965,18 +93871,18 @@ function getXRange(axisLayout, buttonLayout) { 'use strict'; +module.exports = { + moduleType: 'component', + name: 'rangeselector', -exports.moduleType = 'component'; - -exports.name = 'rangeselector'; - -exports.layoutAttributes = require('./attributes'); - -exports.handleDefaults = require('./defaults'); + layoutNodes: ['xaxis.'], + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":583,"./defaults":586,"./draw":587}],590:[function(require,module,exports){ +},{"./attributes":582,"./defaults":585,"./draw":586}],589:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94013,8 +93919,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -94034,7 +93940,7 @@ module.exports = { } }; -},{"../color/attributes":532}],591:[function(require,module,exports){ +},{"../color/attributes":532}],590:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94087,7 +93993,7 @@ module.exports = { handleStroke: '#666', }; -},{}],592:[function(require,module,exports){ +},{}],591:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94111,7 +94017,8 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe } var containerIn = layoutIn[axName].rangeslider, - containerOut = layoutOut[axName].rangeslider = {}; + axOut = layoutOut[axName], + containerOut = axOut.rangeslider = {}; function coerce(attr, dflt) { return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); @@ -94125,14 +94032,16 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe coerce('range'); // Expand slider range to the axis range - if(containerOut.range && !layoutOut[axName].autorange) { + if(containerOut.range && !axOut.autorange) { var outRange = containerOut.range, - axRange = layoutOut[axName].range; + axRange = axOut.range, + l2r = axOut.l2r, + r2l = axOut.r2l; - outRange[0] = Math.min(outRange[0], axRange[0]); - outRange[1] = Math.max(outRange[1], axRange[1]); + outRange[0] = l2r(Math.min(r2l(outRange[0]), r2l(axRange[0]))); + outRange[1] = l2r(Math.max(r2l(outRange[1]), r2l(axRange[1]))); } else { - layoutOut[axName]._needsExpand = true; + axOut._needsExpand = true; } if(containerOut.visible) { @@ -94147,7 +94056,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName, counterAxe containerOut._input = containerIn; }; -},{"../../lib":632,"./attributes":590}],593:[function(require,module,exports){ +},{"../../lib":633,"./attributes":589}],592:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94254,20 +94163,10 @@ module.exports = function(gd) { rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); - // update inner nodes - - rangeSlider - .call(drawBg, gd, axisOpts, opts) - .call(addClipPath, gd, axisOpts, opts) - .call(drawRangePlot, gd, axisOpts, opts) - .call(drawMasks, gd, axisOpts, opts) - .call(drawSlideBox, gd, axisOpts, opts) - .call(drawGrabbers, gd, axisOpts, opts); - // update data <--> pixel coordinate conversion methods - var range0 = opts.range[0], - range1 = opts.range[1], + var range0 = axisOpts.r2l(opts.range[0]), + range1 = axisOpts.r2l(opts.range[1]), dist = range1 - range0; opts.p2d = function(v) { @@ -94278,6 +94177,18 @@ module.exports = function(gd) { return (v - range0) / dist * opts._width; }; + opts._rl = [range0, range1]; + + // update inner nodes + + rangeSlider + .call(drawBg, gd, axisOpts, opts) + .call(addClipPath, gd, axisOpts, opts) + .call(drawRangePlot, gd, axisOpts, opts) + .call(drawMasks, gd, axisOpts, opts) + .call(drawSlideBox, gd, axisOpts, opts) + .call(drawGrabbers, gd, axisOpts, opts); + // setup drag element setupDragElement(rangeSlider, gd, axisOpts, opts); @@ -94315,8 +94226,8 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { target = event.target, startX = event.clientX, offsetX = startX - rangeSlider.node().getBoundingClientRect().left, - minVal = opts.d2p(axisOpts.range[0]), - maxVal = opts.d2p(axisOpts.range[1]); + minVal = opts.d2p(axisOpts._rl[0]), + maxVal = opts.d2p(axisOpts._rl[1]); var dragCover = dragElement.coverSlip(); @@ -94377,7 +94288,7 @@ function setupDragElement(rangeSlider, gd, axisOpts, opts) { function setDataRange(rangeSlider, gd, axisOpts, opts) { function clamp(v) { - return Lib.constrain(v, opts.range[0], opts.range[1]); + return axisOpts.l2r(Lib.constrain(v, opts._rl[0], opts._rl[1])); } var dataMin = clamp(opts.p2d(opts._pixelMin)), @@ -94394,8 +94305,8 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts) { return Lib.constrain(v, 0, opts._width); } - var pixelMin = clamp(opts.d2p(axisOpts.range[0])), - pixelMax = clamp(opts.d2p(axisOpts.range[1])); + var pixelMin = clamp(opts.d2p(axisOpts._rl[0])), + pixelMax = clamp(opts.d2p(axisOpts._rl[1])); rangeSlider.select('rect.' + constants.slideBoxClassName) .attr('x', pixelMin) @@ -94488,6 +94399,7 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) { data: [], layout: { xaxis: { + type: axisOpts.type, domain: [0, 1], range: opts.range.slice() }, @@ -94669,7 +94581,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":632,"../../lib/setcursor":642,"../../plotly":658,"../../plots/cartesian":671,"../../plots/cartesian/axes":662,"../../plots/plots":723,"../color":533,"../dragelement":555,"../drawing":557,"./constants":591,"d3":95}],594:[function(require,module,exports){ +},{"../../lib":633,"../../lib/setcursor":643,"../../plotly":659,"../../plots/cartesian":672,"../../plots/cartesian/axes":664,"../../plots/plots":724,"../color":533,"../dragelement":554,"../drawing":556,"./constants":590,"d3":95}],593:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94683,12 +94595,15 @@ function clearPushMargins(gd) { module.exports = { moduleType: 'component', name: 'rangeslider', + + layoutNodes: ['xaxis.'], layoutAttributes: require('./attributes'), handleDefaults: require('./defaults'), + draw: require('./draw') }; -},{"./attributes":590,"./defaults":592,"./draw":593}],595:[function(require,module,exports){ +},{"./attributes":589,"./defaults":591,"./draw":592}],594:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94706,7 +94621,14 @@ var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'shape', + + visible: { + valType: 'boolean', + + dflt: true, + + }, type: { valType: 'enumerated', @@ -94779,7 +94701,7 @@ module.exports = { } }; -},{"../../lib/extend":625,"../../traces/scatter/attributes":844,"../annotations/attributes":526}],596:[function(require,module,exports){ +},{"../../lib/extend":626,"../../traces/scatter/attributes":846,"../annotations/attributes":526}],595:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94791,6 +94713,7 @@ module.exports = { 'use strict'; +var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); var constants = require('./constants'); @@ -94799,7 +94722,7 @@ var helpers = require('./helpers'); module.exports = function calcAutorange(gd) { var fullLayout = gd._fullLayout, - shapeList = fullLayout.shapes; + shapeList = Lib.filterVisible(fullLayout.shapes); if(!shapeList.length || !gd._fullData.length) return; @@ -94855,7 +94778,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../plots/cartesian/axes":662,"./constants":597,"./helpers":600}],597:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"./constants":596,"./helpers":599}],596:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94919,7 +94842,7 @@ module.exports = { } }; -},{}],598:[function(require,module,exports){ +},{}],597:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94931,22 +94854,20 @@ module.exports = { 'use strict'; +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var handleShapeDefaults = require('./shape_defaults'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - var containerIn = layoutIn.shapes || [], - containerOut = layoutOut.shapes = []; - - for(var i = 0; i < containerIn.length; i++) { - var shapeIn = containerIn[i] || {}, - shapeOut = handleShapeDefaults(shapeIn, layoutOut); + var opts = { + name: 'shapes', + handleItemDefaults: handleShapeDefaults + }; - containerOut.push(shapeOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"./shape_defaults":602}],599:[function(require,module,exports){ +},{"../../plots/array_container_defaults":661,"./shape_defaults":601}],598:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -94998,7 +94919,9 @@ function draw(gd) { fullLayout._shapeSubplotLayer.selectAll('path').remove(); for(var i = 0; i < fullLayout.shapes.length; i++) { - drawOne(gd, i); + if(fullLayout.shapes[i].visible) { + drawOne(gd, i); + } } // may need to resurrect this if we put text (LaTeX) in shapes @@ -95118,8 +95041,6 @@ function updateShape(gd, index, opt, value) { // TODO: clean this up and remove it. if(!optionsIn) return; - var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}; - // alter the input shape as requested var optionsEdit = {}; if(typeof opt === 'string' && opt) optionsEdit[opt] = value; @@ -95131,7 +95052,12 @@ function updateShape(gd, index, opt, value) { Lib.nestedProperty(optionsIn, k).set(optionsEdit[k]); } - var posAttrs = ['x0', 'x1', 'y0', 'y1']; + // return early in visible: false updates + if(optionsIn.visible === false) return; + + var oldRef = {xref: optionsIn.xref, yref: optionsIn.yref}, + posAttrs = ['x0', 'x1', 'y0', 'y1']; + for(i = 0; i < 4; i++) { var posAttr = posAttrs[i]; // if we don't have an explicit position already, @@ -95146,18 +95072,17 @@ function updateShape(gd, index, opt, value) { var axLetter = posAttr.charAt(0), axOld = Axes.getFromId(gd, - Axes.coerceRef(oldRef, {}, gd, axLetter)), + Axes.coerceRef(oldRef, {}, gd, axLetter, '', 'paper')), axNew = Axes.getFromId(gd, - Axes.coerceRef(optionsIn, {}, gd, axLetter)), + Axes.coerceRef(optionsIn, {}, gd, axLetter, '', 'paper')), position = optionsIn[posAttr], - linearizedPosition; + rangePosition; if(optionsEdit[axLetter + 'ref'] !== undefined) { // first convert to fraction of the axis if(axOld) { - linearizedPosition = helpers.dataToLinear(axOld)(position); - position = (linearizedPosition - axOld.range[0]) / - (axOld.range[1] - axOld.range[0]); + rangePosition = helpers.shapePositionToRange(axOld)(position); + position = axOld.r2fraction(rangePosition); } else { position = (position - axNew.domain[0]) / (axNew.domain[1] - axNew.domain[0]); @@ -95165,9 +95090,8 @@ function updateShape(gd, index, opt, value) { if(axNew) { // then convert to new data coordinates at the same fraction - linearizedPosition = axNew.range[0] + position * - (axNew.range[1] - axNew.range[0]); - position = helpers.linearToData(axNew)(linearizedPosition); + rangePosition = axNew.fraction2r(position); + position = helpers.rangeToShapePosition(axNew)(rangePosition); } else { // or scale to the whole plot position = axOld.domain[0] + @@ -95178,7 +95102,8 @@ function updateShape(gd, index, opt, value) { optionsIn[posAttr] = position; } - var options = handleShapeDefaults(optionsIn, gd._fullLayout); + var options = {}; + handleShapeDefaults(optionsIn, options, gd._fullLayout); gd._fullLayout.shapes[index] = options; var clipAxes; @@ -95412,22 +95337,22 @@ function getPathString(gd, options) { xa = Axes.getFromId(gd, options.xref), ya = Axes.getFromId(gd, options.yref), gs = gd._fullLayout._size, - x2l, + x2r, x2p, - y2l, + y2r, y2p; if(xa) { - x2l = helpers.dataToLinear(xa); - x2p = function(v) { return xa._offset + xa.l2p(x2l(v, true)); }; + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2l = helpers.dataToLinear(ya); - y2p = function(v) { return ya._offset + ya.l2p(y2l(v, true)); }; + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; @@ -95509,7 +95434,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":632,"../../lib/setcursor":642,"../../plotly":658,"../../plots/cartesian/axes":662,"../color":533,"../dragelement":555,"../drawing":557,"./constants":597,"./defaults":598,"./helpers":600,"./shape_defaults":602,"fast-isnumeric":104}],600:[function(require,module,exports){ +},{"../../lib":633,"../../lib/setcursor":643,"../../plotly":659,"../../plots/cartesian/axes":664,"../color":533,"../dragelement":554,"../drawing":556,"./constants":596,"./defaults":597,"./helpers":599,"./shape_defaults":601,"fast-isnumeric":104}],599:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95526,16 +95451,16 @@ function movePath(pathIn, moveX, moveY) { // so these have to be specified in terms of the category serial numbers, // but can take fractional values. Other axis types we specify position based on // the actual data values. -// TODO: this should really be part of axes, but for now it's only used here. -// eventually annotations and axis ranges will use this too. -// what should we do, invent a new letter for "data except if it's category"? +// TODO: in V2.0 (when log axis ranges are in data units) range and shape position +// will be identical, so rangeToShapePosition and shapePositionToRange can be +// removed entirely. -exports.dataToLinear = function(ax) { - return ax.type === 'category' ? ax.c2l : ax.d2l; +exports.rangeToShapePosition = function(ax) { + return (ax.type === 'log') ? ax.r2d : function(v) { return v; }; }; -exports.linearToData = function(ax) { - return ax.type === 'category' ? ax.l2c : ax.l2d; +exports.shapePositionToRange = function(ax) { + return (ax.type === 'log') ? ax.d2r : function(v) { return v; }; }; exports.decodeDate = function(convertToPx) { @@ -95554,10 +95479,10 @@ exports.getDataToPixel = function(gd, axis, isVertical) { dataToPixel; if(axis) { - var d2l = exports.dataToLinear(axis); + var d2r = exports.shapePositionToRange(axis); dataToPixel = function(v) { - return axis._offset + axis.l2p(d2l(v, true)); + return axis._offset + axis.r2p(d2r(v, true)); }; if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); @@ -95577,8 +95502,8 @@ exports.getPixelToData = function(gd, axis, isVertical) { pixelToData; if(axis) { - var l2d = exports.linearToData(axis); - pixelToData = function(p) { return l2d(axis.p2l(p - axis._offset)); }; + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; @@ -95590,7 +95515,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],601:[function(require,module,exports){ +},{}],600:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95602,21 +95527,21 @@ exports.getPixelToData = function(gd, axis, isVertical) { 'use strict'; -exports.moduleType = 'component'; - -exports.name = 'shapes'; - -exports.layoutAttributes = require('./attributes'); +var drawModule = require('./draw'); -exports.supplyLayoutDefaults = require('./defaults'); +module.exports = { + moduleType: 'component', + name: 'shapes', -exports.calcAutorange = require('./calc_autorange'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -var drawModule = require('./draw'); -exports.draw = drawModule.draw; -exports.drawOne = drawModule.drawOne; + calcAutorange: require('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne +}; -},{"./attributes":595,"./calc_autorange":596,"./defaults":598,"./draw":599}],602:[function(require,module,exports){ +},{"./attributes":594,"./calc_autorange":595,"./defaults":597,"./draw":598}],601:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95634,13 +95559,19 @@ var Axes = require('../../plots/cartesian/axes'); var attributes = require('./attributes'); var helpers = require('./helpers'); -module.exports = function handleShapeDefaults(shapeIn, fullLayout) { - var shapeOut = {}; + +module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opts, itemOpts) { + opts = opts || {}; + itemOpts = itemOpts || {}; function coerce(attr, dflt) { return Lib.coerce(shapeIn, shapeOut, attributes, attr, dflt); } + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + + if(!visible) return shapeOut; + coerce('layer'); coerce('opacity'); coerce('fillcolor'); @@ -95655,39 +95586,61 @@ module.exports = function handleShapeDefaults(shapeIn, fullLayout) { var axLetters = ['x', 'y']; for(var i = 0; i < 2; i++) { var axLetter = axLetters[i], - tdMock = {_fullLayout: fullLayout}; + gdMock = {_fullLayout: fullLayout}; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, tdMock, axLetter); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); if(shapeType !== 'path') { var dflt0 = 0.25, - dflt1 = 0.75; + dflt1 = 0.75, + ax, + pos2r, + r2pos; if(axRef !== 'paper') { - var ax = Axes.getFromId(tdMock, axRef), - convertFn = helpers.linearToData(ax); - - dflt0 = convertFn(ax.range[0] + dflt0 * (ax.range[1] - ax.range[0])); - dflt1 = convertFn(ax.range[0] + dflt1 * (ax.range[1] - ax.range[0])); + ax = Axes.getFromId(gdMock, axRef); + r2pos = helpers.rangeToShapePosition(ax); + pos2r = helpers.shapePositionToRange(ax); } + else { + pos2r = r2pos = Lib.identity; + } + + // hack until V2.0 when log has regular range behavior - make it look like other + // ranges to send to coerce, then put it back after + // this is all to give reasonable default position behavior on log axes, which is + // a pretty unimportant edge case so we could just ignore this. + var attr0 = axLetter + '0', + attr1 = axLetter + '1', + in0 = shapeIn[attr0], + in1 = shapeIn[attr1]; + shapeIn[attr0] = pos2r(shapeIn[attr0], true); + shapeIn[attr1] = pos2r(shapeIn[attr1], true); // x0, x1 (and y0, y1) - coerce(axLetter + '0', dflt0); - coerce(axLetter + '1', dflt1); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr0, dflt0); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr1, dflt1); + + // hack part 2 + shapeOut[attr0] = r2pos(shapeOut[attr0]); + shapeOut[attr1] = r2pos(shapeOut[attr1]); + shapeIn[attr0] = in0; + shapeIn[attr1] = in1; } } if(shapeType === 'path') { coerce('path'); - } else { + } + else { Lib.noneOrAll(shapeIn, shapeOut, ['x0', 'x1', 'y0', 'y1']); } return shapeOut; }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"./attributes":595,"./helpers":600}],603:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"./attributes":594,"./helpers":599}],602:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95706,7 +95659,7 @@ var animationAttrs = require('../../plots/animation_attributes'); var constants = require('./constants'); var stepsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'step', method: { valType: 'enumerated', @@ -95739,6 +95692,8 @@ var stepsAttrs = { }; module.exports = { + _isLinkedToArray: 'slider', + visible: { valType: 'boolean', @@ -95919,7 +95874,7 @@ module.exports = { }, }; -},{"../../lib/extend":625,"../../plots/animation_attributes":659,"../../plots/font_attributes":683,"../../plots/pad_attributes":722,"./constants":604}],604:[function(require,module,exports){ +},{"../../lib/extend":626,"../../plots/animation_attributes":660,"../../plots/font_attributes":684,"../../plots/pad_attributes":723,"./constants":603}],603:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -95934,9 +95889,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'sliders', - itemName: 'slider', // class names containerClassName: 'slider-container', @@ -96017,7 +95971,7 @@ module.exports = { currentValueInset: 0, }; -},{}],605:[function(require,module,exports){ +},{}],604:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -96029,6 +95983,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -96038,23 +95993,12 @@ var stepAttrs = attributes.steps; module.exports = function slidersDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var sliderIn = contIn[i] || {}, - sliderOut = {}; - - sliderDefaults(sliderIn, sliderOut, layoutOut); - - // used on button click to update the 'active' field - sliderOut._input = sliderIn; - - // used to determine object constancy - sliderOut._index = i; + var opts = { + name: name, + handleItemDefaults: sliderDefaults + }; - contOut.push(sliderOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function sliderDefaults(sliderIn, sliderOut, layoutOut) { @@ -96140,7 +96084,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":632,"./attributes":603,"./constants":604}],606:[function(require,module,exports){ +},{"../../lib":633,"../../plots/array_container_defaults":661,"./attributes":602,"./constants":603}],605:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -96509,6 +96453,7 @@ function handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, doTransiti } function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) { + var previousActive = sliderOpts.active; sliderOpts._input.active = sliderOpts.active = index; var step = sliderOpts.steps[sliderOpts.active]; @@ -96516,6 +96461,13 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) sliderGroup.call(setGripPosition, sliderOpts, sliderOpts.active / (sliderOpts.steps.length - 1), doTransition); sliderGroup.call(drawCurrentValue, sliderOpts); + gd.emit('plotly_sliderchange', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active], + interaction: doCallback, + previousActive: previousActive + }); + if(step && step.method && doCallback) { if(sliderGroup._nextMethod) { // If we've already queued up an update, just overwrite it with the most recent: @@ -96542,6 +96494,8 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { var $gd = d3.select(gd); item.on('mousedown', function() { + gd.emit('plotly_sliderstart', {slider: sliderOpts}); + var grip = sliderGroup.select('.' + constants.gripRectClass); d3.event.stopPropagation(); @@ -96562,6 +96516,11 @@ function attachGripEvents(item, gd, sliderGroup, sliderOpts) { grip.call(Color.fill, sliderOpts.bgcolor); $gd.on('mouseup', null); $gd.on('mousemove', null); + + gd.emit('plotly_sliderend', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active] + }); }); }); } @@ -96699,7 +96658,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":632,"../../lib/svg_text_utils":646,"../../plots/plots":723,"../color":533,"../drawing":557,"../legend/anchor_utils":570,"./constants":604,"d3":95}],607:[function(require,module,exports){ +},{"../../lib":633,"../../lib/svg_text_utils":647,"../../plots/plots":724,"../color":533,"../drawing":556,"../legend/anchor_utils":569,"./constants":603,"d3":95}],606:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -96710,18 +96669,19 @@ function clearPushMargins(gd) { 'use strict'; +var constants = require('./constants'); -exports.moduleType = 'component'; - -exports.name = 'sliders'; - -exports.layoutAttributes = require('./attributes'); +module.exports = { + moduleType: 'component', + name: constants.name, -exports.supplyLayoutDefaults = require('./defaults'); + layoutAttributes: require('./attributes'), + supplyLayoutDefaults: require('./defaults'), -exports.draw = require('./draw'); + draw: require('./draw') +}; -},{"./attributes":603,"./defaults":605,"./draw":606}],608:[function(require,module,exports){ +},{"./attributes":602,"./constants":603,"./defaults":604,"./draw":605}],607:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -96951,7 +96911,7 @@ Titles.draw = function(gd, titleClass, options) { el.classed('js-placeholder', isplaceholder); }; -},{"../../lib":632,"../../lib/svg_text_utils":646,"../../plotly":658,"../../plots/plots":723,"../color":533,"../drawing":557,"d3":95,"fast-isnumeric":104}],609:[function(require,module,exports){ +},{"../../lib":633,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/plots":724,"../color":533,"../drawing":556,"d3":95,"fast-isnumeric":104}],608:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -96968,7 +96928,7 @@ var extendFlat = require('../../lib/extend').extendFlat; var padAttrs = require('../../plots/pad_attributes'); var buttonsAttrs = { - _isLinkedToArray: true, + _isLinkedToArray: 'button', method: { valType: 'enumerated', @@ -96997,7 +96957,7 @@ var buttonsAttrs = { }; module.exports = { - _isLinkedToArray: true, + _isLinkedToArray: 'updatemenu', visible: { valType: 'boolean', @@ -97097,7 +97057,7 @@ module.exports = { } }; -},{"../../lib/extend":625,"../../plots/font_attributes":683,"../../plots/pad_attributes":722,"../color/attributes":532}],610:[function(require,module,exports){ +},{"../../lib/extend":626,"../../plots/font_attributes":684,"../../plots/pad_attributes":723,"../color/attributes":532}],609:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -97112,9 +97072,8 @@ module.exports = { module.exports = { - // layout attribute names + // layout attribute name name: 'updatemenus', - itemName: 'updatemenu', // class names containerClassName: 'updatemenu-container', @@ -97174,7 +97133,7 @@ module.exports = { hoverColor: '#F4FAFF' }; -},{}],611:[function(require,module,exports){ +},{}],610:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -97186,6 +97145,7 @@ module.exports = { 'use strict'; var Lib = require('../../lib'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); var attributes = require('./attributes'); var constants = require('./constants'); @@ -97195,23 +97155,12 @@ var buttonAttrs = attributes.buttons; module.exports = function updateMenusDefaults(layoutIn, layoutOut) { - var contIn = Array.isArray(layoutIn[name]) ? layoutIn[name] : [], - contOut = layoutOut[name] = []; - - for(var i = 0; i < contIn.length; i++) { - var menuIn = contIn[i] || {}, - menuOut = {}; - - menuDefaults(menuIn, menuOut, layoutOut); - - // used on button click to update the 'active' field - menuOut._input = menuIn; - - // used to determine object constancy - menuOut._index = i; + var opts = { + name: name, + handleItemDefaults: menuDefaults + }; - contOut.push(menuOut); - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function menuDefaults(menuIn, menuOut, layoutOut) { @@ -97278,7 +97227,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":632,"./attributes":609,"./constants":610}],612:[function(require,module,exports){ +},{"../../lib":633,"../../plots/array_container_defaults":661,"./attributes":608,"./constants":609}],611:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -97580,6 +97529,8 @@ function drawButtons(gd, gHeader, gButton, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, buttonIndex); Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + + gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); button.on('mouseover', function() { @@ -97859,29 +97810,9 @@ function clearPushMargins(gd) { } } -},{"../../lib":632,"../../lib/svg_text_utils":646,"../../plots/plots":723,"../color":533,"../drawing":557,"../legend/anchor_utils":570,"./constants":610,"d3":95}],613:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - - -exports.moduleType = 'component'; - -exports.name = 'updatemenus'; - -exports.layoutAttributes = require('./attributes'); - -exports.supplyLayoutDefaults = require('./defaults'); - -exports.draw = require('./draw'); - -},{"./attributes":609,"./defaults":611,"./draw":612}],614:[function(require,module,exports){ +},{"../../lib":633,"../../lib/svg_text_utils":647,"../../plots/plots":724,"../color":533,"../drawing":556,"../legend/anchor_utils":569,"./constants":609,"d3":95}],612:[function(require,module,exports){ +arguments[4][606][0].apply(exports,arguments) +},{"./attributes":608,"./constants":609,"./defaults":610,"./draw":611,"dup":606}],613:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -97902,7 +97833,7 @@ module.exports = { longdashdot: [8, 1, 1, 1] }; -},{}],615:[function(require,module,exports){ +},{}],614:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -97923,7 +97854,7 @@ module.exports = { longdashdot: [[0.5, 0.7, 0.8, 1], 10] }; -},{}],616:[function(require,module,exports){ +},{}],615:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -97946,6 +97877,48 @@ module.exports = { x: '❌' }; +},{}],616:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + + +module.exports = { + /** + * Standardize all missing data in calcdata to use undefined + * never null or NaN. + * That way we can use !==undefined, or !== BADNUM, + * to test for real data + */ + BADNUM: undefined, + + /* + * Limit certain operations to well below floating point max value + * to avoid glitches: Make sure that even when you multiply it by the + * number of pixels on a giant screen it still works + */ + FP_SAFE: Number.MAX_VALUE / 10000, + + /* + * conversion of date units to milliseconds + * year and month constants are marked "AVG" + * to remind us that not all years and months + * have the same length + */ + ONEAVGYEAR: 31557600000, // 365.25 days + ONEAVGMONTH: 2629800000, // 1/12 of ONEAVGYEAR + ONEDAY: 86400000, + ONEHOUR: 3600000, + ONEMIN: 60000, + ONESEC: 1000 +}; + },{}],617:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. @@ -98026,7 +97999,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.19.2'; +exports.version = '1.20.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -98087,7 +98060,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":531,"./components/images":569,"./components/legend":577,"./components/rangeselector":589,"./components/rangeslider":594,"./components/shapes":601,"./components/sliders":607,"./components/updatemenus":613,"./fonts/mathjax_config":620,"./lib/queue":640,"./plot_api/plot_schema":652,"./plot_api/register":653,"./plot_api/set_plot_config":654,"./plot_api/to_image":656,"./plot_api/validate":657,"./plotly":658,"./snapshot":743,"./snapshot/download":740,"./traces/scatter":854,"d3":95,"es6-promise":101}],620:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":531,"./components/images":568,"./components/legend":576,"./components/rangeselector":588,"./components/rangeslider":593,"./components/shapes":600,"./components/sliders":606,"./components/updatemenus":612,"./fonts/mathjax_config":620,"./lib/queue":641,"./plot_api/plot_schema":653,"./plot_api/register":654,"./plot_api/set_plot_config":655,"./plot_api/to_image":657,"./plot_api/validate":658,"./plotly":659,"./snapshot":744,"./snapshot/download":741,"./traces/scatter":856,"d3":95,"es6-promise":101}],620:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -98147,22 +98120,50 @@ module.exports = function arrayToCalcItem(traceAttr, calcItem, calcAttr, i) { */ +'use strict'; + +var isNumeric = require('fast-isnumeric'); + +var BADNUM = require('../constants/numerical').BADNUM; + +// precompile these regex's for speed +var FRONTJUNK = /^['"%,$#\s']+/; +var ENDJUNK = /['"%,$#\s']+$/; + +/** + * cleanNumber: remove common leading and trailing cruft + * Always returns either a number or BADNUM. + */ +module.exports = function cleanNumber(v) { + if(typeof v === 'string') { + v = v.replace(FRONTJUNK, '').replace(ENDJUNK, ''); + } + + if(isNumeric(v)) return Number(v); + + return BADNUM; +}; + +},{"../constants/numerical":616,"fast-isnumeric":104}],623:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + 'use strict'; var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); -var nestedProperty = require('./nested_property'); -var isPlainObject = require('./is_plain_object'); -var filterUnique = require('./filter_unique'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); +var nestedProperty = require('./nested_property'); -var idRegex = /^([2-9]|[1-9][0-9]+)$/; - -function isValObject(obj) { - return obj && obj.valType !== undefined; -} +var ID_REGEX = /^([2-9]|[1-9][0-9]+)$/; exports.valObjects = { data_array: { @@ -98273,7 +98274,7 @@ exports.valObjects = { coerceFunction: function(v, propOut, dflt) { var dlen = dflt.length; if(typeof v === 'string' && v.substr(0, dlen) === dflt && - idRegex.test(v.substr(dlen))) { + ID_REGEX.test(v.substr(dlen))) { propOut.set(v); return; } @@ -98285,7 +98286,7 @@ exports.valObjects = { if(v === dflt) return true; if(typeof v !== 'string') return false; - if(v.substr(0, dlen) === dflt && idRegex.test(v.substr(dlen))) { + if(v.substr(0, dlen) === dflt && ID_REGEX.test(v.substr(dlen))) { return true; } @@ -98453,129 +98454,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -/* - * returns true for a valid value object and false for tree nodes in the attribute hierarchy - */ -exports.isValObject = isValObject; - -exports.IS_SUBPLOT_OBJ = '_isSubplotObj'; -exports.IS_LINKED_TO_ARRAY = '_isLinkedToArray'; -exports.DEPRECATED = '_deprecated'; - -// list of underscore attributes to keep in schema as is -exports.UNDERSCORE_ATTRS = [exports.IS_SUBPLOT_OBJ, exports.IS_LINKED_TO_ARRAY, exports.DEPRECATED]; - -/** - * Crawl the attribute tree, recursively calling a callback function - * - * @param {object} attrs - * The node of the attribute tree (e.g. the root) from which recursion originates - * @param {Function} callback - * A callback function with the signature: - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * @param {Number} [specifiedLevel] - * The level in the tree, in order to let the callback function detect descend or backtrack, - * typically unsupplied (implied 0), just used by the self-recursive call. - * The necessity arises because the tree traversal is not controlled by callback return values. - * The decision to not use callback return values for controlling tree pruning arose from - * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions - * precedes the callback call. - * - * @return {object} transformOut - * copy of transformIn that contains attribute defaults - */ -exports.crawl = function(attrs, callback, specifiedLevel) { - var level = specifiedLevel || 0; - Object.keys(attrs).forEach(function(attrName) { - var attr = attrs[attrName]; - - if(exports.UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - - callback(attr, attrName, attrs, level); - - if(isValObject(attr)) return; - if(isPlainObject(attr)) exports.crawl(attr, callback, level + 1); - }); -}; - -/** - * Find all data array attributes in a given trace object - including - * `arrayOk` attributes. - * - * @param {object} trace - * full trace object that contains a reference to `_module.attributes` - * - * @return {array} arrayAttributes - * list of array attributes for the given trace - */ -exports.findArrayAttributes = function(trace) { - var arrayAttributes = [], - stack = []; - - /** - * A closure that gathers attribute paths into its enclosed arraySplitAttributes - * Attribute paths are collected iff their leaf node is a splittable attribute - * - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * - * @closureVariable {String[][]} arrayAttributes the set of gathered attributes - * Example of filled closure variable (expected to be initialized to []): - * [["marker","size"],["marker","line","width"],["marker","line","color"]] - */ - function callback(attr, attrName, attrs, level) { - stack = stack.slice(0, level).concat([attrName]); - - var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; - if(!splittableAttr) return; - - var astr = toAttrString(stack); - var val = nestedProperty(trace, astr).get(); - if(!Array.isArray(val)) return; - - arrayAttributes.push(astr); - } - - function toAttrString(stack) { - return stack.join('.'); - } - - exports.crawl(trace._module.attributes, callback); - - if(trace.transforms) { - var transforms = trace.transforms; - - for(var i = 0; i < transforms.length; i++) { - var transform = transforms[i]; - - stack = ['transforms[' + i + ']']; - exports.crawl(transform._module.attributes, callback, 1); - } - } - - // Look into the fullInput module attributes for array attributes - // to make sure that 'custom' array attributes are detected. - // - // At the moment, we need this block to make sure that - // ohlc and candlestick 'open', 'high', 'low', 'close' can be - // used with filter ang groupby transforms. - if(trace._fullInput) { - exports.crawl(trace._fullInput._module.attributes, callback); - - arrayAttributes = filterUnique(arrayAttributes); - } - - return arrayAttributes; -}; - -},{"../components/colorscale/get_scale":546,"../components/colorscale/scales":552,"./filter_unique":626,"./is_plain_object":634,"./nested_property":637,"fast-isnumeric":104,"tinycolor2":489}],623:[function(require,module,exports){ +},{"../components/colorscale/get_scale":545,"../components/colorscale/scales":551,"./nested_property":638,"fast-isnumeric":104,"tinycolor2":489}],624:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -98590,6 +98469,24 @@ exports.findArrayAttributes = function(trace) { var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); +var logError = require('./loggers').error; + +var constants = require('../constants/numerical'); +var BADNUM = constants.BADNUM; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + +// is an object a javascript date? +exports.isJSDate = function(v) { + return typeof v === 'object' && v !== null && typeof v.getTime === 'function'; +}; + +// The absolute limits of our date-time system +// This is a little weird: we use MIN_MS and MAX_MS in dateTime2ms +// but we use dateTime2ms to calculate them (after defining it!) +var MIN_MS, MAX_MS; /** * dateTime2ms - turn a date object or string s of the form @@ -98597,7 +98494,13 @@ var isNumeric = require('fast-isnumeric'); * per javascript standard) * may truncate after any full field, and sss can be any length * even >3 digits, though javascript dates truncate to milliseconds - * returns false if it doesn't find a date + * returns BADNUM if it doesn't find a date + * + * Expanded to support negative years to -9999 but you must always + * give 4 digits, except for 2-digit positive years which we assume are + * near the present time. + * Note that we follow ISO 8601:2004: there *is* a year 0, which + * is 1BC/BCE, and -1===2BC etc. * * 2-digit to 4-digit year conversion, where to cut off? * from http://support.microsoft.com/kb/244664: @@ -98605,85 +98508,123 @@ var isNumeric = require('fast-isnumeric'); * but in my mac chrome from eg. d=new Date(Date.parse('8/19/50')): * 1950-2049 * by Java, from http://stackoverflow.com/questions/2024273/: - * now-80 - now+20 + * now-80 - now+19 * or FileMaker Pro, from * http://www.filemaker.com/12help/html/add_view_data.4.21.html: - * now-70 - now+30 + * now-70 - now+29 * but python strptime etc, via * http://docs.python.org/py3k/library/time.html: * 1969-2068 (super forward-looking, but static, not sliding!) * - * lets go with now-70 to now+30, and if anyone runs into this problem + * lets go with now-70 to now+29, and if anyone runs into this problem * they can learn the hard way not to use 2-digit years, as no choice we * make now will cover all possibilities. mostly this will all be taken * care of in initial parsing, should only be an issue for hand-entered data - * currently (2012) this range is: - * 1942-2041 + * currently (2016) this range is: + * 1946-2045 */ exports.dateTime2ms = function(s) { // first check if s is a date object - try { - if(s.getTime) return +s; - } - catch(e) { - return false; + if(exports.isJSDate(s)) { + s = Number(s); + if(s >= MIN_MS && s <= MAX_MS) return s; + return BADNUM; } + // otherwise only accept strings and numbers + if(typeof s !== 'string' && typeof s !== 'number') return BADNUM; var y, m, d, h; // split date and time parts - var datetime = String(s).split(' '); - if(datetime.length > 2) return false; + // TODO: we strip leading/trailing whitespace but not other + // characters like we do for numbers - do we want to? + var datetime = String(s).trim().split(' '); + if(datetime.length > 2) return BADNUM; var p = datetime[0].split('-'); // date part - if(p.length > 3 || (p.length !== 3 && datetime[1])) return false; + + var CE = true; // common era, ie positive year + if(p[0] === '') { + // first part is blank: year starts with a minus sign + CE = false; + p.splice(0, 1); + } + + var plen = p.length; + if(plen > 3 || (plen !== 3 && datetime[1]) || !plen) return BADNUM; // year if(p[0].length === 4) y = Number(p[0]); else if(p[0].length === 2) { + if(!CE) return BADNUM; var yNow = new Date().getFullYear(); y = ((Number(p[0]) - yNow + 70) % 100 + 200) % 100 + yNow - 70; } - else return false; - if(!isNumeric(y)) return false; - if(p.length === 1) return new Date(y, 0, 1).getTime(); // year only + else return BADNUM; + if(!isNumeric(y)) return BADNUM; + + // javascript takes new Date(0..99,m,d) to mean 1900-1999, so + // to support years 0-99 we need to use setFullYear explicitly + var baseDate = new Date(0, 0, 1); + baseDate.setFullYear(CE ? y : -y); + if(p.length > 1) { + + // month - may be 1 or 2 digits + m = Number(p[1]) - 1; // new Date() uses zero-based months + if(p[1].length > 2 || !(m >= 0 && m <= 11)) return BADNUM; + baseDate.setMonth(m); + + if(p.length > 2) { + + // day - may be 1 or 2 digits + d = Number(p[2]); + if(p[2].length > 2 || !(d >= 1 && d <= 31)) return BADNUM; + baseDate.setDate(d); + + // does that date exist in this month? + if(baseDate.getDate() !== d) return BADNUM; + + if(datetime[1]) { - // month - m = Number(p[1]) - 1; // new Date() uses zero-based months - if(p[1].length > 2 || !(m >= 0 && m <= 11)) return false; - if(p.length === 2) return new Date(y, m, 1).getTime(); // year-month + p = datetime[1].split(':'); + if(p.length > 3) return BADNUM; - // day - d = Number(p[2]); - if(p[2].length > 2 || !(d >= 1 && d <= 31)) return false; + // hour - may be 1 or 2 digits + h = Number(p[0]); + if(p[0].length > 2 || !p[0].length || !(h >= 0 && h <= 23)) return BADNUM; + baseDate.setHours(h); - // now save the date part - d = new Date(y, m, d).getTime(); - if(!datetime[1]) return d; // year-month-day - p = datetime[1].split(':'); - if(p.length > 3) return false; + // does that hour exist in this day? (Daylight time!) + // (TODO: remove this check when we move to UTC) + if(baseDate.getHours() !== h) return BADNUM; - // hour - h = Number(p[0]); - if(p[0].length > 2 || !(h >= 0 && h <= 23)) return false; - d += 3600000 * h; - if(p.length === 1) return d; + if(p.length > 1) { + d = baseDate.getTime(); - // minute - m = Number(p[1]); - if(p[1].length > 2 || !(m >= 0 && m <= 59)) return false; - d += 60000 * m; - if(p.length === 2) return d; + // minute - must be 2 digits + m = Number(p[1]); + if(p[1].length !== 2 || !(m >= 0 && m <= 59)) return BADNUM; + d += ONEMIN * m; + if(p.length === 2) return d; - // second - s = Number(p[2]); - if(!(s >= 0 && s < 60)) return false; - return d + s * 1000; + // second (and milliseconds) - must have 2-digit seconds + if(p[2].split('.')[0].length !== 2) return BADNUM; + s = Number(p[2]); + if(!(s >= 0 && s < 60)) return BADNUM; + return d + s * ONESEC; + } + } + } + } + return baseDate.getTime(); }; +MIN_MS = exports.MIN_MS = exports.dateTime2ms('-9999'); +MAX_MS = exports.MAX_MS = exports.dateTime2ms('9999-12-31 23:59:59.9999'); + // is string s a date? (see above) exports.isDateTime = function(s) { - return (exports.dateTime2ms(s) !== false); + return (exports.dateTime2ms(s) !== BADNUM); }; // pad a number with zeroes, to given # of digits before the decimal point @@ -98692,224 +98633,68 @@ function lpad(val, digits) { } /** - * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.sss - * Crop any trailing zeros in time, but always leave full date - * (we could choose to crop '-01' from date too)... + * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.ssss + * Crop any trailing zeros in time, except never stop right after hours + * (we could choose to crop '-01' from date too but for now we always + * show the whole date) * Optional range r is the data range that applies, also in ms. * If rng is big, the later parts of time will be omitted */ +var NINETYDAYS = 90 * ONEDAY; +var THREEHOURS = 3 * ONEHOUR; +var FIVEMIN = 5 * ONEMIN; exports.ms2DateTime = function(ms, r) { + if(typeof ms !== 'number' || !(ms >= MIN_MS && ms <= MAX_MS)) return BADNUM; + if(!r) r = 0; - var d = new Date(ms), - s = d3.time.format('%Y-%m-%d')(d); - - if(r < 7776000000) { - // <90 days: add hours - s += ' ' + lpad(d.getHours(), 2); - if(r < 432000000) { - // <5 days: add minutes - s += ':' + lpad(d.getMinutes(), 2); - if(r < 10800000) { - // <3 hours: add seconds - s += ':' + lpad(d.getSeconds(), 2); - if(r < 300000) { - // <5 minutes: add ms - s += '.' + lpad(d.getMilliseconds(), 3); + var d = new Date(Math.floor(ms)), + dateStr = d3.time.format('%Y-%m-%d')(d), + // <90 days: add hours and minutes - never *only* add hours + h = (r < NINETYDAYS) ? d.getHours() : 0, + m = (r < NINETYDAYS) ? d.getMinutes() : 0, + // <3 hours: add seconds + s = (r < THREEHOURS) ? d.getSeconds() : 0, + // <5 minutes: add ms (plus one extra digit, this is msec*10) + msec10 = (r < FIVEMIN) ? Math.round((d.getMilliseconds() + (((ms % 1) + 1) % 1)) * 10) : 0; + + // include each part that has nonzero data in or after it + if(h || m || s || msec10) { + dateStr += ' ' + lpad(h, 2) + ':' + lpad(m, 2); + if(s || msec10) { + dateStr += ':' + lpad(s, 2); + if(msec10) { + var digits = 4; + while(msec10 % 10 === 0) { + digits -= 1; + msec10 /= 10; } + dateStr += '.' + lpad(msec10, digits); } } - // strip trailing zeros - return s.replace(/([:\s]00)*\.?[0]*$/, ''); } - return s; -}; - -/** - * parseDate: forgiving attempt to turn any date string - * into a javascript date object - * - * first collate all the date formats we want to support, precompiled - * to d3 format objects see below for the string cleaning that happens - * before this separate out 2-digit (y) and 4-digit-year (Y) formats, - * formats with month names (b), and formats with am/pm (I) or no time (D) - * (also includes hour only, as the test is really for a colon) so we can - * cut down the number of tests we need to run for any given string - * (right now all are between 15 and 32 tests) - */ - -// TODO: this is way out of date vs. the server-side version -var timeFormats = { - // 24 hour - H: ['%H:%M:%S~%L', '%H:%M:%S', '%H:%M'], - // with am/pm - I: ['%I:%M:%S~%L%p', '%I:%M:%S%p', '%I:%M%p'], - // no colon, ie only date or date with hour (could also support eg 12h34m?) - D: ['%H', '%I%p', '%Hh'] -}; - -var dateFormats = { - Y: [ - '%Y~%m~%d', - '%Y%m%d', - '%y%m%d', // YYMMDD, has 6 digits together so will match Y, not y - '%m~%d~%Y', // MM/DD/YYYY has first precedence - '%d~%m~%Y' // then DD/MM/YYYY - ], - Yb: [ - '%b~%d~%Y', // eg nov 21 2013 - '%d~%b~%Y', // eg 21 nov 2013 - '%Y~%d~%b', // eg 2013 21 nov (or 2013 q3, after replacement) - '%Y~%b~%d' // eg 2013 nov 21 - ], - /** - * the two-digit year cases have so many potential ambiguities - * it's not even funny, but we'll try them anyway. - */ - y: [ - '%m~%d~%y', - '%d~%m~%y', - '%y~%m~%d' - ], - yb: [ - '%b~%d~%y', - '%d~%b~%y', - '%y~%d~%b', - '%y~%b~%d' - ] -}; - -// use utc formatter since we're ignoring timezone info -var formatter = d3.time.format.utc; - -/** - * ISO8601 and YYYYMMDDHHMMSS are the only ones where date and time - * are not separated by a space, so they get inserted specially here. - * Also a couple formats with no day (so time makes no sense) - */ -var dateTimeFormats = { - Y: { - H: ['%Y~%m~%dT%H:%M:%S', '%Y~%m~%dT%H:%M:%S~%L'].map(formatter), - I: [], - D: ['%Y%m%d%H%M%S', '%Y~%m', '%m~%Y'].map(formatter) - }, - Yb: {H: [], I: [], D: ['%Y~%b', '%b~%Y'].map(formatter)}, - y: {H: [], I: [], D: []}, - yb: {H: [], I: [], D: []} + return dateStr; }; -// all others get inserted in all possible combinations from dateFormats and timeFormats -['Y', 'Yb', 'y', 'yb'].forEach(function(dateType) { - dateFormats[dateType].forEach(function(dateFormat) { - // just a date (don't do just a time) - dateTimeFormats[dateType].D.push(formatter(dateFormat)); - ['H', 'I', 'D'].forEach(function(timeType) { - timeFormats[timeType].forEach(function(timeFormat) { - var a = dateTimeFormats[dateType][timeType]; - // 'date time', then 'time date' - a.push(formatter(dateFormat + '~' + timeFormat)); - a.push(formatter(timeFormat + '~' + dateFormat)); - }); - }); - }); -}); - -// precompiled regexps for performance -var matchword = /[a-z]*/g, - shortenword = function(m) { return m.substr(0, 3); }, - weekdaymatch = /(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g, - separatormatch = /[\s,\/\-\.\(\)]+/g, - ampmmatch = /~?([ap])~?m(~|$)/, - replaceampm = function(m, ap) { return ap + 'm '; }, - match4Y = /\d\d\d\d/, - matchMonthName = /(^|~)[a-z]{3}/, - matchAMPM = /[ap]m/, - matchcolon = /:/, - matchquarter = /q([1-4])/, - quarters = ['31~mar', '30~jun', '30~sep', '31~dec'], - replacequarter = function(m, n) { return quarters[n - 1]; }, - matchTZ = / ?([+\-]\d\d:?\d\d|Z)$/; - -function getDateType(v) { - var dateType; - dateType = (match4Y.test(v) ? 'Y' : 'y'); - dateType = dateType + (matchMonthName.test(v) ? 'b' : ''); - return dateType; -} - -function getTimeType(v) { - var timeType; - timeType = matchcolon.test(v) ? (matchAMPM.test(v) ? 'I' : 'H') : 'D'; - return timeType; -} - -exports.parseDate = function(v) { - // is it already a date? just return it - if(v.getTime) return v; - /** - * otherwise, if it's not a string, return nothing - * the case of numbers that just have years will get - * dealt with elsewhere. - */ - if(typeof v !== 'string') return false; - - // first clean up the string a bit to reduce the number of formats we have to test - v = v.toLowerCase() - /** - * cut all words down to 3 characters - this will result in - * some spurious matches, ie whenever the first three characters - * of a word match a month or weekday but that seems more likely - * to fix typos than to make dates where they shouldn't be... - * and then we can omit the long form of months from our testing - */ - .replace(matchword, shortenword) - /** - * remove weekday names, as they get overridden anyway if they're - * inconsistent also removes a few more words - * (ie "tuesday the 26th of november") - * TODO: language support? - * for months too, but these seem to be built into d3 - */ - .replace(weekdaymatch, '') - /** - * collapse all separators one ~ at a time, except : which seems - * pretty consistent for the time part use ~ instead of space or - * something since d3 can eat a space as padding on 1-digit numbers - */ - .replace(separatormatch, '~') - // in case of a.m. or p.m. (also take off any space before am/pm) - .replace(ampmmatch, replaceampm) - // turn quarters Q1-4 into dates (quarter ends) - .replace(matchquarter, replacequarter) - .trim() - // also try to ignore timezone info, at least for now - .replace(matchTZ, ''); - - // now test against the various formats that might match - var out = null, - dateType = getDateType(v), - timeType = getTimeType(v), - formatList, - len; - - formatList = dateTimeFormats[dateType][timeType]; - len = formatList.length; - - for(var i = 0; i < len; i++) { - out = formatList[i].parse(v); - if(out) break; +// normalize date format to date string, in case it starts as +// a Date object or milliseconds +// optional dflt is the return value if cleaning fails +exports.cleanDate = function(v, dflt) { + if(exports.isJSDate(v) || typeof v === 'number') { + // NOTE: if someone puts in a year as a number rather than a string, + // this will mistakenly convert it thinking it's milliseconds from 1970 + // that is: '2012' -> Jan. 1, 2012, but 2012 -> 2012 epoch milliseconds + v = exports.ms2DateTime(+v); + if(!v && dflt !== undefined) return dflt; } - - // If not an instance of Date at this point, just return it. - if(!(out instanceof Date)) return false; - // parse() method interprets arguments with local time zone. - var tzoff = out.getTimezoneOffset(); - // In general (default) this is not what we want, so force into UTC: - out.setTime(out.getTime() + tzoff * 60 * 1000); - return out; + else if(!exports.isDateTime(v)) { + logError('unrecognized date', v); + return dflt; + } + return v; }; -},{"d3":95,"fast-isnumeric":104}],624:[function(require,module,exports){ +},{"../constants/numerical":616,"./loggers":636,"d3":95,"fast-isnumeric":104}],625:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99075,7 +98860,7 @@ var Events = { module.exports = Events; -},{"events":102}],625:[function(require,module,exports){ +},{"events":102}],626:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99189,7 +98974,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":634}],626:[function(require,module,exports){ +},{"./is_plain_object.js":635}],627:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99240,7 +99025,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],627:[function(require,module,exports){ +},{}],628:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99252,19 +99037,26 @@ module.exports = function filterUnique(array) { 'use strict'; -module.exports = function filterVisible(dataIn) { - var dataOut = []; +/** Filter out object items with visible !== true + * insider array container. + * + * @param {array of objects} container + * @return {array of objects} of length <= container + * + */ +module.exports = function filterVisible(container) { + var out = []; - for(var i = 0; i < dataIn.length; i++) { - var trace = dataIn[i]; + for(var i = 0; i < container.length; i++) { + var item = container[i]; - if(trace.visible === true) dataOut.push(trace); + if(item.visible === true) out.push(item); } - return dataOut; + return out; }; -},{}],628:[function(require,module,exports){ +},{}],629:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99326,7 +99118,7 @@ function countryNameToISO3(countryName) { return false; } -},{"../lib":632,"country-regex":88}],629:[function(require,module,exports){ +},{"../lib":633,"country-regex":88}],630:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99458,7 +99250,7 @@ exports.makeBlank = function() { }; }; -},{}],630:[function(require,module,exports){ +},{}],631:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99541,7 +99333,7 @@ function formatColor(containerIn, opacityIn, len) { module.exports = formatColor; -},{"../components/color/attributes":532,"../components/colorscale":548,"./str2rgbarray":645,"fast-isnumeric":104,"tinycolor2":489}],631:[function(require,module,exports){ +},{"../components/color/attributes":532,"../components/colorscale":547,"./str2rgbarray":646,"fast-isnumeric":104,"tinycolor2":489}],632:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99610,7 +99402,7 @@ function convertHTMLToUnicode(html) { module.exports = convertHTMLToUnicode; -},{"../constants/string_mappings":617,"superscript-text":486}],632:[function(require,module,exports){ +},{"../constants/string_mappings":617,"superscript-text":486}],633:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -99636,19 +99428,15 @@ lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; lib.validate = coerceModule.validate; -lib.isValObject = coerceModule.isValObject; -lib.crawl = coerceModule.crawl; -lib.findArrayAttributes = coerceModule.findArrayAttributes; -lib.IS_SUBPLOT_OBJ = coerceModule.IS_SUBPLOT_OBJ; -lib.IS_LINKED_TO_ARRAY = coerceModule.IS_LINKED_TO_ARRAY; -lib.DEPRECATED = coerceModule.DEPRECATED; -lib.UNDERSCORE_ATTRS = coerceModule.UNDERSCORE_ATTRS; var datesModule = require('./dates'); lib.dateTime2ms = datesModule.dateTime2ms; lib.isDateTime = datesModule.isDateTime; lib.ms2DateTime = datesModule.ms2DateTime; -lib.parseDate = datesModule.parseDate; +lib.cleanDate = datesModule.cleanDate; +lib.isJSDate = datesModule.isJSDate; +lib.MIN_MS = datesModule.MIN_MS; +lib.MAX_MS = datesModule.MAX_MS; var searchModule = require('./search'); lib.findBin = searchModule.findBin; @@ -99689,6 +99477,10 @@ lib.error = loggersModule.error; lib.notifier = require('./notifier'); lib.filterUnique = require('./filter_unique'); +lib.filterVisible = require('./filter_visible'); + + +lib.cleanNumber = require('./clean_number'); /** * swap x and y of the same attribute in container cont @@ -99865,7 +99657,7 @@ lib.smooth = function(arrayIn, FWHM) { * as long as its returns are not promises (ie have no .then) * includes one argument arg to send to all functions... * this is mainly just to prevent us having to make wrapper functions - * when the only purpose of the wrapper is to reference gd / td + * when the only purpose of the wrapper is to reference gd * and a final step to be executed at the end * TODO: if there's an error and everything is sync, * this doesn't happen yet because we want to make sure @@ -100338,7 +100130,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./coerce":622,"./dates":623,"./extend":625,"./filter_unique":626,"./is_array":633,"./is_plain_object":634,"./loggers":635,"./matrix":636,"./nested_property":637,"./notifier":638,"./search":641,"./stats":644,"d3":95}],633:[function(require,module,exports){ +},{"./clean_number":622,"./coerce":623,"./dates":624,"./extend":626,"./filter_unique":627,"./filter_visible":628,"./is_array":634,"./is_plain_object":635,"./loggers":636,"./matrix":637,"./nested_property":638,"./notifier":639,"./search":642,"./stats":645,"d3":95}],634:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100356,7 +100148,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ArrayBuffer.isView(a); }; -},{}],634:[function(require,module,exports){ +},{}],635:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100385,7 +100177,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],635:[function(require,module,exports){ +},{}],636:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100452,7 +100244,7 @@ loggers.error = function() { } }; -},{"../plot_api/plot_config":651}],636:[function(require,module,exports){ +},{"../plot_api/plot_config":652}],637:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100562,7 +100354,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],637:[function(require,module,exports){ +},{}],638:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100819,7 +100611,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./is_array":633,"fast-isnumeric":104}],638:[function(require,module,exports){ +},{"./is_array":634,"fast-isnumeric":104}],639:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -100896,7 +100688,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":95,"fast-isnumeric":104}],639:[function(require,module,exports){ +},{"d3":95,"fast-isnumeric":104}],640:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101136,7 +100928,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"./matrix":636}],640:[function(require,module,exports){ +},{"./matrix":637}],641:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101347,7 +101139,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":632,"../plot_api/plot_config":651}],641:[function(require,module,exports){ +},{"../lib":633,"../plot_api/plot_config":652}],642:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101458,7 +101250,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":635,"fast-isnumeric":104}],642:[function(require,module,exports){ +},{"./loggers":636,"fast-isnumeric":104}],643:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101481,7 +101273,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],643:[function(require,module,exports){ +},{}],644:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101530,7 +101322,7 @@ module.exports = function showWebGlMsg(scene) { return false; }; -},{"../components/color":533}],644:[function(require,module,exports){ +},{"../components/color":533}],645:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101626,7 +101418,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":104}],645:[function(require,module,exports){ +},{"fast-isnumeric":104}],646:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101648,7 +101440,7 @@ function str2RgbaArray(color) { module.exports = str2RgbaArray; -},{"arraytools":33,"tinycolor2":489}],646:[function(require,module,exports){ +},{"arraytools":33,"tinycolor2":489}],647:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -101762,8 +101554,8 @@ exports.convertToTspans = function(_context, _callback) { } if(tex) { - var td = Lib.getPlotDiv(that.node()); - ((td && td._promises) || []).push(new Promise(function(resolve) { + var gd = Lib.getPlotDiv(that.node()); + ((gd && gd._promises) || []).push(new Promise(function(resolve) { that.style({visibility: 'hidden'}); var config = {fontSize: parseInt(that.style('font-size'), 10)}; @@ -102175,7 +101967,7 @@ exports.makeEditable = function(context, _delegate, options) { return d3.rebind(this, dispatch, 'on'); }; -},{"../constants/string_mappings":617,"../constants/xmlns_namespaces":618,"../lib":632,"d3":95}],647:[function(require,module,exports){ +},{"../constants/string_mappings":617,"../constants/xmlns_namespaces":618,"../lib":633,"d3":95}],648:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102189,8 +101981,8 @@ exports.makeEditable = function(context, _delegate, options) { var topojsonUtils = module.exports = {}; -var locationmodeToLayer = require('../plots/geo/constants').locationmodeToLayer, - topojsonFeature = require('topojson').feature; +var locationmodeToLayer = require('../plots/geo/constants').locationmodeToLayer; +var topojsonFeature = require('topojson-client').feature; topojsonUtils.getTopojsonName = function(geoLayout) { @@ -102211,7 +102003,7 @@ topojsonUtils.getTopojsonFeatures = function(trace, topojson) { return topojsonFeature(topojson, obj).features; }; -},{"../plots/geo/constants":685,"topojson":491}],648:[function(require,module,exports){ +},{"../plots/geo/constants":686,"topojson-client":491}],649:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102245,7 +102037,7 @@ module.exports = function truncate(arrayIn, len) { throw new Error('This array type is not yet supported by `truncate`.'); }; -},{}],649:[function(require,module,exports){ +},{}],650:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -102350,13 +102142,12 @@ exports.cleanLayout = function(layout) { } } - if(layout.annotations !== undefined && !Array.isArray(layout.annotations)) { - Lib.warn('Annotations must be an array.'); - delete layout.annotations; - } - var annotationsLen = (layout.annotations || []).length; + var annotationsLen = Array.isArray(layout.annotations) ? layout.annotations.length : 0; for(i = 0; i < annotationsLen; i++) { var ann = layout.annotations[i]; + + if(!Lib.isPlainObject(ann)) continue; + if(ann.ref) { if(ann.ref === 'paper') { ann.xref = 'paper'; @@ -102368,17 +102159,17 @@ exports.cleanLayout = function(layout) { } delete ann.ref; } + cleanAxRef(ann, 'xref'); cleanAxRef(ann, 'yref'); } - if(layout.shapes !== undefined && !Array.isArray(layout.shapes)) { - Lib.warn('Shapes must be an array.'); - delete layout.shapes; - } - var shapesLen = (layout.shapes || []).length; + var shapesLen = Array.isArray(layout.shapes) ? layout.shapes.length : 0; for(i = 0; i < shapesLen; i++) { var shape = layout.shapes[i]; + + if(!Lib.isPlainObject(shape)) continue; + cleanAxRef(shape, 'xref'); cleanAxRef(shape, 'yref'); } @@ -102727,7 +102518,7 @@ exports.manageArrayContainers = function(np, newVal, undoit) { } }; -},{"../components/color":533,"../lib":632,"../plots/cartesian/axes":662,"../plots/plots":723,"../registry":738,"fast-isnumeric":104,"gl-mat4/fromQuat":146}],650:[function(require,module,exports){ +},{"../components/color":533,"../lib":633,"../plots/cartesian/axes":664,"../plots/plots":724,"../registry":739,"fast-isnumeric":104,"gl-mat4/fromQuat":146}],651:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -104647,13 +104438,14 @@ function _relayout(gd, aobj) { objList = layout[objType] || [], obji = objList[objNum] || {}; - // new API, remove annotation / shape with `null` - if(vi === null) aobj[ai] = 'remove'; - // if p.parts is just an annotation number, and val is either // 'add' or an entire annotation to add, the undo is 'remove' // if val is 'remove' then undo is the whole annotation object if(p.parts.length === 2) { + + // new API, remove annotation / shape with `null` + if(vi === null) aobj[ai] = 'remove'; + if(aobj[ai] === 'add' || Lib.isPlainObject(aobj[ai])) { undoit[ai] = 'remove'; } @@ -104688,6 +104480,7 @@ function _relayout(gd, aobj) { } // alter gd.layout else { + var pp1 = String(p.parts[1] || ''); // check whether we can short-circuit a full redraw // 3d or geo at this point just needs to redraw. if(p.parts[0].indexOf('scene') === 0) flags.doplot = true; @@ -104702,17 +104495,17 @@ function _relayout(gd, aobj) { else if(ai.indexOf('title') !== -1) flags.doticks = true; else if(p.parts[0].indexOf('bgcolor') !== -1) flags.dolayoutstyle = true; else if(p.parts.length > 1 && - Lib.containsAny(p.parts[1], ['tick', 'exponent', 'grid', 'zeroline'])) { + Lib.containsAny(pp1, ['tick', 'exponent', 'grid', 'zeroline'])) { flags.doticks = true; } else if(ai.indexOf('.linewidth') !== -1 && ai.indexOf('axis') !== -1) { flags.doticks = flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1].indexOf('line') !== -1) { + else if(p.parts.length > 1 && pp1.indexOf('line') !== -1) { flags.dolayoutstyle = true; } - else if(p.parts.length > 1 && p.parts[1] === 'mirror') { + else if(p.parts.length > 1 && pp1 === 'mirror') { flags.doticks = flags.dolayoutstyle = true; } else if(ai === 'margin.pad') { @@ -104734,7 +104527,7 @@ function _relayout(gd, aobj) { */ else if(['hovermode', 'dragmode'].indexOf(ai) !== -1) flags.domodebar = true; else if(['hovermode', 'dragmode', 'height', - 'width', 'autosize'].indexOf(ai) === -1) { + 'width', 'autosize'].indexOf(ai) === -1) { flags.doplot = true; } @@ -104943,6 +104736,20 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } } + // Execute a callback after the wrapper function has been called n times. + // This is used to defer the resolution until a transition has resovled *and* + // the frame has completed. If it's not done this way, then we get a race + // condition in which the animation might resolve before a transition is complete + // or vice versa. + function callbackOnNthTime(cb, n) { + var cnt = 0; + return function() { + if(cb && ++cnt === n) { + return cb(); + } + }; + } + return new Promise(function(resolve, reject) { function discardExistingFrames() { if(trans._frameQueue.length === 0) { @@ -104987,14 +104794,13 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { frameOpts: frameOpts, transitionOpts: transitionOpts, }; - if(i === frameList.length - 1) { // The last frame in this .animate call stores the promise resolve // and reject callbacks. This is how we ensure that the animation // loop (which may exist as a result of a *different* .animate call) // still resolves or rejecdts this .animate call's promise. once it's // complete. - nextFrame.onComplete = resolve; + nextFrame.onComplete = callbackOnNthTime(resolve, 2); nextFrame.onInterrupt = reject; } @@ -105032,7 +104838,6 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { // Execute the callback and unset it to ensure it doesn't // accidentally get called twice trans._currentFrame.onComplete(); - trans._currentFrame.onComplete = null; } var newFrame = trans._currentFrame = trans._frameQueue.shift(); @@ -105052,7 +104857,12 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { helpers.coerceTraceIndices(gd, newFrame.frame.traces), newFrame.frameOpts, newFrame.transitionOpts - ); + ).then(function() { + if(newFrame.onComplete) { + newFrame.onComplete(); + } + + }); gd.emit('plotly_animatingframe', { name: newFrame.name, @@ -105128,6 +104938,8 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { for(i = 0; i < trans._frames.length; i++) { frame = trans._frames[i]; + if(!frame) continue; + if(allFrames || frame.group === frameOrGroupNameOrFrameList) { frameList.push({ type: 'byname', @@ -105139,14 +104951,15 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { } else if(isFrameArray) { for(i = 0; i < frameOrGroupNameOrFrameList.length; i++) { var frameOrName = frameOrGroupNameOrFrameList[i]; - if(typeof frameOrName === 'string') { + if(['number', 'string'].indexOf(typeof frameOrName) !== -1) { + frameOrName = String(frameOrName); // In this case, there's an array and this frame is a string name: frameList.push({ type: 'byname', name: frameOrName, data: setTransitionConfig({name: frameOrName}) }); - } else { + } else if(Lib.isPlainObject(frameOrName)) { frameList.push({ type: 'object', data: setTransitionConfig(Lib.extendFlat({}, frameOrName)) @@ -105290,7 +105103,7 @@ Plotly.addFrames = function(gd, frameList, indices) { if(_hash[frame.name]) { // If frame is present, overwrite its definition: for(j = 0; j < _frames.length; j++) { - if(_frames[j].name === frame.name) break; + if((_frames[j] || {}).name === frame.name) break; } ops.push({type: 'replace', index: j, value: frame}); revops.unshift({type: 'replace', index: j, value: _frames[j]}); @@ -105490,7 +105303,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":557,"../components/errorbars":563,"../constants/xmlns_namespaces":618,"../lib":632,"../lib/events":624,"../lib/queue":640,"../lib/svg_text_utils":646,"../plotly":658,"../plots/cartesian/graph_interact":670,"../plots/plots":723,"../plots/polar":726,"../registry":738,"./helpers":649,"./subroutines":655,"d3":95,"fast-isnumeric":104}],651:[function(require,module,exports){ +},{"../components/drawing":556,"../components/errorbars":562,"../constants/xmlns_namespaces":618,"../lib":633,"../lib/events":625,"../lib/queue":641,"../lib/svg_text_utils":647,"../plotly":659,"../plots/cartesian/graph_interact":671,"../plots/plots":724,"../plots/polar":727,"../registry":739,"./helpers":650,"./subroutines":656,"d3":95,"fast-isnumeric":104}],652:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105610,7 +105423,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],652:[function(require,module,exports){ +},{}],653:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -105622,185 +105435,287 @@ function defaultSetBackground(gd, bgColor) { 'use strict'; -var Plotly = require('../plotly'); var Registry = require('../registry'); -var Plots = require('../plots/plots'); var Lib = require('../lib'); -// FIXME polar attribute are not part of Plotly yet +var baseAttributes = require('../plots/attributes'); +var baseLayoutAttributes = require('../plots/layout_attributes'); +var frameAttributes = require('../plots/frame_attributes'); +var animationAttributes = require('../plots/animation_attributes'); + +// polar attributes are not part of the Registry yet var polarAreaAttrs = require('../plots/polar/area_attributes'); var polarAxisAttrs = require('../plots/polar/axis_attributes'); var extendFlat = Lib.extendFlat; var extendDeep = Lib.extendDeep; -var extendDeepAll = Lib.extendDeepAll; - -var NESTED_MODULE = '_nestedModules', - COMPOSED_MODULE = '_composedModules'; -var plotSchema = { - traces: {}, - layout: {}, - transforms: {}, - defs: {} -}; +var IS_SUBPLOT_OBJ = '_isSubplotObj'; +var IS_LINKED_TO_ARRAY = '_isLinkedToArray'; +var DEPRECATED = '_deprecated'; +var UNDERSCORE_ATTRS = [IS_SUBPLOT_OBJ, IS_LINKED_TO_ARRAY, DEPRECATED]; +exports.IS_SUBPLOT_OBJ = IS_SUBPLOT_OBJ; +exports.IS_LINKED_TO_ARRAY = IS_LINKED_TO_ARRAY; +exports.DEPRECATED = DEPRECATED; +exports.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS; -var PlotSchema = module.exports = {}; +/** Outputs the full plotly.js plot schema + * + * @return {object} + * - defs + * - traces + * - layout + * - transforms + * - frames + * - animations + * - config (coming soon ...) + */ +exports.get = function() { + var traces = {}; + + Registry.allTypes.concat('area').forEach(function(type) { + traces[type] = getTraceAttributes(type); + }); + var transforms = {}; -PlotSchema.get = function() { - Registry.allTypes - .concat('area') // FIXME polar 'area' attributes - .forEach(getTraceAttributes); + Object.keys(Registry.transformsRegistry).forEach(function(type) { + transforms[type] = getTransformAttributes(type); + }); - getLayoutAttributes(); + return { + defs: { + valObjects: Lib.valObjects, + metaKeys: UNDERSCORE_ATTRS.concat['description', 'role'] + }, - Object.keys(Registry.transformsRegistry).forEach(getTransformAttributes); + traces: traces, + layout: getLayoutAttributes(), - getDefs(); + transforms: transforms, - return plotSchema; + frames: formatAttributes(frameAttributes), + animation: formatAttributes(animationAttributes) + }; }; -PlotSchema.crawl = Lib.crawl; +/** + * Crawl the attribute tree, recursively calling a callback function + * + * @param {object} attrs + * The node of the attribute tree (e.g. the root) from which recursion originates + * @param {Function} callback + * A callback function with the signature: + * @callback callback + * @param {object} attr an attribute + * @param {String} attrName name string + * @param {object[]} attrs all the attributes + * @param {Number} level the recursion level, 0 at the root + * @param {Number} [specifiedLevel] + * The level in the tree, in order to let the callback function detect descend or backtrack, + * typically unsupplied (implied 0), just used by the self-recursive call. + * The necessity arises because the tree traversal is not controlled by callback return values. + * The decision to not use callback return values for controlling tree pruning arose from + * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions + * precedes the callback call. + * + * @return {object} transformOut + * copy of transformIn that contains attribute defaults + */ +exports.crawl = function(attrs, callback, specifiedLevel) { + var level = specifiedLevel || 0; -PlotSchema.isValObject = Lib.isValObject; + Object.keys(attrs).forEach(function(attrName) { + var attr = attrs[attrName]; -function getTraceAttributes(type) { - var globalAttributes = Plots.attributes, - _module = getModule({type: type}), - meta = getMeta(type), - subplotRegistry = getSubplotRegistry(type); + if(UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - var attributes = {}, - layoutAttributes = {}; + callback(attr, attrName, attrs, level); - // make 'type' the first attribute in the object - attributes.type = null; + if(exports.isValObject(attr)) return; - // global attributes (same for all trace types) - extendDeep(attributes, globalAttributes); + if(Lib.isPlainObject(attr)) exports.crawl(attr, callback, level + 1); + }); +}; - // module attributes (+ nested + composed) - attributes = coupleAttrs( - _module.attributes, attributes, 'attributes', type - ); +/** Is object a value object (or a container object)? + * + * @param {object} obj + * @return {boolean} + * returns true for a valid value object and + * false for tree nodes in the attribute hierarchy + */ +exports.isValObject = function(obj) { + return obj && obj.valType !== undefined; +}; - // subplot attributes - if(subplotRegistry.attributes !== undefined) { - extendDeep(attributes, subplotRegistry.attributes); +/** + * Find all data array attributes in a given trace object - including + * `arrayOk` attributes. + * + * @param {object} trace + * full trace object that contains a reference to `_module.attributes` + * + * @return {array} arrayAttributes + * list of array attributes for the given trace + */ +exports.findArrayAttributes = function(trace) { + var arrayAttributes = [], + stack = []; + + function callback(attr, attrName, attrs, level) { + stack = stack.slice(0, level).concat([attrName]); + + var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true; + if(!splittableAttr) return; + + var astr = toAttrString(stack); + var val = Lib.nestedProperty(trace, astr).get(); + if(!Array.isArray(val)) return; + + arrayAttributes.push(astr); } - // 'type' gets overwritten by globalAttributes; reset it here - attributes.type = type; + function toAttrString(stack) { + return stack.join('.'); + } - attributes = removeUnderscoreAttrs(attributes); - mergeValTypeAndRole(attributes); - plotSchema.traces[type] = extendFlat({}, - meta, - { attributes: attributes } - ); + exports.crawl(trace._module.attributes, callback); - // trace-specific layout attributes - if(_module.layoutAttributes !== undefined) { - layoutAttributes = coupleAttrs( - _module.layoutAttributes, layoutAttributes, 'layoutAttributes', type - ); + if(trace.transforms) { + var transforms = trace.transforms; - mergeValTypeAndRole(layoutAttributes); - plotSchema.traces[type].layoutAttributes = layoutAttributes; + for(var i = 0; i < transforms.length; i++) { + var transform = transforms[i]; + + stack = ['transforms[' + i + ']']; + exports.crawl(transform._module.attributes, callback, 1); + } } -} -function getLayoutAttributes() { - var globalLayoutAttributes = Plots.layoutAttributes, - layoutAttributes = {}; + // Look into the fullInput module attributes for array attributes + // to make sure that 'custom' array attributes are detected. + // + // At the moment, we need this block to make sure that + // ohlc and candlestick 'open', 'high', 'low', 'close' can be + // used with filter ang groupby transforms. + if(trace._fullInput) { + exports.crawl(trace._fullInput._module.attributes, callback); - // layout module attributes (+ nested + composed) - layoutAttributes = coupleAttrs( - globalLayoutAttributes, layoutAttributes, 'layoutAttributes', '*' - ); + arrayAttributes = Lib.filterUnique(arrayAttributes); + } - // FIXME polar layout attributes - layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); + return arrayAttributes; +}; - // add crawler.IS_SUBPLOT_OBJ attribute - layoutAttributes = handleSubplotObjs(layoutAttributes); +function getTraceAttributes(type) { + var _module, basePlotModule; - layoutAttributes = removeUnderscoreAttrs(layoutAttributes); - mergeValTypeAndRole(layoutAttributes); + if(type === 'area') { + _module = { attributes: polarAreaAttrs }; + basePlotModule = {}; + } + else { + _module = Registry.modules[type]._module, + basePlotModule = _module.basePlotModule; + } - // generate crawler.IS_LINKED_TO_ARRAY structure - handleLinkedToArray(layoutAttributes); + var attributes = {}; - plotSchema.layout = { layoutAttributes: layoutAttributes }; -} + // make 'type' the first attribute in the object + attributes.type = null; -function getTransformAttributes(name) { - var _module = Registry.transformsRegistry[name], - _schema = {}; + // base attributes (same for all trace types) + extendDeep(attributes, baseAttributes); - _schema = coupleAttrs(_schema, _module.attributes || {}, 'attributes', '*'); - _schema = removeUnderscoreAttrs(_schema); - mergeValTypeAndRole(_schema); - handleLinkedToArray(_schema); + // module attributes + extendDeep(attributes, _module.attributes); - plotSchema.transforms[name] = { attributes: _schema }; -} + // subplot attributes + if(basePlotModule.attributes) { + extendDeep(attributes, basePlotModule.attributes); + } -function getDefs() { - plotSchema.defs = { - valObjects: Lib.valObjects, - metaKeys: Lib.UNDERSCORE_ATTRS.concat(['description', 'role']) + // 'type' gets overwritten by baseAttributes; reset it here + attributes.type = type; + + var out = { + meta: _module.meta || {}, + attributes: formatAttributes(attributes), }; + + // trace-specific layout attributes + if(_module.layoutAttributes) { + var layoutAttributes = {}; + + extendDeep(layoutAttributes, _module.layoutAttributes); + out.layoutAttributes = formatAttributes(layoutAttributes); + } + + return out; } -function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) { - var nestedModule, nestedAttrs, nestedReference, - composedModule, composedAttrs; +function getLayoutAttributes() { + var layoutAttributes = {}; - Object.keys(attrsIn).forEach(function(k) { + // global layout attributes + extendDeep(layoutAttributes, baseLayoutAttributes); - if(k === NESTED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - nestedModule = getModule({_module: attrsIn[k][kk]}); - if(nestedModule === undefined) return; + // add base plot module layout attributes + Object.keys(Registry.subplotsRegistry).forEach(function(k) { + var _module = Registry.subplotsRegistry[k]; - nestedAttrs = nestedModule[whichAttrs]; - nestedReference = coupleAttrs( - nestedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - Lib.nestedProperty(attrsOut, kk) - .set(extendDeep({}, nestedReference)); - }); - return; + if(_module.name === 'cartesian') { + handleBasePlotModule(layoutAttributes, _module, 'xaxis'); + handleBasePlotModule(layoutAttributes, _module, 'yaxis'); } + else { + var astr = _module.attr === 'subplot' ? _module.name : _module.attr; + + handleBasePlotModule(layoutAttributes, _module, astr); + } + }); - if(k === COMPOSED_MODULE) { - Object.keys(attrsIn[k]).forEach(function(kk) { - if(kk !== type) return; + // polar layout attributes + layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); - composedModule = getModule({_module: attrsIn[k][kk]}); - if(composedModule === undefined) return; + // add registered components layout attribute + Object.keys(Registry.componentsRegistry).forEach(function(k) { + var _module = Registry.componentsRegistry[k]; - composedAttrs = composedModule[whichAttrs]; - composedAttrs = coupleAttrs( - composedAttrs, {}, whichAttrs, type - ); + if(!_module.layoutAttributes) return; - extendDeepAll(attrsOut, composedAttrs); + if(Array.isArray(_module.layoutNodes)) { + _module.layoutNodes.forEach(function(v) { + handleRegisteredComponent(layoutAttributes, _module, v + _module.name); }); - return; } - - attrsOut[k] = Lib.isPlainObject(attrsIn[k]) ? - extendDeepAll({}, attrsIn[k]) : - attrsIn[k]; + else { + handleRegisteredComponent(layoutAttributes, _module, _module.name); + } }); - return attrsOut; + return { + layoutAttributes: formatAttributes(layoutAttributes) + }; +} + +function getTransformAttributes(type) { + var _module = Registry.transformsRegistry[type]; + + return { + attributes: formatAttributes(_module.attributes) + }; +} + +function formatAttributes(attrs) { + mergeValTypeAndRole(attrs); + formatArrayContainers(attrs); + + return attrs; } function mergeValTypeAndRole(attrs) { @@ -105814,7 +105729,7 @@ function mergeValTypeAndRole(attrs) { } function callback(attr, attrName, attrs) { - if(PlotSchema.isValObject(attr)) { + if(exports.isValObject(attr)) { if(attr.valType === 'data_array') { // all 'data_array' attrs have role 'data' attr.role = 'data'; @@ -105832,40 +105747,26 @@ function mergeValTypeAndRole(attrs) { } } - Lib.crawl(attrs, callback); + exports.crawl(attrs, callback); } -// helper methods +function formatArrayContainers(attrs) { -function getModule(arg) { - if('type' in arg) { - return (arg.type === 'area') ? // FIXME - { attributes: polarAreaAttrs } : - Registry.getModule({type: arg.type}); - } + function callback(attr, attrName, attrs) { + if(!attr) return; - var subplotsRegistry = Registry.subplotsRegistry, - componentsRegistry = Registry.componentsRegistry, - _module = arg._module; + var itemName = attr[IS_LINKED_TO_ARRAY]; - if(subplotsRegistry[_module]) return subplotsRegistry[_module]; - else if(componentsRegistry[_module]) return componentsRegistry[_module]; + if(!itemName) return; - // look it internal Plotly if all previous attempts fail - return Plotly[_module]; -} + delete attr[IS_LINKED_TO_ARRAY]; -function removeUnderscoreAttrs(attributes) { - Object.keys(attributes).forEach(function(k) { - if(k.charAt(0) === '_' && - Lib.UNDERSCORE_ATTRS.indexOf(k) === -1) delete attributes[k]; - }); - return attributes; -} + attrs[attrName] = { items: {} }; + attrs[attrName].items[itemName] = attr; + attrs[attrName].role = 'object'; + } -function getMeta(type) { - if(type === 'area') return {}; // FIXME - return Registry.modules[type].meta || {}; + exports.crawl(attrs, callback); } function assignPolarLayoutAttrs(layoutAttributes) { @@ -105876,68 +105777,25 @@ function assignPolarLayoutAttrs(layoutAttributes) { extendFlat(layoutAttributes, polarAxisAttrs.layout); - return layoutAttributes; // FIXME -} - -function getSubplotRegistry(traceType) { - if(traceType === 'area') return {}; // FIXME - - var subplotsRegistry = Registry.subplotsRegistry, - subplotType = Object.keys(subplotsRegistry).filter(function(subplotType) { - return Registry.traceIs({type: traceType}, subplotType); - })[0]; - - if(subplotType === undefined) return {}; - - return subplotsRegistry[subplotType]; -} - -function handleSubplotObjs(layoutAttributes) { - var subplotsRegistry = Registry.subplotsRegistry; - - Object.keys(layoutAttributes).forEach(function(k) { - Object.keys(subplotsRegistry).forEach(function(subplotType) { - var subplotRegistry = subplotsRegistry[subplotType], - isSubplotObj; - - if(!subplotRegistry.attrRegex) return; - - if(subplotType === 'cartesian' || subplotType === 'gl2d') { - isSubplotObj = ( - subplotRegistry.attrRegex.x.test(k) || - subplotRegistry.attrRegex.y.test(k) - ); - } - else { - isSubplotObj = subplotRegistry.attrRegex.test(k); - } - - if(isSubplotObj) layoutAttributes[k][Lib.IS_SUBPLOT_OBJ] = true; - }); - }); - return layoutAttributes; } -function handleLinkedToArray(layoutAttributes) { - - function callback(attr, attrName, attrs) { - if(attr[Lib.IS_LINKED_TO_ARRAY] !== true) return; - - // TODO more robust logic - var itemName = attrName.substr(0, attrName.length - 1); +function handleBasePlotModule(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep({}, _module.layoutAttributes); - delete attr[Lib.IS_LINKED_TO_ARRAY]; + attrs[IS_SUBPLOT_OBJ] = true; + np.set(attrs); +} - attrs[attrName] = { items: {} }; - attrs[attrName].items[itemName] = attr; - attrs[attrName].role = 'object'; - } +function handleRegisteredComponent(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr), + attrs = extendDeep(np.get() || {}, _module.layoutAttributes); - Lib.crawl(layoutAttributes, callback); + np.set(attrs); } -},{"../lib":632,"../plotly":658,"../plots/plots":723,"../plots/polar/area_attributes":724,"../plots/polar/axis_attributes":725,"../registry":738}],653:[function(require,module,exports){ +},{"../lib":633,"../plots/animation_attributes":660,"../plots/attributes":662,"../plots/frame_attributes":685,"../plots/layout_attributes":715,"../plots/polar/area_attributes":725,"../plots/polar/axis_attributes":726,"../registry":739}],654:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106029,10 +105887,14 @@ function registerTransformModule(newModule) { } function registerComponentModule(newModule) { - Registry.componentsRegistry[newModule.name] = newModule; + if(typeof newModule.name !== 'string') { + throw new Error('Component module *name* must be a string.'); + } + + Registry.registerComponent(newModule); } -},{"../lib":632,"../registry":738}],654:[function(require,module,exports){ +},{"../lib":633,"../registry":739}],655:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106058,7 +105920,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":632,"../plotly":658}],655:[function(require,module,exports){ +},{"../lib":633,"../plotly":659}],656:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106380,7 +106242,7 @@ exports.doModeBar = function(gd) { return Plots.previousPromises(gd); }; -},{"../components/color":533,"../components/drawing":557,"../components/modebar":580,"../components/titles":608,"../lib":632,"../plotly":658,"../plots/plots":723,"../registry":738}],656:[function(require,module,exports){ +},{"../components/color":533,"../components/drawing":556,"../components/modebar":579,"../components/titles":607,"../lib":633,"../plotly":659,"../plots/plots":724,"../registry":739}],657:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106435,7 +106297,7 @@ function toImage(gd, opts) { // first clone the GD so we can operate in a clean environment var clone = clonePlot(gd, {format: 'png', height: opts.height, width: opts.width}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -106490,7 +106352,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":632,"../plotly":658,"../snapshot/cloneplot":739,"../snapshot/helpers":742,"../snapshot/svgtoimg":744,"../snapshot/tosvg":746,"fast-isnumeric":104}],657:[function(require,module,exports){ +},{"../lib":633,"../plotly":659,"../snapshot/cloneplot":740,"../snapshot/helpers":743,"../snapshot/svgtoimg":745,"../snapshot/tosvg":747,"fast-isnumeric":104}],658:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106666,7 +106528,8 @@ function crawl(objIn, objOut, schema, list, base, path) { crawl(valIn, valOut, nestedSchema, list, base, p); } else if(nestedSchema.items && !isInfoArray && isArray(valIn)) { - var itemName = k.substr(0, k.length - 1), + var items = nestedSchema.items, + _nestedSchema = items[Object.keys(items)[0]], indexList = []; var j, _p; @@ -106674,8 +106537,7 @@ function crawl(objIn, objOut, schema, list, base, path) { // loop over valOut items while keeping track of their // corresponding input container index (given by _index) for(j = 0; j < valOut.length; j++) { - var _nestedSchema = nestedSchema.items[itemName], - _index = valOut[j]._index || j; + var _index = valOut[j]._index || j; _p = p.slice(); _p.push(_index); @@ -106860,7 +106722,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":632,"../plots/plots":723,"./plot_schema":652}],658:[function(require,module,exports){ +},{"../lib":633,"../plots/plots":724,"./plot_schema":653}],659:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -106888,25 +106750,12 @@ exports.defaultConfig = require('./plot_api/plot_config'); exports.Plots = require('./plots/plots'); exports.Axes = require('./plots/cartesian/axes'); exports.Fx = require('./plots/cartesian/graph_interact'); - -// components -exports.Color = require('./components/color'); -exports.Drawing = require('./components/drawing'); -exports.Colorscale = require('./components/colorscale'); -exports.Colorbar = require('./components/colorbar'); -exports.ErrorBars = require('./components/errorbars'); -exports.Annotations = require('./components/annotations'); -exports.Shapes = require('./components/shapes'); -exports.Legend = require('./components/legend'); -exports.Images = require('./components/images'); -exports.UpdateMenus = require('./components/updatemenus'); -exports.Sliders = require('./components/sliders'); exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/annotations":531,"./components/color":533,"./components/colorbar":538,"./components/colorscale":548,"./components/drawing":557,"./components/errorbars":563,"./components/images":569,"./components/legend":577,"./components/modebar":580,"./components/shapes":601,"./components/sliders":607,"./components/updatemenus":613,"./plot_api/plot_api":650,"./plot_api/plot_config":651,"./plots/cartesian/axes":662,"./plots/cartesian/graph_interact":670,"./plots/plots":723}],659:[function(require,module,exports){ +},{"./components/modebar":579,"./plot_api/plot_api":651,"./plot_api/plot_config":652,"./plots/cartesian/axes":664,"./plots/cartesian/graph_interact":671,"./plots/plots":724}],660:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107008,7 +106857,76 @@ module.exports = { } }; -},{}],660:[function(require,module,exports){ +},{}],661:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var Lib = require('../lib'); + + +/** Convenience wrapper for making array container logic DRY and consistent + * + * @param {object} parentObjIn + * user input object where the container in question is linked + * (i.e. either a user trace object or the user layout object) + * + * @param {object} parentObjOut + * full object where the coerced container will be linked + * (i.e. either a full trace object or the full layout object) + * + * @param {object} opts + * options object: + * - name {string} + * name of the key linking the container in question + * - handleItemDefaults {function} + * defaults method to be called on each item in the array container in question + * + * Its arguments are: + * - itemIn {object} item in user layout + * - itemOut {object} item in full layout + * - parentObj {object} (as in closure) + * - opts {object} (as in closure) + * - itemOpts {object} + * - itemIsNotPlainObject {boolean} + * N.B. + * + * - opts is passed to handleItemDefaults so it can also store + * links to supplementary data (e.g. fullData for layout components) + * + */ +module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut, opts) { + var name = opts.name; + + var contIn = Array.isArray(parentObjIn[name]) ? parentObjIn[name] : [], + contOut = parentObjOut[name] = []; + + for(var i = 0; i < contIn.length; i++) { + var itemIn = contIn[i], + itemOut = {}, + itemOpts = {}; + + if(!Lib.isPlainObject(itemIn)) { + itemOpts.itemIsNotPlainObject = true; + itemIn = {}; + } + + opts.handleItemDefaults(itemIn, itemOut, parentObjOut, opts, itemOpts); + + itemOut._input = itemIn; + itemOut._index = i; + + contOut.push(itemOut); + } +}; + +},{"../lib":633}],662:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107091,7 +107009,7 @@ module.exports = { } }; -},{}],661:[function(require,module,exports){ +},{}],663:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107118,7 +107036,7 @@ module.exports = { } }; -},{}],662:[function(require,module,exports){ +},{}],664:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -107140,6 +107058,15 @@ var Titles = require('../../components/titles'); var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); +var constants = require('../../constants/numerical'); +var FP_SAFE = constants.FP_SAFE; +var ONEAVGYEAR = constants.ONEAVGYEAR; +var ONEAVGMONTH = constants.ONEAVGMONTH; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; + var axes = module.exports = {}; @@ -107157,43 +107084,88 @@ axes.getFromId = axisIds.getFromId; axes.getFromTrace = axisIds.getFromTrace; -// find the list of possible axes to reference with an xref or yref attribute -// and coerce it to that list -axes.coerceRef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = axLetter + 'ref', +/* + * find the list of possible axes to reference with an xref or yref attribute + * and coerce it to that list + * + * attr: the attribute we're generating a reference for. Should end in 'x' or 'y' + * but can be prefixed, like 'ax' for annotation's arrow x + * dflt: the default to coerce to, or blank to use the first axis (falling back on + * extraOption if there is no axis) + * extraOption: aside from existing axes with this letter, what non-axis value is allowed? + * Only required if it's different from `dflt` + */ +axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption) { + var axLetter = attr.charAt(attr.length - 1), + axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), + refAttr = attr + 'ref', attrDef = {}; + if(!dflt) dflt = axlist[0] || extraOption; + if(!extraOption) extraOption = dflt; + // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(['paper']), - dflt: dflt || axlist[0] || 'paper' + values: axlist.concat(extraOption ? [extraOption] : []), + dflt: dflt }; // xref, yref return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; -// todo: duplicated per github PR 610. Should be consolidated with axes.coerceRef. -// find the list of possible axes to reference with an axref or ayref attribute -// and coerce it to that list -axes.coerceARef = function(containerIn, containerOut, gd, axLetter, dflt) { - var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter), - refAttr = 'a' + axLetter + 'ref', - attrDef = {}; - - // data-ref annotations are not supported in gl2d yet +/* + * coerce position attributes (range-type) that can be either on axes or absolute + * (paper or pixel) referenced. The biggest complication here is that we don't know + * before looking at the axis whether the value must be a number or not (it may be + * a date string), so we can't use the regular valType='number' machinery + * + * axRef (string): the axis this position is referenced to, or: + * paper: fraction of the plot area + * pixel: pixels relative to some starting position + * attr (string): the attribute in containerOut we are coercing + * dflt (number): the default position, as a fraction or pixels. If the attribute + * is to be axis-referenced, this will be converted to an axis data value + * + * Also cleans the values, since the attribute definition itself has to say + * valType: 'any' to handle date axes. This allows us to accept: + * - for category axes: category names, and convert them here into serial numbers. + * Note that this will NOT work for axis range endpoints, because we don't know + * the category list yet (it's set by ax.makeCalcdata during calc) + * but it works for component (note, shape, images) positions. + * - for date axes: JS Dates or milliseconds, and convert to date strings + * - for other types: coerce them to numbers + */ +axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { + var pos, + newPos; + + if(axRef === 'paper' || axRef === 'pixel') { + pos = coerce(attr, dflt); + } + else { + var ax = axes.getFromId(gd, axRef); - attrDef[refAttr] = { - valType: 'enumerated', - values: axlist.concat(['pixel']), - dflt: dflt || 'pixel' || axlist[0] - }; + dflt = ax.fraction2r(dflt); + pos = coerce(attr, dflt); - // axref, ayref - return Lib.coerce(containerIn, containerOut, attrDef, refAttr); + if(ax.type === 'category') { + // if position is given as a category name, convert it to a number + if(typeof pos === 'string' && (ax._categories || []).length) { + newPos = ax._categories.indexOf(pos); + containerOut[attr] = (newPos !== -1) ? dflt : newPos; + return; + } + } + else if(ax.type === 'date') { + containerOut[attr] = Lib.cleanDate(pos); + return; + } + } + // finally make sure we have a number (unless date type already returned a string) + containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; }; // empty out types for all axes containing these traces @@ -107219,14 +107191,16 @@ axes.counterLetter = function(id) { // incorporate a new minimum difference and first tick into // forced +// note that _forceTick0 is linearized, so needs to be turned into +// a range value for setting tick0 axes.minDtick = function(ax, newDiff, newFirst, allow) { // doesn't make sense to do forced min dTick on log or category axes, // and the plot itself may decide to cancel (ie non-grouped bars) if(['log', 'category'].indexOf(ax.type) !== -1 || !allow) { ax._minDtick = 0; } - // null means there's nothing there yet - else if(ax._minDtick === null) { + // undefined means there's nothing there yet + else if(ax._minDtick === undefined) { ax._minDtick = newDiff; ax._forceTick0 = newFirst; } @@ -107251,6 +107225,19 @@ axes.minDtick = function(ax, newDiff, newFirst, allow) { } }; +// Find the autorange for this axis +// +// assumes ax._min and ax._max have already been set by calling axes.expand +// using calcdata from all traces. These are arrays of: +// {val: calcdata value, pad: extra pixels beyond this value} +// +// Returns an array of [min, max]. These are calcdata for log and category axes +// and data for linear and date axes. +// +// TODO: we want to change log to data as well, but it's hard to do this +// maintaining backward compatibility. category will always have to use calcdata +// though, because otherwise values between categories (or outside all categories) +// would be impossible. axes.getAutoRange = function(ax) { var newRange = []; @@ -107269,7 +107256,12 @@ axes.getAutoRange = function(ax) { var j, minpt, maxpt, minbest, maxbest, dp, dv, mbest = 0, - axReverse = (ax.range && ax.range[1] < ax.range[0]); + axReverse = false; + + if(ax.range) { + var rng = ax.range.map(ax.r2l); + axReverse = rng[1] < rng[0]; + } // one-time setting to easily reverse the axis // when plotting from code @@ -107358,11 +107350,9 @@ axes.getAutoRange = function(ax) { } // maintain reversal - if(axReverse) { - newRange.reverse(); - } + if(axReverse) newRange.reverse(); - return newRange; + return newRange.map(ax.l2r || Number); }; axes.doAutoRange = function(ax) { @@ -107425,7 +107415,6 @@ axes.saveRangeInitial = function(gd, overwrite) { // (unless one end is overridden by tozero) // tozero: (boolean) make sure to include zero if axis is linear, // and make it a tight bound if possible -var FP_SAFE = Number.MAX_VALUE / 2; axes.expand = function(ax, data, options) { if(!(ax.autorange || ax._needsExpand) || !data) return; if(!ax._min) ax._min = []; @@ -107564,10 +107553,24 @@ axes.autoBin = function(data, ax, nbins, is2d) { } // piggyback off autotick code to make "nice" bin sizes - var dummyax = { - type: ax.type === 'log' ? 'linear' : ax.type, - range: [datamin, datamax] - }; + var dummyax; + if(ax.type === 'log') { + dummyax = { + type: 'linear', + range: [datamin, datamax], + r2l: Number + }; + } + else { + dummyax = { + type: ax.type, + // conversion below would be ax.c2r but that's only different from l2r + // for log, and this is the only place (so far?) we would want c2r. + range: [datamin, datamax].map(ax.l2r), + r2l: ax.r2l + }; + } + axes.autoTicks(dummyax, size0); var binstart = axes.tickIncrement( axes.tickFirst(dummyax), dummyax.dtick, 'reverse'), @@ -107631,8 +107634,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { } return { - start: binstart, - end: binend, + start: ax.c2r(binstart), + end: ax.c2r(binend), size: dummyax.dtick }; }; @@ -107649,6 +107652,8 @@ axes.autoBin = function(data, ax, nbins, is2d) { axes.calcTicks = function calcTicks(ax) { if(ax.tickmode === 'array') return arrayTicks(ax); + var rng = ax.range.map(ax.r2l); + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks, @@ -107663,18 +107668,17 @@ axes.calcTicks = function calcTicks(ax) { nt = Lib.constrain(ax._length / minPx, 4, 9) + 1; } } - axes.autoTicks(ax, Math.abs(ax.range[1] - ax.range[0]) / nt); + axes.autoTicks(ax, Math.abs(rng[1] - rng[0]) / nt); // check for a forced minimum dtick if(ax._minDtick > 0 && ax.dtick < ax._minDtick * 2) { ax.dtick = ax._minDtick; - ax.tick0 = ax._forceTick0; + ax.tick0 = ax.l2r(ax._forceTick0); } } // check for missing tick0 if(!ax.tick0) { - ax.tick0 = (ax.type === 'date') ? - new Date(2000, 0, 1).getTime() : 0; + ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; } // now figure out rounding of tick values @@ -107684,12 +107688,12 @@ axes.calcTicks = function calcTicks(ax) { ax._tmin = axes.tickFirst(ax); // check for reversed axis - var axrev = (ax.range[1] < ax.range[0]); + var axrev = (rng[1] < rng[0]); // return the full set of tick vals var vals = [], // add a tiny bit so we get ticks which may have rounded out - endtick = ax.range[1] * 1.0001 - ax.range[0] * 0.0001; + endtick = rng[1] * 1.0001 - rng[0] * 0.0001; if(ax.type === 'category') { endtick = (axrev) ? Math.max(-0.5, endtick) : Math.min(ax._categories.length - 0.5, endtick); @@ -107707,9 +107711,18 @@ axes.calcTicks = function calcTicks(ax) { // show the exponent only on the last one ax._tmax = vals[vals.length - 1]; + // for showing date suffixes: ax._prevSuffix holds what we showed most + // recently. Start with it cleared and mark that we're in calcTicks (ie + // calculating a whole string of these so we should care what the previous + // suffix was!) + ax._prevSuffix = ''; + ax._inCalcTicks = true; + var ticksOut = new Array(vals.length); for(var i = 0; i < vals.length; i++) ticksOut[i] = axes.tickText(ax, vals[i]); + ax._inCalcTicks = false; + return ticksOut; }; @@ -107717,15 +107730,15 @@ function arrayTicks(ax) { var vals = ax.tickvals, text = ax.ticktext, ticksOut = new Array(vals.length), - r0expanded = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, - r1expanded = ax.range[1] * 1.0001 - ax.range[0] * 0.0001, + rng = ax.range.map(ax.r2l), + r0expanded = rng[0] * 1.0001 - rng[1] * 0.0001, + r1expanded = rng[1] * 1.0001 - rng[0] * 0.0001, tickMin = Math.min(r0expanded, r1expanded), tickMax = Math.max(r0expanded, r1expanded), vali, i, j = 0; - // without a text array, just format the given values as any other ticks // except with more precision to the numbers if(!Array.isArray(text)) text = []; @@ -107765,7 +107778,7 @@ function roundDTick(roughDTick, base, roundingSet) { // outputs (into ax): // tick0: starting point for ticks (not necessarily on the graph) // usually 0 for numeric (=10^0=1 for log) or jan 1, 2000 for dates -// dtick: the actual, nice round tick spacing, somewhat larger than roughDTick +// dtick: the actual, nice round tick spacing, usually a little larger than roughDTick // if the ticks are spaced linearly (linear scale, categories, // log with only full powers, date ticks < month), // this will just be a number @@ -107778,36 +107791,35 @@ axes.autoTicks = function(ax, roughDTick) { var base; if(ax.type === 'date') { - ax.tick0 = new Date(2000, 0, 1).getTime(); + ax.tick0 = '2000-01-01'; + // the criteria below are all based on the rough spacing we calculate + // being > half of the final unit - so precalculate twice the rough val + var roughX2 = 2 * roughDTick; - if(roughDTick > 15778800000) { - // years if roughDTick > 6mo - roughDTick /= 31557600000; + if(roughX2 > ONEAVGYEAR) { + roughDTick /= ONEAVGYEAR; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'M' + (12 * roundDTick(roughDTick, base, roundBase10)); } - else if(roughDTick > 1209600000) { - // months if roughDTick > 2wk - roughDTick /= 2629800000; + else if(roughX2 > ONEAVGMONTH) { + roughDTick /= ONEAVGMONTH; ax.dtick = 'M' + roundDTick(roughDTick, 1, roundBase24); } - else if(roughDTick > 43200000) { - // days if roughDTick > 12h - ax.dtick = roundDTick(roughDTick, 86400000, roundDays); + else if(roughX2 > ONEDAY) { + ax.dtick = roundDTick(roughDTick, ONEDAY, roundDays); // get week ticks on sunday - ax.tick0 = new Date(2000, 0, 2).getTime(); + // this will also move the base tick off 2000-01-01 if dtick is + // 2 or 3 days... but that's a weird enough case that we'll ignore it. + ax.tick0 = '2000-01-02'; } - else if(roughDTick > 1800000) { - // hours if roughDTick > 30m - ax.dtick = roundDTick(roughDTick, 3600000, roundBase24); + else if(roughX2 > ONEHOUR) { + ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } - else if(roughDTick > 30000) { - // minutes if roughDTick > 30sec - ax.dtick = roundDTick(roughDTick, 60000, roundBase60); + else if(roughX2 > ONEMIN) { + ax.dtick = roundDTick(roughDTick, ONEMIN, roundBase60); } - else if(roughDTick > 500) { - // seconds if roughDTick > 0.5sec - ax.dtick = roundDTick(roughDTick, 1000, roundBase60); + else if(roughX2 > ONESEC) { + ax.dtick = roundDTick(roughDTick, ONESEC, roundBase60); } else { // milliseconds @@ -107817,16 +107829,19 @@ axes.autoTicks = function(ax, roughDTick) { } else if(ax.type === 'log') { ax.tick0 = 0; + var rng = ax.range.map(ax.r2l); - // only show powers of 10 - if(roughDTick > 0.7) ax.dtick = Math.ceil(roughDTick); - else if(Math.abs(ax.range[1] - ax.range[0]) < 1) { + if(roughDTick > 0.7) { + // only show powers of 10 + ax.dtick = Math.ceil(roughDTick); + } + else if(Math.abs(rng[1] - rng[0]) < 1) { // span is less than one power of 10 - var nt = 1.5 * Math.abs((ax.range[1] - ax.range[0]) / roughDTick); + var nt = 1.5 * Math.abs((rng[1] - rng[0]) / roughDTick); // ticks on a linear scale, labeled fully - roughDTick = Math.abs(Math.pow(10, ax.range[1]) - - Math.pow(10, ax.range[0])) / nt; + roughDTick = Math.abs(Math.pow(10, rng[1]) - + Math.pow(10, rng[0])) / nt; base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = 'L' + roundDTick(roughDTick, base, roundBase10); } @@ -107865,41 +107880,59 @@ axes.autoTicks = function(ax, roughDTick) { // for date ticks, the last date part to show (y,m,d,H,M,S) // or an integer # digits past seconds function autoTickRound(ax) { - var dtick = ax.dtick, - maxend; + var dtick = ax.dtick; ax._tickexponent = 0; - if(!isNumeric(dtick) && typeof dtick !== 'string') dtick = 1; + if(!isNumeric(dtick) && typeof dtick !== 'string') { + dtick = 1; + } - if(ax.type === 'category') ax._tickround = null; - else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { - if(ax.type === 'date') { - if(dtick >= 86400000) ax._tickround = 'd'; - else if(dtick >= 3600000) ax._tickround = 'H'; - else if(dtick >= 60000) ax._tickround = 'M'; - else if(dtick >= 1000) ax._tickround = 'S'; - else ax._tickround = 3 - Math.round(Math.log(dtick / 2) / Math.LN10); - } + if(ax.type === 'category') { + ax._tickround = null; + } + if(ax.type === 'date') { + // If tick0 is unusual, give tickround a bit more information + // not necessarily *all* the information in tick0 though, if it's really odd + // minimal string length for tick0: 'd' is 10, 'M' is 16, 'S' is 19 + // take off a leading minus (year < 0 so length is consistent) + var tick0ms = Lib.dateTime2ms(ax.tick0), + tick0str = Lib.ms2DateTime(tick0ms).replace(/^-/, ''), + tick0len = tick0str.length; + + if(String(dtick).charAt(0) === 'M') { + // any tick0 more specific than a year: alway show the full date + if(tick0len > 10 || tick0str.substr(5) !== '01-01') ax._tickround = 'd'; + // show the month unless ticks are full multiples of a year + else ax._tickround = (+(dtick.substr(1)) % 12 === 0) ? 'y' : 'm'; + } + else if((dtick >= ONEDAY && tick0len <= 10) || (dtick >= ONEDAY * 15)) ax._tickround = 'd'; + else if((dtick >= ONEMIN && tick0len <= 16) || (dtick >= ONEHOUR)) ax._tickround = 'M'; + else if((dtick >= ONESEC && tick0len <= 19) || (dtick >= ONEMIN)) ax._tickround = 'S'; else { - if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); - // 2 digits past largest digit of dtick - ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); + // of any two adjacent ticks, at least one will have the maximum fractional digits + // of all possible ticks - so take the max. length of tick0 and the next one + var tick1len = Lib.ms2DateTime(tick0ms + dtick).replace(/^-/, '').length; + ax._tickround = Math.max(tick0len, tick1len) - 20; + } + } + else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { + // linear or log (except D1, D2) + var rng = ax.range.map(ax.r2d || Number); + if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); + // 2 digits past largest digit of dtick + ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); - if(ax.type === 'log') { - maxend = Math.pow(10, Math.max(ax.range[0], ax.range[1])); - } - else maxend = Math.max(Math.abs(ax.range[0]), Math.abs(ax.range[1])); + var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); - var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { - if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { - ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); - } - else ax._tickexponent = rangeexp; + var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); + if(Math.abs(rangeexp) > 3) { + if(ax.exponentformat === 'SI' || ax.exponentformat === 'B') { + ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } + else ax._tickexponent = rangeexp; } } - else if(dtick.charAt(0) === 'M') ax._tickround = (dtick.length === 2) ? 'm' : 'y'; + // D1 or D2 (log) else ax._tickround = null; } @@ -107944,13 +107977,16 @@ axes.tickIncrement = function(x, dtick, axrev) { // calculate the first tick on an axis axes.tickFirst = function(ax) { - var axrev = ax.range[1] < ax.range[0], + var r2l = ax.r2l || Number, + rng = ax.range.map(r2l), + axrev = rng[1] < rng[0], sRound = axrev ? Math.floor : Math.ceil, // add a tiny extra bit to make sure we get ticks // that may have been rounded out - r0 = ax.range[0] * 1.0001 - ax.range[1] * 0.0001, + r0 = rng[0] * 1.0001 - rng[1] * 0.0001, dtick = ax.dtick, - tick0 = ax.tick0; + tick0 = r2l(ax.tick0); + if(isNumeric(dtick)) { var tmin = sRound((r0 - tick0) / dtick) * dtick + tick0; @@ -108000,7 +108036,7 @@ axes.tickFirst = function(ax) { var yearFormat = d3.time.format('%Y'), monthFormat = d3.time.format('%b %Y'), dayFormat = d3.time.format('%b %-d'), - hourFormat = d3.time.format('%b %-d %Hh'), + yearMonthDayFormat = d3.time.format('%b %-d, %Y'), minuteFormat = d3.time.format('%H:%M'), secondFormat = d3.time.format(':%S'); @@ -108036,7 +108072,8 @@ axes.tickText = function(ax, x, hover) { i; if(arrayMode && Array.isArray(ax.ticktext)) { - var minDiff = Math.abs(ax.range[1] - ax.range[0]) / 10000; + var rng = ax.range.map(ax.r2l), + minDiff = Math.abs(rng[1] - rng[0]) / 10000; for(i = 0; i < ax.ticktext.length; i++) { if(Math.abs(x - ax.d2l(ax.tickvals[i])) < minDiff) break; } @@ -108091,10 +108128,12 @@ function tickTextObj(ax, x, text) { function formatDate(ax, out, hover, extraPrecision) { var x = out.x, tr = ax._tickround, + trOriginal = tr, d = new Date(x), // suffix completes the full date info, to be included - // with only the first tick - suffix = '', + // with only the first tick or if any info before what's + // shown has changed + suffix, tt; if(hover && ax.hoverformat) { tt = modDateFormat(ax.hoverformat, x); @@ -108107,34 +108146,40 @@ function formatDate(ax, out, hover, extraPrecision) { else { if(extraPrecision) { if(isNumeric(tr)) tr += 2; - else tr = {y: 'm', m: 'd', d: 'H', H: 'M', M: 'S', S: 2}[tr]; + else tr = {y: 'm', m: 'd', d: 'M', M: 'S', S: 2}[tr]; } if(tr === 'y') tt = yearFormat(d); else if(tr === 'm') tt = monthFormat(d); else { - if(x === ax._tmin && !hover) { - suffix = '
' + yearFormat(d); - } + if(tr === 'd') { + if(!hover) suffix = '
' + yearFormat(d); - if(tr === 'd') tt = dayFormat(d); - else if(tr === 'H') tt = hourFormat(d); + tt = dayFormat(d); + } else { - if(x === ax._tmin && !hover) { - suffix = '
' + dayFormat(d) + ', ' + yearFormat(d); - } + if(!hover) suffix = '
' + yearMonthDayFormat(d); tt = minuteFormat(d); if(tr !== 'M') { tt += secondFormat(d); if(tr !== 'S') { - tt += numFormat(mod(x / 1000, 1), ax, 'none', hover) + tt += numFormat(d3.round(mod(x / 1000, 1), 4), ax, 'none', hover) .substr(1); } } + else if(trOriginal === 'd') { + // for hover on axes with day ticks, minuteFormat (which + // only includes %H:%M) isn't enough, you want the date too + tt = dayFormat(d) + ' ' + tt; + } } } } - out.text = tt + suffix; + if(suffix && (!ax._inCalcTicks || (suffix !== ax._prevSuffix))) { + tt += suffix; + ax._prevSuffix = suffix; + } + out.text = tt; } function formatLog(ax, out, hover, extraPrecision, hideexp) { @@ -108226,7 +108271,7 @@ function numFormat(v, ax, fmtoverride, hover) { (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent // from what we calculate - range: ax.showexponent === 'none' ? ax.range : [0, v || 1] + range: ax.showexponent === 'none' ? ax.range.map(ax.r2d) : [0, v || 1] }; autoTickRound(ah); tickRound = (Number(ah._tickround) || 0) + 4; @@ -108474,8 +108519,9 @@ axes.makeClipPaths = function(gd) { // doTicks: draw ticks, grids, and tick labels // axid: 'x', 'y', 'x2' etc, // blank to do all, -// 'redraw' to force full redraw, and reset ax._r -// (stored range for use by zoom/pan) +// 'redraw' to force full redraw, and reset: +// ax._r (stored range for use by zoom/pan) +// ax._rl (stored linearized range for use by zoom/pan) // or can pass in an axis object directly axes.doTicks = function(gd, axid, skipTitle) { var fullLayout = gd._fullLayout, @@ -108513,7 +108559,10 @@ axes.doTicks = function(gd, axid, skipTitle) { return function() { if(!ax._id) return; var axDone = axes.doTicks(gd, ax._id); - if(axid === 'redraw') ax._r = ax.range.slice(); + if(axid === 'redraw') { + ax._r = ax.range.slice(); + ax._rl = ax._r.map(ax.r2l); + } return axDone; }; })); @@ -108531,9 +108580,6 @@ axes.doTicks = function(gd, axid, skipTitle) { } } - // in case a val turns into string somehow - ax.range = [+ax.range[0], +ax.range[1]]; - // set scaling to pixels ax.setScale(); @@ -108922,7 +108968,8 @@ axes.doTicks = function(gd, axid, skipTitle) { break; } } - var showZl = (ax.range[0] * ax.range[1] <= 0) && ax.zeroline && + var rng = ax.range.map(ax.r2l), + showZl = (rng[0] * rng[1] <= 0) && ax.zeroline && (ax.type === 'linear' || ax.type === '-') && gridvals.length && (hasBarsOrFill || clipEnds({x: 0}) || !ax.showline); var zl = zlcontainer.selectAll('path.' + zcls) @@ -109146,7 +109193,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { // rather than built-in % which gives a negative value for negative v function mod(v, d) { return ((v % d) + d) % d; } -},{"../../components/color":533,"../../components/drawing":557,"../../components/titles":608,"../../lib":632,"../../lib/svg_text_utils":646,"../../registry":738,"./axis_ids":665,"./layout_attributes":672,"./layout_defaults":673,"./set_convert":677,"d3":95,"fast-isnumeric":104}],663:[function(require,module,exports){ +},{"../../components/color":533,"../../components/drawing":556,"../../components/titles":607,"../../constants/numerical":616,"../../lib":633,"../../lib/svg_text_utils":647,"../../registry":739,"./axis_ids":667,"./layout_attributes":673,"./layout_defaults":674,"./set_convert":678,"d3":95,"fast-isnumeric":104}],665:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109161,7 +109208,7 @@ function mod(v, d) { return ((v % d) + d) % d; } var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); -var cleanDatum = require('./clean_datum'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function autoType(array) { if(moreDates(array)) return 'date'; @@ -109203,7 +109250,7 @@ function moreDates(a) { return (dcnt > ncnt * 2); } -// are the (x,y)-values in td.data mostly text? +// are the (x,y)-values in gd.data mostly text? // require twice as many categories as numbers function category(a) { // test at most 1000 points @@ -109213,15 +109260,15 @@ function category(a) { ai; for(var i = 0; i < a.length; i += inc) { - ai = cleanDatum(a[Math.round(i)]); - if(isNumeric(ai)) curvenums++; + ai = a[Math.round(i)]; + if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; else if(typeof ai === 'string' && ai !== '' && ai !== 'None') curvecats++; } return curvecats > curvenums * 2; } -},{"../../lib":632,"./clean_datum":667,"fast-isnumeric":104}],664:[function(require,module,exports){ +},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],666:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109314,17 +109361,15 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var validRange = ( (containerIn.range || []).length === 2 && - isNumeric(containerIn.range[0]) && - isNumeric(containerIn.range[1]) + isNumeric(containerOut.r2l(containerIn.range[0])) && + isNumeric(containerOut.r2l(containerIn.range[1])) ); var autoRange = coerce('autorange', !validRange); if(autoRange) coerce('rangemode'); - var range = coerce('range', [-1, letter === 'x' ? 6 : 4]); - if(range[0] === range[1]) { - containerOut.range = [range[0] - 1, range[0] + 1]; - } - Lib.noneOrAll(containerIn.range, containerOut.range, [0, 1]); + + coerce('range'); + containerOut.cleanRange(); coerce('fixedrange'); @@ -109446,7 +109491,7 @@ function getFirstNonEmptyTrace(data, id, axLetter) { } } -},{"../../components/color/attributes":532,"../../lib":632,"../../registry":738,"./axis_autotype":663,"./axis_ids":665,"./category_order_defaults":666,"./layout_attributes":672,"./ordered_categories":674,"./set_convert":677,"./tick_label_defaults":678,"./tick_mark_defaults":679,"./tick_value_defaults":680,"fast-isnumeric":104,"tinycolor2":489}],665:[function(require,module,exports){ +},{"../../components/color/attributes":532,"../../lib":633,"../../registry":739,"./axis_autotype":665,"./axis_ids":667,"./category_order_defaults":668,"./layout_attributes":673,"./ordered_categories":675,"./set_convert":678,"./tick_label_defaults":679,"./tick_mark_defaults":680,"./tick_value_defaults":681,"fast-isnumeric":104,"tinycolor2":489}],667:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109568,7 +109613,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":632,"../../registry":738,"../plots":723,"./constants":668}],666:[function(require,module,exports){ +},{"../../lib":633,"../../registry":739,"../plots":724,"./constants":669}],668:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109602,46 +109647,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],667:[function(require,module,exports){ -/** -* Copyright 2012-2016, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = require('fast-isnumeric'); - -var Lib = require('../../lib'); - - -/** - * cleanDatum: removes characters - * same replace criteria used in the grid.js:scrapeCol - * but also handling dates, numbers, and NaN, null, Infinity etc - */ -module.exports = function cleanDatum(c) { - try { - if(typeof c === 'object' && c !== null && c.getTime) { - return Lib.ms2DateTime(c); - } - if(typeof c !== 'string' && !isNumeric(c)) { - return ''; - } - c = c.toString().replace(/['"%,$# ]/g, ''); - } - catch(e) { - Lib.error(e, c); - } - - return c; -}; - -},{"../../lib":632,"fast-isnumeric":104}],668:[function(require,module,exports){ +},{}],669:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109665,14 +109671,6 @@ module.exports = { y: /^yaxis([2-9]|[1-9][0-9]+)?$/ }, - /** - * standardize all missing data in calcdata to use undefined - * never null or NaN. - * that way we can use !==undefined, or !== BADNUM, - * to test for real data - */ - BADNUM: undefined, - // axis match regular expression xAxisMatch: /^xaxis[0-9]*$/, yAxisMatch: /^yaxis[0-9]*$/, @@ -109716,10 +109714,15 @@ module.exports = { BENDPX: 1.5, // delay before a redraw (relayout) after smooth panning and zooming - REDRAWDELAY: 50 + REDRAWDELAY: 50, + + // last resort axis ranges for x, y, and date axes if we have no data + DFLTRANGEX: [-1, 6], + DFLTRANGEY: [-1, 4], + DFLTRANGEDATE: ['2000-01-01', '2001-01-01'], }; -},{}],669:[function(require,module,exports){ +},{}],670:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -109820,11 +109823,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { return dragger; } - function forceNumbers(axRange) { - axRange[0] = Number(axRange[0]); - axRange[1] = Number(axRange[1]); - } - var dragOptions = { element: dragger, gd: gd, @@ -109935,7 +109933,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { .attr('d', 'M0,0Z'); clearSelect(); - for(var i = 0; i < allaxes.length; i++) forceNumbers(allaxes[i].range); } function clearSelect() { @@ -110026,16 +110023,16 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomAxRanges(axList, r0Fraction, r1Fraction) { var i, axi, - axRange; + axRangeLinear; for(i = 0; i < axList.length; i++) { axi = axList[i]; if(axi.fixedrange) continue; - axRange = axi.range; + axRangeLinear = axi.range.map(axi.r2l); axi.range = [ - axRange[0] + (axRange[1] - axRange[0]) * r0Fraction, - axRange[0] + (axRange[1] - axRange[0]) * r1Fraction + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r0Fraction), + axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r1Fraction) ]; } } @@ -110089,7 +110086,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { verticalAlign: vAlign }) .on('edit', function(text) { - var v = ax.type === 'category' ? ax.c2l(text) : ax.d2l(text); + var v = ax.d2r(text); if(v !== undefined) { Plotly.relayout(gd, attrStr, v); } @@ -110149,10 +110146,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomWheelOneAxis(ax, centerFraction, zoom) { if(ax.fixedrange) return; - forceNumbers(ax.range); - var axRange = ax.range, + + var axRange = ax.range.map(ax.r2l), v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; - ax.range = [v0 + (axRange[0] - v0) * zoom, v0 + (axRange[1] - v0) * zoom]; + function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); } + ax.range = axRange.map(doZoom); } if(ew) { @@ -110200,7 +110198,10 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { for(var i = 0; i < axList.length; i++) { var axi = axList[i]; if(!axi.fixedrange) { - axi.range = [axi._r[0] - pix / axi._m, axi._r[1] - pix / axi._m]; + axi.range = [ + axi.l2r(axi._rl[0] - pix / axi._m), + axi.l2r(axi._rl[1] - pix / axi._m) + ]; } } } @@ -110223,23 +110224,29 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { 1 / (1 / Math.max(d, -0.3) + 3.222)); } - // dz: set a new value for one end (0 or 1) of an axis array ax, + // dz: set a new value for one end (0 or 1) of an axis array axArray, // and return a pixel shift for that end for the viewbox // based on pixel drag distance d // TODO: this makes (generally non-fatal) errors when you get // near floating point limits - function dz(ax, end, d) { + function dz(axArray, end, d) { var otherEnd = 1 - end, - movedi = 0; - for(var i = 0; i < ax.length; i++) { - var axi = ax[i]; + movedAx, + newLinearizedEnd; + for(var i = 0; i < axArray.length; i++) { + var axi = axArray[i]; if(axi.fixedrange) continue; - movedi = i; - axi.range[end] = axi._r[otherEnd] + - (axi._r[end] - axi._r[otherEnd]) / dZoom(d / axi._length); + movedAx = axi; + newLinearizedEnd = axi._rl[otherEnd] + + (axi._rl[end] - axi._rl[otherEnd]) / dZoom(d / axi._length); + var newEnd = axi.l2r(newLinearizedEnd); + + // if l2r comes back false or undefined, it means we've dragged off + // the end of valid ranges - so stop. + if(newEnd !== false && newEnd !== undefined) axi.range[end] = newEnd; } - return ax[movedi]._length * (ax[movedi]._r[end] - ax[movedi].range[end]) / - (ax[movedi]._r[end] - ax[movedi]._r[otherEnd]); + return movedAx._length * (movedAx._rl[end] - newLinearizedEnd) / + (movedAx._rl[end] - movedAx._rl[otherEnd]); } if(xActive === 'w') dx = dz(xa, 0, dx); @@ -110441,8 +110448,10 @@ function getEndText(ax, end) { diff = Math.abs(initialVal - ax.range[1 - end]), dig; + // TODO: this should basically be ax.r2d but we're doing extra + // rounding here... can we clean up at all? if(ax.type === 'date') { - return Lib.ms2DateTime(initialVal, diff); + return initialVal; } else if(ax.type === 'log') { dig = Math.ceil(Math.max(0, -Math.log(diff) / Math.LN10)) + 3; @@ -110476,7 +110485,7 @@ function isSelectOrLasso(dragmode) { return modes.indexOf(dragmode) !== -1; } -},{"../../components/color":533,"../../components/dragelement":555,"../../components/drawing":557,"../../lib":632,"../../lib/setcursor":642,"../../lib/svg_text_utils":646,"../../plotly":658,"../../registry":738,"./axes":662,"./constants":668,"./select":676,"d3":95,"tinycolor2":489}],670:[function(require,module,exports){ +},{"../../components/color":533,"../../components/dragelement":554,"../../components/drawing":556,"../../lib":633,"../../lib/setcursor":643,"../../lib/svg_text_utils":647,"../../plotly":659,"../../registry":739,"./axes":664,"./constants":669,"./select":677,"d3":95,"tinycolor2":489}],671:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -110502,6 +110511,7 @@ var dragElement = require('../../components/dragelement'); var Axes = require('./axes'); var constants = require('./constants'); var dragBox = require('./dragbox'); +var layoutAttributes = require('../layout_attributes'); var fx = module.exports = {}; @@ -110511,24 +110521,12 @@ var fx = module.exports = {}; fx.unhover = dragElement.unhover; fx.layoutAttributes = { - dragmode: { - valType: 'enumerated', - - values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], - dflt: 'zoom', - - }, - hovermode: { - valType: 'enumerated', - - values: ['x', 'y', 'closest', false], - - } }; fx.supplyLayoutDefaults = function(layoutIn, layoutOut, fullData) { + function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, fx.layoutAttributes, attr, dflt); + return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } coerce('dragmode'); @@ -111831,7 +111829,7 @@ fx.inbox = function(v0, v1) { return Infinity; }; -},{"../../components/color":533,"../../components/dragelement":555,"../../components/drawing":557,"../../lib":632,"../../lib/events":624,"../../lib/svg_text_utils":646,"./axes":662,"./constants":668,"./dragbox":669,"d3":95,"fast-isnumeric":104,"tinycolor2":489}],671:[function(require,module,exports){ +},{"../../components/color":533,"../../components/dragelement":554,"../../components/drawing":556,"../../lib":633,"../../lib/events":625,"../../lib/svg_text_utils":647,"../layout_attributes":715,"./axes":664,"./constants":669,"./dragbox":670,"d3":95,"fast-isnumeric":104,"tinycolor2":489}],672:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -111861,6 +111859,8 @@ exports.attrRegex = constants.attrRegex; exports.attributes = require('./attributes'); +exports.layoutAttributes = require('./layout_attributes'); + exports.transitionAxes = require('./transition_axes'); exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) { @@ -112203,7 +112203,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":632,"../plots":723,"./attributes":661,"./axes":662,"./constants":668,"./transition_axes":681,"d3":95}],672:[function(require,module,exports){ +},{"../../lib":633,"../plots":724,"./attributes":663,"./axes":664,"./constants":669,"./layout_attributes":673,"./transition_axes":682,"d3":95}],673:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112239,8 +112239,8 @@ module.exports = { type: { valType: 'enumerated', // '-' means we haven't yet run autotype or couldn't find any data - // it gets turned into linear in td._fullLayout but not copied back - // to td.data like the others are. + // it gets turned into linear in gd._fullLayout but not copied back + // to gd.data like the others are. values: ['-', 'linear', 'log', 'date', 'category'], dflt: '-', @@ -112264,8 +112264,8 @@ module.exports = { valType: 'info_array', items: [ - {valType: 'number'}, - {valType: 'number'} + {valType: 'any'}, + {valType: 'any'} ], }, @@ -112291,14 +112291,12 @@ module.exports = { }, tick0: { - valType: 'number', - dflt: 0, + valType: 'any', }, dtick: { valType: 'any', - dflt: 1, }, @@ -112539,11 +112537,6 @@ module.exports = { }, - _nestedModules: { - 'rangeslider': 'rangeslider', - 'rangeselector': 'rangeselector', - }, - _deprecated: { autotick: { valType: 'boolean', @@ -112553,7 +112546,7 @@ module.exports = { } }; -},{"../../components/color/attributes":532,"../../lib/extend":625,"../font_attributes":683,"./constants":668}],673:[function(require,module,exports){ +},{"../../components/color/attributes":532,"../../lib/extend":626,"../font_attributes":684,"./constants":669}],674:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112727,7 +112720,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { }); }; -},{"../../components/color":533,"../../lib":632,"../../registry":738,"../layout_attributes":714,"./axis_defaults":664,"./axis_ids":665,"./constants":668,"./layout_attributes":672,"./position_defaults":675}],674:[function(require,module,exports){ +},{"../../components/color":533,"../../lib":633,"../../registry":739,"../layout_attributes":715,"./axis_defaults":666,"./axis_ids":667,"./constants":669,"./layout_attributes":673,"./position_defaults":676}],675:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112806,7 +112799,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":95}],675:[function(require,module,exports){ +},{"d3":95}],676:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -112871,7 +112864,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":632,"fast-isnumeric":104}],676:[function(require,module,exports){ +},{"../../lib":633,"fast-isnumeric":104}],677:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113071,7 +113064,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":533,"../../lib/polygon":639,"./axes":662,"./constants":668}],677:[function(require,module,exports){ +},{"../../components/color":533,"../../lib/polygon":640,"./axes":664,"./constants":669}],678:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113087,27 +113080,38 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); +var numConstants = require('../../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var constants = require('./constants'); -var cleanDatum = require('./clean_datum'); var axisIds = require('./axis_ids'); /** - * Define the conversion functions for an axis data is used in 4 ways: + * Define the conversion functions for an axis data is used in 5 ways: * * d: data, in whatever form it's provided * c: calcdata: turned into numbers, but not linearized - * l: linearized - same as c except for log axes (and other - * mappings later?) this is used by ranges, and when we - * need to know if it's *possible* to show some data on - * this axis, without caring about the current range + * l: linearized - same as c except for log axes (and other nonlinear + * mappings later?) this is used when we need to know if it's + * *possible* to show some data on this axis, without caring about + * the current range * p: pixel value - mapped to the screen with current size and zoom - * - * Creates/updates these conversion functions + * r: ranges, tick0, and annotation positions match one of the above + * but are handled differently for different types: + * - linear and date: data format (d) + * - category: calcdata format (c), and will stay that way because + * the data format has no continuous mapping + * - log: linearized (l) format + * TODO: in v2.0 we plan to change it to data format. At that point + * shapes will work the same way as ranges, tick0, and annotations + * so they can use this conversion too. + * + * Creates/updates these conversion functions, as well as cleaner functions: + * ax.d2d and ax.clean2r * also clears the autorange bounds ._min and ._max - * and the autotick constraints ._minDtick, ._forceTick0, - * and looks for date ranges that aren't yet in numeric format + * and the autotick constraints ._minDtick, ._forceTick0 */ module.exports = function setConvert(ax) { @@ -113127,20 +113131,119 @@ module.exports = function setConvert(ax) { return 0.5 * (r0 + r1 - 3 * clipMult * Math.abs(r0 - r1)); } - else return constants.BADNUM; + else return BADNUM; + } + + function fromLog(v) { + return Math.pow(10, v); + } + + function num(v) { + if(!isNumeric(v)) return BADNUM; + v = Number(v); + if(v < -FP_SAFE || v > FP_SAFE) return BADNUM; + return isNumeric(v) ? Number(v) : BADNUM; } - function fromLog(v) { return Math.pow(10, v); } - function num(v) { return isNumeric(v) ? Number(v) : constants.BADNUM; } ax.c2l = (ax.type === 'log') ? toLog : num; ax.l2c = (ax.type === 'log') ? fromLog : num; ax.l2d = function(v) { return ax.c2d(ax.l2c(v)); }; ax.p2d = function(v) { return ax.l2d(ax.p2l(v)); }; + /* + * fn to make sure range is a couplet of valid & distinct values + * keep numbers away from the limits of floating point numbers, + * and dates away from the ends of our date system (+/- 9999 years) + * + * optional param rangeAttr: operate on a different attribute, like + * ax._r, rather than ax.range + */ + ax.cleanRange = function(rangeAttr) { + if(!rangeAttr) rangeAttr = 'range'; + var range = ax[rangeAttr], + axLetter = (ax._id || 'x').charAt(0), + i, dflt; + + if(ax.type === 'date') dflt = constants.DFLTRANGEDATE; + else if(axLetter === 'y') dflt = constants.DFLTRANGEY; + else dflt = constants.DFLTRANGEX; + + // make sure we don't later mutate the defaults + dflt = dflt.slice(); + + if(!range || range.length !== 2) { + ax[rangeAttr] = dflt; + return; + } + + if(ax.type === 'date') { + // check if milliseconds or js date objects are provided for range + // and convert to date strings + range[0] = Lib.cleanDate(range[0]); + range[1] = Lib.cleanDate(range[1]); + } + + for(i = 0; i < 2; i++) { + if(ax.type === 'date') { + if(!Lib.isDateTime(range[i])) { + ax[rangeAttr] = dflt; + break; + } + + if(range[i] < Lib.MIN_MS) range[i] = Lib.MIN_MS; + if(range[i] > Lib.MAX_MS) range[i] = Lib.MAX_MS; + + if(ax.r2l(range[0]) === ax.r2l(range[1])) { + // split by +/- 1 second + var linCenter = Lib.constrain(ax.r2l(range[0]), + Lib.MIN_MS + 1000, Lib.MAX_MS - 1000); + range[0] = ax.l2r(linCenter - 1000); + range[1] = ax.l2r(linCenter + 1000); + break; + } + } + else { + if(!isNumeric(range[i])) { + if(isNumeric(range[1 - i])) { + range[i] = range[1 - i] * (i ? 10 : 0.1); + } + else { + ax[rangeAttr] = dflt; + break; + } + } + + if(range[i] < -FP_SAFE) range[i] = -FP_SAFE; + else if(range[i] > FP_SAFE) range[i] = FP_SAFE; + + if(range[0] === range[1]) { + // somewhat arbitrary: split by 1 or 1ppm, whichever is bigger + var inc = Math.max(1, Math.abs(range[0] * 1e-6)); + range[0] -= inc; + range[1] += inc; + } + } + } + }; + + // find the range value at the specified (linear) fraction of the axis + ax.fraction2r = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return ax.l2r(rl0 + v * (rl1 - rl0)); + }; + + // find the fraction of the range at the specified range value + ax.r2fraction = function(v) { + var rl0 = ax.r2l(ax.range[0]), + rl1 = ax.r2l(ax.range[1]); + return (ax.r2l(v) - rl0) / (rl1 - rl0); + }; + // set scaling to pixels ax.setScale = function(usePrivateRange) { var gs = ax._gd._fullLayout._size, - i; + axLetter = ax._id.charAt(0); // TODO cleaner way to handle this case if(!ax._categories) ax._categories = []; @@ -113156,40 +113259,23 @@ module.exports = function setConvert(ax) { // issue if we transform the drawn layer *and* use the new axis range to // draw the data. This allows us to construct setConvert using the pre- // interaction values of the range: - var range = (usePrivateRange && ax._r) ? ax._r : ax.range; + var rangeAttr = (usePrivateRange && ax._r) ? '_r' : 'range'; + ax.cleanRange(rangeAttr); - // make sure we have a range (linearized data values) - // and that it stays away from the limits of javascript numbers - if(!range || range.length !== 2 || range[0] === range[1]) { - range = [-1, 1]; - } - for(i = 0; i < 2; i++) { - if(!isNumeric(range[i])) { - range[i] = isNumeric(range[1 - i]) ? - (range[1 - i] * (i ? 10 : 0.1)) : - (i ? 1 : -1); - } - - if(range[i] < -(Number.MAX_VALUE / 2)) { - range[i] = -(Number.MAX_VALUE / 2); - } - else if(range[i] > Number.MAX_VALUE / 2) { - range[i] = Number.MAX_VALUE / 2; - } + var rl0 = ax.r2l(ax[rangeAttr][0]), + rl1 = ax.r2l(ax[rangeAttr][1]); - } - - if(ax._id.charAt(0) === 'y') { + if(axLetter === 'y') { ax._offset = gs.t + (1 - ax.domain[1]) * gs.h; ax._length = gs.h * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[0] - range[1]); - ax._b = -ax._m * range[1]; + ax._m = ax._length / (rl0 - rl1); + ax._b = -ax._m * rl1; } else { ax._offset = gs.l + ax.domain[0] * gs.w; ax._length = gs.w * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (range[1] - range[0]); - ax._b = -ax._m * range[0]; + ax._m = ax._length / (rl1 - rl0); + ax._b = -ax._m * rl0; } if(!isFinite(ax._m) || !isFinite(ax._b)) { @@ -113202,7 +113288,7 @@ module.exports = function setConvert(ax) { }; ax.l2p = function(v) { - if(!isNumeric(v)) return constants.BADNUM; + if(!isNumeric(v)) return BADNUM; // include 2 fractional digits on pixel, for PDF zooming etc return d3.round(ax._b + ax._m * v, 2); @@ -113213,42 +113299,62 @@ module.exports = function setConvert(ax) { ax.c2p = function(v, clip) { return ax.l2p(ax.c2l(v, clip)); }; ax.p2c = function(px) { return ax.l2c(ax.p2l(px)); }; + // clip doesn't do anything here yet, but in v2.0 when log axes get + // refactored it will... so including it now so we don't forget. + ax.r2p = function(v, clip) { return ax.l2p(ax.r2l(v, clip)); }; + ax.p2r = function(px) { return ax.l2r(ax.p2l(px)); }; + + ax.r2c = function(v) { return ax.l2c(ax.r2l(v)); }; + ax.c2r = function(v) { return ax.l2r(ax.c2l(v)); }; + if(['linear', 'log', '-'].indexOf(ax.type) !== -1) { ax.c2d = num; - ax.d2c = function(v) { - v = cleanDatum(v); - return isNumeric(v) ? Number(v) : constants.BADNUM; - }; - ax.d2l = function(v, clip) { - if(ax.type === 'log') return ax.c2l(ax.d2c(v), clip); - else return ax.d2c(v); - }; + ax.d2c = Lib.cleanNumber; + if(ax.type === 'log') { + ax.d2l = function(v, clip) { + return ax.c2l(ax.d2c(v), clip); + }; + ax.d2r = ax.d2l; + ax.r2d = ax.l2d; + } + else { + ax.d2l = Lib.cleanNumber; + ax.d2r = Lib.cleanNumber; + ax.r2d = num; + } + ax.r2l = num; + ax.l2r = num; } else if(ax.type === 'date') { - ax.c2d = function(v) { - return isNumeric(v) ? Lib.ms2DateTime(v) : constants.BADNUM; - }; + ax.c2d = Lib.ms2DateTime; ax.d2c = function(v) { - return (isNumeric(v)) ? Number(v) : Lib.dateTime2ms(v); + // NOTE: Changed this behavior: previously we took any numeric value + // to be a ms, even if it was a string that could be a bare year. + // Now we convert it as a date if at all possible, and only try + // as ms if that fails. + var ms = Lib.dateTime2ms(v); + if(ms === BADNUM) { + if(isNumeric(v)) ms = Number(v); + else return BADNUM; + } + return Lib.constrain(ms, Lib.MIN_MS, Lib.MAX_MS); }; ax.d2l = ax.d2c; - - // check if date strings or js date objects are provided for range - // and convert to ms - if(ax.range && ax.range.length > 1) { - try { - var ar1 = ax.range.map(Lib.dateTime2ms); - if(!isNumeric(ax.range[0]) && isNumeric(ar1[0])) { - ax.range[0] = ar1[0]; - } - if(!isNumeric(ax.range[1]) && isNumeric(ar1[1])) { - ax.range[1] = ar1[1]; - } - } - catch(e) { Lib.error(e, ax.range); } - } + ax.r2l = ax.d2c; + ax.l2r = ax.c2d; + ax.d2r = Lib.identity; + ax.r2d = Lib.identity; + ax.cleanr = function(v) { + /* + * If v is already a date string this is a noop, but running it + * through d2c and back validates the value: + * normalizes Date objects, milliseconds, and out-of-bounds dates + * so we always end up with either a clean date string or BADNUM + */ + return ax.c2d(ax.d2c(v)); + }; } else if(ax.type === 'category') { @@ -113271,38 +113377,42 @@ module.exports = function setConvert(ax) { } var c = ax._categories.indexOf(v); - return c === -1 ? constants.BADNUM : c; + return c === -1 ? BADNUM : c; }; ax.d2l = ax.d2c; + ax.r2l = num; + ax.l2r = num; + ax.d2r = ax.d2c; + ax.r2d = ax.c2d; } // makeCalcdata: takes an x or y array and converts it // to a position on the axis object "ax" // inputs: - // tdc - a data object from td.data - // axletter - a string, either 'x' or 'y', for which item + // trace - a data object from gd.data + // axLetter - a string, either 'x' or 'y', for which item // to convert (TODO: is this now always the same as // the first letter of ax._id?) // in case the expected data isn't there, make a list of // integers based on the opposite data - ax.makeCalcdata = function(tdc, axletter) { + ax.makeCalcdata = function(trace, axLetter) { var arrayIn, arrayOut, i; - if(axletter in tdc) { - arrayIn = tdc[axletter]; + if(axLetter in trace) { + arrayIn = trace[axLetter]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = ax.d2c(arrayIn[i]); } else { - var v0 = ((axletter + '0') in tdc) ? - ax.d2c(tdc[axletter + '0']) : 0, - dv = (tdc['d' + axletter]) ? - Number(tdc['d' + axletter]) : 1; + var v0 = ((axLetter + '0') in trace) ? + ax.d2c(trace[axLetter + '0']) : 0, + dv = (trace['d' + axLetter]) ? + Number(trace['d' + axLetter]) : 1; // the opposing data, for size if we have x and dx etc - arrayIn = tdc[{x: 'y', y: 'x'}[axletter]]; + arrayIn = trace[{x: 'y', y: 'x'}[axLetter]]; arrayOut = new Array(arrayIn.length); for(i = 0; i < arrayIn.length; i++) arrayOut[i] = v0 + i * dv; @@ -113317,11 +113427,11 @@ module.exports = function setConvert(ax) { ax._max = []; // and for bar charts and box plots: reset forced minimum tick spacing - ax._minDtick = null; - ax._forceTick0 = null; + delete ax._minDtick; + delete ax._forceTick0; }; -},{"../../lib":632,"./axis_ids":665,"./clean_datum":667,"./constants":668,"d3":95,"fast-isnumeric":104}],678:[function(require,module,exports){ +},{"../../constants/numerical":616,"../../lib":633,"./axis_ids":667,"./constants":669,"d3":95,"fast-isnumeric":104}],679:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113391,8 +113501,8 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe */ function getShowAttrDflt(containerIn) { var showAttrsAll = ['showexponent', - 'showtickprefix', - 'showticksuffix'], + 'showtickprefix', + 'showticksuffix'], showAttrs = showAttrsAll.filter(function(a) { return containerIn[a] !== undefined; }), @@ -113405,7 +113515,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":632}],679:[function(require,module,exports){ +},{"../../lib":633}],680:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113438,7 +113548,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":632,"./layout_attributes":672}],680:[function(require,module,exports){ +},{"../../lib":633,"./layout_attributes":673}],681:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113451,6 +113561,8 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, 'use strict'; var isNumeric = require('fast-isnumeric'); +var Lib = require('../../lib'); +var ONEDAY = require('../../constants/numerical').ONEDAY; module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType) { @@ -113462,15 +113574,56 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } if(Array.isArray(containerIn.tickvals)) tickmodeDefault = 'array'; - else if(containerIn.dtick && isNumeric(containerIn.dtick)) { + else if(containerIn.dtick) { tickmodeDefault = 'linear'; } var tickmode = coerce('tickmode', tickmodeDefault); if(tickmode === 'auto') coerce('nticks'); else if(tickmode === 'linear') { - coerce('tick0'); - coerce('dtick'); + // dtick is usually a positive number, but there are some + // special strings available for log or date axes + // default is 1 day for dates, otherwise 1 + var dtickDflt = (axType === 'date') ? ONEDAY : 1; + var dtick = coerce('dtick', dtickDflt); + if(isNumeric(dtick)) { + containerOut.dtick = (dtick > 0) ? Number(dtick) : dtickDflt; + } + else if(typeof dtick !== 'string') { + containerOut.dtick = dtickDflt; + } + else { + // date and log special cases are all one character plus a number + var prefix = dtick.charAt(0), + dtickNum = dtick.substr(1); + + dtickNum = isNumeric(dtickNum) ? Number(dtickNum) : 0; + if((dtickNum <= 0) || !( + // "M" gives ticks every (integer) n months + (axType === 'date' && prefix === 'M' && dtickNum === Math.round(dtickNum)) || + // "L" gives ticks linearly spaced in data (not in position) every (float) f + (axType === 'log' && prefix === 'L') || + // "D1" gives powers of 10 with all small digits between, "D2" gives only 2 and 5 + (axType === 'log' && prefix === 'D' && (dtickNum === 1 || dtickNum === 2)) + )) { + containerOut.dtick = dtickDflt; + } + } + + // tick0 can have different valType for different axis types, so + // validate that now. Also for dates, change milliseconds to date strings + var tick0Dflt = (axType === 'date') ? '2000-01-01' : 0; + var tick0 = coerce('tick0', tick0Dflt); + if(axType === 'date') { + containerOut.tick0 = Lib.cleanDate(tick0, tick0Dflt); + } + // Aside from date axes, dtick must be numeric; D1 and D2 modes ignore tick0 entirely + else if(isNumeric(tick0) && dtick !== 'D1' && dtick !== 'D2') { + containerOut.tick0 = Number(tick0); + } + else { + containerOut.tick0 = tick0Dflt; + } } else { var tickvals = coerce('tickvals'); @@ -113479,7 +113632,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"fast-isnumeric":104}],681:[function(require,module,exports){ +},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],682:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -113791,7 +113944,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../lib":632,"../../plotly":658,"../../registry":738,"./axes":662,"d3":95}],682:[function(require,module,exports){ +},{"../../lib":633,"../../plotly":659,"../../registry":739,"./axes":664,"d3":95}],683:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -114203,7 +114356,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":632,"../plotly":658}],683:[function(require,module,exports){ +},{"../lib":633,"../plotly":659}],684:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -114234,7 +114387,7 @@ module.exports = { } }; -},{}],684:[function(require,module,exports){ +},{}],685:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -114275,7 +114428,7 @@ module.exports = { } }; -},{}],685:[function(require,module,exports){ +},{}],686:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -114433,7 +114586,7 @@ params.layerNameToAdjective = { // base layers drawn over choropleth params.baseLayersOverChoropleth = ['rivers', 'lakes']; -},{}],686:[function(require,module,exports){ +},{}],687:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -114462,7 +114615,7 @@ var constants = require('./constants'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); var topojsonUtils = require('../../lib/topojson_utils'); -var topojsonFeature = require('topojson').feature; +var topojsonFeature = require('topojson-client').feature; // add a few projection types to d3.geo addProjectionsToD3(d3); @@ -114995,7 +115148,7 @@ function createMockAxis(fullLayout) { return mockAxis; } -},{"../../components/color":533,"../../components/drawing":557,"../../constants/xmlns_namespaces":618,"../../lib/topojson_utils":647,"../../plots/cartesian/axes":662,"../../plots/cartesian/graph_interact":670,"./constants":685,"./projections":693,"./set_scale":694,"./zoom":695,"./zoom_reset":696,"d3":95,"topojson":491}],687:[function(require,module,exports){ +},{"../../components/color":533,"../../components/drawing":556,"../../constants/xmlns_namespaces":618,"../../lib/topojson_utils":648,"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"./constants":686,"./projections":694,"./set_scale":695,"./zoom":696,"./zoom_reset":697,"d3":95,"topojson-client":491}],688:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115114,7 +115267,7 @@ function getSubplotCalcData(calcData, id) { return subplotCalcData; } -},{"../../plots/plots":723,"./geo":686,"./layout/attributes":688,"./layout/defaults":691,"./layout/layout_attributes":692}],688:[function(require,module,exports){ +},{"../../plots/plots":724,"./geo":687,"./layout/attributes":689,"./layout/defaults":692,"./layout/layout_attributes":693}],689:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115135,7 +115288,7 @@ module.exports = { } }; -},{}],689:[function(require,module,exports){ +},{}],690:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115190,7 +115343,7 @@ module.exports = { } }; -},{"../../../components/color/attributes":532}],690:[function(require,module,exports){ +},{"../../../components/color/attributes":532}],691:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115264,7 +115417,7 @@ module.exports = function supplyGeoAxisLayoutDefaults(geoLayoutIn, geoLayoutOut) } }; -},{"../../../lib":632,"../constants":685,"./axis_attributes":689}],691:[function(require,module,exports){ +},{"../../../lib":633,"../constants":686,"./axis_attributes":690}],692:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115383,7 +115536,7 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce) { ]; } -},{"../../subplot_defaults":730,"../constants":685,"./axis_defaults":690,"./layout_attributes":692}],692:[function(require,module,exports){ +},{"../../subplot_defaults":731,"../constants":686,"./axis_defaults":691,"./layout_attributes":693}],693:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -115616,7 +115769,7 @@ module.exports = { lataxis: geoAxesAttrs }; -},{"../../../components/color/attributes":532,"../constants":685,"./axis_attributes":689}],693:[function(require,module,exports){ +},{"../../../components/color/attributes":532,"../constants":686,"./axis_attributes":690}],694:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116062,7 +116215,7 @@ function addProjectionsToD3(d3) { module.exports = addProjectionsToD3; -},{}],694:[function(require,module,exports){ +},{}],695:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116192,7 +116345,7 @@ function makeRangeBox(lon0, lat0, lon1, lat1) { return { type: 'Polygon', coordinates: [ - [ [lon0, lat0], + [ [lon0, lat0], [lon0, lat1], [lon0 + dlon4, lat1], [lon0 + 2 * dlon4, lat1], @@ -116213,7 +116366,7 @@ function getBounds(projection, rangeBox) { return d3.geo.path().projection(projection).bounds(rangeBox); } -},{"./constants":685,"d3":95}],695:[function(require,module,exports){ +},{"./constants":686,"d3":95}],696:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116640,7 +116793,7 @@ function d3_eventDispatch(target) { return dispatch; } -},{"d3":95}],696:[function(require,module,exports){ +},{"d3":95}],697:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116675,7 +116828,7 @@ function createGeoZoomReset(geo, geoLayout) { module.exports = createGeoZoomReset; -},{"../cartesian/graph_interact":670}],697:[function(require,module,exports){ +},{"../cartesian/graph_interact":671}],698:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -116716,8 +116869,7 @@ function createCamera(scene) { } result.mouseListener = mouseChange(element, function(buttons, x, y) { - var xrange = scene.xaxis.range, - yrange = scene.yaxis.range, + var dataBox = scene.calcDataBox(), viewBox = plot.viewBox; var lastX = result.lastPos[0], @@ -116729,14 +116881,15 @@ function createCamera(scene) { // mouseChange gives y about top; convert to about bottom y = (viewBox[3] - viewBox[1]) - y; - function updateRange(range, start, end) { + function updateRange(i0, start, end) { var range0 = Math.min(start, end), range1 = Math.max(start, end); if(range0 !== range1) { - range[0] = range0; - range[1] = range1; - result.dataBox = range; + dataBox[i0] = range0; + dataBox[i0 + 2] = range1; + result.dataBox = dataBox; + scene.setRanges(dataBox); } else { scene.selectBox.selectBox = [0, 0, 1, 1]; @@ -116748,11 +116901,11 @@ function createCamera(scene) { case 'zoom': if(buttons) { var dataX = x / - (viewBox[2] - viewBox[0]) * (xrange[1] - xrange[0]) + - xrange[0]; + (viewBox[2] - viewBox[0]) * (dataBox[2] - dataBox[0]) + + dataBox[0]; var dataY = y / - (viewBox[3] - viewBox[1]) * (yrange[1] - yrange[0]) + - yrange[0]; + (viewBox[3] - viewBox[1]) * (dataBox[3] - dataBox[1]) + + dataBox[1]; if(!result.boxEnabled) { result.boxStart[0] = dataX; @@ -116765,8 +116918,8 @@ function createCamera(scene) { result.boxEnabled = true; } else if(result.boxEnabled) { - updateRange(xrange, result.boxStart[0], result.boxEnd[0]); - updateRange(yrange, result.boxStart[1], result.boxEnd[1]); + updateRange(0, result.boxStart[0], result.boxEnd[0]); + updateRange(1, result.boxStart[1], result.boxEnd[1]); unSetAutoRange(); result.boxEnabled = false; } @@ -116776,15 +116929,17 @@ function createCamera(scene) { result.boxEnabled = false; if(buttons) { - var dx = (lastX - x) * (xrange[1] - xrange[0]) / + var dx = (lastX - x) * (dataBox[2] - dataBox[0]) / (plot.viewBox[2] - plot.viewBox[0]); - var dy = (lastY - y) * (yrange[1] - yrange[0]) / + var dy = (lastY - y) * (dataBox[3] - dataBox[1]) / (plot.viewBox[3] - plot.viewBox[1]); - xrange[0] += dx; - xrange[1] += dx; - yrange[0] += dy; - yrange[1] += dy; + dataBox[0] += dx; + dataBox[2] += dx; + dataBox[1] += dy; + dataBox[3] += dy; + + scene.setRanges(dataBox); result.lastInputTime = Date.now(); unSetAutoRange(); @@ -116798,8 +116953,7 @@ function createCamera(scene) { }); result.wheelListener = mouseWheel(element, function(dx, dy) { - var xrange = scene.xaxis.range, - yrange = scene.yaxis.range, + var dataBox = scene.calcDataBox(), viewBox = plot.viewBox; var lastX = result.lastPos[0], @@ -116813,16 +116967,18 @@ function createCamera(scene) { var scale = Math.exp(0.1 * dy / (viewBox[3] - viewBox[1])); var cx = lastX / - (viewBox[2] - viewBox[0]) * (xrange[1] - xrange[0]) + - xrange[0]; + (viewBox[2] - viewBox[0]) * (dataBox[2] - dataBox[0]) + + dataBox[0]; var cy = lastY / - (viewBox[3] - viewBox[1]) * (yrange[1] - yrange[0]) + - yrange[0]; + (viewBox[3] - viewBox[1]) * (dataBox[3] - dataBox[1]) + + dataBox[1]; + + dataBox[0] = (dataBox[0] - cx) * scale + cx; + dataBox[2] = (dataBox[2] - cx) * scale + cx; + dataBox[1] = (dataBox[1] - cy) * scale + cy; + dataBox[3] = (dataBox[3] - cy) * scale + cy; - xrange[0] = (xrange[0] - cx) * scale + cx; - xrange[1] = (xrange[1] - cx) * scale + cx; - yrange[0] = (yrange[0] - cy) * scale + cy; - yrange[1] = (yrange[1] - cy) * scale + cy; + scene.setRanges(dataBox); result.lastInputTime = Date.now(); unSetAutoRange(); @@ -116836,7 +116992,7 @@ function createCamera(scene) { return result; } -},{"mouse-change":413,"mouse-wheel":415}],698:[function(require,module,exports){ +},{"mouse-change":413,"mouse-wheel":415}],699:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117082,7 +117238,7 @@ function createAxes2D(scene) { module.exports = createAxes2D; -},{"../../lib/html2unicode":631,"../../lib/str2rgbarray":645,"../cartesian/axes":662,"../plots":723}],699:[function(require,module,exports){ +},{"../../lib/html2unicode":632,"../../lib/str2rgbarray":646,"../cartesian/axes":664,"../plots":724}],700:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117194,7 +117350,7 @@ exports.toSVG = function(gd) { } }; -},{"../../constants/xmlns_namespaces":618,"../cartesian/attributes":661,"../plots":723,"./scene2d":700}],700:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":618,"../cartesian/attributes":663,"../plots":724,"./scene2d":701}],701:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -117507,14 +117663,9 @@ var relayoutCallback = function(scene) { }; proto.cameraChanged = function() { - var camera = this.camera, - xrange = this.xaxis.range, - yrange = this.yaxis.range; + var camera = this.camera; - this.glplot.setDataBox([ - xrange[0], yrange[0], - xrange[1], yrange[1] - ]); + this.glplot.setDataBox(this.calcDataBox()); var nextTicks = this.computeTickMarks(); var curTicks = this.glplotOptions.ticks; @@ -117612,9 +117763,7 @@ proto.plot = function(fullData, calcData, fullLayout) { options.ticks = this.computeTickMarks(); - var xrange = this.xaxis.range; - var yrange = this.yaxis.range; - options.dataBox = [xrange[0], yrange[0], xrange[1], yrange[1]]; + options.dataBox = this.calcDataBox(); options.merge(fullLayout); glplot.update(options); @@ -117623,6 +117772,27 @@ proto.plot = function(fullData, calcData, fullLayout) { this.glplot.draw(); }; +proto.calcDataBox = function() { + var xaxis = this.xaxis, + yaxis = this.yaxis, + xrange = xaxis.range, + yrange = yaxis.range, + xr2l = xaxis.r2l, + yr2l = yaxis.r2l; + + return [xr2l(xrange[0]), yr2l(yrange[0]), xr2l(xrange[1]), yr2l(yrange[1])]; +}; + +proto.setRanges = function(dataBox) { + var xaxis = this.xaxis, + yaxis = this.yaxis, + xl2r = xaxis.l2r, + yl2r = yaxis.l2r; + + xaxis.range = [xl2r(dataBox[0]), xl2r(dataBox[2])]; + yaxis.range = [yl2r(dataBox[1]), yl2r(dataBox[3])]; +}; + proto.updateTraces = function(fullData, calcData) { var traceIds = Object.keys(this.traces); var i, j, fullTrace; @@ -117801,7 +117971,7 @@ proto.hoverFormatter = function(axisName, val) { return Axes.tickText(axis, axis.c2l(val), 'hover').text; }; -},{"../../lib/html2unicode":631,"../../lib/show_no_webgl_msg":643,"../../plots/cartesian/axes":662,"../../plots/cartesian/graph_interact":670,"./camera":697,"./convert":698,"gl-plot2d":187,"gl-select-box":218,"gl-spikes2d":227,"webgl-context":518}],701:[function(require,module,exports){ +},{"../../lib/html2unicode":632,"../../lib/show_no_webgl_msg":644,"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"./camera":698,"./convert":699,"gl-plot2d":187,"gl-select-box":218,"gl-spikes2d":227,"webgl-context":518}],702:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118044,7 +118214,7 @@ function createCamera(element, options) { return camera; } -},{"3d-view":27,"mouse-change":413,"mouse-wheel":415,"right-now":459}],702:[function(require,module,exports){ +},{"3d-view":27,"mouse-change":413,"mouse-wheel":415,"right-now":459}],703:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118178,7 +118348,7 @@ function initAxes(gd, sceneLayout) { } } -},{"../../constants/xmlns_namespaces":618,"../plots":723,"./layout/attributes":703,"./layout/defaults":707,"./layout/layout_attributes":708,"./scene":712,"./set_convert":713}],703:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":618,"../plots":724,"./layout/attributes":704,"./layout/defaults":708,"./layout/layout_attributes":709,"./scene":713,"./set_convert":714}],704:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118199,7 +118369,7 @@ module.exports = { } }; -},{}],704:[function(require,module,exports){ +},{}],705:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118306,7 +118476,7 @@ module.exports = { zerolinewidth: axesAttrs.zerolinewidth }; -},{"../../../components/color":533,"../../../lib/extend":625,"../../cartesian/layout_attributes":672}],705:[function(require,module,exports){ +},{"../../../components/color":533,"../../../lib/extend":626,"../../cartesian/layout_attributes":673}],706:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118374,7 +118544,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { } }; -},{"../../../lib":632,"../../cartesian/axis_defaults":664,"./axis_attributes":704,"tinycolor2":489}],706:[function(require,module,exports){ +},{"../../../lib":633,"../../cartesian/axis_defaults":666,"./axis_attributes":705,"tinycolor2":489}],707:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118529,7 +118699,7 @@ function createAxesOptions(plotlyOptions) { module.exports = createAxesOptions; -},{"../../../lib/html2unicode":631,"../../../lib/str2rgbarray":645,"arraytools":33}],707:[function(require,module,exports){ +},{"../../../lib/html2unicode":632,"../../../lib/str2rgbarray":646,"arraytools":33}],708:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118636,7 +118806,7 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { coerce('hovermode', opts.getDfltFromLayout('hovermode')); } -},{"../../../components/color":533,"../../subplot_defaults":730,"./axis_defaults":705,"./layout_attributes":708}],708:[function(require,module,exports){ +},{"../../../components/color":533,"../../subplot_defaults":731,"./axis_defaults":706,"./layout_attributes":709}],709:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118764,7 +118934,7 @@ module.exports = { } }; -},{"../../../lib/extend":625,"./axis_attributes":704}],709:[function(require,module,exports){ +},{"../../../lib/extend":626,"./axis_attributes":705}],710:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118810,7 +118980,7 @@ function createSpikeOptions(layout) { module.exports = createSpikeOptions; -},{"../../../lib/str2rgbarray":645}],710:[function(require,module,exports){ +},{"../../../lib/str2rgbarray":646}],711:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118906,7 +119076,7 @@ function computeTickMarks(scene) { scene.contourLevels = contourLevelsFromTicks(ticks); } -},{"../../../lib":632,"../../../lib/html2unicode":631,"../../cartesian/axes":662}],711:[function(require,module,exports){ +},{"../../../lib":633,"../../../lib/html2unicode":632,"../../cartesian/axes":664}],712:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -118940,7 +119110,7 @@ function project(camera, v) { module.exports = project; -},{}],712:[function(require,module,exports){ +},{}],713:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119669,7 +119839,7 @@ proto.toImage = function(format) { module.exports = Scene; -},{"../../lib":632,"../../lib/show_no_webgl_msg":643,"../../lib/str2rgbarray":645,"../../plots/cartesian/axes":662,"../../plots/cartesian/graph_interact":670,"./camera":701,"./layout/convert":706,"./layout/spikes":709,"./layout/tick_marks":710,"./project":711,"./set_convert":713,"gl-plot3d":189,"webgl-context":518}],713:[function(require,module,exports){ +},{"../../lib":633,"../../lib/show_no_webgl_msg":644,"../../lib/str2rgbarray":646,"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"./camera":702,"./layout/convert":707,"./layout/spikes":710,"./layout/tick_marks":711,"./project":712,"./set_convert":714,"gl-plot3d":189,"webgl-context":518}],714:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119690,7 +119860,7 @@ module.exports = function setConvert(containerOut) { containerOut.setScale = Lib.noop; }; -},{"../../lib":632,"../cartesian/axes":662}],714:[function(require,module,exports){ +},{"../../lib":633,"../cartesian/axes":664}],715:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119832,28 +120002,22 @@ module.exports = { }, - _composedModules: { - '*': 'Fx' + dragmode: { + valType: 'enumerated', + + values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], + dflt: 'zoom', + }, - - _nestedModules: { - 'xaxis': 'Axes', - 'yaxis': 'Axes', - 'scene': 'gl3d', - 'geo': 'geo', - 'ternary': 'ternary', - 'mapbox': 'mapbox', - - 'legend': 'legend', - 'annotations': 'annotations', - 'shapes': 'shapes', - 'images': 'images', - 'updatemenus': 'updatemenus', - 'sliders': 'sliders' + hovermode: { + valType: 'enumerated', + + values: ['x', 'y', 'closest', false], + } }; -},{"../components/color/attributes":532,"../lib":632,"./font_attributes":683}],715:[function(require,module,exports){ +},{"../components/color/attributes":532,"../lib":633,"./font_attributes":684}],716:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119883,7 +120047,7 @@ module.exports = { mapOnErrorMsg: 'Mapbox error.' }; -},{}],716:[function(require,module,exports){ +},{}],717:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -119957,7 +120121,7 @@ module.exports = function convertTextOpts(textposition, iconSize) { return { anchor: anchor, offset: offset }; }; -},{"../../lib":632}],717:[function(require,module,exports){ +},{"../../lib":633}],718:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120113,7 +120277,7 @@ function findAccessToken(gd, mapboxIds) { return accessToken; } -},{"../../constants/xmlns_namespaces":618,"../plots":723,"./constants":715,"./layout_attributes":719,"./layout_defaults":720,"./mapbox":721,"mapbox-gl":304}],718:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":618,"../plots":724,"./constants":716,"./layout_attributes":720,"./layout_defaults":721,"./mapbox":722,"mapbox-gl":304}],719:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120338,7 +120502,7 @@ module.exports = function createMapboxLayer(mapbox, index, opts) { return mapboxLayer; }; -},{"../../lib":632,"./convert_text_opts":716}],719:[function(require,module,exports){ +},{"../../lib":633,"./convert_text_opts":717}],720:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120429,7 +120593,7 @@ module.exports = { }, layers: { - _isLinkedToArray: true, + _isLinkedToArray: 'layer', sourcetype: { valType: 'enumerated', @@ -120541,7 +120705,7 @@ module.exports = { }; -},{"../../components/color":533,"../../lib":632,"../../traces/scatter/attributes":844,"../font_attributes":683}],720:[function(require,module,exports){ +},{"../../components/color":533,"../../lib":633,"../../traces/scatter/attributes":846,"../font_attributes":684}],721:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -120637,7 +120801,7 @@ function handleLayerDefaults(containerIn, containerOut) { } } -},{"../../lib":632,"../subplot_defaults":730,"./layout_attributes":719}],721:[function(require,module,exports){ +},{"../../lib":633,"../subplot_defaults":731,"./layout_attributes":720}],722:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121093,7 +121257,7 @@ function convertCenter(center) { return [center.lon, center.lat]; } -},{"../../lib":632,"../cartesian/graph_interact":670,"./constants":715,"./layers":718,"./layout_attributes":719,"mapbox-gl":304}],722:[function(require,module,exports){ +},{"../../lib":633,"../cartesian/graph_interact":671,"./constants":716,"./layers":719,"./layout_attributes":720,"mapbox-gl":304}],723:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121131,7 +121295,7 @@ module.exports = { } }; -},{}],723:[function(require,module,exports){ +},{}],724:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -121498,6 +121662,9 @@ plots.sendDataToCloud = function(gd) { // gd._fullLayout._basePlotModules // is a list of all the plot modules required to draw the plot. // +// gd._fullLayout._transformModules +// is a list of all the transform modules invoked. +// plots.supplyDefaults = function(gd) { var oldFullLayout = gd._fullLayout || {}, newFullLayout = gd._fullLayout = {}, @@ -121509,6 +121676,9 @@ plots.supplyDefaults = function(gd) { var i; + // Create all the storage space for frames, but only if doesn't already exist + if(!gd._transitionData) plots.createTransitionData(gd); + // first fill in what we can of layout without looking at data // because fullData needs a few things from layout @@ -121569,7 +121739,7 @@ plots.supplyDefaults = function(gd) { } // finally, fill in the pieces of layout that may need to look at data - plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData); + plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData); // TODO remove in v2.0.0 // add has-plot-type refs to fullLayout for backward compatibility @@ -121608,12 +121778,6 @@ plots.supplyDefaults = function(gd) { (gd.calcdata[i][0] || {}).trace = trace; } } - - // Create all the storage space for frames, but only if doesn't already - // exist: - if(!gd._transitionData) { - plots.createTransitionData(gd); - } }; // Create storage for all of the data related to frames and transitions: @@ -121780,6 +121944,8 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) { basePlotModules = fullLayout._basePlotModules = [], cnt = 0; + fullLayout._transformModules = []; + function pushModule(fullTrace) { dataOut.push(fullTrace); @@ -121997,6 +122163,8 @@ function supplyTransformDefaults(traceIn, traceOut, layout) { transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn); transformOut.type = type; transformOut._module = _module; + + Lib.pushUnique(layout._transformModules, _module); } else { transformOut = Lib.extendFlat({}, transformIn); @@ -122166,7 +122334,7 @@ function calculateReservedMargins(margins) { return resultingMargin; } -plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { +plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, transitionData) { var i, _module; // can't be be part of basePlotModules loop @@ -122197,6 +122365,16 @@ plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) { } } + // transform module layout defaults + var transformModules = layoutOut._transformModules; + for(i = 0; i < transformModules.length; i++) { + _module = transformModules[i]; + + if(_module.supplyLayoutDefaults) { + _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData, transitionData); + } + } + // should FX be a component? Plotly.Fx.supplyLayoutDefaults(layoutIn, layoutOut, fullData); @@ -122224,8 +122402,16 @@ plots.purge = function(gd) { // remove modebar if(fullLayout._modeBar) fullLayout._modeBar.destroy(); - if(gd._transitionData && gd._transitionData._animationRaf) { - window.cancelAnimationFrame(gd._transitionData._animationRaf); + if(gd._transitionData) { + // Ensure any dangling callbacks are simply dropped if the plot is purged. + // This is more or less only actually important for testing. + if(gd._transitionData._interruptCallbacks) { + gd._transitionData._interruptCallbacks.length = 0; + } + + if(gd._transitionData._animationRaf) { + window.cancelAnimationFrame(gd._transitionData._animationRaf); + } } // data and layout @@ -122502,9 +122688,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { // convert native dates to date strings... // mostly for external users exporting to plotly - if(d && d.getTime) { - return Lib.ms2DateTime(d); - } + if(Lib.isJSDate(d)) return Lib.ms2DateTime(+d); return d; } @@ -122549,7 +122733,7 @@ plots.modifyFrames = function(gd, operations) { break;*/ case 'replace': frame = op.value; - var oldName = _frames[op.index].name; + var oldName = (_frames[op.index] || {}).name; var newName = frame.name; _frames[op.index] = _hash[newName] = frame; @@ -122683,8 +122867,14 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { for(i = 0; i < containerPaths.length; i++) { containerProp = Lib.nestedProperty(expandedObj, containerPaths[i]); containerVal = containerProp.get(); - containerProp.set(null); - Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + + if(containerVal === undefined) { + Lib.nestedProperty(containerObj, containerPaths[i]).set(null); + } + else { + containerProp.set(null); + Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + } } } @@ -122698,15 +122888,20 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { if(!srcContainer) continue; destProp = Lib.nestedProperty(dest, containerPaths[i]); - destContainer = destProp.get(); + if(!Array.isArray(destContainer)) { destContainer = []; destProp.set(destContainer); } for(j = 0; j < srcContainer.length; j++) { - destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcContainer[j]); + var srcObj = srcContainer[j]; + + if(srcObj === null) destContainer[j] = null; + else { + destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcObj); + } } destProp.set(destContainer); @@ -122717,7 +122912,7 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) { }; plots.dataArrayContainers = ['transforms']; -plots.layoutArrayContainers = ['annotations', 'shapes', 'images', 'sliders', 'updatemenus']; +plots.layoutArrayContainers = Registry.layoutArrayContainers; /* * Extend a trace definition. This method: @@ -122776,11 +122971,15 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var trace = gd._fullData[traceIdx]; var module = trace._module; - if(!module || !module.animatable) { - continue; - } + // There's nothing to do if this module is not defined: + if(!module) continue; - transitionedTraces.push(traceIdx); + // Don't register the trace as transitioned if it doens't know what to do. + // If it *is* registered, it will receive a callback that it's responsible + // for calling in order to register the transition as having completed. + if(module.animatable) { + transitionedTraces.push(traceIdx); + } gd.data[traceIndices[i]] = plots.extendTrace(gd.data[traceIndices[i]], data[i]); } @@ -122834,6 +123033,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var aborted = false; function executeTransitions() { + + gd.emit('plotly_transitioning', []); + return new Promise(function(resolve) { // This flag is used to disabled things like autorange: gd._transitioning = true; @@ -122918,6 +123120,11 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function completeTransition(callback) { + // This a simple workaround for tests which purge the graph before animations + // have completed. That's not a very common case, so this is the simplest + // fix. + if(!gd._transitionData) return; + flushCallbacks(gd._transitionData._interruptCallbacks); return Promise.resolve().then(function() { @@ -122935,6 +123142,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) } function interruptPreviousTransitions() { + // Fail-safe against purged plot: + if(!gd._transitionData) return; + // If a transition is interrupted, set this to false. At the moment, the only thing that would // interrupt a transition is another transition, so that it will momentarily be set to true // again, but this determines whether autorange or dragbox work, so it's for the sake of @@ -122962,13 +123172,13 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) var seq = [plots.previousPromises, interruptPreviousTransitions, prepareTransitions, executeTransitions]; - var transitionStarting = Lib.syncOrAsync(seq, gd); - if(!transitionStarting || !transitionStarting.then) transitionStarting = Promise.resolve(); + if(!transitionStarting || !transitionStarting.then) { + transitionStarting = Promise.resolve(); + } return transitionStarting.then(function() { - gd.emit('plotly_transitioning', []); return gd; }); }; @@ -123071,7 +123281,7 @@ plots.doCalcdata = function(gd, traces) { } }; -},{"../components/color":533,"../components/errorbars":563,"../lib":632,"../plotly":658,"../registry":738,"./animation_attributes":659,"./attributes":660,"./command":682,"./font_attributes":683,"./frame_attributes":684,"./layout_attributes":714,"d3":95,"fast-isnumeric":104}],724:[function(require,module,exports){ +},{"../components/color":533,"../components/errorbars":562,"../lib":633,"../plotly":659,"../registry":739,"./animation_attributes":660,"./attributes":662,"./command":683,"./font_attributes":684,"./frame_attributes":685,"./layout_attributes":715,"d3":95,"fast-isnumeric":104}],725:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123096,7 +123306,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":844}],725:[function(require,module,exports){ +},{"../../traces/scatter/attributes":846}],726:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123211,7 +123421,7 @@ module.exports = { } }; -},{"../../lib/extend":625,"../cartesian/layout_attributes":672}],726:[function(require,module,exports){ +},{"../../lib/extend":626,"../cartesian/layout_attributes":673}],727:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -123226,7 +123436,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":727,"./micropolar_manager":728}],727:[function(require,module,exports){ +},{"./micropolar":728,"./micropolar_manager":729}],728:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124645,7 +124855,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":632,"d3":95}],728:[function(require,module,exports){ +},{"../../lib":633,"d3":95}],729:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124731,7 +124941,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":533,"../../lib":632,"./micropolar":727,"./undo_manager":729,"d3":95}],729:[function(require,module,exports){ +},{"../../components/color":533,"../../lib":633,"./micropolar":728,"./undo_manager":730,"d3":95}],730:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124797,7 +125007,7 @@ module.exports = function UndoManager() { }; }; -},{}],730:[function(require,module,exports){ +},{}],731:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124872,7 +125082,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":632,"./plots":723}],731:[function(require,module,exports){ +},{"../lib":633,"./plots":724}],732:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124946,7 +125156,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/plots":723,"./layout/attributes":732,"./layout/defaults":735,"./layout/layout_attributes":736,"./ternary":737}],732:[function(require,module,exports){ +},{"../../plots/plots":724,"./layout/attributes":733,"./layout/defaults":736,"./layout/layout_attributes":737,"./ternary":738}],733:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -124967,7 +125177,7 @@ module.exports = { } }; -},{}],733:[function(require,module,exports){ +},{}],734:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125027,7 +125237,7 @@ module.exports = { } }; -},{"../../../lib/extend":625,"../../cartesian/layout_attributes":672}],734:[function(require,module,exports){ +},{"../../../lib/extend":626,"../../cartesian/layout_attributes":673}],735:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125111,7 +125321,7 @@ module.exports = function supplyLayoutDefaults(containerIn, containerOut, option } }; -},{"../../../lib":632,"../../cartesian/tick_label_defaults":678,"../../cartesian/tick_mark_defaults":679,"../../cartesian/tick_value_defaults":680,"./axis_attributes":733,"tinycolor2":489}],735:[function(require,module,exports){ +},{"../../../lib":633,"../../cartesian/tick_label_defaults":679,"../../cartesian/tick_mark_defaults":680,"../../cartesian/tick_value_defaults":681,"./axis_attributes":734,"tinycolor2":489}],736:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125174,7 +125384,7 @@ function handleTernaryDefaults(ternaryLayoutIn, ternaryLayoutOut, coerce, option } } -},{"../../../components/color":533,"../../subplot_defaults":730,"./axis_defaults":734,"./layout_attributes":736}],736:[function(require,module,exports){ +},{"../../../components/color":533,"../../subplot_defaults":731,"./axis_defaults":735,"./layout_attributes":737}],737:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125230,7 +125440,7 @@ module.exports = { caxis: ternaryAxesAttrs }; -},{"../../../components/color/attributes":532,"./axis_attributes":733}],737:[function(require,module,exports){ +},{"../../../components/color/attributes":532,"./axis_attributes":734}],738:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125252,7 +125462,6 @@ var Drawing = require('../../components/drawing'); var setConvert = require('../cartesian/set_convert'); var extendFlat = require('../../lib/extend').extendFlat; var Axes = require('../cartesian/axes'); -var filterVisible = require('../../lib/filter_visible'); var dragElement = require('../../components/dragelement'); var Titles = require('../../components/titles'); var prepSelect = require('../cartesian/select'); @@ -125327,7 +125536,7 @@ proto.plot = function(ternaryData, fullLayout) { var moduleData = traceHash[moduleNames[i]]; var _module = moduleData[0]._module; - _module.plot(_this, filterVisible(moduleData), ternaryLayout); + _module.plot(_this, Lib.filterVisible(moduleData), ternaryLayout); } _this.traceHash = traceHash; @@ -125920,7 +126129,7 @@ function removeZoombox(gd) { .remove(); } -},{"../../components/color":533,"../../components/dragelement":555,"../../components/drawing":557,"../../components/titles":608,"../../lib":632,"../../lib/extend":625,"../../lib/filter_visible":627,"../../plotly":658,"../cartesian/axes":662,"../cartesian/constants":668,"../cartesian/graph_interact":670,"../cartesian/select":676,"../cartesian/set_convert":677,"d3":95,"tinycolor2":489}],738:[function(require,module,exports){ +},{"../../components/color":533,"../../components/dragelement":554,"../../components/drawing":556,"../../components/titles":607,"../../lib":633,"../../lib/extend":626,"../../plotly":659,"../cartesian/axes":664,"../cartesian/constants":669,"../cartesian/graph_interact":671,"../cartesian/select":677,"../cartesian/set_convert":678,"d3":95,"tinycolor2":489}],739:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -125936,11 +126145,12 @@ var Lib = require('./lib'); var basePlotAttributes = require('./plots/attributes'); exports.modules = {}; -exports.allTypes = []; exports.allCategories = {}; +exports.allTypes = []; exports.subplotsRegistry = {}; exports.transformsRegistry = {}; exports.componentsRegistry = {}; +exports.layoutArrayContainers = []; /** * register a module as the handler for a trace type @@ -126006,6 +126216,16 @@ exports.registerSubplot = function(_module) { exports.subplotsRegistry[plotType] = _module; }; +exports.registerComponent = function(_module) { + var name = _module.name; + + exports.componentsRegistry[name] = _module; + + if(_module.layoutAttributes && _module.layoutAttributes._isLinkedToArray) { + Lib.pushUnique(exports.layoutArrayContainers, name); + } +}; + /** * Get registered module using trace object or trace type * @@ -126077,7 +126297,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib":632,"./plots/attributes":660}],739:[function(require,module,exports){ +},{"./lib":633,"./plots/attributes":662}],740:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126204,11 +126424,12 @@ module.exports = function clonePlot(graphObj, options) { } } - var td = document.createElement('div'); - if(options.tileClass) td.className = options.tileClass; + var gd = document.createElement('div'); + if(options.tileClass) gd.className = options.tileClass; var plotTile = { - td: td, + gd: gd, + td: gd, // for external (image server) compatibility layout: newLayout, data: newData, config: { @@ -126228,13 +126449,13 @@ module.exports = function clonePlot(graphObj, options) { plotTile.config.setBackground = options.setBackground || 'opaque'; } - // attaching the default Layout the td, so you can grab it later - plotTile.td.defaultLayout = cloneLayoutOverride(options.tileClass); + // attaching the default Layout the gd, so you can grab it later + plotTile.gd.defaultLayout = cloneLayoutOverride(options.tileClass); return plotTile; }; -},{"../lib":632,"../plots/plots":723}],740:[function(require,module,exports){ +},{"../lib":633,"../plots/plots":724}],741:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126300,7 +126521,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":632,"../plot_api/to_image":656,"./filesaver":741}],741:[function(require,module,exports){ +},{"../lib":633,"../plot_api/to_image":657,"./filesaver":742}],742:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126368,7 +126589,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],742:[function(require,module,exports){ +},{}],743:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126401,7 +126622,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],743:[function(require,module,exports){ +},{}],744:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126427,7 +126648,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":739,"./download":740,"./helpers":742,"./svgtoimg":744,"./toimage":745,"./tosvg":746}],744:[function(require,module,exports){ +},{"./cloneplot":740,"./download":741,"./helpers":743,"./svgtoimg":745,"./toimage":746,"./tosvg":747}],745:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126558,7 +126779,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":632,"events":102}],745:[function(require,module,exports){ +},{"../lib":633,"events":102}],746:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126591,7 +126812,7 @@ function toImage(gd, opts) { var ev = new EventEmitter(); var clone = clonePlot(gd, {format: 'png'}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; @@ -126638,7 +126859,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":632,"../plotly":658,"./cloneplot":739,"./helpers":742,"./svgtoimg":744,"./tosvg":746,"events":102}],746:[function(require,module,exports){ +},{"../lib":633,"../plotly":659,"./cloneplot":740,"./helpers":743,"./svgtoimg":745,"./tosvg":747,"events":102}],747:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126757,7 +126978,7 @@ module.exports = function toSVG(gd, format) { return s; }; -},{"../components/color":533,"../components/drawing":557,"../constants/xmlns_namespaces":618,"../lib/svg_text_utils":646,"d3":95}],747:[function(require,module,exports){ +},{"../components/color":533,"../components/drawing":556,"../constants/xmlns_namespaces":618,"../lib/svg_text_utils":647,"d3":95}],748:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126789,7 +127010,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":632}],748:[function(require,module,exports){ +},{"../../lib":633}],749:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126802,6 +127023,9 @@ module.exports = function arraysToCalcdata(cd) { var scatterAttrs = require('../scatter/attributes'); var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; var scatterMarkerAttrs = scatterAttrs.marker; @@ -126815,9 +127039,11 @@ var markerLine = extendFlat({}, { }, colorAttributes('marker.line')); var marker = extendFlat({}, { - showscale: scatterMarkerAttrs.showscale, line: markerLine -}, colorAttributes('marker')); +}, colorAttributes('marker'), { + showscale: scatterMarkerAttrs.showscale, + colorbar: colorbarAttrs +}); module.exports = { @@ -126866,11 +127092,8 @@ module.exports = { r: scatterAttrs.r, t: scatterAttrs.t, - _nestedModules: { // nested module coupling - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - }, + error_y: errorBarAttrs, + error_x: errorBarAttrs, _deprecated: { bardir: { @@ -126882,7 +127105,7 @@ module.exports = { } }; -},{"../../components/colorscale/color_attributes":541,"../../lib/extend":625,"../scatter/attributes":844}],749:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/color_attributes":540,"../../components/errorbars/attributes":558,"../../lib/extend":626,"../scatter/attributes":846}],750:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -126978,7 +127201,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":540,"../../components/colorscale/has_colorscale":547,"../../plots/cartesian/axes":662,"fast-isnumeric":104}],750:[function(require,module,exports){ +},{"../../components/colorscale/calc":539,"../../components/colorscale/has_colorscale":546,"../../plots/cartesian/axes":664,"fast-isnumeric":104}],751:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127023,7 +127246,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":533,"../../components/errorbars/defaults":562,"../../lib":632,"../bar/style_defaults":759,"../scatter/xy_defaults":866,"./attributes":748}],751:[function(require,module,exports){ +},{"../../components/color":533,"../../components/errorbars/defaults":561,"../../lib":633,"../bar/style_defaults":760,"../scatter/xy_defaults":868,"./attributes":749}],752:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127093,7 +127316,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { if(trace.orientation === 'h') { pointData.x0 = pointData.x1 = xa.c2p(di.x, true); - pointData.xLabelVal = di.s; + pointData.xLabelVal = di.b + di.s; pointData.y0 = ya.c2p(barPos(di) - barDelta, true); pointData.y1 = ya.c2p(barPos(di) + barDelta, true); @@ -127101,7 +127324,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } else { pointData.y0 = pointData.y1 = ya.c2p(di.y, true); - pointData.yLabelVal = di.s; + pointData.yLabelVal = di.b + di.s; pointData.x0 = xa.c2p(barPos(di) - barDelta, true); pointData.x1 = xa.c2p(barPos(di) + barDelta, true); @@ -127115,7 +127338,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return [pointData]; }; -},{"../../components/color":533,"../../components/errorbars":563,"../../plots/cartesian/graph_interact":670}],752:[function(require,module,exports){ +},{"../../components/color":533,"../../components/errorbars":562,"../../plots/cartesian/graph_interact":671}],753:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127151,7 +127374,7 @@ Bar.meta = { module.exports = Bar; -},{"../../plots/cartesian":671,"../scatter/colorbar":847,"./arrays_to_calcdata":747,"./attributes":748,"./calc":749,"./defaults":750,"./hover":751,"./layout_attributes":753,"./layout_defaults":754,"./plot":755,"./set_positions":756,"./style":758}],753:[function(require,module,exports){ +},{"../../plots/cartesian":672,"../scatter/colorbar":849,"./arrays_to_calcdata":748,"./attributes":749,"./calc":750,"./defaults":751,"./hover":752,"./layout_attributes":754,"./layout_defaults":755,"./plot":756,"./set_positions":757,"./style":759}],754:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127195,7 +127418,7 @@ module.exports = { } }; -},{}],754:[function(require,module,exports){ +},{}],755:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127253,7 +127476,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"../../registry":738,"./layout_attributes":753}],755:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"../../registry":739,"./layout_attributes":754}],756:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127374,7 +127597,7 @@ module.exports = function plot(gd, plotinfo, cdbar) { }; -},{"../../components/color":533,"../../components/errorbars":563,"../../lib":632,"./arrays_to_calcdata":747,"d3":95,"fast-isnumeric":104}],756:[function(require,module,exports){ +},{"../../components/color":533,"../../components/errorbars":562,"../../lib":633,"./arrays_to_calcdata":748,"d3":95,"fast-isnumeric":104}],757:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -127862,8 +128085,8 @@ function stackBars(gd, sa, sieve) { if(!isNumeric(bar.s)) continue; // stack current bar and get previous sum - var barBase = sieve.put(bar.p, bar.s), - barTop = barBase + bar.s; + var barBase = sieve.put(bar.p, bar.b + bar.s), + barTop = barBase + bar.b + bar.s; // store the bar base and top in each calcdata item bar.b = barBase; @@ -127901,7 +128124,7 @@ function sieveBars(gd, sa, sieve) { for(var j = 0; j < trace.length; j++) { var bar = trace[j]; - if(isNumeric(bar.s)) sieve.put(bar.p, bar.s); + if(isNumeric(bar.s)) sieve.put(bar.p, bar.b + bar.s); } } } @@ -127970,7 +128193,7 @@ function getAxisLetter(ax) { return ax._id.charAt(0); } -},{"../../plots/cartesian/axes":662,"../../registry":738,"./sieve.js":757,"fast-isnumeric":104}],757:[function(require,module,exports){ +},{"../../plots/cartesian/axes":664,"../../registry":739,"./sieve.js":758,"fast-isnumeric":104}],758:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128071,7 +128294,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../lib":632}],758:[function(require,module,exports){ +},{"../../lib":633}],759:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128115,9 +128338,8 @@ module.exports = function style(gd) { var trace = d[0].trace, marker = trace.marker, markerLine = marker.line, - markerIn = (trace._input || {}).marker || {}, - markerScale = Drawing.tryColorscale(marker, markerIn, ''), - lineScale = Drawing.tryColorscale(marker, markerIn, 'line.'); + markerScale = Drawing.tryColorscale(marker, ''), + lineScale = Drawing.tryColorscale(marker, 'line'); d3.select(this).selectAll('path').each(function(d) { // allow all marker and marker line colors to be scaled @@ -128150,7 +128372,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/color":533,"../../components/drawing":557,"../../components/errorbars":563,"d3":95}],759:[function(require,module,exports){ +},{"../../components/color":533,"../../components/drawing":556,"../../components/errorbars":562,"d3":95}],760:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128187,7 +128409,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('marker.line.width'); }; -},{"../../components/color":533,"../../components/colorscale/defaults":543,"../../components/colorscale/has_colorscale":547}],760:[function(require,module,exports){ +},{"../../components/color":533,"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546}],761:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128318,7 +128540,7 @@ module.exports = { fillcolor: scatterAttrs.fillcolor }; -},{"../../components/color/attributes":532,"../../lib/extend":625,"../scatter/attributes":844}],761:[function(require,module,exports){ +},{"../../components/color/attributes":532,"../../lib/extend":626,"../scatter/attributes":846}],762:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128467,7 +128689,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"fast-isnumeric":104}],762:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"fast-isnumeric":104}],763:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128536,7 +128758,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { } }; -},{"../../components/color":533,"../../lib":632,"./attributes":760}],763:[function(require,module,exports){ +},{"../../components/color":533,"../../lib":633,"./attributes":761}],764:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128645,7 +128867,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return closeData; }; -},{"../../components/color":533,"../../lib":632,"../../plots/cartesian/axes":662,"../../plots/cartesian/graph_interact":670}],764:[function(require,module,exports){ +},{"../../components/color":533,"../../lib":633,"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671}],765:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128678,7 +128900,7 @@ Box.meta = { module.exports = Box; -},{"../../plots/cartesian":671,"./attributes":760,"./calc":761,"./defaults":762,"./hover":763,"./layout_attributes":765,"./layout_defaults":766,"./plot":767,"./set_positions":768,"./style":769}],765:[function(require,module,exports){ +},{"../../plots/cartesian":672,"./attributes":761,"./calc":762,"./defaults":763,"./hover":764,"./layout_attributes":766,"./layout_defaults":767,"./plot":768,"./set_positions":769,"./style":770}],766:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128716,7 +128938,7 @@ module.exports = { } }; -},{}],766:[function(require,module,exports){ +},{}],767:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128750,7 +128972,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { coerce('boxgroupgap'); }; -},{"../../lib":632,"../../registry":738,"./layout_attributes":765}],767:[function(require,module,exports){ +},{"../../lib":633,"../../registry":739,"./layout_attributes":766}],768:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -128990,7 +129212,7 @@ module.exports = function plot(gd, plotinfo, cdbox) { }); }; -},{"../../components/drawing":557,"../../lib":632,"d3":95}],768:[function(require,module,exports){ +},{"../../components/drawing":556,"../../lib":633,"d3":95}],769:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129084,7 +129306,7 @@ module.exports = function setPositions(gd, plotinfo) { } }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"../../registry":738}],769:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"../../registry":739}],770:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129123,7 +129345,7 @@ module.exports = function style(gd) { }); }; -},{"../../components/color":533,"../../components/drawing":557,"d3":95}],770:[function(require,module,exports){ +},{"../../components/color":533,"../../components/drawing":556,"d3":95}],771:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129176,7 +129398,7 @@ module.exports = { whiskerwidth: Lib.extendFlat({}, boxAttrs.whiskerwidth, { dflt: 0 }) }; -},{"../../lib":632,"../box/attributes":760,"../ohlc/attributes":821}],771:[function(require,module,exports){ +},{"../../lib":633,"../box/attributes":761,"../ohlc/attributes":823}],772:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129224,7 +129446,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.fillcolor'); } -},{"../../lib":632,"../ohlc/direction_defaults":823,"../ohlc/helpers":824,"../ohlc/ohlc_defaults":826,"./attributes":770}],772:[function(require,module,exports){ +},{"../../lib":633,"../ohlc/direction_defaults":825,"../ohlc/helpers":826,"../ohlc/ohlc_defaults":828,"./attributes":771}],773:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129254,7 +129476,7 @@ module.exports = { register(require('../box')); register(require('./transform')); -},{"../../plot_api/register":653,"../../plots/cartesian":671,"../box":764,"./attributes":770,"./defaults":771,"./transform":773}],773:[function(require,module,exports){ +},{"../../plot_api/register":654,"../../plots/cartesian":672,"../box":765,"./attributes":771,"./defaults":772,"./transform":774}],774:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129381,7 +129603,7 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { trace.y = y; }; -},{"../../lib":632,"../ohlc/helpers":824}],774:[function(require,module,exports){ +},{"../../lib":633,"../ohlc/helpers":826}],775:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129394,7 +129616,9 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { var ScatterGeoAttrs = require('../scattergeo/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var plotAttrs = require('../../plots/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; var ScatterGeoMarkerLineAttrs = ScatterGeoAttrs.marker.line; @@ -129422,14 +129646,12 @@ module.exports = extendFlat({}, { hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['location', 'z', 'text', 'name'] }), - _nestedModules: { - 'colorbar': 'Colorbar' - } }, - colorscaleAttrs + colorscaleAttrs, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":539,"../../lib/extend":625,"../../plots/attributes":660,"../scattergeo/attributes":873}],775:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/attributes":538,"../../lib/extend":626,"../../plots/attributes":662,"../scattergeo/attributes":875}],776:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129448,7 +129670,7 @@ module.exports = function calc(gd, trace) { colorscaleCalc(trace, trace.z, '', 'z'); }; -},{"../../components/colorscale/calc":540}],776:[function(require,module,exports){ +},{"../../components/colorscale/calc":539}],777:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129503,7 +129725,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hoverinfo', (layout._dataLength === 1) ? 'location+z+text' : undefined); }; -},{"../../components/colorscale/defaults":543,"../../lib":632,"./attributes":774}],777:[function(require,module,exports){ +},{"../../components/colorscale/defaults":542,"../../lib":633,"./attributes":775}],778:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129536,7 +129758,7 @@ Choropleth.meta = { module.exports = Choropleth; -},{"../../plots/geo":687,"../heatmap/colorbar":791,"./attributes":774,"./calc":775,"./defaults":776,"./plot":778}],778:[function(require,module,exports){ +},{"../../plots/geo":688,"../heatmap/colorbar":792,"./attributes":775,"./calc":776,"./defaults":777,"./plot":779}],779:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129765,7 +129987,7 @@ function makeEventDataFunc(trace) { }; } -},{"../../components/color":533,"../../components/colorscale":548,"../../components/drawing":557,"../../lib/array_to_calc_item":621,"../../lib/geo_location_utils":628,"../../lib/topojson_utils":647,"../../plots/cartesian/axes":662,"../../plots/cartesian/graph_interact":670,"../../plots/geo/constants":685,"./attributes":774,"d3":95}],779:[function(require,module,exports){ +},{"../../components/color":533,"../../components/colorscale":547,"../../components/drawing":556,"../../lib/array_to_calc_item":621,"../../lib/geo_location_utils":629,"../../lib/topojson_utils":648,"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"../../plots/geo/constants":686,"./attributes":775,"d3":95}],780:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129779,93 +130001,90 @@ function makeEventDataFunc(trace) { var heatmapAttrs = require('../heatmap/attributes'); var scatterAttrs = require('../scatter/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line; -module.exports = extendFlat({}, - { - z: heatmapAttrs.z, - x: heatmapAttrs.x, - x0: heatmapAttrs.x0, - dx: heatmapAttrs.dx, - y: heatmapAttrs.y, - y0: heatmapAttrs.y0, - dy: heatmapAttrs.dy, - text: heatmapAttrs.text, - transpose: heatmapAttrs.transpose, - xtype: heatmapAttrs.xtype, - ytype: heatmapAttrs.ytype, - - connectgaps: heatmapAttrs.connectgaps, - - autocontour: { - valType: 'boolean', - dflt: true, +module.exports = extendFlat({}, { + z: heatmapAttrs.z, + x: heatmapAttrs.x, + x0: heatmapAttrs.x0, + dx: heatmapAttrs.dx, + y: heatmapAttrs.y, + y0: heatmapAttrs.y0, + dy: heatmapAttrs.dy, + text: heatmapAttrs.text, + transpose: heatmapAttrs.transpose, + xtype: heatmapAttrs.xtype, + ytype: heatmapAttrs.ytype, + + connectgaps: heatmapAttrs.connectgaps, + + autocontour: { + valType: 'boolean', + dflt: true, + + + }, + ncontours: { + valType: 'integer', + dflt: 0, + + + }, + + contours: { + start: { + valType: 'number', + dflt: null, }, - ncontours: { - valType: 'integer', - dflt: 0, + end: { + valType: 'number', + dflt: null, }, - - contours: { - start: { - valType: 'number', - dflt: null, - - - }, - end: { - valType: 'number', - dflt: null, - - - }, - size: { - valType: 'number', - dflt: null, - - - }, - coloring: { - valType: 'enumerated', - values: ['fill', 'heatmap', 'lines', 'none'], - dflt: 'fill', - - - }, - showlines: { - valType: 'boolean', - dflt: true, - - - } + size: { + valType: 'number', + dflt: null, + + }, - - line: { - color: extendFlat({}, scatterLineAttrs.color, { - - }), - width: scatterLineAttrs.width, - dash: scatterLineAttrs.dash, - smoothing: extendFlat({}, scatterLineAttrs.smoothing, { - - }) + coloring: { + valType: 'enumerated', + values: ['fill', 'heatmap', 'lines', 'none'], + dflt: 'fill', + + }, - - _nestedModules: { - 'colorbar': 'Colorbar' + showlines: { + valType: 'boolean', + dflt: true, + + } }, + + line: { + color: extendFlat({}, scatterLineAttrs.color, { + + }), + width: scatterLineAttrs.width, + dash: scatterLineAttrs.dash, + smoothing: extendFlat({}, scatterLineAttrs.smoothing, { + + }) + } +}, colorscaleAttrs, - {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} + { autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}) }, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":539,"../../lib/extend":625,"../heatmap/attributes":789,"../scatter/attributes":844}],780:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/attributes":538,"../../lib/extend":626,"../heatmap/attributes":790,"../scatter/attributes":846}],781:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129918,7 +130137,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../plots/cartesian/axes":662,"../heatmap/calc":790}],781:[function(require,module,exports){ +},{"../../plots/cartesian/axes":664,"../heatmap/calc":791}],782:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -129979,7 +130198,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":536,"../../plots/plots":723,"./make_color_map":785}],782:[function(require,module,exports){ +},{"../../components/colorbar/draw":536,"../../plots/plots":724,"./make_color_map":786}],783:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130023,7 +130242,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":632,"../contour/style_defaults":788,"../heatmap/has_columns":794,"../heatmap/xyz_defaults":800,"./attributes":779}],783:[function(require,module,exports){ +},{"../../lib":633,"../contour/style_defaults":789,"../heatmap/has_columns":795,"../heatmap/xyz_defaults":801,"./attributes":780}],784:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130042,7 +130261,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return heatmapHoverPoints(pointData, xval, yval, hovermode, true); }; -},{"../heatmap/hover":795}],784:[function(require,module,exports){ +},{"../heatmap/hover":796}],785:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130074,7 +130293,7 @@ Contour.meta = { module.exports = Contour; -},{"../../plots/cartesian":671,"./attributes":779,"./calc":780,"./colorbar":781,"./defaults":782,"./hover":783,"./plot":786,"./style":787}],785:[function(require,module,exports){ +},{"../../plots/cartesian":672,"./attributes":780,"./calc":781,"./colorbar":782,"./defaults":783,"./hover":784,"./plot":787,"./style":788}],786:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130152,7 +130371,7 @@ module.exports = function makeColorMap(trace) { }); }; -},{"../../components/colorscale":548,"d3":95}],786:[function(require,module,exports){ +},{"../../components/colorscale":547,"d3":95}],787:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130475,7 +130694,7 @@ function makePath(pi, loc, edgeflag) { // even # of pts - average central two else { newpt = [(getpt(ptavg)[0] + getpt(ptavg + 1)[0]) / 2, - (getpt(ptavg)[1] + getpt(ptavg + 1)[1]) / 2]; + (getpt(ptavg)[1] + getpt(ptavg + 1)[1]) / 2]; } pts.splice(cnt2 + 1, cnt - cnt2 + 1, newpt); @@ -130613,12 +130832,12 @@ function getInterpPx(pi, loc, step) { if(step[1]) { var dx = (pi.level - zxy) / (pi.z[locy][locx + 1] - zxy); return [xa.c2p((1 - dx) * pi.x[locx] + dx * pi.x[locx + 1], true), - ya.c2p(pi.y[locy], true)]; + ya.c2p(pi.y[locy], true)]; } else { var dy = (pi.level - zxy) / (pi.z[locy + 1][locx] - zxy); return [xa.c2p(pi.x[locx], true), - ya.c2p((1 - dy) * pi.y[locy] + dy * pi.y[locy + 1], true)]; + ya.c2p((1 - dy) * pi.y[locy] + dy * pi.y[locy + 1], true)]; } } @@ -130862,7 +131081,7 @@ function makeClipMask(cd0) { return z; } -},{"../../components/drawing":557,"../../lib":632,"../heatmap/plot":798,"d3":95}],787:[function(require,module,exports){ +},{"../../components/drawing":556,"../../lib":633,"../heatmap/plot":799,"d3":95}],788:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130919,7 +131138,7 @@ module.exports = function style(gd) { heatmapStyle(gd); }; -},{"../../components/drawing":557,"../heatmap/style":799,"./make_color_map":785,"d3":95}],788:[function(require,module,exports){ +},{"../../components/drawing":556,"../heatmap/style":800,"./make_color_map":786,"d3":95}],789:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130955,7 +131174,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout) } }; -},{"../../components/colorscale/defaults":543}],789:[function(require,module,exports){ +},{"../../components/colorscale/defaults":542}],790:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -130968,79 +131187,77 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout) var scatterAttrs = require('../scatter/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; -module.exports = extendFlat({}, - { - z: { - valType: 'data_array', - - }, - x: scatterAttrs.x, - x0: scatterAttrs.x0, - dx: scatterAttrs.dx, - y: scatterAttrs.y, - y0: scatterAttrs.y0, - dy: scatterAttrs.dy, - text: { - valType: 'data_array', - - }, - transpose: { - valType: 'boolean', - dflt: false, - - - }, - xtype: { - valType: 'enumerated', - values: ['array', 'scaled'], - - - }, - ytype: { - valType: 'enumerated', - values: ['array', 'scaled'], - - - }, - zsmooth: { - valType: 'enumerated', - values: ['fast', 'best', false], - dflt: false, - - - }, - connectgaps: { - valType: 'boolean', - dflt: false, - - - }, - xgap: { - valType: 'number', - dflt: 0, - min: 0, - - - }, - ygap: { - valType: 'number', - dflt: 0, - min: 0, - - - }, - _nestedModules: { - 'colorbar': 'Colorbar' - } +module.exports = extendFlat({}, { + z: { + valType: 'data_array', + + }, + x: scatterAttrs.x, + x0: scatterAttrs.x0, + dx: scatterAttrs.dx, + y: scatterAttrs.y, + y0: scatterAttrs.y0, + dy: scatterAttrs.dy, + text: { + valType: 'data_array', + + }, + transpose: { + valType: 'boolean', + dflt: false, + + + }, + xtype: { + valType: 'enumerated', + values: ['array', 'scaled'], + + + }, + ytype: { + valType: 'enumerated', + values: ['array', 'scaled'], + + + }, + zsmooth: { + valType: 'enumerated', + values: ['fast', 'best', false], + dflt: false, + + }, + connectgaps: { + valType: 'boolean', + dflt: false, + + + }, + xgap: { + valType: 'number', + dflt: 0, + min: 0, + + + }, + ygap: { + valType: 'number', + dflt: 0, + min: 0, + + + }, +}, colorscaleAttrs, - {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} + { autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}) }, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":539,"../../lib/extend":625,"../scatter/attributes":844}],790:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/attributes":538,"../../lib/extend":626,"../scatter/attributes":846}],791:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131151,9 +131368,9 @@ module.exports = function calc(gd, trace) { // create arrays of brick boundaries, to be used by autorange and heatmap.plot var xlen = maxRowLength(z), - xIn = trace.xtype === 'scaled' ? '' : trace.x, + xIn = trace.xtype === 'scaled' ? '' : x, xArray = makeBoundArray(trace, xIn, x0, dx, xlen, xa), - yIn = trace.ytype === 'scaled' ? '' : trace.y, + yIn = trace.ytype === 'scaled' ? '' : y, yArray = makeBoundArray(trace, yIn, y0, dy, z.length, ya); // handled in gl2d convert step @@ -131223,7 +131440,6 @@ function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) { var isArrayOfTwoItemsOrMore = Array.isArray(arrayIn) && arrayIn.length > 1; if(isArrayOfTwoItemsOrMore && !isHist && (ax.type !== 'category')) { - arrayIn = arrayIn.map(ax.d2c); var len = arrayIn.length; // given vals are brick centers @@ -131266,7 +131482,7 @@ function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) { else { dv = dvIn || 1; - if(isHist || ax.type === 'category') v0 = v0In || 0; + if(isHist || ax.type === 'category') v0 = ax.r2c(v0In) || 0; else if(Array.isArray(arrayIn) && arrayIn.length === 1) v0 = arrayIn[0]; else if(v0In === undefined) v0 = 0; else v0 = ax.d2c(v0In); @@ -131490,7 +131706,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../components/colorscale/calc":540,"../../lib":632,"../../plots/cartesian/axes":662,"../../registry":738,"../histogram2d/calc":810,"./convert_column_xyz":792,"./has_columns":794,"./max_row_length":797,"fast-isnumeric":104}],791:[function(require,module,exports){ +},{"../../components/colorscale/calc":539,"../../lib":633,"../../plots/cartesian/axes":664,"../../registry":739,"../histogram2d/calc":812,"./convert_column_xyz":793,"./has_columns":795,"./max_row_length":798,"fast-isnumeric":104}],792:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131541,7 +131757,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":536,"../../components/colorscale":548,"../../lib":632,"../../plots/plots":723,"fast-isnumeric":104}],792:[function(require,module,exports){ +},{"../../components/colorbar/draw":536,"../../components/colorscale":547,"../../lib":633,"../../plots/plots":724,"fast-isnumeric":104}],793:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131598,7 +131814,7 @@ module.exports = function convertColumnXYZ(trace, xa, ya) { if(hasColumnText) trace.text = text; }; -},{"../../lib":632}],793:[function(require,module,exports){ +},{"../../lib":633}],794:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131643,7 +131859,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":543,"../../lib":632,"./attributes":789,"./has_columns":794,"./xyz_defaults":800}],794:[function(require,module,exports){ +},{"../../components/colorscale/defaults":542,"../../lib":633,"./attributes":790,"./has_columns":795,"./xyz_defaults":801}],795:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131659,7 +131875,7 @@ module.exports = function(trace) { return !Array.isArray(trace.z[0]); }; -},{}],795:[function(require,module,exports){ +},{}],796:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131777,7 +131993,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, contour) })]; }; -},{"../../lib":632,"../../plots/cartesian/constants":668,"../../plots/cartesian/graph_interact":670}],796:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/constants":669,"../../plots/cartesian/graph_interact":671}],797:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131809,7 +132025,7 @@ Heatmap.meta = { module.exports = Heatmap; -},{"../../plots/cartesian":671,"./attributes":789,"./calc":790,"./colorbar":791,"./defaults":793,"./hover":795,"./plot":798,"./style":799}],797:[function(require,module,exports){ +},{"../../plots/cartesian":672,"./attributes":790,"./calc":791,"./colorbar":792,"./defaults":794,"./hover":796,"./plot":799,"./style":800}],798:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -131831,7 +132047,7 @@ module.exports = function maxRowLength(z) { return len; }; -},{}],798:[function(require,module,exports){ +},{}],799:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132281,7 +132497,7 @@ function plotOne(gd, plotinfo, cd) { image3.exit().remove(); } -},{"../../components/colorscale":548,"../../constants/xmlns_namespaces":618,"../../lib":632,"../../registry":738,"./max_row_length":797,"tinycolor2":489}],799:[function(require,module,exports){ +},{"../../components/colorscale":547,"../../constants/xmlns_namespaces":618,"../../lib":633,"../../registry":739,"./max_row_length":798,"tinycolor2":489}],800:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132302,7 +132518,7 @@ module.exports = function style(gd) { }); }; -},{"d3":95}],800:[function(require,module,exports){ +},{"d3":95}],801:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132391,7 +132607,7 @@ function isValidZ(z) { return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"./has_columns":794,"fast-isnumeric":104}],801:[function(require,module,exports){ +},{"./has_columns":795,"fast-isnumeric":104}],802:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132435,7 +132651,7 @@ module.exports = { autobinx: { valType: 'boolean', - dflt: true, + dflt: null, }, @@ -132450,7 +132666,7 @@ module.exports = { autobiny: { valType: 'boolean', - dflt: true, + dflt: null, }, @@ -132465,11 +132681,8 @@ module.exports = { marker: barAttrs.marker, - _nestedModules: { - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - }, + error_y: barAttrs.error_y, + error_x: barAttrs.error_x, _deprecated: { bardir: barAttrs._deprecated.bardir @@ -132479,27 +132692,27 @@ module.exports = { function makeBinsAttr(axLetter) { return { start: { - valType: 'number', + valType: 'any', // for date axes dflt: null, }, end: { - valType: 'number', + valType: 'any', // for date axes dflt: null, }, size: { valType: 'any', // for date axes - dflt: 1, + dflt: null, } }; } -},{"../bar/attributes":748}],802:[function(require,module,exports){ +},{"../bar/attributes":749}],803:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132525,7 +132738,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],803:[function(require,module,exports){ +},{}],804:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132542,20 +132755,23 @@ module.exports = function handleBinDefaults(traceIn, traceOut, coerce, binDirect coerce('histnorm'); binDirections.forEach(function(binDirection) { - // data being binned - note that even though it's a little weird, - // it's possible to have bins without data, if there's inferred data - var binstrt = coerce(binDirection + 'bins.start'), - binend = coerce(binDirection + 'bins.end'), - autobin = coerce('autobin' + binDirection, !(binstrt && binend)); - - if(autobin) coerce('nbins' + binDirection); - else coerce(binDirection + 'bins.size'); + /* + * Because date axes have string values for start and end, + * and string options for size, we cannot validate these attributes + * now. We will do this during calc (immediately prior to binning) + * in ./clean_bins, and push the cleaned values back to _fullData. + */ + coerce(binDirection + 'bins.start'); + coerce(binDirection + 'bins.end'); + coerce(binDirection + 'bins.size'); + coerce('autobin' + binDirection); + coerce('nbins' + binDirection); }); return traceOut; }; -},{}],804:[function(require,module,exports){ +},{}],805:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132629,7 +132845,7 @@ module.exports = { } }; -},{"fast-isnumeric":104}],805:[function(require,module,exports){ +},{"fast-isnumeric":104}],806:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132649,6 +132865,7 @@ var Axes = require('../../plots/cartesian/axes'); var binFunctions = require('./bin_functions'); var normFunctions = require('./norm_functions'); var doAvg = require('./average'); +var cleanBins = require('./clean_bins'); module.exports = function calc(gd, trace) { @@ -132665,6 +132882,8 @@ module.exports = function calc(gd, trace) { maindata = trace.orientation === 'h' ? 'y' : 'x', counterdata = {x: 'y', y: 'x'}[maindata]; + cleanBins(trace, pa, maindata); + // prepare the raw data var pos0 = pa.makeCalcdata(trace, maindata); // calculate the bins @@ -132703,10 +132922,11 @@ module.exports = function calc(gd, trace) { // create the bins (and any extra arrays needed) // assume more than 5000 bins is an error, so we don't crash the browser - i = binspec.start; + i = pa.r2c(binspec.start); + // decrease end a little in case of rounding errors - binend = binspec.end + - (binspec.start - Axes.tickIncrement(binspec.start, binspec.size)) / 1e6; + binend = pa.r2c(binspec.end) + (i - Axes.tickIncrement(i, binspec.size)) / 1e6; + while(i < binend && pos.length < 5000) { i2 = Axes.tickIncrement(i, binspec.size); pos.push((i + i2) / 2); @@ -132759,7 +132979,82 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"./average":802,"./bin_functions":804,"./norm_functions":808,"fast-isnumeric":104}],806:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"./average":803,"./bin_functions":805,"./clean_bins":807,"./norm_functions":810,"fast-isnumeric":104}],807:[function(require,module,exports){ +/** +* Copyright 2012-2016, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; +var isNumeric = require('fast-isnumeric'); +var cleanDate = require('../../lib').cleanDate; +var ONEDAY = require('../../constants/numerical').ONEDAY; + +/* + * cleanBins: validate attributes autobin[xy] and [xy]bins.(start, end, size) + * Mutates trace so all these attributes are valid. + * + * Normally this kind of thing would happen during supplyDefaults, but + * in this case we need to know the axis type, and axis type isn't set until + * after trace supplyDefaults are completed. So this gets called during the + * calc step, when data are inserted into bins. + */ +module.exports = function cleanBins(trace, ax, binDirection) { + var axType = ax.type, + binAttr = binDirection + 'bins', + bins = trace[binAttr]; + + if(!bins) bins = trace[binAttr] = {}; + + var cleanBound = (axType === 'date') ? + function(v) { return (v || v === 0) ? cleanDate(v) : null; } : + function(v) { return isNumeric(v) ? Number(v) : null; }; + + bins.start = cleanBound(bins.start); + bins.end = cleanBound(bins.end); + + // logic for bin size is very similar to dtick (cartesian/tick_value_defaults) + // but without the extra string options for log axes + // ie the only strings we accept are M for months + var sizeDflt = (axType === 'date') ? ONEDAY : 1, + binSize = bins.size; + + if(isNumeric(binSize)) { + bins.size = (binSize > 0) ? Number(binSize) : sizeDflt; + } + else if(typeof binSize !== 'string') { + bins.size = sizeDflt; + } + else { + // date special case: "M" gives bins every (integer) n months + var prefix = binSize.charAt(0), + sizeNum = binSize.substr(1); + + sizeNum = isNumeric(sizeNum) ? Number(sizeNum) : 0; + if((sizeNum <= 0) || !( + axType === 'date' && prefix === 'M' && sizeNum === Math.round(sizeNum) + )) { + bins.size = sizeDflt; + } + } + + var autoBinAttr = 'autobin' + binDirection; + + if(typeof trace[autoBinAttr] !== 'boolean') { + trace[autoBinAttr] = !( + (bins.start || bins.start === 0) && + (bins.end || bins.end === 0) + ); + } + + if(!trace[autoBinAttr]) delete trace['nbins' + binDirection]; +}; + +},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],808:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132811,7 +133106,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":533,"../../components/errorbars/defaults":562,"../../lib":632,"../bar/style_defaults":759,"./attributes":801,"./bin_defaults":803}],807:[function(require,module,exports){ +},{"../../components/color":533,"../../components/errorbars/defaults":561,"../../lib":633,"../bar/style_defaults":760,"./attributes":802,"./bin_defaults":804}],809:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132860,7 +133155,7 @@ Histogram.meta = { module.exports = Histogram; -},{"../../plots/cartesian":671,"../bar/hover":751,"../bar/layout_attributes":753,"../bar/layout_defaults":754,"../bar/plot":755,"../bar/set_positions":756,"../bar/style":758,"../scatter/colorbar":847,"./attributes":801,"./calc":805,"./defaults":806}],808:[function(require,module,exports){ +},{"../../plots/cartesian":672,"../bar/hover":752,"../bar/layout_attributes":754,"../bar/layout_defaults":755,"../bar/plot":756,"../bar/set_positions":757,"../bar/style":759,"../scatter/colorbar":849,"./attributes":802,"./calc":806,"./defaults":808}],810:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132895,7 +133190,7 @@ module.exports = { } }; -},{}],809:[function(require,module,exports){ +},{}],811:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132909,6 +133204,7 @@ module.exports = { var histogramAttrs = require('../histogram/attributes'); var heatmapAttrs = require('../heatmap/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; @@ -132939,17 +133235,14 @@ module.exports = extendFlat({}, xgap: heatmapAttrs.xgap, ygap: heatmapAttrs.ygap, - zsmooth: heatmapAttrs.zsmooth, - - _nestedModules: { - 'colorbar': 'Colorbar' - } + zsmooth: heatmapAttrs.zsmooth }, colorscaleAttrs, - {autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})} + { autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}) }, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":539,"../../lib/extend":625,"../heatmap/attributes":789,"../histogram/attributes":801}],810:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/attributes":538,"../../lib/extend":626,"../heatmap/attributes":790,"../histogram/attributes":802}],812:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -132967,6 +133260,7 @@ var Axes = require('../../plots/cartesian/axes'); var binFunctions = require('../histogram/bin_functions'); var normFunctions = require('../histogram/norm_functions'); var doAvg = require('../histogram/average'); +var cleanBins = require('../histogram/clean_bins'); module.exports = function calc(gd, trace) { @@ -132981,6 +133275,9 @@ module.exports = function calc(gd, trace) { z, i; + cleanBins(trace, xa, 'x'); + cleanBins(trace, ya, 'y'); + var serieslen = Math.min(x.length, y.length); if(x.length > serieslen) x.splice(serieslen, x.length - serieslen); if(y.length > serieslen) y.splice(serieslen, y.length - serieslen); @@ -132990,8 +133287,10 @@ module.exports = function calc(gd, trace) { if(trace.autobinx || !('xbins' in trace)) { trace.xbins = Axes.autoBin(x, xa, trace.nbinsx, '2d'); if(trace.type === 'histogram2dcontour') { - trace.xbins.start -= trace.xbins.size; - trace.xbins.end += trace.xbins.size; + // the "true" last argument reverses the tick direction (which we can't + // just do with a minus sign because of month bins) + trace.xbins.start = xa.c2r(Axes.tickIncrement(xa.r2c(trace.xbins.start), trace.xbins.size, true)); + trace.xbins.end = xa.c2r(Axes.tickIncrement(xa.r2c(trace.xbins.end), trace.xbins.size)); } // copy bin info back to the source data. @@ -133000,8 +133299,8 @@ module.exports = function calc(gd, trace) { if(trace.autobiny || !('ybins' in trace)) { trace.ybins = Axes.autoBin(y, ya, trace.nbinsy, '2d'); if(trace.type === 'histogram2dcontour') { - trace.ybins.start -= trace.ybins.size; - trace.ybins.end += trace.ybins.size; + trace.ybins.start = ya.c2r(Axes.tickIncrement(ya.r2c(trace.ybins.start), trace.ybins.size, true)); + trace.ybins.end = ya.c2r(Axes.tickIncrement(ya.r2c(trace.ybins.end), trace.ybins.size)); } trace._input.ybins = trace.ybins; } @@ -133043,11 +133342,11 @@ module.exports = function calc(gd, trace) { // decrease end a little in case of rounding errors var binspec = trace.xbins, - binend = binspec.end + - (binspec.start - Axes.tickIncrement(binspec.start, binspec.size)) / 1e6; + binStart = xa.r2c(binspec.start), + binEnd = xa.r2c(binspec.end) + + (binStart - Axes.tickIncrement(binStart, binspec.size)) / 1e6; - for(i = binspec.start; i < binend; - i = Axes.tickIncrement(i, binspec.size)) { + for(i = binStart; i < binEnd; i = Axes.tickIncrement(i, binspec.size)) { onecol.push(sizeinit); if(Array.isArray(xbins)) xbins.push(i); if(doavg) zerocol.push(0); @@ -133056,15 +133355,16 @@ module.exports = function calc(gd, trace) { var nx = onecol.length; x0 = trace.xbins.start; - dx = (i - x0) / nx; - x0 += dx / 2; + var x0c = xa.r2c(x0); + dx = (i - x0c) / nx; + x0 = xa.c2r(x0c + dx / 2); binspec = trace.ybins; - binend = binspec.end + - (binspec.start - Axes.tickIncrement(binspec.start, binspec.size)) / 1e6; + binStart = ya.r2c(binspec.start); + binEnd = ya.r2c(binspec.end) + + (binStart - Axes.tickIncrement(binStart, binspec.size)) / 1e6; - for(i = binspec.start; i < binend; - i = Axes.tickIncrement(i, binspec.size)) { + for(i = binStart; i < binEnd; i = Axes.tickIncrement(i, binspec.size)) { z.push(onecol.concat()); if(Array.isArray(ybins)) ybins.push(i); if(doavg) counts.push(zerocol.concat()); @@ -133073,8 +133373,9 @@ module.exports = function calc(gd, trace) { var ny = z.length; y0 = trace.ybins.start; - dy = (i - y0) / ny; - y0 += dy / 2; + var y0c = ya.r2c(y0); + dy = (i - y0c) / ny; + y0 = ya.c2r(y0c + dy / 2); if(densitynorm) { xinc = onecol.map(function(v, i) { @@ -133115,7 +133416,7 @@ module.exports = function calc(gd, trace) { }; }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"../histogram/average":802,"../histogram/bin_functions":804,"../histogram/norm_functions":808}],811:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"../histogram/average":803,"../histogram/bin_functions":805,"../histogram/clean_bins":807,"../histogram/norm_functions":810}],813:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133153,7 +133454,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, layout) { ); }; -},{"../../components/colorscale/defaults":543,"../../lib":632,"./attributes":809,"./sample_defaults":813}],812:[function(require,module,exports){ +},{"../../components/colorscale/defaults":542,"../../lib":633,"./attributes":811,"./sample_defaults":815}],814:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133186,7 +133487,7 @@ Histogram2D.meta = { module.exports = Histogram2D; -},{"../../plots/cartesian":671,"../heatmap/calc":790,"../heatmap/colorbar":791,"../heatmap/hover":795,"../heatmap/plot":798,"../heatmap/style":799,"./attributes":809,"./defaults":811}],813:[function(require,module,exports){ +},{"../../plots/cartesian":672,"../heatmap/calc":791,"../heatmap/colorbar":792,"../heatmap/hover":796,"../heatmap/plot":799,"../heatmap/style":800,"./attributes":811,"./defaults":813}],815:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133222,7 +133523,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce) { handleBinDefaults(traceIn, traceOut, coerce, binDirections); }; -},{"../histogram/bin_defaults":803}],814:[function(require,module,exports){ +},{"../histogram/bin_defaults":804}],816:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133236,6 +133537,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce) { var histogram2dAttrs = require('../histogram2d/attributes'); var contourAttrs = require('../contour/attributes'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; @@ -133257,16 +133559,13 @@ module.exports = extendFlat({}, { autocontour: contourAttrs.autocontour, ncontours: contourAttrs.ncontours, contours: contourAttrs.contours, - line: contourAttrs.line, - - _nestedModules: { - 'colorbar': 'Colorbar' - } + line: contourAttrs.line }, - colorscaleAttrs + colorscaleAttrs, + { colorbar: colorbarAttrs } ); -},{"../../components/colorscale/attributes":539,"../../lib/extend":625,"../contour/attributes":779,"../histogram2d/attributes":809}],815:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/attributes":538,"../../lib/extend":626,"../contour/attributes":780,"../histogram2d/attributes":811}],817:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133302,7 +133601,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":632,"../contour/style_defaults":788,"../histogram2d/sample_defaults":813,"./attributes":814}],816:[function(require,module,exports){ +},{"../../lib":633,"../contour/style_defaults":789,"../histogram2d/sample_defaults":815,"./attributes":816}],818:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133335,7 +133634,7 @@ Histogram2dContour.meta = { module.exports = Histogram2dContour; -},{"../../plots/cartesian":671,"../contour/calc":780,"../contour/colorbar":781,"../contour/hover":783,"../contour/plot":786,"../contour/style":787,"./attributes":814,"./defaults":815}],817:[function(require,module,exports){ +},{"../../plots/cartesian":672,"../contour/calc":781,"../contour/colorbar":782,"../contour/hover":784,"../contour/plot":787,"../contour/style":788,"./attributes":816,"./defaults":817}],819:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133347,7 +133646,9 @@ module.exports = Histogram2dContour; 'use strict'; var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var surfaceAtts = require('../surface/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; @@ -133439,6 +133740,7 @@ module.exports = { colorscale: colorscaleAttrs.colorscale, reversescale: colorscaleAttrs.reversescale, showscale: colorscaleAttrs.showscale, + colorbar: colorbarAttrs, lightposition: { 'x': extendFlat({}, surfaceAtts.lightposition.x, {dflt: 1e5}), @@ -133462,14 +133764,10 @@ module.exports = { dflt: 1e-6, // even the brain model doesn't appear to need finer than this } - }, surfaceAtts.lighting), - - _nestedModules: { // nested module coupling - 'colorbar': 'Colorbar' - } + }, surfaceAtts.lighting) }; -},{"../../components/colorscale/attributes":539,"../../lib/extend":625,"../surface/attributes":900}],818:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/attributes":538,"../../lib/extend":626,"../surface/attributes":902}],820:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133631,7 +133929,7 @@ function createMesh3DTrace(scene, data) { module.exports = createMesh3DTrace; -},{"../../lib/str2rgbarray":645,"alpha-shape":32,"convex-hull":84,"delaunay-triangulate":96,"gl-mesh3d":173,"tinycolor2":489}],819:[function(require,module,exports){ +},{"../../lib/str2rgbarray":646,"alpha-shape":32,"convex-hull":84,"delaunay-triangulate":96,"gl-mesh3d":173,"tinycolor2":489}],821:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133728,7 +134026,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/colorbar/defaults":535,"../../lib":632,"./attributes":817}],820:[function(require,module,exports){ +},{"../../components/colorbar/defaults":535,"../../lib":633,"./attributes":819}],822:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133757,7 +134055,7 @@ Mesh3D.meta = { module.exports = Mesh3D; -},{"../../plots/gl3d":702,"../heatmap/colorbar":791,"./attributes":817,"./convert":818,"./defaults":819}],821:[function(require,module,exports){ +},{"../../plots/gl3d":703,"../heatmap/colorbar":792,"./attributes":819,"./convert":820,"./defaults":821}],823:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133864,7 +134162,7 @@ module.exports = { } }; -},{"../../lib":632,"../scatter/attributes":844}],822:[function(require,module,exports){ +},{"../../lib":633,"../scatter/attributes":846}],824:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133913,7 +134211,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.line.dash', traceOut.line.dash); } -},{"../../lib":632,"./attributes":821,"./direction_defaults":823,"./helpers":824,"./ohlc_defaults":826}],823:[function(require,module,exports){ +},{"../../lib":633,"./attributes":823,"./direction_defaults":825,"./helpers":826,"./ohlc_defaults":828}],825:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -133939,7 +134237,7 @@ module.exports = function handleDirectionDefaults(traceIn, traceOut, coerce, dir coerce(direction + '.name', nameDflt); }; -},{}],824:[function(require,module,exports){ +},{}],826:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134051,7 +134349,7 @@ exports.addRangeSlider = function(layout) { if(!layout.xaxis.rangeslider) layout.xaxis.rangeslider = {}; }; -},{"../../lib":632}],825:[function(require,module,exports){ +},{"../../lib":633}],827:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134081,7 +134379,7 @@ module.exports = { register(require('../scatter')); register(require('./transform')); -},{"../../plot_api/register":653,"../../plots/cartesian":671,"../scatter":854,"./attributes":821,"./defaults":822,"./transform":827}],826:[function(require,module,exports){ +},{"../../plot_api/register":654,"../../plots/cartesian":672,"../scatter":856,"./attributes":823,"./defaults":824,"./transform":829}],828:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134117,7 +134415,7 @@ module.exports = function handleOHLC(traceIn, traceOut, coerce) { return len; }; -},{}],827:[function(require,module,exports){ +},{}],829:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134254,18 +134552,28 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { y = [], textOut = []; - var getXItem = trace._fullInput.x ? - function(i) { return xa.d2c(trace.x[i]); } : - function(i) { return i; }; - - var getTextItem = Array.isArray(textIn) ? - function(i) { return textIn[i] || ''; } : - function() { return textIn; }; - - var appendX = function(i) { - var v = getXItem(i); - x.push(v - tickWidth, v, v, v, v, v + tickWidth, null); - }; + var appendX; + if(trace._fullInput.x) { + appendX = function(i) { + var xi = trace.x[i], + xcalc = xa.d2c(xi); + + x.push( + xa.c2d(xcalc - tickWidth), + xi, xi, xi, xi, + xa.c2d(xcalc + tickWidth), + null); + }; + } + else { + appendX = function(i) { + x.push( + i - tickWidth, + i, i, i, i, + i + tickWidth, + null); + }; + } var appendY = function(o, h, l, c) { y.push(o, o, h, l, c, c, null); @@ -134281,6 +134589,10 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { hasY = hasAll || hoverParts.indexOf('y') !== -1, hasText = hasAll || hoverParts.indexOf('text') !== -1; + var getTextItem = Array.isArray(textIn) ? + function(i) { return textIn[i] || ''; } : + function() { return textIn; }; + var appendText = function(i, o, h, l, c) { var t = []; @@ -134359,7 +134671,7 @@ function convertTickWidth(gd, xa, trace) { return minDiff * tickWidth; } -},{"../../lib":632,"../../plots/cartesian/axes":662,"../../plots/cartesian/axis_ids":665,"./helpers":824}],828:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"../../plots/cartesian/axis_ids":667,"./helpers":826}],830:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134579,7 +134891,7 @@ module.exports = { } }; -},{"../../components/color/attributes":532,"../../lib/extend":625,"../../plots/attributes":660,"../../plots/font_attributes":683}],829:[function(require,module,exports){ +},{"../../components/color/attributes":532,"../../lib/extend":626,"../../plots/attributes":662,"../../plots/font_attributes":684}],831:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134626,7 +134938,7 @@ function getCdModule(calcdata, _module) { return cdModule; } -},{"../../registry":738}],830:[function(require,module,exports){ +},{"../../registry":739}],832:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134778,7 +135090,7 @@ function nextDefaultColor(index) { return pieDefaultColors[index % pieDefaultColors.length]; } -},{"../../components/color":533,"./helpers":832,"fast-isnumeric":104,"tinycolor2":489}],831:[function(require,module,exports){ +},{"../../components/color":533,"./helpers":834,"fast-isnumeric":104,"tinycolor2":489}],833:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134862,7 +135174,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pull'); }; -},{"../../lib":632,"./attributes":828}],832:[function(require,module,exports){ +},{"../../lib":633,"./attributes":830}],834:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134891,7 +135203,7 @@ exports.formatPieValue = function formatPieValue(v, separators) { return Lib.numSeparate(vRounded, separators); }; -},{"../../lib":632}],833:[function(require,module,exports){ +},{"../../lib":633}],835:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134923,7 +135235,7 @@ Pie.meta = { module.exports = Pie; -},{"./attributes":828,"./base_plot":829,"./calc":830,"./defaults":831,"./layout_attributes":834,"./layout_defaults":835,"./plot":836,"./style":837,"./style_one":838}],834:[function(require,module,exports){ +},{"./attributes":830,"./base_plot":831,"./calc":832,"./defaults":833,"./layout_attributes":836,"./layout_defaults":837,"./plot":838,"./style":839,"./style_one":840}],836:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134943,7 +135255,7 @@ module.exports = { hiddenlabels: {valType: 'data_array'} }; -},{}],835:[function(require,module,exports){ +},{}],837:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -134965,7 +135277,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('hiddenlabels'); }; -},{"../../lib":632,"./layout_attributes":834}],836:[function(require,module,exports){ +},{"../../lib":633,"./layout_attributes":836}],838:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -135660,7 +135972,7 @@ function maxExtent(tilt, tiltAxisFraction, depth) { 2 * Math.sqrt(1 - sinTilt * sinTilt * tiltAxisFraction * tiltAxisFraction)); } -},{"../../components/color":533,"../../components/drawing":557,"../../lib/svg_text_utils":646,"../../plots/cartesian/graph_interact":670,"./helpers":832,"d3":95}],837:[function(require,module,exports){ +},{"../../components/color":533,"../../components/drawing":556,"../../lib/svg_text_utils":647,"../../plots/cartesian/graph_interact":671,"./helpers":834,"d3":95}],839:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -135689,7 +136001,7 @@ module.exports = function style(gd) { }); }; -},{"./style_one":838,"d3":95}],838:[function(require,module,exports){ +},{"./style_one":840,"d3":95}],840:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -135716,7 +136028,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":533}],839:[function(require,module,exports){ +},{"../../components/color":533}],841:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -135805,7 +136117,7 @@ module.exports = { } }; -},{"../scattergl/attributes":880}],840:[function(require,module,exports){ +},{"../scattergl/attributes":882}],842:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136037,7 +136349,7 @@ function createPointcloud(scene, data) { module.exports = createPointcloud; -},{"../../lib/str2rgbarray":645,"../scatter/get_trace_color":852,"gl-pointcloud2d":198}],841:[function(require,module,exports){ +},{"../../lib/str2rgbarray":646,"../scatter/get_trace_color":854,"gl-pointcloud2d":198}],843:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136082,7 +136394,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { coerce('marker.border.arearatio'); }; -},{"../../lib":632,"./attributes":839}],842:[function(require,module,exports){ +},{"../../lib":633,"./attributes":841}],844:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136112,7 +136424,7 @@ pointcloud.meta = { module.exports = pointcloud; -},{"../../plots/gl2d":699,"../scatter3d/calc":868,"./attributes":839,"./convert":840,"./defaults":841}],843:[function(require,module,exports){ +},{"../../plots/gl2d":700,"../scatter3d/calc":870,"./attributes":841,"./convert":842,"./defaults":843}],845:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136150,7 +136462,7 @@ module.exports = function arraysToCalcdata(cd) { } }; -},{"../../lib":632}],844:[function(require,module,exports){ +},{"../../lib":633}],846:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136162,11 +136474,11 @@ module.exports = function arraysToCalcdata(cd) { 'use strict'; var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var Drawing = require('../../components/drawing'); - var constants = require('./constants'); - var extendFlat = require('../../lib/extend').extendFlat; module.exports = { @@ -136342,12 +136654,15 @@ module.exports = { }, + showscale: { valType: 'boolean', dflt: false, }, + colorbar: colorbarAttrs, + line: extendFlat({}, { width: { valType: 'number', @@ -136395,6 +136710,7 @@ module.exports = { }, }, + r: { valType: 'data_array', @@ -136403,14 +136719,12 @@ module.exports = { valType: 'data_array', }, - _nestedModules: { // nested module coupling - 'error_y': 'ErrorBars', - 'error_x': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_y: errorBarAttrs, + error_x: errorBarAttrs }; -},{"../../components/colorscale/color_attributes":541,"../../components/drawing":557,"../../lib/extend":625,"./constants":849}],845:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/color_attributes":540,"../../components/drawing":556,"../../components/errorbars/attributes":558,"../../lib/extend":626,"./constants":851}],847:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136541,7 +136855,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"./colorscale_calc":848,"./subtypes":864,"fast-isnumeric":104}],846:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"./colorscale_calc":850,"./subtypes":866,"fast-isnumeric":104}],848:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136580,7 +136894,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],847:[function(require,module,exports){ +},{}],849:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136637,7 +136951,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":536,"../../components/colorscale":548,"../../lib":632,"../../plots/plots":723,"fast-isnumeric":104}],848:[function(require,module,exports){ +},{"../../components/colorbar/draw":536,"../../components/colorscale":547,"../../lib":633,"../../plots/plots":724,"fast-isnumeric":104}],850:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136670,7 +136984,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":540,"../../components/colorscale/has_colorscale":547,"./subtypes":864}],849:[function(require,module,exports){ +},{"../../components/colorscale/calc":539,"../../components/colorscale/has_colorscale":546,"./subtypes":866}],851:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136686,7 +137000,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],850:[function(require,module,exports){ +},{}],852:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136766,7 +137080,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":562,"../../lib":632,"./attributes":844,"./constants":849,"./fillcolor_defaults":851,"./line_defaults":855,"./line_shape_defaults":857,"./marker_defaults":860,"./subtypes":864,"./text_defaults":865,"./xy_defaults":866}],851:[function(require,module,exports){ +},{"../../components/errorbars/defaults":561,"../../lib":633,"./attributes":846,"./constants":851,"./fillcolor_defaults":853,"./line_defaults":857,"./line_shape_defaults":859,"./marker_defaults":862,"./subtypes":866,"./text_defaults":867,"./xy_defaults":868}],853:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136804,7 +137118,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":533}],852:[function(require,module,exports){ +},{"../../components/color":533}],854:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -136857,7 +137171,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":533,"./subtypes":864}],853:[function(require,module,exports){ +},{"../../components/color":533,"./subtypes":866}],855:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137026,7 +137340,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":533,"../../components/errorbars":563,"../../lib":632,"../../plots/cartesian/constants":668,"../../plots/cartesian/graph_interact":670,"./get_trace_color":852}],854:[function(require,module,exports){ +},{"../../components/color":533,"../../components/errorbars":562,"../../lib":633,"../../plots/cartesian/constants":669,"../../plots/cartesian/graph_interact":671,"./get_trace_color":854}],856:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137070,7 +137384,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":671,"./arrays_to_calcdata":843,"./attributes":844,"./calc":845,"./clean_data":846,"./colorbar":847,"./defaults":850,"./hover":853,"./plot":861,"./select":862,"./style":863,"./subtypes":864}],855:[function(require,module,exports){ +},{"../../plots/cartesian":672,"./arrays_to_calcdata":845,"./attributes":846,"./calc":847,"./clean_data":848,"./colorbar":849,"./defaults":852,"./hover":855,"./plot":863,"./select":864,"./style":865,"./subtypes":866}],857:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137103,7 +137417,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce('line.dash'); }; -},{"../../components/colorscale/defaults":543,"../../components/colorscale/has_colorscale":547}],856:[function(require,module,exports){ +},{"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546}],858:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137115,7 +137429,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, 'use strict'; -var Axes = require('../../plots/cartesian/axes'); +var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function linePoints(d, opts) { @@ -137126,7 +137440,6 @@ module.exports = function linePoints(d, opts) { baseTolerance = opts.baseTolerance, linear = opts.linear, segments = [], - badnum = Axes.BADNUM, minTolerance = 0.2, // fraction of tolerance "so close we don't even consider it a new point" pts = new Array(d.length), pti = 0, @@ -137163,7 +137476,7 @@ module.exports = function linePoints(d, opts) { function getPt(index) { var x = xa.c2p(d[index].x), y = ya.c2p(d[index].y); - if(x === badnum || y === badnum) return false; + if(x === BADNUM || y === BADNUM) return false; return [x, y]; } @@ -137277,7 +137590,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../plots/cartesian/axes":662}],857:[function(require,module,exports){ +},{"../../constants/numerical":616}],859:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137296,7 +137609,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],858:[function(require,module,exports){ +},{}],860:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137337,7 +137650,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],859:[function(require,module,exports){ +},{}],861:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137379,7 +137692,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":104}],860:[function(require,module,exports){ +},{"fast-isnumeric":104}],862:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137439,7 +137752,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":533,"../../components/colorscale/defaults":543,"../../components/colorscale/has_colorscale":547,"./subtypes":864}],861:[function(require,module,exports){ +},{"../../components/color":533,"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546,"./subtypes":866}],863:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -137611,6 +137924,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.visible !== true) return; + transition(tr).style('opacity', trace.opacity); + // BUILD LINES AND FILLS var ownFillEl3, tonext; var ownFillDir = trace.fill.charAt(trace.fill.length - 1); @@ -137936,8 +138251,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { var xa = plotinfo.xaxis, ya = plotinfo.yaxis, - xr = d3.extent(xa.range.map(xa.l2c)), - yr = d3.extent(ya.range.map(ya.l2c)); + xr = d3.extent(xa.range.map(xa.r2l).map(xa.l2c)), + yr = d3.extent(ya.range.map(ya.r2l).map(ya.l2c)); var trace = cdscatter[0].trace; if(!subTypes.hasMarkers(trace)) return; @@ -137975,7 +138290,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":557,"../../components/errorbars":563,"../../lib":632,"../../lib/polygon":639,"./arrays_to_calcdata":843,"./line_points":856,"./link_traces":858,"./subtypes":864,"d3":95}],862:[function(require,module,exports){ +},{"../../components/drawing":556,"../../components/errorbars":562,"../../lib":633,"../../lib/polygon":640,"./arrays_to_calcdata":845,"./line_points":858,"./link_traces":860,"./subtypes":866,"d3":95}],864:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138047,7 +138362,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":864}],863:[function(require,module,exports){ +},{"./subtypes":866}],865:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138089,7 +138404,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":557,"../../components/errorbars":563,"d3":95}],864:[function(require,module,exports){ +},{"../../components/drawing":556,"../../components/errorbars":562,"d3":95}],866:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138125,7 +138440,7 @@ module.exports = { } }; -},{"../../lib":632}],865:[function(require,module,exports){ +},{"../../lib":633}],867:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138146,7 +138461,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":632}],866:[function(require,module,exports){ +},{"../../lib":633}],868:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138191,7 +138506,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { return len; }; -},{}],867:[function(require,module,exports){ +},{}],869:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138204,6 +138519,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { var scatterAttrs = require('../scatter/attributes'); var colorAttributes = require('../../components/colorscale/color_attributes'); +var errorBarAttrs = require('../../components/errorbars/attributes'); var MARKER_SYMBOLS = require('../../constants/gl_markers'); var extendFlat = require('../../lib/extend').extendFlat; @@ -138305,6 +138621,8 @@ module.exports = { }), showscale: scatterMarkerAttrs.showscale, + colorbar: scatterMarkerAttrs.colorbar, + line: extendFlat({}, {width: extendFlat({}, scatterMarkerLineAttrs.width, {arrayOk: false})}, colorAttributes('marker.line') @@ -138312,17 +138630,16 @@ module.exports = { }, colorAttributes('marker') ), + textposition: extendFlat({}, scatterAttrs.textposition, {dflt: 'top center'}), textfont: scatterAttrs.textfont, - _nestedModules: { - 'error_x': 'ErrorBars', - 'error_y': 'ErrorBars', - 'error_z': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_x: errorBarAttrs, + error_y: errorBarAttrs, + error_z: errorBarAttrs, }; -},{"../../components/colorscale/color_attributes":541,"../../constants/gl_markers":616,"../../lib/extend":625,"../scatter/attributes":844}],868:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":540,"../../components/errorbars/attributes":558,"../../constants/gl_markers":615,"../../lib/extend":626,"../scatter/attributes":846}],870:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138351,7 +138668,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":843,"../scatter/colorscale_calc":848}],869:[function(require,module,exports){ +},{"../scatter/arrays_to_calcdata":845,"../scatter/colorscale_calc":850}],871:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138422,7 +138739,7 @@ function calculateErrors(data, scaleFactor) { module.exports = calculateErrors; -},{"../../components/errorbars/compute_error":561}],870:[function(require,module,exports){ +},{"../../components/errorbars/compute_error":560}],872:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138881,7 +139198,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../constants/gl3d_dashes":615,"../../constants/gl_markers":616,"../../lib":632,"../../lib/gl_format_color":630,"../../lib/str2rgbarray":645,"../scatter/make_bubble_size_func":859,"./calc_errors":869,"delaunay-triangulate":96,"gl-error3d":133,"gl-line3d":140,"gl-mesh3d":173,"gl-scatter3d":216}],871:[function(require,module,exports){ +},{"../../constants/gl3d_dashes":614,"../../constants/gl_markers":615,"../../lib":633,"../../lib/gl_format_color":631,"../../lib/str2rgbarray":646,"../scatter/make_bubble_size_func":861,"./calc_errors":871,"delaunay-triangulate":96,"gl-error3d":133,"gl-line3d":140,"gl-mesh3d":173,"gl-scatter3d":216}],873:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138966,7 +139283,7 @@ function handleXYZDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../components/errorbars/defaults":562,"../../lib":632,"../scatter/line_defaults":855,"../scatter/marker_defaults":860,"../scatter/subtypes":864,"../scatter/text_defaults":865,"./attributes":867}],872:[function(require,module,exports){ +},{"../../components/errorbars/defaults":561,"../../lib":633,"../scatter/line_defaults":857,"../scatter/marker_defaults":862,"../scatter/subtypes":866,"../scatter/text_defaults":867,"./attributes":869}],874:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -138997,7 +139314,7 @@ Scatter3D.meta = { module.exports = Scatter3D; -},{"../../constants/gl_markers":616,"../../plots/gl3d":702,"../scatter/colorbar":847,"./attributes":867,"./calc":868,"./convert":870,"./defaults":871}],873:[function(require,module,exports){ +},{"../../constants/gl_markers":615,"../../plots/gl3d":703,"../scatter/colorbar":849,"./attributes":869,"./calc":870,"./convert":872,"./defaults":873}],875:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139063,6 +139380,7 @@ module.exports = { sizemin: scatterMarkerAttrs.sizemin, sizemode: scatterMarkerAttrs.sizemode, showscale: scatterMarkerAttrs.showscale, + colorbar: scatterMarkerAttrs.colorbar, line: extendFlat({}, {width: scatterMarkerLineAttrs.width}, colorAttributes('marker.line') @@ -139082,14 +139400,10 @@ module.exports = { hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['lon', 'lat', 'location', 'text', 'name'] - }), - - _nestedModules: { - 'marker.colorbar': 'Colorbar' - } + }) }; -},{"../../components/colorscale/color_attributes":541,"../../lib/extend":625,"../../plots/attributes":660,"../scatter/attributes":844}],874:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":540,"../../lib/extend":626,"../../plots/attributes":662,"../scatter/attributes":846}],876:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139146,7 +139460,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../scatter/colorscale_calc":848,"fast-isnumeric":104}],875:[function(require,module,exports){ +},{"../scatter/colorscale_calc":850,"fast-isnumeric":104}],877:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139226,7 +139540,7 @@ function handleLonLatLocDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":632,"../scatter/fillcolor_defaults":851,"../scatter/line_defaults":855,"../scatter/marker_defaults":860,"../scatter/subtypes":864,"../scatter/text_defaults":865,"./attributes":873}],876:[function(require,module,exports){ +},{"../../lib":633,"../scatter/fillcolor_defaults":853,"../scatter/line_defaults":857,"../scatter/marker_defaults":862,"../scatter/subtypes":866,"../scatter/text_defaults":867,"./attributes":875}],878:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139247,7 +139561,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],877:[function(require,module,exports){ +},{}],879:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139357,7 +139671,7 @@ function getExtraText(trace, pt, axis) { return text.join('
'); } -},{"../../plots/cartesian/axes":662,"../../plots/cartesian/graph_interact":670,"../scatter/get_trace_color":852,"./attributes":873}],878:[function(require,module,exports){ +},{"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"../scatter/get_trace_color":854,"./attributes":875}],880:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139390,7 +139704,7 @@ ScatterGeo.meta = { module.exports = ScatterGeo; -},{"../../plots/geo":687,"../scatter/colorbar":847,"./attributes":873,"./calc":874,"./defaults":875,"./event_data":876,"./hover":877,"./plot":879}],879:[function(require,module,exports){ +},{"../../plots/geo":688,"../scatter/colorbar":849,"./attributes":875,"./calc":876,"./defaults":877,"./event_data":878,"./hover":879,"./plot":881}],881:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139562,7 +139876,7 @@ function style(geo) { }); } -},{"../../components/color":533,"../../components/drawing":557,"../../lib":632,"../../lib/array_to_calc_item":621,"../../lib/geo_location_utils":628,"../../lib/geojson_utils":629,"../../lib/topojson_utils":647,"../scatter/subtypes":864,"d3":95}],880:[function(require,module,exports){ +},{"../../components/color":533,"../../components/drawing":556,"../../lib":633,"../../lib/array_to_calc_item":621,"../../lib/geo_location_utils":629,"../../lib/geojson_utils":630,"../../lib/topojson_utils":648,"../scatter/subtypes":866,"d3":95}],882:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -139628,6 +139942,7 @@ module.exports = { sizemode: scatterMarkerAttrs.sizemode, opacity: scatterMarkerAttrs.opacity, showscale: scatterMarkerAttrs.showscale, + colorbar: scatterMarkerAttrs.colorbar, line: extendDeep({}, colorAttributes('marker.line'), { width: scatterMarkerLineAttrs.width }) @@ -139637,14 +139952,12 @@ module.exports = { values: ['none', 'tozeroy', 'tozerox'] }), fillcolor: scatterAttrs.fillcolor, - _nestedModules: { - 'error_x': 'ErrorBars', - 'error_y': 'ErrorBars', - 'marker.colorbar': 'Colorbar' - } + + error_y: scatterAttrs.error_y, + error_x: scatterAttrs.error_x }; -},{"../../components/colorscale/color_attributes":541,"../../constants/gl2d_dashes":614,"../../constants/gl_markers":616,"../../lib/extend":625,"../scatter/attributes":844}],881:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":540,"../../constants/gl2d_dashes":613,"../../constants/gl_markers":615,"../../lib/extend":626,"../scatter/attributes":846}],883:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140261,7 +140574,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../components/errorbars":563,"../../constants/gl2d_dashes":614,"../../constants/gl_markers":616,"../../lib":632,"../../lib/gl_format_color":630,"../../lib/str2rgbarray":645,"../../lib/typed_array_truncate":648,"../../plots/cartesian/axes":662,"../../plots/cartesian/axis_autotype":663,"../scatter/get_trace_color":852,"../scatter/make_bubble_size_func":859,"../scatter/subtypes":864,"fast-isnumeric":104,"gl-error2d":131,"gl-line2d":138,"gl-scatter2d":213,"gl-scatter2d-fancy":208}],882:[function(require,module,exports){ +},{"../../components/errorbars":562,"../../constants/gl2d_dashes":613,"../../constants/gl_markers":615,"../../lib":633,"../../lib/gl_format_color":631,"../../lib/str2rgbarray":646,"../../lib/typed_array_truncate":649,"../../plots/cartesian/axes":664,"../../plots/cartesian/axis_autotype":665,"../scatter/get_trace_color":854,"../scatter/make_bubble_size_func":861,"../scatter/subtypes":866,"fast-isnumeric":104,"gl-error2d":131,"gl-line2d":138,"gl-scatter2d":213,"gl-scatter2d-fancy":208}],884:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140318,7 +140631,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":562,"../../lib":632,"../scatter/constants":849,"../scatter/fillcolor_defaults":851,"../scatter/line_defaults":855,"../scatter/marker_defaults":860,"../scatter/subtypes":864,"../scatter/xy_defaults":866,"./attributes":880}],883:[function(require,module,exports){ +},{"../../components/errorbars/defaults":561,"../../lib":633,"../scatter/constants":851,"../scatter/fillcolor_defaults":853,"../scatter/line_defaults":857,"../scatter/marker_defaults":862,"../scatter/subtypes":866,"../scatter/xy_defaults":868,"./attributes":882}],885:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140349,7 +140662,7 @@ ScatterGl.meta = { module.exports = ScatterGl; -},{"../../plots/gl2d":699,"../scatter/colorbar":847,"../scatter3d/calc":868,"./attributes":880,"./convert":881,"./defaults":882}],884:[function(require,module,exports){ +},{"../../plots/gl2d":700,"../scatter/colorbar":849,"../scatter3d/calc":870,"./attributes":882,"./convert":883,"./defaults":884}],886:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140364,6 +140677,8 @@ var scatterGeoAttrs = require('../scattergeo/attributes'); var scatterAttrs = require('../scatter/attributes'); var mapboxAttrs = require('../../plots/mapbox/layout_attributes'); var plotAttrs = require('../../plots/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; var lineAttrs = scatterGeoAttrs.line; @@ -140422,7 +140737,8 @@ module.exports = { cmin: markerAttrs.cmin, autocolorscale: markerAttrs.autocolorscale, reversescale: markerAttrs.reversescale, - showscale: markerAttrs.showscale + showscale: markerAttrs.showscale, + colorbar: colorbarAttrs // line }, @@ -140436,13 +140752,9 @@ module.exports = { hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['lon', 'lat', 'text', 'name'] }), - - _nestedModules: { - 'marker.colorbar': 'Colorbar' - } }; -},{"../../lib/extend":625,"../../plots/attributes":660,"../../plots/mapbox/layout_attributes":719,"../scatter/attributes":844,"../scattergeo/attributes":873}],885:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../lib/extend":626,"../../plots/attributes":662,"../../plots/mapbox/layout_attributes":720,"../scatter/attributes":846,"../scattergeo/attributes":875}],887:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140545,7 +140857,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../components/colorscale":548,"../../lib":632,"../scatter/colorscale_calc":848,"../scatter/make_bubble_size_func":859,"../scatter/subtypes":864,"fast-isnumeric":104}],886:[function(require,module,exports){ +},{"../../components/colorscale":547,"../../lib":633,"../scatter/colorscale_calc":850,"../scatter/make_bubble_size_func":861,"../scatter/subtypes":866,"fast-isnumeric":104}],888:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140854,7 +141166,7 @@ function getFillFunc(attr) { function blankFillFunc() { return ''; } -},{"../../lib":632,"../../lib/geojson_utils":629,"../../plots/mapbox/convert_text_opts":716,"../scatter/subtypes":864}],887:[function(require,module,exports){ +},{"../../lib":633,"../../lib/geojson_utils":630,"../../plots/mapbox/convert_text_opts":717,"../scatter/subtypes":866}],889:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140942,7 +141254,7 @@ function handleLonLatDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":632,"../scatter/attributes":844,"../scatter/fillcolor_defaults":851,"../scatter/line_defaults":855,"../scatter/marker_defaults":860,"../scatter/subtypes":864,"../scatter/text_defaults":865,"./attributes":884}],888:[function(require,module,exports){ +},{"../../lib":633,"../scatter/attributes":846,"../scatter/fillcolor_defaults":853,"../scatter/line_defaults":857,"../scatter/marker_defaults":862,"../scatter/subtypes":866,"../scatter/text_defaults":867,"./attributes":886}],890:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -140962,7 +141274,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],889:[function(require,module,exports){ +},{}],891:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141057,7 +141369,7 @@ function getExtraText(trace, di) { return text.join('
'); } -},{"../../plots/cartesian/graph_interact":670,"../scatter/get_trace_color":852}],890:[function(require,module,exports){ +},{"../../plots/cartesian/graph_interact":671,"../scatter/get_trace_color":854}],892:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141090,7 +141402,7 @@ ScatterMapbox.meta = { module.exports = ScatterMapbox; -},{"../../plots/mapbox":717,"../scatter/colorbar":847,"./attributes":884,"./calc":885,"./defaults":887,"./event_data":888,"./hover":889,"./plot":891}],891:[function(require,module,exports){ +},{"../../plots/mapbox":718,"../scatter/colorbar":849,"./attributes":886,"./calc":887,"./defaults":889,"./event_data":890,"./hover":891,"./plot":893}],893:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141214,7 +141526,7 @@ module.exports = function createScatterMapbox(mapbox, calcTrace) { return scatterMapbox; }; -},{"./convert":886}],892:[function(require,module,exports){ +},{"./convert":888}],894:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141228,6 +141540,7 @@ module.exports = function createScatterMapbox(mapbox, calcTrace) { var scatterAttrs = require('../scatter/attributes'); var plotAttrs = require('../../plots/attributes'); var colorAttributes = require('../../components/colorscale/color_attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); var extendFlat = require('../../lib/extend').extendFlat; @@ -141281,26 +141594,24 @@ module.exports = { sizeref: scatterMarkerAttrs.sizeref, sizemin: scatterMarkerAttrs.sizemin, sizemode: scatterMarkerAttrs.sizemode, - showscale: scatterMarkerAttrs.showscale, line: extendFlat({}, {width: scatterMarkerLineAttrs.width}, colorAttributes('marker'.line) ) - }, - colorAttributes('marker') - ), + }, colorAttributes('marker'), { + showscale: scatterMarkerAttrs.showscale, + colorbar: colorbarAttrs + }), + textfont: scatterAttrs.textfont, textposition: scatterAttrs.textposition, hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['a', 'b', 'c', 'text', 'name'] }), hoveron: scatterAttrs.hoveron, - _nestedModules: { - 'marker.colorbar': 'Colorbar' - } }; -},{"../../components/colorscale/color_attributes":541,"../../lib/extend":625,"../../plots/attributes":660,"../scatter/attributes":844}],893:[function(require,module,exports){ +},{"../../components/colorbar/attributes":534,"../../components/colorscale/color_attributes":540,"../../lib/extend":626,"../../plots/attributes":662,"../scatter/attributes":846}],895:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141399,7 +141710,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":632,"../../plots/cartesian/axes":662,"../scatter/colorscale_calc":848,"../scatter/subtypes":864,"fast-isnumeric":104}],894:[function(require,module,exports){ +},{"../../lib":633,"../../plots/cartesian/axes":664,"../scatter/colorscale_calc":850,"../scatter/subtypes":866,"fast-isnumeric":104}],896:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141504,7 +141815,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hoveron', dfltHoverOn.join('+') || 'points'); }; -},{"../../lib":632,"../scatter/constants":849,"../scatter/fillcolor_defaults":851,"../scatter/line_defaults":855,"../scatter/line_shape_defaults":857,"../scatter/marker_defaults":860,"../scatter/subtypes":864,"../scatter/text_defaults":865,"./attributes":892}],895:[function(require,module,exports){ +},{"../../lib":633,"../scatter/constants":851,"../scatter/fillcolor_defaults":853,"../scatter/line_defaults":857,"../scatter/line_shape_defaults":859,"../scatter/marker_defaults":862,"../scatter/subtypes":866,"../scatter/text_defaults":867,"./attributes":894}],897:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141575,7 +141886,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../../plots/cartesian/axes":662,"../scatter/hover":853}],896:[function(require,module,exports){ +},{"../../plots/cartesian/axes":664,"../scatter/hover":855}],898:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141608,7 +141919,7 @@ ScatterTernary.meta = { module.exports = ScatterTernary; -},{"../../plots/ternary":731,"../scatter/colorbar":847,"./attributes":892,"./calc":893,"./defaults":894,"./hover":895,"./plot":897,"./select":898,"./style":899}],897:[function(require,module,exports){ +},{"../../plots/ternary":732,"../scatter/colorbar":849,"./attributes":894,"./calc":895,"./defaults":896,"./hover":897,"./plot":899,"./select":900,"./style":901}],899:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141654,7 +141965,7 @@ module.exports = function plot(ternary, data) { scatterPlot(ternary.graphDiv, plotinfo, calcdata); }; -},{"../scatter/plot":861}],898:[function(require,module,exports){ +},{"../scatter/plot":863}],900:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141689,7 +142000,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"../scatter/select":862}],899:[function(require,module,exports){ +},{"../scatter/select":864}],901:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141718,7 +142029,7 @@ module.exports = function style(gd) { scatterStyle(gd); }; -},{"../scatter/style":863}],900:[function(require,module,exports){ +},{"../scatter/style":865}],902:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141731,6 +142042,8 @@ module.exports = function style(gd) { var Color = require('../../components/color'); var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); + var extendFlat = require('../../lib/extend').extendFlat; function makeContourProjAttr(axLetter) { @@ -141829,6 +142142,7 @@ module.exports = { {dflt: false}), reversescale: colorscaleAttrs.reversescale, showscale: colorscaleAttrs.showscale, + colorbar: colorbarAttrs, contours: { x: makeContourAttr('x'), @@ -141921,10 +142235,6 @@ module.exports = { }, - _nestedModules: { // nested module coupling - 'colorbar': 'Colorbar' - }, - _deprecated: { zauto: extendFlat({}, colorscaleAttrs.zauto, { @@ -141938,7 +142248,7 @@ module.exports = { } }; -},{"../../components/color":533,"../../components/colorscale/attributes":539,"../../lib/extend":625}],901:[function(require,module,exports){ +},{"../../components/color":533,"../../components/colorbar/attributes":534,"../../components/colorscale/attributes":538,"../../lib/extend":626}],903:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -141962,7 +142272,7 @@ module.exports = function calc(gd, trace) { } }; -},{"../../components/colorscale/calc":540}],902:[function(require,module,exports){ +},{"../../components/colorscale/calc":539}],904:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142014,7 +142324,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":536,"../../components/colorscale":548,"../../lib":632,"../../plots/plots":723,"fast-isnumeric":104}],903:[function(require,module,exports){ +},{"../../components/colorbar/draw":536,"../../components/colorscale":547,"../../lib":633,"../../plots/plots":724,"fast-isnumeric":104}],905:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142168,8 +142478,8 @@ function refine(coords) { var padImg = padField(coords[i]); var scaledImg = ndarray(new Float32Array(nsize), nshape); homography(scaledImg, padImg, [scaleF, 0, 0, - 0, scaleF, 0, - 0, 0, 1]); + 0, scaleF, 0, + 0, 0, 1]); coords[i] = scaledImg; } @@ -142393,7 +142703,7 @@ function createSurfaceTrace(scene, data) { module.exports = createSurfaceTrace; -},{"../../lib/str2rgbarray":645,"gl-surface3d":231,"ndarray":427,"ndarray-fill":417,"ndarray-homography":419,"ndarray-ops":421,"tinycolor2":489}],904:[function(require,module,exports){ +},{"../../lib/str2rgbarray":646,"gl-surface3d":231,"ndarray":427,"ndarray-fill":417,"ndarray-homography":419,"ndarray-ops":421,"tinycolor2":489}],906:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142510,7 +142820,7 @@ function mapLegacy(traceIn, oldAttr, newAttr) { } } -},{"../../components/colorscale/defaults":543,"../../lib":632,"./attributes":900}],905:[function(require,module,exports){ +},{"../../components/colorscale/defaults":542,"../../lib":633,"./attributes":902}],907:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142540,7 +142850,7 @@ Surface.meta = { module.exports = Surface; -},{"../../plots/gl3d":702,"./attributes":900,"./calc":901,"./colorbar":902,"./convert":903,"./defaults":904}],906:[function(require,module,exports){ +},{"../../plots/gl3d":703,"./attributes":902,"./calc":903,"./colorbar":904,"./convert":905,"./defaults":906}],908:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142552,6 +142862,7 @@ module.exports = Surface; 'use strict'; var Lib = require('../lib'); +var PlotSchema = require('../plot_api/plot_schema'); var axisIds = require('../plots/cartesian/axis_ids'); var autoType = require('../plots/cartesian/axis_autotype'); var setConvert = require('../plots/cartesian/set_convert'); @@ -142620,7 +142931,7 @@ exports.calcTransform = function(gd, trace, opts) { var dataToCoord = getDataToCoordFunc(gd, trace, target), filterFunc = getFilterFunc(opts, dataToCoord), - arrayAttrs = Lib.findArrayAttributes(trace), + arrayAttrs = PlotSchema.findArrayAttributes(trace), originalArrays = {}; // copy all original array attribute values, @@ -142673,7 +142984,13 @@ function getDataToCoordFunc(gd, trace, target) { type: autoType(target), _categories: [] }; + setConvert(ax); + + // build up ax._categories (usually done during ax.makeCalcdata() + for(var i = 0; i < target.length; i++) { + ax.d2c(target[i]); + } } else { ax = axisIds.getFromTrace(gd, trace, target); @@ -142792,7 +143109,7 @@ function getFilterFunc(opts, d2c) { } } -},{"../lib":632,"../plots/cartesian/axis_autotype":663,"../plots/cartesian/axis_ids":665,"../plots/cartesian/set_convert":677}],907:[function(require,module,exports){ +},{"../lib":633,"../plot_api/plot_schema":653,"../plots/cartesian/axis_autotype":665,"../plots/cartesian/axis_ids":667,"../plots/cartesian/set_convert":678}],909:[function(require,module,exports){ /** * Copyright 2012-2016, Plotly, Inc. * All rights reserved. @@ -142804,6 +143121,7 @@ function getFilterFunc(opts, d2c) { 'use strict'; var Lib = require('../lib'); +var PlotSchema = require('../plot_api/plot_schema'); exports.moduleType = 'transform'; @@ -142907,7 +143225,7 @@ function transformOne(trace, state) { newData = new Array(groupNames.length), len = groups.length; - var arrayAttrs = Lib.findArrayAttributes(trace); + var arrayAttrs = PlotSchema.findArrayAttributes(trace); var style = opts.style || {}; @@ -142934,5 +143252,5 @@ function transformOne(trace, state) { return newData; } -},{"../lib":632}]},{},[15])(15) +},{"../lib":633,"../plot_api/plot_schema":653}]},{},[15])(15) }); \ No newline at end of file diff --git a/dist/plotly.min.js b/dist/plotly.min.js index 124d9dc91ad..0692bb541b9 100644 --- a/dist/plotly.min.js +++ b/dist/plotly.min.js @@ -1,63 +1,63 @@ /** -* plotly.js v1.19.2 +* plotly.js v1.20.0 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function 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 u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){var r=e[o][1][t];return i(r?r:t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;oMath.abs(e))n.rotate(s,0,0,-t*a*Math.PI*f.rotateSpeed/window.innerWidth);else{var l=f.zoomSpeed*o*e/window.innerHeight*(s-n.lastT())/100;n.pan(s,0,0,u*(Math.exp(l)-1))}},!0),f}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":27,"mouse-change":413,"mouse-wheel":415,"right-now":459}],27:[function(t,e,r){"use strict";function n(t,e){this._controllerNames=Object.keys(t),this._controllerList=this._controllerNames.map(function(e){return t[e]}),this._mode=e,this._active=t[e],this._active||(this._mode="turntable",this._active=t.turntable),this.modes=this._controllerNames,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}function i(t){t=t||{};var e=t.eye||[0,0,1],r=t.center||[0,0,0],i=t.up||[0,1,0],l=t.distanceLimits||[0,1/0],u=t.mode||"turntable",c=a(),h=o(),f=s();return c.setDistanceLimits(l[0],l[1]),c.lookAt(0,e,r,i),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,i),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,i),new n({turntable:c,orbit:h,matrix:f},u)}e.exports=i;var a=t("turntable-camera-controller"),o=t("orbit-camera-controller"),s=t("matrix-camera-controller"),l=n.prototype,u=[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]];u.forEach(function(t){for(var e=t[0],r=[],n=0;n>16&255,r[1]=n>>8&255,r[2]=255&n):h.test(t)&&(n=t.match(f),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3])),!e)for(var i=0;i<3;++i)r[i]=r[i]/255;return r}function u(t,e){var r,n;if("string"!=typeof t)return t;if(r=[],"#"===t[0]?(t=t.substr(1),3===t.length&&(t+=t),n=parseInt(t,16),r[0]=n>>16&255,r[1]=n>>8&255,r[2]=255&n):h.test(t)&&(n=t.match(f),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3]),n[4]?r[3]=parseFloat(n[4]):r[3]=1),!e)for(var i=0;i<3;++i)r[i]=r[i]/255;return r}var c={},h=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,.*)?\)$/,f=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,?\s*(.*)?\)$/;return c.isPlainObject=t,c.linspace=e,c.zip3=n,c.sum=i,c.zip=r,c.isEqual=s,c.copy2D=a,c.copy1D=o,c.str2RgbArray=l,c.str2RgbaArray=u,c};e.exports=n()},{}],34:[function(t,e,r){function n(t,e){return d.isUndefined(e)?""+e:d.isNumber(e)&&!isFinite(e)?e.toString():d.isFunction(e)||d.isRegExp(e)?e.toString():e}function i(t,e){return d.isString(t)?t.length=0;a--)if(o[a]!=s[a])return!1;for(a=o.length-1;a>=0;a--)if(i=o[a],!l(t[i],e[i]))return!1;return!0}function h(t,e){return!(!t||!e)&&("[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e||e.call({},t)===!0)}function f(t,e,r,n){var i;d.isString(r)&&(n=r,r=null);try{e()}catch(t){i=t}if(n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&o(i,r,"Missing expected exception"+n),!t&&h(i,r)&&o(i,r,"Got unwanted exception"+n),t&&i&&r&&!h(i,r)||!t&&i)throw i}var d=t("util/"),p=Array.prototype.slice,g=Object.prototype.hasOwnProperty,m=e.exports=s;m.AssertionError=function(t){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=a(this),this.generatedMessage=!0);var e=t.stackStartFunction||o;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=e.name,s=n.indexOf("\n"+i);if(s>=0){var l=n.indexOf("\n",s+1);n=n.substring(l+1)}this.stack=n}}},d.inherits(m.AssertionError,Error),m.fail=o,m.ok=s,m.equal=function(t,e,r){t!=e&&o(t,e,r,"==",m.equal)},m.notEqual=function(t,e,r){t==e&&o(t,e,r,"!=",m.notEqual)},m.deepEqual=function(t,e,r){l(t,e)||o(t,e,r,"deepEqual",m.deepEqual)},m.notDeepEqual=function(t,e,r){l(t,e)&&o(t,e,r,"notDeepEqual",m.notDeepEqual)},m.strictEqual=function(t,e,r){t!==e&&o(t,e,r,"===",m.strictEqual)},m.notStrictEqual=function(t,e,r){t===e&&o(t,e,r,"!==",m.notStrictEqual)},m.throws=function(t,e,r){f.apply(this,[!0].concat(p.call(arguments)))},m.doesNotThrow=function(t,e){f.apply(this,[!1].concat(p.call(arguments)))},m.ifError=function(t){if(t)throw t};var v=Object.keys||function(t){var e=[];for(var r in t)g.call(t,r)&&e.push(r);return e}},{"util/":504}],35:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],36:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0;r0?r=r.shln(h):h<0&&(c=c.shln(-h)),l(r,c)}var i=t("./is-rat"),a=t("./lib/is-bn"),o=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),u=t("./div");e.exports=n},{"./div":39,"./is-rat":41,"./lib/is-bn":45,"./lib/num-to-bn":46,"./lib/rationalize":47,"./lib/str-to-bn":48}],41:[function(t,e,r){"use strict";function n(t){return Array.isArray(t)&&2===t.length&&i(t[0])&&i(t[1])}var i=t("./lib/is-bn");e.exports=n},{"./lib/is-bn":45}],42:[function(t,e,r){"use strict";function n(t){return t.cmp(new i(0))}var i=t("bn.js");e.exports=n},{"bn.js":55}],43:[function(t,e,r){"use strict";function n(t){var e=t.length,r=t.words,n=0;if(1===e)n=r[0];else if(2===e)n=r[0]+67108864*r[1];else for(var n=0,i=0;i20?52:r+32}var i=t("double-bits"),a=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":54,"double-bits":97}],45:[function(t,e,r){"use strict";function n(t){return t&&"object"==typeof t&&Boolean(t.words)}t("bn.js");e.exports=n},{"bn.js":55}],46:[function(t,e,r){"use strict";function n(t){var e=a.exponent(t);return e<52?new i(t):new i(t*Math.pow(2,52-e)).shln(e-52)}var i=t("bn.js"),a=t("double-bits");e.exports=n},{"bn.js":55,"double-bits":97}],47:[function(t,e,r){"use strict";function n(t,e){var r=a(t),n=a(e);if(0===r)return[i(0),i(1)];if(0===n)return[i(0),i(0)];n<0&&(t=t.neg(),e=e.neg());var o=t.gcd(e);return o.cmpn(1)?[t.div(o),e.div(o)]:[t,e]}var i=t("./num-to-bn"),a=t("./bn-sign");e.exports=n},{"./bn-sign":42,"./num-to-bn":46}],48:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":55}],49:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[0]),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":47}],50:[function(t,e,r){"use strict";function n(t){return i(t[0])*i(t[1])}var i=t("./lib/bn-sign");e.exports=n},{"./lib/bn-sign":42}],51:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":47}],52:[function(t,e,r){"use strict";function n(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var n=e.divmod(r),o=n.div,s=i(o),l=n.mod;if(0===l.cmpn(0))return s;if(s){var u=a(s)+4,c=i(l.shln(u).divRound(r));return s<0&&(c=-c),s+c*Math.pow(2,-u)}var h=r.bitLength()-l.bitLength()+53,c=i(l.shln(h).divRound(r));return h<1023?c*Math.pow(2,-h):(c*=Math.pow(2,-1023),c*Math.pow(2,1023-h))}var i=t("./lib/bn-to-num"),a=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":43,"./lib/ctz":44}],53:[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){var a=new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""));return a()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],54:[function(t,e,r){"use strict";"use restrict"; +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function 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 u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){var r=e[o][1][t];return i(r?r:t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;oMath.abs(e))n.rotate(s,0,0,-t*a*Math.PI*f.rotateSpeed/window.innerWidth);else{var l=f.zoomSpeed*o*e/window.innerHeight*(s-n.lastT())/100;n.pan(s,0,0,u*(Math.exp(l)-1))}},!0),f}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":27,"mouse-change":413,"mouse-wheel":415,"right-now":459}],27:[function(t,e,r){"use strict";function n(t,e){this._controllerNames=Object.keys(t),this._controllerList=this._controllerNames.map(function(e){return t[e]}),this._mode=e,this._active=t[e],this._active||(this._mode="turntable",this._active=t.turntable),this.modes=this._controllerNames,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}function i(t){t=t||{};var e=t.eye||[0,0,1],r=t.center||[0,0,0],i=t.up||[0,1,0],l=t.distanceLimits||[0,1/0],u=t.mode||"turntable",c=a(),h=o(),f=s();return c.setDistanceLimits(l[0],l[1]),c.lookAt(0,e,r,i),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,i),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,i),new n({turntable:c,orbit:h,matrix:f},u)}e.exports=i;var a=t("turntable-camera-controller"),o=t("orbit-camera-controller"),s=t("matrix-camera-controller"),l=n.prototype,u=[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]];u.forEach(function(t){for(var e=t[0],r=[],n=0;n>16&255,r[1]=n>>8&255,r[2]=255&n):h.test(t)&&(n=t.match(f),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3])),!e)for(var i=0;i<3;++i)r[i]=r[i]/255;return r}function u(t,e){var r,n;if("string"!=typeof t)return t;if(r=[],"#"===t[0]?(t=t.substr(1),3===t.length&&(t+=t),n=parseInt(t,16),r[0]=n>>16&255,r[1]=n>>8&255,r[2]=255&n):h.test(t)&&(n=t.match(f),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3]),n[4]?r[3]=parseFloat(n[4]):r[3]=1),!e)for(var i=0;i<3;++i)r[i]=r[i]/255;return r}var c={},h=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,.*)?\)$/,f=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,?\s*(.*)?\)$/;return c.isPlainObject=t,c.linspace=e,c.zip3=n,c.sum=i,c.zip=r,c.isEqual=s,c.copy2D=a,c.copy1D=o,c.str2RgbArray=l,c.str2RgbaArray=u,c};e.exports=n()},{}],34:[function(t,e,r){function n(t,e){return d.isUndefined(e)?""+e:d.isNumber(e)&&!isFinite(e)?e.toString():d.isFunction(e)||d.isRegExp(e)?e.toString():e}function i(t,e){return d.isString(t)?t.length=0;a--)if(o[a]!=s[a])return!1;for(a=o.length-1;a>=0;a--)if(i=o[a],!l(t[i],e[i]))return!1;return!0}function h(t,e){return!(!t||!e)&&("[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e||e.call({},t)===!0)}function f(t,e,r,n){var i;d.isString(r)&&(n=r,r=null);try{e()}catch(t){i=t}if(n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&o(i,r,"Missing expected exception"+n),!t&&h(i,r)&&o(i,r,"Got unwanted exception"+n),t&&i&&r&&!h(i,r)||!t&&i)throw i}var d=t("util/"),p=Array.prototype.slice,g=Object.prototype.hasOwnProperty,m=e.exports=s;m.AssertionError=function(t){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=a(this),this.generatedMessage=!0);var e=t.stackStartFunction||o;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=e.name,s=n.indexOf("\n"+i);if(s>=0){var l=n.indexOf("\n",s+1);n=n.substring(l+1)}this.stack=n}}},d.inherits(m.AssertionError,Error),m.fail=o,m.ok=s,m.equal=function(t,e,r){t!=e&&o(t,e,r,"==",m.equal)},m.notEqual=function(t,e,r){t==e&&o(t,e,r,"!=",m.notEqual)},m.deepEqual=function(t,e,r){l(t,e)||o(t,e,r,"deepEqual",m.deepEqual)},m.notDeepEqual=function(t,e,r){l(t,e)&&o(t,e,r,"notDeepEqual",m.notDeepEqual)},m.strictEqual=function(t,e,r){t!==e&&o(t,e,r,"===",m.strictEqual)},m.notStrictEqual=function(t,e,r){t===e&&o(t,e,r,"!==",m.notStrictEqual)},m.throws=function(t,e,r){f.apply(this,[!0].concat(p.call(arguments)))},m.doesNotThrow=function(t,e){f.apply(this,[!1].concat(p.call(arguments)))},m.ifError=function(t){if(t)throw t};var v=Object.keys||function(t){var e=[];for(var r in t)g.call(t,r)&&e.push(r);return e}},{"util/":504}],35:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],36:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0;r0?r=r.shln(h):h<0&&(c=c.shln(-h)),l(r,c)}var i=t("./is-rat"),a=t("./lib/is-bn"),o=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),u=t("./div");e.exports=n},{"./div":39,"./is-rat":41,"./lib/is-bn":45,"./lib/num-to-bn":46,"./lib/rationalize":47,"./lib/str-to-bn":48}],41:[function(t,e,r){"use strict";function n(t){return Array.isArray(t)&&2===t.length&&i(t[0])&&i(t[1])}var i=t("./lib/is-bn");e.exports=n},{"./lib/is-bn":45}],42:[function(t,e,r){"use strict";function n(t){return t.cmp(new i(0))}var i=t("bn.js");e.exports=n},{"bn.js":55}],43:[function(t,e,r){"use strict";function n(t){var e=t.length,r=t.words,n=0;if(1===e)n=r[0];else if(2===e)n=r[0]+67108864*r[1];else for(var n=0,i=0;i20?52:r+32}var i=t("double-bits"),a=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":54,"double-bits":97}],45:[function(t,e,r){"use strict";function n(t){return t&&"object"==typeof t&&Boolean(t.words)}t("bn.js");e.exports=n},{"bn.js":55}],46:[function(t,e,r){"use strict";function n(t){var e=a.exponent(t);return e<52?new i(t):new i(t*Math.pow(2,52-e)).shln(e-52)}var i=t("bn.js"),a=t("double-bits");e.exports=n},{"bn.js":55,"double-bits":97}],47:[function(t,e,r){"use strict";function n(t,e){var r=a(t),n=a(e);if(0===r)return[i(0),i(1)];if(0===n)return[i(0),i(0)];n<0&&(t=t.neg(),e=e.neg());var o=t.gcd(e);return o.cmpn(1)?[t.div(o),e.div(o)]:[t,e]}var i=t("./num-to-bn"),a=t("./bn-sign");e.exports=n},{"./bn-sign":42,"./num-to-bn":46}],48:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":55}],49:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[0]),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":47}],50:[function(t,e,r){"use strict";function n(t){return i(t[0])*i(t[1])}var i=t("./lib/bn-sign");e.exports=n},{"./lib/bn-sign":42}],51:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":47}],52:[function(t,e,r){"use strict";function n(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var n=e.divmod(r),o=n.div,s=i(o),l=n.mod;if(0===l.cmpn(0))return s;if(s){var u=a(s)+4,c=i(l.shln(u).divRound(r));return s<0&&(c=-c),s+c*Math.pow(2,-u)}var h=r.bitLength()-l.bitLength()+53,c=i(l.shln(h).divRound(r));return h<1023?c*Math.pow(2,-h):(c*=Math.pow(2,-1023),c*Math.pow(2,1023-h))}var i=t("./lib/bn-to-num"),a=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":43,"./lib/ctz":44}],53:[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){var a=new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""));return a()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],54:[function(t,e,r){"use strict";"use restrict"; function n(t){var e=32;return t&=-t,t&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}var i=32;r.INT_BITS=i,r.INT_MAX=2147483647,r.INT_MIN=-1<0)-(t<0)},r.abs=function(t){var e=t>>i-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,e|t>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,t&=15,27030>>>t&1};var a=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|a[t>>>16&255]<<8|a[t>>>24&255]},r.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},r.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),t=65535&(t|t>>>16),t<<16>>16},r.interleave3=function(t,e,r){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t|r<<2},r.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),t=1023&(t|t>>>16),t<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],55:[function(t,e,r){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){return null!==t&&"object"==typeof t&&Array.isArray(t.words)?t:(this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==e&&"be"!==e||(r=e,e=10),void(null!==t&&this._init(t||0,e||10,r||"be")))}function a(t,e,r){for(var n=0,i=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function o(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}function s(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function l(){s.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function u(){s.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function c(){s.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function h(){s.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function f(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function d(t){f.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.sign=!0),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){t<0&&(this.sign=!0,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3){var s=t[i]|t[i-1]<<8|t[i-2]<<16;this.words[o]|=s<>>26-a&67108863,a+=24,a>=26&&(a-=26,o++)}else if("le"===n)for(var i=0,o=0;i>>26-a&67108863,a+=24,a>=26&&(a-=26,o++)}return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6){var o=a(t,r,r+6);this.words[i]|=o<>>26-n&4194303,n+=24,n>=26&&(n-=26,i++)}if(r+6!==e){var o=a(t,e,r+6);this.words[i]|=o<>>26-n&4194303}this.strip()},i.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,s=a%n,l=Math.min(a,a-s)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function(){return(this.red?""};var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],g=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],m=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){if(t=t||10,16===t||"hex"===t){for(var n="",i=0,e=0|e||1,a=0,o=0;o>>24-i&16777215,n=0!==a||o!==this.length-1?p[6-l.length]+l+n:l+n,i+=2,i>=26&&(i-=26,o--)}for(0!==a&&(n=a.toString(16)+n);n.length%e!==0;)n="0"+n;return this.sign&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=g[t],c=m[t],n="",h=this.clone();for(h.sign=!1;0!==h.cmpn(0);){var f=h.modn(c).toString(t);h=h.idivn(c),n=0!==h.cmpn(0)?p[u-f.length]+f+n:f+n}return 0===this.cmpn(0)&&(n="0"+n),this.sign&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toArray=function(t){this.strip();var e=new Array(this.byteLength());e[0]=0;var r=this.clone();if("le"!==t)for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[e.length-n-1]=i}else for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[n]=i}return e},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},i.prototype.bitLength=function(){var t=0,e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function(t){this.sign=this.sign&&t.sign;var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function(t){this.sign=this.sign||t.sign;var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);for(var n=t/26|0,i=t%26;this.length<=n;)this.words[this.length++]=0;return e?this.words[n]=this.words[n]|1<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)},i.prototype.isub=function(t){if(t.sign){t.sign=!1;var e=this.iadd(t);return t.sign=!0,e._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t);if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var 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>>26,a=67108863&r,o=Math.min(n,t.length-1),s=Math.max(0,n-this.length+1);s<=o;s++){var l=n-s,u=0|this.words[l],c=0|t.words[s],h=u*c,f=67108863&h;i=i+(h/67108864|0)|0,f=f+a|0,a=67108863&f,i=i+(f>>>26)|0}e.words[n]=a,r=i}return 0!==r?e.words[n]=r:e.length--,e.strip()},i.prototype._bigMulTo=function(t,e){e.sign=t.sign!==this.sign,e.length=this.length+t.length;for(var r=0,n=0,i=0;i>>26)|0,n+=a>>>26,a&=67108863}e.words[i]=o,r=a,a=n}return 0!==r?e.words[i]=r:e.length--,e.strip()},i.prototype.mulTo=function(t,e){var r;return r=this.length+t.length<63?this._smallMulTo(t,e):this._bigMulTo(t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.imul=function(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var e=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var n=this.length-2;n>=0;n--){for(var i=0,a=0,o=Math.min(n,r-1),s=Math.max(0,n-e+1);s<=o;s++){var l=n-s,u=this.words[l],c=t.words[s],h=u*c,f=67108863&h;i+=h/67108864|0,f+=a,a=67108863&f,i+=f>>>26}this.words[n]=a,this.words[n+1]+=i,i=0}for(var i=0,l=1;l>>26}return this.strip()},i.prototype.imuln=function(t){r("number"==typeof t);for(var e=0,n=0;n>=26,e+=i/67108864|0,e+=a>>>26,this.words[n]=67108863&a}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.mul(this)},i.prototype.ishln=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=67108863>>>26-e<<26-e;if(0!==e){for(var a=0,o=0;o>>26-e}a&&(this.words[o]=a,this.length++)}if(0!==n){for(var o=this.length-1;o>=0;o--)this.words[o+n]=this.words[o];for(var o=0;o=0);var i;i=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o){this.length-=o;for(var u=0;u=0&&(0!==c||u>=i);u--){var h=this.words[u];this.words[u]=c<<26-a|h>>>a,c=h&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),t<0)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&l}for(;i>26,this.words[i+n]=67108863&l}if(0===s)return this.strip();r(s===-1),s=0;for(var i=0;i>26,this.words[i]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),a=t,o=a.words[a.length-1],s=this._countBits(o);r=26-s,0!==r&&(a=a.shln(r),n.ishln(r),o=a.words[a.length-1]);var l,u=n.length-a.length;if("mod"!==e){l=new i(null),l.length=u+1,l.words=new Array(l.length);for(var c=0;c=0;f--){var d=67108864*n.words[a.length+f]+n.words[a.length+f-1];for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(a,d,f);n.sign;)d--,n.sign=!1,n._ishlnsubmul(a,1,f),0!==n.cmpn(0)&&(n.sign=!n.sign);l&&(l.words[f]=d)}return l&&l.strip(),n.strip(),"div"!==e&&0!==r&&n.ishrn(r),{div:l?l:null,mod:n}},i.prototype.divmod=function(t,e){if(r(0!==t.cmpn(0)),this.sign&&!t.sign){var n,a,o=this.neg().divmod(t,e);return"mod"!==e&&(n=o.div.neg()),"div"!==e&&(a=0===o.mod.cmpn(0)?o.mod:t.sub(o.mod)),{div:n,mod:a}}if(!this.sign&&t.sign){var n,o=this.divmod(t.neg(),e);return"mod"!==e&&(n=o.div.neg()),{div:n,mod:o.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),e):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e)},i.prototype.div=function(t){return this.divmod(t,"div").div},i.prototype.mod=function(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(0===e.mod.cmpn(0))return e.div;var r=e.div.sign?e.mod.isub(t):e.mod,n=t.shrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:e.div.sign?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+this.words[i])%t;return n},i.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=this.words[n]+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var a=new i(1),o=new i(0),s=new i(0),l=new i(1),u=0;e.isEven()&&n.isEven();)e.ishrn(1),n.ishrn(1),++u;for(var c=n.clone(),h=e.clone();0!==e.cmpn(0);){for(;e.isEven();)e.ishrn(1),a.isEven()&&o.isEven()?(a.ishrn(1),o.ishrn(1)):(a.iadd(c).ishrn(1),o.isub(h).ishrn(1));for(;n.isEven();)n.ishrn(1),s.isEven()&&l.isEven()?(s.ishrn(1),l.ishrn(1)):(s.iadd(c).ishrn(1),l.isub(h).ishrn(1));e.cmp(n)>=0?(e.isub(n),a.isub(s),o.isub(l)):(n.isub(e),s.isub(a),l.isub(o))}return{a:s,b:l,gcd:n.ishln(u)}},i.prototype._invmp=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var a=new i(1),o=new i(0),s=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(;e.isEven();)e.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(s).ishrn(1);for(;n.isEven();)n.ishrn(1),o.isEven()?o.ishrn(1):o.iadd(s).ishrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(o)):(n.isub(e),o.isub(a))}return 0===e.cmpn(1)?a:o},i.prototype.gcd=function(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var e=this.clone(),r=t.clone();e.sign=!1,r.sign=!1;for(var n=0;e.isEven()&&r.isEven();n++)e.ishrn(1),r.ishrn(1);for(;;){for(;e.isEven();)e.ishrn(1);for(;r.isEven();)r.ishrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.ishln(n)},i.prototype.invm=function(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function(){return 0===(1&this.words[0])},i.prototype.isOdd=function(){return 1===(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.cmpn=function(t){var e=t<0;if(e&&(t=-t),this.sign&&!e)return-1;if(!this.sign&&e)return 1;t&=67108863,this.strip();var r;if(this.length>1)r=1;else{var n=this.words[0];r=n===t?0:nt.length)return 1;if(this.length=0;r--){var n=this.words[r],i=t.words[r];if(n!==i){ni&&(e=1);break}}return e},i.red=function(t){return new f(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};s.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},s.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength();while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},s.prototype.split=function(t,e){t.ishrn(this.n,0,e)},s.prototype.imulK=function(t){return t.imul(this.k)},n(l,s),l.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,a=o}t.words[i-10]=a>>>22,t.length-=9},l.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e,r=0,n=0;n>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function t(e){if(v[e])return v[e];var t;if("k256"===e)t=new l;else if("p224"===e)t=new u;else if("p192"===e)t=new c;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new h}return v[e]=t,t},f.prototype._verify1=function(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},f.prototype._verify2=function(t,e){r(!t.sign&&!e.sign,"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},f.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},f.prototype.neg=function(t){var e=t.clone();return e.sign=!e.sign,e.iadd(this.m)._forceRed(this)},f.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},f.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},f.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},f.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},f.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.shln(e))},f.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},f.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},f.prototype.isqr=function(t){return this.imul(t,t)},f.prototype.sqr=function(t){return this.mul(t,t)},f.prototype.sqrt=function(t){if(0===t.cmpn(0))return t.clone();var e=this.m.andln(3);if(r(e%2===1),3===e){var n=this.m.add(new i(1)).ishrn(2),a=this.pow(t,n);return a}for(var o=this.m.subn(1),s=0;0!==o.cmpn(0)&&0===o.andln(1);)s++,o.ishrn(1);r(0!==o.cmpn(0));var l=new i(1).toRed(this),u=l.redNeg(),c=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,o),a=this.pow(t,o.addn(1).ishrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(l);){for(var g=d,m=0;0!==g.cmp(l);m++)g=g.redSqr();r(m=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},d.prototype.mul=function(t,e){if(0===t.cmpn(0)||0===e.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).ishrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},d.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}}("undefined"==typeof e||e,this)},{}],56:[function(t,e,r){"use strict";function n(t){var e,r,n,i=t.length,a=0;for(e=0;e>>1;if(!(s<=0)){var l,u=h.mallocDouble(2*s*a),c=h.mallocInt32(a);if(a=i(t,s,u,c),a>0){if(1===s&&n)f.init(a),l=f.sweepComplete(s,r,0,a,u,c,0,a,u,c);else{var p=h.mallocDouble(2*s*o),g=h.mallocInt32(o);o=i(e,s,p,g),o>0&&(f.init(a+o),l=1===s?f.sweepBipartite(s,r,0,a,u,c,0,o,p,g):d(s,r,n,a,u,c,o,p,g),h.free(p),h.free(g))}h.free(u),h.free(c)}return l}}}function o(t,e){c.push([t,e])}function s(t){return c=[],a(t,t,o,!0),c}function l(t,e){return c=[],a(t,e,o,!1),c}function u(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?a(t,t,e,!0):l(t,e);case 3:return a(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}}e.exports=u;var c,h=t("typedarray-pool"),f=t("./lib/sweep"),d=t("./lib/intersect")},{"./lib/intersect":59,"./lib/sweep":63,"typedarray-pool":496}],58:[function(t,e,r){"use strict";function n(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),i=["function ",n,"(",w.join(),"){","var ",u,"=2*",a,";"],l="for(var i="+c+","+p+"="+u+"*"+c+";i<"+h+";++i,"+p+"+="+u+"){var x0="+f+"["+o+"+"+p+"],x1="+f+"["+o+"+"+p+"+"+a+"],xi="+d+"[i];",M="for(var j="+g+","+x+"="+u+"*"+g+";j<"+m+";++j,"+x+"+="+u+"){var y0="+v+"["+o+"+"+x+"],"+(r?"y1="+v+"["+o+"+"+x+"+"+a+"],":"")+"yi="+y+"[j];";return t?i.push(l,_,":",M):i.push(M,_,":",l),r?i.push("if(y1"+m+"-"+g+"){"),t?(e(!0,!1),o.push("}else{"),e(!1,!1)):(o.push("if("+l+"){"),e(!0,!0),o.push("}else{"),e(!0,!1),o.push("}}else{if("+l+"){"),e(!1,!0),o.push("}else{"),e(!1,!1),o.push("}")),o.push("}}return "+r);var s=i.join("")+o.join(""),u=new Function(s);return u()}var a="d",o="ax",s="vv",l="fp",u="es",c="rs",h="re",f="rb",d="ri",p="rp",g="bs",m="be",v="bb",y="bi",x="bp",b="rv",_="Q",w=[a,o,s,c,h,f,d,g,m,v,y];r.partial=i(!1),r.full=i(!0)},{}],59:[function(t,e,r){"use strict";function n(t,e){var r=8*u.log2(e+1)*(t+1)|0,n=u.nextPow2(k*r);S.length0;){C-=1;var P=C*k,D=S[P],R=S[P+1],O=S[P+2],F=S[P+3],j=S[P+4],N=S[P+5],B=C*T,U=L[B],V=L[B+1],q=1&N,H=!!(16&N),G=l,X=u,Y=g,W=E;if(q&&(G=g,X=E,Y=l,W=u),!(2&N&&(O=_(t,D,R,O,G,X,V),R>=O)||4&N&&(R=w(t,D,R,O,G,X,U),R>=O))){var Z=O-R,Q=j-F;if(H){if(t*Z*(Z+Q)=p0)&&!(p1>=hi)",["p0","p1"]),b=g("lo===p0",["p0"]),_=g("lor&&i[h+e]>u;--c,h-=o){for(var f=h,d=h+o,p=0;p>>1,f=2*t,d=h,p=a[f*h+e];u=x?(d=y,p=x):v>=_?(d=m,p=v):(d=b,p=_):x>=_?(d=y,p=x):_>=v?(d=m,p=v):(d=b,p=_);for(var w=f*(c-1),M=f*d,A=0;A=0&&n.push("lo=e[k+n]"),t.indexOf("hi")>=0&&n.push("hi=e[k+o]"),r.push(i.replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}e.exports=n;var i="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],62:[function(t,e,r){"use strict";function n(t,e){e<=4*f?i(0,e-1,t):h(0,e-1,t)}function i(t,e,r){for(var n=2*(t+1),i=t+1;i<=e;++i){for(var a=r[n++],o=r[n++],s=i,l=n-2;s-- >t;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function c(t,e,r,n){t*=2;var i=n[t];return i>1,m=g-n,v=g+n,y=d,x=m,b=g,_=v,w=p,M=t+1,A=e-1,k=0;u(y,x,r)&&(k=y,y=x,x=k),u(_,w,r)&&(k=_,_=w,w=k),u(y,b,r)&&(k=y,y=b,b=k),u(x,b,r)&&(k=x,x=b,b=k),u(y,_,r)&&(k=y,y=_,_=k),u(b,_,r)&&(k=b,b=_,_=k),u(x,w,r)&&(k=x,x=w,w=k),u(x,b,r)&&(k=x,x=b,b=k),u(_,w,r)&&(k=_,_=w,w=k);for(var T=r[2*x],E=r[2*x+1],S=r[2*_],L=r[2*_+1],z=2*y,C=2*b,I=2*w,P=2*d,D=2*g,R=2*p,O=0;O<2;++O){var F=r[z+O],j=r[C+O],N=r[I+O];r[P+O]=F,r[D+O]=j,r[R+O]=N}o(m,t,r),o(v,e,r);for(var B=M;B<=A;++B)if(c(B,T,E,r))B!==M&&a(B,M,r),++M;else if(!c(B,S,L,r))for(;;){if(c(A,S,L,r)){c(A,T,E,r)?(s(B,M,A,r),++M,--A):(a(B,A,r),--A);break}if(--A>>1;f(_,E);for(var S=0,L=0,M=0;M=d)z=z-d|0,i(v,y,L--,z);else if(z>=0)i(g,m,S--,z);else if(z<=-d){z=-z-d|0;for(var C=0;C>>1;f(_,S);for(var L=0,z=0,C=0,A=0;A>1===_[2*A+3]>>1&&(P=2,A+=1),I<0){for(var D=-(I>>1)-1,R=0;R>1)-1;0===P?i(g,m,L--,D):1===P?i(v,y,z--,D):2===P&&i(x,b,C--,D)}}}function l(t,e,r,n,o,s,l,u,c,h,p,v){var y=0,x=2*t,b=e,w=e+t,M=1,A=1;n?A=d:M=d;for(var k=o;k>>1;f(_,L);for(var z=0,k=0;k=d?(I=!n,T-=d):(I=!!n,T-=1),I)a(g,m,z++,T);else{var P=v[T],D=x*T,R=p[D+e+1],O=p[D+e+1+t];t:for(var F=0;F>>1;f(_,M);for(var A=0,y=0;y=d)g[A++]=x-d;else{x-=1;var T=c[x],E=p*x,S=u[E+e+1],L=u[E+e+1+t];t:for(var z=0;z=0;--z)if(g[z]===x){for(var D=z+1;D=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function m(t){return+t!=t&&(t=0),o.alloc(+t)}function v(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))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 G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(n)return G(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return L(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return I(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function x(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(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),r=+r,isNaN(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=o.from(e,n)),o.isBuffer(e))return 0===e.length?-1:_(t,e,r,n,i);if("number"==typeof e)return e=255&e,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function _(t,e,r,n,i){function a(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,s=t.length,l=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"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}var u;if(i){var c=-1;for(u=r;us&&(r=s-l),u=r;u>=0;u--){for(var h=!0,f=0;fi&&(n=i)):n=i;var a=e.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o239?4:a>223?3:a>191?2:1;if(i+s<=r){var l,u,c,h;switch(s){case 1:a<128&&(o=a);break;case 2:l=t[i+1],128===(192&l)&&(h=(31&a)<<6|63&l,h>127&&(o=h));break;case 3:l=t[i+1],u=t[i+2],128===(192&l)&&128===(192&u)&&(h=(15&a)<<12|(63&l)<<6|63&u,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:l=t[i+1],u=t[i+2],c=t[i+3],128===(192&l)&&128===(192&u)&&128===(192&c)&&(h=(15&a)<<18|(63&l)<<12|(63&u)<<6|63&c,h>65535&&h<1114112&&(o=h))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return z(n)}function z(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,i,a){if(!o.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 F(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,a=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function j(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,a=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function N(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 B(t,e,r,n,i){return i||N(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,i){return i||N(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(t,e,r,n,52,8),r+8}function V(t){if(t=q(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function q(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function H(t){return t<16?"0"+t.toString(16):t.toString(16)}function G(t,e){e=e||1/0;for(var r,n=t.length,i=null,a=[],o=0;o55295&&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=(i-55296<<10|r-56320)+65536}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 X(t){for(var e=[],r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function W(t){return K.toByteArray(V(t))}function Z(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Q(t){return t!==t}var K=t("base64-js"),$=t("ieee754"),J=t("isarray");r.Buffer=o,r.SlowBuffer=m,r.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),r.kMaxLength=i(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,r){return s(null,t,e,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,r){return u(null,t,e,r)},o.allocUnsafe=function(t){return c(null,t)},o.allocUnsafeSlow=function(t){return c(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},o.prototype.compare=function(t,e,r,n,i){if(!o.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,s=r-e,l=Math.min(a,s),u=this.slice(n,i),c=t.slice(e,r),h=0;hi)&&(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 w(this,t,e,r);case"utf8":case"utf-8":return M(this,t,e,r);case"ascii":return A(this,t,e,r);case"latin1":case"binary":return k(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||R(t,e,this.length);for(var n=this[t],i=1,a=0;++a=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||R(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a},o.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},o.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),$.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),$.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),$.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),$.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e=0|e,r=0|r,!n){var i=Math.pow(2,8*r)-1;O(this,t,e,r,i,0)}var a=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+a]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e=0|e,r||O(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=0|e,r||O(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=0|e,r||O(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=0|e,r||O(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):j(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=0|e,r||O(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);O(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},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);O(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},o.prototype.writeInt8=function(t,e,r){return t=+t,e=0|e,r||O(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e=0|e,r||O(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e=0|e,r||O(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e=0|e,r||O(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):j(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e=0|e,r||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var a;if("number"==typeof t)for(a=e;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function a(t){var e,r,i,a,o,s,l=t.length;o=n(t),s=new h(3*l/4-o),i=o>0?l-4:l;var u=0;for(e=0,r=0;e>16&255,s[u++]=a>>8&255,s[u++]=255&a;return 2===o?(a=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,s[u++]=255&a):1===o&&(a=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,s[u++]=a>>8&255,s[u++]=255&a),s}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var n,i=[],a=e;ac?c:l+o));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),a.push(i),a.join("")}r.byteLength=i,r.toByteArray=a,r.fromByteArray=l;for(var u=[],c=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=f.length;d0;){for(var c=r.pop(),s=r.pop(),h=-1,f=-1,l=o[s],p=1;p=0||(e.flip(s,c),n(t,e,r,h,s,f),n(t,e,r,s,f,h),n(t,e,r,f,c,h),n(t,e,r,c,h,f))}}var a=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=i},{"binary-search-bounds":72,"robust-in-sphere":463}],69:[function(t,e,r){"use strict";function n(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 i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function a(t,e){for(var r=t.cells(),a=r.length,o=0;o0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-i){u[d]=i;for(var p=(c[d],0);p<3;++p){var g=f[3*d+p];g>=0&&0===u[g]&&(h[3*d+p]?l.push(g):(s.push(g),u[g]=i))}}}var m=l;l=s,s=m,l.length=0,i=-i}var v=o(c,u,e);return r?v.concat(n.boundary):v}var l=t("binary-search-bounds");e.exports=s;var u=n.prototype;u.locate=function(){var t=[0,0,0];return function(e,r,n){var a=e,o=r,s=n;return r1&&d(r[c[h-2]],r[c[h-1]],n)>0;)t.push([c[h-1],c[h-2],i]),h-=1;c.length=h,c.push(i);for(var p=u.upperIds,h=p.length;h>1&&d(r[p[h-2]],r[p[h-1]],n)<0;)t.push([p[h-2],p[h-1],i]),h-=1;p.length=h,p.push(i)}}function l(t,e){var r;return(r=t.a[0]v[0]&&l.push(new i(v,d,m,h),new i(d,v,g,h))}l.sort(a);for(var y=l[0].a[0]-(1+Math.abs(l[0].a[0]))*Math.pow(2,-52),x=[new n([y,1],[y,0],-1,[],[],[],[])],b=[],h=0,_=l.length;h<_;++h){var w=l[h],M=w.type;M===p?s(b,x,t,w.a,w.idx):M===m?u(x,t,w):c(x,t,w)}return b}var f=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,g=1,m=2;e.exports=h},{"binary-search-bounds":72,"robust-orientation":465}],71:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function i(t,e,r){for(var n=1,i=t.length;n=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;i(n[t],e,r),i(n[e],r,t),i(n[r],t,e)},s.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},s.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;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){var a=new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""));return a()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],73:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;r0?[w(e,-(1/0)),e]:[e,e]}function i(t,e){for(var r=new Array(e.length),n=0;n=t.length)return o[e-t.length];var r=t[e];return[y(r[0]),y(r[1])]}for(var o=[],s=0;s=0;--s){var g=n[s],u=g[0],m=e[u],v=m[0],b=m[1],w=t[v],A=t[b];if((w[0]-A[0]||w[1]-A[1])<0){var k=v;v=b,b=k}m[0]=v;var T,E=m[1]=g[1];for(i&&(T=m[2]);s>0&&n[s-1][0]===u;){var g=n[--s],S=g[1];i?e.push([E,S,T]):e.push([E,S]),E=S}i?e.push([E,b,T]):e.push([E,b])}return o}function u(t,e,r){for(var i=t.length+e.length,a=new g(i),o=r,s=0;se[2]?1:0}function f(t,e,r){if(0!==t.length){if(e)for(var n=0;n0||d.length>0)}function p(t,e,r){var n,i=!1;if(r){n=e;for(var a=new Array(e.length),o=0;op)throw new Error(f+" map requires nshades to be at least size "+h.length);for(m=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:s(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=h.map(function(t){return Math.round(t.index*p)}),m[0]<0&&(m[0]=0),m[1]<0&&(m[0]=0),m[0]>1&&(m[0]=1),m[1]>1&&(m[0]=1),y=0;y=0&&r[3]<=1||(r[3]=m[0]+(m[1]-m[0])*v);for(y=0;y=0}function i(t,e,r,i){var s=a(e,r,i);if(0===s){var l=o(a(t,e,r)),u=o(a(t,e,i));if(l===u){if(0===l){var c=n(t,e,r),h=n(t,e,i);return c===h?0:c?1:-1}return 0}return 0===u?l>0?-1:n(t,e,i)?-1:1:0===l?u>0?1:n(t,e,r)?1:-1:o(u-l)}var f=a(t,e,r);if(f>0)return s>0&&a(t,e,i)>0?1:-1;if(f<0)return s>0||a(t,e,i)>0?1:-1;var d=a(t,e,i);return d>0?1:n(t,e,r)?1:-1}e.exports=i;var a=t("robust-orientation"),o=t("signum"),s=t("two-sum"),l=t("robust-product"),u=t("robust-sum")},{"robust-orientation":465,"robust-product":466,"robust-sum":470,signum:472,"two-sum":495}],82:[function(t,e,r){function n(t,e){return t-e}function i(t,e){var r=t.length,i=t.length-e.length;if(i)return i;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||a(t[0],t[1])-a(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];if(i=o+t[2]-(s+e[2]))return i;var l=a(t[0],t[1]),u=a(e[0],e[1]);return a(l,t[2])-a(u,e[2])||a(l+t[2],o)-a(u+e[2],s);case 4:var c=t[0],h=t[1],f=t[2],d=t[3],p=e[0],g=e[1],m=e[2],v=e[3];return c+h+f+d-(p+g+m+v)||a(c,h,f,d)-a(p,g,m,v,p)||a(c+h,c+f,c+d,h+f,h+d,f+d)-a(p+g,p+m,p+v,g+m,g+v,m+v)||a(c+h+f,c+h+d,c+f+d,h+f+d)-a(p+g+m,p+g+v,p+m+v,g+m+v);default:for(var y=t.slice().sort(n),x=e.slice().sort(n),b=0;bt[r][0]&&(r=n);return er?[[r],[e]]:[[e]]}e.exports=n},{}],86:[function(t,e,r){"use strict";function n(t){var e=i(t),r=e.length;if(r<=2)return[];for(var n=new Array(r),a=e[r-1],o=0;o=e[l]&&(s+=1);a[o]=s}}return t}function a(t,e){try{return o(t,!0)}catch(u){var r=s(t);if(r.length<=e)return[];var a=n(t,r),l=o(a,!0);return i(l,r)}}e.exports=a;var o=t("incremental-convex-hull"),s=t("affine-hull")},{"affine-hull":30,"incremental-convex-hull":254}],88:[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",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CPV:"verde",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",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bdr|\\bdr.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",COG:"^(?!.*\\bdem)(?!.*\\bdr)(?!.*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",CZE:"^(?=.*rep).*czech|czechia|bohemia",CSK:"czechoslovakia",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",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).*\\bkorea|^(?=.*people).*\\bkorea|^(?=.*north).*\\bkorea|dprk",KOR:"^(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea",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)",MKD:"macedonia|fyrom",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:"micronesia",MDA:"moldov|b(a|e)ssarabia",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",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:"\\bs\\w*.?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",TZA:"tanzania",THA:"thailand|\\bsiam",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\\.?$",USA:"united.?states|\\bu\\.?s\\.?a\\.?\\b|\\bu\\.?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"}},{}],89:[function(t,e,r){function n(t){return t=Math.round(t),t<0?0:t>255?255:t}function i(t){return t<0?0:t>1?1:t}function a(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return i("%"===t[t.length-1]?parseFloat(t)/100: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}function l(t){var e=t.replace(/ /g,"").toLowerCase();if(e in u)return u[e].slice();if("#"===e[0]){if(4===e.length){var r=parseInt(e.substr(1),16);return r>=0&&r<=4095?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null}if(7===e.length){var r=parseInt(e.substr(1),16);return r>=0&&r<=16777215?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null}return null}var i=e.indexOf("("),l=e.indexOf(")");if(i!==-1&&l+1===e.length){var c=e.substr(0,i),h=e.substr(i+1,l-(i+1)).split(","),f=1;switch(c){case"rgba":if(4!==h.length)return null;f=o(h.pop());case"rgb":return 3!==h.length?null:[a(h[0]),a(h[1]),a(h[2]),f];case"hsla":if(4!==h.length)return null;f=o(h.pop());case"hsl":if(3!==h.length)return null;var d=(parseFloat(h[0])%360+360)%360/360,p=o(h[1]),g=o(h[2]),m=g<=.5?g*(p+1):g+p-g*p,v=2*g-m;return[n(255*s(v,m,d+1/3)),n(255*s(v,m,d)),n(255*s(v,m,d-1/3)),f];default:return null}}return null}var u={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=l}catch(t){}},{}],90:[function(t,e,r){"use strict";function n(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,u=3*i*i-2*i;if(t.length){a||(a=new Array(t.length));for(var c=t.length-1;c>=0;--c)a[c]=o*t[c]+s*e[c]+l*r[c]+u*n[c];return a}return o*t+s*e+l*r[c]+u*n}function i(t,e,r,n,i,a){var o=i-1,s=i*i,l=o*o,u=(1+2*i)*l,c=i*l,h=s*(3-2*i),f=s*o;if(t.length){a||(a=new Array(t.length));for(var d=t.length-1;d>=0;--d)a[d]=u*t[d]+c*e[d]+h*r[d]+f*n[d];return a}return u*t+c*e+h*r+f*n}e.exports=i,e.exports.derivative=n},{}],91:[function(t,e,r){"use strict";function n(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function i(t){var e=new n;e.pre=t.pre,e.body=t.body,e.post=t.post;var r=t.args.slice(0);e.argTypes=r;for(var i=0;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"===o)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===o){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"===o){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,a(e)}var a=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":93}],92:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,h=0;for(n=0;n=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",h,"]-=s",h].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r,i){for(var a=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],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("")),l&&u.push(["index[",e[c],"]=j",c].join(""));for(var c=0;c0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}function l(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,l=new Array(t.arrayArgs.length),c=new Array(t.arrayArgs.length),h=0;h0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),h=0;h3&&b.push(o(t.pre,t,c));var T=o(t.body,t,c),E=a(m);E3&&b.push(o(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+b.join("\n")+"\n----------");var S=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(c)].join(""),L=new Function(["function ",S,"(",x.join(","),"){",b.join("\n"),"} return ",S].join(""));return L()}var u=t("uniq");e.exports=l},{uniq:498}],93:[function(t,e,r){"use strict";function n(t){var e=["'use strict'","var CACHED={}"],r=[],n=t.funcName+"_cwise_thunk";e.push(["return function ",n,"(",t.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],u=[],c=0;c0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+h+".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"+h+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[c])+"]"))}t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+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}function a(t){return null===t?NaN:+t}function o(t){return!isNaN(t)}function s(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);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}}}function l(t){return t.length}function u(t){for(var e=1;t*e%1;)e*=10;return e}function c(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function h(){this._=Object.create(null)}function f(t){return(t+="")===_o||t[0]===wo?wo+t:t}function d(t){return(t+="")[0]===wo?t.slice(1):t}function p(t){return f(t)in this._}function g(t){return(t=f(t))in this._&&delete this._[t]}function m(){var t=[];for(var e in this._)t.push(d(e));return t}function v(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function x(){this._=Object.create(null)}function b(t){return t}function _(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=Mo.length;r=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Po.get(t);return u&&(t=u,l=Q),s?e?i:n:e?M:a}function Z(t,e){return function(r){var n=uo.event;uo.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.event=n}}}function Q(t,e){var r=Z(t,e);return function(t){var e=this,n=t.relatedTarget;n&&(n===e||8&n.compareDocumentPosition(e))||r.call(e,t)}}function K(t){var r=".dragsuppress-"+ ++Ro,i="click"+r,a=uo.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Do&&(Do=!("onselectstart"in t)&&w(t.style,"userSelect")),Do){var o=e(t).style,s=o[Do];o[Do]="none"}return function(t){if(a.on(r,null),Do&&(o[Do]=s),t){var e=function(){a.on(i,null)};a.on(i,function(){T(),e()},!0),setTimeout(e,0)}}}function $(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(Oo<0){var a=n(t);if(a.scrollX||a.scrollY){r=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();Oo=!(o.f||o.e),r.remove()}}return Oo?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function J(){return uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function rt(t){return t>1?0:t<-1?No:Math.acos(t)}function nt(t){return t>1?Vo:t<-1?-Vo:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function at(t){return((t=Math.exp(t))+1/t)/2}function ot(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ut(t,e,r){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):Mt(""+t,At,ut):new ut(t,e,r)}function ct(t,e,r){function n(t){return t>360?t-=360:t<0&&(t+=360),t<60?a+(o-a)*t/60:t<180?o:t<240?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*n(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,o=r<=.5?r*(1+e):r+e-r*e,a=2*r-o,new xt(i(t+120),i(t),i(t-120))}function ht(t,e,r){return this instanceof ht?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ht?new ht(t.h,t.c,t.l):t instanceof dt?gt(t.l,t.a,t.b):gt((t=kt((t=uo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ht(t,e,r)}function ft(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(r,Math.cos(t*=qo)*e,Math.sin(t)*e)}function dt(t,e,r){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof ht?ft(t.h,t.c,t.l):kt((t=xt(t)).r,t.g,t.b):new dt(t,e,r)}function pt(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return i=mt(i)*ts,n=mt(n)*es,a=mt(a)*rs,new xt(yt(3.2404542*i-1.5371385*n-.4985314*a),yt(-.969266*i+1.8760108*n+.041556*a),yt(.0556434*i-.2040259*n+1.0572252*a))}function gt(t,e,r){return t>0?new ht(Math.atan2(r,e)*Ho,Math.sqrt(e*e+r*r),t):new ht(NaN,NaN,t)}function mt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function vt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function xt(t,e,r){return this instanceof xt?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof xt?new xt(t.r,t.g,t.b):Mt(""+t,xt,ct):new xt(t,e,r)}function bt(t){return new xt(t>>16,t>>8&255,255&t)}function _t(t){return bt(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(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(Et(i[0]),Et(i[1]),Et(i[2]))}return(a=as.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|o,s=240&a,s=s>>4|s,l=15&a,l=l<<4|l):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function At(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 kt(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=vt((.4124564*t+.3575761*e+.1804375*r)/ts),i=vt((.2126729*t+.7151522*e+.072175*r)/es),a=vt((.0193339*t+.119192*e+.9503041*r)/rs);return dt(116*i-16,500*(n-i),200*(i-a))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Et(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function St(t){return"function"==typeof t?t:function(){return t}}function Lt(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),zt(e,r,t,n)}}function zt(t,e,r,n){function i(){var t,e=l.status;if(!e&&It(l)||e>=200&&e<300||304===e){try{t=r.call(a,l)}catch(t){return void o.error.call(a,t)}o.load.call(a,t)}else o.error.call(a,l)}var a={},o=uo.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=uo.event;uo.event=t;try{o.progress.call(a,l)}finally{uo.event=e}},a.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",a)},a.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",a):e},a.responseType=function(t){return arguments.length?(u=t,a):u},a.response=function(t){return r=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(ho(arguments)))}}),a.send=function(r,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),l.open(r,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=u&&(l.responseType=u),null!=i&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==n?null:n),a},a.abort=function(){return l.abort(),a},uo.rebind(a,o,"on"),null==n?a:a.get(Ct(n))}function Ct(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function It(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Pt(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var i=r+e,a={c:t,t:i,n:null};return ss?ss.n=a:os=a,ss=a,ls||(us=clearTimeout(us),ls=1,cs(Dt)),a}function Dt(){var t=Rt(),e=Ot()-t;e>24?(isFinite(e)&&(clearTimeout(us),us=setTimeout(Dt,e)),ls=0):(ls=1,cs(Dt))}function Rt(){for(var t=Date.now(),e=os;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ot(){for(var t,e=os,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Nt(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,a=n&&r?function(t,e){for(var i=t.length,a=[],o=0,s=n[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=n[o=(o+1)%n.length];return a.reverse().join(r)}:b;return function(t){var r=fs.exec(t),n=r[1]||" ",o=r[2]||">",s=r[3]||"-",l=r[4]||"",u=r[5],c=+r[6],h=r[7],f=r[8],d=r[9],p=1,g="",m="",v=!1,y=!0;switch(f&&(f=+f.substring(1)),(u||"0"===n&&"="===o)&&(u=n="0",o="="),d){case"n":h=!0,d="g";break;case"%":p=100,m="%",d="f";break;case"p":p=100,m="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":y=!1;case"d":v=!0,f=0;break;case"s":p=-1,d="r"}"$"===l&&(g=i[0],m=i[1]),"r"!=d||f||(d="g"),null!=f&&("g"==d?f=Math.max(1,Math.min(21,f)):"e"!=d&&"f"!=d||(f=Math.max(0,Math.min(20,f)))),d=ds.get(d)||Bt;var x=u&&h;return function(t){var r=m;if(v&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=uo.formatPrefix(t,f);t=l.scale(t),r=l.symbol+m}else t*=p;t=d(t,f);var b,_,w=t.lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(b=t,_=""):(b=t.substring(0,M),_=t.substring(M))}else b=t.substring(0,w),_=e+t.substring(w+1);!u&&h&&(b=a(b,1/0));var A=g.length+b.length+_.length+(x?0:i.length),k=A"===o?k+i+t:"^"===o?k.substring(0,A>>=1)+i+t+k.substring(A):i+(x?t:k+t))+r}}}function Bt(t){return t+""}function Ut(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Vt(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o=u)return-1;if(i=e.charCodeAt(s++),37===i){if(o=e.charAt(s++),a=L[o in vs?e.charAt(s++):o],!a||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}function n(t,e,r){w.lastIndex=0;var n=w.exec(e.slice(r));return n?(t.w=M.get(n[0].toLowerCase()),r+n[0].length):-1}function i(t,e,r){b.lastIndex=0;var n=b.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=E.get(n[0].toLowerCase()),r+n[0].length):-1}function o(t,e,r){A.lastIndex=0;var n=A.exec(e.slice(r));return n?(t.m=k.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,S.c.toString(),e,n)}function l(t,e,n){return r(t,S.x.toString(),e,n)}function u(t,e,n){return r(t,S.X.toString(),e,n)}function c(t,e,r){var n=x.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)}var h=t.dateTime,f=t.date,d=t.time,p=t.periods,g=t.days,m=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{gs=Ut;var e=new gs;return e._=t,n(e)}finally{gs=Date}}var n=e(t);return r.parse=function(t){try{gs=Ut;var e=n.parse(t);return e&&e._}finally{gs=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var x=uo.map(),b=Xt(g),_=Yt(g),w=Xt(m),M=Yt(m),A=Xt(v),k=Yt(v),T=Xt(y),E=Yt(y);p.forEach(function(t,e){x.set(t.toLowerCase(),e)});var S={a:function(t){return m[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(h),d:function(t,e){return Gt(t.getDate(),e,2)},e:function(t,e){return Gt(t.getDate(),e,2)},H:function(t,e){return Gt(t.getHours(),e,2)},I:function(t,e){return Gt(t.getHours()%12||12,e,2)},j:function(t,e){return Gt(1+ps.dayOfYear(t),e,3)},L:function(t,e){ -return Gt(t.getMilliseconds(),e,3)},m:function(t,e){return Gt(t.getMonth()+1,e,2)},M:function(t,e){return Gt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Gt(t.getSeconds(),e,2)},U:function(t,e){return Gt(ps.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(ps.mondayOfYear(t),e,2)},x:e(f),X:e(d),y:function(t,e){return Gt(t.getFullYear()%100,e,2)},Y:function(t,e){return Gt(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},L={a:n,A:i,b:a,B:o,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:ae,p:c,S:oe,U:Zt,w:Wt,W:Qt,x:l,X:u,y:$t,Y:Kt,Z:Jt,"%":ue};return e}function Gt(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3)}function ee(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ae(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function le(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=bo(e)/60|0,i=bo(e)%60;return r+Gt(n,"0",2)+Gt(i,"0",2)}function ue(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function ce(t){for(var e=t.length,r=-1;++r=0?1:-1,s=o*r,l=Math.cos(e),u=Math.sin(e),c=a*u,h=i*l+c*Math.cos(s),f=c*o*Math.sin(s);ks.add(Math.atan2(f,h)),n=t,i=l,a=u}var e,r,n,i,a;Ts.point=function(o,s){Ts.point=t,n=(e=o)*qo,i=Math.cos(s=(r=s)*qo/2+No/4),a=Math.sin(s)},Ts.lineEnd=function(){t(e,r)}}function ve(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 be(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Me(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function Ae(t,e){return bo(t[0]-e[0])=0;--s)i.point((h=c[s])[0],h[1])}else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);i.lineEnd()}}}function Pe(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n0){for(_||(a.polygonStart(),_=!0),a.lineStart();++o1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(Oe))}var d,p,g,m=e(a),v=i.invert(n[0],n[1]),y={point:o,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=h,y.lineEnd=f,d=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=l,y.lineEnd=u,d=uo.merge(d);var t=Ve(v,p);d.length?(_||(a.polygonStart(),_=!0),Ie(d,je,t,r,a)):t&&(_||(a.polygonStart(),_=!0),a.lineStart(),r(null,null,1,a),a.lineEnd()),_&&(a.polygonEnd(),_=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),r(null,null,1,a),a.lineEnd(),a.polygonEnd()}},x=Fe(),b=e(x),_=!1;return y}}function Oe(t){return t.length>1}function Fe(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:M,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function je(t,e){return((t=t.x)[0]<0?t[1]-Vo-Fo:Vo-t[1])-((e=e.x)[0]<0?e[1]-Vo-Fo:Vo-e[1])}function Ne(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?No:-No,l=bo(a-r);bo(l-No)0?Vo:-Vo),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=No&&(bo(r-i)Fo?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}function Ue(t,e,r,n){var i;if(null==t)i=r*Vo,n.point(-No,i),n.point(0,i),n.point(No,i),n.point(No,0),n.point(No,-i),n.point(0,-i),n.point(-No,-i),n.point(-No,0),n.point(-No,i);else if(bo(t[0]-e[0])>Fo){var a=t[0]=0?1:-1,M=w*_,A=M>No,k=p*x;if(ks.add(Math.atan2(k*w*Math.sin(M),g*b+k*Math.cos(M))),a+=A?_+w*Bo:_,A^f>=r^v>=r){var T=xe(ve(h),ve(t));we(T);var E=xe(i,T);we(E);var S=(A^_>=0?-1:1)*nt(E[2]);(n>S||n===S&&(T[0]||T[1]))&&(o+=A^_>=0?1:-1)}if(!m++)break;f=v,p=x,g=b,h=t}}return(a<-Fo||aa}function r(t){var r,a,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(h,f){var d,p=[h,f],g=e(h,f),m=o?g?0:i(h,f):g?i(h+(h<0?No:-No),f):0;if(!r&&(u=l=g)&&t.lineStart(),g!==l&&(d=n(r,p),(Ae(r,d)||Ae(p,d))&&(p[0]+=Fo,p[1]+=Fo,g=e(p[0],p[1]))),g!==l)c=0,g?(t.lineStart(),d=n(p,r),t.point(d[0],d[1])):(d=n(r,p),t.point(d[0],d[1]),t.lineEnd()),r=d;else if(s&&r&&o^g){var v;m&a||!(v=n(p,r,!0))||(c=0,o?(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||r&&Ae(r,p)||t.point(p[0],p[1]),r=p,l=g,a=m},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=ve(t),i=ve(e),o=[1,0,0],s=xe(n,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var h=a*l/c,f=-a*u/c,d=xe(o,s),p=_e(o,h),g=_e(s,f);be(p,g);var m=d,v=ye(p,m),y=ye(m,m),x=v*v-y*(ye(p,p)-1);if(!(x<0)){var b=Math.sqrt(x),_=_e(m,(-v-b)/y);if(be(_,p),_=Me(_),!r)return _;var w,M=t[0],A=e[0],k=t[1],T=e[1];A0^_[1]<(bo(_[0]-M)No^(M<=_[0]&&_[0]<=A)){var z=_e(m,(-v+b)/y);return be(z,p),[_,Me(z)]}}}function i(e,r){var n=o?t:No-t,i=0;return e<-n?i|=1:e>n&&(i|=2),r<-n?i|=4:r>n&&(i|=8),i}var a=Math.cos(t),o=a>0,s=bo(a)>Fo,l=mr(t,6*qo);return Re(e,r,l,o?[0,-t]:[-No,t-No])}function He(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=s.x,h=s.y,f=0,d=1,p=c-l,g=h-u;if(a=t-l,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>d)return;a>f&&(f=a)}if(a=r-l,p||!(a<0)){if(a/=p,p<0){if(a>d)return;a>f&&(f=a)}else if(p>0){if(a0)){if(a/=g,g<0){if(a0){if(a>d)return;a>f&&(f=a)}if(a=n-u,g||!(a<0)){if(a/=g,g<0){if(a>d)return;a>f&&(f=a)}else if(g>0){if(a0&&(i.a={x:l+f*p,y:u+f*g}),d<1&&(i.b={x:l+d*p,y:u+d*g}),i}}}}}}function Ge(t,e,r,n){function i(n,i){return bo(n[0]-t)0?0:3:bo(n[0]-r)0?2:1:bo(n[1]-e)0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(t,e){var r=i(t,1),n=i(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,r=m.length,n=t[1],i=0;in&&et(u,a,t)>0&&++e:a[1]<=n&&et(u,a,t)<0&&--e,u=a;return 0!==e}function u(a,s,l,u){var c=0,h=0;if(null==a||(c=i(a,l))!==(h=i(s,l))||o(a,s)<0^l>0){do u.point(0===c||3===c?t:r,c>1?n:e);while((c=(c+l+4)%4)!==h)}else u.point(s[0],s[1])}function c(i,a){return t<=i&&i<=r&&e<=a&&a<=n}function h(t,e){c(t,e)&&s.point(t,e)}function f(){L.point=p,m&&m.push(v=[]),A=!0,M=!1,_=w=NaN}function d(){g&&(p(y,x),b&&M&&E.rejoin(),g.push(E.buffer())),L.point=h,M&&s.lineEnd()}function p(t,e){t=Math.max(-Bs,Math.min(Bs,t)),e=Math.max(-Bs,Math.min(Bs,e));var r=c(t,e);if(m&&v.push([t,e]),A)y=t,x=e,b=r,A=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&M)s.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};S(n)?(M||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),k=!1):r&&(s.lineStart(),s.point(t,e),k=!1)}_=t,w=e,M=r}var g,m,v,y,x,b,_,w,M,A,k,T=s,E=Fe(),S=He(t,e,r,n),L={point:h,lineStart:f,lineEnd:d,polygonStart:function(){s=E,g=[],m=[],k=!0},polygonEnd:function(){s=T,g=uo.merge(g);var e=l([t,n]),r=k&&e,i=g.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Ie(g,a,e,u,s),s.polygonEnd()),g=m=v=null}};return L}}function Xe(t){var e=0,r=No/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*No/180,r=t[1]*No/180):[e/No*180,r/No*180]},i}function Ye(t,e){function r(t,e){var r=Math.sqrt(a-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),o-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,a=1+n*(2*i-n),o=Math.sqrt(a)/i;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,nt((a-(t*t+r*r)*i*i)/(2*i))]},r}function We(){function t(t,e){Vs+=i*t-n*e,n=t,i=e}var e,r,n,i;Ys.point=function(a,o){Ys.point=t,e=n=a,r=i=o},Ys.lineEnd=function(){t(e,r)}}function Ze(t,e){tGs&&(Gs=t),eXs&&(Xs=e)}function Qe(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=r}function r(t,e){o.push("L",t,",",e)}function n(){s.point=t}function i(){o.push("Z")}var a=Ke(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return a=Ke(t),s},result:function(){if(o.length){var t=o.join("");return o=[],t}}};return s}function Ke(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $e(t,e){Ls+=t,zs+=e,++Cs}function Je(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);Is+=o*(e+t)/2,Ps+=o*(r+n)/2,Ds+=o,$e(e=t,r=n)}var e,r;Zs.point=function(n,i){Zs.point=t,$e(e=n,r=i)}}function tr(){Zs.point=$e}function er(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Is+=o*(n+t)/2,Ps+=o*(i+e)/2,Ds+=o,o=i*t-n*e,Rs+=o*(n+t),Os+=o*(i+e),Fs+=3*o,$e(n=t,i=e)}var e,r,n,i;Zs.point=function(a,o){Zs.point=t,$e(e=n=a,r=i=o)},Zs.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+o,r),t.arc(e,r,o,0,Bo)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function i(){s.point=e}function a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:i,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return o=t,s},result:M};return s}function nr(t){function e(t){return(s?n:r)(t)}function r(e){return or(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})}function n(e){function r(r,n){r=t(r,n),e.point(r[0],r[1])}function n(){x=NaN,A.point=a,e.lineStart()}function a(r,n){var a=ve([r,n]),o=t(r,n);i(x,b,y,_,w,M,x=o[0],b=o[1],y=r,_=a[0],w=a[1],M=a[2],s,e),e.point(x,b)}function o(){A.point=r,e.lineEnd()}function l(){n(),A.point=u,A.lineEnd=c}function u(t,e){a(h=t,f=e),d=x,p=b,g=_,m=w,v=M,A.point=a}function c(){i(x,b,y,_,w,M,d,p,h,g,m,v,s,e),A.lineEnd=o,o()}var h,f,d,p,g,m,v,y,x,b,_,w,M,A={point:r,lineStart:n,lineEnd:o,polygonStart:function(){e.polygonStart(),A.lineStart=l},polygonEnd:function(){e.polygonEnd(),A.lineStart=n}};return A}function i(e,r,n,s,l,u,c,h,f,d,p,g,m,v){var y=c-e,x=h-r,b=y*y+x*x;if(b>4*a&&m--){var _=s+d,w=l+p,M=u+g,A=Math.sqrt(_*_+w*w+M*M),k=Math.asin(M/=A),T=bo(bo(M)-1)a||bo((y*z+x*C)/b-.5)>.3||s*d+l*p+u*g0&&16,e):Math.sqrt(a)},e}function ir(t){var e=nr(function(e,r){return t([e*Ho,r*Ho])});return function(t){return ur(e(t))}}function ar(t){this.stream=t}function or(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function sr(t){return lr(function(){return t})()}function lr(t){function e(t){return t=s(t[0]*qo,t[1]*qo),[t[0]*f+l,u-t[1]*f]}function r(t){return t=s.invert((t[0]-l)/f,(u-t[1])/f),t&&[t[0]*Ho,t[1]*Ho]}function n(){s=ze(o=fr(v,y,x),a);var t=a(g,m);return l=d-t[0]*f,u=p+t[1]*f,i()}function i(){return c&&(c.valid=!1,c=null),e}var a,o,s,l,u,c,h=nr(function(t,e){return t=a(t,e),[t[0]*f+l,u-t[1]*f]}),f=150,d=480,p=250,g=0,m=0,v=0,y=0,x=0,_=Ns,w=b,M=null,A=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(o,h(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(M=t,Ns):qe((M=+t)*qo),i()):M},e.clipExtent=function(t){return arguments.length?(A=t,w=t?Ge(t[0][0],t[0][1],t[1][0],t[1][1]):b,i()):A},e.scale=function(t){return arguments.length?(f=+t,n()):f},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],n()):[d,p]},e.center=function(t){return arguments.length?(g=t[0]%360*qo,m=t[1]%360*qo,n()):[g*Ho,m*Ho]},e.rotate=function(t){return arguments.length?(v=t[0]%360*qo,y=t[1]%360*qo,x=t.length>2?t[2]%360*qo:0,n()):[v*Ho,y*Ho,x*Ho]},uo.rebind(e,h,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&r,n()}}function ur(t){return or(t,function(e,r){t.point(e*qo,r*qo)})}function cr(t,e){return[t,e]}function hr(t,e){return[t>No?t-Bo:t<-No?t+Bo:t,e]}function fr(t,e,r){return t?e||r?ze(pr(t),gr(e,r)):pr(t):e||r?gr(e,r):hr}function dr(t){return function(e,r){return e+=t,[e>No?e-Bo:e<-No?e+Bo:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function gr(t,e){function r(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*n+s*i;return[Math.atan2(l*a-c*o,s*n-u*i),nt(c*a+l*o)]}var n=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*a-l*o;return[Math.atan2(l*a+u*o,s*n+c*i),nt(c*n-s*i)]},r}function mr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=vr(r,i),a=vr(r,a),(o>0?ia)&&(i+=o*Bo)):(i=t+o*Bo,a=t-.5*l);for(var u,c=i;o>0?c>a:c0?e<-Vo+Fo&&(e=-Vo+Fo):e>Vo-Fo&&(e=Vo-Fo);var r=o/Math.pow(i(e),a);return[r*Math.sin(a*t),o-r*Math.cos(a*t)]}var n=Math.cos(t),i=function(t){return Math.tan(No/4+t/2)},a=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),o=n*Math.pow(i(t),a)/a;return a?(r.invert=function(t,e){var r=o-e,n=tt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(o/n,1/a))-Vo]},r):Er}function Tr(t,e){function r(t,e){var r=a-e;return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),a=n/i+t;return bo(i)1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Pr(t,e){return t[0]-e[0]||t[1]-e[1]}function Dr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Rr(t,e,r,n){var i=t[0],a=r[0],o=e[0]-i,s=n[0]-a,l=t[1],u=r[1],c=e[1]-l,h=n[1]-u,f=(s*(l-u)-h*(i-a))/(h*o-s*c);return[i+f*o,l+f*c]}function Or(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Fr(){an(this),this.edge=this.site=this.circle=null}function jr(t){var e=ul.pop()||new Fr;return e.site=t,e}function Nr(t){Zr(t),ol.remove(t),ul.push(t),an(t)}function Br(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},a=t.P,o=t.N,s=[t];Nr(t);for(var l=a;l.circle&&bo(r-l.circle.x)Fo)s=s.L;else{if(i=a-qr(s,o),!(i>Fo)){n>-Fo?(e=s.P,r=s):i>-Fo?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=jr(t);if(ol.insert(e,l),e||r){if(e===r)return Zr(e),r=jr(e.site),ol.insert(l,r),l.edge=r.edge=Jr(e.site,l.site),Wr(e),void Wr(r);if(!r)return void(l.edge=Jr(e.site,l.site));Zr(e),Zr(r);var u=e.site,c=u.x,h=u.y,f=t.x-c,d=t.y-h,p=r.site,g=p.x-c,m=p.y-h,v=2*(f*m-d*g),y=f*f+d*d,x=g*g+m*m,b={x:(m*y-d*x)/v+c,y:(f*x-g*y)/v+h};en(r.edge,u,p,b),l.edge=Jr(u,t,null,b),r.edge=Jr(t,p,null,b),Wr(e),Wr(r)}}function Vr(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);r=o.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,h=1/a-1/u,f=c/u;return h?(-f+Math.sqrt(f*f-2*h*(c*c/(-2*u)-l+u/2+i-a/2)))/h+n:(n+s)/2}function qr(t,e){var r=t.N;if(r)return Vr(r,e);var n=t.site;return n.y===e?n.x:1/0}function Hr(t){this.site=t,this.edges=[]}function Gr(t){for(var e,r,n,i,a,o,s,l,u,c,h=t[0][0],f=t[1][0],d=t[0][1],p=t[1][1],g=al,m=g.length;m--;)if(a=g[m],a&&a.prepare())for(s=a.edges,l=s.length,o=0;oFo||bo(i-r)>Fo)&&(s.splice(o,0,new rn(tn(a.site,c,bo(n-h)Fo?{x:h,y:bo(e-h)Fo?{x:bo(r-p)Fo?{x:f,y:bo(e-f)Fo?{x:bo(r-d)=-jo)){var d=l*l+u*u,p=c*c+h*h,g=(h*d-u*p)/f,m=(l*p-c*d)/f,h=m+s,v=cl.pop()||new Yr;v.arc=t,v.site=i,v.x=g+o,v.y=h+Math.sqrt(g*g+m*m),v.cy=h,t.circle=v;for(var y=null,x=ll._;x;)if(v.y=s)return;if(f>p){if(a){if(a.y>=u)return}else a={x:m,y:l};r={x:m,y:u}}else{if(a){if(a.y1)if(f>p){if(a){if(a.y>=u)return}else a={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}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.xa||h>o||f=b,M=r>=_,A=M<<1|w,k=A+4;Aa&&(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:xn(r,n)})),a=dl.lastIndex;return a=0&&!(r=uo.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function An(t){return function(e){return 1-t(1-e)}}function kn(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Sn(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 Ln(t){return function(e){return Math.pow(e,t)}}function zn(t){return 1-Math.cos(t*Vo)}function Cn(t){return Math.pow(2,10*(t-1))}function In(t){return 1-Math.sqrt(1-t*t)}function Pn(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Bo*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Bo/e)}}function Dn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Rn(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 On(t,e){t=uo.hcl(t),e=uo.hcl(e);var r=t.h,n=t.c,i=t.l,a=e.h-r,o=e.c-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ft(r+a*t,n+o*t,i+s*t)+""}}function Fn(t,e){t=uo.hsl(t),e=uo.hsl(e);var r=t.h,n=t.s,i=t.l,a=e.h-r,o=e.s-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ct(r+a*t,n+o*t,i+s*t)+""}}function jn(t,e){t=uo.lab(t),e=uo.lab(e);var r=t.l,n=t.a,i=t.b,a=e.l-r,o=e.a-n,s=e.b-i;return function(t){return pt(r+a*t,n+o*t,i+s*t)+""}}function Nn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function Bn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Vn(e),i=Un(e,r),a=Vn(qn(r,e,-i))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(Hn(r)+"rotate(",null,")")-2,x:xn(t,e)})):e&&r.push(Hn(r)+"rotate("+e+")")}function Yn(t,e,r,n){t!==e?n.push({i:r.push(Hn(r)+"skewX(",null,")")-2,x:xn(t,e)}):e&&r.push(Hn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(Hn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:xn(t[0],e[0])},{i:i-2,x:xn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(Hn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=uo.transform(t),e=uo.transform(e),Gn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Yn(t.skew,e.skew,r,n),Wn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,a=n.length;++i=0;)r.push(i[n])}function li(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;++oi&&(n=r,i=e);return n}function xi(t){return t.reduce(bi,0)}function bi(t,e){return t+e[1]}function _i(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,a=[];++r<=e;)a[r]=i*r+n;return a}function Mi(t){return[uo.min(t),uo.max(t)]}function Ai(t,e){return t.value-e.value}function ki(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ti(t,e){t._pack_next=e,e._pack_prev=t}function Ei(t,e){var r=e.x-t.x,n=e.y-t.y,i=t.r+e.r;return.999*i*i>r*r+n*n}function Si(t){function e(t){c=Math.min(t.x-t.r,c),h=Math.max(t.x+t.r,h),f=Math.min(t.y-t.r,f),d=Math.max(t.y+t.r,d)}if((r=t.children)&&(u=r.length)){var r,n,i,a,o,s,l,u,c=1/0,h=-(1/0),f=1/0,d=-(1/0);if(r.forEach(Li),n=r[0],n.x=-n.r,n.y=0,e(n),u>1&&(i=r[1],i.x=i.r,i.y=0,e(i),u>2))for(a=r[2],Ii(n,i,a),e(a),ki(n,a),n._pack_prev=a,ki(a,i),i=n._pack_next,o=3;o=0;)e=i[a],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function ji(t,e,r){return t.a.parent===e.parent?t.a:r}function Ni(t){return 1+uo.max(t,function(t){return t.y})}function Bi(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ui(t){var e=t.children;return e&&e.length?Ui(e[0]):t}function Vi(t){var e,r=t.children;return r&&(e=r.length)?Vi(r[e-1]):t}function qi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Hi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(r+=i/2,i=0),a<0&&(n+=a/2,a=0),{x:r,y:n,dx:i,dy:a}}function Gi(t){var e=t[0],r=t[t.length-1];return e2?Qi:Yi,l=n?Kn:Qn;return o=i(t,e,l,r),s=i(e,t,l,_n),a}function a(t){return o(t)}var o,s;return a.invert=function(t){return s(t)},a.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},a.range=function(t){return arguments.length?(e=t,i()):e},a.rangeRound=function(t){return a.range(t).interpolate(Nn)},a.clamp=function(t){return arguments.length?(n=t,i()):n},a.interpolate=function(t){return arguments.length?(r=t,i()):r},a.ticks=function(e){return ea(t,e)},a.tickFormat=function(e,r){return ra(t,e,r)},a.nice=function(e){return Ji(t,e),i()},a.copy=function(){return Ki(t,e,r,n)},i()}function $i(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ji(t,e){return Wi(t,Zi(ta(t,e)[2])),Wi(t,Zi(ta(t,e)[2])),t}function ta(t,e){null==e&&(e=10);var r=Gi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),a=e/n*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function ea(t,e){return uo.range.apply(uo,ta(t,e))}function ra(t,e,r){var n=ta(t,e);if(r){var i=fs.exec(r);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(bo(n[0]),bo(n[1])));return i[7]||(i[7]="."+na(a.scale(n[2]))),i[8]="f",r=uo.format(i.join("")),function(t){return r(a.scale(t))+a.symbol}}i[7]||(i[7]="."+ia(i[8],n)),r=i.join("")}else r=",."+na(n[2])+"f";return uo.format(r)}function na(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ia(t,e){var r=na(e[2]);return t in kl?Math.abs(r-na(Math.max(bo(e[0]),bo(e[1]))))+ +("e"!==t):r-2*("%"===t)}function aa(t,e,r,n){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(i(e))}return o.invert=function(e){return a(t.invert(e))},o.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),o):e},o.nice=function(){var e=Wi(n.map(i),r?Math:El);return t.domain(e),n=e.map(a),o},o.ticks=function(){var t=Gi(n),o=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),h=e%1?2:e;if(isFinite(c-u)){if(r){for(;u0;f--)o.push(a(u)*f);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,r){if(!arguments.length)return Tl;arguments.length<2?r=Tl:"function"!=typeof r&&(r=uo.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e0?s[r-1]:t[0],r0?0:1}function ba(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,u=-s*a,c=t[0]+l,h=t[1]+u,f=e[0]+l,d=e[1]+u,p=(c+f)/2,g=(h+d)/2,m=f-c,v=d-h,y=m*m+v*v,x=r-n,b=c*d-f*h,_=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*v-m*_)/y,M=(-b*m-v*_)/y,A=(b*v+m*_)/y,k=(-b*m+v*_)/y,T=w-p,E=M-g,S=A-p,L=k-g;return T*T+E*E>S*S+L*L&&(w=A,M=k),[[w-l,M-u],[w*r/x,M*r/x]]}function _a(t){function e(e){function o(){u.push("M",a(t(c),s))}for(var l,u=[],c=[],h=-1,f=e.length,d=St(r),p=St(n);++h1?t.join("L"):t+"Z"}function Ma(t){return t.join("L")+"Z"}function Aa(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1&&i.push("H",n[0]),i.join("")}function ka(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 u=2;u9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[s+1]=i*n));for(s=-1;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}function Ua(t){return t.length<3?wa(t):t[0]+za(t,Ba(t))}function Va(t){for(var e,r,n,i=-1,a=t.length;++i0;)d[--s].call(t,o);if(a>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var l,u,c,f,d,p=t[r]||(t[r]={active:0,count:0}),g=p[n];g||(l=i.time,u=Pt(a,0,l),g=p[n]={tween:new h,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function ro(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function no(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function io(t){return t.toISOString()}function ao(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,a=uo.bisect($l,i);return a==$l.length?[e.year,ta(t.map(function(t){return t/31536e6}),r)[2]]:a?e[i/$l[a-1]<$l[a]/i?a-1:a]:[eu,ta(t,r)[2]]}return n.invert=function(e){return oo(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain(e),n):t.domain().map(oo)},n.nice=function(t,e){function r(r){return!isNaN(r)&&!t.range(r,oo(+r+1),e).length}var a=n.domain(),o=Gi(a),s=null==t?i(o,10):"number"==typeof t&&i(o,t);return s&&(t=s[0],e=s[1]),n.domain(Wi(a,e>1?{floor:function(e){for(;r(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Gi(n.domain()),a=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(r[0],oo(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return ao(t.copy(),e,r)},$i(n,t)}function oo(t){return new Date(t)}function so(t){return JSON.parse(t.responseText)}function lo(t){var e=fo.createRange();return e.selectNode(fo.body),e.createContextualFragment(t.responseText)}var uo={version:"3.5.17"},co=[].slice,ho=function(t){return co.call(t)},fo=this.document;if(fo)try{ho(fo.documentElement.childNodes)[0].nodeType}catch(t){ho=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}),fo)try{fo.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var po=this.Element.prototype,go=po.setAttribute,mo=po.setAttributeNS,vo=this.CSSStyleDeclaration.prototype,yo=vo.setProperty;po.setAttribute=function(t,e){go.call(this,t,e+"")},po.setAttributeNS=function(t,e,r){mo.call(this,t,e,r+"")},vo.setProperty=function(t,e,r){yo.call(this,t,e+"",r)}}uo.ascending=i,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.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},uo.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},uo.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 l/(c-1)},uo.deviation=function(){var t=uo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var xo=s(i);uo.bisectLeft=xo.left,uo.bisect=uo.bisectRight=xo.right,uo.bisector=function(t){return s(1===t.length?function(e,r){return i(t(e),r)}:t)},uo.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},uo.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},uo.pairs=function(t){for(var e,r=0,n=t.length-1,i=t[0],a=new Array(n<0?0:n);r=0;)for(n=t[i],e=n.length;--e>=0;)r[--o]=n[e];return r};var bo=Math.abs;uo.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=u(bo(r)),o=-1;if(t*=a,e*=a,r*=a,r<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=a.length)return n?n.call(i,o):r?o.sort(r):o;for(var l,u,c,f,d=-1,p=o.length,g=a[s++],m=new h;++d=a.length)return t;var n=[],i=o[r++];return t.forEach(function(t,i){n.push({key:t,values:e(i,r)})}),i?n.sort(function(t,e){return i(t.key,e.key)}):n}var r,n,i={},a=[],o=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(uo.map,r,0),0)},i.key=function(t){return a.push(t),i},i.sortKeys=function(t){return o[a.length-1]=t,i},i.sortValues=function(t){return r=t,i},i.rollup=function(t){return n=t,i},i},uo.set=function(t){var e=new x;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}},uo.event=null,uo.requote=function(t){return t.replace(Ao,"\\$&")};var Ao=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ko={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},To=function(t,e){return e.querySelector(t)},Eo=function(t,e){return e.querySelectorAll(t)},So=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(So=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(To=function(t,e){return Sizzle(t,e)[0]||null},Eo=Sizzle,So=Sizzle.matchesSelector),uo.selection=function(){return uo.select(fo.documentElement)};var Lo=uo.selection.prototype=[];Lo.select=function(t){var e,r,n,i,a=[];t=z(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Co.hasOwnProperty(r)?{space:Co[r],local:t}:t}},Lo.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=uo.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(I(e,t[e]));return this}return this.each(I(t,e))},Lo.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=R(t)).length,i=-1;if(e=r.classList){for(;++i=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},Lo.sort=function(t){t=H.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.transition().duration(L)),e.call(t.event)}function s(){_&&_.domain(b.range().map(function(t){return(t-A.x)/A.k}).map(b.invert)),M&&M.domain(w.range().map(function(t){return(t-A.y)/A.k}).map(w.invert))}function l(t){z++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:A.k,translate:[A.x,A.y]})}function c(t){--z||(t({type:"zoomend"}),m=null)}function h(){function t(){s=1,a(uo.mouse(i),f),u(o)}function r(){h.on(I,null).on(P,null),d(s),c(o)}var i=this,o=R.of(i,arguments),s=0,h=uo.select(n(i)).on(I,t).on(P,r),f=e(uo.mouse(i)),d=K(i);Vl.call(i),l(o)}function f(){function t(){var t=uo.touches(p);return d=A.k,t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))}),t}function r(){var e=uo.event.target;uo.select(e).on(b,n).on(_,s),w.push(e);for(var r=uo.event.changedTouches,i=0,a=r.length;i1){var c=l[0],h=l[1],f=c[0]-h[0],d=c[1]-h[1];v=f*f+d*d}}function n(){var t,e,r,n,o=uo.touches(p);Vl.call(p);for(var s=0,l=o.length;s=u)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ds=uo.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=uo.round(t,Ft(t,e))).toFixed(Math.max(0,Math.min(20,Ft(t*(1+1e-15),e))))}}),ps=uo.time={},gs=Date;Ut.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ms.setUTCDate.apply(this._,arguments)},setDay:function(){ms.setUTCDay.apply(this._,arguments)},setFullYear:function(){ms.setUTCFullYear.apply(this._,arguments)},setHours:function(){ms.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ms.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ms.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ms.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ms.setUTCSeconds.apply(this._,arguments)},setTime:function(){ms.setTime.apply(this._,arguments)}};var ms=Date.prototype;ps.year=Vt(function(t){return t=ps.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),ps.years=ps.year.range,ps.years.utc=ps.year.utc.range,ps.day=Vt(function(t){var e=new gs(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),ps.days=ps.day.range,ps.days.utc=ps.day.utc.range,ps.dayOfYear=function(t){var e=ps.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var r=ps[t]=Vt(function(t){return(t=ps.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var r=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});ps[t+"s"]=r.range,ps[t+"s"].utc=r.utc.range,ps[t+"OfYear"]=function(t){var r=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(r+e)%7)/7)}}),ps.week=ps.sunday,ps.weeks=ps.sunday.range,ps.weeks.utc=ps.sunday.utc.range,ps.weekOfYear=ps.sundayOfYear;var vs={"-":"",_:" ",0:"0"},ys=/^\s*\d+/,xs=/^%/;uo.locale=function(t){return{numberFormat:Nt(t),timeFormat:Ht(t)}};var bs=uo.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"]});uo.format=bs.numberFormat,uo.geo={},he.prototype={s:0,t:0,add:function(t){fe(t,this.t,_s),fe(_s.s,this.s,this),this.s?this.t+=_s.t:this.s=_s.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _s=new he;uo.geo.stream=function(t,e){t&&ws.hasOwnProperty(t.type)?ws[t.type](t,e):de(t,e)};var ws={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nd&&(d=e)}function e(e,r){var n=ve([e*qo,r*qo]);if(v){var i=xe(v,n),a=[i[1],-i[0],0],o=xe(a,i);we(o),o=Me(o);var l=e-p,u=l>0?1:-1,g=o[0]*Ho*u,m=bo(l)>180;if(m^(u*pd&&(d=y)}else if(g=(g+360)%360-180,m^(u*pd&&(d=r);m?es(c,f)&&(f=e):s(e,f)>s(c,f)&&(c=e):f>=c?(ef&&(f=e)):e>p?s(c,e)>s(c,f)&&(f=e):s(e,f)>s(c,f)&&(c=e)}else t(e,r);v=n,p=e}function r(){_.point=e}function n(){b[0]=c,b[1]=f,_.point=t,v=null}function i(t,r){if(v){var n=t-p;y+=bo(n)>180?n+(n>0?360:-360):n}else g=t,m=r;Ts.point(t,r),e(t,r)}function a(){Ts.lineStart()}function o(){i(g,m),Ts.lineEnd(),bo(y)>Fo&&(c=-(f=180)),b[0]=c,b[1]=f,v=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tFo?d=90:y<-Fo&&(h=-90),b[0]=c,b[1]=f}};return function(t){d=f=-(c=h=1/0),x=[],uo.geo.stream(t,_);var e=x.length;if(e){x.sort(l);for(var r,n=1,i=x[0],a=[i];ns(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):a.push(i=r);for(var o,r,p=-(1/0),e=a.length-1,n=0,i=a[e];n<=e;i=r,++n)r=a[n],(o=s(i[1],r[0]))>p&&(p=o,c=r[0],f=i[1])}return x=b=null,c===1/0||h===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,h],[f,d]]}}(),uo.geo.centroid=function(t){Es=Ss=Ls=zs=Cs=Is=Ps=Ds=Rs=Os=Fs=0,uo.geo.stream(t,js);var e=Rs,r=Os,n=Fs,i=e*e+r*r+n*n;return i=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},t.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()}}},t.precision=function(e){return arguments.length?(a.precision(e),o.precision(e),s.precision(e),t):a.precision()},t.scale=function(e){return arguments.length?(a.scale(e),o.scale(.35*e),s.scale(e),t.translate(a.translate())):a.scale()},t.translate=function(e){if(!arguments.length)return a.translate();var u=a.scale(),c=+e[0],h=+e[1];return r=a.translate(e).clipExtent([[c-.455*u,h-.238*u],[c+.455*u,h+.238*u]]).stream(l).point,n=o.translate([c-.307*u,h+.201*u]).clipExtent([[c-.425*u+Fo,h+.12*u+Fo],[c-.214*u-Fo,h+.234*u-Fo]]).stream(l).point,i=s.translate([c-.205*u,h+.212*u]).clipExtent([[c-.214*u+Fo,h+.166*u+Fo],[c-.115*u-Fo,h+.234*u-Fo]]).stream(l).point,t},t.scale(1070)};var Us,Vs,qs,Hs,Gs,Xs,Ys={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Vs=0,Ys.lineStart=We},polygonEnd:function(){Ys.lineStart=Ys.lineEnd=Ys.point=M,Us+=bo(Vs/2)}},Ws={point:Ze,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Zs={point:$e,lineStart:Je,lineEnd:tr,polygonStart:function(){Zs.lineStart=er},polygonEnd:function(){Zs.point=$e,Zs.lineStart=Je,Zs.lineEnd=tr}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),uo.geo.stream(t,o)),a.result()}function e(){return o=null,t}var r,n,i,a,o,s=4.5;return t.area=function(t){return Us=0,uo.geo.stream(t,i(Ys)),Us},t.centroid=function(t){return Ls=zs=Cs=Is=Ps=Ds=Rs=Os=Fs=0,uo.geo.stream(t,i(Zs)),Fs?[Rs/Fs,Os/Fs]:Ds?[Is/Ds,Ps/Ds]:Cs?[Ls/Cs,zs/Cs]:[NaN,NaN]},t.bounds=function(t){return Gs=Xs=-(qs=Hs=1/0),uo.geo.stream(t,i(Ws)),[[qs,Hs],[Gs,Xs]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):b,e()):r},t.context=function(t){return arguments.length?(a=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&a.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(a.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var r=new ar(e);for(var n in t)r[n]=t[n];return r}}},ar.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()}},uo.geo.projection=sr,uo.geo.projectionMutator=lr,(uo.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*qo,e[1]*qo),e[0]*=Ho,e[1]*=Ho,e}return t=fr(t[0]%360*qo,t[1]*qo,t.length>2?t[2]*qo:0),e.invert=function(e){return e=t.invert(e[0]*qo,e[1]*qo),e[0]*=Ho,e[1]*=Ho,e},e},hr.invert=cr,uo.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=fr(-t[0]*qo,-t[1]*qo,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=Ho,t[1]*=Ho}}),{type:"Polygon",coordinates:[i]}}var e,r,n=[0,0],i=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=mr((e=+n)*qo,i*qo),t):e},t.precision=function(n){return arguments.length?(r=mr(e*qo,(i=+n)*qo),t):i},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*qo,i=t[1]*qo,a=e[1]*qo,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),h=Math.cos(a);return Math.atan2(Math.sqrt((r=h*o)*r+(r=u*c-l*h*s)*r),l*c+u*h*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/m)*m,i,m).map(f).concat(uo.range(Math.ceil(u/v)*v,l,v).map(d)).concat(uo.range(Math.ceil(n/p)*p,r,p).filter(function(t){return bo(t%m)>Fo}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return bo(t%v)>Fo}).map(h))}var r,n,i,a,o,s,l,u,c,h,f,d,p=10,g=p,m=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(l).slice(1),f(i).reverse().slice(1),d(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(a=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],a>i&&(e=a,a=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[a,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(m=+e[0],v=+e[1],t):[m,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,o,90),h=xr(n,r,y),f=yr(u,l,90),d=xr(a,i,y),t):y},t.majorExtent([[-180,-90+Fo],[180,90-Fo]]).minorExtent([[-180,-80-Fo],[180,80+Fo]])},uo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}var e,r,n=br,i=_r;return t.distance=function(){return uo.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(i=e,r="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},uo.geo.interpolate=function(t,e){return wr(t[0]*qo,t[1]*qo,e[0]*qo,e[1]*qo)},uo.geo.length=function(t){return Qs=0,uo.geo.stream(t,Ks),Qs};var Qs,Ks={sphere:M,point:M,lineStart:Mr,lineEnd:M,polygonStart:M,polygonEnd:M},$s=Ar(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr($s)}).raw=$s;var Js=Ar(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(uo.geo.azimuthalEquidistant=function(){return sr(Js)}).raw=Js,(uo.geo.conicConformal=function(){return Xe(kr)}).raw=kr,(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var tl=Ar(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(tl)}).raw=tl,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return Sr(Er)}).raw=Er;var el=Ar(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr(el)}).raw=el;var rl=Ar(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(rl)}).raw=rl,Lr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Vo]},(uo.geo.transverseMercator=function(){var t=Sr(Lr),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=Lr,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=St(r),a=St(n),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+h;e=n&&u.x<=a&&u.y>=i&&u.y<=o?[[n,o],[a,o],[a,i],[n,i]]:[];c.point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/Fo)*Fo,y:Math.round(o(t,e)/Fo)*Fo,i:e}})}var n=zr,i=Cr,a=n,o=i,s=hl;return t?e(t):(e.links=function(t){return un(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return un(r(t)).cells.forEach(function(r,n){for(var i,a,o=r.site,s=r.edges.sort(Xr),l=-1,u=s.length,c=s[u-1].edge,h=c.l===o?c.r:c.l;++l=u,f=n>=c,d=f<<1|h;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),h?i=u:s=u,f?o=c:l=c,a(t,e,r,n,i,o,s,l)}var c,h,f,d,p,g,m,v,y,x=St(s),b=St(l);if(null!=e)g=e,m=r,v=n,y=i;else if(v=y=-(g=m=1/0),h=[],f=[],p=t.length,o)for(d=0;dv&&(v=c.x),c.y>y&&(y=c.y),h.push(c.x),f.push(c.y);else for(d=0;dv&&(v=_),w>y&&(y=w),h.push(_),f.push(w)}var M=v-g,A=y-m;M>A?y=m+M:v=g+A;var k=pn();if(k.add=function(t){a(k,t,+x(t,++d),+b(t,d),g,m,v,y)},k.visit=function(t){gn(t,k,g,m,v,y)},k.find=function(t){return mn(k,t[0],t[1],g,m,v,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=gl.get(r)||pl,n=ml.get(n)||b,Mn(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=On,uo.interpolateHsl=Fn,uo.interpolateLab=jn,uo.interpolateRound=Nn,uo.transform=function(t){var e=fo.createElementNS(uo.ns.prefix.svg,"g");return(uo.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Bn(r?r.matrix:vl)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var vl={a:1,b:0,c:0,d:1,e:0,f:0};uo.interpolateTransform=Zn,uo.layout={},uo.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r0?i=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),r=Pt(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;l=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;n&&(a.value=0),a.children=u}else n&&(a.value=+n.call(t,a,a.depth)||0),delete a.children;return li(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=hi,r=ui,n=ci;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0),(r=e.parent)&&(r.value+=e.value)})),e},t},uo.layout.partition=function(){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,u=-1;for(n=e.value?n/e.value:0;++us&&(s=n),o.push(n)}for(r=0;r0)for(a=-1;++a=c[0]&&s<=c[1]&&(o=l[uo.bisect(h,s,1,d)-1],o.y+=p,o.push(t[a]));return l}var e=!0,r=Number,n=Mi,i=_i;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=St(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:St(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},uo.layout.pack=function(){function t(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,Si),n){var h=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=h}),li(s,Si),li(s,function(t){t.r-=h})}return Ci(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),o}var e,r=uo.layout.hierarchy().sort(Ai),n=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},oi(t,r)},uo.layout.tree=function(){function t(t,i){var c=o.call(this,t,i),h=c[0],f=e(h);if(li(f,r),f.parent.m=-f.z,si(f,n),u)si(h,a);else{var d=h,p=h,g=h;si(h,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var m=s(d,p)/2-d.x,v=l[0]/(p.x+s(p,d)/2+m),y=l[1]/(g.depth||1);si(h,function(t){t.x=(t.x+m)*v,t.y=t.depth*y})}return c}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var i,a=e.children,o=0,s=a.length;o0&&(Oi(ji(o,t,r),t,n),u+=n,c+=n),h+=o.m,u+=i.m,f+=l.m,c+=a.m;o&&!Ri(a)&&(a.t=o,a.m+=h-c),i&&!Di(l)&&(l.t=i,l.m+=u-f,r=t)}return r}function a(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Pi,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?a:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:a,t):u?l:null},oi(t,o)},uo.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=Bi(e),t.y=Ni(e)):(t.x=o?u+=r(t,o):0,t.y=0,o=t)});var c=Ui(l),h=Vi(l),f=c.x-r(c,h)/2,d=h.x+r(h,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*n[0],t.y=(l.y-t.y)*n[1]}:function(t){t.x=(t.x-f)/(d-f)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=uo.layout.hierarchy().sort(null).value(null),r=Pi,n=[1,1],i=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(i=null==(n=e),t):i?null:n},t.nodeSize=function(e){return arguments.length?(i=null!=(n=e),t):i?n:null},oi(t,e)},uo.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,a=t.length;++i0;)c.push(o=f[l-1]),c.area+=o.area,"squarify"!==d||(s=n(c,g))<=p?(f.pop(),p=s):(c.area-=c.pop().area,i(c,g,u,!1),g=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,g,u,!0),c.length=c.area=0),a.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var a,o=h(e),s=n.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(i(l,a.z?o.dx:o.dy,o,!s.length),l.length=l.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=r));return n*=n,e*=e,n?Math.max(e*i*p/n,n/(e*a*p)):1/0}function i(t,e,r,n){var i,a=-1,o=t.length,s=r.x,u=r.y,c=e?l(t.area/e):0;if(e==r.dx){for((n||c>r.dy)&&(c=r.dy);++ar.dx)&&(c=r.dx);++a1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=uo.random.normal.apply(uo,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=uo.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;rh?0:1;if(u=Uo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,m,v,y,x,b,_,w,M,A,k,T=0,E=0,S=[];if((v=(+l.apply(this,arguments)||0)/2)&&(m=a===Il?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(E*=-1),u&&(E=nt(m/u*Math.sin(v))),t&&(T=nt(m/t*Math.sin(v)))),u){y=u*Math.cos(c+E),x=u*Math.sin(c+E),b=u*Math.cos(h-E),_=u*Math.sin(h-E);var L=Math.abs(h-c-2*E)<=No?0:1;if(E&&xa(y,x,b,_)===d^L){var z=(c+h)/2;y=u*Math.cos(z),x=u*Math.sin(z),b=_=null}}else y=x=0;if(t){w=t*Math.cos(h-T),M=t*Math.sin(h-T),A=t*Math.cos(c+T),k=t*Math.sin(c+T);var C=Math.abs(c-h+2*T)<=No?0:1;if(T&&xa(w,M,A,k)===1-d^C){var I=(c+h)/2;w=t*Math.cos(I),M=t*Math.sin(I),A=k=null}}else w=M=0;if(f>Fo&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){g=tNo)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var a=br,o=_r,s=Ha,l=ma,u=va;return t.radius=function(e){return arguments.length?(s=St(e),t):s},t.source=function(e){return arguments.length?(a=St(e),t):a},t.target=function(e){return arguments.length?(o=St(e),t):o},t.startAngle=function(e){return arguments.length?(l=St(e),t):l},t.endAngle=function(e){return arguments.length?(u=St(e),t):u},t},uo.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=r.call(this,t,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return l=l.map(n),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=br,r=_r,n=Ga;return t.source=function(r){return arguments.length?(e=St(r),t):e},t.target=function(e){return arguments.length?(r=St(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},uo.svg.diagonal.radial=function(){var t=uo.svg.diagonal(),e=Ga,r=t.projection;return t.projection=function(t){return arguments.length?r(Xa(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(Fl.get(e.call(this,t,n))||Za)(r.call(this,t,n))}var e=Wa,r=Ya;return t.type=function(r){return arguments.length?(e=St(r),t):e},t.size=function(e){return arguments.length?(r=St(e),t):r},t};var Fl=uo.map({circle:Za,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*Nl)),r=e*Nl;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/jl),r=e*jl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/jl),r=e*jl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=Fl.keys();var jl=Math.sqrt(3),Nl=Math.tan(30*qo);Lo.transition=function(t){for(var e,r,n=Bl||++Hl,i=to(t),a=[],o=Ul||{time:Date.now(),ease:Sn,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",h[1]-h[0])}function i(t){t.select(".extent").attr("y",f[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function a(){function a(){32==uo.event.keyCode&&(L||(x=null,C[0]-=h[1],C[1]-=f[1],L=2),T())}function g(){32==uo.event.keyCode&&2==L&&(C[0]+=h[1],C[1]+=f[1],L=0,T())}function m(){var t=uo.mouse(_),n=!1;b&&(t[0]+=b[0],t[1]+=b[1]),L||(uo.event.altKey?(x||(x=[(h[0]+h[1])/2,(f[0]+f[1])/2]),C[0]=h[+(t[0]=2)return!1;t[r]=n}return!0}):w.filter(function(t){for(var e=0;e<=o;++e){var r=y[t[e]];if(r<0)return!1;t[e]=r}return!0}),1&o)for(var h=0;h>>31},e.exports.exponent=function(t){var r=e.exports.hi(t);return(r<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){var r=e.exports.hi(t);return!(2146435072&r)}}).call(this,t("buffer").Buffer)},{buffer:64}],98:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(i<=0)return[];var a,o=new Array(i);if(r===t.length-1)for(a=0;a0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=a},{}],99:[function(t,e,r){"use strict";function n(t,e,r){r=r||2;var n=e&&e.length,a=n?e[0]*r:t.length,s=i(t,0,a,r,!0),l=[];if(!s)return l;var u,c,f,d,p,g,m;if(n&&(s=h(t,e,s,r)),t.length>80*r){u=f=t[0],c=d=t[1];for(var v=r;vf&&(f=p),g>d&&(d=g);m=Math.max(f-u,d-c)}return o(s,l,r,u,c,m),l}function i(t,e,r,n,i){var a,o;if(i===C(t,e,r,n)>0)for(a=e;a=e;a-=n)o=S(a,t[a],t[a+1],o);return o&&w(o,o.next)&&(L(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||!w(n,n.next)&&0!==_(n.prev,n,n.next))n=n.next;else{if(L(n),n=e=n.prev,n===n.next)return null;r=!0}while(r||n!==e);return e}function o(t,e,r,n,i,h,f){if(t){!f&&h&&g(t,n,i,h);for(var d,p,m=t;t.prev!==t.next;)if(d=t.prev,p=t.next,h?l(t,n,i,h):s(t))e.push(d.i/r),e.push(t.i/r),e.push(p.i/r),L(t),t=p.next,m=p.next;else if(t=p,t===m){f?1===f?(t=u(t,e,r),o(t,e,r,n,i,h,2)):2===f&&c(t,e,r,n,i,h):o(a(t),e,r,n,i,h,1);break}}}function s(t){var e=t.prev,r=t,n=t.next;if(_(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(x(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&_(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(_(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,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=v(s,l,e,r,n),f=v(u,c,e,r,n),d=t.nextZ;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&x(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&_(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=h;){if(d!==t.prev&&d!==t.next&&x(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&_(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function u(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!w(i,a)&&M(i,n,n.next,a)&&k(i,a)&&k(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),L(n),L(n.next),n=t=a),n=n.next}while(n!==t);return n}function c(t,e,r,n,i,s){var l=t;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&b(l,u)){var c=E(l,u);return l=a(l,l.next),c=a(c,c.next),o(l,e,r,n,i,s),void o(c,e,r,n,i,s)}u=u.next}l=l.next}while(l!==t)}function h(t,e,r,n){var o,s,l,u,c,h=[];for(o=0,s=e.length;o=n.next.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>=c&&x(ar.x)&&k(n,t)&&(r=n,f=l)),n=n.next;return r}function g(t,e,r,n){var i=t;do null===i.z&&(i.z=v(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,m(i)}function m(t){var e,r,n,i,a,o,s,l,u=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?(i=n,n=n.nextZ,l--):0!==l&&n?r.z<=n.z?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--):(i=r,r=r.nextZ,s--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,u*=2}while(o>1);return t}function v(t,e,r,n,i){return t=32767*(t-r)/i,e=32767*(e-n)/i,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function y(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 b(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!A(t,e)&&k(t,e)&&k(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 M(t,e,r,n){return!!(w(t,e)&&w(r,n)||w(t,n)&&w(r,e))||_(t,e,r)>0!=_(t,e,n)>0&&_(r,n,t)>0!=_(r,n,e)>0}function A(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&&M(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function k(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=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do r.y>a!=r.next.y>a&&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}function E(t,e){var r=new z(t.i,t.x,t.y),n=new z(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 S(t,e,r,n){var i=new z(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 L(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 z(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 C(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}},{}],100:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;n0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],a=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(s=a;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(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],103:[function(t,e,r){"use strict";function n(t,e,r){var n=e||0,i=r||1;return[[t[12]+t[0],t[13]+t[1],t[14]+t[2],t[15]+t[3]],[t[12]-t[0],t[13]-t[1],t[14]-t[2],t[15]-t[3]],[t[12]+t[4],t[13]+t[5],t[14]+t[6],t[15]+t[7]],[t[12]-t[4],t[13]-t[5],t[14]-t[6],t[15]-t[7]],[n*t[12]+t[8],n*t[13]+t[9],n*t[14]+t[10],n*t[15]+t[11]],[i*t[12]-t[8],i*t[13]-t[9],i*t[14]-t[10],i*t[15]-t[11]]]}e.exports=n},{}],104:[function(t,e,r){"use strict";function n(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}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],105:[function(t,e,r){"use strict";function n(t){return new Function("f","var p = (f && f.properties || {}); return "+i(t))}function i(t){if(!t)return"true";var e=t[0];if(t.length<=1)return"any"===e?"false":"true";var r="=="===e?o(t[1],t[2],"===",!1):"!="===e?o(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?o(t[1],t[2],e,!0):"any"===e?s(t.slice(1),"||"):"all"===e?s(t.slice(1),"&&"):"none"===e?c(s(t.slice(1),"||")):"in"===e?l(t[1],t.slice(2)):"!in"===e?c(l(t[1],t.slice(2))):"has"===e?u(t[1]):"!has"===e?c(u([t[1]])):"true";return"("+r+")"}function a(t){return"$type"===t?"f.type":"$id"===t?"f.id":"p["+JSON.stringify(t)+"]"}function o(t,e,r,n){var i=a(t),o="$type"===t?f.indexOf(e):JSON.stringify(e);return(n?"typeof "+i+"=== typeof "+o+"&&":"")+i+r+o}function s(t,e){return t.map(i).join(e)}function l(t,e){"$type"===t&&(e=e.map(function(t){return f.indexOf(t)}));var r=JSON.stringify(e.sort(h)),n=a(t);return e.length<=200?r+".indexOf("+n+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1; if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+n+", "+r+",0,"+(e.length-1)+")"}function u(t){return JSON.stringify(t)+" in p"}function c(t){return"!("+t+")"}function h(t,e){return te?1:0}e.exports=n;var f=["Unknown","Point","LineString","Polygon"]},{}],106:[function(t,e,r){"use strict";function n(t,e,r){return Math.min(e,Math.max(t,r))}function i(t,e,r){this.dimension=t.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n=r-1)for(var f=o.length-1,p=t-e[r-1],d=0;d=r-1)for(var c=a.length-1,h=(t-e[r-1],0);h=0;--r)if(t[--e])return!1;return!0},u.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t0;--h)i.push(n(l[h-1],u[h-1],arguments[h])),a.push(0)}},u.push=function(t){var e=this.lastT(),r=this.dimension;if(!(t1e-6?1/s:0;this._time.push(t);for(var f=r;f>0;--f){var d=n(u[f-1],c[f-1],arguments[f]);i.push(d),a.push((d-i[o++])*h)}}},u.set=function(t){var e=this.dimension;if(!(t0;--l)r.push(n(o[l-1],s[l-1],arguments[l])),i.push(0)}},u.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var i=this._state,a=this._velocity,o=i.length-this.dimension,s=this.bounds,l=s[0],u=s[1],c=t-e,h=c>1e-6?1/c:0;this._time.push(t);for(var f=r;f>0;--f){var d=arguments[f];i.push(n(l[f-1],u[f-1],i[o++]+d)),a.push(d*h)}}},u.idle=function(t){var e=this.lastT();if(!(t=0;--h)i.push(n(l[h],u[h],i[o]+c*a[o])),a.push(0),o+=1}}},{"binary-search-bounds":53,"cubic-hermite":90 -}],107:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=a}function i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function a(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}function l(t,e){if(e.left){var r=l(t,e.left);if(r)return r}var r=t(e.key,e.value);return r?r:e.right?l(t,e.right):void 0}function u(t,e,r,n){var i=e(t,n.key);if(i<=0){if(n.left){var a=u(t,e,r,n.left);if(a)return a}var a=r(n.key,n.value);if(a)return a}if(n.right)return u(t,e,r,n.right)}function c(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=c(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return c(t,e,r,n,i.right)}function h(t,e){this.tree=t,this._stack=e}function f(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t._color=e._color,t._count=e._count}function d(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=v);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===m){if(n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=v,r._color=v,s._color=v,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}return void(t[l-1]=n)}if(n.left&&n.left._color===m){if(n=r.right=i(n),s=n.left=i(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=v,n._color=v,e._color=v,o(r),o(n),o(s),l>1){var u=t[l-2];u.left===r?u.left=s:u.right=s}return void(t[l-1]=s)}if(n._color===v){if(r._color===m)return r._color=v,void(r.right=a(m,n));r.right=a(m,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=m,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}t[l-1]=n,t[l]=r,l+11){var u=t[l-2];u.right===r?u.right=n:u.left=n}return void(t[l-1]=n)}if(n.right&&n.right._color===m){if(n=r.left=i(n),s=n.right=i(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=v,n._color=v,e._color=v,o(r),o(n),o(s),l>1){var u=t[l-2];u.right===r?u.right=s:u.left=s}return void(t[l-1]=s)}if(n._color===v){if(r._color===m)return r._color=v,void(r.left=a(m,n));r.left=a(m,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=m,o(r),o(n),l>1){var u=t[l-2];u.right===r?u.right=n:u.left=n}t[l-1]=n,t[l]=r,l+1e?1:0}function g(t){return new s(t||p,null)}e.exports=g;var m=0,v=1,y=s.prototype;Object.defineProperty(y,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(y,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(y,"length",{get:function(){return this.root?this.root._count:0}}),y.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],u=[];i;){var c=r(t,i.key);l.push(i),u.push(c),i=c<=0?i.left:i.right}l.push(new n(m,t,e,null,null,1));for(var h=l.length-2;h>=0;--h){var i=l[h];u[h]<=0?l[h]=new n(i._color,i.key,i.value,l[h+1],i.right,i._count+1):l[h]=new n(i._color,i.key,i.value,i.left,l[h+1],i._count+1)}for(var h=l.length-1;h>1;--h){var f=l[h-1],i=l[h];if(f._color===v||i._color===v)break;var d=l[h-2];if(d.left===f)if(f.left===i){var p=d.right;if(!p||p._color!==m){if(d._color=m,d.left=f.right,f._color=v,f.right=d,l[h-2]=f,l[h-1]=i,o(d),o(f),h>=3){var g=l[h-3];g.left===d?g.left=f:g.right=f}break}f._color=v,d.right=a(v,p),d._color=m,h-=1}else{var p=d.right;if(!p||p._color!==m){if(f.right=i.left,d._color=m,d.left=i.right,i._color=v,i.left=f,i.right=d,l[h-2]=i,l[h-1]=f,o(d),o(f),o(i),h>=3){var g=l[h-3];g.left===d?g.left=i:g.right=i}break}f._color=v,d.right=a(v,p),d._color=m,h-=1}else if(f.right===i){var p=d.left;if(!p||p._color!==m){if(d._color=m,d.right=f.left,f._color=v,f.left=d,l[h-2]=f,l[h-1]=i,o(d),o(f),h>=3){var g=l[h-3];g.right===d?g.right=f:g.left=f}break}f._color=v,d.left=a(v,p),d._color=m,h-=1}else{var p=d.left;if(!p||p._color!==m){if(f.left=i.right,d._color=m,d.right=i.left,i._color=v,i.right=f,i.left=d,l[h-2]=i,l[h-1]=f,o(d),o(f),o(i),h>=3){var g=l[h-3];g.right===d?g.right=i:g.left=i}break}f._color=v,d.left=a(v,p),d._color=m,h-=1}}return l[0]._color=v,new s(r,l[0])},y.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return c(e,r,this._compare,t,this.root)}},Object.defineProperty(y,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new h(this,t)}}),Object.defineProperty(y,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new h(this,t)}}),y.at=function(t){if(t<0)return new h(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new h(this,[])},y.ge=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var 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 h(this,n)},y.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 h(this,n)},y.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 h(this,n)},y.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 h(this,n)},y.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var i=e(t,r.key);if(n.push(r),0===i)return new h(this,n);r=i<=0?r.left:r.right}return new h(this,[])},y.remove=function(t){var e=this.find(t);return e?e.remove():this},y.get=function(t){for(var e=this._compare,r=this.root;r;){var n=e(t,r.key);if(0===n)return r.value;r=n<=0?r.left:r.right}};var x=h.prototype;Object.defineProperty(x,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(x,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),x.clone=function(){return new h(this.tree,this._stack.slice())},x.remove=function(){var t=this._stack;if(0===t.length)return this.tree;var e=new Array(t.length),r=t[t.length-1];e[e.length-1]=new n(r._color,r.key,r.value,r.left,r.right,r._count);for(var i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var a=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var o=e[a-1];e.push(new n(r._color,o.key,o.value,r.left,r.right,r._count)),e[a-1].key=r.key,e[a-1].value=r.value;for(var i=e.length-2;i>=a;--i)r=e[i],e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count);e[a-1].left=e[a]}if(r=e[e.length-1],r._color===m){var l=e[e.length-2];l.left===r?l.left=null:l.right===r&&(l.right=null),e.pop();for(var i=0;i0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(x,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(x,"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}),x.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(x,"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}}),x.update=function(t){var e=this._stack;if(0===e.length)throw new Error("Can't update empty node!");var r=new Array(e.length),i=e[e.length-1];r[r.length-1]=new n(i._color,i.key,t,i.left,i.right,i._count);for(var a=e.length-2;a>=0;--a)i=e[a],i.left===e[a+1]?r[a]=new n(i._color,i.key,i.value,r[a+1],i.right,i._count):r[a]=new n(i._color,i.key,i.value,i.left,r[a+1],i._count);return new s(this.tree._compare,r[0])},x.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(x,"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}})},{}],108:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=s[0],r=s.length-1;r>0;--r)e+=s[r]/(t+r);var n=t+o+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=7,a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],o=607/128,s=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];e.exports=function t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(n(e));e-=1;for(var r=a[0],o=1;o0){e+=Math.abs(a(t[0]));for(var r=1;r2){for(var r,n,i=0;i=0}var u=t("geojson-area");e.exports=n},{"geojson-area":109}],111:[function(t,e,r){"use strict";function n(t,e,r,n,o,l,u,c){if(r/=e,n/=e,u>=r&&c<=n)return t;if(u>n||c=r&&p<=n)h.push(g);else if(!(d>n||p=e&&s<=r&&i.push(o)}return i}function a(t,e,r,n,i,a){for(var s=[],l=0;lr?(b.push(i(u,p,e),i(u,p,r)),a||(b=o(s,b,m,v,y))):d>=e&&b.push(i(u,p,e)):f>r?dr&&(b.push(i(u,p,r)),a||(b=o(s,b,m,v,y))));u=g[x-1],f=u[n],f>=e&&f<=r&&b.push(u),h=b[b.length-1],a&&h&&(b[0][0]!==h[0]||b[0][1]!==h[1])&&b.push(b[0]),o(s,b,m,v,y)}return s}function o(t,e,r,n,i){return e.length&&(e.area=r,e.dist=n,void 0!==i&&(e.outer=i),t.push(e)),[]}e.exports=n;var s=t("./feature")},{"./feature":113}],112:[function(t,e,r){"use strict";function n(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n1?1:n,[r,n,0]}function s(t){for(var e,r,n=0,i=0,a=0;a1)return!1;var a=i.geometry[0].length;if(5!==a)return!1;for(var o=0;o1&&console.time("creation"),x=this.tiles[y]=p(t,v,r,n,b,e===d.maxZoom),this.tileCoords.push({z:e,x:r,y:n}),g)){g>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,x.numFeatures,x.numPoints,x.numSimplified),console.timeEnd("creation"));var _="z"+e;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(x.source=t,i){if(e===d.maxZoom||e===i)continue;var w=1<1&&console.time("clipping");var M,A,k,T,E,S,L=.5*d.buffer/d.extent,z=.5-L,C=.5+L,I=1+L;M=A=k=T=null,E=f(t,v,r-L,r+C,0,o,x.min[0],x.max[0]),S=f(t,v,r+z,r+I,0,o,x.min[0],x.max[0]),E&&(M=f(E,v,n-L,n+C,1,s,x.min[1],x.max[1]),A=f(E,v,n+z,n+I,1,s,x.min[1],x.max[1])),S&&(k=f(S,v,n-L,n+C,1,s,x.min[1],x.max[1]),T=f(S,v,n+z,n+I,1,s,x.min[1],x.max[1])),g>1&&console.timeEnd("clipping"),t.length&&(h.push(M||[],e+1,2*r,2*n),h.push(A||[],e+1,2*r,2*n+1),h.push(k||[],e+1,2*r+1,2*n),h.push(T||[],e+1,2*r+1,2*n+1))}else i&&(m=e)}return m},i.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,o=n.debug,s=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var c,f=t,d=e,p=r;!c&&f>0;)f--,d=Math.floor(d/2),p=Math.floor(p/2),c=this.tiles[a(f,d,p)];if(!c||!c.source)return null;if(o>1&&console.log("found parent tile z%d-%d-%d",f,d,p),u(c,i,n.buffer))return h.tile(c,i);o>1&&console.time("drilling down");var g=this.splitTile(c.source,f,d,p,t,e,r);if(o>1&&console.timeEnd("drilling down"),null!==g){var m=1<n&&(o=r,n=a);n>s?(t[o][2]=n,h.push(u),h.push(o),u=o):(c=h.pop(),u=h.pop())}}function i(t,e,r){var n=e[0],i=e[1],a=r[0],o=r[1],s=t[0],l=t[1],u=a-n,c=o-i;if(0!==u||0!==c){var h=((s-n)*u+(l-i)*c)/(u*u+c*c);h>1?(n=a,i=o):h>0&&(n+=u*h,i+=c*h)}return u=s-n,c=l-i,u*u+c*c}e.exports=n},{}],116:[function(t,e,r){"use strict";function n(t,e,r,n,a,o){for(var s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z2:e,transformed:!1,min:[2,1],max:[-1,0]},l=0;ls.max[0]&&(s.max[0]=c[0]),c[1]>s.max[1]&&(s.max[1]=c[1])}return s}function i(t,e,r,n){var i,o,s,l,u=e.geometry,c=e.type,h=[],f=r*r;if(1===c)for(i=0;if)&&(d.push(l),t.numSimplified++),t.numPoints++;3===c&&a(d,s.outer),h.push(d)}else t.numPoints+=s.length;if(h.length){var p={geometry:h,type:c,tags:e.tags||null};null!==e.id&&(p.id=e.id),t.features.push(p)}}function a(t,e){var r=o(t);r<0===e&&t.reverse()}function o(t){for(var e,r,n=0,i=0,a=t.length,o=a-1;i0?(d[c]=-1,p[c]=0):(d[c]=0,p[c]=1)}}function s(t,e){var r=new i(t);return r.update(e),r}e.exports=s;var l=t("./lib/text.js"),u=t("./lib/lines.js"),c=t("./lib/background.js"),h=t("./lib/cube.js"),f=t("./lib/ticks.js"),d=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),p=i.prototype;p.update=function(t){function e(e,r,n){if(n in t){var i,a=t[n],o=this[n];(e?Array.isArray(a)&&Array.isArray(a[0]):Array.isArray(a))?this[n]=i=[r(a[0]),r(a[1]),r(a[2])]:this[n]=i=[r(a),r(a),r(a)];for(var s=0;s<3;++s)if(i[s]!==o[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),a=e.bind(this,!1,String),o=e.bind(this,!0,function(t){if(Array.isArray(t)){if(3===t.length)return[+t[0],+t[1],+t[2],1];if(4===t.length)return[+t[0],+t[1],+t[2],+t[3]]}return[0,0,0,1]}),s=!1,c=!1;if("bounds"in t)for(var h=t.bounds,d=0;d<2;++d)for(var p=0;p<3;++p)h[d][p]!==this.bounds[d][p]&&(c=!0),this.bounds[d][p]=h[d][p];if("ticks"in t){r=t.ticks,s=!0,this.autoTicks=!1;for(var d=0;d<3;++d)this.tickSpacing[d]=0}else n("tickSpacing")&&(this.autoTicks=!0,c=!0);if(this._firstInit&&("ticks"in t||"tickSpacing"in t||(this.autoTicks=!0),c=!0,s=!0,this._firstInit=!1),c&&this.autoTicks&&(r=f.create(this.bounds,this.tickSpacing),s=!0),s){for(var d=0;d<3;++d)r[d].sort(function(t,e){return t.x-e.x});f.equal(r,this.ticks)?s=!1:this.ticks=r}i("tickEnable"),a("tickFont")&&(s=!0),n("tickSize"),n("tickAngle"),n("tickPad"),o("tickColor");var g=a("labels");a("labelFont")&&(g=!0),i("labelEnable"),n("labelSize"),n("labelPad"),o("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),o("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),o("lineTickColor"),i("gridEnable"),n("gridWidth"),o("gridColor"),i("zeroEnable"),o("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),o("backgroundColor"),this._text?this._text&&(g||s)&&this._text.update(this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont):this._text=l(this.gl,this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont),this._lines&&s&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=u(this.gl,this.bounds,this.ticks))};var g=[new a,new a,new a],m=[0,0,0],v={model:d,view:d,projection:d};p.isOpaque=function(){return!0},p.isTransparent=function(){return!1},p.drawTransparent=function(t){};var y=[0,0,0],x=[0,0,0],b=[0,0,0];p.draw=function(t){t=t||v;for(var e=this.gl,r=t.model||d,i=t.view||d,a=t.projection||d,s=this.bounds,l=h(r,i,a,s),u=l.cubeEdges,c=l.axis,f=i[12],p=i[13],_=i[14],w=i[15],M=this.pixelRatio*(a[3]*f+a[7]*p+a[11]*_+a[15]*w)/e.drawingBufferHeight,A=0;A<3;++A)this.lastCubeProps.cubeEdges[A]=u[A],this.lastCubeProps.axis[A]=c[A];for(var k=g,A=0;A<3;++A)o(g[A],A,this.bounds,u,c);for(var e=this.gl,T=m,A=0;A<3;++A)this.backgroundEnable[A]?T[A]=c[A]:T[A]=0;this._background.draw(r,i,a,s,T,this.backgroundColor),this._lines.bind(r,i,a,this);for(var A=0;A<3;++A){var E=[0,0,0];c[A]>0?E[A]=s[1][A]:E[A]=s[0][A];for(var S=0;S<2;++S){var L=(A+1+S)%3,z=(A+1+(1^S))%3;this.gridEnable[L]&&this._lines.drawGrid(L,z,this.bounds,E,this.gridColor[L],this.gridWidth[L]*this.pixelRatio)}for(var S=0;S<2;++S){var L=(A+1+S)%3,z=(A+1+(1^S))%3;this.zeroEnable[z]&&s[0][z]<=0&&s[1][z]>=0&&this._lines.drawZero(L,z,this.bounds,E,this.zeroLineColor[z],this.zeroLineWidth[z]*this.pixelRatio)}}for(var A=0;A<3;++A){this.lineEnable[A]&&this._lines.drawAxisLine(A,this.bounds,k[A].primalOffset,this.lineColor[A],this.lineWidth[A]*this.pixelRatio),this.lineMirror[A]&&this._lines.drawAxisLine(A,this.bounds,k[A].mirrorOffset,this.lineColor[A],this.lineWidth[A]*this.pixelRatio);for(var C=n(y,k[A].primalMinor),I=n(x,k[A].mirrorMinor),P=this.lineTickLength,S=0;S<3;++S){var D=M/r[5*S];C[S]*=P[S]*D,I[S]*=P[S]*D}this.lineTickEnable[A]&&this._lines.drawAxisTicks(A,k[A].primalOffset,C,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio),this.lineTickMirror[A]&&this._lines.drawAxisTicks(A,k[A].mirrorOffset,I,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio)}this._text.bind(r,i,a,this.pixelRatio);for(var A=0;A<3;++A){for(var R=k[A].primalMinor,O=n(b,k[A].primalOffset),S=0;S<3;++S)this.lineTickEnable[A]&&(O[S]+=M*R[S]*Math.max(this.lineTickLength[S],0)/r[5*S]);if(this.tickEnable[A]){for(var S=0;S<3;++S)O[S]+=M*R[S]*this.tickPad[S]/r[5*S];this._text.drawTicks(A,this.tickSize[A],this.tickAngle[A],O,this.tickColor[A])}if(this.labelEnable[A]){for(var S=0;S<3;++S)O[S]+=M*R[S]*this.labelPad[S]/r[5*S];O[A]+=.5*(s[0][A]+s[1][A]),this._text.drawLabel(A,this.labelSize[A],this.labelAngle[A],O,this.labelColor[A])}}},p.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null}},{"./lib/background.js":121,"./lib/cube.js":122,"./lib/lines.js":123,"./lib/text.js":125,"./lib/ticks.js":126}],121:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}function i(t){for(var e=[],r=[],i=0,l=0;l<3;++l)for(var u=(l+1)%3,c=(l+2)%3,h=[0,0,0],f=[0,0,0],d=-1;d<=1;d+=2){r.push(i,i+2,i+1,i+1,i+2,i+3),h[l]=d,f[l]=d;for(var p=-1;p<=1;p+=2){h[u]=p;for(var g=-1;g<=1;g+=2)h[c]=g,e.push(h[0],h[1],h[2],f[0],f[1],f[2]),i+=1}var m=u;u=c,c=m}var v=a(t,new Float32Array(e)),y=a(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),x=o(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=s(t);return b.attributes.position.location=0,b.attributes.normal.location=1,new n(t,v,x,b)}e.exports=i;var a=t("gl-buffer"),o=t("gl-vao"),s=t("./shaders").bg,l=n.prototype;l.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),l.disable(l.POLYGON_OFFSET_FILL)}},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":124,"gl-buffer":128,"gl-vao":236}],122:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;n<4;++n){t[n]=r[12+n];for(var i=0;i<3;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;eE&&(_|=1<E&&(_|=1<f[g][1]&&(R=g));for(var O=-1,g=0;g<3;++g){var F=R^1<f[j][0]&&(j=F)}}var N=m;N[0]=N[1]=N[2]=0,N[o.log2(O^R)]=R&O,N[o.log2(R^j)]=R&j;var B=7^j;B===_||B===D?(B=7^O,N[o.log2(j^B)]=B&j):N[o.log2(O^B)]=B&O;for(var U=v,V=_,A=0;A<3;++A)V&1<=0;--g){var m=u[p[g]];s.push(l*m[0],-l*m[1],t)}}for(var s=(this.gl,[]),l=[0,0,0],u=[0,0,0],c=[0,0,0],d=[0,0,0],p=0;p<3;++p){c[p]=s.length/f|0,o(.5*(t[0][p]+t[1][p]),e[p],r),d[p]=(s.length/f|0)-c[p],l[p]=s.length/f|0;for(var g=0;g=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,u=o%a;o<0?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u=0|u);var c=""+l;if(o<0&&(c="-"+c),i){for(var h=""+u;h.length=t[0][i];--o)a.push({x:o*e[i],text:n(e[i],o)});r.push(a)}return r}function a(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 a(t,e){for(var r=l.malloc(t.length,e),n=t.length,i=0;i=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,i){if(r=r||t.ARRAY_BUFFER,i=i||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var a=t.createBuffer(),o=new n(t,r,a,0,i);return o.update(e),o}var l=t("typedarray-pool"),u=t("ndarray-ops"),c=t("ndarray"),h=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],f=n.prototype;f.bind=function(){this.gl.bindBuffer(this.type,this.handle)},f.unbind=function(){this.gl.bindBuffer(this.type,null)},f.dispose=function(){this.gl.deleteBuffer(this.handle)},f.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&"undefined"!=typeof t.shape){var r=t.dtype;if(h.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var n=gl.getExtension("OES_element_index_uint");r=n&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&o(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=l.malloc(t.size,r),f=c(s,t.shape);u.assign(f,t),e<0?this.length=i(this.gl,this.type,this.length,this.usage,s,e):this.length=i(this.gl,this.type,this.length,this.usage,s.subarray(0,t.size),e),l.free(s)}}else if(Array.isArray(t)){var d;d=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),e<0?this.length=i(this.gl,this.type,this.length,this.usage,d,e):this.length=i(this.gl,this.type,this.length,this.usage,d.subarray(0,t.length),e),l.free(d)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");t=0|t,t<=0&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:427,"ndarray-ops":421,"typedarray-pool":496}],129:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],130:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":129}],131:[function(t,e,r){"use strict";function n(t,e,r,n){this.plot=t,this.shader=e,this.bufferHi=r,this.bufferLo=n,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.color=[0,0,0,1]}function i(t,e){var r=a(t.gl,l.vertex,l.fragment),i=o(t.gl),s=o(t.gl),u=new n(t,r,i,s);return u.update(e),t.addObject(u),u}var a=t("gl-shader"),o=t("gl-buffer"),s=t("typedarray-pool"),l=t("./lib/shaders");e.exports=i;var u=[[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]],c=n.prototype;c.draw=function(){var t=new Float32Array([0,0]),e=new Float32Array([0,0]),r=new Float32Array([0,0]),n=new Float32Array([0,0]),i=[1,1];return function(){var a=this.plot,o=this.shader,s=this.bounds,l=this.numPoints;if(l){var c=a.gl,h=a.dataBox,f=a.viewBox,d=a.pixelRatio,p=s[2]-s[0],g=s[3]-s[1],m=h[2]-h[0],v=h[3]-h[1],y=2*p/m,x=2*g/v,b=2*(s[0]-h[0])/m-1,_=2*(s[1]-h[1])/v-1;t[0]=y,t[1]=x,e[0]=y-t[0],e[1]=x-t[1],r[0]=b,r[1]=_,n[0]=b-r[0],n[1]=_-r[1];var w=f[2]-f[0],M=f[3]-f[1];i[0]=2*d/w,i[1]=2*d/M,o.bind(),o.uniforms.scaleHi=t,o.uniforms.scaleLo=e,o.uniforms.translateHi=r,o.uniforms.translateLo=n,o.uniforms.pixelScale=i,o.uniforms.color=this.color,this.bufferLo.bind(),o.attributes.positionLo.pointer(c.FLOAT,!1,16,0),this.bufferHi.bind(),o.attributes.positionHi.pointer(c.FLOAT,!1,16,0),o.attributes.pixelOffset.pointer(c.FLOAT,!1,16,8),c.drawArrays(c.TRIANGLES,0,l*u.length)}}}(),c.drawPick=function(t){return t},c.pick=function(t,e){return null},c.update=function(t){t=t||{};var e,r,n,i=t.positions||[],a=t.errors||[],o=1;"lineWidth"in t&&(o=+t.lineWidth);var l=5;"capSize"in t&&(l=+t.capSize),this.color=(t.color||[0,0,0,1]).slice();var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],h=this.numPoints=i.length>>1;for(e=0;e0&&(T*=_),E<0?E*=w:E>0&&(E*=M),m[x++]=f*(r-p+T),m[x++]=d*(n-g+E),m[x++]=o*k[2]+(l+o)*k[4],m[x++]=o*k[3]+(l+o)*k[5]}}for(e=0;e=1},h.isTransparent=function(){return this.opacity<1},h.drawTransparent=h.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||c,i=r.projection=t.projection||c;r.model=t.model||c,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var a=n[12],o=n[13],s=n[14],l=n[15],u=this.pixelRatio*(i[3]*a+i[7]*o+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var h=0;h<3;++h)e.lineWidth(this.lineWidth[h]),r.capSize=this.capSize[h]*u,e.drawArrays(e.LINES,this.lineOffset[h],this.lineCount[h]);this.vao.unbind()};var f=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=(n+e)%3,o=[0,0,0];o[a]=i,r.push(o)}t[e]=r}return t}();h.update=function(t){t=t||{},"lineWidth"in t&&(this.lineWidth=t.lineWidth,Array.isArray(this.lineWidth)||(this.lineWidth=[this.lineWidth,this.lineWidth,this.lineWidth])),"capSize"in t&&(this.capSize=t.capSize,Array.isArray(this.capSize)||(this.capSize=[this.capSize,this.capSize,this.capSize])),"opacity"in t&&(this.opacity=t.opacity);var e=t.color||[[0,0,0],[0,0,0],[0,0,0]],r=t.position,n=t.error;if(Array.isArray(e[0])||(e=[e,e,e]),r&&n){var o=[],s=r.length,l=0;this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.lineCount=[0,0,0];for(var u=0;u<3;++u){this.lineOffset[u]=l;t:for(var c=0;c0){var g=h.slice();g[u]+=d[1][u],o.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,g[0],g[1],g[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,g),l+=2+a(o,g,p,u)}}}this.lineCount[u]=l-this.lineOffset[u]}this.buffer.update(o)}},h.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":134,"gl-buffer":128,"gl-vao":236}],134:[function(t,e,r){"use strict";var n=t("gl-shader"),i="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}",a="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 n(t,i,a,null,[{name:"position",type:"vec3"},{name:"offset",type:"vec3"},{name:"color",type:"vec4"}])}},{"gl-shader":220}],135:[function(t,e,r){"use strict";function n(t){var e=t.getParameter(t.FRAMEBUFFER_BINDING),r=t.getParameter(t.RENDERBUFFER_BINDING),n=t.getParameter(t.TEXTURE_BINDING_2D);return[e,r,n]}function i(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function a(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);y=new Array(r+1);for(var n=0;n<=r;++n){for(var i=new Array(r),a=0;a1&&f.drawBuffersWEBGL(y[h]);var v=r.getExtension("WEBGL_depth_texture");v?d?t.depth=s(r,u,c,v.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=s(r,u,c,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=l(r,u,c,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=l(r,u,c,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=l(r,u,c,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var x=r.checkFramebufferStatus(r.FRAMEBUFFER);if(x!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var m=0;ms||r<0||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(a),u=0;uo||r<0||r>o)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),s<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var h=!0;"depth"in n&&(h=!!n.depth);var f=!1;return"stencil"in n&&(f=!!n.stencil),new c(t,e,r,l,s,h,f,i)}var d=t("gl-texture2d");e.exports=f;var p,g,m,v,y=null,x=c.prototype;Object.defineProperties(x,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return h(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t=0|t,h(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t=0|t,h(this,this._shape[0],t),t},enumerable:!1}}),x.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},x.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e2&&!this.usingDashes){var x=this.mitreShader;this.lineBufferLo.bind(),x.attributes.aLo.pointer(l.FLOAT,!1,48,0),this.lineBufferHi.bind(),x.bind();var b=x.uniforms;this.setProjectionUniforms(b,a),b.color=c,b.radius=s*u,x.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,i/3|0)}}}}(),f.drawPick=function(){var t=[0,0,0,0];return function(e){var r=this.vertCount,n=this.numPoints;if(this.pickOffset=e,!r)return e+n;var i=this.setProjectionModel(),a=this.plot,o=this.width,s=a.gl,l=a.pickPixelRatio,u=this.pickShader,c=this.pickBuffer;t[0]=255&e,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24,u.bind();var h=u.uniforms;this.setProjectionUniforms(h,i),h.width=o*l,h.pickOffset=t;var f=u.attributes;return this.lineBufferHi.bind(),f.aHi.pointer(s.FLOAT,!1,16,0),f.dHi.pointer(s.FLOAT,!1,16,8),this.lineBufferLo.bind(),f.aLo.pointer(s.FLOAT,!1,16,0),c.bind(),f.pick0.pointer(s.UNSIGNED_BYTE,!1,8,0),f.pick1.pointer(s.UNSIGNED_BYTE,!1,8,4),s.drawArrays(s.TRIANGLES,0,r),e+n}}(),f.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(r=n+i)return null;var a=r-n,o=this.data;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}},f.update=function(t){t=t||{};var e,r,n,a,o,s=this.plot.gl;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=i(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var h=t.dashes||[1],f=0;for(e=0;e1,this.dashPattern=l(s,u(d,[f,1,4],[1,0,0])),this.dashPattern.minFilter=s.NEAREST,this.dashPattern.magFilter=s.NEAREST,this.dashLength=f,c.free(d);var g=t.positions;this.data=g;var m=this.bounds;m[0]=m[1]=1/0,m[2]=m[3]=-(1/0);var v=this.numPoints=g.length>>>1;if(0!==v){for(e=0;e1;){var k=--n;a=g[2*n],o=g[2*n+1];var T=k-1,E=g[2*T],S=g[2*T+1];if(!(isNaN(a)||isNaN(o)||isNaN(E)||isNaN(S))){A+=1,a=(a-m[0])/(m[2]-m[0]),o=(o-m[1])/(m[3]-m[1]),E=(E-m[0])/(m[2]-m[0]),S=(S-m[1])/(m[3]-m[1]);var L=E-a,z=S-o,C=k|1<<24,I=k-1,P=k,D=k-1|1<<24;y[--w]=-z,y[--w]=-L,y[--w]=o,y[--w]=a,_[--M]=C,_[--M]=I,y[--w]=z,y[--w]=L,y[--w]=S,y[--w]=E,_[--M]=P,_[--M]=D,y[--w]=-z,y[--w]=-L,y[--w]=S,y[--w]=E,_[--M]=P,_[--M]=D,y[--w]=z,y[--w]=L,y[--w]=S,y[--w]=E,_[--M]=P,_[--M]=D,y[--w]=-z,y[--w]=-L,y[--w]=o,y[--w]=a,_[--M]=C,_[--M]=I,y[--w]=z,y[--w]=L,y[--w]=o,y[--w]=a,_[--M]=C,_[--M]=I}}for(e=0;e=1},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||v,view:t.view||v,projection:t.projection||v,clipBounds:i(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||v,view:t.view||v,projection:t.projection||v,pickId:this.pickId,clipBounds:i(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.update=function(t){var e,r;this.dirty=!0;var i=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var a=t.position||t.positions;if(a){var o=t.color||t.colors||[0,0,0,1],s=t.lineWidth||1,l=[],u=[],c=[],h=0,p=0,g=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],m=!1;t:for(e=1;e0){for(var x=0;x<24;++x)l.push(l[l.length-12]);p+=2,m=!0}continue t}g[0][r]=Math.min(g[0][r],v[r],y[r]),g[1][r]=Math.max(g[1][r],v[r],y[r])}var b,_;Array.isArray(o[0])?(b=o[e-1],_=o[e]):b=_=o,3===b.length&&(b=[b[0],b[1],b[2],1]),3===_.length&&(_=[_[0],_[1],_[2],1]);var w;w=Array.isArray(s)?s[e-1]:s;var M=h;if(h+=n(v,y),m){for(r=0;r<2;++r)l.push(v[0],v[1],v[2],y[0],y[1],y[2],M,w,b[0],b[1],b[2],b[3]);p+=2,m=!1}l.push(v[0],v[1],v[2],y[0],y[1],y[2],M,w,b[0],b[1],b[2],b[3],v[0],v[1],v[2],y[0],y[1],y[2],M,-w,b[0],b[1],b[2],b[3],y[0],y[1],y[2],v[0],v[1],v[2],h,-w,_[0],_[1],_[2],_[3],y[0],y[1],y[2],v[0],v[1],v[2],h,w,_[0],_[1],_[2],_[3]),p+=4}if(this.buffer.update(l),u.push(h),c.push(a[a.length-1].slice()),this.bounds=g,this.vertexCount=p,this.points=c,this.arcLength=u,"dashes"in t){var A=t.dashes,k=A.slice();for(k.unshift(0),e=1;e0?(n=2*Math.sqrt(r+1),t[3]=.25*n,t[0]=(e[6]-e[9])/n,t[1]=(e[8]-e[2])/n,t[2]=(e[1]-e[4])/n):e[0]>e[5]&e[0]>e[10]?(n=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/n,t[0]=.25*n,t[1]=(e[1]+e[4])/n,t[2]=(e[8]+e[2])/n):e[5]>e[10]?(n=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/n,t[0]=(e[1]+e[4])/n,t[1]=.25*n,t[2]=(e[6]+e[9])/n):(n=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/n,t[0]=(e[8]+e[2])/n,t[1]=(e[6]+e[9])/n,t[2]=.25*n),t},i.fromRotationTranslationScale=function(t,e,r,n){var i=e[0],a=e[1],o=e[2],s=e[3],l=i+i,u=a+a,c=o+o,h=i*l,f=i*u,d=i*c,p=a*u,g=a*c,m=o*c,v=s*l,y=s*u,x=s*c,b=n[0],_=n[1],w=n[2];return t[0]=(1-(p+m))*b,t[1]=(f+x)*b,t[2]=(d-y)*b,t[3]=0,t[4]=(f-x)*_,t[5]=(1-(h+m))*_,t[6]=(g+v)*_,t[7]=0,t[8]=(d+y)*w,t[9]=(g-v)*w,t[10]=(1-(h+p))*w,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},i.fromRotationTranslationScaleOrigin=function(t,e,r,n,i){var a=e[0],o=e[1],s=e[2],l=e[3],u=a+a,c=o+o,h=s+s,f=a*u,d=a*c,p=a*h,g=o*c,m=o*h,v=s*h,y=l*u,x=l*c,b=l*h,_=n[0],w=n[1],M=n[2],A=i[0],k=i[1],T=i[2];return t[0]=(1-(g+v))*_,t[1]=(d+b)*_,t[2]=(p-x)*_,t[3]=0,t[4]=(d-b)*w,t[5]=(1-(f+v))*w,t[6]=(m+y)*w,t[7]=0,t[8]=(p+x)*M,t[9]=(m-y)*M,t[10]=(1-(f+g))*M,t[11]=0,t[12]=r[0]+A-(t[0]*A+t[4]*k+t[8]*T),t[13]=r[1]+k-(t[1]*A+t[5]*k+t[9]*T),t[14]=r[2]+T-(t[2]*A+t[6]*k+t[10]*T),t[15]=1,t},i.fromQuat=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r+r,s=n+n,l=i+i,u=r*o,c=n*o,h=n*s,f=i*o,d=i*s,p=i*l,g=a*o,m=a*s,v=a*l;return t[0]=1-h-p,t[1]=c+v,t[2]=f-m,t[3]=0,t[4]=c-v,t[5]=1-u-p,t[6]=d+g,t[7]=0,t[8]=f+m,t[9]=d-g,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.frustum=function(t,e,r,n,i,a,o){var s=1/(r-e),l=1/(i-n),u=1/(a-o);return t[0]=2*a*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*l,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*l,t[10]=(o+a)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*a*2*u,t[15]=0,t},i.perspective=function(t,e,r,n,i){var a=1/Math.tan(e/2),o=1/(n-i);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*o,t[15]=0,t},i.perspectiveFromFieldOfView=function(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(o+s),u=2/(i+a);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((o-s)*l*.5),t[9]=(i-a)*u*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t},i.ortho=function(t,e,r,n,i,a,o){var s=1/(e-r),l=1/(n-i),u=1/(a-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]=(i+n)*l,t[14]=(o+a)*u,t[15]=1,t},i.lookAt=function(t,e,r,a){var o,s,l,u,c,h,f,d,p,g,m=e[0],v=e[1],y=e[2],x=a[0],b=a[1],_=a[2],w=r[0],M=r[1],A=r[2];return Math.abs(m-w).999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(a.cross(t,i,o),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+l,s.normalize(n,n))}}(),s.setAxes=function(){var t=i.create();return function(e,r,n,i){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],s.normalize(e,s.fromMat3(e,t))}}(),s.clone=o.clone,s.fromValues=o.fromValues,s.copy=o.copy,s.set=o.set,s.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.setAxisAngle=function(t,e,r){r=.5*r;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t},s.getAxisAngle=function(t,e){var r=2*Math.acos(e[3]),n=Math.sin(r/2);return 0!=n?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r},s.add=o.add,s.multiply=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*c+o*s+i*u-a*l,t[1]=i*c+o*l+a*s-n*u,t[2]=a*c+o*u+n*l-i*s,t[3]=o*c-n*s-i*l-a*u,t},s.mul=s.multiply,s.scale=o.scale,s.rotateX=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+o*s,t[1]=i*l+a*s,t[2]=a*l-i*s,t[3]=o*l-n*s,t},s.rotateY=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l-a*s,t[1]=i*l+o*s,t[2]=a*l+n*s,t[3]=o*l-i*s,t},s.rotateZ=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*s,t[1]=i*l-n*s,t[2]=a*l+o*s,t[3]=o*l-a*s,t},s.calculateW=function(t,e){var r=e[0],n=e[1],i=e[2];return t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),t},s.dot=o.dot,s.lerp=o.lerp,s.slerp=function(t,e,r,n){var i,a,o,s,l,u=e[0],c=e[1],h=e[2],f=e[3],d=r[0],p=r[1],g=r[2],m=r[3];return a=u*d+c*p+h*g+f*m,a<0&&(a=-a,d=-d,p=-p,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),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*h+l*g,t[3]=s*f+l*m,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(r,n,i,a,o,l){return s.slerp(t,n,o,l),s.slerp(e,i,a,l),s.slerp(r,t,e,2*l*(1-l)),r}}(),s.invert=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-i*s,t[3]=a*s,t},s.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},s.length=o.length,s.len=s.length,s.squaredLength=o.squaredLength,s.sqrLen=s.squaredLength,s.normalize=o.normalize,s.fromMat3=function(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*o+o]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*a+o]-e[3*o+a])*r,t[a]=(e[3*a+i]+e[3*i+a])*r,t[o]=(e[3*o+i]+e[3*i+o])*r}return t},s.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},s.exactEquals=o.exactEquals,s.equals=o.equals,e.exports=s},{"./common.js":162,"./mat3.js":165,"./vec3.js":169,"./vec4.js":170}],168:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},i.fromValues=function(t,e){var r=new n.ARRAY_TYPE(2);return r[0]=t,r[1]=e,r},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},i.set=function(t,e,r){return t[0]=e,t[1]=r,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(r*r+n*n)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1];return e*e+r*r},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},i.cross=function(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t},i.lerp=function(t,e,r,n){var i=e[0],a=e[1];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t},i.transformMat2=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t},i.transformMat2d=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=2),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.cross=function(t,e,r){var n=e[0],i=e[1],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},i.lerp=function(t,e,r,n){var i=e[0],a=e[1],o=e[2];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t},i.hermite=function(t,e,r,n,i,a){var o=a*a,s=o*(2*a-3)+1,l=o*(a-2)+a,u=o*(a-1),c=o*(3-2*a);return t[0]=e[0]*s+r[0]*l+n[0]*u+i[0]*c,t[1]=e[1]*s+r[1]*l+n[1]*u+i[1]*c,t[2]=e[2]*s+r[2]*l+n[2]*u+i[2]*c,t},i.bezier=function(t,e,r,n,i,a){var o=1-a,s=o*o,l=a*a,u=s*o,c=3*a*s,h=3*l*o,f=l*a;return t[0]=e[0]*u+r[0]*c+n[0]*h+i[0]*f,t[1]=e[1]*u+r[1]*c+n[1]*h+i[1]*f,t[2]=e[2]*u+r[2]*c+n[2]*h+i[2]*f,t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI,i=2*n.RANDOM()-1,a=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*a,t[1]=Math.sin(r)*a,t[2]=i*e,t},i.transformMat4=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},i.transformMat3=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},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*a-l*i,h=u*i+l*n-o*a,f=u*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=c*u+d*-o+h*-l-f*-s,t[1]=h*u+d*-s+f*-o-c*-l,t[2]=f*u+d*-l+c*-s-h*-o,t},i.rotateX=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},i.rotateY=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},i.rotateZ=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},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=3),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s1?0:Math.acos(a)},i.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},i.equals=function(t,e){var r=t[0],i=t[1],a=t[2],o=e[0],s=e[1],l=e[2];return Math.abs(r-o)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(a-l)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))},e.exports=i},{"./common.js":162}],170:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.fromValues=function(t,e,r,i){var a=new n.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=r,a[3]=i,a},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.set=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+a*a)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return r*r+n*n+i*i+a*a},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=n*o,t[2]=i*o,t[3]=a*o),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.lerp=function(t,e,r,n){var i=e[0],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},i.random=function(t,e){return e=e||1,t[0]=n.RANDOM(),t[1]=n.RANDOM(),t[2]=n.RANDOM(),t[3]=n.RANDOM(),i.normalize(t,t),i.scale(t,t,e),t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],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},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*a-l*i,h=u*i+l*n-o*a,f=u*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=c*u+d*-o+h*-l-f*-s,t[1]=h*u+d*-s+f*-o-c*-l,t[2]=f*u+d*-l+c*-s-h*-o,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s1.0001)return null;m+=g[c]}return Math.abs(m-1)>.001?null:[h,o(t,g),g]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:36,"polytope-closest-point/lib/closest_point_2d.js":444}],172:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}",i="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat cookTorranceSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution_2_0(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\n\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n \n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular_1_1(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}",a="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}",o="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",u="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}",c="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}",h="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}",f="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}",d="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n";r.meshShader={vertex:n,fragment:i,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:a,fragment:o,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:s,fragment:l,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:h,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:f,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{}],173:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u,c,h,f,d,p,g,m,v,y,x,b,_,w,M,A,k,T){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=a,this.pointPickShader=o,this.contourShader=s,this.trianglePositions=l,this.triangleColors=c,this.triangleNormals=f,this.triangleUVs=h,this.triangleIds=u,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=m,this.edgeUVs=v,this.edgeIds=g,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=x,this.pointColors=_,this.pointUVs=w,this.pointSizes=M,this.pointIds=b,this.pointVAO=A,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=k,this.contourVAO=T,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=R,this._view=R,this._projection=R,this._resolution=[1,1]}function i(t){for(var e=A({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return M(r,[256,256,4],[4,0,1])}function a(t,e,r){for(var n=new Array(e),i=0;i=1},O.isTransparent=function(){return this.opacity<1},O.pickSlots=1,O.setPickBase=function(t){this.pickId=t},O.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=k(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=T.mallocFloat32(6*a),s=0,l=0;l0){var f=this.triShader;f.bind(),f.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var f=this.lineShader;f.bind(),f.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){var f=this.pointShader;f.bind(),f.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}if(this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0){var f=this.contourShader;f.bind(),f.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind()}},O.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||R,n=t.view||R,i=t.projection||R,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={model:r,view:n,projection:i,clipBounds:a,pickId:this.pickId/255},l=this.pickShader;if(l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0){var l=this.pointPickShader;l.bind(),l.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}},O.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),a=0;as[A]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=m[n],a.uniforms.angle=v[n],u.drawArrays(u.TRIANGLES,s[A],s[k]-s[A]))),y[n]&&M&&(e[1^n]-=T*d*x[n],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=b[n],a.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,M)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*g[n+2],As[A]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=m[n+2],a.uniforms.angle=v[n+2],u.drawArrays(u.TRIANGLES,s[A],s[k]-s[A]))),y[n+2]&&M&&(e[1^n]+=T*d*x[n+2],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=b[n+2],a.uniforms.angle=_[n+2],u.drawArrays(u.TRIANGLES,w,M))}}(),c.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,i=r.gl,a=r.screenBox,o=r.titleCenter,s=r.titleAngle,l=r.titleColor,u=r.pixelRatio;if(this.titleCount){for(var c=0;c<2;++c)e[c]=2*(o[c]*u-a[c])/(a[2+c]-a[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,a=n._tickBounds,o=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var u=0;u<2;++u){var c=a[u],h=a[u+2],f=h-c,d=.5*(o[u+2]+o[u]),p=o[u+2]-o[u],g=l[u],m=l[u+2],v=m-g,y=s[u],x=s[u+2],b=x-y;e[u]=2*f/p*v/b,t[u]=2*(c-d)/p*v/b}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){var e,r,n,i,a,o=[],l=t.ticks,u=t.bounds;for(a=0;a<2;++a){var c=[Math.floor(o.length/3)],h=[-(1/0)],f=l[a];for(e=0;er)for(t=r;te)for(t=e;t=0){for(var A=0|M.type.charAt(M.type.length-1),k=new Array(A),T=0;T=0;)E+=1;w[x]=E}var S=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,w),Object.defineProperty(d,"uniforms",o(p,d,r,S))},e.exports=a},{"./lib/GLError":181,"./lib/create-attributes":182,"./lib/create-uniforms":183,"./lib/reflect":184,"./lib/runtime-reflect":185,"./lib/shader-cache":186}],181:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="GLError",n.prototype.constructor=n,e.exports=n},{}],182:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}function i(t,e,r,i,a,o,s){for(var l=["gl","v"],u=[],c=0;c=0){var p=f.charCodeAt(f.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);i(t,e,d[0],n,p,o,h)}else{if(!(f.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+h+": "+f);var p=f.charCodeAt(f.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);a(t,e,d,n,p,o,h)}}}return o}e.exports=o;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,a=i._gl,o=i._locations[i._index];a.vertexAttribPointer(o,i._dimension,t||a.FLOAT,!!e,r||0,n||0),a.enableVertexAttribArray(o)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":181}],183:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;n4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(i<2||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],a=t;a+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function h(e){for(var n=["return function updateProperty(obj){"],i=c("",e),o=0;o4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var o=p(i);Object.defineProperty(t,e,{get:n(o),set:h(i),enumerable:!0,configurable:!1})}else a[i]?Object.defineProperty(t,e,{get:l(i),set:h(i),enumerable:!0,configurable:!1}):t[e]=f(r[i].type)}function p(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){l[0]in o||(o[l[0]]=[]),o=o[l[0]];for(var u=1;u1)for(var l=0;l=0){ -var g=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(g,e[1],g,e[3],d[p],f[p]):o.drawLine(e[0],g,e[2],g,d[p],f[p])}}for(var p=0;p=0;--t)this.objects[t].dispose();this.objects.length=0;for(var t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},f.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},f.removeObject=function(t){for(var e=this.objects,r=0;r0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function o(t){return"boolean"!=typeof t||t}function s(t){function e(){if(!_&&H.autoResize){var t=w.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*H.pixelRatio),i=0|Math.ceil(r*H.pixelRatio);if(n!==w.width||i!==w.height){w.width=n,w.height=i;var a=w.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",j=!0}}}function r(){for(var t=D.length,e=F.length,r=0;r0&&0===O[e-1];)O.pop(),F.pop().dispose()}function s(){return!!H.contextLost||void(A.isContextLost()&&(H.contextLost=!0,H.mouseListener.enabled=!1,H.selection.object=null,H.oncontextloss&&H.oncontextloss()))}function y(){if(!s()){A.colorMask(!0,!0,!0,!0),A.depthMask(!0),A.disable(A.BLEND),A.enable(A.DEPTH_TEST);for(var t=D.length,e=F.length,r=0;rT.distance)continue;for(var u=0;u>>1;for(r=0;r=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}function a(t,e){var r=t.gl,i=s(r),a=s(r),l=o(r,u.pointVertex,u.pointFragment),c=o(r,u.pickVertex,u.pickFragment),h=new n(t,i,a,l,c);return h.update(e),t.addObject(h),h}var o=t("gl-shader"),s=t("gl-buffer"),l=t("typedarray-pool"),u=t("./lib/shader");e.exports=a;var c=n.prototype;c.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},c.update=function(t){function e(e,r){return e in t?t[e]:r}var r;t=t||{},this.sizeMin=e("sizeMin",.5),this.sizeMax=e("sizeMax",20),this.color=e("color",[1,0,0,1]).slice(),this.areaRatio=e("areaRatio",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.blend=e("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,a=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,o=t.positions,s=i?o:l.mallocFloat32(o.length),u=a?t.idToIndex:l.mallocInt32(n);if(i||s.set(o),!a)for(s.set(o),r=0;r>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),a.attributes.pickId.pointer(o.UNSIGNED_BYTE),a.uniforms.pickOffset=e,this.pickOffset=r);var f=o.getParameter(o.BLEND),d=o.getParameter(o.DITHER);return f&&!this.blend&&o.disable(o.BLEND),d&&o.disable(o.DITHER),o.drawArrays(o.POINTS,0,this.pointCount),f&&!this.blend&&o.enable(o.BLEND),d&&o.enable(o.DITHER),r+this.pointCount}}(),c.draw=c.unifiedDraw,c.drawPick=c.unifiedDraw,c.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":190,"gl-buffer":128,"gl-shader":191,"typedarray-pool":496}],199:[function(t,e,r){function n(t,e,r,n){var i,a,o,s,l,u=e[0],c=e[1],h=e[2],f=e[3],d=r[0],p=r[1],g=r[2],m=r[3];return a=u*d+c*p+h*g+f*m,a<0&&(a=-a,d=-d,p=-p,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),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*h+l*g,t[3]=s*f+l*m,t}e.exports=n},{}],200:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4(scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n",fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4(scHi * posHi + trHi\n + scLo * posHi + trLo\n + scHi * posLo\n + scLo * posLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],201:[function(t,e,r){arguments[4][180][0].apply(r,arguments)},{"./lib/GLError":202,"./lib/create-attributes":203,"./lib/create-uniforms":204,"./lib/reflect":205,"./lib/runtime-reflect":206,"./lib/shader-cache":207,dup:180}],202:[function(t,e,r){arguments[4][181][0].apply(r,arguments)},{dup:181}],203:[function(t,e,r){arguments[4][182][0].apply(r,arguments)},{"./GLError":202,dup:182}],204:[function(t,e,r){arguments[4][183][0].apply(r,arguments)},{"./GLError":202,"./reflect":205,dup:183}],205:[function(t,e,r){arguments[4][184][0].apply(r,arguments)},{dup:184}],206:[function(t,e,r){arguments[4][185][0].apply(r,arguments)},{dup:185}],207:[function(t,e,r){arguments[4][186][0].apply(r,arguments)},{"./GLError":202,dup:186,"gl-format-compiler-error":136,"weakmap-shim":517}],208:[function(t,e,r){"use strict";function n(t){if(t in f)return f[t];var e=c(t,{polygons:!0,font:"sans-serif",textAlign:"left",textBaseline:"alphabetic"}),r=[],n=[];e.forEach(function(t){t.forEach(function(t){for(var e=0;e>8*d&255;f.uniforms.pickOffset=o,this.idBuffer.bind(),f.attributes.id.pointer(h.UNSIGNED_BYTE,!1)}else this.colorBuffer.bind(),f.attributes.color.pointer(h.UNSIGNED_BYTE,!0);return this.posHiBuffer.bind(),f.attributes.positionHi.pointer(),this.posLoBuffer.bind(),f.attributes.positionLo.pointer(),this.offsetBuffer.bind(),f.attributes.offset.pointer(),f.uniforms.pixelScale=a,f.uniforms.scaleHi=e,f.uniforms.scaleLo=r,f.uniforms.translateHi=n,f.uniforms.translateLo=i,h.drawArrays(h.TRIANGLES,0,c),l?s+this.numPoints:void 0}}(),d.draw=d.drawPick,d.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;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]]}},d.update=function(t){t=t||{};var e,r,i=t.positions||[],a=t.colors||[],o=t.glyphs||[],s=t.sizes||[],c=t.borderWidths||[],h=t.borderColors||[];this.points=i;var f,d,p=this.bounds=[1/0,1/0,-(1/0),-(1/0)],g=0,m=[],v=[];for(e=0;e>1,r=0;r<2;++r)p[r]=Math.min(p[r],i[2*e+r]),p[2+r]=Math.max(p[2+r],i[2*e+r]);p[0]===p[2]&&(p[2]+=1),p[3]===p[1]&&(p[3]+=1);var y=1/(p[2]-p[0]),x=1/(p[3]-p[1]),b=p[0],_=p[1],w=u.mallocFloat64(2*g),M=u.mallocFloat32(2*g),A=u.mallocFloat32(2*g),k=u.mallocFloat32(2*g),T=u.mallocUint8(4*g),E=u.mallocUint32(g),S=0;for(e=0;et;){var d=r[f-1],p=n[2*(f-1)];if((d-s||l-p)>=0)break;r[f]=d,n[2*f]=p,n[2*f+1]=n[2*f-1],i[f]=i[f-1],a[f]=a[f-1],f-=1}r[f]=s,n[2*f]=l,n[2*f+1]=u,i[f]=c,a[f]=h}}function a(t,e,r,n,i,a){var o=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=a[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,i[e]=u,a[e]=c}function o(t,e,r,n,i,a){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e]}function s(t,e,r,n,i,a,o){var s=n[t],l=i[2*t],u=i[2*t+1],c=a[t],h=o[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],a[t]=a[e],o[t]=o[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],a[e]=a[r],o[e]=o[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,a[r]=c,o[r]=h}function l(t,e,r,n,i,a,o,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=a,c[e]=o}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0; -}function c(t,e,r,n,i,a,o,s){return(e-a[t]||o[2*t]-r||i-s[t])<0}function h(t,e,r,n,d,p){var g=(e-t+1)/6|0,m=t+g,v=e-g,y=t+e>>1,x=y-g,b=y+g,_=m,w=x,M=y,A=b,k=v,T=t+1,E=e-1,S=0;u(_,w,r,n,d,p)&&(S=_,_=w,w=S),u(A,k,r,n,d,p)&&(S=A,A=k,k=S),u(_,M,r,n,d,p)&&(S=_,_=M,M=S),u(w,M,r,n,d,p)&&(S=w,w=M,M=S),u(_,A,r,n,d,p)&&(S=_,_=A,A=S),u(M,A,r,n,d,p)&&(S=M,M=A,A=S),u(w,k,r,n,d,p)&&(S=w,w=k,k=S),u(w,M,r,n,d,p)&&(S=w,w=M,M=S),u(A,k,r,n,d,p)&&(S=A,A=k,k=S);var L=r[w],z=n[2*w],C=n[2*w+1],I=d[w],P=p[w],D=r[A],R=n[2*A],O=n[2*A+1],F=d[A],j=p[A],N=_,B=M,U=k,V=m,q=y,H=v,G=r[N],X=r[B],Y=r[U];r[V]=G,r[q]=X,r[H]=Y;for(var W=0;W<2;++W){var Z=n[2*N+W],Q=n[2*B+W],K=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=Q,n[2*H+W]=K}var $=d[N],J=d[B],tt=d[U];d[V]=$,d[q]=J,d[H]=tt;var et=p[N],rt=p[B],nt=p[U];p[V]=et,p[q]=rt,p[H]=nt,o(x,t,r,n,d,p),o(b,e,r,n,d,p);for(var it=T;it<=E;++it)if(c(it,L,z,C,I,r,n,d))it!==T&&a(it,T,r,n,d,p),++T;else if(!c(it,D,R,O,F,r,n,d))for(;;){if(c(E,D,R,O,F,r,n,d)){c(E,L,z,C,I,r,n,d)?(s(it,T,E,r,n,d,p),++T,--E):(a(it,E,r,n,d,p),--E);break}if(--E=Math.max(.9*d,32)){var x=u+s>>>1;l(m,v,h,f,x,c+1),f=x}l(m,v,h,f,y,c+1),f=y}}}var u=t.length>>>1;if(u<1)return[];for(var c=1/0,h=1/0,f=-(1/0),d=-(1/0),p=0;p=0;--_){t[2*_]=(t[2*_]-c)*v,t[2*_+1]=(t[2*_+1]-h)*y;var k=b[_];k!==M&&(w.push(new i(x*Math.pow(.5,k),_+1,A-(_+1))),A=_+1,M=k)}return w.push(new i(x*Math.pow(.5,k+1),0,A)),o.free(b),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=a},{"./lib/sort":211,"typedarray-pool":496}],213:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.plot=t,this.positionBufferHi=e,this.positionBufferLo=r,this.pickBuffer=n,this.weightBuffer=i,this.shader=a,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=o(r),s=o(r),l=o(r),u=o(r),h=a(r,c.pointVertex,c.pointFragment),f=a(r,c.pickVertex,c.pickFragment),d=new n(t,i,s,l,u,h,f);return d.update(e),t.addObject(d),d}var a=t("gl-shader"),o=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var h=n.prototype,f=new Float32Array(2),d=new Float32Array(2),p=new Float32Array(2),g=new Float32Array(2),m=[0,0,0,0];h.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBufferHi.dispose(),this.positionBufferLo.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},h.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords),this.points=t.positions;var r=this.points.length>>>1,n=u.mallocInt32(r),i=u.mallocFloat32(2*r),a=u.mallocFloat64(2*r);a.set(this.points),this.scales=l(a,n,i,this.bounds);var o=u.mallocFloat64(r),s=u.mallocFloat32(2*r),c=u.mallocFloat32(2*r);s.set(a);for(var h=0,f=0;h>8&255,m[2]=t>>16&255,m[3]=t>>24&255,n.uniforms.pickOffset=m,l.bind(),n.attributes.pickId.pointer(v.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());for(var I=this.xCoords,P=(b[0]-u[0]-E*c*y)/_,D=(b[2]-u[0]+E*c*y)/_,R=!0,O=i.length-1;O>=0;O--){var F=i[O];if(!(F.pixelSize1)){var j=F.offset,N=F.count+j,B=s.ge(I,P,j,N-1),U=s.lt(I,D,B,N-1)+1;U>B&&v.drawArrays(v.POINTS,B,U-B),!e&&R&&(R=!1,n.uniforms.useWeight=0)}}},h.drawPick=h.draw,h.pick=function(t,e,r){var n=r-this.pickOffset;return n<0||n>=this.pointCount?null:{object:this,pointId:n,dataCoord:[this.points[2*n],this.points[2*n+1]]}}},{"./lib/shader":209,"binary-search-bounds":210,"gl-buffer":128,"gl-shader":220,"snap-points-2d":212,"typedarray-pool":496}],214:[function(t,e,r){"use strict";function n(t,e){var r=a[e];if(r||(r=a[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-(1/0),-(1/0)]],l=0;lMath.abs(O[1])){var F=R;R=O,O=F,F=P,P=D,D=F;var j=C;C=I,I=j}R[0]<0&&(P[C]=-1),O[1]>0&&(D[I]=-1);for(var N=0,B=0,z=0;z<4;++z)N+=Math.pow(p[4*C+z],2),B+=Math.pow(p[4*I+z],2);P[C]/=Math.sqrt(N),D[I]/=Math.sqrt(B),d.axes[0]=P,d.axes[1]=D,d.fragClipBounds[0]=u(S,x[0],_,-1e8),d.fragClipBounds[1]=u(S,x[1],_,1e8),e.vao.draw(f.TRIANGLES,e.vertexCount),e.lineWidth>0&&(f.lineWidth(e.lineWidth),e.vao.draw(f.LINES,e.lineVertexCount,e.vertexCount))}}function f(t,e,r,n,i,a){var o=r.gl;if(r.vao.bind(),i===r.opacity<1||a){t.bind();var s=t.uniforms;s.model=n.model||b,s.view=n.view||b,s.projection=n.projection||b,w[0]=2/o.drawingBufferWidth,w[1]=2/o.drawingBufferHeight,s.screenSize=w,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),r.lineWidth>0&&(o.lineWidth(r.lineWidth),r.vao.draw(o.LINES,r.lineVertexCount,r.vertexCount))}h(e,r,n,i,a),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),a=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=p(e),c=p(e),h=p(e),f=p(e),d=g(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:h,size:2,type:e.FLOAT},{buffer:f,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),m=new o(e,r,n,i,u,c,h,f,d,a,s,l);return m.update(t),m}var p=t("gl-buffer"),g=t("gl-vao"),m=t("typedarray-pool"),v=t("gl-mat4/multiply"),y=t("./lib/shaders"),x=t("./lib/glyphs"),b=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=d;var _=o.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],M=[0,0,0],A=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=b.slice(),S=[0,0,0],L=[[0,0,0],[0,0,0]],z=[-1e8,-1e8,-1e8],C=[1e8,1e8,1e8],I=[z,C];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;f(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||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},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",a=t.alignment||[0,0],o=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,h=t.angle,f=t.lineColor,d=0,p=0,g=0,v=n.length;t:for(var y=0;y0&&(C[0]=-a[0]*(1+k[0][0]));for(var q=M.cells,H=M.positions,_=0;_0){var v=r*c;o.drawBox(h-v,f-v,d+v,f+v,a),o.drawBox(h-v,p-v,d+v,p+v,a),o.drawBox(h-v,f-v,h+v,p+v,a),o.drawBox(d-v,f-v,d+v,p+v,a)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":217,"gl-buffer":128,"gl-shader":220}],219:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function a(t,e){var r=o(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=a;var o=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(_inline_49_arg0_<255||_inline_49_arg1_<255||_inline_49_arg2_<255||_inline_49_arg3_<255){var _inline_49_l=_inline_49_arg4_-_inline_49_arg6_[0],_inline_49_a=_inline_49_arg5_-_inline_49_arg6_[1],_inline_49_f=_inline_49_l*_inline_49_l+_inline_49_a*_inline_49_a;_inline_49_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;i=0){for(var A=0|M.type.charAt(M.type.length-1),k=new Array(A),T=0;T=0;)E+=1;_[w]=E}var S=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,x,_),Object.defineProperty(d,"uniforms",o(p,d,r,S))},e.exports=a},{"./lib/GLError":221,"./lib/create-attributes":222,"./lib/create-uniforms":223,"./lib/reflect":224,"./lib/runtime-reflect":225,"./lib/shader-cache":226}],221:[function(t,e,r){arguments[4][181][0].apply(r,arguments)},{dup:181}],222:[function(t,e,r){arguments[4][182][0].apply(r,arguments)},{"./GLError":221,dup:182}],223:[function(t,e,r){arguments[4][183][0].apply(r,arguments)},{"./GLError":221,"./reflect":224,dup:183}],224:[function(t,e,r){arguments[4][184][0].apply(r,arguments)},{dup:184}],225:[function(t,e,r){arguments[4][185][0].apply(r,arguments)},{dup:185}],226:[function(t,e,r){arguments[4][186][0].apply(r,arguments)},{"./GLError":221,dup:186,"gl-format-compiler-error":136,"weakmap-shim":517}],227:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}function i(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=i;var a=n.prototype;a.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},a.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,a=i.line,o=i.dataBox,s=i.viewBox;if(a.bind(),o[0]<=n[0]&&n[0]<=o[2]&&o[1]<=n[1]&&n[1]<=o[3]){var l=s[0]+(n[0]-o[0])/(o[2]-o[0])*(s[2]-s[0]),u=s[1]+(n[1]-o[1])/(o[3]-o[1])*(s[3]-s[1]);t[0]&&a.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&a.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&a.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&a.drawLine(l,u,l,s[3],e[3],r[3])}},a.dispose=function(){this.plot.removeOverlay(this)}},{}],228:[function(t,e,r){"use strict";var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, color;\nattribute float weight;\n\nuniform mat4 model, view, projection;\nuniform vec3 coordinates[3];\nuniform vec4 colors[3];\nuniform vec2 screenShape;\nuniform float lineWidth;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vertexPosition = mix(coordinates[0],\n mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));\n\n vec4 clipPos = projection * view * model * vec4(vertexPosition, 1.0);\n vec2 clipOffset = (projection * view * model * vec4(color, 0.0)).xy;\n vec2 delta = weight * clipOffset * screenShape;\n vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;\n\n gl_Position = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);\n fragColor = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}";e.exports=function(t){return n(t,i,a,null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":220}],229:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n,this.pixelRatio=1,this.bounds=[[-1e3,-1e3,-1e3],[1e3,1e3,1e3]],this.position=[0,0,0],this.lineWidth=[2,2,2],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.enabled=[!0,!0,!0],this.drawSides=[!0,!0,!0],this.axes=null}function i(t,e){function r(t,e,r,n,a,o){var s=[t,e,r,0,0,0,1];s[n+3]=1,s[n]=a,i.push.apply(i,s),s[6]=-1,i.push.apply(i,s),s[n]=o,i.push.apply(i,s),i.push.apply(i,s),s[6]=1,i.push.apply(i,s),s[n]=a,i.push.apply(i,s)}var i=[];r(0,0,0,0,0,1),r(0,0,0,1,0,1),r(0,0,0,2,0,1),r(1,0,0,1,-1,1),r(1,0,0,2,-1,1),r(0,1,0,0,-1,1),r(0,1,0,2,-1,1),r(0,0,1,0,-1,1),r(0,0,1,1,-1,1);var l=a(t,i),u=o(t,[{type:t.FLOAT,buffer:l,size:3,offset:0,stride:28},{type:t.FLOAT,buffer:l,size:3,offset:12,stride:28},{type:t.FLOAT,buffer:l,size:1,offset:24,stride:28}]),c=s(t);c.attributes.position.location=0,c.attributes.color.location=1,c.attributes.weight.location=2;var h=new n(t,l,u,c);return h.update(e),h}var a=t("gl-buffer"),o=t("gl-vao"),s=t("./shaders/index");e.exports=i;var l=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],u=n.prototype,c=[0,0,0],h=[0,0,0],f=[0,0];u.isTransparent=function(){return!1},u.drawTransparent=function(t){},u.draw=function(t){var e=this.gl,r=this.vao,n=this.shader;r.bind(),n.bind();var i,a=t.model||l,o=t.view||l,s=t.projection||l;this.axes&&(i=this.axes.lastCubeProps.axis);for(var u=c,d=h,p=0;p<3;++p)i&&i[p]<0?(u[p]=this.bounds[0][p],d[p]=this.bounds[1][p]):(u[p]=this.bounds[1][p],d[p]=this.bounds[0][p]);f[0]=e.drawingBufferWidth,f[1]=e.drawingBufferHeight,n.uniforms.model=a,n.uniforms.view=o, -n.uniforms.projection=s,n.uniforms.coordinates=[this.position,u,d],n.uniforms.colors=this.colors,n.uniforms.screenShape=f;for(var p=0;p<3;++p)n.uniforms.lineWidth=this.lineWidth[p]*this.pixelRatio,this.enabled[p]&&(r.draw(e.TRIANGLES,6,6*p),this.drawSides[p]&&r.draw(e.TRIANGLES,12,18+12*p));r.unbind()},u.update=function(t){t&&("bounds"in t&&(this.bounds=t.bounds),"position"in t&&(this.position=t.position),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"colors"in t&&(this.colors=t.colors),"enabled"in t&&(this.enabled=t.enabled),"drawSides"in t&&(this.drawSides=t.drawSides))},u.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders/index":228,"gl-buffer":128,"gl-vao":236}],230:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\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 worldCoordinate = vec3(uv.zw, f.x);\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n vec4 clipPosition = projection * view * worldPosition;\n gl_Position = clipPosition;\n kill = f.y;\n value = f.z;\n planeCoordinate = uv.xy;\n\n vColor = texture2D(colormap, vec2(value, value));\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat beckmannSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution_2_0(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\n}\n\n\n\nuniform vec3 lowerBound, upperBound;\nuniform float contourTint;\nuniform vec4 contourColor;\nuniform sampler2D colormap;\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform float vertexColor;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n if (kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = beckmannSpecular_1_1(L, V, N, roughness);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //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",o="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",s="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n";r.createShader=function(t){var e=n(t,i,a,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createPickShader=function(t){var e=n(t,i,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createContourShader=function(t){var e=n(t,o,a,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,o,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":220}],231:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}function i(t){var e=b([y({colormap:t,nshades:O,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);return x.divseq(e,255),e}function a(t,e,r,i,a,o,s,l,u,c,h,f,d,p){this.gl=t,this.shape=e,this.bounds=r,this.intensityBounds=[],this._shader=i,this._pickShader=a,this._coordinateBuffer=o,this._vao=s,this._colorMap=l,this._contourShader=u,this._contourPickShader=c,this._contourBuffer=h,this._contourVAO=f,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new n([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=d,this._dynamicVAO=p,this._dynamicOffsets=[0,0,0],this._dynamicCounts=[0,0,0],this.contourWidth=[1,1,1],this.contourLevels=[[1],[1],[1]],this.contourTint=[0,0,0],this.contourColor=[[.5,.5,.5,1],[.5,.5,.5,1],[.5,.5,.5,1]],this.showContour=!0,this.showSurface=!0,this.enableHighlight=[!0,!0,!0],this.highlightColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.highlightTint=[1,1,1],this.highlightLevel=[-1,-1,-1],this.enableDynamic=[!0,!0,!0],this.dynamicLevel=[NaN,NaN,NaN],this.dynamicColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.dynamicTint=[1,1,1],this.dynamicWidth=[1,1,1],this.axesBounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.surfaceProject=[!1,!1,!1],this.contourProject=[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],this.colorBounds=[!1,!1],this._field=[_(v.mallocFloat(1024),[0,0]),_(v.mallocFloat(1024),[0,0]),_(v.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.snapToData=!1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.vertexColor=0,this.dirty=!0}function o(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||j,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=N.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],M(l,t.model,l);var u=N.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return N.showSurface=o,N.showContour=s,N}function s(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=B;n.model=t.model||P,n.view=t.view||P,n.projection=t.projection||P,n.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],n.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],n.contourColor=this.contourColor[0],n.inverseModel=A(n.inverseModel,n.model);for(var i=0;i<2;++i)for(var a=n.clipBounds[i],s=0;s<3;++s)a[s]=Math.min(Math.max(this.clipBounds[i][s],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=V,n.vertexColor=this.vertexColor;var l=U;for(M(l,n.view,n.model),M(l,n.projection,l),A(l,l),i=0;i<3;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;i<3;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;i<3;++i){var c=l[12+i];for(s=0;s<3;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var h=o(n,this);if(h.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;i<3;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=h.projections[i],this._shader.uniforms.clipBounds=h.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(h.showContour&&!e){var f=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,f.bind(),f.uniforms=n;var d=this._contourVAO;for(d.bind(),i=0;i<3;++i)for(f.uniforms.permutation=R[i],r.lineWidth(this.contourWidth[i]),s=0;s=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},F.pickSlots=1,F.setPickBase=function(t){this.pickId=t};var j=[0,0,0],N={showSurface:!1,showContour:!1,projections:[P.slice(),P.slice(),P.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:P,view:P,projection:P,inverseModel:P.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1,vertexColor:0},U=P.slice(),V=[1,0,0,0,1,0,0,0,1];F.draw=function(t){return s.call(this,t,!1)},F.drawTransparent=function(t){return s.call(this,t,!0)};var q={model:P,view:P,projection:P,inverseModel:P,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};F.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=q;r.model=t.model||P,r.view=t.view||P,r.projection=t.projection||P,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.permutation=V;for(var n=0;n<2;++n)for(var i=r.clipBounds[n],a=0;a<3;++a)i[a]=Math.min(Math.max(this.clipBounds[n][a],-1e8),1e8);var s=o(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;n<3;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var u=this._contourVAO;for(u.bind(),a=0;a<3;++a)for(e.lineWidth(this.contourWidth[a]),l.uniforms.permutation=R[a],n=0;n>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 u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;c<2;++c)for(var h=c?a:1-a,f=0;f<2;++f)for(var d=f?l:1-l,p=i+c,g=s+f,m=h*d,v=0;v<3;++v)u[v]+=this._field[v].get(p,g)*m;for(var y=this._pickResult.level,x=0;x<3;++x)if(y[x]=k.le(this.contourLevels[x],u[x]),y[x]<0)this.contourLevels[x].length>0&&(y[x]=0);else if(y[x]Math.abs(_-u[x])&&(y[x]+=1)}for(r.index[0]=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},F.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=u(t.contourWidth,Number)),"showContour"in t&&(this.showContour=u(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=u(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=h(t.contourColor)),"contourProject"in t&&(this.contourProject=u(t.contourProject,function(t){return u(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=h(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=u(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=u(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"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 n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(v.freeFloat(this._field[2].data),this._field[2].data=v.mallocFloat(d.nextPow2(n))),this._field[2]=_(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),l(this._field[2],e),this.shape=e.shape.slice();for(var a=this.shape,o=0;o<2;++o)this._field[2].size>this._field[o].data.length&&(v.freeFloat(this._field[o].data),this._field[o].data=v.mallocFloat(this._field[2].size)),this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2]);if(t.coords){var s=t.coords;if(!Array.isArray(s)||3!==s.length)throw new Error("gl-surface: invalid coordinates for x/y");for(o=0;o<2;++o){var c=s[o];for(y=0;y<2;++y)if(c.shape[y]!==a[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[o],c)}}else if(t.ticks){var f=t.ticks;if(!Array.isArray(f)||2!==f.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var p=f[o];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var g=_(p.data,a);g.stride[o]=p.stride[0],g.stride[1^o]=0,l(this._field[o],g)}}else{for(o=0;o<2;++o){var m=[0,0];m[o]=1,this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2],m,0)}this._field[0].set(0,0,0);for(var y=0;y0){for(var bt=0;bt<5;++bt)tt.pop();q-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),q+=1}}nt.push(q)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=v.mallocFloat(tt.length);for(o=0;oi||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 a(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}function o(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,a,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var h=0,f=0,m=o(c,l.stride.slice());"float32"===u?h=t.FLOAT:"float64"===u?(h=t.FLOAT,m=!1,u="float32"):"uint8"===u?h=t.UNSIGNED_BYTE:(h=t.UNSIGNED_BYTE,m=!1,u="uint8");var v=1;if(2===c.length)f=t.LUMINANCE,c=[c[0],c[1],1],l=d(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])f=t.ALPHA;else if(2===c[2])f=t.LUMINANCE_ALPHA;else if(3===c[2])f=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");f=t.RGBA}v=c[2]}if(f!==t.LUMINANCE&&f!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(f=i),f!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,b=s.indexOf(n)<0;if(b&&s.push(n),h===a&&m)0===l.offset&&l.data.length===y?b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data):b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var _;_=a===t.FLOAT?g.mallocFloat32(y):g.mallocUint8(y);var w=d(_,c,[c[2],c[2]*c[0],1]);h===t.FLOAT&&a===t.UNSIGNED_BYTE?x(w,l):p.assign(w,l),b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,_.subarray(0,y)),a===t.FLOAT?g.freeFloat32(_):g.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var o=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>o||r<0||r>o)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new a(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new a(t,i,0|e.width,0|e.height,r,n)}function h(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=o(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=d(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var h,f,m=e.size;if(s)h=0===e.offset&&e.data.length===m?e.data:e.data.subarray(e.offset,e.offset+m);else{var v=[n[2],n[2]*n[0],1];f=g.malloc(m,r);var y=d(f,n,v,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?p.assign(y,e):x(y,e),h=f.subarray(0,m)}var b=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,h),s||g.free(f),new a(t,b,n[0],n[1],c,u)}function f(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(m||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return h(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var d=t("ndarray"),p=t("ndarray-ops"),g=t("typedarray-pool");e.exports=f;var m=null,v=null,y=null,x=function(t,e){p.muls(t,e,255)},b=a.prototype;Object.defineProperties(b,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),v.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),v.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=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(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){ -if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t=0|t,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t=0|t,i(this,this._shape[0],t),t}}}),b.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},b.dispose=function(){this.gl.deleteTexture(this.handle)},b.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},b.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var a=this._mipLevels.indexOf(n)<0;a?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:427,"ndarray-ops":421,"typedarray-pool":496}],233:[function(t,e,r){"use strict";function n(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;i0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}e.exports=n},{}],242:[function(t,e,r){function n(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}e.exports=n},{}],243:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,a[0]}e.exports=n;var i=new Uint8Array(4),a=new Float32Array(i.buffer)},{}],244:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function C(){return/[^a-fA-F0-9]/.test(R)?(e(U.join("")),B=u,j):(U.push(R),O=R,j+1)}function I(){return"."===R?(U.push(R),B=m,O=R,j+1):/[eE]/.test(R)?(U.push(R),B=m,O=R,j+1):"x"===R&&1===U.length&&"0"===U[0]?(B=w,U.push(R),O=R,j+1):/[^\d]/.test(R)?(e(U.join("")),B=u,j):(U.push(R),O=R,j+1)}function P(){return"f"===R&&(U.push(R),O=R,j+=1),/[eE]/.test(R)?(U.push(R),O=R,j+1):"-"===R&&/[eE]/.test(O)?(U.push(R),O=R,j+1):/[^\d]/.test(R)?(e(U.join("")),B=u,j):(U.push(R),O=R,j+1)}function D(){if(/[^\d\w_]/.test(R)){var t=U.join("");return B=Q.indexOf(t)>-1?x:Z.indexOf(t)>-1?y:v,e(U.join("")),B=u,j}return U.push(R),O=R,j+1}var R,O,F,j=0,N=0,B=u,U=[],V=[],q=1,H=0,G=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return V=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var i=t("./lib/literals"),a=t("./lib/operators"),o=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,h=0,f=1,d=2,p=3,g=4,m=5,v=6,y=7,x=8,b=9,_=10,w=11,M=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":247,"./lib/builtins-300es":246,"./lib/literals":249,"./lib/literals-300es":248,"./lib/operators":250}],246:[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":247}],247:[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"]},{}],248:[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":249}],249:[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"]},{}],250:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],251:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":245}],252:[function(t,e,r){"use strict";function n(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var a=new Int32Array(this.arrayBuffer);t=a[0],e=a[1],r=a[2],this.d=e+2*r;for(var o=0;o=u[f+0]&&n>=u[f+1]?(o[h]=!0,a.push(l[h])):o[h]=!1}}},n.prototype._forEachCell=function(t,e,r,n,i,a,o){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=s;h<=u;h++)for(var f=l;f<=c;f++){var d=this.d*f+h;if(i.call(this,t,e,r,n,d,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,c=-7,h=r?i-1:0,f=r?-1:1,d=t[e+h];for(h+=f,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+h],h+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+h],h+=f,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=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=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),e+=o+h>=1?f/l:f*Math.pow(2,1-h),e*l>=2&&(o++,l/=2),o+h>=c?(s=0,o=c):o+h>=1?(s=(e*l-1)*Math.pow(2,i),o+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],254:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function a(t,e){return c(t.vertices,e.vertices)}function o(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;r<=t;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=u[t+1];return i||(i=u),n(i)}function s(t,e,r){this.dimension=t,this.vertices=e,this.simplices=r,this.interior=r.filter(function(t){return!t.boundary}),this.tuple=new Array(t+1);for(var n=0;n<=t;++n)this.tuple[n]=this.vertices[n];var i=h[t];i||(i=h[t]=o(t)),this.orient=i}function l(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var i=t[0].length;if(r<=i)throw new Error("Must input at least d+1 points");var a=t.slice(0,i+1),o=u.apply(void 0,a);if(0===o)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;c<=i;++c)l[c]=c;o<0&&(l[0]=1,l[1]=0);for(var h=new n(l,new Array(i+1),!1),f=h.adjacent,d=new Array(i+2),c=0;c<=i;++c){for(var p=l.slice(),g=0;g<=i;++g)g===c&&(p[g]=-1);var m=p[0];p[0]=p[1],p[1]=m;var v=new n(p,new Array(i+1),!0);f[c]=v,d[c]=v}d[i+1]=h;for(var c=0;c<=i;++c)for(var p=f[c].vertices,y=f[c].adjacent,g=0;g<=i;++g){var x=p[g];if(x<0)y[g]=h;else for(var b=0;b<=i;++b)f[b].vertices.indexOf(x)<0&&(y[g]=f[b])}for(var _=new s(i,a,d),w=!!e,c=i+1;c0;){t=o.pop();for(var s=(t.vertices,t.adjacent),l=0;l<=r;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,h=0;h<=r;++h){var f=c[h];f<0?i[h]=e:i[h]=a[f]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&o.push(u)}}}return null},f.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,u=s.adjacent,c=0;c<=n;++c)a[c]=i[l[c]];s.lastVisited=r;for(var c=0;c<=n;++c){var h=u[c];if(!(h.lastVisited>=r)){var f=a[c];a[c]=t;var d=this.orient();if(a[c]=f,d<0){s=h;continue t}h.boundary?h.lastVisited=-r:h.lastVisited=r}}return}return s},f.addPeaks=function(t,e){var r=this.vertices.length-1,o=this.dimension,s=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,h=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var f=[];h.length>0;){var e=h.pop(),d=e.vertices,p=e.adjacent,g=d.indexOf(r);if(!(g<0))for(var m=0;m<=o;++m)if(m!==g){var v=p[m];if(v.boundary&&!(v.lastVisited>=r)){var y=v.vertices;if(v.lastVisited!==-r){for(var x=0,b=0;b<=o;++b)y[b]<0?(x=b,l[b]=t):l[b]=s[y[b]];var _=this.orient();if(_>0){y[x]=r,v.boundary=!1,u.push(v),h.push(v),v.lastVisited=r;continue}v.lastVisited=-r}var w=v.adjacent,M=d.slice(),A=p.slice(),k=new n(M,A,!0);c.push(k);var T=w.indexOf(e);if(!(T<0)){w[T]=k,A[g]=v,M[m]=-1,A[m]=e,p[m]=k,k.flip();for(var b=0;b<=o;++b){var E=M[b];if(!(E<0||E===r)){for(var S=new Array(o-1),L=0,z=0;z<=o;++z){var C=M[z];C<0||z===b||(S[L++]=C)}f.push(new i(S,k,b))}}}}}}f.sort(a);for(var m=0;m+1=0?o[l++]=s[c]:u=1&c;if(u===(1&t)){var h=o[0];o[0]=o[1],o[1]=h}e.push(o)}}return e}},{"robust-orientation":465,"simplicial-complex":476}],255:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function a(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),a(t,r),x)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],a=[],o=[],s=[],r=0;r3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=v.ge(this.leftPoints,t,f),n=v.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===b?(this.left=null,this.count-=1,x):(n===x&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var a=this.left?this.left.count:0;if(4*a>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===b?(this.right=null,this.count-=1,x):(n===x&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?b:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var o=this,l=this.left;l.right;)o=l,l=l.right;if(o===this)l.right=this.right;else{var u=this.left,n=this.right;o.count-=l.count,o.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return x}for(var u=v.ge(this.leftPoints,t,f);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===b&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},w.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":53}],256:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;r=r&&s<=i&&l>=n&&l<=a&&c.push(t[p]);else{var g=Math.floor((d+f)/2);s=e[2*g],l=e[2*g+1],s>=r&&s<=i&&l>=n&&l<=a&&c.push(t[g]);var m=(h+1)%2;(0===h?r<=s:n<=l)&&(u.push(d),u.push(g-1),u.push(m)),(0===h?i>=s:a>=l)&&(u.push(g+1),u.push(f),u.push(m))}}return c}e.exports=n},{}],261:[function(t,e,r){"use strict";function n(t,e,r,a,o,s){if(!(o-a<=r)){var l=Math.floor((a+o)/2);i(t,e,l,a,o,s%2),n(t,e,r,a,l-1,s+1),n(t,e,r,l+1,o,s+1)}}function i(t,e,r,n,o,s){for(;o>n;){if(o-n>600){var l=o-n+1,u=r-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),d=Math.max(n,Math.floor(r-u*h/l+f)),p=Math.min(o,Math.floor(r+(l-u)*h/l+f));i(t,e,r,d,p,s)}var g=e[2*r+s],m=n,v=o;for(a(t,e,n,r),e[2*o+s]>g&&a(t,e,n,o);mg;)v--}e[2*n+s]===g?a(t,e,n,v):(v++,a(t,e,v,o)),v<=r&&(n=v+1),r<=v&&(o=v-1)}}function a(t,e,r,n){o(t,r,n),o(e,2*r,2*n),o(e,2*r+1,2*n+1)}function o(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=n},{}],262:[function(t,e,r){"use strict";function n(t,e,r,n,a,o){for(var s=[0,t.length-1,0],l=[],u=a*a;s.length;){var c=s.pop(),h=s.pop(),f=s.pop();if(h-f<=o)for(var d=f;d<=h;d++)i(e[2*d],e[2*d+1],r,n)<=u&&l.push(t[d]);else{var p=Math.floor((f+h)/2),g=e[2*p],m=e[2*p+1];i(g,m,r,n)<=u&&l.push(t[p]);var v=(c+1)%2;(0===c?r-a<=g:n-a<=m)&&(s.push(f),s.push(p-1),s.push(v)),(0===c?r+a>=g:n+a>=m)&&(s.push(p+1),s.push(h),s.push(v))}}return l}function i(t,e,r,n){var i=t-r,a=e-n;return i*i+a*a}e.exports=n},{}],263:[function(t,e,r){"use strict";function n(t,e){var r;if(h(t)){var l,u=t.stops&&"object"==typeof t.stops[0][0],c=u||void 0!==t.property,f=u||!c,d=t.type||e||"exponential";if("exponential"===d)l=o;else if("interval"===d)l=a;else if("categorical"===d)l=i;else{if("identity"!==d)throw new Error('Unknown function type "'+d+'"');l=s}if(u){for(var p={},g=[],m=0;m=t.stops.length)break;if(e<=t.stops[n][0])break;n++}return 0===n?t.stops[n][1]:n===t.stops.length?t.stops[n-1][1]:l(e,r,t.stops[n-1][0],t.stops[n][0],t.stops[n-1][1],t.stops[n][1]); -}function s(t,e){return e}function l(t,e,r,n,i,a){return"function"==typeof i?function(){var o=i.apply(void 0,arguments),s=a.apply(void 0,arguments);return l(t,e,r,n,o,s)}:i.length?c(t,e,r,n,i,a):u(t,e,r,n,i,a)}function u(t,e,r,n,i,a){var o,s=n-r,l=t-r;return o=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-o)+a*o}function c(t,e,r,n,i,a){for(var o=[],s=0;s -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linesdfpattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},outline:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},outlinepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\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\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},pattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform 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\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n}\n"},raster:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity0;\nuniform float u_opacity1;\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 vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\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);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform 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 v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},icon:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_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:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},sdf:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nconst float PI = 3.141592653589793;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_data[1] / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_data[1] / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = (gl_Position.w - 0.5);\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},collisionbox:{ -fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n"}},e.exports.util="float evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n"},{path:434}],265:[function(t,e,r){"use strict";function n(t,e){this.message=(t?t+": ":"")+i.apply(i,Array.prototype.slice.call(arguments,2)),null!==e&&void 0!==e&&e.__line__&&(this.line=e.__line__)}var i=t("util").format;e.exports=n},{util:504}],266:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1;e7)return[new n(c,l,"constants have been deprecated as of v8")];if(!(l in f.constants))return[new n(c,l,'constant "%s" not found',l)];e=a({},e,{value:f.constants[l]})}return u.function&&"object"===i(l)?r(e):u.type&&s[u.type]?s[u.type](e):o(a({},e,{valueSpec:u.type?h[u.type]:u}))}},{"../error/validation_error":265,"../util/extend":266,"../util/get_type":267,"./validate_array":270,"./validate_boolean":271,"./validate_color":272,"./validate_constants":273,"./validate_enum":274,"./validate_filter":275,"./validate_function":276,"./validate_layer":278,"./validate_number":280,"./validate_object":281,"./validate_source":283,"./validate_string":284}],270:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("./validate"),a=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.valueSpec,o=t.style,s=t.styleSpec,l=t.key,u=t.arrayElementValidator||i;if("array"!==n(e))return[new a(l,e,"array expected, %s found",n(e))];if(r.length&&e.length!==r.length)return[new a(l,e,"array length %d expected, length %d found",r.length,e.length)];if(r["min-length"]&&e.length7)return r?[new n(e,r,"constants have been deprecated as of v8")]:[];var o=i(r);if("object"!==o)return[new n(e,r,"object expected, %s found",o)];var s=[];for(var l in r)"@"!==l[0]&&s.push(new n(e+"."+l,r[l],'constants must start with "@"'));return s}},{"../error/validation_error":265,"../util/get_type":267}],274:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint");e.exports=function(t){var e=t.key,r=t.value,a=t.valueSpec,o=[];return a.values.indexOf(i(r))===-1&&o.push(new n(e,r,"expected one of [%s], %s found",a.values.join(", "),r)),o}},{"../error/validation_error":265,"../util/unbundle_jsonlint":268}],275:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_enum"),a=t("../util/get_type"),o=t("../util/unbundle_jsonlint");e.exports=function t(e){var r,s=e.value,l=e.key,u=e.styleSpec,c=[];if("array"!==a(s))return[new n(l,s,"array expected, %s found",a(s))];if(s.length<1)return[new n(l,s,"filter array must have at least 1 element")];switch(c=c.concat(i({key:l+"[0]",value:s[0],valueSpec:u.filter_operator,style:e.style,styleSpec:e.styleSpec})),o(s[0])){case"<":case"<=":case">":case">=":s.length>=2&&"$type"==s[1]&&c.push(new n(l,s,'"$type" cannot be use with operator "%s"',s[0]));case"==":case"!=":3!=s.length&&c.push(new n(l,s,'filter array for operator "%s" must have 3 elements',s[0]));case"in":case"!in":s.length>=2&&(r=a(s[1]),"string"!==r?c.push(new n(l+"[1]",s[1],"string expected, %s found",r)):"@"===s[1][0]&&c.push(new n(l+"[1]",s[1],"filter key cannot be a constant")));for(var h=2;h=8&&(f&&!t.valueSpec["property-function"]?p.push(new n(t.key,t.value,"property functions not supported")):d&&!t.valueSpec["zoom-function"]&&p.push(new n(t.key,t.value,"zoom functions not supported"))),p}},{"../error/validation_error":265,"../util/get_type":267,"./validate":269,"./validate_array":270,"./validate_number":280,"./validate_object":281}],277:[function(t,e,r){"use strict";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:(e.indexOf("{fontstack}")===-1&&a.push(new n(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&a.push(new n(r,e,'"glyphs" url must include a "{range}" token')),a)}},{"../error/validation_error":265,"./validate_string":284}],278:[function(t,e,r){"use strict";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"),u=t("../util/extend");e.exports=function(t){var e=[],r=t.value,c=t.key,h=t.style,f=t.styleSpec;r.type||r.ref||e.push(new n(c,r,'either "type" or "ref" is required'));var d=i(r.type),p=i(r.ref);if(r.id)for(var g=0;ga.maximum?[new i(e,r,"%s is greater than the maximum value %s",r,a.maximum)]:[]}},{"../error/validation_error":265,"../util/get_type":267}],281:[function(t,e,r){"use strict";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,u=t.styleSpec,c=[],h=i(r);if("object"!==h)return[new n(e,r,"object expected, %s found",h)];for(var f in r){var d=f.split(".")[0],p=o&&(o[d]||o["*"]),g=s[d]||s["*"];p||g?c=c.concat((g||a)({key:(e?e+".":e)+f,value:r[f],valueSpec:p,style:l,styleSpec:u,object:r,objectKey:f})):""!==e&&1!==e.split(".").length&&c.push(new n(e,r[f],'unknown property "%s"',f))}for(d in o)o[d].required&&void 0===o[d].default&&void 0===r[d]&&c.push(new n(e,r,'missing required property "%s"',d));return c}},{"../error/validation_error":265,"../util/get_type":267,"./validate":269}],282:[function(t,e,r){"use strict";var n=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.style,a=t.styleSpec,o=t.value,s=t.objectKey,l=a["paint_"+t.layerType],u=s.match(/^(.*)-transition$/);return u&&l[u[1]]&&l[u[1]].transition?n({key:e,value:o,valueSpec:a.transition,style:r,styleSpec:a}):t.valueSpec||l[s]?n({key:t.key,value:o,valueSpec:t.valueSpec||l[s],style:r,styleSpec:a}):[new i(e,o,'unknown property "%s"',s)]}},{"../error/validation_error":265,"./validate":269}],283:[function(t,e,r){"use strict";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 u=i(e.type);switch(u){case"vector":case"raster":var c=[];if(c=c.concat(a({key:r,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var h in e)["type","url","tileSize"].indexOf(h)<0&&c.push(new n(r+"."+h,e[h],'a source with a "url" property may not include a "%s" property',h));return c;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});default:return o({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":265,"../util/unbundle_jsonlint":268,"./validate_enum":274,"./validate_object":281}],284:[function(t,e,r){"use strict";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, %s found",a)]:[]}},{"../error/validation_error":265,"../util/get_type":267}],285:[function(t,e,r){"use strict";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:u}})),e.$version>7&&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.min"),u=t("./validate/validate_glyphs_url");n.source=a(t("./validate/validate_source")),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.min":286,"./validate/validate":269,"./validate/validate_constants":273,"./validate/validate_filter":275,"./validate/validate_glyphs_url":277,"./validate/validate_layer":278,"./validate/validate_layout_property":279,"./validate/validate_paint_property":282,"./validate/validate_source":283}],286:[function(t,e,r){e.exports=t("./v8.min.json")},{"./v8.min.json":287}],287:[function(t,e,r){e.exports={$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"},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_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"]},url:{type:"string"},tiles:{type:"array",value:"string"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"]},data:{type:"*"},maxzoom:{type:"number",default:14},buffer:{type:"number",default:64},tolerance:{type:"number",default:3},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:400},clusterMaxZoom:{type:"number"}},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","raster","background"]},metadata:{type:"*"},ref:{type:"string"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:22},maxzoom:{type:"number",minimum:0,maximum:22},interactive:{type:"boolean",default:!1},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"},"paint.*":{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_fill:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_circle:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_line:{"line-cap":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number",default:1.05,function:"interpolated","zoom-function":!0,"property-function":!0,requires:[{"line-join":"round"}]},visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_symbol:{"symbol-placement":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["point","line"],default:"point"},"symbol-spacing":{type:"number",default:250,minimum:1,function:"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1},"icon-allow-overlap":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image"]},"icon-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"viewport",requires:["icon-image"]},"icon-size":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image"]},"icon-text-fit":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!1,values:["none","both","width","height"],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,"property-function":!0,requires:["icon-image","icon-text-fit","text-field"]},"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,"property-function":!0,units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-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"]},"text-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],requires:["text-field"]},"text-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"viewport",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:"em",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-line-height":{type:"number",default:1.2,units:"em",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-letter-spacing":{type:"number",default:0,units:"em",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,"property-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,"property-function":!0,requires:["text-field"]},"text-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,default:!1,requires:["text-field"]},"text-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["text-field"]},"text-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["text-field","icon-image"]},visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_raster:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,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"]},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"]},function:{stops:{type:"array",required:!0,value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],default:"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["fill-translate"]},"fill-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["circle-translate"]},"circle-pitch-scale":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map"}},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,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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:!0,units:"milliseconds"}},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"}}}},{}],288:[function(t,e,r){"use strict";function n(t){return!!(i()&&a()&&o()&&s()&&l()&&u()&&c()&&h(t&&t.failIfMajorPerformanceCaveat))}function i(){return"undefined"!=typeof window&&"undefined"!=typeof document}function a(){return 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 o(){return Function.prototype&&Function.prototype.bind}function s(){return 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}function l(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON}function u(){return"Worker"in window}function c(){return"Uint8ClampedArray"in window}function h(t){return void 0===d[t]&&(d[t]=f(t)),d[t]}function f(t){var e=document.createElement("canvas"),r=Object.create(n.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=t,e.probablySupportsContext?e.probablySupportsContext("webgl",r)||e.probablySupportsContext("experimental-webgl",r):e.supportsContext?e.supportsContext("webgl",r)||e.supportsContext("experimental-webgl",r):e.getContext("webgl",r)||e.getContext("experimental-webgl",r)}"undefined"!=typeof e&&e.exports?e.exports=n:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=n);var d={};n.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}},{}],289:[function(t,e,r){"use strict";function n(t){var e=t.layoutVertexArrayType;this.layoutVertexArray=new e;var r=t.elementArrayType;r&&(this.elementArray=new r);var n=t.elementArrayType2;n&&(this.elementArray2=new n),this.paintVertexArrays=i.mapObject(t.paintVertexArrayTypes,function(t){return new t})}var i=t("../util/util");e.exports=n,n.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,n.prototype.hasCapacityFor=function(t){return this.layoutVertexArray.length+t<=n.MAX_VERTEX_ARRAY_LENGTH},n.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},n.prototype.trim=function(){this.layoutVertexArray.trim(),this.elementArray&&this.elementArray.trim(),this.elementArray2&&this.elementArray2.trim();for(var t in this.paintVertexArrays)this.paintVertexArrays[t].trim()},n.prototype.serialize=function(){return{layoutVertexArray:this.layoutVertexArray.serialize(),elementArray:this.elementArray&&this.elementArray.serialize(),elementArray2:this.elementArray2&&this.elementArray2.serialize(),paintVertexArrays:i.mapObject(this.paintVertexArrays,function(t){return t.serialize()})}},n.prototype.getTransferables=function(t){t.push(this.layoutVertexArray.arrayBuffer),this.elementArray&&t.push(this.elementArray.arrayBuffer),this.elementArray2&&t.push(this.elementArray2.arrayBuffer);for(var e in this.paintVertexArrays)t.push(this.paintVertexArrays[e].arrayBuffer)}},{"../util/util":403}],290:[function(t,e,r){"use strict";function n(t){if(this.zoom=t.zoom,this.overscaling=t.overscaling,this.layer=t.layer,this.childLayers=t.childLayers,this.type=this.layer.type,this.features=[],this.id=this.layer.id,this.index=t.index,this.sourceLayer=this.layer.sourceLayer,this.sourceLayerIndex=t.sourceLayerIndex,this.minZoom=this.layer.minzoom,this.maxZoom=this.layer.maxzoom,this.paintAttributes=i(this),t.arrays){var e=this.programInterfaces;this.bufferGroups=c.mapObject(t.arrays,function(r,n){var i=e[n],a=t.paintVertexArrayTypes[n];return r.map(function(t){return new u(t,{layoutVertexArrayType:i.layoutVertexArrayType.serialize(),elementArrayType:i.elementArrayType&&i.elementArrayType.serialize(),elementArrayType2:i.elementArrayType2&&i.elementArrayType2.serialize(),paintVertexArrayTypes:a})})})}}function i(t){var e={};for(var r in t.programInterfaces){for(var n=e[r]={},i=0;i1?p.name+_:p.name;b[w]=g[_]*m}}},n.VertexArrayType=function(t){return new h({members:t,alignment:4})},n.ElementArrayType=function(t){return new h({members:[{type:"Uint16",name:"vertices",components:t||3}]})}},{"../util/struct_array":401,"../util/util":403,"./array_group":289,"./bucket/circle_bucket":291,"./bucket/fill_bucket":292,"./bucket/line_bucket":293,"./bucket/symbol_bucket":294,"./buffer_group":296,assert:34,"feature-filter":105}],291:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=i.EXTENT;e.exports=n,n.prototype=a.inherit(i,{}),n.prototype.addCircleVertex=function(t,e,r,n,i){return t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)},n.prototype.programInterfaces={circle:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType,paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("circle-color",e,r)},multiplier:255,paintProperty:"circle-color"},{name:"a_radius",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-radius",e,r)]},multiplier:10,paintProperty:"circle-radius"},{name:"a_blur",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-blur",e,r)]},multiplier:10,paintProperty:"circle-blur"},{name:"a_opacity",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-opacity",e,r)]},multiplier:255,paintProperty:"circle-opacity"}]}},n.prototype.addFeature=function(t){for(var e={zoom:this.zoom},r=o(t),n=this.prepareArrayGroup("circle",0),i=n.layoutVertexArray.length,a=0;a=s||c<0||c>=s)){var h=this.prepareArrayGroup("circle",4),f=h.layoutVertexArray,d=this.addCircleVertex(f,u,c,-1,-1);this.addCircleVertex(f,u,c,1,-1),this.addCircleVertex(f,u,c,1,1),this.addCircleVertex(f,u,c,-1,1),h.elementArray.emplaceBack(d,d+1,d+2),h.elementArray.emplaceBack(d,d+3,d+2)}}this.populatePaintArrays("circle",e,t.properties,n,i)}},{"../../util/util":403,"../bucket":290,"../load_geometry":298}],292:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=t("earcut"),l=t("../../util/classify_rings"),u=500;e.exports=n,n.prototype=a.inherit(i,{}),n.prototype.programInterfaces={fill:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType(1),elementArrayType2:new i.ElementArrayType(2),paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("fill-color",e,r)},multiplier:255,paintProperty:"fill-color"},{name:"a_outline_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("fill-outline-color",e,r)},multiplier:255,paintProperty:"fill-outline-color"},{name:"a_opacity",components:1,type:"Uint8",getValue:function(t,e,r){return[t.getPaintValue("fill-opacity",e,r)]},multiplier:255,paintProperty:"fill-opacity"}]}},n.prototype.addFeature=function(t){for(var e=o(t),r=l(e,u),n=this.prepareArrayGroup("fill",0),i=n.layoutVertexArray.length,a=0;a0&&a.push(i.length/2);for(var c=0;c=1&&n.elementArray2.emplaceBack(f-1,f),i.push(h.x),i.push(h.y)}}for(var d=s(i,a),p=0;p>6)},n.prototype.programInterfaces={line:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}]),elementArrayType:new i.ElementArrayType}},n.prototype.addFeature=function(t){for(var e=o(t,h),r=0;r2&&t[a-1].equals(t[a-2]);)a--;if(!(t.length<2)){"bevel"===e&&(n=1.05);var o=c*(s/(512*this.overscaling)),l=t[0],h=t[a-1],f=l.equals(h);if(this.prepareArrayGroup("line",10*a),2!==a||!f){this.distance=0;var d,p,g,m,v,y,x,b=r,_=f?"butt":r,w=!0;this.e1=this.e2=this.e3=-1,f&&(d=t[a-2],v=l.sub(d)._unit()._perp());for(var M=0;M0){var S=d.dist(p);if(S>2*o){var L=d.sub(d.sub(p)._mult(o/S)._round());this.distance+=L.dist(p),this.addCurrentVertex(L,this.distance,m.mult(1),0,0,!1),p=L}}var z=p&&g,C=z?e:g?b:_;if(z&&"round"===C&&(Tn&&(C="bevel"),"bevel"===C&&(T>2&&(C="flipbevel"),T100)A=v.clone();else{var I=m.x*v.y-m.y*v.x>0?-1:1,P=T*m.add(v).mag()/m.sub(v).mag();A._perp()._mult(P*I)}this.addCurrentVertex(d,this.distance,A,0,0,!1),this.addCurrentVertex(d,this.distance,A.mult(-1),0,0,!1)}else if("bevel"===C||"fakeround"===C){var D=m.x*v.y-m.y*v.x>0,R=-Math.sqrt(T*T-1);if(D?(x=0,y=R):(y=0,x=R),w||this.addCurrentVertex(d,this.distance,m,y,x,!1),"fakeround"===C){for(var O,F=Math.floor(8*(.5-(k-.5))),j=0;j=0;N--)O=m.mult((N+1)/(F+1))._add(v)._unit(),this.addPieSliceVertex(d,this.distance,O,D)}g&&this.addCurrentVertex(d,this.distance,v,-y,-x,!1)}else"butt"===C?(w||this.addCurrentVertex(d,this.distance,m,0,0,!1),g&&this.addCurrentVertex(d,this.distance,v,0,0,!1)):"square"===C?(w||(this.addCurrentVertex(d,this.distance,m,1,1,!1),this.e1=this.e2=-1),g&&this.addCurrentVertex(d,this.distance,v,-1,-1,!1)):"round"===C&&(w||(this.addCurrentVertex(d,this.distance,m,0,0,!1),this.addCurrentVertex(d,this.distance,m,1,1,!0),this.e1=this.e2=-1),g&&(this.addCurrentVertex(d,this.distance,v,-1,-1,!0),this.addCurrentVertex(d,this.distance,v,0,0,!1)));if(E&&M2*o){var U=d.add(g.sub(d)._mult(o/B)._round());this.distance+=U.dist(d),this.addCurrentVertex(U,this.distance,v.mult(1),0,0,!1),d=U}}w=!1}}}},n.prototype.addCurrentVertex=function(t,e,r,n,i,a){var o,s=a?1:0,l=this.arrayGroups.line[this.arrayGroups.line.length-1],u=l.layoutVertexArray,c=l.elementArray;o=r.clone(),n&&o._sub(r.perp()._mult(n)),this.e3=this.addLineVertex(u,t,o,s,0,n,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,o=r.mult(-1),i&&o._sub(r.perp()._mult(i)),this.e3=this.addLineVertex(u,t,o,s,1,-i,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>d/2&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,n,i,a))},n.prototype.addPieSliceVertex=function(t,e,r,n){var i=n?1:0;r=r.mult(n?-1:1);var a=this.arrayGroups.line[this.arrayGroups.line.length-1],o=a.layoutVertexArray,s=a.elementArray;this.e3=this.addLineVertex(o,t,r,0,i,0,e),this.e1>=0&&this.e2>=0&&s.emplaceBack(this.e1,this.e2,this.e3),n?this.e2=this.e3:this.e1=this.e3}},{"../../util/util":403,"../bucket":290,"../load_geometry":298}],294:[function(t,e,r){"use strict";function n(t){o.apply(this,arguments),this.showCollisionBoxes=t.showCollisionBoxes,this.overscaling=t.overscaling,this.collisionBoxArray=t.collisionBoxArray,this.symbolQuadsArray=t.symbolQuadsArray,this.symbolInstancesArray=t.symbolInstancesArray,this.sdfIcons=t.sdfIcons,this.iconsNeedLinear=t.iconsNeedLinear,this.adjustedTextSize=t.adjustedTextSize,this.adjustedIconSize=t.adjustedIconSize,this.fontstack=t.fontstack}function i(t,e,r,n,i,a,o,s,l,u,c){return t.emplaceBack(e,r,Math.round(64*n),Math.round(64*i),a/4,o/4,10*(u||0),c,10*(s||0),10*Math.min(l||25,25))}var a=t("point-geometry"),o=t("../bucket"),s=t("../../symbol/anchor"),l=t("../../symbol/get_anchors"),u=t("../../util/token"),c=t("../../symbol/quads"),h=t("../../symbol/shaping"),f=t("../../symbol/resolve_text"),d=t("../../symbol/mergelines"),p=t("../../symbol/clip_line"),g=t("../../util/util"),m=t("../load_geometry"),v=t("../../symbol/collision_feature"),y=h.shapeText,x=h.shapeIcon,b=c.getGlyphQuads,_=c.getIconQuads,w=o.EXTENT;e.exports=n,n.MAX_QUADS=65535,n.prototype=g.inherit(o,{}),n.prototype.serialize=function(){var t=o.prototype.serialize.apply(this);return t.sdfIcons=this.sdfIcons,t.iconsNeedLinear=this.iconsNeedLinear,t.adjustedTextSize=this.adjustedTextSize,t.adjustedIconSize=this.adjustedIconSize,t.fontstack=this.fontstack,t};var M=new o.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_offset",components:2,type:"Int16"},{name:"a_texture_pos",components:2,type:"Uint16"},{name:"a_data",components:4,type:"Uint8"}]),A=new o.ElementArrayType;n.prototype.addCollisionBoxVertex=function(t,e,r,n,i){return t.emplaceBack(e.x,e.y,Math.round(r.x),Math.round(r.y),10*n,10*i)},n.prototype.programInterfaces={glyph:{layoutVertexArrayType:M,elementArrayType:A},icon:{layoutVertexArrayType:M,elementArrayType:A},collisionBox:{layoutVertexArrayType:new o.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}])}},n.prototype.populateArrays=function(t,e,r){var n={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",{zoom:18,zoomHistory:n}),this.adjustedTextSize=this.layer.getLayoutValue("text-size",{zoom:this.zoom+1,zoomHistory:n}),this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",{zoom:18,zoomHistory:n}),this.adjustedIconSize=this.layer.getLayoutValue("icon-size",{zoom:this.zoom+1,zoomHistory:n});var i=512*this.overscaling;this.tilePixelRatio=w/i,this.compareText={},this.iconsNeedLinear=!1,this.symbolInstancesStartIndex=this.symbolInstancesArray.length;var a=this.layer.layout,o=this.features,s=this.textFeatures,l=.5,c=.5;switch(a["text-anchor"]){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(a["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":c=1;break;case"top":case"top-right":case"top-left":c=0}for(var h="right"===a["text-justify"]?1:"left"===a["text-justify"]?0:.5,f=24,p=a["text-line-height"]*f,v="line"!==a["symbol-placement"]?a["text-max-width"]*f:0,b=a["text-letter-spacing"]*f,_=[a["text-offset"][0]*f,a["text-offset"][1]*f],M=this.fontstack=a["text-font"].join(","),A=[],k=0;kw||z.y<0||z.y>w);if(!g||C){var I=C||_;this.addSymbolInstance(z,E,e,r,this.layer,I,this.symbolInstancesArray.length,this.collisionBoxArray,n.index,this.sourceLayerIndex,this.index,c,m,x,f,v,b,{zoom:this.zoom},n.properties)}}}}},n.prototype.anchorIsTooClose=function(t,e,r){var n=this.compareText;if(t in n){for(var i=n[t],a=i.length-1;a>=0;a--)if(r.dist(i[a])3*Math.PI/2))){var m=p.tl,v=p.tr,y=p.bl,x=p.br,b=p.tex,_=p.anchorPoint,w=Math.max(h+Math.log(p.minScale)/Math.LN2,f),M=Math.min(h+Math.log(p.maxScale)/Math.LN2,25);if(!(M<=w)){w===f&&(w=0);var A=Math.round(p.glyphAngle/(2*Math.PI)*256),k=i(c,_.x,_.y,m.x,m.y,b.x,b.y,w,M,f,A);i(c,_.x,_.y,v.x,v.y,b.x+b.w,b.y,w,M,f,A),i(c,_.x,_.y,y.x,y.y,b.x,b.y+b.h,w,M,f,A),i(c,_.x,_.y,x.x,x.y,b.x+b.w,b.y+b.h,w,M,f,A),u.emplaceBack(k,k+1,k+2),u.emplaceBack(k+1,k+2,k+3)}}}},n.prototype.updateIcons=function(t){this.recalculateStyleLayers();var e=this.layer.layout["icon-image"];if(e)for(var r=0;rn.MAX_QUADS&&g.warnOnce("Too many symbols being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),k>n.MAX_QUADS&&g.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),this.symbolInstancesArray.emplaceBack(P,D,R,O,A,k,T,E,t.x,t.y,s)},n.prototype.addSymbolQuad=function(t){return this.symbolQuadsArray.emplaceBack(t.anchorPoint.x,t.anchorPoint.y,t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y,t.tex.h,t.tex.w,t.tex.x,t.tex.y,t.anchorAngle,t.glyphAngle,t.maxScale,t.minScale)}},{"../../symbol/anchor":352,"../../symbol/clip_line":354,"../../symbol/collision_feature":356,"../../symbol/get_anchors":358,"../../symbol/mergelines":361,"../../symbol/quads":362,"../../symbol/resolve_text":363,"../../symbol/shaping":364,"../../util/token":402,"../../util/util":403,"../bucket":290,"../load_geometry":298,"point-geometry":442}],295:[function(t,e,r){"use strict";function n(t,e,r){this.arrayBuffer=t.arrayBuffer, -this.length=t.length,this.attributes=e.members,this.itemSize=e.bytesPerElement,this.type=r,this.arrayType=e}e.exports=n,n.prototype.bind=function(t){var e=t[this.type];this.buffer?t.bindBuffer(e,this.buffer):(this.buffer=t.createBuffer(),t.bindBuffer(e,this.buffer),t.bufferData(e,this.arrayBuffer,t.STATIC_DRAW),this.arrayBuffer=null)};var i={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT"};n.prototype.setVertexAttribPointers=function(t,e){for(var r=0;r0?t["line-gap-width"]+2*t["line-width"]:t["line-width"]}function s(t,e,r,n,i){if(!e[0]&&!e[1])return t;e=u.convert(e),"viewport"===r&&e._rotate(-n);for(var a=[],o=0;or.max||f.yr.max)&&i.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return l}},{"../util/util":403,"./bucket":290,assert:34}],299:[function(t,e,r){"use strict";function n(t,e,r){this.column=t,this.row=e,this.zoom=r}e.exports=n,n.prototype={clone:function(){return new n(this.column,this.row,this.zoom)},zoomTo:function(t){return this.clone()._zoomTo(t)},sub:function(t){return this.clone()._sub(t)},_zoomTo:function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},_sub:function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this}}},{}],300:[function(t,e,r){"use strict";function n(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}e.exports=n;var i=t("../util/util").wrap;n.prototype.wrap=function(){return new n(i(this.lng,-180,180),this.lat)},n.prototype.toArray=function(){return[this.lng,this.lat]},n.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{"../util/util":403}],301:[function(t,e,r){"use strict";function n(t,e){t&&(e?this.extend(t).extend(e):4===t.length?this.extend([t[0],t[1]]).extend([t[2],t[3]]):this.extend(t[0]).extend(t[1]))}e.exports=n;var i=t("./lng_lat");n.prototype={extend:function(t){var e,r,a=this._sw,o=this._ne;if(t instanceof i)e=t,r=t;else{if(!(t instanceof n))return t?this.extend(i.convert(t)||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 i(e.lng,e.lat),this._ne=new i(r.lng,r.lat)),this},getCenter:function(){return new i((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},getSouthWest:function(){return this._sw},getNorthEast:function(){return this._ne},getNorthWest:function(){return new i(this.getWest(),this.getNorth())},getSouthEast:function(){return new i(this.getEast(),this.getSouth())},getWest:function(){return this._sw.lng},getSouth:function(){return this._sw.lat},getEast:function(){return this._ne.lng},getNorth:function(){return this._ne.lat},toArray:function(){return[this._sw.toArray(),this._ne.toArray()]},toString:function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"}},n.convert=function(t){return!t||t instanceof n?t:new n(t)}},{"./lng_lat":300}],302:[function(t,e,r){"use strict";function n(t,e){this.tileSize=512,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new i(0,0),this.zoom=0,this.angle=0,this._altitude=1.5,this._pitch=0,this._unmodified=!0}var i=t("./lng_lat"),a=t("point-geometry"),o=t("./coordinate"),s=t("../util/util").wrap,l=t("../util/interpolate"),u=t("../source/tile_coord"),c=t("../data/bucket").EXTENT,h=t("gl-matrix"),f=h.vec4,d=h.mat4,p=h.mat2;e.exports=n,n.prototype={get minZoom(){return this._minZoom},set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},get maxZoom(){return this._maxZoom},set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},get worldSize(){return this.tileSize*this.scale},get centerPoint(){return this.size._div(2)},get size(){return new a(this.width,this.height)},get bearing(){return-this.angle/Math.PI*180},set bearing(t){var e=-s(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcMatrices(),this.rotationMatrix=p.create(),p.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},get pitch(){return this._pitch/Math.PI*180},set pitch(t){var e=Math.min(60,t)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcMatrices())},get altitude(){return this._altitude},set altitude(t){var e=Math.max(.75,t);this._altitude!==e&&(this._unmodified=!1,this._altitude=e,this._calcMatrices())},get zoom(){return this._zoom},set zoom(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._calcMatrices(),this._constrain())},get center(){return this._center},set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._calcMatrices(),this._constrain())},coveringZoomLevel:function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},coveringTiles:function(t){var e=this.coveringZoomLevel(t),r=e;if(et.maxzoom&&(e=t.maxzoom);var n=this,i=n.locationCoordinate(n.center)._zoomTo(e),o=new a(i.column-.5,i.row-.5);return u.cover(e,[n.pointCoordinate(new a(0,0))._zoomTo(e),n.pointCoordinate(new a(n.width,0))._zoomTo(e),n.pointCoordinate(new a(n.width,n.height))._zoomTo(e),n.pointCoordinate(new a(0,n.height))._zoomTo(e)],t.reparseOverscaled?r:e).sort(function(t,e){return o.dist(t)-o.dist(e)})},resize:function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._calcMatrices(),this._constrain()},get unmodified(){return this._unmodified},zoomScale:function(t){return Math.pow(2,t)},scaleZoom:function(t){return Math.log(t)/Math.LN2},project:function(t,e){return new a(this.lngX(t.lng,e),this.latY(t.lat,e))},unproject:function(t,e){return new i(this.xLng(t.x,e),this.yLat(t.y,e))},get x(){return this.lngX(this.center.lng)},get y(){return this.latY(this.center.lat)},get point(){return new a(this.x,this.y)},lngX:function(t,e){return(180+t)*(e||this.worldSize)/360},latY:function(t,e){var r=180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360));return(180-r)*(e||this.worldSize)/360},xLng:function(t,e){return 360*t/(e||this.worldSize)-180},yLat:function(t,e){var r=180-360*t/(e||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90},panBy:function(t){var e=this.centerPoint._add(t);this.center=this.pointLocation(e)},setLocationAtPoint:function(t,e){var r=this.locationCoordinate(t),n=this.pointCoordinate(e),i=this.pointCoordinate(this.centerPoint),a=n._sub(r);this._unmodified=!1,this.center=this.coordinateLocation(i._sub(a))},locationPoint:function(t){return this.coordinatePoint(this.locationCoordinate(t))},pointLocation:function(t){return this.coordinateLocation(this.pointCoordinate(t))},locationCoordinate:function(t){var e=this.zoomScale(this.tileZoom)/this.worldSize,r=i.convert(t);return new o(this.lngX(r.lng)*e,this.latY(r.lat)*e,this.tileZoom)},coordinateLocation:function(t){var e=this.zoomScale(t.zoom);return new i(this.xLng(t.column,e),this.yLat(t.row,e))},pointCoordinate:function(t){var e=0,r=[t.x,t.y,0,1],n=[t.x,t.y,1,1];f.transformMat4(r,r,this.pixelMatrixInverse),f.transformMat4(n,n,this.pixelMatrixInverse);var i=r[3],a=n[3],s=r[0]/i,u=n[0]/a,c=r[1]/i,h=n[1]/a,d=r[2]/i,p=n[2]/a,g=d===p?0:(e-d)/(p-d),m=this.worldSize/this.zoomScale(this.tileZoom);return new o(l(s,u,g)/m,l(c,h,g)/m,this.tileZoom)},coordinatePoint:function(t){var e=this.worldSize/this.zoomScale(t.zoom),r=[t.column*e,t.row*e,0,1];return f.transformMat4(r,r,this.pixelMatrix),new a(r[0]/r[3],r[1]/r[3])},calculatePosMatrix:function(t,e){void 0===e&&(e=1/0),t instanceof u&&(t=t.toCoordinate(e));var r=Math.min(t.zoom,e),n=this.worldSize/Math.pow(2,r),i=new Float64Array(16);return d.identity(i),d.translate(i,i,[t.column*n,t.row*n,0]),d.scale(i,i,[n/c,n/c,1]),d.multiply(i,this.projMatrix,i),new Float32Array(i)},_constrain:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,e,r,n,i,o,s,l,u=this.size,c=this._unmodified;this.latRange&&(t=this.latY(this.latRange[1]),e=this.latY(this.latRange[0]),i=e-te&&(l=e-d)}if(this.lngRange){var p=this.x,g=u.x/2;p-gn&&(s=n-g)}void 0===s&&void 0===l||(this.center=this.unproject(new a(void 0!==s?s:this.x,void 0!==l?l:this.y))),this._unmodified=c,this._constraining=!1}},_calcMatrices:function(){if(this.height){var t=Math.atan(.5/this.altitude),e=Math.sin(t)*this.altitude/Math.sin(Math.PI/2-this._pitch-t),r=Math.cos(Math.PI/2-this._pitch)*e+this.altitude,n=new Float64Array(16);if(d.perspective(n,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,r),d.translate(n,n,[0,0,-this.altitude]),d.scale(n,n,[1,-1,1/this.height]),d.rotateX(n,n,this._pitch),d.rotateZ(n,n,this.angle),d.translate(n,n,[-this.x,-this.y,0]),this.projMatrix=n,n=d.create(),d.scale(n,n,[this.width/2,-this.height/2,1]),d.translate(n,n,[1,-1,0]),this.pixelMatrix=d.multiply(new Float64Array(16),n,this.projMatrix),n=d.invert(new Float64Array(16),this.pixelMatrix),!n)throw new Error("failed to invert matrix");this.pixelMatrixInverse=n}}}},{"../data/bucket":290,"../source/tile_coord":330,"../util/interpolate":397,"../util/util":403,"./coordinate":299,"./lng_lat":300,"gl-matrix":161,"point-geometry":442}],303:[function(t,e,r){"use strict";var n={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,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]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[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]]};e.exports=function(t,e,r,i){i=i||1;var a,o,s,l,u,c,h,f,d=[];for(a=0,o=t.length;a>16,_>>16),s.uniform2f(n.u_pixel_coord_lower,65535&b,65535&_)}s.uniformMatrix4fv(n.u_matrix,!1,t.transform.calculatePosMatrix(v)),s.drawArrays(s.TRIANGLE_STRIP,0,t.tileExtentBuffer.length)}s.stencilMask(0),s.stencilFunc(s.EQUAL,128,128)}var i=t("../source/pixels_to_tile_units"),a=t("./create_uniform_pragmas"),o=512;e.exports=n},{"../source/pixels_to_tile_units":324,"./create_uniform_pragmas":305}],307:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var a=t.gl;t.setDepthSublayer(0),t.depthMask(!1),a.disable(a.STENCIL_TEST);for(var o=0;o>16,f>>16),o.uniform2f(a.u_pixel_coord_lower,65535&h,65535&f),o.activeTexture(o.TEXTURE0),i.spriteAtlas.bind(o,!0)}}var s=t("../source/pixels_to_tile_units");e.exports=n},{"../source/pixels_to_tile_units":324}],311:[function(t,e,r){"use strict";var n=t("../util/browser"),i=t("gl-matrix").mat2,a=t("../source/pixels_to_tile_units");e.exports=function(t,e,r,o){if(!t.isOpaquePass){t.setDepthSublayer(0),t.depthMask(!1);var s=t.gl;if(s.enable(s.STENCIL_TEST),!(r.paint["line-width"]<=0)){var l=1/n.devicePixelRatio,u=r.paint["line-blur"]+l,c=r.paint["line-color"],h=t.transform,f=i.create();i.scale(f,f,[1,Math.cos(h._pitch)]),i.rotate(f,f,t.transform.angle);var d,p,g,m,v,y=Math.sqrt(h.height*h.height/4*(1+h.altitude*h.altitude)),x=h.height/2*Math.tan(h._pitch),b=(y+x)/y-1,_=r.paint["line-dasharray"],w=r.paint["line-pattern"];if(_)d=t.useProgram("linesdfpattern"),s.uniform1f(d.u_linewidth,r.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform4fv(d.u_color,c),s.uniform1f(d.u_opacity,r.paint["line-opacity"]),p=t.lineAtlas.getDash(_.from,"round"===r.layout["line-cap"]),g=t.lineAtlas.getDash(_.to,"round"===r.layout["line-cap"]),s.uniform1i(d.u_image,0),s.activeTexture(s.TEXTURE0),t.lineAtlas.bind(s),s.uniform1f(d.u_tex_y_a,p.y),s.uniform1f(d.u_tex_y_b,g.y),s.uniform1f(d.u_mix,_.t),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,f);else if(w){if(m=t.spriteAtlas.getPosition(w.from,!0),v=t.spriteAtlas.getPosition(w.to,!0),!m||!v)return;d=t.useProgram("linepattern"),s.uniform1i(d.u_image,0),s.activeTexture(s.TEXTURE0),t.spriteAtlas.bind(s,!0),s.uniform1f(d.u_linewidth,r.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform2fv(d.u_pattern_tl_a,m.tl),s.uniform2fv(d.u_pattern_br_a,m.br),s.uniform2fv(d.u_pattern_tl_b,v.tl),s.uniform2fv(d.u_pattern_br_b,v.br),s.uniform1f(d.u_fade,w.t),s.uniform1f(d.u_opacity,r.paint["line-opacity"]),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,f)}else d=t.useProgram("line"),s.uniform1f(d.u_linewidth,r.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,f),s.uniform4fv(d.u_color,c),s.uniform1f(d.u_opacity,r.paint["line-opacity"]);for(var M=0;M0?1/(1-t):1+t}function s(t){return t>0?1-1/(1.001-t):-t}function l(t,e,r,n){var i=[1,0],a=r.paint["raster-fade-duration"];if(t.source&&a>0){var o=(new Date).getTime(),s=(o-t.timeAdded)/a,l=e?(o-e.timeAdded)/a:-1,c=n.coveringZoomLevel(t.source),h=!!e&&Math.abs(e.coord.z-c)>Math.abs(t.coord.z-c);!e||h?(i[0]=u.clamp(s,0,1),i[1]=1-i[0]):(i[0]=u.clamp(1-l,0,1),i[1]=1-i[0])}var f=r.paint["raster-opacity"];return i[0]*=f,i[1]*=f,i}var u=t("../util/util"),c=t("../util/struct_array");e.exports=n,n.RasterBoundsArray=new c({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]})},{"../util/struct_array":401,"../util/util":403}],313:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var a=!(r.layout["text-allow-overlap"]||r.layout["icon-allow-overlap"]||r.layout["text-ignore-placement"]||r.layout["icon-ignore-placement"]),o=t.gl;a?o.disable(o.STENCIL_TEST):o.enable(o.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),o.disable(o.DEPTH_TEST),i(t,e,r,n,!1,r.paint["icon-translate"],r.paint["icon-translate-anchor"],r.layout["icon-rotation-alignment"],r.layout["icon-rotation-alignment"],r.layout["icon-size"],r.paint["icon-halo-width"],r.paint["icon-halo-color"],r.paint["icon-halo-blur"],r.paint["icon-opacity"],r.paint["icon-color"]),i(t,e,r,n,!0,r.paint["text-translate"],r.paint["text-translate-anchor"],r.layout["text-rotation-alignment"],r.layout["text-pitch-alignment"],r.layout["text-size"],r.paint["text-halo-width"],r.paint["text-halo-color"],r.paint["text-halo-blur"],r.paint["text-opacity"],r.paint["text-color"]),o.enable(o.DEPTH_TEST),e.map.showCollisionBoxes&&s(t,e,r,n)}}function i(t,e,r,n,i,o,s,l,u,c,h,f,d,p,g){for(var m=0;mthis.previousZoom;r--)this.changeTimes[r]=e,this.changeOpacities[r]=this.opacities[r];for(r=0;r<256;r++){var n=e-this.changeTimes[r],i=n/this.fadeDuration*255;r<=t?this.opacities[r]=this.changeOpacities[r]+i:this.opacities[r]=this.changeOpacities[r]-i}this.changed=!0,this.previousZoom=t},n.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.changed&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,256,1,t.ALPHA,t.UNSIGNED_BYTE,this.array),this.changed=!1)):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,256,1,0,t.ALPHA,t.UNSIGNED_BYTE,this.array))}},{}],315:[function(t,e,r){"use strict";function n(t,e){this.width=t,this.height=e,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}}var i=t("../util/util");e.exports=n,n.prototype.setSprite=function(t){this.sprite=t},n.prototype.getDash=function(t,e){var r=t.join(",")+e;return this.positions[r]||(this.positions[r]=this.addDash(t,e)),this.positions[r]},n.prototype.addDash=function(t,e){var r=e?7:0,n=2*r+1,a=128;if(this.nextRow+n>this.height)return i.warnOnce("LineAtlas out of space"),null;for(var o=0,s=0;s0?e.pop():null},n.prototype.lineWidth=function(t){this.gl.lineWidth(c.clamp(t,this.lineWidthRange[0],this.lineWidthRange[1]))},n.prototype.showOverdrawInspector=function(t){if(t||this._showOverdrawInspector){this._showOverdrawInspector=t;var e=this.gl;if(t){e.blendFunc(e.CONSTANT_COLOR,e.ONE);var r=8,n=1/r;e.blendColor(n,n,n,0),e.clearColor(0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)}else e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}}},{"../data/bucket":290,"../data/buffer":295,"../source/pixels_to_tile_units":324,"../source/source_cache":328,"../util/browser":387,"../util/struct_array":401,"../util/util":403,"./create_uniform_pragmas":305,"./draw_background":306,"./draw_circle":307,"./draw_debug":309,"./draw_fill":310,"./draw_line":311,"./draw_raster":312,"./draw_symbol":313,"./frame_history":314,"./painter/use_program":317,"./vertex_array_object":318,"gl-matrix":161}],317:[function(t,e,r){"use strict";function n(t,e){return t.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,function(t,r,n,i,a){return e[r][a].replace(/{type}/g,i).replace(/{precision}/g,n)})}var i=t("assert"),a=t("../../util/util"),o=t("mapbox-gl-shaders"),s=o.util;e.exports._createProgram=function(t,e,r,l){for(var u=this.gl,c=u.createProgram(),h=o[t],f="#define MAPBOX_GL_JS;\n",d=0;dthis.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,n={type:this.type,uid:t.uid,coord:t.coord,zoom:t.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:r,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send("load tile",n,function(r,n){if(t.unloadVectorData(this.map.painter),!t.aborted)return r?e(r):(t.loadVectorData(n,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),e(null))}.bind(this),this.workerID)},abortTile:function(t){t.aborted=!0},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},function(){},t.workerID)},serialize:function(){return{type:this.type,data:this._data}}})},{"../data/bucket":290,"../util/evented":395,"../util/util":403,"resolve-url":458}],320:[function(t,e,r){"use strict";function n(t,e,r){r&&(this.loadGeoJSON=r),h.call(this,t,e)}var i=t("../util/util"),a=t("../util/ajax"),o=t("geojson-rewind"),s=t("./geojson_wrapper"),l=t("vt-pbf"),u=t("supercluster"),c=t("geojson-vt"),h=t("./vector_tile_worker_source");e.exports=n,n.prototype=i.inherit(h,{_geoJSONIndexes:{},loadVectorData:function(t,e){var r=t.source,n=t.coord;if(!this._geoJSONIndexes[r])return e(null,null);var i=this._geoJSONIndexes[r].getTile(Math.min(n.z,t.maxZoom),n.x,n.y);if(!i)return e(null,null);var a=new s(i.features);a.name="_geojsonTileLayer";var o=l({layers:{_geojsonTileLayer:a}});0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{tile:a,rawTileData:o.buffer})},loadData:function(t,e){var r=function(r,n){return r?e(r):"object"!=typeof n?e(new Error("Input data is not a valid GeoJSON object.")):(o(n,!0),void this._indexData(n,t,function(r,n){return r?e(r):(this._geoJSONIndexes[t.source]=n,void e(null))}.bind(this)))}.bind(this);this.loadGeoJSON(t,r)},loadGeoJSON:function(t,e){if(t.url)a.getJSON(t.url,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."))}}},_indexData:function(t,e,r){try{e.cluster?r(null,u(e.superclusterOptions).load(t.features)):r(null,c(t,e.geojsonVtOptions))}catch(t){return r(t)}}})},{"../util/ajax":386,"../util/util":403,"./geojson_wrapper":321,"./vector_tile_worker_source":332,"geojson-rewind":110,"geojson-vt":114,supercluster:485,"vt-pbf":511}],321:[function(t,e,r){"use strict";function n(t){this.features=t,this.length=t.length,this.extent=s}function i(t){if(this.type=t.type,1===t.type){this.rawGeometry=[];for(var e=0;ee)){var o=Math.pow(2,Math.min(a.coord.z,this.maxzoom)-Math.min(t.z,this.maxzoom));if(Math.floor(a.coord.x/o)===t.x&&Math.floor(a.coord.y/o)===t.y)for(r[i]=!0,n=!0;a&&a.coord.z-1>t.z;){var s=a.coord.parent(this.maxzoom).id;a=this._tiles[s],a&&a.isRenderable()&&(delete r[i],r[s]=!0)}}}return n},findLoadedParent:function(t,e,r){for(var n=t.z-1;n>=e;n--){t=t.parent(this.maxzoom);var i=this._tiles[t.id];if(i&&i.isRenderable())return r[t.id]=!0,i;if(this._cache.has(t.id))return this.addTile(t),r[t.id]=!0,this._tiles[t.id]}},updateCacheSize:function(t){var e=Math.ceil(t.width/t.tileSize)+1,r=Math.ceil(t.height/t.tileSize)+1,n=e*r,i=5;this._cache.setMaxSize(Math.floor(n*i))},update:function(t,e){if(this._sourceLoaded){var r,i,a;this.updateCacheSize(t);var o=(this.roundZoom?Math.round:Math.floor)(this.getZoom(t)),s=Math.max(o-n.maxOverzooming,this.minzoom),l=Math.max(o+n.maxUnderzooming,this.minzoom),c={},h=(new Date).getTime();this._coveredTiles={};var d=this.used?t.coveringTiles(this._source):[];for(r=0;rh-(e||0)&&(this.findLoadedChildren(i,l,c)&&(c[v]=!0),this.findLoadedParent(i,s,p))}var y;for(y in p)c[y]||(this._coveredTiles[y]=!0);for(y in p)c[y]=!0;var x=f.keysDifference(this._tiles,c);for(r=0;rthis.maxzoom?Math.pow(2,n-this.maxzoom):1;e=new s(r,this.tileSize*i,this.maxzoom),this.loadTile(e,this._tileLoaded.bind(this,e))}return e.uses++,this._tiles[t.id]=e,this.fire("tile.add",{tile:e}),this._source.fire("tile.add",{tile:e}),e},removeTile:function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this.fire("tile.remove",{tile:e}),this._source.fire("tile.remove",{tile:e}),e.uses>0||(e.isRenderable()?this._cache.add(e.coord.wrapped().id,e):(e.aborted=!0,this.abortTile(e),this.unloadTile(e))))},clearTiles:function(){for(var t in this._tiles)this.removeTile(t);this._cache.reset()},tilesIn:function(t){for(var e={},r=this.getIds(),n=1/0,a=1/0,o=-(1/0),s=-(1/0),l=t[0].zoom,c=0;c=0&&v[1].y>=0){for(var y=[],x=0;x=0&&t%1===0),l(!isNaN(e)&&e>=0&&e%1===0),l(!isNaN(r)&&r>=0&&r%1===0),isNaN(n)&&(n=0),this.z=+t,this.x=+e,this.y=+r,this.w=+n,n*=2,n<0&&(n=n*-1-1);var i=1<0;a--)n=1<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 o(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,h=e.dx<0,f=a;fc.dy&&(l=u,u=c,c=l),u.dy>h.dy&&(l=u,u=h,h=l),c.dy>h.dy&&(l=c,c=h,h=l),u.dy&&o(h,u,n,i,s),c.dy&&o(h,c,n,i,s)}var l=t("assert"),u=t("whoots-js"),c=t("../geo/coordinate");e.exports=n,n.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y},n.prototype.toCoordinate=function(t){var e=Math.min(this.z,t),r=Math.pow(2,e),n=this.y,i=this.x+r*this.w;return new c(i,n,e)},n.fromID=function(t){var e=t%32,r=1<t?new n(this.z-1,this.x,this.y,this.w):new n(this.z-1,Math.floor(this.x/2),Math.floor(this.y/2),this.w)},n.prototype.wrapped=function(){return new n(this.z,this.x,this.y,0)},n.prototype.children=function(t){if(this.z>=t)return[new n(this.z+1,this.x,this.y,this.w)];var e=this.z+1,r=2*this.x,i=2*this.y;return[new n(e,r,i,this.w),new n(e,r+1,i,this.w),new n(e,r,i+1,this.w),new n(e,r+1,i+1,this.w)]},n.cover=function(t,e,r){function i(t,e,i){var s,l,u;if(i>=0&&i<=a)for(s=t;sthis.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,i={url:s(t.coord.url(this.tiles,this.maxzoom,this.scheme),this.url),uid:t.uid,coord:t.coord,zoom:t.coord.z,tileSize:this.tileSize*n,source:this.id,overscaling:n,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID?"loading"===t.state?t.reloadCallback=e:(i.rawTileData=t.rawTileData,this.dispatcher.send("reload tile",i,r.bind(this),t.workerID)):t.workerID=this.dispatcher.send("load tile",i,r.bind(this))},abortTile:function(t){this.dispatcher.send("abort tile",{uid:t.uid,source:this.id},null,t.workerID)},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)}})},{"../util/evented":395,"../util/mapbox":400,"../util/util":403,"./load_tilejson":323}],332:[function(t,e,r){"use strict";function n(t,e,r){this.actor=t,this.styleLayers=e,r&&(this.loadVectorData=r),this.loading={},this.loaded={}}var i=t("../util/ajax"),a=t("vector-tile"),o=t("pbf"),s=t("./worker_tile");e.exports=n,n.prototype={loadTile:function(t,e){function r(t,r){return delete this.loading[n][i],t?e(t):r?(a.data=r.tile,a.parse(a.data,this.styleLayers.getLayerFamilies(),this.actor,r.rawTileData,e),this.loaded[n]=this.loaded[n]||{},void(this.loaded[n][i]=a)):e(null,null)}var n=t.source,i=t.uid;this.loading[n]||(this.loading[n]={});var a=this.loading[n][i]=new s(t);a.abort=this.loadVectorData(t,r.bind(this))},reloadTile:function(t,e){var r=this.loaded[t.source],n=t.uid;if(r&&r[n]){var i=r[n];i.parse(i.data,this.styleLayers.getLayerFamilies(),this.actor,t.rawTileData,e)}},abortTile:function(t){var e=this.loading[t.source],r=t.uid;e&&e[r]&&e[r].abort&&(e[r].abort(),delete e[r])},removeTile:function(t){var e=this.loaded[t.source],r=t.uid;e&&e[r]&&delete e[r]},loadVectorData:function(t,e){function r(t,r){if(t)return e(t);var n=new a.VectorTile(new o(new Uint8Array(r)));e(t,{tile:n,rawTileData:r})}var n=i.getArrayBuffer(t.url,r.bind(this));return function(){n.abort()}},redoPlacement:function(t,e){var r=this.loaded[t.source],n=this.loading[t.source],i=t.uid;if(r&&r[i]){var a=r[i],o=a.redoPlacement(t.angle,t.pitch,t.showCollisionBoxes);o.result&&e(null,o.result,o.transferables)}else n&&n[i]&&(n[i].angle=t.angle)}}},{"../util/ajax":386,"./worker_tile":335,pbf:436,"vector-tile":505}],333:[function(t,e,r){"use strict";function n(t,e){this.id=t,this.urls=e.urls,this.coordinates=e.coordinates,u.getVideo(e.urls,function(t,r){if(t)return this.fire("error",{error:t});this.video=r,this.video.loop=!0;var n;this.video.addEventListener("playing",function(){n=this.map.style.animationLoop.set(1/0),this.map._rerender()}.bind(this)),this.video.addEventListener("pause",function(){this.map.style.animationLoop.cancel(n)}.bind(this)),this.map&&(this.video.play(),this.setCoordinates(e.coordinates)),this.fire("load")}.bind(this))}var i=t("../util/util"),a=t("./tile_coord"),o=t("../geo/lng_lat"),s=t("point-geometry"),l=t("../util/evented"),u=t("../util/ajax"),c=t("../data/bucket").EXTENT,h=t("../render/draw_raster").RasterBoundsArray,f=t("../data/buffer"),d=t("../render/vertex_array_object");e.exports=n,n.prototype=i.inherit(l,{minzoom:0,maxzoom:22,tileSize:512,roundZoom:!0,getVideo:function(){return this.video},onAdd:function(t){this.map||(this.map=t,this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},setCoordinates:function(t){this.coordinates=t;var e=this.map,r=t.map(function(t){return e.transform.locationCoordinate(o.convert(t)).zoomTo(0)}),n=this.centerCoord=i.getCoordinatesCenter(r);return n.column=Math.round(n.column),n.row=Math.round(n.row),this.minzoom=this.maxzoom=n.zoom,this._coord=new a(n.zoom,n.column,n.row),this._tileCoords=r.map(function(t){var e=t.zoomTo(n.zoom);return new s(Math.round((e.column-n.column)*c),Math.round((e.row-n.row)*c))}),this.fire("change"),this},_setTile:function(t){this._prepared=!1,this.tile=t;var e=32767,r=new h;r.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),r.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,e,0),r.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,e),r.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,e,e),this.tile.buckets={},this.tile.boundsBuffer=new f(r.serialize(),h.serialize(),f.BufferType.VERTEX),this.tile.boundsVAO=new d,this.tile.state="loaded"},prepare:function(){if(!(this.video.readyState<2)&&this.tile){var t=this.map.painter.gl;this._prepared?(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this._prepared=!0,this.tile.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.video)),this._currentTime=this.video.currentTime}},loadTile:function(t,e){this._coord&&this._coord.toString()===t.coord.toString()?(this._setTile(t),e(null)):(t.state="errored",e(null))},serialize:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}})},{"../data/bucket":290,"../data/buffer":295,"../geo/lng_lat":300,"../render/draw_raster":312,"../render/vertex_array_object":318,"../util/ajax":386,"../util/evented":395,"../util/util":403,"./tile_coord":330,"point-geometry":442}],334:[function(t,e,r){"use strict";function n(t){this.self=t,this.actor=new a(t,this);var e={getLayers:function(){return this.layers}.bind(this),getLayerFamilies:function(){return this.layerFamilies}.bind(this)};this.workerSources={vector:new l(this.actor,e),geojson:new u(this.actor,e)},this.self.registerWorkerSource=function(t,r){if(this.workerSources[t])throw new Error('Worker source with name "'+t+'" already registered.');this.workerSources[t]=new r(this.actor,e)}.bind(this)}function i(t){var e={};for(var r in t){var n=t[r],i=n.ref||n.id,a=t[i];a.layout&&"none"===a.layout.visibility||(e[i]=e[i]||[],r===i?e[i].unshift(n):e[i].push(n))}return e}var a=t("../util/actor"),o=t("../style/style_layer"),s=t("../util/util"),l=t("./vector_tile_worker_source"),u=t("./geojson_worker_source");e.exports=function(t){return new n(t)},s.extend(n.prototype,{"set layers":function(t){function e(t){var e=o.create(t,t.ref&&r.layers[t.ref]);e.updatePaintTransitions({},{transition:!1}),r.layers[e.id]=e}this.layers={};for(var r=this,n=[],a=0;a=0;e--)x(S,D[e]);b()}}function x(t,e){if(e.populateArrays(k,j,F),"symbol"!==e.type)for(var r=0;r=w.maxzoom||w.layout&&"none"===w.layout.visibility||t.layers&&!t.layers[w.sourceLayer]||(A=c.create({layer:w,index:C++,childLayers:e[I],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,symbolQuadsArray:this.symbolQuadsArray,symbolInstancesArray:this.symbolInstancesArray,sourceLayerIndex:E.encode(w.sourceLayer||"_geojsonTileLayer")}),A.createFilter(),L[w.id]=A,t.layers&&(M=w.sourceLayer,z[M]=z[M]||{},z[M][w.id]=A)));if(t.layers)for(M in z)1===w.version&&d.warnOnce('Vector tile source "'+this.source+'" layer "'+M+'" does not use vector tile spec v2 and therefore may have some rendering errors.'),w=t.layers[M],w&&v(w,z[M]);else v(t,L);var P=[],D=this.symbolBuckets=[],R=[];T.bucketLayerIDs={};for(var O in L)A=L[O],0!==A.features.length&&(T.bucketLayerIDs[A.index]=A.childLayers.map(s),P.push(A),"symbol"===A.type?D.push(A):R.push(A));var F={},j={},N=0;if(D.length>0){for(_=D.length-1;_>=0;_--)D[_].updateIcons(F),D[_].updateFont(j);for(var B in j)j[B]=Object.keys(j[B]).map(Number);F=Object.keys(F),r.send("get glyphs",{uid:this.uid,stacks:j},function(t,e){j=e,y(t)}),F.length?r.send("get icons",{icons:F},function(t,e){F=e,y(t)}):y()}for(_=R.length-1;_>=0;_--)x(this,R[_]);if(0===D.length)return b()},n.prototype.redoPlacement=function(t,e,r){if("done"!==this.status)return this.redoPlacementAfterDone=!0,this.angle=t,{};for(var n=new u(t,e,this.collisionBoxArray),s=this.symbolBuckets,l=s.length-1;l>=0;l--)s[l].placeFeatures(n,r);var c=n.serialize(),h=s.filter(i);return{result:{buckets:h.map(a),collisionTile:c.data},transferables:o(h).concat(c.transferables)}}},{"../data/bucket":290,"../data/feature_index":297,"../symbol/collision_box":355,"../symbol/collision_tile":357,"../symbol/symbol_instances":366,"../symbol/symbol_quads":367,"../util/dictionary_coder":393,"../util/util":403}],336:[function(t,e,r){"use strict";function n(){this.n=0,this.times=[]}e.exports=n,n.prototype.stopped=function(){return this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()}),!this.times.length},n.prototype.set=function(t){return this.times.push({id:this.n,time:t+(new Date).getTime()}),this.n++},n.prototype.cancel=function(t){this.times=this.times.filter(function(e){return e.id!==t})}},{}],337:[function(t,e,r){"use strict";function n(t){this.base=t,this.retina=s.devicePixelRatio>1;var e=this.retina?"@2x":"";o.getJSON(l(t,e,".json"),function(t,e){return t?void this.fire("error",{error:t}):(this.data=e,void(this.img&&this.fire("load")))}.bind(this)),o.getImage(l(t,e,".png"),function(t,e){if(t)return void this.fire("error",{error:t});for(var r=e.getData(),n=e.data=new Uint8Array(r.length),i=0;i1!==this.retina){var t=new n(this.base);t.on("load",function(){this.img=t.img,this.data=t.data,this.retina=t.retina}.bind(this))}},i.prototype={x:0,y:0,width:0,height:0,pixelRatio:1,sdf:!1},n.prototype.getSpritePosition=function(t){if(!this.loaded())return new i;var e=this.data&&this.data[t];return e&&this.img?e:new i}},{"../util/ajax":386,"../util/browser":387,"../util/evented":395,"../util/mapbox":400}],338:[function(t,e,r){"use strict";var n=t("csscolorparser").parseCSSColor,i=t("../util/util"),a=t("./style_function"),o={};e.exports=function t(e){if(a.isFunctionDefinition(e))return i.extend({},e,{stops:e.stops.map(function(e){return[e[0],t(e[1])]})});if("string"==typeof e){if(!o[e]){var r=n(e);if(!r)throw new Error("Invalid color "+e);o[e]=[r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]]}return o[e]}throw new Error("Invalid color "+e)}},{"../util/util":403,"./style_function":341,csscolorparser:89}],339:[function(t,e,r){"use strict";function n(t,e,r){this.animationLoop=e||new g,this.dispatcher=new p(r||1,this),this.spriteAtlas=new l(1024,1024),this.lineAtlas=new u(256,512),this._layers={},this._order=[],this._groups=[],this.sources={},this.zoomHistory={},c.bindAll(["_forwardSourceEvent","_forwardTileEvent","_forwardLayerEvent","_redoPlacement"],this),this._resetUpdates();var n=function(t,e){if(t)return void this.fire("error",{error:t});if(!m.emitErrors(this,m(e))){this._loaded=!0,this.stylesheet=e,this.updateClasses();var r=e.sources;for(var n in r)this.addSource(n,r[n]);e.sprite&&(this.sprite=new o(e.sprite),this.sprite.on("load",this.fire.bind(this,"change"))),this.glyphSource=new s(e.glyphs),this._resolve(),this.fire("load")}}.bind(this);"string"==typeof t?h.getJSON(f(t),n):d.frame(n.bind(this,null,t)),this.on("source.load",function(t){var e=t.source;if(e&&e.vectorLayerIds)for(var r in this._layers){var n=this._layers[r];n.source===e.id&&this._validateLayer(n)}})}var i=t("../util/evented"),a=t("./style_layer"),o=t("./image_sprite"),s=t("../symbol/glyph_source"),l=t("../symbol/sprite_atlas"),u=t("../render/line_atlas"),c=t("../util/util"),h=t("../util/ajax"),f=t("../util/mapbox").normalizeStyleURL,d=t("../util/browser"),p=t("../util/dispatcher"),g=t("./animation_loop"),m=t("./validate_style"),v=t("../source/source"),y=t("../source/query_features"),x=t("../source/source_cache"),b=t("./style_spec"),_=t("./style_function");e.exports=n,n.prototype=c.inherit(i,{_loaded:!1,_validateLayer:function(t){var e=this.sources[t.source];t.sourceLayer&&e&&e.vectorLayerIds&&e.vectorLayerIds.indexOf(t.sourceLayer)===-1&&this.fire("error",{error:new Error('Source layer "'+t.sourceLayer+'" does not exist on source "'+e.id+'" as specified by style layer "'+t.id+'"')})},loaded:function(){if(!this._loaded)return!1;if(Object.keys(this._updates.sources).length)return!1;for(var t in this.sources)if(!this.sources[t].loaded())return!1;return!(this.sprite&&!this.sprite.loaded())},_resolve:function(){var t,e;this._layers={},this._order=this.stylesheet.layers.map(function(t){return t.id});for(var r=0;r0;){C-=1;var P=C*k,D=S[P],O=S[P+1],R=S[P+2],F=S[P+3],j=S[P+4],N=S[P+5],B=C*T,U=L[B],V=L[B+1],q=1&N,H=!!(16&N),G=l,X=u,Y=g,W=E;if(q&&(G=g,X=E,Y=l,W=u),!(2&N&&(R=_(t,D,O,R,G,X,V),O>=R)||4&N&&(O=w(t,D,O,R,G,X,U),O>=R))){var Z=R-O,Q=j-F;if(H){if(t*Z*(Z+Q)=p0)&&!(p1>=hi)",["p0","p1"]),b=g("lo===p0",["p0"]),_=g("lor&&i[h+e]>u;--c,h-=o){for(var f=h,d=h+o,p=0;p>>1,f=2*t,d=h,p=a[f*h+e];u=x?(d=y,p=x):v>=_?(d=m,p=v):(d=b,p=_):x>=_?(d=y,p=x):_>=v?(d=m,p=v):(d=b,p=_);for(var w=f*(c-1),M=f*d,A=0;A=0&&n.push("lo=e[k+n]"),t.indexOf("hi")>=0&&n.push("hi=e[k+o]"),r.push(i.replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}e.exports=n;var i="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],62:[function(t,e,r){"use strict";function n(t,e){e<=4*f?i(0,e-1,t):h(0,e-1,t)}function i(t,e,r){for(var n=2*(t+1),i=t+1;i<=e;++i){for(var a=r[n++],o=r[n++],s=i,l=n-2;s-- >t;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function c(t,e,r,n){t*=2;var i=n[t];return i>1,m=g-n,v=g+n,y=d,x=m,b=g,_=v,w=p,M=t+1,A=e-1,k=0;u(y,x,r)&&(k=y,y=x,x=k),u(_,w,r)&&(k=_,_=w,w=k),u(y,b,r)&&(k=y,y=b,b=k),u(x,b,r)&&(k=x,x=b,b=k),u(y,_,r)&&(k=y,y=_,_=k),u(b,_,r)&&(k=b,b=_,_=k),u(x,w,r)&&(k=x,x=w,w=k),u(x,b,r)&&(k=x,x=b,b=k),u(_,w,r)&&(k=_,_=w,w=k);for(var T=r[2*x],E=r[2*x+1],S=r[2*_],L=r[2*_+1],z=2*y,C=2*b,I=2*w,P=2*d,D=2*g,O=2*p,R=0;R<2;++R){var F=r[z+R],j=r[C+R],N=r[I+R];r[P+R]=F,r[D+R]=j,r[O+R]=N}o(m,t,r),o(v,e,r);for(var B=M;B<=A;++B)if(c(B,T,E,r))B!==M&&a(B,M,r),++M;else if(!c(B,S,L,r))for(;;){if(c(A,S,L,r)){c(A,T,E,r)?(s(B,M,A,r),++M,--A):(a(B,A,r),--A);break}if(--A>>1;f(_,E);for(var S=0,L=0,M=0;M=d)z=z-d|0,i(v,y,L--,z);else if(z>=0)i(g,m,S--,z);else if(z<=-d){z=-z-d|0;for(var C=0;C>>1;f(_,S);for(var L=0,z=0,C=0,A=0;A>1===_[2*A+3]>>1&&(P=2,A+=1),I<0){for(var D=-(I>>1)-1,O=0;O>1)-1;0===P?i(g,m,L--,D):1===P?i(v,y,z--,D):2===P&&i(x,b,C--,D)}}}function l(t,e,r,n,o,s,l,u,c,h,p,v){var y=0,x=2*t,b=e,w=e+t,M=1,A=1;n?A=d:M=d;for(var k=o;k>>1;f(_,L);for(var z=0,k=0;k=d?(I=!n,T-=d):(I=!!n,T-=1),I)a(g,m,z++,T);else{var P=v[T],D=x*T,O=p[D+e+1],R=p[D+e+1+t];t:for(var F=0;F>>1;f(_,M);for(var A=0,y=0;y=d)g[A++]=x-d;else{x-=1;var T=c[x],E=p*x,S=u[E+e+1],L=u[E+e+1+t];t:for(var z=0;z=0;--z)if(g[z]===x){for(var D=z+1;D=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function m(t){return+t!=t&&(t=0),o.alloc(+t)}function v(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))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 G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(n)return G(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return L(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return I(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function x(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(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),r=+r,isNaN(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=o.from(e,n)),o.isBuffer(e))return 0===e.length?-1:_(t,e,r,n,i);if("number"==typeof e)return e&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function _(t,e,r,n,i){function a(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,s=t.length,l=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"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}var u;if(i){var c=-1;for(u=r;us&&(r=s-l),u=r;u>=0;u--){for(var h=!0,f=0;fi&&(n=i)):n=i;var a=e.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o239?4:a>223?3:a>191?2:1;if(i+s<=r){var l,u,c,h;switch(s){case 1:a<128&&(o=a);break;case 2:l=t[i+1],128===(192&l)&&(h=(31&a)<<6|63&l,h>127&&(o=h));break;case 3:l=t[i+1],u=t[i+2],128===(192&l)&&128===(192&u)&&(h=(15&a)<<12|(63&l)<<6|63&u,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:l=t[i+1],u=t[i+2],c=t[i+3],128===(192&l)&&128===(192&u)&&128===(192&c)&&(h=(15&a)<<18|(63&l)<<12|(63&u)<<6|63&c,h>65535&&h<1114112&&(o=h))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return z(n)}function z(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,n,i,a){if(!o.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 F(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,a=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function j(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,a=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function N(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 B(t,e,r,n,i){return i||N(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,i){return i||N(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(t,e,r,n,52,8),r+8}function V(t){if(t=q(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function q(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function H(t){return t<16?"0"+t.toString(16):t.toString(16)}function G(t,e){e=e||1/0;for(var r,n=t.length,i=null,a=[],o=0;o55295&&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=(i-55296<<10|r-56320)+65536}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 X(t){for(var e=[],r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function W(t){return K.toByteArray(V(t))}function Z(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Q(t){return t!==t}var K=t("base64-js"),$=t("ieee754"),J=t("isarray");r.Buffer=o,r.SlowBuffer=m,r.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),r.kMaxLength=i(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,r){return s(null,t,e,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,r){return u(null,t,e,r)},o.allocUnsafe=function(t){return c(null,t)},o.allocUnsafeSlow=function(t){return c(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},o.prototype.compare=function(t,e,r,n,i){if(!o.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,s=r-e,l=Math.min(a,s),u=this.slice(n,i),c=t.slice(e,r),h=0;hi)&&(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 w(this,t,e,r);case"utf8":case"utf-8":return M(this,t,e,r);case"ascii":return A(this,t,e,r);case"latin1":case"binary":return k(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||O(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||O(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||O(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t],i=1,a=0;++a=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a},o.prototype.readInt8=function(t,e){return e||O(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},o.prototype.readInt16LE=function(t,e){e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||O(t,4,this.length),$.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||O(t,4,this.length),$.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||O(t,8,this.length),$.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||O(t,8,this.length),$.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){var i=Math.pow(2,8*r)-1;R(this,t,e,r,i,0)}var a=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+a]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):j(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);R(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},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);R(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},o.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):j(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var a;if("number"==typeof t)for(a=e;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function a(t){var e,r,i,a,o,s,l=t.length;o=n(t),s=new h(3*l/4-o),i=o>0?l-4:l;var u=0;for(e=0,r=0;e>16&255,s[u++]=a>>8&255,s[u++]=255&a;return 2===o?(a=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,s[u++]=255&a):1===o&&(a=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,s[u++]=a>>8&255,s[u++]=255&a),s}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var n,i=[],a=e;ac?c:l+o));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),a.push(i),a.join("")}r.byteLength=i,r.toByteArray=a,r.fromByteArray=l;for(var u=[],c=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=f.length;d0;){for(var c=r.pop(),s=r.pop(),h=-1,f=-1,l=o[s],p=1;p=0||(e.flip(s,c),n(t,e,r,h,s,f),n(t,e,r,s,f,h),n(t,e,r,f,c,h),n(t,e,r,c,h,f))}}var a=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=i},{"binary-search-bounds":72,"robust-in-sphere":463}],69:[function(t,e,r){"use strict";function n(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 i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function a(t,e){for(var r=t.cells(),a=r.length,o=0;o0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-i){u[d]=i;for(var p=(c[d],0);p<3;++p){var g=f[3*d+p];g>=0&&0===u[g]&&(h[3*d+p]?l.push(g):(s.push(g),u[g]=i))}}}var m=l;l=s,s=m,l.length=0,i=-i}var v=o(c,u,e);return r?v.concat(n.boundary):v}var l=t("binary-search-bounds");e.exports=s;var u=n.prototype;u.locate=function(){var t=[0,0,0];return function(e,r,n){var a=e,o=r,s=n;return r1&&d(r[c[h-2]],r[c[h-1]],n)>0;)t.push([c[h-1],c[h-2],i]),h-=1;c.length=h,c.push(i);for(var p=u.upperIds,h=p.length;h>1&&d(r[p[h-2]],r[p[h-1]],n)<0;)t.push([p[h-2],p[h-1],i]),h-=1;p.length=h,p.push(i)}}function l(t,e){var r;return(r=t.a[0]v[0]&&l.push(new i(v,d,m,h),new i(d,v,g,h))}l.sort(a);for(var y=l[0].a[0]-(1+Math.abs(l[0].a[0]))*Math.pow(2,-52),x=[new n([y,1],[y,0],-1,[],[],[],[])],b=[],h=0,_=l.length;h<_;++h){var w=l[h],M=w.type;M===p?s(b,x,t,w.a,w.idx):M===m?u(x,t,w):c(x,t,w)}return b}var f=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,g=1,m=2;e.exports=h},{"binary-search-bounds":72,"robust-orientation":465}],71:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function i(t,e,r){for(var n=1,i=t.length;n=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;i(n[t],e,r),i(n[e],r,t),i(n[r],t,e)},s.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},s.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;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){var a=new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""));return a()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],73:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;r0?[w(e,-(1/0)),e]:[e,e]}function i(t,e){for(var r=new Array(e.length),n=0;n=t.length)return o[e-t.length];var r=t[e];return[y(r[0]),y(r[1])]}for(var o=[],s=0;s=0;--s){var g=n[s],u=g[0],m=e[u],v=m[0],b=m[1],w=t[v],A=t[b];if((w[0]-A[0]||w[1]-A[1])<0){var k=v;v=b,b=k}m[0]=v;var T,E=m[1]=g[1];for(i&&(T=m[2]);s>0&&n[s-1][0]===u;){var g=n[--s],S=g[1];i?e.push([E,S,T]):e.push([E,S]),E=S}i?e.push([E,b,T]):e.push([E,b])}return o}function u(t,e,r){for(var i=t.length+e.length,a=new g(i),o=r,s=0;se[2]?1:0}function f(t,e,r){if(0!==t.length){if(e)for(var n=0;n0||d.length>0)}function p(t,e,r){var n,i=!1;if(r){n=e;for(var a=new Array(e.length),o=0;op)throw new Error(f+" map requires nshades to be at least size "+h.length);for(m=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:s(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=h.map(function(t){return Math.round(t.index*p)}),m[0]<0&&(m[0]=0),m[1]<0&&(m[0]=0),m[0]>1&&(m[0]=1),m[1]>1&&(m[0]=1),y=0;y=0&&r[3]<=1||(r[3]=m[0]+(m[1]-m[0])*v);for(y=0;y=0}function i(t,e,r,i){var s=a(e,r,i);if(0===s){var l=o(a(t,e,r)),u=o(a(t,e,i));if(l===u){if(0===l){var c=n(t,e,r),h=n(t,e,i);return c===h?0:c?1:-1}return 0}return 0===u?l>0?-1:n(t,e,i)?-1:1:0===l?u>0?1:n(t,e,r)?1:-1:o(u-l)}var f=a(t,e,r);if(f>0)return s>0&&a(t,e,i)>0?1:-1;if(f<0)return s>0||a(t,e,i)>0?1:-1;var d=a(t,e,i);return d>0?1:n(t,e,r)?1:-1}e.exports=i;var a=t("robust-orientation"),o=t("signum"),s=t("two-sum"),l=t("robust-product"),u=t("robust-sum")},{"robust-orientation":465,"robust-product":466,"robust-sum":470,signum:472,"two-sum":495}],82:[function(t,e,r){function n(t,e){return t-e}function i(t,e){var r=t.length,i=t.length-e.length;if(i)return i;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||a(t[0],t[1])-a(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];if(i=o+t[2]-(s+e[2]))return i;var l=a(t[0],t[1]),u=a(e[0],e[1]);return a(l,t[2])-a(u,e[2])||a(l+t[2],o)-a(u+e[2],s);case 4:var c=t[0],h=t[1],f=t[2],d=t[3],p=e[0],g=e[1],m=e[2],v=e[3];return c+h+f+d-(p+g+m+v)||a(c,h,f,d)-a(p,g,m,v,p)||a(c+h,c+f,c+d,h+f,h+d,f+d)-a(p+g,p+m,p+v,g+m,g+v,m+v)||a(c+h+f,c+h+d,c+f+d,h+f+d)-a(p+g+m,p+g+v,p+m+v,g+m+v);default:for(var y=t.slice().sort(n),x=e.slice().sort(n),b=0;bt[r][0]&&(r=n);return er?[[r],[e]]:[[e]]}e.exports=n},{}],86:[function(t,e,r){"use strict";function n(t){var e=i(t),r=e.length;if(r<=2)return[];for(var n=new Array(r),a=e[r-1],o=0;o=e[l]&&(s+=1);a[o]=s}}return t}function a(t,e){try{return o(t,!0)}catch(u){var r=s(t);if(r.length<=e)return[];var a=n(t,r),l=o(a,!0);return i(l,r)}}e.exports=a;var o=t("incremental-convex-hull"),s=t("affine-hull")},{"affine-hull":30,"incremental-convex-hull":254}],88:[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",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CPV:"verde",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",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bdr|\\bdr.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",COG:"^(?!.*\\bdem)(?!.*\\bdr)(?!.*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",CZE:"^(?=.*rep).*czech|czechia|bohemia",CSK:"czechoslovakia",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",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).*\\bkorea|^(?=.*people).*\\bkorea|^(?=.*north).*\\bkorea|dprk",KOR:"^(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea",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)",MKD:"macedonia|fyrom",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:"micronesia",MDA:"moldov|b(a|e)ssarabia",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",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:"\\bs\\w*.?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",TZA:"tanzania",THA:"thailand|\\bsiam",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\\.?$",USA:"united.?states|\\bu\\.?s\\.?a\\.?\\b|\\bu\\.?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"}},{}],89:[function(t,e,r){function n(t){return t=Math.round(t),t<0?0:t>255?255:t}function i(t){return t<0?0:t>1?1:t}function a(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return i("%"===t[t.length-1]?parseFloat(t)/100: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}function l(t){var e=t.replace(/ /g,"").toLowerCase();if(e in u)return u[e].slice();if("#"===e[0]){if(4===e.length){var r=parseInt(e.substr(1),16);return r>=0&&r<=4095?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null}if(7===e.length){var r=parseInt(e.substr(1),16);return r>=0&&r<=16777215?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null}return null}var i=e.indexOf("("),l=e.indexOf(")");if(i!==-1&&l+1===e.length){var c=e.substr(0,i),h=e.substr(i+1,l-(i+1)).split(","),f=1;switch(c){case"rgba":if(4!==h.length)return null;f=o(h.pop());case"rgb":return 3!==h.length?null:[a(h[0]),a(h[1]),a(h[2]),f];case"hsla":if(4!==h.length)return null;f=o(h.pop());case"hsl":if(3!==h.length)return null;var d=(parseFloat(h[0])%360+360)%360/360,p=o(h[1]),g=o(h[2]),m=g<=.5?g*(p+1):g+p-g*p,v=2*g-m;return[n(255*s(v,m,d+1/3)),n(255*s(v,m,d)),n(255*s(v,m,d-1/3)),f];default:return null}}return null}var u={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=l}catch(t){}},{}],90:[function(t,e,r){"use strict";function n(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,u=3*i*i-2*i;if(t.length){a||(a=new Array(t.length));for(var c=t.length-1;c>=0;--c)a[c]=o*t[c]+s*e[c]+l*r[c]+u*n[c];return a}return o*t+s*e+l*r[c]+u*n}function i(t,e,r,n,i,a){var o=i-1,s=i*i,l=o*o,u=(1+2*i)*l,c=i*l,h=s*(3-2*i),f=s*o;if(t.length){a||(a=new Array(t.length));for(var d=t.length-1;d>=0;--d)a[d]=u*t[d]+c*e[d]+h*r[d]+f*n[d];return a}return u*t+c*e+h*r+f*n}e.exports=i,e.exports.derivative=n},{}],91:[function(t,e,r){"use strict";function n(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function i(t){var e=new n;e.pre=t.pre,e.body=t.body,e.post=t.post;var r=t.args.slice(0);e.argTypes=r;for(var i=0;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"===o)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===o){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"===o){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,a(e)}var a=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":93}],92:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,h=0;for(n=0;n=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",h,"]-=s",h].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r,i){for(var a=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],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("")),l&&u.push(["index[",e[c],"]=j",c].join(""));for(var c=0;c0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}function l(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,l=new Array(t.arrayArgs.length),c=new Array(t.arrayArgs.length),h=0;h0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),h=0;h3&&b.push(o(t.pre,t,c));var T=o(t.body,t,c),E=a(m);E3&&b.push(o(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+b.join("\n")+"\n----------");var S=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(c)].join(""),L=new Function(["function ",S,"(",x.join(","),"){",b.join("\n"),"} return ",S].join(""));return L()}var u=t("uniq");e.exports=l},{uniq:498}],93:[function(t,e,r){"use strict";function n(t){var e=["'use strict'","var CACHED={}"],r=[],n=t.funcName+"_cwise_thunk";e.push(["return function ",n,"(",t.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],u=[],c=0;c0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+h+".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"+h+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[c])+"]"))}t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+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}function a(t){return null===t?NaN:+t}function o(t){return!isNaN(t)}function s(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);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}}}function l(t){return t.length}function u(t){for(var e=1;t*e%1;)e*=10;return e}function c(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function h(){this._=Object.create(null)}function f(t){return(t+="")===_o||t[0]===wo?wo+t:t}function d(t){return(t+="")[0]===wo?t.slice(1):t}function p(t){return f(t)in this._}function g(t){return(t=f(t))in this._&&delete this._[t]}function m(){var t=[];for(var e in this._)t.push(d(e));return t}function v(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function x(){this._=Object.create(null)}function b(t){return t}function _(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=Mo.length;r=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Po.get(t);return u&&(t=u,l=Q),s?e?i:n:e?M:a}function Z(t,e){return function(r){var n=uo.event;uo.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{uo.event=n}}}function Q(t,e){var r=Z(t,e);return function(t){var e=this,n=t.relatedTarget;n&&(n===e||8&n.compareDocumentPosition(e))||r.call(e,t)}}function K(t){var r=".dragsuppress-"+ ++Oo,i="click"+r,a=uo.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Do&&(Do=!("onselectstart"in t)&&w(t.style,"userSelect")),Do){var o=e(t).style,s=o[Do];o[Do]="none"}return function(t){if(a.on(r,null),Do&&(o[Do]=s),t){var e=function(){a.on(i,null)};a.on(i,function(){T(),e()},!0),setTimeout(e,0)}}}function $(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(Ro<0){var a=n(t);if(a.scrollX||a.scrollY){r=uo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();Ro=!(o.f||o.e),r.remove()}}return Ro?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function J(){return uo.event.changedTouches[0].identifier}function tt(t){return t>0?1:t<0?-1:0}function et(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function rt(t){return t>1?0:t<-1?No:Math.acos(t)}function nt(t){return t>1?Vo:t<-1?-Vo:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function at(t){return((t=Math.exp(t))+1/t)/2}function ot(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ut(t,e,r){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):Mt(""+t,At,ut):new ut(t,e,r)}function ct(t,e,r){function n(t){return t>360?t-=360:t<0&&(t+=360),t<60?a+(o-a)*t/60:t<180?o:t<240?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*n(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,o=r<=.5?r*(1+e):r+e-r*e,a=2*r-o,new xt(i(t+120),i(t),i(t-120))}function ht(t,e,r){return this instanceof ht?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ht?new ht(t.h,t.c,t.l):t instanceof dt?gt(t.l,t.a,t.b):gt((t=kt((t=uo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ht(t,e,r)}function ft(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(r,Math.cos(t*=qo)*e,Math.sin(t)*e)}function dt(t,e,r){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof ht?ft(t.h,t.c,t.l):kt((t=xt(t)).r,t.g,t.b):new dt(t,e,r)}function pt(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return i=mt(i)*ts,n=mt(n)*es,a=mt(a)*rs,new xt(yt(3.2404542*i-1.5371385*n-.4985314*a),yt(-.969266*i+1.8760108*n+.041556*a),yt(.0556434*i-.2040259*n+1.0572252*a))}function gt(t,e,r){return t>0?new ht(Math.atan2(r,e)*Ho,Math.sqrt(e*e+r*r),t):new ht(NaN,NaN,t)}function mt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function vt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function xt(t,e,r){return this instanceof xt?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof xt?new xt(t.r,t.g,t.b):Mt(""+t,xt,ct):new xt(t,e,r)}function bt(t){return new xt(t>>16,t>>8&255,255&t)}function _t(t){return bt(t)+""}function wt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(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(Et(i[0]),Et(i[1]),Et(i[2]))}return(a=as.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 At(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 kt(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=vt((.4124564*t+.3575761*e+.1804375*r)/ts),i=vt((.2126729*t+.7151522*e+.072175*r)/es),a=vt((.0193339*t+.119192*e+.9503041*r)/rs);return dt(116*i-16,500*(n-i),200*(i-a))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Et(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function St(t){return"function"==typeof t?t:function(){return t}}function Lt(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),zt(e,r,t,n)}}function zt(t,e,r,n){function i(){var t,e=l.status;if(!e&&It(l)||e>=200&&e<300||304===e){try{t=r.call(a,l)}catch(t){return void o.error.call(a,t)}o.load.call(a,t)}else o.error.call(a,l)}var a={},o=uo.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=uo.event;uo.event=t;try{o.progress.call(a,l)}finally{uo.event=e}},a.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",a)},a.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",a):e},a.responseType=function(t){return arguments.length?(u=t,a):u},a.response=function(t){return r=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(ho(arguments)))}}),a.send=function(r,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),l.open(r,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=u&&(l.responseType=u),null!=i&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==n?null:n),a},a.abort=function(){return l.abort(),a},uo.rebind(a,o,"on"),null==n?a:a.get(Ct(n))}function Ct(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function It(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Pt(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var i=r+e,a={c:t,t:i,n:null};return ss?ss.n=a:os=a,ss=a,ls||(us=clearTimeout(us),ls=1,cs(Dt)),a}function Dt(){var t=Ot(),e=Rt()-t;e>24?(isFinite(e)&&(clearTimeout(us),us=setTimeout(Dt,e)),ls=0):(ls=1,cs(Dt))}function Ot(){for(var t=Date.now(),e=os;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Rt(){for(var t,e=os,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Nt(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,a=n&&r?function(t,e){for(var i=t.length,a=[],o=0,s=n[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=n[o=(o+1)%n.length];return a.reverse().join(r)}:b;return function(t){var r=fs.exec(t),n=r[1]||" ",o=r[2]||">",s=r[3]||"-",l=r[4]||"",u=r[5],c=+r[6],h=r[7],f=r[8],d=r[9],p=1,g="",m="",v=!1,y=!0;switch(f&&(f=+f.substring(1)),(u||"0"===n&&"="===o)&&(u=n="0",o="="),d){case"n":h=!0,d="g";break;case"%":p=100,m="%",d="f";break;case"p":p=100,m="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":y=!1;case"d":v=!0,f=0;break;case"s":p=-1,d="r"}"$"===l&&(g=i[0],m=i[1]),"r"!=d||f||(d="g"),null!=f&&("g"==d?f=Math.max(1,Math.min(21,f)):"e"!=d&&"f"!=d||(f=Math.max(0,Math.min(20,f)))),d=ds.get(d)||Bt;var x=u&&h;return function(t){var r=m;if(v&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=uo.formatPrefix(t,f);t=l.scale(t),r=l.symbol+m}else t*=p;t=d(t,f);var b,_,w=t.lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(b=t,_=""):(b=t.substring(0,M),_=t.substring(M))}else b=t.substring(0,w),_=e+t.substring(w+1);!u&&h&&(b=a(b,1/0));var A=g.length+b.length+_.length+(x?0:i.length),k=A"===o?k+i+t:"^"===o?k.substring(0,A>>=1)+i+t+k.substring(A):i+(x?t:k+t))+r}}}function Bt(t){return t+""}function Ut(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Vt(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o=u)return-1;if(i=e.charCodeAt(s++),37===i){if(o=e.charAt(s++),a=L[o in vs?e.charAt(s++):o],!a||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}function n(t,e,r){w.lastIndex=0;var n=w.exec(e.slice(r));return n?(t.w=M.get(n[0].toLowerCase()),r+n[0].length):-1}function i(t,e,r){b.lastIndex=0;var n=b.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=E.get(n[0].toLowerCase()),r+n[0].length):-1}function o(t,e,r){A.lastIndex=0;var n=A.exec(e.slice(r));return n?(t.m=k.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,S.c.toString(),e,n)}function l(t,e,n){return r(t,S.x.toString(),e,n)}function u(t,e,n){return r(t,S.X.toString(),e,n)}function c(t,e,r){var n=x.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)}var h=t.dateTime,f=t.date,d=t.time,p=t.periods,g=t.days,m=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{gs=Ut;var e=new gs;return e._=t,n(e)}finally{gs=Date}}var n=e(t);return r.parse=function(t){try{gs=Ut;var e=n.parse(t);return e&&e._}finally{gs=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var x=uo.map(),b=Xt(g),_=Yt(g),w=Xt(m),M=Yt(m),A=Xt(v),k=Yt(v),T=Xt(y),E=Yt(y);p.forEach(function(t,e){x.set(t.toLowerCase(),e)});var S={a:function(t){return m[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(h),d:function(t,e){return Gt(t.getDate(),e,2)},e:function(t,e){return Gt(t.getDate(),e,2)},H:function(t,e){return Gt(t.getHours(),e,2)},I:function(t,e){return Gt(t.getHours()%12||12,e,2)},j:function(t,e){return Gt(1+ps.dayOfYear(t),e,3)},L:function(t,e){return Gt(t.getMilliseconds(),e,3); +},m:function(t,e){return Gt(t.getMonth()+1,e,2)},M:function(t,e){return Gt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Gt(t.getSeconds(),e,2)},U:function(t,e){return Gt(ps.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(ps.mondayOfYear(t),e,2)},x:e(f),X:e(d),y:function(t,e){return Gt(t.getFullYear()%100,e,2)},Y:function(t,e){return Gt(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},L={a:n,A:i,b:a,B:o,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:ae,p:c,S:oe,U:Zt,w:Wt,W:Qt,x:l,X:u,y:$t,Y:Kt,Z:Jt,"%":ue};return e}function Gt(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3)}function ee(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ae(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){ys.lastIndex=0;var n=ys.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function le(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=bo(e)/60|0,i=bo(e)%60;return r+Gt(n,"0",2)+Gt(i,"0",2)}function ue(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function ce(t){for(var e=t.length,r=-1;++r=0?1:-1,s=o*r,l=Math.cos(e),u=Math.sin(e),c=a*u,h=i*l+c*Math.cos(s),f=c*o*Math.sin(s);ks.add(Math.atan2(f,h)),n=t,i=l,a=u}var e,r,n,i,a;Ts.point=function(o,s){Ts.point=t,n=(e=o)*qo,i=Math.cos(s=(r=s)*qo/2+No/4),a=Math.sin(s)},Ts.lineEnd=function(){t(e,r)}}function ve(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 be(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Me(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function Ae(t,e){return bo(t[0]-e[0])=0;--s)i.point((h=c[s])[0],h[1])}else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);i.lineEnd()}}}function Pe(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n0){for(_||(a.polygonStart(),_=!0),a.lineStart();++o1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(Re))}var d,p,g,m=e(a),v=i.invert(n[0],n[1]),y={point:o,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=h,y.lineEnd=f,d=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=l,y.lineEnd=u,d=uo.merge(d);var t=Ve(v,p);d.length?(_||(a.polygonStart(),_=!0),Ie(d,je,t,r,a)):t&&(_||(a.polygonStart(),_=!0),a.lineStart(),r(null,null,1,a),a.lineEnd()),_&&(a.polygonEnd(),_=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),r(null,null,1,a),a.lineEnd(),a.polygonEnd()}},x=Fe(),b=e(x),_=!1;return y}}function Re(t){return t.length>1}function Fe(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:M,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function je(t,e){return((t=t.x)[0]<0?t[1]-Vo-Fo:Vo-t[1])-((e=e.x)[0]<0?e[1]-Vo-Fo:Vo-e[1])}function Ne(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?No:-No,l=bo(a-r);bo(l-No)0?Vo:-Vo),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=No&&(bo(r-i)Fo?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}function Ue(t,e,r,n){var i;if(null==t)i=r*Vo,n.point(-No,i),n.point(0,i),n.point(No,i),n.point(No,0),n.point(No,-i),n.point(0,-i),n.point(-No,-i),n.point(-No,0),n.point(-No,i);else if(bo(t[0]-e[0])>Fo){var a=t[0]=0?1:-1,M=w*_,A=M>No,k=p*x;if(ks.add(Math.atan2(k*w*Math.sin(M),g*b+k*Math.cos(M))),a+=A?_+w*Bo:_,A^f>=r^v>=r){var T=xe(ve(h),ve(t));we(T);var E=xe(i,T);we(E);var S=(A^_>=0?-1:1)*nt(E[2]);(n>S||n===S&&(T[0]||T[1]))&&(o+=A^_>=0?1:-1)}if(!m++)break;f=v,p=x,g=b,h=t}}return(a<-Fo||aa}function r(t){var r,a,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(h,f){var d,p=[h,f],g=e(h,f),m=o?g?0:i(h,f):g?i(h+(h<0?No:-No),f):0;if(!r&&(u=l=g)&&t.lineStart(),g!==l&&(d=n(r,p),(Ae(r,d)||Ae(p,d))&&(p[0]+=Fo,p[1]+=Fo,g=e(p[0],p[1]))),g!==l)c=0,g?(t.lineStart(),d=n(p,r),t.point(d[0],d[1])):(d=n(r,p),t.point(d[0],d[1]),t.lineEnd()),r=d;else if(s&&r&&o^g){var v;m&a||!(v=n(p,r,!0))||(c=0,o?(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||r&&Ae(r,p)||t.point(p[0],p[1]),r=p,l=g,a=m},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=ve(t),i=ve(e),o=[1,0,0],s=xe(n,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var h=a*l/c,f=-a*u/c,d=xe(o,s),p=_e(o,h),g=_e(s,f);be(p,g);var m=d,v=ye(p,m),y=ye(m,m),x=v*v-y*(ye(p,p)-1);if(!(x<0)){var b=Math.sqrt(x),_=_e(m,(-v-b)/y);if(be(_,p),_=Me(_),!r)return _;var w,M=t[0],A=e[0],k=t[1],T=e[1];A0^_[1]<(bo(_[0]-M)No^(M<=_[0]&&_[0]<=A)){var z=_e(m,(-v+b)/y);return be(z,p),[_,Me(z)]}}}function i(e,r){var n=o?t:No-t,i=0;return e<-n?i|=1:e>n&&(i|=2),r<-n?i|=4:r>n&&(i|=8),i}var a=Math.cos(t),o=a>0,s=bo(a)>Fo,l=mr(t,6*qo);return Oe(e,r,l,o?[0,-t]:[-No,t-No])}function He(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=s.x,h=s.y,f=0,d=1,p=c-l,g=h-u;if(a=t-l,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>d)return;a>f&&(f=a)}if(a=r-l,p||!(a<0)){if(a/=p,p<0){if(a>d)return;a>f&&(f=a)}else if(p>0){if(a0)){if(a/=g,g<0){if(a0){if(a>d)return;a>f&&(f=a)}if(a=n-u,g||!(a<0)){if(a/=g,g<0){if(a>d)return;a>f&&(f=a)}else if(g>0){if(a0&&(i.a={x:l+f*p,y:u+f*g}),d<1&&(i.b={x:l+d*p,y:u+d*g}),i}}}}}}function Ge(t,e,r,n){function i(n,i){return bo(n[0]-t)0?0:3:bo(n[0]-r)0?2:1:bo(n[1]-e)0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(t,e){var r=i(t,1),n=i(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,r=m.length,n=t[1],i=0;in&&et(u,a,t)>0&&++e:a[1]<=n&&et(u,a,t)<0&&--e,u=a;return 0!==e}function u(a,s,l,u){var c=0,h=0;if(null==a||(c=i(a,l))!==(h=i(s,l))||o(a,s)<0^l>0){do u.point(0===c||3===c?t:r,c>1?n:e);while((c=(c+l+4)%4)!==h)}else u.point(s[0],s[1])}function c(i,a){return t<=i&&i<=r&&e<=a&&a<=n}function h(t,e){c(t,e)&&s.point(t,e)}function f(){L.point=p,m&&m.push(v=[]),A=!0,M=!1,_=w=NaN}function d(){g&&(p(y,x),b&&M&&E.rejoin(),g.push(E.buffer())),L.point=h,M&&s.lineEnd()}function p(t,e){t=Math.max(-Bs,Math.min(Bs,t)),e=Math.max(-Bs,Math.min(Bs,e));var r=c(t,e);if(m&&v.push([t,e]),A)y=t,x=e,b=r,A=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&M)s.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};S(n)?(M||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),k=!1):r&&(s.lineStart(),s.point(t,e),k=!1)}_=t,w=e,M=r}var g,m,v,y,x,b,_,w,M,A,k,T=s,E=Fe(),S=He(t,e,r,n),L={point:h,lineStart:f,lineEnd:d,polygonStart:function(){s=E,g=[],m=[],k=!0},polygonEnd:function(){s=T,g=uo.merge(g);var e=l([t,n]),r=k&&e,i=g.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Ie(g,a,e,u,s),s.polygonEnd()),g=m=v=null}};return L}}function Xe(t){var e=0,r=No/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*No/180,r=t[1]*No/180):[e/No*180,r/No*180]},i}function Ye(t,e){function r(t,e){var r=Math.sqrt(a-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),o-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,a=1+n*(2*i-n),o=Math.sqrt(a)/i;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,nt((a-(t*t+r*r)*i*i)/(2*i))]},r}function We(){function t(t,e){Vs+=i*t-n*e,n=t,i=e}var e,r,n,i;Ys.point=function(a,o){Ys.point=t,e=n=a,r=i=o},Ys.lineEnd=function(){t(e,r)}}function Ze(t,e){tGs&&(Gs=t),eXs&&(Xs=e)}function Qe(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=r}function r(t,e){o.push("L",t,",",e)}function n(){s.point=t}function i(){o.push("Z")}var a=Ke(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return a=Ke(t),s},result:function(){if(o.length){var t=o.join("");return o=[],t}}};return s}function Ke(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $e(t,e){Ls+=t,zs+=e,++Cs}function Je(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);Is+=o*(e+t)/2,Ps+=o*(r+n)/2,Ds+=o,$e(e=t,r=n)}var e,r;Zs.point=function(n,i){Zs.point=t,$e(e=n,r=i)}}function tr(){Zs.point=$e}function er(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Is+=o*(n+t)/2,Ps+=o*(i+e)/2,Ds+=o,o=i*t-n*e,Os+=o*(n+t),Rs+=o*(i+e),Fs+=3*o,$e(n=t,i=e)}var e,r,n,i;Zs.point=function(a,o){Zs.point=t,$e(e=n=a,r=i=o)},Zs.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+o,r),t.arc(e,r,o,0,Bo)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function i(){s.point=e}function a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:i,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return o=t,s},result:M};return s}function nr(t){function e(t){return(s?n:r)(t)}function r(e){return or(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})}function n(e){function r(r,n){r=t(r,n),e.point(r[0],r[1])}function n(){x=NaN,A.point=a,e.lineStart()}function a(r,n){var a=ve([r,n]),o=t(r,n);i(x,b,y,_,w,M,x=o[0],b=o[1],y=r,_=a[0],w=a[1],M=a[2],s,e),e.point(x,b)}function o(){A.point=r,e.lineEnd()}function l(){n(),A.point=u,A.lineEnd=c}function u(t,e){a(h=t,f=e),d=x,p=b,g=_,m=w,v=M,A.point=a}function c(){i(x,b,y,_,w,M,d,p,h,g,m,v,s,e),A.lineEnd=o,o()}var h,f,d,p,g,m,v,y,x,b,_,w,M,A={point:r,lineStart:n,lineEnd:o,polygonStart:function(){e.polygonStart(),A.lineStart=l},polygonEnd:function(){e.polygonEnd(),A.lineStart=n}};return A}function i(e,r,n,s,l,u,c,h,f,d,p,g,m,v){var y=c-e,x=h-r,b=y*y+x*x;if(b>4*a&&m--){var _=s+d,w=l+p,M=u+g,A=Math.sqrt(_*_+w*w+M*M),k=Math.asin(M/=A),T=bo(bo(M)-1)a||bo((y*z+x*C)/b-.5)>.3||s*d+l*p+u*g0&&16,e):Math.sqrt(a)},e}function ir(t){var e=nr(function(e,r){return t([e*Ho,r*Ho])});return function(t){return ur(e(t))}}function ar(t){this.stream=t}function or(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function sr(t){return lr(function(){return t})()}function lr(t){function e(t){return t=s(t[0]*qo,t[1]*qo),[t[0]*f+l,u-t[1]*f]}function r(t){return t=s.invert((t[0]-l)/f,(u-t[1])/f),t&&[t[0]*Ho,t[1]*Ho]}function n(){s=ze(o=fr(v,y,x),a);var t=a(g,m);return l=d-t[0]*f,u=p+t[1]*f,i()}function i(){return c&&(c.valid=!1,c=null),e}var a,o,s,l,u,c,h=nr(function(t,e){return t=a(t,e),[t[0]*f+l,u-t[1]*f]}),f=150,d=480,p=250,g=0,m=0,v=0,y=0,x=0,_=Ns,w=b,M=null,A=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(o,h(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(M=t,Ns):qe((M=+t)*qo),i()):M},e.clipExtent=function(t){return arguments.length?(A=t,w=t?Ge(t[0][0],t[0][1],t[1][0],t[1][1]):b,i()):A},e.scale=function(t){return arguments.length?(f=+t,n()):f},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],n()):[d,p]},e.center=function(t){return arguments.length?(g=t[0]%360*qo,m=t[1]%360*qo,n()):[g*Ho,m*Ho]},e.rotate=function(t){return arguments.length?(v=t[0]%360*qo,y=t[1]%360*qo,x=t.length>2?t[2]%360*qo:0,n()):[v*Ho,y*Ho,x*Ho]},uo.rebind(e,h,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&r,n()}}function ur(t){return or(t,function(e,r){t.point(e*qo,r*qo)})}function cr(t,e){return[t,e]}function hr(t,e){return[t>No?t-Bo:t<-No?t+Bo:t,e]}function fr(t,e,r){return t?e||r?ze(pr(t),gr(e,r)):pr(t):e||r?gr(e,r):hr}function dr(t){return function(e,r){return e+=t,[e>No?e-Bo:e<-No?e+Bo:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function gr(t,e){function r(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*n+s*i;return[Math.atan2(l*a-c*o,s*n-u*i),nt(c*a+l*o)]}var n=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*a-l*o;return[Math.atan2(l*a+u*o,s*n+c*i),nt(c*n-s*i)]},r}function mr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=vr(r,i),a=vr(r,a),(o>0?ia)&&(i+=o*Bo)):(i=t+o*Bo,a=t-.5*l);for(var u,c=i;o>0?c>a:c0?e<-Vo+Fo&&(e=-Vo+Fo):e>Vo-Fo&&(e=Vo-Fo);var r=o/Math.pow(i(e),a);return[r*Math.sin(a*t),o-r*Math.cos(a*t)]}var n=Math.cos(t),i=function(t){return Math.tan(No/4+t/2)},a=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),o=n*Math.pow(i(t),a)/a;return a?(r.invert=function(t,e){var r=o-e,n=tt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(o/n,1/a))-Vo]},r):Er}function Tr(t,e){function r(t,e){var r=a-e;return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),a=n/i+t;return bo(i)1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Pr(t,e){return t[0]-e[0]||t[1]-e[1]}function Dr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Or(t,e,r,n){var i=t[0],a=r[0],o=e[0]-i,s=n[0]-a,l=t[1],u=r[1],c=e[1]-l,h=n[1]-u,f=(s*(l-u)-h*(i-a))/(h*o-s*c);return[i+f*o,l+f*c]}function Rr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Fr(){an(this),this.edge=this.site=this.circle=null}function jr(t){var e=ul.pop()||new Fr;return e.site=t,e}function Nr(t){Zr(t),ol.remove(t),ul.push(t),an(t)}function Br(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},a=t.P,o=t.N,s=[t];Nr(t);for(var l=a;l.circle&&bo(r-l.circle.x)Fo)s=s.L;else{if(i=a-qr(s,o),!(i>Fo)){n>-Fo?(e=s.P,r=s):i>-Fo?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=jr(t);if(ol.insert(e,l),e||r){if(e===r)return Zr(e),r=jr(e.site),ol.insert(l,r),l.edge=r.edge=Jr(e.site,l.site),Wr(e),void Wr(r);if(!r)return void(l.edge=Jr(e.site,l.site));Zr(e),Zr(r);var u=e.site,c=u.x,h=u.y,f=t.x-c,d=t.y-h,p=r.site,g=p.x-c,m=p.y-h,v=2*(f*m-d*g),y=f*f+d*d,x=g*g+m*m,b={x:(m*y-d*x)/v+c,y:(f*x-g*y)/v+h};en(r.edge,u,p,b),l.edge=Jr(u,t,null,b),r.edge=Jr(t,p,null,b),Wr(e),Wr(r)}}function Vr(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);r=o.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,h=1/a-1/u,f=c/u;return h?(-f+Math.sqrt(f*f-2*h*(c*c/(-2*u)-l+u/2+i-a/2)))/h+n:(n+s)/2}function qr(t,e){var r=t.N;if(r)return Vr(r,e);var n=t.site;return n.y===e?n.x:1/0}function Hr(t){this.site=t,this.edges=[]}function Gr(t){for(var e,r,n,i,a,o,s,l,u,c,h=t[0][0],f=t[1][0],d=t[0][1],p=t[1][1],g=al,m=g.length;m--;)if(a=g[m],a&&a.prepare())for(s=a.edges,l=s.length,o=0;oFo||bo(i-r)>Fo)&&(s.splice(o,0,new rn(tn(a.site,c,bo(n-h)Fo?{x:h,y:bo(e-h)Fo?{x:bo(r-p)Fo?{x:f,y:bo(e-f)Fo?{x:bo(r-d)=-jo)){var d=l*l+u*u,p=c*c+h*h,g=(h*d-u*p)/f,m=(l*p-c*d)/f,h=m+s,v=cl.pop()||new Yr;v.arc=t,v.site=i,v.x=g+o,v.y=h+Math.sqrt(g*g+m*m),v.cy=h,t.circle=v;for(var y=null,x=ll._;x;)if(v.y=s)return;if(f>p){if(a){if(a.y>=u)return}else a={x:m,y:l};r={x:m,y:u}}else{if(a){if(a.y1)if(f>p){if(a){if(a.y>=u)return}else a={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}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.xa||h>o||f=b,M=r>=_,A=M<<1|w,k=A+4;Aa&&(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:xn(r,n)})),a=dl.lastIndex;return a=0&&!(r=uo.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function An(t){return function(e){return 1-t(1-e)}}function kn(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Sn(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 Ln(t){return function(e){return Math.pow(e,t)}}function zn(t){return 1-Math.cos(t*Vo)}function Cn(t){return Math.pow(2,10*(t-1))}function In(t){return 1-Math.sqrt(1-t*t)}function Pn(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Bo*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Bo/e)}}function Dn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function On(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 Rn(t,e){t=uo.hcl(t),e=uo.hcl(e);var r=t.h,n=t.c,i=t.l,a=e.h-r,o=e.c-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ft(r+a*t,n+o*t,i+s*t)+""}}function Fn(t,e){t=uo.hsl(t),e=uo.hsl(e);var r=t.h,n=t.s,i=t.l,a=e.h-r,o=e.s-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return ct(r+a*t,n+o*t,i+s*t)+""}}function jn(t,e){t=uo.lab(t),e=uo.lab(e);var r=t.l,n=t.a,i=t.b,a=e.l-r,o=e.a-n,s=e.b-i;return function(t){return pt(r+a*t,n+o*t,i+s*t)+""}}function Nn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function Bn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Vn(e),i=Un(e,r),a=Vn(qn(r,e,-i))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(Hn(r)+"rotate(",null,")")-2,x:xn(t,e)})):e&&r.push(Hn(r)+"rotate("+e+")")}function Yn(t,e,r,n){t!==e?n.push({i:r.push(Hn(r)+"skewX(",null,")")-2,x:xn(t,e)}):e&&r.push(Hn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(Hn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:xn(t[0],e[0])},{i:i-2,x:xn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(Hn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=uo.transform(t),e=uo.transform(e),Gn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Yn(t.skew,e.skew,r,n),Wn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,a=n.length;++i=0;)r.push(i[n])}function li(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;++oi&&(n=r,i=e);return n}function xi(t){return t.reduce(bi,0)}function bi(t,e){return t+e[1]}function _i(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,a=[];++r<=e;)a[r]=i*r+n;return a}function Mi(t){return[uo.min(t),uo.max(t)]}function Ai(t,e){return t.value-e.value}function ki(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ti(t,e){t._pack_next=e,e._pack_prev=t}function Ei(t,e){var r=e.x-t.x,n=e.y-t.y,i=t.r+e.r;return.999*i*i>r*r+n*n}function Si(t){function e(t){c=Math.min(t.x-t.r,c),h=Math.max(t.x+t.r,h),f=Math.min(t.y-t.r,f),d=Math.max(t.y+t.r,d)}if((r=t.children)&&(u=r.length)){var r,n,i,a,o,s,l,u,c=1/0,h=-(1/0),f=1/0,d=-(1/0);if(r.forEach(Li),n=r[0],n.x=-n.r,n.y=0,e(n),u>1&&(i=r[1],i.x=i.r,i.y=0,e(i),u>2))for(a=r[2],Ii(n,i,a),e(a),ki(n,a),n._pack_prev=a,ki(a,i),i=n._pack_next,o=3;o=0;)e=i[a],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function ji(t,e,r){return t.a.parent===e.parent?t.a:r}function Ni(t){return 1+uo.max(t,function(t){return t.y})}function Bi(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ui(t){var e=t.children;return e&&e.length?Ui(e[0]):t}function Vi(t){var e,r=t.children;return r&&(e=r.length)?Vi(r[e-1]):t}function qi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Hi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(r+=i/2,i=0),a<0&&(n+=a/2,a=0),{x:r,y:n,dx:i,dy:a}}function Gi(t){var e=t[0],r=t[t.length-1];return e2?Qi:Yi,l=n?Kn:Qn;return o=i(t,e,l,r),s=i(e,t,l,_n),a}function a(t){return o(t)}var o,s;return a.invert=function(t){return s(t)},a.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},a.range=function(t){return arguments.length?(e=t,i()):e},a.rangeRound=function(t){return a.range(t).interpolate(Nn)},a.clamp=function(t){return arguments.length?(n=t,i()):n},a.interpolate=function(t){return arguments.length?(r=t,i()):r},a.ticks=function(e){return ea(t,e)},a.tickFormat=function(e,r){return ra(t,e,r)},a.nice=function(e){return Ji(t,e),i()},a.copy=function(){return Ki(t,e,r,n)},i()}function $i(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ji(t,e){return Wi(t,Zi(ta(t,e)[2])),Wi(t,Zi(ta(t,e)[2])),t}function ta(t,e){null==e&&(e=10);var r=Gi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),a=e/n*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function ea(t,e){return uo.range.apply(uo,ta(t,e))}function ra(t,e,r){var n=ta(t,e);if(r){var i=fs.exec(r);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(bo(n[0]),bo(n[1])));return i[7]||(i[7]="."+na(a.scale(n[2]))),i[8]="f",r=uo.format(i.join("")),function(t){return r(a.scale(t))+a.symbol}}i[7]||(i[7]="."+ia(i[8],n)),r=i.join("")}else r=",."+na(n[2])+"f";return uo.format(r)}function na(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ia(t,e){var r=na(e[2]);return t in kl?Math.abs(r-na(Math.max(bo(e[0]),bo(e[1]))))+ +("e"!==t):r-2*("%"===t)}function aa(t,e,r,n){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(i(e))}return o.invert=function(e){return a(t.invert(e))},o.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),o):e},o.nice=function(){var e=Wi(n.map(i),r?Math:El);return t.domain(e),n=e.map(a),o},o.ticks=function(){var t=Gi(n),o=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),h=e%1?2:e;if(isFinite(c-u)){if(r){for(;u0;f--)o.push(a(u)*f);for(u=0;o[u]l;c--);o=o.slice(u,c)}return o},o.tickFormat=function(t,r){if(!arguments.length)return Tl;arguments.length<2?r=Tl:"function"!=typeof r&&(r=uo.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e0?s[r-1]:t[0],r0?0:1}function ba(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,u=-s*a,c=t[0]+l,h=t[1]+u,f=e[0]+l,d=e[1]+u,p=(c+f)/2,g=(h+d)/2,m=f-c,v=d-h,y=m*m+v*v,x=r-n,b=c*d-f*h,_=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*v-m*_)/y,M=(-b*m-v*_)/y,A=(b*v+m*_)/y,k=(-b*m+v*_)/y,T=w-p,E=M-g,S=A-p,L=k-g;return T*T+E*E>S*S+L*L&&(w=A,M=k),[[w-l,M-u],[w*r/x,M*r/x]]}function _a(t){function e(e){function o(){u.push("M",a(t(c),s))}for(var l,u=[],c=[],h=-1,f=e.length,d=St(r),p=St(n);++h1?t.join("L"):t+"Z"}function Ma(t){return t.join("L")+"Z"}function Aa(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1&&i.push("H",n[0]),i.join("")}function ka(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 u=2;u9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[s+1]=i*n));for(s=-1;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}function Ua(t){return t.length<3?wa(t):t[0]+za(t,Ba(t))}function Va(t){for(var e,r,n,i=-1,a=t.length;++i0;)d[--s].call(t,o);if(a>=1)return g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var l,u,c,f,d,p=t[r]||(t[r]={active:0,count:0}),g=p[n];g||(l=i.time,u=Pt(a,0,l),g=p[n]={tween:new h,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function ro(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function no(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function io(t){return t.toISOString()}function ao(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,a=uo.bisect($l,i);return a==$l.length?[e.year,ta(t.map(function(t){return t/31536e6}),r)[2]]:a?e[i/$l[a-1]<$l[a]/i?a-1:a]:[eu,ta(t,r)[2]]}return n.invert=function(e){return oo(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain(e),n):t.domain().map(oo)},n.nice=function(t,e){function r(r){return!isNaN(r)&&!t.range(r,oo(+r+1),e).length}var a=n.domain(),o=Gi(a),s=null==t?i(o,10):"number"==typeof t&&i(o,t);return s&&(t=s[0],e=s[1]),n.domain(Wi(a,e>1?{floor:function(e){for(;r(e=t.floor(e));)e=oo(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=oo(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Gi(n.domain()),a=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(r[0],oo(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return ao(t.copy(),e,r)},$i(n,t)}function oo(t){return new Date(t)}function so(t){return JSON.parse(t.responseText)}function lo(t){var e=fo.createRange();return e.selectNode(fo.body),e.createContextualFragment(t.responseText)}var uo={version:"3.5.17"},co=[].slice,ho=function(t){return co.call(t)},fo=this.document;if(fo)try{ho(fo.documentElement.childNodes)[0].nodeType}catch(t){ho=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}),fo)try{fo.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var po=this.Element.prototype,go=po.setAttribute,mo=po.setAttributeNS,vo=this.CSSStyleDeclaration.prototype,yo=vo.setProperty;po.setAttribute=function(t,e){go.call(this,t,e+"")},po.setAttributeNS=function(t,e,r){mo.call(this,t,e,r+"")},vo.setProperty=function(t,e,r){yo.call(this,t,e+"",r)}}uo.ascending=i,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.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},uo.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},uo.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 l/(c-1)},uo.deviation=function(){var t=uo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var xo=s(i);uo.bisectLeft=xo.left,uo.bisect=uo.bisectRight=xo.right,uo.bisector=function(t){return s(1===t.length?function(e,r){return i(t(e),r)}:t)},uo.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},uo.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},uo.pairs=function(t){for(var e,r=0,n=t.length-1,i=t[0],a=new Array(n<0?0:n);r=0;)for(n=t[i],e=n.length;--e>=0;)r[--o]=n[e];return r};var bo=Math.abs;uo.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=u(bo(r)),o=-1;if(t*=a,e*=a,r*=a,r<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=a.length)return n?n.call(i,o):r?o.sort(r):o;for(var l,u,c,f,d=-1,p=o.length,g=a[s++],m=new h;++d=a.length)return t;var n=[],i=o[r++];return t.forEach(function(t,i){n.push({key:t,values:e(i,r)})}),i?n.sort(function(t,e){return i(t.key,e.key)}):n}var r,n,i={},a=[],o=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(uo.map,r,0),0)},i.key=function(t){return a.push(t),i},i.sortKeys=function(t){return o[a.length-1]=t,i},i.sortValues=function(t){return r=t,i},i.rollup=function(t){return n=t,i},i},uo.set=function(t){var e=new x;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}},uo.event=null,uo.requote=function(t){return t.replace(Ao,"\\$&")};var Ao=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ko={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},To=function(t,e){return e.querySelector(t)},Eo=function(t,e){return e.querySelectorAll(t)},So=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(So=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(To=function(t,e){return Sizzle(t,e)[0]||null},Eo=Sizzle,So=Sizzle.matchesSelector),uo.selection=function(){return uo.select(fo.documentElement)};var Lo=uo.selection.prototype=[];Lo.select=function(t){var e,r,n,i,a=[];t=z(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Co.hasOwnProperty(r)?{space:Co[r],local:t}:t}},Lo.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=uo.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(I(e,t[e]));return this}return this.each(I(t,e))},Lo.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=O(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},Lo.sort=function(t){t=H.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.transition().duration(L)),e.call(t.event)}function s(){_&&_.domain(b.range().map(function(t){return(t-A.x)/A.k}).map(b.invert)),M&&M.domain(w.range().map(function(t){return(t-A.y)/A.k}).map(w.invert))}function l(t){z++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:A.k,translate:[A.x,A.y]})}function c(t){--z||(t({type:"zoomend"}),m=null)}function h(){function t(){s=1,a(uo.mouse(i),f),u(o)}function r(){h.on(I,null).on(P,null),d(s),c(o)}var i=this,o=O.of(i,arguments),s=0,h=uo.select(n(i)).on(I,t).on(P,r),f=e(uo.mouse(i)),d=K(i);Vl.call(i),l(o)}function f(){function t(){var t=uo.touches(p);return d=A.k,t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))}),t}function r(){var e=uo.event.target;uo.select(e).on(b,n).on(_,s),w.push(e);for(var r=uo.event.changedTouches,i=0,a=r.length;i1){var c=l[0],h=l[1],f=c[0]-h[0],d=c[1]-h[1];v=f*f+d*d}}function n(){var t,e,r,n,o=uo.touches(p);Vl.call(p);for(var s=0,l=o.length;s=u)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ds=uo.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=uo.round(t,Ft(t,e))).toFixed(Math.max(0,Math.min(20,Ft(t*(1+1e-15),e))))}}),ps=uo.time={},gs=Date;Ut.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ms.setUTCDate.apply(this._,arguments)},setDay:function(){ms.setUTCDay.apply(this._,arguments)},setFullYear:function(){ms.setUTCFullYear.apply(this._,arguments)},setHours:function(){ms.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ms.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ms.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ms.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ms.setUTCSeconds.apply(this._,arguments)},setTime:function(){ms.setTime.apply(this._,arguments)}};var ms=Date.prototype;ps.year=Vt(function(t){return t=ps.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),ps.years=ps.year.range,ps.years.utc=ps.year.utc.range,ps.day=Vt(function(t){var e=new gs(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),ps.days=ps.day.range,ps.days.utc=ps.day.utc.range,ps.dayOfYear=function(t){var e=ps.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var r=ps[t]=Vt(function(t){return(t=ps.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var r=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});ps[t+"s"]=r.range,ps[t+"s"].utc=r.utc.range,ps[t+"OfYear"]=function(t){var r=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(r+e)%7)/7)}}),ps.week=ps.sunday,ps.weeks=ps.sunday.range,ps.weeks.utc=ps.sunday.utc.range,ps.weekOfYear=ps.sundayOfYear;var vs={"-":"",_:" ",0:"0"},ys=/^\s*\d+/,xs=/^%/;uo.locale=function(t){return{numberFormat:Nt(t),timeFormat:Ht(t)}};var bs=uo.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"]});uo.format=bs.numberFormat,uo.geo={},he.prototype={s:0,t:0,add:function(t){fe(t,this.t,_s),fe(_s.s,this.s,this),this.s?this.t+=_s.t:this.s=_s.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _s=new he;uo.geo.stream=function(t,e){t&&ws.hasOwnProperty(t.type)?ws[t.type](t,e):de(t,e)};var ws={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nd&&(d=e)}function e(e,r){var n=ve([e*qo,r*qo]);if(v){var i=xe(v,n),a=[i[1],-i[0],0],o=xe(a,i);we(o),o=Me(o);var l=e-p,u=l>0?1:-1,g=o[0]*Ho*u,m=bo(l)>180;if(m^(u*pd&&(d=y)}else if(g=(g+360)%360-180,m^(u*pd&&(d=r);m?es(c,f)&&(f=e):s(e,f)>s(c,f)&&(c=e):f>=c?(ef&&(f=e)):e>p?s(c,e)>s(c,f)&&(f=e):s(e,f)>s(c,f)&&(c=e)}else t(e,r);v=n,p=e}function r(){_.point=e}function n(){b[0]=c,b[1]=f,_.point=t,v=null}function i(t,r){if(v){var n=t-p;y+=bo(n)>180?n+(n>0?360:-360):n}else g=t,m=r;Ts.point(t,r),e(t,r)}function a(){Ts.lineStart()}function o(){i(g,m),Ts.lineEnd(),bo(y)>Fo&&(c=-(f=180)),b[0]=c,b[1]=f,v=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tFo?d=90:y<-Fo&&(h=-90),b[0]=c,b[1]=f}};return function(t){d=f=-(c=h=1/0),x=[],uo.geo.stream(t,_);var e=x.length;if(e){x.sort(l);for(var r,n=1,i=x[0],a=[i];ns(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):a.push(i=r);for(var o,r,p=-(1/0),e=a.length-1,n=0,i=a[e];n<=e;i=r,++n)r=a[n],(o=s(i[1],r[0]))>p&&(p=o,c=r[0],f=i[1])}return x=b=null,c===1/0||h===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,h],[f,d]]}}(),uo.geo.centroid=function(t){Es=Ss=Ls=zs=Cs=Is=Ps=Ds=Os=Rs=Fs=0,uo.geo.stream(t,js);var e=Os,r=Rs,n=Fs,i=e*e+r*r+n*n;return i=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},t.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()}}},t.precision=function(e){return arguments.length?(a.precision(e),o.precision(e),s.precision(e),t):a.precision()},t.scale=function(e){return arguments.length?(a.scale(e),o.scale(.35*e),s.scale(e),t.translate(a.translate())):a.scale()},t.translate=function(e){if(!arguments.length)return a.translate();var u=a.scale(),c=+e[0],h=+e[1];return r=a.translate(e).clipExtent([[c-.455*u,h-.238*u],[c+.455*u,h+.238*u]]).stream(l).point,n=o.translate([c-.307*u,h+.201*u]).clipExtent([[c-.425*u+Fo,h+.12*u+Fo],[c-.214*u-Fo,h+.234*u-Fo]]).stream(l).point,i=s.translate([c-.205*u,h+.212*u]).clipExtent([[c-.214*u+Fo,h+.166*u+Fo],[c-.115*u-Fo,h+.234*u-Fo]]).stream(l).point,t},t.scale(1070)};var Us,Vs,qs,Hs,Gs,Xs,Ys={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Vs=0,Ys.lineStart=We},polygonEnd:function(){Ys.lineStart=Ys.lineEnd=Ys.point=M,Us+=bo(Vs/2)}},Ws={point:Ze,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Zs={point:$e,lineStart:Je,lineEnd:tr,polygonStart:function(){Zs.lineStart=er},polygonEnd:function(){Zs.point=$e,Zs.lineStart=Je,Zs.lineEnd=tr}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),uo.geo.stream(t,o)),a.result()}function e(){return o=null,t}var r,n,i,a,o,s=4.5;return t.area=function(t){return Us=0,uo.geo.stream(t,i(Ys)),Us},t.centroid=function(t){return Ls=zs=Cs=Is=Ps=Ds=Os=Rs=Fs=0,uo.geo.stream(t,i(Zs)),Fs?[Os/Fs,Rs/Fs]:Ds?[Is/Ds,Ps/Ds]:Cs?[Ls/Cs,zs/Cs]:[NaN,NaN]},t.bounds=function(t){return Gs=Xs=-(qs=Hs=1/0),uo.geo.stream(t,i(Ws)),[[qs,Hs],[Gs,Xs]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):b,e()):r},t.context=function(t){return arguments.length?(a=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&a.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(a.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var r=new ar(e);for(var n in t)r[n]=t[n];return r}}},ar.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()}},uo.geo.projection=sr,uo.geo.projectionMutator=lr,(uo.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*qo,e[1]*qo),e[0]*=Ho,e[1]*=Ho,e}return t=fr(t[0]%360*qo,t[1]*qo,t.length>2?t[2]*qo:0),e.invert=function(e){return e=t.invert(e[0]*qo,e[1]*qo),e[0]*=Ho,e[1]*=Ho,e},e},hr.invert=cr,uo.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=fr(-t[0]*qo,-t[1]*qo,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=Ho,t[1]*=Ho}}),{type:"Polygon",coordinates:[i]}}var e,r,n=[0,0],i=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=mr((e=+n)*qo,i*qo),t):e},t.precision=function(n){return arguments.length?(r=mr(e*qo,(i=+n)*qo),t):i},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*qo,i=t[1]*qo,a=e[1]*qo,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),h=Math.cos(a);return Math.atan2(Math.sqrt((r=h*o)*r+(r=u*c-l*h*s)*r),l*c+u*h*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/m)*m,i,m).map(f).concat(uo.range(Math.ceil(u/v)*v,l,v).map(d)).concat(uo.range(Math.ceil(n/p)*p,r,p).filter(function(t){return bo(t%m)>Fo}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return bo(t%v)>Fo}).map(h))}var r,n,i,a,o,s,l,u,c,h,f,d,p=10,g=p,m=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(l).slice(1),f(i).reverse().slice(1),d(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(a=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],a>i&&(e=a,a=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[a,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(m=+e[0],v=+e[1],t):[m,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,o,90),h=xr(n,r,y),f=yr(u,l,90),d=xr(a,i,y),t):y},t.majorExtent([[-180,-90+Fo],[180,90-Fo]]).minorExtent([[-180,-80-Fo],[180,80+Fo]])},uo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}var e,r,n=br,i=_r;return t.distance=function(){return uo.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(i=e,r="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},uo.geo.interpolate=function(t,e){return wr(t[0]*qo,t[1]*qo,e[0]*qo,e[1]*qo)},uo.geo.length=function(t){return Qs=0,uo.geo.stream(t,Ks),Qs};var Qs,Ks={sphere:M,point:M,lineStart:Mr,lineEnd:M,polygonStart:M,polygonEnd:M},$s=Ar(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr($s)}).raw=$s;var Js=Ar(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(uo.geo.azimuthalEquidistant=function(){return sr(Js)}).raw=Js,(uo.geo.conicConformal=function(){return Xe(kr)}).raw=kr,(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var tl=Ar(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(tl)}).raw=tl,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return Sr(Er)}).raw=Er;var el=Ar(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr(el)}).raw=el;var rl=Ar(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(rl)}).raw=rl,Lr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Vo]},(uo.geo.transverseMercator=function(){var t=Sr(Lr),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=Lr,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=St(r),a=St(n),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+h;e=n&&u.x<=a&&u.y>=i&&u.y<=o?[[n,o],[a,o],[a,i],[n,i]]:[];c.point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/Fo)*Fo,y:Math.round(o(t,e)/Fo)*Fo,i:e}})}var n=zr,i=Cr,a=n,o=i,s=hl;return t?e(t):(e.links=function(t){return un(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return un(r(t)).cells.forEach(function(r,n){for(var i,a,o=r.site,s=r.edges.sort(Xr),l=-1,u=s.length,c=s[u-1].edge,h=c.l===o?c.r:c.l;++l=u,f=n>=c,d=f<<1|h;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),h?i=u:s=u,f?o=c:l=c,a(t,e,r,n,i,o,s,l)}var c,h,f,d,p,g,m,v,y,x=St(s),b=St(l);if(null!=e)g=e,m=r,v=n,y=i;else if(v=y=-(g=m=1/0),h=[],f=[],p=t.length,o)for(d=0;dv&&(v=c.x),c.y>y&&(y=c.y),h.push(c.x),f.push(c.y);else for(d=0;dv&&(v=_),w>y&&(y=w),h.push(_),f.push(w)}var M=v-g,A=y-m;M>A?y=m+M:v=g+A;var k=pn();if(k.add=function(t){a(k,t,+x(t,++d),+b(t,d),g,m,v,y)},k.visit=function(t){gn(t,k,g,m,v,y)},k.find=function(t){return mn(k,t[0],t[1],g,m,v,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=gl.get(r)||pl,n=ml.get(n)||b,Mn(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=Rn,uo.interpolateHsl=Fn,uo.interpolateLab=jn,uo.interpolateRound=Nn,uo.transform=function(t){var e=fo.createElementNS(uo.ns.prefix.svg,"g");return(uo.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Bn(r?r.matrix:vl)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var vl={a:1,b:0,c:0,d:1,e:0,f:0};uo.interpolateTransform=Zn,uo.layout={},uo.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r0?i=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),r=Pt(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;l=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;n&&(a.value=0),a.children=u}else n&&(a.value=+n.call(t,a,a.depth)||0),delete a.children;return li(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=hi,r=ui,n=ci;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0),(r=e.parent)&&(r.value+=e.value)})),e},t},uo.layout.partition=function(){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,u=-1;for(n=e.value?n/e.value:0;++us&&(s=n),o.push(n)}for(r=0;r0)for(a=-1;++a=c[0]&&s<=c[1]&&(o=l[uo.bisect(h,s,1,d)-1],o.y+=p,o.push(t[a]));return l}var e=!0,r=Number,n=Mi,i=_i;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=St(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:St(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},uo.layout.pack=function(){function t(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,Si),n){var h=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=h}),li(s,Si),li(s,function(t){t.r-=h})}return Ci(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),o}var e,r=uo.layout.hierarchy().sort(Ai),n=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},oi(t,r)},uo.layout.tree=function(){function t(t,i){var c=o.call(this,t,i),h=c[0],f=e(h);if(li(f,r),f.parent.m=-f.z,si(f,n),u)si(h,a);else{var d=h,p=h,g=h;si(h,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var m=s(d,p)/2-d.x,v=l[0]/(p.x+s(p,d)/2+m),y=l[1]/(g.depth||1);si(h,function(t){t.x=(t.x+m)*v,t.y=t.depth*y})}return c}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var i,a=e.children,o=0,s=a.length;o0&&(Ri(ji(o,t,r),t,n),u+=n,c+=n),h+=o.m,u+=i.m,f+=l.m,c+=a.m;o&&!Oi(a)&&(a.t=o,a.m+=h-c),i&&!Di(l)&&(l.t=i,l.m+=u-f,r=t)}return r}function a(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Pi,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?a:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:a,t):u?l:null},oi(t,o)},uo.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=Bi(e),t.y=Ni(e)):(t.x=o?u+=r(t,o):0,t.y=0,o=t)});var c=Ui(l),h=Vi(l),f=c.x-r(c,h)/2,d=h.x+r(h,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*n[0],t.y=(l.y-t.y)*n[1]}:function(t){t.x=(t.x-f)/(d-f)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=uo.layout.hierarchy().sort(null).value(null),r=Pi,n=[1,1],i=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(i=null==(n=e),t):i?null:n},t.nodeSize=function(e){return arguments.length?(i=null!=(n=e),t):i?n:null},oi(t,e)},uo.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,a=t.length;++i0;)c.push(o=f[l-1]),c.area+=o.area,"squarify"!==d||(s=n(c,g))<=p?(f.pop(),p=s):(c.area-=c.pop().area,i(c,g,u,!1),g=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,g,u,!0),c.length=c.area=0),a.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var a,o=h(e),s=n.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(i(l,a.z?o.dx:o.dy,o,!s.length),l.length=l.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=r));return n*=n,e*=e,n?Math.max(e*i*p/n,n/(e*a*p)):1/0}function i(t,e,r,n){var i,a=-1,o=t.length,s=r.x,u=r.y,c=e?l(t.area/e):0;if(e==r.dx){for((n||c>r.dy)&&(c=r.dy);++ar.dx)&&(c=r.dx);++a1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=uo.random.normal.apply(uo,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=uo.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;rh?0:1;if(u=Uo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,m,v,y,x,b,_,w,M,A,k,T=0,E=0,S=[];if((v=(+l.apply(this,arguments)||0)/2)&&(m=a===Il?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(E*=-1),u&&(E=nt(m/u*Math.sin(v))),t&&(T=nt(m/t*Math.sin(v)))),u){y=u*Math.cos(c+E),x=u*Math.sin(c+E),b=u*Math.cos(h-E),_=u*Math.sin(h-E);var L=Math.abs(h-c-2*E)<=No?0:1;if(E&&xa(y,x,b,_)===d^L){var z=(c+h)/2;y=u*Math.cos(z),x=u*Math.sin(z),b=_=null}}else y=x=0;if(t){w=t*Math.cos(h-T),M=t*Math.sin(h-T),A=t*Math.cos(c+T),k=t*Math.sin(c+T);var C=Math.abs(c-h+2*T)<=No?0:1;if(T&&xa(w,M,A,k)===1-d^C){var I=(c+h)/2;w=t*Math.cos(I),M=t*Math.sin(I),A=k=null}}else w=M=0;if(f>Fo&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){g=tNo)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var a=br,o=_r,s=Ha,l=ma,u=va;return t.radius=function(e){return arguments.length?(s=St(e),t):s},t.source=function(e){return arguments.length?(a=St(e),t):a},t.target=function(e){return arguments.length?(o=St(e),t):o},t.startAngle=function(e){return arguments.length?(l=St(e),t):l},t.endAngle=function(e){return arguments.length?(u=St(e),t):u},t},uo.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=r.call(this,t,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return l=l.map(n),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=br,r=_r,n=Ga;return t.source=function(r){return arguments.length?(e=St(r),t):e},t.target=function(e){return arguments.length?(r=St(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},uo.svg.diagonal.radial=function(){var t=uo.svg.diagonal(),e=Ga,r=t.projection;return t.projection=function(t){return arguments.length?r(Xa(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(Fl.get(e.call(this,t,n))||Za)(r.call(this,t,n))}var e=Wa,r=Ya;return t.type=function(r){return arguments.length?(e=St(r),t):e},t.size=function(e){return arguments.length?(r=St(e),t):r},t};var Fl=uo.map({circle:Za,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*Nl)),r=e*Nl;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/jl),r=e*jl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/jl),r=e*jl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=Fl.keys();var jl=Math.sqrt(3),Nl=Math.tan(30*qo);Lo.transition=function(t){for(var e,r,n=Bl||++Hl,i=to(t),a=[],o=Ul||{time:Date.now(),ease:Sn,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",h[1]-h[0])}function i(t){t.select(".extent").attr("y",f[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function a(){function a(){32==uo.event.keyCode&&(L||(x=null,C[0]-=h[1],C[1]-=f[1],L=2),T())}function g(){32==uo.event.keyCode&&2==L&&(C[0]+=h[1],C[1]+=f[1],L=0,T())}function m(){var t=uo.mouse(_),n=!1;b&&(t[0]+=b[0],t[1]+=b[1]),L||(uo.event.altKey?(x||(x=[(h[0]+h[1])/2,(f[0]+f[1])/2]),C[0]=h[+(t[0]=2)return!1;t[r]=n}return!0}):w.filter(function(t){for(var e=0;e<=o;++e){var r=y[t[e]];if(r<0)return!1;t[e]=r}return!0}),1&o)for(var h=0;h>>31},e.exports.exponent=function(t){var r=e.exports.hi(t);return(r<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){var r=e.exports.hi(t);return!(2146435072&r)}}).call(this,t("buffer").Buffer)},{buffer:64}],98:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(i<=0)return[];var a,o=new Array(i);if(r===t.length-1)for(a=0;a0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=a},{}],99:[function(t,e,r){"use strict";function n(t,e,r){r=r||2;var n=e&&e.length,a=n?e[0]*r:t.length,s=i(t,0,a,r,!0),l=[];if(!s)return l;var u,c,f,d,p,g,m;if(n&&(s=h(t,e,s,r)),t.length>80*r){u=f=t[0],c=d=t[1];for(var v=r;vf&&(f=p),g>d&&(d=g);m=Math.max(f-u,d-c)}return o(s,l,r,u,c,m),l}function i(t,e,r,n,i){var a,o;if(i===C(t,e,r,n)>0)for(a=e;a=e;a-=n)o=S(a,t[a],t[a+1],o);return o&&w(o,o.next)&&(L(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||!w(n,n.next)&&0!==_(n.prev,n,n.next))n=n.next;else{if(L(n),n=e=n.prev,n===n.next)return null;r=!0}while(r||n!==e);return e}function o(t,e,r,n,i,h,f){if(t){!f&&h&&g(t,n,i,h);for(var d,p,m=t;t.prev!==t.next;)if(d=t.prev,p=t.next,h?l(t,n,i,h):s(t))e.push(d.i/r),e.push(t.i/r),e.push(p.i/r),L(t),t=p.next,m=p.next;else if(t=p,t===m){f?1===f?(t=u(t,e,r),o(t,e,r,n,i,h,2)):2===f&&c(t,e,r,n,i,h):o(a(t),e,r,n,i,h,1);break}}}function s(t){var e=t.prev,r=t,n=t.next;if(_(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(x(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&_(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(_(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,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=v(s,l,e,r,n),f=v(u,c,e,r,n),d=t.nextZ;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&x(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&_(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=h;){if(d!==t.prev&&d!==t.next&&x(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&_(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function u(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!w(i,a)&&M(i,n,n.next,a)&&k(i,a)&&k(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),L(n),L(n.next),n=t=a),n=n.next}while(n!==t);return n}function c(t,e,r,n,i,s){var l=t;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&b(l,u)){var c=E(l,u);return l=a(l,l.next),c=a(c,c.next),o(l,e,r,n,i,s),void o(c,e,r,n,i,s)}u=u.next}l=l.next}while(l!==t)}function h(t,e,r,n){var o,s,l,u,c,h=[];for(o=0,s=e.length;o=n.next.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>=c&&x(ar.x)&&k(n,t)&&(r=n,f=l)),n=n.next;return r}function g(t,e,r,n){var i=t;do null===i.z&&(i.z=v(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,m(i)}function m(t){var e,r,n,i,a,o,s,l,u=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?(i=n,n=n.nextZ,l--):0!==l&&n?r.z<=n.z?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--):(i=r,r=r.nextZ,s--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,u*=2}while(o>1);return t}function v(t,e,r,n,i){return t=32767*(t-r)/i,e=32767*(e-n)/i,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function y(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 b(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!A(t,e)&&k(t,e)&&k(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 M(t,e,r,n){return!!(w(t,e)&&w(r,n)||w(t,n)&&w(r,e))||_(t,e,r)>0!=_(t,e,n)>0&&_(r,n,t)>0!=_(r,n,e)>0}function A(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&&M(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function k(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=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do r.y>a!=r.next.y>a&&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}function E(t,e){var r=new z(t.i,t.x,t.y),n=new z(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 S(t,e,r,n){var i=new z(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 L(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 z(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 C(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}},{}],100:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;n0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],a=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(s=a;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(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],103:[function(t,e,r){"use strict";function n(t,e,r){var n=e||0,i=r||1;return[[t[12]+t[0],t[13]+t[1],t[14]+t[2],t[15]+t[3]],[t[12]-t[0],t[13]-t[1],t[14]-t[2],t[15]-t[3]],[t[12]+t[4],t[13]+t[5],t[14]+t[6],t[15]+t[7]],[t[12]-t[4],t[13]-t[5],t[14]-t[6],t[15]-t[7]],[n*t[12]+t[8],n*t[13]+t[9],n*t[14]+t[10],n*t[15]+t[11]],[i*t[12]-t[8],i*t[13]-t[9],i*t[14]-t[10],i*t[15]-t[11]]]}e.exports=n},{}],104:[function(t,e,r){"use strict";function n(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}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],105:[function(t,e,r){"use strict";function n(t){return new Function("f","var p = (f && f.properties || {}); return "+i(t))}function i(t){if(!t)return"true";var e=t[0];if(t.length<=1)return"any"===e?"false":"true";var r="=="===e?o(t[1],t[2],"===",!1):"!="===e?o(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?o(t[1],t[2],e,!0):"any"===e?s(t.slice(1),"||"):"all"===e?s(t.slice(1),"&&"):"none"===e?c(s(t.slice(1),"||")):"in"===e?l(t[1],t.slice(2)):"!in"===e?c(l(t[1],t.slice(2))):"has"===e?u(t[1]):"!has"===e?c(u([t[1]])):"true";return"("+r+")"}function a(t){return"$type"===t?"f.type":"$id"===t?"f.id":"p["+JSON.stringify(t)+"]"}function o(t,e,r,n){var i=a(t),o="$type"===t?f.indexOf(e):JSON.stringify(e);return(n?"typeof "+i+"=== typeof "+o+"&&":"")+i+r+o}function s(t,e){return t.map(i).join(e)}function l(t,e){"$type"===t&&(e=e.map(function(t){return f.indexOf(t)}));var r=JSON.stringify(e.sort(h)),n=a(t);return e.length<=200?r+".indexOf("+n+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1; if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+n+", "+r+",0,"+(e.length-1)+")"}function u(t){return JSON.stringify(t)+" in p"}function c(t){return"!("+t+")"}function h(t,e){return te?1:0}e.exports=n;var f=["Unknown","Point","LineString","Polygon"]},{}],106:[function(t,e,r){"use strict";function n(t,e,r){return Math.min(e,Math.max(t,r))}function i(t,e,r){this.dimension=t.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n=r-1)for(var f=o.length-1,p=t-e[r-1],d=0;d=r-1)for(var c=a.length-1,h=(t-e[r-1],0);h=0;--r)if(t[--e])return!1;return!0},u.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t0;--h)i.push(n(l[h-1],u[h-1],arguments[h])),a.push(0)}},u.push=function(t){var e=this.lastT(),r=this.dimension;if(!(t1e-6?1/s:0;this._time.push(t);for(var f=r;f>0;--f){var d=n(u[f-1],c[f-1],arguments[f]);i.push(d),a.push((d-i[o++])*h)}}},u.set=function(t){var e=this.dimension;if(!(t0;--l)r.push(n(o[l-1],s[l-1],arguments[l])),i.push(0)}},u.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var i=this._state,a=this._velocity,o=i.length-this.dimension,s=this.bounds,l=s[0],u=s[1],c=t-e,h=c>1e-6?1/c:0;this._time.push(t);for(var f=r;f>0;--f){var d=arguments[f];i.push(n(l[f-1],u[f-1],i[o++]+d)),a.push(d*h)}}},u.idle=function(t){var e=this.lastT();if(!(t=0;--h)i.push(n(l[h],u[h],i[o]+c*a[o])),a.push(0),o+=1}}},{"binary-search-bounds":53,"cubic-hermite":90}],107:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){ +this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=a}function i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function a(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}function l(t,e){if(e.left){var r=l(t,e.left);if(r)return r}var r=t(e.key,e.value);return r?r:e.right?l(t,e.right):void 0}function u(t,e,r,n){var i=e(t,n.key);if(i<=0){if(n.left){var a=u(t,e,r,n.left);if(a)return a}var a=r(n.key,n.value);if(a)return a}if(n.right)return u(t,e,r,n.right)}function c(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=c(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return c(t,e,r,n,i.right)}function h(t,e){this.tree=t,this._stack=e}function f(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t._color=e._color,t._count=e._count}function d(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=v);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===m){if(n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=v,r._color=v,s._color=v,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}return void(t[l-1]=n)}if(n.left&&n.left._color===m){if(n=r.right=i(n),s=n.left=i(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=v,n._color=v,e._color=v,o(r),o(n),o(s),l>1){var u=t[l-2];u.left===r?u.left=s:u.right=s}return void(t[l-1]=s)}if(n._color===v){if(r._color===m)return r._color=v,void(r.right=a(m,n));r.right=a(m,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=m,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}t[l-1]=n,t[l]=r,l+11){var u=t[l-2];u.right===r?u.right=n:u.left=n}return void(t[l-1]=n)}if(n.right&&n.right._color===m){if(n=r.left=i(n),s=n.right=i(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=v,n._color=v,e._color=v,o(r),o(n),o(s),l>1){var u=t[l-2];u.right===r?u.right=s:u.left=s}return void(t[l-1]=s)}if(n._color===v){if(r._color===m)return r._color=v,void(r.left=a(m,n));r.left=a(m,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=m,o(r),o(n),l>1){var u=t[l-2];u.right===r?u.right=n:u.left=n}t[l-1]=n,t[l]=r,l+1e?1:0}function g(t){return new s(t||p,null)}e.exports=g;var m=0,v=1,y=s.prototype;Object.defineProperty(y,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(y,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(y,"length",{get:function(){return this.root?this.root._count:0}}),y.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],u=[];i;){var c=r(t,i.key);l.push(i),u.push(c),i=c<=0?i.left:i.right}l.push(new n(m,t,e,null,null,1));for(var h=l.length-2;h>=0;--h){var i=l[h];u[h]<=0?l[h]=new n(i._color,i.key,i.value,l[h+1],i.right,i._count+1):l[h]=new n(i._color,i.key,i.value,i.left,l[h+1],i._count+1)}for(var h=l.length-1;h>1;--h){var f=l[h-1],i=l[h];if(f._color===v||i._color===v)break;var d=l[h-2];if(d.left===f)if(f.left===i){var p=d.right;if(!p||p._color!==m){if(d._color=m,d.left=f.right,f._color=v,f.right=d,l[h-2]=f,l[h-1]=i,o(d),o(f),h>=3){var g=l[h-3];g.left===d?g.left=f:g.right=f}break}f._color=v,d.right=a(v,p),d._color=m,h-=1}else{var p=d.right;if(!p||p._color!==m){if(f.right=i.left,d._color=m,d.left=i.right,i._color=v,i.left=f,i.right=d,l[h-2]=i,l[h-1]=f,o(d),o(f),o(i),h>=3){var g=l[h-3];g.left===d?g.left=i:g.right=i}break}f._color=v,d.right=a(v,p),d._color=m,h-=1}else if(f.right===i){var p=d.left;if(!p||p._color!==m){if(d._color=m,d.right=f.left,f._color=v,f.left=d,l[h-2]=f,l[h-1]=i,o(d),o(f),h>=3){var g=l[h-3];g.right===d?g.right=f:g.left=f}break}f._color=v,d.left=a(v,p),d._color=m,h-=1}else{var p=d.left;if(!p||p._color!==m){if(f.left=i.right,d._color=m,d.right=i.left,i._color=v,i.right=f,i.left=d,l[h-2]=i,l[h-1]=f,o(d),o(f),o(i),h>=3){var g=l[h-3];g.right===d?g.right=i:g.left=i}break}f._color=v,d.left=a(v,p),d._color=m,h-=1}}return l[0]._color=v,new s(r,l[0])},y.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return c(e,r,this._compare,t,this.root)}},Object.defineProperty(y,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new h(this,t)}}),Object.defineProperty(y,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new h(this,t)}}),y.at=function(t){if(t<0)return new h(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new h(this,[])},y.ge=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var 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 h(this,n)},y.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 h(this,n)},y.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 h(this,n)},y.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 h(this,n)},y.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var i=e(t,r.key);if(n.push(r),0===i)return new h(this,n);r=i<=0?r.left:r.right}return new h(this,[])},y.remove=function(t){var e=this.find(t);return e?e.remove():this},y.get=function(t){for(var e=this._compare,r=this.root;r;){var n=e(t,r.key);if(0===n)return r.value;r=n<=0?r.left:r.right}};var x=h.prototype;Object.defineProperty(x,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(x,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),x.clone=function(){return new h(this.tree,this._stack.slice())},x.remove=function(){var t=this._stack;if(0===t.length)return this.tree;var e=new Array(t.length),r=t[t.length-1];e[e.length-1]=new n(r._color,r.key,r.value,r.left,r.right,r._count);for(var i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var a=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var o=e[a-1];e.push(new n(r._color,o.key,o.value,r.left,r.right,r._count)),e[a-1].key=r.key,e[a-1].value=r.value;for(var i=e.length-2;i>=a;--i)r=e[i],e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count);e[a-1].left=e[a]}if(r=e[e.length-1],r._color===m){var l=e[e.length-2];l.left===r?l.left=null:l.right===r&&(l.right=null),e.pop();for(var i=0;i0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(x,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(x,"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}),x.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(x,"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}}),x.update=function(t){var e=this._stack;if(0===e.length)throw new Error("Can't update empty node!");var r=new Array(e.length),i=e[e.length-1];r[r.length-1]=new n(i._color,i.key,t,i.left,i.right,i._count);for(var a=e.length-2;a>=0;--a)i=e[a],i.left===e[a+1]?r[a]=new n(i._color,i.key,i.value,r[a+1],i.right,i._count):r[a]=new n(i._color,i.key,i.value,i.left,r[a+1],i._count);return new s(this.tree._compare,r[0])},x.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(x,"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}})},{}],108:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=s[0],r=s.length-1;r>0;--r)e+=s[r]/(t+r);var n=t+o+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=7,a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],o=607/128,s=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];e.exports=function t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(n(e));e-=1;for(var r=a[0],o=1;o0){e+=Math.abs(a(t[0]));for(var r=1;r2){for(var r,n,i=0;i=0}var u=t("geojson-area");e.exports=n},{"geojson-area":109}],111:[function(t,e,r){"use strict";function n(t,e,r,n,o,l,u,c){if(r/=e,n/=e,u>=r&&c<=n)return t;if(u>n||c=r&&p<=n)h.push(g);else if(!(d>n||p=e&&s<=r&&i.push(o)}return i}function a(t,e,r,n,i,a){for(var s=[],l=0;lr?(b.push(i(u,p,e),i(u,p,r)),a||(b=o(s,b,m,v,y))):d>=e&&b.push(i(u,p,e)):f>r?dr&&(b.push(i(u,p,r)),a||(b=o(s,b,m,v,y))));u=g[x-1],f=u[n],f>=e&&f<=r&&b.push(u),h=b[b.length-1],a&&h&&(b[0][0]!==h[0]||b[0][1]!==h[1])&&b.push(b[0]),o(s,b,m,v,y)}return s}function o(t,e,r,n,i){return e.length&&(e.area=r,e.dist=n,void 0!==i&&(e.outer=i),t.push(e)),[]}e.exports=n;var s=t("./feature")},{"./feature":113}],112:[function(t,e,r){"use strict";function n(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n1?1:n,[r,n,0]}function s(t){for(var e,r,n=0,i=0,a=0;a1)return!1;var a=i.geometry[0].length;if(5!==a)return!1;for(var o=0;o1&&console.time("creation"),x=this.tiles[y]=p(t,v,r,n,b,e===d.maxZoom),this.tileCoords.push({z:e,x:r,y:n}),g)){g>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,x.numFeatures,x.numPoints,x.numSimplified),console.timeEnd("creation"));var _="z"+e;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(x.source=t,i){if(e===d.maxZoom||e===i)continue;var w=1<1&&console.time("clipping");var M,A,k,T,E,S,L=.5*d.buffer/d.extent,z=.5-L,C=.5+L,I=1+L;M=A=k=T=null,E=f(t,v,r-L,r+C,0,o,x.min[0],x.max[0]),S=f(t,v,r+z,r+I,0,o,x.min[0],x.max[0]),E&&(M=f(E,v,n-L,n+C,1,s,x.min[1],x.max[1]),A=f(E,v,n+z,n+I,1,s,x.min[1],x.max[1])),S&&(k=f(S,v,n-L,n+C,1,s,x.min[1],x.max[1]),T=f(S,v,n+z,n+I,1,s,x.min[1],x.max[1])),g>1&&console.timeEnd("clipping"),t.length&&(h.push(M||[],e+1,2*r,2*n),h.push(A||[],e+1,2*r,2*n+1),h.push(k||[],e+1,2*r+1,2*n),h.push(T||[],e+1,2*r+1,2*n+1))}else i&&(m=e)}return m},i.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,o=n.debug,s=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var c,f=t,d=e,p=r;!c&&f>0;)f--,d=Math.floor(d/2),p=Math.floor(p/2),c=this.tiles[a(f,d,p)];if(!c||!c.source)return null;if(o>1&&console.log("found parent tile z%d-%d-%d",f,d,p),u(c,i,n.buffer))return h.tile(c,i);o>1&&console.time("drilling down");var g=this.splitTile(c.source,f,d,p,t,e,r);if(o>1&&console.timeEnd("drilling down"),null!==g){var m=1<n&&(o=r,n=a);n>s?(t[o][2]=n,h.push(u),h.push(o),u=o):(c=h.pop(),u=h.pop())}}function i(t,e,r){var n=e[0],i=e[1],a=r[0],o=r[1],s=t[0],l=t[1],u=a-n,c=o-i;if(0!==u||0!==c){var h=((s-n)*u+(l-i)*c)/(u*u+c*c);h>1?(n=a,i=o):h>0&&(n+=u*h,i+=c*h)}return u=s-n,c=l-i,u*u+c*c}e.exports=n},{}],116:[function(t,e,r){"use strict";function n(t,e,r,n,a,o){for(var s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z2:e,transformed:!1,min:[2,1],max:[-1,0]},l=0;ls.max[0]&&(s.max[0]=c[0]),c[1]>s.max[1]&&(s.max[1]=c[1])}return s}function i(t,e,r,n){var i,o,s,l,u=e.geometry,c=e.type,h=[],f=r*r;if(1===c)for(i=0;if)&&(d.push(l),t.numSimplified++),t.numPoints++;3===c&&a(d,s.outer),h.push(d)}else t.numPoints+=s.length;if(h.length){var p={geometry:h,type:c,tags:e.tags||null};null!==e.id&&(p.id=e.id),t.features.push(p)}}function a(t,e){var r=o(t);r<0===e&&t.reverse()}function o(t){for(var e,r,n=0,i=0,a=t.length,o=a-1;i0?(d[c]=-1,p[c]=0):(d[c]=0,p[c]=1)}}function s(t,e){var r=new i(t);return r.update(e),r}e.exports=s;var l=t("./lib/text.js"),u=t("./lib/lines.js"),c=t("./lib/background.js"),h=t("./lib/cube.js"),f=t("./lib/ticks.js"),d=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),p=i.prototype;p.update=function(t){function e(e,r,n){if(n in t){var i,a=t[n],o=this[n];(e?Array.isArray(a)&&Array.isArray(a[0]):Array.isArray(a))?this[n]=i=[r(a[0]),r(a[1]),r(a[2])]:this[n]=i=[r(a),r(a),r(a)];for(var s=0;s<3;++s)if(i[s]!==o[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),a=e.bind(this,!1,String),o=e.bind(this,!0,function(t){if(Array.isArray(t)){if(3===t.length)return[+t[0],+t[1],+t[2],1];if(4===t.length)return[+t[0],+t[1],+t[2],+t[3]]}return[0,0,0,1]}),s=!1,c=!1;if("bounds"in t)for(var h=t.bounds,d=0;d<2;++d)for(var p=0;p<3;++p)h[d][p]!==this.bounds[d][p]&&(c=!0),this.bounds[d][p]=h[d][p];if("ticks"in t){r=t.ticks,s=!0,this.autoTicks=!1;for(var d=0;d<3;++d)this.tickSpacing[d]=0}else n("tickSpacing")&&(this.autoTicks=!0,c=!0);if(this._firstInit&&("ticks"in t||"tickSpacing"in t||(this.autoTicks=!0),c=!0,s=!0,this._firstInit=!1),c&&this.autoTicks&&(r=f.create(this.bounds,this.tickSpacing),s=!0),s){for(var d=0;d<3;++d)r[d].sort(function(t,e){return t.x-e.x});f.equal(r,this.ticks)?s=!1:this.ticks=r}i("tickEnable"),a("tickFont")&&(s=!0),n("tickSize"),n("tickAngle"),n("tickPad"),o("tickColor");var g=a("labels");a("labelFont")&&(g=!0),i("labelEnable"),n("labelSize"),n("labelPad"),o("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),o("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),o("lineTickColor"),i("gridEnable"),n("gridWidth"),o("gridColor"),i("zeroEnable"),o("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),o("backgroundColor"),this._text?this._text&&(g||s)&&this._text.update(this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont):this._text=l(this.gl,this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont),this._lines&&s&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=u(this.gl,this.bounds,this.ticks))};var g=[new a,new a,new a],m=[0,0,0],v={model:d,view:d,projection:d};p.isOpaque=function(){return!0},p.isTransparent=function(){return!1},p.drawTransparent=function(t){};var y=[0,0,0],x=[0,0,0],b=[0,0,0];p.draw=function(t){t=t||v;for(var e=this.gl,r=t.model||d,i=t.view||d,a=t.projection||d,s=this.bounds,l=h(r,i,a,s),u=l.cubeEdges,c=l.axis,f=i[12],p=i[13],_=i[14],w=i[15],M=this.pixelRatio*(a[3]*f+a[7]*p+a[11]*_+a[15]*w)/e.drawingBufferHeight,A=0;A<3;++A)this.lastCubeProps.cubeEdges[A]=u[A],this.lastCubeProps.axis[A]=c[A];for(var k=g,A=0;A<3;++A)o(g[A],A,this.bounds,u,c);for(var e=this.gl,T=m,A=0;A<3;++A)this.backgroundEnable[A]?T[A]=c[A]:T[A]=0;this._background.draw(r,i,a,s,T,this.backgroundColor),this._lines.bind(r,i,a,this);for(var A=0;A<3;++A){var E=[0,0,0];c[A]>0?E[A]=s[1][A]:E[A]=s[0][A];for(var S=0;S<2;++S){var L=(A+1+S)%3,z=(A+1+(1^S))%3;this.gridEnable[L]&&this._lines.drawGrid(L,z,this.bounds,E,this.gridColor[L],this.gridWidth[L]*this.pixelRatio)}for(var S=0;S<2;++S){var L=(A+1+S)%3,z=(A+1+(1^S))%3;this.zeroEnable[z]&&s[0][z]<=0&&s[1][z]>=0&&this._lines.drawZero(L,z,this.bounds,E,this.zeroLineColor[z],this.zeroLineWidth[z]*this.pixelRatio)}}for(var A=0;A<3;++A){this.lineEnable[A]&&this._lines.drawAxisLine(A,this.bounds,k[A].primalOffset,this.lineColor[A],this.lineWidth[A]*this.pixelRatio),this.lineMirror[A]&&this._lines.drawAxisLine(A,this.bounds,k[A].mirrorOffset,this.lineColor[A],this.lineWidth[A]*this.pixelRatio);for(var C=n(y,k[A].primalMinor),I=n(x,k[A].mirrorMinor),P=this.lineTickLength,S=0;S<3;++S){var D=M/r[5*S];C[S]*=P[S]*D,I[S]*=P[S]*D}this.lineTickEnable[A]&&this._lines.drawAxisTicks(A,k[A].primalOffset,C,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio),this.lineTickMirror[A]&&this._lines.drawAxisTicks(A,k[A].mirrorOffset,I,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio)}this._text.bind(r,i,a,this.pixelRatio);for(var A=0;A<3;++A){for(var O=k[A].primalMinor,R=n(b,k[A].primalOffset),S=0;S<3;++S)this.lineTickEnable[A]&&(R[S]+=M*O[S]*Math.max(this.lineTickLength[S],0)/r[5*S]);if(this.tickEnable[A]){for(var S=0;S<3;++S)R[S]+=M*O[S]*this.tickPad[S]/r[5*S];this._text.drawTicks(A,this.tickSize[A],this.tickAngle[A],R,this.tickColor[A])}if(this.labelEnable[A]){for(var S=0;S<3;++S)R[S]+=M*O[S]*this.labelPad[S]/r[5*S];R[A]+=.5*(s[0][A]+s[1][A]),this._text.drawLabel(A,this.labelSize[A],this.labelAngle[A],R,this.labelColor[A])}}},p.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null}},{"./lib/background.js":121,"./lib/cube.js":122,"./lib/lines.js":123,"./lib/text.js":125,"./lib/ticks.js":126}],121:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}function i(t){for(var e=[],r=[],i=0,l=0;l<3;++l)for(var u=(l+1)%3,c=(l+2)%3,h=[0,0,0],f=[0,0,0],d=-1;d<=1;d+=2){r.push(i,i+2,i+1,i+1,i+2,i+3),h[l]=d,f[l]=d;for(var p=-1;p<=1;p+=2){h[u]=p;for(var g=-1;g<=1;g+=2)h[c]=g,e.push(h[0],h[1],h[2],f[0],f[1],f[2]),i+=1}var m=u;u=c,c=m}var v=a(t,new Float32Array(e)),y=a(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),x=o(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=s(t);return b.attributes.position.location=0,b.attributes.normal.location=1,new n(t,v,x,b)}e.exports=i;var a=t("gl-buffer"),o=t("gl-vao"),s=t("./shaders").bg,l=n.prototype;l.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),l.disable(l.POLYGON_OFFSET_FILL)}},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":124,"gl-buffer":128,"gl-vao":236}],122:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;n<4;++n){t[n]=r[12+n];for(var i=0;i<3;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;eE&&(_|=1<E&&(_|=1<f[g][1]&&(O=g));for(var R=-1,g=0;g<3;++g){var F=O^1<f[j][0]&&(j=F)}}var N=m;N[0]=N[1]=N[2]=0,N[o.log2(R^O)]=O&R,N[o.log2(O^j)]=O&j;var B=7^j;B===_||B===D?(B=7^R,N[o.log2(j^B)]=B&j):N[o.log2(R^B)]=B&R;for(var U=v,V=_,A=0;A<3;++A)V&1<=0;--g){var m=u[p[g]];s.push(l*m[0],-l*m[1],t)}}for(var s=(this.gl,[]),l=[0,0,0],u=[0,0,0],c=[0,0,0],d=[0,0,0],p=0;p<3;++p){c[p]=s.length/f|0,o(.5*(t[0][p]+t[1][p]),e[p],r),d[p]=(s.length/f|0)-c[p],l[p]=s.length/f|0;for(var g=0;g=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,u=o%a;o<0?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u|=0);var c=""+l;if(o<0&&(c="-"+c),i){for(var h=""+u;h.length=t[0][i];--o)a.push({x:o*e[i],text:n(e[i],o)});r.push(a)}return r}function a(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 a(t,e){for(var r=l.malloc(t.length,e),n=t.length,i=0;i=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,i){if(r=r||t.ARRAY_BUFFER,i=i||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var a=t.createBuffer(),o=new n(t,r,a,0,i);return o.update(e),o}var l=t("typedarray-pool"),u=t("ndarray-ops"),c=t("ndarray"),h=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],f=n.prototype;f.bind=function(){this.gl.bindBuffer(this.type,this.handle)},f.unbind=function(){this.gl.bindBuffer(this.type,null)},f.dispose=function(){this.gl.deleteBuffer(this.handle)},f.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&"undefined"!=typeof t.shape){var r=t.dtype;if(h.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var n=gl.getExtension("OES_element_index_uint");r=n&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&o(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=l.malloc(t.size,r),f=c(s,t.shape);u.assign(f,t),e<0?this.length=i(this.gl,this.type,this.length,this.usage,s,e):this.length=i(this.gl,this.type,this.length,this.usage,s.subarray(0,t.size),e),l.free(s)}}else if(Array.isArray(t)){var d;d=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),e<0?this.length=i(this.gl,this.type,this.length,this.usage,d,e):this.length=i(this.gl,this.type,this.length,this.usage,d.subarray(0,t.length),e),l.free(d)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");t|=0,t<=0&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:427,"ndarray-ops":421,"typedarray-pool":496}],129:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],130:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":129}],131:[function(t,e,r){"use strict";function n(t,e,r,n){this.plot=t,this.shader=e,this.bufferHi=r,this.bufferLo=n,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.color=[0,0,0,1]}function i(t,e){var r=a(t.gl,l.vertex,l.fragment),i=o(t.gl),s=o(t.gl),u=new n(t,r,i,s);return u.update(e),t.addObject(u),u}var a=t("gl-shader"),o=t("gl-buffer"),s=t("typedarray-pool"),l=t("./lib/shaders");e.exports=i;var u=[[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]],c=n.prototype;c.draw=function(){var t=new Float32Array([0,0]),e=new Float32Array([0,0]),r=new Float32Array([0,0]),n=new Float32Array([0,0]),i=[1,1];return function(){var a=this.plot,o=this.shader,s=this.bounds,l=this.numPoints;if(l){var c=a.gl,h=a.dataBox,f=a.viewBox,d=a.pixelRatio,p=s[2]-s[0],g=s[3]-s[1],m=h[2]-h[0],v=h[3]-h[1],y=2*p/m,x=2*g/v,b=(s[0]-h[0]-.5*m)/p,_=(s[1]-h[1]-.5*v)/g;t[0]=y,t[1]=x,e[0]=y-t[0],e[1]=x-t[1],r[0]=b,r[1]=_,n[0]=b-r[0],n[1]=_-r[1];var w=f[2]-f[0],M=f[3]-f[1];i[0]=2*d/w,i[1]=2*d/M,o.bind(),o.uniforms.scaleHi=t,o.uniforms.scaleLo=e,o.uniforms.translateHi=r,o.uniforms.translateLo=n,o.uniforms.pixelScale=i,o.uniforms.color=this.color,this.bufferLo.bind(),o.attributes.positionLo.pointer(c.FLOAT,!1,16,0),this.bufferHi.bind(),o.attributes.positionHi.pointer(c.FLOAT,!1,16,0),o.attributes.pixelOffset.pointer(c.FLOAT,!1,16,8),c.drawArrays(c.TRIANGLES,0,l*u.length)}}}(),c.drawPick=function(t){return t},c.pick=function(){return null},c.update=function(t){t=t||{};var e,r,n,i=t.positions||[],a=t.errors||[],o=1;"lineWidth"in t&&(o=+t.lineWidth);var l=5;"capSize"in t&&(l=+t.capSize),this.color=(t.color||[0,0,0,1]).slice();var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],h=this.numPoints=i.length>>1;for(e=0;e0&&(T*=_),E<0?E*=w:E>0&&(E*=M),m[x++]=f*(r-p+T),m[x++]=d*(n-g+E),m[x++]=o*k[2]+(l+o)*k[4],m[x++]=o*k[3]+(l+o)*k[5]}}for(e=0;e=1},h.isTransparent=function(){return this.opacity<1},h.drawTransparent=h.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||c,i=r.projection=t.projection||c;r.model=t.model||c,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var a=n[12],o=n[13],s=n[14],l=n[15],u=this.pixelRatio*(i[3]*a+i[7]*o+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var h=0;h<3;++h)e.lineWidth(this.lineWidth[h]),r.capSize=this.capSize[h]*u,e.drawArrays(e.LINES,this.lineOffset[h],this.lineCount[h]);this.vao.unbind()};var f=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=(n+e)%3,o=[0,0,0];o[a]=i,r.push(o)}t[e]=r}return t}();h.update=function(t){t=t||{},"lineWidth"in t&&(this.lineWidth=t.lineWidth,Array.isArray(this.lineWidth)||(this.lineWidth=[this.lineWidth,this.lineWidth,this.lineWidth])),"capSize"in t&&(this.capSize=t.capSize,Array.isArray(this.capSize)||(this.capSize=[this.capSize,this.capSize,this.capSize])),"opacity"in t&&(this.opacity=t.opacity);var e=t.color||[[0,0,0],[0,0,0],[0,0,0]],r=t.position,n=t.error;if(Array.isArray(e[0])||(e=[e,e,e]),r&&n){var o=[],s=r.length,l=0;this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.lineCount=[0,0,0];for(var u=0;u<3;++u){this.lineOffset[u]=l;t:for(var c=0;c0){var g=h.slice();g[u]+=d[1][u],o.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,g[0],g[1],g[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,g),l+=2+a(o,g,p,u)}}}this.lineCount[u]=l-this.lineOffset[u]}this.buffer.update(o)}},h.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":134,"gl-buffer":128,"gl-vao":236}],134:[function(t,e,r){"use strict";var n=t("gl-shader"),i="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}",a="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 n(t,i,a,null,[{name:"position",type:"vec3"},{name:"offset",type:"vec3"},{name:"color",type:"vec4"}])}},{"gl-shader":220}],135:[function(t,e,r){"use strict";function n(t){var e=t.getParameter(t.FRAMEBUFFER_BINDING),r=t.getParameter(t.RENDERBUFFER_BINDING),n=t.getParameter(t.TEXTURE_BINDING_2D);return[e,r,n]}function i(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function a(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);y=new Array(r+1);for(var n=0;n<=r;++n){for(var i=new Array(r),a=0;a1&&f.drawBuffersWEBGL(y[h]);var v=r.getExtension("WEBGL_depth_texture");v?d?t.depth=s(r,u,c,v.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=s(r,u,c,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=l(r,u,c,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=l(r,u,c,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=l(r,u,c,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var x=r.checkFramebufferStatus(r.FRAMEBUFFER);if(x!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var m=0;ms||r<0||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(a),u=0;uo||r<0||r>o)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),s<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var h=!0;"depth"in n&&(h=!!n.depth);var f=!1;return"stencil"in n&&(f=!!n.stencil),new c(t,e,r,l,s,h,f,i)}var d=t("gl-texture2d");e.exports=f;var p,g,m,v,y=null,x=c.prototype;Object.defineProperties(x,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return h(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t|=0,h(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t|=0,h(this,this._shape[0],t),t},enumerable:!1}}),x.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},x.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e2&&!this.usingDashes){var x=this.mitreShader;this.lineBufferLo.bind(),x.attributes.aLo.pointer(l.FLOAT,!1,48,0),this.lineBufferHi.bind(),x.bind();var b=x.uniforms;this.setProjectionUniforms(b,a),b.color=c,b.radius=s*u,x.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,i/3|0)}}}}(),f.drawPick=function(){var t=[0,0,0,0];return function(e){var r=this.vertCount,n=this.numPoints;if(this.pickOffset=e,!r)return e+n;var i=this.setProjectionModel(),a=this.plot,o=this.width,s=a.gl,l=a.pickPixelRatio,u=this.pickShader,c=this.pickBuffer;t[0]=255&e,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24,u.bind();var h=u.uniforms;this.setProjectionUniforms(h,i),h.width=o*l,h.pickOffset=t;var f=u.attributes;return this.lineBufferHi.bind(),f.aHi.pointer(s.FLOAT,!1,16,0),f.dHi.pointer(s.FLOAT,!1,16,8),this.lineBufferLo.bind(),f.aLo.pointer(s.FLOAT,!1,16,0),c.bind(),f.pick0.pointer(s.UNSIGNED_BYTE,!1,8,0),f.pick1.pointer(s.UNSIGNED_BYTE,!1,8,4),s.drawArrays(s.TRIANGLES,0,r),e+n}}(),f.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(r=n+i)return null;var a=r-n,o=this.data;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}},f.update=function(t){t=t||{};var e,r,n,a,o,s=this.plot.gl;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=i(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var h=t.dashes||[1],f=0;for(e=0;e1,this.dashPattern=l(s,u(d,[f,1,4],[1,0,0])),this.dashPattern.minFilter=s.NEAREST,this.dashPattern.magFilter=s.NEAREST,this.dashLength=f,c.free(d);var g=t.positions;this.data=g;var m=this.bounds;m[0]=m[1]=1/0,m[2]=m[3]=-(1/0);var v=this.numPoints=g.length>>>1;if(0!==v){for(e=0;e1;){var k=--n;a=g[2*n],o=g[2*n+1];var T=k-1,E=g[2*T],S=g[2*T+1];if(!(isNaN(a)||isNaN(o)||isNaN(E)||isNaN(S))){A+=1,a=(a-m[0])/(m[2]-m[0]),o=(o-m[1])/(m[3]-m[1]),E=(E-m[0])/(m[2]-m[0]),S=(S-m[1])/(m[3]-m[1]);var L=E-a,z=S-o,C=k|1<<24,I=k-1,P=k,D=k-1|1<<24;y[--w]=-z,y[--w]=-L,y[--w]=o,y[--w]=a,_[--M]=C,_[--M]=I,y[--w]=z,y[--w]=L,y[--w]=S,y[--w]=E,_[--M]=P,_[--M]=D,y[--w]=-z,y[--w]=-L,y[--w]=S,y[--w]=E,_[--M]=P,_[--M]=D,y[--w]=z,y[--w]=L,y[--w]=S,y[--w]=E,_[--M]=P,_[--M]=D,y[--w]=-z,y[--w]=-L,y[--w]=o,y[--w]=a,_[--M]=C,_[--M]=I,y[--w]=z,y[--w]=L,y[--w]=o,y[--w]=a,_[--M]=C,_[--M]=I}}for(e=0;e=1},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||v,view:t.view||v,projection:t.projection||v,clipBounds:i(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||v,view:t.view||v,projection:t.projection||v,pickId:this.pickId,clipBounds:i(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.update=function(t){var e,r;this.dirty=!0;var i=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var a=t.position||t.positions;if(a){var o=t.color||t.colors||[0,0,0,1],s=t.lineWidth||1,l=[],u=[],c=[],h=0,p=0,g=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],m=!1;t:for(e=1;e0){for(var x=0;x<24;++x)l.push(l[l.length-12]);p+=2,m=!0}continue t}g[0][r]=Math.min(g[0][r],v[r],y[r]),g[1][r]=Math.max(g[1][r],v[r],y[r])}var b,_;Array.isArray(o[0])?(b=o[e-1],_=o[e]):b=_=o,3===b.length&&(b=[b[0],b[1],b[2],1]),3===_.length&&(_=[_[0],_[1],_[2],1]);var w;w=Array.isArray(s)?s[e-1]:s;var M=h;if(h+=n(v,y),m){for(r=0;r<2;++r)l.push(v[0],v[1],v[2],y[0],y[1],y[2],M,w,b[0],b[1],b[2],b[3]);p+=2,m=!1}l.push(v[0],v[1],v[2],y[0],y[1],y[2],M,w,b[0],b[1],b[2],b[3],v[0],v[1],v[2],y[0],y[1],y[2],M,-w,b[0],b[1],b[2],b[3],y[0],y[1],y[2],v[0],v[1],v[2],h,-w,_[0],_[1],_[2],_[3],y[0],y[1],y[2],v[0],v[1],v[2],h,w,_[0],_[1],_[2],_[3]),p+=4}if(this.buffer.update(l),u.push(h),c.push(a[a.length-1].slice()),this.bounds=g,this.vertexCount=p,this.points=c,this.arcLength=u,"dashes"in t){var A=t.dashes,k=A.slice();for(k.unshift(0),e=1;e0?(n=2*Math.sqrt(r+1),t[3]=.25*n,t[0]=(e[6]-e[9])/n,t[1]=(e[8]-e[2])/n,t[2]=(e[1]-e[4])/n):e[0]>e[5]&e[0]>e[10]?(n=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/n,t[0]=.25*n,t[1]=(e[1]+e[4])/n,t[2]=(e[8]+e[2])/n):e[5]>e[10]?(n=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/n,t[0]=(e[1]+e[4])/n,t[1]=.25*n,t[2]=(e[6]+e[9])/n):(n=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/n,t[0]=(e[8]+e[2])/n,t[1]=(e[6]+e[9])/n,t[2]=.25*n),t},i.fromRotationTranslationScale=function(t,e,r,n){var i=e[0],a=e[1],o=e[2],s=e[3],l=i+i,u=a+a,c=o+o,h=i*l,f=i*u,d=i*c,p=a*u,g=a*c,m=o*c,v=s*l,y=s*u,x=s*c,b=n[0],_=n[1],w=n[2];return t[0]=(1-(p+m))*b,t[1]=(f+x)*b,t[2]=(d-y)*b,t[3]=0,t[4]=(f-x)*_,t[5]=(1-(h+m))*_,t[6]=(g+v)*_,t[7]=0,t[8]=(d+y)*w,t[9]=(g-v)*w,t[10]=(1-(h+p))*w,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},i.fromRotationTranslationScaleOrigin=function(t,e,r,n,i){var a=e[0],o=e[1],s=e[2],l=e[3],u=a+a,c=o+o,h=s+s,f=a*u,d=a*c,p=a*h,g=o*c,m=o*h,v=s*h,y=l*u,x=l*c,b=l*h,_=n[0],w=n[1],M=n[2],A=i[0],k=i[1],T=i[2];return t[0]=(1-(g+v))*_,t[1]=(d+b)*_,t[2]=(p-x)*_,t[3]=0,t[4]=(d-b)*w,t[5]=(1-(f+v))*w,t[6]=(m+y)*w,t[7]=0,t[8]=(p+x)*M,t[9]=(m-y)*M,t[10]=(1-(f+g))*M,t[11]=0,t[12]=r[0]+A-(t[0]*A+t[4]*k+t[8]*T),t[13]=r[1]+k-(t[1]*A+t[5]*k+t[9]*T),t[14]=r[2]+T-(t[2]*A+t[6]*k+t[10]*T),t[15]=1,t},i.fromQuat=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r+r,s=n+n,l=i+i,u=r*o,c=n*o,h=n*s,f=i*o,d=i*s,p=i*l,g=a*o,m=a*s,v=a*l;return t[0]=1-h-p,t[1]=c+v,t[2]=f-m,t[3]=0,t[4]=c-v,t[5]=1-u-p,t[6]=d+g,t[7]=0,t[8]=f+m,t[9]=d-g,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.frustum=function(t,e,r,n,i,a,o){var s=1/(r-e),l=1/(i-n),u=1/(a-o);return t[0]=2*a*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*l,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*l,t[10]=(o+a)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*a*2*u,t[15]=0,t},i.perspective=function(t,e,r,n,i){var a=1/Math.tan(e/2),o=1/(n-i);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*o,t[15]=0,t},i.perspectiveFromFieldOfView=function(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(o+s),u=2/(i+a);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((o-s)*l*.5),t[9]=(i-a)*u*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t},i.ortho=function(t,e,r,n,i,a,o){var s=1/(e-r),l=1/(n-i),u=1/(a-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]=(i+n)*l,t[14]=(o+a)*u,t[15]=1,t},i.lookAt=function(t,e,r,a){var o,s,l,u,c,h,f,d,p,g,m=e[0],v=e[1],y=e[2],x=a[0],b=a[1],_=a[2],w=r[0],M=r[1],A=r[2];return Math.abs(m-w).999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(a.cross(t,i,o),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+l,s.normalize(n,n))}}(),s.setAxes=function(){var t=i.create();return function(e,r,n,i){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],s.normalize(e,s.fromMat3(e,t))}}(),s.clone=o.clone,s.fromValues=o.fromValues,s.copy=o.copy,s.set=o.set,s.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.setAxisAngle=function(t,e,r){r*=.5;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t},s.getAxisAngle=function(t,e){var r=2*Math.acos(e[3]),n=Math.sin(r/2);return 0!=n?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r},s.add=o.add,s.multiply=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*c+o*s+i*u-a*l,t[1]=i*c+o*l+a*s-n*u,t[2]=a*c+o*u+n*l-i*s,t[3]=o*c-n*s-i*l-a*u,t},s.mul=s.multiply,s.scale=o.scale,s.rotateX=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+o*s,t[1]=i*l+a*s,t[2]=a*l-i*s,t[3]=o*l-n*s,t},s.rotateY=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l-a*s,t[1]=i*l+o*s,t[2]=a*l+n*s,t[3]=o*l-i*s,t},s.rotateZ=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*s,t[1]=i*l-n*s,t[2]=a*l+o*s,t[3]=o*l-a*s,t},s.calculateW=function(t,e){var r=e[0],n=e[1],i=e[2];return t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),t},s.dot=o.dot,s.lerp=o.lerp,s.slerp=function(t,e,r,n){var i,a,o,s,l,u=e[0],c=e[1],h=e[2],f=e[3],d=r[0],p=r[1],g=r[2],m=r[3];return a=u*d+c*p+h*g+f*m,a<0&&(a=-a,d=-d,p=-p,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),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*h+l*g,t[3]=s*f+l*m,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(r,n,i,a,o,l){return s.slerp(t,n,o,l),s.slerp(e,i,a,l),s.slerp(r,t,e,2*l*(1-l)),r}}(),s.invert=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-i*s,t[3]=a*s,t},s.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},s.length=o.length,s.len=s.length,s.squaredLength=o.squaredLength,s.sqrLen=s.squaredLength,s.normalize=o.normalize,s.fromMat3=function(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*o+o]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*a+o]-e[3*o+a])*r,t[a]=(e[3*a+i]+e[3*i+a])*r,t[o]=(e[3*o+i]+e[3*i+o])*r}return t},s.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},s.exactEquals=o.exactEquals,s.equals=o.equals,e.exports=s},{"./common.js":162,"./mat3.js":165,"./vec3.js":169,"./vec4.js":170}],168:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},i.fromValues=function(t,e){var r=new n.ARRAY_TYPE(2);return r[0]=t,r[1]=e,r},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},i.set=function(t,e,r){return t[0]=e,t[1]=r,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(r*r+n*n)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1];return e*e+r*r},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},i.cross=function(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t},i.lerp=function(t,e,r,n){var i=e[0],a=e[1];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t},i.transformMat2=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t},i.transformMat2d=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=2),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.cross=function(t,e,r){var n=e[0],i=e[1],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},i.lerp=function(t,e,r,n){var i=e[0],a=e[1],o=e[2];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t},i.hermite=function(t,e,r,n,i,a){var o=a*a,s=o*(2*a-3)+1,l=o*(a-2)+a,u=o*(a-1),c=o*(3-2*a);return t[0]=e[0]*s+r[0]*l+n[0]*u+i[0]*c,t[1]=e[1]*s+r[1]*l+n[1]*u+i[1]*c,t[2]=e[2]*s+r[2]*l+n[2]*u+i[2]*c,t},i.bezier=function(t,e,r,n,i,a){var o=1-a,s=o*o,l=a*a,u=s*o,c=3*a*s,h=3*l*o,f=l*a;return t[0]=e[0]*u+r[0]*c+n[0]*h+i[0]*f,t[1]=e[1]*u+r[1]*c+n[1]*h+i[1]*f,t[2]=e[2]*u+r[2]*c+n[2]*h+i[2]*f,t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI,i=2*n.RANDOM()-1,a=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*a,t[1]=Math.sin(r)*a,t[2]=i*e,t},i.transformMat4=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},i.transformMat3=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},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*a-l*i,h=u*i+l*n-o*a,f=u*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=c*u+d*-o+h*-l-f*-s,t[1]=h*u+d*-s+f*-o-c*-l,t[2]=f*u+d*-l+c*-s-h*-o,t},i.rotateX=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},i.rotateY=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},i.rotateZ=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},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=3),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s1?0:Math.acos(a)},i.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},i.equals=function(t,e){var r=t[0],i=t[1],a=t[2],o=e[0],s=e[1],l=e[2];return Math.abs(r-o)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(a-l)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))},e.exports=i},{"./common.js":162}],170:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.fromValues=function(t,e,r,i){var a=new n.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=r,a[3]=i,a},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.set=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+a*a)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return r*r+n*n+i*i+a*a},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=n*o,t[2]=i*o,t[3]=a*o),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.lerp=function(t,e,r,n){var i=e[0],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},i.random=function(t,e){return e=e||1,t[0]=n.RANDOM(),t[1]=n.RANDOM(),t[2]=n.RANDOM(),t[3]=n.RANDOM(),i.normalize(t,t),i.scale(t,t,e),t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],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},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*a-l*i,h=u*i+l*n-o*a,f=u*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=c*u+d*-o+h*-l-f*-s,t[1]=h*u+d*-s+f*-o-c*-l,t[2]=f*u+d*-l+c*-s-h*-o,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s1.0001)return null;m+=g[c]}return Math.abs(m-1)>.001?null:[h,o(t,g),g]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:36,"polytope-closest-point/lib/closest_point_2d.js":444}],172:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}",i="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat cookTorranceSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution_2_0(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\n\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n \n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular_1_1(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}",a="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}",o="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",u="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}",c="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}",h="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}",f="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}",d="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n";r.meshShader={vertex:n,fragment:i,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:a,fragment:o,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:s,fragment:l,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:h,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:f,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{}],173:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u,c,h,f,d,p,g,m,v,y,x,b,_,w,M,A,k,T){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=a,this.pointPickShader=o,this.contourShader=s,this.trianglePositions=l,this.triangleColors=c,this.triangleNormals=f,this.triangleUVs=h,this.triangleIds=u,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=m,this.edgeUVs=v,this.edgeIds=g,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=x,this.pointColors=_,this.pointUVs=w,this.pointSizes=M,this.pointIds=b,this.pointVAO=A,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=k,this.contourVAO=T,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=O,this._view=O,this._projection=O,this._resolution=[1,1]}function i(t){for(var e=A({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return M(r,[256,256,4],[4,0,1])}function a(t,e,r){for(var n=new Array(e),i=0;i=1},R.isTransparent=function(){return this.opacity<1},R.pickSlots=1,R.setPickBase=function(t){this.pickId=t},R.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=k(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=T.mallocFloat32(6*a),s=0,l=0;l0){var f=this.triShader;f.bind(),f.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var f=this.lineShader;f.bind(),f.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){var f=this.pointShader;f.bind(),f.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}if(this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0){var f=this.contourShader;f.bind(),f.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind()}},R.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||O,n=t.view||O,i=t.projection||O,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={model:r,view:n,projection:i,clipBounds:a,pickId:this.pickId/255},l=this.pickShader;if(l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0){var l=this.pointPickShader;l.bind(),l.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}},R.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;as[A]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=m[n],a.uniforms.angle=v[n],u.drawArrays(u.TRIANGLES,s[A],s[k]-s[A]))),y[n]&&M&&(e[1^n]-=T*d*x[n],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=b[n],a.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,M)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*g[n+2],As[A]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=m[n+2],a.uniforms.angle=v[n+2],u.drawArrays(u.TRIANGLES,s[A],s[k]-s[A]))),y[n+2]&&M&&(e[1^n]+=T*d*x[n+2],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=b[n+2],a.uniforms.angle=_[n+2],u.drawArrays(u.TRIANGLES,w,M))}}(),c.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,i=r.gl,a=r.screenBox,o=r.titleCenter,s=r.titleAngle,l=r.titleColor,u=r.pixelRatio;if(this.titleCount){for(var c=0;c<2;++c)e[c]=2*(o[c]*u-a[c])/(a[2+c]-a[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,a=n._tickBounds,o=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var u=0;u<2;++u){var c=a[u],h=a[u+2],f=h-c,d=.5*(o[u+2]+o[u]),p=o[u+2]-o[u],g=l[u],m=l[u+2],v=m-g,y=s[u],x=s[u+2],b=x-y;e[u]=2*f/p*v/b,t[u]=2*(c-d)/p*v/b}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){var e,r,n,i,a,o=[],l=t.ticks,u=t.bounds;for(a=0;a<2;++a){var c=[Math.floor(o.length/3)],h=[-(1/0)],f=l[a];for(e=0;er)for(t=r;te)for(t=e;t=0){for(var A=0|M.type.charAt(M.type.length-1),k=new Array(A),T=0;T=0;)E+=1;w[x]=E}var S=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,w),Object.defineProperty(d,"uniforms",o(p,d,r,S))},e.exports=a},{"./lib/GLError":181,"./lib/create-attributes":182,"./lib/create-uniforms":183,"./lib/reflect":184,"./lib/runtime-reflect":185,"./lib/shader-cache":186}],181:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="GLError",n.prototype.constructor=n,e.exports=n},{}],182:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}function i(t,e,r,i,a,o,s){for(var l=["gl","v"],u=[],c=0;c=0){var p=f.charCodeAt(f.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);i(t,e,d[0],n,p,o,h)}else{if(!(f.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+h+": "+f);var p=f.charCodeAt(f.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);a(t,e,d,n,p,o,h)}}}return o}e.exports=o;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,a=i._gl,o=i._locations[i._index];a.vertexAttribPointer(o,i._dimension,t||a.FLOAT,!!e,r||0,n||0),a.enableVertexAttribArray(o)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":181}],183:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;n4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(i<2||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],a=t;a+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function h(e){for(var n=["return function updateProperty(obj){"],i=c("",e),o=0;o4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var o=p(i);Object.defineProperty(t,e,{get:n(o),set:h(i),enumerable:!0,configurable:!1})}else a[i]?Object.defineProperty(t,e,{get:l(i),set:h(i),enumerable:!0,configurable:!1}):t[e]=f(r[i].type)}function p(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){l[0]in o||(o[l[0]]=[]),o=o[l[0]];for(var u=1;u1)for(var l=0;l=0){var g=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(g,e[1],g,e[3],d[p],f[p]):o.drawLine(e[0],g,e[2],g,d[p],f[p])}}for(var p=0;p=0;--t)this.objects[t].dispose();this.objects.length=0;for(var t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},f.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},f.removeObject=function(t){for(var e=this.objects,r=0;r0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function o(t){return"boolean"!=typeof t||t}function s(t){function e(){if(!_&&H.autoResize){var t=w.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*H.pixelRatio),i=0|Math.ceil(r*H.pixelRatio);if(n!==w.width||i!==w.height){w.width=n,w.height=i;var a=w.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",j=!0}}}function r(){for(var t=D.length,e=F.length,r=0;r0&&0===R[e-1];)R.pop(),F.pop().dispose()}function s(){return!!H.contextLost||void(A.isContextLost()&&(H.contextLost=!0,H.mouseListener.enabled=!1,H.selection.object=null,H.oncontextloss&&H.oncontextloss()))}function y(){if(!s()){A.colorMask(!0,!0,!0,!0),A.depthMask(!0),A.disable(A.BLEND),A.enable(A.DEPTH_TEST);for(var t=D.length,e=F.length,r=0;rT.distance)continue;for(var u=0;u>>1;for(r=0;r=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}function a(t,e){var r=t.gl,i=s(r),a=s(r),l=o(r,u.pointVertex,u.pointFragment),c=o(r,u.pickVertex,u.pickFragment),h=new n(t,i,a,l,c);return h.update(e),t.addObject(h),h}var o=t("gl-shader"),s=t("gl-buffer"),l=t("typedarray-pool"),u=t("./lib/shader");e.exports=a;var c=n.prototype;c.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},c.update=function(t){function e(e,r){return e in t?t[e]:r}var r;t=t||{},this.sizeMin=e("sizeMin",.5),this.sizeMax=e("sizeMax",20),this.color=e("color",[1,0,0,1]).slice(),this.areaRatio=e("areaRatio",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.blend=e("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,a=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,o=t.positions,s=i?o:l.mallocFloat32(o.length),u=a?t.idToIndex:l.mallocInt32(n);if(i||s.set(o),!a)for(s.set(o),r=0;r>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),a.attributes.pickId.pointer(o.UNSIGNED_BYTE),a.uniforms.pickOffset=e,this.pickOffset=r);var f=o.getParameter(o.BLEND),d=o.getParameter(o.DITHER);return f&&!this.blend&&o.disable(o.BLEND),d&&o.disable(o.DITHER),o.drawArrays(o.POINTS,0,this.pointCount),f&&!this.blend&&o.enable(o.BLEND),d&&o.enable(o.DITHER),r+this.pointCount}}(),c.draw=c.unifiedDraw,c.drawPick=c.unifiedDraw,c.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":190,"gl-buffer":128,"gl-shader":191,"typedarray-pool":496}],199:[function(t,e,r){function n(t,e,r,n){var i,a,o,s,l,u=e[0],c=e[1],h=e[2],f=e[3],d=r[0],p=r[1],g=r[2],m=r[3];return a=u*d+c*p+h*g+f*m,a<0&&(a=-a,d=-d,p=-p,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),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*h+l*g,t[3]=s*f+l*m,t}e.exports=n},{}],200:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4((posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n",fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4((posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],201:[function(t,e,r){arguments[4][180][0].apply(r,arguments)},{"./lib/GLError":202,"./lib/create-attributes":203,"./lib/create-uniforms":204,"./lib/reflect":205,"./lib/runtime-reflect":206,"./lib/shader-cache":207,dup:180}],202:[function(t,e,r){arguments[4][181][0].apply(r,arguments)},{dup:181}],203:[function(t,e,r){arguments[4][182][0].apply(r,arguments)},{"./GLError":202,dup:182}],204:[function(t,e,r){arguments[4][183][0].apply(r,arguments)},{"./GLError":202,"./reflect":205,dup:183}],205:[function(t,e,r){arguments[4][184][0].apply(r,arguments)},{dup:184}],206:[function(t,e,r){arguments[4][185][0].apply(r,arguments)},{dup:185}],207:[function(t,e,r){arguments[4][186][0].apply(r,arguments)},{"./GLError":202,dup:186,"gl-format-compiler-error":136,"weakmap-shim":517}],208:[function(t,e,r){"use strict";function n(t){if(t in f)return f[t];var e=c(t,{polygons:!0,font:"sans-serif",textAlign:"left",textBaseline:"alphabetic"}),r=[],n=[];e.forEach(function(t){t.forEach(function(t){for(var e=0;e>8*d&255;f.uniforms.pickOffset=o,this.idBuffer.bind(),f.attributes.id.pointer(h.UNSIGNED_BYTE,!1)}else this.colorBuffer.bind(),f.attributes.color.pointer(h.UNSIGNED_BYTE,!0);return this.posHiBuffer.bind(),f.attributes.positionHi.pointer(),this.posLoBuffer.bind(),f.attributes.positionLo.pointer(),this.offsetBuffer.bind(),f.attributes.offset.pointer(),f.uniforms.pixelScale=a,f.uniforms.scaleHi=e,f.uniforms.scaleLo=r,f.uniforms.translateHi=n,f.uniforms.translateLo=i,h.drawArrays(h.TRIANGLES,0,c),l?s+this.numPoints:void 0}}(),d.draw=d.drawPick,d.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;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]]}},d.update=function(t){t=t||{};var e,r,i=t.positions||[],a=t.colors||[],o=t.glyphs||[],s=t.sizes||[],c=t.borderWidths||[],h=t.borderColors||[];this.points=i;var f,d,p=this.bounds=[1/0,1/0,-(1/0),-(1/0)],g=0,m=[],v=[];for(e=0;e>1,r=0;r<2;++r)p[r]=Math.min(p[r],i[2*e+r]),p[2+r]=Math.max(p[2+r],i[2*e+r]);p[0]===p[2]&&(p[2]+=1),p[3]===p[1]&&(p[3]+=1);var y=1/(p[2]-p[0]),x=1/(p[3]-p[1]),b=p[0],_=p[1],w=u.mallocFloat64(2*g),M=u.mallocFloat32(2*g),A=u.mallocFloat32(2*g),k=u.mallocFloat32(2*g),T=u.mallocUint8(4*g),E=u.mallocUint32(g),S=0;for(e=0;et;){var d=r[f-1],p=n[2*(f-1)];if((d-s||l-p)>=0)break;r[f]=d,n[2*f]=p,n[2*f+1]=n[2*f-1],i[f]=i[f-1],a[f]=a[f-1],f-=1}r[f]=s,n[2*f]=l,n[2*f+1]=u,i[f]=c,a[f]=h}}function a(t,e,r,n,i,a){var o=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=a[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,i[e]=u,a[e]=c}function o(t,e,r,n,i,a){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e]}function s(t,e,r,n,i,a,o){var s=n[t],l=i[2*t],u=i[2*t+1],c=a[t],h=o[t]; +n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],a[t]=a[e],o[t]=o[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],a[e]=a[r],o[e]=o[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,a[r]=c,o[r]=h}function l(t,e,r,n,i,a,o,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=a,c[e]=o}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,a,o,s){return(e-a[t]||o[2*t]-r||i-s[t])<0}function h(t,e,r,n,d,p){var g=(e-t+1)/6|0,m=t+g,v=e-g,y=t+e>>1,x=y-g,b=y+g,_=m,w=x,M=y,A=b,k=v,T=t+1,E=e-1,S=0;u(_,w,r,n,d,p)&&(S=_,_=w,w=S),u(A,k,r,n,d,p)&&(S=A,A=k,k=S),u(_,M,r,n,d,p)&&(S=_,_=M,M=S),u(w,M,r,n,d,p)&&(S=w,w=M,M=S),u(_,A,r,n,d,p)&&(S=_,_=A,A=S),u(M,A,r,n,d,p)&&(S=M,M=A,A=S),u(w,k,r,n,d,p)&&(S=w,w=k,k=S),u(w,M,r,n,d,p)&&(S=w,w=M,M=S),u(A,k,r,n,d,p)&&(S=A,A=k,k=S);var L=r[w],z=n[2*w],C=n[2*w+1],I=d[w],P=p[w],D=r[A],O=n[2*A],R=n[2*A+1],F=d[A],j=p[A],N=_,B=M,U=k,V=m,q=y,H=v,G=r[N],X=r[B],Y=r[U];r[V]=G,r[q]=X,r[H]=Y;for(var W=0;W<2;++W){var Z=n[2*N+W],Q=n[2*B+W],K=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=Q,n[2*H+W]=K}var $=d[N],J=d[B],tt=d[U];d[V]=$,d[q]=J,d[H]=tt;var et=p[N],rt=p[B],nt=p[U];p[V]=et,p[q]=rt,p[H]=nt,o(x,t,r,n,d,p),o(b,e,r,n,d,p);for(var it=T;it<=E;++it)if(c(it,L,z,C,I,r,n,d))it!==T&&a(it,T,r,n,d,p),++T;else if(!c(it,D,O,R,F,r,n,d))for(;;){if(c(E,D,O,R,F,r,n,d)){c(E,L,z,C,I,r,n,d)?(s(it,T,E,r,n,d,p),++T,--E):(a(it,E,r,n,d,p),--E);break}if(--E=Math.max(.9*d,32)){var x=u+s>>>1;l(m,v,h,f,x,c+1),f=x}l(m,v,h,f,y,c+1),f=y}}}var u=t.length>>>1;if(u<1)return[];for(var c=1/0,h=1/0,f=-(1/0),d=-(1/0),p=0;p=0;--_){t[2*_]=(t[2*_]-c)*v,t[2*_+1]=(t[2*_+1]-h)*y;var k=b[_];k!==M&&(w.push(new i(x*Math.pow(.5,k),_+1,A-(_+1))),A=_+1,M=k)}return w.push(new i(x*Math.pow(.5,k+1),0,A)),o.free(b),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=a},{"./lib/sort":211,"typedarray-pool":496}],213:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.plot=t,this.positionBufferHi=e,this.positionBufferLo=r,this.pickBuffer=n,this.weightBuffer=i,this.shader=a,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=o(r),s=o(r),l=o(r),u=o(r),h=a(r,c.pointVertex,c.pointFragment),f=a(r,c.pickVertex,c.pickFragment),d=new n(t,i,s,l,u,h,f);return d.update(e),t.addObject(d),d}var a=t("gl-shader"),o=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var h=n.prototype,f=new Float32Array(2),d=new Float32Array(2),p=new Float32Array(2),g=new Float32Array(2),m=[0,0,0,0];h.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBufferHi.dispose(),this.positionBufferLo.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},h.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords),this.points=t.positions;var r=this.points.length>>>1,n=u.mallocInt32(r),i=u.mallocFloat32(2*r),a=u.mallocFloat64(2*r);a.set(this.points),this.scales=l(a,n,i,this.bounds);var o=u.mallocFloat64(r),s=u.mallocFloat32(2*r),c=u.mallocFloat32(2*r);s.set(a);for(var h=0,f=0;h>8&255,m[2]=t>>16&255,m[3]=t>>24&255,n.uniforms.pickOffset=m,l.bind(),n.attributes.pickId.pointer(v.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());for(var I=this.xCoords,P=(b[0]-u[0]-E*c*y)/_,D=(b[2]-u[0]+E*c*y)/_,O=!0,R=i.length-1;R>=0;R--){var F=i[R];if(!(F.pixelSize1)){var j=F.offset,N=F.count+j,B=s.ge(I,P,j,N-1),U=s.lt(I,D,B,N-1)+1;U>B&&v.drawArrays(v.POINTS,B,U-B),!e&&O&&(O=!1,n.uniforms.useWeight=0)}}return t+this.pointCount},h.drawPick=h.draw,h.pick=function(t,e,r){var n=r-this.pickOffset;return n<0||n>=this.pointCount?null:{object:this,pointId:n,dataCoord:[this.points[2*n],this.points[2*n+1]]}}},{"./lib/shader":209,"binary-search-bounds":210,"gl-buffer":128,"gl-shader":220,"snap-points-2d":212,"typedarray-pool":496}],214:[function(t,e,r){"use strict";function n(t,e){var r=a[e];if(r||(r=a[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-(1/0),-(1/0)]],l=0;lMath.abs(R[1])){var F=O;O=R,R=F,F=P,P=D,D=F;var j=C;C=I,I=j}O[0]<0&&(P[C]=-1),R[1]>0&&(D[I]=-1);for(var N=0,B=0,z=0;z<4;++z)N+=Math.pow(p[4*C+z],2),B+=Math.pow(p[4*I+z],2);P[C]/=Math.sqrt(N),D[I]/=Math.sqrt(B),d.axes[0]=P,d.axes[1]=D,d.fragClipBounds[0]=u(S,x[0],_,-1e8),d.fragClipBounds[1]=u(S,x[1],_,1e8),e.vao.draw(f.TRIANGLES,e.vertexCount),e.lineWidth>0&&(f.lineWidth(e.lineWidth),e.vao.draw(f.LINES,e.lineVertexCount,e.vertexCount))}}function f(t,e,r,n,i,a){var o=r.gl;if(r.vao.bind(),i===r.opacity<1||a){t.bind();var s=t.uniforms;s.model=n.model||b,s.view=n.view||b,s.projection=n.projection||b,w[0]=2/o.drawingBufferWidth,w[1]=2/o.drawingBufferHeight,s.screenSize=w,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),r.lineWidth>0&&(o.lineWidth(r.lineWidth),r.vao.draw(o.LINES,r.lineVertexCount,r.vertexCount))}h(e,r,n,i,a),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),a=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=p(e),c=p(e),h=p(e),f=p(e),d=g(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:h,size:2,type:e.FLOAT},{buffer:f,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),m=new o(e,r,n,i,u,c,h,f,d,a,s,l);return m.update(t),m}var p=t("gl-buffer"),g=t("gl-vao"),m=t("typedarray-pool"),v=t("gl-mat4/multiply"),y=t("./lib/shaders"),x=t("./lib/glyphs"),b=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=d;var _=o.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],M=[0,0,0],A=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=b.slice(),S=[0,0,0],L=[[0,0,0],[0,0,0]],z=[-1e8,-1e8,-1e8],C=[1e8,1e8,1e8],I=[z,C];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;f(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||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},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",a=t.alignment||[0,0],o=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,h=t.angle,f=t.lineColor,d=0,p=0,g=0,v=n.length;t:for(var y=0;y0&&(C[0]=-a[0]*(1+k[0][0]));for(var q=M.cells,H=M.positions,_=0;_0){var v=r*c;o.drawBox(h-v,f-v,d+v,f+v,a),o.drawBox(h-v,p-v,d+v,p+v,a),o.drawBox(h-v,f-v,h+v,p+v,a),o.drawBox(d-v,f-v,d+v,p+v,a)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":217,"gl-buffer":128,"gl-shader":220}],219:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function a(t,e){var r=o(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=a;var o=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(_inline_49_arg0_<255||_inline_49_arg1_<255||_inline_49_arg2_<255||_inline_49_arg3_<255){var _inline_49_l=_inline_49_arg4_-_inline_49_arg6_[0],_inline_49_a=_inline_49_arg5_-_inline_49_arg6_[1],_inline_49_f=_inline_49_l*_inline_49_l+_inline_49_a*_inline_49_a;_inline_49_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;i=0){for(var A=0|M.type.charAt(M.type.length-1),k=new Array(A),T=0;T=0;)E+=1;_[w]=E}var S=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,x,_),Object.defineProperty(d,"uniforms",o(p,d,r,S))},e.exports=a},{"./lib/GLError":221,"./lib/create-attributes":222,"./lib/create-uniforms":223,"./lib/reflect":224,"./lib/runtime-reflect":225,"./lib/shader-cache":226}],221:[function(t,e,r){arguments[4][181][0].apply(r,arguments)},{dup:181}],222:[function(t,e,r){arguments[4][182][0].apply(r,arguments)},{"./GLError":221,dup:182}],223:[function(t,e,r){arguments[4][183][0].apply(r,arguments)},{"./GLError":221,"./reflect":224,dup:183}],224:[function(t,e,r){arguments[4][184][0].apply(r,arguments)},{dup:184}],225:[function(t,e,r){arguments[4][185][0].apply(r,arguments)},{dup:185}],226:[function(t,e,r){arguments[4][186][0].apply(r,arguments)},{"./GLError":221,dup:186,"gl-format-compiler-error":136,"weakmap-shim":517}],227:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}function i(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=i;var a=n.prototype;a.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},a.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,a=i.line,o=i.dataBox,s=i.viewBox;if(a.bind(),o[0]<=n[0]&&n[0]<=o[2]&&o[1]<=n[1]&&n[1]<=o[3]){var l=s[0]+(n[0]-o[0])/(o[2]-o[0])*(s[2]-s[0]),u=s[1]+(n[1]-o[1])/(o[3]-o[1])*(s[3]-s[1]);t[0]&&a.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&a.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&a.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&a.drawLine(l,u,l,s[3],e[3],r[3])}},a.dispose=function(){this.plot.removeOverlay(this)}},{}],228:[function(t,e,r){"use strict";var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, color;\nattribute float weight;\n\nuniform mat4 model, view, projection;\nuniform vec3 coordinates[3];\nuniform vec4 colors[3];\nuniform vec2 screenShape;\nuniform float lineWidth;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vertexPosition = mix(coordinates[0],\n mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));\n\n vec4 clipPos = projection * view * model * vec4(vertexPosition, 1.0);\n vec2 clipOffset = (projection * view * model * vec4(color, 0.0)).xy;\n vec2 delta = weight * clipOffset * screenShape;\n vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;\n\n gl_Position = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);\n fragColor = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}";e.exports=function(t){return n(t,i,a,null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":220}],229:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n,this.pixelRatio=1,this.bounds=[[-1e3,-1e3,-1e3],[1e3,1e3,1e3]],this.position=[0,0,0],this.lineWidth=[2,2,2],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.enabled=[!0,!0,!0],this.drawSides=[!0,!0,!0],this.axes=null}function i(t,e){function r(t,e,r,n,a,o){var s=[t,e,r,0,0,0,1];s[n+3]=1,s[n]=a,i.push.apply(i,s),s[6]=-1,i.push.apply(i,s),s[n]=o,i.push.apply(i,s),i.push.apply(i,s),s[6]=1,i.push.apply(i,s),s[n]=a,i.push.apply(i,s)}var i=[];r(0,0,0,0,0,1),r(0,0,0,1,0,1),r(0,0,0,2,0,1),r(1,0,0,1,-1,1),r(1,0,0,2,-1,1),r(0,1,0,0,-1,1),r(0,1,0,2,-1,1),r(0,0,1,0,-1,1),r(0,0,1,1,-1,1);var l=a(t,i),u=o(t,[{type:t.FLOAT,buffer:l,size:3,offset:0,stride:28},{type:t.FLOAT,buffer:l,size:3,offset:12,stride:28},{type:t.FLOAT,buffer:l,size:1,offset:24,stride:28}]),c=s(t);c.attributes.position.location=0,c.attributes.color.location=1,c.attributes.weight.location=2;var h=new n(t,l,u,c);return h.update(e),h}var a=t("gl-buffer"),o=t("gl-vao"),s=t("./shaders/index");e.exports=i;var l=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],u=n.prototype,c=[0,0,0],h=[0,0,0],f=[0,0];u.isTransparent=function(){return!1},u.drawTransparent=function(t){}, +u.draw=function(t){var e=this.gl,r=this.vao,n=this.shader;r.bind(),n.bind();var i,a=t.model||l,o=t.view||l,s=t.projection||l;this.axes&&(i=this.axes.lastCubeProps.axis);for(var u=c,d=h,p=0;p<3;++p)i&&i[p]<0?(u[p]=this.bounds[0][p],d[p]=this.bounds[1][p]):(u[p]=this.bounds[1][p],d[p]=this.bounds[0][p]);f[0]=e.drawingBufferWidth,f[1]=e.drawingBufferHeight,n.uniforms.model=a,n.uniforms.view=o,n.uniforms.projection=s,n.uniforms.coordinates=[this.position,u,d],n.uniforms.colors=this.colors,n.uniforms.screenShape=f;for(var p=0;p<3;++p)n.uniforms.lineWidth=this.lineWidth[p]*this.pixelRatio,this.enabled[p]&&(r.draw(e.TRIANGLES,6,6*p),this.drawSides[p]&&r.draw(e.TRIANGLES,12,18+12*p));r.unbind()},u.update=function(t){t&&("bounds"in t&&(this.bounds=t.bounds),"position"in t&&(this.position=t.position),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"colors"in t&&(this.colors=t.colors),"enabled"in t&&(this.enabled=t.enabled),"drawSides"in t&&(this.drawSides=t.drawSides))},u.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders/index":228,"gl-buffer":128,"gl-vao":236}],230:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\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 worldCoordinate = vec3(uv.zw, f.x);\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n vec4 clipPosition = projection * view * worldPosition;\n gl_Position = clipPosition;\n kill = f.y;\n value = f.z;\n planeCoordinate = uv.xy;\n\n vColor = texture2D(colormap, vec2(value, value));\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat beckmannSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution_2_0(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\n}\n\n\n\nuniform vec3 lowerBound, upperBound;\nuniform float contourTint;\nuniform vec4 contourColor;\nuniform sampler2D colormap;\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform float vertexColor;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n if (kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = beckmannSpecular_1_1(L, V, N, roughness);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //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",o="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",s="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n";r.createShader=function(t){var e=n(t,i,a,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createPickShader=function(t){var e=n(t,i,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createContourShader=function(t){var e=n(t,o,a,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,o,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":220}],231:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}function i(t){var e=b([y({colormap:t,nshades:R,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);return x.divseq(e,255),e}function a(t,e,r,i,a,o,s,l,u,c,h,f,d,p){this.gl=t,this.shape=e,this.bounds=r,this.intensityBounds=[],this._shader=i,this._pickShader=a,this._coordinateBuffer=o,this._vao=s,this._colorMap=l,this._contourShader=u,this._contourPickShader=c,this._contourBuffer=h,this._contourVAO=f,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new n([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=d,this._dynamicVAO=p,this._dynamicOffsets=[0,0,0],this._dynamicCounts=[0,0,0],this.contourWidth=[1,1,1],this.contourLevels=[[1],[1],[1]],this.contourTint=[0,0,0],this.contourColor=[[.5,.5,.5,1],[.5,.5,.5,1],[.5,.5,.5,1]],this.showContour=!0,this.showSurface=!0,this.enableHighlight=[!0,!0,!0],this.highlightColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.highlightTint=[1,1,1],this.highlightLevel=[-1,-1,-1],this.enableDynamic=[!0,!0,!0],this.dynamicLevel=[NaN,NaN,NaN],this.dynamicColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.dynamicTint=[1,1,1],this.dynamicWidth=[1,1,1],this.axesBounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.surfaceProject=[!1,!1,!1],this.contourProject=[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],this.colorBounds=[!1,!1],this._field=[_(v.mallocFloat(1024),[0,0]),_(v.mallocFloat(1024),[0,0]),_(v.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.snapToData=!1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.vertexColor=0,this.dirty=!0}function o(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||j,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=N.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],M(l,t.model,l);var u=N.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return N.showSurface=o,N.showContour=s,N}function s(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=B;n.model=t.model||P,n.view=t.view||P,n.projection=t.projection||P,n.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],n.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],n.contourColor=this.contourColor[0],n.inverseModel=A(n.inverseModel,n.model);for(var i=0;i<2;++i)for(var a=n.clipBounds[i],s=0;s<3;++s)a[s]=Math.min(Math.max(this.clipBounds[i][s],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=V,n.vertexColor=this.vertexColor;var l=U;for(M(l,n.view,n.model),M(l,n.projection,l),A(l,l),i=0;i<3;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;i<3;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;i<3;++i){var c=l[12+i];for(s=0;s<3;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var h=o(n,this);if(h.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;i<3;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=h.projections[i],this._shader.uniforms.clipBounds=h.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(h.showContour&&!e){var f=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,f.bind(),f.uniforms=n;var d=this._contourVAO;for(d.bind(),i=0;i<3;++i)for(f.uniforms.permutation=O[i],r.lineWidth(this.contourWidth[i]),s=0;s=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},F.pickSlots=1,F.setPickBase=function(t){this.pickId=t};var j=[0,0,0],N={showSurface:!1,showContour:!1,projections:[P.slice(),P.slice(),P.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:P,view:P,projection:P,inverseModel:P.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1,vertexColor:0},U=P.slice(),V=[1,0,0,0,1,0,0,0,1];F.draw=function(t){return s.call(this,t,!1)},F.drawTransparent=function(t){return s.call(this,t,!0)};var q={model:P,view:P,projection:P,inverseModel:P,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};F.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=q;r.model=t.model||P,r.view=t.view||P,r.projection=t.projection||P,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.permutation=V;for(var n=0;n<2;++n)for(var i=r.clipBounds[n],a=0;a<3;++a)i[a]=Math.min(Math.max(this.clipBounds[n][a],-1e8),1e8);var s=o(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;n<3;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var u=this._contourVAO;for(u.bind(),a=0;a<3;++a)for(e.lineWidth(this.contourWidth[a]),l.uniforms.permutation=O[a],n=0;n>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 u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;c<2;++c)for(var h=c?a:1-a,f=0;f<2;++f)for(var d=f?l:1-l,p=i+c,g=s+f,m=h*d,v=0;v<3;++v)u[v]+=this._field[v].get(p,g)*m;for(var y=this._pickResult.level,x=0;x<3;++x)if(y[x]=k.le(this.contourLevels[x],u[x]),y[x]<0)this.contourLevels[x].length>0&&(y[x]=0);else if(y[x]Math.abs(_-u[x])&&(y[x]+=1)}for(r.index[0]=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},F.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=u(t.contourWidth,Number)),"showContour"in t&&(this.showContour=u(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=u(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=h(t.contourColor)),"contourProject"in t&&(this.contourProject=u(t.contourProject,function(t){return u(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=h(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=u(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=u(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"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 n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(v.freeFloat(this._field[2].data),this._field[2].data=v.mallocFloat(d.nextPow2(n))),this._field[2]=_(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),l(this._field[2],e),this.shape=e.shape.slice();for(var a=this.shape,o=0;o<2;++o)this._field[2].size>this._field[o].data.length&&(v.freeFloat(this._field[o].data),this._field[o].data=v.mallocFloat(this._field[2].size)),this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2]);if(t.coords){var s=t.coords;if(!Array.isArray(s)||3!==s.length)throw new Error("gl-surface: invalid coordinates for x/y");for(o=0;o<2;++o){var c=s[o];for(y=0;y<2;++y)if(c.shape[y]!==a[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[o],c)}}else if(t.ticks){var f=t.ticks;if(!Array.isArray(f)||2!==f.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var p=f[o];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var g=_(p.data,a);g.stride[o]=p.stride[0],g.stride[1^o]=0,l(this._field[o],g)}}else{for(o=0;o<2;++o){var m=[0,0];m[o]=1,this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2],m,0)}this._field[0].set(0,0,0);for(var y=0;y0){for(var bt=0;bt<5;++bt)tt.pop();q-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),q+=1}}nt.push(q)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=v.mallocFloat(tt.length);for(o=0;oi||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 a(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}function o(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,a,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var h=0,f=0,m=o(c,l.stride.slice());"float32"===u?h=t.FLOAT:"float64"===u?(h=t.FLOAT,m=!1,u="float32"):"uint8"===u?h=t.UNSIGNED_BYTE:(h=t.UNSIGNED_BYTE,m=!1,u="uint8");var v=1;if(2===c.length)f=t.LUMINANCE,c=[c[0],c[1],1],l=d(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])f=t.ALPHA;else if(2===c[2])f=t.LUMINANCE_ALPHA;else if(3===c[2])f=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");f=t.RGBA}v=c[2]}if(f!==t.LUMINANCE&&f!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(f=i),f!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,b=s.indexOf(n)<0;if(b&&s.push(n),h===a&&m)0===l.offset&&l.data.length===y?b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data):b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var _;_=a===t.FLOAT?g.mallocFloat32(y):g.mallocUint8(y);var w=d(_,c,[c[2],c[2]*c[0],1]);h===t.FLOAT&&a===t.UNSIGNED_BYTE?x(w,l):p.assign(w,l),b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,_.subarray(0,y)),a===t.FLOAT?g.freeFloat32(_):g.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var o=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>o||r<0||r>o)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new a(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new a(t,i,0|e.width,0|e.height,r,n)}function h(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=o(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=d(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var h,f,m=e.size;if(s)h=0===e.offset&&e.data.length===m?e.data:e.data.subarray(e.offset,e.offset+m);else{var v=[n[2],n[2]*n[0],1];f=g.malloc(m,r);var y=d(f,n,v,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?p.assign(y,e):x(y,e),h=f.subarray(0,m)}var b=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,h),s||g.free(f),new a(t,b,n[0],n[1],c,u)}function f(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(m||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return h(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var d=t("ndarray"),p=t("ndarray-ops"),g=t("typedarray-pool");e.exports=f;var m=null,v=null,y=null,x=function(t,e){p.muls(t,e,255)},b=a.prototype;Object.defineProperties(b,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),v.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),v.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=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(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t); +return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t|=0,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,i(this,this._shape[0],t),t}}}),b.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},b.dispose=function(){this.gl.deleteTexture(this.handle)},b.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},b.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var a=this._mipLevels.indexOf(n)<0;a?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:427,"ndarray-ops":421,"typedarray-pool":496}],233:[function(t,e,r){"use strict";function n(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;i0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}e.exports=n},{}],242:[function(t,e,r){function n(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}e.exports=n},{}],243:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,a[0]}e.exports=n;var i=new Uint8Array(4),a=new Float32Array(i.buffer)},{}],244:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function C(){return/[^a-fA-F0-9]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function I(){return"."===O?(U.push(O),B=m,R=O,j+1):/[eE]/.test(O)?(U.push(O),B=m,R=O,j+1):"x"===O&&1===U.length&&"0"===U[0]?(B=w,U.push(O),R=O,j+1):/[^\d]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function P(){return"f"===O&&(U.push(O),R=O,j+=1),/[eE]/.test(O)?(U.push(O),R=O,j+1):"-"===O&&/[eE]/.test(R)?(U.push(O),R=O,j+1):/[^\d]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function D(){if(/[^\d\w_]/.test(O)){var t=U.join("");return B=Q.indexOf(t)>-1?x:Z.indexOf(t)>-1?y:v,e(U.join("")),B=u,j}return U.push(O),R=O,j+1}var O,R,F,j=0,N=0,B=u,U=[],V=[],q=1,H=0,G=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return V=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var i=t("./lib/literals"),a=t("./lib/operators"),o=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,h=0,f=1,d=2,p=3,g=4,m=5,v=6,y=7,x=8,b=9,_=10,w=11,M=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":247,"./lib/builtins-300es":246,"./lib/literals":249,"./lib/literals-300es":248,"./lib/operators":250}],246:[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":247}],247:[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"]},{}],248:[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":249}],249:[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"]},{}],250:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],251:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":245}],252:[function(t,e,r){"use strict";function n(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var a=new Int32Array(this.arrayBuffer);t=a[0],e=a[1],r=a[2],this.d=e+2*r;for(var o=0;o=u[f+0]&&n>=u[f+1]?(o[h]=!0,a.push(l[h])):o[h]=!1}}},n.prototype._forEachCell=function(t,e,r,n,i,a,o){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=s;h<=u;h++)for(var f=l;f<=c;f++){var d=this.d*f+h;if(i.call(this,t,e,r,n,d,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,c=-7,h=r?i-1:0,f=r?-1:1,d=t[e+h];for(h+=f,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+h],h+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+h],h+=f,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=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=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),e+=o+h>=1?f/l:f*Math.pow(2,1-h),e*l>=2&&(o++,l/=2),o+h>=c?(s=0,o=c):o+h>=1?(s=(e*l-1)*Math.pow(2,i),o+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],254:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function a(t,e){return c(t.vertices,e.vertices)}function o(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;r<=t;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=u[t+1];return i||(i=u),n(i)}function s(t,e,r){this.dimension=t,this.vertices=e,this.simplices=r,this.interior=r.filter(function(t){return!t.boundary}),this.tuple=new Array(t+1);for(var n=0;n<=t;++n)this.tuple[n]=this.vertices[n];var i=h[t];i||(i=h[t]=o(t)),this.orient=i}function l(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var i=t[0].length;if(r<=i)throw new Error("Must input at least d+1 points");var a=t.slice(0,i+1),o=u.apply(void 0,a);if(0===o)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;c<=i;++c)l[c]=c;o<0&&(l[0]=1,l[1]=0);for(var h=new n(l,new Array(i+1),!1),f=h.adjacent,d=new Array(i+2),c=0;c<=i;++c){for(var p=l.slice(),g=0;g<=i;++g)g===c&&(p[g]=-1);var m=p[0];p[0]=p[1],p[1]=m;var v=new n(p,new Array(i+1),!0);f[c]=v,d[c]=v}d[i+1]=h;for(var c=0;c<=i;++c)for(var p=f[c].vertices,y=f[c].adjacent,g=0;g<=i;++g){var x=p[g];if(x<0)y[g]=h;else for(var b=0;b<=i;++b)f[b].vertices.indexOf(x)<0&&(y[g]=f[b])}for(var _=new s(i,a,d),w=!!e,c=i+1;c0;){t=o.pop();for(var s=(t.vertices,t.adjacent),l=0;l<=r;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,h=0;h<=r;++h){var f=c[h];f<0?i[h]=e:i[h]=a[f]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&o.push(u)}}}return null},f.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,u=s.adjacent,c=0;c<=n;++c)a[c]=i[l[c]];s.lastVisited=r;for(var c=0;c<=n;++c){var h=u[c];if(!(h.lastVisited>=r)){var f=a[c];a[c]=t;var d=this.orient();if(a[c]=f,d<0){s=h;continue t}h.boundary?h.lastVisited=-r:h.lastVisited=r}}return}return s},f.addPeaks=function(t,e){var r=this.vertices.length-1,o=this.dimension,s=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,h=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var f=[];h.length>0;){var e=h.pop(),d=e.vertices,p=e.adjacent,g=d.indexOf(r);if(!(g<0))for(var m=0;m<=o;++m)if(m!==g){var v=p[m];if(v.boundary&&!(v.lastVisited>=r)){var y=v.vertices;if(v.lastVisited!==-r){for(var x=0,b=0;b<=o;++b)y[b]<0?(x=b,l[b]=t):l[b]=s[y[b]];var _=this.orient();if(_>0){y[x]=r,v.boundary=!1,u.push(v),h.push(v),v.lastVisited=r;continue}v.lastVisited=-r}var w=v.adjacent,M=d.slice(),A=p.slice(),k=new n(M,A,!0);c.push(k);var T=w.indexOf(e);if(!(T<0)){w[T]=k,A[g]=v,M[m]=-1,A[m]=e,p[m]=k,k.flip();for(var b=0;b<=o;++b){var E=M[b];if(!(E<0||E===r)){for(var S=new Array(o-1),L=0,z=0;z<=o;++z){var C=M[z];C<0||z===b||(S[L++]=C)}f.push(new i(S,k,b))}}}}}}f.sort(a);for(var m=0;m+1=0?o[l++]=s[c]:u=1&c;if(u===(1&t)){var h=o[0];o[0]=o[1],o[1]=h}e.push(o)}}return e}},{"robust-orientation":465,"simplicial-complex":476}],255:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function a(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),a(t,r),x)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],a=[],o=[],s=[],r=0;r3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=v.ge(this.leftPoints,t,f),n=v.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===b?(this.left=null,this.count-=1,x):(n===x&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var a=this.left?this.left.count:0;if(4*a>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===b?(this.right=null,this.count-=1,x):(n===x&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?b:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var o=this,l=this.left;l.right;)o=l,l=l.right;if(o===this)l.right=this.right;else{var u=this.left,n=this.right;o.count-=l.count,o.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return x}for(var u=v.ge(this.leftPoints,t,f);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===b&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},w.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":53}],256:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;r=r&&s<=i&&l>=n&&l<=a&&c.push(t[p]);else{var g=Math.floor((d+f)/2);s=e[2*g],l=e[2*g+1],s>=r&&s<=i&&l>=n&&l<=a&&c.push(t[g]);var m=(h+1)%2;(0===h?r<=s:n<=l)&&(u.push(d),u.push(g-1),u.push(m)),(0===h?i>=s:a>=l)&&(u.push(g+1),u.push(f),u.push(m))}}return c}e.exports=n},{}],261:[function(t,e,r){"use strict";function n(t,e,r,a,o,s){if(!(o-a<=r)){var l=Math.floor((a+o)/2);i(t,e,l,a,o,s%2),n(t,e,r,a,l-1,s+1),n(t,e,r,l+1,o,s+1)}}function i(t,e,r,n,o,s){for(;o>n;){if(o-n>600){var l=o-n+1,u=r-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),d=Math.max(n,Math.floor(r-u*h/l+f)),p=Math.min(o,Math.floor(r+(l-u)*h/l+f));i(t,e,r,d,p,s)}var g=e[2*r+s],m=n,v=o;for(a(t,e,n,r),e[2*o+s]>g&&a(t,e,n,o);mg;)v--}e[2*n+s]===g?a(t,e,n,v):(v++,a(t,e,v,o)),v<=r&&(n=v+1),r<=v&&(o=v-1)}}function a(t,e,r,n){o(t,r,n),o(e,2*r,2*n),o(e,2*r+1,2*n+1)}function o(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=n},{}],262:[function(t,e,r){"use strict";function n(t,e,r,n,a,o){for(var s=[0,t.length-1,0],l=[],u=a*a;s.length;){var c=s.pop(),h=s.pop(),f=s.pop();if(h-f<=o)for(var d=f;d<=h;d++)i(e[2*d],e[2*d+1],r,n)<=u&&l.push(t[d]);else{var p=Math.floor((f+h)/2),g=e[2*p],m=e[2*p+1];i(g,m,r,n)<=u&&l.push(t[p]);var v=(c+1)%2;(0===c?r-a<=g:n-a<=m)&&(s.push(f),s.push(p-1),s.push(v)),(0===c?r+a>=g:n+a>=m)&&(s.push(p+1),s.push(h),s.push(v))}}return l}function i(t,e,r,n){var i=t-r,a=e-n;return i*i+a*a}e.exports=n},{}],263:[function(t,e,r){"use strict";function n(t,e){var r;if(h(t)){var l,u=t.stops&&"object"==typeof t.stops[0][0],c=u||void 0!==t.property,f=u||!c,d=t.type||e||"exponential";if("exponential"===d)l=o;else if("interval"===d)l=a;else if("categorical"===d)l=i;else{if("identity"!==d)throw new Error('Unknown function type "'+d+'"');l=s}if(u){for(var p={},g=[],m=0;m=t.stops.length)break;if(e<=t.stops[n][0])break;n++}return 0===n?t.stops[n][1]:n===t.stops.length?t.stops[n-1][1]:l(e,r,t.stops[n-1][0],t.stops[n][0],t.stops[n-1][1],t.stops[n][1])}function s(t,e){return e}function l(t,e,r,n,i,a){return"function"==typeof i?function(){var o=i.apply(void 0,arguments),s=a.apply(void 0,arguments);return l(t,e,r,n,o,s)}:i.length?c(t,e,r,n,i,a):u(t,e,r,n,i,a)}function u(t,e,r,n,i,a){var o,s=n-r,l=t-r;return o=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-o)+a*o}function c(t,e,r,n,i,a){for(var o=[],s=0;s -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linesdfpattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},outline:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},outlinepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\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\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},pattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform 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\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n}\n"},raster:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity0;\nuniform float u_opacity1;\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 vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\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);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform 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 v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},icon:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_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:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},sdf:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nconst float PI = 3.141592653589793;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_data[1] / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_data[1] / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = (gl_Position.w - 0.5);\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" +},collisionbox:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n"}},e.exports.util="float evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n"},{path:434}],265:[function(t,e,r){"use strict";function n(t,e){this.message=(t?t+": ":"")+i.apply(i,Array.prototype.slice.call(arguments,2)),null!==e&&void 0!==e&&e.__line__&&(this.line=e.__line__)}var i=t("util").format;e.exports=n},{util:504}],266:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1;e7)return[new n(c,l,"constants have been deprecated as of v8")];if(!(l in f.constants))return[new n(c,l,'constant "%s" not found',l)];e=a({},e,{value:f.constants[l]})}return u.function&&"object"===i(l)?r(e):u.type&&s[u.type]?s[u.type](e):o(a({},e,{valueSpec:u.type?h[u.type]:u}))}},{"../error/validation_error":265,"../util/extend":266,"../util/get_type":267,"./validate_array":270,"./validate_boolean":271,"./validate_color":272,"./validate_constants":273,"./validate_enum":274,"./validate_filter":275,"./validate_function":276,"./validate_layer":278,"./validate_number":280,"./validate_object":281,"./validate_source":283,"./validate_string":284}],270:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("./validate"),a=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.valueSpec,o=t.style,s=t.styleSpec,l=t.key,u=t.arrayElementValidator||i;if("array"!==n(e))return[new a(l,e,"array expected, %s found",n(e))];if(r.length&&e.length!==r.length)return[new a(l,e,"array length %d expected, length %d found",r.length,e.length)];if(r["min-length"]&&e.length7)return r?[new n(e,r,"constants have been deprecated as of v8")]:[];var o=i(r);if("object"!==o)return[new n(e,r,"object expected, %s found",o)];var s=[];for(var l in r)"@"!==l[0]&&s.push(new n(e+"."+l,r[l],'constants must start with "@"'));return s}},{"../error/validation_error":265,"../util/get_type":267}],274:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint");e.exports=function(t){var e=t.key,r=t.value,a=t.valueSpec,o=[];return a.values.indexOf(i(r))===-1&&o.push(new n(e,r,"expected one of [%s], %s found",a.values.join(", "),r)),o}},{"../error/validation_error":265,"../util/unbundle_jsonlint":268}],275:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_enum"),a=t("../util/get_type"),o=t("../util/unbundle_jsonlint");e.exports=function t(e){var r,s=e.value,l=e.key,u=e.styleSpec,c=[];if("array"!==a(s))return[new n(l,s,"array expected, %s found",a(s))];if(s.length<1)return[new n(l,s,"filter array must have at least 1 element")];switch(c=c.concat(i({key:l+"[0]",value:s[0],valueSpec:u.filter_operator,style:e.style,styleSpec:e.styleSpec})),o(s[0])){case"<":case"<=":case">":case">=":s.length>=2&&"$type"==s[1]&&c.push(new n(l,s,'"$type" cannot be use with operator "%s"',s[0]));case"==":case"!=":3!=s.length&&c.push(new n(l,s,'filter array for operator "%s" must have 3 elements',s[0]));case"in":case"!in":s.length>=2&&(r=a(s[1]),"string"!==r?c.push(new n(l+"[1]",s[1],"string expected, %s found",r)):"@"===s[1][0]&&c.push(new n(l+"[1]",s[1],"filter key cannot be a constant")));for(var h=2;h=8&&(f&&!t.valueSpec["property-function"]?p.push(new n(t.key,t.value,"property functions not supported")):d&&!t.valueSpec["zoom-function"]&&p.push(new n(t.key,t.value,"zoom functions not supported"))),p}},{"../error/validation_error":265,"../util/get_type":267,"./validate":269,"./validate_array":270,"./validate_number":280,"./validate_object":281}],277:[function(t,e,r){"use strict";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:(e.indexOf("{fontstack}")===-1&&a.push(new n(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&a.push(new n(r,e,'"glyphs" url must include a "{range}" token')),a)}},{"../error/validation_error":265,"./validate_string":284}],278:[function(t,e,r){"use strict";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"),u=t("../util/extend");e.exports=function(t){var e=[],r=t.value,c=t.key,h=t.style,f=t.styleSpec;r.type||r.ref||e.push(new n(c,r,'either "type" or "ref" is required'));var d=i(r.type),p=i(r.ref);if(r.id)for(var g=0;ga.maximum?[new i(e,r,"%s is greater than the maximum value %s",r,a.maximum)]:[]}},{"../error/validation_error":265,"../util/get_type":267}],281:[function(t,e,r){"use strict";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,u=t.styleSpec,c=[],h=i(r);if("object"!==h)return[new n(e,r,"object expected, %s found",h)];for(var f in r){var d=f.split(".")[0],p=o&&(o[d]||o["*"]),g=s[d]||s["*"];p||g?c=c.concat((g||a)({key:(e?e+".":e)+f,value:r[f],valueSpec:p,style:l,styleSpec:u,object:r,objectKey:f})):""!==e&&1!==e.split(".").length&&c.push(new n(e,r[f],'unknown property "%s"',f))}for(d in o)o[d].required&&void 0===o[d].default&&void 0===r[d]&&c.push(new n(e,r,'missing required property "%s"',d));return c}},{"../error/validation_error":265,"../util/get_type":267,"./validate":269}],282:[function(t,e,r){"use strict";var n=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.style,a=t.styleSpec,o=t.value,s=t.objectKey,l=a["paint_"+t.layerType],u=s.match(/^(.*)-transition$/);return u&&l[u[1]]&&l[u[1]].transition?n({key:e,value:o,valueSpec:a.transition,style:r,styleSpec:a}):t.valueSpec||l[s]?n({key:t.key,value:o,valueSpec:t.valueSpec||l[s],style:r,styleSpec:a}):[new i(e,o,'unknown property "%s"',s)]}},{"../error/validation_error":265,"./validate":269}],283:[function(t,e,r){"use strict";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 u=i(e.type);switch(u){case"vector":case"raster":var c=[];if(c=c.concat(a({key:r,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var h in e)["type","url","tileSize"].indexOf(h)<0&&c.push(new n(r+"."+h,e[h],'a source with a "url" property may not include a "%s" property',h));return c;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});default:return o({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":265,"../util/unbundle_jsonlint":268,"./validate_enum":274,"./validate_object":281}],284:[function(t,e,r){"use strict";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, %s found",a)]:[]}},{"../error/validation_error":265,"../util/get_type":267}],285:[function(t,e,r){"use strict";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:u}})),e.$version>7&&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.min"),u=t("./validate/validate_glyphs_url");n.source=a(t("./validate/validate_source")),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.min":286,"./validate/validate":269,"./validate/validate_constants":273,"./validate/validate_filter":275,"./validate/validate_glyphs_url":277,"./validate/validate_layer":278,"./validate/validate_layout_property":279,"./validate/validate_paint_property":282,"./validate/validate_source":283}],286:[function(t,e,r){e.exports=t("./v8.min.json")},{"./v8.min.json":287}],287:[function(t,e,r){e.exports={$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"},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_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"]},url:{type:"string"},tiles:{type:"array",value:"string"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"]},data:{type:"*"},maxzoom:{type:"number",default:14},buffer:{type:"number",default:64},tolerance:{type:"number",default:3},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:400},clusterMaxZoom:{type:"number"}},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","raster","background"]},metadata:{type:"*"},ref:{type:"string"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:22},maxzoom:{type:"number",minimum:0,maximum:22},interactive:{type:"boolean",default:!1},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"},"paint.*":{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_fill:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_circle:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_line:{"line-cap":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number",default:1.05,function:"interpolated","zoom-function":!0,"property-function":!0,requires:[{"line-join":"round"}]},visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_symbol:{"symbol-placement":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["point","line"],default:"point"},"symbol-spacing":{type:"number",default:250,minimum:1,function:"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1},"icon-allow-overlap":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image"]},"icon-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"viewport",requires:["icon-image"]},"icon-size":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image"]},"icon-text-fit":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!1,values:["none","both","width","height"],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,"property-function":!0,requires:["icon-image","icon-text-fit","text-field"]},"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,"property-function":!0,units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-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"]},"text-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],requires:["text-field"]},"text-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"viewport",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:"em",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-line-height":{type:"number",default:1.2,units:"em",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-letter-spacing":{type:"number",default:0,units:"em",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,"property-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,"property-function":!0,requires:["text-field"]},"text-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,default:!1,requires:["text-field"]},"text-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["text-field"]},"text-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["text-field","icon-image"]},visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_raster:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,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"]},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"]},function:{stops:{type:"array",required:!0,value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],default:"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["fill-translate"]},"fill-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["circle-translate"]},"circle-pitch-scale":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map"}},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,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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:!0,units:"milliseconds"}},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"}}}},{}],288:[function(t,e,r){"use strict";function n(t){return!!(i()&&a()&&o()&&s()&&l()&&u()&&c()&&h(t&&t.failIfMajorPerformanceCaveat))}function i(){return"undefined"!=typeof window&&"undefined"!=typeof document}function a(){return 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 o(){return Function.prototype&&Function.prototype.bind}function s(){return 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}function l(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON}function u(){return"Worker"in window}function c(){return"Uint8ClampedArray"in window}function h(t){return void 0===d[t]&&(d[t]=f(t)),d[t]}function f(t){var e=document.createElement("canvas"),r=Object.create(n.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=t,e.probablySupportsContext?e.probablySupportsContext("webgl",r)||e.probablySupportsContext("experimental-webgl",r):e.supportsContext?e.supportsContext("webgl",r)||e.supportsContext("experimental-webgl",r):e.getContext("webgl",r)||e.getContext("experimental-webgl",r)}"undefined"!=typeof e&&e.exports?e.exports=n:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=n);var d={};n.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}},{}],289:[function(t,e,r){"use strict";function n(t){var e=t.layoutVertexArrayType;this.layoutVertexArray=new e;var r=t.elementArrayType;r&&(this.elementArray=new r);var n=t.elementArrayType2;n&&(this.elementArray2=new n),this.paintVertexArrays=i.mapObject(t.paintVertexArrayTypes,function(t){return new t})}var i=t("../util/util");e.exports=n,n.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,n.prototype.hasCapacityFor=function(t){return this.layoutVertexArray.length+t<=n.MAX_VERTEX_ARRAY_LENGTH},n.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},n.prototype.trim=function(){this.layoutVertexArray.trim(),this.elementArray&&this.elementArray.trim(),this.elementArray2&&this.elementArray2.trim();for(var t in this.paintVertexArrays)this.paintVertexArrays[t].trim()},n.prototype.serialize=function(){return{layoutVertexArray:this.layoutVertexArray.serialize(),elementArray:this.elementArray&&this.elementArray.serialize(),elementArray2:this.elementArray2&&this.elementArray2.serialize(),paintVertexArrays:i.mapObject(this.paintVertexArrays,function(t){return t.serialize()})}},n.prototype.getTransferables=function(t){t.push(this.layoutVertexArray.arrayBuffer),this.elementArray&&t.push(this.elementArray.arrayBuffer),this.elementArray2&&t.push(this.elementArray2.arrayBuffer);for(var e in this.paintVertexArrays)t.push(this.paintVertexArrays[e].arrayBuffer)}},{"../util/util":403}],290:[function(t,e,r){"use strict";function n(t){if(this.zoom=t.zoom,this.overscaling=t.overscaling,this.layer=t.layer,this.childLayers=t.childLayers,this.type=this.layer.type,this.features=[],this.id=this.layer.id,this.index=t.index,this.sourceLayer=this.layer.sourceLayer,this.sourceLayerIndex=t.sourceLayerIndex,this.minZoom=this.layer.minzoom,this.maxZoom=this.layer.maxzoom,this.paintAttributes=i(this),t.arrays){var e=this.programInterfaces;this.bufferGroups=c.mapObject(t.arrays,function(r,n){var i=e[n],a=t.paintVertexArrayTypes[n];return r.map(function(t){return new u(t,{layoutVertexArrayType:i.layoutVertexArrayType.serialize(),elementArrayType:i.elementArrayType&&i.elementArrayType.serialize(),elementArrayType2:i.elementArrayType2&&i.elementArrayType2.serialize(),paintVertexArrayTypes:a})})})}}function i(t){var e={};for(var r in t.programInterfaces){for(var n=e[r]={},i=0;i1?p.name+_:p.name;b[w]=g[_]*m}}},n.VertexArrayType=function(t){return new h({members:t,alignment:4})},n.ElementArrayType=function(t){return new h({members:[{type:"Uint16",name:"vertices",components:t||3}]})}},{"../util/struct_array":401,"../util/util":403,"./array_group":289,"./bucket/circle_bucket":291,"./bucket/fill_bucket":292,"./bucket/line_bucket":293,"./bucket/symbol_bucket":294,"./buffer_group":296,assert:34,"feature-filter":105}],291:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=i.EXTENT;e.exports=n,n.prototype=a.inherit(i,{}),n.prototype.addCircleVertex=function(t,e,r,n,i){return t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)},n.prototype.programInterfaces={circle:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType,paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("circle-color",e,r)},multiplier:255,paintProperty:"circle-color"},{name:"a_radius",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-radius",e,r)]},multiplier:10,paintProperty:"circle-radius"},{name:"a_blur",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-blur",e,r)]},multiplier:10,paintProperty:"circle-blur"},{name:"a_opacity",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-opacity",e,r)]},multiplier:255,paintProperty:"circle-opacity"}]}},n.prototype.addFeature=function(t){for(var e={zoom:this.zoom},r=o(t),n=this.prepareArrayGroup("circle",0),i=n.layoutVertexArray.length,a=0;a=s||c<0||c>=s)){var h=this.prepareArrayGroup("circle",4),f=h.layoutVertexArray,d=this.addCircleVertex(f,u,c,-1,-1);this.addCircleVertex(f,u,c,1,-1),this.addCircleVertex(f,u,c,1,1),this.addCircleVertex(f,u,c,-1,1),h.elementArray.emplaceBack(d,d+1,d+2),h.elementArray.emplaceBack(d,d+3,d+2)}}this.populatePaintArrays("circle",e,t.properties,n,i)}},{"../../util/util":403,"../bucket":290,"../load_geometry":298}],292:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=t("earcut"),l=t("../../util/classify_rings"),u=500;e.exports=n,n.prototype=a.inherit(i,{}),n.prototype.programInterfaces={fill:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType(1),elementArrayType2:new i.ElementArrayType(2),paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("fill-color",e,r)},multiplier:255,paintProperty:"fill-color"},{name:"a_outline_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("fill-outline-color",e,r)},multiplier:255,paintProperty:"fill-outline-color"},{name:"a_opacity",components:1,type:"Uint8",getValue:function(t,e,r){return[t.getPaintValue("fill-opacity",e,r)]},multiplier:255,paintProperty:"fill-opacity"}]}},n.prototype.addFeature=function(t){for(var e=o(t),r=l(e,u),n=this.prepareArrayGroup("fill",0),i=n.layoutVertexArray.length,a=0;a0&&a.push(i.length/2);for(var c=0;c=1&&n.elementArray2.emplaceBack(f-1,f),i.push(h.x),i.push(h.y)}}for(var d=s(i,a),p=0;p>6)},n.prototype.programInterfaces={line:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}]),elementArrayType:new i.ElementArrayType}},n.prototype.addFeature=function(t){for(var e=o(t,h),r=0;r2&&t[a-1].equals(t[a-2]);)a--;if(!(t.length<2)){"bevel"===e&&(n=1.05);var o=c*(s/(512*this.overscaling)),l=t[0],h=t[a-1],f=l.equals(h);if(this.prepareArrayGroup("line",10*a),2!==a||!f){this.distance=0;var d,p,g,m,v,y,x,b=r,_=f?"butt":r,w=!0;this.e1=this.e2=this.e3=-1,f&&(d=t[a-2],v=l.sub(d)._unit()._perp());for(var M=0;M0){var S=d.dist(p);if(S>2*o){var L=d.sub(d.sub(p)._mult(o/S)._round());this.distance+=L.dist(p),this.addCurrentVertex(L,this.distance,m.mult(1),0,0,!1),p=L}}var z=p&&g,C=z?e:g?b:_;if(z&&"round"===C&&(Tn&&(C="bevel"),"bevel"===C&&(T>2&&(C="flipbevel"),T100)A=v.clone();else{var I=m.x*v.y-m.y*v.x>0?-1:1,P=T*m.add(v).mag()/m.sub(v).mag();A._perp()._mult(P*I)}this.addCurrentVertex(d,this.distance,A,0,0,!1),this.addCurrentVertex(d,this.distance,A.mult(-1),0,0,!1)}else if("bevel"===C||"fakeround"===C){var D=m.x*v.y-m.y*v.x>0,O=-Math.sqrt(T*T-1);if(D?(x=0,y=O):(y=0,x=O),w||this.addCurrentVertex(d,this.distance,m,y,x,!1),"fakeround"===C){for(var R,F=Math.floor(8*(.5-(k-.5))),j=0;j=0;N--)R=m.mult((N+1)/(F+1))._add(v)._unit(),this.addPieSliceVertex(d,this.distance,R,D)}g&&this.addCurrentVertex(d,this.distance,v,-y,-x,!1)}else"butt"===C?(w||this.addCurrentVertex(d,this.distance,m,0,0,!1),g&&this.addCurrentVertex(d,this.distance,v,0,0,!1)):"square"===C?(w||(this.addCurrentVertex(d,this.distance,m,1,1,!1),this.e1=this.e2=-1),g&&this.addCurrentVertex(d,this.distance,v,-1,-1,!1)):"round"===C&&(w||(this.addCurrentVertex(d,this.distance,m,0,0,!1),this.addCurrentVertex(d,this.distance,m,1,1,!0),this.e1=this.e2=-1),g&&(this.addCurrentVertex(d,this.distance,v,-1,-1,!0),this.addCurrentVertex(d,this.distance,v,0,0,!1)));if(E&&M2*o){var U=d.add(g.sub(d)._mult(o/B)._round());this.distance+=U.dist(d),this.addCurrentVertex(U,this.distance,v.mult(1),0,0,!1),d=U}}w=!1}}}},n.prototype.addCurrentVertex=function(t,e,r,n,i,a){var o,s=a?1:0,l=this.arrayGroups.line[this.arrayGroups.line.length-1],u=l.layoutVertexArray,c=l.elementArray;o=r.clone(),n&&o._sub(r.perp()._mult(n)),this.e3=this.addLineVertex(u,t,o,s,0,n,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,o=r.mult(-1),i&&o._sub(r.perp()._mult(i)),this.e3=this.addLineVertex(u,t,o,s,1,-i,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>d/2&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,n,i,a))},n.prototype.addPieSliceVertex=function(t,e,r,n){var i=n?1:0;r=r.mult(n?-1:1);var a=this.arrayGroups.line[this.arrayGroups.line.length-1],o=a.layoutVertexArray,s=a.elementArray;this.e3=this.addLineVertex(o,t,r,0,i,0,e),this.e1>=0&&this.e2>=0&&s.emplaceBack(this.e1,this.e2,this.e3),n?this.e2=this.e3:this.e1=this.e3}},{"../../util/util":403,"../bucket":290,"../load_geometry":298}],294:[function(t,e,r){"use strict";function n(t){o.apply(this,arguments),this.showCollisionBoxes=t.showCollisionBoxes,this.overscaling=t.overscaling,this.collisionBoxArray=t.collisionBoxArray,this.symbolQuadsArray=t.symbolQuadsArray,this.symbolInstancesArray=t.symbolInstancesArray,this.sdfIcons=t.sdfIcons,this.iconsNeedLinear=t.iconsNeedLinear,this.adjustedTextSize=t.adjustedTextSize,this.adjustedIconSize=t.adjustedIconSize,this.fontstack=t.fontstack}function i(t,e,r,n,i,a,o,s,l,u,c){return t.emplaceBack(e,r,Math.round(64*n),Math.round(64*i),a/4,o/4,10*(u||0),c,10*(s||0),10*Math.min(l||25,25))}var a=t("point-geometry"),o=t("../bucket"),s=t("../../symbol/anchor"),l=t("../../symbol/get_anchors"),u=t("../../util/token"),c=t("../../symbol/quads"),h=t("../../symbol/shaping"),f=t("../../symbol/resolve_text"),d=t("../../symbol/mergelines"),p=t("../../symbol/clip_line"),g=t("../../util/util"),m=t("../load_geometry"),v=t("../../symbol/collision_feature"),y=h.shapeText,x=h.shapeIcon,b=c.getGlyphQuads,_=c.getIconQuads,w=o.EXTENT;e.exports=n,n.MAX_QUADS=65535,n.prototype=g.inherit(o,{}),n.prototype.serialize=function(){var t=o.prototype.serialize.apply(this);return t.sdfIcons=this.sdfIcons,t.iconsNeedLinear=this.iconsNeedLinear,t.adjustedTextSize=this.adjustedTextSize,t.adjustedIconSize=this.adjustedIconSize,t.fontstack=this.fontstack,t};var M=new o.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_offset",components:2,type:"Int16"},{name:"a_texture_pos",components:2,type:"Uint16"},{name:"a_data",components:4,type:"Uint8"}]),A=new o.ElementArrayType;n.prototype.addCollisionBoxVertex=function(t,e,r,n,i){return t.emplaceBack(e.x,e.y,Math.round(r.x),Math.round(r.y),10*n,10*i)},n.prototype.programInterfaces={glyph:{layoutVertexArrayType:M,elementArrayType:A},icon:{layoutVertexArrayType:M,elementArrayType:A},collisionBox:{layoutVertexArrayType:new o.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}])}},n.prototype.populateArrays=function(t,e,r){var n={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",{zoom:18,zoomHistory:n}),this.adjustedTextSize=this.layer.getLayoutValue("text-size",{zoom:this.zoom+1,zoomHistory:n}),this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",{zoom:18,zoomHistory:n}),this.adjustedIconSize=this.layer.getLayoutValue("icon-size",{zoom:this.zoom+1,zoomHistory:n});var i=512*this.overscaling;this.tilePixelRatio=w/i,this.compareText={},this.iconsNeedLinear=!1,this.symbolInstancesStartIndex=this.symbolInstancesArray.length;var a=this.layer.layout,o=this.features,s=this.textFeatures,l=.5,c=.5;switch(a["text-anchor"]){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(a["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":c=1;break;case"top":case"top-right":case"top-left":c=0}for(var h="right"===a["text-justify"]?1:"left"===a["text-justify"]?0:.5,f=24,p=a["text-line-height"]*f,v="line"!==a["symbol-placement"]?a["text-max-width"]*f:0,b=a["text-letter-spacing"]*f,_=[a["text-offset"][0]*f,a["text-offset"][1]*f],M=this.fontstack=a["text-font"].join(","),A=[],k=0;kw||z.y<0||z.y>w);if(!g||C){var I=C||_;this.addSymbolInstance(z,E,e,r,this.layer,I,this.symbolInstancesArray.length,this.collisionBoxArray,n.index,this.sourceLayerIndex,this.index,c,m,x,f,v,b,{zoom:this.zoom},n.properties)}}}}},n.prototype.anchorIsTooClose=function(t,e,r){var n=this.compareText;if(t in n){for(var i=n[t],a=i.length-1;a>=0;a--)if(r.dist(i[a])3*Math.PI/2))){var m=p.tl,v=p.tr,y=p.bl,x=p.br,b=p.tex,_=p.anchorPoint,w=Math.max(h+Math.log(p.minScale)/Math.LN2,f),M=Math.min(h+Math.log(p.maxScale)/Math.LN2,25);if(!(M<=w)){w===f&&(w=0);var A=Math.round(p.glyphAngle/(2*Math.PI)*256),k=i(c,_.x,_.y,m.x,m.y,b.x,b.y,w,M,f,A);i(c,_.x,_.y,v.x,v.y,b.x+b.w,b.y,w,M,f,A),i(c,_.x,_.y,y.x,y.y,b.x,b.y+b.h,w,M,f,A),i(c,_.x,_.y,x.x,x.y,b.x+b.w,b.y+b.h,w,M,f,A),u.emplaceBack(k,k+1,k+2),u.emplaceBack(k+1,k+2,k+3)}}}},n.prototype.updateIcons=function(t){this.recalculateStyleLayers();var e=this.layer.layout["icon-image"];if(e)for(var r=0;rn.MAX_QUADS&&g.warnOnce("Too many symbols being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),k>n.MAX_QUADS&&g.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),this.symbolInstancesArray.emplaceBack(P,D,O,R,A,k,T,E,t.x,t.y,s)},n.prototype.addSymbolQuad=function(t){return this.symbolQuadsArray.emplaceBack(t.anchorPoint.x,t.anchorPoint.y,t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y,t.tex.h,t.tex.w,t.tex.x,t.tex.y,t.anchorAngle,t.glyphAngle,t.maxScale,t.minScale)}},{"../../symbol/anchor":352,"../../symbol/clip_line":354,"../../symbol/collision_feature":356,"../../symbol/get_anchors":358,"../../symbol/mergelines":361,"../../symbol/quads":362,"../../symbol/resolve_text":363,"../../symbol/shaping":364,"../../util/token":402,"../../util/util":403,"../bucket":290,"../load_geometry":298,"point-geometry":442}],295:[function(t,e,r){"use strict";function n(t,e,r){this.arrayBuffer=t.arrayBuffer, +this.length=t.length,this.attributes=e.members,this.itemSize=e.bytesPerElement,this.type=r,this.arrayType=e}e.exports=n,n.prototype.bind=function(t){var e=t[this.type];this.buffer?t.bindBuffer(e,this.buffer):(this.buffer=t.createBuffer(),t.bindBuffer(e,this.buffer),t.bufferData(e,this.arrayBuffer,t.STATIC_DRAW),this.arrayBuffer=null)};var i={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT"};n.prototype.setVertexAttribPointers=function(t,e){for(var r=0;r0?t["line-gap-width"]+2*t["line-width"]:t["line-width"]}function s(t,e,r,n,i){if(!e[0]&&!e[1])return t;e=u.convert(e),"viewport"===r&&e._rotate(-n);for(var a=[],o=0;or.max||f.yr.max)&&i.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return l}},{"../util/util":403,"./bucket":290,assert:34}],299:[function(t,e,r){"use strict";function n(t,e,r){this.column=t,this.row=e,this.zoom=r}e.exports=n,n.prototype={clone:function(){return new n(this.column,this.row,this.zoom)},zoomTo:function(t){return this.clone()._zoomTo(t)},sub:function(t){return this.clone()._sub(t)},_zoomTo:function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},_sub:function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this}}},{}],300:[function(t,e,r){"use strict";function n(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}e.exports=n;var i=t("../util/util").wrap;n.prototype.wrap=function(){return new n(i(this.lng,-180,180),this.lat)},n.prototype.toArray=function(){return[this.lng,this.lat]},n.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{"../util/util":403}],301:[function(t,e,r){"use strict";function n(t,e){t&&(e?this.extend(t).extend(e):4===t.length?this.extend([t[0],t[1]]).extend([t[2],t[3]]):this.extend(t[0]).extend(t[1]))}e.exports=n;var i=t("./lng_lat");n.prototype={extend:function(t){var e,r,a=this._sw,o=this._ne;if(t instanceof i)e=t,r=t;else{if(!(t instanceof n))return t?this.extend(i.convert(t)||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 i(e.lng,e.lat),this._ne=new i(r.lng,r.lat)),this},getCenter:function(){return new i((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},getSouthWest:function(){return this._sw},getNorthEast:function(){return this._ne},getNorthWest:function(){return new i(this.getWest(),this.getNorth())},getSouthEast:function(){return new i(this.getEast(),this.getSouth())},getWest:function(){return this._sw.lng},getSouth:function(){return this._sw.lat},getEast:function(){return this._ne.lng},getNorth:function(){return this._ne.lat},toArray:function(){return[this._sw.toArray(),this._ne.toArray()]},toString:function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"}},n.convert=function(t){return!t||t instanceof n?t:new n(t)}},{"./lng_lat":300}],302:[function(t,e,r){"use strict";function n(t,e){this.tileSize=512,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new i(0,0),this.zoom=0,this.angle=0,this._altitude=1.5,this._pitch=0,this._unmodified=!0}var i=t("./lng_lat"),a=t("point-geometry"),o=t("./coordinate"),s=t("../util/util").wrap,l=t("../util/interpolate"),u=t("../source/tile_coord"),c=t("../data/bucket").EXTENT,h=t("gl-matrix"),f=h.vec4,d=h.mat4,p=h.mat2;e.exports=n,n.prototype={get minZoom(){return this._minZoom},set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},get maxZoom(){return this._maxZoom},set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},get worldSize(){return this.tileSize*this.scale},get centerPoint(){return this.size._div(2)},get size(){return new a(this.width,this.height)},get bearing(){return-this.angle/Math.PI*180},set bearing(t){var e=-s(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcMatrices(),this.rotationMatrix=p.create(),p.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},get pitch(){return this._pitch/Math.PI*180},set pitch(t){var e=Math.min(60,t)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcMatrices())},get altitude(){return this._altitude},set altitude(t){var e=Math.max(.75,t);this._altitude!==e&&(this._unmodified=!1,this._altitude=e,this._calcMatrices())},get zoom(){return this._zoom},set zoom(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._calcMatrices(),this._constrain())},get center(){return this._center},set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._calcMatrices(),this._constrain())},coveringZoomLevel:function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},coveringTiles:function(t){var e=this.coveringZoomLevel(t),r=e;if(et.maxzoom&&(e=t.maxzoom);var n=this,i=n.locationCoordinate(n.center)._zoomTo(e),o=new a(i.column-.5,i.row-.5);return u.cover(e,[n.pointCoordinate(new a(0,0))._zoomTo(e),n.pointCoordinate(new a(n.width,0))._zoomTo(e),n.pointCoordinate(new a(n.width,n.height))._zoomTo(e),n.pointCoordinate(new a(0,n.height))._zoomTo(e)],t.reparseOverscaled?r:e).sort(function(t,e){return o.dist(t)-o.dist(e)})},resize:function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._calcMatrices(),this._constrain()},get unmodified(){return this._unmodified},zoomScale:function(t){return Math.pow(2,t)},scaleZoom:function(t){return Math.log(t)/Math.LN2},project:function(t,e){return new a(this.lngX(t.lng,e),this.latY(t.lat,e))},unproject:function(t,e){return new i(this.xLng(t.x,e),this.yLat(t.y,e))},get x(){return this.lngX(this.center.lng)},get y(){return this.latY(this.center.lat)},get point(){return new a(this.x,this.y)},lngX:function(t,e){return(180+t)*(e||this.worldSize)/360},latY:function(t,e){var r=180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360));return(180-r)*(e||this.worldSize)/360},xLng:function(t,e){return 360*t/(e||this.worldSize)-180},yLat:function(t,e){var r=180-360*t/(e||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90},panBy:function(t){var e=this.centerPoint._add(t);this.center=this.pointLocation(e)},setLocationAtPoint:function(t,e){var r=this.locationCoordinate(t),n=this.pointCoordinate(e),i=this.pointCoordinate(this.centerPoint),a=n._sub(r);this._unmodified=!1,this.center=this.coordinateLocation(i._sub(a))},locationPoint:function(t){return this.coordinatePoint(this.locationCoordinate(t))},pointLocation:function(t){return this.coordinateLocation(this.pointCoordinate(t))},locationCoordinate:function(t){var e=this.zoomScale(this.tileZoom)/this.worldSize,r=i.convert(t);return new o(this.lngX(r.lng)*e,this.latY(r.lat)*e,this.tileZoom)},coordinateLocation:function(t){var e=this.zoomScale(t.zoom);return new i(this.xLng(t.column,e),this.yLat(t.row,e))},pointCoordinate:function(t){var e=0,r=[t.x,t.y,0,1],n=[t.x,t.y,1,1];f.transformMat4(r,r,this.pixelMatrixInverse),f.transformMat4(n,n,this.pixelMatrixInverse);var i=r[3],a=n[3],s=r[0]/i,u=n[0]/a,c=r[1]/i,h=n[1]/a,d=r[2]/i,p=n[2]/a,g=d===p?0:(e-d)/(p-d),m=this.worldSize/this.zoomScale(this.tileZoom);return new o(l(s,u,g)/m,l(c,h,g)/m,this.tileZoom)},coordinatePoint:function(t){var e=this.worldSize/this.zoomScale(t.zoom),r=[t.column*e,t.row*e,0,1];return f.transformMat4(r,r,this.pixelMatrix),new a(r[0]/r[3],r[1]/r[3])},calculatePosMatrix:function(t,e){void 0===e&&(e=1/0),t instanceof u&&(t=t.toCoordinate(e));var r=Math.min(t.zoom,e),n=this.worldSize/Math.pow(2,r),i=new Float64Array(16);return d.identity(i),d.translate(i,i,[t.column*n,t.row*n,0]),d.scale(i,i,[n/c,n/c,1]),d.multiply(i,this.projMatrix,i),new Float32Array(i)},_constrain:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,e,r,n,i,o,s,l,u=this.size,c=this._unmodified;this.latRange&&(t=this.latY(this.latRange[1]),e=this.latY(this.latRange[0]),i=e-te&&(l=e-d)}if(this.lngRange){var p=this.x,g=u.x/2;p-gn&&(s=n-g)}void 0===s&&void 0===l||(this.center=this.unproject(new a(void 0!==s?s:this.x,void 0!==l?l:this.y))),this._unmodified=c,this._constraining=!1}},_calcMatrices:function(){if(this.height){var t=Math.atan(.5/this.altitude),e=Math.sin(t)*this.altitude/Math.sin(Math.PI/2-this._pitch-t),r=Math.cos(Math.PI/2-this._pitch)*e+this.altitude,n=new Float64Array(16);if(d.perspective(n,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,r),d.translate(n,n,[0,0,-this.altitude]),d.scale(n,n,[1,-1,1/this.height]),d.rotateX(n,n,this._pitch),d.rotateZ(n,n,this.angle),d.translate(n,n,[-this.x,-this.y,0]),this.projMatrix=n,n=d.create(),d.scale(n,n,[this.width/2,-this.height/2,1]),d.translate(n,n,[1,-1,0]),this.pixelMatrix=d.multiply(new Float64Array(16),n,this.projMatrix),n=d.invert(new Float64Array(16),this.pixelMatrix),!n)throw new Error("failed to invert matrix");this.pixelMatrixInverse=n}}}},{"../data/bucket":290,"../source/tile_coord":330,"../util/interpolate":397,"../util/util":403,"./coordinate":299,"./lng_lat":300,"gl-matrix":161,"point-geometry":442}],303:[function(t,e,r){"use strict";var n={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,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]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[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]]};e.exports=function(t,e,r,i){i=i||1;var a,o,s,l,u,c,h,f,d=[];for(a=0,o=t.length;a>16,_>>16),s.uniform2f(n.u_pixel_coord_lower,65535&b,65535&_)}s.uniformMatrix4fv(n.u_matrix,!1,t.transform.calculatePosMatrix(v)),s.drawArrays(s.TRIANGLE_STRIP,0,t.tileExtentBuffer.length)}s.stencilMask(0),s.stencilFunc(s.EQUAL,128,128)}var i=t("../source/pixels_to_tile_units"),a=t("./create_uniform_pragmas"),o=512;e.exports=n},{"../source/pixels_to_tile_units":324,"./create_uniform_pragmas":305}],307:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var a=t.gl;t.setDepthSublayer(0),t.depthMask(!1),a.disable(a.STENCIL_TEST);for(var o=0;o>16,f>>16),o.uniform2f(a.u_pixel_coord_lower,65535&h,65535&f),o.activeTexture(o.TEXTURE0),i.spriteAtlas.bind(o,!0)}}var s=t("../source/pixels_to_tile_units");e.exports=n},{"../source/pixels_to_tile_units":324}],311:[function(t,e,r){"use strict";var n=t("../util/browser"),i=t("gl-matrix").mat2,a=t("../source/pixels_to_tile_units");e.exports=function(t,e,r,o){if(!t.isOpaquePass){t.setDepthSublayer(0),t.depthMask(!1);var s=t.gl;if(s.enable(s.STENCIL_TEST),!(r.paint["line-width"]<=0)){var l=1/n.devicePixelRatio,u=r.paint["line-blur"]+l,c=r.paint["line-color"],h=t.transform,f=i.create();i.scale(f,f,[1,Math.cos(h._pitch)]),i.rotate(f,f,t.transform.angle);var d,p,g,m,v,y=Math.sqrt(h.height*h.height/4*(1+h.altitude*h.altitude)),x=h.height/2*Math.tan(h._pitch),b=(y+x)/y-1,_=r.paint["line-dasharray"],w=r.paint["line-pattern"];if(_)d=t.useProgram("linesdfpattern"),s.uniform1f(d.u_linewidth,r.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform4fv(d.u_color,c),s.uniform1f(d.u_opacity,r.paint["line-opacity"]),p=t.lineAtlas.getDash(_.from,"round"===r.layout["line-cap"]),g=t.lineAtlas.getDash(_.to,"round"===r.layout["line-cap"]),s.uniform1i(d.u_image,0),s.activeTexture(s.TEXTURE0),t.lineAtlas.bind(s),s.uniform1f(d.u_tex_y_a,p.y),s.uniform1f(d.u_tex_y_b,g.y),s.uniform1f(d.u_mix,_.t),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,f);else if(w){if(m=t.spriteAtlas.getPosition(w.from,!0),v=t.spriteAtlas.getPosition(w.to,!0),!m||!v)return;d=t.useProgram("linepattern"),s.uniform1i(d.u_image,0),s.activeTexture(s.TEXTURE0),t.spriteAtlas.bind(s,!0),s.uniform1f(d.u_linewidth,r.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform2fv(d.u_pattern_tl_a,m.tl),s.uniform2fv(d.u_pattern_br_a,m.br),s.uniform2fv(d.u_pattern_tl_b,v.tl),s.uniform2fv(d.u_pattern_br_b,v.br),s.uniform1f(d.u_fade,w.t),s.uniform1f(d.u_opacity,r.paint["line-opacity"]),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,f)}else d=t.useProgram("line"),s.uniform1f(d.u_linewidth,r.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,u),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,f),s.uniform4fv(d.u_color,c),s.uniform1f(d.u_opacity,r.paint["line-opacity"]);for(var M=0;M0?1/(1-t):1+t}function s(t){return t>0?1-1/(1.001-t):-t}function l(t,e,r,n){var i=[1,0],a=r.paint["raster-fade-duration"];if(t.source&&a>0){var o=(new Date).getTime(),s=(o-t.timeAdded)/a,l=e?(o-e.timeAdded)/a:-1,c=n.coveringZoomLevel(t.source),h=!!e&&Math.abs(e.coord.z-c)>Math.abs(t.coord.z-c);!e||h?(i[0]=u.clamp(s,0,1),i[1]=1-i[0]):(i[0]=u.clamp(1-l,0,1),i[1]=1-i[0])}var f=r.paint["raster-opacity"];return i[0]*=f,i[1]*=f,i}var u=t("../util/util"),c=t("../util/struct_array");e.exports=n,n.RasterBoundsArray=new c({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]})},{"../util/struct_array":401,"../util/util":403}],313:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var a=!(r.layout["text-allow-overlap"]||r.layout["icon-allow-overlap"]||r.layout["text-ignore-placement"]||r.layout["icon-ignore-placement"]),o=t.gl;a?o.disable(o.STENCIL_TEST):o.enable(o.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),o.disable(o.DEPTH_TEST),i(t,e,r,n,!1,r.paint["icon-translate"],r.paint["icon-translate-anchor"],r.layout["icon-rotation-alignment"],r.layout["icon-rotation-alignment"],r.layout["icon-size"],r.paint["icon-halo-width"],r.paint["icon-halo-color"],r.paint["icon-halo-blur"],r.paint["icon-opacity"],r.paint["icon-color"]),i(t,e,r,n,!0,r.paint["text-translate"],r.paint["text-translate-anchor"],r.layout["text-rotation-alignment"],r.layout["text-pitch-alignment"],r.layout["text-size"],r.paint["text-halo-width"],r.paint["text-halo-color"],r.paint["text-halo-blur"],r.paint["text-opacity"],r.paint["text-color"]),o.enable(o.DEPTH_TEST),e.map.showCollisionBoxes&&s(t,e,r,n)}}function i(t,e,r,n,i,o,s,l,u,c,h,f,d,p,g){for(var m=0;mthis.previousZoom;r--)this.changeTimes[r]=e,this.changeOpacities[r]=this.opacities[r];for(r=0;r<256;r++){var n=e-this.changeTimes[r],i=n/this.fadeDuration*255;r<=t?this.opacities[r]=this.changeOpacities[r]+i:this.opacities[r]=this.changeOpacities[r]-i}this.changed=!0,this.previousZoom=t},n.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.changed&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,256,1,t.ALPHA,t.UNSIGNED_BYTE,this.array),this.changed=!1)):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,256,1,0,t.ALPHA,t.UNSIGNED_BYTE,this.array))}},{}],315:[function(t,e,r){"use strict";function n(t,e){this.width=t,this.height=e,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}}var i=t("../util/util");e.exports=n,n.prototype.setSprite=function(t){this.sprite=t},n.prototype.getDash=function(t,e){var r=t.join(",")+e;return this.positions[r]||(this.positions[r]=this.addDash(t,e)),this.positions[r]},n.prototype.addDash=function(t,e){var r=e?7:0,n=2*r+1,a=128;if(this.nextRow+n>this.height)return i.warnOnce("LineAtlas out of space"),null;for(var o=0,s=0;s0?e.pop():null},n.prototype.lineWidth=function(t){this.gl.lineWidth(c.clamp(t,this.lineWidthRange[0],this.lineWidthRange[1]))},n.prototype.showOverdrawInspector=function(t){if(t||this._showOverdrawInspector){this._showOverdrawInspector=t;var e=this.gl;if(t){e.blendFunc(e.CONSTANT_COLOR,e.ONE);var r=8,n=1/r;e.blendColor(n,n,n,0),e.clearColor(0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)}else e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}}},{"../data/bucket":290,"../data/buffer":295,"../source/pixels_to_tile_units":324,"../source/source_cache":328,"../util/browser":387,"../util/struct_array":401,"../util/util":403,"./create_uniform_pragmas":305,"./draw_background":306,"./draw_circle":307,"./draw_debug":309,"./draw_fill":310,"./draw_line":311,"./draw_raster":312,"./draw_symbol":313,"./frame_history":314,"./painter/use_program":317,"./vertex_array_object":318,"gl-matrix":161}],317:[function(t,e,r){"use strict";function n(t,e){return t.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,function(t,r,n,i,a){return e[r][a].replace(/{type}/g,i).replace(/{precision}/g,n)})}var i=t("assert"),a=t("../../util/util"),o=t("mapbox-gl-shaders"),s=o.util;e.exports._createProgram=function(t,e,r,l){for(var u=this.gl,c=u.createProgram(),h=o[t],f="#define MAPBOX_GL_JS;\n",d=0;dthis.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,n={type:this.type,uid:t.uid,coord:t.coord,zoom:t.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:r,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send("load tile",n,function(r,n){if(t.unloadVectorData(this.map.painter),!t.aborted)return r?e(r):(t.loadVectorData(n,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),e(null))}.bind(this),this.workerID)},abortTile:function(t){t.aborted=!0},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},function(){},t.workerID)},serialize:function(){return{type:this.type,data:this._data}}})},{"../data/bucket":290,"../util/evented":395,"../util/util":403,"resolve-url":458}],320:[function(t,e,r){"use strict";function n(t,e,r){r&&(this.loadGeoJSON=r),h.call(this,t,e)}var i=t("../util/util"),a=t("../util/ajax"),o=t("geojson-rewind"),s=t("./geojson_wrapper"),l=t("vt-pbf"),u=t("supercluster"),c=t("geojson-vt"),h=t("./vector_tile_worker_source");e.exports=n,n.prototype=i.inherit(h,{_geoJSONIndexes:{},loadVectorData:function(t,e){var r=t.source,n=t.coord;if(!this._geoJSONIndexes[r])return e(null,null);var i=this._geoJSONIndexes[r].getTile(Math.min(n.z,t.maxZoom),n.x,n.y);if(!i)return e(null,null);var a=new s(i.features);a.name="_geojsonTileLayer";var o=l({layers:{_geojsonTileLayer:a}});0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{tile:a,rawTileData:o.buffer})},loadData:function(t,e){var r=function(r,n){return r?e(r):"object"!=typeof n?e(new Error("Input data is not a valid GeoJSON object.")):(o(n,!0),void this._indexData(n,t,function(r,n){return r?e(r):(this._geoJSONIndexes[t.source]=n,void e(null))}.bind(this)))}.bind(this);this.loadGeoJSON(t,r)},loadGeoJSON:function(t,e){if(t.url)a.getJSON(t.url,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."))}}},_indexData:function(t,e,r){try{e.cluster?r(null,u(e.superclusterOptions).load(t.features)):r(null,c(t,e.geojsonVtOptions))}catch(t){return r(t)}}})},{"../util/ajax":386,"../util/util":403,"./geojson_wrapper":321,"./vector_tile_worker_source":332,"geojson-rewind":110,"geojson-vt":114,supercluster:485,"vt-pbf":511}],321:[function(t,e,r){"use strict";function n(t){this.features=t,this.length=t.length,this.extent=s}function i(t){if(this.type=t.type,1===t.type){this.rawGeometry=[];for(var e=0;ee)){var o=Math.pow(2,Math.min(a.coord.z,this.maxzoom)-Math.min(t.z,this.maxzoom));if(Math.floor(a.coord.x/o)===t.x&&Math.floor(a.coord.y/o)===t.y)for(r[i]=!0,n=!0;a&&a.coord.z-1>t.z;){var s=a.coord.parent(this.maxzoom).id;a=this._tiles[s],a&&a.isRenderable()&&(delete r[i],r[s]=!0)}}}return n},findLoadedParent:function(t,e,r){for(var n=t.z-1;n>=e;n--){t=t.parent(this.maxzoom);var i=this._tiles[t.id];if(i&&i.isRenderable())return r[t.id]=!0,i;if(this._cache.has(t.id))return this.addTile(t),r[t.id]=!0,this._tiles[t.id]}},updateCacheSize:function(t){var e=Math.ceil(t.width/t.tileSize)+1,r=Math.ceil(t.height/t.tileSize)+1,n=e*r,i=5;this._cache.setMaxSize(Math.floor(n*i))},update:function(t,e){if(this._sourceLoaded){var r,i,a;this.updateCacheSize(t);var o=(this.roundZoom?Math.round:Math.floor)(this.getZoom(t)),s=Math.max(o-n.maxOverzooming,this.minzoom),l=Math.max(o+n.maxUnderzooming,this.minzoom),c={},h=(new Date).getTime();this._coveredTiles={};var d=this.used?t.coveringTiles(this._source):[];for(r=0;rh-(e||0)&&(this.findLoadedChildren(i,l,c)&&(c[v]=!0),this.findLoadedParent(i,s,p))}var y;for(y in p)c[y]||(this._coveredTiles[y]=!0);for(y in p)c[y]=!0;var x=f.keysDifference(this._tiles,c);for(r=0;rthis.maxzoom?Math.pow(2,n-this.maxzoom):1;e=new s(r,this.tileSize*i,this.maxzoom),this.loadTile(e,this._tileLoaded.bind(this,e))}return e.uses++,this._tiles[t.id]=e,this.fire("tile.add",{tile:e}),this._source.fire("tile.add",{tile:e}),e},removeTile:function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this.fire("tile.remove",{tile:e}),this._source.fire("tile.remove",{tile:e}),e.uses>0||(e.isRenderable()?this._cache.add(e.coord.wrapped().id,e):(e.aborted=!0,this.abortTile(e),this.unloadTile(e))))},clearTiles:function(){for(var t in this._tiles)this.removeTile(t);this._cache.reset()},tilesIn:function(t){for(var e={},r=this.getIds(),n=1/0,a=1/0,o=-(1/0),s=-(1/0),l=t[0].zoom,c=0;c=0&&v[1].y>=0){for(var y=[],x=0;x=0&&t%1===0),l(!isNaN(e)&&e>=0&&e%1===0),l(!isNaN(r)&&r>=0&&r%1===0),isNaN(n)&&(n=0),this.z=+t,this.x=+e,this.y=+r,this.w=+n,n*=2,n<0&&(n=n*-1-1);var i=1<0;a--)n=1<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 o(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,h=e.dx<0,f=a;fc.dy&&(l=u,u=c,c=l),u.dy>h.dy&&(l=u,u=h,h=l),c.dy>h.dy&&(l=c,c=h,h=l),u.dy&&o(h,u,n,i,s),c.dy&&o(h,c,n,i,s)}var l=t("assert"),u=t("whoots-js"),c=t("../geo/coordinate");e.exports=n,n.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y},n.prototype.toCoordinate=function(t){var e=Math.min(this.z,t),r=Math.pow(2,e),n=this.y,i=this.x+r*this.w;return new c(i,n,e)},n.fromID=function(t){var e=t%32,r=1<t?new n(this.z-1,this.x,this.y,this.w):new n(this.z-1,Math.floor(this.x/2),Math.floor(this.y/2),this.w)},n.prototype.wrapped=function(){return new n(this.z,this.x,this.y,0)},n.prototype.children=function(t){if(this.z>=t)return[new n(this.z+1,this.x,this.y,this.w)];var e=this.z+1,r=2*this.x,i=2*this.y;return[new n(e,r,i,this.w),new n(e,r+1,i,this.w),new n(e,r,i+1,this.w),new n(e,r+1,i+1,this.w)]},n.cover=function(t,e,r){function i(t,e,i){var s,l,u;if(i>=0&&i<=a)for(s=t;sthis.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,i={url:s(t.coord.url(this.tiles,this.maxzoom,this.scheme),this.url),uid:t.uid,coord:t.coord,zoom:t.coord.z,tileSize:this.tileSize*n,source:this.id,overscaling:n,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID?"loading"===t.state?t.reloadCallback=e:(i.rawTileData=t.rawTileData,this.dispatcher.send("reload tile",i,r.bind(this),t.workerID)):t.workerID=this.dispatcher.send("load tile",i,r.bind(this))},abortTile:function(t){this.dispatcher.send("abort tile",{uid:t.uid,source:this.id},null,t.workerID)},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)}})},{"../util/evented":395,"../util/mapbox":400,"../util/util":403,"./load_tilejson":323}],332:[function(t,e,r){"use strict";function n(t,e,r){this.actor=t,this.styleLayers=e,r&&(this.loadVectorData=r),this.loading={},this.loaded={}}var i=t("../util/ajax"),a=t("vector-tile"),o=t("pbf"),s=t("./worker_tile");e.exports=n,n.prototype={loadTile:function(t,e){function r(t,r){return delete this.loading[n][i],t?e(t):r?(a.data=r.tile,a.parse(a.data,this.styleLayers.getLayerFamilies(),this.actor,r.rawTileData,e),this.loaded[n]=this.loaded[n]||{},void(this.loaded[n][i]=a)):e(null,null)}var n=t.source,i=t.uid;this.loading[n]||(this.loading[n]={});var a=this.loading[n][i]=new s(t);a.abort=this.loadVectorData(t,r.bind(this))},reloadTile:function(t,e){var r=this.loaded[t.source],n=t.uid;if(r&&r[n]){var i=r[n];i.parse(i.data,this.styleLayers.getLayerFamilies(),this.actor,t.rawTileData,e)}},abortTile:function(t){var e=this.loading[t.source],r=t.uid;e&&e[r]&&e[r].abort&&(e[r].abort(),delete e[r])},removeTile:function(t){var e=this.loaded[t.source],r=t.uid;e&&e[r]&&delete e[r]},loadVectorData:function(t,e){function r(t,r){if(t)return e(t);var n=new a.VectorTile(new o(new Uint8Array(r)));e(t,{tile:n,rawTileData:r})}var n=i.getArrayBuffer(t.url,r.bind(this));return function(){n.abort()}},redoPlacement:function(t,e){var r=this.loaded[t.source],n=this.loading[t.source],i=t.uid;if(r&&r[i]){var a=r[i],o=a.redoPlacement(t.angle,t.pitch,t.showCollisionBoxes);o.result&&e(null,o.result,o.transferables)}else n&&n[i]&&(n[i].angle=t.angle)}}},{"../util/ajax":386,"./worker_tile":335,pbf:436,"vector-tile":505}],333:[function(t,e,r){"use strict";function n(t,e){this.id=t,this.urls=e.urls,this.coordinates=e.coordinates,u.getVideo(e.urls,function(t,r){if(t)return this.fire("error",{error:t});this.video=r,this.video.loop=!0;var n;this.video.addEventListener("playing",function(){n=this.map.style.animationLoop.set(1/0),this.map._rerender()}.bind(this)),this.video.addEventListener("pause",function(){this.map.style.animationLoop.cancel(n)}.bind(this)),this.map&&(this.video.play(),this.setCoordinates(e.coordinates)),this.fire("load")}.bind(this))}var i=t("../util/util"),a=t("./tile_coord"),o=t("../geo/lng_lat"),s=t("point-geometry"),l=t("../util/evented"),u=t("../util/ajax"),c=t("../data/bucket").EXTENT,h=t("../render/draw_raster").RasterBoundsArray,f=t("../data/buffer"),d=t("../render/vertex_array_object");e.exports=n,n.prototype=i.inherit(l,{minzoom:0,maxzoom:22,tileSize:512,roundZoom:!0,getVideo:function(){return this.video},onAdd:function(t){this.map||(this.map=t,this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},setCoordinates:function(t){this.coordinates=t;var e=this.map,r=t.map(function(t){return e.transform.locationCoordinate(o.convert(t)).zoomTo(0)}),n=this.centerCoord=i.getCoordinatesCenter(r);return n.column=Math.round(n.column),n.row=Math.round(n.row),this.minzoom=this.maxzoom=n.zoom,this._coord=new a(n.zoom,n.column,n.row),this._tileCoords=r.map(function(t){var e=t.zoomTo(n.zoom);return new s(Math.round((e.column-n.column)*c),Math.round((e.row-n.row)*c))}),this.fire("change"),this},_setTile:function(t){this._prepared=!1,this.tile=t;var e=32767,r=new h;r.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),r.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,e,0),r.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,e),r.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,e,e),this.tile.buckets={},this.tile.boundsBuffer=new f(r.serialize(),h.serialize(),f.BufferType.VERTEX),this.tile.boundsVAO=new d,this.tile.state="loaded"},prepare:function(){if(!(this.video.readyState<2)&&this.tile){var t=this.map.painter.gl;this._prepared?(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this._prepared=!0,this.tile.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.video)),this._currentTime=this.video.currentTime}},loadTile:function(t,e){this._coord&&this._coord.toString()===t.coord.toString()?(this._setTile(t),e(null)):(t.state="errored",e(null))},serialize:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}})},{"../data/bucket":290,"../data/buffer":295,"../geo/lng_lat":300,"../render/draw_raster":312,"../render/vertex_array_object":318,"../util/ajax":386,"../util/evented":395,"../util/util":403,"./tile_coord":330,"point-geometry":442}],334:[function(t,e,r){"use strict";function n(t){this.self=t,this.actor=new a(t,this);var e={getLayers:function(){return this.layers}.bind(this),getLayerFamilies:function(){return this.layerFamilies}.bind(this)};this.workerSources={vector:new l(this.actor,e),geojson:new u(this.actor,e)},this.self.registerWorkerSource=function(t,r){if(this.workerSources[t])throw new Error('Worker source with name "'+t+'" already registered.');this.workerSources[t]=new r(this.actor,e)}.bind(this)}function i(t){var e={};for(var r in t){var n=t[r],i=n.ref||n.id,a=t[i];a.layout&&"none"===a.layout.visibility||(e[i]=e[i]||[],r===i?e[i].unshift(n):e[i].push(n))}return e}var a=t("../util/actor"),o=t("../style/style_layer"),s=t("../util/util"),l=t("./vector_tile_worker_source"),u=t("./geojson_worker_source");e.exports=function(t){return new n(t)},s.extend(n.prototype,{"set layers":function(t){function e(t){var e=o.create(t,t.ref&&r.layers[t.ref]);e.updatePaintTransitions({},{transition:!1}),r.layers[e.id]=e}this.layers={};for(var r=this,n=[],a=0;a=0;e--)x(S,D[e]);b()}}function x(t,e){if(e.populateArrays(k,j,F),"symbol"!==e.type)for(var r=0;r=w.maxzoom||w.layout&&"none"===w.layout.visibility||t.layers&&!t.layers[w.sourceLayer]||(A=c.create({layer:w,index:C++,childLayers:e[I],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,symbolQuadsArray:this.symbolQuadsArray,symbolInstancesArray:this.symbolInstancesArray,sourceLayerIndex:E.encode(w.sourceLayer||"_geojsonTileLayer")}),A.createFilter(),L[w.id]=A,t.layers&&(M=w.sourceLayer,z[M]=z[M]||{},z[M][w.id]=A)));if(t.layers)for(M in z)1===w.version&&d.warnOnce('Vector tile source "'+this.source+'" layer "'+M+'" does not use vector tile spec v2 and therefore may have some rendering errors.'),w=t.layers[M],w&&v(w,z[M]);else v(t,L);var P=[],D=this.symbolBuckets=[],O=[];T.bucketLayerIDs={};for(var R in L)A=L[R],0!==A.features.length&&(T.bucketLayerIDs[A.index]=A.childLayers.map(s),P.push(A),"symbol"===A.type?D.push(A):O.push(A));var F={},j={},N=0;if(D.length>0){for(_=D.length-1;_>=0;_--)D[_].updateIcons(F),D[_].updateFont(j);for(var B in j)j[B]=Object.keys(j[B]).map(Number);F=Object.keys(F),r.send("get glyphs",{uid:this.uid,stacks:j},function(t,e){j=e,y(t)}),F.length?r.send("get icons",{icons:F},function(t,e){F=e,y(t)}):y()}for(_=O.length-1;_>=0;_--)x(this,O[_]);if(0===D.length)return b()},n.prototype.redoPlacement=function(t,e,r){if("done"!==this.status)return this.redoPlacementAfterDone=!0,this.angle=t,{};for(var n=new u(t,e,this.collisionBoxArray),s=this.symbolBuckets,l=s.length-1;l>=0;l--)s[l].placeFeatures(n,r);var c=n.serialize(),h=s.filter(i);return{result:{buckets:h.map(a),collisionTile:c.data},transferables:o(h).concat(c.transferables)}}},{"../data/bucket":290,"../data/feature_index":297,"../symbol/collision_box":355,"../symbol/collision_tile":357,"../symbol/symbol_instances":366,"../symbol/symbol_quads":367,"../util/dictionary_coder":393,"../util/util":403}],336:[function(t,e,r){"use strict";function n(){this.n=0,this.times=[]}e.exports=n,n.prototype.stopped=function(){return this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()}),!this.times.length},n.prototype.set=function(t){return this.times.push({id:this.n,time:t+(new Date).getTime()}),this.n++},n.prototype.cancel=function(t){this.times=this.times.filter(function(e){return e.id!==t})}},{}],337:[function(t,e,r){"use strict";function n(t){this.base=t,this.retina=s.devicePixelRatio>1;var e=this.retina?"@2x":"";o.getJSON(l(t,e,".json"),function(t,e){return t?void this.fire("error",{error:t}):(this.data=e,void(this.img&&this.fire("load")))}.bind(this)),o.getImage(l(t,e,".png"),function(t,e){if(t)return void this.fire("error",{error:t});for(var r=e.getData(),n=e.data=new Uint8Array(r.length),i=0;i1!==this.retina){var t=new n(this.base);t.on("load",function(){this.img=t.img,this.data=t.data,this.retina=t.retina}.bind(this))}},i.prototype={x:0,y:0,width:0,height:0,pixelRatio:1,sdf:!1},n.prototype.getSpritePosition=function(t){if(!this.loaded())return new i;var e=this.data&&this.data[t];return e&&this.img?e:new i}},{"../util/ajax":386,"../util/browser":387,"../util/evented":395,"../util/mapbox":400}],338:[function(t,e,r){"use strict";var n=t("csscolorparser").parseCSSColor,i=t("../util/util"),a=t("./style_function"),o={};e.exports=function t(e){if(a.isFunctionDefinition(e))return i.extend({},e,{stops:e.stops.map(function(e){return[e[0],t(e[1])]})});if("string"==typeof e){if(!o[e]){var r=n(e);if(!r)throw new Error("Invalid color "+e);o[e]=[r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]]}return o[e]}throw new Error("Invalid color "+e)}},{"../util/util":403,"./style_function":341,csscolorparser:89}],339:[function(t,e,r){"use strict";function n(t,e,r){this.animationLoop=e||new g,this.dispatcher=new p(r||1,this),this.spriteAtlas=new l(1024,1024),this.lineAtlas=new u(256,512),this._layers={},this._order=[],this._groups=[],this.sources={},this.zoomHistory={},c.bindAll(["_forwardSourceEvent","_forwardTileEvent","_forwardLayerEvent","_redoPlacement"],this),this._resetUpdates();var n=function(t,e){if(t)return void this.fire("error",{error:t});if(!m.emitErrors(this,m(e))){this._loaded=!0,this.stylesheet=e,this.updateClasses();var r=e.sources;for(var n in r)this.addSource(n,r[n]);e.sprite&&(this.sprite=new o(e.sprite),this.sprite.on("load",this.fire.bind(this,"change"))),this.glyphSource=new s(e.glyphs),this._resolve(),this.fire("load")}}.bind(this);"string"==typeof t?h.getJSON(f(t),n):d.frame(n.bind(this,null,t)),this.on("source.load",function(t){var e=t.source;if(e&&e.vectorLayerIds)for(var r in this._layers){var n=this._layers[r];n.source===e.id&&this._validateLayer(n)}})}var i=t("../util/evented"),a=t("./style_layer"),o=t("./image_sprite"),s=t("../symbol/glyph_source"),l=t("../symbol/sprite_atlas"),u=t("../render/line_atlas"),c=t("../util/util"),h=t("../util/ajax"),f=t("../util/mapbox").normalizeStyleURL,d=t("../util/browser"),p=t("../util/dispatcher"),g=t("./animation_loop"),m=t("./validate_style"),v=t("../source/source"),y=t("../source/query_features"),x=t("../source/source_cache"),b=t("./style_spec"),_=t("./style_function");e.exports=n,n.prototype=c.inherit(i,{_loaded:!1,_validateLayer:function(t){var e=this.sources[t.source];t.sourceLayer&&e&&e.vectorLayerIds&&e.vectorLayerIds.indexOf(t.sourceLayer)===-1&&this.fire("error",{error:new Error('Source layer "'+t.sourceLayer+'" does not exist on source "'+e.id+'" as specified by style layer "'+t.id+'"')})},loaded:function(){if(!this._loaded)return!1;if(Object.keys(this._updates.sources).length)return!1;for(var t in this.sources)if(!this.sources[t].loaded())return!1;return!(this.sprite&&!this.sprite.loaded())},_resolve:function(){var t,e;this._layers={},this._order=this.stylesheet.layers.map(function(t){return t.id});for(var r=0;rMath.floor(t)&&(e.lastIntegerZoom=Math.floor(t+1),e.lastIntegerZoomTime=Date.now()),e.lastZoom=t},_checkLoaded:function(){if(!this._loaded)throw new Error("Style is not done loading")},update:function(t,e){if(!this._updates.changed)return this;if(this._updates.allLayers)this._groupLayers(),this._updateWorkerLayers();else{var r=Object.keys(this._updates.layers);r.length&&this._updateWorkerLayers(r)}var n,i=Object.keys(this._updates.sources);for(n=0;n=0;return n&&this._handleErrors(m.source,"sources."+t,e)?this:(e=new x(t,e,this.dispatcher),this.sources[t]=e,e.style=this,e.on("load",this._forwardSourceEvent).on("error",this._forwardSourceEvent).on("change",this._forwardSourceEvent).on("tile.add",this._forwardTileEvent).on("tile.load",this._forwardTileEvent).on("tile.error",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.add",{source:e}]),this._updates.changed=!0,this)},removeSource:function(t){if(this._checkLoaded(),void 0===this.sources[t])throw new Error("There is no source with this ID");var e=this.sources[t];return delete this.sources[t],delete this._updates.sources[t],e.off("load",this._forwardSourceEvent).off("error",this._forwardSourceEvent).off("change",this._forwardSourceEvent).off("tile.add",this._forwardTileEvent).off("tile.load",this._forwardTileEvent).off("tile.error",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.remove",{source:e}]),this._updates.changed=!0,this},getSource:function(t){return this.sources[t]&&this.sources[t].getSource()},addLayer:function(t,e){if(this._checkLoaded(),!(t instanceof a)){if(this._handleErrors(m.layer,"layers."+t.id,t,!1,{arrayIndex:-1}))return this;var r=t.ref&&this.getLayer(t.ref);t=a.create(t,r)}return this._validateLayer(t),t.on("error",this._forwardLayerEvent),this._layers[t.id]=t,this._order.splice(e?this._order.indexOf(e):1/0,0,t.id),this._updates.allLayers=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.events.push(["layer.add",{layer:t}]),this.updateClasses(t.id)},removeLayer:function(t){this._checkLoaded();var e=this._layers[t];if(void 0===e)throw new Error("There is no layer with this ID");for(var r in this._layers)this._layers[r].ref===t&&this.removeLayer(r);return e.off("error",this._forwardLayerEvent),delete this._layers[t],delete this._updates.layers[t],delete this._updates.paintProps[t],this._order.splice(this._order.indexOf(t),1),this._updates.allLayers=!0,this._updates.events.push(["layer.remove",{layer:e}]),this._updates.changed=!0,this},getLayer:function(t){return this._layers[t]},getReferentLayer:function(t){var e=this.getLayer(t);return e.ref&&(e=this.getLayer(e.ref)),e},setLayerZoomRange:function(t,e,r){this._checkLoaded();var n=this.getReferentLayer(t);return n.minzoom===e&&n.maxzoom===r?this:(null!=e&&(n.minzoom=e),null!=r&&(n.maxzoom=r),this._updateLayer(n))},setFilter:function(t,e){this._checkLoaded();var r=this.getReferentLayer(t);return null!==e&&this._handleErrors(m.filter,"layers."+r.id+".filter",e)?this:c.deepEqual(r.filter,e)?this:(r.filter=c.clone(e),this._updateLayer(r))},getFilter:function(t){return this.getReferentLayer(t).filter},setLayoutProperty:function(t,e,r){this._checkLoaded();var n=this.getReferentLayer(t);return c.deepEqual(n.getLayoutProperty(e),r)?this:(n.setLayoutProperty(e,r),this._updateLayer(n))},getLayoutProperty:function(t,e){return this.getReferentLayer(t).getLayoutProperty(e)},setPaintProperty:function(t,e,r,n){this._checkLoaded();var i=this.getLayer(t);if(c.deepEqual(i.getPaintProperty(e,n),r))return this;var a=i.isPaintValueFeatureConstant(e);i.setPaintProperty(e,r,n);var o=!(r&&_.isFunctionDefinition(r)&&"$zoom"!==r.property&&void 0!==r.property);return o&&a||(this._updates.layers[t]=!0,i.source&&(this._updates.sources[i.source]=!0)),this.updateClasses(t,e)},getPaintProperty:function(t,e,r){return this.getLayer(t).getPaintProperty(e,r)},updateClasses:function(t,e){if(this._updates.changed=!0,t){var r=this._updates.paintProps;r[t]||(r[t]={}),r[t][e||"all"]=!0}else this._updates.allPaintProps=!0;return this},serialize:function(){return c.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,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:c.mapObject(this.sources,function(t){return t.serialize()}),layers:this._order.map(function(t){return this._layers[t].serialize()},this)},function(t){return void 0!==t})},_updateLayer:function(t){return this._updates.layers[t.id]=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.changed=!0,this},_flattenRenderedFeatures:function(t){for(var e=[],r=this._order.length-1;r>=0;r--)for(var n=this._order[r],i=0;is.lastIntegerZoom?(n=u+(1-u)*c,h*=2,i=t({zoom:o-1},r),a=t({zoom:o},r)):(n=1-(1-c)*u,a=t({zoom:o},r),i=t({zoom:o+1},r),h/=2),void 0===i||void 0===a?void 0:{from:i,fromScale:h,to:a,toScale:f,t:n}}}var a=t("./style_function"),o=t("./parse_color"),s=t("../util/util");e.exports=n},{"../util/util":403,"./parse_color":338,"./style_function":341}],341:[function(t,e,r){"use strict";var n=t("mapbox-gl-function");r.interpolated=function(t){var e=n.interpolated(t),r=function(t,r){return e(t&&t.zoom,r||{})};return r.isFeatureConstant=e.isFeatureConstant,r.isZoomConstant=e.isZoomConstant,r},r["piecewise-constant"]=function(t){var e=n["piecewise-constant"](t),r=function(t,r){return e(t&&t.zoom,r||{})};return r.isFeatureConstant=e.isFeatureConstant,r.isZoomConstant=e.isZoomConstant,r},r.isFunctionDefinition=n.isFunctionDefinition},{"mapbox-gl-function":263}],342:[function(t,e,r){"use strict";function n(t,e){this.set(t,e)}function i(t){return t.value}var a=t("../util/util"),o=t("./style_transition"),s=t("./style_declaration"),l=t("./style_spec"),u=t("./validate_style"),c=t("./parse_color"),h=t("../util/evented");e.exports=n;var f="-transition";n.create=function(e,r){var n={background:t("./style_layer/background_style_layer"),circle:t("./style_layer/circle_style_layer"),fill:t("./style_layer/fill_style_layer"),line:t("./style_layer/line_style_layer"),raster:t("./style_layer/raster_style_layer"),symbol:t("./style_layer/symbol_style_layer")};return new n[(r||e).type](e,r)},n.prototype=a.inherit(h,{set:function(t,e){this.id=t.id,this.ref=t.ref,this.metadata=t.metadata,this.type=(e||t).type,this.source=(e||t).source,this.sourceLayer=(e||t)["source-layer"],this.minzoom=(e||t).minzoom,this.maxzoom=(e||t).maxzoom,this.filter=(e||t).filter,this.paint={},this.layout={},this._paintSpecifications=l["paint_"+this.type],this._layoutSpecifications=l["layout_"+this.type],this._paintTransitions={},this._paintTransitionOptions={},this._paintDeclarations={},this._layoutDeclarations={},this._layoutFunctions={};var r,n;for(var i in t){var a=i.match(/^paint(?:\.(.*))?$/);if(a){var o=a[1]||"";for(r in t[i])this.setPaintProperty(r,t[i][r],o)}}if(this.ref)this._layoutDeclarations=e._layoutDeclarations;else for(n in t.layout)this.setLayoutProperty(n,t.layout[n]);for(r in this._paintSpecifications)this.paint[r]=this.getPaintValue(r);for(n in this._layoutSpecifications)this._updateLayoutValue(n)},setLayoutProperty:function(t,e){if(null==e)delete this._layoutDeclarations[t];else{var r="layers."+this.id+".layout."+t;if(this._handleErrors(u.layoutProperty,r,t,e))return;this._layoutDeclarations[t]=new s(this._layoutSpecifications[t],e)}this._updateLayoutValue(t)},getLayoutProperty:function(t){return this._layoutDeclarations[t]&&this._layoutDeclarations[t].value},getLayoutValue:function(t,e,r){var n=this._layoutSpecifications[t],i=this._layoutDeclarations[t];return i?i.calculate(e,r):n.default},setPaintProperty:function(t,e,r){var n="layers."+this.id+(r?'["paint.'+r+'"].':".paint.")+t;if(a.endsWith(t,f))if(this._paintTransitionOptions[r||""]||(this._paintTransitionOptions[r||""]={}),null===e||void 0===e)delete this._paintTransitionOptions[r||""][t];else{if(this._handleErrors(u.paintProperty,n,t,e))return;this._paintTransitionOptions[r||""][t]=e}else if(this._paintDeclarations[r||""]||(this._paintDeclarations[r||""]={}),null===e||void 0===e)delete this._paintDeclarations[r||""][t];else{if(this._handleErrors(u.paintProperty,n,t,e))return;this._paintDeclarations[r||""][t]=new s(this._paintSpecifications[t],e)}},getPaintProperty:function(t,e){return e=e||"",a.endsWith(t,f)?this._paintTransitionOptions[e]&&this._paintTransitionOptions[e][t]:this._paintDeclarations[e]&&this._paintDeclarations[e][t]&&this._paintDeclarations[e][t].value},getPaintValue:function(t,e,r){var n=this._paintSpecifications[t],i=this._paintTransitions[t];return i?i.calculate(e,r):"color"===n.type&&n.default?c(n.default):n.default},getPaintValueStopZoomLevels:function(t){var e=this._paintTransitions[t];return e?e.declaration.stopZoomLevels:[]},getPaintInterpolationT:function(t,e){var r=this._paintTransitions[t];return r.declaration.calculateInterpolationT({zoom:e})},isPaintValueFeatureConstant:function(t){var e=this._paintTransitions[t];return!e||e.declaration.isFeatureConstant},isLayoutValueFeatureConstant:function(t){var e=this._layoutDeclarations[t];return!e||e.isFeatureConstant},isPaintValueZoomConstant:function(t){var e=this._paintTransitions[t];return!e||e.declaration.isZoomConstant},isHidden:function(t){return!!(this.minzoom&&t=this.maxzoom)||("none"===this.layout.visibility||0===this.paint[this.type+"-opacity"]))},updatePaintTransitions:function(t,e,r,n){for(var i=a.extend({},this._paintDeclarations[""]),o=0;o-r/2;){if(o--,o<0)return!1;s-=t[o].dist(a),a=t[o]}s+=t[o].dist(t[o+1]),o++;for(var l=[],u=0;sn;)u-=l.shift().angleDelta;if(u>i)return!1;o++,s+=h.dist(f)}return!0}e.exports=n},{}],354:[function(t,e,r){"use strict";function n(t,e,r,n,a){for(var o=[],s=0;s=n&&f.x>=n||(h.x>=n?h=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round():f.x>=n&&(f=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round()),h.y>=a&&f.y>=a||(h.y>=a?h=new i(h.x+(f.x-h.x)*((a-h.y)/(f.y-h.y)),a)._round():f.y>=a&&(f=new i(h.x+(f.x-h.x)*((a-h.y)/(f.y-h.y)),a)._round()),l&&h.equals(l[l.length-1])||(l=[h],o.push(l)),l.push(f)))))}return o}var i=t("point-geometry");e.exports=n},{"point-geometry":442}],355:[function(t,e,r){"use strict";var n=t("../util/struct_array"),i=t("../util/util"),a=t("point-geometry"),o=e.exports=new n({members:[{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Float32",name:"maxScale"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"bbox0"},{type:"Int16",name:"bbox1"},{type:"Int16",name:"bbox2"},{type:"Int16",name:"bbox3"},{type:"Float32",name:"placementScale"}]});i.extendAll(o.prototype.StructType.prototype,{get anchorPoint(){return new a(this.anchorPointX,this.anchorPointY)}})},{"../util/struct_array":401,"../util/util":403,"point-geometry":442}],356:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u,c){var h=o.top*s-l,f=o.bottom*s+l,d=o.left*s-l,p=o.right*s+l;if(this.boxStartIndex=t.length,u){var g=f-h,m=p-d;if(g>0)if(g=Math.max(10*s,g),c){var v=e[r.segment+1].sub(e[r.segment])._unit()._mult(m),y=[r.sub(v),r.add(v)];this._addLineCollisionBoxes(t,y,r,0,m,g,n,i,a)}else this._addLineCollisionBoxes(t,e,r,r.segment,m,g,n,i,a)}else t.emplaceBack(r.x,r.y,d,h,p,f,1/0,n,i,a,0,0,0,0,0);this.boxEndIndex=t.length}e.exports=n,n.prototype._addLineCollisionBoxes=function(t,e,r,n,i,a,o,s,l){var u=a/2,c=Math.floor(i/u),h=-a/2,f=this.boxes,d=r,p=n+1,g=h;do{if(p--,p<0)return f;g-=e[p].dist(d),d=e[p]}while(g>-i/2);for(var m=e[p].dist(e[p+1]),v=0;v=e.length)return f;m=e[p].dist(e[p+1])}var x=y-g,b=e[p],_=e[p+1],w=_.sub(b)._unit()._mult(x)._add(b)._round(),M=Math.max(Math.abs(y-h)-u/2,0),A=i/2/M;t.emplaceBack(w.x,w.y,-a/2,-a/2,a/2,a/2,A,o,s,l,0,0,0,0,0)}return f}},{}],357:[function(t,e,r){"use strict";function n(t,e,r){if("object"==typeof t){var n=t;r=e,t=n.angle,e=n.pitch,this.grid=new o(n.grid),this.ignoredGrid=new o(n.ignoredGrid)}else this.grid=new o(a,12,6),this.ignoredGrid=new o(a,12,0);this.angle=t,this.pitch=e;var i=Math.sin(t),s=Math.cos(t);if(this.rotationMatrix=[s,-i,i,s],this.reverseRotationMatrix=[s,i,-i,s],this.yStretch=1/Math.cos(e/180*Math.PI),this.yStretch=Math.pow(this.yStretch,1.3),this.collisionBoxArray=r,0===r.length){r.emplaceBack();var l=32767;r.emplaceBack(0,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(a,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,0,-l,0,l,0,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,a,-l,0,l,0,l,0,0,0,0,0,0,0,0,0)}this.tempCollisionBox=r.get(0),this.edges=[r.get(1),r.get(2),r.get(3),r.get(4)]}var i=t("point-geometry"),a=t("../data/bucket").EXTENT,o=t("grid-index");e.exports=n,n.prototype.serialize=function(){var t={angle:this.angle,pitch:this.pitch,grid:this.grid.toArrayBuffer(),ignoredGrid:this.ignoredGrid.toArrayBuffer()};return{data:t,transferables:[t.grid,t.ignoredGrid]}},n.prototype.minScale=.25,n.prototype.maxScale=2,n.prototype.placeCollisionFeature=function(t,e,r){for(var n=this.collisionBoxArray,a=this.minScale,o=this.rotationMatrix,s=this.yStretch,l=t.boxStartIndex;l=this.maxScale)return a}if(r){var _;if(this.angle){var w=this.reverseRotationMatrix,M=new i(u.x1,u.y1).matMult(w),A=new i(u.x2,u.y1).matMult(w),k=new i(u.x1,u.y2).matMult(w),T=new i(u.x2,u.y2).matMult(w);_=this.tempCollisionBox,_.anchorPointX=u.anchorPoint.x,_.anchorPointY=u.anchorPoint.y,_.x1=Math.min(M.x,A.x,k.x,T.x),_.y1=Math.min(M.y,A.x,k.x,T.x),_.x2=Math.max(M.x,A.x,k.x,T.x),_.y2=Math.max(M.y,A.x,k.x,T.x),_.maxScale=u.maxScale}else _=u;for(var E=0;E=this.maxScale)return a}}}return a},n.prototype.queryRenderedSymbols=function(t,e,r,n,a){var o={},s=[],l=this.collisionBoxArray,u=this.rotationMatrix,c=new i(t,e)._matMult(u),h=this.tempCollisionBox;h.anchorX=c.x,h.anchorY=c.y,h.x1=0,h.y1=0,h.x2=r-t,h.y2=n-e,h.maxScale=a,a=h.maxScale;for(var f=[c.x+h.x1/a,c.y+h.y1/a*this.yStretch,c.x+h.x2/a,c.y+h.y2/a*this.yStretch],d=this.grid.query(f[0],f[1],f[2],f[3]),p=this.ignoredGrid.query(f[0],f[1],f[2],f[3]),g=0;g=a&&(o[y][x]=!0,s.push(d[m]))}}return s},n.prototype.getPlacementScale=function(t,e,r,n,i){var a=e.x-n.x,o=e.y-n.y,s=(i.x1-r.x2)/a,l=(i.x2-r.x1)/a,u=(i.y1-r.y2)*this.yStretch/o,c=(i.y2-r.y1)*this.yStretch/o;(isNaN(s)||isNaN(l))&&(s=l=1),(isNaN(u)||isNaN(c))&&(u=c=1);var h=Math.min(Math.max(s,l),Math.max(u,c)),f=i.maxScale,d=r.maxScale;return h>f&&(h=f),h>d&&(h=d),h>t&&h>=i.placementScale&&(t=h),t},n.prototype.insertCollisionFeature=function(t,e,r){for(var n=r?this.ignoredGrid:this.grid,i=this.collisionBoxArray,a=t.boxStartIndex;a=0&&k=0&&T=0&&v+d<=p){var E=new o(k,T,M,x)._round();n&&!s(t,E,u,n,l)||y.push(E)}}m+=w}return h||y.length||c||(y=i(t,m/2,r,n,l,u,c,!0,f)),y}var a=t("../util/interpolate"),o=t("../symbol/anchor"),s=t("./check_max_angle");e.exports=n},{"../symbol/anchor":352,"../util/interpolate":397,"./check_max_angle":353}],359:[function(t,e,r){"use strict";function n(){this.width=s,this.height=s,this.bin=new i(this.width,this.height),this.index={},this.ids={},this.data=new Uint8Array(this.width*this.height)}var i=t("shelf-pack"),a=t("../util/util"),o=4,s=128,l=2048;e.exports=n,n.prototype.getGlyphs=function(){var t,e,r,n={};for(var i in this.ids)t=i.split("#"),e=t[0],r=t[1],n[e]||(n[e]=[]),n[e].push(r);return n},n.prototype.getRects=function(){var t,e,r,n={};for(var i in this.ids)t=i.split("#"),e=t[0],r=t[1],n[e]||(n[e]={}),n[e][r]=this.index[i];return n},n.prototype.addGlyph=function(t,e,r,n){if(!r)return null;var i=e+"#"+r.id;if(this.index[i])return this.ids[i].indexOf(t)<0&&this.ids[i].push(t),this.index[i];if(!r.bitmap)return null;var o=r.width+2*n,s=r.height+2*n,l=1,u=o+2*l,c=s+2*l;u+=4-u%4,c+=4-c%4;var h=this.bin.packOne(u,c);if(h||(this.resize(),h=this.bin.packOne(u,c)),!h)return a.warnOnce("glyph bitmap overflow"),null;this.index[i]=h,this.ids[i]=[t];for(var f=this.data,d=r.bitmap,p=0;p=l||e>=l)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=o,this.height*=o,this.bin.resize(this.width,this.height);for(var r=new ArrayBuffer(this.width*this.height),n=0;n65535)return r("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var n=this.loading[t];if(n[e])n[e].push(r);else{n[e]=[r];var i=256*e+"-"+(256*e+255),o=a(t,i,this.url);s(o,function(t,r){for(var i=!t&&new l(new c(new Uint8Array(r))),a=0;an&&null!==c){var b=v[c+1].x;m=Math.max(b,m);for(var _=c+1;_<=y;_++)v[_].y+=r,v[_].x-=b;if(o){var w=c;h[v[c].codePoint]&&w--,s(v,e,p,w,o)}p=c+1,c=null,d+=b,g++}f[x.codePoint]&&(c=y)}var M=v[v.length-1],A=M.x+e[M.codePoint].advance;m=Math.max(m,A);var k=(g+1)*r;s(v,e,p,v.length-1,o),l(v,o,i,a,m,r,g,u),t.top+=-a*k,t.bottom=t.top+k,t.left+=-i*m,t.right=t.left+m}function s(t,e,r,n,i){for(var a=e[t[n].codePoint].advance,o=(t[n].x+a)*i,s=r;s<=n;s++)t[s].x-=o}function l(t,e,r,n,i,a,o,s){for(var l=(e-r)*i+s[0],u=(-n*(o+1)+.5)*a+s[1],c=0;c1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},n.prototype.addIcons=function(t,e){for(var r=0;r1||(w?(clearTimeout(w),w=null,v("dblclick",e)):w=setTimeout(d,300))}function c(t){y("touchmove",t)}function h(t){y("touchend",t)}function f(t){y("touchcancel",t)}function d(){w=null}function p(t){var e=n.mousePos(x,t);e.equals(_)&&v("click",t)}function g(t){v("dblclick",t),t.preventDefault()}function m(t){b=t,t.preventDefault()}function v(e,r){var i=n.mousePos(x,r);return t.fire(e,{lngLat:t.unproject(i),point:i,originalEvent:r})}function y(e,r){var a=n.touchPos(x,r),o=a.reduce(function(t,e,r,n){return t.add(e.div(n.length))},new i(0,0));return t.fire(e,{lngLat:t.unproject(o),point:o,lngLats:a.map(function(e){return t.unproject(e)},this),points:a,originalEvent:r})}var x=t.getCanvasContainer(),b=null,_=null,w=null;for(var M in a)t[M]=new a[M](t,e),e.interactive&&e[M]&&t[M].enable();x.addEventListener("mouseout",r,!1),x.addEventListener("mousedown",o,!1),x.addEventListener("mouseup",s,!1),x.addEventListener("mousemove",l,!1),x.addEventListener("touchstart",u,!1),x.addEventListener("touchend",h,!1),x.addEventListener("touchmove",c,!1),x.addEventListener("touchcancel",f,!1),x.addEventListener("click",p,!1),x.addEventListener("dblclick",g,!1),x.addEventListener("contextmenu",m,!1)}},{"../util/dom":389,"./handler/box_zoom":374,"./handler/dblclick_zoom":375,"./handler/drag_pan":376,"./handler/drag_rotate":377,"./handler/keyboard":378,"./handler/scroll_zoom":379,"./handler/touch_zoom_rotate":380,"point-geometry":442}],369:[function(t,e,r){"use strict";var n=t("../util/util"),i=t("../util/interpolate"),a=t("../util/browser"),o=t("../geo/lng_lat"),s=t("../geo/lng_lat_bounds"),l=t("point-geometry"),u=e.exports=function(){};n.extend(u.prototype,{getCenter:function(){return this.transform.center},setCenter:function(t,e){return this.jumpTo({center:t},e),this},panBy:function(t,e,r){return this.panTo(this.transform.center,n.extend({offset:l.convert(t).mult(-1)},e),r),this},panTo:function(t,e,r){return this.easeTo(n.extend({center:t},e),r)},getZoom:function(){return this.transform.zoom},setZoom:function(t,e){return this.jumpTo({zoom:t},e),this},zoomTo:function(t,e,r){return this.easeTo(n.extend({zoom:t},e),r)},zoomIn:function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},zoomOut:function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},getBearing:function(){return this.transform.bearing},setBearing:function(t,e){return this.jumpTo({bearing:t},e),this},rotateTo:function(t,e,r){return this.easeTo(n.extend({bearing:t},e),r)},resetNorth:function(t,e){return this.rotateTo(0,n.extend({duration:1e3},t),e),this},snapToNorth:function(t,e){return Math.abs(this.getBearing())180&&(c.center.lng>0&&g.lng<0?g.lng+=360:c.center.lng<0&&g.lng>0&&(g.lng-=360));var x=c.zoomScale(m-f),b=c.point,_="center"in t?c.project(g).sub(h.div(x)):b,w=c.worldSize,M=t.curve,A=Math.max(c.width,c.height),k=A/x,T=_.sub(b).mag();if("minZoom"in t){var E=n.clamp(Math.min(t.minZoom,f,m),c.minZoom,c.maxZoom),S=A/c.zoomScale(E-f);M=Math.sqrt(S/T*2)}var L=M*M,z=r(0),C=function(t){return s(z)/s(z+M*t)},I=function(t){return A*((s(z)*u(z+M*t)-a(z))/L)/T},P=(r(1)-z)/M;if(Math.abs(T)<1e-6){if(Math.abs(A-k)<1e-6)return this.easeTo(t);var D=k=0)return!1;return!0}),e.join(" | ")},n.prototype=o.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e="mapboxgl-ctrl-attrib",r=this._container=a.create("div",e,t.getContainer());return this._update(),t.on("source.load",this._update.bind(this)),t.on("source.change",this._update.bind(this)),t.on("source.remove",this._update.bind(this)),t.on("moveend",this._updateEditLink.bind(this)),r},_update:function(){this._map.style&&(this._container.innerHTML=n.createAttributionString(this._map.style.sources)),this._editLink=this._container.getElementsByClassName("mapbox-improve-map")[0],this._updateEditLink()},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}})},{"../../util/dom":389,"../../util/util":403,"./control":371}],371:[function(t,e,r){"use strict";function n(){}var i=t("../../util/util"),a=t("../../util/evented");e.exports=n,n.prototype={addTo:function(t){this._map=t;var e=this._container=this.onAdd(t);if(this.options&&this.options.position){var r=this.options.position,n=t._controlCorners[r];e.className+=" mapboxgl-ctrl",r.indexOf("bottom")!==-1?n.insertBefore(e,n.firstChild):n.appendChild(e)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}},i.extend(n.prototype,a)},{"../../util/evented":395,"../../util/util":403}],372:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}var i=t("./control"),a=t("../../util/browser"),o=t("../../util/dom"),s=t("../../util/util");e.exports=n;var l={enableHighAccuracy:!1,timeout:6e3};n.prototype=s.inherit(i,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=o.create("div",e+"-group",t.getContainer());return a.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=o.create("button",e+"-icon "+e+"-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),r):r},_onContextMenu:function(t){t.preventDefault()},_onClickGeolocate:function(){navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),l),this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this.fire("geolocate",t),this._finish()},_error:function(t){this.fire("error",t),this._finish()},_finish:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}})},{"../../util/browser":387,"../../util/dom":389,"../../util/util":403,"./control":371}],373:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}function i(t){return new MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var a=t("./control"),o=t("../../util/dom"),s=t("../../util/util");e.exports=n,n.prototype=s.inherit(a,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=o.create("div",e+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(e+"-icon "+e+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(e+"-icon "+e+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(e+"-icon "+e+"-compass",t.resetNorth.bind(t)),this._compassArrow=o.create("div","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),r},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(o.disableDrag(),document.addEventListener("mousemove",this._onCompassMove),document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(document.removeEventListener("mousemove",this._onCompassMove),document.removeEventListener("mouseup",this._onCompassUp),o.enableDrag(),this._el.dispatchEvent(i(t)),t.stopPropagation())},_createButton:function(t,e){var r=o.create("button",t,this._container);return r.type="button",r.addEventListener("click",function(){e()}),r},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}})},{"../../util/dom":389,"../../util/util":403,"./control":371}],374:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../geo/lng_lat_bounds"),o=t("../../util/util");e.exports=n,n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onMouseDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},_onMouseDown:function(t){t.shiftKey&&0===t.button&&(document.addEventListener("mousemove",this._onMouseMove,!1),document.addEventListener("keydown",this._onKeyDown,!1),document.addEventListener("mouseup",this._onMouseUp,!1),i.disableDrag(),this._startPos=i.mousePos(this._el,t),this._active=!0)},_onMouseMove:function(t){var e=this._startPos,r=i.mousePos(this._el,t);this._box||(this._box=i.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var n=Math.min(e.x,r.x),a=Math.max(e.x,r.x),o=Math.min(e.y,r.y),s=Math.max(e.y,r.y);i.setTransform(this._box,"translate("+n+"px,"+o+"px)"),this._box.style.width=a-n+"px",this._box.style.height=s-o+"px"},_onMouseUp:function(t){if(0===t.button){var e=this._startPos,r=i.mousePos(this._el,t),n=new a(this._map.unproject(e),this._map.unproject(r));this._finish(),e.x===r.x&&e.y===r.y?this._fireEvent("boxzoomcancel",t):this._map.fitBounds(n,{linear:!0}).fire("boxzoomend",{originalEvent:t,boxZoomBounds:n})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},_finish:function(){this._active=!1,document.removeEventListener("mousemove",this._onMouseMove,!1),document.removeEventListener("keydown",this._onKeyDown,!1),document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),i.enableDrag()},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})}}},{"../../geo/lng_lat_bounds":301,"../../util/dom":389,"../../util/util":403}],375:[function(t,e,r){"use strict";function n(t){this._map=t,this._onDblClick=this._onDblClick.bind(this)}e.exports=n,n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},_onDblClick:function(t){this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)}}},{}],376:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/util");e.exports=n;var o=.3,s=a.bezier(0,0,o,1),l=1400,u=2500;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},_onDown:function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp)),this._active=!1,this._startPos=this._pos=i.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=i.mousePos(this._el,t),r=this._map;r.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),r.transform.setLocationAtPoint(r.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},_onUp:function(t){if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=function(){this._fireEvent("moveend",t)}.bind(this),r=this._inertia;if(r.length<2)return void e();var n=r[r.length-1],i=r[0],a=n[1].sub(i[1]),c=(n[0]-i[0])/1e3;if(0===c||n[1].equals(i[1]))return void e();var h=a.mult(o/c),f=h.mag();f>l&&(f=l,h._unit()._mult(f));var d=f/(u*o),p=h.mult(-d/2);this._map.panBy(p,{duration:1e3*d,easing:s,noMoveStart:!0},{originalEvent:t})}},_onMouseUp:function(t){this._ignoreEvent(t)||(this._onUp(t), +h},n.prototype.resize=function(){var t=this.width,e=this.height;if(!(t>=l||e>=l)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=o,this.height*=o,this.bin.resize(this.width,this.height);for(var r=new ArrayBuffer(this.width*this.height),n=0;n65535)return r("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var n=this.loading[t];if(n[e])n[e].push(r);else{n[e]=[r];var i=256*e+"-"+(256*e+255),o=a(t,i,this.url);s(o,function(t,r){for(var i=!t&&new l(new c(new Uint8Array(r))),a=0;an&&null!==c){var b=v[c+1].x;m=Math.max(b,m);for(var _=c+1;_<=y;_++)v[_].y+=r,v[_].x-=b;if(o){var w=c;h[v[c].codePoint]&&w--,s(v,e,p,w,o)}p=c+1,c=null,d+=b,g++}f[x.codePoint]&&(c=y)}var M=v[v.length-1],A=M.x+e[M.codePoint].advance;m=Math.max(m,A);var k=(g+1)*r;s(v,e,p,v.length-1,o),l(v,o,i,a,m,r,g,u),t.top+=-a*k,t.bottom=t.top+k,t.left+=-i*m,t.right=t.left+m}function s(t,e,r,n,i){for(var a=e[t[n].codePoint].advance,o=(t[n].x+a)*i,s=r;s<=n;s++)t[s].x-=o}function l(t,e,r,n,i,a,o,s){for(var l=(e-r)*i+s[0],u=(-n*(o+1)+.5)*a+s[1],c=0;c1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},n.prototype.addIcons=function(t,e){for(var r=0;r1||(w?(clearTimeout(w),w=null,v("dblclick",e)):w=setTimeout(d,300))}function c(t){y("touchmove",t)}function h(t){y("touchend",t)}function f(t){y("touchcancel",t)}function d(){w=null}function p(t){var e=n.mousePos(x,t);e.equals(_)&&v("click",t)}function g(t){v("dblclick",t),t.preventDefault()}function m(t){b=t,t.preventDefault()}function v(e,r){var i=n.mousePos(x,r);return t.fire(e,{lngLat:t.unproject(i),point:i,originalEvent:r})}function y(e,r){var a=n.touchPos(x,r),o=a.reduce(function(t,e,r,n){return t.add(e.div(n.length))},new i(0,0));return t.fire(e,{lngLat:t.unproject(o),point:o,lngLats:a.map(function(e){return t.unproject(e)},this),points:a,originalEvent:r})}var x=t.getCanvasContainer(),b=null,_=null,w=null;for(var M in a)t[M]=new a[M](t,e),e.interactive&&e[M]&&t[M].enable();x.addEventListener("mouseout",r,!1),x.addEventListener("mousedown",o,!1),x.addEventListener("mouseup",s,!1),x.addEventListener("mousemove",l,!1),x.addEventListener("touchstart",u,!1),x.addEventListener("touchend",h,!1),x.addEventListener("touchmove",c,!1),x.addEventListener("touchcancel",f,!1),x.addEventListener("click",p,!1),x.addEventListener("dblclick",g,!1),x.addEventListener("contextmenu",m,!1)}},{"../util/dom":389,"./handler/box_zoom":374,"./handler/dblclick_zoom":375,"./handler/drag_pan":376,"./handler/drag_rotate":377,"./handler/keyboard":378,"./handler/scroll_zoom":379,"./handler/touch_zoom_rotate":380,"point-geometry":442}],369:[function(t,e,r){"use strict";var n=t("../util/util"),i=t("../util/interpolate"),a=t("../util/browser"),o=t("../geo/lng_lat"),s=t("../geo/lng_lat_bounds"),l=t("point-geometry"),u=e.exports=function(){};n.extend(u.prototype,{getCenter:function(){return this.transform.center},setCenter:function(t,e){return this.jumpTo({center:t},e),this},panBy:function(t,e,r){return this.panTo(this.transform.center,n.extend({offset:l.convert(t).mult(-1)},e),r),this},panTo:function(t,e,r){return this.easeTo(n.extend({center:t},e),r)},getZoom:function(){return this.transform.zoom},setZoom:function(t,e){return this.jumpTo({zoom:t},e),this},zoomTo:function(t,e,r){return this.easeTo(n.extend({zoom:t},e),r)},zoomIn:function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},zoomOut:function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},getBearing:function(){return this.transform.bearing},setBearing:function(t,e){return this.jumpTo({bearing:t},e),this},rotateTo:function(t,e,r){return this.easeTo(n.extend({bearing:t},e),r)},resetNorth:function(t,e){return this.rotateTo(0,n.extend({duration:1e3},t),e),this},snapToNorth:function(t,e){return Math.abs(this.getBearing())180&&(c.center.lng>0&&g.lng<0?g.lng+=360:c.center.lng<0&&g.lng>0&&(g.lng-=360));var x=c.zoomScale(m-f),b=c.point,_="center"in t?c.project(g).sub(h.div(x)):b,w=c.worldSize,M=t.curve,A=Math.max(c.width,c.height),k=A/x,T=_.sub(b).mag();if("minZoom"in t){var E=n.clamp(Math.min(t.minZoom,f,m),c.minZoom,c.maxZoom),S=A/c.zoomScale(E-f);M=Math.sqrt(S/T*2)}var L=M*M,z=r(0),C=function(t){return s(z)/s(z+M*t)},I=function(t){return A*((s(z)*u(z+M*t)-a(z))/L)/T},P=(r(1)-z)/M;if(Math.abs(T)<1e-6){if(Math.abs(A-k)<1e-6)return this.easeTo(t);var D=k=0)return!1;return!0}),e.join(" | ")},n.prototype=o.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e="mapboxgl-ctrl-attrib",r=this._container=a.create("div",e,t.getContainer());return this._update(),t.on("source.load",this._update.bind(this)),t.on("source.change",this._update.bind(this)),t.on("source.remove",this._update.bind(this)),t.on("moveend",this._updateEditLink.bind(this)),r},_update:function(){this._map.style&&(this._container.innerHTML=n.createAttributionString(this._map.style.sources)),this._editLink=this._container.getElementsByClassName("mapbox-improve-map")[0],this._updateEditLink()},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}})},{"../../util/dom":389,"../../util/util":403,"./control":371}],371:[function(t,e,r){"use strict";function n(){}var i=t("../../util/util"),a=t("../../util/evented");e.exports=n,n.prototype={addTo:function(t){this._map=t;var e=this._container=this.onAdd(t);if(this.options&&this.options.position){var r=this.options.position,n=t._controlCorners[r];e.className+=" mapboxgl-ctrl",r.indexOf("bottom")!==-1?n.insertBefore(e,n.firstChild):n.appendChild(e)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}},i.extend(n.prototype,a)},{"../../util/evented":395,"../../util/util":403}],372:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}var i=t("./control"),a=t("../../util/browser"),o=t("../../util/dom"),s=t("../../util/util");e.exports=n;var l={enableHighAccuracy:!1,timeout:6e3};n.prototype=s.inherit(i,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=o.create("div",e+"-group",t.getContainer());return a.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=o.create("button",e+"-icon "+e+"-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),r):r},_onContextMenu:function(t){t.preventDefault()},_onClickGeolocate:function(){navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),l),this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this.fire("geolocate",t),this._finish()},_error:function(t){this.fire("error",t),this._finish()},_finish:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}})},{"../../util/browser":387,"../../util/dom":389,"../../util/util":403,"./control":371}],373:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}function i(t){return new MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var a=t("./control"),o=t("../../util/dom"),s=t("../../util/util");e.exports=n,n.prototype=s.inherit(a,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=o.create("div",e+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(e+"-icon "+e+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(e+"-icon "+e+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(e+"-icon "+e+"-compass",t.resetNorth.bind(t)),this._compassArrow=o.create("div","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),r},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(o.disableDrag(),document.addEventListener("mousemove",this._onCompassMove),document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(document.removeEventListener("mousemove",this._onCompassMove),document.removeEventListener("mouseup",this._onCompassUp),o.enableDrag(),this._el.dispatchEvent(i(t)),t.stopPropagation())},_createButton:function(t,e){var r=o.create("button",t,this._container);return r.type="button",r.addEventListener("click",function(){e()}),r},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}})},{"../../util/dom":389,"../../util/util":403,"./control":371}],374:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../geo/lng_lat_bounds"),o=t("../../util/util");e.exports=n,n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onMouseDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},_onMouseDown:function(t){t.shiftKey&&0===t.button&&(document.addEventListener("mousemove",this._onMouseMove,!1),document.addEventListener("keydown",this._onKeyDown,!1),document.addEventListener("mouseup",this._onMouseUp,!1),i.disableDrag(),this._startPos=i.mousePos(this._el,t),this._active=!0)},_onMouseMove:function(t){var e=this._startPos,r=i.mousePos(this._el,t);this._box||(this._box=i.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var n=Math.min(e.x,r.x),a=Math.max(e.x,r.x),o=Math.min(e.y,r.y),s=Math.max(e.y,r.y);i.setTransform(this._box,"translate("+n+"px,"+o+"px)"),this._box.style.width=a-n+"px",this._box.style.height=s-o+"px"},_onMouseUp:function(t){if(0===t.button){var e=this._startPos,r=i.mousePos(this._el,t),n=new a(this._map.unproject(e),this._map.unproject(r));this._finish(),e.x===r.x&&e.y===r.y?this._fireEvent("boxzoomcancel",t):this._map.fitBounds(n,{linear:!0}).fire("boxzoomend",{originalEvent:t,boxZoomBounds:n})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},_finish:function(){this._active=!1,document.removeEventListener("mousemove",this._onMouseMove,!1),document.removeEventListener("keydown",this._onKeyDown,!1),document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),i.enableDrag()},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})}}},{"../../geo/lng_lat_bounds":301,"../../util/dom":389,"../../util/util":403}],375:[function(t,e,r){"use strict";function n(t){this._map=t,this._onDblClick=this._onDblClick.bind(this)}e.exports=n,n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},_onDblClick:function(t){this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)}}},{}],376:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/util");e.exports=n;var o=.3,s=a.bezier(0,0,o,1),l=1400,u=2500;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},_onDown:function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp)),this._active=!1,this._startPos=this._pos=i.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=i.mousePos(this._el,t),r=this._map;r.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),r.transform.setLocationAtPoint(r.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},_onUp:function(t){if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=function(){this._fireEvent("moveend",t)}.bind(this),r=this._inertia;if(r.length<2)return void e();var n=r[r.length-1],i=r[0],a=n[1].sub(i[1]),c=(n[0]-i[0])/1e3;if(0===c||n[1].equals(i[1]))return void e();var h=a.mult(o/c),f=h.mag();f>l&&(f=l,h._unit()._mult(f));var d=f/(u*o),p=h.mult(-d/2);this._map.panBy(p,{duration:1e3*d,easing:s,noMoveStart:!0},{originalEvent:t})}},_onMouseUp:function(t){this._ignoreEvent(t)||(this._onUp(t), document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onMouseUp))},_onTouchEnd:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onTouchEnd))},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragRotate&&e.dragRotate.isActive())return!0;if(t.touches)return t.touches.length>1;if(t.ctrlKey)return!0;var r=1,n=0;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>0&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":389,"../../util/util":403}],377:[function(t,e,r){"use strict";function n(t,e){this._map=t,this._el=t.getCanvasContainer(),this._bearingSnap=e.bearingSnap,o.bindHandlers(this)}var i=t("../../util/dom"),a=t("point-geometry"),o=t("../../util/util");e.exports=n;var s=.25,l=o.bezier(0,0,s,1),u=180,c=720;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},_onDown:function(t){if(!this._ignoreEvent(t)&&!this.isActive()){document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onUp),this._active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=i.mousePos(this._el,t),this._center=this._map.transform.centerPoint;var e=this._startPos.sub(this._center),r=e.mag();r<200&&(this._center=this._startPos.add(new a(-200,0)._rotate(e.angle()))),t.preventDefault()}},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t));var e=this._map;e.stop();var r=this._pos,n=i.mousePos(this._el,t),a=this._center,o=r.sub(a).angleWith(n.sub(a))/Math.PI*180,s=e.getBearing()-o,l=this._inertia,u=l[l.length-1];this._drainInertiaBuffer(),l.push([Date.now(),e._normalizeBearing(s,u[1])]),e.transform.bearing=s,this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=n}},_onUp:function(t){if(!this._ignoreEvent(t)&&(document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onUp),this.isActive())){this._active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var e=this._map,r=e.getBearing(),n=this._inertia,i=function(){Math.abs(r)u&&(m=u);var v=m/(c*s),y=p*m*(v/2);f+=y,Math.abs(e._normalizeBearing(f,0))1;var r=t.ctrlKey?1:2,n=t.ctrlKey?0:2;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>0&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":389,"../../util/util":403,"point-geometry":442}],378:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._onKeyDown=this._onKeyDown.bind(this)}e.exports=n;var i=80,a=2,o=5;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=this._map,r={originalEvent:t};if(!e.isEasing())switch(t.keyCode){case 61:case 107:case 171:case 187:e.zoomTo(Math.round(e.getZoom())+(t.shiftKey?2:1),r);break;case 189:case 109:case 173:e.zoomTo(Math.round(e.getZoom())-(t.shiftKey?2:1),r);break;case 37:t.shiftKey?e.easeTo({bearing:e.getBearing()-a},r):(t.preventDefault(),e.panBy([-i,0],r));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+a},r):(t.preventDefault(),e.panBy([i,0],r));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+o},r):(t.preventDefault(),e.panBy([0,-i],r));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-o,0)},r):(t.preventDefault(),e.panBy([0,i],r))}}}}},{}],379:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/browser"),o=t("../../util/util");e.exports=n;var s="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",l=s.indexOf("firefox")!==-1,u=s.indexOf("safari")!==-1&&s.indexOf("chrom")===-1;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},_onWheel:function(t){var e;"wheel"===t.type?(e=t.deltaY,l&&t.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(e/=a.devicePixelRatio),t.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(e*=40)):"mousewheel"===t.type&&(e=-t.wheelDeltaY,u&&(e/=3));var r=a.now(),n=r-(this._time||0);this._pos=i.mousePos(this._el,t),this._time=r,0!==e&&e%4.000244140625===0?(this._type="wheel",e=Math.floor(e/4)):0!==e&&Math.abs(e)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(n*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&this._zoom(-e,t),t.preventDefault()},_onTimeout:function(){this._type="wheel",this._zoom(-this._lastValue)},_zoom:function(t,e){if(0!==t){var r=this._map,n=2/(1+Math.exp(-Math.abs(t/100)));t<0&&0!==n&&(n=1/n);var i=r.ease?r.ease.to:r.transform.scale,a=r.transform.scaleZoom(i*n);r.zoomTo(a,{duration:0,around:r.unproject(this._pos),delayEndEvents:200},{originalEvent:e})}}}},{"../../util/browser":387,"../../util/dom":389,"../../util/util":403}],380:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/util");e.exports=n;var o=.15,s=a.bezier(0,0,o,1),l=12,u=2.5,c=.15,h=4;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},disableRotation:function(){this._rotationDisabled=!0},enableRotation:function(){this._rotationDisabled=!1},_onStart:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]);this._startVec=e.sub(r),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],document.addEventListener("touchmove",this._onMove,!1),document.addEventListener("touchend",this._onEnd,!1)}},_onMove:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]),n=e.add(r).div(2),a=e.sub(r),o=a.mag()/this._startVec.mag(),s=this._rotationDisabled?0:180*a.angleWith(this._startVec)/Math.PI,l=this._map;if(this._gestureIntent){var u={duration:0,around:l.unproject(n)};"rotate"===this._gestureIntent&&(u.bearing=this._startBearing+s),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(u.zoom=l.transform.scaleZoom(this._startScale*o)),l.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),o,n]),l.easeTo(u,{originalEvent:t})}else{var f=Math.abs(1-o)>c,d=Math.abs(s)>h;d?this._gestureIntent="rotate":f&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=a,this._startScale=l.transform.scale,this._startBearing=l.transform.bearing)}t.preventDefault()}},_onEnd:function(t){document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,r=this._map;if(e.length<2)return void r.snapToNorth({},{originalEvent:t});var n=e[e.length-1],i=e[0],a=r.transform.scaleZoom(this._startScale*n[1]),c=r.transform.scaleZoom(this._startScale*i[1]),h=a-c,f=(n[0]-i[0])/1e3,d=n[2];if(0===f||a===c)return void r.snapToNorth({},{originalEvent:t});var p=h*o/f;Math.abs(p)>u&&(p=p>0?u:-u);var g=1e3*Math.abs(p/(l*o)),m=a+p*g/2e3;m<0&&(m=0),r.easeTo({zoom:m,duration:g,easing:s,around:r.unproject(d)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>2&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":389,"../../util/util":403}],381:[function(t,e,r){"use strict";function n(){i.bindAll(["_onHashChange","_updateHash"],this)}e.exports=n;var i=t("../util/util");n.prototype={addTo:function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},remove:function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},_onHashChange:function(){var t=location.hash.replace("#","").split("/");return t.length>=3&&(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0)}),!0)},_updateHash:function(){var t=this._map.getCenter(),e=this._map.getZoom(),r=this._map.getBearing(),n=Math.max(0,Math.ceil(Math.log(e)/Math.LN2)),i="#"+Math.round(100*e)/100+"/"+t.lat.toFixed(n)+"/"+t.lng.toFixed(n)+(r?"/"+Math.round(10*r)/10:"");window.history.replaceState("","",i)}}},{"../util/util":403}],382:[function(t,e,r){"use strict";function n(t){t.parentNode&&t.parentNode.removeChild(t)}var i=t("../util/canvas"),a=t("../util/util"),o=t("../util/browser"),s=t("../util/browser").window,l=t("../util/evented"),u=t("../util/dom"),c=t("../style/style"),h=t("../style/animation_loop"),f=t("../render/painter"),d=t("../geo/transform"),p=t("./hash"),g=t("./bind_handlers"),m=t("./camera"),v=t("../geo/lng_lat"),y=t("../geo/lng_lat_bounds"),x=t("point-geometry"),b=t("./control/attribution"),_=0,w=20,M={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:_,maxZoom:w,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,workerCount:Math.max(o.hardwareConcurrency-1,1)},A=e.exports=function(t){if(t=a.extend({},M,t),t.workerCount<1)throw new Error("workerCount must an integer greater than or equal to 1.");this._interactive=t.interactive,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._trackResize=t.trackResize,this._workerCount=t.workerCount,this._bearingSnap=t.bearingSnap,"string"==typeof t.container?this._container=document.getElementById(t.container):this._container=t.container,this.animationLoop=new h,this.transform=new d(t.minZoom,t.maxZoom),t.maxBounds&&this.setMaxBounds(t.maxBounds),a.bindAll(["_forwardStyleEvent","_forwardSourceEvent","_forwardLayerEvent","_forwardTileEvent","_onStyleLoad","_onStyleChange","_onSourceAdd","_onSourceRemove","_onSourceUpdate","_onWindowOnline","_onWindowResize","_update","_render"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){this.animationLoop.set(300),this._rerender()}.bind(this)),"undefined"!=typeof s&&(s.addEventListener("online",this._onWindowOnline,!1),s.addEventListener("resize",this._onWindowResize,!1)),g(this,t),this._hash=t.hash&&(new p).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),this.stacks={},this._classes=[],this.resize(),t.classes&&this.setClasses(t.classes),t.style&&this.setStyle(t.style),t.attributionControl&&this.addControl(new b(t.attributionControl));var e=this.fire.bind(this,"error");this.on("style.error",e),this.on("source.error",e),this.on("tile.error",e),this.on("layer.error",e)};a.extend(A.prototype,l),a.extend(A.prototype,m.prototype),a.extend(A.prototype,{addControl:function(t){return t.addTo(this),this},addClass:function(t,e){return this._classes.indexOf(t)>=0||""===t?this:(this._classes.push(t),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},removeClass:function(t,e){var r=this._classes.indexOf(t);return r<0||""===t?this:(this._classes.splice(r,1),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},setClasses:function(t,e){for(var r={},n=0;n=0},getClasses:function(){return this._classes},resize:function(){var t=0,e=0;return this._container&&(t=this._container.offsetWidth||400,e=this._container.offsetHeight||300),this._canvas.resize(t,e),this.transform.resize(t,e),this.painter.resize(t,e),this.fire("movestart").fire("move").fire("resize").fire("moveend")},getBounds:function(){var t=new y(this.transform.pointLocation(new x(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new x(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new x(0,this.transform.size.y)))),t},setMaxBounds:function(t){if(t){var e=y.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=[],this.transform.latRange=[],this._update());return this},setMinZoom:function(t){if(t=null===t||void 0===t?_:t,t>=_&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom&&t<=w)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be between the current minZoom and "+w+", inclusive")},project:function(t){return this.transform.locationPoint(v.convert(t))},unproject:function(t){return this.transform.pointLocation(x.convert(t))},queryRenderedFeatures:function(){function t(t){return t instanceof x||Array.isArray(t)}var e,r={};return 2===arguments.length?(e=arguments[0],r=arguments[1]):1===arguments.length&&t(arguments[0])?e=arguments[0]:1===arguments.length&&(r=arguments[0]),this.style.queryRenderedFeatures(this._makeQueryGeometry(e),r,this.transform.zoom,this.transform.angle)},_makeQueryGeometry:function(t){void 0===t&&(t=[x.convert([0,0]),x.convert([this.transform.width,this.transform.height])]);var e,r=t instanceof x||"number"==typeof t[0];if(r){var n=x.convert(t);e=[n]}else{var i=[x.convert(t[0]),x.convert(t[1])];e=[i[0],new x(i[1].x,i[0].y),i[1],new x(i[0].x,i[1].y),i[0]]}return e=e.map(function(t){return this.transform.pointCoordinate(t)}.bind(this))},querySourceFeatures:function(t,e){return this.style.querySourceFeatures(t,e)},setStyle:function(t){return this.style&&(this.style.off("load",this._onStyleLoad).off("error",this._forwardStyleEvent).off("change",this._onStyleChange).off("source.add",this._onSourceAdd).off("source.remove",this._onSourceRemove).off("source.load",this._onSourceUpdate).off("source.error",this._forwardSourceEvent).off("source.change",this._onSourceUpdate).off("layer.add",this._forwardLayerEvent).off("layer.remove",this._forwardLayerEvent).off("layer.error",this._forwardLayerEvent).off("tile.add",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.load",this._update).off("tile.error",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent)._remove(),this.off("rotate",this.style._redoPlacement),this.off("pitch",this.style._redoPlacement)),t?(t instanceof c?this.style=t:this.style=new c(t,this.animationLoop,this._workerCount),this.style.on("load",this._onStyleLoad).on("error",this._forwardStyleEvent).on("change",this._onStyleChange).on("source.add",this._onSourceAdd).on("source.remove",this._onSourceRemove).on("source.load",this._onSourceUpdate).on("source.error",this._forwardSourceEvent).on("source.change",this._onSourceUpdate).on("layer.add",this._forwardLayerEvent).on("layer.remove",this._forwardLayerEvent).on("layer.error",this._forwardLayerEvent).on("tile.add",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.load",this._update).on("tile.error",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this.on("rotate",this.style._redoPlacement),this.on("pitch",this.style._redoPlacement),this):(this.style=null,this)},getStyle:function(){if(this.style)return this.style.serialize()},addSource:function(t,e){return this.style.addSource(t,e),this._update(!0),this},addSourceType:function(t,e,r){return this.style.addSourceType(t,e,r)},removeSource:function(t){return this.style.removeSource(t),this._update(!0),this},getSource:function(t){return this.style.getSource(t)},addLayer:function(t,e){return this.style.addLayer(t,e),this._update(!0),this},removeLayer:function(t){return this.style.removeLayer(t),this._update(!0),this},getLayer:function(t){return this.style.getLayer(t)},setFilter:function(t,e){return this.style.setFilter(t,e),this._update(!0),this},setLayerZoomRange:function(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0),this},getFilter:function(t){return this.style.getFilter(t)},setPaintProperty:function(t,e,r,n){return this.style.setPaintProperty(t,e,r,n),this._update(!0),this},getPaintProperty:function(t,e,r){return this.style.getPaintProperty(t,e,r)},setLayoutProperty:function(t,e,r){return this.style.setLayoutProperty(t,e,r),this._update(!0),this},getLayoutProperty:function(t,e){return this.style.getLayoutProperty(t,e)},getContainer:function(){return this._container},getCanvasContainer:function(){return this._canvasContainer},getCanvas:function(){return this._canvas.getElement()},_setupContainer:function(){var t=this._container;t.classList.add("mapboxgl-map");var e=this._canvasContainer=u.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=new i(this,e);var r=this._controlContainer=u.create("div","mapboxgl-control-container",t),n=this._controlCorners={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(t){n[t]=u.create("div","mapboxgl-ctrl-"+t,r)})},_setupPainter:function(){var t=this._canvas.getWebGLContext({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer});return t?void(this.painter=new f(t,this.transform)):void this.fire("error",{error:new Error("Failed to initialize WebGL")})},_contextLost:function(t){t.preventDefault(),this._frameId&&o.cancelFrame(this._frameId),this.fire("webglcontextlost",{originalEvent:t})},_contextRestored:function(t){this._setupPainter(),this.resize(),this._update(),this.fire("webglcontextrestored",{originalEvent:t})},loaded:function(){return!this._styleDirty&&!this._sourcesDirty&&!(!this.style||!this.style.loaded())},_update:function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this._rerender(),this):this},_render:function(){try{this.style&&this._styleDirty&&(this._styleDirty=!1,this.style.update(this._classes,this._classOptions),this._classOptions=null,this.style._recalculate(this.transform.zoom)),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.painter.render(this.style,{debug:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,vertices:this.vertices,rotating:this.rotating,zooming:this.zooming}),this.fire("render"),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire("load")),this._frameId=null,this.animationLoop.stopped()||(this._styleDirty=!0),(this._sourcesDirty||this._repaint||this._styleDirty)&&this._rerender()}catch(t){this.fire("error",{error:t})}return this},remove:function(){this._hash&&this._hash.remove(),o.cancelFrame(this._frameId),this.setStyle(null),"undefined"!=typeof s&&s.removeEventListener("resize",this._onWindowResize,!1);var t=this.painter.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),n(this._canvasContainer),n(this._controlContainer),this._container.classList.remove("mapboxgl-map")},_rerender:function(){this.style&&!this._frameId&&(this._frameId=o.frame(this._render))},_forwardStyleEvent:function(t){this.fire("style."+t.type,a.extend({style:t.target},t))},_forwardSourceEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_forwardLayerEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_forwardTileEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_onStyleLoad:function(t){this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this.style.update(this._classes,{transition:!1}),this._forwardStyleEvent(t)},_onStyleChange:function(t){this._update(!0),this._forwardStyleEvent(t)},_onSourceAdd:function(t){var e=t.source;e.onAdd&&e.onAdd(this),this._forwardSourceEvent(t)},_onSourceRemove:function(t){var e=t.source;e.onRemove&&e.onRemove(this),this._forwardSourceEvent(t)},_onSourceUpdate:function(t){this._update(),this._forwardSourceEvent(t)},_onWindowOnline:function(){this._update()},_onWindowResize:function(){this._trackResize&&this.stop().resize()._update()}}),a.extendAll(A.prototype,{_showTileBoundaries:!1,get showTileBoundaries(){return this._showTileBoundaries},set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},_showCollisionBoxes:!1,get showCollisionBoxes(){return this._showCollisionBoxes},set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,this.style._redoPlacement())},_showOverdrawInspector:!1,get showOverdrawInspector(){return this._showOverdrawInspector},set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},_repaint:!1,get repaint(){return this._repaint},set repaint(t){this._repaint=t,this._update()},_vertices:!1,get vertices(){return this._vertices},set vertices(t){this._vertices=t,this._update()}})},{"../geo/lng_lat":300,"../geo/lng_lat_bounds":301,"../geo/transform":302,"../render/painter":316,"../style/animation_loop":336,"../style/style":339,"../util/browser":387,"../util/canvas":388,"../util/dom":389,"../util/evented":395,"../util/util":403,"./bind_handlers":368,"./camera":369,"./control/attribution":370,"./hash":381,"point-geometry":442}],383:[function(t,e,r){"use strict";function n(t,e){t||(t=i.create("div")),t.classList.add("mapboxgl-marker"),this._el=t,this._offset=o.convert(e&&e.offset||[0,0]),this._update=this._update.bind(this)}e.exports=n;var i=t("../util/dom"),a=t("../geo/lng_lat"),o=t("point-geometry");n.prototype={addTo:function(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._el),t.on("move",this._update),this._update(),this},remove:function(){this._map&&(this._map.off("move",this._update),this._map=null);var t=this._el.parentNode;return t&&t.removeChild(this._el),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=a.convert(t),this._update(),this},getElement:function(){return this._el},_update:function(){if(this._map){var t=this._map.project(this._lngLat)._add(this._offset);i.setTransform(this._el,"translate("+t.x+"px,"+t.y+"px)")}}}},{"../geo/lng_lat":300,"../util/dom":389,"point-geometry":442}],384:[function(t,e,r){"use strict";function n(t){i.setOptions(this,t),i.bindAll(["_update","_onClickClose"],this)}e.exports=n;var i=t("../util/util"),a=t("../util/evented"),o=t("../util/dom"),s=t("../geo/lng_lat");n.prototype=i.inherit(a,{options:{closeButton:!0,closeOnClick:!0},addTo:function(t){return this._map=t,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this},remove:function(){return this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this.fire("close"),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=s.convert(t),this._update(),this},setText:function(t){return this.setDOMContent(document.createTextNode(t))},setHTML:function(t){var e,r=document.createDocumentFragment(),n=document.createElement("body");for(n.innerHTML=t;;){if(e=n.firstChild,!e)break;r.appendChild(e)}return this.setDOMContent(r)},setDOMContent:function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},_createContent:function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._content=o.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=o.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},_update:function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=o.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=o.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content));var t=this._map.project(this._lngLat).round(),e=this.options.anchor;if(!e){var r=this._container.offsetWidth,n=this._container.offsetHeight;e=t.ythis._map.transform.height-n?["bottom"]:[],t.xthis._map.transform.width-r/2&&e.push("right"),e=0===e.length?"bottom":e.join("-")}var i={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},a=this._container.classList;for(var s in i)a.remove("mapboxgl-popup-anchor-"+s);a.add("mapboxgl-popup-anchor-"+e),o.setTransform(this._container,i[e]+" translate("+t.x+"px,"+t.y+"px)")}},_onClickClose:function(){this.remove()}})},{"../geo/lng_lat":300,"../util/dom":389,"../util/evented":395,"../util/util":403}],385:[function(t,e,r){"use strict";function n(t,e){this.target=t,this.parent=e,this.callbacks={},this.callbackID=0,this.receive=this.receive.bind(this),this.target.addEventListener("message",this.receive,!1)}e.exports=n,n.prototype.receive=function(t){function e(t,e,r){this.postMessage({type:"",id:String(i),error:t?String(t):null,data:e},r)}var r,n=t.data,i=n.id;if(""===n.type)r=this.callbacks[n.id],delete this.callbacks[n.id],r&&r(n.error||null,n.data);else if("undefined"!=typeof n.id&&this.parent[n.type])this.parent[n.type](n.data,e.bind(this));else if("undefined"!=typeof n.id&&this.parent.workerSources){var a=n.type.split(".");this.parent.workerSources[a[0]][a[1]](n.data,e.bind(this))}else this.parent[n.type](n.data)},n.prototype.send=function(t,e,r,n){var i=null;r&&(this.callbacks[i=this.callbackID++]=r),this.postMessage({type:t,id:String(i),data:e},n)},n.prototype.postMessage=function(t,e){this.target.postMessage(t,e)}},{}],386:[function(t,e,r){"use strict";function n(t){var e=document.createElement("a");return e.href=t,e.protocol===document.location.protocol&&e.host===document.location.host}r.getJSON=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.setRequestHeader("Accept","application/json"),r.onerror=function(t){e(t)},r.onload=function(){if(r.status>=200&&r.status<300&&r.response){var t;try{t=JSON.parse(r.response)}catch(t){return e(t)}e(null,t)}else e(new Error(r.statusText))},r.send(),r},r.getArrayBuffer=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.responseType="arraybuffer",r.onerror=function(t){e(t)},r.onload=function(){r.status>=200&&r.status<300&&r.response?e(null,r.response):e(new Error(r.statusText))},r.send(),r},r.getImage=function(t,e){return r.getArrayBuffer(t,function(t,r){if(t)return e(t);var n=new Image;n.onload=function(){e(null,n),(window.URL||window.webkitURL).revokeObjectURL(n.src)};var i=new Blob([new Uint8Array(r)],{type:"image/png"});return n.src=(window.URL||window.webkitURL).createObjectURL(i),n.getData=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return t.width=n.width,t.height=n.height,e.drawImage(n,0,0),e.getImageData(0,0,n.width,n.height).data},n})},r.getVideo=function(t,e){var r=document.createElement("video");r.onloadstart=function(){e(null,r)};for(var i=0;i=s+n?t.call(i,1):(t.call(i,(l-s)/n),r.frame(a)))}if(!n)return t.call(i,1),null;var o=!1,s=e.exports.now();return r.frame(a),function(){o=!0}},r.supported=t("mapbox-gl-supported"),r.hardwareConcurrency=navigator.hardwareConcurrency||4,Object.defineProperty(r,"devicePixelRatio",{get:function(){return window.devicePixelRatio}}),r.supportsWebp=!1;var a=document.createElement("img");a.onload=function(){r.supportsWebp=!0},a.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=",r.supportsGeolocation=!!navigator.geolocation},{"mapbox-gl-supported":288}],388:[function(t,e,r){"use strict";function n(t,e){this.canvas=document.createElement("canvas"),t&&e&&(this.canvas.style.position="absolute",this.canvas.classList.add("mapboxgl-canvas"),this.canvas.addEventListener("webglcontextlost",t._contextLost.bind(t),!1),this.canvas.addEventListener("webglcontextrestored",t._contextRestored.bind(t),!1),this.canvas.setAttribute("tabindex",0),e.appendChild(this.canvas))}var i=t("../util"),a=t("mapbox-gl-supported");e.exports=n,n.prototype.resize=function(t,e){var r=window.devicePixelRatio||1;this.canvas.width=r*t,this.canvas.height=r*e,this.canvas.style.width=t+"px",this.canvas.style.height=e+"px"},n.prototype.getWebGLContext=function(t){return t=i.extend({},t,a.webGLContextAttributes),this.canvas.getContext("webgl",t)||this.canvas.getContext("experimental-webgl",t)},n.prototype.getElement=function(){return this.canvas}},{"../util":403,"mapbox-gl-supported":288}],389:[function(t,e,r){"use strict";function n(t){for(var e=0;e1)for(var h=0;h=0&&this._events[t].splice(r,1),this._events[t].length||delete this._events[t]}else delete this._events[t];return this},once:function(t,e){var r=function(n){this.off(t,r),e.call(this,n)}.bind(this);return this.on(t,r),this},fire:function(t,e){if(!this.listens(t))return n.endsWith(t,"error")&&console.error(e&&e.error||e||"Empty error event"),this;e=n.extend({},e),n.extend(e,{type:t,target:this});for(var r=this._events[t].slice(),i=0;i=3)for(var l=0;l1){if(s(t,e))return!0;for(var n=0;n(e.y-t.y)*(r.x-t.x)}function u(t,e,r,n){return l(t,r,n)!==l(e,r,n)&&l(t,e,r)!==l(t,e,n)}function c(t,e,r){var n=r*r;if(1===e.length)return t.distSqr(e[0])1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function f(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 d(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}e.exports={multiPolygonIntersectsBufferedMultiPoint:n,multiPolygonIntersectsMultiPolygon:i,multiPolygonIntersectsBufferedMultiLine:a}},{}],399:[function(t,e,r){"use strict";function n(t,e){this.max=t,this.onRemove=e,this.reset()}e.exports=n,n.prototype.reset=function(){for(var t in this.data)this.onRemove(this.data[t]);return this.data={},this.order=[],this},n.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var r=this.get(this.order[0]);r&&this.onRemove(r)}return this},n.prototype.has=function(t){return t in this.data},n.prototype.keys=function(){return this.order},n.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},n.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this.get(this.order[0]);e&&this.onRemove(e)}return this}},{}],400:[function(t,e,r){"use strict";function n(t,e,r){if(r=r||o.ACCESS_TOKEN,!r&&o.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox GL. See https://www.mapbox.com/developers/api/#access-tokens");if(t=t.replace(/^mapbox:\/\//,o.API_URL+e),t+=t.indexOf("?")!==-1?"&access_token=":"?access_token=",o.REQUIRE_ACCESS_TOKEN){if("s"===r[0])throw new Error("Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). See https://www.mapbox.com/developers/api/#access-tokens");t+=r}return t}function i(t){return t?"?"+t:""}function a(t){return t.access_token&&"tk."===t.access_token.slice(0,3)?u.extend({},t,{access_token:o.ACCESS_TOKEN}):t}var o=t("./config"),s=t("./browser"),l=t("url"),u=t("./util");e.exports.normalizeStyleURL=function(t,e){var r=l.parse(t);return"mapbox:"!==r.protocol?t:n("mapbox:/"+r.pathname+i(r.query),"/styles/v1/",e)},e.exports.normalizeSourceURL=function(t,e){var r=l.parse(t);return"mapbox:"!==r.protocol?t:n(t+".json","/v4/",e)+"&secure"},e.exports.normalizeGlyphsURL=function(t,e){var r=l.parse(t);if("mapbox:"!==r.protocol)return t;var a=r.pathname.split("/")[1];return n("mapbox://"+a+"/{fontstack}/{range}.pbf"+i(r.query),"/fonts/v1/",e)},e.exports.normalizeSpriteURL=function(t,e,r,a){var o=l.parse(t);return"mapbox:"!==o.protocol?(o.pathname+=e+r,l.format(o)):n("mapbox:/"+o.pathname+"/sprite"+e+r+i(o.query),"/styles/v1/",a)},e.exports.normalizeTileURL=function(t,e,r){var n=l.parse(t,!0);if(!e)return t;var i=l.parse(e);if("mapbox:"!==i.protocol)return t;var o=s.supportsWebp?".webp":"$1",u=s.devicePixelRatio>=2||512===r?"@2x":"";return l.format({protocol:n.protocol,hostname:n.hostname,pathname:n.pathname.replace(/(\.(?:png|jpg)\d*)/,u+o),query:a(n.query)})}},{"./browser":387,"./config":392,"./util":403,url:500}],401:[function(t,e,r){"use strict";function n(t){function e(){f.apply(this,arguments)}function r(){d.apply(this,arguments),this.members=e.prototype.members}var n=JSON.stringify(t);if(m[n])return m[n];void 0===t.alignment&&(t.alignment=1),e.prototype=Object.create(f.prototype);var s=0,u=0,v=["Uint8"];return e.prototype.members=t.members.map(function(r){r={name:r.name,type:r.type,components:r.components||1},p(r.name.length),p(r.type in g),v.indexOf(r.type)<0&&v.push(r.type);var n=o(r.type);u=Math.max(u,n),r.offset=s=a(s,Math.max(t.alignment,n));for(var i=0;ithis.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*this.RESIZE_MULTIPLIER),this.DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},d.prototype._refreshViews=function(){for(var t=0;t=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.coalesce=function(){for(var t=0;t=0)return!0;return!1};var o={};r.warnOnce=function(t){o[t]||("undefined"!=typeof console&&console.warn(t),o[t]=!0)}},{"../geo/coordinate":299,unitbezier:499}],404:[function(t,e,r){"use strict";function n(t,e,r,n){this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,null!=t.id&&(this.id=t.id)}e.exports=n,n.prototype={type:"Feature",get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},set geometry(t){this._geometry=t},toJSON:function(){var t={};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&"toJSON"!==e&&(t[e]=this[e]);return t}}},{}],405:[function(t,e,r){e.exports={_args:[[{raw:"mapbox-gl@^0.22.0",scope:null,escapedName:"mapbox-gl",name:"mapbox-gl",rawSpec:"^0.22.0",spec:">=0.22.0 <0.23.0",type:"range"},"/home/etienne/Documents/plotly/plotly.js"]],_from:"mapbox-gl@>=0.22.0 <0.23.0",_id:"mapbox-gl@0.22.1",_inCache:!0,_location:"/mapbox-gl",_nodeVersion:"4.4.5",_npmOperationalInternal:{host:"packages-12-west.internal.npmjs.com",tmp:"tmp/mapbox-gl-0.22.1.tgz_1471549891670_0.8762630566488951"},_npmUser:{name:"lucaswoj",email:"lucas@lucaswoj.com"},_npmVersion:"2.15.5",_phantomChildren:{},_requested:{raw:"mapbox-gl@^0.22.0",scope:null,escapedName:"mapbox-gl",name:"mapbox-gl",rawSpec:"^0.22.0",spec:">=0.22.0 <0.23.0",type:"range"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.1.tgz",_shasum:"92a965547d4c2f24c22cbc487eeda48694cb627a",_shrinkwrap:null,_spec:"mapbox-gl@^0.22.0",_where:"/home/etienne/Documents/plotly/plotly.js",browser:{"./js/util/ajax.js":"./js/util/browser/ajax.js","./js/util/browser.js":"./js/util/browser/browser.js","./js/util/canvas.js":"./js/util/browser/canvas.js","./js/util/dom.js":"./js/util/browser/dom.js","./js/util/web_worker.js":"./js/util/browser/web_worker.js"},bugs:{url:"https://github.com/mapbox/mapbox-gl-js/issues"},dependencies:{csscolorparser:"^1.0.2",earcut:"^2.0.3","feature-filter":"^2.2.0","geojson-rewind":"^0.1.0","geojson-vt":"^2.4.0","gl-matrix":"^2.3.1","grid-index":"^1.0.0","mapbox-gl-function":"^1.2.1","mapbox-gl-shaders":"github:mapbox/mapbox-gl-shaders#de2ab007455aa2587c552694c68583f94c9f2747","mapbox-gl-style-spec":"github:mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae","mapbox-gl-supported":"^1.2.0",pbf:"^1.3.2",pngjs:"^2.2.0","point-geometry":"^0.0.0",quickselect:"^1.0.0",request:"^2.39.0","resolve-url":"^0.2.1","shelf-pack":"^1.0.0",supercluster:"^2.0.1",unassertify:"^2.0.0",unitbezier:"^0.0.0","vector-tile":"^1.3.0","vt-pbf":"^2.0.2",webworkify:"^1.3.0","whoots-js":"^2.0.0"},description:"A WebGL interactive maps library",devDependencies:{"babel-preset-react":"^6.11.1",babelify:"^7.3.0",benchmark:"~2.1.0",browserify:"^13.0.0",clipboard:"^1.5.12","concat-stream":"1.5.1",coveralls:"^2.11.8",doctrine:"^1.2.1",documentation:"https://github.com/documentationjs/documentation/archive/bb41619c734e59ef3fbc3648610032efcfdaaace.tar.gz","documentation-theme-utils":"3.0.0",envify:"^3.4.0",eslint:"^2.5.3","eslint-config-mourner":"^2.0.0","eslint-plugin-html":"^1.5.1",gl:"^4.0.1",handlebars:"4.0.5","highlight.js":"9.3.0",istanbul:"^0.4.2","json-loader":"^0.5.4",lodash:"^4.13.1","mapbox-gl-test-suite":"github:mapbox/mapbox-gl-test-suite#7babab52fb02788ebbc38384139bf350e8e38552","memory-fs":"^0.3.0",minifyify:"^7.0.1","npm-run-all":"^3.0.0",nyc:"6.4.0",proxyquire:"^1.7.9",remark:"4.2.2","remark-html":"3.0.0",sinon:"^1.15.4",st:"^1.2.0",tap:"^5.7.0","transform-loader":"^0.2.3","unist-util-visit":"1.1.0",vinyl:"1.1.1","vinyl-fs":"2.4.3",watchify:"^3.7.0",webpack:"^1.13.1","webworkify-webpack":"^1.1.3"},directories:{},dist:{shasum:"92a965547d4c2f24c22cbc487eeda48694cb627a",tarball:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.1.tgz"},engines:{node:">=4.0.0"},gitHead:"13a9015341f0602ccb55c98c53079838ad4b70b5",homepage:"https://github.com/mapbox/mapbox-gl-js#readme",license:"BSD-3-Clause",main:"js/mapbox-gl.js",maintainers:[{name:"aaronlidman",email:"aaronlidman@gmail.com"},{name:"ajashton",email:"aj.ashton@gmail.com"},{name:"ansis",email:"ansis.brammanis@gmail.com"},{name:"bergwerkgis",email:"wb@bergwerk-gis.at"},{name:"bhousel",email:"bryan@mapbox.com"},{name:"bsudekum",email:"bobby@mapbox.com"},{name:"camilleanne",email:"camille@mapbox.com"},{name:"dnomadb",email:"damon@mapbox.com"},{name:"dthompson",email:"dthompson@gmail.com"},{name:"emilymcafee",email:"emily@mapbox.com"},{name:"flippmoke",email:"flippmoke@gmail.com"},{name:"freenerd",email:"spam@freenerd.de"},{name:"gretacb",email:"carol@mapbox.com"},{name:"ian29",email:"ian.villeda@gmail.com"},{name:"ianshward",email:"ian@mapbox.com"},{name:"ingalls",email:"nicholas.ingalls@gmail.com"},{name:"jfirebaugh",email:"john.firebaugh@gmail.com"},{name:"jrpruit1",email:"jake@jakepruitt.com"},{name:"karenzshea",email:"karen@mapbox.com"},{name:"kkaefer",email:"kkaefer@gmail.com"},{name:"lbud",email:"lauren@mapbox.com"},{name:"lucaswoj",email:"lucas@lucaswoj.com"},{name:"lxbarth",email:"alex@mapbox.com"},{name:"lyzidiamond",email:"lyzi@mapbox.com"},{name:"mapbox-admin",email:"accounts@mapbox.com"},{name:"mateov",email:"matt@mapbox.com"},{name:"mcwhittemore",email:"mcwhittemore@gmail.com"},{name:"miccolis",email:"jeff@miccolis.net"},{name:"mikemorris",email:"michael.patrick.morris@gmail.com"},{name:"morganherlocker",email:"morgan.herlocker@gmail.com"},{name:"mourner",email:"agafonkin@gmail.com"},{name:"nickidlugash",email:"nicki@mapbox.com"},{name:"rclark",email:"ryan.clark.j@gmail.com"},{name:"samanbb",email:"saman@mapbox.com"},{name:"sbma44",email:"tlee@mapbox.com"},{name:"scothis",email:"scothis@gmail.com"},{name:"sgillies",email:"sean@mapbox.com"},{name:"springmeyer",email:"dane@mapbox.com"},{name:"themarex",email:"patrick@mapbox.com"},{name:"tmcw",email:"tom@macwright.org"},{name:"tristen",email:"tristen.brown@gmail.com"},{name:"willwhite",email:"will@mapbox.com"},{name:"yhahn",email:"young@mapbox.com"}],name:"mapbox-gl",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git://github.com/mapbox/mapbox-gl-js.git"},scripts:{build:"npm run build-docs # invoked by publisher when publishing docs on the mb-pages branch","build-dev":"browserify js/mapbox-gl.js --debug --standalone mapboxgl > dist/mapbox-gl-dev.js && tap --no-coverage test/build/dev.test.js","build-docs":"documentation build --github --format html -c documentation.yml --theme ./docs/_theme --output docs/api/","build-min":"browserify js/mapbox-gl.js --debug -t unassertify --plugin [minifyify --map mapbox-gl.js.map --output dist/mapbox-gl.js.map] --standalone mapboxgl > dist/mapbox-gl.js && tap --no-coverage test/build/min.test.js","build-token":"browserify debug/access-token-src.js --debug -t envify > debug/access-token.js",lint:"eslint --ignore-path .gitignore js test bench docs/_posts/examples/*.html","open-changed-examples":"git diff --name-only mb-pages HEAD -- docs/_posts/examples/*.html | awk '{print \"http://127.0.0.1:4000/mapbox-gl-js/example/\" substr($0,33,length($0)-37)}' | xargs open",start:"run-p build-token watch-dev watch-bench start-server","start-bench":"run-p build-token watch-bench start-server","start-debug":"run-p build-token watch-dev start-server","start-docs":"npm run build-min && npm run build-docs && jekyll serve -w","start-server":"st --no-cache --localhost --port 9966 --index index.html .",test:"npm run lint && tap --reporter dot test/js/*/*.js test/build/webpack.test.js","test-suite":"node test/render.test.js && node test/query.test.js","watch-bench":"node bench/download-data.js && watchify bench/index.js --plugin [minifyify --no-map] -t [babelify --presets react] -t unassertify -t envify -o bench/bench.js -v","watch-dev":"watchify js/mapbox-gl.js --debug --standalone mapboxgl -o dist/mapbox-gl-dev.js -v"},version:"0.22.1"}},{}],406:[function(t,e,r){"use strict";function n(t,e,r){for(var n=new Array(t),i=0;im[1][2]&&(x[0]=-x[0]),m[0][2]>m[2][0]&&(x[1]=-x[1]),m[1][0]>m[0][1]&&(x[2]=-x[2]),!0}},{"./normalize":408,"gl-mat4/clone":143,"gl-mat4/create":144,"gl-mat4/determinant":145,"gl-mat4/invert":149,"gl-mat4/transpose":159,"gl-vec3/cross":237,"gl-vec3/dot":238,"gl-vec3/length":239,"gl-vec3/normalize":241}],408:[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}},{}],409:[function(t,e,r){function n(t,e,r,n){if(0===c(e)||0===c(r))return!1;var i=u(e,f.translate,f.scale,f.skew,f.perspective,f.quaternion),a=u(r,d.translate,d.scale,d.skew,d.perspective,d.quaternion);return!(!i||!a)&&(s(p.translate,f.translate,d.translate,n),s(p.skew,f.skew,d.skew,n),s(p.scale,f.scale,d.scale,n),s(p.perspective,f.perspective,d.perspective,n),h(p.quaternion,f.quaternion,d.quaternion,n),l(t,p.translate,p.scale,p.skew,p.perspective,p.quaternion),!0)}function i(){return{translate:a(),scale:a(1),skew:a(),perspective:o(),quaternion:o()}}function a(t){return[t||0,t||0,t||0]}function o(){return[0,0,0,1]}var s=t("gl-vec3/lerp"),l=t("mat4-recompose"),u=t("mat4-decompose"),c=t("gl-mat4/determinant"),h=t("quat-slerp"),f=i(),d=i(),p=i();e.exports=n},{"gl-mat4/determinant":145,"gl-vec3/lerp":240,"mat4-decompose":407,"mat4-recompose":410,"quat-slerp":447}],410:[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":144,"gl-mat4/fromRotationTranslation":147,"gl-mat4/identity":148,"gl-mat4/multiply":151,"gl-mat4/scale":157,"gl-mat4/translate":158}],411:[function(t,e,r){"use strict";function n(t){this._components=t.slice(),this._time=[0],this.prevMatrix=t.slice(),this.nextMatrix=t.slice(),this.computedMatrix=t.slice(),this.computedInverse=t.slice(),this.computedEye=[0,0,0],this.computedUp=[0,0,0],this.computedCenter=[0,0,0],this.computedRadius=[0],this._limits=[-(1/0),1/0]}function i(t){t=t||{};var e=t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return new n(e)}var a=t("binary-search-bounds"),o=t("mat4-interpolate"),s=t("gl-mat4/invert"),l=t("gl-mat4/rotateX"),u=t("gl-mat4/rotateY"),c=t("gl-mat4/rotateZ"),h=t("gl-mat4/lookAt"),f=t("gl-mat4/translate"),d=(t("gl-mat4/scale"),t("gl-vec3/normalize")),p=[0,0,0];e.exports=i;var g=n.prototype;g.recalcMatrix=function(t){var e=this._time,r=a.le(e,t),n=this.computedMatrix;if(!(r<0)){var i=this._components;if(r===e.length-1)for(var l=16*r,u=0;u<16;++u)n[u]=i[l++];else{for(var c=e[r+1]-e[r],l=16*r,h=this.prevMatrix,f=!0,u=0;u<16;++u)h[u]=i[l++];for(var p=this.nextMatrix,u=0;u<16;++u)p[u]=i[l++],f=f&&h[u]===p[u];if(c<1e-6||f)for(var u=0;u<16;++u)n[u]=h[u];else o(n,h,p,(t-e[r])/c)}var g=this.computedUp;g[0]=n[1],g[1]=n[5],g[2]=n[6],d(g,g);var m=this.computedInverse;s(m,n);var v=this.computedEye,y=m[15];v[0]=m[12]/y,v[1]=m[13]/y,v[2]=m[14]/y;for(var x=this.computedCenter,b=Math.exp(this.computedRadius[0]),u=0;u<3;++u)x[u]=v[u]-n[2+4*u]*b}},g.idle=function(t){if(!(t1&&i(t[o[c-2]],t[o[c-1]],u)<=0;)c-=1,o.pop();for(o.push(l),c=s.length;c>1&&i(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(l)}for(var r=new Array(s.length+o.length-2),h=0,n=0,f=o.length;n0;--d)r[h++]=s[d];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":465}],413:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==g.alt,g.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==g.shift,g.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==g.control,g.control=!!t.ctrlKey), -"metaKey"in t&&(e=e||t.metaKey!==g.meta,g.meta=!!t.metaKey),e}function n(t,n){var a=i.x(n),o=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==f||a!==d||o!==p||r(n))&&(f=0|t,d=a||0,p=o||0,e&&e(f,d,p,g))}function a(t){n(0,t)}function o(){(f||d||p||g.shift||g.alt||g.meta||g.control)&&(d=p=0,f=0,g.shift=g.alt=g.control=g.meta=!1,e&&e(0,0,0,g))}function s(t){r(t)&&e&&e(f,d,p,g)}function l(t){0===i.buttons(t)?n(0,t):n(f,t)}function u(t){n(f|i.buttons(t),t)}function c(t){n(f&~i.buttons(t),t)}function h(){m||(m=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",a),t.addEventListener("mouseenter",a),t.addEventListener("mouseout",a),t.addEventListener("mouseover",a),t.addEventListener("blur",o),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",o),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var f=0,d=0,p=0,g={shift:!1,alt:!1,control:!1,meta:!1},m=!1;h();var v={element:t};return Object.defineProperties(v,{enabled:{get:function(){return m},set:function(t){t&&h()},enumerable:!0},buttons:{get:function(){return f},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return g},enumerable:!0}}),v}e.exports=n;var i=t("mouse-event")},{"mouse-event":414}],414:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<=0;--e)L(e,0);for(var r=[],e=0;e0;_=_-1&g)b.push(w+"["+T+"+"+m(_)+"]");b.push(v(0));for(var _=0;_0){",f(b[t]),"=1;"),D(t-1,e|1<0&&G.push(s(U,b[V-1])+"*"+o(b[V-1])),N.push(d(U,b[V])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)X.push(o(b[U]));N.push(k+"=("+X.join("*")+")|0",M+"=mallocUint32("+k+")",w+"=mallocUint32("+k+")",T+"=0"),N.push(p(0)+"=0");for(var V=1;V<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 a=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return x(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=b;var w="V",M="P",A="N",k="Q",T="X",E="T"},{"typedarray-pool":496}],417:[function(t,e,r){"use strict";var n=t("cwise/lib/wrapper")({args:["index","array","scalar"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{_inline_4_arg1_=_inline_4_arg2_.apply(void 0,_inline_4_arg0_)}",args:[{name:"_inline_4_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_4_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_4_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":94}],418:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;r=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){o.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push("&&s[",l,"]>2");o.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push(",dst.pick(",s.join(),",",l,")",u);o.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",f.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>1){diff(",h,",src.pick(",f.join(),")",u,",src.pick(",d.join(),")",u,");}else{zero(",h,");};");break;case"mirror":0===r?o.push("dst.set(",s.join(),",",c,",0);"):o.push("zero(",h,");");break;case"wrap":var p=s.slice(),g=s.slice();e[l]<0?(p[c]="s["+c+"]-2",g[c]="0"):(p[c]="s["+c+"]-1",g[c]="1"),0===r?o.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>2){diff(",h,",src.pick(",p.join(),")",u,",src.pick(",g.join(),")",u,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&o.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var a=t.length,o=["function gradient(dst,src){var s=src.shape.slice();"],s=0;s<1<>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=a({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]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var h=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=o({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=o({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=o({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=a({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=a({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=o({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":91}],422:[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":423,ndarray:427}],423:[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":91}],424:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;r1){for(var h=[],f=1;f1){o.push("dptr=0;sptr=ptr");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&o.push(["for(i",d,"=0;i",d,"left){","dptr=0","sptr=cptr-s0");for(var f=1;fb){break __l}"].join(""));for(var f=t.length-1;f>=1;--f)o.push("sptr+=e"+f,"dptr+=f"+f,"}");o.push("dptr=cptr;sptr=cptr-s0");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&o.push(["for(i",d,"=0;i",d,"=0;--f){var d=t[f];0!==d&&o.push(["for(i",d,"=0;i",d,"left)&&("+r("cptr-s0")+">scratch)){",a("cptr",r("cptr-s0")),"cptr-=s0","}",a("cptr","scratch"));if(o.push("}"),t.length>1&&u&&o.push("free(scratch)"),o.push("} return "+s),u){var p=new Function("malloc","free",o.join("\n"));return p(u[0],u[1])}var p=new Function(o.join("\n"));return p()}function o(t,e,r){function a(t){return["(offset+",t,"*s0)"].join("")}function o(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+a(e[0]));else for(var i=0;i=0;--i){var o=t[i];0!==o&&_.push(["for(i",o,"=0;i",o,"1)for(var i=0;i1?_.push("ptr_shift+=d"+o):_.push("ptr0+=d"+o),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+a(r[0]));else{for(var o=0;o1)for(var o=0;o=1;--o)n&&_.push("pivot_ptr+=f"+o),r.length>1?_.push("ptr_shift+=e"+o):_.push("ptr0+=e"+o),_.push("}")}function h(){t.length>1&&A&&_.push("free(pivot1)","free(pivot2)")}function f(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++k;c(s,[n,i],!1,["comp=",o("ptr0"),"-",o("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",o(a(n)),">",o(a(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?l([e,r],!1,s("ptr0",o("ptr1"))):_.push(s(a(e),o(a(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++k;c(i,[r],!0,[e,"=",o("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",o(a(r)),"-pivot",n].join(""))}function g(e,r){t.length>1?l([e,r],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join(""))}function m(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","ptr2=",a(n),"\n","++",r,"\n","--",n,"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join(""))}function v(t,e){g(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",o("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(a(e),o(a(r))),s(a(r),"pivot"+n))}function x(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function b(e,r,n){t.length>1?(_.push(["__l",++k,":while(true){"].join("")),l([e],!0,["if(",o("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",k,"}"].join("")),_.push(n,"}")):_.push(["while(",o(a(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),M=["left","right","data","offset"].concat(i(t.length)),A=n(e),k=0;_.push(["function ",w,"(",M.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],S=1;S1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",o("ptr1"),"\n","pivot2[pivot_ptr]=",o("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",o("ptr0"),"\n","y=",o("ptr2"),"\n","z=",o("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",o(a("el2")),"\n","pivot2=",o(a("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",o(a("el1")),"\n","y=",o(a("el3")),"\n","z=",o(a("el5")),"\n",s(a("index1"),"x"),"\n",s(a("index3"),"y"),"\n",s(a("index5"),"z")].join("")),d("index2","left"),d("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),p("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),p("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),m("k","less","great"),_.push("break"),_.push("}else{"),v("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"), +"metaKey"in t&&(e=e||t.metaKey!==g.meta,g.meta=!!t.metaKey),e}function n(t,n){var a=i.x(n),o=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==f||a!==d||o!==p||r(n))&&(f=0|t,d=a||0,p=o||0,e&&e(f,d,p,g))}function a(t){n(0,t)}function o(){(f||d||p||g.shift||g.alt||g.meta||g.control)&&(d=p=0,f=0,g.shift=g.alt=g.control=g.meta=!1,e&&e(0,0,0,g))}function s(t){r(t)&&e&&e(f,d,p,g)}function l(t){0===i.buttons(t)?n(0,t):n(f,t)}function u(t){n(f|i.buttons(t),t)}function c(t){n(f&~i.buttons(t),t)}function h(){m||(m=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",a),t.addEventListener("mouseenter",a),t.addEventListener("mouseout",a),t.addEventListener("mouseover",a),t.addEventListener("blur",o),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",o),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var f=0,d=0,p=0,g={shift:!1,alt:!1,control:!1,meta:!1},m=!1;h();var v={element:t};return Object.defineProperties(v,{enabled:{get:function(){return m},set:function(t){t&&h()},enumerable:!0},buttons:{get:function(){return f},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return g},enumerable:!0}}),v}e.exports=n;var i=t("mouse-event")},{"mouse-event":414}],414:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<=0;--e)L(e,0);for(var r=[],e=0;e0;_=_-1&g)b.push(w+"["+T+"+"+m(_)+"]");b.push(v(0));for(var _=0;_0){",f(b[t]),"=1;"),D(t-1,e|1<0&&G.push(s(U,b[V-1])+"*"+o(b[V-1])),N.push(d(U,b[V])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)X.push(o(b[U]));N.push(k+"=("+X.join("*")+")|0",M+"=mallocUint32("+k+")",w+"=mallocUint32("+k+")",T+"=0"),N.push(p(0)+"=0");for(var V=1;V<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 a=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return x(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=b;var w="V",M="P",A="N",k="Q",T="X",E="T"},{"typedarray-pool":496}],417:[function(t,e,r){"use strict";var n=t("cwise/lib/wrapper")({args:["index","array","scalar"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{_inline_4_arg1_=_inline_4_arg2_.apply(void 0,_inline_4_arg0_)}",args:[{name:"_inline_4_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_4_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_4_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":94}],418:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;r=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){o.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push("&&s[",l,"]>2");o.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push(",dst.pick(",s.join(),",",l,")",u);o.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",f.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>1){diff(",h,",src.pick(",f.join(),")",u,",src.pick(",d.join(),")",u,");}else{zero(",h,");};");break;case"mirror":0===r?o.push("dst.set(",s.join(),",",c,",0);"):o.push("zero(",h,");");break;case"wrap":var p=s.slice(),g=s.slice();e[l]<0?(p[c]="s["+c+"]-2",g[c]="0"):(p[c]="s["+c+"]-1",g[c]="1"),0===r?o.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>2){diff(",h,",src.pick(",p.join(),")",u,",src.pick(",g.join(),")",u,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&o.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var a=t.length,o=["function gradient(dst,src){var s=src.shape.slice();"],s=0;s<1<>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=a({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]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var h=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=o({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=o({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=o({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=a({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=a({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=o({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":91}],422:[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":423,ndarray:427}],423:[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":91}],424:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;r1){for(var h=[],f=1;f1){o.push("dptr=0;sptr=ptr");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&o.push(["for(i",d,"=0;i",d,"left){","dptr=0","sptr=cptr-s0");for(var f=1;fb){break __l}"].join(""));for(var f=t.length-1;f>=1;--f)o.push("sptr+=e"+f,"dptr+=f"+f,"}");o.push("dptr=cptr;sptr=cptr-s0");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&o.push(["for(i",d,"=0;i",d,"=0;--f){var d=t[f];0!==d&&o.push(["for(i",d,"=0;i",d,"left)&&("+r("cptr-s0")+">scratch)){",a("cptr",r("cptr-s0")),"cptr-=s0","}",a("cptr","scratch"));if(o.push("}"),t.length>1&&u&&o.push("free(scratch)"),o.push("} return "+s),u){var p=new Function("malloc","free",o.join("\n"));return p(u[0],u[1])}var p=new Function(o.join("\n"));return p()}function o(t,e,r){function a(t){return["(offset+",t,"*s0)"].join("")}function o(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+a(e[0]));else for(var i=0;i=0;--i){var o=t[i];0!==o&&_.push(["for(i",o,"=0;i",o,"1)for(var i=0;i1?_.push("ptr_shift+=d"+o):_.push("ptr0+=d"+o),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+a(r[0]));else{for(var o=0;o1)for(var o=0;o=1;--o)n&&_.push("pivot_ptr+=f"+o),r.length>1?_.push("ptr_shift+=e"+o):_.push("ptr0+=e"+o),_.push("}")}function h(){t.length>1&&A&&_.push("free(pivot1)","free(pivot2)")}function f(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++k;c(s,[n,i],!1,["comp=",o("ptr0"),"-",o("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",o(a(n)),">",o(a(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?l([e,r],!1,s("ptr0",o("ptr1"))):_.push(s(a(e),o(a(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++k;c(i,[r],!0,[e,"=",o("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",o(a(r)),"-pivot",n].join(""))}function g(e,r){t.length>1?l([e,r],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join(""))}function m(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","ptr2=",a(n),"\n","++",r,"\n","--",n,"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join(""))}function v(t,e){g(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",o("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(a(e),o(a(r))),s(a(r),"pivot"+n))}function x(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function b(e,r,n){t.length>1?(_.push(["__l",++k,":while(true){"].join("")),l([e],!0,["if(",o("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",k,"}"].join("")),_.push(n,"}")):_.push(["while(",o(a(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),M=["left","right","data","offset"].concat(i(t.length)),A=n(e),k=0;_.push(["function ",w,"(",M.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],S=1;S1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",o("ptr1"),"\n","pivot2[pivot_ptr]=",o("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",o("ptr0"),"\n","y=",o("ptr2"),"\n","z=",o("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",o(a("el2")),"\n","pivot2=",o(a("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",o(a("el1")),"\n","y=",o(a("el3")),"\n","z=",o(a("el5")),"\n",s(a("index1"),"x"),"\n",s(a("index3"),"y"),"\n",s(a("index5"),"z")].join("")),d("index2","left"),d("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),p("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),p("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),m("k","less","great"),_.push("break"),_.push("}else{"),v("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"), _.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp>0){"),_.push("if(--greatindex5){"),b("less",1,"++less"),b("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp===0){"),_.push("if(--great1&&A){var L=new Function("insertionSort","malloc","free",_.join("\n"));return L(r,A[0],A[1])}var L=new Function("insertionSort",_.join("\n"));return L(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c0?l.push(["d",m,"=s",m,"-d",p,"*n",p].join("")):l.push(["d",m,"=s",m].join("")),p=m);var d=t.length-1-c;0!==d&&(g>0?l.push(["e",d,"=s",d,"-e",g,"*n",g,",f",d,"=",h[d],"-f",g,"*n",g].join("")):l.push(["e",d,"=s",d,",f",d,"=",h[d]].join("")),g=d)}r.push("var "+l.join(","));var v=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",v.join(","),")}else{","quickSort(",v.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),x=a(t,e),b=o(t,e,x);return y(x,b)}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":496}],425:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],o=n.join(":"),s=a[o];return s||(a[o]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),a={};e.exports=n},{"./lib/compile_sort.js":424}],426:[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_21_arg4_)}",args:[{name:"_inline_21_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_21_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_21_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_21_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_21_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_22_arg2_(this_warped,_inline_22_arg0_),_inline_22_arg1_=_inline_22_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_22_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_22_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_22_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_22_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_22_arg4_",lvalue:!1,rvalue:!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_25_arg2_(this_warped,_inline_25_arg0_),_inline_25_arg1_=_inline_25_arg3_(_inline_25_arg4_,this_warped[0])}",args:[{name:"_inline_25_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_25_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_25_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_25_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_25_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"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_28_arg2_(this_warped,_inline_28_arg0_),_inline_28_arg1_=_inline_28_arg3_(_inline_28_arg4_,this_warped[0],this_warped[1])}",args:[{name:"_inline_28_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_28_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_28_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_28_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_28_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"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_31_arg2_(this_warped,_inline_31_arg0_),_inline_31_arg1_=_inline_31_arg3_(_inline_31_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_31_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_31_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_31_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_31_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_31_arg4_",lvalue:!1,rvalue:!0,count:1}],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":94,"ndarray-linear-interpolate":420}],427:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;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("+u.join(",")+",v){"),n?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var m=0;m=0){d=i"+m+"|0;b+=c"+m+"*d;a"+m+"-=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var m=0;m=0){c=(c+this.stride["+m+"]*i"+m+")|0}else{a.push(this.shape["+m+"]);b.push(this.stride["+m+"])}");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,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",a.join("\n"));return o(h[t],i)}function o(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=h.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),a=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":97}],429:[function(t,e,r){var n=1e-6,i=1e-6;r.vertexNormals=function(t,e,r){for(var i=e.length,a=new Array(i),o=void 0===r?n:r,s=0;so)for(var _=a[c],w=1/Math.sqrt(v*x),b=0;b<3;++b){var M=(b+1)%3,A=(b+2)%3;_[b]+=w*(y[M]*m[A]-y[A]*m[M])}}for(var s=0;so)for(var w=1/Math.sqrt(k),b=0;b<3;++b)_[b]*=w;else for(var b=0;b<3;++b)_[b]=0}return a},r.faceNormals=function(t,e,r){for(var n=t.length,a=new Array(n),o=void 0===r?i:r,s=0;so?1/Math.sqrt(p):0;for(var c=0;c<3;++c)d[c]*=p;a[s]=d}return a}},{}],430:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u){var c=e+a+u;if(h>0){var h=Math.sqrt(c+1);t[0]=.5*(o-l)/h,t[1]=.5*(s-n)/h,t[2]=.5*(r-a)/h,t[3]=.5*h}else{var f=Math.max(e,a,u),h=Math.sqrt(2*f-c+1);e>=f?(t[0]=.5*h,t[1]=.5*(i+r)/h,t[2]=.5*(s+n)/h,t[3]=.5*(o-l)/h):a>=f?(t[0]=.5*(r+i)/h,t[1]=.5*h,t[2]=.5*(l+o)/h,t[3]=.5*(s-n)/h):(t[0]=.5*(n+s)/h,t[1]=.5*(o+l)/h,t[2]=.5*h,t[3]=.5*(r-i)/h)}return t}e.exports=n},{}],431:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function a(t,e){var r=e[0],n=e[1],a=e[2],o=e[3],s=i(r,n,a,o);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=a/s,t[3]=o/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function o(t,e,r){this.radius=l([r]),this.center=l(e),this.rotation=l(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),r=[].slice.call(r,0,4),a(r,r);var i=new o(r,e,Math.log(n));return i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up),i}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/lookAt"),c=t("gl-mat4/fromQuat"),h=t("gl-mat4/invert"),f=t("./lib/quatFromFrame"),d=o.prototype;d.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},d.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;a(e,e);var r=this.computedMatrix;c(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 u=0,h=0;h<3;++h)u+=r[l+4*h]*i[h];r[12+l]=-u}},d.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},d.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},d.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},d.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=a[1],s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],h=a[4],f=a[8],d=c*o+h*s+f*l;c-=o*d,h-=s*d,f-=l*d;var p=n(c,h,f);c/=p,h/=p,f/=p;var g=a[2],m=a[6],v=a[10],y=g*o+m*s+v*l,x=g*c+m*h+v*f;g-=y*o+x*c,m-=y*s+x*h,v-=y*l+x*f;var b=n(g,m,v);g/=b,m/=b,v/=b;var _=c*e+o*r,w=h*e+s*r,M=f*e+l*r;this.center.move(t,_,w,M);var A=Math.exp(this.computedRadius[0]);A=Math.max(1e-4,A+i),this.radius.set(t,Math.log(A))},d.rotate=function(t,e,r,a){this.recalcMatrix(t),e=e||0,r=r||0;var o=this.computedMatrix,s=o[0],l=o[4],u=o[8],c=o[1],h=o[5],f=o[9],d=o[2],p=o[6],g=o[10],m=e*s+r*c,v=e*l+r*h,y=e*u+r*f,x=-(p*y-g*v),b=-(g*m-d*y),_=-(d*v-p*m),w=Math.sqrt(Math.max(0,1-Math.pow(x,2)-Math.pow(b,2)-Math.pow(_,2))),M=i(x,b,_,w);M>1e-6?(x/=M,b/=M,_/=M,w/=M):(x=b=_=0,w=1);var A=this.computedRotation,k=A[0],T=A[1],E=A[2],S=A[3],L=k*w+S*x+T*_-E*b,z=T*w+S*b+E*x-k*_,C=E*w+S*_+k*b-T*x,I=S*w-k*x-T*b-E*_;if(a){x=d,b=p,_=g;var P=Math.sin(a)/n(x,b,_);x*=P,b*=P,_*=P,w=Math.cos(e),L=L*w+I*x+z*_-C*b,z=z*w+I*b+C*x-L*_,C=C*w+I*_+L*b-z*x,I=I*w-L*x-z*b-C*_}var D=i(L,z,C,I);D>1e-6?(L/=D,z/=D,C/=D,I/=D):(L=z=C=0,I=1),this.rotation.set(t,L,z,C,I)},d.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var i=this.computedMatrix;u(i,e,r,n);var o=this.computedRotation;f(o,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),a(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var s=0,l=0;l<3;++l)s+=Math.pow(r[l]-e[l],2);this.radius.set(t,.5*Math.log(Math.max(s,1e-6))),this.center.set(t,r[0],r[1],r[2])},d.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},d.setMatrix=function(t,e){var r=this.computedRotation;f(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),a(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;h(n,e);var i=n[15];if(Math.abs(i)>1e-6){var o=n[12]/i,s=n[13]/i,l=n[14]/i;this.recalcMatrix(t);var u=Math.exp(this.computedRadius[0]);this.center.set(t,o-n[2]*u,s-n[6]*u,l-n[10]*u),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},d.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},d.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},d.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},d.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":430,"filtered-vector":106,"gl-mat4/fromQuat":146,"gl-mat4/invert":149,"gl-mat4/lookAt":150}],432:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r="undefined"!=typeof r?r+"":" ",n(r,e)+t}},{"repeat-string":457}],433:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],434:[function(t,e,r){(function(t){function e(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n=-1&&!i;a--){var o=a>=0?arguments[a]:t.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(r=o+"/"+r,i="/"===o.charAt(0))}return r=e(n(r.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(t){var i=r.isAbsolute(t),a="/"===o(t,-1);return t=e(n(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&a&&(t+="/"),(i?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},r.relative=function(t,e){function n(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var i=n(t.split("/")),a=n(e.split("/")),o=Math.min(i.length,a.length),s=o,l=0;l55295&&e<57344){if(!r){e>56319||a+1===n?i.push(239,191,189):r=e;continue}if(e<56320){i.push(239,191,189),r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(i.push(239,191,189),r=null);e<128?i.push(e):e<2048?i.push(e>>6|192,63&e|128):e<65536?i.push(e>>12|224,e>>6&63|128,63&e|128):i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}return i}e.exports=n;var a,o,s,l=t("ieee754");a={readUInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},writeUInt32LE:function(t,e){this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24},readInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+(this[t+3]<<24)},readFloatLE:function(t){return l.read(this,t,!0,23,4)},readDoubleLE:function(t){return l.read(this,t,!0,52,8)},writeFloatLE:function(t,e){return l.write(this,t,e,!0,23,4)},writeDoubleLE:function(t,e){return l.write(this,t,e,!0,52,8)},toString:function(t,e,r){var n="",i="";e=e||0,r=Math.min(this.length,r||this.length);for(var a=e;a=1;){if(e.pos>=r)throw new Error("Given varint doesn't fit into 10 bytes");var n=255&t;e.buf[e.pos++]=n|(t>=128?128:0),t/=128}}function 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>3,a=this.pos;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=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*v;return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*v;return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,e,r=this.buf;return e=r[this.pos++],t=127&e,e<128?t:(e=r[this.pos++],t|=(127&e)<<7,e<128?t:(e=r[this.pos++],t|=(127&e)<<14,e<128?t:(e=r[this.pos++],t|=(127&e)<<21,e<128?t:i(t,this))))},readVarint64:function(){var t=this.pos,e=this.readVarint();if(e127;);else if(e===n.Bytes)this.pos=this.readVarint()+this.pos;else if(e===n.Fixed32)this.pos+=4;else{if(e!==n.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455?void a(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(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);var e=m.byteLength(t);this.writeVarint(e),this.realloc(e),this.buf.write(t,this.pos),this.pos+=e},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;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,h,e)},writePackedFloat:function(t,e){this.writeMessage(t,u,e)},writePackedDouble:function(t,e){this.writeMessage(t,c,e)},writePackedFixed32:function(t,e){this.writeMessage(t,f,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,d,e)},writePackedFixed64:function(t,e){this.writeMessage(t,p,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))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":435}],437:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return a.freeUint32(l),a.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,a,o=1;for(r[0]=0,a=1;a0;--a)n=e/o|0,e=e-n*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}var a=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":256,"typedarray-pool":496}],439:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,s,l,c=0;c<2;++c)if(u[c][n].length>0){o=u[c][n][0],l=c;break}s=o[1^l];for(var h=0;h<2;++h)for(var f=u[h][n],d=0;d0&&(o=p,s=g,l=h)}return a?s:(o&&r(o,l),s)}function a(t,a){var o=u[a][t][0],s=[t];r(o,a);for(var l=o[1^a];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],h=t,f=s[1],d=n(c,h,!0);if(i(e[c],e[h],e[f],e[d])<0)break;s.push(t),l=n(c,h)}return s}function o(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;c0;){var g=(u[0][c].length,a(c,d));o(p,g)?p.push.apply(p,g):(p.length>0&&f.push(p),p=g)}p.length>0&&f.push(p)}return f}e.exports=n;var i=t("compare-angle")},{"compare-angle":81}],440:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function a(t){for(var e=t.length,r=0;r0;){var U=N.pop(),V=I[U];h(V,function(t,e){return t-e});var q,H=V.length,G=B[U];if(0===G){var T=v[U];q=[T]}for(var m=0;m=0)&&(B[X]=1^G,N.push(X),0===G)){var T=v[X];a(T)||(T.reverse(),q.push(T))}}0===G&&d.push(q)}return d}e.exports=a;var o=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),h=t("uniq"),f=t("./lib/trim-leaves")},{"./lib/trim-leaves":440,"edges-to-adjacency-list":100,"planar-dual":439,"point-in-big-polygon":443,"robust-sum":470,"two-product":494,uniq:498}],442:[function(t,e,r){"use strict";function n(t,e){this.x=t,this.y=e}e.exports=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{}],443:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return!!i&&!!i.queryPoint(r,n)}}function a(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var o=i.key,s=h(r,o[0],o[1]);if(o[0][0]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))return 0;a=1,i=i.right}}return a}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;i=u?(b=1,y=u+2*f+p):(b=-f/u,y=f*b+p)):(b=0,d>=0?(_=0,y=p):-d>=h?(_=1,y=h+2*d+p):(_=-d/h,y=d*_+p));else if(_<0)_=0,f>=0?(b=0,y=p):-f>=u?(b=1,y=u+2*f+p):(b=-f/u,y=f*b+p);else{var w=1/x;b*=w,_*=w,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p}else{var M,A,k,T;b<0?(M=c+f,A=h+d,A>M?(k=A-M,T=u-2*c+h,k>=T?(b=1,_=0,y=u+2*f+p):(b=k/T,_=1-b,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p)):(b=0,A<=0?(_=1,y=h+2*d+p):d>=0?(_=0,y=p):(_=-d/h,y=d*_+p))):_<0?(M=c+d,A=u+f,A>M?(k=A-M,T=u-2*c+h,k>=T?(_=1,b=0,y=h+2*d+p):(_=k/T,b=1-_,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p)):(_=0,A<=0?(b=1,y=u+2*f+p):f>=0?(b=0,y=p):(b=-f/u,y=f*b+p))):(k=h+d-c-f,k<=0?(b=0,_=1,y=h+2*d+p):(T=u-2*c+h,k>=T?(b=1,_=0,y=u+2*f+p):(b=k/T,_=1-b,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p)))}for(var E=1-b-_,l=0;l1)for(var r=1;r1&&(n=r[0]+"@",t=r[1]),t=t.replace(P,".");var i=t.split("."),a=o(i,e).join(".");return n+a}function l(t){for(var e,r,n=[],i=0,a=t.length;i=55296&&e<=56319&&i65535&&(t-=65536,e+=F(t>>>10&1023|55296),t=56320|1023&t),e+=F(t)}).join("")}function c(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:M}function h(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function f(t,e,r){var n=0;for(t=r?O(t/E):t>>1,t+=O(t/e);t>R*k>>1;n+=M)t=O(t/R);return O(n+(R+1)*t/(t+T))}function d(t){var e,r,n,i,o,s,l,h,d,p,g=[],m=t.length,v=0,y=L,x=S;for(r=t.lastIndexOf(z),r<0&&(r=0),n=0;n=128&&a("not-basic"),g.push(t.charCodeAt(n));for(i=r>0?r+1:0;i=m&&a("invalid-input"),h=c(t.charCodeAt(i++)),(h>=M||h>O((w-v)/s))&&a("overflow"),v+=h*s,d=l<=x?A:l>=x+k?k:l-x,!(hO(w/p)&&a("overflow"),s*=p;e=g.length+1,x=f(v-o,e,0==o),O(v/e)>w-y&&a("overflow"),y+=O(v/e),v%=e,g.splice(v++,0,y)}return u(g)}function p(t){var e,r,n,i,o,s,u,c,d,p,g,m,v,y,x,b=[];for(t=l(t),m=t.length,e=L,r=0,o=S,s=0;s=e&&gO((w-r)/v)&&a("overflow"),r+=(u-e)*v,e=u,s=0;sw&&a("overflow"),g==e){for(c=r,d=M;p=d<=o?A:d>=o+k?k:d-o,!(c= 0x80 (not a basic code point)","invalid-input":"Invalid input"},R=M-A,O=Math.floor,F=String.fromCharCode;if(b={version:"1.4.1",ucs2:{decode:l,encode:u},decode:d,encode:p,toASCII:m,toUnicode:g},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return b});else if(v&&y)if(r.exports==v)y.exports=b;else for(_ in b)b.hasOwnProperty(_)&&(v[_]=b[_]);else i.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],447:[function(t,e,r){e.exports=t("gl-quat/slerp")},{"gl-quat/slerp":199}],448:[function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,r,a){e=e||"&",r=r||"=";var o={};if("string"!=typeof t||0===t.length)return o;var s=/\+/g;t=t.split(e);var l=1e3;a&&"number"==typeof a.maxKeys&&(l=a.maxKeys);var u=t.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(h=g.substr(0,m),f=g.substr(m+1)):(h=g,f=""),d=decodeURIComponent(h),p=decodeURIComponent(f),n(o,d)?i(o[d])?o[d].push(p):o[d]=[o[d],p]:o[d]=p}return o};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],449:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;nr;){if(o-r>600){var l=o-r+1,u=e-r+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),d=Math.max(r,Math.floor(e-u*h/l+f)),p=Math.min(o,Math.floor(e+(l-u)*h/l+f));n(t,e,d,p,s)}var g=t[e],m=r,v=o;for(i(t,r,e),s(t[o],g)>0&&i(t,r,o);m0;)v--}0===s(t[r],g)?i(t,r,v):(v++,i(t,v,o)),v<=e&&(r=v+1),e<=v&&(o=v-1)}}function i(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function a(t,e){return te?1:0}e.exports=n},{}],452:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),a=0;a0){var u=t[r-1];if(0===i(s,u)&&o(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}var i=t("compare-cell"),a=t("compare-oriented-cell"),o=t("cell-orientation");e.exports=n},{"cell-orientation":73,"compare-cell":82,"compare-oriented-cell":83}],457:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("repeat-string expects a string.");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;for(i===t&&"undefined"!=typeof i||(i=t,a="");r>a.length&&e>0&&(1&e&&(a+=t),e>>=1);)t+=t;return a.substr(0,r)}var i,a="";e.exports=n},{}],458:[function(e,r,n){void function(e,i){"function"==typeof t&&t.amd?t(i):"object"==typeof n?r.exports=i():e.resolveUrl=i()}(this,function(){function t(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var r=document.getElementsByTagName("head")[0];r.insertBefore(e,r.firstChild);for(var n,i=document.createElement("a"),a=1;a=0;--i){var a=r,o=t[i];r=a+o;var s=r-a,l=o-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;i>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;r>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r0&&r.push(","),r.push("[");for(var a=0;a0&&r.push(","),a===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",a,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var o=new Function("det",r.join(""));return o(t<6?s[t]:s)}function i(){return[0]}function a(t,e){return[[e[0]],[t[0][0]]]}function o(){for(;u.length>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;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=v*n;return o>=s||o<=-s?o:x(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],u=r[1]-n[1],c=t[2]-n[2],h=e[2]-n[2],f=r[2]-n[2],d=a*u,p=o*l,g=o*s,m=i*u,v=i*l,x=a*s,_=c*(d-p)+h*(g-m)+f*(v-x),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(m))*Math.abs(h)+(Math.abs(v)+Math.abs(x))*Math.abs(f),M=y*w;return _>M||-_>M?_:b(t,e,r,n)}];c()},{"robust-scale":467,"robust-subtract":469,"robust-sum":470,"two-product":494}],466:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return a(e,t[0]);if(1===e.length)return a(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.length0&&s>0||o<0&&s<0)return!1;var l=a(r,t,e),u=a(i,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,i))}e.exports=i;var a=t("robust-orientation")[3]},{"robust-orientation":465}],469:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,h=0,f=Math.abs,d=t[c],p=f(d),g=-e[h],m=f(g);p=i?(a=d,c+=1,c=i?(a=d,c+=1,c0){for(var s=0,l=0,u=0;un.h||t>n.free||rc)&&(h=2*Math.max(t,c)),(ll)&&(u=2*Math.max(r,l)),this.resize(h,u),this.packOne(t,r)}return null},t.prototype.clear=function(){this.shelves=[],this.stats={}},t.prototype.resize=function(t,e){this.w=t,this.h=e;for(var r=0;rthis.free||e>this.h)return null;var r=this.x;return this.x+=t,this.free-=t,{x:r,y:this.y,w:t,h:e,width:t,height:e}},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t})},{}],472:[function(t,e,r){"use strict";e.exports=function(t){return t<0?-1:t>0?1:0}},{}],473:[function(t,e,r){"use strict";function n(t){return a(i(t))}e.exports=n;var i=t("boundary-cells"),a=t("reduce-simplicial-complex")},{"boundary-cells":56,"reduce-simplicial-complex":456}],474:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;n0&&u.push(","),u.push("[");for(var n=0;n0&&u.push(","),u.push("B(C,E,c[",i[0],"],c[",i[1],"])")}u.push("]")}u.push(");")}}var r=0,n=new Array(t+1);n[0]=[[]];for(var i=1;i<=t;++i)for(var s=n[i]=o(i),l=0;l>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--i){i>1,s=o(t[a],e);s<=0?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function h(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[g],a))break}return r}function f(t,e){if(!e)return h(u(p(t,0)),t,0);for(var r=new Array(e),n=0;n>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){var n=s(r);if(e0){var t=k[0];return a(0,S-1),S-=1,u(0),t}return-1}function f(t,e){var r=k[t];return x[r]===e?t:(x[r]=-(1/0),c(t),h(),x[r]=e,S+=1,c(S-1))}function d(t){if(!b[t]){b[t]=!0;var e=v[t],r=y[t];v[r]>=0&&(v[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&f(T[e],i(e)),T[r]>=0&&f(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!b[n]||i<0||i===n)break;if(n=i,i=t[n],!b[n]||i<0||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var g=e.length,m=t.length,v=new Array(g),y=new Array(g),x=new Array(g),b=new Array(g),_=0;_>1;_>=0;--_)u(_);for(;;){var L=h();if(L<0||x[L]>r)break;d(L)}for(var z=[],_=0;_=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&C.push([n,i])}}),o.unique(o.normalize(C)),{positions:z,edges:C}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":465,"simplicial-complex":478}],481:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return ol?i-l:o-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=a(r,i,s),u=a(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;if(l=a(s,o,i),u=a(s,o,r),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]}e.exports=i;var a=t("robust-orientation")},{"robust-orientation":465}],482:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=a(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=a(t.right,e);if(l)return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;a0){var s=a(this.slabs[e-1],t);s&&(o?f(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(o){var p=h(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":481,"binary-search-bounds":53,"functional-red-black-tree":107,"robust-orientation":465}],483:[function(t,e,r){"use strict";function n(t,e){var r=u(l(t,e),[e[e.length-1]]);return r[r.length-1]}function i(t,e,r,n){var i=n-e,a=-e/i;a<0?a=0:a>1&&(a=1);for(var o=1-a,s=t.length,l=new Array(s),u=0;u0||o>0&&c<0){var h=i(s,c,l,o);r.push(h),a.push(h.slice())}c<0?a.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),a.push(l.slice())),o=c}return{positive:r,negative:a}}function o(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u>=0&&r.push(s.slice()),a=u}return r}function s(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u<=0&&r.push(s.slice()),a=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=a,e.exports.positive=o,e.exports.negative=s},{"robust-dot-product":462,"robust-sum":470}],484:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function a(t,e){return Array(e+1).join(t)}var o={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,h,f,d=1,p=t.length,g="",m=[],v=!0,y="";for(s=0;s=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?m[m.length]=n:(!o.number.test(u[8])||v&&!u[3]?y="":(y=v?"+":"-",n=n.toString().replace(o.sign,"")),h=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",f=u[6]-(y+n).length,c=u[6]&&f>0?a(h,f):"",m[m.length]=u[5]?y+n+c:"0"===h?y+c+n:c+y+n)}return m.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],485:[function(t,e,r){"use strict";function n(t){return new i(t)}function i(t){this.options=d(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function a(t,e,r,n){return{x:t,y:e,zoom:1/0,id:n,numPoints:r}}function o(t,e){var r=t.geometry.coordinates;return a(u(r[0]),c(r[1]),1,e)}function s(t){return{type:"Feature",properties:l(t),geometry:{type:"Point",coordinates:[h(t.x),f(t.y)]}}}function l(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:r}}function u(t){return t/360+.5}function c(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function h(t){return 360*(t-.5)}function f(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function d(t,e){for(var r in e)t[r]=e[r];return t}function p(t){return t.x}function g(t){return t.y}var m=t("kdbush");e.exports=n,i.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var r="prepare "+t.length+" points";e&&console.time(r),this.points=t;var n=t.map(o);e&&console.timeEnd(r);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var a=+Date.now();this.trees[i+1]=m(n,p,g,this.options.nodeSize,Float32Array),n=this._cluster(n,i),e&&console.log("z%d: %d clusters in %dms",i,n.length,+Date.now()-a)}return this.trees[this.options.minZoom]=m(n,p,g,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(u(t[0]),c(t[3]),u(t[2]),c(t[1])),i=[],a=0;a c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128===0){h.length>0&&f.push("}}");var d="vExtra"+h.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),f=["function ",d,"(m,",l.join(),"){switch(m){"],h.push(f)}f.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),m=new Array(r),v=new Array(r),y=0,x=0;xx)&&!(u&1<<_)!=!(u&1<0&&(k="+"+m[b]+"*c");var T=.5*(p[b].length/y),E=.5+.5*(v[b]/y);A.push("d"+b+"-"+E+"-"+T+"*("+p[b].join("+")+k+")/("+g[b].join("+")+")")}f.push("a.push([",A.join(),"]);","break;")}n.push("}},"),h.length>0&&f.push("}}");for(var S=[],u=0;u<1<0&&(f+=.02);for(var p=new Float32Array(h),g=0,m=-.5*f,d=0;d.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=S(t,360),e=S(e,100),r=S(r,100),0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,r){t=S(t,255),e=S(e,255),r=S(r,255);var n,i,a=G(t,e,r),o=H(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function k(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function S(t,r){C(t)&&(t="100%");var n=I(t);return t=H(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function L(t){return H(1,G(0,t))}function z(t){return parseInt(t,16)}function C(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function I(t){return"string"==typeof t&&t.indexOf("%")!=-1}function P(t){return 1==t.length?"0"+t:""+t}function D(t){return t<=1&&(t=100*t+"%"),t}function R(t){return e.round(255*parseFloat(t)).toString(16)}function O(t){return z(t)/255}function F(t){return!!Z.CSS_UNIT.exec(t)}function j(t){t=t.replace(B,"").replace(U,"").toLowerCase();var e=!1;if(Y[t])t=Y[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Z.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(t))?{r:z(r[1]),g:z(r[2]),b:z(r[3]),a:O(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:z(r[1]),g:z(r[2]),b:z(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:z(r[1]+""+r[1]),g:z(r[2]+""+r[2]),b:z(r[3]+""+r[3]),a:O(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.hex3.exec(t))&&{r:z(r[1]+""+r[1]),g:z(r[2]+""+r[2]),b:z(r[3]+""+r[3]),format:e?"name":"hex"}}function N(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var B=/^\s+/,U=/\s+$/,V=0,q=e.round,H=e.min,G=e.max,X=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=E(t),this._roundA=q(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=q(360*t.h),r=q(100*t.s),n=q(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=q(360*t.h),r=q(100*t.s),n=q(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return h(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:q(this._r),g:q(this._g),b:q(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+q(this._r)+", "+q(this._g)+", "+q(this._b)+")":"rgba("+q(this._r)+", "+q(this._g)+", "+q(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:q(100*S(this._r,255))+"%",g:q(100*S(this._g,255))+"%",b:q(100*S(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+q(100*S(this._r,255))+"%, "+q(100*S(this._g,255))+"%, "+q(100*S(this._b,255))+"%)":"rgba("+q(100*S(this._r,255))+"%, "+q(100*S(this._g,255))+"%, "+q(100*S(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(W[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+f(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+f(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){ -return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,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(b,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=D(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return n(s)},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=N(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},n.mostReadable=function(t,e,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var Y=n.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"},W=n.hexNames=T(Y),Z=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],490:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":433}],491:[function(e,r,n){!function(e,i){"object"==typeof n&&"undefined"!=typeof r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.topojson=e.topojson||{})}(this,function(t){"use strict";function e(){}function r(t){if(!t)return e;var r,n,i=t.scale[0],a=t.scale[1],o=t.translate[0],s=t.translate[1];return function(t,e){e||(r=n=0),t[0]=(r+=t[0])*i+o,t[1]=(n+=t[1])*a+s}}function n(t){if(!t)return e;var r,n,i=t.scale[0],a=t.scale[1],o=t.translate[0],s=t.translate[1];return function(t,e){e||(r=n=0);var l=Math.round((t[0]-o)/i),u=Math.round((t[1]-s)/a);t[0]=l-r,t[1]=u-n,r=l,n=u}}function i(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r}function a(t,e){for(var r=0,n=t.length;r>>1;t[i]1){var l,c=[],h={LineString:i,MultiLineString:a,Polygon:a,MultiPolygon:function(t){t.forEach(a)}};o(e),c.forEach(arguments.length<3?function(t){s.push(t[0].i)}:function(t){r(t[0].g,t[t.length-1].g)&&s.push(t[0].i)})}else for(var f=0,d=t.arcs.length;f1)for(var o,s,l=1,c=n(a[0]);lc&&(s=a[0],a[0]=a[l],a[l]=s,c=o);return a})}}function m(t){function e(t,e){t.forEach(function(t){t<0&&(t=~t);var r=i[t];r?r.push(e):i[t]=[e]})}function r(t,r){t.forEach(function(t){e(t,r)})}function n(t,e){"GeometryCollection"===t.type?t.geometries.forEach(function(t){n(t,e)}):t.type in s&&s[t.type](t.arcs,e)}var i={},o=t.map(function(){return[]}),s={LineString:e,MultiLineString:r,Polygon:r,MultiPolygon:function(t,e){t.forEach(function(t){r(t,e)})}};t.forEach(n);for(var l in i)for(var u=i[l],c=u.length,h=0;h0;){var r=(e+1>>1)-1,i=n[r];if(v(t,i)>=0)break;n[i._=e]=i,n[t._=e=r]=t}}function e(t,e){for(;;){var r=e+1<<1,a=r-1,o=e,s=n[o];if(a0&&(t=n[i],e(n[t._=0]=t,0)),r}},r.remove=function(r){var a,o=r._;if(n[o]===r)return o!==--i&&(a=n[i],(v(a,r)<0?t:e)(n[a._=o]=a,o)),o},r}function x(t,e){function i(t){s.remove(t),t[1][2]=e(t),s.push(t)}var a=r(t.transform),o=n(t.transform),s=y();return e||(e=f),t.arcs.forEach(function(t){var r,n,l,u,c=[],h=0;for(n=0,l=t.length;nMath.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var a=0,o=0,s=0;s<3;++s)a+=t[s]*t[s],o+=i[s]*t[s];for(var s=0;s<3;++s)i[s]-=o/a*t[s];return f(i,i),i}function o(t,e,r,n,i,a,o,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([a]),this.angle=l([o,s]),this.angle.bounds=[[-(1/0),-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;u<16;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.up||[0,1,0],i=t.right||a(r),s=t.radius||1,l=t.theta||0,u=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),f(r,r),i=[].slice.call(i,0,3),f(i,i),"eye"in t){var c=t.eye,p=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];h(i,p,r),n(i[0],i[1],i[2])<1e-6?i=a(r):f(i,i),s=n(p[0],p[1],p[2]);var g=d(r,p)/s,m=d(i,p)/s;u=Math.acos(g),l=Math.acos(m)}return s=Math.log(s),new o(t.zoomMin,t.zoomMax,e,r,i,s,l,u)}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),h=t("gl-vec3/cross"),f=t("gl-vec3/normalize"),d=t("gl-vec3/dot"),p=o.prototype;p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,i=0,a=0,o=0;o<3;++o)a+=e[o]*r[o],i+=e[o]*e[o];for(var s=Math.sqrt(i),l=0,o=0;o<3;++o)r[o]-=e[o]*a/i,l+=r[o]*r[o],e[o]/=s;for(var u=Math.sqrt(l),o=0;o<3;++o)r[o]/=u;var c=this.computedToward;h(c,e,r),f(c,c);for(var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],g=this.computedAngle[1],m=Math.cos(p),v=Math.sin(p),y=Math.cos(g),x=Math.sin(g),b=this.computedCenter,_=m*y,w=v*y,M=x,A=-m*x,k=-v*x,T=y,E=this.computedEye,S=this.computedMatrix,o=0;o<3;++o){var L=_*r[o]+w*c[o]+M*e[o];S[4*o+1]=A*r[o]+k*c[o]+T*e[o],S[4*o+2]=L,S[4*o+3]=0}var z=S[1],C=S[5],I=S[9],P=S[2],D=S[6],R=S[10],O=C*R-I*D,F=I*P-z*R,j=z*D-C*P,N=n(O,F,j);O/=N,F/=N,j/=N,S[0]=O,S[4]=F,S[8]=j;for(var o=0;o<3;++o)E[o]=b[o]+S[2+4*o]*d;for(var o=0;o<3;++o){for(var l=0,B=0;B<3;++B)l+=S[o+4*B]*E[B];S[12+o]=-l}S[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 g=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;g[0]=i[2],g[1]=i[6],g[2]=i[10];for(var a=this.computedUp,o=this.computedRight,s=this.computedToward,l=0;l<3;++l)i[4*l]=a[l],i[4*l+1]=o[l],i[4*l+2]=s[l];c(i,i,n,g);for(var l=0;l<3;++l)a[l]=i[4*l],o[l]=i[4*l+1];this.up.set(t,a[0],a[1],a[2]),this.right.set(t,o[0],o[1],o[2])}},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=(Math.exp(this.computedRadius[0]),a[1]),s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],h=a[4],f=a[8],d=c*o+h*s+f*l;c-=o*d,h-=s*d,f-=l*d;var p=n(c,h,f);c/=p,h/=p,f/=p;var g=c*e+o*r,m=h*e+s*r,v=f*e+l*r;this.center.move(t,g,m,v);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e,r,a){var o=1;"number"==typeof r&&(o=0|r),(o<0||o>3)&&(o=1);var s=(o+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[o],c=e[o+4],h=e[o+8];if(a){var f=Math.abs(l),d=Math.abs(c),p=Math.abs(h),g=Math.max(f,d,p);f===g?(l=l<0?-1:1,c=h=0):p===g?(h=h<0?-1:1,l=c=0):(c=c<0?-1:1,l=h=0)}else{var m=n(l,c,h);l/=m,c/=m,h/=m}var v=e[s],y=e[s+4],x=e[s+8],b=v*l+y*c+x*h;v-=l*b,y-=c*b,x-=h*b;var _=n(v,y,x);v/=_,y/=_,x/=_;var w=c*x-h*y,M=h*v-l*x,A=l*y-c*v,k=n(w,M,A);w/=k,M/=k,A/=k,this.center.jump(t,H,G,X),this.radius.idle(t),this.up.jump(t,l,c,h),this.right.jump(t,v,y,x);var T,E;if(2===o){var S=e[1],L=e[5],z=e[9],C=S*v+L*y+z*x,I=S*w+L*M+z*A;T=O<0?-Math.PI/2:Math.PI/2,E=Math.atan2(I,C)}else{var P=e[2],D=e[6],R=e[10],O=P*l+D*c+R*h,F=P*v+D*y+R*x,j=P*w+D*M+R*A;T=Math.asin(i(O)),E=Math.atan2(j,F)}this.angle.jump(t,E,T),this.recalcMatrix(t);var N=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var q=V[15],H=V[12]/q,G=V[13]/q,X=V[14]/q,Y=Math.exp(this.computedRadius[0]);this.center.jump(t,H-N*Y,G-B*Y,X-U*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,a){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,a=a||this.computedUp;var o=a[0],s=a[1],l=a[2],u=n(o,s,l);if(!(u<1e-6)){o/=u,s/=u,l/=u;var c=e[0]-r[0],h=e[1]-r[1],f=e[2]-r[2],d=n(c,h,f);if(!(d<1e-6)){c/=d,h/=d,f/=d;var p=this.computedRight,g=p[0],m=p[1],v=p[2],y=o*g+s*m+l*v;g-=y*o,m-=y*s,v-=y*l;var x=n(g,m,v);if(!(x<.01&&(g=s*f-l*h,m=l*c-o*f,v=o*h-s*c,x=n(g,m,v),x<1e-6))){g/=x,m/=x,v/=x,this.up.set(t,o,s,l),this.right.set(t,g,m,v),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var b=s*v-l*m,_=l*g-o*v,w=o*m-s*g,M=n(b,_,w);b/=M,_/=M,w/=M;var A=o*c+s*h+l*f,k=g*c+m*h+v*f,T=b*c+_*h+w*f,E=Math.asin(i(A)),S=Math.atan2(T,k),L=this.angle._state,z=L[L.length-1],C=L[L.length-2];z%=2*Math.PI;var I=Math.abs(z+2*Math.PI-S),P=Math.abs(z-S),D=Math.abs(z-2*Math.PI-S);I0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function h(t){return new Int16Array(o(2*t),0,t)}function f(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return b?new Uint8ClampedArray(o(t),0,t):s(t)}function m(t){return new DataView(o(t),0,t)}function v(t){t=y.nextPow2(t);var e=y.log2(t),r=M[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),x=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:x([32,0]),UINT16:x([32,0]),UINT32:x([32,0]),INT8:x([32,0]),INT16:x([32,0]),INT32:x([32,0]),FLOAT:x([32,0]),DOUBLE:x([32,0]),DATA:x([32,0]),UINT8C:x([32,0]),BUFFER:x([32,0])});var b="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=x([32,0])),_.BUFFER||(_.BUFFER=x([32,0]));var w=_.DATA,M=_.BUFFER;r.free=function(t){if(n.isBuffer(t))M[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){M[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return h(t);case"int32":return f(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return v(t);case"data":case"dataview":return m(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=h,r.mallocInt32=f,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=m,r.mallocBuffer=v,r.clearCache=function(){for(var t=0;t<32;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,M[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":54,buffer:64,dup:98}],497:[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;en)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))}},{}],500:[function(t,e,r){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function i(t,e,r){if(t&&u.isObject(t)&&t instanceof n)return t;var i=new n;return i.parse(t,e,r),i}function a(t){return u.isString(t)&&(t=i(t)),t instanceof n?t.format():n.prototype.format.call(t)}function o(t,e){return i(t,!1,!0).resolve(e)}function s(t,e){return t?i(t,!1,!0).resolveObject(e):e}var l=t("punycode"),u=t("./util");r.parse=i,r.resolve=o,r.resolveObject=s,r.format=a,r.Url=n;var c=/^([a-z0-9.+-]+:)/i,h=/:[0-9]*$/,f=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["<",">",'"',"`"," ","\r","\n","\t"],p=["{","}","|","\\","^","`"].concat(d),g=["'"].concat(p),m=["%","/","?",";","#"].concat(g),v=["/","?","#"],y=255,x=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},M={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=t("querystring");n.prototype.parse=function(t,e,r){if(!u.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),i=n!==-1&&n127?"x":D[O];if(!R.match(x)){var j=I.slice(0,E),N=I.slice(E+1),B=D.match(b);B&&(j.push(B[1]),N.unshift(B[2])),N.length&&(s="/"+N.join(".")+s),this.hostname=j.join(".");break}}}this.hostname.length>y?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=l.toASCII(this.hostname));var U=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+U,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!_[p])for(var E=0,P=g.length;E0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return r.search=t.search,r.query=t.query,u.isNull(r.pathname)&&u.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!_.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=_.slice(-1)[0],E=(r.host||t.host||_.length>1)&&("."===T||".."===T)||""===T,S=0,L=_.length;L>=0;L--)T=_[L],"."===T?_.splice(L,1):".."===T?(_.splice(L,1),S++):S&&(_.splice(L,1),S--);if(!x&&!b)for(;S--;S)_.unshift("..");!x||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),E&&"/"!==_.join("/").substr(-1)&&_.push("");var z=""===_[0]||_[0]&&"/"===_[0].charAt(0);if(A){r.hostname=r.host=z?"":_.length?_.shift():"";var k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return x=x||r.host&&_.length,x&&!z&&_.unshift(""),_.length?r.pathname=_.join("/"):(r.pathname=null,r.path=null),u.isNull(r.pathname)&&u.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes, -r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=h.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":501,punycode:446,querystring:450}],501:[function(t,e,r){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],502:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],503:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],504:[function(t,e,r){(function(e,n){function i(t,e){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(e)?n.showHidden=e:e&&r._extend(n,e),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a),l(n,t,n.depth)}function a(t,e){var r=i.styles[e];return r?"\x1b["+i.colors[r][0]+"m"+t+"\x1b["+i.colors[r][1]+"m":t}function o(t,e){return t}function s(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function l(t,e,n){if(t.customInspect&&e&&T(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return x(i)||(i=l(t,i,n)),i}var a=u(t,e);if(a)return a;var o=Object.keys(e),g=s(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),k(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(e);if(0===o.length){if(T(e)){var m=e.name?": "+e.name:"";return t.stylize("[Function"+m+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(A(e))return t.stylize(Date.prototype.toString.call(e),"date");if(k(e))return c(e)}var v="",y=!1,b=["{","}"];if(p(e)&&(y=!0,b=["[","]"]),T(e)){var _=e.name?": "+e.name:"";v=" [Function"+_+"]"}if(w(e)&&(v=" "+RegExp.prototype.toString.call(e)),A(e)&&(v=" "+Date.prototype.toUTCString.call(e)),k(e)&&(v=" "+c(e)),0===o.length&&(!y||0==e.length))return b[0]+v+b[1];if(n<0)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=y?h(t,e,n,g,o):o.map(function(r){return f(t,e,n,g,r,y)}),t.seen.pop(),d(M,v,b)}function u(t,e){if(_(e))return t.stylize("undefined","undefined");if(x(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return y(e)?t.stylize(""+e,"number"):g(e)?t.stylize(""+e,"boolean"):m(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var a=[],o=0,s=e.length;o-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")),_(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.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 d(t,e,r){var n=0,i=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function p(t){return Array.isArray(t)}function g(t){return"boolean"==typeof t}function m(t){return null===t}function v(t){return null==t}function y(t){return"number"==typeof t}function x(t){return"string"==typeof t}function b(t){return"symbol"==typeof t}function _(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===S(t)}function M(t){return"object"==typeof t&&null!==t}function A(t){return M(t)&&"[object Date]"===S(t)}function k(t){return M(t)&&("[object Error]"===S(t)||t instanceof Error)}function T(t){return"function"==typeof t}function E(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function S(t){return Object.prototype.toString.call(t)}function L(t){return t<10?"0"+t.toString(10):t.toString(10)}function z(){var t=new Date,e=[L(t.getHours()),L(t.getMinutes()),L(t.getSeconds())].join(":");return[t.getDate(),R[t.getMonth()],e].join(" ")}function C(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var I=/%[sdj%]/g;r.format=function(t){if(!x(t)){for(var e=[],r=0;r=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}}),s=n[r];r>3}if(i--,1===n||2===n)a+=t.readSVarint(),o+=t.readSVarint(),1===n&&(e&&s.push(e),e=[]),e.push(new l(a,o));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&s.push(e),s},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,u=-(1/0);t.pos>3}if(n--,1===r||2===r)i+=t.readSVarint(),a+=t.readSVarint(),is&&(s=i),au&&(u=a);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,u]},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}var o=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 o(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":507}],509:[function(t,e,r){"use strict";function n(t,e){return"object"==typeof e&&null!==e||(e={}),i(t,e.canvas||a,e.context||o,e)}e.exports=n;var i=t("./lib/vtext"),a=null,o=null;"undefined"!=typeof document&&(a=document.createElement("canvas"),a.width=8192,a.height=1024,o=a.getContext("2d"))},{"./lib/vtext":510}],510:[function(t,e,r){"use strict";function n(t,e,r){for(var n=e.textAlign||"start",i=e.textBaseline||"alphabetic",a=[1<<30,1<<30],o=[0,0],s=t.length,l=0;l8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height>31}function l(t){for(var e=[],r=0,n=0,i=t.length,a=0;a=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function o(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),!(e<0)&&(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof b||a();var s=[],l=[],u=x++;return Object.create(b.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(o)}})};b.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||!!c&&c.has___(t)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof b||a();var l,u=new s,c=void 0,h=!1;return l=o?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new b),c.set(t,e)),this}:function(t,e){if(h)try{u.set(t,e)}catch(r){c||(c=new b),c.set___(t,e)}else u.set(t,e);return this},Object.create(b.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");h=!0})}})}o&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=b.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=b)}}()},{}],515:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":516}],516:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],517:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":515}],518:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":119}],519:[function(t,e,r){var n=arguments[3],i=arguments[4],a=arguments[5],o=JSON.stringify;e.exports=function(t,e){function r(t){m[t]=!0;for(var e in i[t][1]){var n=i[t][1][e];m[n]||r(n)}}for(var s,l=Object.keys(a),u=0,c=l.length;u= 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":91}],523:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":522}],524:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e){function r(e,r){return n.coerce(t,s,o,e,r)}var s={};r("opacity"),r("align"),r("bgcolor");var l=r("bordercolor"),u=i.opacity(l);r("borderpad");var c=r("borderwidth"),h=r("showarrow");h&&(r("arrowcolor",u?s.bordercolor:i.defaultLine),r("arrowhead"),r("arrowsize"),r("arrowwidth",2*(u&&c||1)),r("ax"),r("ay"),r("axref"),r("ayref"),n.noneOrAll(t,s,["ax","ay"])),r("text",h?" ":"new text"),r("textangle"),n.coerceFont(r,"font",e.font);for(var f=["x","y"],d=0;d<2;d++){var p=f[d],g={_fullLayout:e},m=a.coerceRef(t,s,g,p),v=a.coerceARef(t,s,g,p),y=.5;if("paper"!==m){var x=a.getFromId(g,m);if(y=x.range[0]+y*(x.range[1]-x.range[0]),["date","category"].indexOf(x.type)!==-1&&"string"==typeof t[p]){var b;if("date"===x.type){if(b=n.dateTime2ms(t[p]),b!==!1&&(t[p]=b),v===m){var _=n.dateTime2ms(t["a"+p]);_!==!1&&(t["a"+p]=_)}}else(x._categories||[]).length&&(b=x._categories.indexOf(t[p]),b!==-1&&(t[p]=b))}}r(p,y),h||r(p+"anchor")}return n.noneOrAll(t,s,["x","y"]),s}},{"../../lib":632,"../../plots/cartesian/axes":662,"../color":533,"./attributes":526}],525:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],526:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10},ay:{valType:"number",dflt:-30},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":625,"../../plots/cartesian/constants":668,"../../plots/font_attributes":683,"./arrow_paths":525}],527:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,h=s-l,f=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),h=Math.max(h,d),f=Math.max(f,d)}r&&r.autorange&&a.expand(r,[r.l2c(e.x)],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(e.y)],{ppadplus:f,ppadminus:h})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=e.annotations;if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":632,"../../plots/cartesian/axes":662,"./draw":529}],528:[function(t,e,r){"use strict";var n=t("./annotation_defaults");e.exports=function(t,e){for(var r=t.annotations||[],i=e.annotations=[],a=0;a2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=K.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,v=Math.round(u+2*tt),y=Math.round(p+2*tt);H._w=u,H._h=p;var b=!1;if(["x","y"].forEach(function(e){var n,i=H[e+"ref"]||e,a=h.getFromId(t,i),o=(W+("x"===e?0:90))*Math.PI/180,s=v*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=H[e+"anchor"];if(a){if(!a.autorange&&(H[e]-a.range[0])*(H[e]-a.range[1])>0&&(H["a"+e+"ref"]===i?(H["a"+e]-a.range[0])*(H["a"+e]-a.range[1])>0&&(b=!0):b=!0,b))return;Y[e]=a._offset+a.l2p(H[e]),n=.5}else n=H[e],"y"===e&&(n=1-n),Y[e]="x"===e?I.l+I.w*n:I.t+I.h*n;var u=0;H["a"+e+"ref"]===i?Y["aa"+e]=a._offset+a.l2p(H["a"+e]):(u=H.showarrow?H["a"+e]:s*r(n,l),Y[e]+=u),H["_"+e+"type"]=a&&a.type,H["_"+e+"size"]=s,H["_"+e+"shift"]=u}),b)return void K.remove();var _,w;H.showarrow&&(_=H.axref===H.xref?Y.x:c.constrain(Y.x-H.ax,1,A.width-1),w=H.ayref===H.yref?Y.y:c.constrain(Y.y-H.ay,1,A.height-1)), -Y.x=c.constrain(Y.x,1,A.width-1),Y.y=c.constrain(Y.y,1,A.height-1);var M=tt-s.top,k=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:k,y:M}),nt.selectAll("tspan.line").attr({y:M,x:k})),et.call(d.setRect,$/2,$/2,v-$,y-$);var T=0,E=0;T=H.axref===H.xref?Math.round(Y.aax-v/2):Math.round(Y.x-v/2),E=H.ayref===H.yref?Math.round(Y.aay-y/2):Math.round(Y.y-y/2),K.call(c.setTranslate,T,E);var S="annotations["+e+"]",L=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=H.axref===H.xref?Y.aax+r:Y.x+r,s=H.ayref===H.yref?Y.aay+n:Y.y+n;var u=c.rotationXYMatrix(W,i,s),h=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,v=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!v.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=H.arrowwidth,b=H.arrowcolor,M=Z.append("g").style({opacity:f.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),A=M.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(f.stroke,f.rgb(b));x(A,H.arrowhead,"end",H.arrowsize);var k=M.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,L;m.init({element:k.node(),prepFn:function(){var t=c.getTranslate(K);E=t.x,L=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){M.attr("transform","translate("+t+","+e+")");var r=h(E,L),n=r[0]+t,i=r[1]+e;K.call(c.setTranslate,n,i),T[S+".x"]=G?H.x+t/G._m:(_+t-I.l)/I.w,T[S+".y"]=X?H.y+e/X._m:1-(w+e-I.t)/I.h,H.axref===H.xref&&(T[S+".ax"]=G?H.ax+t/G._m:(_+t-I.l)/I.w),H.ayref===H.yref&&(T[S+".ay"]=X?H.ay+e/X._m:1-(w+e-I.t)/I.h),Q.attr({transform:"rotate("+W+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};H.showarrow&&L(0,0);var z=c.rotationXYMatrix(W,Y.x,Y.y),C=c.apply2DTransform(z);if(t._context.editable){var P,D,R;m.init({element:K.node(),prepFn:function(){var t=c.getTranslate(K);P=t.x,D=t.y,R={}},moveFn:function(t,e){K.call(c.setTranslate,P+t,D+e);var r="pointer";if(H.showarrow)H.axref===H.xref?R[S+".ax"]=G.p2l(G.l2p(H.ax)+t):R[S+".ax"]=H.ax+t,H.ayref===H.yref?R[S+".ay"]=X.p2l(X.l2p(H.ay)+e):R[S+".ay"]=H.ay+e,L(t,e);else{if(G)R[S+".x"]=H.x+t/G._m;else{var n=H._xsize/I.w,i=H.x+H._xshift/I.w-n/2;R[S+".x"]=m.align(i+t/I.w,n,0,1,H.xanchor)}if(X)R[S+".y"]=H.y+e/X._m;else{var a=H._ysize/I.h,o=H.y-H._yshift/I.h-a/2;R[S+".y"]=m.align(o-e/I.h,a,0,1,H.yanchor)}G&&X||(r=m.getCursor(G?.5:R[S+".x"],X?.5:R[S+".y"],H.xanchor,H.yanchor))}var s=C(P,D),l=s[0]+t,u=s[1]+e;K.call(c.setTranslate,P+t,D+e),Q.attr({transform:"rotate("+W+","+l+","+u+")"}),g(K,r)},doneFn:function(e){if(g(K),e){l.relayout(t,R);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,M=t.layout,A=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return M.annotations=u,y(M,A),void n(t);if("remove"===u)return delete M.annotations,A.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)A._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}A._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=M.annotations[e],E=A.annotations[e];if(T){var S={xref:T.xref,yref:T.yref},L={};"string"==typeof r&&r?L[r]=u:c.isPlainObject(r)&&(L=r);var z=Object.keys(L);for(w=0;w4/3&&(F=V)}}else O&&(N&&(F<1/3?F+=U:F>2/3&&(F-=U)),F=(F-O.domain[0])/(O.domain[1]-O.domain[0]),F=O.range[0]+F*(O.range[1]-O.range[0]))}O&&O===R&&j&&("log"===j&&"log"!==O.type?F=Math.pow(10,F):"log"!==j&&"log"===O.type&&(F=F>0?Math.log(F)/Math.LN10:void 0)),T[D]=F}}var H=v(T,A);A.annotations[e]=H;var G=h.getFromId(t,H.xref),X=h.getFromId(t,H.yref),Y={x:0,y:0},W=+H.textangle||0,Z=A._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",H.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:H})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),K=Q.append("g"),$=H.borderwidth,J=H.borderpad,tt=$+J,et=K.append("rect").attr("class","bg").style("stroke-width",$+"px").call(f.stroke,H.bordercolor).call(f.fill,H.bgcolor),rt=H.font,nt=K.append("text").classed("annotation",!0).attr("data-unformatted",H.text).text(H.text);t._context.editable?nt.call(p.makeEditable,K).call(b).on("edit",function(r){H.text=r,this.attr({"data-unformatted":H.text}),this.call(b);var n={};n["annotations["+e+"].text"]=H.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(b),Q.attr({transform:"rotate("+W+","+Y.x+","+Y.y+")"}).call(d.setPosition,Y.x,Y.y)}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,h=n-e,f=a-e,d=s-a,p=l*d-c*h;if(0===p)return null;var g=(u*d-c*f)/p,m=(u*h-l*f)/p;return m<0||m>1||g<0||g>1?null:{x:t+l*g,y:e+h*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),h=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":632,"../../lib/setcursor":642,"../../lib/svg_text_utils":646,"../../plotly":658,"../../plots/cartesian/axes":662,"../../plots/plots":723,"../color":533,"../dragelement":555,"../drawing":557,"./annotation_defaults":524,"./defaults":528,"./draw_arrow_head":530,d3:95,"fast-isnumeric":104}],530:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var h,f,d,p,g=(o.getPx(t,"stroke-width")||1)*l,m=t.style("stroke")||a.defaultLine,v=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,x=r.indexOf("end")>=0,b=c.backoff*g;if("line"===u.nodeName){if(h={x:+t.attr("x1"),y:+t.attr("y1")},f={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(h.y-f.y,h.x-f.x),p=d+Math.PI,b){var _=b*Math.cos(d),w=b*Math.sin(d);y&&(h.x-=_,h.y-=w,t.attr({x1:h.x,y1:h.y})),x&&(f.x+=_,f.y+=w,t.attr({x2:f.x,y2:f.y}))}}else if("path"===u.nodeName){var M=u.getTotalLength(),A="";if(y){var k=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(k.y-T.y,k.x-T.x),h=u.getPointAtLength(Math.min(b,M)),b&&(A="0px,"+b+"px,")}if(x){var E=u.getPointAtLength(M),S=u.getPointAtLength(M-.1);if(p=Math.atan2(E.y-S.y,E.x-S.x),f=u.getPointAtLength(Math.max(0,M-b)),b){var L=A?2*b:b;A+=M-L+"px,"+M+"px"}}else A&&(A+=M+"px");A&&t.style("stroke-dasharray",A)}var z=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&z(h,d),x&&z(f,p)}}},{"../color":533,"../drawing":557,"./arrow_paths":525,d3:95,"fast-isnumeric":104}],531:[function(t,e,r){"use strict";var n=t("../../plotly");r.moduleType="component",r.name="annotations",r.ARROWPATHS=t("./arrow_paths"),r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.calcAutorange=t("./calc_autorange"),r.arrowhead=t("./draw_arrow_head");var i=t("./draw");r.draw=i.draw,r.drawOne=i.drawOne,r.add=function(t){var e=t._fullLayout.annotations.length;n.relayout(t,"annotations["+e+"]","add")}},{"../../plotly":658,"./arrow_paths":525,"./attributes":526,"./calc_autorange":527,"./defaults":528,"./draw":529,"./draw_arrow_head":530}],532:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],533:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var h=at.select(".cbfills").selectAll("rect.cbfill").data(z);h.enter().append("rect").classed("cbfill",!0).style("stroke","none"),h.exit().remove(),h.each(function(t,e){var r=[0===e?S[0]:(z[e]+z[e-1])/2,e===z.length-1?S[1]:(z[e]+z[e+1])/2].map(J.c2p).map(Math.round);e!==z.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=I(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({x:Y,width:Math.max(B,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var f=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?L:[]);return f.enter().append("path").classed("cbline",!0),f.exit().remove(),f.each(function(t){n.select(this).attr("d","M"+Y+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+B).call(d.lineGroupStyle,_.line.width,C(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=Y+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));M("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:k.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,r){var n,i=b();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,h(a,r||{}))}function A(){var r=B+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(F=ot.select("text"),F.node()&&!F.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-Y-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-K;at.select(".cbbg").attr({x:Y-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:K-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:Y,y:K+_.ypad+("top"===_.titleside?st:0),width:Math.max(B,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var k=t._fullLayout,T=k._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void k._infolayer.selectAll("g."+e).remove();var E,S=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),L=[],z=[],C="function"==typeof _.line.color?_.line.color:function(){return _.line.color},I="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},P=_.levels.end+_.levels.size/100,D=_.levels.size,R=1.001*S[0]-.001*S[1],O=1.001*S[1]-.001*S[0];for(E=_.levels.start;(E-P)*D<0;E+=D)E>R&&ES[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+q-X],J.setScale();var at=k._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+H)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+q-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,M(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ht=c.syncOrAsync([o.previousPromises,w,o.previousPromises,A],t);if(ht&&ht.then&&(t._promises||[]).push(ht),t._context.editable){var ft,dt,pt;u.init({element:at.node(),prepFn:function(){ft=at.attr("transform"),f(at)},moveFn:function(t,e){at.attr("transform",ft+" translate("+t+","+e+")"),dt=u.align(W+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,q,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);f(at,r)},doneFn:function(e){f(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},b().index)}})}return ht}function b(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=f,s.reversescale&&(f=a(f)),s.colorscale=f)}},{"../../lib":632,"./flip_scale":545,"./scales":552}],541:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":625,"./attributes":539,"./scales.js":552}],542:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":552}],543:[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,u,c){var h=c.prefix,f=c.cLetter,d=h.slice(0,h.length-1),p=h?i.nestedProperty(t,d).get()||{}:t,g=h?i.nestedProperty(e,d).get()||{}:e,m=p[f+"min"],v=p[f+"max"],y=p.colorscale,x=n(m)&&n(v)&&m=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],546:[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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):e}},{"./default_scale":542,"./is_valid_scale_array":550,"./scales":552}],547:[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(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],554:[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":632}],555:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,h=(new Date).getTime(),h-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,h,f,d,p,g=o.getPlotDiv(t.element)||{},m=1,v=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":632,"../../plotly":658,"../../plots/cartesian/constants":668,"./align":553,"./cursor":554,"./unhover":556}],556:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":624}],557:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,h,f;t.so?(f=o.outlierwidth,h=o.outliercolor,c=a.outliercolor):(f=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,h="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(f||1)+"px",fill:"none"}):(e.style("stroke-width",f+"px").call(l.fill,c),f&&e.call(l.stroke,h))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),h=(c*c*i-u*u*s)*n,f=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&h/d),2),a.round(e[1]+(d&&f/d),2)],[a.round(e[0]-(p&&h/p),2),a.round(e[1]-(p&&f/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),h=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=(r._input||{}).marker||{},s=g.tryColorscale(i,o,""),l=g.tryColorscale(i,o,"line.");n(t,e,r,s,l,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=(e._input||{}).marker||{},i=g.tryColorscale(r,n,""),o=g.tryColorscale(r,n,"line.");t.each(function(t){g.singlePointStyle(t,a.select(this),e,i,o)})}},g.tryColorscale=function(t,e,r){var n=c.nestedProperty(t,r+"color").get(),i=c.nestedProperty(t,r+"colorscale").get(),a=c.nestedProperty(t,r+"cauto").get(),s=c.nestedProperty(t,r+"cmin"),l=c.nestedProperty(t,r+"cmax"),h=s.get(),f=l.get();return i&&Array.isArray(n)?(!a&&o(h)&&o(f)||(h=1/0,f=-(1/0),n.forEach(function(t){o(t)&&(h>t&&(h=+t),ff&&(h=0,f=1),s.set(h),l.set(f),c.nestedProperty(e,r+"cmin").set(h),c.nestedProperty(e,r+"cmax").set(f)),u.makeColorScaleFunc(u.extractScale(i,h,f))):c.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(h.convertToTspans);var f=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*b+1,m=x[l]*c,v=.75*u+x[s]*c+(x[s]-1)*p*u/2;f.attr("transform","translate("+m+","+v+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=k&&(a.selectAll("[data-bb]").attr("data-bb",null),A=[]),t.setAttribute("data-bb",A.length),A.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":618,"../../lib":632,"../../lib/svg_text_utils":646,"../../registry":738,"../../traces/scatter/make_bubble_size_func":859,"../../traces/scatter/subtypes":864,"../color":533,"../colorscale":548,"./symbol_defs":558,d3:95,"fast-isnumeric":104}],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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),h=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+h+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:95}],559:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],560:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),h=0;h0;t.each(function(t){var e,h=t[0].trace,f=h.error_x||{},d=h.error_y||{};h.ids&&(e=function(t){return t.id});var p=o.hasMarkers(h)&&h.marker.maxdisplayed>0;if(d.visible||f.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().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),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var h;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;h="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(h+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");s=!m.size(),s?m=e.append("path").classed("yerror",!0):c&&(m=m.transition().duration(r.duration).ease(r.easing)),m.attr("d",h)}if(f.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var v=(f.copy_ystyle?d:f).width;h="M"+o.xh+","+(o.y-v)+"v"+2*v+"m0,-"+v+"H"+o.xs,o.noXS||(h+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",h)}}})}})}},{"../../traces/scatter/subtypes":864,d3:95,"fast-isnumeric":104}],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":533,d3:95}],566:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":668}],567:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,o,r,n)}e=e||{},n("source"),n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var s=0;s<2;s++){var l={_fullLayout:r},u=["x","y"][s];i.coerceRef(t,e,l,u,"paper")}return e}var i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var r=t.images,i=e.images=[],a=0;a=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}},{}],571:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":625,"../../plots/font_attributes":683,"../color/attributes":532}],572:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],573:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,h,f,d=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(u=0,h="left",c=1.1,f="bottom"):(u=0,h="left",c=-.1,f="top")}l("traceorder",m),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",h),l("y",c),l("yanchor",f),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":632,"../../plots/layout_attributes":714,"../../registry":738,"./attributes":571,"./helpers":576}],574:[function(t,e,r){"use strict";function n(t,e){function r(r){v.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,h=t.selectAll("text.legendtext").data([0]);h.enter().append("text").classed("legendtext",!0),h.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?h.call(v.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):h.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var h=a.label,f=r.indexOf(h);f===-1?r.push(h):r.splice(f,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),f=c[0].length||1;r=s*f,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-f)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){h.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;h.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height); -});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,f=l.length;cn.width-(n.margin.r+n.margin.l)&&(x=0,m+=v,i.height=i.height+v,v=0),h.setTranslate(this,a+x,5+a+e.height/2+m),i.width+=o+r,i.height=Math.max(i.height,e.height),x+=o+r,v=Math.max(e.height,v)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),f.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),f.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),h=t("../../lib"),f=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(h.setTranslate,0,e),S.call(g.setRect,N,t,y.scrollBarWidth,y.scrollBarHeight),k.select("rect").attr({y:v.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var v=r.legend,_=r.showlegend&&x(t.calcdata,v),M=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void f.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var T=A.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var E=A.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var S=A.selectAll("rect.scrollbar").data([0]);S.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var L=E.selectAll("g.groups").data(_);L.enter().append("g").attr("class","groups"),L.exit().remove();var z=L.selectAll("g.traces").data(h.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var C=0!==A.enter().size();C&&(o(t,L,z),s(t));var I=0,P=r.width,D=0,R=r.height;o(t,L,z),v.height>R?l(t):s(t);var O=r._size,F=O.l+O.w*v.x,j=O.t+O.h*(1-v.y);w.isRightAnchor(v)?F-=v.width:w.isCenterAnchor(v)&&(F-=v.width/2),w.isBottomAnchor(v)?j-=v.height:w.isMiddleAnchor(v)&&(j-=v.height/2);var N=v.width,B=O.w;N>B?(F=O.l,N=B):(F+N>P&&(F=P-N),FV?(j=O.t,U=V):(j+U>R&&(j=R-U),jr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),f=d.hasLines(o);if(s||u||f){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),f&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var m=l.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(s?n:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(h.pointStyle,i),s&&(n[0].mrc=3);var y=m.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(h.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(f.fill,t.mc||r.color),e&&i.call(f.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(f.fill,t.fc||e.fillcolor),r&&n.call(f.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),h=t("../drawing"),f=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":632,"../../registry":738,"../../traces/pie/style_one":838,"../../traces/scatter/subtypes":864,"../color":533,"../drawing":557,d3:95}],579:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,f=(1+c)/2,d=(1-c)/2,p=h.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(m,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=i(s),y=[];return((u||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||v||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(m,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var m=c("bgcolor");c("activecolor",o.contrast(m,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":632,"../color":533,"./attributes":583,"./button_attributes":584,"./constants":585}],587:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=f)));return p>=d?[d,p]:void 0}}var i=t("../../plots/cartesian/axes"),a=t("./constants"),o=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=e.shapes;if(r.length&&t._fullData.length)for(var o=0;oe;a--)f(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,L)},i=L.line.width?L.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",L.opacity).call(_.stroke,i).call(_.fill,L.fillcolor).call(w.dashLine,L.line.dash,L.line.width);z&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&h(t,a,L,e)}var a,o;f(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={xref:s.xref,yref:s.yref},u={};"string"==typeof r&&r?u[r]=n:x.isPlainObject(r)&&(u=r);var c=Object.keys(u);for(a=0;aX&&n>Y&&!t.shiftKey?M.getCursor(i/r,1-a/n):"move";A(e,o),G=o.split("-")[0]}function a(e){N=b.getFromId(t,r.xref),B=b.getFromId(t,r.yref),U=T.getDataToPixel(t,N),V=T.getDataToPixel(t,B,!0),q=T.getPixelToData(t,N),H=T.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(F=r.path,j=a+".path"):(c=U(r.x0),h=V(r.y0),f=U(r.x1),d=V(r.y1),g=a+".x0",v=a+".y0",x=a+".x1",_=a+".y1"),cY&&(u[L]=r[P]=H(s),u[z]=r[D]=H(l)),h-c>X&&(u[C]=r[R]=q(c),u[I]=r[O]=q(h))}e.attr("d",p(t,r))}var u,c,h,f,d,g,v,x,_,w,k,E,S,L,z,C,I,P,D,R,O,F,j,N,B,U,V,q,H,G,X=10,Y=10,W={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=W.element.getBoundingClientRect();M.init(W)}function f(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=b.getFromId(t,r.id,"x")._id,i=b.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=b.getFromId(t,e.xref),l=b.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.dataToLinear(s),n=function(t){return s._offset+s.l2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.dataToLinear(l),a=function(t){return l._offset+l.l2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),h=n(e.x1),f=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+f+"L"+h+","+d;if("rect"===o)return"M"+c+","+f+"H"+h+"V"+d+"H"+c+"Z";var p=(c+h)/2,m=(f+d)/2,v=Math.abs(p-c),y=Math.abs(m-f),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),i+l})}function m(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),M=t("../dragelement"),A=t("../../lib/setcursor"),k=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),S=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":632,"../../lib/setcursor":642,"../../plotly":658,"../../plots/cartesian/axes":662,"../color":533,"../dragelement":555,"../drawing":557,"./constants":597,"./defaults":598,"./helpers":600,"./shape_defaults":602,"fast-isnumeric":104}],600:[function(t,e,r){"use strict";r.dataToLinear=function(t){return"category"===t.type?t.c2l:t.d2l},r.linearToData=function(t){return"category"===t.type?t.l2c:t.l2d},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.dataToLinear(e);i=function(t){return e._offset+e.l2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.linearToData(e);i=function(t){return o(e.p2l(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],601:[function(t,e,r){"use strict";r.moduleType="component",r.name="shapes",r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.calcAutorange=t("./calc_autorange");var n=t("./draw");r.draw=n.draw,r.drawOne=n.drawOne},{"./attributes":595,"./calc_autorange":596,"./defaults":598,"./draw":599}],602:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e){function r(e,r){return n.coerce(t,s,a,e,r)}var s={};r("layer"),r("opacity"),r("fillcolor"),r("line.color"),r("line.width"),r("line.dash");for(var l=t.path?"path":"rect",u=r("type",l),c=["x","y"],h=0;h<2;h++){var f=c[h],d={_fullLayout:e},p=i.coerceRef(t,s,d,f);if("path"!==u){var g=.25,m=.75;if("paper"!==p){var v=i.getFromId(d,p),y=o.linearToData(v);g=y(v.range[0]+g*(v.range[1]-v.range[0])),m=y(v.range[0]+m*(v.range[1]-v.range[0]))}r(f+"0",g),r(f+"1",m)}}return"path"===u?r("path"):n.noneOrAll(t,s,["x0","x1","y0","y1"]),s}},{"../../lib":632,"../../plots/cartesian/axes":662,"./attributes":595,"./helpers":600}],603:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":625,"../../plots/animation_attributes":659,"../../plots/font_attributes":683,"../../plots/pad_attributes":722,"./constants":604}],604:[function(t,e,r){"use strict";e.exports={name:"sliders",itemName:"slider",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],605:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,o,r,n)}var s=i(t,e),l=n("visible",s.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,u,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*L.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+L.stepInset+(t.inputAreaLength-2*L.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-L.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*L.stepInset-2*t.inputAreaStart)))}function x(t,e,r){var n=t.selectAll("rect."+L.railTouchRectClass).data([0]);n.enter().append("rect").classed(L.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,L.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),A.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+L.railRectClass).data([0]);r.enter().append("rect").classed(L.railRectClass,!0);var n=e.inputAreaLength-2*L.railInset;r.attr({width:n,height:L.railWidth,rx:L.railRadius,ry:L.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(r,L.railInset,.5*(e.inputAreaWidth-L.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(L.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+L.groupClassName).data(r,i);l.enter().append("g").classed(L.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,L.autoMarginIdRoot+e._index)});for(var u=0;u0||f<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,S=!0,L=C,M._infolayer.select("."+e).attr({"data-unformatted":L}).text(L).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,m=r.propName,v=r.traceIndex,y=r.dfltName,x=r.avoid||{},b=r.attributes,_=r.transform,w=r.containerGroup,M=t._fullLayout,A=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,S=!1,L=g.title.trim();""===L&&(E=0),L.match(/Click to enter .+ title/)&&(E=.2,S=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(L).attr("class",e),z.attr({"data-unformatted":L}).call(h);var C="Click to enter "+y+" title";t._context.editable?(L||p(),z.call(c.makeEditable).on("edit",function(e){ -void 0!==v?a.restyle(t,m,e,v):a.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):L&&!L.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",S)}},{"../../lib":632,"../../lib/svg_text_utils":646,"../../plotly":658,"../../plots/plots":723,"../color":533,"../drawing":557,d3:95,"fast-isnumeric":104}],609:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":625,"../../plots/font_attributes":683,"../../plots/pad_attributes":722,"../color/attributes":532}],610:[function(t,e,r){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],611:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,o,r,n)}var s=i(t,e),l=n("visible",s.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,u,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var h=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);h.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&h.call(v).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){x.select(this).remove(),h.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],618:[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}},{}],619:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.19.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":531,"./components/images":569,"./components/legend":577,"./components/rangeselector":589,"./components/rangeslider":594,"./components/shapes":601,"./components/sliders":607,"./components/updatemenus":613,"./fonts/mathjax_config":620,"./lib/queue":640,"./plot_api/plot_schema":652,"./plot_api/register":653,"./plot_api/set_plot_config":654,"./plot_api/to_image":656,"./plot_api/validate":657,"./plotly":658,"./snapshot":743,"./snapshot/download":740,"./traces/scatter":854,d3:95,"es6-promise":101}],620:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],621:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],622:[function(t,e,r){"use strict";function n(t){return t&&void 0!==t.valType}var i=t("fast-isnumeric"),a=t("tinycolor2"),o=t("./nested_property"),s=t("./is_plain_object"),l=t("./filter_unique"),u=t("../components/colorscale/get_scale"),c=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,n){!i(t)||void 0!==n.min&&tn.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,n){t%1||!i(t)||void 0!==n.min&&tn.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(u(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):i(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&c.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!c.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a2)return!1;var o=a[0].split("-");if(o.length>3||3!==o.length&&a[1])return!1;if(4===o[0].length)e=Number(o[0]);else{if(2!==o[0].length)return!1;var l=(new Date).getFullYear();e=((Number(o[0])-l+70)%100+200)%100+l-70}return!!s(e)&&(1===o.length?new Date(e,0,1).getTime():(r=Number(o[1])-1,!(o[1].length>2)&&r>=0&&r<=11&&(2===o.length?new Date(e,r,1).getTime():(n=Number(o[2]),!(o[2].length>2)&&n>=1&&n<=31&&(n=new Date(e,r,n).getTime(),a[1]?(o=a[1].split(":"),!(o.length>3)&&(i=Number(o[0]),!(o[0].length>2)&&i>=0&&i<=23&&(n+=36e5*i,1===o.length?n:(r=Number(o[1]),!(o[1].length>2)&&r>=0&&r<=59&&(n+=6e4*r,2===o.length?n:(t=Number(o[2]),t>=0&&t<60&&n+1e3*t)))))):n)))))},r.isDateTime=function(t){return r.dateTime2ms(t)!==!1},r.ms2DateTime=function(t,e){e||(e=0);var r=new Date(t),i=o.time.format("%Y-%m-%d")(r);return e<7776e6?(i+=" "+n(r.getHours(),2),e<432e6&&(i+=":"+n(r.getMinutes(),2),e<108e5&&(i+=":"+n(r.getSeconds(),2),e<3e5&&(i+="."+n(r.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var l={H:["%H:%M:%S~%L","%H:%M:%S","%H:%M"],I:["%I:%M:%S~%L%p","%I:%M:%S%p","%I:%M%p"],D:["%H","%I%p","%Hh"]},u={Y:["%Y~%m~%d","%Y%m%d","%y%m%d","%m~%d~%Y","%d~%m~%Y"],Yb:["%b~%d~%Y","%d~%b~%Y","%Y~%d~%b","%Y~%b~%d"],y:["%m~%d~%y","%d~%m~%y","%y~%m~%d"],yb:["%b~%d~%y","%d~%b~%y","%y~%d~%b","%y~%b~%d"]},c=o.time.format.utc,h={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(c),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(c)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(c)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){u[t].forEach(function(e){h[t].D.push(c(e)),["H","I","D"].forEach(function(r){l[r].forEach(function(n){var i=h[t][r];i.push(c(e+"~"+n)),i.push(c(n+"~"+e))})})})});var f=/[a-z]*/g,d=function(t){return t.substr(0,3)},p=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,g=/[\s,\/\-\.\(\)]+/g,m=/~?([ap])~?m(~|$)/,v=function(t,e){return e+"m "},y=/\d\d\d\d/,x=/(^|~)[a-z]{3}/,b=/[ap]m/,_=/:/,w=/q([1-4])/,M=["31~mar","30~jun","30~sep","31~dec"],A=function(t,e){return M[e-1]},k=/ ?([+\-]\d\d:?\d\d|Z)$/;r.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(f,d).replace(p,"").replace(g,"~").replace(m,v).replace(w,A).trim().replace(k,"");var e,r,n=null,o=i(t),s=a(t);e=h[o][s],r=e.length;for(var l=0;l0&&(n.push(i),i=[])}return n.push(i),n},r.makeLine=function(t,e){var r={};return r=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(r.trace=e),r},r.makePolygon=function(t,e){var r={};if(1===t.length)r={type:"Polygon",coordinates:t};else{for(var n=new Array(t.length),i=0;i",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./coerce":622,"./dates":623,"./extend":625,"./filter_unique":626,"./is_array":633,"./is_plain_object":634,"./loggers":635,"./matrix":636,"./nested_property":637,"./notifier":638,"./search":641,"./stats":644,d3:95}],633:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],634:[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}},{}],635:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,f(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(f(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric"),f=t("./is_array");e.exports=function(t,e){if(h(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,h,f,d,p=n.length,g=n[0][0],m=n[0][1],v=0;for(u=1;uMath.max(c,g)||l>Math.max(h,m)))if(lc||Math.abs(n(o,f))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":636}],640:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,h=0,f=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;h90&&l.log("Long binary search..."),h-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":104}],645:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:33,tinycolor2:489}],646:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+f.randstr([],64),a=h.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=h.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())f.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,m.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var h=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var h=t("d3"),f=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");h.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(f.log(r.querySelector("parsererror div").textContent),null):h.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=h.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=h.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var m=f.getPlotDiv(s.node());(m&&m._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var h=n(l,"width"),f=n(l,"height"),g=+s.attr("x")-h*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],m=parseInt(s.style("font-size"),10)||n(s,"height"),v=-m/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-h/2,v-f/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:v-f/2}):"a"===p[0]?l.attr({x:0,y:v}):l.attr({x:g,y:+s.attr("y")+v-f/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(v," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=h.select(f.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=h.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;h.select(this).transition().duration(0).remove(),h.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;h.select(document).on("mouseup",function(){return h.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===h.event.which?(o.style({opacity:1}),h.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),h.select(this).call(c(o,e,r)))}).on("keydown",function(){13===h.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=h.dispatch("edit","input","cancel"),l=h.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),h.rebind(this,s,"on")}},{"../constants/string_mappings":617,"../constants/xmlns_namespaces":618,"../lib":632,d3:95}],647:[function(t,e,r){"use strict";var n=e.exports={},i=t("../plots/geo/constants").locationmodeToLayer,a=t("topojson").feature;n.getTopojsonName=function(t){return[t.scope.replace(/ /g,"-"),"_",t.resolution.toString(),"m"].join("")},n.getTopojsonPath=function(t,e){return t+e+".json"},n.getTopojsonFeatures=function(t,e){var r=i[t.locationmode],n=e.objects[r];return a(e,n).features}},{"../plots/geo/constants":685,topojson:491}],648:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0&&u.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);var i=h.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lC.range[0]?[1,2]:[2,1]);else{var I=C.range[0],P=C.range[1];"log"===b?(I<=0&&P<=0&&r(E+".autorange",!0),I<=0?I=P/1e6:P<=0&&(P=I/1e6),r(E+".range[0]",Math.log(I)/Math.LN10),r(E+".range[1]",Math.log(P)/Math.LN10)):(r(E+".range[0]",Math.pow(10,I)),r(E+".range[1]",Math.pow(10,P)))}else r(E+".autorange",!0)}if("reverse"===k)S.range?S.range.reverse():(r(E+".autorange",!0),S.range=[1,0]),L.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var D=v.parts[1],R=v.parts[0],O=a[R]||[],F=O[D]||{};null===b&&(e[m]="remove"),2===v.parts.length&&("add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?D===-1?(g[R]=O,delete g[m]):g[m]=F:x.log("???",e)),!n(F,"x")&&!n(F,"y")||x.containsAny(m,["color","opacity","align","dash"])||(d.docalc=!0);var j=w.getComponentMethod(R,"drawOne");j(t,D,v.parts.slice(2).join("."),e[m]),delete e[m]}else M.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1]?(z.manageArrayContainers(v,b,g),d.doplot=!0):(0===v.parts[0].indexOf("scene")?d.doplot=!0:0===v.parts[0].indexOf("geo")?d.doplot=!0:0===v.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===m?d.doplot=!0:!o._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?d.docalc=!0:v.parts[0].indexOf("legend")!==-1?d.dolegend=!0:m.indexOf("title")!==-1?d.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(v.parts[1],["tick","exponent","grid","zeroline"])?d.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:v.parts.length>1&&v.parts[1].indexOf("line")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&"mirror"===v.parts[1]?d.doticks=d.dolayoutstyle=!0:"margin.pad"===m?d.doticks=d.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(d.doplot=!0):d.doplot=!0,v.set(b))}}var N=t._fullLayout.width,B=t._fullLayout.height;M.supplyDefaults(t),t.layout.autosize&&M.plotAutoSize(t,t.layout,t._fullLayout);var U=e.height||e.width||t._fullLayout.width!==N||t._fullLayout.height!==B;return U&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];m.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=x.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(S.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),M=t("../plots/plots"),A=t("../plots/cartesian/graph_interact"),k=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),S=t("../constants/xmlns_namespaces"),L=t("../lib/svg_text_utils"),z=t("./helpers"),C=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=I._basePlotModules,r=0;r=o.length?o[0]:o[t]:o}function i(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}if(t=z.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var a=t._transitionData;a._frameQueue||(a._frameQueue=[]),r=M.supplyAnimationDefaults(r);var o=r.transition,s=r.frame;return void 0===a._frameWaitingCnt&&(a._frameWaitingCnt=0),new Promise(function(s,l){function u(){if(0!==a._frameQueue.length){for(;a._frameQueue.length;){var e=a._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function c(e){if(0!==e.length){for(var o=0;oa._timeToNext&&f()};e()}function p(t){return Array.isArray(o)?v>=o.length?t.transitionOpts=o[v]:t.transitionOpts=o[0]:t.transitionOpts=o,v++,t}var g,m,v=0,y=[],b=void 0===e||null===e,_=Array.isArray(e),w=!b&&!_&&x.isPlainObject(e);if(w)y.push({type:"object",data:p(x.extendFlat({},e))});else if(b||"string"==typeof e)for(g=0;g0&&TT)&&E.push(m);y=E}}y.length>0?c(y):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,r){if(t=z.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:M.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=M.modifyFrames,l=M.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),M.modifyFrames(t,a)},y.purge=function(t){t=z.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return M.cleanPlot([],{},r,e),M.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":557,"../components/errorbars":563,"../constants/xmlns_namespaces":618,"../lib":632,"../lib/events":624,"../lib/queue":640,"../lib/svg_text_utils":646,"../plotly":658,"../plots/cartesian/graph_interact":670,"../plots/plots":723,"../plots/polar":726,"../registry":738,"./helpers":649,"./subroutines":655,d3:95,"fast-isnumeric":104}],651:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],652:[function(t,e,r){"use strict";function n(t){var e=y.attributes,r=u({type:t}),n=h(t),i=d(t),a={},o={};a.type=null,M(a,e),a=s(r.attributes,a,"attributes",t),void 0!==i.attributes&&M(a,i.attributes),a.type=t,a=c(a),l(a),E.traces[t]=w({},n,{attributes:a}),void 0!==r.layoutAttributes&&(o=s(r.layoutAttributes,o,"layoutAttributes",t),l(o),E.traces[t].layoutAttributes=o)}function i(){var t=y.layoutAttributes,e={};e=s(t,e,"layoutAttributes","*"),e=f(e),e=p(e),e=c(e),l(e),g(e),E.layout={layoutAttributes:e}}function a(t){var e=v.transformsRegistry[t],r={};r=s(r,e.attributes||{},"attributes","*"),r=c(r),l(r),g(r),E.transforms[t]={attributes:r}}function o(){E.defs={valObjects:x.valObjects,metaKeys:x.UNDERSCORE_ATTRS.concat(["description","role"])}}function s(t,e,r,n){var i,a,o,l,c;return Object.keys(t).forEach(function(h){return h===k?void Object.keys(t[h]).forEach(function(l){i=u({_module:t[h][l]}),void 0!==i&&(a=i[r],o=s(a,{},r,n),x.nestedProperty(e,l).set(M({},o)))}):h===T?void Object.keys(t[h]).forEach(function(i){i===n&&(l=u({_module:t[h][i]}),void 0!==l&&(c=l[r],c=s(c,{},r,n),A(e,c)))}):void(e[h]=x.isPlainObject(t[h])?A({},t[h]):t[h])}),e}function l(t){function e(t){return{valType:"string"}}function r(t,r,n){S.isValObject(t)?"data_array"===t.valType?(t.role="data",n[r+"src"]=e(r)):t.arrayOk===!0&&(n[r+"src"]=e(r)):x.isPlainObject(t)&&(t.role="object")}x.crawl(t,r)}function u(t){if("type"in t)return"area"===t.type?{attributes:b}:v.getModule({type:t.type});var e=v.subplotsRegistry,r=v.componentsRegistry,n=t._module;return e[n]?e[n]:r[n]?r[n]:m[n]}function c(t){return Object.keys(t).forEach(function(e){"_"===e.charAt(0)&&x.UNDERSCORE_ATTRS.indexOf(e)===-1&&delete t[e]}),t}function h(t){return"area"===t?{}:v.modules[t].meta||{}}function f(t){return w(t,{radialaxis:_.radialaxis,angularaxis:_.angularaxis}),w(t,_.layout),t}function d(t){if("area"===t)return{};var e=v.subplotsRegistry,r=Object.keys(e).filter(function(e){return v.traceIs({type:t},e)})[0];return void 0===r?{}:e[r]}function p(t){var e=v.subplotsRegistry;return Object.keys(t).forEach(function(r){Object.keys(e).forEach(function(n){var i,a=e[n];a.attrRegex&&(i="cartesian"===n||"gl2d"===n?a.attrRegex.x.test(r)||a.attrRegex.y.test(r):a.attrRegex.test(r),i&&(t[r][x.IS_SUBPLOT_OBJ]=!0))})}),t}function g(t){function e(t,e,r){if(t[x.IS_LINKED_TO_ARRAY]===!0){var n=e.substr(0,e.length-1);delete t[x.IS_LINKED_TO_ARRAY],r[e]={items:{}},r[e].items[n]=t,r[e].role="object"}}x.crawl(t,e)}var m=t("../plotly"),v=t("../registry"),y=t("../plots/plots"),x=t("../lib"),b=t("../plots/polar/area_attributes"),_=t("../plots/polar/axis_attributes"),w=x.extendFlat,M=x.extendDeep,A=x.extendDeepAll,k="_nestedModules",T="_composedModules",E={traces:{},layout:{},transforms:{},defs:{}},S=e.exports={};S.get=function(){return v.allTypes.concat("area").forEach(n),i(),Object.keys(v.transformsRegistry).forEach(a),o(),E},S.crawl=x.crawl,S.isValObject=x.isValObject},{"../lib":632,"../plotly":658,"../plots/plots":723,"../plots/polar/area_attributes":724,"../plots/polar/axis_attributes":725,"../registry":738}],653:[function(t,e,r){"use strict";function n(t){o.register(t,t.name,t.categories,t.meta),o.subplotsRegistry[t.basePlotModule.name]||o.registerSubplot(t.basePlotModule)}function i(t){if("string"!=typeof t.name)throw new Error("Transform module *name* must be a string.");var e="Transform module "+t.name,r="function"==typeof t.transform,n="function"==typeof t.calcTransform;if(!r&&!n)throw new Error(e+" is missing a *transform* or *calcTransform* method.");r&&n&&s.log([e+" has both a *transform* and *calcTransform* methods.","Please note that all *transform* methods are executed","before all *calcTransform* methods."].join(" ")),s.isPlainObject(t.attributes)||s.log(e+" registered without an *attributes* object."),"function"!=typeof t.supplyDefaults&&s.log(e+" registered without a *supplyDefaults* method."), -o.transformsRegistry[t.name]=t}function a(t){o.componentsRegistry[t.name]=t}var o=t("../registry"),s=t("../lib");e.exports=function(t){if(!t)throw new Error("No argument passed to Plotly.register.");t&&!Array.isArray(t)&&(t=[t]);for(var e=0;e1)};f(e.width)&&f(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.td;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(h).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":632,"../plotly":658,"../snapshot/cloneplot":739,"../snapshot/helpers":742,"../snapshot/svgtoimg":744,"../snapshot/tosvg":746,"fast-isnumeric":104}],657:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),f=0;f1&&l.push(o("object","layout"))),f.supplyDefaults(u);for(var c=u._fullData,m=r.length,v=0;vu&&e=864e5?t._tickround="d":r>=36e5?t._tickround="H":r>=6e4?t._tickround="M":r>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(r/2)/Math.LN10);else{x(r)||(r=Number(r.substr(1))),t._tickround=2-Math.floor(Math.log(r)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var n=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(n)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((n-1)/3):t._tickexponent=n)}else"M"===r.charAt(0)?t._tickround=2===r.length?"m":"y":t._tickround=null}function o(t,e){var r=t.match(U),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(U,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a=e.x,s=t._tickround,l=new Date(a),u="";r&&t.hoverformat?i=o(t.hoverformat,a):t.tickformat?i=o(t.tickformat,a):(n&&(x(s)?s+=2:s={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[s]),"y"===s?i=R(l):"m"===s?i=O(l):(a!==t._tmin||r||(u="
"+R(l)),"d"===s?i=F(l):"H"===s?i=j(l):(a!==t._tmin||r||(u="
"+F(l)+", "+R(l)),i=N(l),"M"!==s&&(i+=B(l),"S"!==s&&(i+=f(v(a/1e3,1),t,"none",r).substr(1)))))),e.text=i+u}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=f(Math.pow(10,o),t,i,n);else if(x(a)||"D"===a.charAt(0)&&v(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=f(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,v(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function h(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=f(e.x,t,i,n)}function f(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var h={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};a(h),o=(Number(h._tickround)||0)+4,l=h._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=V[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&h/c>f&&(l=o,u=s,f=h/c);if(n===i){var p=n-1,g=n+1;r="tozero"===t.rangemode?n<0?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else f&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-f*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),f=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-f*l.pad,u.val+f*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var r=T.list(t,"",!0),n=!1,i=0;i=f?d=!1:s.val>=u&&s.pad<=f&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:f})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=h?d=!1:s.val<=c&&s.pad<=h&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:h})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,h,f,d,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=m-1;a>5;a--)i(a)}},T.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/h.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var h={type:"log"===e.type?"linear":e.type,range:[a,o]};T.autoTicks(h,s);var f,d=T.tickIncrement(T.tickFirst(h),h.dtick,"reverse");if("number"==typeof h.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||i(a)||i(o))){var w=h.dtick/2;d+=d+w0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),a(t),t._tmin=T.tickFirst(t);var i=t.range[1]=s:l<=s)&&(o.push(l),!(o.length>1e3));l=T.tickIncrement(l,t.dtick,i));t._tmax=o[o.length-1];for(var u=new Array(o.length),c=0;c157788e5?(e/=315576e5,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,L)):e>12096e5?(e/=26298e5,t.dtick="M"+i(e,1,z)):e>432e5?(t.dtick=i(e,864e5,I),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=i(e,36e5,z):e>3e4?t.dtick=i(e,6e4,C):e>500?t.dtick=i(e,1e3,C):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,L));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var n=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/n,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,L)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,L));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var a=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(a)}},T.tickIncrement=function(t,e,r){var n=r?-1:1;if(x(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?D:P,l=t+.01*n,u=_.roundUp(v(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]n:u1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("./clean_datum");e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../lib":632,"./clean_datum":667,"fast-isnumeric":104}],664:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),h=[],f=0;f0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],667:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return i.ms2DateTime(t);if("string"!=typeof t&&!n(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){i.error(e,t)}return t}},{"../../lib":632,"fast-isnumeric":104}],668:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],669:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?h.ms2DateTime(n,i):"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),h=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,r,s,_,w,M,A){function k(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+mt+", "+vt+")").attr("d",ct+"Z"),pt=gt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+mt+", "+vt+")").attr("d","M0,0Z"),L();for(var a=0;a<$.length;a++)T($[a].range)}function L(){gt.selectAll(".select-outline").remove()}function z(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(H,e+ot)),i=Math.max(0,Math.min(G,r+st)),a=Math.abs(n-ot),o=Math.abs(i-st),s=Math.floor(Math.min(o,a,Y)/2);lt.l=Math.min(ot,n),lt.r=Math.max(ot,n),lt.t=Math.min(st,i),lt.b=Math.max(st,i),!tt||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),pt.transition().style("opacity",1).duration(200),ht=!0)}function C(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),b=!1)))}function P(e,r){var i=1===(M+A).length;if(e)j();else if(2!==r||i){if(1===r&&i){var a=M?q[0]:V[0],o="s"===M||"w"===A?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",h="middle";if(a.fixedrange)return;M?(h="n"===M?"top":"bottom","right"===a.side&&(c="right")):"e"===A&&(c="right"),nt.call(f.makeEditable,null,{immediate:!0,background:B.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:h}).on("edit",function(e){var r="category"===a.type?a.c2l(e):a.d2l(e);void 0!==r&&u.relayout(t,s,r)})}}else F()}function D(e){function r(t,e,r){if(!t.fixedrange){T(t.range);var n=t.range,i=n[0]+(n[1]-n[0])*e;t.range=[i+(n[0]-i)*r,i+(n[1]-i)*r]}}if(t._context.scrollZoom||B._enablescrollzoom){if(t._transitioningWithDuration)return h.pauseEvent(e);var n=t.querySelector(".plotly");if(E(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(xt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void h.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=_t.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=yt[0]+yt[2]*l,c=(s.bottom-e.clientY)/s.height,f=yt[1]+yt[3]*(1-c);if(A){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,r){for(var n=1-e,a=0,o=0;o0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nW.width||Y<0||Y>W.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:A[0]._length/2,Y="ypx"in e?e.ypx:k[0]._length/2;if(C="xval"in e?n(a,e.xval):i(A,X),I="yval"in e?n(a,e.yval):i(k,Y),!g(C[0])||!g(I[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(D=0;D1||O.hoverinfo.indexOf("name")!==-1?O.name:void 0,index:!1,distance:Math.min(Z,M.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[F]&&(V.subplot=o[F]._subplot),q=H.length,"array"===N){var Q=e[D];"pointNumber"in Q?(V.index=Q.pointNumber,N="closest"):(N="","xval"in Q&&(B=Q.xval,N="x"),"yval"in Q&&(U=Q.yval,N=N?"closest":"y"))}else B=C[j],U=I[j];if(O._module&&O._module.hoverPoints){var K=O._module.hoverPoints(V,B,U,N);if(K)for(var $,J=0;Jq&&(H.splice(0,q),Z=H[0].distance)}if(0===H.length)return _.unhoverRaw(t,e);var tt="y"===z&&G.length>1;H.sort(function(t,e){return t.distance-e.distance});var et=x.combine(o.plot_bgcolor||x.background,o.paper_bgcolor),rt={hovermode:z,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(H,rt);c(H,tt?"xa":"ya"),h(nt,tt);var it=t._hoverdata,at=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):k&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var h=e.select("text.nums").style("fill",u).call(b.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);h.selectAll("tspan.line").call(b.setPosition,0,0);var f=e.select("text.name"),m=0;r&&r!==n?(f.style("fill",l).text(r).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),f.selectAll("tspan.line").call(b.setPosition,0,0),m=f.node().getBoundingClientRect().width+2*I):(f.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var v,M,E=h.node().getBoundingClientRect(),S=t.xa._offset+(t.x0+t.x1)/2,L=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),D=E.width+C+I+m;t.ty0=_-E.top,t.bx=E.width+2*I,t.by=E.height+2*I,t.anchor="start",t.txwidth=E.width,t.tx2width=m,t.offset=0,a?(t.pos=S,v=L+P/2+D<=A,M=L-P/2-D>=0,"top"!==t.idealAlign&&v||!M?v?(L+=P/2,t.anchor="start"):t.anchor="middle":(L-=P/2,t.anchor="end")):(t.pos=L,v=S+z/2+D<=w,M=S-z/2-D>=0,"left"!==t.idealAlign&&v||!M?v?(S+=z/2,t.anchor="start"):t.anchor="middle":(S-=z/2,t.anchor="end")),h.attr("text-anchor",t.anchor),m&&f.attr("text-anchor",t.anchor),e.attr("transform","translate("+S+","+L+")"+(a?"rotate("+T+")":""))}),L}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,h=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?S:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(f.push.apply(f,d),h.splice(o+1,1),u=0,s=f.length-1;s>=0;s--)u+=f[s].dp;for(a=u/f.length,s=f.length-1;s>=0;s--)f[s].dp-=a;n=!1}else o++}h.forEach(r)}for(o=h.length-1;o>=0;o--){var m=h[o];for(s=m.length-1;s>=0;s--){var v=m[s],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function h(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(C+I),s=o+a*(t.txwidth+I),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-z,l=t.offset*L),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*C+l)+","+(C+u)+"v"+(t.by/2-C)+"h"+n*t.bx+"v-"+t.by+"H"+(n*C+l)+"V"+(u-C)+"Z"),i.call(b.setPosition,o+l,u+t.ty0-t.by/2+I).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(b.setPosition,s+a*I+l,u+t.ty0-t.by/2+I),r.select("rect").call(b.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function f(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0; -}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),A=t("./dragbox"),k=e.exports={};k.unhover=_.unhover,k.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},k.supplyLayoutDefaults=function(t,e,r){function n(r,n){return m.coerce(t,e,k.layoutAttributes,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=k.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},k.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+M.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},k.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},k.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexh[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":632,"fast-isnumeric":104}],676:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,h){function f(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,m=i.element.getBoundingClientRect(),v=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,x=e-m.left,b=r-m.top,_=x,w=b,M="M"+x+","+b,A=i.xaxes[0]._length,k=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),S=i.xaxes.concat(i.yaxes);"lasso"===h&&(p=l([[x,b]],s.BENDPX));var L=g.selectAll("path.select-outline").data([1,2]);L.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",M+"Z");var z,C,I,P,D,R=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),O=[],F=i.gd,j=[];for(z=0;z0)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*c*Math.abs(n-i))}return o.BADNUM}function r(t){return Math.pow(10,t)}function u(t){return i(t)?Number(t):o.BADNUM}var c=10;if(t.c2l="log"===t.type?e:u,t.l2c="log"===t.type?r:u,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(e){var r,n=t._gd._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var o=l.getFromId(t._gd,t.overlaying);t.domain=o.domain}var s=e&&t._r?t._r:t.range;for(s&&2===s.length&&s[0]!==s[1]||(s=[-1,1]),r=0;r<2;r++)i(s[r])||(s[r]=i(s[1-r])?s[1-r]*(r?10:.1):r?1:-1),s[r]<-(Number.MAX_VALUE/2)?s[r]=-(Number.MAX_VALUE/2):s[r]>Number.MAX_VALUE/2&&(s[r]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s[0]-s[1]),t._b=-t._m*s[1]):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s[1]-s[0]),t._b=-t._m*s[0]),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):o.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},["linear","log","-"].indexOf(t.type)!==-1)t.c2d=u,t.d2c=function(t){return t=s(t),i(t)?Number(t):o.BADNUM},t.d2l=function(e,r){return"log"===t.type?t.c2l(t.d2c(e),r):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return i(t)?a.ms2DateTime(t):o.BADNUM},t.d2c=function(t){return i(t)?Number(t):a.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var h=t.range.map(a.dateTime2ms);!i(t.range[0])&&i(h[0])&&(t.range[0]=h[0]),!i(t.range[1])&&i(h[1])&&(t.range[1]=h[1])}catch(e){a.error(e,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?o.BADNUM:r},t.d2l=t.d2c);t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;ar.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=c(e),_=Object.keys(b),w=h(y,_,b);if(!w.length)return!1;var M;u&&(M=u());var A,k,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),A=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":632,"../../plotly":658,"../../registry":738,"./axes":662,d3:95}],682:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],h=0;hi},M.render=function(){function t(t){var e=r.projection(t.lonlat);return e?"translate("+e[0]+","+e[1]+")":null}function e(t){return r.isLonLatOverEdges(t.lonlat)?"0":"1.0"}var r=this,n=r.framework,i=n.select("g.choroplethlayer"),a=n.select("g.scattergeolayer"),o=r.path;n.selectAll("path.basepath").attr("d",o),n.selectAll("path.graticulepath").attr("d",o),i.selectAll("path.choroplethlocation").attr("d",o),i.selectAll("path.basepath").attr("d",o),a.selectAll("path.js-line").attr("d",o),null!==r.clipAngle?(a.selectAll("path.point").style("opacity",e).attr("transform",t),a.selectAll("text").style("opacity",e).attr("transform",t)):(a.selectAll("path.point").attr("transform",t),a.selectAll("text").attr("transform",t))}},{"../../components/color":533,"../../components/drawing":557,"../../constants/xmlns_namespaces":618,"../../lib/topojson_utils":647,"../../plots/cartesian/axes":662,"../../plots/cartesian/graph_interact":670,"./constants":685,"./projections":693,"./set_scale":694,"./zoom":695,"./zoom_reset":696,d3:95,topojson:491}],687:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;nn^d>n&&r<(f-u)*(n-c)/(d-c)+u&&(i=!i)}return i}function o(t){return t?t/Math.sin(t):1}function s(t){return t>1?I:t<-1?-I:Math.asin(t)}function l(t){return t>1?0:t<-1?C:Math.acos(t)}function u(t,e){var r=(2+I)*Math.sin(e);e/=2;for(var n=0,i=1/0;n<10&&Math.abs(i)>L;n++){var a=Math.cos(e);e-=i=(e+Math.sin(e)*(a+2)-r)/(2*a*(1+a))}return[2/Math.sqrt(C*(4+C))*t*(1+Math.cos(e)),2*Math.sqrt(C/(4+C))*Math.sin(e)]}function c(t,e){function r(r,n){var i=F(r/e,n);return i[0]*=t,i}return arguments.length<2&&(e=t),1===e?F:e===1/0?f:(r.invert=function(r,n){var i=F.invert(r/t,n);return i[0]*=e,i},r)}function h(){var t=2,e=O(c),r=e(t);return r.coefficient=function(r){return arguments.length?e(t=+r):t},r}function f(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function d(t,e){return[3*t/(2*C)*Math.sqrt(C*C/3-e*e),e]}function p(t,e){return[t,1.25*Math.log(Math.tan(C/4+.4*e))]}function g(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)>L&&--i>0);return e/2}}function m(t,e,r){function n(r,n){return[t*r*Math.cos(n=i(n)),e*Math.sin(n)]}var i=g(r);return n.invert=function(n,i){var a=s(i/e);return[n/(t*Math.cos(a)),s((2*a+Math.sin(2*a))/r)]},n}function v(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(-.013791+n*(.003971*r-.001529*n))),e*(1.007226+r*(.015085+n*(-.044475+.028874*r-.005916*n)))]}function y(t,e){var r,n=Math.min(18,36*Math.abs(e)/C),i=Math.floor(n),a=n-i,o=(r=N[i])[0],s=r[1],l=(r=N[++i])[0],u=r[1],c=(r=N[Math.min(19,++i)])[0],h=r[1];return[t*(l+a*(c-o)/2+a*a*(c-2*l+o)/2),(e>0?I:-I)*(u+a*(h-s)/2+a*a*(h-2*u+s)/2)]}function x(t,e){return[t*Math.cos(e),e]}function b(t,e){var r=Math.cos(e),n=o(l(r*Math.cos(t/=2)));return[2*r*Math.sin(t)*n,Math.sin(e)*n]}function _(t,e){var r=b(t,e);return[(r[0]+t/I)/2,(r[1]+e)/2]}t.geo.project=function(t,e){var n=e.stream;if(!n)throw new Error("not yet supported");return(t&&w.hasOwnProperty(t.type)?w[t.type]:r)(t,n)};var w={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,r)})}}},M=[],A=[],k={point:function(t,e){M.push([t,e])},result:function(){var t=M.length?M.length<2?{type:"Point",coordinates:M[0]}:{type:"MultiPoint",coordinates:M}:null;return M=[],t}},T={lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){M.length&&(A.push(M),M=[])},result:function(){var t=A.length?A.length<2?{type:"LineString",coordinates:A[0]}:{type:"MultiLineString",coordinates:A}:null;return A=[],t}},E={polygonStart:n,lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){var t=M.length;if(t){do M.push(M[0].slice());while(++t<4);A.push(M),M=[]}},polygonEnd:n,result:function(){if(!A.length)return null;var t=[],e=[];return A.forEach(function(r){i(r)?t.push([r]):e.push(r)}),e.forEach(function(e){var r=e[0];t.some(function(t){if(a(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}},S={Point:k,MultiPoint:k,LineString:T,MultiLineString:T,Polygon:E,MultiPolygon:E,Sphere:E},L=1e-6,z=L*L,C=Math.PI,I=C/2,P=(Math.sqrt(C),C/180),D=180/C,R=t.geo.projection,O=t.geo.projectionMutator;t.geo.interrupt=function(e){function r(t,r){for(var n=r<0?-1:1,i=l[+(r<0)],a=0,o=i.length-1;ai[a][2][0];++a);var s=e(t-i[a][1][0],r);return s[0]+=e(i[a][1][0],n*r>n*i[a][0][1]?i[a][0][1]:r)[0],s}function n(){s=l.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]]})})}function i(){for(var e=1e-6,r=[],n=0,i=l[0].length;n=0;--n){var o=l[1][n],s=180*o[0][0]/C,u=180*o[0][1]/C,c=180*o[1][1]/C,h=180*o[2][0]/C,f=180*o[2][1]/C;r.push(a([[h-e,f-e],[h-e,c+e],[s+e,c+e],[s+e,u-e]],30))}return{type:"Polygon",coordinates:[t.merge(r)]}}function a(t,e){for(var r,n,i,a=-1,o=t.length,s=t[0],l=[];++aL&&--i>0);return[t/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]},(t.geo.naturalEarth=function(){return R(v)}).raw=v;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}),y.invert=function(t,e){var r=e/I,n=90*r,i=Math.min(18,Math.abs(n/5)),a=Math.max(0,Math.floor(i));do{var o=N[a][1],s=N[a+1][1],l=N[Math.min(19,a+2)][1],u=l-o,c=l-2*s+o,h=2*(Math.abs(r)-s)/u,f=c/u,d=h*(1-f*h*(1-2*f*h));if(d>=0||1===a){n=(e>=0?5:-5)*(d+i);var p,g=50;do i=Math.min(18,Math.abs(n)/5),a=Math.floor(i),d=i-a,o=N[a][1],s=N[a+1][1],l=N[Math.min(19,a+2)][1],n-=(p=(e>=0?I:-I)*(s+d*(l-o)/2+d*d*(l-2*s+o)/2)-e)*D;while(Math.abs(p)>z&&--g>0);break}}while(--a>=0);var m=N[a][0],v=N[a+1][0],y=N[Math.min(19,a+2)][0];return[t/(v+d*(y-m)/2+d*d*(y-2*v+m)/2),n*P]},(t.geo.robinson=function(){return R(y)}).raw=y,x.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return R(x)}).raw=x,b.invert=function(t,e){if(!(t*t+4*e*e>C*C+L)){var r=t,n=e,i=25;do{var a,o=Math.sin(r),s=Math.sin(r/2),u=Math.cos(r/2),c=Math.sin(n),h=Math.cos(n),f=Math.sin(2*n),d=c*c,p=h*h,g=s*s,m=1-p*u*u,v=m?l(h*u)*Math.sqrt(a=1/m):a=0,y=2*v*h*s-t,x=v*c-e,b=a*(p*g+v*h*u*d),_=a*(.5*o*f-2*v*c*s),w=.25*a*(f*s-v*c*p*o),M=a*(d*u+v*g*h),A=_*w-M*b;if(!A)break;var k=(x*_-y*M)/A,T=(y*w-x*b)/A;r-=k,n-=T}while((Math.abs(k)>L||Math.abs(T)>L)&&--i>0);return[r,n]}},(t.geo.aitoff=function(){return R(b)}).raw=b,_.invert=function(t,e){var r=t,n=e,i=25;do{var a,o=Math.cos(n),s=Math.sin(n),u=Math.sin(2*n),c=s*s,h=o*o,f=Math.sin(r),d=Math.cos(r/2),p=Math.sin(r/2),g=p*p,m=1-h*d*d,v=m?l(o*d)*Math.sqrt(a=1/m):a=0,y=.5*(2*v*o*p+r/I)-t,x=.5*(v*s+n)-e,b=.5*a*(h*g+v*o*d*c)+.5/I,_=a*(f*u/4-v*s*p),w=.125*a*(u*p-v*s*h*f),M=.5*a*(c*d+v*g*o)+.5,A=_*w-M*b,k=(x*_-y*M)/A,T=(y*w-x*b)/A;r-=k,n-=T}while((Math.abs(k)>L||Math.abs(T)>L)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return R(_)}).raw=_}e.exports=n},{}],694:[function(t,e,r){"use strict";function n(t,e){var r=t.projection,n=t.lonaxis,o=t.lataxis,l=t.domain,u=t.framewidth||0,c=e.w*(l.x[1]-l.x[0]),h=e.h*(l.y[1]-l.y[0]),f=n.range[0]+s,d=n.range[1]-s,p=o.range[0]+s,g=o.range[1]-s,m=n._fullRange[0]+s,v=n._fullRange[1]-s,y=o._fullRange[0]+s,x=o._fullRange[1]-s;r._translate0=[e.l+c/2,e.t+h/2];var b=d-f,_=g-p,w=[f+b/2,p+_/2],M=r._rotate;r._center=[w[0]+M[0],w[1]+M[1]];var A=function(e){function n(t){return Math.min(_*c/(t[1][0]-t[0][0]),_*h/(t[1][1]-t[0][1]))}var o,s,l,b,_=e.scale(),w=r._translate0,M=i(f,p,d,g),A=i(m,y,v,x);l=a(e,M),o=n(l),b=a(e,A),r._fullScale=n(b),e.scale(o),l=a(e,M),s=[w[0]-l[0][0]+u,w[1]-l[0][1]+u],r._translate=s,e.translate(s),l=a(e,M),t._isAlbersUsa||e.clipExtent(l),o=r.scale*o,r._scale=o,t._width=Math.round(l[1][0])+u,t._height=Math.round(l[1][1])+u,t._marginX=(c-Math.round(l[1][0]))/2,t._marginY=(h-Math.round(l[1][1]))/2};return A}function i(t,e,r,n){var i=(r-t)/4;return{type:"Polygon",coordinates:[[[t,e],[t,n],[t+i,n],[t+2*i,n],[t+3*i,n],[r,n],[r,e],[r-i,e],[r-2*i,e],[r-3*i,e],[t,e]]]}}function a(t,e){return o.geo.path().projection(t).bounds(e)}var o=t("d3"),s=t("./constants").clipPad;e.exports=n},{"./constants":685,d3:95}],695:[function(t,e,r){"use strict";function n(t,e){var r;return(r=e._isScoped?a:e._clipAngle?s:o)(t,e.projection)}function i(t,e){var r=e._fullScale;return _.behavior.zoom().translate(t.translate()).scale(t.scale()).scaleExtent([.5*r,100*r])}function a(t,e){function r(){_.select(this).style(A)}function n(){o.scale(_.event.scale).translate(_.event.translate),t.render()}function a(){_.select(this).style(k)}var o=t.projection,s=i(o,e);return s.on("zoomstart",r).on("zoom",n).on("zoomend",a),s}function o(t,e){function r(t){return m.invert(t)}function n(t){var e=m(r(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function a(){_.select(this).style(A),l=_.mouse(this),u=m.rotate(),c=m.translate(),h=u,f=r(l)}function o(){return d=_.mouse(this),n(l)?(v.scale(m.scale()),void v.translate(m.translate())):(m.scale(_.event.scale),m.translate([c[0],_.event.translate[1]]),f?r(d)&&(g=r(d),p=[h[0]+(g[0]-f[0]),u[1],u[2]],m.rotate(p),h=p):(l=d,f=r(l)),void t.render())}function s(){_.select(this).style(k)}var l,u,c,h,f,d,p,g,m=t.projection,v=i(m,e),y=2;return v.on("zoomstart",a).on("zoom",o).on("zoomend",s),v}function s(t,e){function r(t){v++||t({type:"zoomstart"})}function n(t){t({type:"zoom"})}function a(t){--v||t({type:"zoomend"})}var o,s=t.projection,d={r:s.rotate(),k:s.scale()},p=i(s,e),g=b(p,"zoomstart","zoom","zoomend"),v=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(A);var t=_.mouse(this),e=s.rotate(),i=e,a=s.translate(),v=u(e);o=l(s,t),y.call(p,"zoom",function(){var r=_.mouse(this);if(s.scale(d.k=_.event.scale),o){if(l(s,r)){s.rotate(e).translate(a);var u=l(s,r),p=h(o,u),y=m(c(v,p)),x=d.r=f(y,o,i);isFinite(x[0])&&isFinite(x[1])&&isFinite(x[2])||(x=i),s.rotate(x),i=x}}else t=r,o=l(s,t);n(g.of(this,arguments))}),r(g.of(this,arguments))}).on("zoomend",function(){_.select(this).style(k),y.call(p,"zoom",null),a(g.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,g,"on")}function l(t,e){var r=t.invert(e);return r&&isFinite(r[0])&&isFinite(r[1])&&v(r)}function u(t){var e=.5*t[0]*w,r=.5*t[1]*w,n=.5*t[2]*w,i=Math.sin(e),a=Math.cos(e),o=Math.sin(r),s=Math.cos(r),l=Math.sin(n),u=Math.cos(n);return[a*s*u+i*o*l,i*s*u-a*o*l,a*o*u+i*s*l,a*s*l-i*o*u]}function c(t,e){var r=t[0],n=t[1],i=t[2],a=t[3],o=e[0],s=e[1],l=e[2],u=e[3];return[r*o-n*s-i*l-a*u,r*s+n*o+i*u-a*l,r*l-n*u+i*o+a*s,r*u+n*l-i*s+a*o]}function h(t,e){if(t&&e){var r=x(t,e),n=Math.sqrt(y(r,r)),i=.5*Math.acos(Math.max(-1,Math.min(1,y(t,e)))),a=Math.sin(i)/n;return n&&[Math.cos(i),r[2]*a,-r[1]*a,r[0]*a]}}function f(t,e,r){var n=g(e,2,t[0]);n=g(n,1,t[1]),n=g(n,0,t[2]-r[2]);var i,a,o=e[0],s=e[1],l=e[2],u=n[0],c=n[1],h=n[2],f=Math.atan2(s,o)*M,p=Math.sqrt(o*o+s*s);Math.abs(c)>p?(a=(c>0?90:-90)-f,i=0):(a=Math.asin(c/p)*M-f,i=Math.sqrt(p*p-c*c));var m=180-a-2*f,v=(Math.atan2(h,u)-Math.atan2(l,i))*M,y=(Math.atan2(h,u)-Math.atan2(l,-i))*M,x=d(r[0],r[1],a,v),b=d(r[0],r[1],m,y);return x<=b?[a,v,r[2]]:[m,y,r[2]]}function d(t,e,r,n){var i=p(r-t),a=p(n-e);return Math.sqrt(i*i+a*a)}function p(t){return(t%360+540)%360-180}function g(t,e,r){var n=r*w,i=t.slice(),a=0===e?1:0,o=2===e?1:2,s=Math.cos(n),l=Math.sin(n);return i[a]=t[a]*s-t[o]*l,i[o]=t[o]*s+t[a]*l,i}function m(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*M,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*M,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*M]}function v(t){var e=t[0]*w,r=t[1]*w,n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function y(t,e){for(var r=0,n=0,i=t.length;nh[d+2]&&(h[d]=-1,h[d+2]=1),f=this[v[d]],f._length=o.viewBox[d+2]-o.viewBox[d],s.doAutoRange(f);o.ticks=this.computeTickMarks();var y=this.xaxis.range,x=this.yaxis.range;o.dataBox=[y[0],x[0],y[1],x[1]],o.merge(r),n.update(o),this.glplot.draw()},y.updateTraces=function(t,e){var r,n,i,a=Object.keys(this.traces);this.fullData=t;t:for(r=0;rMath.abs(e))n.rotate(o,0,0,-t*r*Math.PI*f.rotateSpeed/window.innerWidth);else{var s=-f.zoomSpeed*a*e/window.innerHeight*(o-n.lastT())/100;n.pan(o,0,0,u*(Math.exp(s)-1))}},!0),f}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":27,"mouse-change":413,"mouse-wheel":415,"right-now":459}],702:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<3;++r){var n=s[r];e[n]._gd=t}}var i=t("./scene"),a=t("../plots"),o=t("../../constants/xmlns_namespaces"),s=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,o=a.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var s=0;sf[1][o]?d[o]=1:f[1][o]===f[0][o]?d[o]=1:d[o]=1/(f[1][o]-f[0][o]);for(this.dataScale=d,a=0;ag[1][a])g[0][a]=-1,g[1][a]=1;else{var b=g[1][a]-g[0][a];g[0][a]-=b/32,g[1][a]+=b/32}}else{var w=c[T[a]].range;g[0][a]=w[0],g[1][a]=w[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]*d[a],this.glplot.bounds[1][a]=g[1][a]*d[a]}var M=[1,1,1];for(a=0;a<3;++a){l=c[T[a]],u=l.type;var A=y[u];M[a]=Math.pow(A.acc,1/A.count)/d[a]}var k,E=4;if("auto"===c.aspectmode)k=Math.max.apply(null,M)/Math.min.apply(null,M)<=E?M:[1,1,1];else if("cube"===c.aspectmode)k=[1,1,1];else if("data"===c.aspectmode)k=M;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types"); -var S=c.aspectratio;k=[S.x,S.y,S.z]}c.aspectratio.x=h.aspectratio.x=k[0],c.aspectratio.y=h.aspectratio.y=k[1],c.aspectratio.z=h.aspectratio.z=k[2],this.glplot.aspect=k;var L=c.domain||null,z=e._size||null;if(L&&z){var C=this.container.style;C.position="absolute",C.left=z.l+L.x[0]*z.w+"px",C.top=z.t+(1-L.y[1])*z.h+"px",C.width=z.w*(L.x[1]-L.x[0])+"px",C.height=z.h*(L.y[1]-L.y[0])+"px"}this.glplot.redraw()}},k.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},k.setCameraToDefault=function(){this.setCamera({eye:{x:1.25,y:1.25,z:1.25},center:{x:0,y:0,z:0},up:{x:0,y:0,z:1}})},k.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},k.setCamera=function(t){var e={};e[this.id]=t,this.glplot.camera.lookAt.apply(this,l(t)),this.graphDiv.emit("plotly_relayout",e)},k.saveCamera=function(t){function e(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]]}var r=this.getCamera(),n=p.nestedProperty(t,this.id+".camera"),i=n.get(),a=!1;if(void 0===i)a=!0;else for(var o=0;o<3;o++)for(var s=0;s<3;s++)if(!e(r,i,o,s)){a=!0;break}return a&&n.set(r),a},k.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},k.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(c),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var a=0,o=n-1;a0}function a(t){var e={},r={};switch(t.type){case"circle":s.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":s.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":s.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var n=t.symbol,i=l(n.textposition,n.iconsize);s.extendFlat(e,{"icon-image":n.icon+"-15","icon-size":n.iconsize/10,"text-field":n.text,"text-size":n.textfont.size,"text-anchor":i.anchor,"text-offset":i.offset}),s.extendFlat(r,{"icon-color":t.color,"text-color":n.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:r}}function o(t){var e,r=t.sourcetype,n=t.source,i={type:r},a="string"==typeof n;return"geojson"===r?e="data":"vector"===r&&(e=a?"url":"tiles"),i[e]=n,i}var s=t("../../lib"),l=t("./convert_text_opts"),u=n.prototype;u.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)&&this.updateLayer(t):(this.updateSource(t),this.updateLayer(t)),this.updateStyle(t),this.visible=i(t)},u.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},u.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},u.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,i(t)){var r=o(t);e.addSource(this.idSource,r)}},u.updateLayer=function(t){var e=this.map;if(e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,i(t)){e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type},t.below);var r={visibility:"visible"};this.mapbox.setOptions(this.idLayer,"setLayoutProperty",r)}},u.updateStyle=function(t){var e=a(t);i(t)&&(this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint))},u.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)},e.exports=function(t,e,r){var i=new n(t,e);return i.update(r),i}},{"../../lib":632,"./convert_text_opts":716}],719:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color").defaultLine,a=t("../font_attributes"),o=t("../../traces/scatter/attributes").textposition;e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},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:!0,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:n.extendDeep({},a,{family:{dflt:"Open Sans Regular, Arial Unicode MS Regular"}}),textposition:n.extendFlat({},o,{arrayOk:!1})}}}},{"../../components/color":533,"../../lib":632,"../../traces/scatter/attributes":844,"../font_attributes":683}],720:[function(t,e,r){"use strict";function n(t,e,r){r("accesstoken"),r("style"),r("center.lon"),r("center.lat"),r("zoom"),r("bearing"),r("pitch"),i(t,e),e._input=t}function i(t,e){function r(t,e){return a.coerce(n,i,s.layers,t,e)}for(var n,i,o=t.layers||[],l=e.layers=[],u=0;u=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"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(r._initialAutoSizeIsDone){var u=r.width,h=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=h)}else{p.supplyLayoutGlobalDefaults(a,n);var f=!a.width||!a.height,d=n.autosize,g=t._context&&t._context.autosizable,m=f&&(d||g);m?p.plotAutoSize(t,a,n):f&&p.sanitizeMargins(t),!d&&f&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,n),n._has=p._hasPlotType.bind(n);var v=n._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),h=c.left+c.right,d=c.bottom+c.top,g=1-2*o,m=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(m.width-h)),i=Math.round(g*(m.height-d))}else{var v=l?window.getComputedStyle(t):{};n=parseFloat(v.width)||r.width,i=parseFloat(v.height)||r.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-i)>1;(_||b)&&(b&&(r.width=n),_&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r){var n,i;c.Axes.supplyLayoutDefaults(t,e,r);var a=e._basePlotModules;for(n=0;n.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,h=r.size,f=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(h)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(h*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(h-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var m=l[t].t.val,v=l[t].t.size;if(m>f){var y=(d*m+(v-e.height)*f)/(m-f),x=(v*(1-f)+(d-e.height)*(1-m))/(m-f);y>=0&&x>=0&&y+x>s+o&&(s=y,o=x)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){ -if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):t&&t.getTime?f.ms2DateTime(t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)},p.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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,L=S?h.angularAxis.domain:n.extent(A),z=Math.abs(A[1]-A[0]);T&&!k&&(z=0);var C=L.slice();E&&k&&(C[1]+=z);var I=h.angularAxis.ticksCount||4;I>8&&(I=I/(I/8)+I%8),h.angularAxis.ticksStep&&(I=(C[1]-C[0])/I);var P=h.angularAxis.ticksStep||(C[1]-C[0])/(I*(h.minorTicks+1));M&&(P=Math.max(Math.round(P),1)),C[2]||(C[2]=P);var D=n.range.apply(this,C);if(D=D.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]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?z:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var R="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",O=(new DOMParser).parseFromString(R,"application/xml"),F=this.appendChild(this.ownerDocument.importNode(O.documentElement,!0));e=n.select(F)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var j,N=e.select(".chart-group"),B={fill:"none",stroke:h.tickColor},U={"font-size":h.font.size,"font-family":h.font.family,fill:h.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+h.font.outlineColor}).join(",")};if(h.showLegend){j=e.select(".legend-group").attr({transform:"translate("+[x,h.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:j,elements:V,reverseOrder:h.legend.reverseOrder})})();var q=j.node().getBBox();x=Math.min(h.width-q.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,x=Math.max(10,x),_=[h.margin.left+x,h.margin.top+x],i.range([0,x]),c.layout.radialAxis.domain=i.domain(),j.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else j=e.select(".legend-group").style({display:"none"});e.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),N.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(h.width-(h.margin.left+h.margin.right+2*x+(q?q.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*x))/2];if(H[0]=Math.max(0,H[0]),H[1]=Math.max(0,H[1]),e.select(".outer-group").attr("transform","translate("+H+")"),h.title){var G=e.select("g.title-group text").style(U).text(h.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-x-20})}var Y=e.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(i.ticks(5));W.enter().append("circle").attr({class:"grid-circle"}).style(B),W.attr("r",i),W.exit().remove()}Y.select("circle.outside-circle").attr({r:x}).style(B);var Z=e.select("circle.background-circle").attr({r:x}).style({fill:h.backgroundColor,stroke:h.stroke});if(h.radialAxis.visible){var Q=n.svg.axis().scale(i).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+h.radialAxis.orientation+")"}),Y.selectAll(".domain").style(B),Y.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===h.radialAxis.tickOrientation?"rotate("+-h.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var K=e.select(".angular.axis-group").selectAll("g.angular-tick").data(D),$=K.enter().append("g").classed("angular-tick",!0);K.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),K.exit().remove(),$.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(h.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(h.minorTicks+1)==0)}).style(B),$.selectAll(".minor").style({stroke:h.minorTickColor}),K.select("line.grid-line").attr({x1:h.tickLength?x-h.tickLength:0,x2:x}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(U);var J=K.select("text.axis-text").attr({x:x+h.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=x+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?"":M?M[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(U);h.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(N.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[x+tt,h.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=h.orientation,r.direction=h.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!k){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});N.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;ot=s.invert(n);var i=o.util.convertToCartesian(x+12,r+180);ct.text(o.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});N.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=i.invert(o.util.getMousePos(Z).radius);var n=o.util.convertToCartesian(r,h.radialAxis.orientation);ht.text(o.util.round(st)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ft.hide(),ct.hide(),ht.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var i=n.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(u.t=M[t[0]]);var c="t: "+u.t+", r: "+u.r,h=this.getBoundingClientRect(),f=e.node().getBoundingClientRect(),d=[h.left+h.width/2-H[0]-f.left,h.top+h.height/2-H[1]-f.top];ft.config({color:s}).text(c),ft.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&ft.show())}).on("mouseout.tooltip",function(t,e){ft.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")})})}),f}var e,r,i,s,l={data:[],layout:{}},u={},c={},h=n.dispatch("hover"),f={};return f.render=function(e){return t(e),this},f.config=function(t){if(!arguments.length)return l;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},f.getLiveConfig=function(){return c},f.getinputConfig=function(){return u},f.radialScale=function(t){return i},f.angularScale=function(t){return s},f.svg=function(){return e},n.rebind(f,h,"on"),f},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,i=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return i},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("undefined"==typeof 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 r===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=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 s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:f(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return m.stroke(r,i,a)},"stroke-width":function(t,e){return m["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](r,i,a)},opacity:function(t,e){return m.opacity(r,i,a)},display:function(t,e){return m.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});h.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var m={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},v=n.select(this).selectAll("g.layer").data(l);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(m).each(h[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],i=n.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=n.merge(i);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,h=c?r.height:u*o.length,f=s.classed("legend-group",!0),d=f.selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:h+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(o.length),m=n.scale[c?"linear":"ordinal"]().domain(g).range(l),v=n.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,h]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(c){var x=d.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}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var b=d.select(".legend-marks").selectAll("path.legend-mark").data(o);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[u/2,v(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=n.svg.axis().scale(v).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var n=t.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",h=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(h);var f=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=d.width+2*f+l,m=d.height+2*f;return r.attr({d:"M"+[[l,-m/2],[l,-m/4],[i.hasTick?0:l,0],[l,m/4],[l,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-m/2+2*f]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=i.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]]; -if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],h={};n.entries(s.margin).forEach(function(t,e){h[c[u.indexOf(t.key)]]=t.value}),s.margin=h}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../lib":632,d3:95}],728:[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,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(h=i),n.select(n.select(h).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(r),a.config(c).render(h),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,i,a,c,h,f=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){f.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){f.undo()},e.redo=function(){f.redo()},e},u.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":533,"../../lib":632,"./micropolar":727,"./undo_manager":729,d3:95}],729:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n=o&&(d.min=0,p.min=0,g.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var i=t("../../../components/color"),a=t("../../subplot_defaults"),o=t("./layout_attributes"),s=t("./axis_defaults"),l=["aaxis","baxis","caxis"];e.exports=function(t,e,r){a(t,e,r,{type:"ternary",attributes:o,handleDefaults:n,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":533,"../../subplot_defaults":730,"./axis_defaults":734,"./layout_attributes":736}],736:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:i,baxis:i,caxis:i}},{"../../../components/color/attributes":532,"./axis_attributes":733}],737:[function(t,e,r){"use strict";function n(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework()}function i(t){a.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var a=t("d3"),o=t("tinycolor2"),s=t("../../plotly"),l=t("../../lib"),u=t("../../components/color"),c=t("../../components/drawing"),h=t("../cartesian/set_convert"),f=t("../../lib/extend").extendFlat,d=t("../cartesian/axes"),p=t("../../lib/filter_visible"),g=t("../../components/dragelement"),m=t("../../components/titles"),v=t("../cartesian/select"),y=t("../cartesian/constants"),x=t("../cartesian/graph_interact");e.exports=n;var b=n.prototype;b.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={}},b.plot=function(t,e){var r,n=this,i=e[n.id],a=e._size;l.getPlotDiv(n.plotContainer.node())!==n.graphDiv&&(n.init(n.graphDiv._fullLayout),n.makeFramework()),n.adjustLayout(i,a);var o=n.traceHash,s={};for(r=0;r_*y?(a=y,i=a*_):(i=v,a=i/_),o=g*i/v,s=m*a/y,r=e.l+e.w*d-i/2,n=e.t+e.h*(1-p)-a/2,l.x0=r,l.y0=n,l.w=i,l.h=a,l.sum=x,l.xaxis={type:"linear",range:[b+2*M-x,x-b-2*w],domain:[d-o/2,d+o/2],_id:"x",_gd:l.graphDiv},h(l.xaxis),l.xaxis.setScale(),l.yaxis={type:"linear",range:[b,x-w-M],domain:[p-s/2,p+s/2],_id:"y",_gd:l.graphDiv},h(l.yaxis),l.yaxis.setScale();var A=l.yaxis.domain[0],k=l.aaxis=f({},t.aaxis,{range:[b,x-w-M],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[A,A+s*_],_axislayer:l.layers.aaxis,_gridlayer:l.layers.agrid,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l"+a+",-"+i/2});h(k);var T=l.baxis=f({},t.baxis,{range:[x-b-M,w],side:"bottom",_counterangle:30,domain:l.xaxis.domain,_axislayer:l.layers.baxis,_gridlayer:l.layers.bgrid,_counteraxis:l.aaxis,_pos:0,_gd:l.graphDiv,_id:"x",_length:i,_gridpath:"M0,0l-"+i/2+",-"+a});h(T),k._counteraxis=T;var E=l.caxis=f({},t.caxis,{range:[x-b-w,M],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[A,A+s*_],_axislayer:l.layers.caxis,_gridlayer:l.layers.cgrid,_counteraxis:l.baxis,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l-"+a+","+i/2});h(E);var S="M"+r+","+(n+a)+"h"+i+"l-"+i/2+",-"+a+"Z";l.clipDef.select("path").attr("d",S),l.layers.plotbg.select("path").attr("d",S);var L="translate("+r+","+n+")";l.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",L);var z="translate("+r+","+(n+a)+")";l.layers.baxis.attr("transform",z),l.layers.bgrid.attr("transform",z);var C="translate("+(r+i/2)+","+n+")rotate(30)";l.layers.aaxis.attr("transform",C),l.layers.agrid.attr("transform",C);var I="translate("+(r+i/2)+","+n+")rotate(-30)";l.layers.caxis.attr("transform",I),l.layers.cgrid.attr("transform",I),l.drawAxes(!0),l.plotContainer.selectAll(".crisp").classed("crisp",!1);var P=l.layers.axlines;P.select(".aline").attr("d",k.showline?"M"+r+","+(n+a)+"l"+i/2+",-"+a:"M0,0").call(u.stroke,k.linecolor||"#000").style("stroke-width",(k.linewidth||0)+"px"),P.select(".bline").attr("d",T.showline?"M"+r+","+(n+a)+"h"+i:"M0,0").call(u.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),P.select(".cline").attr("d",E.showline?"M"+(r+i/2)+","+n+"l"+i/2+","+a:"M0,0").call(u.stroke,E.linecolor||"#000").style("stroke-width",(E.linewidth||0)+"px")},b.drawAxes=function(t){var e=this,r=e.graphDiv,n=e.id.substr(7)+"title",i=e.aaxis,a=e.baxis,o=e.caxis;if(d.doTicks(r,i,!0),d.doTicks(r,a,!0),d.doTicks(r,o,!0),t){var s=Math.max(i.showticklabels?i.tickfont.size/2:0,(o.showticklabels?.75*o.tickfont.size:0)+("outside"===o.ticks?.87*o.ticklen:0));m.draw(r,"a"+n,{propContainer:i,propName:e.id+".aaxis.title",dfltName:"Component A",attributes:{x:e.x0+e.w/2,y:e.y0-i.titlefont.size/3-s,"text-anchor":"middle"}});var l=(a.showticklabels?a.tickfont.size:0)+("outside"===a.ticks?a.ticklen:0)+3;m.draw(r,"b"+n,{propContainer:a,propName:e.id+".baxis.title",dfltName:"Component B",attributes:{x:e.x0-l,y:e.y0+e.h+.83*a.titlefont.size+l,"text-anchor":"middle"}}),m.draw(r,"c"+n,{propContainer:o,propName:e.id+".caxis.title",dfltName:"Component C",attributes:{x:e.x0+e.w+l,y:e.y0+e.h+.83*o.titlefont.size+l,"text-anchor":"middle"}})}};var w=y.MINZOOM/2+.87,M="m-0.87,.5h"+w+"v3h-"+(w+5.2)+"l"+(w/2+2.6)+",-"+(.87*w+4.5)+"l2.6,1.5l-"+w/2+","+.87*w+"Z",A="m0.87,.5h-"+w+"v3h"+(w+5.2)+"l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-2.6,1.5l"+w/2+","+.87*w+"Z",k="m0,1l"+w/2+","+.87*w+"l2.6,-1.5l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-"+(w/2+2.6)+","+(.87*w+4.5)+"l2.6,1.5l"+w/2+",-"+.87*w+"Z",T="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",E=!0;b.initInteractions=function(){function t(t,e,r){var n=F.getBoundingClientRect();b=e-n.left,w=r-n.top,S={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},z=S,L=O.aaxis.range[1]-S.a,C=o(O.graphDiv._fullLayout[O.id].bgcolor).getLuminance(),I="M0,"+O.h+"L"+O.w/2+", 0L"+O.w+","+O.h+"Z",P=!1,D=N.append("path").attr("class","zoombox").style({fill:C>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",I),R=N.append("path").attr("class","zoombox-corners").style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),p()}function e(t,e){return 1-e/O.h}function r(t,e){return 1-(t+(O.h-e)/Math.sqrt(3))/O.w}function n(t,e){return(t-(O.h-e)/Math.sqrt(3))/O.w}function a(t,i){var a=b+t,o=w+i,s=Math.max(0,Math.min(1,e(b,w),e(a,o))),l=Math.max(0,Math.min(1,r(b,w),r(a,o))),u=Math.max(0,Math.min(1,n(b,w),n(a,o))),c=(s/2+u)*O.w,h=(1-s/2-l)*O.w,f=(c+h)/2,d=h-c,p=(1-s)*O.h,g=p-d/_;d.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),R.transition().style("opacity",1).duration(200),P=!0)}function c(t,e){if(z===S)return 2===e&&m(),i(j);i(j);var r={};r[O.id+".aaxis.min"]=z.a,r[O.id+".baxis.min"]=z.b,r[O.id+".caxis.min"]=z.c,s.relayout(j,r),E&&j.data&&j._context.showTips&&(l.notifier("Double-click to
zoom back out","long"),E=!1)}function h(){S={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},z=S}function f(t,e){var r=t/O.xaxis._m,n=e/O.yaxis._m;z={a:S.a-n,b:S.b+(r+n)/2,c:S.c-(r-n)/2};var i=[z.a,z.b,z.c].sort(),a={a:i.indexOf(z.a),b:i.indexOf(z.b),c:i.indexOf(z.c)};i[0]<0&&(i[1]+i[0]/2<0?(i[2]+=i[0]+i[1],i[0]=i[1]=0):(i[2]+=i[0]/2,i[1]+=i[0]/2,i[0]=0),z={a:i[a.a],b:i[a.b],c:i[a.c]},e=(S.a-z.a)*O.yaxis._m,t=(S.c-z.c-S.b+z.b)*O.xaxis._m);var o="translate("+(O.x0+t)+","+(O.y0+e)+")";O.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",o),O.aaxis.range=[z.a,O.sum-z.b-z.c],O.baxis.range=[O.sum-z.a-z.c,z.b],O.caxis.range=[O.sum-z.a-z.b,z.c],O.drawAxes(!1),O.plotContainer.selectAll(".crisp").classed("crisp",!1)}function d(t,e){if(t){var r={};r[O.id+".aaxis.min"]=z.a,r[O.id+".baxis.min"]=z.b,r[O.id+".caxis.min"]=z.c,s.relayout(j,r)}else 2===e&&m()}function p(){O.plotContainer.selectAll(".select-outline").remove()}function m(){var t={};t[O.id+".aaxis.min"]=0,t[O.id+".baxis.min"]=0,t[O.id+".caxis.min"]=0,j.emit("plotly_doubleclick",null),s.relayout(j,t)}var b,w,S,L,z,C,I,P,D,R,O=this,F=O.layers.plotbg.select("path").node(),j=O.graphDiv,N=O.layers.zoom,B={element:F,gd:j,plotinfo:{plot:N},doubleclick:m,subplot:O.id,prepFn:function(e,r,n){B.xaxes=[O.xaxis],B.yaxes=[O.yaxis];var i=j._fullLayout.dragmode;e.shiftKey&&(i="pan"===i?"zoom":"pan"),"lasso"===i?B.minDrag=1:B.minDrag=void 0,"zoom"===i?(B.moveFn=a,B.doneFn=c,t(e,r,n)):"pan"===i?(B.moveFn=f,B.doneFn=d,h(),p()):"select"!==i&&"lasso"!==i||v(e,r,n,B,i)}};F.onmousemove=function(t){x.hover(j,t,O.id),j._fullLayout._lasthover=F,j._fullLayout._hoversubplot=O.id},F.onmouseout=function(t){j._dragging||g.unhover(j,t)},F.onclick=function(t){x.click(j,t)},g.init(B)}},{"../../components/color":533,"../../components/dragelement":555,"../../components/drawing":557,"../../components/titles":608,"../../lib":632,"../../lib/extend":625,"../../lib/filter_visible":627,"../../plotly":658,"../cartesian/axes":662,"../cartesian/constants":668,"../cartesian/graph_interact":670,"../cartesian/select":676,"../cartesian/set_convert":677,d3:95,tinycolor2:489}],738:[function(t,e,r){"use strict";function n(t){return"object"==typeof t&&(t=t.type),t}var i=t("./lib"),a=t("./plots/attributes");r.modules={},r.allTypes=[],r.allCategories={},r.subplotsRegistry={},r.transformsRegistry={},r.componentsRegistry={},r.register=function(t,e,n,a){if(r.modules[e])return void i.log("Type "+e+" already registered");for(var o={},s=0;s-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,u=t.layout,c=l([],a),h=l({},u,n(e.tileClass));if(e.width&&(h.width=e.width),e.height&&(h.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){h.annotations=[];var f=Object.keys(h);for(r=0;r=2?a(t):t>e?Math.ceil(t):Math.floor(t)}var m,v,y,x,b=e.p+(d?f[r]:f),_=b+(g?p[r]:p),w=e.b,M=w+e.s;if("h"===s.orientation?(y=c.c2p(b,!0),x=c.c2p(_,!0),m=u.c2p(w,!0),v=u.c2p(M,!0)):(m=u.c2p(b,!0),v=u.c2p(_,!0),y=c.c2p(w,!0),x=c.c2p(M,!0)),!(i(m)&&i(v)&&i(y)&&i(x)&&m!==v&&y!==x))return void n.select(this).remove();var A=(e.mlw+1||s.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,k=n.round(A/2%1,2);if(!t._context.staticPlot){var T=o.opacity(e.mc||s.marker.color),E=T<1||A>.01?a:l;m=E(m,v),v=E(v,m),y=E(y,x),x=E(x,y)}n.select(this).attr("d","M"+m+","+y+"V"+x+"H"+v+"V"+y+"Z")})}),f.call(s.plot,e)}},{"../../components/color":533,"../../components/errorbars":563,"../../lib":632,"./arrays_to_calcdata":747,d3:95,"fast-isnumeric":104}],756:[function(t,e,r){"use strict";function n(t,e,r,n){if(n.length){var s,l,u,c,h,f=t._fullLayout.barmode,d="overlay"===f,p="group"===f;if(d)i(t,e,r,n);else if(p){for(s=[],l=[],u=0;ul+o&&(u=!0,l=y)),v(e.c2l(g))&&(gl+o&&(u=!0,l=g))}}x.expand(e,[s,l],{tozero:!0,padded:u})}function m(t){return t._id.charAt(0)}var v=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var r,i=e.xaxis,a=e.yaxis,o=t._fullData,s=t.calcdata,l=[],u=[];for(r=0;r1||0===s.bargap&&0===s.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,r=e.marker,o=r.line,s=(e._input||{}).marker||{},l=a.tryColorscale(r,s,""),u=a.tryColorscale(r,s,"line.");n.select(this).selectAll("path").each(function(t){var e,a,s=(t.mlw+1||o.width+1)-1,c=n.select(this);e="mc"in t?t.mcc=l(t.mc):Array.isArray(r.color)?i.defaultLine:r.color,c.style("stroke-width",s+"px").call(i.fill,e),s&&(a="mlc"in t?t.mlcc=u(t.mlc):Array.isArray(o.color)?i.defaultLine:o.color,c.call(i.stroke,a))})}),e.call(o.style)}},{"../../components/color":533,"../../components/drawing":557,"../../components/errorbars":563,d3:95}],759:[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")}},{"../../components/color":533,"../../components/colorscale/defaults":543,"../../components/colorscale/has_colorscale":547}],760:[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"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:a({},o.symbol,{arrayOk:!1}),opacity:a({},o.opacity,{arrayOk:!1,dflt:1}),size:a({},o.size,{arrayOk:!1}),color:a({},o.color,{arrayOk:!1}),line:{color:a({},s.color,{arrayOk:!1,dflt:i.defaultLine}),width:a({},s.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:n.fillcolor}},{"../../components/color/attributes":532,"../../lib/extend":625,"../scatter/attributes":844}],761:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(t,e,r,a,o){var s;return r in e?p=a.makeCalcdata(e,r):(s=r+"0"in e?e[r+"0"]:"name"in e&&("category"===a.type||n(e.name)&&["linear","log"].indexOf(a.type)!==-1||i.isDateTime(e.name)&&"date"===a.type)?e.name:t.numboxes,s=a.d2c(s),p=o.map(function(){return s})),p}function o(t,e,r,a,o){var s,l,u,c,h=a.length,f=e.length,d=[],p=[];for(s=0;s=0&&u1,v=r.dPos*(1-f.boxgap)*(1-f.boxgroupgap)/(m?t.numboxes:1),y=m?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-f.boxgap):0,x=v*g.whiskerwidth;return g.visible!==!0||r.emptybox?void a.select(this).remove():("h"===g.orientation?(l=p,h=d):(l=d,h=p),r.bPos=y,r.bdPos=v,n(),a.select(this).selectAll("path.box").data(o.identity).enter().append("path").attr("class","box").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-v,!0),n=l.c2p(t.pos+y+v,!0),i=l.c2p(t.pos+y-x,!0),s=l.c2p(t.pos+y+x,!0),u=h.c2p(t.q1,!0),c=h.c2p(t.q3,!0),f=o.constrain(h.c2p(t.med,!0),Math.min(u,c)+1,Math.max(u,c)-1),d=h.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=h.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?a.select(this).attr("d","M"+f+","+r+"V"+n+"M"+u+","+r+"V"+n+"H"+c+"V"+r+"ZM"+u+","+e+"H"+d+"M"+c+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+d+","+i+"V"+s+"M"+p+","+i+"V"+s)):a.select(this).attr("d","M"+r+","+f+"H"+n+"M"+r+","+u+"H"+n+"V"+c+"H"+r+"ZM"+e+","+u+"V"+d+"M"+e+","+c+"V"+p+(0===g.whiskerwidth?"":"M"+i+","+d+"H"+s+"M"+i+","+p+"H"+s))}),g.boxpoints&&a.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,a,s,l,h,f="all"===g.boxpoints?t.val:t.val.filter(function(e){return et.uf}),d=Math.max((t.max-t.min)/10,t.q3-t.q1),p=1e-9*d,m=d*c,x=[],b=0;if(g.jitter){if(0===d)for(b=1,x=new Array(f.length),e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(s.translatePoints,d,p),void(g.boxmean&&a.select(this).selectAll("path.mean").data(o.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-v,!0),n=l.c2p(t.pos+y+v,!0),i=h.c2p(t.mean,!0),o=h.c2p(t.mean-t.sd,!0),s=h.c2p(t.mean+t.sd,!0);"h"===g.orientation?a.select(this).attr("d","M"+i+","+r+"V"+n+("sd"!==g.boxmean?"":"m0,0L"+o+","+e+"L"+i+","+r+"L"+s+","+e+"Z")):a.select(this).attr("d","M"+r+","+i+"H"+n+("sd"!==g.boxmean?"":"m0,0L"+e+","+o+"L"+r+","+i+"L"+e+","+s+"Z"))})))})}},{"../../components/drawing":557,"../../lib":632,d3:95}],768:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../plots/cartesian/axes"),a=t("../../lib");e.exports=function(t,e){var r,o,s,l,u=t._fullLayout,c=e.xaxis,h=e.yaxis,f=["v","h"];for(o=0;ol&&(e.z=c.slice(0,l)),s("locationmode"),s("text"),s("marker.line.color"),s("marker.line.width"),i(t,e,o,s,{prefix:"",cLetter:"z"}),void s("hoverinfo",1===o._dataLength?"location+z+text":void 0)):void(e.visible=!1)}},{"../../components/colorscale/defaults":543,"../../lib":632,"./attributes":774}],777:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("./calc"),n.plot=t("./plot").plot,n.hoverPoints=function(){},n.moduleType="trace",n.name="choropleth",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","noOpacity"],n.meta={},e.exports=n},{"../../plots/geo":687,"../heatmap/colorbar":791,"./attributes":774,"./calc":775,"./defaults":776,"./plot":778}],778:[function(t,e,r){"use strict";function n(t,e){function r(e){var r=t.mockAxis;return o.tickText(r,r.c2l(e),"hover").text}var n=e.hoverinfo;if("none"===n||"skip"===n)return function(t){delete t.nameLabel,delete t.textLabel};var i="all"===n?g.hoverinfo.flags:n.split("+"),a=i.indexOf("name")!==-1,s=i.indexOf("location")!==-1,l=i.indexOf("z")!==-1,u=i.indexOf("text")!==-1,c=!a&&s;return function(t){var n=[];c?t.nameLabel=t.id:(a&&(t.nameLabel=e.name),s&&n.push(t.id)),l&&n.push(r(t.z)),u&&n.push(t.tx),t.textLabel=n.join("
")}}function i(t){return function(e,r){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:r,location:e.id,z:e.z}]}}}var a=t("d3"),o=t("../../plots/cartesian/axes"),s=t("../../plots/cartesian/graph_interact"),l=t("../../components/color"),u=t("../../components/drawing"),c=t("../../components/colorscale"),h=t("../../lib/topojson_utils").getTopojsonFeatures,f=t("../../lib/geo_location_utils").locationToFeature,d=t("../../lib/array_to_calc_item"),p=t("../../plots/geo/constants"),g=t("./attributes"),m=e.exports={};m.calcGeoJSON=function(t,e){for(var r,n=[],i=t.locations,a=i.length,o=h(t,e),s=(t.marker||{}).line||{},l=0;l0&&(n[0].trace=t),n},m.plot=function(t,e,r){function o(t){return t[0].trace.uid}var l,u=t.framework,c=u.select("g.choroplethlayer"),h=u.select("g.baselayer"),f=u.select("g.baselayeroverchoropleth"),d=p.baseLayersOverChoropleth,g=c.selectAll("g.trace.choropleth").data(e,o);g.enter().append("g").attr("class","trace choropleth"),g.exit().remove(),g.each(function(e){function r(e,r){if(t.showHover){var n=t.projection(e.properties.ct);c(e),s.loneHover({x:n[0],y:n[1],name:e.nameLabel,text:e.textLabel},{container:t.hoverContainer.node()}),f=h(e,r),t.graphDiv.emit("plotly_hover",f)}}function o(e,r){t.graphDiv.emit("plotly_click",h(e,r))}var l=e[0].trace,u=m.calcGeoJSON(l,t.topojson),c=n(t,l),h=i(l),f=null,d=a.select(this).selectAll("path.choroplethlocation").data(u);d.enter().append("path").classed("choroplethlocation",!0).on("mouseover",r).on("click",o).on("mouseout",function(){s.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",f)}).on("mousedown",function(){s.loneUnhover(t.hoverContainer)}).on("mouseup",r),d.exit().remove()}),f.selectAll("*").remove();for(var v=0;vt?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===r||10===r){var n=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;return t>n?5===r?713:1114:5===r?104:208}return 15===r?0:r}function o(t){var e,r,n,i,o,s,l,u,c,h=t[0].z,f=h.length,d=h[0].length,p=2===f||2===d;for(r=0;r20?(s=L[s][(l[0]||l[1])<0?0:1],t.crossings[o]=z[s]):delete t.crossings[o],l=S[s],!l){_.log("Found bad marching index:",s,e,t.level);break}if(d.push(f(t,e,l)),e[0]+=l[0],e[1]+=l[1],c(d[d.length-1],d[d.length-2])&&d.pop(),o=e.join(","),o===a&&l.join(",")===p||r&&(l[0]&&(e[0]<0||e[0]>m-2)||l[1]&&(e[1]<0||e[1]>g-2)))break;s=t.crossings[o]}1e4===i&&_.log("Infinite loop in contour?");var v,y,x,b,w,M,A,k=c(d[0],d[d.length-1]),T=0,E=.2*t.smoothing,C=[],I=0;for(i=1;i=I;i--)if(v=C[i],v=I&&v+C[y]20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:A.indexOf(t)!==-1?i=1:T.indexOf(t)!==-1?n=1:k.indexOf(t)!==-1?i=-1:n=-1,[n,i]}function c(t,e){return Math.abs(t[0]-e[0])<.01&&Math.abs(t[1]-e[1])<.01}function h(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function f(t,e,r){var n=e[0]+Math.max(r[0],0),i=e[1]+Math.max(r[1],0),a=t.z[i][n],o=t.xaxis,s=t.yaxis;if(r[1]){var l=(t.level-a)/(t.z[i][n+1]-a);return[o.c2p((1-l)*t.x[n]+l*t.x[n+1],!0),s.c2p(t.y[i],!0)]}var u=(t.level-a)/(t.z[i+1][n]-a);return[o.c2p(t.x[n],!0),s.c2p((1-u)*t.y[i]+u*t.y[i+1],!0)]}function d(t,e,r){var n=t.plot.select(".maplayer").selectAll("g.contour."+r).data(e);return n.enter().append("g").classed("contour",!0).classed(r,!0),n.exit().remove(),n}function p(t,e,r){var n=t.selectAll("g.contourbg").data([0]);n.enter().append("g").classed("contourbg",!0);var i=n.selectAll("path").data("fill"===r.coloring?[0]:[]);i.enter().append("path"),i.exit().remove(),i.attr("d","M"+e.join("L")+"Z").style("stroke","none")}function g(t,e,r,n){var i=t.selectAll("g.contourfill").data([0]);i.enter().append("g").classed("contourfill",!0);var a=i.selectAll("path").data("fill"===n.coloring?e:[]);a.enter().append("path"),a.exit().remove(),a.each(function(t){var e=m(t,r);e?b.select(this).attr("d",e).style("stroke","none"):b.select(this).remove()})}function m(t,e){function r(t){return Math.abs(t[1]-e[0][1])<.01}function n(t){return Math.abs(t[1]-e[2][1])<.01}function i(t){return Math.abs(t[0]-e[0][0])<.01}function a(t){return Math.abs(t[0]-e[2][0])<.01}for(var o,s,l,u,c,h,f=t.edgepaths.length||t.z[0][0]=0&&(s=m,u=c):Math.abs(o[1]-s[1])<.01?Math.abs(o[1]-m[1])<.01&&(m[0]-o[0])*(s[0]-m[0])>=0&&(s=m,u=c):_.log("endpt to newendpt is not vert. or horz.",o,s,m)}if(o=s,u>=0)break;f+="L"+s}if(u===t.edgepaths.length){_.log("unclosed perimeter path");break}d=u,g=p.indexOf(d)===-1,g&&(d=p[0],f+="Z")}for(d=0;d1;if(p&&!f&&"category"!==a.type){e=e.map(a.d2c);var g=e.length;if(!(g<=i))return h?e.slice(0,i):e.slice(0,i+1);if(h||d)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;ly;n++)o=l(t,e,a(o));return o>y&&h.log("interp2d didn't converge quickly",o),t}function s(t){var e,r,n,i,a,o,s,l,u=[],c={},h=[],f=t[0],d=[],p=[0,0,0],g=v(t);for(r=0;r=0;a--)i=h[a],r=i[0],n=i[1],o=((c[[r-1,n]]||p)[2]+(c[[r+1,n]]||p)[2]+(c[[r,n-1]]||p)[2]+(c[[r,n+1]]||p)[2])/20,o&&(s[i]=[r,n,o],h.splice(a,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,a,o,s,l,u,c,h,f,d,p,g,m=0;for(o=0;op&&(m=Math.max(m,Math.abs(t[i][a]-d)/(g-p))))}return m}var u=t("fast-isnumeric"),c=t("../../registry"),h=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),m=t("./convert_column_xyz"),v=t("./max_row_length");e.exports=function(t,e){function r(t){S=e._input.zsmooth=e.zsmooth=!1,h.notifier("cannot fast-zsmooth: "+t)}var a,l,u,y,x,b,_,w,M=f.getFromId(t,e.xaxis||"x"),A=f.getFromId(t,e.yaxis||"y"),k=c.traceIs(e,"contour"),T=c.traceIs(e,"histogram"),E=c.traceIs(e,"gl2d"),S=k?"best":e.zsmooth;if(M._minDtick=0,A._minDtick=0,T){var L=d(t,e);a=L.x,l=L.x0,u=L.dx,y=L.y,x=L.y0,b=L.dy,_=L.z}else g(e)&&m(e,M,A),a=e.x?M.makeCalcdata(e,"x"):[],y=e.y?A.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,x=e.y0||0,b=e.dy||1,_=n(e),(k||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=o(_,e._emptypoints,e._interpz));if("fast"===S)if("log"===M.type||"log"===A.type)r("log axis found");else if(!T){if(a.length){var z=(a[a.length-1]-a[0])/(a.length-1),C=Math.abs(z/100);for(w=0;wC){r("x scale is not linear");break}}if(y.length&&"fast"===S){var I=(y[y.length-1]-y[0])/(y.length-1),P=Math.abs(I/100);for(w=0;wP){r("y scale is not linear");break}}}var D=v(_),R="scaled"===e.xtype?"":e.x,O=i(e,R,l,u,D,M),F="scaled"===e.ytype?"":e.y,j=i(e,F,x,b,_.length,A);E||(f.expand(M,O),f.expand(A,j));var N={x:O,y:j,z:_};if(p(e,_,"","z"),k&&e.contours&&"heatmap"===e.contours.coloring){var B="contour"===e.type?"heatmap":"histogram2d";N.xfill=i(B,R,l,u,D,M),N.yfill=i(B,F,x,b,_.length,A)}return[N]};var y=.01,x=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":540,"../../lib":632,"../../plots/cartesian/axes":662,"../../registry":738,"../histogram2d/calc":810,"./convert_column_xyz":792,"./has_columns":794,"./max_row_length":797,"fast-isnumeric":104}],791:[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="cb"+r.uid,u=r.zmin,c=r.zmax;if(n(u)||(u=i.aggNums(Math.min,null,r.z)),n(c)||(c=i.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void a.autoMargin(t,l);var h=e[0].t.cb=s(t,l),f=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});h.fillcolor(f).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":536,"../../components/colorscale":548,"../../lib":632,"../../plots/plots":723,"fast-isnumeric":104}],792:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a=t.x.slice(),o=t.y.slice(),s=t.z,l=t.text,u=Math.min(a.length,o.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(u=y[0].length||h<0||h>y.length)return}else{if(n.inbox(e-m[0],e-m[m.length-1])>a||n.inbox(r-v[0],r-v[v.length-1])>a)return;if(s){var w;for(b=[2*m[0]-m[1]],w=1;w0&&a0&&s0;)_=m.c2p(E[k]),k--;for(_0;)A=v.c2p(S[k]),k--;if(A0&&(n=!0);for(var s=0;sa)return r[t]=a,a-r[t]}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]=0&&vO;r--)if(c[r]){F=r;break}for(r=O;r<=F;r++)n(u[r])&&n(c[r])&&R.push({p:u[r],s:c[r],b:0});return R}}},{"../../lib":632,"../../plots/cartesian/axes":662,"./average":802,"./bin_functions":804,"./norm_functions":808,"fast-isnumeric":104}],806:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),a=t("./bin_defaults"),o=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,i){return n.coerce(t,e,l,r,i)}var h=c("x"),f=c("y");c("text");var d=c("orientation",f&&!h?"h":"v"),p=e["v"===d?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===d?"x":"y"];g&&c("histfunc");var m="h"===d?["y"]:["x"];a(t,e,c,m),o(t,e,c,r,u),s(t,e,i.defaultLine,{axis:"y"}),s(t,e,i.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":533,"../../components/errorbars/defaults":562,"../../lib":632,"../bar/style_defaults":759,"./attributes":801,"./bin_defaults":803}],807:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("../bar/layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("../bar/layout_defaults"),n.calc=t("./calc"),n.setPositions=t("../bar/set_positions"),n.plot=t("../bar/plot"),n.style=t("../bar/style"),n.colorbar=t("../scatter/colorbar"),n.hoverPoints=t("../bar/hover"),n.moduleType="trace",n.name="histogram",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":671,"../bar/hover":751,"../bar/layout_attributes":753,"../bar/layout_defaults":754,"../bar/plot":755,"../bar/set_positions":756,"../bar/style":758,"../scatter/colorbar":847,"./attributes":801,"./calc":805,"./defaults":806}],808:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;iv&&p.splice(v,p.length-v),m.length>v&&m.splice(v,m.length-v),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(p,d,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start-=e.xbins.size,e.xbins.end+=e.xbins.size),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(m,g,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start-=e.ybins.size,e.ybins.end+=e.ybins.size),e._input.ybins=e.ybins),h=[];var y,x,b=[],_=[],w="string"==typeof e.xbins.size?[]:e.xbins,M="string"==typeof e.xbins.size?[]:e.ybins,A=0,k=[],T=e.histnorm,E=e.histfunc,S=T.indexOf("density")!==-1,L="max"===E||"min"===E,z=L?null:0,C=a.count,I=o[T],P=!1,D=[],R=[],O="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";O&&"count"!==E&&(P="avg"===E,C=a[E]);var F=e.xbins,j=F.end+(F.start-i.tickIncrement(F.start,F.size))/1e6;for(f=F.start;f=0&&y=0&&x0)s=h(t.alphahull,l);else{var u=["x","y","z"].indexOf(t.delaunayaxis);s=c(l.map(function(t){return[t[(u+1)%3],t[(u+2)%3]]}))}var p={positions:l,cells:s,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:d(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",p.vertexIntensity=t.intensity,p.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolors[0],p.vertexColors=a(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],p.cellColors=a(t.facecolor)):(this.color=t.color,p.meshColor=d(t.color)),this.mesh.update(p)},p.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=s},{"../../lib/str2rgbarray":645,"alpha-shape":32,"convex-hull":84,"delaunay-triangulate":96,"gl-mesh3d":173,tinycolor2:489}],819:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorbar/defaults"),a=t("./attributes");e.exports=function(t,e,r,o){function s(r,i){return n.coerce(t,e,a,r,i)}function l(t){var e=t.map(function(t){var e=s(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=l(["x","y","z"]),c=l(["i","j","k"]);return u?(c&&c.forEach(function(t){for(var e=0;ee}}},r.addRangeSlider=function(t){t.xaxis||(t.xaxis={}),t.xaxis.rangeslider||(t.xaxis.rangeslider={})}},{"../../lib":632}],825:[function(t,e,r){"use strict";var n=t("../../plot_api/register");e.exports={moduleType:"trace",name:"ohlc",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","showLegend"],meta:{},attributes:t("./attributes"),supplyDefaults:t("./defaults")},n(t("../scatter")),n(t("./transform"))},{"../../plot_api/register":653,"../../plots/cartesian":671,"../scatter":854,"./attributes":821,"./defaults":822,"./transform":827}],826:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,i=r("x"),a=r("open"),o=r("high"),s=r("low"),l=r("close");return n=Math.min(a.length,o.length,s.length,l.length),i&&(n=Math.min(n,i.length),n1)){var h=o.distinctVals(c.x.map(e.d2c)).minDiff;a=Math.min(a,h)}}for(a===1/0&&(a=1),u=0;u");b.push(o,o,o,o,o,o,null)},I=0;I")}return g};var l},{"../../components/color":533,"./helpers":832,"fast-isnumeric":104,tinycolor2:489}],831:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,a){function o(r,a){return n.coerce(t,e,i,r,a)}var s=n.coerceFont,l=o("values");if(!Array.isArray(l)||!l.length)return void(e.visible=!1);var u=o("labels");Array.isArray(u)||(o("label0"),o("dlabel"));var c=o("marker.line.width");c&&o("marker.line.color");var h=o("marker.colors");Array.isArray(h)||(e.marker.colors=[]),o("scalegroup");var f=o("text"),d=o("textinfo",Array.isArray(f)?"text+percent":"percent");if(o("hoverinfo",1===a._dataLength?"label+text+value+percent":void 0),d&&"none"!==d){var p=o("textposition"),g=Array.isArray(p)||"auto"===p,m=g||"inside"===p,v=g||"outside"===p;if(m||v){var y=s(o,"textfont",a.font);m&&s(o,"insidetextfont",y),v&&s(o,"outsidetextfont",y)}}o("domain.x"),o("domain.y"),o("hole"),o("sort"),o("direction"),o("rotation"),o("pull")}},{"../../lib":632,"./attributes":828}],832:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return r.lastIndexOf(".")!==-1&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return r.lastIndexOf(".")!==-1&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":632}],833:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.layoutAttributes=t("./layout_attributes"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.styleOne=t("./style_one"),n.moduleType="trace",n.name="pie",n.basePlotModule=t("./base_plot"),n.categories=["pie","showLegend"],n.meta={},e.exports=n},{"./attributes":828,"./base_plot":829,"./calc":830,"./defaults":831,"./layout_attributes":834,"./layout_defaults":835,"./plot":836,"./style":837,"./style_one":838}],834:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],835:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e){function r(r,a){return n.coerce(t,e,i,r,a)}r("hiddenlabels")}},{"../../lib":632,"./layout_attributes":834}],836:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.sqrt(t.width*t.width+t.height*t.height),a=t.width/t.height,o=Math.PI*Math.min(e.v/r.vTotal,.5),s=1-r.trace.hole,l=i(e,r),u={scale:l*r.r*2/n,rCenter:1-l,rotate:0};if(u.scale>=1)return u;var c=a+1/(2*Math.tan(o)),h=r.r*Math.min(1/(Math.sqrt(c*c+.5)+c),s/(Math.sqrt(a*a+s/2)+a)),f={scale:2*h/t.height,rCenter:Math.cos(h/r.r)-h*a/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90},d=1/a,p=d+1/(2*Math.tan(o)),g=r.r*Math.min(1/(Math.sqrt(p*p+.5)+p),s/(Math.sqrt(d*d+s/2)+d)),m={scale:2*g/t.width,rCenter:Math.cos(g/r.r)-g/a/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>f.scale?m:f;return u.scale<1&&v.scale>u.scale?v:u}function i(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var r=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(r)),(1-e.trace.hole)/2)}function a(t,e){var r=e.pxmid[0],n=e.pxmid[1],i=t.width/2,a=t.height/2;return r<0&&(i*=-1),n<0&&(a*=-1),{scale:1,rCenter:1,rotate:0,x:i+Math.abs(a)*(i>0?1:-1)/2,y:a/(1+r*r/(n*n)),outside:!0}}function o(t,e){function r(t,e){return t.pxmid[1]-e.pxmid[1]}function n(t,e){return e.pxmid[1]-t.pxmid[1]}function i(t,r){r||(r={});var n,i,a,s,f,d,g=r.labelExtraY+(o?r.yLabelMax:r.yLabelMin),m=o?t.yLabelMin:t.yLabelMax,v=o?t.yLabelMax:t.yLabelMin,y=t.cyFinal+u(t.px0[1],t.px1[1]),x=g-m;if(x*h>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(i=0;i=e.pull[a.i]||((t.pxmid[1]-a.pxmid[1])*h>0?(s=a.cyFinal+u(a.px0[1],a.px1[1]),x=s-m-t.labelExtraY,x*h>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*h>0&&(n=3*c*Math.abs(i-p.indexOf(t)),f=a.cxFinal+l(a.px0[0],a.px1[0]),d=f+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX,d*c>0&&(t.labelExtraX+=d)))}var a,o,s,l,u,c,h,f,d,p,g,m,v;for(o=0;o<2;o++)for(s=o?r:n,u=o?Math.max:Math.min,h=o?1:-1,a=0;a<2;a++){for(l=a?Math.max:Math.min,c=a?1:-1,f=t[o][a],f.sort(s),d=t[1-o][a],p=d.concat(f),m=[],g=0;gc&&(c=s.pull[a]);o.r=Math.min(r/u(s.tilt,Math.sin(l),s.depth),n/u(s.tilt,Math.cos(l),s.depth))/(2+2*c),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&&d.indexOf(s.scalegroup)===-1&&d.push(s.scalegroup)}for(a=0;ah.vTotal/2?1:0)}function u(t,e,r){if(!t)return 1;var n=Math.sin(t*Math.PI/180);return Math.max(.01,r*n*Math.abs(e)+2*Math.sqrt(1-n*n*e*e))}var c=t("d3"),h=t("../../plots/cartesian/graph_interact"),f=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;s(e,r._size);var u=r._pielayer.selectAll("g.trace").data(e);u.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),u.exit().remove(),u.order(),u.each(function(e){var s=c.select(this),u=e[0],m=u.trace,v=0,y=(m.depth||0)*u.r*Math.sin(v)/2,x=m.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=u.r*Math.cos(v),M=s.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);M.enter().append("g").attr("class",function(t){return t+" part"}),M.exit().remove(),M.order(),l(e),s.selectAll(".top").each(function(){var s=c.select(this).selectAll("g.slice").data(e);s.enter().append("g").classed("slice",!0),s.exit().remove();var l=[[[],[]],[[],[]]],v=!1;s.each(function(o){function s(e){var n=t._fullLayout,a=t._fullData[m.index],s=a.hoverinfo;if("all"===s&&(s="label+text+value+percent+name"),!t._dragging&&n.hovermode!==!1&&"none"!==s&&"skip"!==s&&s){var l=i(o,u),c=M+o.pxmid[0]*(1-l),f=A+o.pxmid[1]*(1-l),d=r.separators,p=[];s.indexOf("label")!==-1&&p.push(o.label),a.text&&a.text[o.i]&&s.indexOf("text")!==-1&&p.push(a.text[o.i]),s.indexOf("value")!==-1&&p.push(g.formatPieValue(o.v,d)),s.indexOf("percent")!==-1&&p.push(g.formatPiePercent(o.v/u.vTotal,d)),h.loneHover({x0:c-l*u.r,x1:c+l*u.r,y:f,text:p.join("
"),name:s.indexOf("name")!==-1?a.name:void 0,color:o.color,idealAlign:o.pxmid[0]<0?"left":"right"},{container:n._hoverlayer.node(),outerContainer:n._paper.node()}),h.hover(t,e,"pie"),E=!0}}function f(e){t.emit("plotly_unhover",{points:[e]}),E&&(h.loneUnhover(r._hoverlayer.node()),E=!1)}function y(){t._hoverdata=[o],t._hoverdata.trace=e.trace,h.click(t,{target:!0})}function b(t,e,r,n){return"a"+n*u.r+","+n*w+" "+x+" "+o.largeArc+(r?" 1 ":" 0 ")+n*(e[0]-t[0])+","+n*(e[1]-t[1])}if(o.hidden)return void c.select(this).selectAll("path,g").remove();l[o.pxmid[1]<0?0:1][o.pxmid[0]<0?0:1].push(o);var M=u.cx+_[0],A=u.cy+_[1],k=c.select(this),T=k.selectAll("path.surface").data([o]),E=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),k.select("path.textline").remove(),k.on("mouseover",s).on("mouseout",f).on("click",y),m.pull){var S=+(Array.isArray(m.pull)?m.pull[o.i]:m.pull)||0;S>0&&(M+=S*o.pxmid[0],A+=S*o.pxmid[1])}o.cxFinal=M,o.cyFinal=A;var L=m.hole;if(o.v===u.vTotal){var z="M"+(M+o.px0[0])+","+(A+o.px0[1])+b(o.px0,o.pxmid,!0,1)+b(o.pxmid,o.px0,!0,1)+"Z";L?T.attr("d","M"+(M+L*o.px0[0])+","+(A+L*o.px0[1])+b(o.px0,o.pxmid,!1,L)+b(o.pxmid,o.px0,!1,L)+"Z"+z):T.attr("d",z)}else{var C=b(o.px0,o.px1,!0,1);if(L){var I=1-L;T.attr("d","M"+(M+L*o.px1[0])+","+(A+L*o.px1[1])+b(o.px1,o.px0,!1,L)+"l"+I*o.px0[0]+","+I*o.px0[1]+C+"Z")}else T.attr("d","M"+M+","+A+"l"+o.px0[0]+","+o.px0[1]+C+"Z")}var P=Array.isArray(m.textposition)?m.textposition[o.i]:m.textposition,D=k.selectAll("g.slicetext").data(o.text&&"none"!==P?[0]:[]);D.enter().append("g").classed("slicetext",!0),D.exit().remove(),D.each(function(){var t=c.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(o.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(d.font,"outside"===P?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,r=d.bBox(t.node());"outside"===P?e=a(r,o):(e=n(r,o,u),"auto"===P&&e.scale<1&&(t.call(d.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),r=d.bBox(t.node())),e=a(r,o)));var i=M+o.pxmid[0]*e.rCenter+(e.x||0),s=A+o.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(o.yLabelMin=s-r.height/2,o.yLabelMid=s,o.yLabelMax=s+r.height/2,o.labelExtraX=0,o.labelExtraY=0,v=!0),t.attr("transform","translate("+i+","+s+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(r.left+r.right)/2+","+-(r.top+r.bottom)/2+")")})}),v&&o(l,m),s.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=c.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],i=t.cyFinal+t.pxmid[1],a="M"+n+","+i,o=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var s=t.labelExtraX*t.pxmid[1]/t.pxmid[0],l=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);a+=Math.abs(s)>Math.abs(l)?"l"+l*t.pxmid[0]/t.pxmid[1]+","+l+"H"+(n+t.labelExtraX+o):"l"+t.labelExtraX+","+s+"v"+(l-s)+"h"+o}else a+="V"+(t.yLabelMid+t.labelExtraY)+"h"+o;e.append("path").classed("textline",!0).call(f.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:a,fill:"none"})}})})}),setTimeout(function(){u.selectAll("tspan").each(function(){var t=c.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":533,"../../components/drawing":557,"../../lib/svg_text_utils":646,"../../plots/cartesian/graph_interact":670,"./helpers":832,d3:95}],837:[function(t,e,r){"use strict";var n=t("d3"),i=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],r=e.trace,a=n.select(this);a.style({opacity:r.opacity}),a.selectAll(".top path.surface").each(function(t){n.select(this).call(i,t,r)})})}},{"./style_one":838,d3:95}],838:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var i=r.marker.line.color;Array.isArray(i)&&(i=i[e.i]||n.defaultLine);var a=r.marker.line.width||0;Array.isArray(a)&&(a=a[e.i]||0),t.style({"stroke-width":a,fill:e.color}).call(n.stroke,i)}},{"../../components/color":533}],839:[function(t,e,r){"use strict";var n=t("../scattergl/attributes");e.exports={x:n.x,y:n.y,xy:{valType:"data_array"},indices:{valType:"data_array"},xbounds:{valType:"data_array"},ybounds:{valType:"data_array"},text:n.text,marker:{color:{valType:"color",arrayOk:!1},opacity:{valType:"number",min:0,max:1,dflt:1,arrayOk:!1},blend:{valType:"boolean",dflt:null},sizemin:{valType:"number",min:.1,max:2,dflt:.5},sizemax:{valType:"number",min:.1,dflt:20},border:{color:{valType:"color",arrayOk:!1},arearatio:{valType:"number",min:0,max:1,dflt:0}}}}},{"../scattergl/attributes":880}],840:[function(t,e,r){"use strict";function n(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=a(t.glplot,this.pointcloudOptions),this.pointcloud._trace=this}function i(t,e){var r=new n(t,e.uid);return r.update(e),r}var a=t("gl-pointcloud2d"),o=t("../../lib/str2rgbarray"),s=t("../scatter/get_trace_color"),l=["xaxis","yaxis"],u=n.prototype;u.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}},u.update=function(t){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=s(t,{})},u.updateFast=function(t){var e,r,n,i,a,s,l=this.xData=this.pickXData=t.x,u=this.yData=this.pickYData=t.y,c=this.pickXYData=t.xy,h=t.xbounds&&t.ybounds,f=t.indices,d=this.bounds;if(c){if(n=c,e=c.length>>>1,h)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);if(f)r=f;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var p=o(t.marker.color),g=o(t.marker.border.color),m=t.opacity*t.marker.opacity;p[3]*=m,this.pointcloudOptions.color=p;var v=t.marker.blend;if(null===v){var y=100;v=l.lengthp&&f.splice(p,f.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},m={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var v={type:"linear"};i.setConvert(v),l=v.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||f[0]===f[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||f[0]===f[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,i.expand(c,f,g),i.expand(h,d,m);var b=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],847:[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,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,h=l.cmin,f=l.cmax;n(h)||(h=i.aggNums(Math.min,null,c)),n(f)||(f=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,h,f),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:h,end:f,size:(f-h)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":536,"../../components/colorscale":548,"../../lib":632,"../../plots/plots":723,"fast-isnumeric":104}],848:[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":540,"../../components/colorscale/has_colorscale":547,"./subtypes":864}],849:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],850:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),h=t("./text_defaults"),f=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var m=s(t,e,g),v=mU!=P>=U&&(z=S[T-1][0],C=S[T][0],L=z+(C-z)*(U-I)/(P-I),F=Math.min(F,L),j=Math.max(j,L));F=Math.max(F,0),j=Math.min(j,f._length);var V=l.defaultLine;return l.opacity(h.fillcolor)?V=h.fillcolor:l.opacity((h.line||{}).color)&&(V=h.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:F,x1:j,y0:U,y1:U,color:V}),delete t.index,h.text&&!Array.isArray(h.text)?t.text=String(h.text):t.text=h.name,[t]}}}},{"../../components/color":533,"../../components/errorbars":563,"../../lib":632,"../../plots/cartesian/constants":668,"../../plots/cartesian/graph_interact":670,"./get_trace_color":852}],854:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":671,"./arrays_to_calcdata":843,"./attributes":844,"./calc":845,"./clean_data":846,"./colorbar":847,"./defaults":850,"./hover":853,"./plot":861,"./select":862,"./style":863,"./subtypes":864}],855:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":543,"../../components/colorscale/has_colorscale":547}],856:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),n=M.c2p(t[e].y);return r!==L&&n!==L&&[r,n]}function i(t){var e=t[0]/w._length,r=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,h,f,d,p,g,m,v,y,x,b,_,w=e.xaxis,M=e.yaxis,A=e.simplify,k=e.connectGaps,T=e.baseTolerance,E=e.linear,S=[],L=n.BADNUM,z=.2,C=new Array(t.length),I=0;for(A||(T=z=-1),o=0;oi(h))break;l=h,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,u=h,d=!1):y=t.length||!h)break;C[I++]=h,s=h}}else C[I++]=u}S.push(C.slice(0,I))}return S}},{"../../plots/cartesian/axes":662}],857:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],858:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":104}],860:[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){var u,c=o.isBubble(t),h=(t.line||{}).color;h&&(r=h),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=h&&!Array.isArray(h)&&e.marker.color!==h?h:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":533,"../../components/colorscale/defaults":543,"../../components/colorscale/has_colorscale":547,"./subtypes":864}],861:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function i(t,e,r,n,i,d,g){function m(t){return A?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,r,n=t[0].trace,i=o.select(this),a=c.hasMarkers(n),u=c.hasText(n),h=x(n),f=b,d=b;a&&(f=n.marker.maxdisplayed?v:s.identity),u&&(d=n.marker.maxdisplayed?v:s.identity),r=i.selectAll("path.point"),e=r.data(f,h);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,n).call(l.translatePoints,k,T,n),A&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=m(o.select(this));l.translatePoint(t,e,k,T),l.singlePointStyle(t,e,n)}),A?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=i.selectAll("g"),e=r.data(d,h),e.enter().append("g").append("text"),e.each(function(t){var e=m(o.select(this).select("text"));l.translatePoint(t,e,k,T)}),e.selectAll("text").call(l.textPointStyle,n).each(function(t){var e=t.xp||k.c2p(t.x),r=t.yp||T.c2p(t.y);o.select(this).selectAll("tspan").each(function(){m(o.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,M;a(t,e,r,n,i);var A=!!g&&g.duration>0,k=r.xaxis,T=r.yaxis,E=n[0].trace,S=E.line,L=o.select(d);if(L.call(u.plot,r,g),E.visible===!0){var z,C,I=E.fill.charAt(E.fill.length-1);"x"!==I&&"y"!==I&&(I=""),n[0].node3=L,h(n);var P="",D=[],R=E._prevtrace;R&&(P=R._prevRevpath||"",C=R._nextFill,D=R._polygons);var O,F,j,N,B,U,V,q,H,G="",X="",Y=[],W=[],Z=s.noop;if(z=E._ownFill,c.hasLines(E)||"none"!==E.fill){for(C&&C.datum(n),["hv","vh","hvh","vhv"].indexOf(S.shape)!==-1?(j=l.steps(S.shape),N=l.steps(S.shape.split("").reverse().join(""))):j=N="spline"===S.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),S.smoothing):l.smoothopen(t,S.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return N(t.reverse())},Y=f(n,{xaxis:k,yaxis:T,connectGaps:E.connectgaps,baseTolerance:Math.max(S.width||1,3)/4,linear:"linear"===S.shape,simplify:S.simplify}),H=E._polygons=new Array(Y.length),M=0;M1}),Z=function(t){return function(e){if(O=j(e),F=B(e),G?I?(G+="L"+O.substr(1),X=F+("L"+X.substr(1))):(G+="Z"+O,X=F+"Z"+X):(G=O,X=F),c.hasLines(E)&&e.length>1){var r=o.select(this);if(r.datum(n),t)m(r.style("opacity",0).attr("d",O).call(l.lineGroupStyle)).style("opacity",1);else{var i=m(r);i.attr("d",O),l.singleLineStyle(n,i)}}}}}var Q=L.selectAll(".js-line").data(W);m(Q.exit()).style("opacity",0).remove(),Q.each(Z(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Z(!0)),Y.length&&(z?U&&q&&(I?("y"===I?U[1]=q[1]=T.c2p(0,!0):"x"===I&&(U[0]=q[0]=k.c2p(0,!0)),m(z).attr("d","M"+q+"L"+U+"L"+G.substr(1))):m(z).attr("d",G+"Z")):"tonext"===E.fill.substr(0,6)&&G&&P&&("tonext"===E.fill?m(C).attr("d",G+"Z"+P+"Z"):m(C).attr("d",G+"L"+P.substr(1)+"Z"),E._polygons=E._polygons.concat(D)),E._prevRevpath=X,E._prevPolygons=H);var K=L.selectAll(".points");w=K.data([n]),K.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,s=r.yaxis,l=o.extent(a.range.map(a.l2c)),u=o.extent(s.range.map(s.l2c)),h=n[0].trace;if(c.hasMarkers(h)){var f=h.marker.maxdisplayed;if(0!==f){var d=n.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/f),g=0;i.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),h=c.data(r,function(t){return t[0].trace.uid}),h.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,r),n(t,p),l=0,u=[];ln?1:-1}),m){s&&(f=s());var v=o.transition().duration(a.duration).ease(a.easing).each("end",function(){f&&f()}).each("interrupt",function(){f&&f()});v.each(function(){p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)})})}else p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)});g&&h.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":557,"../../components/errorbars":563,"../../lib":632,"../../lib/polygon":639,"./arrays_to_calcdata":843,"./line_points":856,"./link_traces":858,"./subtypes":864,d3:95}],862:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,h=[],f=l[0].trace,d=f.index,p=f.marker,g=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return M[t]}function u(t,e,r,n,i){var a=null;if(Array.isArray(t)){a=[];for(var o=0;o=0){var f=i(l.position,l.delaunayColor,l.delaunayAxis);f.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(f):(f.gl=o,this.delaunayMesh=m(f),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},k.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=f},{"../../constants/gl3d_dashes":615,"../../constants/gl_markers":616,"../../lib":632,"../../lib/gl_format_color":630,"../../lib/str2rgbarray":645,"../scatter/make_bubble_size_func":859,"./calc_errors":869,"delaunay-triangulate":96,"gl-error3d":133,"gl-line3d":140,"gl-mesh3d":173,"gl-scatter3d":216}],871:[function(t,e,r){"use strict";function n(t,e,r){var n=0,i=r("x"),a=r("y"),o=r("z");return i&&a&&o&&(n=Math.min(i.length,a.length,o.length),n=0&&f("surfacecolor",p||g);for(var m=["x","y","z"],v=0;v<3;++v){var y="projection."+m[v];f(y+".show")&&(f(y+".opacity"),f(y+".scale"))}u(t,e,r,{axis:"z"}),u(t,e,r,{axis:"y",inherit:"z"}),u(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":562,"../../lib":632,"../scatter/line_defaults":855,"../scatter/marker_defaults":860,"../scatter/subtypes":864,"../scatter/text_defaults":865,"./attributes":867}],872:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl_markers":616,"../../plots/gl3d":702, -"../scatter/colorbar":847,"./attributes":867,"./calc":868,"./convert":870,"./defaults":871}],873:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),a=t("../../components/colorscale/color_attributes"),o=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={lon:{valType:"data_array"},lat:{valType:"data_array"},locations:{valType:"data_array"},locationmode:{valType:"enumerated",values:["ISO-3","USA-states","country names"],dflt:"ISO-3"},mode:o({},n.mode,{dflt:"markers"}),text:o({},n.text,{}),textfont:n.textfont,textposition:n.textposition,line:{color:l.color,width:l.width,dash:l.dash},connectgaps:n.connectgaps,marker:o({},{symbol:s.symbol,opacity:s.opacity,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,line:o({},{width:u.width},a("marker.line"))},a("marker")),fill:{valType:"enumerated",values:["none","toself"],dflt:"none"},fillcolor:n.fillcolor,hoverinfo:o({},i.hoverinfo,{flags:["lon","lat","location","text","name"]}),_nestedModules:{"marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":541,"../../lib/extend":625,"../../plots/attributes":660,"../scatter/attributes":844}],874:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../scatter/colorscale_calc");e.exports=function(t,e){for(var r=Array.isArray(e.locations),a=r?e.locations.length:e.lon.length,o=[],s=0,l=0;l0&&(o[s-1].gapAfter=!0):(s++,o.push(c))}return i(e),o}},{"../scatter/colorscale_calc":848,"fast-isnumeric":104}],875:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=0,o=r("locations");return o?(r("locationmode"),a=o.length):(n=r("lon")||[],i=r("lat")||[],a=Math.min(n.length,i.length),a")}var i=t("../../plots/cartesian/graph_interact"),a=t("../../plots/cartesian/axes"),o=t("../scatter/get_trace_color"),s=t("./attributes");e.exports=function(t){function e(t){return c.projection(t)}function r(t){var r=t.lonlat;if(null===r[0]||null===r[1])return 1/0;if(c.isLonLatOverEdges(r))return 1/0;var n=e(r),i=l.c2p(),a=u.c2p(),o=Math.abs(i-n[0]),s=Math.abs(a-n[1]),h=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(o*o+s*s)-h,1-3/h)}var a=t.cd,s=a[0].trace,l=t.xa,u=t.ya,c=t.subplot;if(!a[0].placeholder&&(i.getClosest(a,r,t),t.index!==!1)){var h=a[t.index],f=h.lonlat,d=e(f),p=h.mrc||1;return t.x0=d[0]-p,t.x1=d[0]+p,t.y0=d[1]-p,t.y1=d[1]+p,t.loc=h.loc,t.lat=f[0],t.lon=f[1],t.color=o(s,h),t.extraText=n(s,h,c.mockAxis),[t]}}},{"../../plots/cartesian/axes":662,"../../plots/cartesian/graph_interact":670,"../scatter/get_trace_color":852,"./attributes":873}],878:[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.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.moduleType="trace",n.name="scattergeo",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/geo":687,"../scatter/colorbar":847,"./attributes":873,"./calc":874,"./defaults":875,"./event_data":876,"./hover":877,"./plot":879}],879:[function(t,e,r){"use strict";function n(t,e){if(!Array.isArray(t.locations))return u.identity;var r=c(t,e),n=t.locationmode;return function(t){var e=h(n,t.loc,r);return e?(t.lonlat=e.properties.ct,t):(t.lonlat=[null,null],!1)}}function i(t,e,r){function n(t,n){d(t,e,n,r)}var i=t.marker;if(n(t.text,"tx"),n(t.textposition,"tp"),t.textfont&&(n(t.textfont.size,"ts"),n(t.textfont.color,"tc"),n(t.textfont.family,"tf")),i&&i.line){var a=i.line;n(i.opacity,"mo"),n(i.symbol,"mx"),n(i.color,"mc"),n(i.size,"ms"),n(a.color,"mlc"),n(a.width,"mlw")}}function a(t){var e=t.framework.selectAll("g.trace.scattergeo");e.style("opacity",function(t){return t[0].trace.opacity}),e.each(function(t){var e=t[0].trace,r=o.select(this);r.selectAll("path.point").call(s.pointStyle,e),r.selectAll("text").call(s.textPointStyle,e)}),e.selectAll("path.js-line").style("fill","none").each(function(t){var e=o.select(this),r=t.trace,n=r.line||{};e.call(l.stroke,n.color).call(s.dashLine,n.dash||"",n.width||0),"none"!==r.fill&&e.call(l.fill,r.fillcolor)})}var o=t("d3"),s=t("../../components/drawing"),l=t("../../components/color"),u=t("../../lib"),c=t("../../lib/topojson_utils").getTopojsonFeatures,h=t("../../lib/geo_location_utils").locationToFeature,f=t("../../lib/geojson_utils"),d=t("../../lib/array_to_calc_item"),p=t("../scatter/subtypes");e.exports=function(t,e){function r(t){return t[0].trace.uid}var s=t.framework.select(".scattergeolayer").selectAll("g.trace.scattergeo").data(e,r);s.enter().append("g").attr("class","trace scattergeo"),s.exit().remove(),s.selectAll("*").remove(),s.each(function(e){var r=o.select(this),a=e[0].trace,s=n(a,t.topojson);e[0].placeholder&&r.remove();for(var l=[],u=0;u=e.length?i:e[a]);return n}function o(t,e,r){return l(C(t,r),z(e,r),r)}function s(t,e,r,n){var i=w(t,e,n);return i=Array.isArray(i[0])?i:a(m.identity,[i],n),l(i,z(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;i0&&(v[y-1].gapAfter=!0)}return v}},{"../../components/colorscale":548,"../../lib":632,"../scatter/colorscale_calc":848,"../scatter/make_bubble_size_func":859,"../scatter/subtypes":864,"fast-isnumeric":104}],886:[function(t,e,r){"use strict";function n(){return{geojson:h.makeBlank(),layout:{visibility:"none"},paint:{}}}function i(t,e){function r(t,r,n,i){void 0===e[r][n]&&(e[r][n]=i),t[r]=e[r][n]}for(var n=t[0].trace,i=n.marker,a=Array.isArray(i.color),o=Array.isArray(i.size),s=[],l=0;l")}var i=t("../../plots/cartesian/graph_interact"),a=t("../scatter/get_trace_color");e.exports=function(t,e,r){function o(t){var e=t.lonlat,n=Math.abs(u.c2p(e)-u.c2p([d,e[1]])),i=Math.abs(c.c2p(e)-c.c2p([e[0],r])),a=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(n*n+i*i)-a,1-3/a)}var s=t.cd,l=s[0].trace,u=t.xa,c=t.ya;if(!s[0].placeholder){var h=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),f=360*h,d=e-f;if(i.getClosest(s,o,t),t.index!==!1){var p=s[t.index],g=p.lonlat,m=[g[0]+f,g[1]],v=u.c2p(m),y=c.c2p(m),x=p.mrc||1;return t.x0=v-x,t.x1=v+x,t.y0=y-x,t.y1=y+x,t.color=a(l,p),t.extraText=n(l,p),[t]}}}},{"../../plots/cartesian/graph_interact":670,"../scatter/get_trace_color":852}],890:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.plot=t("./plot"),n.moduleType="trace",n.name="scattermapbox",n.basePlotModule=t("../../plots/mapbox"),n.categories=["mapbox","gl","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/mapbox":717,"../scatter/colorbar":847,"./attributes":884,"./calc":885,"./defaults":887,"./event_data":888,"./hover":889,"./plot":891}],891:[function(t,e,r){"use strict";function n(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.mapbox.initSource(this.idSourceFill),this.mapbox.initSource(this.idSourceLine),this.mapbox.initSource(this.idSourceCircle),this.mapbox.initSource(this.idSourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle,source:this.idSourceCircle,type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var a=t("./convert"),o=n.prototype;o.update=function(t){var e=this.mapbox,r=a(t);e.setOptions(this.idLayerFill,"setLayoutProperty",r.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",r.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",r.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",r.symbol.layout),i(r.fill)&&(e.setSourceData(this.idSourceFill,r.fill.geojson),e.setOptions(this.idLayerFill,"setPaintProperty",r.fill.paint)),i(r.line)&&(e.setSourceData(this.idSourceLine,r.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",r.line.paint)),i(r.circle)&&(e.setSourceData(this.idSourceCircle,r.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",r.circle.paint)),i(r.symbol)&&(e.setSourceData(this.idSourceSymbol,r.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",r.symbol.paint))},o.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var r=e[0].trace,i=new n(t,r.uid);return i.update(e),i}},{"./convert":886}],892:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),a=t("../../components/colorscale/color_attributes"),o=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={a:{valType:"data_array"},b:{valType:"data_array"},c:{valType:"data_array"},sum:{valType:"number",dflt:0,min:0},mode:o({},n.mode,{dflt:"markers"}),text:o({},n.text,{}),line:{color:l.color,width:l.width,dash:l.dash,shape:o({},l.shape,{values:["linear","spline"]}),smoothing:l.smoothing},connectgaps:n.connectgaps,fill:o({},n.fill,{values:["none","toself","tonext"]}),fillcolor:n.fillcolor,marker:o({},{symbol:s.symbol,opacity:s.opacity,maxdisplayed:s.maxdisplayed,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,line:o({},{width:u.width},a("marker".line))},a("marker")),textfont:n.textfont,textposition:n.textposition,hoverinfo:o({},i.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron,_nestedModules:{"marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":541,"../../lib/extend":625,"../../plots/attributes":660,"../scatter/attributes":844}],893:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=t("../scatter/subtypes"),s=t("../scatter/colorscale_calc"),l=["a","b","c"],u={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,c,h,f,d,p,g=t._fullLayout[e.subplot],m=g.sum,v=e.sum||m;for(r=0;rA&&E.splice(A,E.length-A)}return s(e),"undefined"!=typeof E&&a.mergeArray(E,k,"ms"),k}},{"../../lib":632,"../../plots/cartesian/axes":662,"../scatter/colorscale_calc":848,"../scatter/subtypes":864,"fast-isnumeric":104}],894:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),a=t("../scatter/subtypes"),o=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/line_shape_defaults"),u=t("../scatter/text_defaults"),c=t("../scatter/fillcolor_defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function d(r,i){return n.coerce(t,e,h,r,i)}var p,g=d("a"),m=d("b"),v=d("c");if(g?(p=g.length,m?(p=Math.min(p,m.length),v&&(p=Math.min(p,v.length))):p=v?Math.min(p,v.length):0):m&&v&&(p=Math.min(m.length,v.length)),!p)return void(e.visible=!1);g&&p"),s}}},{"../../plots/cartesian/axes":662,"../scatter/hover":853}],896:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/ternary":731,"../scatter/colorbar":847,"./attributes":892,"./calc":893,"./defaults":894,"./hover":895,"./plot":897,"./select":898,"./style":899}],897:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e){var r=t.plotContainer;r.select(".scatterlayer").selectAll("*").remove();for(var i={xaxis:t.xaxis,yaxis:t.yaxis,plot:r},a=new Array(e.length),o=t.graphDiv.calcdata,s=0;s":return function(t){return e(t)>n};case">=":return function(t){return e(t)>=n};case"[]":return function(t){var r=e(t);return r>=n[0]&&r<=n[1]};case"()":return function(t){var r=e(t);return r>n[0]&&r=n[0]&&rn[0]&&r<=n[1]};case"][":return function(t){var r=e(t);return r<=n[0]||r>=n[1]};case")(":return function(t){var r=e(t);return rn[1]};case"](":return function(t){var r=e(t);return r<=n[0]||r>n[1]};case")[":return function(t){var r=e(t);return r=n[1]};case"{}":return function(t){return n.indexOf(e(t))!==-1};case"}{":return function(t){return n.indexOf(e(t))===-1}}}var o=t("../lib"),s=t("../plots/cartesian/axis_ids"),l=t("../plots/cartesian/axis_autotype"),u=t("../plots/cartesian/set_convert"),c=["=","<",">=",">","<="],h=["[]","()","[)","(]","][",")(","](",")["],f=["{}","}{"];r.moduleType="transform",r.name="filter",r.attributes={enabled:{valType:"boolean",dflt:!0},target:{valType:"string",strict:!0,noBlank:!0,arrayOk:!0,dflt:"x"},operation:{valType:"enumerated",values:[].concat(c).concat(h).concat(f),dflt:"="},value:{valType:"any",dflt:0}},r.supplyDefaults=function(t){function e(e,i){return o.coerce(t,n,r.attributes,e,i)}var n={},i=e("enabled");return i&&(e("operation"),e("value"),e("target")),n},r.calcTransform=function(t,e,r){function s(t,r){var n=p[t],i=o.nestedProperty(e,t).get();i.push(n[r])}if(r.enabled){var l=r.target,u=n(e,l),c=u.length;if(c){for(var h=i(t,e,l),f=a(r,h),d=o.findArrayAttributes(e),p={},g=0;g0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return a.freeUint32(l),a.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,a,o=1;for(r[0]=0,a=1;a0;--a)n=e/o|0,e=e-n*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}var a=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":256,"typedarray-pool":496}],439:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,s,l,c=0;c<2;++c)if(u[c][n].length>0){o=u[c][n][0],l=c;break}s=o[1^l];for(var h=0;h<2;++h)for(var f=u[h][n],d=0;d0&&(o=p,s=g,l=h)}return a?s:(o&&r(o,l),s)}function a(t,a){var o=u[a][t][0],s=[t];r(o,a);for(var l=o[1^a];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],h=t,f=s[1],d=n(c,h,!0);if(i(e[c],e[h],e[f],e[d])<0)break;s.push(t),l=n(c,h)}return s}function o(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;c0;){var g=(u[0][c].length,a(c,d));o(p,g)?p.push.apply(p,g):(p.length>0&&f.push(p),p=g)}p.length>0&&f.push(p)}return f}e.exports=n;var i=t("compare-angle")},{"compare-angle":81}],440:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function a(t){for(var e=t.length,r=0;r0;){var U=N.pop(),V=I[U];h(V,function(t,e){return t-e});var q,H=V.length,G=B[U];if(0===G){var T=v[U];q=[T]}for(var m=0;m=0)&&(B[X]=1^G,N.push(X),0===G)){var T=v[X];a(T)||(T.reverse(),q.push(T))}}0===G&&d.push(q)}return d}e.exports=a;var o=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),h=t("uniq"),f=t("./lib/trim-leaves")},{"./lib/trim-leaves":440,"edges-to-adjacency-list":100,"planar-dual":439,"point-in-big-polygon":443,"robust-sum":470,"two-product":494,uniq:498}],442:[function(t,e,r){"use strict";function n(t,e){this.x=t,this.y=e}e.exports=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{}],443:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return!!i&&!!i.queryPoint(r,n)}}function a(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var o=i.key,s=h(r,o[0],o[1]);if(o[0][0]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))return 0;a=1,i=i.right}}return a}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;i=u?(b=1,y=u+2*f+p):(b=-f/u,y=f*b+p)):(b=0,d>=0?(_=0,y=p):-d>=h?(_=1,y=h+2*d+p):(_=-d/h,y=d*_+p));else if(_<0)_=0,f>=0?(b=0,y=p):-f>=u?(b=1,y=u+2*f+p):(b=-f/u,y=f*b+p);else{var w=1/x;b*=w,_*=w,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p}else{var M,A,k,T;b<0?(M=c+f,A=h+d,A>M?(k=A-M,T=u-2*c+h,k>=T?(b=1,_=0,y=u+2*f+p):(b=k/T,_=1-b,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p)):(b=0,A<=0?(_=1,y=h+2*d+p):d>=0?(_=0,y=p):(_=-d/h,y=d*_+p))):_<0?(M=c+d,A=u+f,A>M?(k=A-M,T=u-2*c+h,k>=T?(_=1,b=0,y=h+2*d+p):(_=k/T,b=1-_,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p)):(_=0,A<=0?(b=1,y=u+2*f+p):f>=0?(b=0,y=p):(b=-f/u,y=f*b+p))):(k=h+d-c-f,k<=0?(b=0,_=1,y=h+2*d+p):(T=u-2*c+h,k>=T?(b=1,_=0,y=u+2*f+p):(b=k/T,_=1-b,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p)))}for(var E=1-b-_,l=0;l1)for(var r=1;r1&&(n=r[0]+"@",t=r[1]),t=t.replace(P,".");var i=t.split("."),a=o(i,e).join(".");return n+a}function l(t){for(var e,r,n=[],i=0,a=t.length;i=55296&&e<=56319&&i65535&&(t-=65536,e+=F(t>>>10&1023|55296),t=56320|1023&t),e+=F(t)}).join("")}function c(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:M}function h(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function f(t,e,r){var n=0;for(t=r?R(t/E):t>>1,t+=R(t/e);t>O*k>>1;n+=M)t=R(t/O);return R(n+(O+1)*t/(t+T))}function d(t){var e,r,n,i,o,s,l,h,d,p,g=[],m=t.length,v=0,y=L,x=S;for(r=t.lastIndexOf(z),r<0&&(r=0),n=0;n=128&&a("not-basic"),g.push(t.charCodeAt(n));for(i=r>0?r+1:0;i=m&&a("invalid-input"),h=c(t.charCodeAt(i++)),(h>=M||h>R((w-v)/s))&&a("overflow"),v+=h*s,d=l<=x?A:l>=x+k?k:l-x,!(hR(w/p)&&a("overflow"),s*=p;e=g.length+1,x=f(v-o,e,0==o),R(v/e)>w-y&&a("overflow"),y+=R(v/e),v%=e,g.splice(v++,0,y)}return u(g)}function p(t){var e,r,n,i,o,s,u,c,d,p,g,m,v,y,x,b=[];for(t=l(t),m=t.length,e=L,r=0,o=S,s=0;s=e&&gR((w-r)/v)&&a("overflow"),r+=(u-e)*v,e=u,s=0;sw&&a("overflow"),g==e){for(c=r,d=M;p=d<=o?A:d>=o+k?k:d-o,!(c= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=M-A,R=Math.floor,F=String.fromCharCode;if(b={version:"1.4.1",ucs2:{decode:l,encode:u},decode:d,encode:p,toASCII:m,toUnicode:g},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return b});else if(v&&y)if(r.exports==v)y.exports=b;else for(_ in b)b.hasOwnProperty(_)&&(v[_]=b[_]);else i.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],447:[function(t,e,r){e.exports=t("gl-quat/slerp")},{"gl-quat/slerp":199}],448:[function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,r,a){e=e||"&",r=r||"=";var o={};if("string"!=typeof t||0===t.length)return o;var s=/\+/g;t=t.split(e);var l=1e3;a&&"number"==typeof a.maxKeys&&(l=a.maxKeys);var u=t.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(h=g.substr(0,m),f=g.substr(m+1)):(h=g,f=""),d=decodeURIComponent(h),p=decodeURIComponent(f),n(o,d)?i(o[d])?o[d].push(p):o[d]=[o[d],p]:o[d]=p}return o};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],449:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;nr;){if(o-r>600){var l=o-r+1,u=e-r+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),d=Math.max(r,Math.floor(e-u*h/l+f)),p=Math.min(o,Math.floor(e+(l-u)*h/l+f));n(t,e,d,p,s)}var g=t[e],m=r,v=o;for(i(t,r,e),s(t[o],g)>0&&i(t,r,o);m0;)v--}0===s(t[r],g)?i(t,r,v):(v++,i(t,v,o)),v<=e&&(r=v+1),e<=v&&(o=v-1)}}function i(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function a(t,e){return te?1:0}e.exports=n},{}],452:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),a=0;a0){var u=t[r-1];if(0===i(s,u)&&o(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}var i=t("compare-cell"),a=t("compare-oriented-cell"),o=t("cell-orientation");e.exports=n},{"cell-orientation":73,"compare-cell":82,"compare-oriented-cell":83}],457:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("repeat-string expects a string.");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;for(i===t&&"undefined"!=typeof i||(i=t,a="");r>a.length&&e>0&&(1&e&&(a+=t),e>>=1);)t+=t;return a.substr(0,r)}var i,a="";e.exports=n},{}],458:[function(e,r,n){void function(e,i){"function"==typeof t&&t.amd?t(i):"object"==typeof n?r.exports=i():e.resolveUrl=i()}(this,function(){function t(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var r=document.getElementsByTagName("head")[0];r.insertBefore(e,r.firstChild);for(var n,i=document.createElement("a"),a=1;a=0;--i){var a=r,o=t[i];r=a+o;var s=r-a,l=o-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;i>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;r>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r0&&r.push(","),r.push("[");for(var a=0;a0&&r.push(","),a===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",a,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var o=new Function("det",r.join(""));return o(t<6?s[t]:s)}function i(){return[0]}function a(t,e){return[[e[0]],[t[0][0]]]}function o(){for(;u.length>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;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=v*n;return o>=s||o<=-s?o:x(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],u=r[1]-n[1],c=t[2]-n[2],h=e[2]-n[2],f=r[2]-n[2],d=a*u,p=o*l,g=o*s,m=i*u,v=i*l,x=a*s,_=c*(d-p)+h*(g-m)+f*(v-x),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(m))*Math.abs(h)+(Math.abs(v)+Math.abs(x))*Math.abs(f),M=y*w;return _>M||-_>M?_:b(t,e,r,n)}];c()},{"robust-scale":467,"robust-subtract":469,"robust-sum":470,"two-product":494}],466:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return a(e,t[0]);if(1===e.length)return a(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.length0&&s>0||o<0&&s<0)return!1;var l=a(r,t,e),u=a(i,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,i))}e.exports=i;var a=t("robust-orientation")[3]},{"robust-orientation":465}],469:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,h=0,f=Math.abs,d=t[c],p=f(d),g=-e[h],m=f(g);p=i?(a=d,c+=1,c=i?(a=d,c+=1,c0){for(var s=0,l=0,u=0;un.h||t>n.free||rc)&&(h=2*Math.max(t,c)),(ll)&&(u=2*Math.max(r,l)),this.resize(h,u),this.packOne(t,r)}return null},t.prototype.clear=function(){this.shelves=[],this.stats={}},t.prototype.resize=function(t,e){this.w=t,this.h=e;for(var r=0;rthis.free||e>this.h)return null;var r=this.x;return this.x+=t,this.free-=t,{x:r,y:this.y,w:t,h:e,width:t,height:e}},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t})},{}],472:[function(t,e,r){"use strict";e.exports=function(t){return t<0?-1:t>0?1:0}},{}],473:[function(t,e,r){"use strict";function n(t){return a(i(t))}e.exports=n;var i=t("boundary-cells"),a=t("reduce-simplicial-complex")},{"boundary-cells":56,"reduce-simplicial-complex":456}],474:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;n0&&u.push(","),u.push("[");for(var n=0;n0&&u.push(","),u.push("B(C,E,c[",i[0],"],c[",i[1],"])")}u.push("]")}u.push(");")}}var r=0,n=new Array(t+1);n[0]=[[]];for(var i=1;i<=t;++i)for(var s=n[i]=o(i),l=0;l>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--i){i>1,s=o(t[a],e);s<=0?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function h(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[g],a))break}return r}function f(t,e){if(!e)return h(u(p(t,0)),t,0);for(var r=new Array(e),n=0;n>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){var n=s(r);if(e0){var t=k[0];return a(0,S-1),S-=1,u(0),t}return-1}function f(t,e){var r=k[t];return x[r]===e?t:(x[r]=-(1/0),c(t),h(),x[r]=e,S+=1,c(S-1))}function d(t){if(!b[t]){b[t]=!0;var e=v[t],r=y[t];v[r]>=0&&(v[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&f(T[e],i(e)),T[r]>=0&&f(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!b[n]||i<0||i===n)break;if(n=i,i=t[n],!b[n]||i<0||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var g=e.length,m=t.length,v=new Array(g),y=new Array(g),x=new Array(g),b=new Array(g),_=0;_>1;_>=0;--_)u(_);for(;;){var L=h();if(L<0||x[L]>r)break;d(L)}for(var z=[],_=0;_=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&C.push([n,i])}}),o.unique(o.normalize(C)),{positions:z,edges:C}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":465,"simplicial-complex":478}],481:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return ol?i-l:o-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=a(r,i,s),u=a(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;if(l=a(s,o,i),u=a(s,o,r),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]}e.exports=i;var a=t("robust-orientation")},{"robust-orientation":465}],482:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=a(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=a(t.right,e);if(l)return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;a0){var s=a(this.slabs[e-1],t);s&&(o?f(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(o){var p=h(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":481,"binary-search-bounds":53,"functional-red-black-tree":107,"robust-orientation":465}],483:[function(t,e,r){"use strict";function n(t,e){var r=u(l(t,e),[e[e.length-1]]);return r[r.length-1]}function i(t,e,r,n){var i=n-e,a=-e/i;a<0?a=0:a>1&&(a=1);for(var o=1-a,s=t.length,l=new Array(s),u=0;u0||o>0&&c<0){var h=i(s,c,l,o);r.push(h),a.push(h.slice())}c<0?a.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),a.push(l.slice())),o=c}return{positive:r,negative:a}}function o(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u>=0&&r.push(s.slice()),a=u}return r}function s(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u<=0&&r.push(s.slice()),a=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=a,e.exports.positive=o,e.exports.negative=s},{"robust-dot-product":462,"robust-sum":470}],484:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function a(t,e){return Array(e+1).join(t)}var o={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,h,f,d=1,p=t.length,g="",m=[],v=!0,y="";for(s=0;s=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?m[m.length]=n:(!o.number.test(u[8])||v&&!u[3]?y="":(y=v?"+":"-",n=n.toString().replace(o.sign,"")),h=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",f=u[6]-(y+n).length,c=u[6]&&f>0?a(h,f):"",m[m.length]=u[5]?y+n+c:"0"===h?y+c+n:c+y+n)}return m.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],485:[function(t,e,r){"use strict";function n(t){return new i(t)}function i(t){this.options=d(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function a(t,e,r,n){return{x:t,y:e,zoom:1/0,id:n,numPoints:r}}function o(t,e){var r=t.geometry.coordinates;return a(u(r[0]),c(r[1]),1,e)}function s(t){return{type:"Feature",properties:l(t),geometry:{type:"Point",coordinates:[h(t.x),f(t.y)]}}}function l(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:r}}function u(t){return t/360+.5}function c(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function h(t){return 360*(t-.5)}function f(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function d(t,e){for(var r in e)t[r]=e[r];return t}function p(t){return t.x}function g(t){return t.y}var m=t("kdbush");e.exports=n,i.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var r="prepare "+t.length+" points";e&&console.time(r),this.points=t;var n=t.map(o);e&&console.timeEnd(r);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var a=+Date.now();this.trees[i+1]=m(n,p,g,this.options.nodeSize,Float32Array),n=this._cluster(n,i),e&&console.log("z%d: %d clusters in %dms",i,n.length,+Date.now()-a)}return this.trees[this.options.minZoom]=m(n,p,g,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(u(t[0]),c(t[3]),u(t[2]),c(t[1])),i=[],a=0;a c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128===0){h.length>0&&f.push("}}");var d="vExtra"+h.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),f=["function ",d,"(m,",l.join(),"){switch(m){"],h.push(f)}f.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),m=new Array(r),v=new Array(r),y=0,x=0;xx)&&!(u&1<<_)!=!(u&1<0&&(k="+"+m[b]+"*c");var T=.5*(p[b].length/y),E=.5+.5*(v[b]/y);A.push("d"+b+"-"+E+"-"+T+"*("+p[b].join("+")+k+")/("+g[b].join("+")+")")}f.push("a.push([",A.join(),"]);","break;")}n.push("}},"),h.length>0&&f.push("}}");for(var S=[],u=0;u<1<0&&(f+=.02);for(var p=new Float32Array(h),g=0,m=-.5*f,d=0;d.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=S(t,360),e=S(e,100),r=S(r,100),0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,r){t=S(t,255),e=S(e,255),r=S(r,255);var n,i,a=G(t,e,r),o=H(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function k(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function S(t,r){C(t)&&(t="100%");var n=I(t);return t=H(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function L(t){return H(1,G(0,t))}function z(t){return parseInt(t,16)}function C(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function I(t){return"string"==typeof t&&t.indexOf("%")!=-1}function P(t){return 1==t.length?"0"+t:""+t}function D(t){return t<=1&&(t=100*t+"%"),t}function O(t){return e.round(255*parseFloat(t)).toString(16)}function R(t){return z(t)/255}function F(t){return!!Z.CSS_UNIT.exec(t)}function j(t){t=t.replace(B,"").replace(U,"").toLowerCase();var e=!1;if(Y[t])t=Y[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Z.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(t))?{r:z(r[1]),g:z(r[2]),b:z(r[3]),a:R(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:z(r[1]),g:z(r[2]),b:z(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:z(r[1]+""+r[1]),g:z(r[2]+""+r[2]),b:z(r[3]+""+r[3]),a:R(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.hex3.exec(t))&&{r:z(r[1]+""+r[1]),g:z(r[2]+""+r[2]),b:z(r[3]+""+r[3]),format:e?"name":"hex"}}function N(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var B=/^\s+/,U=/\s+$/,V=0,q=e.round,H=e.min,G=e.max,X=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=E(t),this._roundA=q(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=q(360*t.h),r=q(100*t.s),n=q(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=q(360*t.h),r=q(100*t.s),n=q(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return h(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:q(this._r),g:q(this._g),b:q(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+q(this._r)+", "+q(this._g)+", "+q(this._b)+")":"rgba("+q(this._r)+", "+q(this._g)+", "+q(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:q(100*S(this._r,255))+"%",g:q(100*S(this._g,255))+"%",b:q(100*S(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+q(100*S(this._r,255))+"%, "+q(100*S(this._g,255))+"%, "+q(100*S(this._b,255))+"%)":"rgba("+q(100*S(this._r,255))+"%, "+q(100*S(this._g,255))+"%, "+q(100*S(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(W[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+f(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+f(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){ +return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,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(b,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=D(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return n(s)},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=N(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},n.mostReadable=function(t,e,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var Y=n.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"},W=n.hexNames=T(Y),Z=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],490:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":433}],491:[function(e,r,n){!function(e,i){"object"==typeof n&&"undefined"!=typeof r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.topojson=e.topojson||{})}(this,function(t){"use strict";function e(t,e){var n=e.id,i=e.bbox,a=null==e.properties?{}:e.properties,o=r(t,e);return null==n&&null==i?{type:"Feature",properties:a,geometry:o}:null==i?{type:"Feature",id:n,properties:a,geometry:o}:{type:"Feature",id:n,bbox:i,properties:a,geometry:o}}function r(t,e){function r(t,e){e.length&&e.pop();for(var r=h[t<0?~t:t],n=0,i=r.length;n1)n=i(t,e,r);else for(a=0,n=new Array(o=t.arcs.length);a1)for(var i,a,l=1,u=o(n[0]);lu&&(a=n[0],n[0]=n[l],n[l]=a,u=i);return n})}}var s=function(t){return t},l=function(t){if(null==(e=t.transform))return s;var e,r,n,i=e.scale[0],a=e.scale[1],o=e.translate[0],l=e.translate[1];return function(t,e){return e||(r=n=0),t[0]=(r+=t[0])*i+o,t[1]=(n+=t[1])*a+l,t}},u=function(t){function e(t){s[0]=t[0],s[1]=t[1],o(s),s[0]h&&(h=s[0]),s[1]f&&(f=s[1])}function r(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(r);break;case"Point":e(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(e)}}var n=t.bbox;if(!n){var i,a,o=l(t),s=new Array(2),u=1/0,c=u,h=-u,f=-u;t.arcs.forEach(function(t){for(var e=-1,r=t.length;++eh&&(h=s[0]),s[1]f&&(f=s[1])});for(a in t.objects)r(t.objects[a]);n=t.bbox=[u,c,h,f]}return n},c=function(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r},h=function(t,r){return"GeometryCollection"===r.type?{type:"FeatureCollection",features:r.geometries.map(function(r){return e(t,r)})}:e(t,r)},f=function(t,e){function r(e){var r,n=t.arcs[e<0?~e:e],i=n[0];return t.transform?(r=[0,0],n.forEach(function(t){r[0]+=t[0],r[1]+=t[1]})):r=n[n.length-1],e<0?[r,i]:[i,r]}function n(t,e){for(var r in t){var n=t[r];delete e[n.start],delete n.start,delete n.end,n.forEach(function(t){i[t<0?~t:t]=1}),s.push(n)}}var i={},a={},o={},s=[],l=-1;return e.forEach(function(r,n){var i,a=t.arcs[r<0?~r:r];a.length<3&&!a[1][0]&&!a[1][1]&&(i=e[++l],e[l]=r,e[n]=i)}),e.forEach(function(t){var e,n,i=r(t),s=i[0],l=i[1];if(e=o[s])if(delete o[e.end],e.push(t),e.end=l,n=a[l]){delete a[n.start];var u=n===e?e:e.concat(n);a[u.start=e.start]=o[u.end=n.end]=u}else a[e.start]=o[e.end]=e;else if(e=a[l])if(delete a[e.start],e.unshift(t),e.start=s,n=o[s]){delete o[n.end];var c=n===e?e:n.concat(e);a[c.start=n.start]=o[c.end=e.end]=c}else a[e.start]=o[e.end]=e;else e=[t],a[e.start=s]=o[e.end=l]=e}),n(o,a),n(a,o),e.forEach(function(t){i[t<0?~t:t]||s.push([t])}),s},d=function(t){return r(t,n.apply(this,arguments))},p=function(t){return r(t,o.apply(this,arguments))},g=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 i,a=u(t),o=a[0],s=(a[2]-o)/(e-1)||1,l=a[1],c=(a[3]-l)/(e-1)||1;t.arcs.forEach(function(t){for(var e,r,n,i=1,a=1,u=t.length,h=t[0],f=h[0]=Math.round((h[0]-o)/s),d=h[1]=Math.round((h[1]-l)/c);iMath.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var a=0,o=0,s=0;s<3;++s)a+=t[s]*t[s],o+=i[s]*t[s];for(var s=0;s<3;++s)i[s]-=o/a*t[s];return f(i,i),i}function o(t,e,r,n,i,a,o,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([a]),this.angle=l([o,s]),this.angle.bounds=[[-(1/0),-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;u<16;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.up||[0,1,0],i=t.right||a(r),s=t.radius||1,l=t.theta||0,u=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),f(r,r),i=[].slice.call(i,0,3),f(i,i),"eye"in t){var c=t.eye,p=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];h(i,p,r),n(i[0],i[1],i[2])<1e-6?i=a(r):f(i,i),s=n(p[0],p[1],p[2]);var g=d(r,p)/s,m=d(i,p)/s;u=Math.acos(g),l=Math.acos(m)}return s=Math.log(s),new o(t.zoomMin,t.zoomMax,e,r,i,s,l,u)}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),h=t("gl-vec3/cross"),f=t("gl-vec3/normalize"),d=t("gl-vec3/dot"),p=o.prototype;p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,i=0,a=0,o=0;o<3;++o)a+=e[o]*r[o],i+=e[o]*e[o];for(var s=Math.sqrt(i),l=0,o=0;o<3;++o)r[o]-=e[o]*a/i,l+=r[o]*r[o],e[o]/=s;for(var u=Math.sqrt(l),o=0;o<3;++o)r[o]/=u;var c=this.computedToward;h(c,e,r),f(c,c);for(var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],g=this.computedAngle[1],m=Math.cos(p),v=Math.sin(p),y=Math.cos(g),x=Math.sin(g),b=this.computedCenter,_=m*y,w=v*y,M=x,A=-m*x,k=-v*x,T=y,E=this.computedEye,S=this.computedMatrix,o=0;o<3;++o){var L=_*r[o]+w*c[o]+M*e[o];S[4*o+1]=A*r[o]+k*c[o]+T*e[o],S[4*o+2]=L,S[4*o+3]=0}var z=S[1],C=S[5],I=S[9],P=S[2],D=S[6],O=S[10],R=C*O-I*D,F=I*P-z*O,j=z*D-C*P,N=n(R,F,j);R/=N,F/=N,j/=N,S[0]=R,S[4]=F,S[8]=j;for(var o=0;o<3;++o)E[o]=b[o]+S[2+4*o]*d;for(var o=0;o<3;++o){for(var l=0,B=0;B<3;++B)l+=S[o+4*B]*E[B];S[12+o]=-l}S[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 g=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;g[0]=i[2],g[1]=i[6],g[2]=i[10];for(var a=this.computedUp,o=this.computedRight,s=this.computedToward,l=0;l<3;++l)i[4*l]=a[l],i[4*l+1]=o[l],i[4*l+2]=s[l];c(i,i,n,g);for(var l=0;l<3;++l)a[l]=i[4*l],o[l]=i[4*l+1];this.up.set(t,a[0],a[1],a[2]),this.right.set(t,o[0],o[1],o[2])}},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=(Math.exp(this.computedRadius[0]),a[1]),s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],h=a[4],f=a[8],d=c*o+h*s+f*l;c-=o*d,h-=s*d,f-=l*d;var p=n(c,h,f);c/=p,h/=p,f/=p;var g=c*e+o*r,m=h*e+s*r,v=f*e+l*r;this.center.move(t,g,m,v);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e,r,a){var o=1;"number"==typeof r&&(o=0|r),(o<0||o>3)&&(o=1);var s=(o+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[o],c=e[o+4],h=e[o+8];if(a){var f=Math.abs(l),d=Math.abs(c),p=Math.abs(h),g=Math.max(f,d,p);f===g?(l=l<0?-1:1,c=h=0):p===g?(h=h<0?-1:1,l=c=0):(c=c<0?-1:1,l=h=0)}else{var m=n(l,c,h);l/=m,c/=m,h/=m}var v=e[s],y=e[s+4],x=e[s+8],b=v*l+y*c+x*h;v-=l*b,y-=c*b,x-=h*b;var _=n(v,y,x);v/=_,y/=_,x/=_;var w=c*x-h*y,M=h*v-l*x,A=l*y-c*v,k=n(w,M,A);w/=k,M/=k,A/=k,this.center.jump(t,H,G,X),this.radius.idle(t),this.up.jump(t,l,c,h),this.right.jump(t,v,y,x);var T,E;if(2===o){var S=e[1],L=e[5],z=e[9],C=S*v+L*y+z*x,I=S*w+L*M+z*A;T=R<0?-Math.PI/2:Math.PI/2,E=Math.atan2(I,C)}else{var P=e[2],D=e[6],O=e[10],R=P*l+D*c+O*h,F=P*v+D*y+O*x,j=P*w+D*M+O*A;T=Math.asin(i(R)),E=Math.atan2(j,F)}this.angle.jump(t,E,T),this.recalcMatrix(t);var N=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var q=V[15],H=V[12]/q,G=V[13]/q,X=V[14]/q,Y=Math.exp(this.computedRadius[0]);this.center.jump(t,H-N*Y,G-B*Y,X-U*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,a){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,a=a||this.computedUp;var o=a[0],s=a[1],l=a[2],u=n(o,s,l);if(!(u<1e-6)){o/=u,s/=u,l/=u;var c=e[0]-r[0],h=e[1]-r[1],f=e[2]-r[2],d=n(c,h,f);if(!(d<1e-6)){c/=d,h/=d,f/=d;var p=this.computedRight,g=p[0],m=p[1],v=p[2],y=o*g+s*m+l*v;g-=y*o,m-=y*s,v-=y*l;var x=n(g,m,v);if(!(x<.01&&(g=s*f-l*h,m=l*c-o*f,v=o*h-s*c,x=n(g,m,v),x<1e-6))){g/=x,m/=x,v/=x,this.up.set(t,o,s,l),this.right.set(t,g,m,v),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var b=s*v-l*m,_=l*g-o*v,w=o*m-s*g,M=n(b,_,w);b/=M,_/=M,w/=M;var A=o*c+s*h+l*f,k=g*c+m*h+v*f,T=b*c+_*h+w*f,E=Math.asin(i(A)),S=Math.atan2(T,k),L=this.angle._state,z=L[L.length-1],C=L[L.length-2];z%=2*Math.PI;var I=Math.abs(z+2*Math.PI-S),P=Math.abs(z-S),D=Math.abs(z-2*Math.PI-S);I0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function h(t){return new Int16Array(o(2*t),0,t)}function f(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return b?new Uint8ClampedArray(o(t),0,t):s(t)}function m(t){return new DataView(o(t),0,t)}function v(t){t=y.nextPow2(t);var e=y.log2(t),r=M[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),x=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:x([32,0]),UINT16:x([32,0]),UINT32:x([32,0]),INT8:x([32,0]),INT16:x([32,0]),INT32:x([32,0]),FLOAT:x([32,0]),DOUBLE:x([32,0]),DATA:x([32,0]),UINT8C:x([32,0]),BUFFER:x([32,0])});var b="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=x([32,0])),_.BUFFER||(_.BUFFER=x([32,0]));var w=_.DATA,M=_.BUFFER;r.free=function(t){if(n.isBuffer(t))M[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){M[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return h(t);case"int32":return f(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return v(t);case"data":case"dataview":return m(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=h,r.mallocInt32=f,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=m,r.mallocBuffer=v,r.clearCache=function(){for(var t=0;t<32;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,M[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":54,buffer:64,dup:98}],497:[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;en)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))}},{}],500:[function(t,e,r){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function i(t,e,r){if(t&&u.isObject(t)&&t instanceof n)return t;var i=new n;return i.parse(t,e,r),i}function a(t){return u.isString(t)&&(t=i(t)),t instanceof n?t.format():n.prototype.format.call(t)}function o(t,e){return i(t,!1,!0).resolve(e)}function s(t,e){return t?i(t,!1,!0).resolveObject(e):e}var l=t("punycode"),u=t("./util");r.parse=i,r.resolve=o,r.resolveObject=s,r.format=a,r.Url=n;var c=/^([a-z0-9.+-]+:)/i,h=/:[0-9]*$/,f=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["<",">",'"',"`"," ","\r","\n","\t"],p=["{","}","|","\\","^","`"].concat(d),g=["'"].concat(p),m=["%","/","?",";","#"].concat(g),v=["/","?","#"],y=255,x=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},M={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=t("querystring");n.prototype.parse=function(t,e,r){if(!u.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),i=n!==-1&&n127?"x":D[R];if(!O.match(x)){var j=I.slice(0,E),N=I.slice(E+1),B=D.match(b);B&&(j.push(B[1]),N.unshift(B[2])),N.length&&(s="/"+N.join(".")+s),this.hostname=j.join(".");break}}}this.hostname.length>y?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=l.toASCII(this.hostname));var U=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+U,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!_[p])for(var E=0,P=g.length;E0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return r.search=t.search,r.query=t.query,u.isNull(r.pathname)&&u.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!_.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=_.slice(-1)[0],E=(r.host||t.host||_.length>1)&&("."===T||".."===T)||""===T,S=0,L=_.length;L>=0;L--)T=_[L],"."===T?_.splice(L,1):".."===T?(_.splice(L,1),S++):S&&(_.splice(L,1),S--);if(!x&&!b)for(;S--;S)_.unshift("..");!x||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""), +E&&"/"!==_.join("/").substr(-1)&&_.push("");var z=""===_[0]||_[0]&&"/"===_[0].charAt(0);if(A){r.hostname=r.host=z?"":_.length?_.shift():"";var k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return x=x||r.host&&_.length,x&&!z&&_.unshift(""),_.length?r.pathname=_.join("/"):(r.pathname=null,r.path=null),u.isNull(r.pathname)&&u.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=h.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":501,punycode:446,querystring:450}],501:[function(t,e,r){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],502:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],503:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],504:[function(t,e,r){(function(e,n){function i(t,e){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(e)?n.showHidden=e:e&&r._extend(n,e),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a),l(n,t,n.depth)}function a(t,e){var r=i.styles[e];return r?"\x1b["+i.colors[r][0]+"m"+t+"\x1b["+i.colors[r][1]+"m":t}function o(t,e){return t}function s(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function l(t,e,n){if(t.customInspect&&e&&T(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return x(i)||(i=l(t,i,n)),i}var a=u(t,e);if(a)return a;var o=Object.keys(e),g=s(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),k(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(e);if(0===o.length){if(T(e)){var m=e.name?": "+e.name:"";return t.stylize("[Function"+m+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(A(e))return t.stylize(Date.prototype.toString.call(e),"date");if(k(e))return c(e)}var v="",y=!1,b=["{","}"];if(p(e)&&(y=!0,b=["[","]"]),T(e)){var _=e.name?": "+e.name:"";v=" [Function"+_+"]"}if(w(e)&&(v=" "+RegExp.prototype.toString.call(e)),A(e)&&(v=" "+Date.prototype.toUTCString.call(e)),k(e)&&(v=" "+c(e)),0===o.length&&(!y||0==e.length))return b[0]+v+b[1];if(n<0)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=y?h(t,e,n,g,o):o.map(function(r){return f(t,e,n,g,r,y)}),t.seen.pop(),d(M,v,b)}function u(t,e){if(_(e))return t.stylize("undefined","undefined");if(x(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return y(e)?t.stylize(""+e,"number"):g(e)?t.stylize(""+e,"boolean"):m(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var a=[],o=0,s=e.length;o-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")),_(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.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 d(t,e,r){var n=0,i=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function p(t){return Array.isArray(t)}function g(t){return"boolean"==typeof t}function m(t){return null===t}function v(t){return null==t}function y(t){return"number"==typeof t}function x(t){return"string"==typeof t}function b(t){return"symbol"==typeof t}function _(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===S(t)}function M(t){return"object"==typeof t&&null!==t}function A(t){return M(t)&&"[object Date]"===S(t)}function k(t){return M(t)&&("[object Error]"===S(t)||t instanceof Error)}function T(t){return"function"==typeof t}function E(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function S(t){return Object.prototype.toString.call(t)}function L(t){return t<10?"0"+t.toString(10):t.toString(10)}function z(){var t=new Date,e=[L(t.getHours()),L(t.getMinutes()),L(t.getSeconds())].join(":");return[t.getDate(),O[t.getMonth()],e].join(" ")}function C(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var I=/%[sdj%]/g;r.format=function(t){if(!x(t)){for(var e=[],r=0;r=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}}),s=n[r];r>3}if(i--,1===n||2===n)a+=t.readSVarint(),o+=t.readSVarint(),1===n&&(e&&s.push(e),e=[]),e.push(new l(a,o));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&s.push(e),s},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,u=-(1/0);t.pos>3}if(n--,1===r||2===r)i+=t.readSVarint(),a+=t.readSVarint(),is&&(s=i),au&&(u=a);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,u]},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}var o=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 o(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":507}],509:[function(t,e,r){"use strict";function n(t,e){return"object"==typeof e&&null!==e||(e={}),i(t,e.canvas||a,e.context||o,e)}e.exports=n;var i=t("./lib/vtext"),a=null,o=null;"undefined"!=typeof document&&(a=document.createElement("canvas"),a.width=8192,a.height=1024,o=a.getContext("2d"))},{"./lib/vtext":510}],510:[function(t,e,r){"use strict";function n(t,e,r){for(var n=e.textAlign||"start",i=e.textBaseline||"alphabetic",a=[1<<30,1<<30],o=[0,0],s=t.length,l=0;l8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height>31}function l(t){for(var e=[],r=0,n=0,i=t.length,a=0;a=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function o(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),!(e<0)&&(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof b||a();var s=[],l=[],u=x++;return Object.create(b.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(o)}})};b.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||!!c&&c.has___(t)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof b||a();var l,u=new s,c=void 0,h=!1;return l=o?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new b),c.set(t,e)),this}:function(t,e){if(h)try{u.set(t,e)}catch(r){c||(c=new b),c.set___(t,e)}else u.set(t,e);return this},Object.create(b.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");h=!0})}})}o&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=b.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=b)}}()},{}],515:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":516}],516:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],517:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":515}],518:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":119}],519:[function(t,e,r){var n=arguments[3],i=arguments[4],a=arguments[5],o=JSON.stringify;e.exports=function(t,e){function r(t){m[t]=!0;for(var e in i[t][1]){var n=i[t][1][e];m[n]||r(n)}}for(var s,l=Object.keys(a),u=0,c=l.length;u= 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":91}],523:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":522}],524:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("opacity"),u("align"),u("bgcolor");var h=u("bordercolor"),f=i.opacity(h);u("borderpad");var d=u("borderwidth"),p=u("showarrow");u("text",p?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font);for(var g=["x","y"],m=[-10,-30],v={_fullLayout:r},y=0;y<2;y++){var x=g[y],b=a.coerceRef(t,e,v,x,"","paper");if(a.coercePosition(e,v,u,b,x,.5),p){var _="a"+x,w=a.coerceRef(t,e,v,_,"pixel");"pixel"!==w&&w!==b&&(w=e[_]="pixel");var M="pixel"===w?m[y]:.4;a.coercePosition(e,v,u,w,_,M)}else u(x+"anchor")}return n.noneOrAll(t,e,["x","y"]),p&&(u("arrowcolor",f?e.bordercolor:i.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(f&&d||1)),n.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":633,"../../plots/cartesian/axes":664,"../color":533,"./attributes":526}],525:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],526:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":626,"../../plots/cartesian/constants":669,"../../plots/font_attributes":684,"./arrow_paths":525}],527:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,h=s-l,f=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),h=Math.max(h,d),f=Math.max(f,d)}r&&r.autorange&&a.expand(r,[r.l2c(r.r2l(e.x))],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(n.r2l(e.y))],{ppadplus:f,ppadminus:h})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":633,"../../plots/cartesian/axes":664,"./draw":529}],528:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),i=t("./annotation_defaults");e.exports=function(t,e){var r={name:"annotations",handleItemDefaults:i};n(t,e,r)}},{"../../plots/array_container_defaults":661,"./annotation_defaults":524}],529:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=K.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,v=Math.round(u+2*tt),y=Math.round(p+2*tt);H._w=u,H._h=p;var b=!1;if(["x","y"].forEach(function(e){var n,i=H[e+"ref"]||e,a=h.getFromId(t,i),o=(W+("x"===e?0:90))*Math.PI/180,s=v*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=H[e+"anchor"];if(a){var u=a.r2fraction(H[e]);if(!a.autorange&&(u<0||u>1)&&(H["a"+e+"ref"]===i?(u=a.r2fraction(H["a"+e]), +(u<0||u>1)&&(b=!0)):b=!0,b))return;Y[e]=a._offset+a.r2p(H[e]),n=.5}else n=H[e],"y"===e&&(n=1-n),Y[e]="x"===e?C.l+C.w*n:C.t+C.h*n;var c=0;H["a"+e+"ref"]===i?Y["aa"+e]=a._offset+a.r2p(H["a"+e]):(c=H.showarrow?H["a"+e]:s*r(n,l),Y[e]+=c),H["_"+e+"type"]=a&&a.type,H["_"+e+"size"]=s,H["_"+e+"shift"]=c}),b)return void K.remove();var _,w;H.showarrow&&(_=H.axref===H.xref?Y.x:c.constrain(Y.x-H.ax,1,A.width-1),w=H.ayref===H.yref?Y.y:c.constrain(Y.y-H.ay,1,A.height-1)),Y.x=c.constrain(Y.x,1,A.width-1),Y.y=c.constrain(Y.y,1,A.height-1);var M=tt-s.top,k=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:k,y:M}),nt.selectAll("tspan.line").attr({y:M,x:k})),et.call(d.setRect,$/2,$/2,v-$,y-$);var T=0,E=0;T=H.axref===H.xref?Math.round(Y.aax-v/2):Math.round(Y.x-v/2),E=H.ayref===H.yref?Math.round(Y.aay-y/2):Math.round(Y.y-y/2),K.call(c.setTranslate,T,E);var S="annotations["+e+"]",L=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=H.axref===H.xref?Y.aax+r:Y.x+r,s=H.ayref===H.yref?Y.aay+n:Y.y+n;var u=c.rotationXYMatrix(W,i,s),h=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,v=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!v.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=H.arrowwidth,b=H.arrowcolor,M=Z.append("g").style({opacity:f.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),A=M.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(f.stroke,f.rgb(b));x(A,H.arrowhead,"end",H.arrowsize);var k=M.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,L;m.init({element:k.node(),prepFn:function(){var t=c.getTranslate(K);E=t.x,L=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){M.attr("transform","translate("+t+","+e+")");var r=h(E,L),n=r[0]+t,i=r[1]+e;K.call(c.setTranslate,n,i),T[S+".x"]=G?G.p2r(G.r2p(H.x)+t):(_+t-C.l)/C.w,T[S+".y"]=X?X.p2r(X.r2p(H.y)+e):1-(w+e-C.t)/C.h,H.axref===H.xref&&(T[S+".ax"]=G?G.p2r(G.r2p(H.ax)+t):(_+t-C.l)/C.w),H.ayref===H.yref&&(T[S+".ay"]=X?X.p2r(X.r2p(H.ay)+e):1-(w+e-C.t)/C.h),Q.attr({transform:"rotate("+W+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};H.showarrow&&L(0,0);var z=c.rotationXYMatrix(W,Y.x,Y.y),I=c.apply2DTransform(z);if(t._context.editable){var P,D,O;m.init({element:K.node(),prepFn:function(){var t=c.getTranslate(K);P=t.x,D=t.y,O={}},moveFn:function(t,e){K.call(c.setTranslate,P+t,D+e);var r="pointer";if(H.showarrow)H.axref===H.xref?O[S+".ax"]=G.p2r(G.r2p(H.ax)+t):O[S+".ax"]=H.ax+t,H.ayref===H.yref?O[S+".ay"]=X.p2r(X.r2p(H.ay)+e):O[S+".ay"]=H.ay+e,L(t,e);else{if(G)O[S+".x"]=H.x+t/G._m;else{var n=H._xsize/C.w,i=H.x+H._xshift/C.w-n/2;O[S+".x"]=m.align(i+t/C.w,n,0,1,H.xanchor)}if(X)O[S+".y"]=H.y+e/X._m;else{var a=H._ysize/C.h,o=H.y-H._yshift/C.h-a/2;O[S+".y"]=m.align(o-e/C.h,a,0,1,H.yanchor)}G&&X||(r=m.getCursor(G?.5:O[S+".x"],X?.5:O[S+".y"],H.xanchor,H.yanchor))}var s=I(P,D),l=s[0]+t,u=s[1]+e;K.call(c.setTranslate,P+t,D+e),Q.attr({transform:"rotate("+W+","+l+","+u+")"}),g(K,r)},doneFn:function(e){if(g(K),e){l.relayout(t,O);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,M=t.layout,A=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return M.annotations=u,y(M,A),void n(t);if("remove"===u)return delete M.annotations,A.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)A._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}A._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=M.annotations[e],E=A.annotations[e];if(T){var S={};"string"==typeof r&&r?S[r]=u:c.isPlainObject(r)&&(S=r);var L=Object.keys(S);for(w=0;w4/3&&(F=V)}}else R&&(N&&(F<1/3?F+=U:F>2/3&&(F-=U)),F=(F-R.domain[0])/(R.domain[1]-R.domain[0]),F=R.fraction2r(F))}R&&R===O&&j&&("log"===j&&"log"!==R.type?F=Math.pow(10,F):"log"!==j&&"log"===R.type&&(F=F>0?Math.log(F)/Math.LN10:void 0)),T[D]=F}}var H={};v(T,H,A),A.annotations[e]=H;var G=h.getFromId(t,H.xref),X=h.getFromId(t,H.yref),Y={x:0,y:0},W=+H.textangle||0,Z=A._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",H.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:H})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),K=Q.append("g"),$=H.borderwidth,J=H.borderpad,tt=$+J,et=K.append("rect").attr("class","bg").style("stroke-width",$+"px").call(f.stroke,H.bordercolor).call(f.fill,H.bgcolor),rt=H.font,nt=K.append("text").classed("annotation",!0).attr("data-unformatted",H.text).text(H.text);t._context.editable?nt.call(p.makeEditable,K).call(b).on("edit",function(r){H.text=r,this.attr({"data-unformatted":H.text}),this.call(b);var n={};n["annotations["+e+"].text"]=H.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(b),Q.attr({transform:"rotate("+W+","+Y.x+","+Y.y+")"}).call(d.setPosition,Y.x,Y.y)}}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,h=n-e,f=a-e,d=s-a,p=l*d-c*h;if(0===p)return null;var g=(u*d-c*f)/p,m=(u*h-l*f)/p;return m<0||m>1||g<0||g>1?null:{x:t+l*g,y:e+h*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),h=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":633,"../../lib/setcursor":643,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/cartesian/axes":664,"../../plots/plots":724,"../color":533,"../dragelement":554,"../drawing":556,"./annotation_defaults":524,"./defaults":528,"./draw_arrow_head":530,d3:95,"fast-isnumeric":104}],530:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var h,f,d,p,g=(o.getPx(t,"stroke-width")||1)*l,m=t.style("stroke")||a.defaultLine,v=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,x=r.indexOf("end")>=0,b=c.backoff*g;if("line"===u.nodeName){if(h={x:+t.attr("x1"),y:+t.attr("y1")},f={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(h.y-f.y,h.x-f.x),p=d+Math.PI,b){var _=b*Math.cos(d),w=b*Math.sin(d);y&&(h.x-=_,h.y-=w,t.attr({x1:h.x,y1:h.y})),x&&(f.x+=_,f.y+=w,t.attr({x2:f.x,y2:f.y}))}}else if("path"===u.nodeName){var M=u.getTotalLength(),A="";if(y){var k=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(k.y-T.y,k.x-T.x),h=u.getPointAtLength(Math.min(b,M)),b&&(A="0px,"+b+"px,")}if(x){var E=u.getPointAtLength(M),S=u.getPointAtLength(M-.1);if(p=Math.atan2(E.y-S.y,E.x-S.x),f=u.getPointAtLength(Math.max(0,M-b)),b){var L=A?2*b:b;A+=M-L+"px,"+M+"px"}}else A&&(A+=M+"px");A&&t.style("stroke-dasharray",A)}var z=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&z(h,d),x&&z(f,p)}}},{"../color":533,"../drawing":556,"./arrow_paths":525,d3:95,"fast-isnumeric":104}],531:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":526,"./calc_autorange":527,"./defaults":528,"./draw":529}],532:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],533:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var h=at.select(".cbfills").selectAll("rect.cbfill").data(z);h.enter().append("rect").classed("cbfill",!0).style("stroke","none"),h.exit().remove(),h.each(function(t,e){var r=[0===e?S[0]:(z[e]+z[e-1])/2,e===z.length-1?S[1]:(z[e]+z[e+1])/2].map(J.c2p).map(Math.round);e!==z.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=I(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({x:Y,width:Math.max(B,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var f=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?L:[]);return f.enter().append("path").classed("cbline",!0),f.exit().remove(),f.each(function(t){n.select(this).attr("d","M"+Y+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+B).call(d.lineGroupStyle,_.line.width,C(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=Y+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));M("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:k.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,r){var n,i=b();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,h(a,r||{}))}function A(){var r=B+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(F=ot.select("text"),F.node()&&!F.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-Y-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-K;at.select(".cbbg").attr({x:Y-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:K-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:Y,y:K+_.ypad+("top"===_.titleside?st:0),width:Math.max(B,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var k=t._fullLayout,T=k._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void k._infolayer.selectAll("g."+e).remove();var E,S=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),L=[],z=[],C="function"==typeof _.line.color?_.line.color:function(){return _.line.color},I="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},P=_.levels.end+_.levels.size/100,D=_.levels.size,O=1.001*S[0]-.001*S[1],R=1.001*S[1]-.001*S[0];for(E=_.levels.start;(E-P)*D<0;E+=D)E>O&&ES[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+q-X],J.setScale();var at=k._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+H)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+q-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,M(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ht=c.syncOrAsync([o.previousPromises,w,o.previousPromises,A],t);if(ht&&ht.then&&(t._promises||[]).push(ht),t._context.editable){var ft,dt,pt;u.init({element:at.node(),prepFn:function(){ft=at.attr("transform"),f(at)},moveFn:function(t,e){at.attr("transform",ft+" translate("+t+","+e+")"),dt=u.align(W+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,q,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);f(at,r)},doneFn:function(e){f(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},b().index)}})}return ht}function b(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=f,s.reversescale&&(f=a(f)),s.colorscale=f)}},{"../../lib":633,"./flip_scale":544,"./scales":551}],540:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":626,"./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,u,c){var h=c.prefix,f=c.cLetter,d=h.slice(0,h.length-1),p=h?i.nestedProperty(t,d).get()||{}:t,g=h?i.nestedProperty(e,d).get()||{}:e,m=p[f+"min"],v=p[f+"max"],y=p.colorscale,x=n(m)&&n(v)&&m=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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):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(Array.isArray(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":633}],554:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,h=(new Date).getTime(),h-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,h,f,d,p,g=o.getPlotDiv(t.element)||{},m=1,v=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":633,"../../plotly":659,"../../plots/cartesian/constants":669,"./align":552,"./cursor":553,"./unhover":555}],555:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":625}],556:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,h,f;t.so?(f=o.outlierwidth,h=o.outliercolor,c=a.outliercolor):(f=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,h="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(f||1)+"px",fill:"none"}):(e.style("stroke-width",f+"px").call(l.fill,c),f&&e.call(l.stroke,h))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),h=(c*c*i-u*u*s)*n,f=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&h/d),2),a.round(e[1]+(d&&f/d),2)],[a.round(e[0]-(p&&h/p),2),a.round(e[1]-(p&&f/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),h=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=g.tryColorscale(i,""),s=g.tryColorscale(i,"line");n(t,e,r,o,s,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),i=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,a.select(this),e,n,i)})}},g.tryColorscale=function(t,e){var r=e?c.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):c.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(h.convertToTspans);var f=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*b+1,m=x[l]*c,v=.75*u+x[s]*c+(x[s]-1)*p*u/2;f.attr("transform","translate("+m+","+v+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=k&&(a.selectAll("[data-bb]").attr("data-bb",null),A=[]),t.setAttribute("data-bb",A.length),A.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":618,"../../lib":633,"../../lib/svg_text_utils":647,"../../registry":739,"../../traces/scatter/make_bubble_size_func":861,"../../traces/scatter/subtypes":866,"../color":533,"../colorscale":547,"./symbol_defs":557,d3:95,"fast-isnumeric":104}],557:[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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),h=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+h+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:95}],558:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],559:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),h=0;h0;t.each(function(t){var e,h=t[0].trace,f=h.error_x||{},d=h.error_y||{};h.ids&&(e=function(t){return t.id});var p=o.hasMarkers(h)&&h.marker.maxdisplayed>0;if(d.visible||f.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().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),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var h;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;h="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(h+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");s=!m.size(),s?m=e.append("path").classed("yerror",!0):c&&(m=m.transition().duration(r.duration).ease(r.easing)),m.attr("d",h)}if(f.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var v=(f.copy_ystyle?d:f).width;h="M"+o.xh+","+(o.y-v)+"v"+2*v+"m0,-"+v+"H"+o.xs,o.noXS||(h+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",h)}}})}})}},{"../../traces/scatter/subtypes":866,d3:95,"fast-isnumeric":104}],564:[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":533,d3:95}],565:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":669}],566:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}var o=n("source"),l=n("visible",!!o);if(!l)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var u={_fullLayout:r},c=["x","y"],h=0;h<2;h++)a.coerceRef(t,e,u,c[h],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var r={name:l,handleItemDefaults:n};o(t,e,r)}},{"../../lib":633,"../../plots/array_container_defaults":661,"../../plots/cartesian/axes":664,"./attributes":565}],567:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,h=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,f=c*d.x[e.xanchor].offset,p=h*d.y[e.yanchor].offset,g=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,m=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+f,v=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:m,y:v,width:c,height:h,preserveAspectRatio:g,opacity:e.opacity});var y=o?o._id:"",x=l?l._id:"",b=y+x;b&&r.call(i.setClipUrl,"clip"+s._uid+b)}for(var s=t._fullLayout,l=[],u=[],c=[],h=0;h=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}},{}],570:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":626,"../../plots/font_attributes":684,"../color/attributes":532}],571:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],572:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,h,f,d=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(u=0,h="left",c=1.1,f="bottom"):(u=0,h="left",c=-.1,f="top")}l("traceorder",m),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",h),l("y",c),l("yanchor",f),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":633,"../../plots/layout_attributes":715,"../../registry":739,"./attributes":570,"./helpers":575}],573:[function(t,e,r){"use strict";function n(t,e){function r(r){v.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,h=t.selectAll("text.legendtext").data([0]);h.enter().append("text").classed("legendtext",!0),h.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?h.call(v.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):h.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var h=a.label,f=r.indexOf(h);f===-1?r.push(h):r.splice(f,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),f=c[0].length||1;r=s*f,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-f)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){h.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;h.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,f=l.length;cn.width-(n.margin.r+n.margin.l)&&(x=0,m+=v,i.height=i.height+v,v=0),h.setTranslate(this,a+x,5+a+e.height/2+m),i.width+=o+r,i.height=Math.max(i.height,e.height),x+=o+r,v=Math.max(e.height,v)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),f.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),f.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),h=t("../../lib"),f=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(h.setTranslate,0,e),S.call(g.setRect,N,t,y.scrollBarWidth,y.scrollBarHeight),k.select("rect").attr({y:v.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var v=r.legend,_=r.showlegend&&x(t.calcdata,v),M=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void f.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var T=A.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var E=A.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var S=A.selectAll("rect.scrollbar").data([0]);S.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var L=E.selectAll("g.groups").data(_);L.enter().append("g").attr("class","groups"),L.exit().remove();var z=L.selectAll("g.traces").data(h.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var C=0!==A.enter().size();C&&(o(t,L,z),s(t));var I=0,P=r.width,D=0,O=r.height;o(t,L,z),v.height>O?l(t):s(t);var R=r._size,F=R.l+R.w*v.x,j=R.t+R.h*(1-v.y);w.isRightAnchor(v)?F-=v.width:w.isCenterAnchor(v)&&(F-=v.width/2),w.isBottomAnchor(v)?j-=v.height:w.isMiddleAnchor(v)&&(j-=v.height/2);var N=v.width,B=R.w;N>B?(F=R.l,N=B):(F+N>P&&(F=P-N),FV?(j=R.t,U=V):(j+U>O&&(j=O-U),jr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),f=d.hasLines(o);if(s||u||f){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),f&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var m=l.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(s?n:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(h.pointStyle,i),s&&(n[0].mrc=3);var y=m.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(h.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(f.fill,t.mc||r.color),e&&i.call(f.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(f.fill,t.fc||e.fillcolor),r&&n.call(f.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),h=t("../drawing"),f=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":633,"../../registry":739,"../../traces/pie/style_one":840,"../../traces/scatter/subtypes":866,"../color":533,"../drawing":556,d3:95}],578:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,f=(1+c)/2,d=(1-c)/2,p=h.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(m,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=i(s),y=[];return((u||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||v||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(m,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var m=c("bgcolor");c("activecolor",o.contrast(m,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":633,"../color":533,"./attributes":582,"./button_attributes":583,"./constants":584}],586:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=f)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)f(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,L)},i=L.line.width?L.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",L.opacity).call(_.stroke,i).call(_.fill,L.fillcolor).call(w.dashLine,L.line.dash,L.line.width);z&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&h(t,a,L,e)}var a,o;f(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:x.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>Y&&!t.shiftKey?M.getCursor(i/r,1-a/n):"move";A(e,o),G=o.split("-")[0]}function a(e){N=b.getFromId(t,r.xref),B=b.getFromId(t,r.yref),U=T.getDataToPixel(t,N),V=T.getDataToPixel(t,B,!0),q=T.getPixelToData(t,N),H=T.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(F=r.path,j=a+".path"):(c=U(r.x0),h=V(r.y0),f=U(r.x1),d=V(r.y1),g=a+".x0",v=a+".y0",x=a+".x1",_=a+".y1"),cY&&(u[L]=r[P]=H(s),u[z]=r[D]=H(l)),h-c>X&&(u[C]=r[O]=q(c),u[I]=r[R]=q(h))}e.attr("d",p(t,r))}var u,c,h,f,d,g,v,x,_,w,k,E,S,L,z,C,I,P,D,O,R,F,j,N,B,U,V,q,H,G,X=10,Y=10,W={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=W.element.getBoundingClientRect();M.init(W)}function f(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=b.getFromId(t,r.id,"x")._id,i=b.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=b.getFromId(t,e.xref),l=b.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),h=n(e.x1),f=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+f+"L"+h+","+d;if("rect"===o)return"M"+c+","+f+"H"+h+"V"+d+"H"+c+"Z";var p=(c+h)/2,m=(f+d)/2,v=Math.abs(p-c),y=Math.abs(m-f),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),i+l})}function m(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),M=t("../dragelement"),A=t("../../lib/setcursor"),k=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),S=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":633,"../../lib/setcursor":643,"../../plotly":659,"../../plots/cartesian/axes":664,"../color":533,"../dragelement":554,"../drawing":556,"./constants":596,"./defaults":597,"./helpers":599,"./shape_defaults":601,"fast-isnumeric":104}],599:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],600:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":594,"./calc_autorange":595,"./defaults":597,"./draw":598}],601:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var h=t.path?"path":"rect",f=u("type",h),d=["x","y"],p=0;p<2;p++){var g=d[p],m={_fullLayout:r},v=i.coerceRef(t,e,m,g,"","paper");if("path"!==f){var y,x,b,_=.25,w=.75;"paper"!==v?(y=i.getFromId(m,v),b=o.rangeToShapePosition(y),x=o.shapePositionToRange(y)):x=b=n.identity;var M=g+"0",A=g+"1",k=t[M],T=t[A];t[M]=x(t[M],!0),t[A]=x(t[A],!0),i.coercePosition(e,m,u,v,M,_),i.coercePosition(e,m,u,v,A,w),e[M]=b(e[M]),e[A]=b(e[A]),t[M]=k,t[A]=T}}return"path"===f?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":633,"../../plots/cartesian/axes":664,"./attributes":594,"./helpers":599}],602:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":626,"../../plots/animation_attributes":660,"../../plots/font_attributes":684,"../../plots/pad_attributes":723,"./constants":603}],603:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],604:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*L.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+L.stepInset+(t.inputAreaLength-2*L.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-L.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*L.stepInset-2*t.inputAreaStart)))}function x(t,e,r){var n=t.selectAll("rect."+L.railTouchRectClass).data([0]);n.enter().append("rect").classed(L.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,L.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),A.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+L.railRectClass).data([0]);r.enter().append("rect").classed(L.railRectClass,!0);var n=e.inputAreaLength-2*L.railInset;r.attr({width:n,height:L.railWidth,rx:L.railRadius,ry:L.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(r,L.railInset,.5*(e.inputAreaWidth-L.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(L.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+L.groupClassName).data(r,i);l.enter().append("g").classed(L.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,L.autoMarginIdRoot+e._index)});for(var u=0;u0||f<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,S=!0,L=C,M._infolayer.select("."+e).attr({"data-unformatted":L}).text(L).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,m=r.propName,v=r.traceIndex,y=r.dfltName,x=r.avoid||{},b=r.attributes,_=r.transform,w=r.containerGroup,M=t._fullLayout,A=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,S=!1,L=g.title.trim(); +""===L&&(E=0),L.match(/Click to enter .+ title/)&&(E=.2,S=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(L).attr("class",e),z.attr({"data-unformatted":L}).call(h);var C="Click to enter "+y+" title";t._context.editable?(L||p(),z.call(c.makeEditable).on("edit",function(e){void 0!==v?a.restyle(t,m,e,v):a.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):L&&!L.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",S)}},{"../../lib":633,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/plots":724,"../color":533,"../drawing":556,d3:95,"fast-isnumeric":104}],608:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":626,"../../plots/font_attributes":684,"../../plots/pad_attributes":723,"../color/attributes":532}],609:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],610:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var h=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);h.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&h.call(v).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){x.select(this).remove(),h.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],618:[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}},{}],619:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":531,"./components/images":568,"./components/legend":576,"./components/rangeselector":588,"./components/rangeslider":593,"./components/shapes":600,"./components/sliders":606,"./components/updatemenus":612,"./fonts/mathjax_config":620,"./lib/queue":641,"./plot_api/plot_schema":653,"./plot_api/register":654,"./plot_api/set_plot_config":655,"./plot_api/to_image":657,"./plot_api/validate":658,"./plotly":659,"./snapshot":744,"./snapshot/download":741,"./traces/scatter":856,d3:95,"es6-promise":101}],620:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],621:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],622:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":616,"fast-isnumeric":104}],623:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var m=(new Date).getFullYear();e=((Number(u[0])-m+70)%100+200)%100+m-70}if(!a(e))return l;var v=new Date(0,0,1);if(v.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(v.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(v.setDate(i),v.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(v.setHours(o),v.getHours()!==o)return l;if(u.length>1)return i=v.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=h*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*f:l)):l}}}return v.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,m=3*c,v=5*h;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e0&&(n.push(i),i=[])}return n.push(i),n},r.makeLine=function(t,e){var r={};return r=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(r.trace=e),r},r.makePolygon=function(t,e){var r={};if(1===t.length)r={type:"Polygon",coordinates:t};else{for(var n=new Array(t.length),i=0;i",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":622, +"./coerce":623,"./dates":624,"./extend":626,"./filter_unique":627,"./filter_visible":628,"./is_array":634,"./is_plain_object":635,"./loggers":636,"./matrix":637,"./nested_property":638,"./notifier":639,"./search":642,"./stats":645,d3:95}],634:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],635:[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}},{}],636:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,f(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(f(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric"),f=t("./is_array");e.exports=function(t,e){if(h(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,h,f,d,p=n.length,g=n[0][0],m=n[0][1],v=0;for(u=1;uMath.max(c,g)||l>Math.max(h,m)))if(lc||Math.abs(n(o,f))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":637}],641:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,h=0,f=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;h90&&l.log("Long binary search..."),h-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":104}],646:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:33,tinycolor2:489}],647:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+f.randstr([],64),a=h.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=h.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())f.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,m.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var h=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var h=t("d3"),f=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");h.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(f.log(r.querySelector("parsererror div").textContent),null):h.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=h.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=h.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var m=f.getPlotDiv(s.node());(m&&m._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var h=n(l,"width"),f=n(l,"height"),g=+s.attr("x")-h*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],m=parseInt(s.style("font-size"),10)||n(s,"height"),v=-m/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-h/2,v-f/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:v-f/2}):"a"===p[0]?l.attr({x:0,y:v}):l.attr({x:g,y:+s.attr("y")+v-f/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(v," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=h.select(f.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=h.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;h.select(this).transition().duration(0).remove(),h.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;h.select(document).on("mouseup",function(){return h.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===h.event.which?(o.style({opacity:1}),h.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),h.select(this).call(c(o,e,r)))}).on("keydown",function(){13===h.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=h.dispatch("edit","input","cancel"),l=h.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),h.rebind(this,s,"on")}},{"../constants/string_mappings":617,"../constants/xmlns_namespaces":618,"../lib":633,d3:95}],648:[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":686,"topojson-client":491}],649:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0&&u.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);var i=h.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lC.range[0]?[1,2]:[2,1]);else{var I=C.range[0],P=C.range[1];"log"===b?(I<=0&&P<=0&&r(E+".autorange",!0),I<=0?I=P/1e6:P<=0&&(P=I/1e6),r(E+".range[0]",Math.log(I)/Math.LN10),r(E+".range[1]",Math.log(P)/Math.LN10)):(r(E+".range[0]",Math.pow(10,I)),r(E+".range[1]",Math.pow(10,P)))}else r(E+".autorange",!0)}if("reverse"===k)S.range?S.range.reverse():(r(E+".autorange",!0),S.range=[1,0]),L.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var D=v.parts[1],O=v.parts[0],R=a[O]||[],F=R[D]||{};2===v.parts.length&&(null===b&&(e[m]="remove"),"add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?D===-1?(g[O]=R,delete g[m]):g[m]=F:x.log("???",e)),!n(F,"x")&&!n(F,"y")||x.containsAny(m,["color","opacity","align","dash"])||(d.docalc=!0);var j=w.getComponentMethod(O,"drawOne");j(t,D,v.parts.slice(2).join("."),e[m]),delete e[m]}else if(M.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])z.manageArrayContainers(v,b,g),d.doplot=!0;else{var N=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?d.doplot=!0:0===v.parts[0].indexOf("geo")?d.doplot=!0:0===v.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===m?d.doplot=!0:!o._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?d.docalc=!0:v.parts[0].indexOf("legend")!==-1?d.dolegend=!0:m.indexOf("title")!==-1?d.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(N,["tick","exponent","grid","zeroline"])?d.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:v.parts.length>1&&N.indexOf("line")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&"mirror"===N?d.doticks=d.dolayoutstyle=!0:"margin.pad"===m?d.doticks=d.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(d.doplot=!0):d.doplot=!0,v.set(b)}}}var B=t._fullLayout.width,U=t._fullLayout.height;M.supplyDefaults(t),t.layout.autosize&&M.plotAutoSize(t,t.layout,t._fullLayout);var V=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==U;return V&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];m.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=x.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(S.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),M=t("../plots/plots"),A=t("../plots/cartesian/graph_interact"),k=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),S=t("../constants/xmlns_namespaces"),L=t("../lib/svg_text_utils"),z=t("./helpers"),C=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=I._basePlotModules,r=0;r=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=z.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=M.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function h(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function g(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var m,v,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),A=!_&&!w&&x.isPlainObject(e);if(A)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&EE)&&S.push(v);b=S}}b.length>0?h(b):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=z.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:M.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=M.modifyFrames,l=M.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),M.modifyFrames(t,a)},y.purge=function(t){t=z.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return M.cleanPlot([],{},r,e),M.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":556,"../components/errorbars":562,"../constants/xmlns_namespaces":618,"../lib":633,"../lib/events":625,"../lib/queue":641,"../lib/svg_text_utils":647,"../plotly":659,"../plots/cartesian/graph_interact":671,"../plots/plots":724,"../plots/polar":727,"../registry":739,"./helpers":650,"./subroutines":656,d3:95,"fast-isnumeric":104}],652:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],653:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=f.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};_(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return _(t,g),Object.keys(f.subplotsRegistry).forEach(function(e){var r=f.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)c(t,r,"xaxis"),c(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;c(t,r,n)}}),t=u(t),Object.keys(f.componentsRegistry).forEach(function(e){var r=f.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){h(t,r,e+r.name)}):h(t,r,r.name))}),{layoutAttributes:o(t)}}function a(t){var e=f.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):t.arrayOk===!0&&(i[n+"src"]=e(n)):d.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function l(t){function e(t,e,r){if(t){var n=t[M];n&&(delete t[M],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function c(t,e,r){var n=d.nestedProperty(t,r),i=_({},e.layoutAttributes);i[w]=!0,n.set(i)}function h(t,e,r){var n=d.nestedProperty(t,r),i=_(n.get()||{},e.layoutAttributes);n.set(i)}var f=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=d.extendFlat,_=d.extendDeep,w="_isSubplotObj",M="_isLinkedToArray",A="_deprecated",k=[w,M,A];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=M,r.DEPRECATED=A,r.UNDERSCORE_ATTRS=k,r.get=function(){var t={};f.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(f.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:k.concat.role},traces:t,layout:i(),transforms:e,frames:o(m),animation:o(v)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];k.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||d.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){a=a.slice(0,s).concat([r]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=n(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};f(e.width)&&f(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(h).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":633,"../plotly":659,"../snapshot/cloneplot":740,"../snapshot/helpers":743,"../snapshot/svgtoimg":745,"../snapshot/tosvg":747,"fast-isnumeric":104}],658:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),f=0;f1&&l.push(o("object","layout"))),f.supplyDefaults(u);for(var c=u._fullData,m=r.length,v=0;vc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=z&&i<=10||e>=15*z)t._tickround="d";else if(e>=I&&i<=16||e>=C)t._tickround="M";else if(e>=P&&i<=19||e>=I)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(x(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(W),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(W,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(x(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=V(c):"m"===l?a=q(c):"d"===l?(r||(i="
"+V(c)),a=H(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=Y(c),"S"!==l&&(a+=f(y.round(v(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=H(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=f(Math.pow(10,o),t,i,n);else if(x(a)||"D"===a.charAt(0)&&v(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=f(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,v(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function h(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=f(e.x,t,i,n)}function f(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var h={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(h),o=(Number(h._tickround)||0)+4,l=h._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},D.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&h/c>f&&(l=o,u=s,f=h/c);if(n===i){var g=n-1,m=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else f&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-f*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),f=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-f*l.pad,u.val+f*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r.map(t.l2r||Number)},D.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=D.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},D.saveRangeInitial=function(t,e){for(var r=D.list(t,"",!0),n=!1,i=0;i=f?d=!1:s.val>=u&&s.pad<=f&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:f})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=h?d=!1:s.val<=c&&s.pad<=h&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:h})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,h,f,d,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=m-1;a>5;a--)i(a)}},D.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/h.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var h;h="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},D.autoTicks(h,s);var f,d=D.tickIncrement(D.tickFirst(h),h.dtick,"reverse");if("number"==typeof h.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||i(a)||i(o))){var w=h.dtick/2;d+=d+w0&&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),a(t),t._tmin=D.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=D.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),h=0;hS?(e/=S,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,R)):n>L?(e/=L,t.dtick="M"+i(e,1,F)):n>z?(t.dtick=i(e,z,N),t.tick0="2000-01-02"):n>C?t.dtick=i(e,C,F):n>I?t.dtick=i(e,I,j):n>P?t.dtick=i(e,P,j):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,R))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,R)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,R));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},D.tickIncrement=function(t,e,r){var n=r?-1:1;if(x(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?U:B,l=t+.01*n,u=_.roundUp(v(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},D.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]a:h1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],666:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),h=[],f=0;f0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],669:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],670:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),h=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,r,s,_,w,M,A){function k(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+mt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+mt+")").attr("d","M0,0Z"),S()}function S(){pt.selectAll(".select-outline").remove()}function L(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(q,e+at)),i=Math.max(0,Math.min(H,r+ot)),a=Math.abs(n-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,X)/2);st.l=Math.min(at,n),st.r=Math.max(at,n),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!J||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function z(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),b=!1)))}function I(e,r){var i=1===(M+A).length;if(e)F();else if(2!==r||i){if(1===r&&i){var a=M?V[0]:U[0],o="s"===M||"w"===A?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",h="middle";if(a.fixedrange)return;M?(h="n"===M?"top":"bottom","right"===a.side&&(c="right")):"e"===A&&(c="right"),rt.call(f.makeEditable,null,{immediate:!0,background:N.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:h}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&u.relayout(t,s,r)})}}else R()}function P(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||N._enablescrollzoom){if(t._transitioningWithDuration)return h.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void h.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=vt[0]+vt[2]*l,c=(s.bottom-e.clientY)/s.height,f=vt[1]+vt[3]*(1-c);if(A){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,r){for(var n,a,o=1-e,s=0;s0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nW.width||Y<0||Y>W.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:A[0]._length/2,Y="ypx"in e?e.ypx:k[0]._length/2;if(C="xval"in e?n(a,e.xval):i(A,X),I="yval"in e?n(a,e.yval):i(k,Y),!g(C[0])||!g(I[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(D=0;D1||R.hoverinfo.indexOf("name")!==-1?R.name:void 0,index:!1,distance:Math.min(Z,M.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[F]&&(V.subplot=o[F]._subplot),q=H.length,"array"===N){var Q=e[D];"pointNumber"in Q?(V.index=Q.pointNumber,N="closest"):(N="","xval"in Q&&(B=Q.xval,N="x"),"yval"in Q&&(U=Q.yval,N=N?"closest":"y"))}else B=C[j],U=I[j];if(R._module&&R._module.hoverPoints){var K=R._module.hoverPoints(V,B,U,N);if(K)for(var $,J=0;Jq&&(H.splice(0,q),Z=H[0].distance)}if(0===H.length)return _.unhoverRaw(t,e);var tt="y"===z&&G.length>1;H.sort(function(t,e){return t.distance-e.distance});var et=x.combine(o.plot_bgcolor||x.background,o.paper_bgcolor),rt={hovermode:z,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(H,rt);c(H,tt?"xa":"ya"),h(nt,tt);var it=t._hoverdata,at=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):k&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var h=e.select("text.nums").style("fill",u).call(b.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);h.selectAll("tspan.line").call(b.setPosition,0,0);var f=e.select("text.name"),m=0;r&&r!==n?(f.style("fill",l).text(r).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),f.selectAll("tspan.line").call(b.setPosition,0,0),m=f.node().getBoundingClientRect().width+2*P):(f.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var v,M,T=h.node().getBoundingClientRect(),S=t.xa._offset+(t.x0+t.x1)/2,L=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),C=Math.abs(t.y1-t.y0),D=T.width+I+P+m;t.ty0=_-T.top,t.bx=T.width+2*P,t.by=T.height+2*P,t.anchor="start",t.txwidth=T.width,t.tx2width=m,t.offset=0,a?(t.pos=S,v=L+C/2+D<=A,M=L-C/2-D>=0,"top"!==t.idealAlign&&v||!M?v?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")):(t.pos=L,v=S+z/2+D<=w,M=S-z/2-D>=0,"left"!==t.idealAlign&&v||!M?v?(S+=z/2,t.anchor="start"):t.anchor="middle":(S-=z/2,t.anchor="end")),h.attr("text-anchor",t.anchor),m&&f.attr("text-anchor",t.anchor),e.attr("transform","translate("+S+","+L+")"+(a?"rotate("+E+")":""))}),L}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,h=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?L:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(f.push.apply(f,d),h.splice(o+1,1),u=0,s=f.length-1;s>=0;s--)u+=f[s].dp;for(a=u/f.length,s=f.length-1;s>=0;s--)f[s].dp-=a;n=!1}else o++}h.forEach(r)}for(o=h.length-1;o>=0;o--){var m=h[o];for(s=m.length-1;s>=0;s--){var v=m[s],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function h(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(I+P),s=o+a*(t.txwidth+P),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-C,l=t.offset*z),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*I+l)+","+(I+u)+"v"+(t.by/2-I)+"h"+n*t.bx+"v-"+t.by+"H"+(n*I+l)+"V"+(u-I)+"Z"),i.call(b.setPosition,o+l,u+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(b.setPosition,s+a*P+l,u+t.ty0-t.by/2+P),r.select("rect").call(b.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function f(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),A=t("./dragbox"),k=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return m.coerce(t,e,k,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=T.isHoriz(r);i=a?"y":"x"}else i="closest"; +n("hovermode",i)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+M.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexh[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":633,"fast-isnumeric":104}],677:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,h){function f(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,m=i.element.getBoundingClientRect(),v=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,x=e-m.left,b=r-m.top,_=x,w=b,M="M"+x+","+b,A=i.xaxes[0]._length,k=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),S=i.xaxes.concat(i.yaxes);"lasso"===h&&(p=l([[x,b]],s.BENDPX));var L=g.selectAll("path.select-outline").data([1,2]);L.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",M+"Z");var z,C,I,P,D,O=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),R=[],F=i.gd,j=[];for(z=0;z0)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*h*Math.abs(n-i))}return l}function r(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var h=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?r:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,o=t[e],l=(t._id||"x").charAt(0);if(n="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,n=n.slice(),!o||2!==o.length)return void(t[e]=n);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),r=0;r<2;r++)if("date"===t.type){if(!a.isDateTime(o[r])){t[e]=n;break}if(o[r]a.MAX_MS&&(o[r]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[r])){if(!i(o[1-r])){t[e]=n;break}o[r]=o[1-r]*(r?10:.1)}if(o[r]<-s?o[r]=-s:o[r]>s&&(o[r]=s),o[0]===o[1]){var h=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=h,o[1]+=h}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?l:r},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var h=c.charAt(0),f=c.substr(1);f=n(f)?Number(f):0,(f<=0||!("date"===o&&"M"===h&&f===Math.round(f)||"log"===o&&"L"===h||"log"===o&&"D"===h&&(1===f||2===f)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],682:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(t){var e,r,n,i,a,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,x.push(s),o[s]=a}return o}function h(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=l.yaxis._id,h=l.xaxis.range,f=l.yaxis.range;l.xaxis._r=l.xaxis.range.slice(),l.yaxis._r=l.yaxis.range.slice(),i=r[u]?r[u].to:h,a=r[c]?r[c].to:f,h[0]===i[0]&&h[1]===i[1]&&f[0]===a[0]&&f[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function f(e,r){function n(e,r){for(i=0;ir.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=c(e),_=Object.keys(b),w=h(y,_,b);if(!w.length)return!1;var M;u&&(M=u());var A,k,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),A=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":633,"../../plotly":659,"../../registry":739,"./axes":664,d3:95}],683:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],h=0;hi},M.render=function(){function t(t){var e=r.projection(t.lonlat);return e?"translate("+e[0]+","+e[1]+")":null}function e(t){return r.isLonLatOverEdges(t.lonlat)?"0":"1.0"}var r=this,n=r.framework,i=n.select("g.choroplethlayer"),a=n.select("g.scattergeolayer"),o=r.path;n.selectAll("path.basepath").attr("d",o),n.selectAll("path.graticulepath").attr("d",o),i.selectAll("path.choroplethlocation").attr("d",o),i.selectAll("path.basepath").attr("d",o),a.selectAll("path.js-line").attr("d",o),null!==r.clipAngle?(a.selectAll("path.point").style("opacity",e).attr("transform",t),a.selectAll("text").style("opacity",e).attr("transform",t)):(a.selectAll("path.point").attr("transform",t),a.selectAll("text").attr("transform",t))}},{"../../components/color":533,"../../components/drawing":556,"../../constants/xmlns_namespaces":618,"../../lib/topojson_utils":648,"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"./constants":686,"./projections":694,"./set_scale":695,"./zoom":696,"./zoom_reset":697,d3:95,"topojson-client":491}],688:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;nn^d>n&&r<(f-u)*(n-c)/(d-c)+u&&(i=!i)}return i}function o(t){return t?t/Math.sin(t):1}function s(t){return t>1?I:t<-1?-I:Math.asin(t)}function l(t){return t>1?0:t<-1?C:Math.acos(t)}function u(t,e){var r=(2+I)*Math.sin(e);e/=2;for(var n=0,i=1/0;n<10&&Math.abs(i)>L;n++){var a=Math.cos(e);e-=i=(e+Math.sin(e)*(a+2)-r)/(2*a*(1+a))}return[2/Math.sqrt(C*(4+C))*t*(1+Math.cos(e)),2*Math.sqrt(C/(4+C))*Math.sin(e)]}function c(t,e){function r(r,n){var i=F(r/e,n);return i[0]*=t,i}return arguments.length<2&&(e=t),1===e?F:e===1/0?f:(r.invert=function(r,n){var i=F.invert(r/t,n);return i[0]*=e,i},r)}function h(){var t=2,e=R(c),r=e(t);return r.coefficient=function(r){return arguments.length?e(t=+r):t},r}function f(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function d(t,e){return[3*t/(2*C)*Math.sqrt(C*C/3-e*e),e]}function p(t,e){return[t,1.25*Math.log(Math.tan(C/4+.4*e))]}function g(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)>L&&--i>0);return e/2}}function m(t,e,r){function n(r,n){return[t*r*Math.cos(n=i(n)),e*Math.sin(n)]}var i=g(r);return n.invert=function(n,i){var a=s(i/e);return[n/(t*Math.cos(a)),s((2*a+Math.sin(2*a))/r)]},n}function v(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(-.013791+n*(.003971*r-.001529*n))),e*(1.007226+r*(.015085+n*(-.044475+.028874*r-.005916*n)))]}function y(t,e){var r,n=Math.min(18,36*Math.abs(e)/C),i=Math.floor(n),a=n-i,o=(r=N[i])[0],s=r[1],l=(r=N[++i])[0],u=r[1],c=(r=N[Math.min(19,++i)])[0],h=r[1];return[t*(l+a*(c-o)/2+a*a*(c-2*l+o)/2),(e>0?I:-I)*(u+a*(h-s)/2+a*a*(h-2*u+s)/2)]}function x(t,e){return[t*Math.cos(e),e]}function b(t,e){var r=Math.cos(e),n=o(l(r*Math.cos(t/=2)));return[2*r*Math.sin(t)*n,Math.sin(e)*n]}function _(t,e){var r=b(t,e);return[(r[0]+t/I)/2,(r[1]+e)/2]}t.geo.project=function(t,e){var n=e.stream;if(!n)throw new Error("not yet supported");return(t&&w.hasOwnProperty(t.type)?w[t.type]:r)(t,n)};var w={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,r)})}}},M=[],A=[],k={point:function(t,e){M.push([t,e])},result:function(){var t=M.length?M.length<2?{type:"Point",coordinates:M[0]}:{type:"MultiPoint",coordinates:M}:null;return M=[],t}},T={lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){M.length&&(A.push(M),M=[])},result:function(){var t=A.length?A.length<2?{type:"LineString",coordinates:A[0]}:{type:"MultiLineString",coordinates:A}:null;return A=[],t}},E={polygonStart:n,lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){var t=M.length;if(t){do M.push(M[0].slice());while(++t<4);A.push(M),M=[]}},polygonEnd:n,result:function(){if(!A.length)return null;var t=[],e=[];return A.forEach(function(r){i(r)?t.push([r]):e.push(r)}),e.forEach(function(e){var r=e[0];t.some(function(t){if(a(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}},S={Point:k,MultiPoint:k,LineString:T,MultiLineString:T,Polygon:E,MultiPolygon:E,Sphere:E},L=1e-6,z=L*L,C=Math.PI,I=C/2,P=(Math.sqrt(C),C/180),D=180/C,O=t.geo.projection,R=t.geo.projectionMutator;t.geo.interrupt=function(e){function r(t,r){for(var n=r<0?-1:1,i=l[+(r<0)],a=0,o=i.length-1;ai[a][2][0];++a);var s=e(t-i[a][1][0],r);return s[0]+=e(i[a][1][0],n*r>n*i[a][0][1]?i[a][0][1]:r)[0],s}function n(){s=l.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]]})})}function i(){for(var e=1e-6,r=[],n=0,i=l[0].length;n=0;--n){var o=l[1][n],s=180*o[0][0]/C,u=180*o[0][1]/C,c=180*o[1][1]/C,h=180*o[2][0]/C,f=180*o[2][1]/C;r.push(a([[h-e,f-e],[h-e,c+e],[s+e,c+e],[s+e,u-e]],30))}return{type:"Polygon",coordinates:[t.merge(r)]}}function a(t,e){for(var r,n,i,a=-1,o=t.length,s=t[0],l=[];++aL&&--i>0);return[t/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]},(t.geo.naturalEarth=function(){return O(v)}).raw=v;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}),y.invert=function(t,e){var r=e/I,n=90*r,i=Math.min(18,Math.abs(n/5)),a=Math.max(0,Math.floor(i));do{var o=N[a][1],s=N[a+1][1],l=N[Math.min(19,a+2)][1],u=l-o,c=l-2*s+o,h=2*(Math.abs(r)-s)/u,f=c/u,d=h*(1-f*h*(1-2*f*h));if(d>=0||1===a){n=(e>=0?5:-5)*(d+i);var p,g=50;do i=Math.min(18,Math.abs(n)/5),a=Math.floor(i),d=i-a,o=N[a][1],s=N[a+1][1],l=N[Math.min(19,a+2)][1],n-=(p=(e>=0?I:-I)*(s+d*(l-o)/2+d*d*(l-2*s+o)/2)-e)*D;while(Math.abs(p)>z&&--g>0);break}}while(--a>=0);var m=N[a][0],v=N[a+1][0],y=N[Math.min(19,a+2)][0];return[t/(v+d*(y-m)/2+d*d*(y-2*v+m)/2),n*P]},(t.geo.robinson=function(){return O(y)}).raw=y,x.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return O(x)}).raw=x,b.invert=function(t,e){if(!(t*t+4*e*e>C*C+L)){var r=t,n=e,i=25;do{var a,o=Math.sin(r),s=Math.sin(r/2),u=Math.cos(r/2),c=Math.sin(n),h=Math.cos(n),f=Math.sin(2*n),d=c*c,p=h*h,g=s*s,m=1-p*u*u,v=m?l(h*u)*Math.sqrt(a=1/m):a=0,y=2*v*h*s-t,x=v*c-e,b=a*(p*g+v*h*u*d),_=a*(.5*o*f-2*v*c*s),w=.25*a*(f*s-v*c*p*o),M=a*(d*u+v*g*h),A=_*w-M*b;if(!A)break;var k=(x*_-y*M)/A,T=(y*w-x*b)/A;r-=k,n-=T}while((Math.abs(k)>L||Math.abs(T)>L)&&--i>0);return[r,n]}},(t.geo.aitoff=function(){return O(b)}).raw=b,_.invert=function(t,e){var r=t,n=e,i=25;do{var a,o=Math.cos(n),s=Math.sin(n),u=Math.sin(2*n),c=s*s,h=o*o,f=Math.sin(r),d=Math.cos(r/2),p=Math.sin(r/2),g=p*p,m=1-h*d*d,v=m?l(o*d)*Math.sqrt(a=1/m):a=0,y=.5*(2*v*o*p+r/I)-t,x=.5*(v*s+n)-e,b=.5*a*(h*g+v*o*d*c)+.5/I,_=a*(f*u/4-v*s*p),w=.125*a*(u*p-v*s*h*f),M=.5*a*(c*d+v*g*o)+.5,A=_*w-M*b,k=(x*_-y*M)/A,T=(y*w-x*b)/A;r-=k,n-=T}while((Math.abs(k)>L||Math.abs(T)>L)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return O(_)}).raw=_}e.exports=n},{}],695:[function(t,e,r){"use strict";function n(t,e){var r=t.projection,n=t.lonaxis,o=t.lataxis,l=t.domain,u=t.framewidth||0,c=e.w*(l.x[1]-l.x[0]),h=e.h*(l.y[1]-l.y[0]),f=n.range[0]+s,d=n.range[1]-s,p=o.range[0]+s,g=o.range[1]-s,m=n._fullRange[0]+s,v=n._fullRange[1]-s,y=o._fullRange[0]+s,x=o._fullRange[1]-s;r._translate0=[e.l+c/2,e.t+h/2];var b=d-f,_=g-p,w=[f+b/2,p+_/2],M=r._rotate;r._center=[w[0]+M[0],w[1]+M[1]];var A=function(e){function n(t){return Math.min(_*c/(t[1][0]-t[0][0]),_*h/(t[1][1]-t[0][1]))}var o,s,l,b,_=e.scale(),w=r._translate0,M=i(f,p,d,g),A=i(m,y,v,x);l=a(e,M),o=n(l),b=a(e,A),r._fullScale=n(b),e.scale(o),l=a(e,M),s=[w[0]-l[0][0]+u,w[1]-l[0][1]+u],r._translate=s,e.translate(s),l=a(e,M),t._isAlbersUsa||e.clipExtent(l),o=r.scale*o,r._scale=o,t._width=Math.round(l[1][0])+u,t._height=Math.round(l[1][1])+u,t._marginX=(c-Math.round(l[1][0]))/2,t._marginY=(h-Math.round(l[1][1]))/2};return A}function i(t,e,r,n){var i=(r-t)/4;return{type:"Polygon",coordinates:[[[t,e],[t,n],[t+i,n],[t+2*i,n],[t+3*i,n],[r,n],[r,e],[r-i,e],[r-2*i,e],[r-3*i,e],[t,e]]]}}function a(t,e){return o.geo.path().projection(t).bounds(e)}var o=t("d3"),s=t("./constants").clipPad;e.exports=n},{"./constants":686,d3:95}],696:[function(t,e,r){"use strict";function n(t,e){var r;return(r=e._isScoped?a:e._clipAngle?s:o)(t,e.projection)}function i(t,e){var r=e._fullScale;return _.behavior.zoom().translate(t.translate()).scale(t.scale()).scaleExtent([.5*r,100*r])}function a(t,e){function r(){_.select(this).style(A)}function n(){o.scale(_.event.scale).translate(_.event.translate),t.render()}function a(){_.select(this).style(k)}var o=t.projection,s=i(o,e);return s.on("zoomstart",r).on("zoom",n).on("zoomend",a),s}function o(t,e){function r(t){return m.invert(t)}function n(t){var e=m(r(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function a(){_.select(this).style(A),l=_.mouse(this),u=m.rotate(),c=m.translate(),h=u,f=r(l)}function o(){return d=_.mouse(this),n(l)?(v.scale(m.scale()),void v.translate(m.translate())):(m.scale(_.event.scale),m.translate([c[0],_.event.translate[1]]),f?r(d)&&(g=r(d),p=[h[0]+(g[0]-f[0]),u[1],u[2]],m.rotate(p),h=p):(l=d,f=r(l)),void t.render())}function s(){_.select(this).style(k)}var l,u,c,h,f,d,p,g,m=t.projection,v=i(m,e),y=2;return v.on("zoomstart",a).on("zoom",o).on("zoomend",s),v}function s(t,e){function r(t){v++||t({type:"zoomstart"})}function n(t){t({type:"zoom"})}function a(t){--v||t({type:"zoomend"})}var o,s=t.projection,d={r:s.rotate(),k:s.scale()},p=i(s,e),g=b(p,"zoomstart","zoom","zoomend"),v=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(A);var t=_.mouse(this),e=s.rotate(),i=e,a=s.translate(),v=u(e);o=l(s,t),y.call(p,"zoom",function(){var r=_.mouse(this);if(s.scale(d.k=_.event.scale),o){if(l(s,r)){s.rotate(e).translate(a);var u=l(s,r),p=h(o,u),y=m(c(v,p)),x=d.r=f(y,o,i);isFinite(x[0])&&isFinite(x[1])&&isFinite(x[2])||(x=i),s.rotate(x),i=x}}else t=r,o=l(s,t);n(g.of(this,arguments))}),r(g.of(this,arguments))}).on("zoomend",function(){_.select(this).style(k),y.call(p,"zoom",null),a(g.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,g,"on")}function l(t,e){var r=t.invert(e);return r&&isFinite(r[0])&&isFinite(r[1])&&v(r)}function u(t){var e=.5*t[0]*w,r=.5*t[1]*w,n=.5*t[2]*w,i=Math.sin(e),a=Math.cos(e),o=Math.sin(r),s=Math.cos(r),l=Math.sin(n),u=Math.cos(n);return[a*s*u+i*o*l,i*s*u-a*o*l,a*o*u+i*s*l,a*s*l-i*o*u]}function c(t,e){var r=t[0],n=t[1],i=t[2],a=t[3],o=e[0],s=e[1],l=e[2],u=e[3];return[r*o-n*s-i*l-a*u,r*s+n*o+i*u-a*l,r*l-n*u+i*o+a*s,r*u+n*l-i*s+a*o]}function h(t,e){if(t&&e){var r=x(t,e),n=Math.sqrt(y(r,r)),i=.5*Math.acos(Math.max(-1,Math.min(1,y(t,e)))),a=Math.sin(i)/n;return n&&[Math.cos(i),r[2]*a,-r[1]*a,r[0]*a]}}function f(t,e,r){var n=g(e,2,t[0]);n=g(n,1,t[1]),n=g(n,0,t[2]-r[2]);var i,a,o=e[0],s=e[1],l=e[2],u=n[0],c=n[1],h=n[2],f=Math.atan2(s,o)*M,p=Math.sqrt(o*o+s*s);Math.abs(c)>p?(a=(c>0?90:-90)-f,i=0):(a=Math.asin(c/p)*M-f,i=Math.sqrt(p*p-c*c));var m=180-a-2*f,v=(Math.atan2(h,u)-Math.atan2(l,i))*M,y=(Math.atan2(h,u)-Math.atan2(l,-i))*M,x=d(r[0],r[1],a,v),b=d(r[0],r[1],m,y);return x<=b?[a,v,r[2]]:[m,y,r[2]]}function d(t,e,r,n){var i=p(r-t),a=p(n-e);return Math.sqrt(i*i+a*a)}function p(t){return(t%360+540)%360-180}function g(t,e,r){var n=r*w,i=t.slice(),a=0===e?1:0,o=2===e?1:2,s=Math.cos(n),l=Math.sin(n);return i[a]=t[a]*s-t[o]*l,i[o]=t[o]*s+t[a]*l,i}function m(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*M,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*M,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*M]}function v(t){var e=t[0]*w,r=t[1]*w,n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function y(t,e){for(var r=0,n=0,i=t.length;nh[d+2]&&(h[d]=-1,h[d+2]=1),f=this[v[d]],f._length=o.viewBox[d+2]-o.viewBox[d],s.doAutoRange(f);o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},y.calcDataBox=function(){var t=this.xaxis,e=this.yaxis,r=t.range,n=e.range,i=t.r2l,a=e.r2l;return[i(r[0]),a(n[0]),i(r[1]),a(n[1])]},y.setRanges=function(t){var e=this.xaxis,r=this.yaxis,n=e.l2r,i=r.l2r;e.range=[n(t[0]),n(t[2])],r.range=[i(t[1]),i(t[3])]},y.updateTraces=function(t,e){var r,n,i,a=Object.keys(this.traces);this.fullData=t;t:for(r=0;rMath.abs(e))n.rotate(o,0,0,-t*r*Math.PI*f.rotateSpeed/window.innerWidth);else{var s=-f.zoomSpeed*a*e/window.innerHeight*(o-n.lastT())/100;n.pan(o,0,0,u*(Math.exp(s)-1))}},!0),f}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":27,"mouse-change":413,"mouse-wheel":415,"right-now":459}],703:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<3;++r){var n=s[r];e[n]._gd=t}}var i=t("./scene"),a=t("../plots"),o=t("../../constants/xmlns_namespaces"),s=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,o=a.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var s=0;sf[1][o]?d[o]=1:f[1][o]===f[0][o]?d[o]=1:d[o]=1/(f[1][o]-f[0][o]);for(this.dataScale=d,a=0;ag[1][a])g[0][a]=-1,g[1][a]=1;else{var b=g[1][a]-g[0][a];g[0][a]-=b/32,g[1][a]+=b/32}}else{var w=c[T[a]].range;g[0][a]=w[0],g[1][a]=w[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]*d[a],this.glplot.bounds[1][a]=g[1][a]*d[a]}var M=[1,1,1];for(a=0;a<3;++a){l=c[T[a]],u=l.type;var A=y[u];M[a]=Math.pow(A.acc,1/A.count)/d[a]}var k,E=4;if("auto"===c.aspectmode)k=Math.max.apply(null,M)/Math.min.apply(null,M)<=E?M:[1,1,1];else if("cube"===c.aspectmode)k=[1,1,1];else if("data"===c.aspectmode)k=M;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var S=c.aspectratio;k=[S.x,S.y,S.z]}c.aspectratio.x=h.aspectratio.x=k[0],c.aspectratio.y=h.aspectratio.y=k[1],c.aspectratio.z=h.aspectratio.z=k[2],this.glplot.aspect=k;var L=c.domain||null,z=e._size||null;if(L&&z){var C=this.container.style;C.position="absolute",C.left=z.l+L.x[0]*z.w+"px",C.top=z.t+(1-L.y[1])*z.h+"px",C.width=z.w*(L.x[1]-L.x[0])+"px",C.height=z.h*(L.y[1]-L.y[0])+"px"}this.glplot.redraw()}},k.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},k.setCameraToDefault=function(){this.setCamera({eye:{x:1.25,y:1.25,z:1.25},center:{x:0,y:0,z:0},up:{x:0,y:0,z:1}})},k.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},k.setCamera=function(t){var e={};e[this.id]=t,this.glplot.camera.lookAt.apply(this,l(t)),this.graphDiv.emit("plotly_relayout",e)},k.saveCamera=function(t){function e(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]]}var r=this.getCamera(),n=p.nestedProperty(t,this.id+".camera"),i=n.get(),a=!1;if(void 0===i)a=!0;else for(var o=0;o<3;o++)for(var s=0;s<3;s++)if(!e(r,i,o,s)){a=!0;break}return a&&n.set(r),a},k.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},k.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(c),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var a=0,o=n-1;a0}function a(t){var e={},r={};switch(t.type){case"circle":s.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":s.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":s.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var n=t.symbol,i=l(n.textposition,n.iconsize);s.extendFlat(e,{"icon-image":n.icon+"-15","icon-size":n.iconsize/10,"text-field":n.text,"text-size":n.textfont.size,"text-anchor":i.anchor,"text-offset":i.offset}),s.extendFlat(r,{"icon-color":t.color,"text-color":n.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:r}}function o(t){var e,r=t.sourcetype,n=t.source,i={type:r},a="string"==typeof n;return"geojson"===r?e="data":"vector"===r&&(e=a?"url":"tiles"),i[e]=n,i}var s=t("../../lib"),l=t("./convert_text_opts"),u=n.prototype;u.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)&&this.updateLayer(t):(this.updateSource(t),this.updateLayer(t)),this.updateStyle(t),this.visible=i(t)},u.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},u.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},u.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,i(t)){var r=o(t);e.addSource(this.idSource,r)}},u.updateLayer=function(t){var e=this.map;if(e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,i(t)){e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type},t.below);var r={visibility:"visible"};this.mapbox.setOptions(this.idLayer,"setLayoutProperty",r)}},u.updateStyle=function(t){var e=a(t);i(t)&&(this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint))},u.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)},e.exports=function(t,e,r){var i=new n(t,e);return i.update(r),i}},{"../../lib":633,"./convert_text_opts":717}],720:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color").defaultLine,a=t("../font_attributes"),o=t("../../traces/scatter/attributes").textposition;e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},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:n.extendDeep({},a,{family:{dflt:"Open Sans Regular, Arial Unicode MS Regular"}}),textposition:n.extendFlat({},o,{arrayOk:!1})}}}},{"../../components/color":533,"../../lib":633,"../../traces/scatter/attributes":846,"../font_attributes":684}],721:[function(t,e,r){"use strict";function n(t,e,r){r("accesstoken"),r("style"),r("center.lon"),r("center.lat"),r("zoom"),r("bearing"),r("pitch"),i(t,e),e._input=t}function i(t,e){function r(t,e){return a.coerce(n,i,s.layers,t,e)}for(var n,i,o=t.layers||[],l=e.layers=[],u=0;u=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"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,h=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=h)}else{p.supplyLayoutGlobalDefaults(a,n);var f=!a.width||!a.height,d=n.autosize,g=t._context&&t._context.autosizable,m=f&&(d||g);m?p.plotAutoSize(t,a,n):f&&p.sanitizeMargins(t),!d&&f&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,n),n._has=p._hasPlotType.bind(n);var v=n._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),h=c.left+c.right,d=c.bottom+c.top,g=1-2*o,m=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(m.width-h)),i=Math.round(g*(m.height-d))}else{var v=l?window.getComputedStyle(t):{};n=parseFloat(v.width)||r.width,i=parseFloat(v.height)||r.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-i)>1;(_||b)&&(b&&(r.width=n),_&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a;c.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(i=0;i.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t); +}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,h=r.size,f=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(h)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(h*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(h-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var m=l[t].t.val,v=l[t].t.size;if(m>f){var y=(d*m+(v-e.height)*f)/(m-f),x=(v*(1-f)+(d-e.height)*(1-m))/(m-f);y>=0&&x>=0&&y+x>s+o&&(s=y,o=x)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):f.isJSDate(t)?f.ms2DateTime(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)},p.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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,L=S?h.angularAxis.domain:n.extent(A),z=Math.abs(A[1]-A[0]);T&&!k&&(z=0);var C=L.slice();E&&k&&(C[1]+=z);var I=h.angularAxis.ticksCount||4;I>8&&(I=I/(I/8)+I%8),h.angularAxis.ticksStep&&(I=(C[1]-C[0])/I);var P=h.angularAxis.ticksStep||(C[1]-C[0])/(I*(h.minorTicks+1));M&&(P=Math.max(Math.round(P),1)),C[2]||(C[2]=P);var D=n.range.apply(this,C);if(D=D.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]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?z:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var O="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",R=(new DOMParser).parseFromString(O,"application/xml"),F=this.appendChild(this.ownerDocument.importNode(R.documentElement,!0));e=n.select(F)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var j,N=e.select(".chart-group"),B={fill:"none",stroke:h.tickColor},U={"font-size":h.font.size,"font-family":h.font.family,fill:h.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+h.font.outlineColor}).join(",")};if(h.showLegend){j=e.select(".legend-group").attr({transform:"translate("+[x,h.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:j,elements:V,reverseOrder:h.legend.reverseOrder})})();var q=j.node().getBBox();x=Math.min(h.width-q.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,x=Math.max(10,x),_=[h.margin.left+x,h.margin.top+x],i.range([0,x]),c.layout.radialAxis.domain=i.domain(),j.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else j=e.select(".legend-group").style({display:"none"});e.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),N.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(h.width-(h.margin.left+h.margin.right+2*x+(q?q.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*x))/2];if(H[0]=Math.max(0,H[0]),H[1]=Math.max(0,H[1]),e.select(".outer-group").attr("transform","translate("+H+")"),h.title){var G=e.select("g.title-group text").style(U).text(h.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-x-20})}var Y=e.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(i.ticks(5));W.enter().append("circle").attr({class:"grid-circle"}).style(B),W.attr("r",i),W.exit().remove()}Y.select("circle.outside-circle").attr({r:x}).style(B);var Z=e.select("circle.background-circle").attr({r:x}).style({fill:h.backgroundColor,stroke:h.stroke});if(h.radialAxis.visible){var Q=n.svg.axis().scale(i).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+h.radialAxis.orientation+")"}),Y.selectAll(".domain").style(B),Y.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===h.radialAxis.tickOrientation?"rotate("+-h.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var K=e.select(".angular.axis-group").selectAll("g.angular-tick").data(D),$=K.enter().append("g").classed("angular-tick",!0);K.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),K.exit().remove(),$.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(h.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(h.minorTicks+1)==0)}).style(B),$.selectAll(".minor").style({stroke:h.minorTickColor}),K.select("line.grid-line").attr({x1:h.tickLength?x-h.tickLength:0,x2:x}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(U);var J=K.select("text.axis-text").attr({x:x+h.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=x+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?"":M?M[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(U);h.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(N.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[x+tt,h.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=h.orientation,r.direction=h.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!k){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});N.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;ot=s.invert(n);var i=o.util.convertToCartesian(x+12,r+180);ct.text(o.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});N.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=i.invert(o.util.getMousePos(Z).radius);var n=o.util.convertToCartesian(r,h.radialAxis.orientation);ht.text(o.util.round(st)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ft.hide(),ct.hide(),ht.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var i=n.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(u.t=M[t[0]]);var c="t: "+u.t+", r: "+u.r,h=this.getBoundingClientRect(),f=e.node().getBoundingClientRect(),d=[h.left+h.width/2-H[0]-f.left,h.top+h.height/2-H[1]-f.top];ft.config({color:s}).text(c),ft.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&ft.show())}).on("mouseout.tooltip",function(t,e){ft.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")})})}),f}var e,r,i,s,l={data:[],layout:{}},u={},c={},h=n.dispatch("hover"),f={};return f.render=function(e){return t(e),this},f.config=function(t){if(!arguments.length)return l;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},f.getLiveConfig=function(){return c},f.getinputConfig=function(){return u},f.radialScale=function(t){return i},f.angularScale=function(t){return s},f.svg=function(){return e},n.rebind(f,h,"on"),f},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,i=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return i},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("undefined"==typeof 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 r===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=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 s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:f(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return m.stroke(r,i,a)},"stroke-width":function(t,e){return m["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](r,i,a)},opacity:function(t,e){return m.opacity(r,i,a)},display:function(t,e){return m.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});h.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var m={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},v=n.select(this).selectAll("g.layer").data(l);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(m).each(h[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],i=n.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=n.merge(i);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,h=c?r.height:u*o.length,f=s.classed("legend-group",!0),d=f.selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:h+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(o.length),m=n.scale[c?"linear":"ordinal"]().domain(g).range(l),v=n.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,h]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(c){var x=d.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}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var b=d.select(".legend-marks").selectAll("path.legend-mark").data(o);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[u/2,v(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=n.svg.axis().scale(v).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var n=t.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",h=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(h);var f=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=d.width+2*f+l,m=d.height+2*f;return r.attr({d:"M"+[[l,-m/2],[l,-m/4],[i.hasTick?0:l,0],[l,m/4],[l,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-m/2+2*f]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId, +e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=i.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],h={};n.entries(s.margin).forEach(function(t,e){h[c[u.indexOf(t.key)]]=t.value}),s.margin=h}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../lib":633,d3:95}],729:[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,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(h=i),n.select(n.select(h).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(r),a.config(c).render(h),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,i,a,c,h,f=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){f.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){f.undo()},e.redo=function(){f.redo()},e},u.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":533,"../../lib":633,"./micropolar":728,"./undo_manager":730,d3:95}],730:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n=o&&(d.min=0,p.min=0,g.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var i=t("../../../components/color"),a=t("../../subplot_defaults"),o=t("./layout_attributes"),s=t("./axis_defaults"),l=["aaxis","baxis","caxis"];e.exports=function(t,e,r){a(t,e,r,{type:"ternary",attributes:o,handleDefaults:n,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":533,"../../subplot_defaults":731,"./axis_defaults":735,"./layout_attributes":737}],737:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:i,baxis:i,caxis:i}},{"../../../components/color/attributes":532,"./axis_attributes":734}],738:[function(t,e,r){"use strict";function n(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework()}function i(t){a.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var a=t("d3"),o=t("tinycolor2"),s=t("../../plotly"),l=t("../../lib"),u=t("../../components/color"),c=t("../../components/drawing"),h=t("../cartesian/set_convert"),f=t("../../lib/extend").extendFlat,d=t("../cartesian/axes"),p=t("../../components/dragelement"),g=t("../../components/titles"),m=t("../cartesian/select"),v=t("../cartesian/constants"),y=t("../cartesian/graph_interact");e.exports=n;var x=n.prototype;x.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={}},x.plot=function(t,e){var r,n=this,i=e[n.id],a=e._size;l.getPlotDiv(n.plotContainer.node())!==n.graphDiv&&(n.init(n.graphDiv._fullLayout),n.makeFramework()),n.adjustLayout(i,a);var o=n.traceHash,s={};for(r=0;rb*y?(a=y,i=a*b):(i=v,a=i/b),o=g*i/v,s=m*a/y,r=e.l+e.w*d-i/2,n=e.t+e.h*(1-p)-a/2,l.x0=r,l.y0=n,l.w=i,l.h=a,l.sum=x,l.xaxis={type:"linear",range:[_+2*M-x,x-_-2*w],domain:[d-o/2,d+o/2],_id:"x",_gd:l.graphDiv},h(l.xaxis),l.xaxis.setScale(),l.yaxis={type:"linear",range:[_,x-w-M],domain:[p-s/2,p+s/2],_id:"y",_gd:l.graphDiv},h(l.yaxis),l.yaxis.setScale();var A=l.yaxis.domain[0],k=l.aaxis=f({},t.aaxis,{range:[_,x-w-M],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[A,A+s*b],_axislayer:l.layers.aaxis,_gridlayer:l.layers.agrid,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l"+a+",-"+i/2});h(k);var T=l.baxis=f({},t.baxis,{range:[x-_-M,w],side:"bottom",_counterangle:30,domain:l.xaxis.domain,_axislayer:l.layers.baxis,_gridlayer:l.layers.bgrid,_counteraxis:l.aaxis,_pos:0,_gd:l.graphDiv,_id:"x",_length:i,_gridpath:"M0,0l-"+i/2+",-"+a});h(T),k._counteraxis=T;var E=l.caxis=f({},t.caxis,{range:[x-_-w,M],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[A,A+s*b],_axislayer:l.layers.caxis,_gridlayer:l.layers.cgrid,_counteraxis:l.baxis,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l-"+a+","+i/2});h(E);var S="M"+r+","+(n+a)+"h"+i+"l-"+i/2+",-"+a+"Z";l.clipDef.select("path").attr("d",S),l.layers.plotbg.select("path").attr("d",S);var L="translate("+r+","+n+")";l.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",L);var z="translate("+r+","+(n+a)+")";l.layers.baxis.attr("transform",z),l.layers.bgrid.attr("transform",z);var C="translate("+(r+i/2)+","+n+")rotate(30)";l.layers.aaxis.attr("transform",C),l.layers.agrid.attr("transform",C);var I="translate("+(r+i/2)+","+n+")rotate(-30)";l.layers.caxis.attr("transform",I),l.layers.cgrid.attr("transform",I),l.drawAxes(!0),l.plotContainer.selectAll(".crisp").classed("crisp",!1);var P=l.layers.axlines;P.select(".aline").attr("d",k.showline?"M"+r+","+(n+a)+"l"+i/2+",-"+a:"M0,0").call(u.stroke,k.linecolor||"#000").style("stroke-width",(k.linewidth||0)+"px"),P.select(".bline").attr("d",T.showline?"M"+r+","+(n+a)+"h"+i:"M0,0").call(u.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),P.select(".cline").attr("d",E.showline?"M"+(r+i/2)+","+n+"l"+i/2+","+a:"M0,0").call(u.stroke,E.linecolor||"#000").style("stroke-width",(E.linewidth||0)+"px")},x.drawAxes=function(t){var e=this,r=e.graphDiv,n=e.id.substr(7)+"title",i=e.aaxis,a=e.baxis,o=e.caxis;if(d.doTicks(r,i,!0),d.doTicks(r,a,!0),d.doTicks(r,o,!0),t){var s=Math.max(i.showticklabels?i.tickfont.size/2:0,(o.showticklabels?.75*o.tickfont.size:0)+("outside"===o.ticks?.87*o.ticklen:0));g.draw(r,"a"+n,{propContainer:i,propName:e.id+".aaxis.title",dfltName:"Component A",attributes:{x:e.x0+e.w/2,y:e.y0-i.titlefont.size/3-s,"text-anchor":"middle"}});var l=(a.showticklabels?a.tickfont.size:0)+("outside"===a.ticks?a.ticklen:0)+3;g.draw(r,"b"+n,{propContainer:a,propName:e.id+".baxis.title",dfltName:"Component B",attributes:{x:e.x0-l,y:e.y0+e.h+.83*a.titlefont.size+l,"text-anchor":"middle"}}),g.draw(r,"c"+n,{propContainer:o,propName:e.id+".caxis.title",dfltName:"Component C",attributes:{x:e.x0+e.w+l,y:e.y0+e.h+.83*o.titlefont.size+l,"text-anchor":"middle"}})}};var _=v.MINZOOM/2+.87,w="m-0.87,.5h"+_+"v3h-"+(_+5.2)+"l"+(_/2+2.6)+",-"+(.87*_+4.5)+"l2.6,1.5l-"+_/2+","+.87*_+"Z",M="m0.87,.5h-"+_+"v3h"+(_+5.2)+"l-"+(_/2+2.6)+",-"+(.87*_+4.5)+"l-2.6,1.5l"+_/2+","+.87*_+"Z",A="m0,1l"+_/2+","+.87*_+"l2.6,-1.5l-"+(_/2+2.6)+",-"+(.87*_+4.5)+"l-"+(_/2+2.6)+","+(.87*_+4.5)+"l2.6,1.5l"+_/2+",-"+.87*_+"Z",k="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",T=!0;x.initInteractions=function(){function t(t,e,r){var n=F.getBoundingClientRect();_=e-n.left,E=r-n.top,S={a:R.aaxis.range[0],b:R.baxis.range[1],c:R.caxis.range[1]},z=S,L=R.aaxis.range[1]-S.a,C=o(R.graphDiv._fullLayout[R.id].bgcolor).getLuminance(),I="M0,"+R.h+"L"+R.w/2+", 0L"+R.w+","+R.h+"Z",P=!1,D=N.append("path").attr("class","zoombox").style({fill:C>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",I),O=N.append("path").attr("class","zoombox-corners").style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),g()}function e(t,e){return 1-e/R.h}function r(t,e){return 1-(t+(R.h-e)/Math.sqrt(3))/R.w}function n(t,e){return(t-(R.h-e)/Math.sqrt(3))/R.w}function a(t,i){var a=_+t,o=E+i,s=Math.max(0,Math.min(1,e(_,E),e(a,o))),l=Math.max(0,Math.min(1,r(_,E),r(a,o))),u=Math.max(0,Math.min(1,n(_,E),n(a,o))),c=(s/2+u)*R.w,h=(1-s/2-l)*R.w,f=(c+h)/2,d=h-c,p=(1-s)*R.h,g=p-d/b;d.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),O.transition().style("opacity",1).duration(200),P=!0)}function c(t,e){if(z===S)return 2===e&&x(),i(j);i(j);var r={};r[R.id+".aaxis.min"]=z.a,r[R.id+".baxis.min"]=z.b,r[R.id+".caxis.min"]=z.c,s.relayout(j,r),T&&j.data&&j._context.showTips&&(l.notifier("Double-click to
zoom back out","long"),T=!1)}function h(){S={a:R.aaxis.range[0],b:R.baxis.range[1],c:R.caxis.range[1]},z=S}function f(t,e){var r=t/R.xaxis._m,n=e/R.yaxis._m;z={a:S.a-n,b:S.b+(r+n)/2,c:S.c-(r-n)/2};var i=[z.a,z.b,z.c].sort(),a={a:i.indexOf(z.a),b:i.indexOf(z.b),c:i.indexOf(z.c)};i[0]<0&&(i[1]+i[0]/2<0?(i[2]+=i[0]+i[1],i[0]=i[1]=0):(i[2]+=i[0]/2,i[1]+=i[0]/2,i[0]=0),z={a:i[a.a],b:i[a.b],c:i[a.c]},e=(S.a-z.a)*R.yaxis._m,t=(S.c-z.c-S.b+z.b)*R.xaxis._m);var o="translate("+(R.x0+t)+","+(R.y0+e)+")";R.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",o),R.aaxis.range=[z.a,R.sum-z.b-z.c],R.baxis.range=[R.sum-z.a-z.c,z.b],R.caxis.range=[R.sum-z.a-z.b,z.c],R.drawAxes(!1),R.plotContainer.selectAll(".crisp").classed("crisp",!1)}function d(t,e){if(t){var r={};r[R.id+".aaxis.min"]=z.a,r[R.id+".baxis.min"]=z.b,r[R.id+".caxis.min"]=z.c,s.relayout(j,r)}else 2===e&&x()}function g(){R.plotContainer.selectAll(".select-outline").remove()}function x(){var t={};t[R.id+".aaxis.min"]=0,t[R.id+".baxis.min"]=0,t[R.id+".caxis.min"]=0,j.emit("plotly_doubleclick",null),s.relayout(j,t)}var _,E,S,L,z,C,I,P,D,O,R=this,F=R.layers.plotbg.select("path").node(),j=R.graphDiv,N=R.layers.zoom,B={element:F,gd:j,plotinfo:{plot:N},doubleclick:x,subplot:R.id,prepFn:function(e,r,n){B.xaxes=[R.xaxis],B.yaxes=[R.yaxis];var i=j._fullLayout.dragmode;e.shiftKey&&(i="pan"===i?"zoom":"pan"),"lasso"===i?B.minDrag=1:B.minDrag=void 0,"zoom"===i?(B.moveFn=a,B.doneFn=c,t(e,r,n)):"pan"===i?(B.moveFn=f,B.doneFn=d,h(),g()):"select"!==i&&"lasso"!==i||m(e,r,n,B,i)}};F.onmousemove=function(t){y.hover(j,t,R.id),j._fullLayout._lasthover=F,j._fullLayout._hoversubplot=R.id},F.onmouseout=function(t){j._dragging||p.unhover(j,t)},F.onclick=function(t){y.click(j,t)},p.init(B)}},{"../../components/color":533,"../../components/dragelement":554,"../../components/drawing":556,"../../components/titles":607,"../../lib":633,"../../lib/extend":626,"../../plotly":659,"../cartesian/axes":664,"../cartesian/constants":669,"../cartesian/graph_interact":671,"../cartesian/select":677,"../cartesian/set_convert":678,d3:95,tinycolor2:489}],739:[function(t,e,r){"use strict";function n(t){return"object"==typeof t&&(t=t.type),t}var i=t("./lib"),a=t("./plots/attributes");r.modules={},r.allCategories={},r.allTypes=[],r.subplotsRegistry={},r.transformsRegistry={},r.componentsRegistry={},r.layoutArrayContainers=[],r.register=function(t,e,n,a){if(r.modules[e])return void i.log("Type "+e+" already registered");for(var o={},s=0;s-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,u=t.layout,c=l([],a),h=l({},u,n(e.tileClass));if(e.width&&(h.width=e.width),e.height&&(h.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){h.annotations=[];var f=Object.keys(h);for(r=0;r=2?a(t):t>e?Math.ceil(t):Math.floor(t)}var m,v,y,x,b=e.p+(d?f[r]:f),_=b+(g?p[r]:p),w=e.b,M=w+e.s;if("h"===s.orientation?(y=c.c2p(b,!0),x=c.c2p(_,!0),m=u.c2p(w,!0),v=u.c2p(M,!0)):(m=u.c2p(b,!0),v=u.c2p(_,!0),y=c.c2p(w,!0),x=c.c2p(M,!0)),!(i(m)&&i(v)&&i(y)&&i(x)&&m!==v&&y!==x))return void n.select(this).remove();var A=(e.mlw+1||s.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,k=n.round(A/2%1,2);if(!t._context.staticPlot){var T=o.opacity(e.mc||s.marker.color),E=T<1||A>.01?a:l;m=E(m,v),v=E(v,m),y=E(y,x),x=E(x,y)}n.select(this).attr("d","M"+m+","+y+"V"+x+"H"+v+"V"+y+"Z")})}),f.call(s.plot,e)}},{"../../components/color":533,"../../components/errorbars":562,"../../lib":633,"./arrays_to_calcdata":748,d3:95,"fast-isnumeric":104}],757:[function(t,e,r){"use strict";function n(t,e,r,n){if(n.length){var s,l,u,c,h,f=t._fullLayout.barmode,d="overlay"===f,p="group"===f;if(d)i(t,e,r,n);else if(p){for(s=[],l=[],u=0;ul+o&&(u=!0,l=y)),v(e.c2l(g))&&(gl+o&&(u=!0,l=g))}}x.expand(e,[s,l],{tozero:!0,padded:u})}function m(t){return t._id.charAt(0)}var v=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var r,i=e.xaxis,a=e.yaxis,o=t._fullData,s=t.calcdata,l=[],u=[];for(r=0;r1||0===s.bargap&&0===s.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,r=e.marker,o=r.line,s=a.tryColorscale(r,""),l=a.tryColorscale(r,"line");n.select(this).selectAll("path").each(function(t){var e,a,u=(t.mlw+1||o.width+1)-1,c=n.select(this);e="mc"in t?t.mcc=s(t.mc):Array.isArray(r.color)?i.defaultLine:r.color,c.style("stroke-width",u+"px").call(i.fill,e),u&&(a="mlc"in t?t.mlcc=l(t.mlc):Array.isArray(o.color)?i.defaultLine:o.color,c.call(i.stroke,a))})}),e.call(o.style)}},{"../../components/color":533,"../../components/drawing":556,"../../components/errorbars":562,d3:95}],760:[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")}},{"../../components/color":533,"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546}],761:[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"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:a({},o.symbol,{arrayOk:!1}),opacity:a({},o.opacity,{arrayOk:!1,dflt:1}),size:a({},o.size,{arrayOk:!1}),color:a({},o.color,{arrayOk:!1}),line:{color:a({},s.color,{arrayOk:!1,dflt:i.defaultLine}),width:a({},s.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:n.fillcolor}},{"../../components/color/attributes":532,"../../lib/extend":626,"../scatter/attributes":846}],762:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(t,e,r,a,o){var s;return r in e?p=a.makeCalcdata(e,r):(s=r+"0"in e?e[r+"0"]:"name"in e&&("category"===a.type||n(e.name)&&["linear","log"].indexOf(a.type)!==-1||i.isDateTime(e.name)&&"date"===a.type)?e.name:t.numboxes,s=a.d2c(s),p=o.map(function(){return s})),p}function o(t,e,r,a,o){var s,l,u,c,h=a.length,f=e.length,d=[],p=[];for(s=0;s=0&&u1,v=r.dPos*(1-f.boxgap)*(1-f.boxgroupgap)/(m?t.numboxes:1),y=m?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-f.boxgap):0,x=v*g.whiskerwidth;return g.visible!==!0||r.emptybox?void a.select(this).remove():("h"===g.orientation?(l=p,h=d):(l=d,h=p),r.bPos=y,r.bdPos=v,n(),a.select(this).selectAll("path.box").data(o.identity).enter().append("path").attr("class","box").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-v,!0),n=l.c2p(t.pos+y+v,!0),i=l.c2p(t.pos+y-x,!0),s=l.c2p(t.pos+y+x,!0),u=h.c2p(t.q1,!0),c=h.c2p(t.q3,!0),f=o.constrain(h.c2p(t.med,!0),Math.min(u,c)+1,Math.max(u,c)-1),d=h.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=h.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?a.select(this).attr("d","M"+f+","+r+"V"+n+"M"+u+","+r+"V"+n+"H"+c+"V"+r+"ZM"+u+","+e+"H"+d+"M"+c+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+d+","+i+"V"+s+"M"+p+","+i+"V"+s)):a.select(this).attr("d","M"+r+","+f+"H"+n+"M"+r+","+u+"H"+n+"V"+c+"H"+r+"ZM"+e+","+u+"V"+d+"M"+e+","+c+"V"+p+(0===g.whiskerwidth?"":"M"+i+","+d+"H"+s+"M"+i+","+p+"H"+s))}),g.boxpoints&&a.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,a,s,l,h,f="all"===g.boxpoints?t.val:t.val.filter(function(e){return et.uf}),d=Math.max((t.max-t.min)/10,t.q3-t.q1),p=1e-9*d,m=d*c,x=[],b=0;if(g.jitter){if(0===d)for(b=1,x=new Array(f.length),e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(s.translatePoints,d,p),void(g.boxmean&&a.select(this).selectAll("path.mean").data(o.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-v,!0),n=l.c2p(t.pos+y+v,!0),i=h.c2p(t.mean,!0),o=h.c2p(t.mean-t.sd,!0),s=h.c2p(t.mean+t.sd,!0);"h"===g.orientation?a.select(this).attr("d","M"+i+","+r+"V"+n+("sd"!==g.boxmean?"":"m0,0L"+o+","+e+"L"+i+","+r+"L"+s+","+e+"Z")):a.select(this).attr("d","M"+r+","+i+"H"+n+("sd"!==g.boxmean?"":"m0,0L"+e+","+o+"L"+r+","+i+"L"+e+","+s+"Z"))})))})}},{"../../components/drawing":556,"../../lib":633,d3:95}],769:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../plots/cartesian/axes"),a=t("../../lib");e.exports=function(t,e){var r,o,s,l,u=t._fullLayout,c=e.xaxis,h=e.yaxis,f=["v","h"];for(o=0;ol&&(e.z=c.slice(0,l)),s("locationmode"),s("text"),s("marker.line.color"),s("marker.line.width"),i(t,e,o,s,{prefix:"",cLetter:"z"}),void s("hoverinfo",1===o._dataLength?"location+z+text":void 0)):void(e.visible=!1)}},{"../../components/colorscale/defaults":542,"../../lib":633,"./attributes":775}],778:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("./calc"),n.plot=t("./plot").plot,n.hoverPoints=function(){},n.moduleType="trace",n.name="choropleth",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","noOpacity"],n.meta={},e.exports=n},{"../../plots/geo":688,"../heatmap/colorbar":792,"./attributes":775,"./calc":776,"./defaults":777,"./plot":779}],779:[function(t,e,r){"use strict";function n(t,e){function r(e){var r=t.mockAxis;return o.tickText(r,r.c2l(e),"hover").text}var n=e.hoverinfo;if("none"===n||"skip"===n)return function(t){delete t.nameLabel,delete t.textLabel};var i="all"===n?g.hoverinfo.flags:n.split("+"),a=i.indexOf("name")!==-1,s=i.indexOf("location")!==-1,l=i.indexOf("z")!==-1,u=i.indexOf("text")!==-1,c=!a&&s;return function(t){var n=[];c?t.nameLabel=t.id:(a&&(t.nameLabel=e.name),s&&n.push(t.id)),l&&n.push(r(t.z)),u&&n.push(t.tx),t.textLabel=n.join("
")}}function i(t){return function(e,r){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:r,location:e.id,z:e.z}]}}}var a=t("d3"),o=t("../../plots/cartesian/axes"),s=t("../../plots/cartesian/graph_interact"),l=t("../../components/color"),u=t("../../components/drawing"),c=t("../../components/colorscale"),h=t("../../lib/topojson_utils").getTopojsonFeatures,f=t("../../lib/geo_location_utils").locationToFeature,d=t("../../lib/array_to_calc_item"),p=t("../../plots/geo/constants"),g=t("./attributes"),m=e.exports={};m.calcGeoJSON=function(t,e){for(var r,n=[],i=t.locations,a=i.length,o=h(t,e),s=(t.marker||{}).line||{},l=0;l0&&(n[0].trace=t),n},m.plot=function(t,e,r){function o(t){return t[0].trace.uid}var l,u=t.framework,c=u.select("g.choroplethlayer"),h=u.select("g.baselayer"),f=u.select("g.baselayeroverchoropleth"),d=p.baseLayersOverChoropleth,g=c.selectAll("g.trace.choropleth").data(e,o);g.enter().append("g").attr("class","trace choropleth"),g.exit().remove(),g.each(function(e){function r(e,r){if(t.showHover){var n=t.projection(e.properties.ct);c(e),s.loneHover({x:n[0],y:n[1],name:e.nameLabel,text:e.textLabel},{container:t.hoverContainer.node()}),f=h(e,r),t.graphDiv.emit("plotly_hover",f)}}function o(e,r){t.graphDiv.emit("plotly_click",h(e,r))}var l=e[0].trace,u=m.calcGeoJSON(l,t.topojson),c=n(t,l),h=i(l),f=null,d=a.select(this).selectAll("path.choroplethlocation").data(u);d.enter().append("path").classed("choroplethlocation",!0).on("mouseover",r).on("click",o).on("mouseout",function(){s.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",f)}).on("mousedown",function(){s.loneUnhover(t.hoverContainer)}).on("mouseup",r),d.exit().remove()}),f.selectAll("*").remove();for(var v=0;vt?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===r||10===r){var n=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;return t>n?5===r?713:1114:5===r?104:208}return 15===r?0:r}function o(t){var e,r,n,i,o,s,l,u,c,h=t[0].z,f=h.length,d=h[0].length,p=2===f||2===d;for(r=0;r20?(s=L[s][(l[0]||l[1])<0?0:1],t.crossings[o]=z[s]):delete t.crossings[o],l=S[s],!l){_.log("Found bad marching index:",s,e,t.level);break}if(d.push(f(t,e,l)),e[0]+=l[0],e[1]+=l[1],c(d[d.length-1],d[d.length-2])&&d.pop(),o=e.join(","),o===a&&l.join(",")===p||r&&(l[0]&&(e[0]<0||e[0]>m-2)||l[1]&&(e[1]<0||e[1]>g-2)))break;s=t.crossings[o]}1e4===i&&_.log("Infinite loop in contour?");var v,y,x,b,w,M,A,k=c(d[0],d[d.length-1]),T=0,E=.2*t.smoothing,C=[],I=0;for(i=1;i=I;i--)if(v=C[i],v=I&&v+C[y]20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:A.indexOf(t)!==-1?i=1:T.indexOf(t)!==-1?n=1:k.indexOf(t)!==-1?i=-1:n=-1,[n,i]}function c(t,e){return Math.abs(t[0]-e[0])<.01&&Math.abs(t[1]-e[1])<.01}function h(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function f(t,e,r){var n=e[0]+Math.max(r[0],0),i=e[1]+Math.max(r[1],0),a=t.z[i][n],o=t.xaxis,s=t.yaxis;if(r[1]){var l=(t.level-a)/(t.z[i][n+1]-a);return[o.c2p((1-l)*t.x[n]+l*t.x[n+1],!0),s.c2p(t.y[i],!0)]}var u=(t.level-a)/(t.z[i+1][n]-a);return[o.c2p(t.x[n],!0),s.c2p((1-u)*t.y[i]+u*t.y[i+1],!0)]}function d(t,e,r){var n=t.plot.select(".maplayer").selectAll("g.contour."+r).data(e);return n.enter().append("g").classed("contour",!0).classed(r,!0),n.exit().remove(),n}function p(t,e,r){var n=t.selectAll("g.contourbg").data([0]);n.enter().append("g").classed("contourbg",!0);var i=n.selectAll("path").data("fill"===r.coloring?[0]:[]);i.enter().append("path"),i.exit().remove(),i.attr("d","M"+e.join("L")+"Z").style("stroke","none")}function g(t,e,r,n){var i=t.selectAll("g.contourfill").data([0]);i.enter().append("g").classed("contourfill",!0);var a=i.selectAll("path").data("fill"===n.coloring?e:[]);a.enter().append("path"),a.exit().remove(),a.each(function(t){var e=m(t,r);e?b.select(this).attr("d",e).style("stroke","none"):b.select(this).remove()})}function m(t,e){function r(t){return Math.abs(t[1]-e[0][1])<.01}function n(t){return Math.abs(t[1]-e[2][1])<.01}function i(t){return Math.abs(t[0]-e[0][0])<.01}function a(t){return Math.abs(t[0]-e[2][0])<.01}for(var o,s,l,u,c,h,f=t.edgepaths.length||t.z[0][0]=0&&(s=m,u=c):Math.abs(o[1]-s[1])<.01?Math.abs(o[1]-m[1])<.01&&(m[0]-o[0])*(s[0]-m[0])>=0&&(s=m,u=c):_.log("endpt to newendpt is not vert. or horz.",o,s,m)}if(o=s,u>=0)break;f+="L"+s}if(u===t.edgepaths.length){_.log("unclosed perimeter path");break}d=u,g=p.indexOf(d)===-1,g&&(d=p[0],f+="Z")}for(d=0;d1;if(p&&!f&&"category"!==a.type){var g=e.length;if(!(g<=i))return h?e.slice(0,i):e.slice(0,i+1);if(h||d)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;ly;n++)o=l(t,e,a(o));return o>y&&h.log("interp2d didn't converge quickly",o),t}function s(t){var e,r,n,i,a,o,s,l,u=[],c={},h=[],f=t[0],d=[],p=[0,0,0],g=v(t);for(r=0;r=0;a--)i=h[a],r=i[0],n=i[1],o=((c[[r-1,n]]||p)[2]+(c[[r+1,n]]||p)[2]+(c[[r,n-1]]||p)[2]+(c[[r,n+1]]||p)[2])/20,o&&(s[i]=[r,n,o],h.splice(a,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,a,o,s,l,u,c,h,f,d,p,g,m=0;for(o=0;op&&(m=Math.max(m,Math.abs(t[i][a]-d)/(g-p))))}return m}var u=t("fast-isnumeric"),c=t("../../registry"),h=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),m=t("./convert_column_xyz"),v=t("./max_row_length");e.exports=function(t,e){function r(t){S=e._input.zsmooth=e.zsmooth=!1,h.notifier("cannot fast-zsmooth: "+t)}var a,l,u,y,x,b,_,w,M=f.getFromId(t,e.xaxis||"x"),A=f.getFromId(t,e.yaxis||"y"),k=c.traceIs(e,"contour"),T=c.traceIs(e,"histogram"),E=c.traceIs(e,"gl2d"),S=k?"best":e.zsmooth;if(M._minDtick=0,A._minDtick=0,T){var L=d(t,e);a=L.x,l=L.x0,u=L.dx,y=L.y,x=L.y0,b=L.dy,_=L.z}else g(e)&&m(e,M,A),a=e.x?M.makeCalcdata(e,"x"):[],y=e.y?A.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,x=e.y0||0,b=e.dy||1,_=n(e),(k||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=o(_,e._emptypoints,e._interpz));if("fast"===S)if("log"===M.type||"log"===A.type)r("log axis found");else if(!T){if(a.length){var z=(a[a.length-1]-a[0])/(a.length-1),C=Math.abs(z/100);for(w=0;wC){r("x scale is not linear");break}}if(y.length&&"fast"===S){var I=(y[y.length-1]-y[0])/(y.length-1),P=Math.abs(I/100);for(w=0;wP){r("y scale is not linear");break}}}var D=v(_),O="scaled"===e.xtype?"":a,R=i(e,O,l,u,D,M),F="scaled"===e.ytype?"":y,j=i(e,F,x,b,_.length,A);E||(f.expand(M,R),f.expand(A,j));var N={x:R,y:j,z:_};if(p(e,_,"","z"),k&&e.contours&&"heatmap"===e.contours.coloring){var B="contour"===e.type?"heatmap":"histogram2d";N.xfill=i(B,O,l,u,D,M),N.yfill=i(B,F,x,b,_.length,A)}return[N]};var y=.01,x=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":539,"../../lib":633,"../../plots/cartesian/axes":664,"../../registry":739,"../histogram2d/calc":812,"./convert_column_xyz":793,"./has_columns":795,"./max_row_length":798,"fast-isnumeric":104}],792:[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="cb"+r.uid,u=r.zmin,c=r.zmax;if(n(u)||(u=i.aggNums(Math.min,null,r.z)),n(c)||(c=i.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void a.autoMargin(t,l);var h=e[0].t.cb=s(t,l),f=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});h.fillcolor(f).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":536,"../../components/colorscale":547,"../../lib":633,"../../plots/plots":724,"fast-isnumeric":104}],793:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a=t.x.slice(),o=t.y.slice(),s=t.z,l=t.text,u=Math.min(a.length,o.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(u=y[0].length||h<0||h>y.length)return}else{if(n.inbox(e-m[0],e-m[m.length-1])>a||n.inbox(r-v[0],r-v[v.length-1])>a)return;if(s){var w;for(b=[2*m[0]-m[1]],w=1;w0&&a0&&s0;)_=m.c2p(E[k]),k--;for(_0;)A=v.c2p(S[k]),k--;if(A0&&(n=!0);for(var s=0;sa)return r[t]=a,a-r[t]}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]=0&&yF;r--)if(h[r]){j=r;break}for(r=F;r<=j;r++)n(c[r])&&n(h[r])&&R.push({p:c[r],s:h[r],b:0});return R}}},{"../../lib":633,"../../plots/cartesian/axes":664,"./average":803,"./bin_functions":805,"./clean_bins":807,"./norm_functions":810,"fast-isnumeric":104}],807:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib").cleanDate,a=t("../../constants/numerical").ONEDAY;e.exports=function(t,e,r){var o=e.type,s=r+"bins",l=t[s];l||(l=t[s]={});var u="date"===o?function(t){return t||0===t?i(t):null}:function(t){return n(t)?Number(t):null};l.start=u(l.start),l.end=u(l.end);var c="date"===o?a:1,h=l.size;if(n(h))l.size=h>0?Number(h):c;else if("string"!=typeof h)l.size=c;else{var f=h.charAt(0),d=h.substr(1);d=n(d)?Number(d):0,(d<=0||"date"!==o||"M"!==f||d!==Math.round(d))&&(l.size=c)}var p="autobin"+r;"boolean"!=typeof t[p]&&(t[p]=!((l.start||0===l.start)&&(l.end||0===l.end))),t[p]||delete t["nbins"+r]}},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],808:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),a=t("./bin_defaults"),o=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,i){return n.coerce(t,e,l,r,i)}var h=c("x"),f=c("y");c("text");var d=c("orientation",f&&!h?"h":"v"),p=e["v"===d?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===d?"x":"y"];g&&c("histfunc");var m="h"===d?["y"]:["x"];a(t,e,c,m),o(t,e,c,r,u),s(t,e,i.defaultLine,{axis:"y"}),s(t,e,i.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":533,"../../components/errorbars/defaults":561,"../../lib":633,"../bar/style_defaults":760,"./attributes":802,"./bin_defaults":804}],809:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("../bar/layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("../bar/layout_defaults"),n.calc=t("./calc"),n.setPositions=t("../bar/set_positions"),n.plot=t("../bar/plot"),n.style=t("../bar/style"),n.colorbar=t("../scatter/colorbar"),n.hoverPoints=t("../bar/hover"),n.moduleType="trace",n.name="histogram",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":672,"../bar/hover":752,"../bar/layout_attributes":754,"../bar/layout_defaults":755,"../bar/plot":756,"../bar/set_positions":757,"../bar/style":759,"../scatter/colorbar":849,"./attributes":802,"./calc":806,"./defaults":808}],810:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;iy&&g.splice(y,g.length-y),v.length>y&&v.splice(y,v.length-y),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(g,p,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start=p.c2r(i.tickIncrement(p.r2c(e.xbins.start),e.xbins.size,!0)),e.xbins.end=p.c2r(i.tickIncrement(p.r2c(e.xbins.end),e.xbins.size))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(v,m,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start=m.c2r(i.tickIncrement(m.r2c(e.ybins.start),e.ybins.size,!0)),e.ybins.end=m.c2r(i.tickIncrement(m.r2c(e.ybins.end),e.ybins.size))),e._input.ybins=e.ybins),f=[];var x,b,_=[],w=[],M="string"==typeof e.xbins.size?[]:e.xbins,A="string"==typeof e.xbins.size?[]:e.ybins,k=0,T=[],E=e.histnorm,S=e.histfunc,L=E.indexOf("density")!==-1,z="max"===S||"min"===S,C=z?null:0,I=a.count,P=o[E],D=!1,O=[],R=[],F="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";F&&"count"!==S&&(D="avg"===S,I=a[S]);var j=e.xbins,N=p.r2c(j.start),B=p.r2c(j.end)+(N-i.tickIncrement(N,j.size))/1e6;for(d=N;d=0&&x=0&&b0)s=h(t.alphahull,l);else{var u=["x","y","z"].indexOf(t.delaunayaxis);s=c(l.map(function(t){return[t[(u+1)%3],t[(u+2)%3]]}))}var p={positions:l,cells:s,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:d(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",p.vertexIntensity=t.intensity,p.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolors[0],p.vertexColors=a(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],p.cellColors=a(t.facecolor)):(this.color=t.color,p.meshColor=d(t.color)),this.mesh.update(p)},p.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=s},{"../../lib/str2rgbarray":646,"alpha-shape":32,"convex-hull":84,"delaunay-triangulate":96,"gl-mesh3d":173,tinycolor2:489}],821:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorbar/defaults"),a=t("./attributes");e.exports=function(t,e,r,o){function s(r,i){return n.coerce(t,e,a,r,i)}function l(t){var e=t.map(function(t){var e=s(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=l(["x","y","z"]),c=l(["i","j","k"]);return u?(c&&c.forEach(function(t){for(var e=0;ee}}},r.addRangeSlider=function(t){t.xaxis||(t.xaxis={}),t.xaxis.rangeslider||(t.xaxis.rangeslider={})}},{"../../lib":633}],827:[function(t,e,r){"use strict";var n=t("../../plot_api/register");e.exports={moduleType:"trace",name:"ohlc",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","showLegend"],meta:{},attributes:t("./attributes"),supplyDefaults:t("./defaults")},n(t("../scatter")),n(t("./transform"))},{"../../plot_api/register":654,"../../plots/cartesian":672,"../scatter":856,"./attributes":823,"./defaults":824,"./transform":829}],828:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,i=r("x"),a=r("open"),o=r("high"),s=r("low"),l=r("close");return n=Math.min(a.length,o.length,s.length,l.length),i&&(n=Math.min(n,i.length),n1)){var h=o.distinctVals(c.x.map(e.d2c)).minDiff;a=Math.min(a,h)}}for(a===1/0&&(a=1),u=0;u");_.push(o,o,o,o,o,o,null)},C=0;C")}return g};var l},{"../../components/color":533,"./helpers":834,"fast-isnumeric":104,tinycolor2:489}],833:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,a){function o(r,a){return n.coerce(t,e,i,r,a)}var s=n.coerceFont,l=o("values");if(!Array.isArray(l)||!l.length)return void(e.visible=!1);var u=o("labels");Array.isArray(u)||(o("label0"),o("dlabel"));var c=o("marker.line.width");c&&o("marker.line.color");var h=o("marker.colors");Array.isArray(h)||(e.marker.colors=[]),o("scalegroup");var f=o("text"),d=o("textinfo",Array.isArray(f)?"text+percent":"percent");if(o("hoverinfo",1===a._dataLength?"label+text+value+percent":void 0),d&&"none"!==d){var p=o("textposition"),g=Array.isArray(p)||"auto"===p,m=g||"inside"===p,v=g||"outside"===p;if(m||v){var y=s(o,"textfont",a.font);m&&s(o,"insidetextfont",y),v&&s(o,"outsidetextfont",y)}}o("domain.x"),o("domain.y"),o("hole"),o("sort"),o("direction"),o("rotation"),o("pull")}},{"../../lib":633,"./attributes":830}],834:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return r.lastIndexOf(".")!==-1&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return r.lastIndexOf(".")!==-1&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":633}],835:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.layoutAttributes=t("./layout_attributes"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.styleOne=t("./style_one"),n.moduleType="trace",n.name="pie",n.basePlotModule=t("./base_plot"),n.categories=["pie","showLegend"],n.meta={},e.exports=n},{"./attributes":830,"./base_plot":831,"./calc":832,"./defaults":833,"./layout_attributes":836,"./layout_defaults":837,"./plot":838,"./style":839,"./style_one":840}],836:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],837:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e){function r(r,a){return n.coerce(t,e,i,r,a)}r("hiddenlabels")}},{"../../lib":633,"./layout_attributes":836}],838:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.sqrt(t.width*t.width+t.height*t.height),a=t.width/t.height,o=Math.PI*Math.min(e.v/r.vTotal,.5),s=1-r.trace.hole,l=i(e,r),u={scale:l*r.r*2/n,rCenter:1-l,rotate:0};if(u.scale>=1)return u;var c=a+1/(2*Math.tan(o)),h=r.r*Math.min(1/(Math.sqrt(c*c+.5)+c),s/(Math.sqrt(a*a+s/2)+a)),f={scale:2*h/t.height,rCenter:Math.cos(h/r.r)-h*a/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90},d=1/a,p=d+1/(2*Math.tan(o)),g=r.r*Math.min(1/(Math.sqrt(p*p+.5)+p),s/(Math.sqrt(d*d+s/2)+d)),m={scale:2*g/t.width,rCenter:Math.cos(g/r.r)-g/a/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>f.scale?m:f;return u.scale<1&&v.scale>u.scale?v:u}function i(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var r=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(r)),(1-e.trace.hole)/2)}function a(t,e){var r=e.pxmid[0],n=e.pxmid[1],i=t.width/2,a=t.height/2;return r<0&&(i*=-1),n<0&&(a*=-1),{scale:1,rCenter:1,rotate:0,x:i+Math.abs(a)*(i>0?1:-1)/2,y:a/(1+r*r/(n*n)),outside:!0}}function o(t,e){function r(t,e){return t.pxmid[1]-e.pxmid[1]}function n(t,e){return e.pxmid[1]-t.pxmid[1]}function i(t,r){r||(r={});var n,i,a,s,f,d,g=r.labelExtraY+(o?r.yLabelMax:r.yLabelMin),m=o?t.yLabelMin:t.yLabelMax,v=o?t.yLabelMax:t.yLabelMin,y=t.cyFinal+u(t.px0[1],t.px1[1]),x=g-m;if(x*h>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(i=0;i=e.pull[a.i]||((t.pxmid[1]-a.pxmid[1])*h>0?(s=a.cyFinal+u(a.px0[1],a.px1[1]),x=s-m-t.labelExtraY,x*h>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*h>0&&(n=3*c*Math.abs(i-p.indexOf(t)),f=a.cxFinal+l(a.px0[0],a.px1[0]),d=f+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX,d*c>0&&(t.labelExtraX+=d)))}var a,o,s,l,u,c,h,f,d,p,g,m,v;for(o=0;o<2;o++)for(s=o?r:n,u=o?Math.max:Math.min,h=o?1:-1,a=0;a<2;a++){for(l=a?Math.max:Math.min,c=a?1:-1,f=t[o][a],f.sort(s),d=t[1-o][a],p=d.concat(f),m=[],g=0;gc&&(c=s.pull[a]);o.r=Math.min(r/u(s.tilt,Math.sin(l),s.depth),n/u(s.tilt,Math.cos(l),s.depth))/(2+2*c),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&&d.indexOf(s.scalegroup)===-1&&d.push(s.scalegroup)}for(a=0;ah.vTotal/2?1:0)}function u(t,e,r){if(!t)return 1;var n=Math.sin(t*Math.PI/180);return Math.max(.01,r*n*Math.abs(e)+2*Math.sqrt(1-n*n*e*e))}var c=t("d3"),h=t("../../plots/cartesian/graph_interact"),f=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;s(e,r._size);var u=r._pielayer.selectAll("g.trace").data(e);u.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),u.exit().remove(),u.order(),u.each(function(e){var s=c.select(this),u=e[0],m=u.trace,v=0,y=(m.depth||0)*u.r*Math.sin(v)/2,x=m.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=u.r*Math.cos(v),M=s.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);M.enter().append("g").attr("class",function(t){return t+" part"}),M.exit().remove(),M.order(),l(e),s.selectAll(".top").each(function(){var s=c.select(this).selectAll("g.slice").data(e);s.enter().append("g").classed("slice",!0),s.exit().remove();var l=[[[],[]],[[],[]]],v=!1;s.each(function(o){function s(e){var n=t._fullLayout,a=t._fullData[m.index],s=a.hoverinfo;if("all"===s&&(s="label+text+value+percent+name"),!t._dragging&&n.hovermode!==!1&&"none"!==s&&"skip"!==s&&s){var l=i(o,u),c=M+o.pxmid[0]*(1-l),f=A+o.pxmid[1]*(1-l),d=r.separators,p=[];s.indexOf("label")!==-1&&p.push(o.label),a.text&&a.text[o.i]&&s.indexOf("text")!==-1&&p.push(a.text[o.i]),s.indexOf("value")!==-1&&p.push(g.formatPieValue(o.v,d)),s.indexOf("percent")!==-1&&p.push(g.formatPiePercent(o.v/u.vTotal,d)),h.loneHover({x0:c-l*u.r,x1:c+l*u.r,y:f,text:p.join("
"),name:s.indexOf("name")!==-1?a.name:void 0,color:o.color,idealAlign:o.pxmid[0]<0?"left":"right"},{container:n._hoverlayer.node(),outerContainer:n._paper.node()}),h.hover(t,e,"pie"),E=!0}}function f(e){t.emit("plotly_unhover",{points:[e]}),E&&(h.loneUnhover(r._hoverlayer.node()),E=!1)}function y(){t._hoverdata=[o],t._hoverdata.trace=e.trace,h.click(t,{target:!0})}function b(t,e,r,n){return"a"+n*u.r+","+n*w+" "+x+" "+o.largeArc+(r?" 1 ":" 0 ")+n*(e[0]-t[0])+","+n*(e[1]-t[1])}if(o.hidden)return void c.select(this).selectAll("path,g").remove();l[o.pxmid[1]<0?0:1][o.pxmid[0]<0?0:1].push(o);var M=u.cx+_[0],A=u.cy+_[1],k=c.select(this),T=k.selectAll("path.surface").data([o]),E=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),k.select("path.textline").remove(),k.on("mouseover",s).on("mouseout",f).on("click",y),m.pull){var S=+(Array.isArray(m.pull)?m.pull[o.i]:m.pull)||0;S>0&&(M+=S*o.pxmid[0],A+=S*o.pxmid[1])}o.cxFinal=M,o.cyFinal=A;var L=m.hole;if(o.v===u.vTotal){var z="M"+(M+o.px0[0])+","+(A+o.px0[1])+b(o.px0,o.pxmid,!0,1)+b(o.pxmid,o.px0,!0,1)+"Z";L?T.attr("d","M"+(M+L*o.px0[0])+","+(A+L*o.px0[1])+b(o.px0,o.pxmid,!1,L)+b(o.pxmid,o.px0,!1,L)+"Z"+z):T.attr("d",z)}else{var C=b(o.px0,o.px1,!0,1);if(L){var I=1-L;T.attr("d","M"+(M+L*o.px1[0])+","+(A+L*o.px1[1])+b(o.px1,o.px0,!1,L)+"l"+I*o.px0[0]+","+I*o.px0[1]+C+"Z")}else T.attr("d","M"+M+","+A+"l"+o.px0[0]+","+o.px0[1]+C+"Z")}var P=Array.isArray(m.textposition)?m.textposition[o.i]:m.textposition,D=k.selectAll("g.slicetext").data(o.text&&"none"!==P?[0]:[]);D.enter().append("g").classed("slicetext",!0),D.exit().remove(),D.each(function(){var t=c.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(o.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(d.font,"outside"===P?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,r=d.bBox(t.node());"outside"===P?e=a(r,o):(e=n(r,o,u),"auto"===P&&e.scale<1&&(t.call(d.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),r=d.bBox(t.node())),e=a(r,o)));var i=M+o.pxmid[0]*e.rCenter+(e.x||0),s=A+o.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(o.yLabelMin=s-r.height/2,o.yLabelMid=s,o.yLabelMax=s+r.height/2,o.labelExtraX=0,o.labelExtraY=0,v=!0),t.attr("transform","translate("+i+","+s+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(r.left+r.right)/2+","+-(r.top+r.bottom)/2+")")})}),v&&o(l,m),s.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=c.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],i=t.cyFinal+t.pxmid[1],a="M"+n+","+i,o=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var s=t.labelExtraX*t.pxmid[1]/t.pxmid[0],l=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);a+=Math.abs(s)>Math.abs(l)?"l"+l*t.pxmid[0]/t.pxmid[1]+","+l+"H"+(n+t.labelExtraX+o):"l"+t.labelExtraX+","+s+"v"+(l-s)+"h"+o}else a+="V"+(t.yLabelMid+t.labelExtraY)+"h"+o;e.append("path").classed("textline",!0).call(f.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:a,fill:"none"})}})})}),setTimeout(function(){u.selectAll("tspan").each(function(){var t=c.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":533,"../../components/drawing":556,"../../lib/svg_text_utils":647,"../../plots/cartesian/graph_interact":671,"./helpers":834,d3:95}],839:[function(t,e,r){"use strict";var n=t("d3"),i=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],r=e.trace,a=n.select(this);a.style({opacity:r.opacity}),a.selectAll(".top path.surface").each(function(t){n.select(this).call(i,t,r)})})}},{"./style_one":840,d3:95}],840:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var i=r.marker.line.color;Array.isArray(i)&&(i=i[e.i]||n.defaultLine);var a=r.marker.line.width||0;Array.isArray(a)&&(a=a[e.i]||0),t.style({"stroke-width":a,fill:e.color}).call(n.stroke,i)}},{"../../components/color":533}],841:[function(t,e,r){"use strict";var n=t("../scattergl/attributes");e.exports={x:n.x,y:n.y,xy:{valType:"data_array"},indices:{valType:"data_array"},xbounds:{valType:"data_array"},ybounds:{valType:"data_array"},text:n.text,marker:{color:{valType:"color",arrayOk:!1},opacity:{valType:"number",min:0,max:1,dflt:1,arrayOk:!1},blend:{valType:"boolean",dflt:null},sizemin:{valType:"number",min:.1,max:2,dflt:.5},sizemax:{valType:"number",min:.1,dflt:20},border:{color:{valType:"color",arrayOk:!1},arearatio:{valType:"number",min:0,max:1,dflt:0}}}}},{"../scattergl/attributes":882}],842:[function(t,e,r){"use strict";function n(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=a(t.glplot,this.pointcloudOptions),this.pointcloud._trace=this}function i(t,e){var r=new n(t,e.uid);return r.update(e),r}var a=t("gl-pointcloud2d"),o=t("../../lib/str2rgbarray"),s=t("../scatter/get_trace_color"),l=["xaxis","yaxis"],u=n.prototype;u.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}},u.update=function(t){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=s(t,{})},u.updateFast=function(t){var e,r,n,i,a,s,l=this.xData=this.pickXData=t.x,u=this.yData=this.pickYData=t.y,c=this.pickXYData=t.xy,h=t.xbounds&&t.ybounds,f=t.indices,d=this.bounds;if(c){if(n=c,e=c.length>>>1,h)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);if(f)r=f;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var p=o(t.marker.color),g=o(t.marker.border.color),m=t.opacity*t.marker.opacity;p[3]*=m,this.pointcloudOptions.color=p;var v=t.marker.blend;if(null===v){var y=100;v=l.lengthp&&f.splice(p,f.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},m={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var v={type:"linear"};i.setConvert(v),l=v.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||f[0]===f[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||f[0]===f[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,i.expand(c,f,g),i.expand(h,d,m);var b=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],849:[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,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,h=l.cmin,f=l.cmax;n(h)||(h=i.aggNums(Math.min,null,c)),n(f)||(f=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,h,f),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:h,end:f,size:(f-h)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":536,"../../components/colorscale":547,"../../lib":633,"../../plots/plots":724,"fast-isnumeric":104}],850:[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":866}],851:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],852:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),h=t("./text_defaults"),f=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var m=s(t,e,g),v=mU!=P>=U&&(z=S[T-1][0],C=S[T][0],L=z+(C-z)*(U-I)/(P-I),F=Math.min(F,L),j=Math.max(j,L));F=Math.max(F,0),j=Math.min(j,f._length);var V=l.defaultLine;return l.opacity(h.fillcolor)?V=h.fillcolor:l.opacity((h.line||{}).color)&&(V=h.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:F,x1:j,y0:U,y1:U,color:V}),delete t.index,h.text&&!Array.isArray(h.text)?t.text=String(h.text):t.text=h.name,[t]}}}},{"../../components/color":533,"../../components/errorbars":562,"../../lib":633,"../../plots/cartesian/constants":669,"../../plots/cartesian/graph_interact":671,"./get_trace_color":854}],856:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":672,"./arrays_to_calcdata":845,"./attributes":846,"./calc":847,"./clean_data":848,"./colorbar":849,"./defaults":852,"./hover":855,"./plot":863,"./select":864,"./style":865,"./subtypes":866}],857:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546}],858:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),i=M.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/w._length,r=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,h,f,d,p,g,m,v,y,x,b,_,w=e.xaxis,M=e.yaxis,A=e.simplify,k=e.connectGaps,T=e.baseTolerance,E=e.linear,S=[],L=.2,z=new Array(t.length),C=0;for(A||(T=L=-1),o=0;oi(h))break;l=h,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,u=h,d=!1):y=t.length||!h)break;z[C++]=h,s=h}}else z[C++]=u}S.push(z.slice(0,C))}return S}},{"../../constants/numerical":616}],859:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],860:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":104}],862:[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){var u,c=o.isBubble(t),h=(t.line||{}).color;h&&(r=h),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=h&&!Array.isArray(h)&&e.marker.color!==h?h:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":533,"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546,"./subtypes":866}],863:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function i(t,e,r,n,i,d,g){function m(t){return A?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,r,n=t[0].trace,i=o.select(this),a=c.hasMarkers(n),u=c.hasText(n),h=x(n),f=b,d=b;a&&(f=n.marker.maxdisplayed?v:s.identity),u&&(d=n.marker.maxdisplayed?v:s.identity),r=i.selectAll("path.point"),e=r.data(f,h);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,n).call(l.translatePoints,k,T,n),A&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=m(o.select(this));l.translatePoint(t,e,k,T),l.singlePointStyle(t,e,n)}),A?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=i.selectAll("g"),e=r.data(d,h),e.enter().append("g").append("text"),e.each(function(t){var e=m(o.select(this).select("text"));l.translatePoint(t,e,k,T)}),e.selectAll("text").call(l.textPointStyle,n).each(function(t){var e=t.xp||k.c2p(t.x),r=t.yp||T.c2p(t.y);o.select(this).selectAll("tspan").each(function(){m(o.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,M;a(t,e,r,n,i);var A=!!g&&g.duration>0,k=r.xaxis,T=r.yaxis,E=n[0].trace,S=E.line,L=o.select(d);if(L.call(u.plot,r,g),E.visible===!0){m(L).style("opacity",E.opacity);var z,C,I=E.fill.charAt(E.fill.length-1);"x"!==I&&"y"!==I&&(I=""),n[0].node3=L,h(n);var P="",D=[],O=E._prevtrace;O&&(P=O._prevRevpath||"",C=O._nextFill,D=O._polygons);var R,F,j,N,B,U,V,q,H,G="",X="",Y=[],W=[],Z=s.noop;if(z=E._ownFill,c.hasLines(E)||"none"!==E.fill){for(C&&C.datum(n),["hv","vh","hvh","vhv"].indexOf(S.shape)!==-1?(j=l.steps(S.shape),N=l.steps(S.shape.split("").reverse().join(""))):j=N="spline"===S.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),S.smoothing):l.smoothopen(t,S.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return N(t.reverse())},Y=f(n,{xaxis:k,yaxis:T,connectGaps:E.connectgaps,baseTolerance:Math.max(S.width||1,3)/4,linear:"linear"===S.shape,simplify:S.simplify}),H=E._polygons=new Array(Y.length),M=0;M1}),Z=function(t){return function(e){if(R=j(e),F=B(e),G?I?(G+="L"+R.substr(1),X=F+("L"+X.substr(1))):(G+="Z"+R,X=F+"Z"+X):(G=R,X=F),c.hasLines(E)&&e.length>1){var r=o.select(this);if(r.datum(n),t)m(r.style("opacity",0).attr("d",R).call(l.lineGroupStyle)).style("opacity",1);else{var i=m(r);i.attr("d",R),l.singleLineStyle(n,i)}}}}}var Q=L.selectAll(".js-line").data(W);m(Q.exit()).style("opacity",0).remove(),Q.each(Z(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Z(!0)),Y.length&&(z?U&&q&&(I?("y"===I?U[1]=q[1]=T.c2p(0,!0):"x"===I&&(U[0]=q[0]=k.c2p(0,!0)),m(z).attr("d","M"+q+"L"+U+"L"+G.substr(1))):m(z).attr("d",G+"Z")):"tonext"===E.fill.substr(0,6)&&G&&P&&("tonext"===E.fill?m(C).attr("d",G+"Z"+P+"Z"):m(C).attr("d",G+"L"+P.substr(1)+"Z"),E._polygons=E._polygons.concat(D)),E._prevRevpath=X,E._prevPolygons=H);var K=L.selectAll(".points");w=K.data([n]),K.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,s=r.yaxis,l=o.extent(a.range.map(a.r2l).map(a.l2c)),u=o.extent(s.range.map(s.r2l).map(s.l2c)),h=n[0].trace;if(c.hasMarkers(h)){var f=h.marker.maxdisplayed;if(0!==f){var d=n.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/f),g=0;i.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),h=c.data(r,function(t){return t[0].trace.uid}),h.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,r),n(t,p),l=0,u=[];ln?1:-1}),m){s&&(f=s());var v=o.transition().duration(a.duration).ease(a.easing).each("end",function(){f&&f()}).each("interrupt",function(){f&&f()});v.each(function(){p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)})})}else p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)});g&&h.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":556,"../../components/errorbars":562,"../../lib":633,"../../lib/polygon":640,"./arrays_to_calcdata":845,"./line_points":858,"./link_traces":860,"./subtypes":866,d3:95}],864:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,h=[],f=l[0].trace,d=f.index,p=f.marker,g=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return M[t]}function u(t,e,r,n,i){var a=null;if(Array.isArray(t)){a=[];for(var o=0;o=0){var f=i(l.position,l.delaunayColor,l.delaunayAxis);f.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(f):(f.gl=o,this.delaunayMesh=m(f),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},k.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=f},{"../../constants/gl3d_dashes":614,"../../constants/gl_markers":615,"../../lib":633,"../../lib/gl_format_color":631,"../../lib/str2rgbarray":646,"../scatter/make_bubble_size_func":861,"./calc_errors":871,"delaunay-triangulate":96,"gl-error3d":133,"gl-line3d":140,"gl-mesh3d":173,"gl-scatter3d":216}],873:[function(t,e,r){"use strict";function n(t,e,r){var n=0,i=r("x"),a=r("y"),o=r("z");return i&&a&&o&&(n=Math.min(i.length,a.length,o.length),n=0&&f("surfacecolor",p||g);for(var m=["x","y","z"],v=0;v<3;++v){var y="projection."+m[v];f(y+".show")&&(f(y+".opacity"),f(y+".scale"))}u(t,e,r,{axis:"z"}),u(t,e,r,{axis:"y",inherit:"z"}),u(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":561,"../../lib":633,"../scatter/line_defaults":857,"../scatter/marker_defaults":862,"../scatter/subtypes":866,"../scatter/text_defaults":867,"./attributes":869}],874:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl_markers":615,"../../plots/gl3d":703,"../scatter/colorbar":849,"./attributes":869,"./calc":870,"./convert":872,"./defaults":873}],875:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),a=t("../../components/colorscale/color_attributes"),o=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={lon:{valType:"data_array"},lat:{valType:"data_array"},locations:{valType:"data_array"},locationmode:{valType:"enumerated",values:["ISO-3","USA-states","country names"],dflt:"ISO-3"},mode:o({},n.mode,{dflt:"markers"}),text:o({},n.text,{}),textfont:n.textfont,textposition:n.textposition,line:{color:l.color,width:l.width,dash:l.dash},connectgaps:n.connectgaps,marker:o({},{symbol:s.symbol,opacity:s.opacity,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,colorbar:s.colorbar,line:o({},{width:u.width},a("marker.line"))},a("marker")),fill:{valType:"enumerated",values:["none","toself"],dflt:"none"},fillcolor:n.fillcolor,hoverinfo:o({},i.hoverinfo,{flags:["lon","lat","location","text","name"]})}},{"../../components/colorscale/color_attributes":540,"../../lib/extend":626,"../../plots/attributes":662,"../scatter/attributes":846}],876:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../scatter/colorscale_calc");e.exports=function(t,e){for(var r=Array.isArray(e.locations),a=r?e.locations.length:e.lon.length,o=[],s=0,l=0;l0&&(o[s-1].gapAfter=!0):(s++,o.push(c))}return i(e),o}},{"../scatter/colorscale_calc":850,"fast-isnumeric":104}],877:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=0,o=r("locations");return o?(r("locationmode"),a=o.length):(n=r("lon")||[],i=r("lat")||[],a=Math.min(n.length,i.length),a")}var i=t("../../plots/cartesian/graph_interact"),a=t("../../plots/cartesian/axes"),o=t("../scatter/get_trace_color"),s=t("./attributes");e.exports=function(t){function e(t){return c.projection(t)}function r(t){var r=t.lonlat;if(null===r[0]||null===r[1])return 1/0;if(c.isLonLatOverEdges(r))return 1/0;var n=e(r),i=l.c2p(),a=u.c2p(),o=Math.abs(i-n[0]),s=Math.abs(a-n[1]),h=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(o*o+s*s)-h,1-3/h)}var a=t.cd,s=a[0].trace,l=t.xa,u=t.ya,c=t.subplot;if(!a[0].placeholder&&(i.getClosest(a,r,t),t.index!==!1)){var h=a[t.index],f=h.lonlat,d=e(f),p=h.mrc||1;return t.x0=d[0]-p,t.x1=d[0]+p,t.y0=d[1]-p,t.y1=d[1]+p,t.loc=h.loc,t.lat=f[0],t.lon=f[1],t.color=o(s,h),t.extraText=n(s,h,c.mockAxis),[t]}}},{"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"../scatter/get_trace_color":854,"./attributes":875}],880:[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.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.moduleType="trace",n.name="scattergeo",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/geo":688,"../scatter/colorbar":849,"./attributes":875,"./calc":876,"./defaults":877,"./event_data":878,"./hover":879,"./plot":881}],881:[function(t,e,r){"use strict";function n(t,e){if(!Array.isArray(t.locations))return u.identity;var r=c(t,e),n=t.locationmode;return function(t){var e=h(n,t.loc,r);return e?(t.lonlat=e.properties.ct,t):(t.lonlat=[null,null],!1)}}function i(t,e,r){function n(t,n){d(t,e,n,r)}var i=t.marker;if(n(t.text,"tx"),n(t.textposition,"tp"),t.textfont&&(n(t.textfont.size,"ts"),n(t.textfont.color,"tc"),n(t.textfont.family,"tf")),i&&i.line){var a=i.line;n(i.opacity,"mo"),n(i.symbol,"mx"),n(i.color,"mc"),n(i.size,"ms"),n(a.color,"mlc"),n(a.width,"mlw")}}function a(t){var e=t.framework.selectAll("g.trace.scattergeo");e.style("opacity",function(t){return t[0].trace.opacity}),e.each(function(t){var e=t[0].trace,r=o.select(this);r.selectAll("path.point").call(s.pointStyle,e),r.selectAll("text").call(s.textPointStyle,e)}),e.selectAll("path.js-line").style("fill","none").each(function(t){var e=o.select(this),r=t.trace,n=r.line||{};e.call(l.stroke,n.color).call(s.dashLine,n.dash||"",n.width||0),"none"!==r.fill&&e.call(l.fill,r.fillcolor)})}var o=t("d3"),s=t("../../components/drawing"),l=t("../../components/color"),u=t("../../lib"),c=t("../../lib/topojson_utils").getTopojsonFeatures,h=t("../../lib/geo_location_utils").locationToFeature,f=t("../../lib/geojson_utils"),d=t("../../lib/array_to_calc_item"),p=t("../scatter/subtypes");e.exports=function(t,e){function r(t){return t[0].trace.uid}var s=t.framework.select(".scattergeolayer").selectAll("g.trace.scattergeo").data(e,r);s.enter().append("g").attr("class","trace scattergeo"),s.exit().remove(),s.selectAll("*").remove(),s.each(function(e){var r=o.select(this),a=e[0].trace,s=n(a,t.topojson);e[0].placeholder&&r.remove();for(var l=[],u=0;u=e.length?i:e[a]);return n}function o(t,e,r){return l(C(t,r),z(e,r),r)}function s(t,e,r,n){var i=w(t,e,n);return i=Array.isArray(i[0])?i:a(m.identity,[i],n),l(i,z(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;i0&&(v[y-1].gapAfter=!0)}return v}},{"../../components/colorscale":547,"../../lib":633,"../scatter/colorscale_calc":850,"../scatter/make_bubble_size_func":861,"../scatter/subtypes":866,"fast-isnumeric":104}],888:[function(t,e,r){"use strict";function n(){return{geojson:h.makeBlank(),layout:{visibility:"none"},paint:{}}}function i(t,e){function r(t,r,n,i){void 0===e[r][n]&&(e[r][n]=i),t[r]=e[r][n]}for(var n=t[0].trace,i=n.marker,a=Array.isArray(i.color),o=Array.isArray(i.size),s=[],l=0;l")}var i=t("../../plots/cartesian/graph_interact"),a=t("../scatter/get_trace_color");e.exports=function(t,e,r){function o(t){var e=t.lonlat,n=Math.abs(u.c2p(e)-u.c2p([d,e[1]])),i=Math.abs(c.c2p(e)-c.c2p([e[0],r])),a=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(n*n+i*i)-a,1-3/a)}var s=t.cd,l=s[0].trace,u=t.xa,c=t.ya;if(!s[0].placeholder){var h=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),f=360*h,d=e-f;if(i.getClosest(s,o,t),t.index!==!1){var p=s[t.index],g=p.lonlat,m=[g[0]+f,g[1]],v=u.c2p(m),y=c.c2p(m),x=p.mrc||1;return t.x0=v-x,t.x1=v+x,t.y0=y-x,t.y1=y+x,t.color=a(l,p),t.extraText=n(l,p),[t]}}}},{"../../plots/cartesian/graph_interact":671,"../scatter/get_trace_color":854}],892:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.plot=t("./plot"),n.moduleType="trace",n.name="scattermapbox",n.basePlotModule=t("../../plots/mapbox"),n.categories=["mapbox","gl","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/mapbox":718,"../scatter/colorbar":849,"./attributes":886,"./calc":887,"./defaults":889,"./event_data":890,"./hover":891,"./plot":893}],893:[function(t,e,r){"use strict";function n(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.mapbox.initSource(this.idSourceFill),this.mapbox.initSource(this.idSourceLine),this.mapbox.initSource(this.idSourceCircle),this.mapbox.initSource(this.idSourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle,source:this.idSourceCircle,type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var a=t("./convert"),o=n.prototype;o.update=function(t){var e=this.mapbox,r=a(t);e.setOptions(this.idLayerFill,"setLayoutProperty",r.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",r.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",r.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",r.symbol.layout),i(r.fill)&&(e.setSourceData(this.idSourceFill,r.fill.geojson), +e.setOptions(this.idLayerFill,"setPaintProperty",r.fill.paint)),i(r.line)&&(e.setSourceData(this.idSourceLine,r.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",r.line.paint)),i(r.circle)&&(e.setSourceData(this.idSourceCircle,r.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",r.circle.paint)),i(r.symbol)&&(e.setSourceData(this.idSourceSymbol,r.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",r.symbol.paint))},o.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var r=e[0].trace,i=new n(t,r.uid);return i.update(e),i}},{"./convert":888}],894:[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,u=n.line,c=l.line;e.exports={a:{valType:"data_array"},b:{valType:"data_array"},c:{valType:"data_array"},sum:{valType:"number",dflt:0,min:0},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},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},a("marker".line))},a("marker"),{showscale:l.showscale,colorbar:o}),textfont:n.textfont,textposition:n.textposition,hoverinfo:s({},i.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron}},{"../../components/colorbar/attributes":534,"../../components/colorscale/color_attributes":540,"../../lib/extend":626,"../../plots/attributes":662,"../scatter/attributes":846}],895:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=t("../scatter/subtypes"),s=t("../scatter/colorscale_calc"),l=["a","b","c"],u={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,c,h,f,d,p,g=t._fullLayout[e.subplot],m=g.sum,v=e.sum||m;for(r=0;rA&&E.splice(A,E.length-A)}return s(e),"undefined"!=typeof E&&a.mergeArray(E,k,"ms"),k}},{"../../lib":633,"../../plots/cartesian/axes":664,"../scatter/colorscale_calc":850,"../scatter/subtypes":866,"fast-isnumeric":104}],896:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),a=t("../scatter/subtypes"),o=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/line_shape_defaults"),u=t("../scatter/text_defaults"),c=t("../scatter/fillcolor_defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function d(r,i){return n.coerce(t,e,h,r,i)}var p,g=d("a"),m=d("b"),v=d("c");if(g?(p=g.length,m?(p=Math.min(p,m.length),v&&(p=Math.min(p,v.length))):p=v?Math.min(p,v.length):0):m&&v&&(p=Math.min(m.length,v.length)),!p)return void(e.visible=!1);g&&p"),s}}},{"../../plots/cartesian/axes":664,"../scatter/hover":855}],898:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/ternary":732,"../scatter/colorbar":849,"./attributes":894,"./calc":895,"./defaults":896,"./hover":897,"./plot":899,"./select":900,"./style":901}],899:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e){var r=t.plotContainer;r.select(".scatterlayer").selectAll("*").remove();for(var i={xaxis:t.xaxis,yaxis:t.yaxis,plot:r},a=new Array(e.length),o=t.graphDiv.calcdata,s=0;s":return function(t){return e(t)>n};case">=":return function(t){return e(t)>=n};case"[]":return function(t){var r=e(t);return r>=n[0]&&r<=n[1]};case"()":return function(t){var r=e(t);return r>n[0]&&r=n[0]&&rn[0]&&r<=n[1]};case"][":return function(t){var r=e(t);return r<=n[0]||r>=n[1]};case")(":return function(t){var r=e(t);return rn[1]};case"](":return function(t){var r=e(t);return r<=n[0]||r>n[1]};case")[":return function(t){var r=e(t);return r=n[1]};case"{}":return function(t){return n.indexOf(e(t))!==-1};case"}{":return function(t){return n.indexOf(e(t))===-1}}}var o=t("../lib"),s=t("../plot_api/plot_schema"),l=t("../plots/cartesian/axis_ids"),u=t("../plots/cartesian/axis_autotype"),c=t("../plots/cartesian/set_convert"),h=["=","<",">=",">","<="],f=["[]","()","[)","(]","][",")(","](",")["],d=["{}","}{"];r.moduleType="transform",r.name="filter",r.attributes={enabled:{valType:"boolean",dflt:!0},target:{valType:"string",strict:!0,noBlank:!0,arrayOk:!0,dflt:"x"},operation:{valType:"enumerated",values:[].concat(h).concat(f).concat(d),dflt:"="},value:{valType:"any",dflt:0}},r.supplyDefaults=function(t){function e(e,i){return o.coerce(t,n,r.attributes,e,i)}var n={},i=e("enabled");return i&&(e("operation"),e("value"),e("target")),n},r.calcTransform=function(t,e,r){function l(t,r){var n=g[t],i=o.nestedProperty(e,t).get();i.push(n[r])}if(r.enabled){var u=r.target,c=n(e,u),h=c.length;if(h){for(var f=i(t,e,u),d=a(r,f),p=s.findArrayAttributes(e),g={},m=0;m Date: Tue, 15 Nov 2016 16:41:06 -0500 Subject: [PATCH 03/51] remove commented out code about 3d pie chart attributes --- src/traces/pie/attributes.js | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/src/traces/pie/attributes.js b/src/traces/pie/attributes.js index fa33cd0bf12..fd99ab5da66 100644 --- a/src/traces/pie/attributes.js +++ b/src/traces/pie/attributes.js @@ -160,40 +160,6 @@ module.exports = { ].join(' ') } }, - // 3D attributes commented out until I finish them in a later PR - // tilt: { - // // degrees to tilt the pie back from straight on - // valType: 'number', - // min: 0, - // max: 90, - // dflt: 0 - // }, - // tiltaxis: { - // // degrees away from straight up to tilt the pie - // // only has an effect if tilt is nonzero - // valType: 'number', - // min: -360, - // max: 360, - // dflt: 0 - // }, - // depth: { - // // "3D" size, as a fraction of radius - // // only has an effect if tilt is nonzero - // valType: 'number', - // min: 0, - // max: 10, - // dflt: 0.5 - // }, - // shading: { - // // how much darker to make the sides than the top, - // // with a 3D effect. We could of course get all - // // fancy with lighting effects, but maybe this is - // // sufficient. - // valType: 'number', - // min: 0, - // max: 1, - // dflt: 0.2 - // }, hole: { valType: 'number', role: 'style', From 9583cfaca0c4740ac5d12ff3e4a32744dc9c2f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 16 Nov 2016 12:47:13 -0500 Subject: [PATCH 04/51] annotation: assign dflt pos if category IS NOT present --- src/plots/cartesian/axes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plots/cartesian/axes.js b/src/plots/cartesian/axes.js index 27359e06df9..bd86bb76b06 100644 --- a/src/plots/cartesian/axes.js +++ b/src/plots/cartesian/axes.js @@ -116,7 +116,7 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { // if position is given as a category name, convert it to a number if(typeof pos === 'string' && (ax._categories || []).length) { newPos = ax._categories.indexOf(pos); - containerOut[attr] = (newPos !== -1) ? dflt : newPos; + containerOut[attr] = (newPos === -1) ? dflt : newPos; return; } } From 6e7d5d6c6ecedb7451b34a438301559bc9dd7a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 16 Nov 2016 13:08:30 -0500 Subject: [PATCH 05/51] test: add annotations to mock 16 --- test/image/baselines/16.png | Bin 18044 -> 18606 bytes test/image/mocks/16.json | 156 +++++------------------------------- 2 files changed, 19 insertions(+), 137 deletions(-) diff --git a/test/image/baselines/16.png b/test/image/baselines/16.png index 446891b07b4e2daedcd3a845d003741d4f16f66d..edce238d560e3a14718182f07c5cb775b1844ef8 100644 GIT binary patch literal 18606 zcmeHvc|6o>8+Q$|v?v`pk+dQEITb=Eq7br;k!@OJC+ifUNu^CHTM?41GZ?atWk#Fq zTL?2$_H8K3V2pXMQRjJ|=bY!9zu(X2efoTKPW6h_jP@*@AbXhIc;=eBcCwe znl)=S>YY4px@HXmwPwv)JDzp$9jnf>Hfz@GTBCRTnE7S9Nh^dJM%KAFV<=$ zVygJ!hKnv~GmK@U;rem<<;%^!jdZ$N)0A<=5QC9$kXHr%oYP*jmUHt__Fp`wc45hU z^^dVX{t4exIEwb#v+LR#1P}YKwd*&d)`lL~@#9}SyWoeL{`bTGpNw$&HJ5zpfI!2O z-?i@vDafDxN*vE=oBr~q(7mUqIdz*X>N(MGoaRT0&{)cV|10XOo*Z54+JSFzh_y|V zGD{nI=F`{`I8~9ZP`RLGY3mm~)RdGfnRr<%Ow|8LYisLr?)b;dtt~5;4jJ0bnn+0&4MoW-8)kkJNDd5_Z>(G#60yj!vC2ME*s94|G#2%3 zJ|@0g|8;Qh>3l98{9|=ic>t$5h3wLqlMrzygvIE~vMnnbYKR}^sG&v<(5$`V%ff2j z)swLteqZlMjEAhjC9YlJG!v zY(I&wBg15G$f=DYN+02@d@S)gU+CFqN2g+v_{&>TPA~`}${x=eH5hK$_M~3!Po$MO z1+j2FJ-zNypLF@kg>xZ?JuBv7HXWHh$|_&RDxQ7K$+}vsAoNgP!?SYnqG-TKa-6E4 zw4)G$Cknk5f#WpRP!L@!d747bvcSbe+>NyhkmA4e<@HT(gdbJyN9+1u9p=urCnqW*2T)GsB}e)()zut zF$-V9a5kmhR~TM0o*sVVqv=WW_CB%PRQ)LHFSXRh!~GjrNn0h2W?BAp$3cEsp~oKf z@`rtj`8AhMYv0l8>I^Qw2^en0ZTgGCg8VC*H|E{o%?>WMLKWmn1y$WA=WS9{&SjMQP6u zopyl@_Hn+k)0EUBLTLGsI7QdAnMO6wB#ydwDP=oGX@lPMq`ch_eipfSWE;6T^-IWd z#grF9_E%eSCw5#SuMKIv6w5&7+D%%9tdx}2dD1k}LYDi*g2l&%lR}Vvl|js0s^M2I z+dXh0<4D^z@MIS%v9OXkZ_VnmD3x(|`t<3FcQPX*>?D#v8TY|?Eh@yuOt;;MjaY*y zgLfKnvEQjSRo=fh*|8~cWoPDcymhkoRECc|24_n1c}^KrD*hhHcyNrqa4dA)A|so^ zG^W{xHpDB_m2cPwjHX_BQ;OL}WE6NSh};rH(KMulZqw2jl!oj|Tb~BSl>@`DdlRH` z1v=XHQWaO6dSDT$MU$Q)YICXAr%63nP_DIUNcu~ z^!f+eO}?=VN~!|p6|wBuuzYE0`+j;=oOO}gx2Yu`x~cl|^qZB)25PEK@wq`HnWF#5 zTHO2mRTh&z)|s0Wf)A|U8*$`?iqFtO2u1DtYd%>aBbwPKs)G^zfv!-Ld=}+yd>Li* zdW)?RC6?@+v_$i`fe|}0)+;_r8y};TzM@Dc%+!VFpfBDr*?e?Y3?~mB6({#VaP8i; z7_n%^NiMpIInDI>dVYG%AninTiAcu`iP3m7l5soKxh-u`P)R5c$ty#k)IKfSF!s8(LLReY`}Xa^n!)8Hp?cdPpI9Zj zIDz8oC#LwNH)w&1>04~7@=oIIz*#Ev9&_@|IUtM3+jA8CuJ)AIvsDnovupD~1Shio zlpy!rpSb3K5BxxM|FgsY?C|G%p>xE{{`e6D$FkMu{u`SJzw$o&c2qp&k-?Vbgqu|r-`f~6-;Hnlp@i!W$+dhj30cR{ zU8DKee+-m=UGRwvR`6GcN-U4;dJ9CI5qz>hoZ#jQ16d+ueq(>>!_eQ2&wJl#zV%cP zzAe9{yHo(>Uu3gq!|LFV3~p?@&-FkL-F12^N-2jkCP4=4;Anv6ItO2`Pok}U6F?j(q#PV>!{17Pv0?AzBu{_!);sn{J@Jid&x%1UWllksHCg(rjN6`A? zN7UyC*OBJr$1$IF4A`AeHy<4x4Gc0rw39rH*1;R0bxxtkYs&96Yx#9Pp@ce|uTzJq zc$mX@N}tGQTznn|iq36DxaR8q&RBz}J2&>nas_1#z>vDiBV>JJ&7Ps7>$m%jG=F={ zgFoH!hPoZ=@Wl{ql>w{G;*3d^!#bphIH3n+kpX86;yL7G3AYR%3b=p~vjQ^I_7Y@E zc>mLgp&Rk`QN6zpkcDZ8@k@xhq1jJjy0FxXSlCY3A9LQHZ*L~o+P$28klwSy>8uRu zjilb4LYP6jHhTtDf1ZIGTF!i_UCwP&0f8LgkROGLC-YgTe@xhd+D74wxhaixNY_VO zbqk=Bh}d<=4n(SbP+S9cn=s1krK#UP4a>yOZc6WlDPR@PWtmIECj9-dLq}3Ehu?v{ zHsXz6w$A?l|3-@? z3(2k>PRZCgO{vVa*ncpsSak2o@zrh64VDmBgtKD7@8`%F!=;RMNY+PpWeT8Tir}<) z5U`3TMkkF4D$QCP<33WOJO~-{xziY3wAH1psBN&b31Bm4xL70Wgi&f2Wh#OW!mx)3 zX$B6$TTsbaVZ?)Q1>*m*XWc6mt+_{f!3gW|tj33rSz73uS&5#GO-E+#Cqk+)`6*8u zFj;nDz?c-IIGmRcb0V)jxuOjl^&c-4LG?*7@1A#G-B7=@sH?xgvX^KHLCfE&iKA)p z11q*gZdQQkd$~LEs@Gi+*o@ldWALYQ>4t8&Yl>EsAh;Pts7C}eD0YrSnHjZgRHjU) zbH~V78c~UUZDmuHIIi{EMjF+o%!eBj=GraoGtJVCT-vju(@s5o;Wysl{F#g$>nYA1 zs(+diBWIlz!dh8;4@Y|lHt0`BwtGIiHP`8!&-0r(=pgZECO8uItQDPGk6YSZN!1M( zPKAWz16QXuzxqH(v1zLQ%HuDP)?`CImyjvwk3fhd!AQPQ!Q0{Yj ze}8*zO^r#ROZy=V&89uWds#r2j!%bFy|2Iw5#zbZJuJC}(`g=WKXZ&b zt)7)ic(Gtp@vHL>RCFWM=bx~%Dpq^7Scr`b51uYT9r&7N82_;hx29sG5}+MfXh99#}|T}RAQeNRjjwQAdM-h!VjUw_vE zN@PA3;Rzf>L!9D0^4*RLgFOmZ2W4Kk&)|mp!3d>rS>qk|S4=+g=eBO<>lhJx>0P}Q zuB*^lM|pzHsdl{8E1rnnHtiB_87(p*$p|hCO*oRAp9k^H2HZ~PQ4ZHO-_&CF3m5{| zx(>I@s|VSRVb8>UvNXc<7cnh#*B1zAY!?CnZCKb19h5U$bmEh!8x|ajbO?g&oVNJu zq6ODV-R0j+n3(>#N9^bezDy}NZPq}fTh#3scJ6(I>CLS(2-k^Ec|^$U3NF+LD7to> zf_$}x{xq7j@w0|YW+0u`T^Uq1){%{aY|Ab)GZQNosP%v`d#Z?sv*h@%YwePa**5?a z4qNx{X3cC>a7M!#xH{r}Qu!nqKYY4k(Z7;3w6Fy`-ITlIp1+4^Q)8w zAz*eS8K?nZrGl?S_-eK`a#_5&MY1LOYPJvF-uqx$Gwc)d_%`|xy3eh!jUw9?^0uP3 zL<*p`Y!yIly8%%q3y-$)esz6y1=&ei1@}Tp5zfZBS3g;68c3xtk;l3Vajfz>yNZB8 z^>+?d=xCqK9cM z-boRo@`4f)66^R3(K_{d0Ac_wZ3eWI1)&RKdAP@OY@vs@F9K(}UJT`t>O#J@_KGsD zEJaay zGtQI}ua$ISJy4bwIOH6uax4qCY)D(wmc1>c1t{#~e_w$A_0}_D9uOwDI@CxfqpgR6 zHpSdamA54>pjKVr4p|`+HjzU5v97;@7bHQ}9WFi<&Efj2RsQhXRX9M8(YI(~$D;p^NMKvXv{MVS&aPU8QTH;m zQT(4C{>qV>VBfGha-Pgfm*IaxC1+MDTN~9rtv<|;)Ni-``-i8=s`Oo}2uj072Ypj| z=Tal!VsAv97A)Tke9h{@z)g;p>8qt@0f^j&>PH%c*?i#p2MiZeo>K4%_h}VJ28a7P zx&A%e5Lmndf=mGlY~R=3s*km(jB ztOF-JS;c;mGbY*%&H=ih^-R<&)sNRXT)$t;G_qzJU^8IT?Ps^5bP1d>f-t%`dvpkQ zGbf}bKXPPmD*Q~2BkE)YZf8fJ+mLzOC-B0I5p{fk(jJQw@E15X;*)IAqG-R2o17g; zDS+~V>h+Kz=yv~gzU7wD9p(7;IcTnbn1UwL(pfS#k3HYjP%3hQpzUe^f zEz8yOS^|)pC!T!ZI;;lGD=TA#sMA+!CdVDra+bWY1C`{cf5LYc0dMrsDZ&7~yU*F8XH_HF26l~Ojz?b{7qbI@iv%j%T@BCNO_mN%{^lNRx zE9Ac<*))i2;kNGU?iWDm9z6P&RR;|tWLm~fueYmO+GDLcR!kOF^T*Rlhj#+!dmP|Q z+r!=3<|(@2n(7#+RS<{bTn_~;`9c6SRv<0s#~pGOSjdwcfIplXF1*4I$p_-xz!tEx zY+GCaTXeyV?6{OFD&mc9sE-lG%*vp~J990WOLK}B>wguqWF!5Fu2+gKA2T$+6*{$O zxpx<{w|6w&U+?9?^XTy6dDgBERQ-$T<|Z$tD(Vqnk1Yw6wU1VaG6cK8 zNyUxAhfaD3*15}N_h6{8GU(iX1I>4Il`XTP*?!R|t1_7W09Qo$O_cws57;@s2fn^>{P>;f0ZxnG2LZC!_uePg zg+@vmBj4QGI8!-46z{oIU1AX0|2}+%6+GYN2+2SSxrq}Yqh$(TN5L=!N&Yvp%1u=e&V^ec&v`qBl#{&QKj<`{T4256(S0$Na zywx;5cEDd^Wa>WHG3t2^Gqssg;2g=~Sx5KK!uSNje4`Q)vVqPvrT2x9Ae$PPsutF` zTEhBpiw%Ud00{jz<15%9yG?d;cVKw+57Xkx`Gx(IvoWKsI$&zEnV|+|g#|6Y4|w=t z&79pBzwsVV(p*yL;EVB$ln39ZG>&||y%%u;qW3=WpH}KuAf!2ZT1?*9XJN2Ey9^`S zu98|izHBO}MVE04{5+q(hG6}g9yk!we8m-wWO3mtUHV2RPjA1;D4JF`+=g|)NVCB|j6J)b z3klw6XyTK4R+);NoSY$KCy-se`aWNH_RTu#)tQE+&!POw+~HLJ9`}IHSZ;*+HiXRS z#=dp^p}OJdNe!pj>WRsKtHXQ=He*MFqALvJz4QG%TdRbh78>2l$BdP{l#+O})T(P>DPDe0Q9$!LFe5q$LI(3y&- zHa)=I9XLA|3h5bpk;B?i9s36a@m+WH4<~Qcyw^N5`;e43`7+YTbi5;bj#f6c0!h{B zQj9=JJcUA{_OCGdSW6oKsFjE;LFoh}}UVSnq8P#&T-fv0OF+M=Ny*X0N(j`8B&dJoz zy}rgYUGyHaQ$#|7F?{5SFTuX5HssE9`Q&enqEjmORaojw|Muqk2u1!>Fv1{*@;e-`i zZu_9Q=nzM2U~yHHlv#lXRdwTz!>5B7^X<=6e3rQ*=cf8Jr{*@Jbj=_-RduiHXiy7o z53BKG=4mFC>W=&5FH6Vt$oEv9RFBLWXFQvXiz~FMsN3ez!Yl(p`xHko>< z{c*onXGGCRQt26o=;z}GmR;x3bH=J~Pdw>q?9#ATh|SDoIe4}^c3EG2Uh00X1mG^ux4Wr+BGJx!1nxO~#(yd3mrvw(*%z*VF8H=o! zuDKORV@+m3#4E_@7K**WeRhP5jo;wi>f7y{o(W~im92J;^-p%wee$T>u?-1o%2SfQ z5GN1*SYV8`Rc!?){oIhSyU7FE{)+K8j2uekN$TS)SKWDJMO0}=uJoWsd~`M|Dl^r; zM=0x@mQ-{%Q^cci9RKz^QD*eH`nrzi2f{KhYCR5#v2O7u?My1vGw?pZ%!=))tm{oX z;h(dMP~Rw9hGjeDqkulD^j#l11AxA->gM4r{_GU`Y08uop~!=p$*zieut*^RO2`WohpK~(hqWU#S1$K%{ev6| z?A(}3+nJ-}-o4P&c!`z3kjkYUcu}^Yi_HujrgQA3hCMDt?Imn*j3ys=Q@C`tiMA8} z0*|&Z-k*)bEWa48+mUvLS8qupu&lSKd&Kivh=fmJ(PX8HhJi|el23S}o@_2@pM*?M z^*O33@vf2nk!fQ(TJRT?2>7GU##CXep-a&QCqD+M#W?S#qn{>N#&CcW1RA*`DmDs< zN&n$s7xnZHhm#MSP}olZMlJ1ClZLgWjn_^4gj!N5tZjXS8tpL4K?sSV`o;3^N7P*< z&R23ET&Hvy3%8xPJ09JsS=twPZ{37V_GGQe;*H}}tEF9{ktn2fRCceLj)h1EGyJd(6~$_`A;G0sP!}tI~JUZ z<%VfZ*77Szbal{H#z>R*l7zc23XCK2`0zohzxGR(Du)mEjw&7u#F1)(E&?uP)9BLQhyL=Q_ za<)YCJ9kLbQ{x&!IO8OZm7REQv8$)|>fWDDN*a{sB1ZUKN=kXh7t`e{7=%XPMv(8W zUeM#k`>9wFuU797GY=Erw-|BlBvPx_(MvGWJ(pjSFt121 ztf;*S|IQ)m(vTk>-SuoILn90H7G{cYA*r&;rBjR@6W^W!D#lX{X&1S7RFOR|xHmV~ z7q0k}2=Cj6b8W3!;V_g_f@~0KD(oBx+)2wleKohTAIHExGWyaste|v&37Z4ck-8hP zn@~S(07a(l=-qH`{J;MAkRq*5Uv1w2`Ai)ChEI+odm}#4O?dG^#p?&*{o4;>9kkh1 zEhtJ23p=5Mrae>ZHFMLCDBXHPhdSYwd;1l&9!|?Vdy0vS>6EtKy*? z1+Kt#V!b|Yn>RXpKkmkiCz}0&+bfW@wd?=~{6`7}1)EztfQ9oHBZ?wC7`VD{Otth1A$%1Ne!u^Za z{*p=wE1nkR-=IP$iZXlcz!}rNxMj|ZS2jgz*I%Y!Cz|oVLD@>wr7D)EINI{H;6Ke* zchl+W10t(AYPZQT-bv3d0%tSEcC%Oa`p>I7LU;_`F#%p)nrD9>0*N8VpOTS>*l6{y zR<^d%6moz#?z(^)1&&ucufQaGs@wlO)dPh5TbelBR%Mi^3%0-Vv8_p}DzIsPyS>8m zc-4J3L{NLZrL)YtJ+X@Z6DTUc(=+)O?y$u(yR~m+03UzzyWz9LCUVwAA3U%7ljk=|JYoeko@LQ$2xJ*`@@1#m(v3U4szpzr1qUzOd4C>=6hC(I zD){qE!+*PWaky3+F#QG_FL8{M^rWO`=(gDQLRU+Nix(lWw7X&h%(t+5KmlaJ-_>5f zYE(7gR|hc4%JS-e4@ZS}+h_?V^5ylLN0R<@razFoSI&jlmYz@eVVpX1)9-%&k*ifB z|1DQzXWOJ`{NfEolGzJ-6sx*1p6%47Oc{ zzVhqNJY$4PQWG_O_}feM_51u2ckr}8nW=E{W-#%bbqRLPrAuEr@QtVjfui4jZ7s*4 z;N{D#I3ymG4AQ)%K!Sd(d;(onp<>q5FhSKKRX_T>y>&%Ep|nNTKqw9>aM;TOn_idk z>|IS2Wd}yViL&X)1Nm@`(c*}@TS_Bj;??mpz}sE;*tsd=nGg!}W9E?P9`YVI$xinZ z)G!@@Wd@LV%D=c}|K`SBu>m*b+5-m-{4AFuXSql++33ok_FC90dbk23ha&JK~ zUKG)XIk%&%lg88Ql*4wQ2BpWZ#rtQYOWlF}Wvl0)DwqbcMMhHpi_Dma0-xUPH-dSI1*bN;$LsXn+(c~ldV-}QoNy5IT8Wz zydLUMt0f(_tbiRfnz8L3{lY(1C}Ykpt?^$0{%qsnKRx#lTd0zf+nvp?LNLwBpt#$j z*cfY-nL7x~+-lth#_wV$IdFB-f`i)qsV=MIwnS%TEsOr)$?{u(%4ZjaED?2$;Cb2H zZ{jGf$Q2xVt%XG;#3&#C3GNgah+WhwVHeDxs0Hc8d65ff_lcepu{oQR3B4I-ECh*^ z8gZ@ow!KU2r+xm*(+eaG;)QnU)oCd6tDY2`+C$LN;rD?Rh66+RCrkK!tA&e_9m*>k zfAGBKc3@_o@~p}ven>oiP!z7rwxEv}bxLA+s?Bj(QDtnbsWu;K0w2=b^{15`Aau;p zQtris0sCs1o2Ac!2O1wR(IA$%D8R$kebhC=TVBDwxxv0Evc_;7kkhNRP-mvMP~5O?9wGywAMA9&yiKM{GBqYv(d}!`w%wZ_0d; zMTfxu55~=&n7e=G<_^@9n5hnTUp0SV(ci92mC$G}K;!H9r2WsvdZ(Gxa)p#r2!a4z z=4V1}mcORVA7Mfl>iqw)st@Ed^8*J}FQ^qo@-M9V;vSlVWwa4 zxc}V&hl5+-sF}bt0CV;8=i;?@?)%40un(MVv%1#-!ie1|!RENfo5uCgH}CEo0={0v z{jaCt+g7IUMc~)Gvh}kTH~*aPdlxhlFQuv%2g7DSAkN!-uoLgWU7u((6RfJGZZgOMk~tII%S}KN zoC@wRdpwt92Xb1>^XhYgsJa4MPnV}-xM$m(aYa%FLRrL>^ujaQqFE^%e%P$V&I2dn z=kk!wVfhwTdM@eO=0>Sk4_D+0o|$0DRCBlI>9?3?w;az#az%HPs-o;&f_nKnH0L54 zTdJ0h#TOve+K&q|XDCC7^vsSWi`;$-J+lH`TXW^pO_VAg*{w*;{aA+!?39+xWP{6i zUA;6u%Qe1=7bV;EOeRmTr9nOz|MBc%X-UZw9P2hTcNe<07dV@36w|OtPYiHDSDzO| z$rRW&IVb0|e96k@m?g%zlopMzYeznK8RDEsJ1y!UeS)L#bV%oytegvmZD+(TO!{T? zc6d*kKae-sDCVT#^oSL(QQY;~wv2F>1ws6BEKgGF5z*XV5;8*z^q!8TEE0|93XGlx z=-u2Jiu1H6~~kobPGB_*tq zK~t+({$6*c)H~I_Gyr7qejxK01G1x|g5HaJAgZ=xkQ68B1Ly2$+eCwoGgAN_A^CXUC5aBII-tI!BKY$ z?U_QI$O2vNEc2Z=t+Tyl4CP-_T+F`G0&x_VP7~=|WL8l%nP^mKuA>)xr1-^PFf&1E z$>5f|IW>f8>%SvAl@oc$Xo3gi7&<(tPi;Suq|yiSQYoyESB0RVXJ`VICcl7*E0k>O z;<4E_W4erSys~EpsN6HEcLvsL)-dg!9&j+vGM8eP82rXQw!j*%qDzPIAZ*d3tqNNv z7(jIm#!%adz|#iV%C#QqwZ*D*sjIU||AYU2HgX z;lso7cMq3uoqvD7C5TQQ|E6X= zaPKTrvyW&D8oDX$=Egf??@0<-(xyBx7PU;~h7~-4)TBoXF2C<2e44=>51lr%Mr4O_O9af}ys z+O<7D7CL~;qYPcg1VCmrsIQ!X+^o%V-k_0Ib)%gh6juP(R?~L&6w3l{#X<0IGc)_>gh7`E=EN%4=L9pC z2E9rHQzeZP%d6``jMe9&E;c^Pe6;t(y2c%y*ufZX&(gtdB(1?BNai~2xA~g*fgaAO z^`&0rCFf+~mFHscM zRq(gx?PWY~4$pt3oxjz=;1_8ydEkiWcXe zQxt%n?5k2qOH4iw*?q2=nQuJ}+8us5oolBaqF`}vo7~4zA4eAN8k)~<)Jd(G;U+r$ zY+2ISR}JpApob-aui^)F(K;Ch;1ExuyVlUo0*t)<>}ReAfK;K(aU>TmVR5FEOWc$X z;eEJBI;csUy7C=<=t=OPxfv@RPMi_z{ERGK$G;N~>~=@Uri&{L6=lupN*_RpbUJdi z)R(^&WTO~Cti#1daV?Qv)csDnhu5e1kDJyS{*irgwH^I>enZS_~gtpR687oME>_)7w01kZLb-T*<>APeQI z|0|eY9g{Vln0yPKjDRsgg78mcP9`R=gC{94=Ba-ivyJGOVfO*6sGz9R0P~AHAMz_Z zjo|t#aCD(>Xon*=l%6&MRv#Kz)hoNP^~!(3#Br_6Vlk8RJ_TG60m4{82}}tCAYVCT zBmbE`$j0xL?alzPwoV}WL&Vom-MyTW|2i~mS>3o_W zMI~v#gR?H8HgB~6jtPg8G4jXh0D7kk@`n?Rd_RPNaca_7!DNLWH9n4$=$kZn!J~i4 z_yiw%_HwkZuMyupb0a*xy#1K?t&{qi5^WfWKH( zUq%b!ui5b8ukC_Ej+I55BMJ92tf~%Nhi6u$7Y6=z8Ti95mT-LaZGsM*}3gkCTrL8Kr?ZSHtZnLJJIdN3A>+MO!H&r(1T%=8#x=K*XkeyURG{QC`Tk#ka;o4CO>^4)KX z{@B5l=f14-n8|L%srK2?wiCc|d=I%SfMO`s&=khu<}>!A@7bWiS*eaZ4=uR#MN8EG z)7fA$kQ8Gec5YMdyP6`b=(3QT;NR^`1eUBF^v-*xqR8C`EshQ6uQx^DKBRw|+Bt$4 zPmA~Hc0E+;*-FtY9bT!N40n8&1s$!pgT;&zTeO^AIf@;%Lrexez-}*~DHdopbukpX zB^NZycwm!E0pWC5SlXtBi3OwB1wz)niLdt*I-o*03n@+(=onR}%4g2mNPK^zFrpw% z7kWJ7-S>zn$I1P z3|t20&JR$CD~KtGOJg{zD(Qij(z1jHN4}pdMP2HZcRK-M0M=D>&nt2wqK>(JyzZasEkBva9A67 zvY441v-Ah{seU+n`3v?SM@HbDU$m=1y(48U$GQardpE{T6oA@RJ;{WD zrW5q=Ut@U;XkEwA?-nS->yX~w`N$lbQIfTH-<+g`#1ga%a@0{H<~poBM?am9n9KcS zYeXUX;aGJmY*GHw+&Ht7w6f$%dhvNhKz7s`WFVzVpa+I_?74XlACmvfw;IVLCt%z( zBpyK7vb;~>P9@ZC*}d8YPAz-Ho(akzXG#9Cd?4!?SEwe=v}T)^=BnkwneQ>HV9?5X z+ul7{-vQ!{z7U_!O2r4*`Kkcw-3Hm=nDOz--9D@-)}&{M%$@X$d3LX?tGxRj5)FD6 zmFXLASo8W;kpNk`!HZBIo|wEXDx;+WC5L6WK`0{d2JTfYLIvfkiQ&vMUqJEwwY`fUE>-@x$RVfapqS0DE%RS#EiBt{ zxr$3@WTr{e5(GocI=@&;oCR(uX(wd6T2UGUb(O$;L7FMn| z)(_P8XGM0-$) zgIvhT?!q~cAq@ppPeD_w`fs!{3nk95ufF)5(36Dm&WZ`W0r*Z zf>KOf!j++?!HO+6b@V8dR5MItDaMt^Xr-uI&?*mM`kueC0aZ_gG+mJ{!GWonjTV-m;5ucO~{Q!=R6Pm0A&qVQtz&7b-7H zs-?Pqk#}VFi?OCz7N!_xY8<*4j=LQdR)wgM)6Zdm(_K9SWL5Z*>rReD79Q#UffLL zX0PJ_ws49?2X5KJ@^PXbTp71vXxlcTDTH92HV1_zg>cnX7=EeW!0!2$?l_?qwJ$_|%R03lP9!1mn<`+O+=F%FT0i4&26UC1q&Qap z(FdCg{UGIyvbpPj{sNE}5=YTG;fbO@!}HN{KIlSMeN`_1^Y???j)Tym7~p^ZXW#5M zX=tn+um4W``TIh4xxj!QN4kFh2?*Ze;Q9Ye;C~kQp9TIOw*ZTO;>+&p#~!D@!S5kj Oqo-qZJVy(C{r>s@88IiKg5bLPRhvl{#8Sm~&! zsP<`Tsv1yHQDdp7c32{J!e1_QUo@wp;-=D4J#BQ;^6TS0aeBsE^#PwFkKR34X{{Md zH|mk2dQcc;5hFSIb&fe$Ot@gs((rp`WZw~?i+7L49??oYH+g13|ADjcs91&3$Wnm6 zW5R>O(=9#INq$SoZT`v0uS^{aHdgWz^lMArC<^&3ed*ydXAGo5a8vC-DpOIvL8fzK z-(V#efB%8;7=lrRnfk9^ujx{eUH3*0|9T!iihs@e_vgcQb7RA9NwEL*yfO((^Vj$< zkMBS&ZcX>e^;g=TknHO{rbHgW>T-rLjU`BBsZ40 zJ?ZWLe~hETj~+f+clxjA5f7z*E{gJh_5;c!b{d#y+`MY{f)B;)_*7Jbl_I@aPwya<-0?7#lKo+h$#yV_EHep^t+|Zd2M4F)_a$R5kxb&UJHTyt&w+W8`zV5@G3UU-R5(^Js(y zXT+s&1q^S*{S}WGVPpA$@HdQs%H?pV!*61ECGA@J* zMYfF|-4=owIpz;R5eM;^j2e)$iuuzYbQL85kI}xX3tmwXA!)G!_j;@1z{BDuQgyqWt91 zfuq^DJgZvEnc6M?ctyWTqFLG5rdV3eM~c8}iU z@_!VJLTlfn=TI%1qn90F>=+wMbRn$Fk0(B#DgR7gF_HH0@*nq^k`dE?9MG5gd{D?h zHQ8&7<=r!*`Y?{sP?^C;gVjFGuY&g2v?VKK_IfN2cqVGcS=y!el~yee`gkonx2Hd7 zc`WCdQZdnAGBi|%Tx2nRqqwnPC}fhKRO~!p%IUXoUUsg5Z_i58r|&%HDEl8I7m&YOcK+#I7+c)n#f_^K zV+oEUHET1Hco~QGBYZa`ZCf5Oi<&lM>LrE*Ds2Avtj_xIkhqxKjW3UM#H-)yj>ni- zMi^vh$NT&2>FRT-y}CMGZNzP?=rof%zqpXD4n7f724(vIn>5BA&YD%5Ap%fZw}NpcGaHgT}vqMHLA2N$Z zdM{2jMhh9H!@JZ;?rbh=OJ8ku#1qi0j6M{vIo2s0b5!A2 zL1DVY!CYKMW@b~TiPdA1n1^F5_B1SC?m9N=FvHRXCT8VjeAV8rf*8jazN4#xfDF zfBrN6YKeV;Jwm5!m!NLkBbkvO-#@o@r8^H#Vv_0N=qxr?7c*>{3CH&knw~mqOkEID z2>6p0d?L<;8p%ApgE}ZlIqU4>k&5wT$(YBH{5mrlDrIXYoIc>5DFxKJuj#cNA8>0^ z$lSm9wQQ&&&7piVP_wqD$&Ttxk^Vs&qIjhBw z8TgF0tj_Z4GMzmuu3++1x0Jx zMJ#40zjo8Rs8#mL`=j%H&y&cN-(KypnQYG(dlE2{%VBi#h3BmEGkeRSR^x_PfpCUf z$`CrJIk=+k1+r1Ep3y_`4$!~cb_8(HH#JuucjYrEE-07=jS?h=cgH;8jVF;I2%|WL@IM@A{dF> z8L!QG7zL@l!?dk(p3J7U=P9EY{M;)1JwiCKLu(zL!e>{5Z+p#;#Rn6b8okCJ+Z|C? z%E{_3sNKAR(9J!Wi^Jf%MW)j>XgTmJe&2e@2>W^fbs*?hp#8rg{%D;X}eK)T0TqrA>y}{QlO7d0SZ269G#vMO zUmgPuA68L0{Ie(%@#HHTdnDox6(05I$x?~{9`#{@{@8T{TGt^Muu@Z0)-7cbxDeQE zel;!xTFCmE)NVvGQ^OIKon-Au?zo)@-y?yz735G~9+Qa6dStE)KE~YZ=Hq?%(HQOx z9!6hq{5VNf5;Yr#*`15QGl6Y*T#%wQCnGfmfGX;I;R$6@q;x!XOpO-Je5J8(7g>AI zDUJoPUyX{aeb8Zi`7|ksZ}GY^qFLj|^>S%EYFGB&-M0dn;KDI~uga4i^>{s$R~hzG!aB&Ids6I!pX%o<}-x zm%o_8aBLhX;xRQ1TJ)b%ZU{%?km~9ia;)UJ;76PPex~>62nvbjWNm$yi!NVCYM3rv zrqd*LUYl%Rfb+L3SYh2ypW;!O6WO@eahXg+1tl%-k*dQQ_w&p!OJ=-6^#6AfZ#j*yEWiu{i0_>vuj>+Jq*D;$Ghkv!sQCK`~AriecKA|)I_ZXJ?85Y$2S4ZFrIBuLER20V z{M2Lz><4XNjJX~YaipoP&nX+{^*Pq5ItSNtppl8_!oSg5^p&zg?_rCGG>7dKzGlAI z&;=%$smw$?meI(3QObdp+`AH*ZsmiKYJFVN=sm0uVcp3nVyDV-REgS%ME&9fBk`qr zJ@du5G?)|R2&WyjT!v2m$z(lEkiLUzB73|#(*lI%rx?=9z2{vKu;17N? zmr~@{2ZzbM-(%9tT-XIAn3l>9cWLLfSL*KJ;JuBnLE(xvLF|MUQ>CG;Ou4$(K z(Ar)gSo>v1usp*ju-EPBc$6M&;3jq|9LHgBfE+Avr1vH-9Ml0tB{@E=r*!N2r`t|DR_kfFjzrOW{lW9w_0BKOID%6CT-ren5p1 z(f_gjB?PykHMCgGB+{+A!4XbJcpL!h5t}sWERwnLfp?RjQ0yZE@A zkO=gfzyqh`@iFK6uh+7mMC7dbuzk!rtHvJNw(UK6AVNi7?bjl%U!XB7b&3Eu+|(*F zB*GzgL#nVdL+4PugiUY~P_pY4c5h(Y*oOst?GfnVhR@zAh~_XE4U%Ha0$RU}vI58T ztq1JhtoYGKLMl917_d!#K4c=`=%CMRHBFdRE=F|nZR+i+jitW19=jB+2mARie;{3? zFv*8a7vMc3uMb&8`){l^c3TCAhO$aW-lEy14S4Z#VLHpZT!Y zcfZd%%_NfYvVO7@N#Gzd5r?+)+Y97d2R~eVNc^4>94*g5c5R4GWh9mpZ)qOk1zuL} z^nrBR(&wwREUNTix#1>NZ9nt9EfI4CQ)8LZE$0R3zP?u{)!ui{_9+gaL%#raQV6WEy)UIwr`Ri;9m2SM-Cq(YlpF$w^EY}qgt4VL6QDm zqCS`Ii53d@iy1uQ{M#tH&D}zy#Vkyd{g!&FzPnUT3ao&J(9$DuUaNTCSgJZYh!n2T97cXhmt{?pQ zMlmMYFMAQqJcf7AkUkaej8*I0<-(#n3CzUR)N-uZdZ}UQ- zF>&2e{b1&4F=z#Sk9rQzxNhl*)Eg+`;&gZO9}f<+Dk*`@&HeZso~SaT7JTqDNhIgj zYl3krcNN8CYW&&?^bH>qwo1^YPGeyo`%^^ zbirm`42~9kbu2^Z6?3YBevw+aSF-AU5p0h-iIt5!HSnU0c%evr=RVeGnTrFQMyc%# zLZgHX|dm%!J?U$(RB{wZW5DP<9u%q^)B8(9PJGYfLfvSFj03TCWI22 zeewf^@-T8<|WsW|#z~V(0yLGoD_H{6-`NgdoZ@bO)6$#sx zxT>KJNz)SL?iKD(AUp0a+|hZJ2CR5};`ff_#_w+25K zriVL6^%r36{LvEgkd3s?Hf zpL;P7wBLi=(u(=m5--^r>MnO3w7ansaL8y-J0uPMq`kGi4L#ZZX<&8Ii8o6yap_UL znd4*XWfP!ByerZ!Bp@-7w4WSK`3Ao|P?J90!sF?41mZ=hs@T~tESX<&l!Buj@8Wv+ z(tWz20q}UK#W77 z>QR7}_enxHn-gUu+Mh`a6@&>0`ug8cC#|Q?t_~szj%k}=8nn%Clr%`Tnj^2CZsW(~ zQtkBhmH!N{x@v_Yx?<8CW{7%A)46J4RiOW?N8g&`Q>I0e9BJT0+yUqbRnjQ#L5cYM zp-$?m=85P+ZIA8m7us-M^mo+yg-vq+d+P~f-=#Ys9KX6hC?+!Mx!GMU9KxavQc?KP zkfSu`$#es(%5cO&VD(Z=KM~oO$Ae;d;e@d_y_ajBpG~)RL^QLU-+6{~rfer8Fpyx% zr~s~{LUDP?0ug({LNY6gPV~6sAIfp(*&dY#o4SqBc_|nj7#jsUVyXoq=9@J-`Y$AY zVPR7Zt3hrrj*<9w8@@$Q;2Q;4f*qr?w9{WRy_53n67U&oIqC zgy8bxL?SXDY@}p==}A-ztKCa3)KJ|M4k?y!s*R~I+=`l_;<6g)Q(b4ld9XzDOsmUUyj3#I7>TyY&-amZwedGl3njdrvgcH1pWYQ znhsMwr%L+b#Y#3+Jk4ttTey8A28L9hS)Qh)z=SkB>X|eo5QNX3CcTOg1pWn^TPBR< z|7nKHo)J>p(}m~qDbK+y(dJ&f*d_T;oZoz;Dl69&3NTozy2{&`pSF#4zz93R2+yDd zQN(Mng^&b=bHE^SaWN#y%Y6oKL`=b@N#6^c#GG=jCdo#BzuM&Uk@gA3?ez?8sf_&L zn7z%2j7Vonz*^6})`AaR2PVtgCQrVCl@IQkNw^$9q9ME9i;AE>6WA?JYJJpEhlC*dVg2{m>DE+H49g=$ZF?@Lu&VO1^_a z$(3&dJ2WSc&P%~I*upkcaYslV5W()b@gOM#2x(f73HTZlydt=IUuv$bK3LiTY|33V z(wC2+I8he92uX;pT(kRSM^6D|WP10C4-$cV%C(h1(;~v#{FsP8t}QwmA)3#^T*ig5 zYTE>7^JbZ*==Ql;!|Q);GV(7|Sam8^o#Mxmm}i)C26zha(tfM%lY`YSh~^arQ{4sP zd>UcV+A+dkm#LK2zuh(u*jSVZ*z~1Dpb%DR?Wy-Umjce29yF!UU{(b%;*WFjC%`=9 znM8b&)k)0Z1kC}&p02b3-Yf`^koZUkXk5`zHgvXb|a5g$43oz-e9GqGRZgFP7tc!So@Al4pO^GCDhBuGpOn@Xs zEc-+W>Yupk?s)Cb5SFo73R!tiywI`vr1)qt<$6+(jMPbCxSnBjm=?HntF=xKl9=Zi zk9)Li8mXRbVGR$rP9gEB{%+fBhZA}l@+O+lg z)}illObp2mi67M47>c7f33m@}|MBr0e93qe49&Vdw53R-fuIIybz$-neVLuD?O3RB z>KWR28JA?)#2BAyNKMVXRbgm^tYC`^AV(cITbosaxRqk2*IS`=%EWC${&92&FXsuW zSL)?ebvcTZ4rt{hIwN$@#wvIBMgYi8c;1z7fi}*?NZXNuQESs^UuH4$qcCpNY|WaO zK1rJ(A_Qr{sQ2&R$BmuN`bG)43CDjQ<~`i&Bye&;!dM?`PCi0dPfCWSb~QV>x6tOH ztiCj$Ik)>3N<8HNaOUZDZb+qaI=c*1mVAM9G|UjrM*t0e23DEeIsK(c-V{;dA#5d$B zXM6eeOKzpwWgBYmG#M-9#SLk_F)^cxA@~a>pLZgme&pP3Y$&*3a*k_3~`F^hf*gwTHZs23+Le zAPzq|b&%r@7oKu`!~C$kDgBaq zPiC5j{MWvYF^=$s%NObwkZJh7=hKjNb!ufKekkX66i1*hL_N4_ z38tP13`kvjB;8^=z=)%Tg|;BQ|4T(YFS2i=xDk?imlQ49;o|xsrYXV%n@iO@-znAF z=BbQW%ScWI?*_=oGI!HFLShb*X|s3ZQBO!|al&|;dzTT@brJh>DDJZ`J6%ed^kw(E zS7_J{I=sH(N_zkGdXDyI#%PBRq+vyThE?nn7wWDi%#6pY-GY>~bpN%wePbO09H-nL zl@0m#X~z23c9JgEjjYeN$#5}=8D@rLrvt6jui0F6bb$M~m;L11D(Rabl8pI0Ux*Sh zerD8Tm-+8zb(?9w>~XLF3?W(^Pa z>hZ~}6z7_Ri?e&k!phfn*azcixznk2naG8868Oa$x~{X^VXanJKqwSgrzVRq7eyN+ zKt2|VNiGdWrOhosQaT~RnDpk<)*0d@4&4gEp}2{G(jZSW$JtautO47cRS=K30>` zlK@BNct9A&IgAKmSF4Q=S>8;Q6_>VcIn1Y55lctFlx*uBL%G|!2TI~0m!WX9-YHDlo3dA{b)Xbh!ryY0xBOGU+S1Y0@k zIp{SWKbzBDfH`WA-k`|$?4-2)+m}hz?K)_S(WaOvP=6BVjgbU?Dnu?7T52Wn1a?_< zPQRVJ7Z95&AJ*-zPP!|ec6#koq^lU-M*lvuC2SlsUih427x8#rZ<&iY_zuZFA8%y~ zhEyfUol98%fpk0S=TdPB1eVqd=zq~aGQ*QQ+Lw^b_zVQd(Hr^~Tp{3p@j6WQUXy*m zzIAUKKcML&qHSf)Z$lG$s1_P#-}9_BAH+K~U{mz3<# zG=^;L=xqkYN3w2Xnn84^me@NdTn77%iWo%@d&qP{0m-mmnd+oL@3Xx15c2)yRSn*# z{JxgW=+im@C}N^>rB`{9n0iw+zRKd4p{MxBz2OlqF}_O(rqoRy6{eV z@!#&^x+Nk#z*2$=e+EC^nA=_| z>;Xi;11GlRo~um+>=d(m$(*W_uo?au6bKqaa)P2RFA6}CBSTCyrtI8*MdKZJweIl+ zP-I){h1JMNSKv5|LMo#wfJ7(SAy%=PD|V>=4M-j9(p6T#((b~eOn;ezNpEdA6^MeC4oS4D(`u5MCh$ZL8N@*-Y{2@_95v-sTi3UNG& zE8jmf7}wLtMoyRuaX-42NICwe0YdyjvD{et2#JGccZN+ND?-8Ue}VFm)b>E82XHWlI?X8>W*ZHZm$!-c{hb20@VKtu?Z-Oa?r!1H@xH0 z&HdScj8eFDARUl!e+mibduA;QpH5vt*>*>0FHKuJ}MdwRQycwH&7Vn zwBKfJA_@8*Kf9YD&}VUetjy%X+cNmY_Kx=9w|SI+6Eb+CJl#A9C#$-hwT%=--Ym2)lH{U`xP?!90dTs*5w`%{*Ff*)miVl}`dQrl2JUW3H= zmaj@fAQLRWmpHZ~&ZgRU#iA|qqM11890dXpcHl7GT50MRV??Rups9wkUp-1iXI zLuMnhZbX}#TrQ#<<)s_35osLTK0a9V)inwurf{a=rUT?c3U-r}Gt7^Hk@py=2dh<% zTxB|&qG(a+IV<)LT4Dy&G^{AT1WcR(HD7ZOhc!Vy|H`2K@Qe;g(12us_sj9XIW@R2{2DC|!>o;g=9(RC)Z4t)GsoQF= z4J1-f_hGXm#=)K-afAD8{x)2vmW%byxn@knzFV(`LZY<+V_GLD+>*HdNtN#+l2C^` zbMheIzH>~(z@7JiIs$wh1KJpRSfu-lHW3$!P7r?WQa*sh%nnxDz~UtA-#)1tfBThO z;Wn-fS&${KQt{e#gZ%PObn!|7HA&b1WIKHaA4Bev0DQH6L4B+re`v zVWUTsB9WpC72VnApSHy3GV!U$4V@ub^H}{@g&l1LRr41v1sG^Z>$p~Qd*s>I2Pk5! zc67{snW2mS2(8DVd@s)^&$Kg%EQ}#y2a71;_MqRgg^+1+_Dc0WwiB8?g*KtrEPTJe zJ}&v>5~aRvN2?6qXnNqADqKfRM$;_qG~?T@n8ETBPb9@Z7RwOPxO=!0L-X%U$VoSM z*jc1c_fs$Z$gQC3D!m93xeB*frMW4!Yy{aw5H(9TEx95A7~BEs?A*Wh8kaf`2%A1{ z*FPWze9E-Uxq3(v2&(MTnNG@P^;0&h*{=8ZEn_8n+deX1=~JiRoIhiQ1@CR5HAo8y z$1mM=pYGDb6j+Kv-Q$T_vanT6)n1NM?~{s}@|?da&?1^Ia`SM~!I0&@_upJmAJQ9_ zFyvLg3GRxyZt%btN7G000(KMpGK&M1oq)D{C|?=eL!MKh&N=}1_+ZxTZ653r(um~G zCUGwRLjsnZaP6k7P-hO>YRTyr_Tk*I+Q~tld+6&s1AhBnuGLfU+jA9oj}<}+Me&Hk zt|Eaq>)&lkp|GybZPrzatV6Mz-J#H~MaMC!3SUD!EqW0tOVp8pOt_#%y*(VmyGZTA z8`~1+^;1TaxK=m=u;kWZGON6DFGOB}9Na+IzhnHo*z45O9VAHQRnc{I-J(e!_;Vk{ zSLzCzSkli1Z~Mv>O2JR16fm`&ka8}^gQzej??#*ZwT)s(;mRay`p__1P^eKzlQ}7M zO8)&2CI61Mo(ln;Cpn0&i?F#dTDS<0H);@K+dT&xS^hyn{Ws3lgxtHHPS@p4IZFX9 zuk`4OJ=FD)?)JlYkV_67^gB#Lp4;Kg?gB|NrhEn!NF_}O zV-r^wV|BU&ZaloE9W)o|Ed#OUe+wQa$+RNvq3HQz?!jaf$^y`O+z}cpa0vyZnV>{jA5T0H28jP2b@D1 z1Bi!zRlqD>v_~}4ThKaM4Bcu!1+--Kokqj?Wsgy{r@x5FzmG~OXlx!vpcF5?aTv5h zdQo#Q3-fae7a`-fYvOtpKOUt~uDCZ8*OQuy%ky)8QoQc)loF3z*v-xg_v?e;_aAjf zx~_z+ebIX$_PTJw!%KfrH^7J~t5CgjE4RPWqcbil&gEomJWw{|wJC{bqfx!lzt zr=BC}zd$b((b#XDiTHF2Cip*vuYbA*O@p`7SAze*kZd`u&W24s_^%((7se{BQ>sQ@ z6Av^sK?$Hr+TNId5C&Fs*?yx86p@RI<;XZ($-z^pMD}H{*8kN8L9`*ae_4ac4CWK@ z9&-2k|B~Tef^wx*U|D@cPR^_=&rA?Rk(jla7y3{IULV0Q$UzQ958h!2!|}6wnY%y& z%0|Jy=I%cF5bAa=20g^LT9m=XHrPLB2UR6ar zGs@v*kpC9g@7|$TXxqvPg_{p4iR@CBAu;gFgjAJ#!KDyh9zqqax~1=TH9iNcfQ=HV zEAKUpdQW*w9nm3(L;zu=sCT++)#8ZeOV_lzILO+C%JOG-kqc=c2ydp6+b?^;>YO`` zazNmuNei;0WOMEaD-Be7L^*V1YC)j40ddWBvD2hkFvXV_%G}!_S#_b>yCj55$ubzK zqqo+_l|t?H9-lHUz1kK;m)6 z5}r_ZB>NcOwvSvWX-Hlb<1>7tMZ#4ZN*h00FWY1HncBH20bQ9!-;coL;mxP&x}CH{pDcz&cx(saC-e= zlzmoq^q|*tUYTy^6coK5OIrYR7pF42hgpPCfpM#zE8y_(>S(Oh9O5VcwiSSy=okpk z+TolEEd?G<1C~j$ZUXqx=JolYSLcP{T2 zQ3!ii?c;f&!Zl+B*G|cbe-Ej(s_b~ORaAAQQ+R%88a7f3;N6#PEDO^+T%8 z?Ix~Zn6ZVYRLzW)>@$7cK7YY`V{K@Qz@u`P8++bWgOr9qMccA<(b{AtkAYYCo`ds? zi4fWciaJ+%M$>};y5FETZ7$t4qoDsnrF+f_?%iN_xYFj)631>rx1~?3FQZnt^Mv4Q zk9zzb>J=#Mlg|&Om>i|vB(5o1JKA}C(o1+_QFc6uPlNsXoxPm$AB^%W{T7YA<{AY@ zDHSV##2R?+v0Kwu7?PWmAfxk{TCWs{Y$5+A2Sv5YH=z}^bX|oZx+@x>B0McNlAY8i zw?E~eR9kZix9bGyC{^SIh@VeW9W2^d=+Gal?ORm>!6Tq(v36eAlH%7t74KZoH3m^^ z<=_)ST)5oK$;qCgtZjuX%v)V27gM{n`NAA<;Mh0s`LR~LK9`!6KiT~?NQ@$-$j=Mn z+4^+`K)+1LP`o3w2pcrtVURJFg3sVO+io&BaXqYG$CGR9&10XpUzHT*Qtj;OL)q;9 zLD!$9;MRX~oBS;CuIjLy&#;_PSk4y9V1--O!q+|-mshLLk^o$fK7P2d7B#Ue&KbHF z_%5z0y*Fokf=3l@CyvhjP8=DN6x$l2y#aX!Ipi2j>yxKCvch}x8d_Rf60cD-j1^&p z#KmQu@Z0hWZ&k)hWOuE)tr>Qt9b|yL)yKS#=q(9<{!mJDHt+PAnYHdZ$Nks z>Y4AsZ}>$LgtIn;u&W+6tHK-#I-TiS2PS()a5C1dtpN0$ldV;-cDZJuBdC|~tNy?p>JN78gZcv#kh)vEp5a8B z8lny1a38|qin+Lk%gUTm*9VOy+1Q{&l@uvV-xf9e=!M-KEomxnfY-Been}BRB@pFP zvND=j090|C-h|#UFZGEwDkMRv|Fee)0&RJDgXIvp&<$+oQG`&|5iE%Smn;6iKD~OB z&+v)>Je`@*1a&pPy-lpRn?Q(ixvkHl0ptV)8SHlB}Pya>K38b>xI5QO*r_ow~g z={V4pg++~70cQr<5645>8cV7Y4L5f4T6nhw6Y*xmqMbRS`Hg}J>6svwRHIJ%GW_<{ zZoqcC|NMgikK<4FlApbgdmZKcsUH5vT6fxR{3yKu-zbP*bQ7QcMPf3fZEiy=C=9gqxy_z| z+FUyOhJWHfsNgs+O(c6Xg^tkT|F+d2UVYB})X%|FSf>&YevHH;Nb>N(54`S3$=#6E zg<|Amw8$S6?=KsOb%82uZ86z39&BU04zUR6DZhpi^3HY&T7+_;ez6MDxsgVdGu)Kw z8IkvqPZ+jqnv`zf{$I+4X-;mCBjnS0kbF z4;W{-Ia(0^tI6Rd1xU2*xaRY_E#j31?3PugJaioW?3_@9RFf}#V4upbM#aDTkbZSm ze506*8&y9i^=Y1Kkc?9bt8*ZyL* zhOJzK^B69$AG$|Y-mDGZ<09w$?;N64?ch3hYjt}^hs~QL*}0A7 zq1leF#T{oQy|!ipw$R_^1tD!NYKDOlFZY+@6cOM{e?r%762+e%<@hf<4ikE={^**sBEb6n!gON z*A+@T8=wwrB>QPtq=}WEaizz!0E5E9BYCJs9NXmusol#hamNiR-5soU2SB5tLCKX) zD0%-AqG0JmN^5AN>@Dd9&FuMY z#T48A5=Rrhp?jR(+3V15ippE3bO>ryt9^KWNu#IIBUd->*u@lfBN7FGcHPQ1v519& zwKYwLSGUn0_qowJLP41;SRg0K6Ef?%ij>5C)Y(&7>LG{8%olgacCb_D!!63!-08#~ zb32k>CxK1_x-&!MCo+@*7w#1W-_gELN1*!y5?5k&N!Rc0WtGzO-`eo3fM&;5h8!Wo z%!Y-@jtuCG9otp0N!7)5t=BSRI!tcnTZ}FdpJ5zfsISne8MXP+6l(gQ{jyhcWU<>y zoYFXH-}x~oD|vt3L3^9apZ^S%@L&INN67_>hV{fw*;N}c4tb4p7-l3W_>|heRw<|+ zty}Un-7(cyRuFM)K&)#V`d_10Zar?XBhd?BA?FeSzjM8aMdkaEjQ!be?UI;PN=oZFH1=_OGi&9#Q3@U) zz0zp(lzz##(t{X3jd^aFkcUB+2(uWGp|aR{(3{dasu!e@TMT`}a~`4UKJ)gpI$MwZ zXDY^9NbIiR1hKE&ACtjzB|C7dx1fk2A$#4fEkUw3rnp$D=ygWl-O7CtXe?yKrBQna zv|Fm(9}-uQlwtzs7Q>kLVSU3u(fgYD>ms1AV;`@9 z;|g(4@|mfqQF!Kjdy0^S;Wc(WBxY`ZS!eV#8e2(Aw3`A!@}g=pEJMw=+rqQ)YS{o` zS@#qHQ;!$MR;p8a|B^Mz?v_Yo#mEm>?t2x3#tJtF)E0ZoU;C)+)}^bo@D|!p5olzp zMEyDN)Mq$cHW^~k*j1V$zqO^YmKeHM(EBI`B=fl0-U@t1H=f}yzoYY9!n`?~k0wC(zHl%m`A97DmPyfJ8I?Yt7=?=7+aL7e3N z@3|3FR6EgH@Vx-m-WEPzOEN2C5)!UFV-^0xyC+#+)_$z=tgAQ&pJ(&?aJ!JP^F67ptYG^a25Ud1IWZoD;k0hX<>{Qyc@X~W8W7j;#I=8e%R=%0EJhI&tj!6K${_xhPctTq=vXEL7T-hs${ zBoEJo!E$4azg{6{SMCb#sad6u8-CiqL7V|XrZ zTHL_iVA5!G{hZc$a{Ih(rA;q1eDjG48<`GQekp8jnVnq9=KR>LKRTIVmk8CZ7yq39 z+&-0xIWBcT;eJ638qCosMW10Lmpw;n(t|YK!Ekb->p3TNH{E0Zb*nP2674MGV~FPP zJ6n+e-ncgVQPi}MW@_1TbbAMy2A$dZoIf76z&E?9 zeHYl6{3B?BO*g}NzqHCV5H%}}28R{jeP}|EW)Ye?2*YV+nWhylAh+F;>T-1+YW?H8 z4^I%xzJGe%>L_H?;x6~5AQ##a1e6AZ!7p16N-ZdyTeUo<@Fm}^wHoei)0wu#38=vR z0=v`^yxJRV?lnIx%Wz}p6-n(rj{kGhrL&A5Krep%?Ek*b;s3tF0^-mAeQ^hHuK!jx%+t>9Z_sI=71s^*`;;r}1}X6T{- diff --git a/test/image/mocks/16.json b/test/image/mocks/16.json index b73a41d13e2..24e9b09e702 100644 --- a/test/image/mocks/16.json +++ b/test/image/mocks/16.json @@ -36,10 +36,6 @@ "12pm", "6pm" ], - "name": "trace 0", - "zauto": true, - "zmin": 0.1189977, - "zmax": 0.959744, "scl": [ [ 0, @@ -87,147 +83,33 @@ ], "layout": { "title": "User Traffic", - "titlefont": { - "color": "", - "family": "", - "size": 0 - }, "font": { - "family": "Arial, sans-serif", - "size": 12, - "color": "#000" + "family": "Arial, sans-serif", + "size": 12, + "color": "#000" }, - "showlegend": false, "autosize": false, "width": 600, "height": 350, "xaxis": { - "title": "", - "titlefont": { - "color": "", - "family": "", - "size": 16 - }, - "range": [ - -0.5, - 4.5 - ], - "domain": [ - 0, - 1 - ], - "type": "category", - "rangemode": "normal", - "showgrid": true, - "zeroline": true, - "showline": true, - "autotick": true, - "nticks": 0, - "ticks": "", - "showticklabels": true, - "tick0": 0, - "dtick": 1, - "ticklen": 5, - "tickwidth": 1, - "tickcolor": "#000", - "tickangle": 0, - "tickfont": { - "size": 14, - "color": "" - }, - "exponentformat": "e", - "showexponent": "all", - "gridcolor": "#ddd", - "gridwidth": 1, - "zerolinecolor": "#000", - "zerolinewidth": 1, - "linecolor": "rgb(255, 255, 255)", - "linewidth": 0.1, - "anchor": "y", - "position": 0, - "mirror": true, - "overlaying": false, - "autorange": true + "ticks": "" }, "yaxis": { - "title": "", - "titlefont": { - "color": "", - "family": "", - "size": 16 - }, - "range": [ - -0.5, - 2.5 - ], - "domain": [ - 0, - 1 - ], - "type": "category", - "rangemode": "normal", - "showgrid": true, - "zeroline": true, - "showline": true, - "autotick": true, - "nticks": 0, - "ticks": "", - "showticklabels": true, - "tick0": 0, - "dtick": 1, - "ticklen": 5, - "tickwidth": 1, - "tickcolor": "#000", - "tickangle": 0, - "tickfont": { - "family": "Arial, sans-serif", - "size": 14, - "color": "" - }, - "exponentformat": "e", - "showexponent": "all", - "gridcolor": "#ddd", - "gridwidth": 1, - "zerolinecolor": "#000", - "zerolinewidth": 1, - "linecolor": "rgb(255, 255, 255)", - "linewidth": 0.1, - "anchor": "x", - "position": 0, - "mirror": true, - "overlaying": false, - "autorange": true - }, - "legend": { - "x": 0.98, - "y": 0.98, - "traceorder": "normal", - "font": { - "family": "", - "size": 0, - "color": "" - }, - "bgcolor": "#fff", - "bordercolor": "#000", - "borderwidth": 1 - }, - "margin": { - "l": 110, - "r": 200, - "b": 80, - "t": 80, - "pad": 2, - "autoexpand": true + "ticks": "" }, - "paper_bgcolor": "#fff", - "plot_bgcolor": "#fff", - "hovermode": "x", - "dragmode": "zoom", - "barmode": "stack", - "bargap": 0.2, - "bargroupgap": 0, - "boxmode": "overlay", - "separators": ".,", - "hidesources": false + "annotations": [ + { + "showarrow": false, + "x": "Wed", + "y": "12pm", + "text": "meeting" + }, + { + "showarrow": false, + "x": 0, + "y": 0, + "text": "meeting" + } + ] } } From 58b91e739b38ddf21fd281ad19134b00320630f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 16 Nov 2016 13:09:25 -0500 Subject: [PATCH 06/51] test: add annotation with category positions case --- test/jasmine/tests/annotations_test.js | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/jasmine/tests/annotations_test.js b/test/jasmine/tests/annotations_test.js index f771fdcca6c..cf6e282f6da 100644 --- a/test/jasmine/tests/annotations_test.js +++ b/test/jasmine/tests/annotations_test.js @@ -87,6 +87,41 @@ describe('Test annotations', function() { expect(layoutOut.annotations[0].x).toEqual('2008-07-01'); expect(layoutOut.annotations[0].ax).toEqual('2004-07-01'); }); + + it('should convert ax/ay category coordinates to linear coords', function() { + var layoutIn = { + annotations: [{ + showarrow: true, + axref: 'x', + ayref: 'y', + x: 'c', + ax: 1, + y: 'A', + ay: 3 + }] + }; + + var layoutOut = { + xaxis: { + type: 'category', + _categories: ['a', 'b', 'c'], + range: [-0.5, 2.5] }, + yaxis: { + type: 'category', + _categories: ['A', 'B', 'C'], + range: [-0.5, 3] + } + }; + Axes.setConvert(layoutOut.xaxis); + Axes.setConvert(layoutOut.yaxis); + + _supply(layoutIn, layoutOut); + + expect(layoutOut.annotations[0].x).toEqual(2); + expect(layoutOut.annotations[0].ax).toEqual(1); + expect(layoutOut.annotations[0].y).toEqual(0); + expect(layoutOut.annotations[0].ay).toEqual(3); + }); }); }); From 22049147f3e1610f5f7a5835a18b3e1d1619118b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 16 Nov 2016 14:21:27 -0500 Subject: [PATCH 07/51] update changelog for 1.20.1 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9db358d7e8..042fb090ea3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ https://github.com/plotly/plotly.js/compare/vX.Y.Z...master where X.Y.Z is the semver of most recent plotly.js release. +## [1.20.1] -- 2016-11-16 + +### Fixed +- Fix annotation positioning on categorical axes [#1155] + + ## [1.20.0] -- 2016-11-15 ### Added From 564f661cd2831cb3e97a1eaec1d0f8505bedd2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 16 Nov 2016 14:23:41 -0500 Subject: [PATCH 08/51] 1.20.1 --- dist/README.md | 32 +++++++------- dist/npm-ls.json | 77 ++++++++++++++++++--------------- dist/plotly-basic.js | 40 ++---------------- dist/plotly-basic.min.js | 6 +-- dist/plotly-cartesian.js | 40 ++---------------- dist/plotly-cartesian.min.js | 6 +-- dist/plotly-finance.js | 40 ++---------------- dist/plotly-finance.min.js | 6 +-- dist/plotly-geo-assets.js | 4 +- dist/plotly-geo.js | 6 +-- dist/plotly-geo.min.js | 6 +-- dist/plotly-gl2d.js | 36 +++++++++------- dist/plotly-gl2d.min.js | 38 ++++++++--------- dist/plotly-gl3d.js | 36 +++++++++------- dist/plotly-gl3d.min.js | 42 +++++++++--------- dist/plotly-mapbox.js | 6 +-- dist/plotly-mapbox.min.js | 6 +-- dist/plotly-with-meta.js | 82 ++++++++++++------------------------ dist/plotly.js | 82 ++++++++++++------------------------ dist/plotly.min.js | 34 +++++++-------- package.json | 2 +- src/assets/geo_assets.js | 2 +- src/core.js | 2 +- 23 files changed, 242 insertions(+), 389 deletions(-) diff --git a/dist/README.md b/dist/README.md index f2203cb86c6..f31becb287a 100644 --- a/dist/README.md +++ b/dist/README.md @@ -37,11 +37,11 @@ The main plotly.js bundle includes all the official (non-beta) trace modules. It be can imported as minified javascript - using dist file `dist/plotly.min.js` -- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.min.js OR https://cdn.plot.ly/plotly-plotly-1.20.0.min.js +- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.min.js OR https://cdn.plot.ly/plotly-plotly-1.20.1.min.js or as raw javascript: - using dist file `dist/plotly.js` -- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.js OR https://cdn.plot.ly/plotly-plotly-1.20.0.js +- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.js OR https://cdn.plot.ly/plotly-plotly-1.20.1.js - using CommonJS with `require('plotly.js')` If you would like to have access to the attribute meta information (including attribute descriptions as on the [schema reference page](https://plot.ly/javascript/reference/)), use dist file `dist/plotly-with-meta.js` @@ -74,8 +74,8 @@ The `basic` partial bundle contains the `scatter`, `bar` and `pie` trace modules | dist bundle (minified) | `dist/plotly-basic.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-basic-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-basic-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-basic-1.20.0.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-basic-1.20.0.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-basic-1.20.1.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-basic-1.20.1.min.js | | CommonJS | `require('plotly.js/lib/index-basic')` | | Raw size | Minified size | Minified + gzip size | @@ -92,8 +92,8 @@ The `cartesian` partial bundle contains the `scatter`, `bar`, `box`, `heatmap`, | dist bundle (minified) | `dist/plotly-cartesian.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-cartesian-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-cartesian-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-cartesian-1.20.0.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-cartesian-1.20.0.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-cartesian-1.20.1.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-cartesian-1.20.1.min.js | | CommonJS | `require('plotly.js/lib/index-cartesian')` | | Raw size | Minified size | Minified + gzip size | @@ -110,8 +110,8 @@ The `geo` partial bundle contains the `scatter`, `scattergeo` and `choropleth` t | dist bundle (minified) | `dist/plotly-geo.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-geo-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-geo-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-geo-1.20.0.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-geo-1.20.0.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-geo-1.20.1.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-geo-1.20.1.min.js | | CommonJS | `require('plotly.js/lib/index-geo')` | | Raw size | Minified size | Minified + gzip size | @@ -128,8 +128,8 @@ The `gl3d` partial bundle contains the `scatter`, `scatter3d`, `surface` and `me | dist bundle (minified) | `dist/plotly-gl3d.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-gl3d-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-gl3d-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl3d-1.20.0.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl3d-1.20.0.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl3d-1.20.1.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl3d-1.20.1.min.js | | CommonJS | `require('plotly.js/lib/index-gl3d')` | | Raw size | Minified size | Minified + gzip size | @@ -146,8 +146,8 @@ The `gl2d` partial bundle contains the `scatter`, `scattergl`, `pointcloud`, `he | dist bundle (minified) | `dist/plotly-gl2d.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-gl2d-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-gl2d-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl2d-1.20.0.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl2d-1.20.0.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl2d-1.20.1.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl2d-1.20.1.min.js | | CommonJS | `require('plotly.js/lib/index-gl2d')` | | Raw size | Minified size | Minified + gzip size | @@ -164,8 +164,8 @@ The `mapbox` partial bundle contains the `scatter` and `scattermapbox` trace mod | dist bundle (minified) | `dist/plotly-mapbox.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-mapbox-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-mapbox-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-mapbox-1.20.0.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-mapbox-1.20.0.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-mapbox-1.20.1.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-mapbox-1.20.1.min.js | | CommonJS | `require('plotly.js/lib/index-mapbox')` | | Raw size | Minified size | Minified + gzip size | @@ -182,8 +182,8 @@ The `finance` partial bundle contains the `scatter`, `bar`, `histogram`, `pie`, | dist bundle (minified) | `dist/plotly-finance.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-finance-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-finance-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-finance-1.20.0.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-finance-1.20.0.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-finance-1.20.1.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-finance-1.20.1.min.js | | CommonJS | `require('plotly.js/lib/index-finance')` | | Raw size | Minified size | Minified + gzip size | diff --git a/dist/npm-ls.json b/dist/npm-ls.json index 40c0d9b1795..4554fd70b12 100644 --- a/dist/npm-ls.json +++ b/dist/npm-ls.json @@ -1,6 +1,6 @@ { "name": "plotly.js", - "version": "1.20.0", + "version": "1.20.1", "dependencies": { "3d-view": { "version": "2.0.0", @@ -581,9 +581,9 @@ } }, "graceful-fs": { - "version": "4.1.9", + "version": "4.1.10", "from": "graceful-fs@>=4.1.2 <5.0.0", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.9.tgz" + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.10.tgz" }, "inherits": { "version": "2.0.3", @@ -758,7 +758,7 @@ "dependencies": { "acorn": { "version": "1.2.2", - "from": "acorn@>=1.0.3 <2.0.0", + "from": "acorn@^1.0.3", "resolved": "https://registry.npmjs.org/acorn/-/acorn-1.2.2.tgz" }, "foreach": { @@ -881,7 +881,7 @@ }, "through2": { "version": "0.6.5", - "from": "through2@>=0.6.3 <0.7.0", + "from": "through2@^0.6.3", "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz" } } @@ -961,15 +961,15 @@ }, "through2": { "version": "0.6.5", - "from": "through2@>=0.6.3 <0.7.0", + "from": "through2@^0.6.3", "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz" } } }, "gl-texture2d": { - "version": "2.0.11", + "version": "2.0.12", "from": "gl-texture2d@>=2.0.9 <3.0.0", - "resolved": "https://registry.npmjs.org/gl-texture2d/-/gl-texture2d-2.0.11.tgz" + "resolved": "https://registry.npmjs.org/gl-texture2d/-/gl-texture2d-2.0.12.tgz" }, "snap-points-2d": { "version": "1.0.1", @@ -1160,7 +1160,7 @@ }, "through2": { "version": "0.6.5", - "from": "through2@>=0.6.3 <0.7.0", + "from": "through2@^0.6.3", "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz" } } @@ -1177,7 +1177,7 @@ }, "text-cache": { "version": "4.1.0", - "from": "text-cache@>=4.0.0 <5.0.0", + "from": "text-cache@>=4.1.0 <5.0.0", "resolved": "https://registry.npmjs.org/text-cache/-/text-cache-4.1.0.tgz" } } @@ -1354,7 +1354,7 @@ }, "gl-scatter2d": { "version": "1.2.2", - "from": "gl-scatter2d@1.2.2", + "from": "gl-scatter2d@>=1.2.2 <2.0.0", "resolved": "https://registry.npmjs.org/gl-scatter2d/-/gl-scatter2d-1.2.2.tgz", "dependencies": { "binary-search-bounds": { @@ -1364,18 +1364,18 @@ }, "glslify": { "version": "2.3.1", - "from": "glslify@^2.1.2", + "from": "glslify@>=2.1.2 <3.0.0", "resolved": "https://registry.npmjs.org/glslify/-/glslify-2.3.1.tgz", "dependencies": { "bl": { "version": "0.9.5", - "from": "bl@^0.9.4", + "from": "bl@>=0.9.4 <0.10.0", "resolved": "https://registry.npmjs.org/bl/-/bl-0.9.5.tgz" }, "glslify-bundle": { "version": "2.0.4", - "from": "glslify-bundle@^2.0.4", - "resolved": "http://registry.npmjs.org/glslify-bundle/-/glslify-bundle-2.0.4.tgz" + "from": "glslify-bundle@>=2.0.4 <3.0.0", + "resolved": "https://registry.npmjs.org/glslify-bundle/-/glslify-bundle-2.0.4.tgz" }, "through2": { "version": "0.6.5", @@ -1403,18 +1403,18 @@ }, "glslify": { "version": "2.3.1", - "from": "glslify@^2.3.1", + "from": "glslify@>=2.3.1 <3.0.0", "resolved": "https://registry.npmjs.org/glslify/-/glslify-2.3.1.tgz", "dependencies": { "bl": { "version": "0.9.5", - "from": "bl@^0.9.4", + "from": "bl@>=0.9.4 <0.10.0", "resolved": "https://registry.npmjs.org/bl/-/bl-0.9.5.tgz" }, "glslify-bundle": { "version": "2.0.4", - "from": "glslify-bundle@^2.0.4", - "resolved": "http://registry.npmjs.org/glslify-bundle/-/glslify-bundle-2.0.4.tgz" + "from": "glslify-bundle@>=2.0.4 <3.0.0", + "resolved": "https://registry.npmjs.org/glslify-bundle/-/glslify-bundle-2.0.4.tgz" }, "through2": { "version": "0.6.5", @@ -1600,9 +1600,9 @@ "resolved": "https://registry.npmjs.org/pad-left/-/pad-left-1.0.2.tgz", "dependencies": { "repeat-string": { - "version": "1.5.4", + "version": "1.6.1", "from": "repeat-string@>=1.3.0 <2.0.0", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.5.4.tgz" + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz" } } } @@ -2007,9 +2007,9 @@ "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-1.0.0.tgz" }, "request": { - "version": "2.75.0", + "version": "2.78.0", "from": "request@>=2.39.0 <3.0.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.75.0.tgz", + "resolved": "https://registry.npmjs.org/request/-/request-2.78.0.tgz", "dependencies": { "aws-sign2": { "version": "0.6.0", @@ -2049,9 +2049,9 @@ "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz" }, "form-data": { - "version": "2.0.0", - "from": "form-data@>=2.0.0 <2.1.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.0.0.tgz", + "version": "2.1.2", + "from": "form-data@>=2.1.1 <2.2.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.2.tgz", "dependencies": { "asynckit": { "version": "0.4.0", @@ -2324,9 +2324,9 @@ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz" }, "qs": { - "version": "6.2.1", - "from": "qs@>=6.2.0 <6.3.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.2.1.tgz" + "version": "6.3.0", + "from": "qs@>=6.3.0 <6.4.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.0.tgz" }, "stringstream": { "version": "0.0.5", @@ -2334,9 +2334,16 @@ "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz" }, "tough-cookie": { - "version": "2.3.1", + "version": "2.3.2", "from": "tough-cookie@>=2.3.0 <2.4.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.1.tgz" + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", + "dependencies": { + "punycode": { + "version": "1.4.1", + "from": "punycode@>=1.4.1 <2.0.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz" + } + } }, "tunnel-agent": { "version": "0.4.3", @@ -2388,9 +2395,9 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", "dependencies": { "amdefine": { - "version": "1.0.0", + "version": "1.0.1", "from": "amdefine@>=0.0.4", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz" } } } @@ -2629,7 +2636,7 @@ }, "uglify-js": { "version": "2.7.4", - "from": "uglify-js@2.7.4", + "from": "uglify-js@>=2.6.0 <3.0.0", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.7.4.tgz", "dependencies": { "async": { @@ -2825,7 +2832,7 @@ }, "topojson-client": { "version": "2.1.0", - "from": "topojson-client@latest", + "from": "topojson-client@>=2.1.0 <3.0.0", "resolved": "https://registry.npmjs.org/topojson-client/-/topojson-client-2.1.0.tgz", "dependencies": { "commander": { diff --git a/dist/plotly-basic.js b/dist/plotly-basic.js index e3bd15bfa18..e967204c0c0 100644 --- a/dist/plotly-basic.js +++ b/dist/plotly-basic.js @@ -1,5 +1,5 @@ /** -* plotly.js (basic) v1.20.0 +* plotly.js (basic) v1.20.1 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -25295,7 +25295,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.20.0'; +exports.version = '1.20.1'; // inject promise polyfill require('es6-promise').polyfill(); @@ -33947,7 +33947,7 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { // if position is given as a category name, convert it to a number if(typeof pos === 'string' && (ax._categories || []).length) { newPos = ax._categories.indexOf(pos); - containerOut[attr] = (newPos !== -1) ? dflt : newPos; + containerOut[attr] = (newPos === -1) ? dflt : newPos; return; } } @@ -47543,40 +47543,6 @@ module.exports = { } }, - // 3D attributes commented out until I finish them in a later PR - // tilt: { - // // degrees to tilt the pie back from straight on - // valType: 'number', - // min: 0, - // max: 90, - // dflt: 0 - // }, - // tiltaxis: { - // // degrees away from straight up to tilt the pie - // // only has an effect if tilt is nonzero - // valType: 'number', - // min: -360, - // max: 360, - // dflt: 0 - // }, - // depth: { - // // "3D" size, as a fraction of radius - // // only has an effect if tilt is nonzero - // valType: 'number', - // min: 0, - // max: 10, - // dflt: 0.5 - // }, - // shading: { - // // how much darker to make the sides than the top, - // // with a 3D effect. We could of course get all - // // fancy with lighting effects, but maybe this is - // // sufficient. - // valType: 'number', - // min: 0, - // max: 1, - // dflt: 0.2 - // }, hole: { valType: 'number', diff --git a/dist/plotly-basic.min.js b/dist/plotly-basic.min.js index ba227c7b66a..635e06aa04a 100644 --- a/dist/plotly-basic.min.js +++ b/dist/plotly-basic.min.js @@ -1,5 +1,5 @@ /** -* plotly.js (basic - minified) v1.20.0 +* plotly.js (basic - minified) v1.20.1 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -14,10 +14,10 @@ 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",ba e.exports=function(t,e){e=e||{};for(var n=t.domain,s=t.range,c=s.length,u=new Array(c),f=0;f4/3-l?i:l}},{}],43:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":115}],44:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},v=1,m=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=r},{"../../lib":115,"../../plotly":137,"../../plots/cartesian/constants":147,"./align":42,"./cursor":43,"./unhover":45}],45:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":111}],46:[function(t,e,n){"use strict";function r(t,e,n,r,a,o,i){if(l.traceIs(n,"symbols")){var c=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(n)?c(t.ms):(o.size||6)/2,t.mrc=e;var r=g.symbolNumber(t.mx||o.symbol)||0,a=r%100;return t.om=r%200>=100,g.symbolFuncs[a](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=r(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,n,r){var a=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(s.fill,r)},g.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},g.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},g.setRect=function(t,e,n,r,a){t.call(g.setPosition,e,n).call(g.setSize,r,a)},g.translatePoint=function(t,e,n,r){var a=t.xp||n.c2p(t.x),o=t.yp||r.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,n,r){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,n,r)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,n){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},g.singleLineStyle=function(t,e,n,r,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=n||o.width||0,l=a||o.dash||"";s.stroke(e,r||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=r||a.dash||"";o.select(this).call(s.stroke,n||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=o.select(this);try{n.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),n.remove()}})};var v=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,n){var a=n.marker,o=a.line,i=g.tryColorscale(a,""),l=g.tryColorscale(a,"line");r(t,e,n,i,l,a,o)},g.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=g.tryColorscale(n,""),a=g.tryColorscale(n,"line");t.each(function(t){g.singlePointStyle(t,o.select(this),e,r,a)})}},g.tryColorscale=function(t,e){var n=e?u.nestedProperty(t,e).get():t,r=n.colorscale,a=n.color;return r&&Array.isArray(a)?c.makeColorScaleFunc(c.extractScale(r,n.cmin,n.cmax)):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var n=o.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,n.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(f.convertToTspans);var d=o.select(this.parentNode),h=n.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,v=x[s]*u,m=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+v+","+m+")"),p>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],o=[];for(n=1;n=A&&(o.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=o.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":105,"../../lib":115,"../../lib/svg_text_utils":127,"../../registry":173,"../../traces/scatter/make_bubble_size_func":222,"../../traces/scatter/subtypes":227,"../color":23,"../colorscale":37,"./symbol_defs":47,d3:7,"fast-isnumeric":10}],47:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:7}],48:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],49:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&["linear","log"].indexOf(n.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);u&&v.style("opacity",0).transition().duration(n.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=r(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");l=!v.size(),l?v=e.append("path").classed("yerror",!0):u&&(v=v.transition().duration(n.duration).ease(n.easing)),v.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var m=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-m)+"v"+2*m+"m0,-"+m+"H"+i.xs,i.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":227,d3:7,"fast-isnumeric":10}],54:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":23,d3:7}],55:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":147}],56:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,l,n,r)}var i=r("source"),s=r("visible",!!i);if(!s)return e;r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var c={_fullLayout:n},u=["x","y"],f=0;f<2;f++)o.coerceRef(t,e,c,u[f],"paper");return e}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("../../plots/array_container_defaults"),l=t("./attributes"),s="images";e.exports=function(t,e){var n={name:s,handleItemDefaults:r};i(t,e,n)}},{"../../lib":115,"../../plots/array_container_defaults":139,"../../plots/cartesian/axes":142,"./attributes":55}],57:[function(t,e,n){"use strict";var r=t("d3"),a=t("../drawing"),o=t("../../plots/cartesian/axes"),i=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var n=r.select(this);if(!this.img||this.img.src!==e.source){n.attr("xmlns",i.svg);var a=new Promise(function(t){function r(){n.remove(),t()}var a=new Image;this.img=a,a.setAttribute("crossOrigin","anonymous"),a.onerror=r,a.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var r=t.toDataURL("image/png");n.attr("xlink:href",r)},n.on("error",r),n.on("load",t),a.src=e.source}.bind(this));t._promises.push(a)}}function n(e){var n=r.select(this),i=o.getFromId(t,e.xref),s=o.getFromId(t,e.yref),c=l._size,u=i?Math.abs(i.l2p(e.sizex)-i.l2p(0)):e.sizex*c.w,f=s?Math.abs(s.l2p(e.sizey)-s.l2p(0)):e.sizey*c.h,d=u*h.x[e.xanchor].offset,p=f*h.y[e.yanchor].offset,g=h.x[e.xanchor].sizing+h.y[e.yanchor].sizing,v=(i?i.r2p(e.x)+i._offset:e.x*c.w+c.l)+d,m=(s?s.r2p(e.y)+s._offset:c.h-e.y*c.h+c.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}n.attr({x:v,y:m,width:u,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=i?i._id:"",x=s?s._id:"",b=y+x;b&&n.call(a.setClipUrl,"clip"+l._uid+b)}for(var l=t._fullLayout,s=[],c=[],u=[],f=0;f=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],60:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":112,"../../plots/font_attributes":162,"../color/attributes":22}],61:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],62:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",v),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":115,"../../plots/layout_attributes":164,"../../registry":173,"./attributes":60,"./helpers":65}],63:[function(t,e,n){"use strict";function r(t,e){function n(n){m.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(m.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,v+=m,a.height=a.height+m,m=0),f.setTranslate(this,o+x,5+o+e.height/2+v),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,m=Math.max(e.height,m)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,j,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:m.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var m=n.legend,_=n.showlegend&&x(t.calcdata,m),k=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=n._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=M.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=L.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var z=S.selectAll("g.traces").data(f.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,S,z),l(t));var P=0,D=n.width,N=0,E=n.height;i(t,S,z),m.height>E?s(t):l(t);var I=n._size,R=I.l+I.w*m.x,F=I.t+I.h*(1-m.y);w.isRightAnchor(m)?R-=m.width:w.isCenterAnchor(m)&&(R-=m.width/2),w.isBottomAnchor(m)?F-=m.height:w.isMiddleAnchor(m)&&(F-=m.height/2);var j=m.width,B=I.w;j>B?(R=I.l,j=B):(R+j>D&&(R=D-j),RH?(F=I.t,q=H):(F+q>E&&(F=E-q),Fn[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var v=s.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(l?r:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=v.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":115,"../../registry":173,"../../traces/pie/style_one":205,"../../traces/scatter/subtypes":227,"../color":23,"../drawing":46,d3:7}],68:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(v,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var m=a(l),y=[];return((c||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||m||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(v,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var v=u("bgcolor");u("activecolor",i.contrast(v,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":115,"../color":23,"./attributes":72,"./button_attributes":73,"./constants":74}],76:[function(t,e,n){"use strict";function r(t){for(var e=m.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},a=S.line.width?S.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",S.opacity).call(_.stroke,a).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);z&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&f(t,o,S,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof n&&n?s[n]=r:x.isPlainObject(n)&&(s=n);var c=Object.keys(s);for(o=0;oZ&&r>G&&!t.shiftKey?k.getCursor(a/n,1-o/r):"move";M(e,i),U=i.split("-")[0]}function o(e){j=b.getFromId(t,n.xref),B=b.getFromId(t,n.yref),q=T.getDataToPixel(t,j),H=T.getDataToPixel(t,B,!0),V=T.getPixelToData(t,j),X=T.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(R=n.path,F=o+".path"):(u=q(n.x0),f=H(n.y0),d=q(n.x1),h=H(n.y1),g=o+".x0",m=o+".y0",x=o+".x1",_=o+".y1"),uG&&(c[S]=n[D]=X(l),c[z]=n[N]=X(s)),f-u>Z&&(c[O]=n[E]=V(u),c[P]=n[I]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,m,x,_,w,A,L,C,S,z,O,P,D,N,E,I,R,F,j,B,q,H,V,X,U,Z=10,G=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();k.init(Y)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,v=(d+h)/2,m=Math.abs(p-u),y=Math.abs(v-d),x="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function v(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var m=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults");e.exports={draw:r,drawOne:a}},{"../../lib":115,"../../lib/setcursor":125,"../../plotly":137,"../../plots/cartesian/axes":142,"../color":23,"../dragelement":44,"../drawing":46,"./constants":86,"./defaults":87,"./helpers":89,"./shape_defaults":91,"fast-isnumeric":10}],89:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],90:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":84,"./calc_autorange":85,"./defaults":87,"./draw":88}],91:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],v={_fullLayout:n},m=a.coerceRef(t,e,v,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==m?(y=a.getFromId(v,m),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=r.identity;var k=g+"0",M=g+"1",A=t[k],T=t[M];t[k]=x(t[k],!0),t[M]=x(t[M],!0),a.coercePosition(e,v,c,m,k,_),a.coercePosition(e,v,c,m,M,w),e[k]=b(e[k]),e[M]=b(e[M]),t[k]=A,t[M]=T}}return"path"===d?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":115,"../../plots/cartesian/axes":142,"./attributes":84,"./helpers":89}],92:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":112,"../../plots/animation_attributes":138,"../../plots/font_attributes":162,"../../plots/pad_attributes":165,"./constants":93}],93:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],94:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+S.railTouchRectClass).data([0]);r.enter().append("rect").classed(S.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,S.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0), -M.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+S.railRectClass).data([0]);n.enter().append("rect").classed(S.railRectClass,!0);var r=e.inputAreaLength-2*S.railInset;n.attr({width:r,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(n,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+S.groupClassName).data(n,a);s.enter().append("g").classed(S.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,S=O,k._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,v=n.propName,m=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(S).attr("class",e),z.attr({"data-unformatted":S}).call(f);var O="Click to enter "+y+" title";t._context.editable?(S||p(),z.call(u.makeEditable).on("edit",function(e){void 0!==m?o.restyle(t,v,e,m):o.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",C)}},{"../../lib":115,"../../lib/svg_text_utils":127,"../../plotly":137,"../../plots/plots":166,"../color":23,"../drawing":46,d3:7,"fast-isnumeric":10}],98:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":112,"../../plots/font_attributes":162,"../../plots/pad_attributes":165,"../color/attributes":22}],99:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],100:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],105:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],106:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":21,"./components/images":58,"./components/legend":66,"./components/rangeselector":78,"./components/rangeslider":83,"./components/shapes":90,"./components/sliders":96,"./components/updatemenus":102,"./fonts/mathjax_config":107,"./lib/queue":123,"./plot_api/plot_schema":131,"./plot_api/register":132,"./plot_api/set_plot_config":133,"./plot_api/to_image":135,"./plot_api/validate":136,"./plotly":137,"./snapshot":178,"./snapshot/download":175,"./traces/scatter":217,d3:7,"es6-promise":8}],107:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],108:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":103,"fast-isnumeric":10}],109:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(o(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,r,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var v=(new Date).getFullYear();e=((Number(c[0])-v+70)%100+200)%100+v-70}if(!o(e))return s;var m=new Date(0,0,1);if(m.setFullYear(u?e:-e),c.length>1){if(r=Number(c[1])-1,c[1].length>2||!(r>=0&&r<=11))return s;if(m.setMonth(r),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(m.setDate(a),m.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(m.setHours(i),m.getHours()!==i)return s;if(c.length>1)return a=m.getTime(),r=Number(c[1]),2===c[1].length&&r>=0&&r<=59?(a+=f*r,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return m.getTime()},h=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==s};var g=90*c,v=3*u,m=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var n=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(n),i=en?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r0?[0]:[]);if(l.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+S.groupClassName).data(n,a);s.enter().append("g").classed(S.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,S=O,k._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,v=n.propName,m=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(S).attr("class",e),z.attr({"data-unformatted":S}).call(f);var O="Click to enter "+y+" title";t._context.editable?(S||p(),z.call(u.makeEditable).on("edit",function(e){void 0!==m?o.restyle(t,v,e,m):o.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",C)}},{"../../lib":115,"../../lib/svg_text_utils":127,"../../plotly":137,"../../plots/plots":166,"../color":23,"../drawing":46,d3:7,"fast-isnumeric":10}],98:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":112,"../../plots/font_attributes":162,"../../plots/pad_attributes":165,"../color/attributes":22}],99:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],100:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],105:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],106:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":21,"./components/images":58,"./components/legend":66,"./components/rangeselector":78,"./components/rangeslider":83,"./components/shapes":90,"./components/sliders":96,"./components/updatemenus":102,"./fonts/mathjax_config":107,"./lib/queue":123,"./plot_api/plot_schema":131,"./plot_api/register":132,"./plot_api/set_plot_config":133,"./plot_api/to_image":135,"./plot_api/validate":136,"./plotly":137,"./snapshot":178,"./snapshot/download":175,"./traces/scatter":217,d3:7,"es6-promise":8}],107:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],108:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":103,"fast-isnumeric":10}],109:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(o(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,r,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var v=(new Date).getFullYear();e=((Number(c[0])-v+70)%100+200)%100+v-70}if(!o(e))return s;var m=new Date(0,0,1);if(m.setFullYear(u?e:-e),c.length>1){if(r=Number(c[1])-1,c[1].length>2||!(r>=0&&r<=11))return s;if(m.setMonth(r),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(m.setDate(a),m.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(m.setHours(i),m.getHours()!==i)return s;if(c.length>1)return a=m.getTime(),r=Number(c[1]),2===c[1].length&&r>=0&&r<=59?(a+=f*r,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return m.getTime()},h=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==s};var g=90*c,v=3*u,m=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var n=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(n),i=en?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"./clean_number":108,"./coerce":109,"./dates":110,"./extend":112,"./filter_unique":113,"./filter_visible":114,"./is_array":116,"./is_plain_object":117,"./loggers":118,"./matrix":119,"./nested_property":120,"./notifier":121,"./search":124,"./stats":126,d3:7}],116:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],117:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],118:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],i=!1,d(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");lo||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],s=t[1];if(no||sl)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],v=r[0][1],m=0;for(c=1;cMath.max(u,g)||s>Math.max(f,v)))if(su||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":119}],123:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;f90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":10}],127:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,v.indexOf(u.protocol)===-1?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var v=d.getPlotDiv(l.node());(v&&v._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],v=parseInt(l.style("font-size"),10)||r(l,"height"),m=-v/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,m-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:m-d/2}):"a"===p[0]?s.attr({x:0,y:m}):s.attr({x:g,y:+l.attr("y")+m-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(m," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":104,"../constants/xmlns_namespaces":105,"../lib":115,d3:7}],128:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function a(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var a=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=u.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&l(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sO.range[0]?[1,2]:[2,1]);else{var P=O.range[0],D=O.range[1];"log"===b?(P<=0&&D<=0&&n(L+".autorange",!0),P<=0?P=D/1e6:D<=0&&(D=P/1e6),n(L+".range[0]",Math.log(P)/Math.LN10),n(L+".range[1]",Math.log(D)/Math.LN10)):(n(L+".range[0]",Math.pow(10,P)),n(L+".range[1]",Math.pow(10,D)))}else n(L+".autorange",!0)}if("reverse"===A)C.range?C.range.reverse():(n(L+".autorange",!0),C.range=[1,0]),S.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var N=m.parts[1],E=m.parts[0],I=o[E]||[],R=I[N]||{};2===m.parts.length&&(null===b&&(e[v]="remove"),"add"===e[v]||x.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?N===-1?(g[E]=I,delete g[v]):g[v]=R:x.log("???",e)),!r(R,"x")&&!r(R,"y")||x.containsAny(v,["color","opacity","align","dash"])||(h.docalc=!0);var F=w.getComponentMethod(E,"drawOne");F(t,N,m.parts.slice(2).join("."),e[v]),delete e[v]}else if(k.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1])z.manageArrayContainers(m,b,g),h.doplot=!0;else{var j=String(m.parts[1]||"");0===m.parts[0].indexOf("scene")?h.doplot=!0:0===m.parts[0].indexOf("geo")?h.doplot=!0:0===m.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===v?h.doplot=!0:!i._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?h.docalc=!0:m.parts[0].indexOf("legend")!==-1?h.dolegend=!0:v.indexOf("title")!==-1?h.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:m.parts.length>1&&x.containsAny(j,["tick","exponent","grid","zeroline"])?h.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:m.parts.length>1&&j.indexOf("line")!==-1?h.dolayoutstyle=!0:m.parts.length>1&&"mirror"===j?h.doticks=h.dolayoutstyle=!0:"margin.pad"===v?h.doticks=h.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(h.doplot=!0):h.doplot=!0,m.set(b)}}}var B=t._fullLayout.width,q=t._fullLayout.height;k.supplyDefaults(t),t.layout.autosize&&k.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==q;return H&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=v.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];v.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(C.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var o=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=o.append("g").classed("imagelayer",!0),n._shapeUpperLayer=o.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),k=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),C=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),z=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,n,r){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=P._basePlotModules,n=0;n=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=z.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),n=k.supplyAnimationDefaults(n);var l=n.transition,s=n.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){if(0!==i._frameQueue.length){for(;i._frameQueue.length;){var e=i._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var l=0;li._timeToNext&&h()};e()}function g(t){return Array.isArray(l)?y>=l.length?t.transitionOpts=l[y]:t.transitionOpts=l[0]:t.transitionOpts=l,y++,t}var v,m,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&x.isPlainObject(e);if(M)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(v=0;v0&&LL)&&C.push(m);b=C}}b.length>0?f(b):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,n){if(t=z.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,a,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(r=e.length-1;r>=0;r--)u.push({frame:k.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:c+r});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(a=u[r].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=k.modifyFrames,s=k.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),k.modifyFrames(t,o)},y.purge=function(t){t=z.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return k.cleanPlot([],{},n,e),k.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":46,"../components/errorbars":52,"../constants/xmlns_namespaces":105,"../lib":115,"../lib/events":111,"../lib/queue":123,"../lib/svg_text_utils":127,"../plotly":137,"../plots/cartesian/graph_interact":149,"../plots/plots":166,"../plots/polar":169,"../registry":173,"./helpers":128,"./subroutines":134,d3:7,"fast-isnumeric":10}],130:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],131:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:y},n={}):(e=d.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,_(r,p),_(r,e.attributes),n.attributes&&_(r,n.attributes),r.type=t;var a={meta:e.meta||{},attributes:i(r)};if(e.layoutAttributes){var o={};_(o,e.layoutAttributes),a.layoutAttributes=i(o)}return a}function a(){var t={};return _(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var n=d.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)u(t,n,"xaxis"),u(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;u(t,n,r)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.layoutAttributes&&(Array.isArray(n.layoutNodes)?n.layoutNodes.forEach(function(e){f(t,n,e+n.name)}):f(t,n,n.name))}),{layoutAttributes:i(t)}}function o(t){var e=d.transformsRegistry[t];return{attributes:i(e.attributes)}}function i(t){return l(t),s(t),t}function l(t){function e(t){return{valType:"string"}}function r(t,r,a){n.isValObject(t)?"data_array"===t.valType?(t.role="data",a[r+"src"]=e(r)):t.arrayOk===!0&&(a[r+"src"]=e(r)):h.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function s(t){function e(t,e,n){if(t){var r=t[k];r&&(delete t[k],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function c(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function u(t,e,n){var r=h.nestedProperty(t,n),a=_({},e.layoutAttributes);a[w]=!0,r.set(a)}function f(t,e,n){var r=h.nestedProperty(t,n),a=_(r.get()||{},e.layoutAttributes);r.set(a)}var d=t("../registry"),h=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),m=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=h.extendFlat,_=h.extendDeep,w="_isSubplotObj",k="_isLinkedToArray",M="_deprecated",A=[w,k,M];n.IS_SUBPLOT_OBJ=w,n.IS_LINKED_TO_ARRAY=k,n.DEPRECATED=M,n.UNDERSCORE_ATTRS=A,n.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:h.valObjects,metaKeys:A.concat.role},traces:t,layout:a(),transforms:e,frames:i(v),animation:i(m)}},n.crawl=function(t,e,r){var a=r||0;Object.keys(t).forEach(function(r){var o=t[r];A.indexOf(r)===-1&&(e(o,r,t,a),n.isValObject(o)||h.isPlainObject(o)&&n.crawl(o,e,a+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,i,l){o=o.slice(0,l).concat([n]);var s="data_array"===e.valType||e.arrayOk===!0;if(s){var c=r(o),u=h.nestedProperty(t,c).get();Array.isArray(u)&&a.push(c)}}function r(t){return t.join(".")}var a=[],o=[];if(n.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":115,"../plotly":137,"../snapshot/cloneplot":174,"../snapshot/helpers":177,"../snapshot/svgtoimg":179,"../snapshot/tosvg":181,"fast-isnumeric":10}],136:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,v=n.length,m=0;mu&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=z&&a<=10||e>=15*z)t._tickround="d";else if(e>=P&&a<=16||e>=O)t._tickround="M";else if(e>=D&&a<=19||e>=P)t._tickround="S";else{var o=_.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var n=t.match(Y),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);n&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(r&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(n||(a="
"+H(u)),o=X(u)):(n||(a="
"+U(u)),o=Z(u),"M"!==s?(o+=G(u),"S"!==s&&(o+=d(y.round(m(l/1e3,1),4),t,"none",n).substr(1))):"d"===c&&(o=X(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&m(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,m(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=t<0,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var g=r-1,v=r+1;n="tozero"===t.rangemode?r<0?[g,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,v)]:[g,v]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n.map(t.l2r||Number)},N.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=N.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},N.saveRangeInitial=function(t,e){for(var n=N.list(t,"",!0),r=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,v=e.length,m=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=v-1;o>5;o--)a(o)}},N.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},N.autoTicks(f,l);var d,h=N.tickIncrement(N.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=N.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=N.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fC?(e/=C,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,I)):r>S?(e/=S,t.dtick="M"+a(e,1,R)):r>z?(t.dtick=a(e,z,j),t.tick0="2000-01-02"):r>O?t.dtick=a(e,O,R):r>P?t.dtick=a(e,P,F):r>D?t.dtick=a(e,D,F):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,I)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},N.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?q:B,s=t+.01*r,c=_.roundUp(m(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]o:f1&&e1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":115,"../plotly":137,"../snapshot/cloneplot":174,"../snapshot/helpers":177,"../snapshot/svgtoimg":179,"../snapshot/tosvg":181,"fast-isnumeric":10}],136:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,v=n.length,m=0;mu&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=z&&a<=10||e>=15*z)t._tickround="d";else if(e>=P&&a<=16||e>=O)t._tickround="M";else if(e>=D&&a<=19||e>=P)t._tickround="S";else{var o=_.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var n=t.match(Y),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);n&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(r&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(n||(a="
"+H(u)),o=X(u)):(n||(a="
"+U(u)),o=Z(u),"M"!==s?(o+=G(u),"S"!==s&&(o+=d(y.round(m(l/1e3,1),4),t,"none",n).substr(1))):"d"===c&&(o=X(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&m(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,m(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=t<0,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var g=r-1,v=r+1;n="tozero"===t.rangemode?r<0?[g,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,v)]:[g,v]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n.map(t.l2r||Number)},N.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=N.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},N.saveRangeInitial=function(t,e){for(var n=N.list(t,"",!0),r=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,v=e.length,m=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=v-1;o>5;o--)a(o)}},N.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},N.autoTicks(f,l);var d,h=N.tickIncrement(N.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=N.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=N.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fC?(e/=C,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,I)):r>S?(e/=S,t.dtick="M"+a(e,1,R)):r>z?(t.dtick=a(e,z,j),t.tick0="2000-01-02"):r>O?t.dtick=a(e,O,R):r>P?t.dtick=a(e,P,F):r>D?t.dtick=a(e,D,F):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,I)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},N.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?q:B,s=t+.01*r,c=_.roundUp(m(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]o:f1&&e2*r}function o(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("../../constants/numerical").BADNUM;e.exports=function(t){return a(t)?"date":o(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":103,"../../lib":115,"fast-isnumeric":10}],144:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var l=i(e,n,r);if(l){if("histogram"===l.type&&r==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,r)){for(var s,u=a(l),f=[],d=0;d0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],147:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],148:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?r:"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,n,l,_,w,k,M){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+vt+")").attr("d",ct+"Z"),ht=pt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+vt+")").attr("d","M0,0Z"),C()}function C(){pt.selectAll(".select-outline").remove()}function S(e,n){if(t._transitioningWithDuration)return!1;var r=Math.max(0,Math.min(V,e+ot)),a=Math.max(0,Math.min(X,n+it)),o=Math.abs(r-ot),i=Math.abs(a-it),l=Math.floor(Math.min(i,o,Z)/2);lt.l=Math.min(ot,r),lt.r=Math.max(ot,r),lt.t=Math.min(it,a),lt.b=Math.max(it,a),!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function z(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),b=!1)))}function P(e,n){var a=1===(k+M).length;if(e)R();else if(2!==n||a){if(1===n&&a){var o=k?H[0]:q[0],i="s"===k||"w"===M?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",f="middle";if(o.fixedrange)return;k?(f="n"===k?"top":"bottom","right"===o.side&&(u="right")):"e"===M&&(u="right"),nt.call(d.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var n=o.d2r(e);void 0!==n&&c.relayout(t,l,n)})}}else I()}function D(e){function n(t,e,n){function r(e){return t.l2r(o+(e-o)*n)}if(!t.fixedrange){var a=t.range.map(t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(r)}}if(t._context.scrollZoom||j._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(T(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(yt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=mt[0]+mt[2]*s,u=(l.bottom-e.clientY)/l.height,d=mt[1]+mt[3]*(1-u);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,n){for(var r,o,i=1-e,l=0;l0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rY.width||G<0||G>Y.height)return _.unhoverRaw(t,e)}else Z="xpx"in e?e.xpx:M[0]._length/2,G="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?r(o,e.xval):a(M,Z),P="yval"in e?r(o,e.yval):a(A,G),!g(O[0])||!g(P[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(N=0;N1||I.hoverinfo.indexOf("name")!==-1?I.name:void 0,index:!1,distance:Math.min(W,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[R]&&(H.subplot=i[R]._subplot),V=X.length,"array"===j){var Q=e[N];"pointNumber"in Q?(H.index=Q.pointNumber,j="closest"):(j="","xval"in Q&&(B=Q.xval,j="x"),"yval"in Q&&(q=Q.yval,j=j?"closest":"y"))}else B=O[F],q=P[F];if(I._module&&I._module.hoverPoints){var $=I._module.hoverPoints(H,B,q,j);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&X.push(s(J,z))}else v.log("Unrecognized trace type in hover:",I);"closest"===z&&X.length>V&&(X.splice(0,V),W=X[0].distance)}if(0===X.length)return _.unhoverRaw(t,e);var tt="y"===z&&U.length>1;X.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),nt={hovermode:z,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},rt=c(X,nt);u(X,tt?"xa":"ya"),f(rt,tt);var at=t._hoverdata,ot=[];for(D=0;D128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),v=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),v=d.node().getBoundingClientRect().width+2*D):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var m,k,T=f.node().getBoundingClientRect(),C=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),N=T.width+P+D+v;t.ty0=_-T.top,t.bx=T.width+2*D,t.by=T.height+2*D,t.anchor="start",t.txwidth=T.width,t.tx2width=v,t.offset=0,o?(t.pos=C,m=S+O/2+N<=M,k=S-O/2-N>=0,"top"!==t.idealAlign&&m||!k?m?(S+=O/2,t.anchor="start"):t.anchor="middle":(S-=O/2,t.anchor="end")):(t.pos=S,m=C+z/2+N<=w,k=C-z/2-N>=0,"left"!==t.idealAlign&&m||!k?m?(C+=z/2,t.anchor="start"):t.anchor="middle":(C-=z/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+C+","+S+")"+(o?"rotate("+L+")":""))}),S}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?S:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var v=f[i];for(l=v.length-1;l>=0;l--){var m=v[l],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(P+D),l=i+o*(t.txwidth+D),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-O,s=t.offset*z),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*P+s)+","+(P+c)+"v"+(t.by/2-P)+"h"+r*t.bx+"v-"+t.by+"H"+(r*P+s)+"V"+(c-P)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+D).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*D+s,c+t.ty0-t.by/2+D),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,n){function r(n,r){return v.coerce(t,e,A,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=T.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},T.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+k.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},T.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},T.getClosest=function(t,e,n){ if(n.index!==!1)n.index>=0&&n.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":115,"fast-isnumeric":10}],155:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,v=a.element.getBoundingClientRect(),m=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-v.left,b=n-v.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),C=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",k+"Z");var z,O,P,D,N,E=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,F=[];for(z=0;z0)return Math.log(e)/Math.LN10;if(e<=0&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*f*Math.abs(r-a))}return s}function n(t){return Math.pow(10,t)}function i(t){return a(t)?(t=Number(t),t<-l||t>l?s:a(t)?Number(t):s):s}var f=10;t.c2l="log"===t.type?e:i,t.l2c="log"===t.type?n:i,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var n,r,i=t[e],s=(t._id||"x").charAt(0);if(r="date"===t.type?c.DFLTRANGEDATE:"y"===s?c.DFLTRANGEY:c.DFLTRANGEX,r=r.slice(),!i||2!==i.length)return void(t[e]=r);for("date"===t.type&&(i[0]=o.cleanDate(i[0]),i[1]=o.cleanDate(i[1])),n=0;n<2;n++)if("date"===t.type){if(!o.isDateTime(i[n])){t[e]=r;break}if(i[n]o.MAX_MS&&(i[n]=o.MAX_MS),t.r2l(i[0])===t.r2l(i[1])){var u=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(u-1e3),i[1]=t.l2r(u+1e3);break}}else{if(!a(i[n])){if(!a(i[1-n])){t[e]=r;break}i[n]=i[1-n]*(n?10:.1)}if(i[n]<-l?i[n]=-l:i[n]>l&&(i[n]=l),i[0]===i[1]){var f=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=f,i[1]+=f}}},t.fraction2r=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return t.l2r(n+e*(r-n))},t.r2fraction=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return(t.r2l(e)-n)/(r-n)},t.setScale=function(e){var n=t._gd._fullLayout._size,r=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var a=u.getFromId(t._gd,t.overlaying);t.domain=a.domain}var i=e&&t._r?"_r":"range";t.cleanRange(i);var l=t.r2l(t[i][0]),s=t.r2l(t[i][1]);if("y"===r?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):s},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,n){return t.l2p(t.r2l(e,n))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=i,t.d2c=o.cleanNumber,"log"===t.type?(t.d2l=function(e,n){return t.c2l(t.d2c(e),n)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=o.cleanNumber,t.d2r=o.cleanNumber,t.r2d=i),t.r2l=i,t.l2r=i):"date"===t.type?(t.c2d=o.ms2DateTime,t.d2c=function(t){var e=o.dateTime2ms(t);if(e===s){if(!a(t))return s;e=Number(t)}return o.constrain(e,o.MIN_MS,o.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=o.identity,t.r2d=o.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var n=t._categories.indexOf(e);return n===-1?s:n},t.d2l=t.d2c,t.r2l=i,t.l2r=i,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;o0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var f=u.charAt(0),d=u.substr(1);d=r(d)?Number(d):0,(d<=0||!("date"===i&&"M"===f&&d===Math.round(d)||"log"===i&&"L"===f||"log"===i&&"D"===f&&(1===d||2===d)))&&(e.dtick=c)}var h="date"===i?"2000-01-01":0,p=n("tick0",h);"date"===i?e.tick0=a.cleanDate(p,h):r(p)&&"D1"!==u&&"D2"!==u?e.tick0=Number(p):e.tick0=h}else{var g=n("tickvals");void 0===g?e.tickmode="auto":n("ticktext")}}},{"../../constants/numerical":103,"../../lib":115,"fast-isnumeric":10}],160:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../lib"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,n,c){function u(t){var e,n,r,a,o,i={};for(e in t)if(n=e.split("."),r=n[0].match(s)){var l=r[1],c=l+"axis";if(a=y[c],o={},Array.isArray(t[e])?o.to=t[e].slice(0):Array.isArray(t[e].range)&&(o.to=t[e].range.slice(0)),!o.to)continue;o.axisName=c,o.length=a._length,x.push(l),i[l]=o}return i}function f(t,e,n){var r,a,o,i=t._plots,l=[];for(r in i){var s=i[r];if(l.indexOf(s)===-1){var c=s.xaxis._id,u=s.yaxis._id,f=s.xaxis.range,d=s.yaxis.range;s.xaxis._r=s.xaxis.range.slice(),s.yaxis._r=s.yaxis.range.slice(),a=n[c]?n[c].to:f,o=n[u]?n[u].to:d,f[0]===a[0]&&f[1]===a[1]&&d[0]===o[0]&&d[1]===o[1]||e.indexOf(c)===-1&&e.indexOf(u)===-1||l.push(s)}}return l}function d(e,n){function r(e,n){for(a=0;an.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var k;c&&(k=c());var M,A,T,L=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),M=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":115,"../../plotly":137,"../../registry":173,"./axes":142,d3:7}],161:[function(t,e,n){"use strict";function r(t,e,n){var r,a,o,i=!1;if("data"===e.type)r=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;r=t._fullLayout}return a=c.nestedProperty(r,e.prop).get(),o=n[e.type]=n[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var n=[],r=e[0],a={};if("string"==typeof r)a[r]=e[1];else{if(!c.isPlainObject(r))return n;a=r}return l(a,function(t,e,r){n.push({type:"layout",prop:t,value:r})},"",0),n}function i(t,e){var n,r,a,o,i=[];if(r=e[0],a=e[1],n=e[2],o={},"string"==typeof r)o[r]=a;else{if(!c.isPlainObject(r))return i;o=r,void 0===n&&(n=a)}return void 0===n&&(n=null),l(o,function(e,r,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);n&&(l=Math.min(l,n.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,r+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");n.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=n.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){r(t,s,i.cache),i.check=function(){if(l){var e=r(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),n._initialAutoSizeIsDone){var c=n.width,f=n.height;p.supplyLayoutGlobalDefaults(o,r),o.width||(r.width=c),o.height||(r.height=f)}else{p.supplyLayoutGlobalDefaults(o,r);var d=!o.width||!o.height,h=r.autosize,g=t._context&&t._context.autosizable,v=d&&(h||g);v?p.plotAutoSize(t,o,r):d&&p.sanitizeMargins(t),!h&&d&&(o.width=r.width,o.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=s.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,r),r._has=p._hasPlotType.bind(r);var m=r._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,v=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(g*(v.width-f)),a=Math.round(g*(v.height-h))}else{var m=s?window.getComputedStyle(t):{};r=parseFloat(m.width)||n.width,a=parseFloat(m.height)||n.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;r1,_=!e.height&&Math.abs(n.height-a)>1;(_||b)&&(b&&(n.width=r),_&&(n.height=a)),t._initialAutoSize||(t._initialAutoSize={width:r,height:a}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n,r){var a,o;u.Axes.supplyLayoutDefaults(t,e,n);var i=e._basePlotModules;for(a=0;a.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var v=s[t].t.val,m=s[t].t.size;if(v>d){var y=(h*v+(m-e.height)*d)/(v-d),x=(m*(1-d)+(h-e.height)*(1-v))/(v-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!t._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):d.isJSDate(t)?d.ms2DateTime(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var n,r,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(n=0;n0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(n)for(l=0;l=0,S=C?f.angularAxis.domain:r.extent(M),z=Math.abs(M[1]-M[0]);T&&!A&&(z=0);var O=S.slice();L&&A&&(O[1]+=z);var P=f.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),f.angularAxis.ticksStep&&(P=(O[1]-O[0])/P);var D=f.angularAxis.ticksStep||(O[1]-O[0])/(P*(f.minorTicks+1));k&&(D=Math.max(Math.round(D),1)),O[2]||(O[2]=D);var N=r.range.apply(this,O);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=r.scale.linear().domain(O.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?z:0,e=r.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var E="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(E,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=r.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,j=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},q={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=i.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});i.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},i.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],a.range([0,x]),u.layout.radialAxis.domain=a.domain(),F.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),j.attr("transform","translate("+_+")").style({cursor:"crosshair"});var X=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(X[0]=Math.max(0,X[0]),X[1]=Math.max(0,X[1]),e.select(".outer-group").attr("transform","translate("+X+")"),f.title){var U=e.select("g.title-group text").style(q).text(f.title),Z=U.node().getBBox();U.attr({x:_[0]-Z.width/2,y:_[1]-x-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=G.selectAll("circle.grid-circle").data(a.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(B),Y.attr("r",a),Y.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(B);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=r.svg.axis().scale(a).ticks(5).tickSize(5);G.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(B),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(q).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,q["font-size"]]+")":"translate("+[0,q["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),J=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),J.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(q);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?n<270&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(n<=180&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(q);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=r.max(j.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=a,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=r.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return o(i[n].defaultConfig(),t)});i[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=i.tooltipPanel().config({container:ct,fontSize:8})(),ft=i.tooltipPanel().config({container:ct,fontSize:8})(),dt=i.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});j.on("mousemove.angular-guide",function(t,e){var n=i.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=i.util.convertToCartesian(x+12,n+180);ut.text(i.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});j.on("mousemove.radial-guide",function(t,e){var n=i.util.getMousePos(W).radius;pt.attr({r:n}).style({opacity:.5}),lt=a.invert(i.util.getMousePos(W).radius);var r=i.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(i.util.round(lt)).move([r[0]+_[0],r[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var a=r.select(this),o=a.style("fill"),l="black",s=a.style("opacity")||1;if(a.attr({"data-opacity":s}),"none"!=o){a.attr({"data-fill":o}),l=r.hsl(o).darker().toString(),a.style({fill:l,opacity:1});var c={t:i.util.round(t[0]),r:i.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-X[0]-d.left,f.top+f.height/2-X[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else o=a.style("stroke"),a.attr({"data-stroke":o}),l=r.hsl(o).darker().toString(),a.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==r.event.which&&void(r.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=r.select(this),a=n.attr("data-fill");a?n.style({fill:a,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,a,l,s={data:[],layout:{}},c={},u={},f=r.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=i.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),o(s.data[e],i.Axis.defaultConfig().data[0]),o(s.data[e],t)}),o(s.layout,i.Axis.defaultConfig().layout),o(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},r.rebind(d,f,"on"),d},i.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:r.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},i.util={},i.DATAEXTENT="dataExtent",i.AREA="AreaChart",i.LINE="LinePlot",i.DOT="DotPlot",i.BAR="BarChart",i.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},i.util._extend=function(t,e){for(var n in t)e[n]=t[n]},i.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},i.util.dataFromEquation2=function(t,e){var n=e||6,a=r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return a},i.util.dataFromEquation=function(t,e,n){var a=e||6,o=[],i=[];r.range(0,360+a,a).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},i.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return r.range(e).map(function(t,e){return n[e]||n[0]})},i.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=i.util.ensureArray(t[e],n)}),t},i.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},i.util.validateKeys=function(t,e){ diff --git a/dist/plotly-cartesian.js b/dist/plotly-cartesian.js index b188759731b..40939a572c2 100644 --- a/dist/plotly-cartesian.js +++ b/dist/plotly-cartesian.js @@ -1,5 +1,5 @@ /** -* plotly.js (cartesian) v1.20.0 +* plotly.js (cartesian) v1.20.1 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -25393,7 +25393,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.20.0'; +exports.version = '1.20.1'; // inject promise polyfill require('es6-promise').polyfill(); @@ -34045,7 +34045,7 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { // if position is given as a category name, convert it to a number if(typeof pos === 'string' && (ax._categories || []).length) { newPos = ax._categories.indexOf(pos); - containerOut[attr] = (newPos !== -1) ? dflt : newPos; + containerOut[attr] = (newPos === -1) ? dflt : newPos; return; } } @@ -53346,40 +53346,6 @@ module.exports = { } }, - // 3D attributes commented out until I finish them in a later PR - // tilt: { - // // degrees to tilt the pie back from straight on - // valType: 'number', - // min: 0, - // max: 90, - // dflt: 0 - // }, - // tiltaxis: { - // // degrees away from straight up to tilt the pie - // // only has an effect if tilt is nonzero - // valType: 'number', - // min: -360, - // max: 360, - // dflt: 0 - // }, - // depth: { - // // "3D" size, as a fraction of radius - // // only has an effect if tilt is nonzero - // valType: 'number', - // min: 0, - // max: 10, - // dflt: 0.5 - // }, - // shading: { - // // how much darker to make the sides than the top, - // // with a 3D effect. We could of course get all - // // fancy with lighting effects, but maybe this is - // // sufficient. - // valType: 'number', - // min: 0, - // max: 1, - // dflt: 0.2 - // }, hole: { valType: 'number', diff --git a/dist/plotly-cartesian.min.js b/dist/plotly-cartesian.min.js index e53c5c1e6e5..f8ca801f2d4 100644 --- a/dist/plotly-cartesian.min.js +++ b/dist/plotly-cartesian.min.js @@ -1,5 +1,5 @@ /** -* plotly.js (cartesian - minified) v1.20.0 +* plotly.js (cartesian - minified) v1.20.1 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -14,10 +14,10 @@ O[0]=f[P],O[1]=d[N]}else ui.event.altKey&&(x=O.slice());M.style("pointer-events" r.getScale=t("./get_scale"),r.flipScale=t("./flip_scale"),r.extractScale=t("./extract_scale"),r.makeColorScaleFunc=t("./make_color_scale_func")},{"./attributes":35,"./calc":36,"./default_scale":38,"./defaults":39,"./extract_scale":40,"./flip_scale":41,"./get_scale":42,"./has_colorscale":43,"./is_valid_scale":45,"./make_color_scale_func":47,"./scales":48}],45:[function(t,e,r){"use strict";var n=t("./scales"),a=t("./is_valid_scale_array");e.exports=function(t){return void 0!==n[t]||a(t)}},{"./is_valid_scale_array":46,"./scales":48}],46:[function(t,e,r){"use strict";var n=t("tinycolor2");e.exports=function(t){var e=0;if(!Array.isArray(t)||t.length<2)return!1;if(!t[0]||!t[t.length-1])return!1;if(0!==+t[0][0]||1!==+t[t.length-1][0])return!1;for(var r=0;r4/3-l?i:l}},{}],50:[function(t,e,r){"use strict";var n=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,o){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:n.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":122}],51:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),h.dispatchEvent(r)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=n},{"../../lib":122,"../../plotly":144,"../../plots/cartesian/constants":154,"./align":49,"./cursor":50,"./unhover":52}],52:[function(t,e,r){"use strict";var n=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,r)},a.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":118}],53:[function(t,e,r){"use strict";function n(t,e,r,n,a,o,i){if(l.traceIs(r,"symbols")){var c=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(r)?c(t.ms):(o.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||o.symbol)||0,a=n%100;return t.om=n%200>=100,g.symbolFuncs[a](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=n(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,r,n){var a=t[0]-e[0],i=t[1]-e[1],l=r[0]-e[0],s=r[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*n,d=(u*u*i-c*c*s)*n,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,a){t.call(g.setPosition,e,r).call(g.setSize,n,a)},g.translatePoint=function(t,e,r,n){var a=t.xp||r.c2p(t.x),o=t.yp||n.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=r||o.width||0,l=a||o.dash||"";s.stroke(e,n||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=n||a.dash||"";o.select(this).call(s.stroke,r||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=o.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),r.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var a=r.marker,o=a.line,i=g.tryColorscale(a,""),l=g.tryColorscale(a,"line");n(t,e,r,i,l,a,o)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),a=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,o.select(this),e,n,a)})}},g.tryColorscale=function(t,e){var r=e?u.nestedProperty(t,e).get():t,n=r.colorscale,a=r.color;return n&&Array.isArray(a)?c.makeColorScaleFunc(c.extractScale(n,r.cmin,r.cmax)):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=o.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,r.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(n).call(f.convertToTspans);var d=o.select(this.parentNode),h=r.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,m=x[s]*u,v=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+m+","+v+")"),p>1&&h.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],o=[];for(r=1;r=A&&(o.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=o.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":112,"../../lib":122,"../../lib/svg_text_utils":134,"../../registry":188,"../../traces/scatter/make_bubble_size_func":286,"../../traces/scatter/subtypes":291,"../color":30,"../colorscale":44,"./symbol_defs":54,d3:14,"fast-isnumeric":17}],54:[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,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+r+a+o+a+o+i+o+i+r+i+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),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(2*t/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(2*t/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(2*t/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(.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),a=n.round(-t,2),o=n.round(t*-.309,2),i=n.round(.809*t,2);return"M"+e+","+o+"L"+r+","+i+"H-"+r+"L-"+e+","+o+"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(.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),a=n.round(.951*e,2),o=n.round(.363*e,2),i=n.round(.588*e,2),l=n.round(-e,2),s=n.round(e*-.309,2),c=n.round(.118*e,2),u=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+r+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),a=n.round(.76*t,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(.8*t,2),a=n.round(1.6*t,2),o=n.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+r+i+e+","+r+i+"0,-"+a+i+"-"+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),a=n.round(1.6*t,2),o=n.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+r+i+"-"+e+",-"+r+i+"0,"+a+i+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,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(1.4*t,2),r=n.round(1.9*t,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:14}],55:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],56:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e["error_"+n]||{},s=o.visible&&["linear","log"].indexOf(r.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var m=g.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=n(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");l=!m.size(),l?m=e.append("path").classed("yerror",!0):u&&(m=m.transition().duration(r.duration).ease(r.easing)),m.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var v=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-v)+"v"+2*v+"m0,-"+v+"H"+i.xs,i.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":291,d3:14,"fast-isnumeric":17}],61:[function(t,e,r){"use strict";var n=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},o=e.error_x||{},i=n.select(this);i.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),o.copy_ystyle&&(o=r),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":30,d3:14}],62:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":154}],63:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,l,r,n)}var i=n("source"),s=n("visible",!!i);if(!s)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var c={_fullLayout:r},u=["x","y"],f=0;f<2;f++)o.coerceRef(t,e,c,u[f],"paper");return e}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("../../plots/array_container_defaults"),l=t("./attributes"),s="images";e.exports=function(t,e){var r={name:s,handleItemDefaults:n};i(t,e,r)}},{"../../lib":122,"../../plots/array_container_defaults":146,"../../plots/cartesian/axes":149,"./attributes":62}],64:[function(t,e,r){"use strict";var n=t("d3"),a=t("../drawing"),o=t("../../plots/cartesian/axes"),i=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",i.svg);var a=new Promise(function(t){function n(){r.remove(),t()}var a=new Image;this.img=a,a.setAttribute("crossOrigin","anonymous"),a.onerror=n,a.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),a.src=e.source}.bind(this));t._promises.push(a)}}function r(e){var r=n.select(this),i=o.getFromId(t,e.xref),s=o.getFromId(t,e.yref),c=l._size,u=i?Math.abs(i.l2p(e.sizex)-i.l2p(0)):e.sizex*c.w,f=s?Math.abs(s.l2p(e.sizey)-s.l2p(0)):e.sizey*c.h,d=u*h.x[e.xanchor].offset,p=f*h.y[e.yanchor].offset,g=h.x[e.xanchor].sizing+h.y[e.yanchor].sizing,m=(i?i.r2p(e.x)+i._offset:e.x*c.w+c.l)+d,v=(s?s.r2p(e.y)+s._offset:c.h-e.y*c.h+c.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:m,y:v,width:u,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=i?i._id:"",x=s?s._id:"",b=y+x;b&&r.call(a.setClipUrl,"clip"+l._uid+b)}for(var l=t._fullLayout,s=[],c=[],u=[],f=0;f=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}},{}],67:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat; e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":119,"../../plots/font_attributes":169,"../color/attributes":29}],68:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],69:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,r){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":122,"../../plots/layout_attributes":171,"../../registry":188,"./attributes":67,"./helpers":72}],70:[function(t,e,r){"use strict";function n(t,e){function r(r){v.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(o,e)})}var n=t.data()[0][0],a=e._fullLayout,i=n.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?n.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var a,o=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=n.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(r)}function a(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=r.indexOf(f);d===-1?r.push(f):r.splice(d,1),u.relayout(e,"hiddenlabels",r)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;r=l*d,n=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}r=Math.max(r,16)+3,a.height=r,a.width=n}function i(t,e,r){var n=t._fullLayout,a=n.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.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,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),r.each(function(e){var r=e[0],n=c.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:a.width)+40,r.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;un.width-(n.margin.r+n.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+r,a.height=Math.max(a.height,e.height),x+=i+r,v=Math.max(e.height,v)}),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],n=c.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:a.width,r.height)})}}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var a="top";w.isBottomAnchor(r)?a="bottom":w.isMiddleAnchor(r)&&(a="middle"),d.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[a]||0),t:r.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),d.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),z.call(g.setRect,j,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){var v=r.legend,_=r.showlegend&&x(t.calcdata,v),k=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=r._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var z=M.selectAll("rect.scrollbar").data([0]);z.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var C=L.selectAll("g.groups").data(_);C.enter().append("g").attr("class","groups"),C.exit().remove();var S=C.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,C,S),l(t));var D=0,P=r.width,N=0,E=r.height;i(t,C,S),v.height>E?s(t):l(t);var I=r._size,R=I.l+I.w*v.x,F=I.t+I.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?F-=v.height:w.isMiddleAnchor(v)&&(F-=v.height/2);var j=v.width,q=I.w;j>q?(R=I.l,j=q):(R+j>P&&(R=P-j),RH?(F=I.t,B=H):(F+B>E&&(F=E-B),Fr[1])return r[1]}return a}function r(t){return t[0]}var n,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",r,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?n:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(n[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||n.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||r.color),e&&a.call(d.stroke,t.mlc||n.color)})}function i(t){var e=t[0].trace,r=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=s.select(this);n.style("stroke-width",r+"px").call(d.fill,t.fc||e.fillcolor),r&&n.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,r=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(n).each(a)}},{"../../lib":122,"../../registry":188,"../../traces/pie/style_one":269,"../../traces/scatter/subtypes":291,"../color":30,"../drawing":53,d3:14}],75:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),a=r.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===n){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),i(m,r);u&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),d&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!c&&!p||v||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):c?n(["hoverClosestCartesian","hoverCompareCartesian"]):h&&n(["hoverClosestPie"]),i(m,r)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=a(e,r,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",r.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":122,"../color":30,"./attributes":79,"./button_attributes":80,"./constants":81}],83:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,r,n){function a(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,C)},a=C.line.width?C.line.color:"rgba(0,0,0,0)",o=r.append("path").attr(n).style("opacity",C.opacity).call(_.stroke,a).call(_.fill,C.fillcolor).call(w.dashLine,C.line.dash,C.line.width);S&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+S),t._context.editable&&f(t,o,C,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof r&&r?s[r]=n:x.isPlainObject(r)&&(s=r);var c=Object.keys(s);for(o=0;oU&&n>G&&!t.shiftKey?k.getCursor(a/r,1-o/n):"move";M(e,i),X=i.split("-")[0]}function o(e){j=b.getFromId(t,r.xref),q=b.getFromId(t,r.yref),B=T.getDataToPixel(t,j),H=T.getDataToPixel(t,q,!0),V=T.getPixelToData(t,j),Z=T.getPixelToData(t,q,!0);var o="shapes["+n+"]";"path"===r.type?(R=r.path,F=o+".path"):(u=B(r.x0),f=H(r.y0),d=B(r.x1),h=H(r.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uG&&(c[C]=r[P]=Z(l),c[S]=r[N]=Z(s)),f-u>U&&(c[O]=r[E]=V(u),c[D]=r[I]=V(f))}e.attr("d",p(t,r))}var c,u,f,d,h,g,v,x,_,w,A,L,z,C,S,O,D,P,N,E,I,R,F,j,q,B,H,V,Z,X,U=10,G=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();k.init(Y)}function d(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),n}function h(t,e,r){var n=b.getFromId(t,r.id,"x")._id,a=b.getFromId(t,r.id,"y")._id,o="below"===e.layer,i=n===e.xref||a===e.yref,l=!!r.shapelayer;return o&&i&&l}function p(t,e){var r,n,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=T.shapePositionToRange(l),n=function(t){return l._offset+l.r2p(r(t,!0))}):n=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(n=T.decodeDate(n)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,n,o);var u=n(e.x0),f=n(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(A.segmentRE,function(t){var n=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[n]?t=e(t):i[n]&&(t=r(t)),n++,n>l&&(t="X"),t});return n>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,r){return t.replace(A.segmentRE,function(t){var n=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return n>=l?t:(o[n]?t=e(t):i[n]&&(t=r(t)),n++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),z=t("./defaults");e.exports={draw:n,drawOne:a}},{"../../lib":122,"../../lib/setcursor":132,"../../plotly":144,"../../plots/cartesian/axes":149,"../color":30,"../dragelement":51,"../drawing":53,"./constants":93,"./defaults":94,"./helpers":96,"./shape_defaults":98,"fast-isnumeric":17}],96:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var a,o=t._fullLayout._size;if(e){var i=r.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=r.decodeDate(a))}else a=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},r.getPixelToData=function(t,e,n){var a,o=t._fullLayout._size;if(e){var i=r.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=n?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],97:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":91,"./calc_autorange":92,"./defaults":94,"./draw":95}],98:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,r,l,s){function c(r,a){return n.coerce(t,e,o,r,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],m={_fullLayout:r},v=a.coerceRef(t,e,m,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==v?(y=a.getFromId(m,v),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=n.identity;var k=g+"0",M=g+"1",A=t[k],T=t[M];t[k]=x(t[k],!0),t[M]=x(t[M],!0),a.coercePosition(e,m,c,v,k,_),a.coercePosition(e,m,c,v,M,w),e[k]=b(e[k]),e[M]=b(e[M]),t[k]=A,t[M]=T}}return"path"===d?c("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":122,"../../plots/cartesian/axes":149,"./attributes":91,"./helpers":96}],99:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},n,{})},font:o({},n,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":119,"../../plots/animation_attributes":145,"../../plots/font_attributes":169,"../../plots/pad_attributes":172,"./constants":100}],100:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],101:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}var i=a(t,e),s=n("visible",i.length>0);if(s){n("active"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),o.coerceFont(n,"font",r.font);var c=n("currentvalue.visible");c&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),o.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function a(t,e){function r(t,e){return o.coerce(n,a,u,t,e)}for(var n,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+C.stepInset+(t.inputAreaLength-2*C.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-C.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*C.stepInset-2*t.inputAreaStart)))}function x(t,e,r){var n=t.selectAll("rect."+C.railTouchRectClass).data([0]);n.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,C.tickOffset+r.ticklen+r.labelHeight)}).call(A.fill,r.bgcolor).attr("opacity",0),M.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+C.railRectClass).data([0]);r.enter().append("rect").classed(C.railRectClass,!0);var n=e.inputAreaLength-2*C.railInset;r.attr({width:n,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(r,C.railInset,.5*(e.inputAreaWidth-C.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(l.enter().append("g").classed(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==r.length){var s=l.selectAll("g."+C.groupClassName).data(r,a);s.enter().append("g").classed(C.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,C.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,z=!0,C=O,k._infolayer.select("."+e).attr({"data-unformatted":C}).text(C).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,m=r.propName,v=r.traceIndex,y=r.dfltName,x=r.avoid||{},b=r.attributes,_=r.transform,w=r.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,z=!1,C=g.title.trim();""===C&&(L=0),C.match(/Click to enter .+ title/)&&(L=.2,z=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var S=w.selectAll("text").data([0]);S.enter().append("text"),S.text(C).attr("class",e),S.attr({"data-unformatted":C}).call(f);var O="Click to enter "+y+" title";t._context.editable?(C||p(),S.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):C&&!C.match(/Click to enter .+ title/)||S.remove(),S.classed("js-placeholder",z)}},{"../../lib":122,"../../lib/svg_text_utils":134,"../../plotly":144,"../../plots/plots":173,"../color":30,"../drawing":53,d3:14,"fast-isnumeric":17}],105:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":119,"../../plots/font_attributes":169,"../../plots/pad_attributes":172,"../color/attributes":29}],106:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],107:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}var i=a(t,e),s=n("visible",i.length>0);s&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),o.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function a(t,e){function r(t,e){return o.coerce(n,a,u,t,e)}for(var n,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==r.length){var u=c.selectAll("g."+T.headerGroupClassName).data(r,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],112:[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}},{}],113:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":28,"./components/images":65,"./components/legend":73,"./components/rangeselector":85,"./components/rangeslider":90,"./components/shapes":97,"./components/sliders":103,"./components/updatemenus":109,"./fonts/mathjax_config":114,"./lib/queue":130,"./plot_api/plot_schema":138,"./plot_api/register":139,"./plot_api/set_plot_config":140,"./plot_api/to_image":142,"./plot_api/validate":143,"./plotly":144,"./snapshot":193,"./snapshot/download":190,"./traces/scatter":281,d3:14,"es6-promise":15}],114:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],115:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),n(t)?Number(t):a}},{"../constants/numerical":110,"fast-isnumeric":17}],116:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,a){!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){t%1||!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;n.strict!==!0&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(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)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!l.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,n,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var m=(new Date).getFullYear();e=((Number(c[0])-m+70)%100+200)%100+m-70}if(!o(e))return s;var v=new Date(0,0,1);if(v.setFullYear(u?e:-e),c.length>1){if(n=Number(c[1])-1,c[1].length>2||!(n>=0&&n<=11))return s;if(v.setMonth(n),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(v.setDate(a),v.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(v.setHours(i),v.getHours()!==i)return s;if(c.length>1)return a=v.getTime(),n=Number(c[1]),2===c[1].length&&n>=0&&n<=59?(a+=f*n,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return v.getTime()},h=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==s};var g=90*c,m=3*u,v=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var r=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(r),i=er?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},a.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},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,r))/Math.log(n),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,r/a))/Math.log(n)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,r)?t(e,r,n):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[n];u[r]=o}return u},a.syncOrAsync=function(t,e,r){function n(){return a.syncOrAsync(t,e,r)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(n).then(void 0,a.promiseError);return r&&r(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,r){if(t){var n,a,o=!1,i=!0;for(n=0;n0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+C.stepInset+(t.inputAreaLength-2*C.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-C.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*C.stepInset-2*t.inputAreaStart)))}function x(t,e,r){var n=t.selectAll("rect."+C.railTouchRectClass).data([0]);n.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,C.tickOffset+r.ticklen+r.labelHeight)}).call(A.fill,r.bgcolor).attr("opacity",0),M.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+C.railRectClass).data([0]);r.enter().append("rect").classed(C.railRectClass,!0);var n=e.inputAreaLength-2*C.railInset;r.attr({width:n,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(r,C.railInset,.5*(e.inputAreaWidth-C.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(l.enter().append("g").classed(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==r.length){var s=l.selectAll("g."+C.groupClassName).data(r,a);s.enter().append("g").classed(C.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,C.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,z=!0,C=O,k._infolayer.select("."+e).attr({"data-unformatted":C}).text(C).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,m=r.propName,v=r.traceIndex,y=r.dfltName,x=r.avoid||{},b=r.attributes,_=r.transform,w=r.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,z=!1,C=g.title.trim();""===C&&(L=0),C.match(/Click to enter .+ title/)&&(L=.2,z=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var S=w.selectAll("text").data([0]);S.enter().append("text"),S.text(C).attr("class",e),S.attr({"data-unformatted":C}).call(f);var O="Click to enter "+y+" title";t._context.editable?(C||p(),S.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):C&&!C.match(/Click to enter .+ title/)||S.remove(),S.classed("js-placeholder",z)}},{"../../lib":122,"../../lib/svg_text_utils":134,"../../plotly":144,"../../plots/plots":173,"../color":30,"../drawing":53,d3:14,"fast-isnumeric":17}],105:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":119,"../../plots/font_attributes":169,"../../plots/pad_attributes":172,"../color/attributes":29}],106:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],107:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}var i=a(t,e),s=n("visible",i.length>0);s&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),o.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function a(t,e){function r(t,e){return o.coerce(n,a,u,t,e)}for(var n,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==r.length){var u=c.selectAll("g."+T.headerGroupClassName).data(r,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],112:[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}},{}],113:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":28,"./components/images":65,"./components/legend":73,"./components/rangeselector":85,"./components/rangeslider":90,"./components/shapes":97,"./components/sliders":103,"./components/updatemenus":109,"./fonts/mathjax_config":114,"./lib/queue":130,"./plot_api/plot_schema":138,"./plot_api/register":139,"./plot_api/set_plot_config":140,"./plot_api/to_image":142,"./plot_api/validate":143,"./plotly":144,"./snapshot":193,"./snapshot/download":190,"./traces/scatter":281,d3:14,"es6-promise":15}],114:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],115:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),n(t)?Number(t):a}},{"../constants/numerical":110,"fast-isnumeric":17}],116:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,a){!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){t%1||!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;n.strict!==!0&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(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)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!l.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,n,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var m=(new Date).getFullYear();e=((Number(c[0])-m+70)%100+200)%100+m-70}if(!o(e))return s;var v=new Date(0,0,1);if(v.setFullYear(u?e:-e),c.length>1){if(n=Number(c[1])-1,c[1].length>2||!(n>=0&&n<=11))return s;if(v.setMonth(n),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(v.setDate(a),v.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(v.setHours(i),v.getHours()!==i)return s;if(c.length>1)return a=v.getTime(),n=Number(c[1]),2===c[1].length&&n>=0&&n<=59?(a+=f*n,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return v.getTime()},h=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==s};var g=90*c,m=3*u,v=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var r=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(r),i=er?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},a.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},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,r))/Math.log(n),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,r/a))/Math.log(n)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,r)?t(e,r,n):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[n];u[r]=o}return u},a.syncOrAsync=function(t,e,r){function n(){return a.syncOrAsync(t,e,r)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(n).then(void 0,a.promiseError);return r&&r(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,r){if(t){var n,a,o=!1,i=!0;for(n=0;n1?a+i[1]:"";if(o&&(i.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+o+"$2");return l+s}},{"./clean_number":115,"./coerce":116,"./dates":117,"./extend":119,"./filter_unique":120,"./filter_visible":121,"./is_array":123,"./is_plain_object":124,"./loggers":125,"./matrix":126,"./nested_property":127,"./notifier":128,"./search":131,"./stats":133,d3:14}],123:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],124:[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}},{}],125:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],i=!1,d(n))for(r=n.length-1;r>=0;r--)c(n[r])?i?n[r]=void 0:n.pop():i=!0;else if("object"==typeof n&&null!==n)for(o=Object.keys(n),i=!1,r=o.length-1;r>=0;r--)c(n[o[r]])&&!a(n[o[r]],o[r])?delete n[o[r]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,a,i,l=0,s=e.split(".");lo||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],s=t[1];if(ro||sl)return!1;var c,u,f,d,h,p=n.length,g=n[0][0],m=n[0][1],v=0;for(c=1;cMath.max(u,g)||s>Math.max(f,m)))if(su||Math.abs(n(i,d))>a)return!0;return!1};a.filter=function(t,e){function r(r){t.push(r);var l=n.length,s=a;n.splice(i+1);for(var c=s+1;c1){var l=t.pop();r(l)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":126}],130:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");r.findBin=function(t,e,r){if(l(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?r?n:a:r?i:o;f90&&s.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,a=e[n]-e[0]||1,o=a/(n||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},r.roundUp=function(t,e,r){for(var n,a=0,o=e.length-1,i=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":17}],134:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,r){var n="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),r();else{var n=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,n)}o.remove()})}function i(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),a=g[n];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,m.indexOf(u.protocol)===-1?"":''}if("br"===n)return"
";if(o)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))n.push(a);var o=0;n.forEach(function(t){for(var r=t+o,n=e.slice(0,r),a="",i=n.length-1;i>=0;i--){var l=n[i].match(/<(\/?).*>/i);if(l&&"
"!==n[i]){l[1]||(a=n[i]);break}}a&&(e.splice(r+1,0,a),e.splice(r,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,r){var n,a,o,i=r.horizontalAlign,l=r.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-n.height}:"middle"===l?function(){return s.top+(s.height-n.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-n.width}:"center"===i?function(){return s.left+(s.width-n.width)/2}:function(){return s.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(d.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return r(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=n(s,"width"),d=n(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||n(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(v," ")},r.makeEditable=function(t,e,r){function n(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:r.fill||i.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||i.attr("data-unformatted")).call(u(i,e,r)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}r||(r={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),r.immediate?n():c.on("click",n),f.rebind(this,l,"on")}},{"../constants/string_mappings":111,"../constants/xmlns_namespaces":112,"../lib":122,d3:14}],135:[function(t,e,r){"use strict";function n(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=f.cleanId(r,n))}function a(t){var e="middle",r="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?r="left":t.indexOf("right")!==-1&&(r="right"),e+" "+r}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.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);var a=f.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=u.getSubplotIds(t,"gl3d");for(e=0;e=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 s(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&l(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&sO.range[0]?[1,2]:[2,1]);else{var D=O.range[0],P=O.range[1];"log"===b?(D<=0&&P<=0&&r(L+".autorange",!0),D<=0?D=P/1e6:P<=0&&(P=D/1e6),r(L+".range[0]",Math.log(D)/Math.LN10),r(L+".range[1]",Math.log(P)/Math.LN10)):(r(L+".range[0]",Math.pow(10,D)),r(L+".range[1]",Math.pow(10,P)))}else r(L+".autorange",!0)}if("reverse"===A)z.range?z.range.reverse():(r(L+".autorange",!0),z.range=[1,0]),C.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var N=v.parts[1],E=v.parts[0],I=o[E]||[],R=I[N]||{};2===v.parts.length&&(null===b&&(e[m]="remove"),"add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?N===-1?(g[E]=I,delete g[m]):g[m]=R:x.log("???",e)),!n(R,"x")&&!n(R,"y")||x.containsAny(m,["color","opacity","align","dash"])||(h.docalc=!0);var F=w.getComponentMethod(E,"drawOne");F(t,N,v.parts.slice(2).join("."),e[m]),delete e[m]}else if(k.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])S.manageArrayContainers(v,b,g),h.doplot=!0;else{var j=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?h.doplot=!0:0===v.parts[0].indexOf("geo")?h.doplot=!0:0===v.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===m?h.doplot=!0:!i._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?h.docalc=!0:v.parts[0].indexOf("legend")!==-1?h.dolegend=!0:m.indexOf("title")!==-1?h.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(j,["tick","exponent","grid","zeroline"])?h.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:v.parts.length>1&&j.indexOf("line")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&"mirror"===j?h.doticks=h.dolayoutstyle=!0:"margin.pad"===m?h.doticks=h.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(h.doplot=!0):h.doplot=!0,v.set(b)}}}var q=t._fullLayout.width,B=t._fullLayout.height;k.supplyDefaults(t),t.layout.autosize&&k.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==q||t._fullLayout.height!==B;return H&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];m.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=x.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(z.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var a=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=a.append("g").classed("imagelayer",!0),r._shapeLowerLayer=a.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var o=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=o.append("g").classed("imagelayer",!0),r._shapeUpperLayer=o.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),k=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),z=t("../constants/xmlns_namespaces"),C=t("../lib/svg_text_utils"),S=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,r,n){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=D._basePlotModules,r=0;r=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=S.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),r=k.supplyAnimationDefaults(r);var l=r.transition,s=r.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){if(0!==i._frameQueue.length){for(;i._frameQueue.length;){var e=i._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var l=0;li._timeToNext&&h()};e()}function g(t){return Array.isArray(l)?y>=l.length?t.transitionOpts=l[y]:t.transitionOpts=l[0]:t.transitionOpts=l,y++,t}var m,v,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&x.isPlainObject(e);if(M)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&LL)&&z.push(v);b=z}}b.length>0?f(b):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,r){if(t=S.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(n=e.length-1;n>=0;n--)u.push({frame:k.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:c+n});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(a=u[n].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;r--)n=e[r],o.push({type:"delete",index:n}),i.unshift({type:"insert",index:n,value:a[n]});var l=k.modifyFrames,s=k.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),k.modifyFrames(t,o)},y.purge=function(t){t=S.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return k.cleanPlot([],{},r,e),k.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":53,"../components/errorbars":59,"../constants/xmlns_namespaces":112,"../lib":122,"../lib/events":118,"../lib/queue":130,"../lib/svg_text_utils":134,"../plotly":144,"../plots/cartesian/graph_interact":156,"../plots/plots":173,"../plots/polar":176,"../registry":188,"./helpers":135,"./subroutines":141,d3:14,"fast-isnumeric":17}],137:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],138:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=d.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var a={meta:e.meta||{},attributes:i(n)};if(e.layoutAttributes){var o={};_(o,e.layoutAttributes),a.layoutAttributes=i(o)}return a}function a(){var t={};return _(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var r=d.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)u(t,r,"xaxis"),u(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;u(t,r,n)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){f(t,r,e+r.name)}):f(t,r,r.name))}),{layoutAttributes:i(t)}}function o(t){var e=d.transformsRegistry[t];return{attributes:i(e.attributes)}}function i(t){return l(t),s(t),t}function l(t){function e(t){return{valType:"string"}}function n(t,n,a){r.isValObject(t)?"data_array"===t.valType?(t.role="data",a[n+"src"]=e(n)):t.arrayOk===!0&&(a[n+"src"]=e(n)):h.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function s(t){function e(t,e,r){if(t){var n=t[k];n&&(delete t[k],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function c(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function u(t,e,r){var n=h.nestedProperty(t,r),a=_({},e.layoutAttributes);a[w]=!0,n.set(a)}function f(t,e,r){var n=h.nestedProperty(t,r),a=_(n.get()||{},e.layoutAttributes);n.set(a)}var d=t("../registry"),h=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=h.extendFlat,_=h.extendDeep,w="_isSubplotObj",k="_isLinkedToArray",M="_deprecated",A=[w,k,M];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=k,r.DEPRECATED=M,r.UNDERSCORE_ATTRS=A,r.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:h.valObjects,metaKeys:A.concat.role},traces:t,layout:a(),transforms:e,frames:i(m),animation:i(v)}},r.crawl=function(t,e,n){var a=n||0;Object.keys(t).forEach(function(n){var o=t[n];A.indexOf(n)===-1&&(e(o,n,t,a),r.isValObject(o)||h.isPlainObject(o)&&r.crawl(o,e,a+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,i,l){o=o.slice(0,l).concat([r]);var s="data_array"===e.valType||e.arrayOk===!0;if(s){var c=n(o),u=h.nestedProperty(t,c).get();Array.isArray(u)&&a.push(c)}}function n(t){return t.join(".")}var a=[],o=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l1)};d(e.width)&&d(e.height)||n(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=n},{"../lib":122,"../plotly":144,"../snapshot/cloneplot":189,"../snapshot/helpers":192,"../snapshot/svgtoimg":194,"../snapshot/tosvg":196,"fast-isnumeric":17}],143:[function(t,e,r){"use strict";function n(t,e,r,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=r.length,v=0;vu&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=S&&a<=10||e>=15*S)t._tickround="d";else if(e>=D&&a<=16||e>=O)t._tickround="M";else if(e>=P&&a<=19||e>=D)t._tickround="S";else{var o=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var r=t.match(Y),n=new Date(e);if(r){var a=Math.min(+r[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(n)}return y.time.format(t)(n)}function l(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function s(t,e,r,n){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);r&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(n&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(r||(a="
"+H(u)),o=Z(u)):(r||(a="
"+X(u)),o=U(u),"M"!==s?(o+=G(u),"S"!==s&&(o+=d(y.round(v(l/1e3,1),4),t,"none",r).substr(1))):"d"===c&&(o=Z(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,r,n,a){var o=t.dtick,i=e.x;if(!n||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,n);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,n)}function d(t,e,r,n){var a=t<0,i=e._tickround,l=r||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var r,n,a=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.getAutoRange=function(t){var e,r=[],n=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(n===a){var g=n-1,m=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),r=[s.val-d*s.pad,c.val+d*c.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),h&&r.reverse(),r.map(t.l2r||Number)},N.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=N.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},N.saveRangeInitial=function(t,e){for(var r=N.list(t,"",!0),n=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(n(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),k=n(r.vpadminus||r.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},N.autoBin=function(t,e,r,n){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(r)l=(i-o)/r;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},N.autoTicks(f,l);var d,h=N.tickIncrement(N.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=N.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=N.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fz?(e/=z,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,r,I)):n>C?(e/=C,t.dtick="M"+a(e,1,R)):n>S?(t.dtick=a(e,S,j),t.tick0="2000-01-02"):n>O?t.dtick=a(e,O,R):n>D?t.dtick=a(e,D,F):n>P?t.dtick=a(e,P,F):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,r,I))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,r,I)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,r,I));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},N.tickIncrement=function(t,e,r){var n=r?-1:1;if(x(e))return t+n*e;var a=e.charAt(0),o=n*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?B:q,s=t+.01*n,c=_.roundUp(v(s,1),l,r);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]o:f1&&e1)};d(e.width)&&d(e.height)||n(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=n},{"../lib":122,"../plotly":144,"../snapshot/cloneplot":189,"../snapshot/helpers":192,"../snapshot/svgtoimg":194,"../snapshot/tosvg":196,"fast-isnumeric":17}],143:[function(t,e,r){"use strict";function n(t,e,r,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=r.length,v=0;vu&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=S&&a<=10||e>=15*S)t._tickround="d";else if(e>=D&&a<=16||e>=O)t._tickround="M";else if(e>=P&&a<=19||e>=D)t._tickround="S";else{var o=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var r=t.match(Y),n=new Date(e);if(r){var a=Math.min(+r[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(n)}return y.time.format(t)(n)}function l(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function s(t,e,r,n){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);r&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(n&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(r||(a="
"+H(u)),o=Z(u)):(r||(a="
"+X(u)),o=U(u),"M"!==s?(o+=G(u),"S"!==s&&(o+=d(y.round(v(l/1e3,1),4),t,"none",r).substr(1))):"d"===c&&(o=Z(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,r,n,a){var o=t.dtick,i=e.x;if(!n||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,n);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,n)}function d(t,e,r,n){var a=t<0,i=e._tickround,l=r||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var r,n,a=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.getAutoRange=function(t){var e,r=[],n=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(n===a){var g=n-1,m=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),r=[s.val-d*s.pad,c.val+d*c.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),h&&r.reverse(),r.map(t.l2r||Number)},N.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=N.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},N.saveRangeInitial=function(t,e){for(var r=N.list(t,"",!0),n=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(n(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),k=n(r.vpadminus||r.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},N.autoBin=function(t,e,r,n){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(r)l=(i-o)/r;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},N.autoTicks(f,l);var d,h=N.tickIncrement(N.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=N.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=N.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fz?(e/=z,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,r,I)):n>C?(e/=C,t.dtick="M"+a(e,1,R)):n>S?(t.dtick=a(e,S,j),t.tick0="2000-01-02"):n>O?t.dtick=a(e,O,R):n>D?t.dtick=a(e,D,F):n>P?t.dtick=a(e,P,F):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,r,I))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,r,I)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,r,I));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},N.tickIncrement=function(t,e,r){var n=r?-1:1;if(x(e))return t+n*e;var a=e.charAt(0),o=n*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?B:q,s=t+.01*n,c=_.roundUp(v(s,1),l,r);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]o:f1&&e2*n}function o(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,a=0,o=0;o2*n}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("../../constants/numerical").BADNUM;e.exports=function(t){return a(t)?"date":o(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":110,"../../lib":122,"fast-isnumeric":17}],151:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var l=i(e,r,n);if(l){if("histogram"===l.type&&n==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,n)){for(var s,u=a(l),f=[],d=0;d0;o&&(n="array");var i=r("categoryorder",n);"array"===i&&r("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],154:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],155:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],a=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(r)+"g")(n))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,r,l,_,w,k,M){function A(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+mt+")").attr("d",ct+"Z"),ht=pt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+mt+")").attr("d","M0,0Z"),z()}function z(){pt.selectAll(".select-outline").remove()}function C(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(V,e+ot)),a=Math.max(0,Math.min(Z,r+it)),o=Math.abs(n-ot),i=Math.abs(a-it),l=Math.floor(Math.min(i,o,U)/2);lt.l=Math.min(ot,n),lt.r=Math.max(ot,n),lt.t=Math.min(it,a),lt.b=Math.max(it,a),!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function S(t,e,r){var n,a,o;for(n=0;nzoom back out","long"),b=!1)))}function D(e,r){var a=1===(k+M).length;if(e)R();else if(2!==r||a){if(1===r&&a){var o=k?H[0]:B[0],i="s"===k||"w"===M?0:1,l=o._name+".range["+i+"]",s=n(o,i),u="left",f="middle";if(o.fixedrange)return;k?(f="n"===k?"top":"bottom","right"===o.side&&(u="right")):"e"===M&&(u="right"),rt.call(d.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var r=o.d2r(e);void 0!==r&&c.relayout(t,l,r)})}}else I()}function P(e){function r(t,e,r){function n(e){return t.l2r(o+(e-o)*r)}if(!t.fixedrange){var a=t.range.map(t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(n)}}if(t._context.scrollZoom||j._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=vt[0]+vt[2]*s,u=(l.bottom-e.clientY)/l.height,d=vt[1]+vt[3]*(1-u);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,r){for(var n,o,i=1-e,l=0;l0;n--)r.push(e);return r}function a(t,e){for(var r=[],n=0;nY.width||G<0||G>Y.height)return _.unhoverRaw(t,e)}else U="xpx"in e?e.xpx:M[0]._length/2,G="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?n(o,e.xval):a(M,U),D="yval"in e?n(o,e.yval):a(A,G),!g(O[0])||!g(D[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(N=0;N1||I.hoverinfo.indexOf("name")!==-1?I.name:void 0,index:!1,distance:Math.min(W,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[R]&&(H.subplot=i[R]._subplot),V=Z.length,"array"===j){var Q=e[N];"pointNumber"in Q?(H.index=Q.pointNumber,j="closest"):(j="","xval"in Q&&(q=Q.xval,j="x"),"yval"in Q&&(B=Q.yval,j=j?"closest":"y"))}else q=O[F],B=D[F];if(I._module&&I._module.hoverPoints){var $=I._module.hoverPoints(H,q,B,j);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&Z.push(s(J,S))}else m.log("Unrecognized trace type in hover:",I);"closest"===S&&Z.length>V&&(Z.splice(0,V),W=Z[0].distance)}if(0===Z.length)return _.unhoverRaw(t,e);var tt="y"===S&&X.length>1;Z.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),rt={hovermode:S,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},nt=c(Z,rt);u(Z,tt?"xa":"ya"),f(nt,tt);var at=t._hoverdata,ot=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,r=u.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?n=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),m=0;r&&r!==n?(d.style("fill",s).text(r).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),m=d.node().getBoundingClientRect().width+2*P):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var v,k,T=f.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,C=t.ya._offset+(t.y0+t.y1)/2,S=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),N=T.width+D+P+m;t.ty0=_-T.top,t.bx=T.width+2*P,t.by=T.height+2*P,t.anchor="start",t.txwidth=T.width,t.tx2width=m,t.offset=0,o?(t.pos=z,v=C+O/2+N<=M,k=C-O/2-N>=0,"top"!==t.idealAlign&&v||!k?v?(C+=O/2,t.anchor="start"):t.anchor="middle":(C-=O/2,t.anchor="end")):(t.pos=C,v=z+S/2+N<=w,k=z-S/2-N>=0,"left"!==t.idealAlign&&v||!k?v?(z+=S/2,t.anchor="start"):t.anchor="middle":(z-=S/2,t.anchor="end")),f.attr("text-anchor",t.anchor),m&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+C+")"+(o?"rotate("+L+")":""))}),C}function u(t,e){function r(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=r.pos+r.dp+r.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;n=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;n=!1}if(n){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var n,a,o,i,l,s,c,u=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?C:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&u<=t.length;){for(u++,n=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;n=!1}else i++}f.forEach(r)}for(i=f.length-1;i>=0;i--){var m=f[i];for(l=m.length-1;l>=0;l--){var v=m[l],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var r=h.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,a=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(D+P),l=i+o*(t.txwidth+P),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-O,s=t.offset*S),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*D+s)+","+(D+c)+"v"+(t.by/2-D)+"h"+n*t.bx+"v-"+t.by+"H"+(n*D+s)+"V"+(c-D)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(b.setPosition,l+o*P+s,c+t.ty0-t.by/2+P),r.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],o=t._hoverdata[n];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return m.coerce(t,e,A,r,n)}n("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=T.isHoriz(r);a=o?"y":"x"}else a="closest";n("hovermode",a)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+k.HOVERMINTIME?(i(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||o(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":122,"fast-isnumeric":17}],162:[function(t,e,r){"use strict";function n(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,r,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-m.left,b=r-m.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(n),L=a.yaxes.map(n),z=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var C=g.selectAll("path.select-outline").data([1,2]);C.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",k+"Z");var S,O,D,P,N,E=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,F=[];for(S=0;S0)return Math.log(e)/Math.LN10;if(e<=0&&r&&t.range&&2===t.range.length){var n=t.range[0],a=t.range[1];return.5*(n+a-3*f*Math.abs(n-a))}return s}function r(t){return Math.pow(10,t)}function i(t){return a(t)?(t=Number(t),t<-l||t>l?s:a(t)?Number(t):s):s}var f=10;t.c2l="log"===t.type?e:i,t.l2c="log"===t.type?r:i,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,i=t[e],s=(t._id||"x").charAt(0);if(n="date"===t.type?c.DFLTRANGEDATE:"y"===s?c.DFLTRANGEY:c.DFLTRANGEX,n=n.slice(),!i||2!==i.length)return void(t[e]=n);for("date"===t.type&&(i[0]=o.cleanDate(i[0]),i[1]=o.cleanDate(i[1])),r=0;r<2;r++)if("date"===t.type){if(!o.isDateTime(i[r])){t[e]=n;break}if(i[r]o.MAX_MS&&(i[r]=o.MAX_MS),t.r2l(i[0])===t.r2l(i[1])){var u=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(u-1e3),i[1]=t.l2r(u+1e3);break}}else{if(!a(i[r])){if(!a(i[1-r])){t[e]=n;break}i[r]=i[1-r]*(r?10:.1)}if(i[r]<-l?i[r]=-l:i[r]>l&&(i[r]=l),i[0]===i[1]){var f=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=f,i[1]+=f}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var a=u.getFromId(t._gd,t.overlaying);t.domain=a.domain}var i=e&&t._r?"_r":"range";t.cleanRange(i);var l=t.r2l(t[i][0]),s=t.r2l(t[i][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?n.round(t._b+t._m*e,2):s},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=i,t.d2c=o.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=o.cleanNumber,t.d2r=o.cleanNumber,t.r2d=i),t.r2l=i,t.l2r=i):"date"===t.type?(t.c2d=o.ms2DateTime,t.d2c=function(t){var e=o.dateTime2ms(t);if(e===s){if(!a(t))return s;e=Number(t)}return o.constrain(e,o.MIN_MS,o.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=o.identity,t.r2d=o.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?s:r},t.d2l=t.d2c,t.r2l=i,t.l2r=i,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,a,o;if(r in e)for(n=e[r],a=new Array(n.length),o=0;o0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var f=u.charAt(0),d=u.substr(1);d=n(d)?Number(d):0,(d<=0||!("date"===i&&"M"===f&&d===Math.round(d)||"log"===i&&"L"===f||"log"===i&&"D"===f&&(1===d||2===d)))&&(e.dtick=c)}var h="date"===i?"2000-01-01":0,p=r("tick0",h);"date"===i?e.tick0=a.cleanDate(p,h):n(p)&&"D1"!==u&&"D2"!==u?e.tick0=Number(p):e.tick0=h}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":110,"../../lib":122,"fast-isnumeric":17}],167:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../lib"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,c){function u(t){var e,r,n,a,o,i={};for(e in t)if(r=e.split("."),n=r[0].match(s)){var l=n[1],c=l+"axis";if(a=y[c],o={},Array.isArray(t[e])?o.to=t[e].slice(0):Array.isArray(t[e].range)&&(o.to=t[e].range.slice(0)),!o.to)continue;o.axisName=c,o.length=a._length,x.push(l),i[l]=o}return i}function f(t,e,r){var n,a,o,i=t._plots,l=[];for(n in i){var s=i[n];if(l.indexOf(s)===-1){var c=s.xaxis._id,u=s.yaxis._id,f=s.xaxis.range,d=s.yaxis.range;s.xaxis._r=s.xaxis.range.slice(),s.yaxis._r=s.yaxis.range.slice(),a=r[c]?r[c].to:f,o=r[u]?r[u].to:d,f[0]===a[0]&&f[1]===a[1]&&d[0]===o[0]&&d[1]===o[1]||e.indexOf(c)===-1&&e.indexOf(u)===-1||l.push(s)}}return l}function d(e,r){function n(e,r){for(a=0;ar.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var k;c&&(k=c());var M,A,T,L=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),M=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":122,"../../plotly":144,"../../registry":188,"./axes":149,d3:14}],168:[function(t,e,r){"use strict";function n(t,e,r){var n,a,o,i=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return a=c.nestedProperty(n,e.prop).get(),o=r[e.type]=r[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var r=[],n=e[0],a={};if("string"==typeof n)a[n]=e[1];else{if(!c.isPlainObject(n))return r;a=n}return l(a,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function i(t,e){var r,n,a,o,i=[];if(n=e[0],a=e[1],r=e[2],o={},"string"==typeof n)o[n]=a;else{if(!c.isPlainObject(n))return i;o=n,void 0===r&&(r=a)}return void 0===r&&(r=null),l(o,function(e,n,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);r&&(l=Math.min(l,r.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,n+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");r.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=r.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){n(t,s,i.cache),i.check=function(){if(l){var e=n(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),r.attr(o);var i=r.select(".js-link-to-tool"),l=r.select(".js-link-spacer"),c=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=s.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=n.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var c=r.width,f=r.height;p.supplyLayoutGlobalDefaults(o,n),o.width||(n.width=c),o.height||(n.height=f)}else{p.supplyLayoutGlobalDefaults(o,n);var d=!o.width||!o.height,h=n.autosize,g=t._context&&t._context.autosizable,m=d&&(h||g);m?p.plotAutoSize(t,o,n):d&&p.sanitizeMargins(t),!h&&d&&(o.width=n.width,o.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=s.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,n),n._has=p._hasPlotType.bind(n);var v=n._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,m=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(m.width-f)),a=Math.round(g*(m.height-h))}else{var v=s?window.getComputedStyle(t):{};n=parseFloat(v.width)||r.width,a=parseFloat(v.height)||r.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-a)>1;(_||b)&&(b&&(r.width=n),_&&(r.height=a)),t._initialAutoSize||(t._initialAutoSize={width:n,height:a}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var a,o;u.Axes.supplyLayoutDefaults(t,e,r);var i=e._basePlotModules;for(a=0;a.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+a},r:{val:r.x,size:r.r+a},b:{val:r.y,size:r.b+a},t:{val:r.y,size:r.t+a}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var r=s[t].l||{},n=s[t].b||{},u=r.val,f=r.size,d=n.val,h=n.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var r=s[t].r.val,n=s[t].r.size;if(r>u){var p=(f*r+(n-e.width)*u)/(r-u),g=(n*(1-u)+(f-e.width)*(1-r))/(r-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var m=s[t].t.val,v=s[t].t.size;if(m>d){var y=(h*m+(v-e.height)*d)/(m-d),x=(v*(1-d)+(h-e.height)*(1-m))/(m-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),r.l=Math.round(a),r.r=Math.round(o),r.t=Math.round(i),r.b=Math.round(l),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,r,n,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,n,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):d.isJSDate(t)?d.ms2DateTime(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===n?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var r,n,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(r=0;r0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(r)for(l=0;l=0,C=z?f.angularAxis.domain:n.extent(M),S=Math.abs(M[1]-M[0]);T&&!A&&(S=0);var O=C.slice();L&&A&&(O[1]+=S);var D=f.angularAxis.ticksCount||4;D>8&&(D=D/(D/8)+D%8),f.angularAxis.ticksStep&&(D=(O[1]-O[0])/D);var P=f.angularAxis.ticksStep||(O[1]-O[0])/(D*(f.minorTicks+1));k&&(P=Math.max(Math.round(P),1)),O[2]||(O[2]=P);var N=n.range.apply(this,O);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=n.scale.linear().domain(O.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?S:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var E="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(E,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=n.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,j=e.select(".chart-group"),q={fill:"none",stroke:f.tickColor},B={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var r=i.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});i.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},i.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],a.range([0,x]),u.layout.radialAxis.domain=a.domain(),F.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),j.attr("transform","translate("+_+")").style({cursor:"crosshair"});var Z=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(Z[0]=Math.max(0,Z[0]),Z[1]=Math.max(0,Z[1]),e.select(".outer-group").attr("transform","translate("+Z+")"),f.title){var X=e.select("g.title-group text").style(B).text(f.title),U=X.node().getBBox();X.attr({x:_[0]-U.width/2,y:_[1]-x-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=G.selectAll("circle.grid-circle").data(a.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(q),Y.attr("r",a),Y.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(q);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=n.svg.axis().scale(a).ticks(5).tickSize(5);G.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(q),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(B).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),J=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(q),J.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(B);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var r=s(t,e),n=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(B);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(j.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),h[0]||et){var nt=[];h.forEach(function(t,e){var r={};r.radialScale=a,r.angularScale=l,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var at=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return o(i[r].defaultConfig(),t)});i[r]().config(n)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=i.tooltipPanel().config({container:ct,fontSize:8})(),ft=i.tooltipPanel().config({container:ct,fontSize:8})(),dt=i.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});j.on("mousemove.angular-guide",function(t,e){var r=i.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;it=l.invert(n);var a=i.util.convertToCartesian(x+12,r+180);ut.text(i.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});j.on("mousemove.radial-guide",function(t,e){var r=i.util.getMousePos(W).radius;pt.attr({r:r}).style({opacity:.5}),lt=a.invert(i.util.getMousePos(W).radius);var n=i.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(i.util.round(lt)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var a=n.select(this),o=a.style("fill"),l="black",s=a.style("opacity")||1;if(a.attr({"data-opacity":s}),"none"!=o){a.attr({"data-fill":o}),l=n.hsl(o).darker().toString(),a.style({fill:l,opacity:1});var c={t:i.util.round(t[0]),r:i.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-Z[0]-d.left,f.top+f.height/2-Z[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else o=a.style("stroke"),a.attr({"data-stroke":o}),l=n.hsl(o).darker().toString(),a.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})}),d}var e,r,a,l,s={data:[],layout:{}},c={},u={},f=n.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=i.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),o(s.data[e],i.Axis.defaultConfig().data[0]),o(s.data[e],t)}),o(s.layout,i.Axis.defaultConfig().layout), diff --git a/dist/plotly-finance.js b/dist/plotly-finance.js index 6d52727e370..a21d295e006 100644 --- a/dist/plotly-finance.js +++ b/dist/plotly-finance.js @@ -1,5 +1,5 @@ /** -* plotly.js (finance) v1.20.0 +* plotly.js (finance) v1.20.1 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -25337,7 +25337,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.20.0'; +exports.version = '1.20.1'; // inject promise polyfill require('es6-promise').polyfill(); @@ -33989,7 +33989,7 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { // if position is given as a category name, convert it to a number if(typeof pos === 'string' && (ax._categories || []).length) { newPos = ax._categories.indexOf(pos); - containerOut[attr] = (newPos !== -1) ? dflt : newPos; + containerOut[attr] = (newPos === -1) ? dflt : newPos; return; } } @@ -49978,40 +49978,6 @@ module.exports = { } }, - // 3D attributes commented out until I finish them in a later PR - // tilt: { - // // degrees to tilt the pie back from straight on - // valType: 'number', - // min: 0, - // max: 90, - // dflt: 0 - // }, - // tiltaxis: { - // // degrees away from straight up to tilt the pie - // // only has an effect if tilt is nonzero - // valType: 'number', - // min: -360, - // max: 360, - // dflt: 0 - // }, - // depth: { - // // "3D" size, as a fraction of radius - // // only has an effect if tilt is nonzero - // valType: 'number', - // min: 0, - // max: 10, - // dflt: 0.5 - // }, - // shading: { - // // how much darker to make the sides than the top, - // // with a 3D effect. We could of course get all - // // fancy with lighting effects, but maybe this is - // // sufficient. - // valType: 'number', - // min: 0, - // max: 1, - // dflt: 0.2 - // }, hole: { valType: 'number', diff --git a/dist/plotly-finance.min.js b/dist/plotly-finance.min.js index 997dd001f8c..e4cdd27378a 100644 --- a/dist/plotly-finance.min.js +++ b/dist/plotly-finance.min.js @@ -1,5 +1,5 @@ /** -* plotly.js (finance - minified) v1.20.0 +* plotly.js (finance - minified) v1.20.1 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -14,10 +14,10 @@ var k="pixel"===w?m[y]:.4;o.coercePosition(e,v,c,w,_,k)}else c(x+"anchor")}retur }},{"./is_valid_scale_array":42,"./scales":44}],42:[function(t,e,n){"use strict";var r=t("tinycolor2");e.exports=function(t){var e=0;if(!Array.isArray(t)||t.length<2)return!1;if(!t[0]||!t[t.length-1])return!1;if(0!==+t[0][0]||1!==+t[t.length-1][0])return!1;for(var n=0;n4/3-l?i:l}},{}],46:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":118}],47:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=r},{"../../lib":118,"../../plotly":140,"../../plots/cartesian/constants":150,"./align":45,"./cursor":46,"./unhover":48}],48:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":114}],49:[function(t,e,n){"use strict";function r(t,e,n,r,a,o,i){if(l.traceIs(n,"symbols")){var c=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(n)?c(t.ms):(o.size||6)/2,t.mrc=e;var r=g.symbolNumber(t.mx||o.symbol)||0,a=r%100;return t.om=r%200>=100,g.symbolFuncs[a](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=r(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,n,r){var a=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(s.fill,r)},g.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},g.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},g.setRect=function(t,e,n,r,a){t.call(g.setPosition,e,n).call(g.setSize,r,a)},g.translatePoint=function(t,e,n,r){var a=t.xp||n.c2p(t.x),o=t.yp||r.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,n,r){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,n,r)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,n){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},g.singleLineStyle=function(t,e,n,r,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=n||o.width||0,l=a||o.dash||"";s.stroke(e,r||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=r||a.dash||"";o.select(this).call(s.stroke,n||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=o.select(this);try{n.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),n.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,n){var a=n.marker,o=a.line,i=g.tryColorscale(a,""),l=g.tryColorscale(a,"line");r(t,e,n,i,l,a,o)},g.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=g.tryColorscale(n,""),a=g.tryColorscale(n,"line");t.each(function(t){g.singlePointStyle(t,o.select(this),e,r,a)})}},g.tryColorscale=function(t,e){var n=e?u.nestedProperty(t,e).get():t,r=n.colorscale,a=n.color;return r&&Array.isArray(a)?c.makeColorScaleFunc(c.extractScale(r,n.cmin,n.cmax)):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var n=o.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,n.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(f.convertToTspans);var d=o.select(this.parentNode),h=n.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,m=x[s]*u,v=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+m+","+v+")"),p>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],o=[];for(n=1;n=A&&(o.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=o.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":108,"../../lib":118,"../../lib/svg_text_utils":130,"../../registry":176,"../../traces/scatter/make_bubble_size_func":255,"../../traces/scatter/subtypes":260,"../color":26,"../colorscale":40,"./symbol_defs":50,d3:10,"fast-isnumeric":13}],50:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:10}],51:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],52:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&["linear","log"].indexOf(n.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var m=g.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(n.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=r(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");l=!m.size(),l?m=e.append("path").classed("yerror",!0):u&&(m=m.transition().duration(n.duration).ease(n.easing)),m.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var v=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-v)+"v"+2*v+"m0,-"+v+"H"+i.xs,i.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":260,d3:10,"fast-isnumeric":13}],57:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":26,d3:10}],58:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":150}],59:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,l,n,r)}var i=r("source"),s=r("visible",!!i);if(!s)return e;r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var c={_fullLayout:n},u=["x","y"],f=0;f<2;f++)o.coerceRef(t,e,c,u[f],"paper");return e}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("../../plots/array_container_defaults"),l=t("./attributes"),s="images";e.exports=function(t,e){var n={name:s,handleItemDefaults:r};i(t,e,n)}},{"../../lib":118,"../../plots/array_container_defaults":142,"../../plots/cartesian/axes":145,"./attributes":58}],60:[function(t,e,n){"use strict";var r=t("d3"),a=t("../drawing"),o=t("../../plots/cartesian/axes"),i=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var n=r.select(this);if(!this.img||this.img.src!==e.source){n.attr("xmlns",i.svg);var a=new Promise(function(t){function r(){n.remove(),t()}var a=new Image;this.img=a,a.setAttribute("crossOrigin","anonymous"),a.onerror=r,a.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var r=t.toDataURL("image/png");n.attr("xlink:href",r)},n.on("error",r),n.on("load",t),a.src=e.source}.bind(this));t._promises.push(a)}}function n(e){var n=r.select(this),i=o.getFromId(t,e.xref),s=o.getFromId(t,e.yref),c=l._size,u=i?Math.abs(i.l2p(e.sizex)-i.l2p(0)):e.sizex*c.w,f=s?Math.abs(s.l2p(e.sizey)-s.l2p(0)):e.sizey*c.h,d=u*h.x[e.xanchor].offset,p=f*h.y[e.yanchor].offset,g=h.x[e.xanchor].sizing+h.y[e.yanchor].sizing,m=(i?i.r2p(e.x)+i._offset:e.x*c.w+c.l)+d,v=(s?s.r2p(e.y)+s._offset:c.h-e.y*c.h+c.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}n.attr({x:m,y:v,width:u,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=i?i._id:"",x=s?s._id:"",b=y+x;b&&n.call(a.setClipUrl,"clip"+l._uid+b)}for(var l=t._fullLayout,s=[],c=[],u=[],f=0;f=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],63:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2, max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":115,"../../plots/font_attributes":165,"../color/attributes":25}],64:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],65:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":118,"../../plots/layout_attributes":167,"../../registry":176,"./attributes":63,"./helpers":68}],66:[function(t,e,n){"use strict";function r(t,e){function n(n){v.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,v=Math.max(e.height,v)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,j,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,_=n.showlegend&&x(t.calcdata,v),k=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=n._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=M.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var z=L.selectAll("g.groups").data(_);z.enter().append("g").attr("class","groups"),z.exit().remove();var S=z.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,z,S),l(t));var P=0,D=n.width,N=0,E=n.height;i(t,z,S),v.height>E?s(t):l(t);var I=n._size,R=I.l+I.w*v.x,F=I.t+I.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?F-=v.height:w.isMiddleAnchor(v)&&(F-=v.height/2);var j=v.width,q=I.w;j>q?(R=I.l,j=q):(R+j>D&&(R=D-j),RH?(F=I.t,B=H):(F+B>E&&(F=E-B),Fn[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":118,"../../registry":176,"../../traces/pie/style_one":238,"../../traces/scatter/subtypes":260,"../color":26,"../drawing":49,d3:10}],71:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||v||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(m,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":118,"../color":26,"./attributes":75,"./button_attributes":76,"./constants":77}],79:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,z)},a=z.line.width?z.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",z.opacity).call(_.stroke,a).call(_.fill,z.fillcolor).call(w.dashLine,z.line.dash,z.line.width);S&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+S),t._context.editable&&f(t,o,z,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof n&&n?s[n]=r:x.isPlainObject(n)&&(s=n);var c=Object.keys(s);for(o=0;oU&&r>G&&!t.shiftKey?k.getCursor(a/n,1-o/r):"move";M(e,i),Z=i.split("-")[0]}function o(e){j=b.getFromId(t,n.xref),q=b.getFromId(t,n.yref),B=T.getDataToPixel(t,j),H=T.getDataToPixel(t,q,!0),V=T.getPixelToData(t,j),X=T.getPixelToData(t,q,!0);var o="shapes["+r+"]";"path"===n.type?(R=n.path,F=o+".path"):(u=B(n.x0),f=H(n.y0),d=B(n.x1),h=H(n.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uG&&(c[z]=n[D]=X(l),c[S]=n[N]=X(s)),f-u>U&&(c[O]=n[E]=V(u),c[P]=n[I]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,v,x,_,w,A,L,C,z,S,O,P,D,N,E,I,R,F,j,q,B,H,V,X,Z,U=10,G=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();k.init(Y)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults");e.exports={draw:r,drawOne:a}},{"../../lib":118,"../../lib/setcursor":128,"../../plotly":140,"../../plots/cartesian/axes":145,"../color":26,"../dragelement":47,"../drawing":49,"./constants":89,"./defaults":90,"./helpers":92,"./shape_defaults":94,"fast-isnumeric":13}],92:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],93:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":87,"./calc_autorange":88,"./defaults":90,"./draw":91}],94:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],m={_fullLayout:n},v=a.coerceRef(t,e,m,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==v?(y=a.getFromId(m,v),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=r.identity;var k=g+"0",M=g+"1",A=t[k],T=t[M];t[k]=x(t[k],!0),t[M]=x(t[M],!0),a.coercePosition(e,m,c,v,k,_),a.coercePosition(e,m,c,v,M,w),e[k]=b(e[k]),e[M]=b(e[M]),t[k]=A,t[M]=T}}return"path"===d?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":118,"../../plots/cartesian/axes":145,"./attributes":87,"./helpers":92}],95:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":115,"../../plots/animation_attributes":141,"../../plots/font_attributes":165,"../../plots/pad_attributes":168,"./constants":96}],96:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],97:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*z.gripWidth)+","+e.currentValueTotalHeight+")"); -}}function v(t,e){return t.inputAreaStart+z.stepInset+(t.inputAreaLength-2*z.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-z.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*z.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+z.railTouchRectClass).data([0]);r.enter().append("rect").classed(z.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,z.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),M.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+z.railRectClass).data([0]);n.enter().append("rect").classed(z.railRectClass,!0);var r=e.inputAreaLength-2*z.railInset;n.attr({width:r,height:z.railWidth,rx:z.railRadius,ry:z.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(n,z.railInset,.5*(e.inputAreaWidth-z.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(z.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+z.groupClassName).data(n,a);s.enter().append("g").classed(z.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,z.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,z=O,k._infolayer.select("."+e).attr({"data-unformatted":z}).text(z).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,z=g.title.trim();""===z&&(L=0),z.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var S=w.selectAll("text").data([0]);S.enter().append("text"),S.text(z).attr("class",e),S.attr({"data-unformatted":z}).call(f);var O="Click to enter "+y+" title";t._context.editable?(z||p(),S.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):z&&!z.match(/Click to enter .+ title/)||S.remove(),S.classed("js-placeholder",C)}},{"../../lib":118,"../../lib/svg_text_utils":130,"../../plotly":140,"../../plots/plots":169,"../color":26,"../drawing":49,d3:10,"fast-isnumeric":13}],101:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":115,"../../plots/font_attributes":165,"../../plots/pad_attributes":168,"../color/attributes":25}],102:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],103:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],108:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],109:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":24,"./components/images":61,"./components/legend":69,"./components/rangeselector":81,"./components/rangeslider":86,"./components/shapes":93,"./components/sliders":99,"./components/updatemenus":105,"./fonts/mathjax_config":110,"./lib/queue":126,"./plot_api/plot_schema":134,"./plot_api/register":135,"./plot_api/set_plot_config":136,"./plot_api/to_image":138,"./plot_api/validate":139,"./plotly":140,"./snapshot":181,"./snapshot/download":178,"./traces/scatter":250,d3:10,"es6-promise":11}],110:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],111:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":106,"fast-isnumeric":13}],112:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(o(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,r,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var m=(new Date).getFullYear();e=((Number(c[0])-m+70)%100+200)%100+m-70}if(!o(e))return s;var v=new Date(0,0,1);if(v.setFullYear(u?e:-e),c.length>1){if(r=Number(c[1])-1,c[1].length>2||!(r>=0&&r<=11))return s;if(v.setMonth(r),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(v.setDate(a),v.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(v.setHours(i),v.getHours()!==i)return s;if(c.length>1)return a=v.getTime(),r=Number(c[1]),2===c[1].length&&r>=0&&r<=59?(a+=f*r,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return v.getTime()},h=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==s};var g=90*c,m=3*u,v=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var n=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(n),i=en?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r0?[0]:[]);if(l.enter().append("g").classed(z.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+z.groupClassName).data(n,a);s.enter().append("g").classed(z.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,z.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,z=O,k._infolayer.select("."+e).attr({"data-unformatted":z}).text(z).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,z=g.title.trim();""===z&&(L=0),z.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var S=w.selectAll("text").data([0]);S.enter().append("text"),S.text(z).attr("class",e),S.attr({"data-unformatted":z}).call(f);var O="Click to enter "+y+" title";t._context.editable?(z||p(),S.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):z&&!z.match(/Click to enter .+ title/)||S.remove(),S.classed("js-placeholder",C)}},{"../../lib":118,"../../lib/svg_text_utils":130,"../../plotly":140,"../../plots/plots":169,"../color":26,"../drawing":49,d3:10,"fast-isnumeric":13}],101:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":115,"../../plots/font_attributes":165,"../../plots/pad_attributes":168,"../color/attributes":25}],102:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],103:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],108:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],109:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":24,"./components/images":61,"./components/legend":69,"./components/rangeselector":81,"./components/rangeslider":86,"./components/shapes":93,"./components/sliders":99,"./components/updatemenus":105,"./fonts/mathjax_config":110,"./lib/queue":126,"./plot_api/plot_schema":134,"./plot_api/register":135,"./plot_api/set_plot_config":136,"./plot_api/to_image":138,"./plot_api/validate":139,"./plotly":140,"./snapshot":181,"./snapshot/download":178,"./traces/scatter":250,d3:10,"es6-promise":11}],110:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],111:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":106,"fast-isnumeric":13}],112:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(o(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,r,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var m=(new Date).getFullYear();e=((Number(c[0])-m+70)%100+200)%100+m-70}if(!o(e))return s;var v=new Date(0,0,1);if(v.setFullYear(u?e:-e),c.length>1){if(r=Number(c[1])-1,c[1].length>2||!(r>=0&&r<=11))return s;if(v.setMonth(r),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(v.setDate(a),v.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(v.setHours(i),v.getHours()!==i)return s;if(c.length>1)return a=v.getTime(),r=Number(c[1]),2===c[1].length&&r>=0&&r<=59?(a+=f*r,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return v.getTime()},h=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==s};var g=90*c,m=3*u,v=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var n=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(n),i=en?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"./clean_number":111,"./coerce":112,"./dates":113,"./extend":115,"./filter_unique":116,"./filter_visible":117,"./is_array":119,"./is_plain_object":120,"./loggers":121,"./matrix":122,"./nested_property":123,"./notifier":124,"./search":127,"./stats":129,d3:10}],119:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],120:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],121:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],i=!1,d(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");lo||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],s=t[1];if(no||sl)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],m=r[0][1],v=0;for(c=1;cMath.max(u,g)||s>Math.max(f,m)))if(su||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":122}],126:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;f90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":13}],130:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,m.indexOf(u.protocol)===-1?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||r(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":107,"../constants/xmlns_namespaces":108,"../lib":118,d3:10}],131:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function a(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var a=f.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=u.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&l(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sO.range[0]?[1,2]:[2,1]);else{var P=O.range[0],D=O.range[1];"log"===b?(P<=0&&D<=0&&n(L+".autorange",!0),P<=0?P=D/1e6:D<=0&&(D=P/1e6),n(L+".range[0]",Math.log(P)/Math.LN10),n(L+".range[1]",Math.log(D)/Math.LN10)):(n(L+".range[0]",Math.pow(10,P)),n(L+".range[1]",Math.pow(10,D)))}else n(L+".autorange",!0)}if("reverse"===A)C.range?C.range.reverse():(n(L+".autorange",!0),C.range=[1,0]),z.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var N=v.parts[1],E=v.parts[0],I=o[E]||[],R=I[N]||{};2===v.parts.length&&(null===b&&(e[m]="remove"),"add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?N===-1?(g[E]=I,delete g[m]):g[m]=R:x.log("???",e)),!r(R,"x")&&!r(R,"y")||x.containsAny(m,["color","opacity","align","dash"])||(h.docalc=!0);var F=w.getComponentMethod(E,"drawOne");F(t,N,v.parts.slice(2).join("."),e[m]),delete e[m]}else if(k.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])S.manageArrayContainers(v,b,g),h.doplot=!0;else{var j=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?h.doplot=!0:0===v.parts[0].indexOf("geo")?h.doplot=!0:0===v.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===m?h.doplot=!0:!i._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?h.docalc=!0:v.parts[0].indexOf("legend")!==-1?h.dolegend=!0:m.indexOf("title")!==-1?h.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(j,["tick","exponent","grid","zeroline"])?h.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:v.parts.length>1&&j.indexOf("line")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&"mirror"===j?h.doticks=h.dolayoutstyle=!0:"margin.pad"===m?h.doticks=h.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(h.doplot=!0):h.doplot=!0,v.set(b)}}}var q=t._fullLayout.width,B=t._fullLayout.height;k.supplyDefaults(t),t.layout.autosize&&k.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==q||t._fullLayout.height!==B;return H&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];m.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(C.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var o=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=o.append("g").classed("imagelayer",!0),n._shapeUpperLayer=o.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),k=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),C=t("../constants/xmlns_namespaces"),z=t("../lib/svg_text_utils"),S=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,n,r){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=P._basePlotModules,n=0;n=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=S.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),n=k.supplyAnimationDefaults(n);var l=n.transition,s=n.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){if(0!==i._frameQueue.length){for(;i._frameQueue.length;){var e=i._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var l=0;li._timeToNext&&h()};e()}function g(t){return Array.isArray(l)?y>=l.length?t.transitionOpts=l[y]:t.transitionOpts=l[0]:t.transitionOpts=l,y++,t}var m,v,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&x.isPlainObject(e);if(M)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&LL)&&C.push(v);b=C}}b.length>0?f(b):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,n){if(t=S.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,a,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(r=e.length-1;r>=0;r--)u.push({frame:k.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:c+r});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(a=u[r].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=k.modifyFrames,s=k.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),k.modifyFrames(t,o)},y.purge=function(t){t=S.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return k.cleanPlot([],{},n,e),k.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":49,"../components/errorbars":55,"../constants/xmlns_namespaces":108,"../lib":118,"../lib/events":114,"../lib/queue":126,"../lib/svg_text_utils":130,"../plotly":140,"../plots/cartesian/graph_interact":152,"../plots/plots":169,"../plots/polar":172,"../registry":176,"./helpers":131,"./subroutines":137,d3:10,"fast-isnumeric":13}],133:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],134:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:y},n={}):(e=d.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,_(r,p),_(r,e.attributes),n.attributes&&_(r,n.attributes),r.type=t;var a={meta:e.meta||{},attributes:i(r)};if(e.layoutAttributes){var o={};_(o,e.layoutAttributes),a.layoutAttributes=i(o)}return a}function a(){var t={};return _(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var n=d.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)u(t,n,"xaxis"),u(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;u(t,n,r)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.layoutAttributes&&(Array.isArray(n.layoutNodes)?n.layoutNodes.forEach(function(e){f(t,n,e+n.name)}):f(t,n,n.name))}),{layoutAttributes:i(t)}}function o(t){var e=d.transformsRegistry[t];return{attributes:i(e.attributes)}}function i(t){return l(t),s(t),t}function l(t){function e(t){return{valType:"string"}}function r(t,r,a){n.isValObject(t)?"data_array"===t.valType?(t.role="data",a[r+"src"]=e(r)):t.arrayOk===!0&&(a[r+"src"]=e(r)):h.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function s(t){function e(t,e,n){if(t){var r=t[k];r&&(delete t[k],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function c(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function u(t,e,n){var r=h.nestedProperty(t,n),a=_({},e.layoutAttributes);a[w]=!0,r.set(a)}function f(t,e,n){var r=h.nestedProperty(t,n),a=_(r.get()||{},e.layoutAttributes);r.set(a)}var d=t("../registry"),h=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=h.extendFlat,_=h.extendDeep,w="_isSubplotObj",k="_isLinkedToArray",M="_deprecated",A=[w,k,M];n.IS_SUBPLOT_OBJ=w,n.IS_LINKED_TO_ARRAY=k,n.DEPRECATED=M,n.UNDERSCORE_ATTRS=A,n.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:h.valObjects,metaKeys:A.concat.role},traces:t,layout:a(),transforms:e,frames:i(m),animation:i(v)}},n.crawl=function(t,e,r){var a=r||0;Object.keys(t).forEach(function(r){var o=t[r];A.indexOf(r)===-1&&(e(o,r,t,a),n.isValObject(o)||h.isPlainObject(o)&&n.crawl(o,e,a+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,i,l){o=o.slice(0,l).concat([n]);var s="data_array"===e.valType||e.arrayOk===!0;if(s){var c=r(o),u=h.nestedProperty(t,c).get();Array.isArray(u)&&a.push(c)}}function r(t){return t.join(".")}var a=[],o=[];if(n.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":118,"../plotly":140,"../snapshot/cloneplot":177,"../snapshot/helpers":180,"../snapshot/svgtoimg":182,"../snapshot/tosvg":184,"fast-isnumeric":13}],139:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=n.length,v=0;vu&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=S&&a<=10||e>=15*S)t._tickround="d";else if(e>=P&&a<=16||e>=O)t._tickround="M";else if(e>=D&&a<=19||e>=P)t._tickround="S";else{var o=_.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var n=t.match(Y),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);n&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(r&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(n||(a="
"+H(u)),o=X(u)):(n||(a="
"+Z(u)),o=U(u),"M"!==s?(o+=G(u),"S"!==s&&(o+=d(y.round(v(l/1e3,1),4),t,"none",n).substr(1))):"d"===c&&(o=X(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=t<0,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var g=r-1,m=r+1;n="tozero"===t.rangemode?r<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n.map(t.l2r||Number)},N.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=N.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},N.saveRangeInitial=function(t,e){for(var n=N.list(t,"",!0),r=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},N.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},N.autoTicks(f,l);var d,h=N.tickIncrement(N.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=N.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=N.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fC?(e/=C,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,I)):r>z?(e/=z,t.dtick="M"+a(e,1,R)):r>S?(t.dtick=a(e,S,j),t.tick0="2000-01-02"):r>O?t.dtick=a(e,O,R):r>P?t.dtick=a(e,P,F):r>D?t.dtick=a(e,D,F):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,I)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},N.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?B:q,s=t+.01*r,c=_.roundUp(v(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]o:f1&&e1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":118,"../plotly":140,"../snapshot/cloneplot":177,"../snapshot/helpers":180,"../snapshot/svgtoimg":182,"../snapshot/tosvg":184,"fast-isnumeric":13}],139:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=n.length,v=0;vu&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=S&&a<=10||e>=15*S)t._tickround="d";else if(e>=P&&a<=16||e>=O)t._tickround="M";else if(e>=D&&a<=19||e>=P)t._tickround="S";else{var o=_.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var n=t.match(Y),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);n&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(r&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(n||(a="
"+H(u)),o=X(u)):(n||(a="
"+Z(u)),o=U(u),"M"!==s?(o+=G(u),"S"!==s&&(o+=d(y.round(v(l/1e3,1),4),t,"none",n).substr(1))):"d"===c&&(o=X(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=t<0,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var g=r-1,m=r+1;n="tozero"===t.rangemode?r<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n.map(t.l2r||Number)},N.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=N.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},N.saveRangeInitial=function(t,e){for(var n=N.list(t,"",!0),r=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},N.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},N.autoTicks(f,l);var d,h=N.tickIncrement(N.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=N.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=N.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fC?(e/=C,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,I)):r>z?(e/=z,t.dtick="M"+a(e,1,R)):r>S?(t.dtick=a(e,S,j),t.tick0="2000-01-02"):r>O?t.dtick=a(e,O,R):r>P?t.dtick=a(e,P,F):r>D?t.dtick=a(e,D,F):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,I)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},N.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?B:q,s=t+.01*r,c=_.roundUp(v(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]o:f1&&e2*r}function o(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("../../constants/numerical").BADNUM;e.exports=function(t){return a(t)?"date":o(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":106,"../../lib":118,"fast-isnumeric":13}],147:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var l=i(e,n,r);if(l){if("histogram"===l.type&&r==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,r)){for(var s,u=a(l),f=[],d=0;d0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],150:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],151:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?r:"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,n,l,_,w,k,M){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+mt+")").attr("d",ct+"Z"),ht=pt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+mt+")").attr("d","M0,0Z"),C()}function C(){pt.selectAll(".select-outline").remove()}function z(e,n){if(t._transitioningWithDuration)return!1;var r=Math.max(0,Math.min(V,e+ot)),a=Math.max(0,Math.min(X,n+it)),o=Math.abs(r-ot),i=Math.abs(a-it),l=Math.floor(Math.min(i,o,U)/2);lt.l=Math.min(ot,r),lt.r=Math.max(ot,r),lt.t=Math.min(it,a),lt.b=Math.max(it,a),!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function S(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),b=!1)))}function P(e,n){var a=1===(k+M).length;if(e)R();else if(2!==n||a){if(1===n&&a){var o=k?H[0]:B[0],i="s"===k||"w"===M?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",f="middle";if(o.fixedrange)return;k?(f="n"===k?"top":"bottom","right"===o.side&&(u="right")):"e"===M&&(u="right"),nt.call(d.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var n=o.d2r(e);void 0!==n&&c.relayout(t,l,n)})}}else I()}function D(e){function n(t,e,n){function r(e){return t.l2r(o+(e-o)*n)}if(!t.fixedrange){var a=t.range.map(t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(r)}}if(t._context.scrollZoom||j._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(T(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(yt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=vt[0]+vt[2]*s,u=(l.bottom-e.clientY)/l.height,d=vt[1]+vt[3]*(1-u);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,n){for(var r,o,i=1-e,l=0;l0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rY.width||G<0||G>Y.height)return _.unhoverRaw(t,e)}else U="xpx"in e?e.xpx:M[0]._length/2,G="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?r(o,e.xval):a(M,U),P="yval"in e?r(o,e.yval):a(A,G),!g(O[0])||!g(P[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(N=0;N1||I.hoverinfo.indexOf("name")!==-1?I.name:void 0,index:!1,distance:Math.min(W,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[R]&&(H.subplot=i[R]._subplot),V=X.length,"array"===j){var Q=e[N];"pointNumber"in Q?(H.index=Q.pointNumber,j="closest"):(j="","xval"in Q&&(q=Q.xval,j="x"),"yval"in Q&&(B=Q.yval,j=j?"closest":"y"))}else q=O[F],B=P[F];if(I._module&&I._module.hoverPoints){var $=I._module.hoverPoints(H,q,B,j);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&X.push(s(J,S))}else m.log("Unrecognized trace type in hover:",I);"closest"===S&&X.length>V&&(X.splice(0,V),W=X[0].distance)}if(0===X.length)return _.unhoverRaw(t,e);var tt="y"===S&&Z.length>1;X.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),nt={hovermode:S,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},rt=c(X,nt);u(X,tt?"xa":"ya"),f(rt,tt);var at=t._hoverdata,ot=[];for(D=0;D128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),m=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),m=d.node().getBoundingClientRect().width+2*D):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var v,k,T=f.node().getBoundingClientRect(),C=t.xa._offset+(t.x0+t.x1)/2,z=t.ya._offset+(t.y0+t.y1)/2,S=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),N=T.width+P+D+m;t.ty0=_-T.top,t.bx=T.width+2*D,t.by=T.height+2*D,t.anchor="start",t.txwidth=T.width,t.tx2width=m,t.offset=0,o?(t.pos=C,v=z+O/2+N<=M,k=z-O/2-N>=0,"top"!==t.idealAlign&&v||!k?v?(z+=O/2,t.anchor="start"):t.anchor="middle":(z-=O/2,t.anchor="end")):(t.pos=z,v=C+S/2+N<=w,k=C-S/2-N>=0,"left"!==t.idealAlign&&v||!k?v?(C+=S/2,t.anchor="start"):t.anchor="middle":(C-=S/2,t.anchor="end")),f.attr("text-anchor",t.anchor),m&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+C+","+z+")"+(o?"rotate("+L+")":""))}),z}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?z:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var m=f[i];for(l=m.length-1;l>=0;l--){var v=m[l],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(P+D),l=i+o*(t.txwidth+D),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-O,s=t.offset*S),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*P+s)+","+(P+c)+"v"+(t.by/2-P)+"h"+r*t.bx+"v-"+t.by+"H"+(r*P+s)+"V"+(c-P)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+D).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*D+s,c+t.ty0-t.by/2+D),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,n){function r(n,r){return m.coerce(t,e,A,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=T.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},T.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+k.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},T.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},T.getClosest=function(t,e,n){ if(n.index!==!1)n.index>=0&&n.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":118,"fast-isnumeric":13}],158:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-m.left,b=n-m.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),C=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var z=g.selectAll("path.select-outline").data([1,2]);z.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",k+"Z");var S,O,P,D,N,E=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,F=[];for(S=0;S0)return Math.log(e)/Math.LN10;if(e<=0&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*f*Math.abs(r-a))}return s}function n(t){return Math.pow(10,t)}function i(t){return a(t)?(t=Number(t),t<-l||t>l?s:a(t)?Number(t):s):s}var f=10;t.c2l="log"===t.type?e:i,t.l2c="log"===t.type?n:i,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var n,r,i=t[e],s=(t._id||"x").charAt(0);if(r="date"===t.type?c.DFLTRANGEDATE:"y"===s?c.DFLTRANGEY:c.DFLTRANGEX,r=r.slice(),!i||2!==i.length)return void(t[e]=r);for("date"===t.type&&(i[0]=o.cleanDate(i[0]),i[1]=o.cleanDate(i[1])),n=0;n<2;n++)if("date"===t.type){if(!o.isDateTime(i[n])){t[e]=r;break}if(i[n]o.MAX_MS&&(i[n]=o.MAX_MS),t.r2l(i[0])===t.r2l(i[1])){var u=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(u-1e3),i[1]=t.l2r(u+1e3);break}}else{if(!a(i[n])){if(!a(i[1-n])){t[e]=r;break}i[n]=i[1-n]*(n?10:.1)}if(i[n]<-l?i[n]=-l:i[n]>l&&(i[n]=l),i[0]===i[1]){var f=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=f,i[1]+=f}}},t.fraction2r=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return t.l2r(n+e*(r-n))},t.r2fraction=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return(t.r2l(e)-n)/(r-n)},t.setScale=function(e){var n=t._gd._fullLayout._size,r=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var a=u.getFromId(t._gd,t.overlaying);t.domain=a.domain}var i=e&&t._r?"_r":"range";t.cleanRange(i);var l=t.r2l(t[i][0]),s=t.r2l(t[i][1]);if("y"===r?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):s},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,n){return t.l2p(t.r2l(e,n))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=i,t.d2c=o.cleanNumber,"log"===t.type?(t.d2l=function(e,n){return t.c2l(t.d2c(e),n)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=o.cleanNumber,t.d2r=o.cleanNumber,t.r2d=i),t.r2l=i,t.l2r=i):"date"===t.type?(t.c2d=o.ms2DateTime,t.d2c=function(t){var e=o.dateTime2ms(t);if(e===s){if(!a(t))return s;e=Number(t)}return o.constrain(e,o.MIN_MS,o.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=o.identity,t.r2d=o.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var n=t._categories.indexOf(e);return n===-1?s:n},t.d2l=t.d2c,t.r2l=i,t.l2r=i,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;o0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var f=u.charAt(0),d=u.substr(1);d=r(d)?Number(d):0,(d<=0||!("date"===i&&"M"===f&&d===Math.round(d)||"log"===i&&"L"===f||"log"===i&&"D"===f&&(1===d||2===d)))&&(e.dtick=c)}var h="date"===i?"2000-01-01":0,p=n("tick0",h);"date"===i?e.tick0=a.cleanDate(p,h):r(p)&&"D1"!==u&&"D2"!==u?e.tick0=Number(p):e.tick0=h}else{var g=n("tickvals");void 0===g?e.tickmode="auto":n("ticktext")}}},{"../../constants/numerical":106,"../../lib":118,"fast-isnumeric":13}],163:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../lib"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,n,c){function u(t){var e,n,r,a,o,i={};for(e in t)if(n=e.split("."),r=n[0].match(s)){var l=r[1],c=l+"axis";if(a=y[c],o={},Array.isArray(t[e])?o.to=t[e].slice(0):Array.isArray(t[e].range)&&(o.to=t[e].range.slice(0)),!o.to)continue;o.axisName=c,o.length=a._length,x.push(l),i[l]=o}return i}function f(t,e,n){var r,a,o,i=t._plots,l=[];for(r in i){var s=i[r];if(l.indexOf(s)===-1){var c=s.xaxis._id,u=s.yaxis._id,f=s.xaxis.range,d=s.yaxis.range;s.xaxis._r=s.xaxis.range.slice(),s.yaxis._r=s.yaxis.range.slice(),a=n[c]?n[c].to:f,o=n[u]?n[u].to:d,f[0]===a[0]&&f[1]===a[1]&&d[0]===o[0]&&d[1]===o[1]||e.indexOf(c)===-1&&e.indexOf(u)===-1||l.push(s)}}return l}function d(e,n){function r(e,n){for(a=0;an.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var k;c&&(k=c());var M,A,T,L=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),M=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":118,"../../plotly":140,"../../registry":176,"./axes":145,d3:10}],164:[function(t,e,n){"use strict";function r(t,e,n){var r,a,o,i=!1;if("data"===e.type)r=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;r=t._fullLayout}return a=c.nestedProperty(r,e.prop).get(),o=n[e.type]=n[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var n=[],r=e[0],a={};if("string"==typeof r)a[r]=e[1];else{if(!c.isPlainObject(r))return n;a=r}return l(a,function(t,e,r){n.push({type:"layout",prop:t,value:r})},"",0),n}function i(t,e){var n,r,a,o,i=[];if(r=e[0],a=e[1],n=e[2],o={},"string"==typeof r)o[r]=a;else{if(!c.isPlainObject(r))return i;o=r,void 0===n&&(n=a)}return void 0===n&&(n=null),l(o,function(e,r,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);n&&(l=Math.min(l,n.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,r+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");n.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=n.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){r(t,s,i.cache),i.check=function(){if(l){var e=r(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),n._initialAutoSizeIsDone){var c=n.width,f=n.height;p.supplyLayoutGlobalDefaults(o,r),o.width||(r.width=c),o.height||(r.height=f)}else{p.supplyLayoutGlobalDefaults(o,r);var d=!o.width||!o.height,h=r.autosize,g=t._context&&t._context.autosizable,m=d&&(h||g);m?p.plotAutoSize(t,o,r):d&&p.sanitizeMargins(t),!h&&d&&(o.width=r.width,o.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=s.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,r),r._has=p._hasPlotType.bind(r);var v=r._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,m=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(g*(m.width-f)),a=Math.round(g*(m.height-h))}else{var v=s?window.getComputedStyle(t):{};r=parseFloat(v.width)||n.width,a=parseFloat(v.height)||n.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;r1,_=!e.height&&Math.abs(n.height-a)>1;(_||b)&&(b&&(n.width=r),_&&(n.height=a)),t._initialAutoSize||(t._initialAutoSize={width:r,height:a}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n,r){var a,o;u.Axes.supplyLayoutDefaults(t,e,n);var i=e._basePlotModules;for(a=0;a.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var m=s[t].t.val,v=s[t].t.size;if(m>d){var y=(h*m+(v-e.height)*d)/(m-d),x=(v*(1-d)+(h-e.height)*(1-m))/(m-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!t._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):d.isJSDate(t)?d.ms2DateTime(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var n,r,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(n=0;n0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(n)for(l=0;l=0,z=C?f.angularAxis.domain:r.extent(M),S=Math.abs(M[1]-M[0]);T&&!A&&(S=0);var O=z.slice();L&&A&&(O[1]+=S);var P=f.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),f.angularAxis.ticksStep&&(P=(O[1]-O[0])/P);var D=f.angularAxis.ticksStep||(O[1]-O[0])/(P*(f.minorTicks+1));k&&(D=Math.max(Math.round(D),1)),O[2]||(O[2]=D);var N=r.range.apply(this,O);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=r.scale.linear().domain(O.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?S:0,e=r.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var E="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(E,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=r.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,j=e.select(".chart-group"),q={fill:"none",stroke:f.tickColor},B={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=i.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});i.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},i.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],a.range([0,x]),u.layout.radialAxis.domain=a.domain(),F.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),j.attr("transform","translate("+_+")").style({cursor:"crosshair"});var X=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(X[0]=Math.max(0,X[0]),X[1]=Math.max(0,X[1]),e.select(".outer-group").attr("transform","translate("+X+")"),f.title){var Z=e.select("g.title-group text").style(B).text(f.title),U=Z.node().getBBox();Z.attr({x:_[0]-U.width/2,y:_[1]-x-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=G.selectAll("circle.grid-circle").data(a.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(q),Y.attr("r",a),Y.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(q);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=r.svg.axis().scale(a).ticks(5).tickSize(5);G.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(q),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(B).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),J=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(q),J.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(B);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?n<270&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(n<=180&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(B);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=r.max(j.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=a,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=r.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return o(i[n].defaultConfig(),t)});i[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=i.tooltipPanel().config({container:ct,fontSize:8})(),ft=i.tooltipPanel().config({container:ct,fontSize:8})(),dt=i.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});j.on("mousemove.angular-guide",function(t,e){var n=i.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=i.util.convertToCartesian(x+12,n+180);ut.text(i.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});j.on("mousemove.radial-guide",function(t,e){var n=i.util.getMousePos(W).radius;pt.attr({r:n}).style({opacity:.5}),lt=a.invert(i.util.getMousePos(W).radius);var r=i.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(i.util.round(lt)).move([r[0]+_[0],r[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var a=r.select(this),o=a.style("fill"),l="black",s=a.style("opacity")||1;if(a.attr({"data-opacity":s}),"none"!=o){a.attr({"data-fill":o}),l=r.hsl(o).darker().toString(),a.style({fill:l,opacity:1});var c={t:i.util.round(t[0]),r:i.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-X[0]-d.left,f.top+f.height/2-X[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else o=a.style("stroke"),a.attr({"data-stroke":o}),l=r.hsl(o).darker().toString(),a.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==r.event.which&&void(r.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=r.select(this),a=n.attr("data-fill");a?n.style({fill:a,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,a,l,s={data:[],layout:{}},c={},u={},f=r.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=i.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),o(s.data[e],i.Axis.defaultConfig().data[0]),o(s.data[e],t)}),o(s.layout,i.Axis.defaultConfig().layout),o(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},r.rebind(d,f,"on"),d},i.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:r.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},i.util={},i.DATAEXTENT="dataExtent",i.AREA="AreaChart",i.LINE="LinePlot",i.DOT="DotPlot",i.BAR="BarChart",i.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},i.util._extend=function(t,e){for(var n in t)e[n]=t[n]},i.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},i.util.dataFromEquation2=function(t,e){var n=e||6,a=r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return a},i.util.dataFromEquation=function(t,e,n){var a=e||6,o=[],i=[];r.range(0,360+a,a).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},i.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return r.range(e).map(function(t,e){return n[e]||n[0]})},i.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=i.util.ensureArray(t[e],n)}),t},i.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},i.util.validateKeys=function(t,e){ diff --git a/dist/plotly-geo-assets.js b/dist/plotly-geo-assets.js index c15af16c0e5..b9a768a9408 100644 --- a/dist/plotly-geo-assets.js +++ b/dist/plotly-geo-assets.js @@ -1,5 +1,5 @@ /** -* plotly.js v1.20.0 +* plotly.js v1.20.1 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -69,7 +69,7 @@ var saneTopojson = require('sane-topojson'); // package version injected by `npm run preprocess` -exports.version = '1.20.0'; +exports.version = '1.20.1'; exports.topojson = saneTopojson; diff --git a/dist/plotly-geo.js b/dist/plotly-geo.js index b0174645738..00f00037927 100644 --- a/dist/plotly-geo.js +++ b/dist/plotly-geo.js @@ -1,5 +1,5 @@ /** -* plotly.js (geo) v1.20.0 +* plotly.js (geo) v1.20.1 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -26074,7 +26074,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.20.0'; +exports.version = '1.20.1'; // inject promise polyfill require('es6-promise').polyfill(); @@ -34973,7 +34973,7 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { // if position is given as a category name, convert it to a number if(typeof pos === 'string' && (ax._categories || []).length) { newPos = ax._categories.indexOf(pos); - containerOut[attr] = (newPos !== -1) ? dflt : newPos; + containerOut[attr] = (newPos === -1) ? dflt : newPos; return; } } diff --git a/dist/plotly-geo.min.js b/dist/plotly-geo.min.js index 59a3626847f..cb67a379045 100644 --- a/dist/plotly-geo.min.js +++ b/dist/plotly-geo.min.js @@ -1,5 +1,5 @@ /** -* plotly.js (geo - minified) v1.20.0 +* plotly.js (geo - minified) v1.20.1 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -14,11 +14,11 @@ t.L=e}else t.R=e;n=t}else this._?(t=sr(this._),e.P=null,e.N=t,t.P=t.L=e,n=t):(e. e.exports=function(t,e){function n(){function x(t,e){return u.coerce(J,K,y,t,e)}function w(){if(["top","bottom"].indexOf(_.titleside)!==-1){var e=ot.select(".cbtitle"),n=e.select("text"),o=[-_.outlinewidth/2,_.outlinewidth/2],i=e.select(".h"+K._id+"title-math-group").node(),l=15.6;if(n.node()&&(l=1.3*parseInt(n.style("font-size"),10)),i?(lt=h.bBox(i).height,lt>l&&(o[1]-=(lt-l)/2)):n.node()&&!n.classed("js-placeholder")&&(lt=h.bBox(e.node()).height),lt){if(lt+=5,"top"===_.titleside)K.domain[1]-=lt/T.h,o[1]*=-1;else{K.domain[0]+=lt/T.h;var c=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),K.setScale()}}ot.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-K.domain[1]))+")");var f=ot.select(".cbfills").selectAll("rect.cbfill").data(z);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?C[0]:(z[e]+z[e-1])/2,e===z.length-1?C[1]:(z[e]+z[e+1])/2].map(K.c2p).map(Math.round);e!==z.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=N(t).replace("e-",""),i=a(o).toHexString();r.select(this).attr({x:Z,width:Math.max(B,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var d=ot.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){r.select(this).attr("d","M"+Z+","+(Math.round(K.c2p(t))+_.line.width/2%1)+"h"+B).call(h.lineGroupStyle,_.line.width,O(t),_.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=Z+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=K.titlefont.size,n=K._offset+K._length/2,a=T.l+(K.position||0)*T.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));M("h"+K._id+"title",{avoid:{selection:r.select(t).selectAll("g."+K._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:A.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,n){var r,a=b();r=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:K,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:ot.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;ot.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,n||{}))}function k(){var n=B+_.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(j=it.select("text"),j.node()&&!j.classed("js-placeholder")){var r,a=it.select(".h"+K._id+"title-math-group").node();r=a&&["top","bottom"].indexOf(_.titleside)!==-1?h.bBox(a).width:h.bBox(it.node()).right-Z-T.l,n=Math.max(n,r)}var o=2*_.xpad+n+_.borderwidth+_.outlinewidth/2,l=Q-$;ot.select(".cbbg").attr({x:Z-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-U,width:Math.max(o,2),height:Math.max(l+2*U,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),ot.selectAll(".cboutline").attr({x:Z,y:$+_.ypad+("top"===_.titleside?lt:0),width:Math.max(B,2),height:Math.max(l-2*_.ypad-lt,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var s=({center:.5,right:1}[_.xanchor]||0)*o;ot.attr("transform","translate("+(T.l-s)+","+T.t+")"),i.autoMargin(t,e,{x:_.x,y:_.y,l:o*({right:1,center:.5}[_.xanchor]||0),r:o*({left:1,center:.5}[_.xanchor]||0),t:l*({bottom:1,middle:.5}[_.yanchor]||0),b:l*({top:1,middle:.5}[_.yanchor]||0)})}var A=t._fullLayout,T=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var L,C=r.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],z=[],O="function"==typeof _.line.color?_.line.color:function(){return _.line.color},N="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},P=_.levels.end+_.levels.size/100,E=_.levels.size,D=1.001*C[0]-.001*C[1],R=1.001*C[1]-.001*C[0];for(L=_.levels.start;(L-P)*E<0;L+=E)L>D&&LC[0]&&L1){var at=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));et*=at*u.roundUp(rt/at,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+X,W+V-X],K.setScale();var ot=A._infolayer.selectAll("g."+e).data([0]);ot.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),ot.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var it=ot.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");K._axislayer=ot.select(".cbaxis");var lt=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var st,ct=T.l+(_.x+G)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-X))*T.h+T.t+3+.75*ut:(1-(W+X))*T.h+T.t-3-.25*ut,M(K._id+"title",{attributes:{x:ct,y:st,"text-anchor":"start"}})}var ft=u.syncOrAsync([i.previousPromises,w,i.previousPromises,k],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var dt,ht,pt;c.init({element:ot.node(),prepFn:function(){dt=ot.attr("transform"),d(ot)},moveFn:function(t,e){ot.attr("transform",dt+" translate("+t+","+e+")"),ht=c.align(Y+t/T.w,q,0,1,_.xanchor),pt=c.align(W-e/T.h,V,0,1,_.yanchor);var n=c.getCursor(ht,pt,_.xanchor,_.yanchor);d(ot,n)},doneFn:function(e){d(ot),e&&void 0!==ht&&void 0!==pt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":pt},b().index)}})}return ft}function b(){var n,r,a=e.substr(2);for(n=0;n=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":120,"./flip_scale":36,"./scales":43}],32:[function(t,e,n){"use strict";var r=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},r.colorscale,{}),cauto:a({},r.zauto,{}),cmax:a({},r.zmax,{}),cmin:a({},r.zmin,{}),autocolorscale:a({},r.autocolorscale,{}),reversescale:a({},r.reversescale,{})}}},{"../../lib/extend":115,"./attributes":30,"./scales.js":43}],33:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":43}],34:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,n,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,m=p[d+"min"],v=p[d+"max"],y=p.colorscale,x=r(m)&&r(v)&&m=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],37:[function(t,e,n){"use strict";var r=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=a),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":33,"./is_valid_scale_array":41,"./scales":43}],38:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?a.nestedProperty(t,e).get()||{}:t,i=n.color,l=!1;if(Array.isArray(i))for(var s=0;s4/3-l?i:l}},{}],45:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":120}],46:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=r},{"../../lib":120,"../../plotly":143,"../../plots/cartesian/constants":153,"./align":44,"./cursor":45,"./unhover":47}],47:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":114}],48:[function(t,e,n){"use strict";function r(t,e,n,r,a,o,i){if(l.traceIs(n,"symbols")){var c=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(n)?c(t.ms):(o.size||6)/2,t.mrc=e;var r=g.symbolNumber(t.mx||o.symbol)||0,a=r%100;return t.om=r%200>=100,g.symbolFuncs[a](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=r(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,n,r){var a=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(s.fill,r)},g.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},g.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},g.setRect=function(t,e,n,r,a){t.call(g.setPosition,e,n).call(g.setSize,r,a)},g.translatePoint=function(t,e,n,r){var a=t.xp||n.c2p(t.x),o=t.yp||r.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,n,r){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,n,r)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,n){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},g.singleLineStyle=function(t,e,n,r,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=n||o.width||0,l=a||o.dash||"";s.stroke(e,r||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=r||a.dash||"";o.select(this).call(s.stroke,n||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=o.select(this);try{n.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),n.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,n){var a=n.marker,o=a.line,i=g.tryColorscale(a,""),l=g.tryColorscale(a,"line");r(t,e,n,i,l,a,o)},g.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=g.tryColorscale(n,""),a=g.tryColorscale(n,"line");t.each(function(t){g.singlePointStyle(t,o.select(this),e,r,a)})}},g.tryColorscale=function(t,e){var n=e?u.nestedProperty(t,e).get():t,r=n.colorscale,a=n.color;return r&&Array.isArray(a)?c.makeColorScaleFunc(c.extractScale(r,n.cmin,n.cmax)):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var n=o.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,n.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(f.convertToTspans);var d=o.select(this.parentNode),h=n.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,m=x[s]*u,v=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+m+","+v+")"),p>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],o=[];for(n=1;n=A&&(o.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=o.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":107,"../../lib":120,"../../lib/svg_text_utils":132,"../../registry":192,"../../traces/scatter/make_bubble_size_func":224,"../../traces/scatter/subtypes":229,"../color":25,"../colorscale":39,"./symbol_defs":49,d3:8,"fast-isnumeric":11}],49:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2); return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:8}],50:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],51:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&["linear","log"].indexOf(n.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var m=g.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(n.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=r(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");l=!m.size(),l?m=e.append("path").classed("yerror",!0):u&&(m=m.transition().duration(n.duration).ease(n.easing)),m.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var v=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-v)+"v"+2*v+"m0,-"+v+"H"+i.xs,i.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":229,d3:8,"fast-isnumeric":11}],56:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":25,d3:8}],57:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":153}],58:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,l,n,r)}var i=r("source"),s=r("visible",!!i);if(!s)return e;r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var c={_fullLayout:n},u=["x","y"],f=0;f<2;f++)o.coerceRef(t,e,c,u[f],"paper");return e}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("../../plots/array_container_defaults"),l=t("./attributes"),s="images";e.exports=function(t,e){var n={name:s,handleItemDefaults:r};i(t,e,n)}},{"../../lib":120,"../../plots/array_container_defaults":145,"../../plots/cartesian/axes":148,"./attributes":57}],59:[function(t,e,n){"use strict";var r=t("d3"),a=t("../drawing"),o=t("../../plots/cartesian/axes"),i=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var n=r.select(this);if(!this.img||this.img.src!==e.source){n.attr("xmlns",i.svg);var a=new Promise(function(t){function r(){n.remove(),t()}var a=new Image;this.img=a,a.setAttribute("crossOrigin","anonymous"),a.onerror=r,a.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var r=t.toDataURL("image/png");n.attr("xlink:href",r)},n.on("error",r),n.on("load",t),a.src=e.source}.bind(this));t._promises.push(a)}}function n(e){var n=r.select(this),i=o.getFromId(t,e.xref),s=o.getFromId(t,e.yref),c=l._size,u=i?Math.abs(i.l2p(e.sizex)-i.l2p(0)):e.sizex*c.w,f=s?Math.abs(s.l2p(e.sizey)-s.l2p(0)):e.sizey*c.h,d=u*h.x[e.xanchor].offset,p=f*h.y[e.yanchor].offset,g=h.x[e.xanchor].sizing+h.y[e.yanchor].sizing,m=(i?i.r2p(e.x)+i._offset:e.x*c.w+c.l)+d,v=(s?s.r2p(e.y)+s._offset:c.h-e.y*c.h+c.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}n.attr({x:m,y:v,width:u,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=i?i._id:"",x=s?s._id:"",b=y+x;b&&n.call(a.setClipUrl,"clip"+l._uid+b)}for(var l=t._fullLayout,s=[],c=[],u=[],f=0;f=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],62:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":115,"../../plots/font_attributes":168,"../color/attributes":24}],63:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],64:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":120,"../../plots/layout_attributes":182,"../../registry":192,"./attributes":62,"./helpers":67}],65:[function(t,e,n){"use strict";function r(t,e){function n(n){v.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,v=Math.max(e.height,v)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,F,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,_=n.showlegend&&x(t.calcdata,v),M=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=k.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=k.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=k.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var S=L.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var z=S.selectAll("g.traces").data(f.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==k.enter().size();O&&(i(t,S,z),l(t));var N=0,P=n.width,E=0,D=n.height;i(t,S,z),v.height>D?s(t):l(t);var R=n._size,j=R.l+R.w*v.x,I=R.t+R.h*(1-v.y);w.isRightAnchor(v)?j-=v.width:w.isCenterAnchor(v)&&(j-=v.width/2),w.isBottomAnchor(v)?I-=v.height:w.isMiddleAnchor(v)&&(I-=v.height/2);var F=v.width,B=R.w;F>B?(j=R.l,F=B):(j+F>P&&(j=P-F),jH?(I=R.t,q=H):(I+q>D&&(I=D-q),In[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":120,"../../registry":192,"../../traces/pie/style_one":207,"../../traces/scatter/subtypes":229,"../color":25,"../drawing":48,d3:8}],70:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||v||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(m,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":120,"../color":25,"./attributes":74,"./button_attributes":75,"./constants":76}],78:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},a=S.line.width?S.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",S.opacity).call(_.stroke,a).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);z&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&f(t,o,S,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof n&&n?s[n]=r:x.isPlainObject(n)&&(s=n);var c=Object.keys(s);for(o=0;oX&&r>Z&&!t.shiftKey?M.getCursor(a/n,1-o/r):"move";k(e,i),U=i.split("-")[0]}function o(e){F=b.getFromId(t,n.xref),B=b.getFromId(t,n.yref),q=T.getDataToPixel(t,F),H=T.getDataToPixel(t,B,!0),V=T.getPixelToData(t,F),G=T.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(j=n.path,I=o+".path"):(u=q(n.x0),f=H(n.y0),d=q(n.x1),h=H(n.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uZ&&(c[S]=n[P]=G(l),c[z]=n[E]=G(s)),f-u>X&&(c[O]=n[D]=V(u),c[N]=n[R]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,v,x,_,w,A,L,C,S,z,O,N,P,E,D,R,j,I,F,B,q,H,V,G,U,X=10,Z=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();M.init(Y)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),M=t("../dragelement"),k=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults");e.exports={ -draw:r,drawOne:a}},{"../../lib":120,"../../lib/setcursor":130,"../../plotly":143,"../../plots/cartesian/axes":148,"../color":25,"../dragelement":46,"../drawing":48,"./constants":88,"./defaults":89,"./helpers":91,"./shape_defaults":93,"fast-isnumeric":11}],91:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],92:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":86,"./calc_autorange":87,"./defaults":89,"./draw":90}],93:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],m={_fullLayout:n},v=a.coerceRef(t,e,m,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==v?(y=a.getFromId(m,v),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=r.identity;var M=g+"0",k=g+"1",A=t[M],T=t[k];t[M]=x(t[M],!0),t[k]=x(t[k],!0),a.coercePosition(e,m,c,v,M,_),a.coercePosition(e,m,c,v,k,w),e[M]=b(e[M]),e[k]=b(e[k]),t[M]=A,t[k]=T}}return"path"===d?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":120,"../../plots/cartesian/axes":148,"./attributes":86,"./helpers":91}],94:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":115,"../../plots/animation_attributes":144,"../../plots/font_attributes":168,"../../plots/pad_attributes":183,"./constants":95}],95:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],96:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+S.railTouchRectClass).data([0]);r.enter().append("rect").classed(S.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,S.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),k.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+S.railRectClass).data([0]);n.enter().append("rect").classed(S.railRectClass,!0);var r=e.inputAreaLength-2*S.railInset;n.attr({width:r,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(n,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+S.groupClassName).data(n,a);s.enter().append("g").classed(S.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,S=O,M._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,M=t._fullLayout,k=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(S).attr("class",e),z.attr({"data-unformatted":S}).call(f);var O="Click to enter "+y+" title";t._context.editable?(S||p(),z.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",C)}},{"../../lib":120,"../../lib/svg_text_utils":132,"../../plotly":143,"../../plots/plots":184,"../color":25,"../drawing":48,d3:8,"fast-isnumeric":11}],100:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":115,"../../plots/font_attributes":168,"../../plots/pad_attributes":183,"../color/attributes":24}],101:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],102:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],107:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],108:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":23,"./components/images":60,"./components/legend":68,"./components/rangeselector":80,"./components/rangeslider":85,"./components/shapes":92,"./components/sliders":98,"./components/updatemenus":104,"./fonts/mathjax_config":109,"./lib/queue":128,"./plot_api/plot_schema":137,"./plot_api/register":138,"./plot_api/set_plot_config":139,"./plot_api/to_image":141,"./plot_api/validate":142,"./plotly":143,"./snapshot":197,"./snapshot/download":194,"./traces/scatter":219,d3:8,"es6-promise":9}],109:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],110:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){Array.isArray(t)&&(e[n]=t[r])}},{}],111:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":105,"fast-isnumeric":11}],112:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n); +draw:r,drawOne:a}},{"../../lib":120,"../../lib/setcursor":130,"../../plotly":143,"../../plots/cartesian/axes":148,"../color":25,"../dragelement":46,"../drawing":48,"./constants":88,"./defaults":89,"./helpers":91,"./shape_defaults":93,"fast-isnumeric":11}],91:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],92:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":86,"./calc_autorange":87,"./defaults":89,"./draw":90}],93:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],m={_fullLayout:n},v=a.coerceRef(t,e,m,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==v?(y=a.getFromId(m,v),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=r.identity;var M=g+"0",k=g+"1",A=t[M],T=t[k];t[M]=x(t[M],!0),t[k]=x(t[k],!0),a.coercePosition(e,m,c,v,M,_),a.coercePosition(e,m,c,v,k,w),e[M]=b(e[M]),e[k]=b(e[k]),t[M]=A,t[k]=T}}return"path"===d?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":120,"../../plots/cartesian/axes":148,"./attributes":86,"./helpers":91}],94:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":115,"../../plots/animation_attributes":144,"../../plots/font_attributes":168,"../../plots/pad_attributes":183,"./constants":95}],95:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],96:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+S.railTouchRectClass).data([0]);r.enter().append("rect").classed(S.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,S.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),k.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+S.railRectClass).data([0]);n.enter().append("rect").classed(S.railRectClass,!0);var r=e.inputAreaLength-2*S.railInset;n.attr({width:r,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(n,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+S.groupClassName).data(n,a);s.enter().append("g").classed(S.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,S=O,M._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,M=t._fullLayout,k=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(S).attr("class",e),z.attr({"data-unformatted":S}).call(f);var O="Click to enter "+y+" title";t._context.editable?(S||p(),z.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",C)}},{"../../lib":120,"../../lib/svg_text_utils":132,"../../plotly":143,"../../plots/plots":184,"../color":25,"../drawing":48,d3:8,"fast-isnumeric":11}],100:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":115,"../../plots/font_attributes":168,"../../plots/pad_attributes":183,"../color/attributes":24}],101:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],102:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],107:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],108:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":23,"./components/images":60,"./components/legend":68,"./components/rangeselector":80,"./components/rangeslider":85,"./components/shapes":92,"./components/sliders":98,"./components/updatemenus":104,"./fonts/mathjax_config":109,"./lib/queue":128,"./plot_api/plot_schema":137,"./plot_api/register":138,"./plot_api/set_plot_config":139,"./plot_api/to_image":141,"./plot_api/validate":142,"./plotly":143,"./snapshot":197,"./snapshot/download":194,"./traces/scatter":219,d3:8,"es6-promise":9}],109:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],110:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){Array.isArray(t)&&(e[n]=t[r])}},{}],111:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":105,"fast-isnumeric":11}],112:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n); }else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(o(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,r,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var m=(new Date).getFullYear();e=((Number(c[0])-m+70)%100+200)%100+m-70}if(!o(e))return s;var v=new Date(0,0,1);if(v.setFullYear(u?e:-e),c.length>1){if(r=Number(c[1])-1,c[1].length>2||!(r>=0&&r<=11))return s;if(v.setMonth(r),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(v.setDate(a),v.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(v.setHours(i),v.getHours()!==i)return s;if(c.length>1)return a=v.getTime(),r=Number(c[1]),2===c[1].length&&r>=0&&r<=59?(a+=f*r,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return v.getTime()},h=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==s};var g=90*c,m=3*u,v=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var n=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(n),i=e0&&(r.push(a),a=[])}return r.push(a),r},n.makeLine=function(t,e){var n={};return n=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(n.trace=e),n},n.makePolygon=function(t,e){var n={};if(1===t.length)n={type:"Polygon",coordinates:t};else{for(var r=new Array(t.length),a=0;an?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"./clean_number":111,"./coerce":112,"./dates":113,"./extend":115,"./filter_unique":116,"./filter_visible":117,"./is_array":121,"./is_plain_object":122,"./loggers":123,"./matrix":124,"./nested_property":125,"./notifier":126,"./search":129,"./stats":131,d3:8}],121:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],122:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],123:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],i=!1,d(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");lo||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],s=t[1];if(no||sl)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],m=r[0][1],v=0;for(c=1;cMath.max(u,g)||s>Math.max(f,m)))if(su||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":124}],128:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;f90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":11}],132:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,m.indexOf(u.protocol)===-1?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||r(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{ regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":106,"../constants/xmlns_namespaces":107,"../lib":120,d3:8}],133:[function(t,e,n){"use strict";var r=e.exports={},a=t("../plots/geo/constants").locationmodeToLayer,o=t("topojson-client").feature;r.getTopojsonName=function(t){return[t.scope.replace(/ /g,"-"),"_",t.resolution.toString(),"m"].join("")},r.getTopojsonPath=function(t,e){return t+e+".json"},r.getTopojsonFeatures=function(t,e){var n=a[t.locationmode],r=e.objects[n];return o(e,r).features}},{"../plots/geo/constants":170,"topojson-client":15}],134:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function a(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var a=f.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=u.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&l(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sO.range[0]?[1,2]:[2,1]);else{var N=O.range[0],P=O.range[1];"log"===b?(N<=0&&P<=0&&n(L+".autorange",!0),N<=0?N=P/1e6:P<=0&&(P=N/1e6),n(L+".range[0]",Math.log(N)/Math.LN10),n(L+".range[1]",Math.log(P)/Math.LN10)):(n(L+".range[0]",Math.pow(10,N)),n(L+".range[1]",Math.pow(10,P)))}else n(L+".autorange",!0)}if("reverse"===A)C.range?C.range.reverse():(n(L+".autorange",!0),C.range=[1,0]),S.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var E=v.parts[1],D=v.parts[0],R=o[D]||[],j=R[E]||{};2===v.parts.length&&(null===b&&(e[m]="remove"),"add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?E===-1?(g[D]=R,delete g[m]):g[m]=j:x.log("???",e)),!r(j,"x")&&!r(j,"y")||x.containsAny(m,["color","opacity","align","dash"])||(h.docalc=!0);var I=w.getComponentMethod(D,"drawOne");I(t,E,v.parts.slice(2).join("."),e[m]),delete e[m]}else if(M.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])z.manageArrayContainers(v,b,g),h.doplot=!0;else{var F=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?h.doplot=!0:0===v.parts[0].indexOf("geo")?h.doplot=!0:0===v.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===m?h.doplot=!0:!i._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?h.docalc=!0:v.parts[0].indexOf("legend")!==-1?h.dolegend=!0:m.indexOf("title")!==-1?h.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(F,["tick","exponent","grid","zeroline"])?h.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:v.parts.length>1&&F.indexOf("line")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&"mirror"===F?h.doticks=h.dolayoutstyle=!0:"margin.pad"===m?h.doticks=h.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(h.doplot=!0):h.doplot=!0,v.set(b)}}}var B=t._fullLayout.width,q=t._fullLayout.height;M.supplyDefaults(t),t.layout.autosize&&M.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==q;return H&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];m.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(C.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var o=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=o.append("g").classed("imagelayer",!0),n._shapeUpperLayer=o.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),M=t("../plots/plots"),k=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),C=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),z=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,n,r){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=N._basePlotModules,n=0;n=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=z.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),n=M.supplyAnimationDefaults(n);var l=n.transition,s=n.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){if(0!==i._frameQueue.length){for(;i._frameQueue.length;){var e=i._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var l=0;li._timeToNext&&h()};e()}function g(t){return Array.isArray(l)?y>=l.length?t.transitionOpts=l[y]:t.transitionOpts=l[0]:t.transitionOpts=l,y++,t}var m,v,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),k=!_&&!w&&x.isPlainObject(e);if(k)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&LL)&&C.push(v);b=C}}b.length>0?f(b):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,n){if(t=z.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,a,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(r=e.length-1;r>=0;r--)u.push({frame:M.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:c+r});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(a=u[r].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=M.modifyFrames,s=M.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),M.modifyFrames(t,o)},y.purge=function(t){t=z.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return M.cleanPlot([],{},n,e),M.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":48,"../components/errorbars":54,"../constants/xmlns_namespaces":107,"../lib":120,"../lib/events":114,"../lib/queue":128,"../lib/svg_text_utils":132,"../plotly":143,"../plots/cartesian/graph_interact":155,"../plots/plots":184,"../plots/polar":187,"../registry":192,"./helpers":134,"./subroutines":140,d3:8,"fast-isnumeric":11}],136:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],137:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:y},n={}):(e=d.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,_(r,p),_(r,e.attributes),n.attributes&&_(r,n.attributes),r.type=t;var a={meta:e.meta||{},attributes:i(r)};if(e.layoutAttributes){var o={};_(o,e.layoutAttributes),a.layoutAttributes=i(o)}return a}function a(){var t={};return _(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var n=d.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)u(t,n,"xaxis"),u(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;u(t,n,r)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.layoutAttributes&&(Array.isArray(n.layoutNodes)?n.layoutNodes.forEach(function(e){f(t,n,e+n.name)}):f(t,n,n.name))}),{layoutAttributes:i(t)}}function o(t){var e=d.transformsRegistry[t];return{attributes:i(e.attributes)}}function i(t){return l(t),s(t),t}function l(t){function e(t){return{valType:"string"}}function r(t,r,a){n.isValObject(t)?"data_array"===t.valType?(t.role="data",a[r+"src"]=e(r)):t.arrayOk===!0&&(a[r+"src"]=e(r)):h.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function s(t){function e(t,e,n){if(t){var r=t[M];r&&(delete t[M],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function c(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function u(t,e,n){var r=h.nestedProperty(t,n),a=_({},e.layoutAttributes);a[w]=!0,r.set(a)}function f(t,e,n){var r=h.nestedProperty(t,n),a=_(r.get()||{},e.layoutAttributes);r.set(a)}var d=t("../registry"),h=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=h.extendFlat,_=h.extendDeep,w="_isSubplotObj",M="_isLinkedToArray",k="_deprecated",A=[w,M,k];n.IS_SUBPLOT_OBJ=w,n.IS_LINKED_TO_ARRAY=M,n.DEPRECATED=k,n.UNDERSCORE_ATTRS=A,n.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:h.valObjects,metaKeys:A.concat.role},traces:t,layout:a(),transforms:e,frames:i(m),animation:i(v)}},n.crawl=function(t,e,r){var a=r||0;Object.keys(t).forEach(function(r){var o=t[r];A.indexOf(r)===-1&&(e(o,r,t,a),n.isValObject(o)||h.isPlainObject(o)&&n.crawl(o,e,a+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,i,l){o=o.slice(0,l).concat([n]);var s="data_array"===e.valType||e.arrayOk===!0;if(s){var c=r(o),u=h.nestedProperty(t,c).get();Array.isArray(u)&&a.push(c)}}function r(t){return t.join(".")}var a=[],o=[];if(n.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":120,"../plotly":143,"../snapshot/cloneplot":193,"../snapshot/helpers":196,"../snapshot/svgtoimg":198,"../snapshot/tosvg":200,"fast-isnumeric":11}],142:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=n.length,v=0;vu&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=z&&a<=10||e>=15*z)t._tickround="d";else if(e>=N&&a<=16||e>=O)t._tickround="M";else if(e>=P&&a<=19||e>=N)t._tickround="S";else{var o=_.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var n=t.match(Y),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);n&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(r&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(n||(a="
"+H(u)),o=G(u)):(n||(a="
"+U(u)),o=X(u),"M"!==s?(o+=Z(u),"S"!==s&&(o+=d(y.round(v(l/1e3,1),4),t,"none",n).substr(1))):"d"===c&&(o=G(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=t<0,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},E.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var g=r-1,m=r+1;n="tozero"===t.rangemode?r<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n.map(t.l2r||Number)},E.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=E.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},E.saveRangeInitial=function(t,e){for(var n=E.list(t,"",!0),r=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),M=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},E.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},E.autoTicks(f,l);var d,h=E.tickIncrement(E.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=E.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=E.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fC?(e/=C,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,R)):r>S?(e/=S,t.dtick="M"+a(e,1,j)):r>z?(t.dtick=a(e,z,F),t.tick0="2000-01-02"):r>O?t.dtick=a(e,O,j):r>N?t.dtick=a(e,N,I):r>P?t.dtick=a(e,P,I):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,R))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,R)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,R));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},E.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?q:B,s=t+.01*r,c=_.roundUp(v(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},E.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]o:f1&&e2*r}function o(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("../../constants/numerical").BADNUM;e.exports=function(t){return a(t)?"date":o(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":105,"../../lib":120,"fast-isnumeric":11}],150:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var l=i(e,n,r);if(l){if("histogram"===l.type&&r==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,r)){for(var s,u=a(l),f=[],d=0;d0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],153:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],154:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?r:"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,n,l,_,w,M,k){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+mt+")").attr("d",ct+"Z"),ht=pt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+mt+")").attr("d","M0,0Z"),C()}function C(){pt.selectAll(".select-outline").remove()}function S(e,n){if(t._transitioningWithDuration)return!1;var r=Math.max(0,Math.min(V,e+ot)),a=Math.max(0,Math.min(G,n+it)),o=Math.abs(r-ot),i=Math.abs(a-it),l=Math.floor(Math.min(i,o,X)/2);lt.l=Math.min(ot,r),lt.r=Math.max(ot,r),lt.t=Math.min(it,a),lt.b=Math.max(it,a),!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function z(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),b=!1)))}function N(e,n){var a=1===(M+k).length;if(e)j();else if(2!==n||a){if(1===n&&a){var o=M?H[0]:q[0],i="s"===M||"w"===k?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",f="middle";if(o.fixedrange)return;M?(f="n"===M?"top":"bottom","right"===o.side&&(u="right")):"e"===k&&(u="right"),nt.call(d.makeEditable,null,{immediate:!0,background:F.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var n=o.d2r(e);void 0!==n&&c.relayout(t,l,n)})}}else R()}function P(e){function n(t,e,n){function r(e){return t.l2r(o+(e-o)*n)}if(!t.fixedrange){var a=t.range.map(t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(r)}}if(t._context.scrollZoom||F._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(T(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(yt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=vt[0]+vt[2]*s,u=(l.bottom-e.clientY)/l.height,d=vt[1]+vt[3]*(1-u);if(k){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,n){for(var r,o,i=1-e,l=0;l2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},E.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var g=r-1,m=r+1;n="tozero"===t.rangemode?r<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n.map(t.l2r||Number)},E.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=E.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},E.saveRangeInitial=function(t,e){for(var n=E.list(t,"",!0),r=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),M=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},E.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},E.autoTicks(f,l);var d,h=E.tickIncrement(E.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=E.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=E.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fC?(e/=C,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,R)):r>S?(e/=S,t.dtick="M"+a(e,1,j)):r>z?(t.dtick=a(e,z,F),t.tick0="2000-01-02"):r>O?t.dtick=a(e,O,j):r>N?t.dtick=a(e,N,I):r>P?t.dtick=a(e,P,I):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,R))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,R)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,R));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},E.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?q:B,s=t+.01*r,c=_.roundUp(v(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},E.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]o:f1&&e2*r}function o(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("../../constants/numerical").BADNUM;e.exports=function(t){return a(t)?"date":o(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":105,"../../lib":120,"fast-isnumeric":11}],150:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var l=i(e,n,r);if(l){if("histogram"===l.type&&r==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,r)){for(var s,u=a(l),f=[],d=0;d0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],153:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],154:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?r:"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,n,l,_,w,M,k){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+mt+")").attr("d",ct+"Z"),ht=pt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+mt+")").attr("d","M0,0Z"),C()}function C(){pt.selectAll(".select-outline").remove()}function S(e,n){if(t._transitioningWithDuration)return!1;var r=Math.max(0,Math.min(V,e+ot)),a=Math.max(0,Math.min(G,n+it)),o=Math.abs(r-ot),i=Math.abs(a-it),l=Math.floor(Math.min(i,o,X)/2);lt.l=Math.min(ot,r),lt.r=Math.max(ot,r),lt.t=Math.min(it,a),lt.b=Math.max(it,a),!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function z(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),b=!1)))}function N(e,n){var a=1===(M+k).length;if(e)j();else if(2!==n||a){if(1===n&&a){var o=M?H[0]:q[0],i="s"===M||"w"===k?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",f="middle";if(o.fixedrange)return;M?(f="n"===M?"top":"bottom","right"===o.side&&(u="right")):"e"===k&&(u="right"),nt.call(d.makeEditable,null,{immediate:!0,background:F.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var n=o.d2r(e);void 0!==n&&c.relayout(t,l,n)})}}else R()}function P(e){function n(t,e,n){function r(e){return t.l2r(o+(e-o)*n)}if(!t.fixedrange){var a=t.range.map(t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(r)}}if(t._context.scrollZoom||F._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(T(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(yt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=vt[0]+vt[2]*s,u=(l.bottom-e.clientY)/l.height,d=vt[1]+vt[3]*(1-u);if(k){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,n){for(var r,o,i=1-e,l=0;l0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rY.width||Z<0||Z>Y.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:k[0]._length/2,Z="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?r(o,e.xval):a(k,X),N="yval"in e?r(o,e.yval):a(A,Z),!g(O[0])||!g(N[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(E=0;E1||R.hoverinfo.indexOf("name")!==-1?R.name:void 0,index:!1,distance:Math.min(W,M.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[j]&&(H.subplot=i[j]._subplot),V=G.length,"array"===F){var Q=e[E];"pointNumber"in Q?(H.index=Q.pointNumber,F="closest"):(F="","xval"in Q&&(B=Q.xval,F="x"),"yval"in Q&&(q=Q.yval,F=F?"closest":"y"))}else B=O[I],q=N[I];if(R._module&&R._module.hoverPoints){var $=R._module.hoverPoints(H,B,q,F);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&G.push(s(J,z))}else m.log("Unrecognized trace type in hover:",R);"closest"===z&&G.length>V&&(G.splice(0,V),W=G[0].distance)}if(0===G.length)return _.unhoverRaw(t,e);var tt="y"===z&&U.length>1;G.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),nt={hovermode:z,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},rt=c(G,nt);u(G,tt?"xa":"ya"),f(rt,tt);var at=t._hoverdata,ot=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),m=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),m=d.node().getBoundingClientRect().width+2*P):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var v,M,T=f.node().getBoundingClientRect(),C=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),E=T.width+N+P+m;t.ty0=_-T.top,t.bx=T.width+2*P,t.by=T.height+2*P,t.anchor="start",t.txwidth=T.width,t.tx2width=m,t.offset=0,o?(t.pos=C,v=S+O/2+E<=k,M=S-O/2-E>=0,"top"!==t.idealAlign&&v||!M?v?(S+=O/2,t.anchor="start"):t.anchor="middle":(S-=O/2,t.anchor="end")):(t.pos=S,v=C+z/2+E<=w,M=C-z/2-E>=0,"left"!==t.idealAlign&&v||!M?v?(C+=z/2,t.anchor="start"):t.anchor="middle":(C-=z/2,t.anchor="end")),f.attr("text-anchor",t.anchor),m&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+C+","+S+")"+(o?"rotate("+L+")":""))}),S}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?S:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var m=f[i];for(l=m.length-1;l>=0;l--){var v=m[l],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(N+P),l=i+o*(t.txwidth+P),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-O,s=t.offset*z),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*N+s)+","+(N+c)+"v"+(t.by/2-N)+"h"+r*t.bx+"v-"+t.by+"H"+(r*N+s)+"V"+(c-N)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*P+s,c+t.ty0-t.by/2+P),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),k=t("./dragbox"),A=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,n){function r(n,r){return m.coerce(t,e,A,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=T.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},T.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+M.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},T.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},T.getClosest=function(t,e,n){if(n.index!==!1)n.index>=0&&n.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":120,"fast-isnumeric":11}],161:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-m.left,b=n-m.top,_=x,w=b,M="M"+x+","+b,k=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),C=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",M+"Z");var z,O,N,P,E,D=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),R=[],j=a.gd,I=[];for(z=0;z0)return Math.log(e)/Math.LN10;if(e<=0&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*f*Math.abs(r-a))}return s}function n(t){return Math.pow(10,t)}function i(t){return a(t)?(t=Number(t),t<-l||t>l?s:a(t)?Number(t):s):s}var f=10;t.c2l="log"===t.type?e:i,t.l2c="log"===t.type?n:i,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var n,r,i=t[e],s=(t._id||"x").charAt(0);if(r="date"===t.type?c.DFLTRANGEDATE:"y"===s?c.DFLTRANGEY:c.DFLTRANGEX,r=r.slice(),!i||2!==i.length)return void(t[e]=r);for("date"===t.type&&(i[0]=o.cleanDate(i[0]),i[1]=o.cleanDate(i[1])),n=0;n<2;n++)if("date"===t.type){if(!o.isDateTime(i[n])){t[e]=r;break}if(i[n]o.MAX_MS&&(i[n]=o.MAX_MS),t.r2l(i[0])===t.r2l(i[1])){var u=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(u-1e3),i[1]=t.l2r(u+1e3);break}}else{if(!a(i[n])){if(!a(i[1-n])){t[e]=r;break}i[n]=i[1-n]*(n?10:.1)}if(i[n]<-l?i[n]=-l:i[n]>l&&(i[n]=l),i[0]===i[1]){var f=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=f,i[1]+=f}}},t.fraction2r=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return t.l2r(n+e*(r-n))},t.r2fraction=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return(t.r2l(e)-n)/(r-n)},t.setScale=function(e){var n=t._gd._fullLayout._size,r=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var a=u.getFromId(t._gd,t.overlaying);t.domain=a.domain}var i=e&&t._r?"_r":"range";t.cleanRange(i);var l=t.r2l(t[i][0]),s=t.r2l(t[i][1]);if("y"===r?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s):(t._offset=n.l+t.domain[0]*n.w, t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):s},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,n){return t.l2p(t.r2l(e,n))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=i,t.d2c=o.cleanNumber,"log"===t.type?(t.d2l=function(e,n){return t.c2l(t.d2c(e),n)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=o.cleanNumber,t.d2r=o.cleanNumber,t.r2d=i),t.r2l=i,t.l2r=i):"date"===t.type?(t.c2d=o.ms2DateTime,t.d2c=function(t){var e=o.dateTime2ms(t);if(e===s){if(!a(t))return s;e=Number(t)}return o.constrain(e,o.MIN_MS,o.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=o.identity,t.r2d=o.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var n=t._categories.indexOf(e);return n===-1?s:n},t.d2l=t.d2c,t.r2l=i,t.l2r=i,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;o0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var f=u.charAt(0),d=u.substr(1);d=r(d)?Number(d):0,(d<=0||!("date"===i&&"M"===f&&d===Math.round(d)||"log"===i&&"L"===f||"log"===i&&"D"===f&&(1===d||2===d)))&&(e.dtick=c)}var h="date"===i?"2000-01-01":0,p=n("tick0",h);"date"===i?e.tick0=a.cleanDate(p,h):r(p)&&"D1"!==u&&"D2"!==u?e.tick0=Number(p):e.tick0=h}else{var g=n("tickvals");void 0===g?e.tickmode="auto":n("ticktext")}}},{"../../constants/numerical":105,"../../lib":120,"fast-isnumeric":11}],166:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../lib"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,n,c){function u(t){var e,n,r,a,o,i={};for(e in t)if(n=e.split("."),r=n[0].match(s)){var l=r[1],c=l+"axis";if(a=y[c],o={},Array.isArray(t[e])?o.to=t[e].slice(0):Array.isArray(t[e].range)&&(o.to=t[e].range.slice(0)),!o.to)continue;o.axisName=c,o.length=a._length,x.push(l),i[l]=o}return i}function f(t,e,n){var r,a,o,i=t._plots,l=[];for(r in i){var s=i[r];if(l.indexOf(s)===-1){var c=s.xaxis._id,u=s.yaxis._id,f=s.xaxis.range,d=s.yaxis.range;s.xaxis._r=s.xaxis.range.slice(),s.yaxis._r=s.yaxis.range.slice(),a=n[c]?n[c].to:f,o=n[u]?n[u].to:d,f[0]===a[0]&&f[1]===a[1]&&d[0]===o[0]&&d[1]===o[1]||e.indexOf(c)===-1&&e.indexOf(u)===-1||l.push(s)}}return l}function d(e,n){function r(e,n){for(a=0;an.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var M;c&&(M=c());var k,A,T,L=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),k=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":120,"../../plotly":143,"../../registry":192,"./axes":148,d3:8}],167:[function(t,e,n){"use strict";function r(t,e,n){var r,a,o,i=!1;if("data"===e.type)r=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;r=t._fullLayout}return a=c.nestedProperty(r,e.prop).get(),o=n[e.type]=n[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var n=[],r=e[0],a={};if("string"==typeof r)a[r]=e[1];else{if(!c.isPlainObject(r))return n;a=r}return l(a,function(t,e,r){n.push({type:"layout",prop:t,value:r})},"",0),n}function i(t,e){var n,r,a,o,i=[];if(r=e[0],a=e[1],n=e[2],o={},"string"==typeof r)o[r]=a;else{if(!c.isPlainObject(r))return i;o=r,void 0===n&&(n=a)}return void 0===n&&(n=null),l(o,function(e,r,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);n&&(l=Math.min(l,n.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,r+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");n.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=n.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){r(t,s,i.cache),i.check=function(){if(l){var e=r(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;fa},M.render=function(){function t(t){var e=n.projection(t.lonlat);return e?"translate("+e[0]+","+e[1]+")":null}function e(t){return n.isLonLatOverEdges(t.lonlat)?"0":"1.0"}var n=this,r=n.framework,a=r.select("g.choroplethlayer"),o=r.select("g.scattergeolayer"),i=n.path;r.selectAll("path.basepath").attr("d",i),r.selectAll("path.graticulepath").attr("d",i),a.selectAll("path.choroplethlocation").attr("d",i),a.selectAll("path.basepath").attr("d",i),o.selectAll("path.js-line").attr("d",i),null!==n.clipAngle?(o.selectAll("path.point").style("opacity",e).attr("transform",t),o.selectAll("text").style("opacity",e).attr("transform",t)):(o.selectAll("path.point").attr("transform",t),o.selectAll("text").attr("transform",t))}},{"../../components/color":25,"../../components/drawing":48,"../../constants/xmlns_namespaces":107,"../../lib/topojson_utils":133,"../../plots/cartesian/axes":148,"../../plots/cartesian/graph_interact":155,"./constants":170,"./projections":178,"./set_scale":179,"./zoom":180,"./zoom_reset":181,d3:8,"topojson-client":15}],172:[function(t,e,n){"use strict";function r(t,e){for(var n=[],r=0;rr^h>r&&n<(d-c)*(r-u)/(h-u)+c&&(a=!a)}return a}function i(t){return t?t/Math.sin(t):1}function l(t){return t>1?N:t<-1?-N:Math.asin(t)}function s(t){return t>1?0:t<-1?O:Math.acos(t)}function c(t,e){var n=(2+N)*Math.sin(e);e/=2;for(var r=0,a=1/0;r<10&&Math.abs(a)>S;r++){var o=Math.cos(e);e-=a=(e+Math.sin(e)*(o+2)-n)/(2*o*(1+o))}return[2/Math.sqrt(O*(4+O))*t*(1+Math.cos(e)),2*Math.sqrt(O/(4+O))*Math.sin(e)]}function u(t,e){function n(n,r){var a=j(n/e,r);return a[0]*=t,a}return arguments.length<2&&(e=t),1===e?j:e===1/0?d:(n.invert=function(n,r){var a=j.invert(n/t,r);return a[0]*=e,a},n)}function f(){var t=2,e=R(u),n=e(t);return n.coefficient=function(n){return arguments.length?e(t=+n):t},n}function d(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function h(t,e){return[3*t/(2*O)*Math.sqrt(O*O/3-e*e),e]}function p(t,e){return[t,1.25*Math.log(Math.tan(O/4+.4*e))]}function g(t){return function(e){var n,r=t*Math.sin(e),a=30;do e-=n=(e+Math.sin(e)-r)/(1+Math.cos(e));while(Math.abs(n)>S&&--a>0);return e/2}}function m(t,e,n){function r(n,r){return[t*n*Math.cos(r=a(r)),e*Math.sin(r)]}var a=g(n);return r.invert=function(r,a){var o=l(a/e);return[r/(t*Math.cos(o)),l((2*o+Math.sin(2*o))/n)]},r}function v(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),e*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}function y(t,e){var n,r=Math.min(18,36*Math.abs(e)/O),a=Math.floor(r),o=r-a,i=(n=F[a])[0],l=n[1],s=(n=F[++a])[0],c=n[1],u=(n=F[Math.min(19,++a)])[0],f=n[1];return[t*(s+o*(u-i)/2+o*o*(u-2*s+i)/2),(e>0?N:-N)*(c+o*(f-l)/2+o*o*(f-2*c+l)/2)]}function x(t,e){return[t*Math.cos(e),e]}function b(t,e){var n=Math.cos(e),r=i(s(n*Math.cos(t/=2)));return[2*n*Math.sin(t)*r,Math.sin(e)*r]}function _(t,e){var n=b(t,e);return[(n[0]+t/N)/2,(n[1]+e)/2]}t.geo.project=function(t,e){var r=e.stream;if(!r)throw new Error("not yet supported");return(t&&w.hasOwnProperty(t.type)?w[t.type]:n)(t,r)};var w={Feature:e,FeatureCollection:function(t,n){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,n)})}}},M=[],k=[],A={point:function(t,e){M.push([t,e])},result:function(){var t=M.length?M.length<2?{type:"Point",coordinates:M[0]}:{type:"MultiPoint",coordinates:M}:null;return M=[],t}},T={lineStart:r,point:function(t,e){M.push([t,e])},lineEnd:function(){M.length&&(k.push(M),M=[])},result:function(){var t=k.length?k.length<2?{type:"LineString",coordinates:k[0]}:{type:"MultiLineString",coordinates:k}:null;return k=[],t}},L={polygonStart:r,lineStart:r,point:function(t,e){M.push([t,e])},lineEnd:function(){var t=M.length;if(t){do M.push(M[0].slice());while(++t<4);k.push(M),M=[]}},polygonEnd:r,result:function(){if(!k.length)return null;var t=[],e=[];return k.forEach(function(n){a(n)?t.push([n]):e.push(n)}),e.forEach(function(e){var n=e[0];t.some(function(t){if(o(t[0],n))return t.push(e),!0})||t.push([e])}),k=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},C={Point:A,MultiPoint:A,LineString:T,MultiLineString:T,Polygon:L,MultiPolygon:L,Sphere:L},S=1e-6,z=S*S,O=Math.PI,N=O/2,P=(Math.sqrt(O),O/180),E=180/O,D=t.geo.projection,R=t.geo.projectionMutator;t.geo.interrupt=function(e){function n(t,n){for(var r=n<0?-1:1,a=s[+(n<0)],o=0,i=a.length-1;oa[o][2][0];++o);var l=e(t-a[o][1][0],n);return l[0]+=e(a[o][1][0],r*n>r*a[o][0][1]?a[o][0][1]:n)[0],l}function r(){l=s.map(function(t){return t.map(function(t){var n,r=e(t[0][0],t[0][1])[0],a=e(t[2][0],t[2][1])[0],o=e(t[1][0],t[0][1])[1],i=e(t[1][0],t[1][1])[1];return o>i&&(n=o,o=i,i=n),[[r,o],[a,i]]})})}function a(){for(var e=1e-6,n=[],r=0,a=s[0].length;r=0;--r){var i=s[1][r],l=180*i[0][0]/O,c=180*i[0][1]/O,u=180*i[1][1]/O,f=180*i[2][0]/O,d=180*i[2][1]/O;n.push(o([[f-e,d-e],[f-e,u+e],[l+e,u+e],[l+e,c-e]],30))}return{type:"Polygon",coordinates:[t.merge(n)]}}function o(t,e){for(var n,r,a,o=-1,i=t.length,l=t[0],s=[];++oS&&--a>0);return[t/(.8707+(o=r*r)*(-.131979+o*(-.013791+o*o*o*(.003971-.001529*o)))),r]},(t.geo.naturalEarth=function(){return D(v)}).raw=v;var F=[[.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]];F.forEach(function(t){t[1]*=1.0144}),y.invert=function(t,e){var n=e/N,r=90*n,a=Math.min(18,Math.abs(r/5)),o=Math.max(0,Math.floor(a));do{var i=F[o][1],l=F[o+1][1],s=F[Math.min(19,o+2)][1],c=s-i,u=s-2*l+i,f=2*(Math.abs(n)-l)/c,d=u/c,h=f*(1-d*f*(1-2*d*f));if(h>=0||1===o){r=(e>=0?5:-5)*(h+a);var p,g=50;do a=Math.min(18,Math.abs(r)/5),o=Math.floor(a),h=a-o,i=F[o][1],l=F[o+1][1],s=F[Math.min(19,o+2)][1],r-=(p=(e>=0?N:-N)*(l+h*(s-i)/2+h*h*(s-2*l+i)/2)-e)*E;while(Math.abs(p)>z&&--g>0);break}}while(--o>=0);var m=F[o][0],v=F[o+1][0],y=F[Math.min(19,o+2)][0];return[t/(v+h*(y-m)/2+h*h*(y-2*v+m)/2),r*P]},(t.geo.robinson=function(){return D(y)}).raw=y,x.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return D(x)}).raw=x,b.invert=function(t,e){if(!(t*t+4*e*e>O*O+S)){var n=t,r=e,a=25;do{var o,i=Math.sin(n),l=Math.sin(n/2),c=Math.cos(n/2),u=Math.sin(r),f=Math.cos(r),d=Math.sin(2*r),h=u*u,p=f*f,g=l*l,m=1-p*c*c,v=m?s(f*c)*Math.sqrt(o=1/m):o=0,y=2*v*f*l-t,x=v*u-e,b=o*(p*g+v*f*c*h),_=o*(.5*i*d-2*v*u*l),w=.25*o*(d*l-v*u*p*i),M=o*(h*c+v*g*f),k=_*w-M*b;if(!k)break;var A=(x*_-y*M)/k,T=(y*w-x*b)/k;n-=A,r-=T}while((Math.abs(A)>S||Math.abs(T)>S)&&--a>0);return[n,r]}},(t.geo.aitoff=function(){return D(b)}).raw=b,_.invert=function(t,e){var n=t,r=e,a=25;do{var o,i=Math.cos(r),l=Math.sin(r),c=Math.sin(2*r),u=l*l,f=i*i,d=Math.sin(n),h=Math.cos(n/2),p=Math.sin(n/2),g=p*p,m=1-f*h*h,v=m?s(i*h)*Math.sqrt(o=1/m):o=0,y=.5*(2*v*i*p+n/N)-t,x=.5*(v*l+r)-e,b=.5*o*(f*g+v*i*h*u)+.5/N,_=o*(d*c/4-v*l*p),w=.125*o*(c*p-v*l*f*d),M=.5*o*(u*h+v*g*i)+.5,k=_*w-M*b,A=(x*_-y*M)/k,T=(y*w-x*b)/k;n-=A,r-=T}while((Math.abs(A)>S||Math.abs(T)>S)&&--a>0);return[n,r]},(t.geo.winkel3=function(){return D(_)}).raw=_}e.exports=r},{}],179:[function(t,e,n){"use strict";function r(t,e){var n=t.projection,r=t.lonaxis,i=t.lataxis,s=t.domain,c=t.framewidth||0,u=e.w*(s.x[1]-s.x[0]),f=e.h*(s.y[1]-s.y[0]),d=r.range[0]+l,h=r.range[1]-l,p=i.range[0]+l,g=i.range[1]-l,m=r._fullRange[0]+l,v=r._fullRange[1]-l,y=i._fullRange[0]+l,x=i._fullRange[1]-l;n._translate0=[e.l+u/2,e.t+f/2];var b=h-d,_=g-p,w=[d+b/2,p+_/2],M=n._rotate;n._center=[w[0]+M[0],w[1]+M[1]];var k=function(e){function r(t){return Math.min(_*u/(t[1][0]-t[0][0]),_*f/(t[1][1]-t[0][1]))}var i,l,s,b,_=e.scale(),w=n._translate0,M=a(d,p,h,g),k=a(m,y,v,x);s=o(e,M),i=r(s),b=o(e,k),n._fullScale=r(b),e.scale(i),s=o(e,M),l=[w[0]-s[0][0]+c,w[1]-s[0][1]+c],n._translate=l,e.translate(l),s=o(e,M),t._isAlbersUsa||e.clipExtent(s),i=n.scale*i,n._scale=i,t._width=Math.round(s[1][0])+c,t._height=Math.round(s[1][1])+c,t._marginX=(u-Math.round(s[1][0]))/2,t._marginY=(f-Math.round(s[1][1]))/2};return k}function a(t,e,n,r){var a=(n-t)/4;return{type:"Polygon",coordinates:[[[t,e],[t,r],[t+a,r],[t+2*a,r],[t+3*a,r],[n,r],[n,e],[n-a,e],[n-2*a,e],[n-3*a,e],[t,e]]]}}function o(t,e){return i.geo.path().projection(t).bounds(e)}var i=t("d3"),l=t("./constants").clipPad;e.exports=r},{"./constants":170,d3:8}],180:[function(t,e,n){"use strict";function r(t,e){var n;return(n=e._isScoped?o:e._clipAngle?l:i)(t,e.projection)}function a(t,e){var n=e._fullScale;return _.behavior.zoom().translate(t.translate()).scale(t.scale()).scaleExtent([.5*n,100*n])}function o(t,e){function n(){_.select(this).style(k)}function r(){i.scale(_.event.scale).translate(_.event.translate),t.render()}function o(){_.select(this).style(A)}var i=t.projection,l=a(i,e);return l.on("zoomstart",n).on("zoom",r).on("zoomend",o),l}function i(t,e){function n(t){return m.invert(t)}function r(t){var e=m(n(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function o(){_.select(this).style(k),s=_.mouse(this),c=m.rotate(),u=m.translate(),f=c,d=n(s)}function i(){return h=_.mouse(this),r(s)?(v.scale(m.scale()),void v.translate(m.translate())):(m.scale(_.event.scale),m.translate([u[0],_.event.translate[1]]),d?n(h)&&(g=n(h),p=[f[0]+(g[0]-d[0]),c[1],c[2]],m.rotate(p),f=p):(s=h,d=n(s)),void t.render())}function l(){_.select(this).style(A)}var s,c,u,f,d,h,p,g,m=t.projection,v=a(m,e),y=2;return v.on("zoomstart",o).on("zoom",i).on("zoomend",l),v}function l(t,e){function n(t){v++||t({type:"zoomstart"})}function r(t){t({type:"zoom"})}function o(t){--v||t({type:"zoomend"})}var i,l=t.projection,h={r:l.rotate(),k:l.scale()},p=a(l,e),g=b(p,"zoomstart","zoom","zoomend"),v=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(k);var t=_.mouse(this),e=l.rotate(),a=e,o=l.translate(),v=c(e);i=s(l,t),y.call(p,"zoom",function(){var n=_.mouse(this);if(l.scale(h.k=_.event.scale),i){if(s(l,n)){l.rotate(e).translate(o);var c=s(l,n),p=f(i,c),y=m(u(v,p)),x=h.r=d(y,i,a);isFinite(x[0])&&isFinite(x[1])&&isFinite(x[2])||(x=a),l.rotate(x),a=x}}else t=n,i=s(l,t);r(g.of(this,arguments))}),n(g.of(this,arguments))}).on("zoomend",function(){_.select(this).style(A),y.call(p,"zoom",null),o(g.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,g,"on")}function s(t,e){var n=t.invert(e);return n&&isFinite(n[0])&&isFinite(n[1])&&v(n)}function c(t){var e=.5*t[0]*w,n=.5*t[1]*w,r=.5*t[2]*w,a=Math.sin(e),o=Math.cos(e),i=Math.sin(n),l=Math.cos(n),s=Math.sin(r),c=Math.cos(r);return[o*l*c+a*i*s,a*l*c-o*i*s,o*i*c+a*l*s,o*l*s-a*i*c]}function u(t,e){var n=t[0],r=t[1],a=t[2],o=t[3],i=e[0],l=e[1],s=e[2],c=e[3];return[n*i-r*l-a*s-o*c,n*l+r*i+a*c-o*s,n*s-r*c+a*i+o*l,n*c+r*s-a*l+o*i]}function f(t,e){if(t&&e){var n=x(t,e),r=Math.sqrt(y(n,n)),a=.5*Math.acos(Math.max(-1,Math.min(1,y(t,e)))),o=Math.sin(a)/r;return r&&[Math.cos(a),n[2]*o,-n[1]*o,n[0]*o]}}function d(t,e,n){var r=g(e,2,t[0]);r=g(r,1,t[1]),r=g(r,0,t[2]-n[2]);var a,o,i=e[0],l=e[1],s=e[2],c=r[0],u=r[1],f=r[2],d=Math.atan2(l,i)*M,p=Math.sqrt(i*i+l*l);Math.abs(u)>p?(o=(u>0?90:-90)-d,a=0):(o=Math.asin(u/p)*M-d,a=Math.sqrt(p*p-u*u));var m=180-o-2*d,v=(Math.atan2(f,c)-Math.atan2(s,a))*M,y=(Math.atan2(f,c)-Math.atan2(s,-a))*M,x=h(n[0],n[1],o,v),b=h(n[0],n[1],m,y);return x<=b?[o,v,n[2]]:[m,y,n[2]]}function h(t,e,n,r){var a=p(n-t),o=p(r-e);return Math.sqrt(a*a+o*o)}function p(t){return(t%360+540)%360-180}function g(t,e,n){var r=n*w,a=t.slice(),o=0===e?1:0,i=2===e?1:2,l=Math.cos(r),s=Math.sin(r);return a[o]=t[o]*l-t[i]*s,a[i]=t[i]*l+t[o]*s,a}function m(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*M,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*M,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*M]}function v(t){var e=t[0]*w,n=t[1]*w,r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function y(t,e){for(var n=0,r=0,a=t.length;r=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),n._initialAutoSizeIsDone){var c=n.width,f=n.height;p.supplyLayoutGlobalDefaults(o,r),o.width||(r.width=c),o.height||(r.height=f)}else{p.supplyLayoutGlobalDefaults(o,r);var d=!o.width||!o.height,h=r.autosize,g=t._context&&t._context.autosizable,m=d&&(h||g);m?p.plotAutoSize(t,o,r):d&&p.sanitizeMargins(t),!h&&d&&(o.width=r.width,o.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=s.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,r),r._has=p._hasPlotType.bind(r);var v=r._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,m=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(g*(m.width-f)),a=Math.round(g*(m.height-h))}else{var v=s?window.getComputedStyle(t):{};r=parseFloat(v.width)||n.width,a=parseFloat(v.height)||n.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;r1,_=!e.height&&Math.abs(n.height-a)>1;(_||b)&&(b&&(n.width=r),_&&(n.height=a)),t._initialAutoSize||(t._initialAutoSize={width:r,height:a}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n,r){var a,o;u.Axes.supplyLayoutDefaults(t,e,n);var i=e._basePlotModules;for(a=0;a.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var m=s[t].t.val,v=s[t].t.size;if(m>d){var y=(h*m+(v-e.height)*d)/(m-d),x=(v*(1-d)+(h-e.height)*(1-m))/(m-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!t._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):d.isJSDate(t)?d.ms2DateTime(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var n,r,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(n=0;n0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(n)for(l=0;l= max) { + return res.substr(0, max); } - while (max > res.length && num > 0) { + while (max > res.length && num > 1) { if (num & 1) { res += str; } num >>= 1; - if (!num) break; str += str; } - return res.substr(0, max); + res += str; + res = res.substr(0, max); + return res; } - },{}],164:[function(require,module,exports){ "use strict" @@ -49487,7 +49491,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.20.0'; +exports.version = '1.20.1'; // inject promise polyfill require('es6-promise').polyfill(); @@ -58396,7 +58400,7 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { // if position is given as a category name, convert it to a number if(typeof pos === 'string' && (ax._categories || []).length) { newPos = ax._categories.indexOf(pos); - containerOut[attr] = (newPos !== -1) ? dflt : newPos; + containerOut[attr] = (newPos === -1) ? dflt : newPos; return; } } diff --git a/dist/plotly-gl2d.min.js b/dist/plotly-gl2d.min.js index 7682716346b..efc9b5280f5 100644 --- a/dist/plotly-gl2d.min.js +++ b/dist/plotly-gl2d.min.js @@ -1,5 +1,5 @@ /** -* plotly.js (gl2d - minified) v1.20.0 +* plotly.js (gl2d - minified) v1.20.1 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -16,21 +16,21 @@ return h[0]=t,[d[1],d[0]]},e.exports.pack=a,e.exports.lo=o,e.exports.hi=s):f=!1} 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"}},{}],67:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":66}],68:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){this.plot=t,this.shader=e,this.fillShader=r,this.positionBuffer=n,this.colorBuffer=i,this.idBuffer=a,this.fillPositionBuffer=o,this.fillColorBuffer=s,this.fillVerts=0,this.shape=[0,0],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numVertices=0,this.lineWidth=1}function i(t,e){var r=Math.floor(e);if(r<0)return t[0];if(r>=t.length-1)return t[t.length-1];var n=e-r;return(1-n)*t[r]+n*t[r+1]}function a(t,e){var r=t.gl,i=s(r,p.vertex,p.fragment),a=s(r,p.fillVertex,p.fragment),o=l(r),u=l(r),c=l(r),f=l(r),h=l(r),d=new n(t,i,a,o,u,c,f,h);return d.update(e),t.addObject(d),d}e.exports=a;var o=t("iota-array"),s=t("gl-shader"),l=t("gl-buffer"),u=t("ndarray"),c=t("surface-nets"),f=t("cdt2d"),h=t("clean-pslg"),d=t("binary-search-bounds"),p=t("./lib/shaders"),g=n.prototype,v=[1,0,0,0,0,1,1,0,1,1,0,1];g.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0];return function(){var r,n,i=this.plot,a=this.shader,o=this.fillShader,s=this.bounds,l=this.numVertices,u=this.fillVerts,c=i.gl,f=i.viewBox,h=i.dataBox,d=s[2]-s[0],p=s[3]-s[1],g=h[2]-h[0],v=h[3]-h[1];if(t[0]=2*d/g,t[4]=2*p/v,t[6]=2*(s[0]-h[0])/g-1,t[7]=2*(s[1]-h[1])/v-1,e[0]=f[2]-f[0],e[1]=f[3]-f[1],u>0&&(o.bind(),r=o.uniforms,r.viewTransform=t,r.screenShape=e,n=a.attributes,this.fillPositionBuffer.bind(),n.position.pointer(),this.fillColorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0),c.drawArrays(c.TRIANGLES,0,u)),l>0){a.bind();var m=this.lineWidth*i.pixelRatio;r=a.uniforms,r.viewTransform=t,r.screenShape=e,r.lineWidth=m,r.pointSize=1e3,n=a.attributes,this.positionBuffer.bind(),n.position.pointer(c.FLOAT,!1,16,0),n.tangent.pointer(c.FLOAT,!1,16,8),this.colorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0),c.drawArrays(c.TRIANGLES,0,l),r.lineWidth=0,r.pointSize=m,this.positionBuffer.bind(),n.position.pointer(c.FLOAT,!1,48,0),n.tangent.pointer(c.FLOAT,!1,48,8),this.colorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0,12,0),c.drawArrays(c.POINTS,0,l/3)}}}(),g.drawPick=function(){return function(t){return t}}(),g.pick=function(t,e,r){return null},g.update=function(t){function e(t,e,r,n){var i=n-r;return Math.abs(i)<1e-6?e:Math.floor(e)+Math.max(.001,Math.min(.999,(t-r)/i))}t=t||{};var r=t.shape||[0,0],n=t.x||o(r[0]),a=t.y||o(r[1]),s=t.z||new Float32Array(r[0]*r[1]),l=t.levels||[],p=t.levelColors||[],g=this.bounds,m=g[0]=n[0],y=g[1]=a[0],b=g[2]=n[n.length-1],x=g[3]=a[a.length-1];m===b&&(g[2]+=1,b+=1),y===x&&(g[3]+=1,x+=1);var _=1/(b-m),w=1/(x-y);this.lineWidth=t.lineWidth||1;for(var A=u(s,r),k=[],M=[],T=[],E=[],L=[[0,0],[r[0]-1,0],[0,r[1]-1],[r[0]-1,r[1]-1]],S=0;S0&&C===l[S-1])){for(var R=c(A,C),O=255*p[4*S]|0,I=255*p[4*S+1]|0,P=255*p[4*S+2]|0,N=255*p[4*S+3]|0,D=R.cells,z=R.positions,F=Array(z.length),B=0;B1)){var V,q=H[0],G=H[1],X=A.get(Math.floor(q),Math.floor(G)),Y=A.get(Math.floor(q),Math.ceil(G)),W=A.get(Math.ceil(q),Math.floor(G)),Z=A.get(Math.ceil(q),Math.ceil(G));0===Math.floor(H[0])&&X<=C!=Y>1;for(e=0;e0&&(T*=_),E<0?E*=w:E>0&&(E*=A),v[b++]=h*(r-p+T),v[b++]=d*(n-g+E),v[b++]=o*M[2]+(l+o)*M[4],v[b++]=o*M[3]+(l+o)*M[5]}}for(e=0;e1&&h.drawBuffersWEBGL(y[f]);var m=r.getExtension("WEBGL_depth_texture");m?d?t.depth=s(r,u,c,m.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=s(r,u,c,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=l(r,u,c,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=l(r,u,c,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=l(r,u,c,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var v=0;vs||r<0||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(a),u=0;uo||r<0||r>o)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),s<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var f=!0;"depth"in n&&(f=!!n.depth);var h=!1;return"stencil"in n&&(h=!!n.stencil),new c(t,e,r,l,s,f,h,i)}var d=t("gl-texture2d");e.exports=h;var p,g,v,m,y=null,b=c.prototype;Object.defineProperties(b,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return f(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t|=0,f(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t|=0,f(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e>8*h&255;this.pickOffset=r,i.bind();var d=i.uniforms;d.viewTransform=t,d.pickOffset=e;var p=i.attributes;return this.positionBuffer.bind(),p.position.pointer(),this.idBuffer.bind(),p.pickId.pointer(o.UNSIGNED_BYTE,!1),o.drawArrays(o.TRIANGLES,0,this.numVertices),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){t=t||{};var e=t.shape||[0,0],r=t.x||o(e[0]),n=t.y||o(e[1]),i=t.z||new Float32Array(e[0]*e[1]);this.xData=r,this.yData=n;var l=t.colorLevels||[0],u=t.colorValues||[0,0,0,1],c=l.length,f=this.bounds,d=f[0]=r[0],p=f[1]=n[0],g=f[2]=r[r.length-1],v=f[3]=n[n.length-1],m=1/(g-d),y=1/(v-p),b=e[0]*e[1]*(h.length>>>1);this.numVertices=b;var x=s.mallocUint8(4*b),_=s.mallocFloat32(2*b),w=s.mallocUint32(b),A=e[0],k=e[1];this.shape=[A,k];for(var M=0,T=0;T2&&!this.usingDashes){var b=this.mitreShader;this.lineBufferLo.bind(),b.attributes.aLo.pointer(l.FLOAT,!1,48,0),this.lineBufferHi.bind(),b.bind();var x=b.uniforms;this.setProjectionUniforms(x,a),x.color=c,x.radius=s*u,b.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,i/3|0)}}}}(),h.drawPick=function(){var t=[0,0,0,0];return function(e){var r=this.vertCount,n=this.numPoints;if(this.pickOffset=e,!r)return e+n;var i=this.setProjectionModel(),a=this.plot,o=this.width,s=a.gl,l=a.pickPixelRatio,u=this.pickShader,c=this.pickBuffer;t[0]=255&e,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24,u.bind();var f=u.uniforms;this.setProjectionUniforms(f,i),f.width=o*l,f.pickOffset=t;var h=u.attributes;return this.lineBufferHi.bind(),h.aHi.pointer(s.FLOAT,!1,16,0),h.dHi.pointer(s.FLOAT,!1,16,8),this.lineBufferLo.bind(),h.aLo.pointer(s.FLOAT,!1,16,0),c.bind(),h.pick0.pointer(s.UNSIGNED_BYTE,!1,8,0),h.pick1.pointer(s.UNSIGNED_BYTE,!1,8,4),s.drawArrays(s.TRIANGLES,0,r),e+n}}(),h.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(r=n+i)return null;var a=r-n,o=this.data;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}},h.update=function(t){t=t||{};var e,r,n,a,o,s=this.plot.gl;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=i(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var f=t.dashes||[1],h=0;for(e=0;e1,this.dashPattern=l(s,u(d,[h,1,4],[1,0,0])),this.dashPattern.minFilter=s.NEAREST,this.dashPattern.magFilter=s.NEAREST,this.dashLength=h,c.free(d);var g=t.positions;this.data=g;var v=this.bounds;v[0]=v[1]=1/0,v[2]=v[3]=-(1/0);var m=this.numPoints=g.length>>>1;if(0!==m){for(e=0;e1;){var M=--n;a=g[2*n],o=g[2*n+1];var T=M-1,E=g[2*T],L=g[2*T+1];if(!(isNaN(a)||isNaN(o)||isNaN(E)||isNaN(L))){k+=1,a=(a-v[0])/(v[2]-v[0]),o=(o-v[1])/(v[3]-v[1]),E=(E-v[0])/(v[2]-v[0]),L=(L-v[1])/(v[3]-v[1]);var S=E-a,C=L-o,R=M|1<<24,O=M-1,I=M,P=M-1|1<<24;y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=a,_[--A]=R,_[--A]=O,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=I,_[--A]=P,y[--w]=-C,y[--w]=-S,y[--w]=L,y[--w]=E,_[--A]=I,_[--A]=P,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=I,_[--A]=P,y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=a,_[--A]=R,_[--A]=O,y[--w]=C,y[--w]=S,y[--w]=o,y[--w]=a,_[--A]=R,_[--A]=O}}for(e=0;es[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n],a.uniforms.angle=m[n],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n]&&A&&(e[1^n]-=T*d*b[n],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n],a.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,A)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*g[n+2],ks[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n+2],a.uniforms.angle=m[n+2],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n+2]&&A&&(e[1^n]+=T*d*b[n+2],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n+2],a.uniforms.angle=_[n+2],u.drawArrays(u.TRIANGLES,w,A))}}(),c.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,u=r.pixelRatio;if(this.titleCount){for(var c=0;c<2;++c)e[c]=2*(o[c]*u-a[c])/(a[2+c]-a[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,a=n._tickBounds,o=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var u=0;u<2;++u){var c=a[u],f=a[u+2],h=f-c,d=.5*(o[u+2]+o[u]),p=o[u+2]-o[u],g=l[u],v=l[u+2],m=v-g,y=s[u],b=s[u+2],x=b-y;e[u]=2*h/p*m/x,t[u]=2*(c-d)/p*m/x}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){var e,r,n,i,a,o=[],l=t.ticks,u=t.bounds;for(a=0;a<2;++a){var c=[Math.floor(o.length/3)],f=[-(1/0)],h=l[a];for(e=0;er)for(t=r;te)for(t=e;t=0){for(var k=0|A.type.charAt(A.type.length-1),M=new Array(k),T=0;T=0;)E+=1;w[b]=E}var L=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,x,w),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=a},{"./lib/GLError":88,"./lib/create-attributes":89,"./lib/create-uniforms":90,"./lib/reflect":91,"./lib/runtime-reflect":92,"./lib/shader-cache":93}],88:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="GLError",n.prototype.constructor=n,e.exports=n},{}],89:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}function i(t,e,r,i,a,o,s){for(var l=["gl","v"],u=[],c=0;c=0){var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);i(t,e,d[0],n,p,o,f)}else{if(!(h.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+f+": "+h);var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);a(t,e,d,n,p,o,f)}}}return o}e.exports=o;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,a=i._gl,o=i._locations[i._index];a.vertexAttribPointer(o,i._dimension,t||a.FLOAT,!!e,r||0,n||0),a.enableVertexAttribArray(o)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":88}],90:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;n4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(i<2||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],a=t;a+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function f(e){for(var n=["return function updateProperty(obj){"],i=c("",e),o=0;o4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var o=p(i);Object.defineProperty(t,e,{get:n(o),set:f(i),enumerable:!0,configurable:!1})}else a[i]?Object.defineProperty(t,e,{get:l(i),set:f(i),enumerable:!0,configurable:!1}):t[e]=h(r[i].type)}function p(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 u=1;u1)for(var l=0;l=0){var g=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(g,e[1],g,e[3],d[p],h[p]):o.drawLine(e[0],g,e[2],g,d[p],h[p])}}for(var p=0;p=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},h.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},h.removeObject=function(t){ for(var e=this.objects,r=0;r>>1;for(r=0;r=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}function a(t,e){var r=t.gl,i=s(r),a=s(r),l=o(r,u.pointVertex,u.pointFragment),c=o(r,u.pickVertex,u.pickFragment),f=new n(t,i,a,l,c);return f.update(e),t.addObject(f),f}var o=t("gl-shader"),s=t("gl-buffer"),l=t("typedarray-pool"),u=t("./lib/shader");e.exports=a;var c=n.prototype;c.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},c.update=function(t){function e(e,r){return e in t?t[e]:r}var r;t=t||{},this.sizeMin=e("sizeMin",.5),this.sizeMax=e("sizeMax",20),this.color=e("color",[1,0,0,1]).slice(),this.areaRatio=e("areaRatio",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.blend=e("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,a=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,o=t.positions,s=i?o:l.mallocFloat32(o.length),u=a?t.idToIndex:l.mallocInt32(n);if(i||s.set(o),!a)for(s.set(o),r=0;r>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),a.attributes.pickId.pointer(o.UNSIGNED_BYTE),a.uniforms.pickOffset=e,this.pickOffset=r);var h=o.getParameter(o.BLEND),d=o.getParameter(o.DITHER);return h&&!this.blend&&o.disable(o.BLEND),d&&o.disable(o.DITHER),o.drawArrays(o.POINTS,0,this.pointCount),h&&!this.blend&&o.enable(o.BLEND),d&&o.enable(o.DITHER),r+this.pointCount}}(),c.draw=c.unifiedDraw,c.drawPick=c.unifiedDraw,c.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":95,"gl-buffer":65,"gl-shader":96,"typedarray-pool":187}],104:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4((posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n",fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4((posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],105:[function(t,e,r){arguments[4][87][0].apply(r,arguments)},{"./lib/GLError":106,"./lib/create-attributes":107,"./lib/create-uniforms":108,"./lib/reflect":109,"./lib/runtime-reflect":110,"./lib/shader-cache":111,dup:87}],106:[function(t,e,r){arguments[4][88][0].apply(r,arguments)},{dup:88}],107:[function(t,e,r){arguments[4][89][0].apply(r,arguments)},{"./GLError":106,dup:89}],108:[function(t,e,r){arguments[4][90][0].apply(r,arguments)},{"./GLError":106,"./reflect":109,dup:90}],109:[function(t,e,r){arguments[4][91][0].apply(r,arguments)},{dup:91}],110:[function(t,e,r){arguments[4][92][0].apply(r,arguments)},{dup:92}],111:[function(t,e,r){arguments[4][93][0].apply(r,arguments)},{"./GLError":106,dup:93,"gl-format-compiler-error":74,"weakmap-shim":194}],112:[function(t,e,r){"use strict";function n(t){if(t in h)return h[t];var e=c(t,{polygons:!0,font:"sans-serif",textAlign:"left",textBaseline:"alphabetic"}),r=[],n=[];e.forEach(function(t){t.forEach(function(t){for(var e=0;e>8*d&255;h.uniforms.pickOffset=o,this.idBuffer.bind(),h.attributes.id.pointer(f.UNSIGNED_BYTE,!1)}else this.colorBuffer.bind(),h.attributes.color.pointer(f.UNSIGNED_BYTE,!0);return this.posHiBuffer.bind(),h.attributes.positionHi.pointer(),this.posLoBuffer.bind(),h.attributes.positionLo.pointer(),this.offsetBuffer.bind(),h.attributes.offset.pointer(),h.uniforms.pixelScale=a,h.uniforms.scaleHi=e,h.uniforms.scaleLo=r,h.uniforms.translateHi=n,h.uniforms.translateLo=i,f.drawArrays(f.TRIANGLES,0,c),l?s+this.numPoints:void 0}}(),d.draw=d.drawPick,d.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;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]]}},d.update=function(t){t=t||{};var e,r,i=t.positions||[],a=t.colors||[],o=t.glyphs||[],s=t.sizes||[],c=t.borderWidths||[],f=t.borderColors||[];this.points=i;var h,d,p=this.bounds=[1/0,1/0,-(1/0),-(1/0)],g=0,v=[],m=[];for(e=0;e>1,r=0;r<2;++r)p[r]=Math.min(p[r],i[2*e+r]),p[2+r]=Math.max(p[2+r],i[2*e+r]);p[0]===p[2]&&(p[2]+=1),p[3]===p[1]&&(p[3]+=1);var y=1/(p[2]-p[0]),b=1/(p[3]-p[1]),x=p[0],_=p[1],w=u.mallocFloat64(2*g),A=u.mallocFloat32(2*g),k=u.mallocFloat32(2*g),M=u.mallocFloat32(2*g),T=u.mallocUint8(4*g),E=u.mallocUint32(g),L=0;for(e=0;et;){var d=r[h-1],p=n[2*(h-1)];if((d-s||l-p)>=0)break;r[h]=d,n[2*h]=p,n[2*h+1]=n[2*h-1],i[h]=i[h-1],a[h]=a[h-1],h-=1}r[h]=s,n[2*h]=l,n[2*h+1]=u,i[h]=c,a[h]=f}}function a(t,e,r,n,i,a){var o=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=a[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,i[e]=u,a[e]=c}function o(t,e,r,n,i,a){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e]}function s(t,e,r,n,i,a,o){var s=n[t],l=i[2*t],u=i[2*t+1],c=a[t],f=o[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],a[t]=a[e],o[t]=o[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],a[e]=a[r],o[e]=o[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,a[r]=c,o[r]=f}function l(t,e,r,n,i,a,o,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=a,c[e]=o}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,a,o,s){return(e-a[t]||o[2*t]-r||i-s[t])<0}function f(t,e,r,n,d,p){var g=(e-t+1)/6|0,v=t+g,m=e-g,y=t+e>>1,b=y-g,x=y+g,_=v,w=b,A=y,k=x,M=m,T=t+1,E=e-1,L=0;u(_,w,r,n,d,p)&&(L=_,_=w,w=L),u(k,M,r,n,d,p)&&(L=k,k=M,M=L),u(_,A,r,n,d,p)&&(L=_,_=A,A=L),u(w,A,r,n,d,p)&&(L=w,w=A,A=L),u(_,k,r,n,d,p)&&(L=_,_=k,k=L),u(A,k,r,n,d,p)&&(L=A,A=k,k=L),u(w,M,r,n,d,p)&&(L=w,w=M,M=L),u(w,A,r,n,d,p)&&(L=w,w=A,A=L),u(k,M,r,n,d,p)&&(L=k,k=M,M=L);var S=r[w],C=n[2*w],R=n[2*w+1],O=d[w],I=p[w],P=r[k],N=n[2*k],D=n[2*k+1],z=d[k],F=p[k],B=_,j=A,U=M,H=v,V=y,q=m,G=r[B],X=r[j],Y=r[U];r[H]=G,r[V]=X,r[q]=Y;for(var W=0;W<2;++W){var Z=n[2*B+W],Q=n[2*j+W],$=n[2*U+W];n[2*H+W]=Z,n[2*V+W]=Q,n[2*q+W]=$}var K=d[B],J=d[j],tt=d[U];d[H]=K,d[V]=J,d[q]=tt;var et=p[B],rt=p[j],nt=p[U];p[H]=et,p[V]=rt,p[q]=nt,o(b,t,r,n,d,p),o(x,e,r,n,d,p);for(var it=T;it<=E;++it)if(c(it,S,C,R,O,r,n,d))it!==T&&a(it,T,r,n,d,p),++T;else if(!c(it,P,N,D,z,r,n,d))for(;;){if(c(E,P,N,D,z,r,n,d)){c(E,S,C,R,O,r,n,d)?(s(it,T,E,r,n,d,p),++T,--E):(a(it,E,r,n,d,p),--E);break}if(--E=Math.max(.9*d,32)){var b=u+s>>>1;l(v,m,f,h,b,c+1),h=b}l(v,m,f,h,y,c+1),h=y}}}var u=t.length>>>1;if(u<1)return[];for(var c=1/0,f=1/0,h=-(1/0),d=-(1/0),p=0;p=0;--_){t[2*_]=(t[2*_]-c)*m,t[2*_+1]=(t[2*_+1]-f)*y;var M=x[_];M!==A&&(w.push(new i(b*Math.pow(.5,M),_+1,k-(_+1))),k=_+1,A=M)}return w.push(new i(b*Math.pow(.5,M+1),0,k)),o.free(x),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=a},{"./lib/sort":115,"typedarray-pool":187}],117:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.plot=t,this.positionBufferHi=e,this.positionBufferLo=r,this.pickBuffer=n,this.weightBuffer=i,this.shader=a,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=o(r),s=o(r),l=o(r),u=o(r),f=a(r,c.pointVertex,c.pointFragment),h=a(r,c.pickVertex,c.pickFragment),d=new n(t,i,s,l,u,f,h);return d.update(e),t.addObject(d),d}var a=t("gl-shader"),o=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var f=n.prototype,h=new Float32Array(2),d=new Float32Array(2),p=new Float32Array(2),g=new Float32Array(2),v=[0,0,0,0];f.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBufferHi.dispose(),this.positionBufferLo.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},f.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords),this.points=t.positions;var r=this.points.length>>>1,n=u.mallocInt32(r),i=u.mallocFloat32(2*r),a=u.mallocFloat64(2*r);a.set(this.points),this.scales=l(a,n,i,this.bounds);var o=u.mallocFloat64(r),s=u.mallocFloat32(2*r),c=u.mallocFloat32(2*r);s.set(a);for(var f=0,h=0;f>8&255,v[2]=t>>16&255,v[3]=t>>24&255,n.uniforms.pickOffset=v,l.bind(),n.attributes.pickId.pointer(m.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());for(var O=this.xCoords,I=(x[0]-u[0]-E*c*y)/_,P=(x[2]-u[0]+E*c*y)/_,N=!0,D=i.length-1;D>=0;D--){var z=i[D];if(!(z.pixelSize1)){var F=z.offset,B=z.count+F,j=s.ge(O,I,F,B-1),U=s.lt(O,P,j,B-1)+1;U>j&&m.drawArrays(m.POINTS,j,U-j),!e&&N&&(N=!1,n.uniforms.useWeight=0)}}return t+this.pointCount},f.drawPick=f.draw,f.pick=function(t,e,r){var n=r-this.pickOffset;return n<0||n>=this.pointCount?null:{object:this,pointId:n,dataCoord:[this.points[2*n],this.points[2*n+1]]}}},{"./lib/shader":113,"binary-search-bounds":114,"gl-buffer":65,"gl-shader":121,"snap-points-2d":116,"typedarray-pool":187}],118:[function(t,e,r){"use strict";r.boxVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n",r.boxFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"},{}],119:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.boxBuffer=e,this.boxShader=r,this.enabled=!0,this.selectBox=[1/0,1/0,-(1/0),-(1/0)],this.borderColor=[0,0,0,1],this.innerFill=!1,this.innerColor=[0,0,0,.25],this.outerFill=!0,this.outerColor=[0,0,0,.5],this.borderWidth=10}function i(t,e){var r=t.gl,i=o(r,[0,0,0,1,1,0,1,1]),l=a(r,s.boxVertex,s.boxFragment),u=new n(t,i,l);return u.update(e),t.addOverlay(u),u}var a=t("gl-shader"),o=t("gl-buffer"),s=t("./lib/shaders");e.exports=i;var l=n.prototype;l.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),i=(this.outerFill,this.outerColor),a=this.borderColor,o=t.box,s=t.screenBox,l=t.dataBox,u=t.viewBox,c=t.pixelRatio,f=(e[0]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],h=(e[1]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1],d=(e[2]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],p=(e[3]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1];if(f=Math.max(f,u[0]),h=Math.max(h,u[1]),d=Math.min(d,u[2]),p=Math.min(p,u[3]),!(d0){var m=r*c;o.drawBox(f-m,h-m,d+m,h+m,a),o.drawBox(f-m,p-m,d+m,p+m,a),o.drawBox(f-m,h-m,f+m,p+m,a),o.drawBox(d-m,h-m,d+m,p+m,a)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":118,"gl-buffer":65,"gl-shader":121}],120:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function a(t,e){var r=o(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=a;var o=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(_inline_55_arg0_<255||_inline_55_arg1_<255||_inline_55_arg2_<255||_inline_55_arg3_<255){var _inline_55_l=_inline_55_arg4_-_inline_55_arg6_[0],_inline_55_a=_inline_55_arg5_-_inline_55_arg6_[1],_inline_55_f=_inline_55_l*_inline_55_l+_inline_55_a*_inline_55_a;_inline_55_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;i=0){for(var k=0|A.type.charAt(A.type.length-1),M=new Array(k),T=0;T=0;)E+=1;_[w]=E}var L=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n) -},d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=a},{"./lib/GLError":122,"./lib/create-attributes":123,"./lib/create-uniforms":124,"./lib/reflect":125,"./lib/runtime-reflect":126,"./lib/shader-cache":127}],122:[function(t,e,r){arguments[4][88][0].apply(r,arguments)},{dup:88}],123:[function(t,e,r){arguments[4][89][0].apply(r,arguments)},{"./GLError":122,dup:89}],124:[function(t,e,r){arguments[4][90][0].apply(r,arguments)},{"./GLError":122,"./reflect":125,dup:90}],125:[function(t,e,r){arguments[4][91][0].apply(r,arguments)},{dup:91}],126:[function(t,e,r){arguments[4][92][0].apply(r,arguments)},{dup:92}],127:[function(t,e,r){arguments[4][93][0].apply(r,arguments)},{"./GLError":122,dup:93,"gl-format-compiler-error":74,"weakmap-shim":194}],128:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}function i(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=i;var a=n.prototype;a.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},a.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,a=i.line,o=i.dataBox,s=i.viewBox;if(a.bind(),o[0]<=n[0]&&n[0]<=o[2]&&o[1]<=n[1]&&n[1]<=o[3]){var l=s[0]+(n[0]-o[0])/(o[2]-o[0])*(s[2]-s[0]),u=s[1]+(n[1]-o[1])/(o[3]-o[1])*(s[3]-s[1]);t[0]&&a.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&a.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&a.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&a.drawLine(l,u,l,s[3],e[3],r[3])}},a.dispose=function(){this.plot.removeOverlay(this)}},{}],129:[function(t,e,r){"use strict";function n(t){v=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],m=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],y=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function i(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(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 a(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}function o(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,a,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var f=0,h=0,v=o(c,l.stride.slice());"float32"===u?f=t.FLOAT:"float64"===u?(f=t.FLOAT,v=!1,u="float32"):"uint8"===u?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,v=!1,u="uint8");var m=1;if(2===c.length)h=t.LUMINANCE,c=[c[0],c[1],1],l=d(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])h=t.ALPHA;else if(2===c[2])h=t.LUMINANCE_ALPHA;else if(3===c[2])h=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");h=t.RGBA}m=c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(h=i),h!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,x=s.indexOf(n)<0;if(x&&s.push(n),f===a&&v)0===l.offset&&l.data.length===y?x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data):x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var _;_=a===t.FLOAT?g.mallocFloat32(y):g.mallocUint8(y);var w=d(_,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&a===t.UNSIGNED_BYTE?b(w,l):p.assign(w,l),x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,_.subarray(0,y)),a===t.FLOAT?g.freeFloat32(_):g.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var o=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>o||r<0||r>o)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new a(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new a(t,i,0|e.width,0|e.height,r,n)}function f(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=o(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=d(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var f,h,v=e.size;if(s)f=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var m=[n[2],n[2]*n[0],1];h=g.malloc(v,r);var y=d(h,n,m,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?p.assign(y,e):b(y,e),f=h.subarray(0,v)}var x=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,f),s||g.free(h),new a(t,x,n[0],n[1],c,u)}function h(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(v||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return f(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var d=t("ndarray"),p=t("ndarray-ops"),g=t("typedarray-pool");e.exports=h;var v=null,m=null,y=null,b=function(t,e){p.muls(t,e,255)},x=a.prototype;Object.defineProperties(x,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=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(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t|=0,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,i(this,this._shape[0],t),t}}}),x.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},x.dispose=function(){this.gl.deleteTexture(this.handle)},x.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},x.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var a=this._mipLevels.indexOf(n)<0;a?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:148,"ndarray-ops":147,"typedarray-pool":187}],130:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function R(){return/[^a-fA-F0-9]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function O(){return"."===N?(U.push(N),j=v,D=N,F+1):/[eE]/.test(N)?(U.push(N),j=v,D=N,F+1):"x"===N&&1===U.length&&"0"===U[0]?(j=w,U.push(N),D=N,F+1):/[^\d]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function I(){return"f"===N&&(U.push(N),D=N,F+=1),/[eE]/.test(N)?(U.push(N),D=N,F+1):"-"===N&&/[eE]/.test(D)?(U.push(N),D=N,F+1):/[^\d]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function P(){if(/[^\d\w_]/.test(N)){var t=U.join("");return j=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:m,e(U.join("")),j=u,F}return U.push(N),D=N,F+1}var N,D,z,F=0,B=0,j=u,U=[],H=[],V=1,q=0,G=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return H=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var i=t("./lib/literals"),a=t("./lib/operators"),o=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,f=0,h=1,d=2,p=3,g=4,v=5,m=6,y=7,b=8,x=9,_=10,w=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":133,"./lib/builtins-300es":132,"./lib/literals":135,"./lib/literals-300es":134,"./lib/operators":136}],132:[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":133}],133:[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"]},{}],134:[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":135}],135:[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"]},{}],136:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],137:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":131}],138:[function(t,e,r){r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=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=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),e*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):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+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],139:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function a(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),a(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],a=[],o=[],s=[],r=0;r3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=m.ge(this.leftPoints,t,h),n=m.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var a=this.left?this.left.count:0;if(4*a>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var o=this,l=this.left;l.right;)o=l,l=l.right;if(o===this)l.right=this.right;else{var u=this.left,n=this.right;o.count-=l.count,o.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var u=m.ge(this.leftPoints,t,h);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===x&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},w.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":28}],140:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;r0)return 1<=0)return 1<=0;--e)S(e,0);for(var r=[],e=0;e0;_=_-1&g)x.push(w+"["+T+"+"+v(_)+"]");x.push(m(0));for(var _=0;_0){",h(x[t]),"=1;"),P(t-1,e|1<0&&G.push(s(U,x[H-1])+"*"+o(x[H-1])),B.push(d(U,x[H])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)X.push(o(x[U]));B.push(M+"=("+X.join("*")+")|0",A+"=mallocUint32("+M+")",w+"=mallocUint32("+M+")",T+"=0"),B.push(p(0)+"=0");for(var H=1;H<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 a=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return b(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",A="P",k="N",M="Q",T="X",E="T"},{"typedarray-pool":187}],147:[function(t,e,r){"use strict";function n(t){if(!t)return s;for(var e=0;e>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=a({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]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,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=o({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=o({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=o({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=a({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=a({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=o({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":51}],148:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;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("+u.join(",")+",v){"),n?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var v=0;v=0){d=i"+v+"|0;b+=c"+v+"*d;a"+v+"-=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var v=0;v=0){c=(c+this.stride["+v+"]*i"+v+")|0}else{a.push(this.shape["+v+"]);b.push(this.stride["+v+"])}");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,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",a.join("\n"));return o(f[t],i)}function o(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=f.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),a=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":56}],150:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r="undefined"!=typeof r?r+"":" ",n(r,e)+t}},{"repeat-string":163}],151:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],152:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return a.freeUint32(l),a.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,a,o=1;for(r[0]=0,a=1;a0;--a)n=e/o|0,e=e-n*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}var a=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":140,"typedarray-pool":187}],154:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,s,l,c=0;c<2;++c)if(u[c][n].length>0){o=u[c][n][0],l=c;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=u[f][n],d=0;d0&&(o=p,s=g,l=f)}return a?s:(o&&r(o,l),s)}function a(t,a){var o=u[a][t][0],s=[t];r(o,a);for(var l=o[1^a];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],f=t,h=s[1],d=n(c,f,!0);if(i(e[c],e[f],e[h],e[d])<0)break;s.push(t),l=n(c,f)}return s}function o(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;c0;){var g=(u[0][c].length,a(c,d));o(p,g)?p.push.apply(p,g):(p.length>0&&h.push(p),p=g)}p.length>0&&h.push(p)}return h}e.exports=n;var i=t("compare-angle")},{"compare-angle":49}],155:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function a(t){for(var e=t.length,r=0;r0;){var U=B.pop(),H=O[U];f(H,function(t,e){return t-e});var V,q=H.length,G=j[U];if(0===G){var T=m[U];V=[T]}for(var v=0;v=0)&&(j[X]=1^G,B.push(X),0===G)){var T=m[X];a(T)||(T.reverse(),V.push(T))}}0===G&&d.push(V)}return d}e.exports=a;var o=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),f=t("uniq"),h=t("./lib/trim-leaves")},{"./lib/trim-leaves":155,"edges-to-adjacency-list":58,"planar-dual":154,"point-in-big-polygon":157,"robust-sum":170,"two-product":185,uniq:189}],157:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return!!i&&!!i.queryPoint(r,n)}}function a(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var o=i.key,s=f(r,o[0],o[1]);if(o[0][0]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))return 0;a=1,i=i.right}}return a}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;i1)for(var r=1;ra.length&&e>0&&(1&e&&(a+=t),e>>=1);)t+=t;return a.substr(0,r)}var i,a="";e.exports=n},{}],164:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;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=m*n;return o>=s||o<=-s?o:b(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],u=r[1]-n[1],c=t[2]-n[2],f=e[2]-n[2],h=r[2]-n[2],d=a*u,p=o*l,g=o*s,v=i*u,m=i*l,b=a*s,_=c*(d-p)+f*(g-v)+h*(m-b),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(m)+Math.abs(b))*Math.abs(h),A=y*w;return _>A||-_>A?_:x(t,e,r,n)}];c()},{"robust-scale":167,"robust-subtract":169,"robust-sum":170,"two-product":185}],166:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return a(e,t[0]);if(1===e.length)return a(t,e[0]);if(0===t.length||0===e.length)return[0]; -var r=[0];if(t.length0&&s>0||o<0&&s<0)return!1;var l=a(r,t,e),u=a(i,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,i))}e.exports=i;var a=t("robust-orientation")[3]},{"robust-orientation":165}],169:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],v=h(g);p=i?(a=d,c+=1,c=i?(a=d,c+=1,c0?1:0}},{}],172:[function(t,e,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],173:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,i=t.length;n>1,s=o(t[a],e);s<=0?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function f(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[g],a))break}return r}function h(t,e){if(!e)return f(u(p(t,0)),t,0);for(var r=new Array(e),n=0;n>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){var n=s(r);if(e0){var t=M[0];return a(0,L-1),L-=1,u(0),t}return-1}function h(t,e){var r=M[t];return b[r]===e?t:(b[r]=-(1/0),c(t),f(),b[r]=e,L+=1,c(L-1))}function d(t){if(!x[t]){x[t]=!0;var e=m[t],r=y[t];m[r]>=0&&(m[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&h(T[e],i(e)),T[r]>=0&&h(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||i<0||i===n)break;if(n=i,i=t[n],!x[n]||i<0||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var g=e.length,v=t.length,m=new Array(g),y=new Array(g),b=new Array(g),x=new Array(g),_=0;_>1;_>=0;--_)u(_);for(;;){var S=f();if(S<0||b[S]>r)break;d(S)}for(var C=[],_=0;_=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&R.push([n,i])}}),o.unique(o.normalize(R)),{positions:C,edges:R}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":165,"simplicial-complex":173}],176:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return ol?i-l:o-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=a(r,i,s),u=a(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;if(l=a(s,o,i),u=a(s,o,r),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]}e.exports=i;var a=t("robust-orientation")},{"robust-orientation":165}],177:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=a(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=a(t.right,e);if(l)return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;a0){var s=a(this.slabs[e-1],t);s&&(o?h(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(o){var p=f(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":176,"binary-search-bounds":28,"functional-red-black-tree":62,"robust-orientation":165}],178:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function a(t,e){return Array(e+1).join(t)}var o={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,f,h,d=1,p=t.length,g="",v=[],m=!0,y="";for(s=0;s=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?v[v.length]=n:(!o.number.test(u[8])||m&&!u[3]?y="":(y=m?"+":"-",n=n.toString().replace(o.sign,"")),f=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",h=u[6]-(y+n).length,c=u[6]&&h>0?a(f,h):"",v[v.length]=u[5]?y+n+c:"0"===f?y+c+n:c+y+n)}return v.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],179:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],180:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128===0){f.length>0&&h.push("}}");var d="vExtra"+f.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(M="+"+v[x]+"*c");var T=.5*(p[x].length/y),E=.5+.5*(m[x]/y);k.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+M+")/("+g[x].join("+")+")")}h.push("a.push([",k.join(),"]);","break;")}n.push("}},"),f.length>0&&h.push("}}");for(var L=[],u=0;u<1<0&&(h+=.02);for(var p=new Float32Array(f),g=0,v=-.5*h,d=0;d.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=L(t,360),e=L(e,100),r=L(r,100),0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,i,a=G(t,e,r),o=q(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function M(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){R(t)&&(t="100%");var n=O(t);return t=q(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function S(t){return q(1,G(0,t))}function C(t){return parseInt(t,16)}function R(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function O(t){return"string"==typeof t&&t.indexOf("%")!=-1}function I(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function N(t){return e.round(255*parseFloat(t)).toString(16)}function D(t){return C(t)/255}function z(t){return!!Z.CSS_UNIT.exec(t)}function F(t){t=t.replace(j,"").replace(U,"").toLowerCase();var e=!1;if(Y[t])t=Y[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Z.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),a:D(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),a:D(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.hex3.exec(t))&&{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),format:e?"name":"hex"}}function B(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var j=/^\s+/,U=/\s+$/,H=0,V=e.round,q=e.min,G=e.max,X=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=E(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*L(this._r,255))+"%",g:V(100*L(this._g,255))+"%",b:V(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*L(this._r,255))+"%, "+V(100*L(this._g,255))+"%, "+V(100*L(this._b,255))+"%)":"rgba("+V(100*L(this._r,255))+"%, "+V(100*L(this._g,255))+"%, "+V(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(W[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,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(k,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=P(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return n(s)},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=B(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},n.mostReadable=function(t,e,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var Y=n.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"},W=n.hexNames=T(Y),Z=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],183:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":151}],184:[function(t,e,r){"use strict";function n(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(o(t+1)),r=[],n=0;n0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function f(t){return new Int16Array(o(2*t),0,t)}function h(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return x?new Uint8ClampedArray(o(t),0,t):s(t)}function v(t){return new DataView(o(t),0,t)}function m(t){t=y.nextPow2(t);var e=y.log2(t),r=A[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,A=_.BUFFER;r.free=function(t){if(n.isBuffer(t))A[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){A[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return f(t);case"int32":return h(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return m(t);case"data":case"dataview":return v(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=f,r.mallocInt32=h,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=v,r.mallocBuffer=m,r.clearCache=function(){for(var t=0;t<32;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,A[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":29,buffer:38,dup:57}],188:[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;e8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height= 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":51}],197:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":196}],198:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("opacity"),u("align"),u("bgcolor");var f=u("bordercolor"),h=i.opacity(f);u("borderpad");var d=u("borderwidth"),p=u("showarrow");u("text",p?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font);for(var g=["x","y"],v=[-10,-30],m={_fullLayout:r},y=0;y<2;y++){var b=g[y],x=a.coerceRef(t,e,m,b,"","paper");if(a.coercePosition(e,m,u,x,b,.5),p){var _="a"+b,w=a.coerceRef(t,e,m,_,"pixel");"pixel"!==w&&w!==x&&(w=e[_]="pixel");var A="pixel"===w?v[y]:.4;a.coercePosition(e,m,u,w,_,A)}else u(b+"anchor")}return n.noneOrAll(t,e,["x","y"]),p&&(u("arrowcolor",h?e.bordercolor:i.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(h&&d||1)),n.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":303,"../../plots/cartesian/axes":333,"../color":207,"./attributes":200}],199:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],200:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":298,"../../plots/cartesian/constants":338,"../../plots/font_attributes":353,"./arrow_paths":199}],201:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,f=s-l,h=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),f=Math.max(f,d),h=Math.max(h,d)}r&&r.autorange&&a.expand(r,[r.l2c(r.r2l(e.x))],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(n.r2l(e.y))],{ppadplus:h,ppadminus:f})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":303,"../../plots/cartesian/axes":333,"./draw":203}],202:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),i=t("./annotation_defaults");e.exports=function(t,e){var r={name:"annotations",handleItemDefaults:i};n(t,e,r)}},{"../../plots/array_container_defaults":330,"./annotation_defaults":198}],203:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=$.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,m=Math.round(u+2*tt),y=Math.round(p+2*tt);q._w=u,q._h=p;var x=!1;if(["x","y"].forEach(function(e){var n,i=q[e+"ref"]||e,a=f.getFromId(t,i),o=(W+("x"===e?0:90))*Math.PI/180,s=m*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=q[e+"anchor"];if(a){var u=a.r2fraction(q[e]);if(!a.autorange&&(u<0||u>1)&&(q["a"+e+"ref"]===i?(u=a.r2fraction(q["a"+e]),(u<0||u>1)&&(x=!0)):x=!0,x))return;Y[e]=a._offset+a.r2p(q[e]),n=.5}else n=q[e],"y"===e&&(n=1-n),Y[e]="x"===e?R.l+R.w*n:R.t+R.h*n;var c=0;q["a"+e+"ref"]===i?Y["aa"+e]=a._offset+a.r2p(q["a"+e]):(c=q.showarrow?q["a"+e]:s*r(n,l),Y[e]+=c),q["_"+e+"type"]=a&&a.type,q["_"+e+"size"]=s,q["_"+e+"shift"]=c}),x)return void $.remove();var _,w;q.showarrow&&(_=q.axref===q.xref?Y.x:c.constrain(Y.x-q.ax,1,k.width-1),w=q.ayref===q.yref?Y.y:c.constrain(Y.y-q.ay,1,k.height-1)),Y.x=c.constrain(Y.x,1,k.width-1),Y.y=c.constrain(Y.y,1,k.height-1);var A=tt-s.top,M=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:M,y:A}),nt.selectAll("tspan.line").attr({y:A,x:M})),et.call(d.setRect,K/2,K/2,m-K,y-K);var T=0,E=0;T=q.axref===q.xref?Math.round(Y.aax-m/2):Math.round(Y.x-m/2),E=q.ayref===q.yref?Math.round(Y.aay-y/2):Math.round(Y.y-y/2),$.call(c.setTranslate,T,E);var L="annotations["+e+"]",S=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=q.axref===q.xref?Y.aax+r:Y.x+r,s=q.ayref===q.yref?Y.aay+n:Y.y+n;var u=c.rotationXYMatrix(W,i,s),f=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,m=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!m.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){m.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=q.arrowwidth,x=q.arrowcolor,A=Z.append("g").style({opacity:h.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=A.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(h.stroke,h.rgb(x));b(k,q.arrowhead,"end",q.arrowsize);var M=A.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,S;v.init({element:M.node(),prepFn:function(){var t=c.getTranslate($);E=t.x,S=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){A.attr("transform","translate("+t+","+e+")");var r=f(E,S),n=r[0]+t,i=r[1]+e;$.call(c.setTranslate,n,i),T[L+".x"]=G?G.p2r(G.r2p(q.x)+t):(_+t-R.l)/R.w,T[L+".y"]=X?X.p2r(X.r2p(q.y)+e):1-(w+e-R.t)/R.h,q.axref===q.xref&&(T[L+".ax"]=G?G.p2r(G.r2p(q.ax)+t):(_+t-R.l)/R.w),q.ayref===q.yref&&(T[L+".ay"]=X?X.p2r(X.r2p(q.ay)+e):1-(w+e-R.t)/R.h),Q.attr({transform:"rotate("+W+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};q.showarrow&&S(0,0);var C=c.rotationXYMatrix(W,Y.x,Y.y),O=c.apply2DTransform(C);if(t._context.editable){var I,P,N;v.init({element:$.node(),prepFn:function(){var t=c.getTranslate($);I=t.x,P=t.y,N={}},moveFn:function(t,e){$.call(c.setTranslate,I+t,P+e);var r="pointer";if(q.showarrow)q.axref===q.xref?N[L+".ax"]=G.p2r(G.r2p(q.ax)+t):N[L+".ax"]=q.ax+t,q.ayref===q.yref?N[L+".ay"]=X.p2r(X.r2p(q.ay)+e):N[L+".ay"]=q.ay+e,S(t,e);else{if(G)N[L+".x"]=q.x+t/G._m;else{var n=q._xsize/R.w,i=q.x+q._xshift/R.w-n/2;N[L+".x"]=v.align(i+t/R.w,n,0,1,q.xanchor)}if(X)N[L+".y"]=q.y+e/X._m;else{var a=q._ysize/R.h,o=q.y-q._yshift/R.h-a/2;N[L+".y"]=v.align(o-e/R.h,a,0,1,q.yanchor)}G&&X||(r=v.getCursor(G?.5:N[L+".x"],X?.5:N[L+".y"],q.xanchor,q.yanchor))}var s=O(I,P),l=s[0]+t,u=s[1]+e;$.call(c.setTranslate,I+t,P+e),Q.attr({transform:"rotate("+W+","+l+","+u+")"}),g($,r)},doneFn:function(e){if(g($),e){l.relayout(t,N);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,A=t.layout,k=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return A.annotations=u,y(A,k),void n(t);if("remove"===u)return delete A.annotations,k.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)k._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}k._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=A.annotations[e],E=k.annotations[e];if(T){var L={};"string"==typeof r&&r?L[r]=u:c.isPlainObject(r)&&(L=r);var S=Object.keys(L);for(w=0;w4/3&&(z=H)}}else D&&(B&&(z<1/3?z+=U:z>2/3&&(z-=U)),z=(z-D.domain[0])/(D.domain[1]-D.domain[0]),z=D.fraction2r(z))}D&&D===N&&F&&("log"===F&&"log"!==D.type?z=Math.pow(10,z):"log"!==F&&"log"===D.type&&(z=z>0?Math.log(z)/Math.LN10:void 0)),T[P]=z}}var q={};m(T,q,k),k.annotations[e]=q;var G=f.getFromId(t,q.xref),X=f.getFromId(t,q.yref),Y={x:0,y:0},W=+q.textangle||0,Z=k._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",q.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:q})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),K=q.borderwidth,J=q.borderpad,tt=K+J,et=$.append("rect").attr("class","bg").style("stroke-width",K+"px").call(h.stroke,q.bordercolor).call(h.fill,q.bgcolor),rt=q.font,nt=$.append("text").classed("annotation",!0).attr("data-unformatted",q.text).text(q.text);t._context.editable?nt.call(p.makeEditable,$).call(x).on("edit",function(r){q.text=r,this.attr({"data-unformatted":q.text}),this.call(x);var n={};n["annotations["+e+"].text"]=q.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(x),Q.attr({transform:"rotate("+W+","+Y.x+","+Y.y+")"}).call(d.setPosition,Y.x,Y.y)}}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,f=n-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var g=(u*d-c*h)/p,v=(u*f-l*h)/p;return v<0||v>1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./annotation_defaults"),y=t("./defaults"),b=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":303,"../../lib/setcursor":313,"../../lib/svg_text_utils":317,"../../plotly":328,"../../plots/cartesian/axes":333,"../../plots/plots":361,"../color":207,"../dragelement":228,"../drawing":230,"./annotation_defaults":198,"./defaults":202,"./draw_arrow_head":204,d3:55,"fast-isnumeric":61}],204:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var f,h,d,p,g=(o.getPx(t,"stroke-width")||1)*l,v=t.style("stroke")||a.defaultLine,m=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=c.backoff*g;if("line"===u.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},h={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(f.y-h.y,f.x-h.x),p=d+Math.PI,x){var _=x*Math.cos(d),w=x*Math.sin(d);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),b&&(h.x+=_,h.y+=w,t.attr({x2:h.x,y2:h.y}))}}else if("path"===u.nodeName){var A=u.getTotalLength(),k="";if(y){var M=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(M.y-T.y,M.x-T.x),f=u.getPointAtLength(Math.min(x,A)),x&&(k="0px,"+x+"px,")}if(b){var E=u.getPointAtLength(A),L=u.getPointAtLength(A-.1);if(p=Math.atan2(E.y-L.y,E.x-L.x),h=u.getPointAtLength(Math.max(0,A-x)),x){var S=k?2*x:x;k+=A-S+"px,"+A+"px"}}else k&&(k+=A+"px");k&&t.style("stroke-dasharray",k)}var C=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:v,opacity:m,"stroke-width":0})};y&&C(f,d),b&&C(h,p)}}},{"../color":207,"../drawing":230,"./arrow_paths":199,d3:55,"fast-isnumeric":61}],205:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":200,"./calc_autorange":201,"./defaults":202,"./draw":203}],206:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],207:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(C);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?L[0]:(C[e]+C[e-1])/2,e===C.length-1?L[1]:(C[e]+C[e+1])/2].map(J.c2p).map(Math.round);e!==C.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=O(t).replace("e-",""),o=i(a).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 h=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){n.select(this).attr("d","M"+Y+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+j).call(d.lineGroupStyle,_.line.width,R(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=Y+j+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));A("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:M.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,i=x();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(a,r||{}))}function k(){var r=j+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(z=ot.select("text"),z.node()&&!z.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-Y-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-$;at.select(".cbbg").attr({x:Y-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:Y,y:$+_.ypad+("top"===_.titleside?st:0),width:Math.max(j,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var M=t._fullLayout,T=M._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void M._infolayer.selectAll("g."+e).remove();var E,L=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],C=[],R="function"==typeof _.line.color?_.line.color:function(){return _.line.color},O="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},I=_.levels.end+_.levels.size/100,P=_.levels.size,N=1.001*L[0]-.001*L[1],D=1.001*L[1]-.001*L[0];for(E=_.levels.start;(E-I)*P<0;E+=P)E>N&&EL[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+V-X],J.setScale();var at=M._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+q)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+V-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,A(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ft=c.syncOrAsync([o.previousPromises,w,o.previousPromises,k],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var ht,dt,pt;u.init({element:at.node(),prepFn:function(){ht=at.attr("transform"),h(at)},moveFn:function(t,e){at.attr("transform",ht+" translate("+t+","+e+")"),dt=u.align(W+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,V,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);h(at,r)},doneFn:function(e){h(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},x().index)}})}return ft}function x(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":303,"./flip_scale":218,"./scales":225}],214:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":298,"./attributes":212,"./scales.js":225}],215:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":225}],216:[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,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,g=f?i.nestedProperty(e,d).get()||{}:e,v=p[h+"min"],m=p[h+"max"],y=p.colorscale,b=n(v)&&n(m)&&v=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],219:[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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):e}},{"./default_scale":215,"./is_valid_scale_array":223,"./scales":225}],220:[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(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],227:[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":303}],228:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,g=o.getPlotDiv(t.element)||{},v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":303,"../../plotly":328,"../../plots/cartesian/constants":338,"./align":226,"./cursor":227,"./unhover":229}],229:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":297}],230:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,f,h;t.so?(h=o.outlierwidth,f=o.outliercolor,c=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(h||1)+"px",fill:"none"}):(e.style("stroke-width",h+"px").call(l.fill,c),h&&e.call(l.stroke,f))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),f=(c*c*i-u*u*s)*n,h=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&f/d),2),a.round(e[1]+(d&&h/d),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&h/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var v=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=g.tryColorscale(i,""),s=g.tryColorscale(i,"line");n(t,e,r,o,s,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),i=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,a.select(this),e,n,i)})}},g.tryColorscale=function(t,e){var r=e?c.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):c.identity};var b={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(f.convertToTspans);var h=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*x+1,v=b[l]*c,m=.75*u+b[s]*c+(b[s]-1)*p*u/2;h.attr("transform","translate("+v+","+m+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=M&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":291,"../../lib":303,"../../lib/svg_text_utils":317,"../../registry":368,"../../traces/scatter/make_bubble_size_func":422,"../../traces/scatter/subtypes":427,"../color":207,"../colorscale":221,"./symbol_defs":231,d3:55,"fast-isnumeric":61}],231:[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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:55}],232:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],233:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),f=0;f0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);c&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;f="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");s=!v.size(),s?v=e.append("path").classed("yerror",!0):c&&(v=v.transition().duration(r.duration).ease(r.easing)),v.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var m=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-m)+"v"+2*m+"m0,-"+m+"H"+o.xs,o.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":427,d3:55,"fast-isnumeric":61}],238:[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":207,d3:55}],239:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":338}],240:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}var o=n("source"),l=n("visible",!!o);if(!l)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var u={_fullLayout:r},c=["x","y"],f=0;f<2;f++)a.coerceRef(t,e,u,c[f],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var r={name:l,handleItemDefaults:n};o(t,e,r)}},{"../../lib":303,"../../plots/array_container_defaults":330,"../../plots/cartesian/axes":333,"./attributes":239}],241:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,f=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,h=c*d.x[e.xanchor].offset,p=f*d.y[e.yanchor].offset,g=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,v=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+h,m=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:v,y:m,width:c,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=o?o._id:"",b=l?l._id:"",x=y+b;x&&r.call(i.setClipUrl,"clip"+s._uid+x)}for(var s=t._fullLayout,l=[],u=[],c=[],f=0;f=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}},{}],244:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":298,"../../plots/font_attributes":353,"../color/attributes":206}],245:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],246:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(b!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",v),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":303,"../../plots/layout_attributes":359,"../../registry":368,"./attributes":244,"./helpers":249}],247:[function(t,e,r){"use strict";function n(t,e){function r(r){m.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?f.call(m.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=r.indexOf(f);h===-1?r.push(f):r.splice(h,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;r=s*h,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cn.width-(n.margin.r+n.margin.l)&&(b=0,v+=m,i.height=i.height+m,m=0),f.setTranslate(this,a+b,5+a+e.height/2+v),i.width+=o+r,i.height=Math.max(i.height,e.height),b+=o+r,m=Math.max(e.height,m)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),b=t("./get_legend_data"),x=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(g.setRect,B,t,y.scrollBarWidth,y.scrollBarHeight),M.select("rect").attr({y:m.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var m=r.legend,_=r.showlegend&&b(t.calcdata,m),A=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var k=r._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var M=r._topdefs.selectAll("#"+a).data([0]);M.enter().append("clipPath").attr("id",a).append("rect");var T=k.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var E=k.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=k.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=E.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var C=S.selectAll("g.traces").data(f.identity);C.enter().append("g").attr("class","traces"),C.exit().remove(),C.call(x).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?A.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var R=0!==k.enter().size();R&&(o(t,S,C),s(t));var O=0,I=r.width,P=0,N=r.height;o(t,S,C),m.height>N?l(t):s(t);var D=r._size,z=D.l+D.w*m.x,F=D.t+D.h*(1-m.y);w.isRightAnchor(m)?z-=m.width:w.isCenterAnchor(m)&&(z-=m.width/2),w.isBottomAnchor(m)?F-=m.height:w.isMiddleAnchor(m)&&(F-=m.height/2);var B=m.width,j=D.w;B>j?(z=D.l,B=j):(z+B>I&&(z=I-B),zH?(F=D.t,U=H):(F+U>N&&(F=N-U),Fr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":303,"../../registry":368,"../../traces/pie/style_one":401,"../../traces/scatter/subtypes":427,"../color":207,"../drawing":230,d3:55}],252:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(v,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",o.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":303,"../color":207,"./attributes":256,"./button_attributes":257,"./constants":258}],260:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},i=S.line.width?S.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",S.opacity).call(_.stroke,i).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);C&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+C),t._context.editable&&f(t,a,S,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:b.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>Y&&!t.shiftKey?A.getCursor(i/r,1-a/n):"move";k(e,o),G=o.split("-")[0]}function a(e){B=x.getFromId(t,r.xref),j=x.getFromId(t,r.yref),U=T.getDataToPixel(t,B),H=T.getDataToPixel(t,j,!0),V=T.getPixelToData(t,B),q=T.getPixelToData(t,j,!0);var a="shapes["+n+"]";"path"===r.type?(z=r.path,F=a+".path"):(c=U(r.x0),f=H(r.y0),h=U(r.x1),d=H(r.y1),g=a+".x0",m=a+".y0",b=a+".x1",_=a+".y1"),cY&&(u[S]=r[I]=q(s),u[C]=r[P]=q(l)),f-c>X&&(u[R]=r[N]=V(c),u[O]=r[D]=V(f))}e.attr("d",p(t,r))}var u,c,f,h,d,g,m,b,_,w,M,E,L,S,C,R,O,I,P,N,D,z,F,B,j,U,H,V,q,G,X=10,Y=10,W={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=W.element.getBoundingClientRect();A.init(W)}function h(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):b.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=x.getFromId(t,r.id,"x")._id,i=x.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=x.getFromId(t,e.xref),l=x.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),f=n(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z"; -var p=(c+f)/2,v=(h+d)/2,m=Math.abs(p-c),y=Math.abs(v-h),b="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(M.segmentRE,function(t){var n=0,i=t.charAt(0),a=M.paramIsX[i],o=M.paramIsY[i],s=M.numParams[i],l=t.substr(1).replace(M.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),b.log("Ignoring extra params in segment "+t)),i+l})}function v(t,e,r){return t.replace(M.segmentRE,function(t){var n=0,i=t.charAt(0),a=M.paramIsX[i],o=M.paramIsY[i],s=M.numParams[i],l=t.substr(1).replace(M.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var m=t("fast-isnumeric"),y=t("../../plotly"),b=t("../../lib"),x=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),A=t("../dragelement"),k=t("../../lib/setcursor"),M=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),L=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":303,"../../lib/setcursor":313,"../../plotly":328,"../../plots/cartesian/axes":333,"../color":207,"../dragelement":228,"../drawing":230,"./constants":270,"./defaults":271,"./helpers":273,"./shape_defaults":275,"fast-isnumeric":61}],273:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],274:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":268,"./calc_autorange":269,"./defaults":271,"./draw":272}],275:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var f=t.path?"path":"rect",h=u("type",f),d=["x","y"],p=0;p<2;p++){var g=d[p],v={_fullLayout:r},m=i.coerceRef(t,e,v,g,"","paper");if("path"!==h){var y,b,x,_=.25,w=.75;"paper"!==m?(y=i.getFromId(v,m),x=o.rangeToShapePosition(y),b=o.shapePositionToRange(y)):b=x=n.identity;var A=g+"0",k=g+"1",M=t[A],T=t[k];t[A]=b(t[A],!0),t[k]=b(t[k],!0),i.coercePosition(e,v,u,m,A,_),i.coercePosition(e,v,u,m,k,w),e[A]=x(e[A]),e[k]=x(e[k]),t[A]=M,t[k]=T}}return"path"===h?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":303,"../../plots/cartesian/axes":333,"./attributes":268,"./helpers":273}],276:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":298,"../../plots/animation_attributes":329,"../../plots/font_attributes":353,"../../plots/pad_attributes":360,"./constants":277}],277:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],278:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+S.railTouchRectClass).data([0]);n.enter().append("rect").classed(S.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,S.tickOffset+r.ticklen+r.labelHeight)}).call(M.fill,r.bgcolor).attr("opacity",0),k.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+S.railRectClass).data([0]);r.enter().append("rect").classed(S.railRectClass,!0);var n=e.inputAreaLength-2*S.railInset;r.attr({width:n,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(r,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+S.groupClassName).data(r,i);l.enter().append("g").classed(S.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,L=!0,S=R,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,k=g.titlefont.family,M=g.titlefont.size,T=g.titlefont.color,E=1,L=!1,S=g.title.trim();""===S&&(E=0),S.match(/Click to enter .+ title/)&&(E=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var R="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?a.restyle(t,v,e,m):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":303,"../../lib/svg_text_utils":317,"../../plotly":328,"../../plots/plots":361,"../color":207,"../drawing":230,d3:55,"fast-isnumeric":61}],282:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":298,"../../plots/font_attributes":353,"../../plots/pad_attributes":360,"../color/attributes":206}],283:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],284:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var f=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){b.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],291:[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}},{}],292:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":205,"./components/images":242,"./components/legend":250,"./components/rangeselector":262,"./components/rangeslider":267,"./components/shapes":274,"./components/sliders":280,"./components/updatemenus":286,"./fonts/mathjax_config":293,"./lib/queue":311,"./plot_api/plot_schema":322,"./plot_api/register":323,"./plot_api/set_plot_config":324,"./plot_api/to_image":326,"./plot_api/validate":327,"./plotly":328,"./snapshot":373,"./snapshot/download":370,"./traces/scatter":417,d3:55,"es6-promise":59}],293:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]] -}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],294:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":289,"fast-isnumeric":61}],295:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var v=(new Date).getFullYear();e=((Number(u[0])-v+70)%100+200)%100+v-70}if(!a(e))return l;var m=new Date(0,0,1);if(m.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(m.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(m.setDate(i),m.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(m.setHours(o),m.getHours()!==o)return l;if(u.length>1)return i=m.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=f*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return m.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,v=3*c,m=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":294,"./coerce":295,"./dates":296,"./extend":298,"./filter_unique":299,"./filter_visible":300,"./is_array":304,"./is_plain_object":305,"./loggers":306,"./matrix":307,"./nested_property":308,"./notifier":309,"./search":312,"./stats":315,d3:55}],304:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],305:[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}},{}],306:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,h(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;uMath.max(c,g)||l>Math.max(f,v)))if(lc||Math.abs(n(o,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":307}],311:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;f90&&l.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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":61}],316:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:10,tinycolor2:182}],317:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,v.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math", -d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":290,"../constants/xmlns_namespaces":291,"../lib":303,d3:55}],318:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0&&u.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);var i=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lR.range[0]?[1,2]:[2,1]);else{var O=R.range[0],I=R.range[1];"log"===x?(O<=0&&I<=0&&r(E+".autorange",!0),O<=0?O=I/1e6:I<=0&&(I=O/1e6),r(E+".range[0]",Math.log(O)/Math.LN10),r(E+".range[1]",Math.log(I)/Math.LN10)):(r(E+".range[0]",Math.pow(10,O)),r(E+".range[1]",Math.pow(10,I)))}else r(E+".autorange",!0)}if("reverse"===M)L.range?L.range.reverse():(r(E+".autorange",!0),L.range=[1,0]),S.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var P=m.parts[1],N=m.parts[0],D=a[N]||[],z=D[P]||{};2===m.parts.length&&(null===x&&(e[v]="remove"),"add"===e[v]||b.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?P===-1?(g[N]=D,delete g[v]):g[v]=z:b.log("???",e)),!n(z,"x")&&!n(z,"y")||b.containsAny(v,["color","opacity","align","dash"])||(d.docalc=!0);var F=w.getComponentMethod(N,"drawOne");F(t,P,m.parts.slice(2).join("."),e[v]),delete e[v]}else if(A.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1])C.manageArrayContainers(m,x,g),d.doplot=!0;else{var B=String(m.parts[1]||"");0===m.parts[0].indexOf("scene")?d.doplot=!0:0===m.parts[0].indexOf("geo")?d.doplot=!0:0===m.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===v?d.doplot=!0:!o._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?d.docalc=!0:m.parts[0].indexOf("legend")!==-1?d.dolegend=!0:v.indexOf("title")!==-1?d.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&b.containsAny(B,["tick","exponent","grid","zeroline"])?d.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:m.parts.length>1&&B.indexOf("line")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&"mirror"===B?d.doticks=d.dolayoutstyle=!0:"margin.pad"===v?d.doticks=d.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(d.doplot=!0):d.doplot=!0,m.set(x)}}}var j=t._fullLayout.width,U=t._fullLayout.height;A.supplyDefaults(t),t.layout.autosize&&A.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==j||t._fullLayout.height!==U;return H&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:b.extendDeep({},p)}}function g(t){var e=v.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];v.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=b.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(L.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),b=t("../lib"),x=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),A=t("../plots/plots"),k=t("../plots/cartesian/graph_interact"),M=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),L=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),C=t("./helpers"),R=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=O._basePlotModules,r=0;r=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=C.getGraphDiv(t),!b.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=A.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function g(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var v,m,y=0,x=[],_=void 0===e||null===e,w=Array.isArray(e),k=!_&&!w&&b.isPlainObject(e);if(k)x.push({type:"object",data:g(b.extendFlat({},e))});else if(_||"string"==typeof e)for(v=0;v0&&EE)&&L.push(m);x=L}}x.length>0?f(x):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=C.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!b.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:A.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),A.modifyFrames(t,a)},y.purge=function(t){t=C.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return A.cleanPlot([],{},r,e),A.purge(t),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":230,"../components/errorbars":236,"../constants/xmlns_namespaces":291,"../lib":303,"../lib/events":297,"../lib/queue":311,"../lib/svg_text_utils":317,"../plotly":328,"../plots/cartesian/graph_interact":340,"../plots/plots":361,"../plots/polar":364,"../registry":368,"./helpers":319,"./subroutines":325,d3:55,"fast-isnumeric":61}],321:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],322:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};_(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return _(t,g),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)c(t,r,"xaxis"),c(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;c(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){f(t,r,e+r.name)}):f(t,r,r.name))}),{layoutAttributes:o(t)}}function a(t){var e=h.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):t.arrayOk===!0&&(i[n+"src"]=e(n)):d.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function l(t){function e(t,e,r){if(t){var n=t[A];n&&(delete t[A],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return x(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),x(t,b.layout),t}function c(t,e,r){var n=d.nestedProperty(t,r),i=_({},e.layoutAttributes);i[w]=!0,n.set(i)}function f(t,e,r){var n=d.nestedProperty(t,r),i=_(n.get()||{},e.layoutAttributes);n.set(i)}var h=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),m=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),x=d.extendFlat,_=d.extendDeep,w="_isSubplotObj",A="_isLinkedToArray",k="_deprecated",M=[w,A,k];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=A,r.DEPRECATED=k,r.UNDERSCORE_ATTRS=M,r.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:M.concat.role},traces:t,layout:i(),transforms:e,frames:o(v),animation:o(m)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];M.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||d.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){a=a.slice(0,s).concat([r]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=n(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":303,"../plotly":328,"../snapshot/cloneplot":369,"../snapshot/helpers":372,"../snapshot/svgtoimg":374,"../snapshot/tosvg":376,"fast-isnumeric":61}],327:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;mc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=C&&i<=10||e>=15*C)t._tickround="d";else if(e>=O&&i<=16||e>=R)t._tickround="M";else if(e>=I&&i<=19||e>=O)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(b(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);b(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(W),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(W,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(b(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=H(c):"m"===l?a=V(c):"d"===l?(r||(i="
"+H(c)),a=q(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=Y(c),"S"!==l&&(a+=h(y.round(m(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=q(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&m(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,m(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},P.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===i){var g=n-1,v=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,v)]:[g,v]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r.map(t.l2r||Number)},P.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=P.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},P.saveRangeInitial=function(t,e){for(var r=P.list(t,"",!0),n=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=v-1;a>5;a--)i(a)}},P.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},P.autoTicks(f,s);var h,d=P.tickIncrement(P.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*x||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&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),a(t),t._tmin=P.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=P.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),f=0;fL?(e/=L,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,D)):n>S?(e/=S,t.dtick="M"+i(e,1,z)):n>C?(t.dtick=i(e,C,B),t.tick0="2000-01-02"):n>R?t.dtick=i(e,R,z):n>O?t.dtick=i(e,O,F):n>I?t.dtick=i(e,I,F):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,D))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,D)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,D));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},P.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?U:j,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},P.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]a:f1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],335:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),f=[],h=0;h0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],338:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],339:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),b=t("./constants"),x=!0;e.exports=function(t,e,r,s,_,w,A,k){function M(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+vt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+vt+")").attr("d","M0,0Z"),L()}function L(){pt.selectAll(".select-outline").remove()}function S(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(V,e+at)),i=Math.max(0,Math.min(q,r+ot)),a=Math.abs(n-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,X)/2);st.l=Math.min(at,n),st.r=Math.max(at,n),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!J||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function C(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),x=!1)))}function O(e,r){var i=1===(A+k).length;if(e)z();else if(2!==r||i){if(1===r&&i){var a=A?H[0]:U[0],o="s"===A||"w"===k?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",f="middle";if(a.fixedrange)return;A?(f="n"===A?"top":"bottom","right"===a.side&&(c="right")):"e"===k&&(c="right"),rt.call(h.makeEditable,null,{immediate:!0,background:B.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&u.relayout(t,s,r)})}}else D()}function I(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||B._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void f.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=mt[0]+mt[2]*l,c=(s.bottom-e.clientY)/s.height,h=mt[1]+mt[3]*(1-c);if(k){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222)); -}function a(t,e,r){for(var n,a,o=1-e,s=0;s0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nW.width||Y<0||Y>W.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:k[0]._length/2,Y="ypx"in e?e.ypx:M[0]._length/2;if(R="xval"in e?n(a,e.xval):i(k,X),O="yval"in e?n(a,e.yval):i(M,Y),!g(R[0])||!g(O[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(P=0;P1||D.hoverinfo.indexOf("name")!==-1?D.name:void 0,index:!1,distance:Math.min(Z,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[z]&&(H.subplot=o[z]._subplot),V=q.length,"array"===B){var Q=e[P];"pointNumber"in Q?(H.index=Q.pointNumber,B="closest"):(B="","xval"in Q&&(j=Q.xval,B="x"),"yval"in Q&&(U=Q.yval,B=B?"closest":"y"))}else j=R[F],U=O[F];if(D._module&&D._module.hoverPoints){var $=D._module.hoverPoints(H,j,U,B);if($)for(var K,J=0;J<$.length;J++)K=$[J],g(K.x0)&&g(K.y0)&&q.push(l(K,C))}else v.log("Unrecognized trace type in hover:",D);"closest"===C&&q.length>V&&(q.splice(0,V),Z=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var tt="y"===C&&G.length>1;q.sort(function(t,e){return t.distance-e.distance});var et=b.combine(o.plot_bgcolor||b.background,o.paper_bgcolor),rt={hovermode:C,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(q,rt);c(q,tt?"xa":"ya"),f(nt,tt);var it=t._hoverdata,at=[];for(I=0;I128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):M&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0;r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0),v=h.node().getBoundingClientRect().width+2*I):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,T=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),R=Math.abs(t.y1-t.y0),P=T.width+O+I+v;t.ty0=_-T.top,t.bx=T.width+2*I,t.by=T.height+2*I,t.anchor="start",t.txwidth=T.width,t.tx2width=v,t.offset=0,a?(t.pos=L,m=S+R/2+P<=k,A=S-R/2-P>=0,"top"!==t.idealAlign&&m||!A?m?(S+=R/2,t.anchor="start"):t.anchor="middle":(S-=R/2,t.anchor="end")):(t.pos=S,m=L+C/2+P<=w,A=L-C/2-P>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(a?"rotate("+E+")":""))}),S}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?S:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var v=f[o];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(O+I),s=o+a*(t.txwidth+I),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-R,l=t.offset*C),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*O+l)+","+(O+u)+"v"+(t.by/2-O)+"h"+n*t.bx+"v-"+t.by+"H"+(n*O+l)+"V"+(u-O)+"Z"),i.call(x.setPosition,o+l,u+t.ty0-t.by/2+I).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+a*I+l,u+t.ty0-t.by/2+I),r.select("rect").call(x.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),k=t("./dragbox"),M=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,M,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=T.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":303,"fast-isnumeric":61}],346:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,k=i.xaxes[0]._length,M=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,R,O,I,P,N=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),D=[],z=i.gd,F=[];for(C=0;C0)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*f*Math.abs(n-i))}return l}function r(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var f=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?r:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,o=t[e],l=(t._id||"x").charAt(0);if(n="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,n=n.slice(),!o||2!==o.length)return void(t[e]=n);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),r=0;r<2;r++)if("date"===t.type){if(!a.isDateTime(o[r])){t[e]=n;break}if(o[r]a.MAX_MS&&(o[r]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[r])){if(!i(o[1-r])){t[e]=n;break}o[r]=o[1-r]*(r?10:.1)}if(o[r]<-s?o[r]=-s:o[r]>s&&(o[r]=s),o[0]===o[1]){var f=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=f,o[1]+=f}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?l:r},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var f=c.charAt(0),h=c.substr(1);h=n(h)?Number(h):0,(h<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],351:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(t){var e,r,n,i,a,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,b.push(s),o[s]=a}return o}function f(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=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[u]?r[u].to:f,a=r[c]?r[c].to:h,f[0]===i[0]&&f[1]===i[1]&&h[0]===a[0]&&h[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function h(e,r){function n(e,r){for(i=0;ir.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,b=[],x=c(e),_=Object.keys(x),w=f(y,_,x);if(!w.length)return!1;var A;u&&(A=u());var k,M,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),k=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":303,"../../plotly":328,"../../registry":368,"./axes":333,d3:55}],352:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;ff[d+2]&&(f[d]=-1,f[d+2]=1),h=this[m[d]],h._length=o.viewBox[d+2]-o.viewBox[d],s.doAutoRange(h);o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},y.calcDataBox=function(){var t=this.xaxis,e=this.yaxis,r=t.range,n=e.range,i=t.r2l,a=e.r2l;return[i(r[0]),a(n[0]),i(r[1]),a(n[1])]},y.setRanges=function(t){var e=this.xaxis,r=this.yaxis,n=e.l2r,i=r.l2r;e.range=[n(t[0]),n(t[2])],r.range=[i(t[1]),i(t[3])]},y.updateTraces=function(t,e){var r,n,i,a=Object.keys(this.traces);this.fullData=t;t:for(r=0;r=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"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,f=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=f)}else{p.supplyLayoutGlobalDefaults(a,n);var h=!a.width||!a.height,d=n.autosize,g=t._context&&t._context.autosizable,v=h&&(d||g);v?p.plotAutoSize(t,a,n):h&&p.sanitizeMargins(t),!d&&h&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,n),n._has=p._hasPlotType.bind(n);var m=n._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),f=c.left+c.right,d=c.bottom+c.top,g=1-2*o,v=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(v.width-f)),i=Math.round(g*(v.height-d))}else{var m=l?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,i=parseFloat(m.height)||r.height}var y=p.layoutAttributes.width.min,b=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-i)>1;(_||x)&&(x&&(r.width=n),_&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a;c.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(i=0;i.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,f=r.size,h=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(f*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(f-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var v=l[t].t.val,m=l[t].t.size;if(v>h){var y=(d*v+(m-e.height)*h)/(v-h),b=(m*(1-h)+(d-e.height)*(1-v))/(v-h);y>=0&&b>=0&&y+b>s+o&&(s=y,o=b)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):h.isJSDate(t)?h.ms2DateTime(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)},p.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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,S=L?f.angularAxis.domain:n.extent(k),C=Math.abs(k[1]-k[0]);T&&!M&&(C=0);var R=S.slice();E&&M&&(R[1]+=C);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(R[1]-R[0])/O);var I=f.angularAxis.ticksStep||(R[1]-R[0])/(O*(f.minorTicks+1));A&&(I=Math.max(Math.round(I),1)),R[2]||(R[2]=I);var P=n.range.apply(this,R);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(R.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?C:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var N="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",D=(new DOMParser).parseFromString(N,"application/xml"),z=this.appendChild(this.ownerDocument.importNode(D.documentElement,!0));e=n.select(z)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,B=e.select(".chart-group"),j={fill:"none",stroke:f.tickColor},U={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var H=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();b=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,b=Math.max(10,b),_=[f.margin.left+b,f.margin.top+b],i.range([0,b]),c.layout.radialAxis.domain=i.domain(),F.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),B.attr("transform","translate("+_+")").style({cursor:"crosshair"});var q=[(f.width-(f.margin.left+f.margin.right+2*b+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2];if(q[0]=Math.max(0,q[0]),q[1]=Math.max(0,q[1]),e.select(".outer-group").attr("transform","translate("+q+")"),f.title){var G=e.select("g.title-group text").style(U).text(f.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var Y=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(i.ticks(5));W.enter().append("circle").attr({class:"grid-circle"}).style(j),W.attr("r",i),W.exit().remove()}Y.select("circle.outside-circle").attr({r:b}).style(j);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=n.svg.axis().scale(i).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Y.selectAll(".domain").style(j),Y.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),K=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),K.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(j),K.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(U);var J=$.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+f.labelOffset,i=f.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:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":A?A[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(U);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(B.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[b+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!M){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});B.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;ot=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ct.text(o.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});B.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=i.invert(o.util.getMousePos(Z).radius);var n=o.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(o.util.round(st)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var i=n.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};M&&(u.t=A[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-q[0]-h.left,f.top+f.height/2-q[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.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")})})}),h}var e,r,i,s,l={data:[],layout:{}},u={},c={},f=n.dispatch("hover"),h={};return h.render=function(e){return t(e),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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return i},h.angularScale=function(t){return s},h.svg=function(){return e},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,i=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return i},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("undefined"==typeof 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 r===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=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 s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:h(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,i,a)},"stroke-width":function(t,e){return v["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,i,a)},opacity:function(t,e){return v.opacity(r,i,a)},display:function(t,e){return v.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var v={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},m=n.select(this).selectAll("g.layer").data(l);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],i=n.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=n.merge(i);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,f=c?r.height:u*o.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.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"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(o.length),v=n.scale[c?"linear":"ordinal"]().domain(g).range(l),m=n.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,m(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return v(e)}}),x.exit().remove()}var _=n.svg.axis().scale(m).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var n=t.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(f);var h=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[i.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=i.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};n.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../lib":303,d3:55}],366:[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,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(f=i),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(r),a.config(c).render(f),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,i,a,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},u.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":207,"../../lib":303,"./micropolar":365,"./undo_manager":367,d3:55}],367:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,u=t.layout,c=l([],a),f=l({},u,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(r=0;r1;if(p&&!h&&"category"!==a.type){var g=e.length;if(!(g<=i))return f?e.slice(0,i):e.slice(0,i+1);if(f||d)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;ly;n++)o=l(t,e,a(o));return o>y&&f.log("interp2d didn't converge quickly",o),t}function s(t){var e,r,n,i,a,o,s,l,u=[],c={},f=[],h=t[0],d=[],p=[0,0,0],g=m(t);for(r=0;r=0;a--)i=f[a],r=i[0],n=i[1],o=((c[[r-1,n]]||p)[2]+(c[[r+1,n]]||p)[2]+(c[[r,n-1]]||p)[2]+(c[[r,n+1]]||p)[2])/20,o&&(s[i]=[r,n,o],f.splice(a,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,a,o,s,l,u,c,f,h,d,p,g,v=0;for(o=0;op&&(v=Math.max(v,Math.abs(t[i][a]-d)/(g-p))))}return v}var u=t("fast-isnumeric"),c=t("../../registry"),f=t("../../lib"),h=t("../../plots/cartesian/axes"),d=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),v=t("./convert_column_xyz"),m=t("./max_row_length");e.exports=function(t,e){function r(t){L=e._input.zsmooth=e.zsmooth=!1,f.notifier("cannot fast-zsmooth: "+t)}var a,l,u,y,b,x,_,w,A=h.getFromId(t,e.xaxis||"x"),k=h.getFromId(t,e.yaxis||"y"),M=c.traceIs(e,"contour"),T=c.traceIs(e,"histogram"),E=c.traceIs(e,"gl2d"),L=M?"best":e.zsmooth;if(A._minDtick=0,k._minDtick=0,T){var S=d(t,e);a=S.x,l=S.x0,u=S.dx,y=S.y,b=S.y0,x=S.dy,_=S.z}else g(e)&&v(e,A,k),a=e.x?A.makeCalcdata(e,"x"):[],y=e.y?k.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,b=e.y0||0,x=e.dy||1,_=n(e),(M||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=o(_,e._emptypoints,e._interpz));if("fast"===L)if("log"===A.type||"log"===k.type)r("log axis found");else if(!T){if(a.length){var C=(a[a.length-1]-a[0])/(a.length-1),R=Math.abs(C/100);for(w=0;wR){r("x scale is not linear");break}}if(y.length&&"fast"===L){var O=(y[y.length-1]-y[0])/(y.length-1),I=Math.abs(O/100);for(w=0;wI){r("y scale is not linear");break}}}var P=m(_),N="scaled"===e.xtype?"":a,D=i(e,N,l,u,P,A),z="scaled"===e.ytype?"":y,F=i(e,z,b,x,_.length,k);E||(h.expand(A,D),h.expand(k,F));var B={x:D,y:F,z:_};if(p(e,_,"","z"),M&&e.contours&&"heatmap"===e.contours.coloring){var j="contour"===e.type?"heatmap":"histogram2d";B.xfill=i(j,N,l,u,P,A),B.yfill=i(j,z,b,x,_.length,k)}return[B]};var y=.01,b=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":213,"../../lib":303,"../../plots/cartesian/axes":333,"../../registry":368,"../histogram2d/calc":400,"./convert_column_xyz":388,"./has_columns":390,"./max_row_length":391,"fast-isnumeric":61}],387:[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="cb"+r.uid,u=r.zmin,c=r.zmax;if(n(u)||(u=i.aggNums(Math.min,null,r.z)),n(c)||(c=i.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void a.autoMargin(t,l);var f=e[0].t.cb=s(t,l),h=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});f.fillcolor(h).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":210,"../../components/colorscale":221,"../../lib":303,"../../plots/plots":361,"fast-isnumeric":61}],388:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a=t.x.slice(),o=t.y.slice(),s=t.z,l=t.text,u=Math.min(a.length,o.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(u0&&(n=!0);for(var s=0;sa)return r[t]=a,a-r[t]}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]0?Number(f):c;else if("string"!=typeof f)l.size=c;else{var h=f.charAt(0),d=f.substr(1);d=n(d)?Number(d):0,(d<=0||"date"!==o||"M"!==h||d!==Math.round(d))&&(l.size=c)}var p="autobin"+r;"boolean"!=typeof t[p]&&(t[p]=!((l.start||0===l.start)&&(l.end||0===l.end))),t[p]||delete t["nbins"+r]}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],399:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;iy&&g.splice(y,g.length-y),m.length>y&&m.splice(y,m.length-y),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(g,p,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start=p.c2r(i.tickIncrement(p.r2c(e.xbins.start),e.xbins.size,!0)),e.xbins.end=p.c2r(i.tickIncrement(p.r2c(e.xbins.end),e.xbins.size))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(m,v,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start=v.c2r(i.tickIncrement(v.r2c(e.ybins.start),e.ybins.size,!0)),e.ybins.end=v.c2r(i.tickIncrement(v.r2c(e.ybins.end),e.ybins.size))),e._input.ybins=e.ybins),h=[];var b,x,_=[],w=[],A="string"==typeof e.xbins.size?[]:e.xbins,k="string"==typeof e.xbins.size?[]:e.ybins,M=0,T=[],E=e.histnorm,L=e.histfunc,S=E.indexOf("density")!==-1,C="max"===L||"min"===L,R=C?null:0,O=a.count,I=o[E],P=!1,N=[],D=[],z="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";z&&"count"!==L&&(P="avg"===L,O=a[L]);var F=e.xbins,B=p.r2c(F.start),j=p.r2c(F.end)+(B-i.tickIncrement(B,F.size))/1e6;for(d=B;d=0&&b=0&&x>>1,f)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);if(h)r=h;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var p=o(t.marker.color),g=o(t.marker.border.color),v=t.opacity*t.marker.opacity;p[3]*=v,this.pointcloudOptions.color=p;var m=t.marker.blend;if(null===m){var y=100;m=l.lengthp&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var m={type:"linear"};i.setConvert(m),l=m.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},g.ppad=v.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,i.expand(c,h,g),i.expand(f,d,v);var x=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],410:[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,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=i.aggNums(Math.min,null,c)),n(h)||(h=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":210,"../../components/colorscale":221,"../../lib":303,"../../plots/plots":361,"fast-isnumeric":61}],411:[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":213,"../../components/colorscale/has_colorscale":220,"./subtypes":427}],412:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],413:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var v=s(t,e,g),m=vU!=I>=U&&(C=L[T-1][0],R=L[T][0],S=C+(R-C)*(U-O)/(I-O),z=Math.min(z,S),F=Math.max(F,S));z=Math.max(z,0),F=Math.min(F,h._length);var H=l.defaultLine;return l.opacity(f.fillcolor)?H=f.fillcolor:l.opacity((f.line||{}).color)&&(H=f.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:z,x1:F,y0:U,y1:U,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":207,"../../components/errorbars":236,"../../lib":303,"../../plots/cartesian/constants":338,"../../plots/cartesian/graph_interact":340,"./get_trace_color":415}],417:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":341,"./arrays_to_calcdata":406,"./attributes":407,"./calc":408,"./clean_data":409,"./colorbar":410,"./defaults":413,"./hover":416,"./plot":424,"./select":425,"./style":426,"./subtypes":427}],418:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":216,"../../components/colorscale/has_colorscale":220 -}],419:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),i=A.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/w._length,r=t[1]/A._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w=e.xaxis,A=e.yaxis,k=e.simplify,M=e.connectGaps,T=e.baseTolerance,E=e.linear,L=[],S=.2,C=new Array(t.length),R=0;for(k||(T=S=-1),o=0;oi(f))break;l=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,u=f,d=!1):y=t.length||!f)break;C[R++]=f,s=f}}else C[R++]=u}L.push(C.slice(0,R))}return L}},{"../../constants/numerical":289}],420:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],421:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":61}],423:[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){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":207,"../../components/colorscale/defaults":216,"../../components/colorscale/has_colorscale":220,"./subtypes":427}],424:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function i(t,e,r,n,i,d,g){function v(t){return k?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function b(t){if(t.ids)return y}function x(){return!1}function _(t){var e,r,n=t[0].trace,i=o.select(this),a=c.hasMarkers(n),u=c.hasText(n),f=b(n),h=x,d=x;a&&(h=n.marker.maxdisplayed?m:s.identity),u&&(d=n.marker.maxdisplayed?m:s.identity),r=i.selectAll("path.point"),e=r.data(h,f);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,n).call(l.translatePoints,M,T,n),k&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=v(o.select(this));l.translatePoint(t,e,M,T),l.singlePointStyle(t,e,n)}),k?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=i.selectAll("g"),e=r.data(d,f),e.enter().append("g").append("text"),e.each(function(t){var e=v(o.select(this).select("text"));l.translatePoint(t,e,M,T)}),e.selectAll("text").call(l.textPointStyle,n).each(function(t){var e=t.xp||M.c2p(t.x),r=t.yp||T.c2p(t.y);o.select(this).selectAll("tspan").each(function(){v(o.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,A;a(t,e,r,n,i);var k=!!g&&g.duration>0,M=r.xaxis,T=r.yaxis,E=n[0].trace,L=E.line,S=o.select(d);if(S.call(u.plot,r,g),E.visible===!0){v(S).style("opacity",E.opacity);var C,R,O=E.fill.charAt(E.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=S,f(n);var I="",P=[],N=E._prevtrace;N&&(I=N._prevRevpath||"",R=N._nextFill,P=N._polygons);var D,z,F,B,j,U,H,V,q,G="",X="",Y=[],W=[],Z=s.noop;if(C=E._ownFill,c.hasLines(E)||"none"!==E.fill){for(R&&R.datum(n),["hv","vh","hvh","vhv"].indexOf(L.shape)!==-1?(F=l.steps(L.shape),B=l.steps(L.shape.split("").reverse().join(""))):F=B="spline"===L.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),L.smoothing):l.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},j=function(t){return B(t.reverse())},Y=h(n,{xaxis:M,yaxis:T,connectGaps:E.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),q=E._polygons=new Array(Y.length),A=0;A1}),Z=function(t){return function(e){if(D=F(e),z=j(e),G?O?(G+="L"+D.substr(1),X=z+("L"+X.substr(1))):(G+="Z"+D,X=z+"Z"+X):(G=D,X=z),c.hasLines(E)&&e.length>1){var r=o.select(this);if(r.datum(n),t)v(r.style("opacity",0).attr("d",D).call(l.lineGroupStyle)).style("opacity",1);else{var i=v(r);i.attr("d",D),l.singleLineStyle(n,i)}}}}}var Q=S.selectAll(".js-line").data(W);v(Q.exit()).style("opacity",0).remove(),Q.each(Z(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Z(!0)),Y.length&&(C?U&&V&&(O?("y"===O?U[1]=V[1]=T.c2p(0,!0):"x"===O&&(U[0]=V[0]=M.c2p(0,!0)),v(C).attr("d","M"+V+"L"+U+"L"+G.substr(1))):v(C).attr("d",G+"Z")):"tonext"===E.fill.substr(0,6)&&G&&I&&("tonext"===E.fill?v(R).attr("d",G+"Z"+I+"Z"):v(R).attr("d",G+"L"+I.substr(1)+"Z"),E._polygons=E._polygons.concat(P)),E._prevRevpath=X,E._prevPolygons=q);var $=S.selectAll(".points");w=$.data([n]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,s=r.yaxis,l=o.extent(a.range.map(a.r2l).map(a.l2c)),u=o.extent(s.range.map(s.r2l).map(s.l2c)),f=n[0].trace;if(c.hasMarkers(f)){var h=f.marker.maxdisplayed;if(0!==h){var d=n.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/h),g=0;i.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),f=c.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,r),n(t,p),l=0,u=[];ln?1:-1}),v){s&&(h=s());var m=o.transition().duration(a.duration).ease(a.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()});m.each(function(){p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)})})}else p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":230,"../../components/errorbars":236,"../../lib":303,"../../lib/polygon":310,"./arrays_to_calcdata":406,"./line_points":419,"./link_traces":421,"./subtypes":427,d3:55}],425:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,g=!n.hasMarkers(h)&&!n.hasText(h);if(h.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r=e.length?i:e[a]);return n}function o(t,e,r){return l(R(t,r),C(e,r),r)}function s(t,e,r,n){var i=w(t,e,n);return i=Array.isArray(i[0])?i:a(v.identity,[i],n),l(i,C(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;ii||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 o(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}function s(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 l(t,e,r,n,i,a,o,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var f=0,h=0,d=s(c,l.stride.slice());"float32"===u?f=t.FLOAT:"float64"===u?(f=t.FLOAT,d=!1,u="float32"):"uint8"===u?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,d=!1,u="uint8");var m=1;if(2===c.length)h=t.LUMINANCE,c=[c[0],c[1],1],l=p(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])h=t.ALPHA;else if(2===c[2])h=t.LUMINANCE_ALPHA;else if(3===c[2])h=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");h=t.RGBA}m=c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(h=i),h!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,b=o.indexOf(n)<0;if(b&&o.push(n),f===a&&d)0===l.offset&&l.data.length===y?b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data):b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var _;_=a===t.FLOAT?v.mallocFloat32(y):v.mallocUint8(y);var w=p(_,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&a===t.UNSIGNED_BYTE?x(w,l):g.assign(w,l),b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,_.subarray(0,y)),a===t.FLOAT?v.freeFloat32(_):v.freeUint8(_)}}function u(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function c(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(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 s=u(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new o(t,s,e,r,n,i)}function f(t,e,r,n){var i=u(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new o(t,i,0|e.width,0|e.height,r,n)}function h(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var a=s(n,e.stride.slice()),l=0;"float32"===r?l=t.FLOAT:"float64"===r?(l=t.FLOAT,a=!1,r="float32"):"uint8"===r?l=t.UNSIGNED_BYTE:(l=t.UNSIGNED_BYTE,a=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=p(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}l!==t.FLOAT||t.getExtension("OES_texture_float")||(l=t.UNSIGNED_BYTE,a=!1);var f,h,d=e.size;if(a)f=0===e.offset&&e.data.length===d?e.data:e.data.subarray(e.offset,e.offset+d);else{var m=[n[2],n[2]*n[0],1];h=v.malloc(d,r);var y=p(h,n,m,0);"float32"!==r&&"float64"!==r||l!==t.UNSIGNED_BYTE?g.assign(y,e):x(y,e),f=h.subarray(0,d)}var b=u(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,l,f),a||v.free(h),new o(t,b,n[0],n[1],c,l)}function d(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(m||n(t),"number"==typeof arguments[1])return c(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return c(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(i(e))return f(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return h(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var p=t("ndarray"),g=t("ndarray-ops"),v=t("typedarray-pool");e.exports=d;var m=null,y=null,b=null,x=function(t,e){g.muls(t,e,255)},_=o.prototype;Object.defineProperties(_,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),y.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&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),y.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(),b.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(),b.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(b.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 a(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t|=0,a(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,a(this,this._shape[0],t),t}}}),_.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},_.dispose=function(){this.gl.deleteTexture(this.handle)},_.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)},_.setPixels=function(t,e,r,n){var a=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,i(t)){var o=this._mipLevels.indexOf(n)<0;o?(a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):a.texSubImage2D(a.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");l(a,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:148,"ndarray-ops":147,"typedarray-pool":187}],130:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function R(){return/[^a-fA-F0-9]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function O(){return"."===N?(U.push(N),j=v,D=N,F+1):/[eE]/.test(N)?(U.push(N),j=v,D=N,F+1):"x"===N&&1===U.length&&"0"===U[0]?(j=w,U.push(N),D=N,F+1):/[^\d]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function I(){return"f"===N&&(U.push(N),D=N,F+=1),/[eE]/.test(N)?(U.push(N),D=N,F+1):"-"===N&&/[eE]/.test(D)?(U.push(N),D=N,F+1):/[^\d]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function P(){if(/[^\d\w_]/.test(N)){var t=U.join("");return j=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:m,e(U.join("")),j=u,F}return U.push(N),D=N,F+1}var N,D,z,F=0,B=0,j=u,U=[],H=[],V=1,q=0,G=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return H=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var i=t("./lib/literals"),a=t("./lib/operators"),o=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,f=0,h=1,d=2,p=3,g=4,v=5,m=6,y=7,b=8,x=9,_=10,w=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":133,"./lib/builtins-300es":132,"./lib/literals":135,"./lib/literals-300es":134,"./lib/operators":136}],132:[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":133}],133:[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"]},{}],134:[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":135}],135:[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"]},{}],136:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],137:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":131}],138:[function(t,e,r){r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=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=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),e*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):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+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],139:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function a(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),a(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],a=[],o=[],s=[],r=0;r3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=m.ge(this.leftPoints,t,h),n=m.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var a=this.left?this.left.count:0;if(4*a>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var o=this,l=this.left;l.right;)o=l,l=l.right;if(o===this)l.right=this.right;else{var u=this.left,n=this.right;o.count-=l.count,o.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var u=m.ge(this.leftPoints,t,h);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===x&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},w.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":28}],140:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;r0)return 1<=0)return 1<=0;--e)S(e,0);for(var r=[],e=0;e0;_=_-1&g)x.push(w+"["+T+"+"+v(_)+"]");x.push(m(0));for(var _=0;_0){",h(x[t]),"=1;"),P(t-1,e|1<0&&G.push(s(U,x[H-1])+"*"+o(x[H-1])),B.push(d(U,x[H])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)X.push(o(x[U]));B.push(M+"=("+X.join("*")+")|0",A+"=mallocUint32("+M+")",w+"=mallocUint32("+M+")",T+"=0"),B.push(p(0)+"=0");for(var H=1;H<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 a=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return b(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",A="P",k="N",M="Q",T="X",E="T"},{"typedarray-pool":187}],147:[function(t,e,r){"use strict";function n(t){if(!t)return s;for(var e=0;e>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=a({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]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,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=o({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=o({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=o({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=a({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=a({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=o({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":51}],148:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;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("+u.join(",")+",v){"),n?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var v=0;v=0){d=i"+v+"|0;b+=c"+v+"*d;a"+v+"-=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var v=0;v=0){c=(c+this.stride["+v+"]*i"+v+")|0}else{a.push(this.shape["+v+"]);b.push(this.stride["+v+"])}");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,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",a.join("\n"));return o(f[t],i)}function o(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=f.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),a=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":56}],150:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r="undefined"!=typeof r?r+"":" ",n(r,e)+t}},{"repeat-string":163}],151:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],152:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return a.freeUint32(l),a.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,a,o=1;for(r[0]=0,a=1;a0;--a)n=e/o|0,e=e-n*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}var a=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":140,"typedarray-pool":187}],154:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,s,l,c=0;c<2;++c)if(u[c][n].length>0){o=u[c][n][0],l=c;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=u[f][n],d=0;d0&&(o=p,s=g,l=f)}return a?s:(o&&r(o,l),s)}function a(t,a){var o=u[a][t][0],s=[t];r(o,a);for(var l=o[1^a];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],f=t,h=s[1],d=n(c,f,!0);if(i(e[c],e[f],e[h],e[d])<0)break;s.push(t),l=n(c,f)}return s}function o(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;c0;){var g=(u[0][c].length,a(c,d));o(p,g)?p.push.apply(p,g):(p.length>0&&h.push(p),p=g)}p.length>0&&h.push(p)}return h}e.exports=n;var i=t("compare-angle")},{"compare-angle":49}],155:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function a(t){for(var e=t.length,r=0;r0;){var U=B.pop(),H=O[U];f(H,function(t,e){return t-e});var V,q=H.length,G=j[U];if(0===G){var T=m[U];V=[T]}for(var v=0;v=0)&&(j[X]=1^G,B.push(X),0===G)){var T=m[X];a(T)||(T.reverse(),V.push(T))}}0===G&&d.push(V)}return d}e.exports=a;var o=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),f=t("uniq"),h=t("./lib/trim-leaves")},{"./lib/trim-leaves":155,"edges-to-adjacency-list":58,"planar-dual":154,"point-in-big-polygon":157,"robust-sum":170,"two-product":185,uniq:189}],157:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return!!i&&!!i.queryPoint(r,n)}}function a(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var o=i.key,s=f(r,o[0],o[1]);if(o[0][0]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))return 0;a=1,i=i.right}}return a}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;i1)for(var r=1;r=r)return a.substr(0,r);for(;r>a.length&&e>1;)1&e&&(a+=t),e>>=1,t+=t;return a+=t,a=a.substr(0,r)}var i,a="";e.exports=n},{}],164:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;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=m*n;return o>=s||o<=-s?o:b(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],u=r[1]-n[1],c=t[2]-n[2],f=e[2]-n[2],h=r[2]-n[2],d=a*u,p=o*l,g=o*s,v=i*u,m=i*l,b=a*s,_=c*(d-p)+f*(g-v)+h*(m-b),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(m)+Math.abs(b))*Math.abs(h),A=y*w;return _>A||-_>A?_:x(t,e,r,n)}];c()},{"robust-scale":167,"robust-subtract":169,"robust-sum":170,"two-product":185}],166:[function(t,e,r){"use strict"; +function n(t,e){if(1===t.length)return a(e,t[0]);if(1===e.length)return a(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.length0&&s>0||o<0&&s<0)return!1;var l=a(r,t,e),u=a(i,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,i))}e.exports=i;var a=t("robust-orientation")[3]},{"robust-orientation":165}],169:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],v=h(g);p=i?(a=d,c+=1,c=i?(a=d,c+=1,c0?1:0}},{}],172:[function(t,e,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],173:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,i=t.length;n>1,s=o(t[a],e);s<=0?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function f(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[g],a))break}return r}function h(t,e){if(!e)return f(u(p(t,0)),t,0);for(var r=new Array(e),n=0;n>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){var n=s(r);if(e0){var t=M[0];return a(0,L-1),L-=1,u(0),t}return-1}function h(t,e){var r=M[t];return b[r]===e?t:(b[r]=-(1/0),c(t),f(),b[r]=e,L+=1,c(L-1))}function d(t){if(!x[t]){x[t]=!0;var e=m[t],r=y[t];m[r]>=0&&(m[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&h(T[e],i(e)),T[r]>=0&&h(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||i<0||i===n)break;if(n=i,i=t[n],!x[n]||i<0||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var g=e.length,v=t.length,m=new Array(g),y=new Array(g),b=new Array(g),x=new Array(g),_=0;_>1;_>=0;--_)u(_);for(;;){var S=f();if(S<0||b[S]>r)break;d(S)}for(var C=[],_=0;_=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&R.push([n,i])}}),o.unique(o.normalize(R)),{positions:C,edges:R}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":165,"simplicial-complex":173}],176:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return ol?i-l:o-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=a(r,i,s),u=a(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;if(l=a(s,o,i),u=a(s,o,r),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]}e.exports=i;var a=t("robust-orientation")},{"robust-orientation":165}],177:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=a(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=a(t.right,e);if(l)return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;a0){var s=a(this.slabs[e-1],t);s&&(o?h(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(o){var p=f(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":176,"binary-search-bounds":28,"functional-red-black-tree":62,"robust-orientation":165}],178:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function a(t,e){return Array(e+1).join(t)}var o={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,f,h,d=1,p=t.length,g="",v=[],m=!0,y="";for(s=0;s=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?v[v.length]=n:(!o.number.test(u[8])||m&&!u[3]?y="":(y=m?"+":"-",n=n.toString().replace(o.sign,"")),f=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",h=u[6]-(y+n).length,c=u[6]&&h>0?a(f,h):"",v[v.length]=u[5]?y+n+c:"0"===f?y+c+n:c+y+n)}return v.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],179:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],180:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128===0){f.length>0&&h.push("}}");var d="vExtra"+f.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(M="+"+v[x]+"*c");var T=.5*(p[x].length/y),E=.5+.5*(m[x]/y);k.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+M+")/("+g[x].join("+")+")")}h.push("a.push([",k.join(),"]);","break;")}n.push("}},"),f.length>0&&h.push("}}");for(var L=[],u=0;u<1<0&&(h+=.02);for(var p=new Float32Array(f),g=0,v=-.5*h,d=0;d.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=L(t,360),e=L(e,100),r=L(r,100),0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,i,a=G(t,e,r),o=q(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function M(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){R(t)&&(t="100%");var n=O(t);return t=q(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function S(t){return q(1,G(0,t))}function C(t){return parseInt(t,16)}function R(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function O(t){return"string"==typeof t&&t.indexOf("%")!=-1}function I(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function N(t){return e.round(255*parseFloat(t)).toString(16)}function D(t){return C(t)/255}function z(t){return!!Z.CSS_UNIT.exec(t)}function F(t){t=t.replace(j,"").replace(U,"").toLowerCase();var e=!1;if(Y[t])t=Y[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Z.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),a:D(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),a:D(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.hex3.exec(t))&&{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),format:e?"name":"hex"}}function B(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var j=/^\s+/,U=/\s+$/,H=0,V=e.round,q=e.min,G=e.max,X=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=E(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*L(this._r,255))+"%",g:V(100*L(this._g,255))+"%",b:V(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*L(this._r,255))+"%, "+V(100*L(this._g,255))+"%, "+V(100*L(this._b,255))+"%)":"rgba("+V(100*L(this._r,255))+"%, "+V(100*L(this._g,255))+"%, "+V(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(W[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,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(k,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=P(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return n(s)},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=B(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},n.mostReadable=function(t,e,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var Y=n.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"},W=n.hexNames=T(Y),Z=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],183:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":151}],184:[function(t,e,r){"use strict";function n(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(o(t+1)),r=[],n=0;n0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function f(t){return new Int16Array(o(2*t),0,t)}function h(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return x?new Uint8ClampedArray(o(t),0,t):s(t)}function v(t){return new DataView(o(t),0,t)}function m(t){t=y.nextPow2(t);var e=y.log2(t),r=A[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,A=_.BUFFER;r.free=function(t){if(n.isBuffer(t))A[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){A[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return f(t);case"int32":return h(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return m(t);case"data":case"dataview":return v(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=f,r.mallocInt32=h,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=v,r.mallocBuffer=m,r.clearCache=function(){for(var t=0;t<32;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,A[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":29,buffer:38,dup:57}],188:[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;e8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height= 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":51}],197:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":196}],198:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("opacity"),u("align"),u("bgcolor");var f=u("bordercolor"),h=i.opacity(f);u("borderpad");var d=u("borderwidth"),p=u("showarrow");u("text",p?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font);for(var g=["x","y"],v=[-10,-30],m={_fullLayout:r},y=0;y<2;y++){var b=g[y],x=a.coerceRef(t,e,m,b,"","paper");if(a.coercePosition(e,m,u,x,b,.5),p){var _="a"+b,w=a.coerceRef(t,e,m,_,"pixel");"pixel"!==w&&w!==x&&(w=e[_]="pixel");var A="pixel"===w?v[y]:.4;a.coercePosition(e,m,u,w,_,A)}else u(b+"anchor")}return n.noneOrAll(t,e,["x","y"]),p&&(u("arrowcolor",h?e.bordercolor:i.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(h&&d||1)),n.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":303,"../../plots/cartesian/axes":333,"../color":207,"./attributes":200}],199:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],200:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":298,"../../plots/cartesian/constants":338,"../../plots/font_attributes":353,"./arrow_paths":199}],201:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,f=s-l,h=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),f=Math.max(f,d),h=Math.max(h,d)}r&&r.autorange&&a.expand(r,[r.l2c(r.r2l(e.x))],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(n.r2l(e.y))],{ppadplus:h,ppadminus:f})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":303,"../../plots/cartesian/axes":333,"./draw":203}],202:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),i=t("./annotation_defaults");e.exports=function(t,e){var r={name:"annotations",handleItemDefaults:i};n(t,e,r)}},{"../../plots/array_container_defaults":330,"./annotation_defaults":198}],203:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=$.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,m=Math.round(u+2*tt),y=Math.round(p+2*tt);q._w=u,q._h=p;var x=!1;if(["x","y"].forEach(function(e){var n,i=q[e+"ref"]||e,a=f.getFromId(t,i),o=(W+("x"===e?0:90))*Math.PI/180,s=m*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=q[e+"anchor"];if(a){var u=a.r2fraction(q[e]);if(!a.autorange&&(u<0||u>1)&&(q["a"+e+"ref"]===i?(u=a.r2fraction(q["a"+e]),(u<0||u>1)&&(x=!0)):x=!0,x))return;Y[e]=a._offset+a.r2p(q[e]),n=.5}else n=q[e],"y"===e&&(n=1-n),Y[e]="x"===e?R.l+R.w*n:R.t+R.h*n;var c=0;q["a"+e+"ref"]===i?Y["aa"+e]=a._offset+a.r2p(q["a"+e]):(c=q.showarrow?q["a"+e]:s*r(n,l),Y[e]+=c),q["_"+e+"type"]=a&&a.type,q["_"+e+"size"]=s,q["_"+e+"shift"]=c}),x)return void $.remove();var _,w;q.showarrow&&(_=q.axref===q.xref?Y.x:c.constrain(Y.x-q.ax,1,k.width-1),w=q.ayref===q.yref?Y.y:c.constrain(Y.y-q.ay,1,k.height-1)),Y.x=c.constrain(Y.x,1,k.width-1),Y.y=c.constrain(Y.y,1,k.height-1);var A=tt-s.top,M=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:M,y:A}),nt.selectAll("tspan.line").attr({y:A,x:M})),et.call(d.setRect,K/2,K/2,m-K,y-K);var T=0,E=0;T=q.axref===q.xref?Math.round(Y.aax-m/2):Math.round(Y.x-m/2),E=q.ayref===q.yref?Math.round(Y.aay-y/2):Math.round(Y.y-y/2),$.call(c.setTranslate,T,E);var L="annotations["+e+"]",S=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=q.axref===q.xref?Y.aax+r:Y.x+r,s=q.ayref===q.yref?Y.aay+n:Y.y+n;var u=c.rotationXYMatrix(W,i,s),f=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,m=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!m.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){m.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=q.arrowwidth,x=q.arrowcolor,A=Z.append("g").style({opacity:h.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=A.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(h.stroke,h.rgb(x));b(k,q.arrowhead,"end",q.arrowsize);var M=A.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,S;v.init({element:M.node(),prepFn:function(){var t=c.getTranslate($);E=t.x,S=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){A.attr("transform","translate("+t+","+e+")");var r=f(E,S),n=r[0]+t,i=r[1]+e;$.call(c.setTranslate,n,i),T[L+".x"]=G?G.p2r(G.r2p(q.x)+t):(_+t-R.l)/R.w,T[L+".y"]=X?X.p2r(X.r2p(q.y)+e):1-(w+e-R.t)/R.h,q.axref===q.xref&&(T[L+".ax"]=G?G.p2r(G.r2p(q.ax)+t):(_+t-R.l)/R.w),q.ayref===q.yref&&(T[L+".ay"]=X?X.p2r(X.r2p(q.ay)+e):1-(w+e-R.t)/R.h),Q.attr({transform:"rotate("+W+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};q.showarrow&&S(0,0);var C=c.rotationXYMatrix(W,Y.x,Y.y),O=c.apply2DTransform(C);if(t._context.editable){var I,P,N;v.init({element:$.node(),prepFn:function(){var t=c.getTranslate($);I=t.x,P=t.y,N={}},moveFn:function(t,e){$.call(c.setTranslate,I+t,P+e);var r="pointer";if(q.showarrow)q.axref===q.xref?N[L+".ax"]=G.p2r(G.r2p(q.ax)+t):N[L+".ax"]=q.ax+t,q.ayref===q.yref?N[L+".ay"]=X.p2r(X.r2p(q.ay)+e):N[L+".ay"]=q.ay+e,S(t,e);else{if(G)N[L+".x"]=q.x+t/G._m;else{var n=q._xsize/R.w,i=q.x+q._xshift/R.w-n/2;N[L+".x"]=v.align(i+t/R.w,n,0,1,q.xanchor)}if(X)N[L+".y"]=q.y+e/X._m;else{var a=q._ysize/R.h,o=q.y-q._yshift/R.h-a/2;N[L+".y"]=v.align(o-e/R.h,a,0,1,q.yanchor)}G&&X||(r=v.getCursor(G?.5:N[L+".x"],X?.5:N[L+".y"],q.xanchor,q.yanchor))}var s=O(I,P),l=s[0]+t,u=s[1]+e;$.call(c.setTranslate,I+t,P+e),Q.attr({transform:"rotate("+W+","+l+","+u+")"}),g($,r)},doneFn:function(e){if(g($),e){l.relayout(t,N);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,A=t.layout,k=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return A.annotations=u,y(A,k),void n(t);if("remove"===u)return delete A.annotations,k.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)k._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}k._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=A.annotations[e],E=k.annotations[e];if(T){var L={};"string"==typeof r&&r?L[r]=u:c.isPlainObject(r)&&(L=r);var S=Object.keys(L);for(w=0;w4/3&&(z=H)}}else D&&(B&&(z<1/3?z+=U:z>2/3&&(z-=U)),z=(z-D.domain[0])/(D.domain[1]-D.domain[0]),z=D.fraction2r(z))}D&&D===N&&F&&("log"===F&&"log"!==D.type?z=Math.pow(10,z):"log"!==F&&"log"===D.type&&(z=z>0?Math.log(z)/Math.LN10:void 0)),T[P]=z}}var q={};m(T,q,k),k.annotations[e]=q;var G=f.getFromId(t,q.xref),X=f.getFromId(t,q.yref),Y={x:0,y:0},W=+q.textangle||0,Z=k._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",q.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:q})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),K=q.borderwidth,J=q.borderpad,tt=K+J,et=$.append("rect").attr("class","bg").style("stroke-width",K+"px").call(h.stroke,q.bordercolor).call(h.fill,q.bgcolor),rt=q.font,nt=$.append("text").classed("annotation",!0).attr("data-unformatted",q.text).text(q.text);t._context.editable?nt.call(p.makeEditable,$).call(x).on("edit",function(r){q.text=r,this.attr({"data-unformatted":q.text}),this.call(x);var n={};n["annotations["+e+"].text"]=q.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(x),Q.attr({transform:"rotate("+W+","+Y.x+","+Y.y+")"}).call(d.setPosition,Y.x,Y.y)}}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,f=n-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var g=(u*d-c*h)/p,v=(u*f-l*h)/p;return v<0||v>1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./annotation_defaults"),y=t("./defaults"),b=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":303,"../../lib/setcursor":313,"../../lib/svg_text_utils":317,"../../plotly":328,"../../plots/cartesian/axes":333,"../../plots/plots":361,"../color":207,"../dragelement":228,"../drawing":230,"./annotation_defaults":198,"./defaults":202,"./draw_arrow_head":204,d3:55,"fast-isnumeric":61}],204:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var f,h,d,p,g=(o.getPx(t,"stroke-width")||1)*l,v=t.style("stroke")||a.defaultLine,m=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=c.backoff*g;if("line"===u.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},h={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(f.y-h.y,f.x-h.x),p=d+Math.PI,x){var _=x*Math.cos(d),w=x*Math.sin(d);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),b&&(h.x+=_,h.y+=w,t.attr({x2:h.x,y2:h.y}))}}else if("path"===u.nodeName){var A=u.getTotalLength(),k="";if(y){var M=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(M.y-T.y,M.x-T.x),f=u.getPointAtLength(Math.min(x,A)),x&&(k="0px,"+x+"px,")}if(b){var E=u.getPointAtLength(A),L=u.getPointAtLength(A-.1);if(p=Math.atan2(E.y-L.y,E.x-L.x),h=u.getPointAtLength(Math.max(0,A-x)),x){var S=k?2*x:x;k+=A-S+"px,"+A+"px"}}else k&&(k+=A+"px");k&&t.style("stroke-dasharray",k)}var C=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:v,opacity:m,"stroke-width":0})};y&&C(f,d),b&&C(h,p)}}},{"../color":207,"../drawing":230,"./arrow_paths":199,d3:55,"fast-isnumeric":61}],205:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":200,"./calc_autorange":201,"./defaults":202,"./draw":203}],206:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],207:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(C);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?L[0]:(C[e]+C[e-1])/2,e===C.length-1?L[1]:(C[e]+C[e+1])/2].map(J.c2p).map(Math.round);e!==C.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=O(t).replace("e-",""),o=i(a).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 h=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){n.select(this).attr("d","M"+Y+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+j).call(d.lineGroupStyle,_.line.width,R(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=Y+j+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));A("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:M.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,i=x();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(a,r||{}))}function k(){var r=j+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(z=ot.select("text"),z.node()&&!z.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-Y-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-$;at.select(".cbbg").attr({x:Y-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:Y,y:$+_.ypad+("top"===_.titleside?st:0),width:Math.max(j,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var M=t._fullLayout,T=M._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void M._infolayer.selectAll("g."+e).remove();var E,L=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],C=[],R="function"==typeof _.line.color?_.line.color:function(){return _.line.color},O="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},I=_.levels.end+_.levels.size/100,P=_.levels.size,N=1.001*L[0]-.001*L[1],D=1.001*L[1]-.001*L[0];for(E=_.levels.start;(E-I)*P<0;E+=P)E>N&&EL[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+V-X],J.setScale();var at=M._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+q)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+V-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,A(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ft=c.syncOrAsync([o.previousPromises,w,o.previousPromises,k],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var ht,dt,pt;u.init({element:at.node(),prepFn:function(){ht=at.attr("transform"),h(at)},moveFn:function(t,e){at.attr("transform",ht+" translate("+t+","+e+")"),dt=u.align(W+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,V,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);h(at,r)},doneFn:function(e){h(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},x().index)}})}return ft}function x(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":303,"./flip_scale":218,"./scales":225}],214:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":298,"./attributes":212,"./scales.js":225}],215:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":225}],216:[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,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,g=f?i.nestedProperty(e,d).get()||{}:e,v=p[h+"min"],m=p[h+"max"],y=p.colorscale,b=n(v)&&n(m)&&v=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],219:[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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):e}},{"./default_scale":215,"./is_valid_scale_array":223,"./scales":225}],220:[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(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],227:[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":303}],228:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,g=o.getPlotDiv(t.element)||{},v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":303,"../../plotly":328,"../../plots/cartesian/constants":338,"./align":226,"./cursor":227,"./unhover":229}],229:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":297}],230:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,f,h;t.so?(h=o.outlierwidth,f=o.outliercolor,c=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(h||1)+"px",fill:"none"}):(e.style("stroke-width",h+"px").call(l.fill,c),h&&e.call(l.stroke,f))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),f=(c*c*i-u*u*s)*n,h=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&f/d),2),a.round(e[1]+(d&&h/d),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&h/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var v=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=g.tryColorscale(i,""),s=g.tryColorscale(i,"line");n(t,e,r,o,s,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),i=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,a.select(this),e,n,i)})}},g.tryColorscale=function(t,e){var r=e?c.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):c.identity};var b={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(f.convertToTspans);var h=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*x+1,v=b[l]*c,m=.75*u+b[s]*c+(b[s]-1)*p*u/2;h.attr("transform","translate("+v+","+m+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=M&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":291,"../../lib":303,"../../lib/svg_text_utils":317,"../../registry":368,"../../traces/scatter/make_bubble_size_func":422,"../../traces/scatter/subtypes":427,"../color":207,"../colorscale":221,"./symbol_defs":231,d3:55,"fast-isnumeric":61}],231:[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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:55}],232:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],233:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),f=0;f0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);c&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;f="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");s=!v.size(),s?v=e.append("path").classed("yerror",!0):c&&(v=v.transition().duration(r.duration).ease(r.easing)),v.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var m=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-m)+"v"+2*m+"m0,-"+m+"H"+o.xs,o.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":427,d3:55,"fast-isnumeric":61}],238:[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":207,d3:55}],239:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":338}],240:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}var o=n("source"),l=n("visible",!!o);if(!l)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var u={_fullLayout:r},c=["x","y"],f=0;f<2;f++)a.coerceRef(t,e,u,c[f],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var r={name:l,handleItemDefaults:n};o(t,e,r)}},{"../../lib":303,"../../plots/array_container_defaults":330,"../../plots/cartesian/axes":333,"./attributes":239}],241:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,f=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,h=c*d.x[e.xanchor].offset,p=f*d.y[e.yanchor].offset,g=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,v=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+h,m=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:v,y:m,width:c,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=o?o._id:"",b=l?l._id:"",x=y+b;x&&r.call(i.setClipUrl,"clip"+s._uid+x)}for(var s=t._fullLayout,l=[],u=[],c=[],f=0;f=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}},{}],244:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":298,"../../plots/font_attributes":353,"../color/attributes":206}],245:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],246:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(b!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",v),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":303,"../../plots/layout_attributes":359,"../../registry":368,"./attributes":244,"./helpers":249}],247:[function(t,e,r){"use strict";function n(t,e){function r(r){m.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?f.call(m.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=r.indexOf(f);h===-1?r.push(f):r.splice(h,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;r=s*h,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cn.width-(n.margin.r+n.margin.l)&&(b=0,v+=m,i.height=i.height+m,m=0),f.setTranslate(this,a+b,5+a+e.height/2+v),i.width+=o+r,i.height=Math.max(i.height,e.height),b+=o+r,m=Math.max(e.height,m)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),b=t("./get_legend_data"),x=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(g.setRect,B,t,y.scrollBarWidth,y.scrollBarHeight),M.select("rect").attr({y:m.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var m=r.legend,_=r.showlegend&&b(t.calcdata,m),A=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var k=r._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var M=r._topdefs.selectAll("#"+a).data([0]);M.enter().append("clipPath").attr("id",a).append("rect");var T=k.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var E=k.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=k.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=E.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var C=S.selectAll("g.traces").data(f.identity);C.enter().append("g").attr("class","traces"),C.exit().remove(),C.call(x).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?A.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var R=0!==k.enter().size();R&&(o(t,S,C),s(t));var O=0,I=r.width,P=0,N=r.height;o(t,S,C),m.height>N?l(t):s(t);var D=r._size,z=D.l+D.w*m.x,F=D.t+D.h*(1-m.y);w.isRightAnchor(m)?z-=m.width:w.isCenterAnchor(m)&&(z-=m.width/2),w.isBottomAnchor(m)?F-=m.height:w.isMiddleAnchor(m)&&(F-=m.height/2);var B=m.width,j=D.w;B>j?(z=D.l,B=j):(z+B>I&&(z=I-B),zH?(F=D.t,U=H):(F+U>N&&(F=N-U),Fr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":303,"../../registry":368,"../../traces/pie/style_one":401,"../../traces/scatter/subtypes":427,"../color":207,"../drawing":230,d3:55}],252:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(v,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",o.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":303,"../color":207,"./attributes":256,"./button_attributes":257,"./constants":258}],260:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},i=S.line.width?S.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",S.opacity).call(_.stroke,i).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);C&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+C),t._context.editable&&f(t,a,S,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:b.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>Y&&!t.shiftKey?A.getCursor(i/r,1-a/n):"move";k(e,o),G=o.split("-")[0]}function a(e){B=x.getFromId(t,r.xref),j=x.getFromId(t,r.yref),U=T.getDataToPixel(t,B),H=T.getDataToPixel(t,j,!0),V=T.getPixelToData(t,B),q=T.getPixelToData(t,j,!0);var a="shapes["+n+"]";"path"===r.type?(z=r.path,F=a+".path"):(c=U(r.x0),f=H(r.y0),h=U(r.x1),d=H(r.y1),g=a+".x0",m=a+".y0",b=a+".x1",_=a+".y1"),cY&&(u[S]=r[I]=q(s),u[C]=r[P]=q(l)),f-c>X&&(u[R]=r[N]=V(c),u[O]=r[D]=V(f))}e.attr("d",p(t,r))}var u,c,f,h,d,g,m,b,_,w,M,E,L,S,C,R,O,I,P,N,D,z,F,B,j,U,H,V,q,G,X=10,Y=10,W={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=W.element.getBoundingClientRect();A.init(W)}function h(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):b.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=x.getFromId(t,r.id,"x")._id,i=x.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=x.getFromId(t,e.xref),l=x.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),f=n(e.x1),h=a(e.y0),d=a(e.y1); +if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,v=(h+d)/2,m=Math.abs(p-c),y=Math.abs(v-h),b="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(M.segmentRE,function(t){var n=0,i=t.charAt(0),a=M.paramIsX[i],o=M.paramIsY[i],s=M.numParams[i],l=t.substr(1).replace(M.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),b.log("Ignoring extra params in segment "+t)),i+l})}function v(t,e,r){return t.replace(M.segmentRE,function(t){var n=0,i=t.charAt(0),a=M.paramIsX[i],o=M.paramIsY[i],s=M.numParams[i],l=t.substr(1).replace(M.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var m=t("fast-isnumeric"),y=t("../../plotly"),b=t("../../lib"),x=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),A=t("../dragelement"),k=t("../../lib/setcursor"),M=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),L=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":303,"../../lib/setcursor":313,"../../plotly":328,"../../plots/cartesian/axes":333,"../color":207,"../dragelement":228,"../drawing":230,"./constants":270,"./defaults":271,"./helpers":273,"./shape_defaults":275,"fast-isnumeric":61}],273:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],274:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":268,"./calc_autorange":269,"./defaults":271,"./draw":272}],275:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var f=t.path?"path":"rect",h=u("type",f),d=["x","y"],p=0;p<2;p++){var g=d[p],v={_fullLayout:r},m=i.coerceRef(t,e,v,g,"","paper");if("path"!==h){var y,b,x,_=.25,w=.75;"paper"!==m?(y=i.getFromId(v,m),x=o.rangeToShapePosition(y),b=o.shapePositionToRange(y)):b=x=n.identity;var A=g+"0",k=g+"1",M=t[A],T=t[k];t[A]=b(t[A],!0),t[k]=b(t[k],!0),i.coercePosition(e,v,u,m,A,_),i.coercePosition(e,v,u,m,k,w),e[A]=x(e[A]),e[k]=x(e[k]),t[A]=M,t[k]=T}}return"path"===h?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":303,"../../plots/cartesian/axes":333,"./attributes":268,"./helpers":273}],276:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":298,"../../plots/animation_attributes":329,"../../plots/font_attributes":353,"../../plots/pad_attributes":360,"./constants":277}],277:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],278:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+S.railTouchRectClass).data([0]);n.enter().append("rect").classed(S.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,S.tickOffset+r.ticklen+r.labelHeight)}).call(M.fill,r.bgcolor).attr("opacity",0),k.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+S.railRectClass).data([0]);r.enter().append("rect").classed(S.railRectClass,!0);var n=e.inputAreaLength-2*S.railInset;r.attr({width:n,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(r,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+S.groupClassName).data(r,i);l.enter().append("g").classed(S.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,L=!0,S=R,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,k=g.titlefont.family,M=g.titlefont.size,T=g.titlefont.color,E=1,L=!1,S=g.title.trim();""===S&&(E=0),S.match(/Click to enter .+ title/)&&(E=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var R="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?a.restyle(t,v,e,m):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":303,"../../lib/svg_text_utils":317,"../../plotly":328,"../../plots/plots":361,"../color":207,"../drawing":230,d3:55,"fast-isnumeric":61}],282:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":298,"../../plots/font_attributes":353,"../../plots/pad_attributes":360,"../color/attributes":206}],283:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],284:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var f=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){b.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],291:[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}},{}],292:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":205,"./components/images":242,"./components/legend":250,"./components/rangeselector":262,"./components/rangeslider":267,"./components/shapes":274,"./components/sliders":280,"./components/updatemenus":286,"./fonts/mathjax_config":293,"./lib/queue":311,"./plot_api/plot_schema":322,"./plot_api/register":323,"./plot_api/set_plot_config":324,"./plot_api/to_image":326,"./plot_api/validate":327,"./plotly":328,"./snapshot":373,"./snapshot/download":370,"./traces/scatter":417,d3:55,"es6-promise":59}],293:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0, +MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],294:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":289,"fast-isnumeric":61}],295:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var v=(new Date).getFullYear();e=((Number(u[0])-v+70)%100+200)%100+v-70}if(!a(e))return l;var m=new Date(0,0,1);if(m.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(m.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(m.setDate(i),m.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(m.setHours(o),m.getHours()!==o)return l;if(u.length>1)return i=m.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=f*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return m.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,v=3*c,m=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":294,"./coerce":295,"./dates":296,"./extend":298,"./filter_unique":299,"./filter_visible":300,"./is_array":304,"./is_plain_object":305,"./loggers":306,"./matrix":307,"./nested_property":308,"./notifier":309,"./search":312,"./stats":315,d3:55}],304:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],305:[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}},{}],306:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,h(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;uMath.max(c,g)||l>Math.max(f,v)))if(lc||Math.abs(n(o,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":307}],311:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;f90&&l.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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":61}],316:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:10,tinycolor2:182}],317:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,v.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&"); +},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":290,"../constants/xmlns_namespaces":291,"../lib":303,d3:55}],318:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0&&u.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);var i=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lR.range[0]?[1,2]:[2,1]);else{var O=R.range[0],I=R.range[1];"log"===x?(O<=0&&I<=0&&r(E+".autorange",!0),O<=0?O=I/1e6:I<=0&&(I=O/1e6),r(E+".range[0]",Math.log(O)/Math.LN10),r(E+".range[1]",Math.log(I)/Math.LN10)):(r(E+".range[0]",Math.pow(10,O)),r(E+".range[1]",Math.pow(10,I)))}else r(E+".autorange",!0)}if("reverse"===M)L.range?L.range.reverse():(r(E+".autorange",!0),L.range=[1,0]),S.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var P=m.parts[1],N=m.parts[0],D=a[N]||[],z=D[P]||{};2===m.parts.length&&(null===x&&(e[v]="remove"),"add"===e[v]||b.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?P===-1?(g[N]=D,delete g[v]):g[v]=z:b.log("???",e)),!n(z,"x")&&!n(z,"y")||b.containsAny(v,["color","opacity","align","dash"])||(d.docalc=!0);var F=w.getComponentMethod(N,"drawOne");F(t,P,m.parts.slice(2).join("."),e[v]),delete e[v]}else if(A.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1])C.manageArrayContainers(m,x,g),d.doplot=!0;else{var B=String(m.parts[1]||"");0===m.parts[0].indexOf("scene")?d.doplot=!0:0===m.parts[0].indexOf("geo")?d.doplot=!0:0===m.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===v?d.doplot=!0:!o._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?d.docalc=!0:m.parts[0].indexOf("legend")!==-1?d.dolegend=!0:v.indexOf("title")!==-1?d.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&b.containsAny(B,["tick","exponent","grid","zeroline"])?d.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:m.parts.length>1&&B.indexOf("line")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&"mirror"===B?d.doticks=d.dolayoutstyle=!0:"margin.pad"===v?d.doticks=d.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(d.doplot=!0):d.doplot=!0,m.set(x)}}}var j=t._fullLayout.width,U=t._fullLayout.height;A.supplyDefaults(t),t.layout.autosize&&A.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==j||t._fullLayout.height!==U;return H&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:b.extendDeep({},p)}}function g(t){var e=v.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];v.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=b.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(L.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),b=t("../lib"),x=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),A=t("../plots/plots"),k=t("../plots/cartesian/graph_interact"),M=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),L=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),C=t("./helpers"),R=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=O._basePlotModules,r=0;r=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=C.getGraphDiv(t),!b.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=A.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function g(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var v,m,y=0,x=[],_=void 0===e||null===e,w=Array.isArray(e),k=!_&&!w&&b.isPlainObject(e);if(k)x.push({type:"object",data:g(b.extendFlat({},e))});else if(_||"string"==typeof e)for(v=0;v0&&EE)&&L.push(m);x=L}}x.length>0?f(x):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=C.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!b.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:A.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),A.modifyFrames(t,a)},y.purge=function(t){t=C.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return A.cleanPlot([],{},r,e),A.purge(t),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":230,"../components/errorbars":236,"../constants/xmlns_namespaces":291,"../lib":303,"../lib/events":297,"../lib/queue":311,"../lib/svg_text_utils":317,"../plotly":328,"../plots/cartesian/graph_interact":340,"../plots/plots":361,"../plots/polar":364,"../registry":368,"./helpers":319,"./subroutines":325,d3:55,"fast-isnumeric":61}],321:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],322:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};_(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return _(t,g),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)c(t,r,"xaxis"),c(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;c(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){f(t,r,e+r.name)}):f(t,r,r.name))}),{layoutAttributes:o(t)}}function a(t){var e=h.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):t.arrayOk===!0&&(i[n+"src"]=e(n)):d.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function l(t){function e(t,e,r){if(t){var n=t[A];n&&(delete t[A],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return x(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),x(t,b.layout),t}function c(t,e,r){var n=d.nestedProperty(t,r),i=_({},e.layoutAttributes);i[w]=!0,n.set(i)}function f(t,e,r){var n=d.nestedProperty(t,r),i=_(n.get()||{},e.layoutAttributes);n.set(i)}var h=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),m=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),x=d.extendFlat,_=d.extendDeep,w="_isSubplotObj",A="_isLinkedToArray",k="_deprecated",M=[w,A,k];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=A,r.DEPRECATED=k,r.UNDERSCORE_ATTRS=M,r.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:M.concat.role},traces:t,layout:i(),transforms:e,frames:o(v),animation:o(m)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];M.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||d.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){a=a.slice(0,s).concat([r]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=n(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":303,"../plotly":328,"../snapshot/cloneplot":369,"../snapshot/helpers":372,"../snapshot/svgtoimg":374,"../snapshot/tosvg":376,"fast-isnumeric":61}],327:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;mc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=C&&i<=10||e>=15*C)t._tickround="d";else if(e>=O&&i<=16||e>=R)t._tickround="M";else if(e>=I&&i<=19||e>=O)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(b(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);b(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(W),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(W,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(b(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=H(c):"m"===l?a=V(c):"d"===l?(r||(i="
"+H(c)),a=q(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=Y(c),"S"!==l&&(a+=h(y.round(m(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=q(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&m(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,m(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},P.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===i){var g=n-1,v=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,v)]:[g,v]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r.map(t.l2r||Number)},P.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=P.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},P.saveRangeInitial=function(t,e){for(var r=P.list(t,"",!0),n=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=v-1;a>5;a--)i(a)}},P.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},P.autoTicks(f,s);var h,d=P.tickIncrement(P.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*x||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&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),a(t),t._tmin=P.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=P.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),f=0;fL?(e/=L,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,D)):n>S?(e/=S,t.dtick="M"+i(e,1,z)):n>C?(t.dtick=i(e,C,B),t.tick0="2000-01-02"):n>R?t.dtick=i(e,R,z):n>O?t.dtick=i(e,O,F):n>I?t.dtick=i(e,I,F):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,D))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,D)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,D));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},P.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?U:j,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},P.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]a:f1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],335:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),f=[],h=0;h0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],338:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],339:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),b=t("./constants"),x=!0;e.exports=function(t,e,r,s,_,w,A,k){function M(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+vt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+vt+")").attr("d","M0,0Z"),L()}function L(){pt.selectAll(".select-outline").remove()}function S(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(V,e+at)),i=Math.max(0,Math.min(q,r+ot)),a=Math.abs(n-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,X)/2);st.l=Math.min(at,n),st.r=Math.max(at,n),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!J||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function C(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),x=!1)))}function O(e,r){var i=1===(A+k).length;if(e)z();else if(2!==r||i){if(1===r&&i){var a=A?H[0]:U[0],o="s"===A||"w"===k?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",f="middle";if(a.fixedrange)return;A?(f="n"===A?"top":"bottom","right"===a.side&&(c="right")):"e"===k&&(c="right"),rt.call(h.makeEditable,null,{immediate:!0,background:B.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&u.relayout(t,s,r)})}}else D()}function I(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||B._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void f.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=mt[0]+mt[2]*l,c=(s.bottom-e.clientY)/s.height,h=mt[1]+mt[3]*(1-c);if(k){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,r){for(var n,a,o=1-e,s=0;s0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nW.width||Y<0||Y>W.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:k[0]._length/2,Y="ypx"in e?e.ypx:M[0]._length/2;if(R="xval"in e?n(a,e.xval):i(k,X),O="yval"in e?n(a,e.yval):i(M,Y),!g(R[0])||!g(O[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(P=0;P1||D.hoverinfo.indexOf("name")!==-1?D.name:void 0,index:!1,distance:Math.min(Z,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[z]&&(H.subplot=o[z]._subplot),V=q.length,"array"===B){var Q=e[P];"pointNumber"in Q?(H.index=Q.pointNumber,B="closest"):(B="","xval"in Q&&(j=Q.xval,B="x"),"yval"in Q&&(U=Q.yval,B=B?"closest":"y"))}else j=R[F],U=O[F];if(D._module&&D._module.hoverPoints){var $=D._module.hoverPoints(H,j,U,B);if($)for(var K,J=0;J<$.length;J++)K=$[J],g(K.x0)&&g(K.y0)&&q.push(l(K,C))}else v.log("Unrecognized trace type in hover:",D);"closest"===C&&q.length>V&&(q.splice(0,V),Z=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var tt="y"===C&&G.length>1;q.sort(function(t,e){return t.distance-e.distance});var et=b.combine(o.plot_bgcolor||b.background,o.paper_bgcolor),rt={hovermode:C,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(q,rt);c(q,tt?"xa":"ya"),f(nt,tt);var it=t._hoverdata,at=[];for(I=0;I128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):M&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0;r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0),v=h.node().getBoundingClientRect().width+2*I):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,T=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),R=Math.abs(t.y1-t.y0),P=T.width+O+I+v;t.ty0=_-T.top,t.bx=T.width+2*I,t.by=T.height+2*I,t.anchor="start",t.txwidth=T.width,t.tx2width=v,t.offset=0,a?(t.pos=L,m=S+R/2+P<=k,A=S-R/2-P>=0,"top"!==t.idealAlign&&m||!A?m?(S+=R/2,t.anchor="start"):t.anchor="middle":(S-=R/2,t.anchor="end")):(t.pos=S,m=L+C/2+P<=w,A=L-C/2-P>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(a?"rotate("+E+")":""))}),S}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?S:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var v=f[o];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(O+I),s=o+a*(t.txwidth+I),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-R,l=t.offset*C),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*O+l)+","+(O+u)+"v"+(t.by/2-O)+"h"+n*t.bx+"v-"+t.by+"H"+(n*O+l)+"V"+(u-O)+"Z"),i.call(x.setPosition,o+l,u+t.ty0-t.by/2+I).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+a*I+l,u+t.ty0-t.by/2+I),r.select("rect").call(x.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),k=t("./dragbox"),M=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,M,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=T.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":303,"fast-isnumeric":61}],346:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,k=i.xaxes[0]._length,M=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,R,O,I,P,N=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),D=[],z=i.gd,F=[];for(C=0;C0)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*f*Math.abs(n-i))}return l}function r(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var f=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?r:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,o=t[e],l=(t._id||"x").charAt(0);if(n="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,n=n.slice(),!o||2!==o.length)return void(t[e]=n);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),r=0;r<2;r++)if("date"===t.type){if(!a.isDateTime(o[r])){t[e]=n;break}if(o[r]a.MAX_MS&&(o[r]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[r])){if(!i(o[1-r])){t[e]=n;break}o[r]=o[1-r]*(r?10:.1)}if(o[r]<-s?o[r]=-s:o[r]>s&&(o[r]=s),o[0]===o[1]){var f=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=f,o[1]+=f}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?l:r},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var f=c.charAt(0),h=c.substr(1);h=n(h)?Number(h):0,(h<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],351:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(t){var e,r,n,i,a,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,b.push(s),o[s]=a}return o}function f(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=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[u]?r[u].to:f,a=r[c]?r[c].to:h,f[0]===i[0]&&f[1]===i[1]&&h[0]===a[0]&&h[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function h(e,r){function n(e,r){for(i=0;ir.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,b=[],x=c(e),_=Object.keys(x),w=f(y,_,x);if(!w.length)return!1;var A;u&&(A=u());var k,M,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),k=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":303,"../../plotly":328,"../../registry":368,"./axes":333,d3:55}],352:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;ff[d+2]&&(f[d]=-1,f[d+2]=1),h=this[m[d]],h._length=o.viewBox[d+2]-o.viewBox[d],s.doAutoRange(h);o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},y.calcDataBox=function(){var t=this.xaxis,e=this.yaxis,r=t.range,n=e.range,i=t.r2l,a=e.r2l;return[i(r[0]),a(n[0]),i(r[1]),a(n[1])]},y.setRanges=function(t){var e=this.xaxis,r=this.yaxis,n=e.l2r,i=r.l2r;e.range=[n(t[0]),n(t[2])],r.range=[i(t[1]),i(t[3])]},y.updateTraces=function(t,e){var r,n,i,a=Object.keys(this.traces);this.fullData=t;t:for(r=0;r=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"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,f=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=f)}else{p.supplyLayoutGlobalDefaults(a,n);var h=!a.width||!a.height,d=n.autosize,g=t._context&&t._context.autosizable,v=h&&(d||g);v?p.plotAutoSize(t,a,n):h&&p.sanitizeMargins(t),!d&&h&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,n),n._has=p._hasPlotType.bind(n);var m=n._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),f=c.left+c.right,d=c.bottom+c.top,g=1-2*o,v=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(v.width-f)),i=Math.round(g*(v.height-d))}else{var m=l?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,i=parseFloat(m.height)||r.height}var y=p.layoutAttributes.width.min,b=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-i)>1;(_||x)&&(x&&(r.width=n),_&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a;c.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(i=0;i.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,f=r.size,h=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(f*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(f-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var v=l[t].t.val,m=l[t].t.size;if(v>h){var y=(d*v+(m-e.height)*h)/(v-h),b=(m*(1-h)+(d-e.height)*(1-v))/(v-h);y>=0&&b>=0&&y+b>s+o&&(s=y,o=b)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):h.isJSDate(t)?h.ms2DateTime(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)},p.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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,S=L?f.angularAxis.domain:n.extent(k),C=Math.abs(k[1]-k[0]);T&&!M&&(C=0);var R=S.slice();E&&M&&(R[1]+=C);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(R[1]-R[0])/O);var I=f.angularAxis.ticksStep||(R[1]-R[0])/(O*(f.minorTicks+1));A&&(I=Math.max(Math.round(I),1)),R[2]||(R[2]=I);var P=n.range.apply(this,R);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(R.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?C:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var N="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",D=(new DOMParser).parseFromString(N,"application/xml"),z=this.appendChild(this.ownerDocument.importNode(D.documentElement,!0));e=n.select(z)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,B=e.select(".chart-group"),j={fill:"none",stroke:f.tickColor},U={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var H=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();b=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,b=Math.max(10,b),_=[f.margin.left+b,f.margin.top+b],i.range([0,b]),c.layout.radialAxis.domain=i.domain(),F.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),B.attr("transform","translate("+_+")").style({cursor:"crosshair"});var q=[(f.width-(f.margin.left+f.margin.right+2*b+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2];if(q[0]=Math.max(0,q[0]),q[1]=Math.max(0,q[1]),e.select(".outer-group").attr("transform","translate("+q+")"),f.title){var G=e.select("g.title-group text").style(U).text(f.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var Y=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(i.ticks(5));W.enter().append("circle").attr({class:"grid-circle"}).style(j),W.attr("r",i),W.exit().remove()}Y.select("circle.outside-circle").attr({r:b}).style(j);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=n.svg.axis().scale(i).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Y.selectAll(".domain").style(j),Y.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),K=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),K.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(j),K.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(U);var J=$.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+f.labelOffset,i=f.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:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":A?A[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(U);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(B.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[b+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!M){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});B.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;ot=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ct.text(o.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});B.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=i.invert(o.util.getMousePos(Z).radius);var n=o.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(o.util.round(st)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var i=n.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};M&&(u.t=A[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-q[0]-h.left,f.top+f.height/2-q[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.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")})})}),h}var e,r,i,s,l={data:[],layout:{}},u={},c={},f=n.dispatch("hover"),h={};return h.render=function(e){return t(e),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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return i},h.angularScale=function(t){return s},h.svg=function(){return e},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,i=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return i},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("undefined"==typeof 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 r===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=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 s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:h(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,i,a)},"stroke-width":function(t,e){return v["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,i,a)},opacity:function(t,e){return v.opacity(r,i,a)},display:function(t,e){return v.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var v={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},m=n.select(this).selectAll("g.layer").data(l);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],i=n.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=n.merge(i);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,f=c?r.height:u*o.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.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"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(o.length),v=n.scale[c?"linear":"ordinal"]().domain(g).range(l),m=n.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,m(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return v(e)}}),x.exit().remove()}var _=n.svg.axis().scale(m).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var n=t.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(f);var h=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[i.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=i.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};n.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../lib":303,d3:55}],366:[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,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(f=i),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(r),a.config(c).render(f),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,i,a,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},u.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":207,"../../lib":303,"./micropolar":365,"./undo_manager":367,d3:55}],367:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,u=t.layout,c=l([],a),f=l({},u,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(r=0;r1;if(p&&!h&&"category"!==a.type){var g=e.length;if(!(g<=i))return f?e.slice(0,i):e.slice(0,i+1);if(f||d)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;ly;n++)o=l(t,e,a(o));return o>y&&f.log("interp2d didn't converge quickly",o),t}function s(t){var e,r,n,i,a,o,s,l,u=[],c={},f=[],h=t[0],d=[],p=[0,0,0],g=m(t);for(r=0;r=0;a--)i=f[a],r=i[0],n=i[1],o=((c[[r-1,n]]||p)[2]+(c[[r+1,n]]||p)[2]+(c[[r,n-1]]||p)[2]+(c[[r,n+1]]||p)[2])/20,o&&(s[i]=[r,n,o],f.splice(a,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,a,o,s,l,u,c,f,h,d,p,g,v=0;for(o=0;op&&(v=Math.max(v,Math.abs(t[i][a]-d)/(g-p))))}return v}var u=t("fast-isnumeric"),c=t("../../registry"),f=t("../../lib"),h=t("../../plots/cartesian/axes"),d=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),v=t("./convert_column_xyz"),m=t("./max_row_length");e.exports=function(t,e){function r(t){L=e._input.zsmooth=e.zsmooth=!1,f.notifier("cannot fast-zsmooth: "+t)}var a,l,u,y,b,x,_,w,A=h.getFromId(t,e.xaxis||"x"),k=h.getFromId(t,e.yaxis||"y"),M=c.traceIs(e,"contour"),T=c.traceIs(e,"histogram"),E=c.traceIs(e,"gl2d"),L=M?"best":e.zsmooth;if(A._minDtick=0,k._minDtick=0,T){var S=d(t,e);a=S.x,l=S.x0,u=S.dx,y=S.y,b=S.y0,x=S.dy,_=S.z}else g(e)&&v(e,A,k),a=e.x?A.makeCalcdata(e,"x"):[],y=e.y?k.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,b=e.y0||0,x=e.dy||1,_=n(e),(M||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=o(_,e._emptypoints,e._interpz));if("fast"===L)if("log"===A.type||"log"===k.type)r("log axis found");else if(!T){if(a.length){var C=(a[a.length-1]-a[0])/(a.length-1),R=Math.abs(C/100);for(w=0;wR){r("x scale is not linear");break}}if(y.length&&"fast"===L){var O=(y[y.length-1]-y[0])/(y.length-1),I=Math.abs(O/100);for(w=0;wI){r("y scale is not linear");break}}}var P=m(_),N="scaled"===e.xtype?"":a,D=i(e,N,l,u,P,A),z="scaled"===e.ytype?"":y,F=i(e,z,b,x,_.length,k);E||(h.expand(A,D),h.expand(k,F));var B={x:D,y:F,z:_};if(p(e,_,"","z"),M&&e.contours&&"heatmap"===e.contours.coloring){var j="contour"===e.type?"heatmap":"histogram2d";B.xfill=i(j,N,l,u,P,A),B.yfill=i(j,z,b,x,_.length,k)}return[B]};var y=.01,b=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":213,"../../lib":303,"../../plots/cartesian/axes":333,"../../registry":368,"../histogram2d/calc":400,"./convert_column_xyz":388,"./has_columns":390,"./max_row_length":391,"fast-isnumeric":61}],387:[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="cb"+r.uid,u=r.zmin,c=r.zmax;if(n(u)||(u=i.aggNums(Math.min,null,r.z)),n(c)||(c=i.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void a.autoMargin(t,l);var f=e[0].t.cb=s(t,l),h=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});f.fillcolor(h).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":210,"../../components/colorscale":221,"../../lib":303,"../../plots/plots":361,"fast-isnumeric":61}],388:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a=t.x.slice(),o=t.y.slice(),s=t.z,l=t.text,u=Math.min(a.length,o.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(u0&&(n=!0);for(var s=0;sa)return r[t]=a,a-r[t]}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]0?Number(f):c;else if("string"!=typeof f)l.size=c;else{var h=f.charAt(0),d=f.substr(1);d=n(d)?Number(d):0,(d<=0||"date"!==o||"M"!==h||d!==Math.round(d))&&(l.size=c)}var p="autobin"+r;"boolean"!=typeof t[p]&&(t[p]=!((l.start||0===l.start)&&(l.end||0===l.end))),t[p]||delete t["nbins"+r]}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],399:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;iy&&g.splice(y,g.length-y),m.length>y&&m.splice(y,m.length-y),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(g,p,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start=p.c2r(i.tickIncrement(p.r2c(e.xbins.start),e.xbins.size,!0)),e.xbins.end=p.c2r(i.tickIncrement(p.r2c(e.xbins.end),e.xbins.size))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(m,v,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start=v.c2r(i.tickIncrement(v.r2c(e.ybins.start),e.ybins.size,!0)),e.ybins.end=v.c2r(i.tickIncrement(v.r2c(e.ybins.end),e.ybins.size))),e._input.ybins=e.ybins),h=[];var b,x,_=[],w=[],A="string"==typeof e.xbins.size?[]:e.xbins,k="string"==typeof e.xbins.size?[]:e.ybins,M=0,T=[],E=e.histnorm,L=e.histfunc,S=E.indexOf("density")!==-1,C="max"===L||"min"===L,R=C?null:0,O=a.count,I=o[E],P=!1,N=[],D=[],z="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";z&&"count"!==L&&(P="avg"===L,O=a[L]);var F=e.xbins,B=p.r2c(F.start),j=p.r2c(F.end)+(B-i.tickIncrement(B,F.size))/1e6;for(d=B;d=0&&b=0&&x>>1,f)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);if(h)r=h;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var p=o(t.marker.color),g=o(t.marker.border.color),v=t.opacity*t.marker.opacity;p[3]*=v,this.pointcloudOptions.color=p;var m=t.marker.blend;if(null===m){var y=100;m=l.lengthp&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var m={type:"linear"};i.setConvert(m),l=m.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},g.ppad=v.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,i.expand(c,h,g),i.expand(f,d,v);var x=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],410:[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,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=i.aggNums(Math.min,null,c)),n(h)||(h=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":210,"../../components/colorscale":221,"../../lib":303,"../../plots/plots":361,"fast-isnumeric":61}],411:[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":213,"../../components/colorscale/has_colorscale":220,"./subtypes":427}],412:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],413:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var v=s(t,e,g),m=vU!=I>=U&&(C=L[T-1][0],R=L[T][0],S=C+(R-C)*(U-O)/(I-O),z=Math.min(z,S),F=Math.max(F,S));z=Math.max(z,0),F=Math.min(F,h._length);var H=l.defaultLine;return l.opacity(f.fillcolor)?H=f.fillcolor:l.opacity((f.line||{}).color)&&(H=f.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:z,x1:F,y0:U,y1:U,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":207,"../../components/errorbars":236,"../../lib":303,"../../plots/cartesian/constants":338,"../../plots/cartesian/graph_interact":340,"./get_trace_color":415}],417:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":341,"./arrays_to_calcdata":406,"./attributes":407,"./calc":408,"./clean_data":409,"./colorbar":410,"./defaults":413,"./hover":416,"./plot":424,"./select":425,"./style":426,"./subtypes":427}],418:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":216, +"../../components/colorscale/has_colorscale":220}],419:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),i=A.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/w._length,r=t[1]/A._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w=e.xaxis,A=e.yaxis,k=e.simplify,M=e.connectGaps,T=e.baseTolerance,E=e.linear,L=[],S=.2,C=new Array(t.length),R=0;for(k||(T=S=-1),o=0;oi(f))break;l=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,u=f,d=!1):y=t.length||!f)break;C[R++]=f,s=f}}else C[R++]=u}L.push(C.slice(0,R))}return L}},{"../../constants/numerical":289}],420:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],421:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":61}],423:[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){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":207,"../../components/colorscale/defaults":216,"../../components/colorscale/has_colorscale":220,"./subtypes":427}],424:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function i(t,e,r,n,i,d,g){function v(t){return k?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function b(t){if(t.ids)return y}function x(){return!1}function _(t){var e,r,n=t[0].trace,i=o.select(this),a=c.hasMarkers(n),u=c.hasText(n),f=b(n),h=x,d=x;a&&(h=n.marker.maxdisplayed?m:s.identity),u&&(d=n.marker.maxdisplayed?m:s.identity),r=i.selectAll("path.point"),e=r.data(h,f);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,n).call(l.translatePoints,M,T,n),k&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=v(o.select(this));l.translatePoint(t,e,M,T),l.singlePointStyle(t,e,n)}),k?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=i.selectAll("g"),e=r.data(d,f),e.enter().append("g").append("text"),e.each(function(t){var e=v(o.select(this).select("text"));l.translatePoint(t,e,M,T)}),e.selectAll("text").call(l.textPointStyle,n).each(function(t){var e=t.xp||M.c2p(t.x),r=t.yp||T.c2p(t.y);o.select(this).selectAll("tspan").each(function(){v(o.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,A;a(t,e,r,n,i);var k=!!g&&g.duration>0,M=r.xaxis,T=r.yaxis,E=n[0].trace,L=E.line,S=o.select(d);if(S.call(u.plot,r,g),E.visible===!0){v(S).style("opacity",E.opacity);var C,R,O=E.fill.charAt(E.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=S,f(n);var I="",P=[],N=E._prevtrace;N&&(I=N._prevRevpath||"",R=N._nextFill,P=N._polygons);var D,z,F,B,j,U,H,V,q,G="",X="",Y=[],W=[],Z=s.noop;if(C=E._ownFill,c.hasLines(E)||"none"!==E.fill){for(R&&R.datum(n),["hv","vh","hvh","vhv"].indexOf(L.shape)!==-1?(F=l.steps(L.shape),B=l.steps(L.shape.split("").reverse().join(""))):F=B="spline"===L.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),L.smoothing):l.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},j=function(t){return B(t.reverse())},Y=h(n,{xaxis:M,yaxis:T,connectGaps:E.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),q=E._polygons=new Array(Y.length),A=0;A1}),Z=function(t){return function(e){if(D=F(e),z=j(e),G?O?(G+="L"+D.substr(1),X=z+("L"+X.substr(1))):(G+="Z"+D,X=z+"Z"+X):(G=D,X=z),c.hasLines(E)&&e.length>1){var r=o.select(this);if(r.datum(n),t)v(r.style("opacity",0).attr("d",D).call(l.lineGroupStyle)).style("opacity",1);else{var i=v(r);i.attr("d",D),l.singleLineStyle(n,i)}}}}}var Q=S.selectAll(".js-line").data(W);v(Q.exit()).style("opacity",0).remove(),Q.each(Z(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Z(!0)),Y.length&&(C?U&&V&&(O?("y"===O?U[1]=V[1]=T.c2p(0,!0):"x"===O&&(U[0]=V[0]=M.c2p(0,!0)),v(C).attr("d","M"+V+"L"+U+"L"+G.substr(1))):v(C).attr("d",G+"Z")):"tonext"===E.fill.substr(0,6)&&G&&I&&("tonext"===E.fill?v(R).attr("d",G+"Z"+I+"Z"):v(R).attr("d",G+"L"+I.substr(1)+"Z"),E._polygons=E._polygons.concat(P)),E._prevRevpath=X,E._prevPolygons=q);var $=S.selectAll(".points");w=$.data([n]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,s=r.yaxis,l=o.extent(a.range.map(a.r2l).map(a.l2c)),u=o.extent(s.range.map(s.r2l).map(s.l2c)),f=n[0].trace;if(c.hasMarkers(f)){var h=f.marker.maxdisplayed;if(0!==h){var d=n.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/h),g=0;i.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),f=c.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,r),n(t,p),l=0,u=[];ln?1:-1}),v){s&&(h=s());var m=o.transition().duration(a.duration).ease(a.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()});m.each(function(){p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)})})}else p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":230,"../../components/errorbars":236,"../../lib":303,"../../lib/polygon":310,"./arrays_to_calcdata":406,"./line_points":419,"./link_traces":421,"./subtypes":427,d3:55}],425:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,g=!n.hasMarkers(h)&&!n.hasText(h);if(h.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r=e.length?i:e[a]);return n}function o(t,e,r){return l(R(t,r),C(e,r),r)}function s(t,e,r,n){var i=w(t,e,n);return i=Array.isArray(i[0])?i:a(v.identity,[i],n),l(i,C(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;i= max) { + return res.substr(0, max); } - while (max > res.length && num > 0) { + while (max > res.length && num > 1) { if (num & 1) { res += str; } num >>= 1; - if (!num) break; str += str; } - return res.substr(0, max); + res += str; + res = res.substr(0, max); + return res; } - },{}],214:[function(require,module,exports){ (function (global){ module.exports = @@ -59249,7 +59253,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.20.0'; +exports.version = '1.20.1'; // inject promise polyfill require('es6-promise').polyfill(); @@ -68124,7 +68128,7 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { // if position is given as a category name, convert it to a number if(typeof pos === 'string' && (ax._categories || []).length) { newPos = ax._categories.indexOf(pos); - containerOut[attr] = (newPos !== -1) ? dflt : newPos; + containerOut[attr] = (newPos === -1) ? dflt : newPos; return; } } diff --git a/dist/plotly-gl3d.min.js b/dist/plotly-gl3d.min.js index 4903bd8a498..10c922384d7 100644 --- a/dist/plotly-gl3d.min.js +++ b/dist/plotly-gl3d.min.js @@ -1,5 +1,5 @@ /** -* plotly.js (gl3d - minified) v1.20.0 +* plotly.js (gl3d - minified) v1.20.1 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -18,23 +18,23 @@ r.line=function(t){return n(t,i,a,null,[{name:"position",type:"vec3"}])};var o=" r.attributes.color.location=4;var n=v(e);n.attributes.position.location=0,n.attributes.nextPosition.location=1,n.attributes.arcLength.location=2,n.attributes.lineWidth.location=3,n.attributes.color.location=4;for(var i=l(e),a=u(e,[{buffer:i,size:3,offset:0,stride:48},{buffer:i,size:3,offset:12,stride:48},{buffer:i,size:1,offset:24,stride:48},{buffer:i,size:1,offset:28,stride:48},{buffer:i,size:4,offset:32,stride:48}]),s=d(new Array(1024),[256,1,4]),f=0;f<1024;++f)s.data[f]=255;var h=c(e,s);h.wrap=e.REPEAT;var p=new o(e,r,n,i,a,h);return p.update(t),p}e.exports=s;var l=t("gl-buffer"),u=t("gl-vao"),c=t("gl-texture2d"),f=t("glsl-read-float"),h=t("binary-search-bounds"),d=t("ndarray"),p=t("./lib/shaders"),g=p.createShader,v=p.createPickShader,m=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],y=o.prototype;y.isTransparent=function(){return this.opacity<1},y.isOpaque=function(){return this.opacity>=1},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||m,view:t.view||m,projection:t.projection||m,clipBounds:i(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||m,view:t.view||m,projection:t.projection||m,pickId:this.pickId,clipBounds:i(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.update=function(t){var e,r;this.dirty=!0;var i=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var a=t.position||t.positions;if(a){var o=t.color||t.colors||[0,0,0,1],s=t.lineWidth||1,l=[],u=[],c=[],f=0,p=0,g=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],v=!1;t:for(e=1;e0){for(var b=0;b<24;++b)l.push(l[l.length-12]);p+=2,v=!0}continue t}g[0][r]=Math.min(g[0][r],m[r],y[r]),g[1][r]=Math.max(g[1][r],m[r],y[r])}var x,_;Array.isArray(o[0])?(x=o[e-1],_=o[e]):x=_=o,3===x.length&&(x=[x[0],x[1],x[2],1]),3===_.length&&(_=[_[0],_[1],_[2],1]);var w;w=Array.isArray(s)?s[e-1]:s;var A=f;if(f+=n(m,y),v){for(r=0;r<2;++r)l.push(m[0],m[1],m[2],y[0],y[1],y[2],A,w,x[0],x[1],x[2],x[3]);p+=2,v=!1}l.push(m[0],m[1],m[2],y[0],y[1],y[2],A,w,x[0],x[1],x[2],x[3],m[0],m[1],m[2],y[0],y[1],y[2],A,-w,x[0],x[1],x[2],x[3],y[0],y[1],y[2],m[0],m[1],m[2],f,-w,_[0],_[1],_[2],_[3],y[0],y[1],y[2],m[0],m[1],m[2],f,w,_[0],_[1],_[2],_[3]),p+=4}if(this.buffer.update(l),u.push(f),c.push(a[a.length-1].slice()),this.bounds=g,this.vertexCount=p,this.points=c,this.arcLength=u,"dashes"in t){var M=t.dashes,k=M.slice();for(k.unshift(0),e=1;e1.0001)return null;v+=g[c]}return Math.abs(v-1)>.001?null:[f,o(t,g),g]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:17,"polytope-closest-point/lib/closest_point_2d.js":205}],125:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}",i="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat cookTorranceSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution_2_0(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\n\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n \n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular_1_1(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}",a="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}",o="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",u="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}",c="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}",f="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}",h="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="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n";r.meshShader={vertex:n,fragment:i,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:a,fragment:o,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:s,fragment:l,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:f,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:h,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{}],126:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w,A,M,k,T){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=a,this.pointPickShader=o,this.contourShader=s,this.trianglePositions=l,this.triangleColors=c,this.triangleNormals=h,this.triangleUVs=f,this.triangleIds=u,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=v,this.edgeUVs=m,this.edgeIds=g,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=b,this.pointColors=_,this.pointUVs=w,this.pointSizes=A,this.pointIds=x,this.pointVAO=M,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=k,this.contourVAO=T,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=I,this._view=I,this._projection=I,this._resolution=[1,1]}function i(t){for(var e=M({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return A(r,[256,256,4],[4,0,1])}function a(t,e,r){for(var n=new Array(e),i=0;i=1},z.isTransparent=function(){return this.opacity<1},z.pickSlots=1,z.setPickBase=function(t){this.pickId=t},z.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=k(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=T.mallocFloat32(6*a),s=0,l=0;l0){var h=this.triShader;h.bind(),h.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var h=this.lineShader;h.bind(),h.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){var h=this.pointShader;h.bind(),h.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 h=this.contourShader;h.bind(),h.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind()}},z.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||I,n=t.view||I,i=t.projection||I,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={model:r,view:n,projection:i,clipBounds:a,pickId:this.pickId/255},l=this.pickShader;if(l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0){var l=this.pointPickShader;l.bind(),l.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}},z.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;a0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function o(t){return"boolean"!=typeof t||t}function s(t){function e(){if(!_&&q.autoResize){var t=w.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*q.pixelRatio),i=0|Math.ceil(r*q.pixelRatio);if(n!==w.width||i!==w.height){w.width=n,w.height=i;var a=w.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",D=!0}}}function r(){for(var t=O.length,e=j.length,r=0;r0&&0===z[e-1];)z.pop(),j.pop().dispose()}function s(){return!!q.contextLost||void(M.isContextLost()&&(q.contextLost=!0,q.mouseListener.enabled=!1,q.selection.object=null,q.oncontextloss&&q.oncontextloss()))}function y(){if(!s()){M.colorMask(!0,!0,!0,!0),M.depthMask(!0),M.disable(M.BLEND),M.enable(M.DEPTH_TEST);for(var t=O.length,e=j.length,r=0;rT.distance)continue;for(var u=0;u1e-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),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*f+l*g,t[3]=s*h+l*v,t}e.exports=n},{}],130:[function(t,e,r){"use strict";function n(t,e){var r=a[e];if(r||(r=a[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-(1/0),-(1/0)]],l=0;lMath.abs(z[1])){var j=I;I=z,z=j,j=N,N=O,O=j;var D=P;P=R,R=D}I[0]<0&&(N[P]=-1),z[1]>0&&(O[R]=-1);for(var F=0,B=0,C=0;C<4;++C)F+=Math.pow(p[4*P+C],2),B+=Math.pow(p[4*R+C],2);N[P]/=Math.sqrt(F),O[R]/=Math.sqrt(B),d.axes[0]=N,d.axes[1]=O,d.fragClipBounds[0]=u(L,b[0],_,-1e8),d.fragClipBounds[1]=u(L,b[1],_,1e8),e.vao.draw(h.TRIANGLES,e.vertexCount),e.lineWidth>0&&(h.lineWidth(e.lineWidth),e.vao.draw(h.LINES,e.lineVertexCount,e.vertexCount))}}function h(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||x,s.view=n.view||x,s.projection=n.projection||x,w[0]=2/o.drawingBufferWidth,w[1]=2/o.drawingBufferHeight,s.screenSize=w,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=R,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))}f(e,r,n,i,a),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),a=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=p(e),c=p(e),f=p(e),h=p(e),d=g(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:f,size:2,type:e.FLOAT},{buffer:h,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),v=new o(e,r,n,i,u,c,f,h,d,a,s,l);return v.update(t),v}var p=t("gl-buffer"),g=t("gl-vao"),v=t("typedarray-pool"),m=t("gl-mat4/multiply"),y=t("./lib/shaders"),b=t("./lib/glyphs"),x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=d;var _=o.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],A=[0,0,0],M=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=x.slice(),L=[0,0,0],S=[[0,0,0],[0,0,0]],C=[-1e8,-1e8,-1e8],P=[1e8,1e8,1e8],R=[C,P];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;h(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;h(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;h(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||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},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",a=t.alignment||[0,0],o=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,f=t.angle,h=t.lineColor,d=0,p=0,g=0,m=n.length;t:for(var y=0;y0&&(P[0]=-a[0]*(1+k[0][0]));for(var H=A.cells,q=A.positions,_=0;_this.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;i=0){for(var M=0|A.type.charAt(A.type.length-1),k=new Array(M),T=0;T=0;)E+=1;_[w]=E}var L=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=a},{"./lib/GLError":135,"./lib/create-attributes":136,"./lib/create-uniforms":137,"./lib/reflect":138,"./lib/runtime-reflect":139,"./lib/shader-cache":140}],135:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="GLError",n.prototype.constructor=n,e.exports=n},{}],136:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}function i(t,e,r,i,a,o,s){for(var l=["gl","v"],u=[],c=0;c=0){var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);i(t,e,d[0],n,p,o,f)}else{if(!(h.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+f+": "+h);var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);a(t,e,d,n,p,o,f)}}}return o}e.exports=o;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,a=i._gl,o=i._locations[i._index];a.vertexAttribPointer(o,i._dimension,t||a.FLOAT,!!e,r||0,n||0),a.enableVertexAttribArray(o)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":135}],137:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;n4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(i<2||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],a=t;a+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function f(e){for(var n=["return function updateProperty(obj){"],i=c("",e),o=0;o4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var o=p(i);Object.defineProperty(t,e,{get:n(o),set:f(i),enumerable:!0,configurable:!1})}else a[i]?Object.defineProperty(t,e,{get:l(i),set:f(i),enumerable:!0,configurable:!1}):t[e]=h(r[i].type)}function p(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 u=1;u1)for(var l=0;l0)][r],A(l,t.model,l);var u=F.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return F.showSurface=o,F.showContour=s,F}function s(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=B;n.model=t.model||N,n.view=t.view||N,n.projection=t.projection||N,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=M(n.inverseModel,n.model);for(var i=0;i<2;++i)for(var a=n.clipBounds[i],s=0;s<3;++s)a[s]=Math.min(Math.max(this.clipBounds[i][s],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=V,n.vertexColor=this.vertexColor;var l=U;for(A(l,n.view,n.model),A(l,n.projection,l),M(l,l),i=0;i<3;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;i<3;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;i<3;++i){var c=l[12+i];for(s=0;s<3;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var f=o(n,this);if(f.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=f.projections[i],this._shader.uniforms.clipBounds=f.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(f.showContour&&!e){var h=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,h.bind(),h.uniforms=n;var d=this._contourVAO;for(d.bind(),i=0;i<3;++i)for(h.uniforms.permutation=I[i],r.lineWidth(this.contourWidth[i]),s=0;s=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},j.pickSlots=1,j.setPickBase=function(t){this.pickId=t};var D=[0,0,0],F={showSurface:!1,showContour:!1,projections:[N.slice(),N.slice(),N.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:N,view:N,projection:N,inverseModel:N.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},U=N.slice(),V=[1,0,0,0,1,0,0,0,1];j.draw=function(t){return s.call(this,t,!1)},j.drawTransparent=function(t){return s.call(this,t,!0)};var H={model:N,view:N,projection:N,inverseModel:N,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};j.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=H;r.model=t.model||N,r.view=t.view||N,r.projection=t.projection||N,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.permutation=V;for(var n=0;n<2;++n)for(var i=r.clipBounds[n],a=0;a<3;++a)i[a]=Math.min(Math.max(this.clipBounds[n][a],-1e8),1e8);var s=o(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;n<3;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var u=this._contourVAO;for(u.bind(),a=0;a<3;++a)for(e.lineWidth(this.contourWidth[a]),l.uniforms.permutation=I[a],n=0;n>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 u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;c<2;++c)for(var f=c?a:1-a,h=0;h<2;++h)for(var d=h?l:1-l,p=i+c,g=s+h,v=f*d,m=0;m<3;++m)u[m]+=this._field[m].get(p,g)*v;for(var y=this._pickResult.level,b=0;b<3;++b)if(y[b]=k.le(this.contourLevels[b],u[b]),y[b]<0)this.contourLevels[b].length>0&&(y[b]=0);else if(y[b]Math.abs(_-u[b])&&(y[b]+=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],m=0;m<3;++m)r.dataCoordinate[m]=this._field[m].get(r.index[0],r.index[1]);return r},j.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=u(t.contourWidth,Number)),"showContour"in t&&(this.showContour=u(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=u(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=f(t.contourColor)),"contourProject"in t&&(this.contourProject=u(t.contourProject,function(t){return u(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=f(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=u(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=u(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"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 n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(m.freeFloat(this._field[2].data),this._field[2].data=m.mallocFloat(d.nextPow2(n))),this._field[2]=_(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),l(this._field[2],e),this.shape=e.shape.slice();for(var a=this.shape,o=0;o<2;++o)this._field[2].size>this._field[o].data.length&&(m.freeFloat(this._field[o].data),this._field[o].data=m.mallocFloat(this._field[2].size)),this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2]);if(t.coords){var s=t.coords;if(!Array.isArray(s)||3!==s.length)throw new Error("gl-surface: invalid coordinates for x/y");for(o=0;o<2;++o){var c=s[o];for(y=0;y<2;++y)if(c.shape[y]!==a[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[o],c)}}else if(t.ticks){var h=t.ticks;if(!Array.isArray(h)||2!==h.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var p=h[o];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var g=_(p.data,a);g.stride[o]=p.stride[0],g.stride[1^o]=0,l(this._field[o],g)}}else{for(o=0;o<2;++o){var v=[0,0];v[o]=1,this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2],v,0)}this._field[0].set(0,0,0);for(var y=0;y0){for(var xt=0;xt<5;++xt)tt.pop();H-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),H+=1}}nt.push(H)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=m.mallocFloat(tt.length);for(o=0;oi||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 a(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}function o(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,a,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var f=0,h=0,v=o(c,l.stride.slice());"float32"===u?f=t.FLOAT:"float64"===u?(f=t.FLOAT,v=!1,u="float32"):"uint8"===u?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,v=!1,u="uint8");var m=1;if(2===c.length)h=t.LUMINANCE,c=[c[0],c[1],1],l=d(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])h=t.ALPHA;else if(2===c[2])h=t.LUMINANCE_ALPHA;else if(3===c[2])h=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");h=t.RGBA}m=c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(h=i),h!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,x=s.indexOf(n)<0;if(x&&s.push(n),f===a&&v)0===l.offset&&l.data.length===y?x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data):x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var _;_=a===t.FLOAT?g.mallocFloat32(y):g.mallocUint8(y);var w=d(_,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&a===t.UNSIGNED_BYTE?b(w,l):p.assign(w,l),x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,_.subarray(0,y)),a===t.FLOAT?g.freeFloat32(_):g.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var o=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>o||r<0||r>o)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new a(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new a(t,i,0|e.width,0|e.height,r,n)}function f(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=o(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=d(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var f,h,v=e.size;if(s)f=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var m=[n[2],n[2]*n[0],1];h=g.malloc(v,r);var y=d(h,n,m,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?p.assign(y,e):b(y,e),f=h.subarray(0,v)}var x=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,f),s||g.free(h),new a(t,x,n[0],n[1],c,u)}function h(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(v||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return f(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var d=t("ndarray"),p=t("ndarray-ops"),g=t("typedarray-pool");e.exports=h;var v=null,m=null,y=null,b=function(t,e){p.muls(t,e,255)},x=a.prototype;Object.defineProperties(x,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=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(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t|=0,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,i(this,this._shape[0],t),t}}}),x.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},x.dispose=function(){this.gl.deleteTexture(this.handle)},x.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},x.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var a=this._mipLevels.indexOf(n)<0;a?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:192,"ndarray-ops":186,"typedarray-pool":247}],146:[function(t,e,r){"use strict";function n(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;i0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}e.exports=n},{}],155:[function(t,e,r){function n(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}e.exports=n},{}],156:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,a[0]}e.exports=n;var i=new Uint8Array(4),a=new Float32Array(i.buffer)},{}],157:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function P(){return/[^a-fA-F0-9]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),z=I,D+1)}function R(){return"."===I?(U.push(I),B=v,z=I,D+1):/[eE]/.test(I)?(U.push(I),B=v,z=I,D+1):"x"===I&&1===U.length&&"0"===U[0]?(B=w,U.push(I),z=I,D+1):/[^\d]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),z=I,D+1)}function N(){return"f"===I&&(U.push(I),z=I,D+=1),/[eE]/.test(I)?(U.push(I),z=I,D+1):"-"===I&&/[eE]/.test(z)?(U.push(I),z=I,D+1):/[^\d]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),z=I,D+1)}function O(){if(/[^\d\w_]/.test(I)){var t=U.join("");return B=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:m,e(U.join("")),B=u,D}return U.push(I),z=I,D+1}var I,z,j,D=0,F=0,B=u,U=[],V=[],H=1,q=0,G=0,X=!1,W=!1,Y="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return V=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var i=t("./lib/literals"),a=t("./lib/operators"),o=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,f=0,h=1,d=2,p=3,g=4,v=5,m=6,y=7,b=8,x=9,_=10,w=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":160,"./lib/builtins-300es":159,"./lib/literals":162,"./lib/literals-300es":161,"./lib/operators":163}],159:[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":160}],160:[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"]},{}],161:[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":162}],162:[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"]},{}],163:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],164:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":158}],165:[function(t,e,r){r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=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=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),e*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):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+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],166:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function a(t,e){return c(t.vertices,e.vertices)}function o(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;r<=t;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=u[t+1];return i||(i=u),n(i)}function s(t,e,r){this.dimension=t,this.vertices=e,this.simplices=r,this.interior=r.filter(function(t){return!t.boundary}),this.tuple=new Array(t+1);for(var n=0;n<=t;++n)this.tuple[n]=this.vertices[n];var i=f[t];i||(i=f[t]=o(t)),this.orient=i}function l(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var i=t[0].length;if(r<=i)throw new Error("Must input at least d+1 points");var a=t.slice(0,i+1),o=u.apply(void 0,a);if(0===o)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;c<=i;++c)l[c]=c;o<0&&(l[0]=1,l[1]=0);for(var f=new n(l,new Array(i+1),!1),h=f.adjacent,d=new Array(i+2),c=0;c<=i;++c){for(var p=l.slice(),g=0;g<=i;++g)g===c&&(p[g]=-1);var v=p[0];p[0]=p[1],p[1]=v;var m=new n(p,new Array(i+1),!0);h[c]=m,d[c]=m}d[i+1]=f;for(var c=0;c<=i;++c)for(var p=h[c].vertices,y=h[c].adjacent,g=0;g<=i;++g){var b=p[g];if(b<0)y[g]=f;else for(var x=0;x<=i;++x)h[x].vertices.indexOf(b)<0&&(y[g]=h[x])}for(var _=new s(i,a,d),w=!!e,c=i+1;c0;){t=o.pop();for(var s=(t.vertices,t.adjacent),l=0;l<=r;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,f=0;f<=r;++f){var h=c[f];h<0?i[f]=e:i[f]=a[h]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&o.push(u)}}}return null},h.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,u=s.adjacent,c=0;c<=n;++c)a[c]=i[l[c]];s.lastVisited=r;for(var c=0;c<=n;++c){var f=u[c];if(!(f.lastVisited>=r)){var h=a[c];a[c]=t;var d=this.orient();if(a[c]=h,d<0){s=f;continue t}f.boundary?f.lastVisited=-r:f.lastVisited=r}}return}return s},h.addPeaks=function(t,e){var r=this.vertices.length-1,o=this.dimension,s=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,f=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var h=[];f.length>0;){var e=f.pop(),d=e.vertices,p=e.adjacent,g=d.indexOf(r);if(!(g<0))for(var v=0;v<=o;++v)if(v!==g){var m=p[v];if(m.boundary&&!(m.lastVisited>=r)){var y=m.vertices;if(m.lastVisited!==-r){for(var b=0,x=0;x<=o;++x)y[x]<0?(b=x,l[x]=t):l[x]=s[y[x]];var _=this.orient();if(_>0){y[b]=r,m.boundary=!1,u.push(m),f.push(m),m.lastVisited=r;continue}m.lastVisited=-r}var w=m.adjacent,A=d.slice(),M=p.slice(),k=new n(A,M,!0);c.push(k);var T=w.indexOf(e);if(!(T<0)){w[T]=k,M[g]=m,A[v]=-1,M[v]=e,p[v]=k,k.flip();for(var x=0;x<=o;++x){var E=A[x];if(!(E<0||E===r)){for(var L=new Array(o-1),S=0,C=0;C<=o;++C){var P=A[C];P<0||C===x||(L[S++]=P)}h.push(new i(L,k,x))}}}}}}h.sort(a);for(var v=0;v+1=0?o[l++]=s[c]:u=1&c;if(u===(1&t)){var f=o[0];o[0]=o[1],o[1]=f}e.push(o)}}return e}},{"robust-orientation":220,"simplicial-complex":230}],167:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function a(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),a(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],a=[],o=[],s=[],r=0;r3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=m.ge(this.leftPoints,t,h),n=m.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var a=this.left?this.left.count:0;if(4*a>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var o=this,l=this.left;l.right;)o=l,l=l.right;if(o===this)l.right=this.right;else{var u=this.left,n=this.right;o.count-=l.count,o.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var u=m.ge(this.leftPoints,t,h);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===x&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},w.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":34}],168:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;rv[1][2]&&(b[0]=-b[0]),v[0][2]>v[2][0]&&(b[1]=-b[1]),v[1][0]>v[0][1]&&(b[2]=-b[2]),!0}},{"./normalize":173,"gl-mat4/clone":106,"gl-mat4/create":107,"gl-mat4/determinant":108,"gl-mat4/invert":112,"gl-mat4/transpose":122,"gl-vec3/cross":150,"gl-vec3/dot":151,"gl-vec3/length":152,"gl-vec3/normalize":154}],173:[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}},{}],174:[function(t,e,r){function n(t,e,r,n){if(0===c(e)||0===c(r))return!1;var i=u(e,h.translate,h.scale,h.skew,h.perspective,h.quaternion),a=u(r,d.translate,d.scale,d.skew,d.perspective,d.quaternion);return!(!i||!a)&&(s(p.translate,h.translate,d.translate,n),s(p.skew,h.skew,d.skew,n),s(p.scale,h.scale,d.scale,n),s(p.perspective,h.perspective,d.perspective,n),f(p.quaternion,h.quaternion,d.quaternion,n),l(t,p.translate,p.scale,p.skew,p.perspective,p.quaternion),!0)}function i(){return{translate:a(),scale:a(1),skew:a(),perspective:o(),quaternion:o()}}function a(t){return[t||0,t||0,t||0]}function o(){return[0,0,0,1]}var s=t("gl-vec3/lerp"),l=t("mat4-recompose"),u=t("mat4-decompose"),c=t("gl-mat4/determinant"),f=t("quat-slerp"),h=i(),d=i(),p=i();e.exports=n},{"gl-mat4/determinant":108,"gl-vec3/lerp":153,"mat4-decompose":172,"mat4-recompose":175,"quat-slerp":207}],175:[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":107,"gl-mat4/fromRotationTranslation":110,"gl-mat4/identity":111,"gl-mat4/multiply":114,"gl-mat4/scale":120,"gl-mat4/translate":121}],176:[function(t,e,r){"use strict";function n(t){this._components=t.slice(),this._time=[0],this.prevMatrix=t.slice(),this.nextMatrix=t.slice(),this.computedMatrix=t.slice(),this.computedInverse=t.slice(),this.computedEye=[0,0,0],this.computedUp=[0,0,0],this.computedCenter=[0,0,0],this.computedRadius=[0],this._limits=[-(1/0),1/0]}function i(t){t=t||{};var e=t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return new n(e)}var a=t("binary-search-bounds"),o=t("mat4-interpolate"),s=t("gl-mat4/invert"),l=t("gl-mat4/rotateX"),u=t("gl-mat4/rotateY"),c=t("gl-mat4/rotateZ"),f=t("gl-mat4/lookAt"),h=t("gl-mat4/translate"),d=(t("gl-mat4/scale"),t("gl-vec3/normalize")),p=[0,0,0];e.exports=i;var g=n.prototype;g.recalcMatrix=function(t){var e=this._time,r=a.le(e,t),n=this.computedMatrix;if(!(r<0)){var i=this._components;if(r===e.length-1)for(var l=16*r,u=0;u<16;++u)n[u]=i[l++];else{for(var c=e[r+1]-e[r],l=16*r,f=this.prevMatrix,h=!0,u=0;u<16;++u)f[u]=i[l++];for(var p=this.nextMatrix,u=0;u<16;++u)p[u]=i[l++],h=h&&f[u]===p[u];if(c<1e-6||h)for(var u=0;u<16;++u)n[u]=f[u];else o(n,f,p,(t-e[r])/c)}var g=this.computedUp;g[0]=n[1],g[1]=n[5],g[2]=n[6],d(g,g);var v=this.computedInverse;s(v,n);var m=this.computedEye,y=v[15];m[0]=v[12]/y,m[1]=v[13]/y,m[2]=v[14]/y;for(var b=this.computedCenter,x=Math.exp(this.computedRadius[0]),u=0;u<3;++u)b[u]=m[u]-n[2+4*u]*x}},g.idle=function(t){if(!(t1&&i(t[o[c-2]],t[o[c-1]],u)<=0;)c-=1,o.pop();for(o.push(l),c=s.length;c>1&&i(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(l)}for(var r=new Array(s.length+o.length-2),f=0,n=0,h=o.length;n0;--d)r[f++]=s[d];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":220}],178:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==g.alt,g.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==g.shift,g.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==g.control,g.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==g.meta,g.meta=!!t.metaKey),e}function n(t,n){var a=i.x(n),o=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==h||a!==d||o!==p||r(n))&&(h=0|t,d=a||0,p=o||0,e&&e(h,d,p,g))}function a(t){n(0,t)}function o(){(h||d||p||g.shift||g.alt||g.meta||g.control)&&(d=p=0,h=0,g.shift=g.alt=g.control=g.meta=!1,e&&e(0,0,0,g))}function s(t){r(t)&&e&&e(h,d,p,g)}function l(t){0===i.buttons(t)?n(0,t):n(h,t)}function u(t){n(h|i.buttons(t),t)}function c(t){n(h&~i.buttons(t),t)}function f(){v||(v=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",a),t.addEventListener("mouseenter",a),t.addEventListener("mouseout",a),t.addEventListener("mouseover",a),t.addEventListener("blur",o),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",o),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var h=0,d=0,p=0,g={shift:!1,alt:!1,control:!1,meta:!1},v=!1;f();var m={element:t};return Object.defineProperties(m,{enabled:{get:function(){return v},set:function(t){t&&f()},enumerable:!0},buttons:{get:function(){return h},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return g},enumerable:!0}}),m}e.exports=n;var i=t("mouse-event")},{"mouse-event":179}],179:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<=0;--e)S(e,0);for(var r=[],e=0;e0;_=_-1&g)x.push(w+"["+T+"+"+v(_)+"]");x.push(m(0));for(var _=0;_0){",h(x[t]),"=1;"),O(t-1,e|1<0&&G.push(s(U,x[V-1])+"*"+o(x[V-1])),F.push(d(U,x[V])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)X.push(o(x[U]));F.push(k+"=("+X.join("*")+")|0",A+"=mallocUint32("+k+")",w+"=mallocUint32("+k+")",T+"=0"),F.push(p(0)+"=0");for(var V=1;V<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 a=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return b(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",A="P",M="N",k="Q",T="X",E="T"},{"typedarray-pool":247}],182:[function(t,e,r){"use strict";var n=t("cwise/lib/wrapper")({args:["index","array","scalar"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{_inline_7_arg1_=_inline_7_arg2_.apply(void 0,_inline_7_arg0_)}",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}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":73}],183:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;r=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){o.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push("&&s[",l,"]>2");o.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push(",dst.pick(",s.join(),",",l,")",u);o.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",h.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>1){diff(",f,",src.pick(",h.join(),")",u,",src.pick(",d.join(),")",u,");}else{zero(",f,");};");break;case"mirror":0===r?o.push("dst.set(",s.join(),",",c,",0);"):o.push("zero(",f,");");break;case"wrap":var p=s.slice(),g=s.slice();e[l]<0?(p[c]="s["+c+"]-2",g[c]="0"):(p[c]="s["+c+"]-1",g[c]="1"),0===r?o.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>2){diff(",f,",src.pick(",p.join(),")",u,",src.pick(",g.join(),")",u,");}else{zero(",f,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&o.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var a=t.length,o=["function gradient(dst,src){var s=src.shape.slice();"],s=0;s<1<>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=a({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]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,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=o({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=o({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=o({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=a({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=a({args:["array","array"],body:{ -args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=o({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":70}],187:[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":188,ndarray:192}],188:[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":70}],189:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;r1){for(var f=[],h=1;h1){o.push("dptr=0;sptr=ptr");for(var h=t.length-1;h>=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"left){","dptr=0","sptr=cptr-s0");for(var h=1;hb){break __l}"].join(""));for(var h=t.length-1;h>=1;--h)o.push("sptr+=e"+h,"dptr+=f"+h,"}");o.push("dptr=cptr;sptr=cptr-s0");for(var h=t.length-1;h>=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"left)&&("+r("cptr-s0")+">scratch)){",a("cptr",r("cptr-s0")),"cptr-=s0","}",a("cptr","scratch"));if(o.push("}"),t.length>1&&u&&o.push("free(scratch)"),o.push("} return "+s),u){var p=new Function("malloc","free",o.join("\n"));return p(u[0],u[1])}var p=new Function(o.join("\n"));return p()}function o(t,e,r){function a(t){return["(offset+",t,"*s0)"].join("")}function o(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+a(e[0]));else for(var i=0;i=0;--i){var o=t[i];0!==o&&_.push(["for(i",o,"=0;i",o,"1)for(var i=0;i1?_.push("ptr_shift+=d"+o):_.push("ptr0+=d"+o),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+a(r[0]));else{for(var o=0;o1)for(var o=0;o=1;--o)n&&_.push("pivot_ptr+=f"+o),r.length>1?_.push("ptr_shift+=e"+o):_.push("ptr0+=e"+o),_.push("}")}function f(){t.length>1&&M&&_.push("free(pivot1)","free(pivot2)")}function h(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++k;c(s,[n,i],!1,["comp=",o("ptr0"),"-",o("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",o(a(n)),">",o(a(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?l([e,r],!1,s("ptr0",o("ptr1"))):_.push(s(a(e),o(a(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++k;c(i,[r],!0,[e,"=",o("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",o(a(r)),"-pivot",n].join(""))}function g(e,r){t.length>1?l([e,r],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join(""))}function v(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","ptr2=",a(n),"\n","++",r,"\n","--",n,"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join(""))}function m(t,e){g(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",o("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(a(e),o(a(r))),s(a(r),"pivot"+n))}function b(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function x(e,r,n){t.length>1?(_.push(["__l",++k,":while(true){"].join("")),l([e],!0,["if(",o("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",k,"}"].join("")),_.push(n,"}")):_.push(["while(",o(a(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),A=["left","right","data","offset"].concat(i(t.length)),M=n(e),k=0;_.push(["function ",w,"(",A.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],L=1;L1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",o("ptr1"),"\n","pivot2[pivot_ptr]=",o("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",o("ptr0"),"\n","y=",o("ptr2"),"\n","z=",o("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",o(a("el2")),"\n","pivot2=",o(a("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",o(a("el1")),"\n","y=",o(a("el3")),"\n","z=",o(a("el5")),"\n",s(a("index1"),"x"),"\n",s(a("index3"),"y"),"\n",s(a("index5"),"z")].join("")),d("index2","left"),d("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),p("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),p("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),v("k","less","great"),_.push("break"),_.push("}else{"),m("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp>0){"),_.push("if(--greatindex5){"),x("less",1,"++less"),x("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp===0){"),_.push("if(--great1&&M){var S=new Function("insertionSort","malloc","free",_.join("\n"));return S(r,M[0],M[1])}var S=new Function("insertionSort",_.join("\n"));return S(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c0?l.push(["d",v,"=s",v,"-d",p,"*n",p].join("")):l.push(["d",v,"=s",v].join("")),p=v);var d=t.length-1-c;0!==d&&(g>0?l.push(["e",d,"=s",d,"-e",g,"*n",g,",f",d,"=",f[d],"-f",g,"*n",g].join("")):l.push(["e",d,"=s",d,",f",d,"=",f[d]].join("")),g=d)}r.push("var "+l.join(","));var m=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",m.join(","),")}else{","quickSort(",m.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),b=a(t,e),x=o(t,e,b);return y(b,x)}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":247}],190:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],o=n.join(":"),s=a[o];return s||(a[o]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),a={};e.exports=n},{"./lib/compile_sort.js":189}],191:[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_33_arg4_)}",args:[{name:"_inline_33_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_34_arg2_(this_warped,_inline_34_arg0_),_inline_34_arg1_=_inline_34_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_34_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_34_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_34_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_34_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_34_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_37_arg2_(this_warped,_inline_37_arg0_),_inline_37_arg1_=_inline_37_arg3_(_inline_37_arg4_,this_warped[0])}",args:[{name:"_inline_37_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_37_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_37_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_37_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_37_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_40_arg2_(this_warped,_inline_40_arg0_),_inline_40_arg1_=_inline_40_arg3_(_inline_40_arg4_,this_warped[0],this_warped[1])}",args:[{name:"_inline_40_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_40_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_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_43_arg2_(this_warped,_inline_43_arg0_),_inline_43_arg1_=_inline_43_arg3_(_inline_43_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_43_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_43_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_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":73,"ndarray-linear-interpolate":185}],192:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;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("+u.join(",")+",v){"),n?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var v=0;v=0){d=i"+v+"|0;b+=c"+v+"*d;a"+v+"-=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var v=0;v=0){c=(c+this.stride["+v+"]*i"+v+")|0}else{a.push(this.shape["+v+"]);b.push(this.stride["+v+"])}");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,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",a.join("\n"));return o(f[t],i)}function o(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=f.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),a=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":76}],194:[function(t,e,r){var n=1e-6,i=1e-6;r.vertexNormals=function(t,e,r){for(var i=e.length,a=new Array(i),o=void 0===r?n:r,s=0;so)for(var _=a[c],w=1/Math.sqrt(m*b),x=0;x<3;++x){var A=(x+1)%3,M=(x+2)%3;_[x]+=w*(y[A]*v[M]-y[M]*v[A])}}for(var s=0;so)for(var w=1/Math.sqrt(k),x=0;x<3;++x)_[x]*=w;else for(var x=0;x<3;++x)_[x]=0}return a},r.faceNormals=function(t,e,r){for(var n=t.length,a=new Array(n),o=void 0===r?i:r,s=0;so?1/Math.sqrt(p):0;for(var c=0;c<3;++c)d[c]*=p;a[s]=d}return a}},{}],195:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u){var c=e+a+u;if(f>0){var f=Math.sqrt(c+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,u),f=Math.sqrt(2*h-c+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}e.exports=n},{}],196:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function a(t,e){var r=e[0],n=e[1],a=e[2],o=e[3],s=i(r,n,a,o);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=a/s,t[3]=o/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function o(t,e,r){this.radius=l([r]),this.center=l(e),this.rotation=l(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),r=[].slice.call(r,0,4),a(r,r);var i=new o(r,e,Math.log(n));return i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up),i}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/lookAt"),c=t("gl-mat4/fromQuat"),f=t("gl-mat4/invert"),h=t("./lib/quatFromFrame"),d=o.prototype;d.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},d.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;a(e,e);var r=this.computedMatrix;c(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 u=0,f=0;f<3;++f)u+=r[l+4*f]*i[f];r[12+l]=-u}},d.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},d.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},d.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},d.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=a[1],s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],f=a[4],h=a[8],d=c*o+f*s+h*l;c-=o*d,f-=s*d,h-=l*d;var p=n(c,f,h);c/=p,f/=p,h/=p;var g=a[2],v=a[6],m=a[10],y=g*o+v*s+m*l,b=g*c+v*f+m*h;g-=y*o+b*c,v-=y*s+b*f,m-=y*l+b*h;var x=n(g,v,m);g/=x,v/=x,m/=x;var _=c*e+o*r,w=f*e+s*r,A=h*e+l*r;this.center.move(t,_,w,A);var M=Math.exp(this.computedRadius[0]);M=Math.max(1e-4,M+i),this.radius.set(t,Math.log(M))},d.rotate=function(t,e,r,a){this.recalcMatrix(t),e=e||0,r=r||0;var o=this.computedMatrix,s=o[0],l=o[4],u=o[8],c=o[1],f=o[5],h=o[9],d=o[2],p=o[6],g=o[10],v=e*s+r*c,m=e*l+r*f,y=e*u+r*h,b=-(p*y-g*m),x=-(g*v-d*y),_=-(d*m-p*v),w=Math.sqrt(Math.max(0,1-Math.pow(b,2)-Math.pow(x,2)-Math.pow(_,2))),A=i(b,x,_,w);A>1e-6?(b/=A,x/=A,_/=A,w/=A):(b=x=_=0,w=1);var M=this.computedRotation,k=M[0],T=M[1],E=M[2],L=M[3],S=k*w+L*b+T*_-E*x,C=T*w+L*x+E*b-k*_,P=E*w+L*_+k*x-T*b,R=L*w-k*b-T*x-E*_;if(a){b=d,x=p,_=g;var N=Math.sin(a)/n(b,x,_);b*=N,x*=N,_*=N,w=Math.cos(e),S=S*w+R*b+C*_-P*x,C=C*w+R*x+P*b-S*_,P=P*w+R*_+S*x-C*b,R=R*w-S*b-C*x-P*_}var O=i(S,C,P,R);O>1e-6?(S/=O,C/=O,P/=O,R/=O):(S=C=P=0,R=1),this.rotation.set(t,S,C,P,R)},d.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var i=this.computedMatrix;u(i,e,r,n);var o=this.computedRotation;h(o,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),a(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var s=0,l=0;l<3;++l)s+=Math.pow(r[l]-e[l],2);this.radius.set(t,.5*Math.log(Math.max(s,1e-6))),this.center.set(t,r[0],r[1],r[2])},d.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},d.setMatrix=function(t,e){var r=this.computedRotation;h(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),a(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;f(n,e);var i=n[15];if(Math.abs(i)>1e-6){var o=n[12]/i,s=n[13]/i,l=n[14]/i;this.recalcMatrix(t);var u=Math.exp(this.computedRadius[0]);this.center.set(t,o-n[2]*u,s-n[6]*u,l-n[10]*u),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},d.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},d.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},d.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},d.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":195,"filtered-vector":83,"gl-mat4/fromQuat":109,"gl-mat4/invert":112,"gl-mat4/lookAt":113}],197:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r="undefined"!=typeof r?r+"":" ",n(r,e)+t}},{"repeat-string":213}],198:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],199:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return a.freeUint32(l),a.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,a,o=1;for(r[0]=0,a=1;a0;--a)n=e/o|0,e=e-n*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}var a=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":168,"typedarray-pool":247}],201:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,s,l,c=0;c<2;++c)if(u[c][n].length>0){o=u[c][n][0],l=c;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=u[f][n],d=0;d0&&(o=p,s=g,l=f)}return a?s:(o&&r(o,l),s)}function a(t,a){var o=u[a][t][0],s=[t];r(o,a);for(var l=o[1^a];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],f=t,h=s[1],d=n(c,f,!0);if(i(e[c],e[f],e[h],e[d])<0)break;s.push(t),l=n(c,f)}return s}function o(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;c0;){var g=(u[0][c].length,a(c,d));o(p,g)?p.push.apply(p,g):(p.length>0&&h.push(p),p=g)}p.length>0&&h.push(p)}return h}e.exports=n;var i=t("compare-angle")},{"compare-angle":62}],202:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function a(t){for(var e=t.length,r=0;r0;){var U=F.pop(),V=R[U];f(V,function(t,e){return t-e});var H,q=V.length,G=B[U];if(0===G){var T=m[U];H=[T]}for(var v=0;v=0)&&(B[X]=1^G,F.push(X),0===G)){var T=m[X];a(T)||(T.reverse(),H.push(T))}}0===G&&d.push(H)}return d}e.exports=a;var o=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),f=t("uniq"),h=t("./lib/trim-leaves")},{"./lib/trim-leaves":202,"edges-to-adjacency-list":78,"planar-dual":201,"point-in-big-polygon":204,"robust-sum":225,"two-product":245,uniq:249}],204:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return!!i&&!!i.queryPoint(r,n)}}function a(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var o=i.key,s=f(r,o[0],o[1]);if(o[0][0]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))return 0;a=1,i=i.right}}return a}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;i=u?(x=1,y=u+2*h+p):(x=-h/u,y=h*x+p)):(x=0,d>=0?(_=0,y=p):-d>=f?(_=1,y=f+2*d+p):(_=-d/f,y=d*_+p));else if(_<0)_=0,h>=0?(x=0,y=p):-h>=u?(x=1,y=u+2*h+p):(x=-h/u,y=h*x+p);else{var w=1/b;x*=w,_*=w,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p}else{var A,M,k,T;x<0?(A=c+h,M=f+d,M>A?(k=M-A,T=u-2*c+f,k>=T?(x=1,_=0,y=u+2*h+p):(x=k/T,_=1-x,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)):(x=0,M<=0?(_=1,y=f+2*d+p):d>=0?(_=0,y=p):(_=-d/f,y=d*_+p))):_<0?(A=c+d,M=u+h,M>A?(k=M-A,T=u-2*c+f,k>=T?(_=1,x=0,y=f+2*d+p):(_=k/T,x=1-_,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)):(_=0,M<=0?(x=1,y=u+2*h+p):h>=0?(x=0,y=p):(x=-h/u,y=h*x+p))):(k=f+d-c-h,k<=0?(x=0,_=1,y=f+2*d+p):(T=u-2*c+f,k>=T?(x=1,_=0,y=u+2*h+p):(x=k/T,_=1-x,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)))}for(var E=1-x-_,l=0;l1)for(var r=1;r0){var u=t[r-1];if(0===i(s,u)&&o(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}var i=t("compare-cell"),a=t("compare-oriented-cell"),o=t("cell-orientation");e.exports=n},{"cell-orientation":54,"compare-cell":63,"compare-oriented-cell":64}],213:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("repeat-string expects a string.");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;for(i===t&&"undefined"!=typeof i||(i=t,a="");r>a.length&&e>0&&(1&e&&(a+=t),e>>=1);)t+=t;return a.substr(0,r)}var i,a="";e.exports=n},{}],214:[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:{})},{}],215:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var a=r,o=t[i];r=a+o;var s=r-a,l=o-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;i>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;r>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r0&&r.push(","),r.push("[");for(var a=0;a0&&r.push(","),a===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",a,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var o=new Function("det",r.join(""));return o(t<6?s[t]:s)}function i(){return[0]}function a(t,e){return[[e[0]],[t[0][0]]]}function o(){for(;u.length>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;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=m*n;return o>=s||o<=-s?o:b(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],u=r[1]-n[1],c=t[2]-n[2],f=e[2]-n[2],h=r[2]-n[2],d=a*u,p=o*l,g=o*s,v=i*u,m=i*l,b=a*s,_=c*(d-p)+f*(g-v)+h*(m-b),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(m)+Math.abs(b))*Math.abs(h),A=y*w;return _>A||-_>A?_:x(t,e,r,n)}];c()},{"robust-scale":222,"robust-subtract":224,"robust-sum":225,"two-product":245}],221:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return a(e,t[0]);if(1===e.length)return a(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.length0&&s>0||o<0&&s<0)return!1;var l=a(r,t,e),u=a(i,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,i))}e.exports=i;var a=t("robust-orientation")[3]},{"robust-orientation":220}],224:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],v=h(g);p=i?(a=d,c+=1,c=i?(a=d,c+=1,c0?1:0}},{}],227:[function(t,e,r){"use strict";function n(t){return a(i(t))}e.exports=n;var i=t("boundary-cells"),a=t("reduce-simplicial-complex")},{"boundary-cells":37,"reduce-simplicial-complex":212}],228:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;n0&&u.push(","),u.push("[");for(var n=0;n0&&u.push(","),u.push("B(C,E,c[",i[0],"],c[",i[1],"])")}u.push("]")}u.push(");")}}var r=0,n=new Array(t+1);n[0]=[[]];for(var i=1;i<=t;++i)for(var s=n[i]=o(i),l=0;l>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--i){i>1,s=o(t[a],e);s<=0?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function f(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[g],a))break}return r}function h(t,e){if(!e)return f(u(p(t,0)),t,0);for(var r=new Array(e),n=0;n>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){var n=s(r);if(e0){var t=k[0];return a(0,L-1),L-=1,u(0),t}return-1}function h(t,e){var r=k[t];return b[r]===e?t:(b[r]=-(1/0),c(t),f(),b[r]=e,L+=1,c(L-1))}function d(t){if(!x[t]){x[t]=!0;var e=m[t],r=y[t];m[r]>=0&&(m[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&h(T[e],i(e)),T[r]>=0&&h(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||i<0||i===n)break;if(n=i,i=t[n],!x[n]||i<0||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var g=e.length,v=t.length,m=new Array(g),y=new Array(g),b=new Array(g),x=new Array(g),_=0;_>1;_>=0;--_)u(_);for(;;){var S=f();if(S<0||b[S]>r)break;d(S)}for(var C=[],_=0;_=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&P.push([n,i])}}),o.unique(o.normalize(P)),{positions:C,edges:P}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":220,"simplicial-complex":232}],235:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return ol?i-l:o-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=a(r,i,s),u=a(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;if(l=a(s,o,i),u=a(s,o,r),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]}e.exports=i;var a=t("robust-orientation")},{"robust-orientation":220}],236:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=a(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=a(t.right,e);if(l)return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;a0){var s=a(this.slabs[e-1],t);s&&(o?h(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(o){var p=f(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":235,"binary-search-bounds":34,"functional-red-black-tree":84,"robust-orientation":220 -}],237:[function(t,e,r){"use strict";function n(t,e){var r=u(l(t,e),[e[e.length-1]]);return r[r.length-1]}function i(t,e,r,n){var i=n-e,a=-e/i;a<0?a=0:a>1&&(a=1);for(var o=1-a,s=t.length,l=new Array(s),u=0;u0||o>0&&c<0){var f=i(s,c,l,o);r.push(f),a.push(f.slice())}c<0?a.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),a.push(l.slice())),o=c}return{positive:r,negative:a}}function o(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u>=0&&r.push(s.slice()),a=u}return r}function s(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u<=0&&r.push(s.slice()),a=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=a,e.exports.positive=o,e.exports.negative=s},{"robust-dot-product":217,"robust-sum":225}],238:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function a(t,e){return Array(e+1).join(t)}var o={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,f,h,d=1,p=t.length,g="",v=[],m=!0,y="";for(s=0;s=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?v[v.length]=n:(!o.number.test(u[8])||m&&!u[3]?y="":(y=m?"+":"-",n=n.toString().replace(o.sign,"")),f=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",h=u[6]-(y+n).length,c=u[6]&&h>0?a(f,h):"",v[v.length]=u[5]?y+n+c:"0"===f?y+c+n:c+y+n)}return v.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],239:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],240:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128===0){f.length>0&&h.push("}}");var d="vExtra"+f.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(k="+"+v[x]+"*c");var T=.5*(p[x].length/y),E=.5+.5*(m[x]/y);M.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+k+")/("+g[x].join("+")+")")}h.push("a.push([",M.join(),"]);","break;")}n.push("}},"),f.length>0&&h.push("}}");for(var L=[],u=0;u<1<.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=L(t,360),e=L(e,100),r=L(r,100),0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,i,a=G(t,e,r),o=q(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function k(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){P(t)&&(t="100%");var n=R(t);return t=q(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function S(t){return q(1,G(0,t))}function C(t){return parseInt(t,16)}function P(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function R(t){return"string"==typeof t&&t.indexOf("%")!=-1}function N(t){return 1==t.length?"0"+t:""+t}function O(t){return t<=1&&(t=100*t+"%"),t}function I(t){return e.round(255*parseFloat(t)).toString(16)}function z(t){return C(t)/255}function j(t){return!!Z.CSS_UNIT.exec(t)}function D(t){t=t.replace(B,"").replace(U,"").toLowerCase();var e=!1;if(W[t])t=W[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Z.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),a:z(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),a:z(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.hex3.exec(t))&&{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),format:e?"name":"hex"}}function F(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var B=/^\s+/,U=/\s+$/,V=0,H=e.round,q=e.min,G=e.max,X=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=E(t),this._roundA=H(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=H(360*t.h),r=H(100*t.s),n=H(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=H(360*t.h),r=H(100*t.s),n=H(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:H(this._r),g:H(this._g),b:H(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+H(this._r)+", "+H(this._g)+", "+H(this._b)+")":"rgba("+H(this._r)+", "+H(this._g)+", "+H(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:H(100*L(this._r,255))+"%",g:H(100*L(this._g,255))+"%",b:H(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+H(100*L(this._r,255))+"%, "+H(100*L(this._g,255))+"%, "+H(100*L(this._b,255))+"%)":"rgba("+H(100*L(this._r,255))+"%, "+H(100*L(this._g,255))+"%, "+H(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,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(M,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=O(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return n(s)},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=F(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},n.mostReadable=function(t,e,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var W=n.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=n.hexNames=T(W),Z=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],242:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":198}],243:[function(t,e,r){"use strict";function n(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(o(t+1)),r=[],n=0;nMath.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var a=0,o=0,s=0;s<3;++s)a+=t[s]*t[s],o+=i[s]*t[s];for(var s=0;s<3;++s)i[s]-=o/a*t[s];return h(i,i),i}function o(t,e,r,n,i,a,o,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([a]),this.angle=l([o,s]),this.angle.bounds=[[-(1/0),-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;u<16;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.up||[0,1,0],i=t.right||a(r),s=t.radius||1,l=t.theta||0,u=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),h(r,r),i=[].slice.call(i,0,3),h(i,i),"eye"in t){var c=t.eye,p=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];f(i,p,r),n(i[0],i[1],i[2])<1e-6?i=a(r):h(i,i),s=n(p[0],p[1],p[2]);var g=d(r,p)/s,v=d(i,p)/s;u=Math.acos(g),l=Math.acos(v)}return s=Math.log(s),new o(t.zoomMin,t.zoomMax,e,r,i,s,l,u)}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),f=t("gl-vec3/cross"),h=t("gl-vec3/normalize"),d=t("gl-vec3/dot"),p=o.prototype;p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,i=0,a=0,o=0;o<3;++o)a+=e[o]*r[o],i+=e[o]*e[o];for(var s=Math.sqrt(i),l=0,o=0;o<3;++o)r[o]-=e[o]*a/i,l+=r[o]*r[o],e[o]/=s;for(var u=Math.sqrt(l),o=0;o<3;++o)r[o]/=u;var c=this.computedToward;f(c,e,r),h(c,c);for(var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],g=this.computedAngle[1],v=Math.cos(p),m=Math.sin(p),y=Math.cos(g),b=Math.sin(g),x=this.computedCenter,_=v*y,w=m*y,A=b,M=-v*b,k=-m*b,T=y,E=this.computedEye,L=this.computedMatrix,o=0;o<3;++o){var S=_*r[o]+w*c[o]+A*e[o];L[4*o+1]=M*r[o]+k*c[o]+T*e[o],L[4*o+2]=S,L[4*o+3]=0}var C=L[1],P=L[5],R=L[9],N=L[2],O=L[6],I=L[10],z=P*I-R*O,j=R*N-C*I,D=C*O-P*N,F=n(z,j,D);z/=F,j/=F,D/=F,L[0]=z,L[4]=j,L[8]=D;for(var o=0;o<3;++o)E[o]=x[o]+L[2+4*o]*d;for(var o=0;o<3;++o){for(var l=0,B=0;B<3;++B)l+=L[o+4*B]*E[B];L[12+o]=-l}L[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 g=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;g[0]=i[2],g[1]=i[6],g[2]=i[10];for(var a=this.computedUp,o=this.computedRight,s=this.computedToward,l=0;l<3;++l)i[4*l]=a[l],i[4*l+1]=o[l],i[4*l+2]=s[l];c(i,i,n,g);for(var l=0;l<3;++l)a[l]=i[4*l],o[l]=i[4*l+1];this.up.set(t,a[0],a[1],a[2]),this.right.set(t,o[0],o[1],o[2])}},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=(Math.exp(this.computedRadius[0]),a[1]),s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],f=a[4],h=a[8],d=c*o+f*s+h*l;c-=o*d,f-=s*d,h-=l*d;var p=n(c,f,h);c/=p,f/=p,h/=p;var g=c*e+o*r,v=f*e+s*r,m=h*e+l*r;this.center.move(t,g,v,m);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e,r,a){var o=1;"number"==typeof r&&(o=0|r),(o<0||o>3)&&(o=1);var s=(o+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[o],c=e[o+4],f=e[o+8];if(a){var h=Math.abs(l),d=Math.abs(c),p=Math.abs(f),g=Math.max(h,d,p);h===g?(l=l<0?-1:1,c=f=0):p===g?(f=f<0?-1:1,l=c=0):(c=c<0?-1:1,l=f=0)}else{var v=n(l,c,f);l/=v,c/=v,f/=v}var m=e[s],y=e[s+4],b=e[s+8],x=m*l+y*c+b*f;m-=l*x,y-=c*x,b-=f*x;var _=n(m,y,b);m/=_,y/=_,b/=_;var w=c*b-f*y,A=f*m-l*b,M=l*y-c*m,k=n(w,A,M);w/=k,A/=k,M/=k,this.center.jump(t,q,G,X),this.radius.idle(t),this.up.jump(t,l,c,f),this.right.jump(t,m,y,b);var T,E;if(2===o){var L=e[1],S=e[5],C=e[9],P=L*m+S*y+C*b,R=L*w+S*A+C*M;T=z<0?-Math.PI/2:Math.PI/2,E=Math.atan2(R,P)}else{var N=e[2],O=e[6],I=e[10],z=N*l+O*c+I*f,j=N*m+O*y+I*b,D=N*w+O*A+I*M;T=Math.asin(i(z)),E=Math.atan2(D,j)}this.angle.jump(t,E,T),this.recalcMatrix(t);var F=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var H=V[15],q=V[12]/H,G=V[13]/H,X=V[14]/H,W=Math.exp(this.computedRadius[0]);this.center.jump(t,q-F*W,G-B*W,X-U*W)},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,a){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,a=a||this.computedUp;var o=a[0],s=a[1],l=a[2],u=n(o,s,l);if(!(u<1e-6)){o/=u,s/=u,l/=u;var c=e[0]-r[0],f=e[1]-r[1],h=e[2]-r[2],d=n(c,f,h);if(!(d<1e-6)){c/=d,f/=d,h/=d;var p=this.computedRight,g=p[0],v=p[1],m=p[2],y=o*g+s*v+l*m;g-=y*o,v-=y*s,m-=y*l;var b=n(g,v,m);if(!(b<.01&&(g=s*h-l*f,v=l*c-o*h,m=o*f-s*c,b=n(g,v,m),b<1e-6))){g/=b,v/=b,m/=b,this.up.set(t,o,s,l),this.right.set(t,g,v,m),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=s*m-l*v,_=l*g-o*m,w=o*v-s*g,A=n(x,_,w);x/=A,_/=A,w/=A;var M=o*c+s*f+l*h,k=g*c+v*f+m*h,T=x*c+_*f+w*h,E=Math.asin(i(M)),L=Math.atan2(T,k),S=this.angle._state,C=S[S.length-1],P=S[S.length-2];C%=2*Math.PI;var R=Math.abs(C+2*Math.PI-L),N=Math.abs(C-L),O=Math.abs(C-2*Math.PI-L);R0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function f(t){return new Int16Array(o(2*t),0,t)}function h(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return x?new Uint8ClampedArray(o(t),0,t):s(t)}function v(t){return new DataView(o(t),0,t)}function m(t){t=y.nextPow2(t);var e=y.log2(t),r=A[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,A=_.BUFFER;r.free=function(t){if(n.isBuffer(t))A[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){A[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8": -return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return f(t);case"int32":return h(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return m(t);case"data":case"dataview":return v(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=f,r.mallocInt32=h,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=v,r.mallocBuffer=m,r.clearCache=function(){for(var t=0;t<32;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,A[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":35,buffer:45,dup:77}],248:[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;e8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function o(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),!(e<0)&&(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof x||a();var s=[],l=[],u=b++;return Object.create(x.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(o)}})};x.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||!!c&&c.has___(t)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof x||a();var l,u=new s,c=void 0,f=!1;return l=o?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new x),c.set(t,e)),this}:function(t,e){if(f)try{u.set(t,e)}catch(r){c||(c=new x),c.set___(t,e)}else u.set(t,e);return this},Object.create(x.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");f=!0})}})}o&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=x.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=x)}}()},{}],253:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":254}],254:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],255:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":253}],256:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":86}],257:[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":70}],258:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":257}],259:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("opacity"),u("align"),u("bgcolor");var f=u("bordercolor"),h=i.opacity(f);u("borderpad");var d=u("borderwidth"),p=u("showarrow");u("text",p?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font);for(var g=["x","y"],v=[-10,-30],m={_fullLayout:r},y=0;y<2;y++){var b=g[y],x=a.coerceRef(t,e,m,b,"","paper");if(a.coercePosition(e,m,u,x,b,.5),p){var _="a"+b,w=a.coerceRef(t,e,m,_,"pixel");"pixel"!==w&&w!==x&&(w=e[_]="pixel");var A="pixel"===w?v[y]:.4;a.coercePosition(e,m,u,w,_,A)}else u(b+"anchor")}return n.noneOrAll(t,e,["x","y"]),p&&(u("arrowcolor",h?e.bordercolor:i.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(h&&d||1)),n.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":364,"../../plots/cartesian/axes":393,"../color":268,"./attributes":261}],260:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],261:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":359,"../../plots/cartesian/constants":398,"../../plots/font_attributes":413,"./arrow_paths":260}],262:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,f=s-l,h=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),f=Math.max(f,d),h=Math.max(h,d)}r&&r.autorange&&a.expand(r,[r.l2c(r.r2l(e.x))],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(n.r2l(e.y))],{ppadplus:h,ppadminus:f})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":364,"../../plots/cartesian/axes":393,"./draw":264}],263:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),i=t("./annotation_defaults");e.exports=function(t,e){var r={name:"annotations",handleItemDefaults:i};n(t,e,r)}},{"../../plots/array_container_defaults":390,"./annotation_defaults":259}],264:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=$.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,m=Math.round(u+2*tt),y=Math.round(p+2*tt);q._w=u,q._h=p;var x=!1;if(["x","y"].forEach(function(e){var n,i=q[e+"ref"]||e,a=f.getFromId(t,i),o=(Y+("x"===e?0:90))*Math.PI/180,s=m*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=q[e+"anchor"];if(a){var u=a.r2fraction(q[e]);if(!a.autorange&&(u<0||u>1)&&(q["a"+e+"ref"]===i?(u=a.r2fraction(q["a"+e]),(u<0||u>1)&&(x=!0)):x=!0,x))return;W[e]=a._offset+a.r2p(q[e]),n=.5}else n=q[e],"y"===e&&(n=1-n),W[e]="x"===e?P.l+P.w*n:P.t+P.h*n;var c=0;q["a"+e+"ref"]===i?W["aa"+e]=a._offset+a.r2p(q["a"+e]):(c=q.showarrow?q["a"+e]:s*r(n,l),W[e]+=c),q["_"+e+"type"]=a&&a.type,q["_"+e+"size"]=s,q["_"+e+"shift"]=c}),x)return void $.remove();var _,w;q.showarrow&&(_=q.axref===q.xref?W.x:c.constrain(W.x-q.ax,1,M.width-1),w=q.ayref===q.yref?W.y:c.constrain(W.y-q.ay,1,M.height-1)),W.x=c.constrain(W.x,1,M.width-1),W.y=c.constrain(W.y,1,M.height-1);var A=tt-s.top,k=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:k,y:A}),nt.selectAll("tspan.line").attr({y:A,x:k})),et.call(d.setRect,K/2,K/2,m-K,y-K);var T=0,E=0;T=q.axref===q.xref?Math.round(W.aax-m/2):Math.round(W.x-m/2),E=q.ayref===q.yref?Math.round(W.aay-y/2):Math.round(W.y-y/2),$.call(c.setTranslate,T,E);var L="annotations["+e+"]",S=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=q.axref===q.xref?W.aax+r:W.x+r,s=q.ayref===q.yref?W.aay+n:W.y+n;var u=c.rotationXYMatrix(Y,i,s),f=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,m=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!m.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){m.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=q.arrowwidth,x=q.arrowcolor,A=Z.append("g").style({opacity:h.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=A.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(h.stroke,h.rgb(x));b(M,q.arrowhead,"end",q.arrowsize);var k=A.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,S;v.init({element:k.node(),prepFn:function(){var t=c.getTranslate($);E=t.x,S=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){A.attr("transform","translate("+t+","+e+")");var r=f(E,S),n=r[0]+t,i=r[1]+e;$.call(c.setTranslate,n,i),T[L+".x"]=G?G.p2r(G.r2p(q.x)+t):(_+t-P.l)/P.w,T[L+".y"]=X?X.p2r(X.r2p(q.y)+e):1-(w+e-P.t)/P.h,q.axref===q.xref&&(T[L+".ax"]=G?G.p2r(G.r2p(q.ax)+t):(_+t-P.l)/P.w),q.ayref===q.yref&&(T[L+".ay"]=X?X.p2r(X.r2p(q.ay)+e):1-(w+e-P.t)/P.h),Q.attr({transform:"rotate("+Y+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};q.showarrow&&S(0,0);var C=c.rotationXYMatrix(Y,W.x,W.y),R=c.apply2DTransform(C);if(t._context.editable){var N,O,I;v.init({element:$.node(),prepFn:function(){var t=c.getTranslate($);N=t.x,O=t.y,I={}},moveFn:function(t,e){$.call(c.setTranslate,N+t,O+e);var r="pointer";if(q.showarrow)q.axref===q.xref?I[L+".ax"]=G.p2r(G.r2p(q.ax)+t):I[L+".ax"]=q.ax+t,q.ayref===q.yref?I[L+".ay"]=X.p2r(X.r2p(q.ay)+e):I[L+".ay"]=q.ay+e,S(t,e);else{if(G)I[L+".x"]=q.x+t/G._m;else{var n=q._xsize/P.w,i=q.x+q._xshift/P.w-n/2;I[L+".x"]=v.align(i+t/P.w,n,0,1,q.xanchor)}if(X)I[L+".y"]=q.y+e/X._m;else{var a=q._ysize/P.h,o=q.y-q._yshift/P.h-a/2;I[L+".y"]=v.align(o-e/P.h,a,0,1,q.yanchor)}G&&X||(r=v.getCursor(G?.5:I[L+".x"],X?.5:I[L+".y"],q.xanchor,q.yanchor))}var s=R(N,O),l=s[0]+t,u=s[1]+e;$.call(c.setTranslate,N+t,O+e),Q.attr({transform:"rotate("+Y+","+l+","+u+")"}),g($,r)},doneFn:function(e){if(g($),e){l.relayout(t,I);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,A=t.layout,M=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return A.annotations=u,y(A,M),void n(t);if("remove"===u)return delete A.annotations,M.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)M._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}M._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=A.annotations[e],E=M.annotations[e];if(T){var L={};"string"==typeof r&&r?L[r]=u:c.isPlainObject(r)&&(L=r);var S=Object.keys(L);for(w=0;w4/3&&(j=V)}}else z&&(F&&(j<1/3?j+=U:j>2/3&&(j-=U)),j=(j-z.domain[0])/(z.domain[1]-z.domain[0]),j=z.fraction2r(j))}z&&z===I&&D&&("log"===D&&"log"!==z.type?j=Math.pow(10,j):"log"!==D&&"log"===z.type&&(j=j>0?Math.log(j)/Math.LN10:void 0)),T[O]=j}}var q={};m(T,q,M),M.annotations[e]=q;var G=f.getFromId(t,q.xref),X=f.getFromId(t,q.yref),W={x:0,y:0},Y=+q.textangle||0,Z=M._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",q.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:q})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),K=q.borderwidth,J=q.borderpad,tt=K+J,et=$.append("rect").attr("class","bg").style("stroke-width",K+"px").call(h.stroke,q.bordercolor).call(h.fill,q.bgcolor),rt=q.font,nt=$.append("text").classed("annotation",!0).attr("data-unformatted",q.text).text(q.text);t._context.editable?nt.call(p.makeEditable,$).call(x).on("edit",function(r){q.text=r,this.attr({"data-unformatted":q.text}),this.call(x);var n={};n["annotations["+e+"].text"]=q.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(x),Q.attr({transform:"rotate("+Y+","+W.x+","+W.y+")"}).call(d.setPosition,W.x,W.y)}}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,f=n-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var g=(u*d-c*h)/p,v=(u*f-l*h)/p;return v<0||v>1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./annotation_defaults"),y=t("./defaults"),b=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":364,"../../lib/setcursor":374,"../../lib/svg_text_utils":378,"../../plotly":388,"../../plots/cartesian/axes":393,"../../plots/plots":430,"../color":268,"../dragelement":289,"../drawing":291,"./annotation_defaults":259,"./defaults":263,"./draw_arrow_head":265,d3:74,"fast-isnumeric":82}],265:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var f,h,d,p,g=(o.getPx(t,"stroke-width")||1)*l,v=t.style("stroke")||a.defaultLine,m=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=c.backoff*g;if("line"===u.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},h={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(f.y-h.y,f.x-h.x),p=d+Math.PI,x){var _=x*Math.cos(d),w=x*Math.sin(d);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),b&&(h.x+=_,h.y+=w,t.attr({x2:h.x,y2:h.y}))}}else if("path"===u.nodeName){var A=u.getTotalLength(),M="";if(y){var k=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(k.y-T.y,k.x-T.x),f=u.getPointAtLength(Math.min(x,A)),x&&(M="0px,"+x+"px,")}if(b){var E=u.getPointAtLength(A),L=u.getPointAtLength(A-.1);if(p=Math.atan2(E.y-L.y,E.x-L.x),h=u.getPointAtLength(Math.max(0,A-x)),x){var S=M?2*x:x;M+=A-S+"px,"+A+"px"}}else M&&(M+=A+"px");M&&t.style("stroke-dasharray",M)}var C=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:v,opacity:m,"stroke-width":0})};y&&C(f,d),b&&C(h,p)}}},{"../color":268,"../drawing":291,"./arrow_paths":260,d3:74,"fast-isnumeric":82}],266:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":261,"./calc_autorange":262,"./defaults":263,"./draw":264}],267:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],268:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(C);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?L[0]:(C[e]+C[e-1])/2,e===C.length-1?L[1]:(C[e]+C[e+1])/2].map(J.c2p).map(Math.round);e!==C.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=R(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({x:W,width:Math.max(B,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2), -fill:o})});var h=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){n.select(this).attr("d","M"+W+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+B).call(d.lineGroupStyle,_.line.width,P(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=W+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));A("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:k.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,i=x();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(a,r||{}))}function M(){var r=B+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(j=ot.select("text"),j.node()&&!j.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-W-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-$;at.select(".cbbg").attr({x:W-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:W,y:$+_.ypad+("top"===_.titleside?st:0),width:Math.max(B,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var k=t._fullLayout,T=k._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void k._infolayer.selectAll("g."+e).remove();var E,L=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],C=[],P="function"==typeof _.line.color?_.line.color:function(){return _.line.color},R="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},N=_.levels.end+_.levels.size/100,O=_.levels.size,I=1.001*L[0]-.001*L[1],z=1.001*L[1]-.001*L[0];for(E=_.levels.start;(E-N)*O<0;E+=O)E>I&&EL[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+H-X],J.setScale();var at=k._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+q)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+H-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,A(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ft=c.syncOrAsync([o.previousPromises,w,o.previousPromises,M],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var ht,dt,pt;u.init({element:at.node(),prepFn:function(){ht=at.attr("transform"),h(at)},moveFn:function(t,e){at.attr("transform",ht+" translate("+t+","+e+")"),dt=u.align(Y+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,H,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);h(at,r)},doneFn:function(e){h(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},x().index)}})}return ft}function x(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":364,"./flip_scale":279,"./scales":286}],275:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":359,"./attributes":273,"./scales.js":286}],276:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":286}],277:[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,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,g=f?i.nestedProperty(e,d).get()||{}:e,v=p[h+"min"],m=p[h+"max"],y=p.colorscale,b=n(v)&&n(m)&&v=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],280:[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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):e}},{"./default_scale":276,"./is_valid_scale_array":284,"./scales":286}],281:[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(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],288:[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":364}],289:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,g=o.getPlotDiv(t.element)||{},v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":364,"../../plotly":388,"../../plots/cartesian/constants":398,"./align":287,"./cursor":288,"./unhover":290}],290:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":358}],291:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,f,h;t.so?(h=o.outlierwidth,f=o.outliercolor,c=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(h||1)+"px",fill:"none"}):(e.style("stroke-width",h+"px").call(l.fill,c),h&&e.call(l.stroke,f))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),f=(c*c*i-u*u*s)*n,h=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&f/d),2),a.round(e[1]+(d&&h/d),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&h/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var v=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=g.tryColorscale(i,""),s=g.tryColorscale(i,"line");n(t,e,r,o,s,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),i=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,a.select(this),e,n,i)})}},g.tryColorscale=function(t,e){var r=e?c.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):c.identity};var b={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(f.convertToTspans);var h=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*x+1,v=b[l]*c,m=.75*u+b[s]*c+(b[s]-1)*p*u/2;h.attr("transform","translate("+v+","+m+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=k&&(a.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":352,"../../lib":364,"../../lib/svg_text_utils":378,"../../registry":438,"../../traces/scatter/make_bubble_size_func":469,"../../traces/scatter/subtypes":474,"../color":268,"../colorscale":282,"./symbol_defs":292,d3:74,"fast-isnumeric":82}],292:[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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r; -},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:74}],293:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],294:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),f=0;f0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);c&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;f="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");s=!v.size(),s?v=e.append("path").classed("yerror",!0):c&&(v=v.transition().duration(r.duration).ease(r.easing)),v.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var m=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-m)+"v"+2*m+"m0,-"+m+"H"+o.xs,o.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":474,d3:74,"fast-isnumeric":82}],299:[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":268,d3:74}],300:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":398}],301:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}var o=n("source"),l=n("visible",!!o);if(!l)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var u={_fullLayout:r},c=["x","y"],f=0;f<2;f++)a.coerceRef(t,e,u,c[f],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var r={name:l,handleItemDefaults:n};o(t,e,r)}},{"../../lib":364,"../../plots/array_container_defaults":390,"../../plots/cartesian/axes":393,"./attributes":300}],302:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,f=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,h=c*d.x[e.xanchor].offset,p=f*d.y[e.yanchor].offset,g=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,v=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+h,m=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:v,y:m,width:c,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=o?o._id:"",b=l?l._id:"",x=y+b;x&&r.call(i.setClipUrl,"clip"+s._uid+x)}for(var s=t._fullLayout,l=[],u=[],c=[],f=0;f=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}},{}],305:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":359,"../../plots/font_attributes":413,"../color/attributes":267}],306:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],307:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(b!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",v),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":364,"../../plots/layout_attributes":428,"../../registry":438,"./attributes":305,"./helpers":310}],308:[function(t,e,r){"use strict";function n(t,e){function r(r){m.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?f.call(m.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=r.indexOf(f);h===-1?r.push(f):r.splice(h,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;r=s*h,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cn.width-(n.margin.r+n.margin.l)&&(b=0,v+=m,i.height=i.height+m,m=0),f.setTranslate(this,a+b,5+a+e.height/2+v),i.width+=o+r,i.height=Math.max(i.height,e.height),b+=o+r,m=Math.max(e.height,m)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),b=t("./get_legend_data"),x=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(g.setRect,F,t,y.scrollBarWidth,y.scrollBarHeight),k.select("rect").attr({y:m.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var m=r.legend,_=r.showlegend&&b(t.calcdata,m),A=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var E=M.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=M.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=E.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var C=S.selectAll("g.traces").data(f.identity);C.enter().append("g").attr("class","traces"),C.exit().remove(),C.call(x).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?A.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var P=0!==M.enter().size();P&&(o(t,S,C),s(t));var R=0,N=r.width,O=0,I=r.height;o(t,S,C),m.height>I?l(t):s(t);var z=r._size,j=z.l+z.w*m.x,D=z.t+z.h*(1-m.y);w.isRightAnchor(m)?j-=m.width:w.isCenterAnchor(m)&&(j-=m.width/2),w.isBottomAnchor(m)?D-=m.height:w.isMiddleAnchor(m)&&(D-=m.height/2);var F=m.width,B=z.w;F>B?(j=z.l,F=B):(j+F>N&&(j=N-F),jV?(D=z.t,U=V):(D+U>I&&(D=I-U),Dr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":364,"../../registry":438,"../../traces/pie/style_one":452,"../../traces/scatter/subtypes":474,"../color":268,"../drawing":291,d3:74}],313:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(v,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",o.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":364,"../color":268,"./attributes":317,"./button_attributes":318,"./constants":319}],321:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},i=S.line.width?S.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",S.opacity).call(_.stroke,i).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);C&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+C),t._context.editable&&f(t,a,S,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:b.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>W&&!t.shiftKey?A.getCursor(i/r,1-a/n):"move";M(e,o),G=o.split("-")[0]}function a(e){F=x.getFromId(t,r.xref),B=x.getFromId(t,r.yref),U=T.getDataToPixel(t,F),V=T.getDataToPixel(t,B,!0),H=T.getPixelToData(t,F),q=T.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(j=r.path,D=a+".path"):(c=U(r.x0),f=V(r.y0),h=U(r.x1),d=V(r.y1),g=a+".x0",m=a+".y0",b=a+".x1",_=a+".y1"),cW&&(u[S]=r[N]=q(s),u[C]=r[O]=q(l)),f-c>X&&(u[P]=r[I]=H(c),u[R]=r[z]=H(f))}e.attr("d",p(t,r))}var u,c,f,h,d,g,m,b,_,w,k,E,L,S,C,P,R,N,O,I,z,j,D,F,B,U,V,H,q,G,X=10,W=10,Y={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=Y.element.getBoundingClientRect();A.init(Y)}function h(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):b.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=x.getFromId(t,r.id,"x")._id,i=x.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=x.getFromId(t,e.xref),l=x.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),f=n(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,v=(h+d)/2,m=Math.abs(p-c),y=Math.abs(v-h),b="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),b.log("Ignoring extra params in segment "+t)),i+l})}function v(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var m=t("fast-isnumeric"),y=t("../../plotly"),b=t("../../lib"),x=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),A=t("../dragelement"),M=t("../../lib/setcursor"),k=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),L=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":364,"../../lib/setcursor":374,"../../plotly":388,"../../plots/cartesian/axes":393,"../color":268,"../dragelement":289,"../drawing":291,"./constants":331,"./defaults":332,"./helpers":334,"./shape_defaults":336,"fast-isnumeric":82}],334:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){ -return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],335:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":329,"./calc_autorange":330,"./defaults":332,"./draw":333}],336:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var f=t.path?"path":"rect",h=u("type",f),d=["x","y"],p=0;p<2;p++){var g=d[p],v={_fullLayout:r},m=i.coerceRef(t,e,v,g,"","paper");if("path"!==h){var y,b,x,_=.25,w=.75;"paper"!==m?(y=i.getFromId(v,m),x=o.rangeToShapePosition(y),b=o.shapePositionToRange(y)):b=x=n.identity;var A=g+"0",M=g+"1",k=t[A],T=t[M];t[A]=b(t[A],!0),t[M]=b(t[M],!0),i.coercePosition(e,v,u,m,A,_),i.coercePosition(e,v,u,m,M,w),e[A]=x(e[A]),e[M]=x(e[M]),t[A]=k,t[M]=T}}return"path"===h?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":364,"../../plots/cartesian/axes":393,"./attributes":329,"./helpers":334}],337:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":359,"../../plots/animation_attributes":389,"../../plots/font_attributes":413,"../../plots/pad_attributes":429,"./constants":338}],338:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],339:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+S.railTouchRectClass).data([0]);n.enter().append("rect").classed(S.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,S.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),M.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+S.railRectClass).data([0]);r.enter().append("rect").classed(S.railRectClass,!0);var n=e.inputAreaLength-2*S.railInset;r.attr({width:n,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(r,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+S.groupClassName).data(r,i);l.enter().append("g").classed(S.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,L=!0,S=P,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,M=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,L=!1,S=g.title.trim();""===S&&(E=0),S.match(/Click to enter .+ title/)&&(E=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var P="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?a.restyle(t,v,e,m):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":364,"../../lib/svg_text_utils":378,"../../plotly":388,"../../plots/plots":430,"../color":268,"../drawing":291,d3:74,"fast-isnumeric":82}],343:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":359,"../../plots/font_attributes":413,"../../plots/pad_attributes":429,"../color/attributes":267}],344:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],345:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var f=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){b.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],352:[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}},{}],353:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":266,"./components/images":303,"./components/legend":311,"./components/rangeselector":323,"./components/rangeslider":328,"./components/shapes":335,"./components/sliders":341,"./components/updatemenus":347,"./fonts/mathjax_config":354,"./lib/queue":372,"./plot_api/plot_schema":382,"./plot_api/register":383,"./plot_api/set_plot_config":384,"./plot_api/to_image":386,"./plot_api/validate":387,"./plotly":388,"./snapshot":443,"./snapshot/download":440,"./traces/scatter":464,d3:74,"es6-promise":79}],354:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],355:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":350,"fast-isnumeric":82}],356:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t); -for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var v=(new Date).getFullYear();e=((Number(u[0])-v+70)%100+200)%100+v-70}if(!a(e))return l;var m=new Date(0,0,1);if(m.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(m.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(m.setDate(i),m.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(m.setHours(o),m.getHours()!==o)return l;if(u.length>1)return i=m.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=f*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return m.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,v=3*c,m=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":355,"./coerce":356,"./dates":357,"./extend":359,"./filter_unique":360,"./filter_visible":361,"./is_array":365,"./is_plain_object":366,"./loggers":367,"./matrix":368,"./nested_property":369,"./notifier":370,"./search":373,"./stats":376,d3:74}],365:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],366:[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}},{}],367:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,h(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;uMath.max(c,g)||l>Math.max(f,v)))if(lc||Math.abs(n(o,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":368}],372:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;f90&&l.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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":82}],377:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:15,tinycolor2:241}],378:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,v.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){ -return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":351,"../constants/xmlns_namespaces":352,"../lib":364,d3:74}],379:[function(t,e,r){"use strict";function n(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=f.cleanId(r,n))}function i(t){var e="middle",r="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?r="left":t.indexOf("right")!==-1&&(r="right"),e+" "+r}function a(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var o=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),l=t("../registry"),u=t("../lib"),c=t("../plots/plots"),f=t("../plots/cartesian/axes"),h=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.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);var i=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lP.range[0]?[1,2]:[2,1]);else{var R=P.range[0],N=P.range[1];"log"===x?(R<=0&&N<=0&&r(E+".autorange",!0),R<=0?R=N/1e6:N<=0&&(N=R/1e6),r(E+".range[0]",Math.log(R)/Math.LN10),r(E+".range[1]",Math.log(N)/Math.LN10)):(r(E+".range[0]",Math.pow(10,R)),r(E+".range[1]",Math.pow(10,N)))}else r(E+".autorange",!0)}if("reverse"===k)L.range?L.range.reverse():(r(E+".autorange",!0),L.range=[1,0]),S.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var O=m.parts[1],I=m.parts[0],z=a[I]||[],j=z[O]||{};2===m.parts.length&&(null===x&&(e[v]="remove"),"add"===e[v]||b.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?O===-1?(g[I]=z,delete g[v]):g[v]=j:b.log("???",e)),!n(j,"x")&&!n(j,"y")||b.containsAny(v,["color","opacity","align","dash"])||(d.docalc=!0);var D=w.getComponentMethod(I,"drawOne");D(t,O,m.parts.slice(2).join("."),e[v]),delete e[v]}else if(A.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1])C.manageArrayContainers(m,x,g),d.doplot=!0;else{var F=String(m.parts[1]||"");0===m.parts[0].indexOf("scene")?d.doplot=!0:0===m.parts[0].indexOf("geo")?d.doplot=!0:0===m.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===v?d.doplot=!0:!o._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?d.docalc=!0:m.parts[0].indexOf("legend")!==-1?d.dolegend=!0:v.indexOf("title")!==-1?d.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&b.containsAny(F,["tick","exponent","grid","zeroline"])?d.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:m.parts.length>1&&F.indexOf("line")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&"mirror"===F?d.doticks=d.dolayoutstyle=!0:"margin.pad"===v?d.doticks=d.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(d.doplot=!0):d.doplot=!0,m.set(x)}}}var B=t._fullLayout.width,U=t._fullLayout.height;A.supplyDefaults(t),t.layout.autosize&&A.plotAutoSize(t,t.layout,t._fullLayout);var V=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==U;return V&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:b.extendDeep({},p)}}function g(t){var e=v.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];v.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=b.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(L.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),b=t("../lib"),x=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),A=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),k=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),L=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),C=t("./helpers"),P=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=R._basePlotModules,r=0;r=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=C.getGraphDiv(t),!b.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=A.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function g(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var v,m,y=0,x=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&b.isPlainObject(e);if(M)x.push({type:"object",data:g(b.extendFlat({},e))});else if(_||"string"==typeof e)for(v=0;v0&&EE)&&L.push(m);x=L}}x.length>0?f(x):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=C.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!b.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:A.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),A.modifyFrames(t,a)},y.purge=function(t){t=C.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return A.cleanPlot([],{},r,e),A.purge(t),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":291,"../components/errorbars":297,"../constants/xmlns_namespaces":352,"../lib":364,"../lib/events":358,"../lib/queue":372,"../lib/svg_text_utils":378,"../plotly":388,"../plots/cartesian/graph_interact":400,"../plots/plots":430,"../plots/polar":433,"../registry":438,"./helpers":379,"./subroutines":385,d3:74,"fast-isnumeric":82}],381:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],382:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};_(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return _(t,g),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)c(t,r,"xaxis"),c(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;c(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){f(t,r,e+r.name)}):f(t,r,r.name))}),{layoutAttributes:o(t)}}function a(t){var e=h.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):t.arrayOk===!0&&(i[n+"src"]=e(n)):d.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function l(t){function e(t,e,r){if(t){var n=t[A];n&&(delete t[A],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return x(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),x(t,b.layout),t}function c(t,e,r){var n=d.nestedProperty(t,r),i=_({},e.layoutAttributes);i[w]=!0,n.set(i)}function f(t,e,r){var n=d.nestedProperty(t,r),i=_(n.get()||{},e.layoutAttributes);n.set(i)}var h=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),m=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),x=d.extendFlat,_=d.extendDeep,w="_isSubplotObj",A="_isLinkedToArray",M="_deprecated",k=[w,A,M];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=A,r.DEPRECATED=M,r.UNDERSCORE_ATTRS=k,r.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:k.concat.role},traces:t,layout:i(),transforms:e,frames:o(v),animation:o(m)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];k.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||d.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){a=a.slice(0,s).concat([r]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=n(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":364,"../plotly":388,"../snapshot/cloneplot":439,"../snapshot/helpers":442,"../snapshot/svgtoimg":444,"../snapshot/tosvg":446,"fast-isnumeric":82}],387:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;mc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=C&&i<=10||e>=15*C)t._tickround="d";else if(e>=R&&i<=16||e>=P)t._tickround="M";else if(e>=N&&i<=19||e>=R)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(b(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);b(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(Y),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(b(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=V(c):"m"===l?a=H(c):"d"===l?(r||(i="
"+V(c)),a=q(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=W(c),"S"!==l&&(a+=h(y.round(m(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=q(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&m(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,m(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},O.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===i){var g=n-1,v=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,v)]:[g,v]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r.map(t.l2r||Number)},O.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=O.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},O.saveRangeInitial=function(t,e){for(var r=O.list(t,"",!0),n=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=v-1;a>5;a--)i(a)}},O.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},O.autoTicks(f,s);var h,d=O.tickIncrement(O.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*x||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&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),a(t),t._tmin=O.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=O.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),f=0;fL?(e/=L,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,z)):n>S?(e/=S,t.dtick="M"+i(e,1,j)):n>C?(t.dtick=i(e,C,F),t.tick0="2000-01-02"):n>P?t.dtick=i(e,P,j):n>R?t.dtick=i(e,R,D):n>N?t.dtick=i(e,N,D):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,z))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,z)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,z));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},O.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?U:B,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},O.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]a:f1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":350,"../../lib":364,"fast-isnumeric":82}],395:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),f=[],h=0;h0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],398:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],399:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),b=t("./constants"),x=!0;e.exports=function(t,e,r,s,_,w,A,M){function k(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+vt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+vt+")").attr("d","M0,0Z"),L()}function L(){pt.selectAll(".select-outline").remove()}function S(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(H,e+at)),i=Math.max(0,Math.min(q,r+ot)),a=Math.abs(n-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,X)/2);st.l=Math.min(at,n),st.r=Math.max(at,n),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!J||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function C(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),x=!1)))}function R(e,r){var i=1===(A+M).length;if(e)j();else if(2!==r||i){if(1===r&&i){var a=A?V[0]:U[0],o="s"===A||"w"===M?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",f="middle";if(a.fixedrange)return;A?(f="n"===A?"top":"bottom","right"===a.side&&(c="right")):"e"===M&&(c="right"),rt.call(h.makeEditable,null,{immediate:!0,background:F.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&u.relayout(t,s,r)})}}else z()}function N(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||F._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void f.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=mt[0]+mt[2]*l,c=(s.bottom-e.clientY)/s.height,h=mt[1]+mt[3]*(1-c);if(M){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,r){for(var n,a,o=1-e,s=0;s0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nY.width||W<0||W>Y.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:M[0]._length/2,W="ypx"in e?e.ypx:k[0]._length/2;if(P="xval"in e?n(a,e.xval):i(M,X),R="yval"in e?n(a,e.yval):i(k,W),!g(P[0])||!g(R[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(O=0;O1||z.hoverinfo.indexOf("name")!==-1?z.name:void 0,index:!1,distance:Math.min(Z,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[j]&&(V.subplot=o[j]._subplot),H=q.length,"array"===F){var Q=e[O];"pointNumber"in Q?(V.index=Q.pointNumber,F="closest"):(F="","xval"in Q&&(B=Q.xval,F="x"),"yval"in Q&&(U=Q.yval,F=F?"closest":"y"))}else B=P[D],U=R[D];if(z._module&&z._module.hoverPoints){var $=z._module.hoverPoints(V,B,U,F);if($)for(var K,J=0;J<$.length;J++)K=$[J],g(K.x0)&&g(K.y0)&&q.push(l(K,C))}else v.log("Unrecognized trace type in hover:",z);"closest"===C&&q.length>H&&(q.splice(0,H),Z=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var tt="y"===C&&G.length>1;q.sort(function(t,e){return t.distance-e.distance});var et=b.combine(o.plot_bgcolor||b.background,o.paper_bgcolor),rt={hovermode:C,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(q,rt);c(q,tt?"xa":"ya"),f(nt,tt);var it=t._hoverdata,at=[];for(N=0;N128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):k&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0;r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0),v=h.node().getBoundingClientRect().width+2*N):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,T=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),O=T.width+R+N+v;t.ty0=_-T.top,t.bx=T.width+2*N,t.by=T.height+2*N,t.anchor="start",t.txwidth=T.width,t.tx2width=v,t.offset=0,a?(t.pos=L,m=S+P/2+O<=M,A=S-P/2-O>=0,"top"!==t.idealAlign&&m||!A?m?(S+=P/2,t.anchor="start"):t.anchor="middle":(S-=P/2,t.anchor="end")):(t.pos=S,m=L+C/2+O<=w,A=L-C/2-O>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(a?"rotate("+E+")":""))}),S}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?S:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var v=f[o];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(R+N),s=o+a*(t.txwidth+N),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-P,l=t.offset*C),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*R+l)+","+(R+u)+"v"+(t.by/2-R)+"h"+n*t.bx+"v-"+t.by+"H"+(n*R+l)+"V"+(u-R)+"Z"),i.call(x.setPosition,o+l,u+t.ty0-t.by/2+N).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+a*N+l,u+t.ty0-t.by/2+N),r.select("rect").call(x.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),M=t("./dragbox"),k=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,k,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=T.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":364,"fast-isnumeric":82}],406:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,M=i.xaxes[0]._length,k=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,P,R,N,O,I=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),z=[],j=i.gd,D=[];for(C=0;C0)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*f*Math.abs(n-i))}return l}function r(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var f=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?r:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,o=t[e],l=(t._id||"x").charAt(0);if(n="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,n=n.slice(),!o||2!==o.length)return void(t[e]=n);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),r=0;r<2;r++)if("date"===t.type){if(!a.isDateTime(o[r])){t[e]=n;break}if(o[r]a.MAX_MS&&(o[r]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[r])){if(!i(o[1-r])){t[e]=n;break}o[r]=o[1-r]*(r?10:.1)}if(o[r]<-s?o[r]=-s:o[r]>s&&(o[r]=s),o[0]===o[1]){var f=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=f,o[1]+=f}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s), -!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?l:r},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var f=c.charAt(0),h=c.substr(1);h=n(h)?Number(h):0,(h<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":350,"../../lib":364,"fast-isnumeric":82}],411:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(t){var e,r,n,i,a,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,b.push(s),o[s]=a}return o}function f(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=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[u]?r[u].to:f,a=r[c]?r[c].to:h,f[0]===i[0]&&f[1]===i[1]&&h[0]===a[0]&&h[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function h(e,r){function n(e,r){for(i=0;ir.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,b=[],x=c(e),_=Object.keys(x),w=f(y,_,x);if(!w.length)return!1;var A;u&&(A=u());var M,k,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),M=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":364,"../../plotly":388,"../../registry":438,"./axes":393,d3:74}],412:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;fMath.abs(e))n.rotate(o,0,0,-t*r*Math.PI*h.rotateSpeed/window.innerWidth);else{var s=-h.zoomSpeed*a*e/window.innerHeight*(o-n.lastT())/100;n.pan(o,0,0,u*(Math.exp(s)-1))}},!0),h}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":9,"mouse-change":178,"mouse-wheel":180,"right-now":214}],416:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<3;++r){var n=s[r];e[n]._gd=t}}var i=t("./scene"),a=t("../plots"),o=t("../../constants/xmlns_namespaces"),s=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,o=a.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var s=0;sh[1][o]?d[o]=1:h[1][o]===h[0][o]?d[o]=1:d[o]=1/(h[1][o]-h[0][o]);for(this.dataScale=d,a=0;ag[1][a])g[0][a]=-1,g[1][a]=1;else{var x=g[1][a]-g[0][a];g[0][a]-=x/32,g[1][a]+=x/32}}else{var w=c[T[a]].range;g[0][a]=w[0],g[1][a]=w[1]}g[0][a]===g[1][a]&&(g[0][a]-=1,g[1][a]+=1),v[a]=g[1][a]-g[0][a],this.glplot.bounds[0][a]=g[0][a]*d[a],this.glplot.bounds[1][a]=g[1][a]*d[a]}var A=[1,1,1];for(a=0;a<3;++a){l=c[T[a]],u=l.type;var M=y[u];A[a]=Math.pow(M.acc,1/M.count)/d[a]}var k,E=4;if("auto"===c.aspectmode)k=Math.max.apply(null,A)/Math.min.apply(null,A)<=E?A:[1,1,1];else if("cube"===c.aspectmode)k=[1,1,1];else if("data"===c.aspectmode)k=A;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var L=c.aspectratio;k=[L.x,L.y,L.z]}c.aspectratio.x=f.aspectratio.x=k[0],c.aspectratio.y=f.aspectratio.y=k[1],c.aspectratio.z=f.aspectratio.z=k[2],this.glplot.aspect=k;var S=c.domain||null,C=e._size||null;if(S&&C){var P=this.container.style;P.position="absolute",P.left=C.l+S.x[0]*C.w+"px",P.top=C.t+(1-S.y[1])*C.h+"px",P.width=C.w*(S.x[1]-S.x[0])+"px",P.height=C.h*(S.y[1]-S.y[0])+"px"}this.glplot.redraw()}},k.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},k.setCameraToDefault=function(){this.setCamera({eye:{x:1.25,y:1.25,z:1.25},center:{x:0,y:0,z:0},up:{x:0,y:0,z:1}})},k.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},k.setCamera=function(t){var e={};e[this.id]=t,this.glplot.camera.lookAt.apply(this,l(t)),this.graphDiv.emit("plotly_relayout",e)},k.saveCamera=function(t){function e(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]]}var r=this.getCamera(),n=p.nestedProperty(t,this.id+".camera"),i=n.get(),a=!1;if(void 0===i)a=!0;else for(var o=0;o<3;o++)for(var s=0;s<3;s++)if(!e(r,i,o,s)){a=!0;break}return a&&n.set(r),a},k.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},k.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(c),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var a=0,o=n-1;a=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"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,f=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=f)}else{p.supplyLayoutGlobalDefaults(a,n);var h=!a.width||!a.height,d=n.autosize,g=t._context&&t._context.autosizable,v=h&&(d||g);v?p.plotAutoSize(t,a,n):h&&p.sanitizeMargins(t),!d&&h&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,n),n._has=p._hasPlotType.bind(n);var m=n._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),f=c.left+c.right,d=c.bottom+c.top,g=1-2*o,v=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(v.width-f)),i=Math.round(g*(v.height-d))}else{var m=l?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,i=parseFloat(m.height)||r.height}var y=p.layoutAttributes.width.min,b=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-i)>1;(_||x)&&(x&&(r.width=n),_&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a;c.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(i=0;i.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,f=r.size,h=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(f*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(f-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var v=l[t].t.val,m=l[t].t.size;if(v>h){var y=(d*v+(m-e.height)*h)/(v-h),b=(m*(1-h)+(d-e.height)*(1-v))/(v-h);y>=0&&b>=0&&y+b>s+o&&(s=y,o=b)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):h.isJSDate(t)?h.ms2DateTime(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)},p.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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,S=L?f.angularAxis.domain:n.extent(M),C=Math.abs(M[1]-M[0]);T&&!k&&(C=0);var P=S.slice();E&&k&&(P[1]+=C);var R=f.angularAxis.ticksCount||4;R>8&&(R=R/(R/8)+R%8),f.angularAxis.ticksStep&&(R=(P[1]-P[0])/R);var N=f.angularAxis.ticksStep||(P[1]-P[0])/(R*(f.minorTicks+1));A&&(N=Math.max(Math.round(N),1)),P[2]||(P[2]=N);var O=n.range.apply(this,P);if(O=O.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(P.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?C:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var I="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",z=(new DOMParser).parseFromString(I,"application/xml"),j=this.appendChild(this.ownerDocument.importNode(z.documentElement,!0));e=n.select(j)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var D,F=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},U={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){D=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:D,elements:V,reverseOrder:f.legend.reverseOrder})})();var H=D.node().getBBox();b=Math.min(f.width-H.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,b=Math.max(10,b),_=[f.margin.left+b,f.margin.top+b],i.range([0,b]),c.layout.radialAxis.domain=i.domain(),D.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else D=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var q=[(f.width-(f.margin.left+f.margin.right+2*b+(H?H.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2];if(q[0]=Math.max(0,q[0]),q[1]=Math.max(0,q[1]), -e.select(".outer-group").attr("transform","translate("+q+")"),f.title){var G=e.select("g.title-group text").style(U).text(f.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var W=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=W.selectAll("circle.grid-circle").data(i.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(B),Y.attr("r",i),Y.exit().remove()}W.select("circle.outside-circle").attr({r:b}).style(B);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=n.svg.axis().scale(i).ticks(5).tickSize(5);W.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),W.selectAll(".domain").style(B),W.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),W.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(O),K=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),K.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),K.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(U);var J=$.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+f.labelOffset,i=f.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:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":A?A[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(U);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));D.attr({transform:"translate("+[b+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!k){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;ot=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ct.text(o.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=i.invert(o.util.getMousePos(Z).radius);var n=o.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(o.util.round(st)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var i=n.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(u.t=A[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-q[0]-h.left,f.top+f.height/2-q[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.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")})})}),h}var e,r,i,s,l={data:[],layout:{}},u={},c={},f=n.dispatch("hover"),h={};return h.render=function(e){return t(e),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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return i},h.angularScale=function(t){return s},h.svg=function(){return e},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,i=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return i},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("undefined"==typeof 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 r===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=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 s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:h(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,i,a)},"stroke-width":function(t,e){return v["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,i,a)},opacity:function(t,e){return v.opacity(r,i,a)},display:function(t,e){return v.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var v={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},m=n.select(this).selectAll("g.layer").data(l);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],i=n.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=n.merge(i);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,f=c?r.height:u*o.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.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"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(o.length),v=n.scale[c?"linear":"ordinal"]().domain(g).range(l),m=n.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,m(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return v(e)}}),x.exit().remove()}var _=n.svg.axis().scale(m).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var n=t.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(f);var h=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[i.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=i.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};n.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../lib":364,d3:74}],435:[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,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(f=i),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(r),a.config(c).render(f),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,i,a,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},u.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":268,"../../lib":364,"./micropolar":434,"./undo_manager":436,d3:74}],436:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,u=t.layout,c=l([],a),f=l({},u,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(r=0;r0)s=f(t.alphahull,l);else{var u=["x","y","z"].indexOf(t.delaunayaxis);s=c(l.map(function(t){return[t[(u+1)%3],t[(u+2)%3]]}))}var p={positions:l,cells:s,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:d(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",p.vertexIntensity=t.intensity,p.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolors[0],p.vertexColors=a(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],p.cellColors=a(t.facecolor)):(this.color=t.color,p.meshColor=d(t.color)),this.mesh.update(p)},p.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=s},{"../../lib/str2rgbarray":377,"alpha-shape":14,"convex-hull":65,"delaunay-triangulate":75,"gl-mesh3d":126,tinycolor2:241}],450:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorbar/defaults"),a=t("./attributes");e.exports=function(t,e,r,o){function s(r,i){return n.coerce(t,e,a,r,i)}function l(t){var e=t.map(function(t){var e=s(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=l(["x","y","z"]),c=l(["i","j","k"]);return u?(c&&c.forEach(function(t){for(var e=0;ep&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var m={type:"linear"};i.setConvert(m),l=m.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},g.ppad=v.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,i.expand(c,h,g),i.expand(f,d,v);var x=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],457:[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,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=i.aggNums(Math.min,null,c)),n(h)||(h=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":271,"../../components/colorscale":282,"../../lib":364,"../../plots/plots":430,"fast-isnumeric":82}],458:[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":274,"../../components/colorscale/has_colorscale":281,"./subtypes":474}],459:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],460:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var v=s(t,e,g),m=vU!=N>=U&&(C=L[T-1][0],P=L[T][0],S=C+(P-C)*(U-R)/(N-R),j=Math.min(j,S),D=Math.max(D,S));j=Math.max(j,0),D=Math.min(D,h._length);var V=l.defaultLine;return l.opacity(f.fillcolor)?V=f.fillcolor:l.opacity((f.line||{}).color)&&(V=f.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:j,x1:D,y0:U,y1:U,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":268,"../../components/errorbars":297,"../../lib":364,"../../plots/cartesian/constants":398,"../../plots/cartesian/graph_interact":400,"./get_trace_color":462}],464:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":401,"./arrays_to_calcdata":453,"./attributes":454,"./calc":455,"./clean_data":456,"./colorbar":457,"./defaults":460,"./hover":463,"./plot":471,"./select":472,"./style":473,"./subtypes":474}],465:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":277,"../../components/colorscale/has_colorscale":281}],466:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),i=A.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/w._length,r=t[1]/A._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w=e.xaxis,A=e.yaxis,M=e.simplify,k=e.connectGaps,T=e.baseTolerance,E=e.linear,L=[],S=.2,C=new Array(t.length),P=0;for(M||(T=S=-1),o=0;oi(f))break;l=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,u=f,d=!1):y=t.length||!f)break;C[P++]=f,s=f}}else C[P++]=u}L.push(C.slice(0,P))}return L}},{"../../constants/numerical":350}],467:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],468:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":82}],470:[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){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":268,"../../components/colorscale/defaults":277,"../../components/colorscale/has_colorscale":281,"./subtypes":474}],471:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function i(t,e,r,n,i,d,g){function v(t){return M?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function b(t){if(t.ids)return y}function x(){return!1}function _(t){var e,r,n=t[0].trace,i=o.select(this),a=c.hasMarkers(n),u=c.hasText(n),f=b(n),h=x,d=x;a&&(h=n.marker.maxdisplayed?m:s.identity),u&&(d=n.marker.maxdisplayed?m:s.identity),r=i.selectAll("path.point"),e=r.data(h,f);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,n).call(l.translatePoints,k,T,n),M&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=v(o.select(this));l.translatePoint(t,e,k,T),l.singlePointStyle(t,e,n)}),M?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=i.selectAll("g"),e=r.data(d,f),e.enter().append("g").append("text"),e.each(function(t){var e=v(o.select(this).select("text"));l.translatePoint(t,e,k,T)}),e.selectAll("text").call(l.textPointStyle,n).each(function(t){var e=t.xp||k.c2p(t.x),r=t.yp||T.c2p(t.y);o.select(this).selectAll("tspan").each(function(){v(o.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,A;a(t,e,r,n,i);var M=!!g&&g.duration>0,k=r.xaxis,T=r.yaxis,E=n[0].trace,L=E.line,S=o.select(d);if(S.call(u.plot,r,g),E.visible===!0){v(S).style("opacity",E.opacity);var C,P,R=E.fill.charAt(E.fill.length-1);"x"!==R&&"y"!==R&&(R=""),n[0].node3=S,f(n);var N="",O=[],I=E._prevtrace;I&&(N=I._prevRevpath||"",P=I._nextFill,O=I._polygons);var z,j,D,F,B,U,V,H,q,G="",X="",W=[],Y=[],Z=s.noop;if(C=E._ownFill,c.hasLines(E)||"none"!==E.fill){for(P&&P.datum(n),["hv","vh","hvh","vhv"].indexOf(L.shape)!==-1?(D=l.steps(L.shape),F=l.steps(L.shape.split("").reverse().join(""))):D=F="spline"===L.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),L.smoothing):l.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return F(t.reverse())},W=h(n,{xaxis:k,yaxis:T,connectGaps:E.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),q=E._polygons=new Array(W.length),A=0;A1}),Z=function(t){return function(e){if(z=D(e),j=B(e),G?R?(G+="L"+z.substr(1),X=j+("L"+X.substr(1))):(G+="Z"+z,X=j+"Z"+X):(G=z,X=j),c.hasLines(E)&&e.length>1){var r=o.select(this);if(r.datum(n),t)v(r.style("opacity",0).attr("d",z).call(l.lineGroupStyle)).style("opacity",1);else{var i=v(r);i.attr("d",z),l.singleLineStyle(n,i)}}}}}var Q=S.selectAll(".js-line").data(Y);v(Q.exit()).style("opacity",0).remove(),Q.each(Z(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Z(!0)),W.length&&(C?U&&H&&(R?("y"===R?U[1]=H[1]=T.c2p(0,!0):"x"===R&&(U[0]=H[0]=k.c2p(0,!0)),v(C).attr("d","M"+H+"L"+U+"L"+G.substr(1))):v(C).attr("d",G+"Z")):"tonext"===E.fill.substr(0,6)&&G&&N&&("tonext"===E.fill?v(P).attr("d",G+"Z"+N+"Z"):v(P).attr("d",G+"L"+N.substr(1)+"Z"),E._polygons=E._polygons.concat(O)),E._prevRevpath=X,E._prevPolygons=q);var $=S.selectAll(".points");w=$.data([n]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,s=r.yaxis,l=o.extent(a.range.map(a.r2l).map(a.l2c)),u=o.extent(s.range.map(s.r2l).map(s.l2c)),f=n[0].trace;if(c.hasMarkers(f)){var h=f.marker.maxdisplayed;if(0!==h){var d=n.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/h),g=0;i.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),f=c.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,r),n(t,p),l=0,u=[];ln?1:-1}),v){s&&(h=s());var m=o.transition().duration(a.duration).ease(a.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()});m.each(function(){p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)})})}else p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":291,"../../components/errorbars":297,"../../lib":364,"../../lib/polygon":371,"./arrays_to_calcdata":453,"./line_points":466,"./link_traces":468,"./subtypes":474,d3:74}],472:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,g=!n.hasMarkers(h)&&!n.hasText(h);if(h.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return A[t]}function u(t,e,r,n,i){var a=null;if(Array.isArray(t)){a=[];for(var o=0;o=0){var h=i(l.position,l.delaunayColor,l.delaunayAxis);h.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(h):(h.gl=o,this.delaunayMesh=v(h),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},k.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=h},{"../../constants/gl3d_dashes":348,"../../constants/gl_markers":349,"../../lib":364,"../../lib/gl_format_color":362,"../../lib/str2rgbarray":377,"../scatter/make_bubble_size_func":469,"./calc_errors":479,"delaunay-triangulate":75,"gl-error3d":98,"gl-line3d":103,"gl-mesh3d":126,"gl-scatter3d":132}],481:[function(t,e,r){"use strict";function n(t,e,r){var n=0,i=r("x"),a=r("y"),o=r("z");return i&&a&&o&&(n=Math.min(i.length,a.length,o.length),n=0&&h("surfacecolor",p||g);for(var v=["x","y","z"],m=0;m<3;++m){var y="projection."+v[m];h(y+".show")&&(h(y+".opacity"),h(y+".scale"))}u(t,e,r,{axis:"z"}),u(t,e,r,{axis:"y",inherit:"z"}),u(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":296,"../../lib":364,"../scatter/line_defaults":465,"../scatter/marker_defaults":470,"../scatter/subtypes":474,"../scatter/text_defaults":475,"./attributes":477}],482:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl_markers":349,"../../plots/gl3d":416,"../scatter/colorbar":457,"./attributes":477,"./calc":478,"./convert":480,"./defaults":481}],483:[function(t,e,r){"use strict";function n(t){return{valType:"boolean",dflt:!1}}function i(t){return{show:{valType:"boolean",dflt:!1},project:{x:n("x"),y:n("y"),z:n("z")},color:{valType:"color",dflt:a.defaultLine},usecolormap:{valType:"boolean",dflt:!1},width:{valType:"number",min:1,max:16,dflt:2},highlight:{valType:"boolean",dflt:!0},highlightcolor:{valType:"color",dflt:a.defaultLine},highlightwidth:{valType:"number",min:1,max:16,dflt:2}}}var a=t("../../components/color"),o=t("../../components/colorscale/attributes"),s=t("../../components/colorbar/attributes"),l=t("../../lib/extend").extendFlat;e.exports={z:{valType:"data_array"},x:{valType:"data_array"},y:{valType:"data_array"},text:{valType:"data_array"},surfacecolor:{valType:"data_array"},cauto:o.zauto,cmin:o.zmin,cmax:o.zmax,colorscale:o.colorscale,autocolorscale:l({},o.autocolorscale,{dflt:!1}),reversescale:o.reversescale,showscale:o.showscale,colorbar:s,contours:{x:i("x"),y:i("y"),z:i("z")},hidesurface:{valType:"boolean",dflt:!1},lightposition:{x:{valType:"number",min:-1e5,max:1e5,dflt:10},y:{valType:"number",min:-1e5,max:1e5,dflt:1e4},z:{valType:"number",min:-1e5,max:1e5,dflt:0}},lighting:{ambient:{valType:"number",min:0,max:1,dflt:.8},diffuse:{valType:"number",min:0,max:1,dflt:.8},specular:{valType:"number",min:0,max:2,dflt:.05},roughness:{valType:"number",min:0,max:1,dflt:.5},fresnel:{valType:"number",min:0,max:5,dflt:.2}},opacity:{valType:"number",min:0,max:1,dflt:1},_deprecated:{zauto:l({},o.zauto,{}),zmin:l({},o.zmin,{}),zmax:l({},o.zmax,{})}}},{"../../components/color":268,"../../components/colorbar/attributes":269,"../../components/colorscale/attributes":273,"../../lib/extend":359}],484:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){e.surfacecolor?n(e,e.surfacecolor,"","c"):n(e,e.z,"","c")}},{"../../components/colorscale/calc":274}],485:[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="cb"+r.uid,u=r.cmin,c=r.cmax,f=r.surfacecolor||r.z;if(n(u)||(u=i.aggNums(Math.min,null,f)),n(c)||(c=i.aggNums(Math.max,null,f)),t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void a.autoMargin(t,l);var h=e[0].t.cb=s(t,l),d=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});h.fillcolor(d).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":271,"../../components/colorscale":282,"../../lib":364,"../../plots/plots":430,"fast-isnumeric":82}],486:[function(t,e,r){"use strict";function n(t,e,r){this.scene=t,this.uid=r,this.surface=e,this.data=null,this.showContour=[!1,!1,!1],this.dataScale=1}function i(t,e){return void 0===e&&(e=1),t.map(function(t){var r=t[0],n=p(t[1]),i=n.toRgb();return{index:r,rgb:[i.r,i.g,i.b,e]}})}function a(t){var e=t[0].rgb,r=t[t.length-1].rgb;return e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]&&e[3]===r[3]}function o(t){var e=t.shape,r=[e[0]+2,e[1]+2],n=c(new Float32Array(r[0]*r[1]),r);return d.assign(n.lo(1,1).hi(e[0],e[1]),t),d.assign(n.lo(1).hi(e[0],1),t.hi(e[0],1)),d.assign(n.lo(1,r[1]-1).hi(e[0],1),t.lo(0,e[1]-1).hi(e[0],1)),d.assign(n.lo(0,1).hi(1,e[1]),t.hi(1)),d.assign(n.lo(r[0]-1,1).hi(1,e[1]),t.lo(e[0]-1)),n.set(0,0,t.get(0,0)),n.set(0,r[1]-1,t.get(0,e[1]-1)),n.set(r[0]-1,0,t.get(e[0]-1,0)),n.set(r[0]-1,r[1]-1,t.get(e[0]-1,e[1]-1)),n}function s(t){var e=Math.max(t[0].shape[0],t[0].shape[1]);if(ei||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 o(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}function s(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 l(t,e,r,n,i,a,o,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var f=0,h=0,d=s(c,l.stride.slice());"float32"===u?f=t.FLOAT:"float64"===u?(f=t.FLOAT,d=!1,u="float32"):"uint8"===u?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,d=!1,u="uint8");var m=1;if(2===c.length)h=t.LUMINANCE,c=[c[0],c[1],1],l=p(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])h=t.ALPHA;else if(2===c[2])h=t.LUMINANCE_ALPHA;else if(3===c[2])h=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");h=t.RGBA}m=c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(h=i),h!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,b=o.indexOf(n)<0;if(b&&o.push(n),f===a&&d)0===l.offset&&l.data.length===y?b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data):b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var _;_=a===t.FLOAT?v.mallocFloat32(y):v.mallocUint8(y);var w=p(_,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&a===t.UNSIGNED_BYTE?x(w,l):g.assign(w,l),b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,_.subarray(0,y)),a===t.FLOAT?v.freeFloat32(_):v.freeUint8(_)}}function u(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function c(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(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 s=u(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new o(t,s,e,r,n,i)}function f(t,e,r,n){var i=u(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new o(t,i,0|e.width,0|e.height,r,n)}function h(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var a=s(n,e.stride.slice()),l=0;"float32"===r?l=t.FLOAT:"float64"===r?(l=t.FLOAT,a=!1,r="float32"):"uint8"===r?l=t.UNSIGNED_BYTE:(l=t.UNSIGNED_BYTE,a=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=p(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}l!==t.FLOAT||t.getExtension("OES_texture_float")||(l=t.UNSIGNED_BYTE,a=!1);var f,h,d=e.size;if(a)f=0===e.offset&&e.data.length===d?e.data:e.data.subarray(e.offset,e.offset+d);else{var m=[n[2],n[2]*n[0],1];h=v.malloc(d,r);var y=p(h,n,m,0);"float32"!==r&&"float64"!==r||l!==t.UNSIGNED_BYTE?g.assign(y,e):x(y,e),f=h.subarray(0,d)}var b=u(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,l,f),a||v.free(h),new o(t,b,n[0],n[1],c,l)}function d(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(m||n(t),"number"==typeof arguments[1])return c(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return c(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(i(e))return f(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return h(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var p=t("ndarray"),g=t("ndarray-ops"),v=t("typedarray-pool");e.exports=d;var m=null,y=null,b=null,x=function(t,e){g.muls(t,e,255)},_=o.prototype;Object.defineProperties(_,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),y.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&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),y.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(),b.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(),b.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(b.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 a(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t|=0,a(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,a(this,this._shape[0],t),t}}}),_.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},_.dispose=function(){this.gl.deleteTexture(this.handle)},_.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)},_.setPixels=function(t,e,r,n){var a=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,i(t)){var o=this._mipLevels.indexOf(n)<0;o?(a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):a.texSubImage2D(a.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");l(a,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:192,"ndarray-ops":186,"typedarray-pool":247}],146:[function(t,e,r){"use strict";function n(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;i0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}e.exports=n},{}],155:[function(t,e,r){function n(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}e.exports=n},{}],156:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,a[0]}e.exports=n;var i=new Uint8Array(4),a=new Float32Array(i.buffer)},{}],157:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function P(){return/[^a-fA-F0-9]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),z=I,D+1)}function R(){return"."===I?(U.push(I),B=v,z=I,D+1):/[eE]/.test(I)?(U.push(I),B=v,z=I,D+1):"x"===I&&1===U.length&&"0"===U[0]?(B=w,U.push(I),z=I,D+1):/[^\d]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),z=I,D+1)}function N(){return"f"===I&&(U.push(I),z=I,D+=1),/[eE]/.test(I)?(U.push(I),z=I,D+1):"-"===I&&/[eE]/.test(z)?(U.push(I),z=I,D+1):/[^\d]/.test(I)?(e(U.join("")),B=u,D):(U.push(I),z=I,D+1)}function O(){if(/[^\d\w_]/.test(I)){var t=U.join("");return B=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:m,e(U.join("")),B=u,D}return U.push(I),z=I,D+1}var I,z,j,D=0,F=0,B=u,U=[],V=[],H=1,q=0,G=0,X=!1,W=!1,Y="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return V=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var i=t("./lib/literals"),a=t("./lib/operators"),o=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,f=0,h=1,d=2,p=3,g=4,v=5,m=6,y=7,b=8,x=9,_=10,w=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":160,"./lib/builtins-300es":159,"./lib/literals":162,"./lib/literals-300es":161,"./lib/operators":163}],159:[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":160}],160:[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"]},{}],161:[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":162}],162:[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"]},{}],163:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],164:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":158}],165:[function(t,e,r){r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=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=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),e*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):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+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],166:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function a(t,e){return c(t.vertices,e.vertices)}function o(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;r<=t;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=u[t+1];return i||(i=u),n(i)}function s(t,e,r){this.dimension=t,this.vertices=e,this.simplices=r,this.interior=r.filter(function(t){return!t.boundary}),this.tuple=new Array(t+1);for(var n=0;n<=t;++n)this.tuple[n]=this.vertices[n];var i=f[t];i||(i=f[t]=o(t)),this.orient=i}function l(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var i=t[0].length;if(r<=i)throw new Error("Must input at least d+1 points");var a=t.slice(0,i+1),o=u.apply(void 0,a);if(0===o)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;c<=i;++c)l[c]=c;o<0&&(l[0]=1,l[1]=0);for(var f=new n(l,new Array(i+1),!1),h=f.adjacent,d=new Array(i+2),c=0;c<=i;++c){for(var p=l.slice(),g=0;g<=i;++g)g===c&&(p[g]=-1);var v=p[0];p[0]=p[1],p[1]=v;var m=new n(p,new Array(i+1),!0);h[c]=m,d[c]=m}d[i+1]=f;for(var c=0;c<=i;++c)for(var p=h[c].vertices,y=h[c].adjacent,g=0;g<=i;++g){var b=p[g];if(b<0)y[g]=f;else for(var x=0;x<=i;++x)h[x].vertices.indexOf(b)<0&&(y[g]=h[x])}for(var _=new s(i,a,d),w=!!e,c=i+1;c0;){t=o.pop();for(var s=(t.vertices,t.adjacent),l=0;l<=r;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,f=0;f<=r;++f){var h=c[f];h<0?i[f]=e:i[f]=a[h]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&o.push(u)}}}return null},h.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,u=s.adjacent,c=0;c<=n;++c)a[c]=i[l[c]];s.lastVisited=r;for(var c=0;c<=n;++c){var f=u[c];if(!(f.lastVisited>=r)){var h=a[c];a[c]=t;var d=this.orient();if(a[c]=h,d<0){s=f;continue t}f.boundary?f.lastVisited=-r:f.lastVisited=r}}return}return s},h.addPeaks=function(t,e){var r=this.vertices.length-1,o=this.dimension,s=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,f=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var h=[];f.length>0;){var e=f.pop(),d=e.vertices,p=e.adjacent,g=d.indexOf(r);if(!(g<0))for(var v=0;v<=o;++v)if(v!==g){var m=p[v];if(m.boundary&&!(m.lastVisited>=r)){var y=m.vertices;if(m.lastVisited!==-r){for(var b=0,x=0;x<=o;++x)y[x]<0?(b=x,l[x]=t):l[x]=s[y[x]];var _=this.orient();if(_>0){y[b]=r,m.boundary=!1,u.push(m),f.push(m),m.lastVisited=r;continue}m.lastVisited=-r}var w=m.adjacent,A=d.slice(),M=p.slice(),k=new n(A,M,!0);c.push(k);var T=w.indexOf(e);if(!(T<0)){w[T]=k,M[g]=m,A[v]=-1,M[v]=e,p[v]=k,k.flip();for(var x=0;x<=o;++x){var E=A[x];if(!(E<0||E===r)){for(var L=new Array(o-1),S=0,C=0;C<=o;++C){var P=A[C];P<0||C===x||(L[S++]=P)}h.push(new i(L,k,x))}}}}}}h.sort(a);for(var v=0;v+1=0?o[l++]=s[c]:u=1&c;if(u===(1&t)){var f=o[0];o[0]=o[1],o[1]=f}e.push(o)}}return e}},{"robust-orientation":220,"simplicial-complex":230}],167:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function a(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),a(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],a=[],o=[],s=[],r=0;r3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=m.ge(this.leftPoints,t,h),n=m.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var a=this.left?this.left.count:0;if(4*a>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var o=this,l=this.left;l.right;)o=l,l=l.right;if(o===this)l.right=this.right;else{var u=this.left,n=this.right;o.count-=l.count,o.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var u=m.ge(this.leftPoints,t,h);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===x&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},w.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":34}],168:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;rv[1][2]&&(b[0]=-b[0]),v[0][2]>v[2][0]&&(b[1]=-b[1]),v[1][0]>v[0][1]&&(b[2]=-b[2]),!0}},{"./normalize":173,"gl-mat4/clone":106,"gl-mat4/create":107,"gl-mat4/determinant":108,"gl-mat4/invert":112,"gl-mat4/transpose":122,"gl-vec3/cross":150,"gl-vec3/dot":151,"gl-vec3/length":152,"gl-vec3/normalize":154}],173:[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}},{}],174:[function(t,e,r){function n(t,e,r,n){if(0===c(e)||0===c(r))return!1;var i=u(e,h.translate,h.scale,h.skew,h.perspective,h.quaternion),a=u(r,d.translate,d.scale,d.skew,d.perspective,d.quaternion);return!(!i||!a)&&(s(p.translate,h.translate,d.translate,n),s(p.skew,h.skew,d.skew,n),s(p.scale,h.scale,d.scale,n),s(p.perspective,h.perspective,d.perspective,n),f(p.quaternion,h.quaternion,d.quaternion,n),l(t,p.translate,p.scale,p.skew,p.perspective,p.quaternion),!0)}function i(){return{translate:a(),scale:a(1),skew:a(),perspective:o(),quaternion:o()}}function a(t){return[t||0,t||0,t||0]}function o(){return[0,0,0,1]}var s=t("gl-vec3/lerp"),l=t("mat4-recompose"),u=t("mat4-decompose"),c=t("gl-mat4/determinant"),f=t("quat-slerp"),h=i(),d=i(),p=i();e.exports=n},{"gl-mat4/determinant":108,"gl-vec3/lerp":153,"mat4-decompose":172,"mat4-recompose":175,"quat-slerp":207}],175:[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":107,"gl-mat4/fromRotationTranslation":110,"gl-mat4/identity":111,"gl-mat4/multiply":114,"gl-mat4/scale":120,"gl-mat4/translate":121}],176:[function(t,e,r){"use strict";function n(t){this._components=t.slice(),this._time=[0],this.prevMatrix=t.slice(),this.nextMatrix=t.slice(),this.computedMatrix=t.slice(),this.computedInverse=t.slice(),this.computedEye=[0,0,0],this.computedUp=[0,0,0],this.computedCenter=[0,0,0],this.computedRadius=[0],this._limits=[-(1/0),1/0]}function i(t){t=t||{};var e=t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return new n(e)}var a=t("binary-search-bounds"),o=t("mat4-interpolate"),s=t("gl-mat4/invert"),l=t("gl-mat4/rotateX"),u=t("gl-mat4/rotateY"),c=t("gl-mat4/rotateZ"),f=t("gl-mat4/lookAt"),h=t("gl-mat4/translate"),d=(t("gl-mat4/scale"),t("gl-vec3/normalize")),p=[0,0,0];e.exports=i;var g=n.prototype;g.recalcMatrix=function(t){var e=this._time,r=a.le(e,t),n=this.computedMatrix;if(!(r<0)){var i=this._components;if(r===e.length-1)for(var l=16*r,u=0;u<16;++u)n[u]=i[l++];else{for(var c=e[r+1]-e[r],l=16*r,f=this.prevMatrix,h=!0,u=0;u<16;++u)f[u]=i[l++];for(var p=this.nextMatrix,u=0;u<16;++u)p[u]=i[l++],h=h&&f[u]===p[u];if(c<1e-6||h)for(var u=0;u<16;++u)n[u]=f[u];else o(n,f,p,(t-e[r])/c)}var g=this.computedUp;g[0]=n[1],g[1]=n[5],g[2]=n[6],d(g,g);var v=this.computedInverse;s(v,n);var m=this.computedEye,y=v[15];m[0]=v[12]/y,m[1]=v[13]/y,m[2]=v[14]/y;for(var b=this.computedCenter,x=Math.exp(this.computedRadius[0]),u=0;u<3;++u)b[u]=m[u]-n[2+4*u]*x}},g.idle=function(t){if(!(t1&&i(t[o[c-2]],t[o[c-1]],u)<=0;)c-=1,o.pop();for(o.push(l),c=s.length;c>1&&i(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(l)}for(var r=new Array(s.length+o.length-2),f=0,n=0,h=o.length;n0;--d)r[f++]=s[d];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":220}],178:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==g.alt,g.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==g.shift,g.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==g.control,g.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==g.meta,g.meta=!!t.metaKey),e}function n(t,n){var a=i.x(n),o=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==h||a!==d||o!==p||r(n))&&(h=0|t,d=a||0,p=o||0,e&&e(h,d,p,g))}function a(t){n(0,t)}function o(){(h||d||p||g.shift||g.alt||g.meta||g.control)&&(d=p=0,h=0,g.shift=g.alt=g.control=g.meta=!1,e&&e(0,0,0,g))}function s(t){r(t)&&e&&e(h,d,p,g)}function l(t){0===i.buttons(t)?n(0,t):n(h,t)}function u(t){n(h|i.buttons(t),t)}function c(t){n(h&~i.buttons(t),t)}function f(){v||(v=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",a),t.addEventListener("mouseenter",a),t.addEventListener("mouseout",a),t.addEventListener("mouseover",a),t.addEventListener("blur",o),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",o),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var h=0,d=0,p=0,g={shift:!1,alt:!1,control:!1,meta:!1},v=!1;f();var m={element:t};return Object.defineProperties(m,{enabled:{get:function(){return v},set:function(t){t&&f()},enumerable:!0},buttons:{get:function(){return h},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return g},enumerable:!0}}),m}e.exports=n;var i=t("mouse-event")},{"mouse-event":179}],179:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<=0;--e)S(e,0);for(var r=[],e=0;e0;_=_-1&g)x.push(w+"["+T+"+"+v(_)+"]");x.push(m(0));for(var _=0;_0){",h(x[t]),"=1;"),O(t-1,e|1<0&&G.push(s(U,x[V-1])+"*"+o(x[V-1])),F.push(d(U,x[V])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)X.push(o(x[U]));F.push(k+"=("+X.join("*")+")|0",A+"=mallocUint32("+k+")",w+"=mallocUint32("+k+")",T+"=0"),F.push(p(0)+"=0");for(var V=1;V<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 a=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return b(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",A="P",M="N",k="Q",T="X",E="T"},{"typedarray-pool":247}],182:[function(t,e,r){"use strict";var n=t("cwise/lib/wrapper")({args:["index","array","scalar"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{_inline_7_arg1_=_inline_7_arg2_.apply(void 0,_inline_7_arg0_)}",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}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":73}],183:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;r=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){o.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push("&&s[",l,"]>2");o.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push(",dst.pick(",s.join(),",",l,")",u);o.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",h.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>1){diff(",f,",src.pick(",h.join(),")",u,",src.pick(",d.join(),")",u,");}else{zero(",f,");};");break;case"mirror":0===r?o.push("dst.set(",s.join(),",",c,",0);"):o.push("zero(",f,");");break;case"wrap":var p=s.slice(),g=s.slice();e[l]<0?(p[c]="s["+c+"]-2",g[c]="0"):(p[c]="s["+c+"]-1",g[c]="1"),0===r?o.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>2){diff(",f,",src.pick(",p.join(),")",u,",src.pick(",g.join(),")",u,");}else{zero(",f,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&o.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var a=t.length,o=["function gradient(dst,src){var s=src.shape.slice();"],s=0;s<1<>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=a({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]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,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=o({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=o({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=o({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=a({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=a({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=o({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":70}],187:[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":188,ndarray:192}],188:[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":70}],189:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;r1){for(var f=[],h=1;h1){o.push("dptr=0;sptr=ptr");for(var h=t.length-1;h>=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"left){","dptr=0","sptr=cptr-s0");for(var h=1;hb){break __l}"].join(""));for(var h=t.length-1;h>=1;--h)o.push("sptr+=e"+h,"dptr+=f"+h,"}");o.push("dptr=cptr;sptr=cptr-s0");for(var h=t.length-1;h>=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"=0;--h){var d=t[h];0!==d&&o.push(["for(i",d,"=0;i",d,"left)&&("+r("cptr-s0")+">scratch)){",a("cptr",r("cptr-s0")),"cptr-=s0","}",a("cptr","scratch"));if(o.push("}"),t.length>1&&u&&o.push("free(scratch)"),o.push("} return "+s),u){var p=new Function("malloc","free",o.join("\n"));return p(u[0],u[1])}var p=new Function(o.join("\n"));return p()}function o(t,e,r){function a(t){return["(offset+",t,"*s0)"].join("")}function o(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+a(e[0]));else for(var i=0;i=0;--i){var o=t[i];0!==o&&_.push(["for(i",o,"=0;i",o,"1)for(var i=0;i1?_.push("ptr_shift+=d"+o):_.push("ptr0+=d"+o),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+a(r[0]));else{for(var o=0;o1)for(var o=0;o=1;--o)n&&_.push("pivot_ptr+=f"+o),r.length>1?_.push("ptr_shift+=e"+o):_.push("ptr0+=e"+o),_.push("}")}function f(){t.length>1&&M&&_.push("free(pivot1)","free(pivot2)")}function h(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++k;c(s,[n,i],!1,["comp=",o("ptr0"),"-",o("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",o(a(n)),">",o(a(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?l([e,r],!1,s("ptr0",o("ptr1"))):_.push(s(a(e),o(a(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++k;c(i,[r],!0,[e,"=",o("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",o(a(r)),"-pivot",n].join(""))}function g(e,r){t.length>1?l([e,r],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join(""))}function v(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","ptr2=",a(n),"\n","++",r,"\n","--",n,"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join(""))}function m(t,e){g(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",o("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(a(e),o(a(r))),s(a(r),"pivot"+n))}function b(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function x(e,r,n){t.length>1?(_.push(["__l",++k,":while(true){"].join("")),l([e],!0,["if(",o("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",k,"}"].join("")),_.push(n,"}")):_.push(["while(",o(a(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),A=["left","right","data","offset"].concat(i(t.length)),M=n(e),k=0;_.push(["function ",w,"(",A.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],L=1;L1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",o("ptr1"),"\n","pivot2[pivot_ptr]=",o("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",o("ptr0"),"\n","y=",o("ptr2"),"\n","z=",o("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",o(a("el2")),"\n","pivot2=",o(a("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",o(a("el1")),"\n","y=",o(a("el3")),"\n","z=",o(a("el5")),"\n",s(a("index1"),"x"),"\n",s(a("index3"),"y"),"\n",s(a("index5"),"z")].join("")),d("index2","left"),d("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),p("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),p("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),v("k","less","great"),_.push("break"),_.push("}else{"),m("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp>0){"),_.push("if(--greatindex5){"),x("less",1,"++less"),x("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp===0){"),_.push("if(--great1&&M){var S=new Function("insertionSort","malloc","free",_.join("\n"));return S(r,M[0],M[1])}var S=new Function("insertionSort",_.join("\n"));return S(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c0?l.push(["d",v,"=s",v,"-d",p,"*n",p].join("")):l.push(["d",v,"=s",v].join("")),p=v);var d=t.length-1-c;0!==d&&(g>0?l.push(["e",d,"=s",d,"-e",g,"*n",g,",f",d,"=",f[d],"-f",g,"*n",g].join("")):l.push(["e",d,"=s",d,",f",d,"=",f[d]].join("")),g=d)}r.push("var "+l.join(","));var m=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",m.join(","),")}else{","quickSort(",m.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),b=a(t,e),x=o(t,e,b);return y(b,x)}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":247}],190:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],o=n.join(":"),s=a[o];return s||(a[o]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),a={};e.exports=n},{"./lib/compile_sort.js":189}],191:[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_33_arg4_)}",args:[{name:"_inline_33_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_33_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_34_arg2_(this_warped,_inline_34_arg0_),_inline_34_arg1_=_inline_34_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_34_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_34_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_34_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_34_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_34_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_37_arg2_(this_warped,_inline_37_arg0_),_inline_37_arg1_=_inline_37_arg3_(_inline_37_arg4_,this_warped[0])}",args:[{name:"_inline_37_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_37_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_37_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_37_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_37_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_40_arg2_(this_warped,_inline_40_arg0_),_inline_40_arg1_=_inline_40_arg3_(_inline_40_arg4_,this_warped[0],this_warped[1])}",args:[{name:"_inline_40_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_40_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_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_43_arg2_(this_warped,_inline_43_arg0_),_inline_43_arg1_=_inline_43_arg3_(_inline_43_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_43_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_43_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_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":73,"ndarray-linear-interpolate":185}],192:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;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("+u.join(",")+",v){"),n?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var v=0;v=0){d=i"+v+"|0;b+=c"+v+"*d;a"+v+"-=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var v=0;v=0){c=(c+this.stride["+v+"]*i"+v+")|0}else{a.push(this.shape["+v+"]);b.push(this.stride["+v+"])}");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,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",a.join("\n"));return o(f[t],i)}function o(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=f.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),a=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":76}],194:[function(t,e,r){var n=1e-6,i=1e-6;r.vertexNormals=function(t,e,r){for(var i=e.length,a=new Array(i),o=void 0===r?n:r,s=0;so)for(var _=a[c],w=1/Math.sqrt(m*b),x=0;x<3;++x){var A=(x+1)%3,M=(x+2)%3;_[x]+=w*(y[A]*v[M]-y[M]*v[A])}}for(var s=0;so)for(var w=1/Math.sqrt(k),x=0;x<3;++x)_[x]*=w;else for(var x=0;x<3;++x)_[x]=0}return a},r.faceNormals=function(t,e,r){for(var n=t.length,a=new Array(n),o=void 0===r?i:r,s=0;so?1/Math.sqrt(p):0;for(var c=0;c<3;++c)d[c]*=p;a[s]=d}return a}},{}],195:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u){var c=e+a+u;if(f>0){var f=Math.sqrt(c+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,u),f=Math.sqrt(2*h-c+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}e.exports=n},{}],196:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function a(t,e){var r=e[0],n=e[1],a=e[2],o=e[3],s=i(r,n,a,o);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=a/s,t[3]=o/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function o(t,e,r){this.radius=l([r]),this.center=l(e),this.rotation=l(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),r=[].slice.call(r,0,4),a(r,r);var i=new o(r,e,Math.log(n));return i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up),i}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/lookAt"),c=t("gl-mat4/fromQuat"),f=t("gl-mat4/invert"),h=t("./lib/quatFromFrame"),d=o.prototype;d.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},d.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;a(e,e);var r=this.computedMatrix;c(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 u=0,f=0;f<3;++f)u+=r[l+4*f]*i[f];r[12+l]=-u}},d.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},d.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},d.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},d.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=a[1],s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],f=a[4],h=a[8],d=c*o+f*s+h*l;c-=o*d,f-=s*d,h-=l*d;var p=n(c,f,h);c/=p,f/=p,h/=p;var g=a[2],v=a[6],m=a[10],y=g*o+v*s+m*l,b=g*c+v*f+m*h;g-=y*o+b*c,v-=y*s+b*f,m-=y*l+b*h;var x=n(g,v,m);g/=x,v/=x,m/=x;var _=c*e+o*r,w=f*e+s*r,A=h*e+l*r;this.center.move(t,_,w,A);var M=Math.exp(this.computedRadius[0]);M=Math.max(1e-4,M+i),this.radius.set(t,Math.log(M))},d.rotate=function(t,e,r,a){this.recalcMatrix(t),e=e||0,r=r||0;var o=this.computedMatrix,s=o[0],l=o[4],u=o[8],c=o[1],f=o[5],h=o[9],d=o[2],p=o[6],g=o[10],v=e*s+r*c,m=e*l+r*f,y=e*u+r*h,b=-(p*y-g*m),x=-(g*v-d*y),_=-(d*m-p*v),w=Math.sqrt(Math.max(0,1-Math.pow(b,2)-Math.pow(x,2)-Math.pow(_,2))),A=i(b,x,_,w);A>1e-6?(b/=A,x/=A,_/=A,w/=A):(b=x=_=0,w=1);var M=this.computedRotation,k=M[0],T=M[1],E=M[2],L=M[3],S=k*w+L*b+T*_-E*x,C=T*w+L*x+E*b-k*_,P=E*w+L*_+k*x-T*b,R=L*w-k*b-T*x-E*_;if(a){b=d,x=p,_=g;var N=Math.sin(a)/n(b,x,_);b*=N,x*=N,_*=N,w=Math.cos(e),S=S*w+R*b+C*_-P*x,C=C*w+R*x+P*b-S*_,P=P*w+R*_+S*x-C*b,R=R*w-S*b-C*x-P*_}var O=i(S,C,P,R);O>1e-6?(S/=O,C/=O,P/=O,R/=O):(S=C=P=0,R=1),this.rotation.set(t,S,C,P,R)},d.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var i=this.computedMatrix;u(i,e,r,n);var o=this.computedRotation;h(o,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),a(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var s=0,l=0;l<3;++l)s+=Math.pow(r[l]-e[l],2);this.radius.set(t,.5*Math.log(Math.max(s,1e-6))),this.center.set(t,r[0],r[1],r[2])},d.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},d.setMatrix=function(t,e){var r=this.computedRotation;h(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),a(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;f(n,e);var i=n[15];if(Math.abs(i)>1e-6){var o=n[12]/i,s=n[13]/i,l=n[14]/i;this.recalcMatrix(t);var u=Math.exp(this.computedRadius[0]);this.center.set(t,o-n[2]*u,s-n[6]*u,l-n[10]*u),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},d.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},d.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},d.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},d.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":195,"filtered-vector":83,"gl-mat4/fromQuat":109,"gl-mat4/invert":112,"gl-mat4/lookAt":113}],197:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r="undefined"!=typeof r?r+"":" ",n(r,e)+t}},{"repeat-string":213}],198:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],199:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return a.freeUint32(l),a.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,a,o=1;for(r[0]=0,a=1;a0;--a)n=e/o|0,e=e-n*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}var a=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":168,"typedarray-pool":247}],201:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,s,l,c=0;c<2;++c)if(u[c][n].length>0){o=u[c][n][0],l=c;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=u[f][n],d=0;d0&&(o=p,s=g,l=f)}return a?s:(o&&r(o,l),s)}function a(t,a){var o=u[a][t][0],s=[t];r(o,a);for(var l=o[1^a];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],f=t,h=s[1],d=n(c,f,!0);if(i(e[c],e[f],e[h],e[d])<0)break;s.push(t),l=n(c,f)}return s}function o(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;c0;){var g=(u[0][c].length,a(c,d));o(p,g)?p.push.apply(p,g):(p.length>0&&h.push(p),p=g)}p.length>0&&h.push(p)}return h}e.exports=n;var i=t("compare-angle")},{"compare-angle":62}],202:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function a(t){for(var e=t.length,r=0;r0;){var U=F.pop(),V=R[U];f(V,function(t,e){return t-e});var H,q=V.length,G=B[U];if(0===G){var T=m[U];H=[T]}for(var v=0;v=0)&&(B[X]=1^G,F.push(X),0===G)){var T=m[X];a(T)||(T.reverse(),H.push(T))}}0===G&&d.push(H)}return d}e.exports=a;var o=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),f=t("uniq"),h=t("./lib/trim-leaves")},{"./lib/trim-leaves":202,"edges-to-adjacency-list":78,"planar-dual":201,"point-in-big-polygon":204,"robust-sum":225,"two-product":245,uniq:249}],204:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return!!i&&!!i.queryPoint(r,n)}}function a(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var o=i.key,s=f(r,o[0],o[1]);if(o[0][0]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))return 0;a=1,i=i.right}}return a}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;i=u?(x=1,y=u+2*h+p):(x=-h/u,y=h*x+p)):(x=0,d>=0?(_=0,y=p):-d>=f?(_=1,y=f+2*d+p):(_=-d/f,y=d*_+p));else if(_<0)_=0,h>=0?(x=0,y=p):-h>=u?(x=1,y=u+2*h+p):(x=-h/u,y=h*x+p);else{var w=1/b;x*=w,_*=w,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p}else{var A,M,k,T;x<0?(A=c+h,M=f+d,M>A?(k=M-A,T=u-2*c+f,k>=T?(x=1,_=0,y=u+2*h+p):(x=k/T,_=1-x,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)):(x=0,M<=0?(_=1,y=f+2*d+p):d>=0?(_=0,y=p):(_=-d/f,y=d*_+p))):_<0?(A=c+d,M=u+h,M>A?(k=M-A,T=u-2*c+f,k>=T?(_=1,x=0,y=f+2*d+p):(_=k/T,x=1-_,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)):(_=0,M<=0?(x=1,y=u+2*h+p):h>=0?(x=0,y=p):(x=-h/u,y=h*x+p))):(k=f+d-c-h,k<=0?(x=0,_=1,y=f+2*d+p):(T=u-2*c+f,k>=T?(x=1,_=0,y=u+2*h+p):(x=k/T,_=1-x,y=x*(u*x+c*_+2*h)+_*(c*x+f*_+2*d)+p)))}for(var E=1-x-_,l=0;l1)for(var r=1;r0){var u=t[r-1];if(0===i(s,u)&&o(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}var i=t("compare-cell"),a=t("compare-oriented-cell"),o=t("cell-orientation");e.exports=n},{"cell-orientation":54,"compare-cell":63,"compare-oriented-cell":64}],213:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("expected a string");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;if(i!==t||"undefined"==typeof i)i=t,a="";else if(a.length>=r)return a.substr(0,r);for(;r>a.length&&e>1;)1&e&&(a+=t),e>>=1,t+=t;return a+=t,a=a.substr(0,r)}var i,a="";e.exports=n},{}],214:[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:{})},{}],215:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var a=r,o=t[i];r=a+o;var s=r-a,l=o-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;i>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;r>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r0&&r.push(","),r.push("[");for(var a=0;a0&&r.push(","),a===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",a,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var o=new Function("det",r.join(""));return o(t<6?s[t]:s)}function i(){return[0]}function a(t,e){return[[e[0]],[t[0][0]]]}function o(){for(;u.length>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;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=m*n;return o>=s||o<=-s?o:b(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],u=r[1]-n[1],c=t[2]-n[2],f=e[2]-n[2],h=r[2]-n[2],d=a*u,p=o*l,g=o*s,v=i*u,m=i*l,b=a*s,_=c*(d-p)+f*(g-v)+h*(m-b),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(m)+Math.abs(b))*Math.abs(h),A=y*w;return _>A||-_>A?_:x(t,e,r,n)}];c()},{"robust-scale":222,"robust-subtract":224,"robust-sum":225,"two-product":245}],221:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return a(e,t[0]);if(1===e.length)return a(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.length0&&s>0||o<0&&s<0)return!1;var l=a(r,t,e),u=a(i,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,i))}e.exports=i;var a=t("robust-orientation")[3]},{"robust-orientation":220}],224:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],v=h(g);p=i?(a=d,c+=1,c=i?(a=d,c+=1,c0?1:0}},{}],227:[function(t,e,r){"use strict";function n(t){return a(i(t))}e.exports=n;var i=t("boundary-cells"),a=t("reduce-simplicial-complex")},{"boundary-cells":37,"reduce-simplicial-complex":212}],228:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;n0&&u.push(","),u.push("[");for(var n=0;n0&&u.push(","),u.push("B(C,E,c[",i[0],"],c[",i[1],"])")}u.push("]")}u.push(");")}}var r=0,n=new Array(t+1);n[0]=[[]];for(var i=1;i<=t;++i)for(var s=n[i]=o(i),l=0;l>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--i){i>1,s=o(t[a],e);s<=0?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function f(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[g],a))break}return r}function h(t,e){if(!e)return f(u(p(t,0)),t,0);for(var r=new Array(e),n=0;n>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){var n=s(r);if(e0){var t=k[0];return a(0,L-1),L-=1,u(0),t}return-1}function h(t,e){var r=k[t];return b[r]===e?t:(b[r]=-(1/0),c(t),f(),b[r]=e,L+=1,c(L-1))}function d(t){if(!x[t]){x[t]=!0;var e=m[t],r=y[t];m[r]>=0&&(m[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&h(T[e],i(e)),T[r]>=0&&h(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||i<0||i===n)break;if(n=i,i=t[n],!x[n]||i<0||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var g=e.length,v=t.length,m=new Array(g),y=new Array(g),b=new Array(g),x=new Array(g),_=0;_>1;_>=0;--_)u(_);for(;;){var S=f();if(S<0||b[S]>r)break;d(S)}for(var C=[],_=0;_=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&P.push([n,i])}}),o.unique(o.normalize(P)),{positions:C,edges:P}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":220,"simplicial-complex":232}],235:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return ol?i-l:o-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=a(r,i,s),u=a(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;if(l=a(s,o,i),u=a(s,o,r),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]}e.exports=i;var a=t("robust-orientation")},{"robust-orientation":220}],236:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=a(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=a(t.right,e);if(l)return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;a0){var s=a(this.slabs[e-1],t);s&&(o?h(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(o){var p=f(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":235, +"binary-search-bounds":34,"functional-red-black-tree":84,"robust-orientation":220}],237:[function(t,e,r){"use strict";function n(t,e){var r=u(l(t,e),[e[e.length-1]]);return r[r.length-1]}function i(t,e,r,n){var i=n-e,a=-e/i;a<0?a=0:a>1&&(a=1);for(var o=1-a,s=t.length,l=new Array(s),u=0;u0||o>0&&c<0){var f=i(s,c,l,o);r.push(f),a.push(f.slice())}c<0?a.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),a.push(l.slice())),o=c}return{positive:r,negative:a}}function o(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u>=0&&r.push(s.slice()),a=u}return r}function s(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u<=0&&r.push(s.slice()),a=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=a,e.exports.positive=o,e.exports.negative=s},{"robust-dot-product":217,"robust-sum":225}],238:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function a(t,e){return Array(e+1).join(t)}var o={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,f,h,d=1,p=t.length,g="",v=[],m=!0,y="";for(s=0;s=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?v[v.length]=n:(!o.number.test(u[8])||m&&!u[3]?y="":(y=m?"+":"-",n=n.toString().replace(o.sign,"")),f=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",h=u[6]-(y+n).length,c=u[6]&&h>0?a(f,h):"",v[v.length]=u[5]?y+n+c:"0"===f?y+c+n:c+y+n)}return v.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],239:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],240:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128===0){f.length>0&&h.push("}}");var d="vExtra"+f.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(k="+"+v[x]+"*c");var T=.5*(p[x].length/y),E=.5+.5*(m[x]/y);M.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+k+")/("+g[x].join("+")+")")}h.push("a.push([",M.join(),"]);","break;")}n.push("}},"),f.length>0&&h.push("}}");for(var L=[],u=0;u<1<.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=L(t,360),e=L(e,100),r=L(r,100),0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,i,a=G(t,e,r),o=q(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function k(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){P(t)&&(t="100%");var n=R(t);return t=q(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function S(t){return q(1,G(0,t))}function C(t){return parseInt(t,16)}function P(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function R(t){return"string"==typeof t&&t.indexOf("%")!=-1}function N(t){return 1==t.length?"0"+t:""+t}function O(t){return t<=1&&(t=100*t+"%"),t}function I(t){return e.round(255*parseFloat(t)).toString(16)}function z(t){return C(t)/255}function j(t){return!!Z.CSS_UNIT.exec(t)}function D(t){t=t.replace(B,"").replace(U,"").toLowerCase();var e=!1;if(W[t])t=W[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Z.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),a:z(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),a:z(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.hex3.exec(t))&&{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),format:e?"name":"hex"}}function F(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var B=/^\s+/,U=/\s+$/,V=0,H=e.round,q=e.min,G=e.max,X=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=E(t),this._roundA=H(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=H(360*t.h),r=H(100*t.s),n=H(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=H(360*t.h),r=H(100*t.s),n=H(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:H(this._r),g:H(this._g),b:H(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+H(this._r)+", "+H(this._g)+", "+H(this._b)+")":"rgba("+H(this._r)+", "+H(this._g)+", "+H(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:H(100*L(this._r,255))+"%",g:H(100*L(this._g,255))+"%",b:H(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+H(100*L(this._r,255))+"%, "+H(100*L(this._g,255))+"%, "+H(100*L(this._b,255))+"%)":"rgba("+H(100*L(this._r,255))+"%, "+H(100*L(this._g,255))+"%, "+H(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,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(M,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=O(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return n(s)},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=F(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},n.mostReadable=function(t,e,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var W=n.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=n.hexNames=T(W),Z=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],242:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":198}],243:[function(t,e,r){"use strict";function n(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(o(t+1)),r=[],n=0;nMath.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var a=0,o=0,s=0;s<3;++s)a+=t[s]*t[s],o+=i[s]*t[s];for(var s=0;s<3;++s)i[s]-=o/a*t[s];return h(i,i),i}function o(t,e,r,n,i,a,o,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([a]),this.angle=l([o,s]),this.angle.bounds=[[-(1/0),-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;u<16;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.up||[0,1,0],i=t.right||a(r),s=t.radius||1,l=t.theta||0,u=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),h(r,r),i=[].slice.call(i,0,3),h(i,i),"eye"in t){var c=t.eye,p=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];f(i,p,r),n(i[0],i[1],i[2])<1e-6?i=a(r):h(i,i),s=n(p[0],p[1],p[2]);var g=d(r,p)/s,v=d(i,p)/s;u=Math.acos(g),l=Math.acos(v)}return s=Math.log(s),new o(t.zoomMin,t.zoomMax,e,r,i,s,l,u)}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),f=t("gl-vec3/cross"),h=t("gl-vec3/normalize"),d=t("gl-vec3/dot"),p=o.prototype;p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,i=0,a=0,o=0;o<3;++o)a+=e[o]*r[o],i+=e[o]*e[o];for(var s=Math.sqrt(i),l=0,o=0;o<3;++o)r[o]-=e[o]*a/i,l+=r[o]*r[o],e[o]/=s;for(var u=Math.sqrt(l),o=0;o<3;++o)r[o]/=u;var c=this.computedToward;f(c,e,r),h(c,c);for(var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],g=this.computedAngle[1],v=Math.cos(p),m=Math.sin(p),y=Math.cos(g),b=Math.sin(g),x=this.computedCenter,_=v*y,w=m*y,A=b,M=-v*b,k=-m*b,T=y,E=this.computedEye,L=this.computedMatrix,o=0;o<3;++o){var S=_*r[o]+w*c[o]+A*e[o];L[4*o+1]=M*r[o]+k*c[o]+T*e[o],L[4*o+2]=S,L[4*o+3]=0}var C=L[1],P=L[5],R=L[9],N=L[2],O=L[6],I=L[10],z=P*I-R*O,j=R*N-C*I,D=C*O-P*N,F=n(z,j,D);z/=F,j/=F,D/=F,L[0]=z,L[4]=j,L[8]=D;for(var o=0;o<3;++o)E[o]=x[o]+L[2+4*o]*d;for(var o=0;o<3;++o){for(var l=0,B=0;B<3;++B)l+=L[o+4*B]*E[B];L[12+o]=-l}L[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 g=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;g[0]=i[2],g[1]=i[6],g[2]=i[10];for(var a=this.computedUp,o=this.computedRight,s=this.computedToward,l=0;l<3;++l)i[4*l]=a[l],i[4*l+1]=o[l],i[4*l+2]=s[l];c(i,i,n,g);for(var l=0;l<3;++l)a[l]=i[4*l],o[l]=i[4*l+1];this.up.set(t,a[0],a[1],a[2]),this.right.set(t,o[0],o[1],o[2])}},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=(Math.exp(this.computedRadius[0]),a[1]),s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],f=a[4],h=a[8],d=c*o+f*s+h*l;c-=o*d,f-=s*d,h-=l*d;var p=n(c,f,h);c/=p,f/=p,h/=p;var g=c*e+o*r,v=f*e+s*r,m=h*e+l*r;this.center.move(t,g,v,m);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e,r,a){var o=1;"number"==typeof r&&(o=0|r),(o<0||o>3)&&(o=1);var s=(o+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[o],c=e[o+4],f=e[o+8];if(a){var h=Math.abs(l),d=Math.abs(c),p=Math.abs(f),g=Math.max(h,d,p);h===g?(l=l<0?-1:1,c=f=0):p===g?(f=f<0?-1:1,l=c=0):(c=c<0?-1:1,l=f=0)}else{var v=n(l,c,f);l/=v,c/=v,f/=v}var m=e[s],y=e[s+4],b=e[s+8],x=m*l+y*c+b*f;m-=l*x,y-=c*x,b-=f*x;var _=n(m,y,b);m/=_,y/=_,b/=_;var w=c*b-f*y,A=f*m-l*b,M=l*y-c*m,k=n(w,A,M);w/=k,A/=k,M/=k,this.center.jump(t,q,G,X),this.radius.idle(t),this.up.jump(t,l,c,f),this.right.jump(t,m,y,b);var T,E;if(2===o){var L=e[1],S=e[5],C=e[9],P=L*m+S*y+C*b,R=L*w+S*A+C*M;T=z<0?-Math.PI/2:Math.PI/2,E=Math.atan2(R,P)}else{var N=e[2],O=e[6],I=e[10],z=N*l+O*c+I*f,j=N*m+O*y+I*b,D=N*w+O*A+I*M;T=Math.asin(i(z)),E=Math.atan2(D,j)}this.angle.jump(t,E,T),this.recalcMatrix(t);var F=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var H=V[15],q=V[12]/H,G=V[13]/H,X=V[14]/H,W=Math.exp(this.computedRadius[0]);this.center.jump(t,q-F*W,G-B*W,X-U*W)},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,a){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,a=a||this.computedUp;var o=a[0],s=a[1],l=a[2],u=n(o,s,l);if(!(u<1e-6)){o/=u,s/=u,l/=u;var c=e[0]-r[0],f=e[1]-r[1],h=e[2]-r[2],d=n(c,f,h);if(!(d<1e-6)){c/=d,f/=d,h/=d;var p=this.computedRight,g=p[0],v=p[1],m=p[2],y=o*g+s*v+l*m;g-=y*o,v-=y*s,m-=y*l;var b=n(g,v,m);if(!(b<.01&&(g=s*h-l*f,v=l*c-o*h,m=o*f-s*c,b=n(g,v,m),b<1e-6))){g/=b,v/=b,m/=b,this.up.set(t,o,s,l),this.right.set(t,g,v,m),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=s*m-l*v,_=l*g-o*m,w=o*v-s*g,A=n(x,_,w);x/=A,_/=A,w/=A;var M=o*c+s*f+l*h,k=g*c+v*f+m*h,T=x*c+_*f+w*h,E=Math.asin(i(M)),L=Math.atan2(T,k),S=this.angle._state,C=S[S.length-1],P=S[S.length-2];C%=2*Math.PI;var R=Math.abs(C+2*Math.PI-L),N=Math.abs(C-L),O=Math.abs(C-2*Math.PI-L);R0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function f(t){return new Int16Array(o(2*t),0,t)}function h(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return x?new Uint8ClampedArray(o(t),0,t):s(t)}function v(t){return new DataView(o(t),0,t)}function m(t){t=y.nextPow2(t);var e=y.log2(t),r=A[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,A=_.BUFFER;r.free=function(t){if(n.isBuffer(t))A[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){A[y.log2(t.length)].push(t)},r.malloc=function(t,e){ +if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return f(t);case"int32":return h(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return m(t);case"data":case"dataview":return v(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=f,r.mallocInt32=h,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=v,r.mallocBuffer=m,r.clearCache=function(){for(var t=0;t<32;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,A[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":35,buffer:45,dup:77}],248:[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;e8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function o(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),!(e<0)&&(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof x||a();var s=[],l=[],u=b++;return Object.create(x.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(o)}})};x.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||!!c&&c.has___(t)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof x||a();var l,u=new s,c=void 0,f=!1;return l=o?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new x),c.set(t,e)),this}:function(t,e){if(f)try{u.set(t,e)}catch(r){c||(c=new x),c.set___(t,e)}else u.set(t,e);return this},Object.create(x.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");f=!0})}})}o&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=x.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=x)}}()},{}],253:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":254}],254:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],255:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":253}],256:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":86}],257:[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":70}],258:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":257}],259:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("opacity"),u("align"),u("bgcolor");var f=u("bordercolor"),h=i.opacity(f);u("borderpad");var d=u("borderwidth"),p=u("showarrow");u("text",p?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font);for(var g=["x","y"],v=[-10,-30],m={_fullLayout:r},y=0;y<2;y++){var b=g[y],x=a.coerceRef(t,e,m,b,"","paper");if(a.coercePosition(e,m,u,x,b,.5),p){var _="a"+b,w=a.coerceRef(t,e,m,_,"pixel");"pixel"!==w&&w!==x&&(w=e[_]="pixel");var A="pixel"===w?v[y]:.4;a.coercePosition(e,m,u,w,_,A)}else u(b+"anchor")}return n.noneOrAll(t,e,["x","y"]),p&&(u("arrowcolor",h?e.bordercolor:i.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(h&&d||1)),n.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":364,"../../plots/cartesian/axes":393,"../color":268,"./attributes":261}],260:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],261:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":359,"../../plots/cartesian/constants":398,"../../plots/font_attributes":413,"./arrow_paths":260}],262:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,f=s-l,h=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),f=Math.max(f,d),h=Math.max(h,d)}r&&r.autorange&&a.expand(r,[r.l2c(r.r2l(e.x))],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(n.r2l(e.y))],{ppadplus:h,ppadminus:f})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":364,"../../plots/cartesian/axes":393,"./draw":264}],263:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),i=t("./annotation_defaults");e.exports=function(t,e){var r={name:"annotations",handleItemDefaults:i};n(t,e,r)}},{"../../plots/array_container_defaults":390,"./annotation_defaults":259}],264:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=$.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,m=Math.round(u+2*tt),y=Math.round(p+2*tt);q._w=u,q._h=p;var x=!1;if(["x","y"].forEach(function(e){var n,i=q[e+"ref"]||e,a=f.getFromId(t,i),o=(Y+("x"===e?0:90))*Math.PI/180,s=m*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=q[e+"anchor"];if(a){var u=a.r2fraction(q[e]);if(!a.autorange&&(u<0||u>1)&&(q["a"+e+"ref"]===i?(u=a.r2fraction(q["a"+e]),(u<0||u>1)&&(x=!0)):x=!0,x))return;W[e]=a._offset+a.r2p(q[e]),n=.5}else n=q[e],"y"===e&&(n=1-n),W[e]="x"===e?P.l+P.w*n:P.t+P.h*n;var c=0;q["a"+e+"ref"]===i?W["aa"+e]=a._offset+a.r2p(q["a"+e]):(c=q.showarrow?q["a"+e]:s*r(n,l),W[e]+=c),q["_"+e+"type"]=a&&a.type,q["_"+e+"size"]=s,q["_"+e+"shift"]=c}),x)return void $.remove();var _,w;q.showarrow&&(_=q.axref===q.xref?W.x:c.constrain(W.x-q.ax,1,M.width-1),w=q.ayref===q.yref?W.y:c.constrain(W.y-q.ay,1,M.height-1)),W.x=c.constrain(W.x,1,M.width-1),W.y=c.constrain(W.y,1,M.height-1);var A=tt-s.top,k=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:k,y:A}),nt.selectAll("tspan.line").attr({y:A,x:k})),et.call(d.setRect,K/2,K/2,m-K,y-K);var T=0,E=0;T=q.axref===q.xref?Math.round(W.aax-m/2):Math.round(W.x-m/2),E=q.ayref===q.yref?Math.round(W.aay-y/2):Math.round(W.y-y/2),$.call(c.setTranslate,T,E);var L="annotations["+e+"]",S=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=q.axref===q.xref?W.aax+r:W.x+r,s=q.ayref===q.yref?W.aay+n:W.y+n;var u=c.rotationXYMatrix(Y,i,s),f=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,m=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!m.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){m.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=q.arrowwidth,x=q.arrowcolor,A=Z.append("g").style({opacity:h.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=A.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(h.stroke,h.rgb(x));b(M,q.arrowhead,"end",q.arrowsize);var k=A.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,S;v.init({element:k.node(),prepFn:function(){var t=c.getTranslate($);E=t.x,S=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){A.attr("transform","translate("+t+","+e+")");var r=f(E,S),n=r[0]+t,i=r[1]+e;$.call(c.setTranslate,n,i),T[L+".x"]=G?G.p2r(G.r2p(q.x)+t):(_+t-P.l)/P.w,T[L+".y"]=X?X.p2r(X.r2p(q.y)+e):1-(w+e-P.t)/P.h,q.axref===q.xref&&(T[L+".ax"]=G?G.p2r(G.r2p(q.ax)+t):(_+t-P.l)/P.w),q.ayref===q.yref&&(T[L+".ay"]=X?X.p2r(X.r2p(q.ay)+e):1-(w+e-P.t)/P.h),Q.attr({transform:"rotate("+Y+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};q.showarrow&&S(0,0);var C=c.rotationXYMatrix(Y,W.x,W.y),R=c.apply2DTransform(C);if(t._context.editable){var N,O,I;v.init({element:$.node(),prepFn:function(){var t=c.getTranslate($);N=t.x,O=t.y,I={}},moveFn:function(t,e){$.call(c.setTranslate,N+t,O+e);var r="pointer";if(q.showarrow)q.axref===q.xref?I[L+".ax"]=G.p2r(G.r2p(q.ax)+t):I[L+".ax"]=q.ax+t,q.ayref===q.yref?I[L+".ay"]=X.p2r(X.r2p(q.ay)+e):I[L+".ay"]=q.ay+e,S(t,e);else{if(G)I[L+".x"]=q.x+t/G._m;else{var n=q._xsize/P.w,i=q.x+q._xshift/P.w-n/2;I[L+".x"]=v.align(i+t/P.w,n,0,1,q.xanchor)}if(X)I[L+".y"]=q.y+e/X._m;else{var a=q._ysize/P.h,o=q.y-q._yshift/P.h-a/2;I[L+".y"]=v.align(o-e/P.h,a,0,1,q.yanchor)}G&&X||(r=v.getCursor(G?.5:I[L+".x"],X?.5:I[L+".y"],q.xanchor,q.yanchor))}var s=R(N,O),l=s[0]+t,u=s[1]+e;$.call(c.setTranslate,N+t,O+e),Q.attr({transform:"rotate("+Y+","+l+","+u+")"}),g($,r)},doneFn:function(e){if(g($),e){l.relayout(t,I);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,A=t.layout,M=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return A.annotations=u,y(A,M),void n(t);if("remove"===u)return delete A.annotations,M.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)M._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}M._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=A.annotations[e],E=M.annotations[e];if(T){var L={};"string"==typeof r&&r?L[r]=u:c.isPlainObject(r)&&(L=r);var S=Object.keys(L);for(w=0;w4/3&&(j=V)}}else z&&(F&&(j<1/3?j+=U:j>2/3&&(j-=U)),j=(j-z.domain[0])/(z.domain[1]-z.domain[0]),j=z.fraction2r(j))}z&&z===I&&D&&("log"===D&&"log"!==z.type?j=Math.pow(10,j):"log"!==D&&"log"===z.type&&(j=j>0?Math.log(j)/Math.LN10:void 0)),T[O]=j}}var q={};m(T,q,M),M.annotations[e]=q;var G=f.getFromId(t,q.xref),X=f.getFromId(t,q.yref),W={x:0,y:0},Y=+q.textangle||0,Z=M._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",q.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:q})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),K=q.borderwidth,J=q.borderpad,tt=K+J,et=$.append("rect").attr("class","bg").style("stroke-width",K+"px").call(h.stroke,q.bordercolor).call(h.fill,q.bgcolor),rt=q.font,nt=$.append("text").classed("annotation",!0).attr("data-unformatted",q.text).text(q.text);t._context.editable?nt.call(p.makeEditable,$).call(x).on("edit",function(r){q.text=r,this.attr({"data-unformatted":q.text}),this.call(x);var n={};n["annotations["+e+"].text"]=q.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(x),Q.attr({transform:"rotate("+Y+","+W.x+","+W.y+")"}).call(d.setPosition,W.x,W.y)}}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,f=n-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var g=(u*d-c*h)/p,v=(u*f-l*h)/p;return v<0||v>1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./annotation_defaults"),y=t("./defaults"),b=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":364,"../../lib/setcursor":374,"../../lib/svg_text_utils":378,"../../plotly":388,"../../plots/cartesian/axes":393,"../../plots/plots":430,"../color":268,"../dragelement":289,"../drawing":291,"./annotation_defaults":259,"./defaults":263,"./draw_arrow_head":265,d3:74,"fast-isnumeric":82}],265:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var f,h,d,p,g=(o.getPx(t,"stroke-width")||1)*l,v=t.style("stroke")||a.defaultLine,m=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=c.backoff*g;if("line"===u.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},h={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(f.y-h.y,f.x-h.x),p=d+Math.PI,x){var _=x*Math.cos(d),w=x*Math.sin(d);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),b&&(h.x+=_,h.y+=w,t.attr({x2:h.x,y2:h.y}))}}else if("path"===u.nodeName){var A=u.getTotalLength(),M="";if(y){var k=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(k.y-T.y,k.x-T.x),f=u.getPointAtLength(Math.min(x,A)),x&&(M="0px,"+x+"px,")}if(b){var E=u.getPointAtLength(A),L=u.getPointAtLength(A-.1);if(p=Math.atan2(E.y-L.y,E.x-L.x),h=u.getPointAtLength(Math.max(0,A-x)),x){var S=M?2*x:x;M+=A-S+"px,"+A+"px"}}else M&&(M+=A+"px");M&&t.style("stroke-dasharray",M)}var C=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:v,opacity:m,"stroke-width":0})};y&&C(f,d),b&&C(h,p)}}},{"../color":268,"../drawing":291,"./arrow_paths":260,d3:74,"fast-isnumeric":82}],266:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":261,"./calc_autorange":262,"./defaults":263,"./draw":264}],267:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],268:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(C);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?L[0]:(C[e]+C[e-1])/2,e===C.length-1?L[1]:(C[e]+C[e+1])/2].map(J.c2p).map(Math.round);e!==C.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=R(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({ +x:W,width:Math.max(B,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var h=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){n.select(this).attr("d","M"+W+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+B).call(d.lineGroupStyle,_.line.width,P(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=W+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));A("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:k.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,i=x();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(a,r||{}))}function M(){var r=B+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(j=ot.select("text"),j.node()&&!j.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-W-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-$;at.select(".cbbg").attr({x:W-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:W,y:$+_.ypad+("top"===_.titleside?st:0),width:Math.max(B,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var k=t._fullLayout,T=k._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void k._infolayer.selectAll("g."+e).remove();var E,L=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],C=[],P="function"==typeof _.line.color?_.line.color:function(){return _.line.color},R="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},N=_.levels.end+_.levels.size/100,O=_.levels.size,I=1.001*L[0]-.001*L[1],z=1.001*L[1]-.001*L[0];for(E=_.levels.start;(E-N)*O<0;E+=O)E>I&&EL[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+H-X],J.setScale();var at=k._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+q)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+H-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,A(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ft=c.syncOrAsync([o.previousPromises,w,o.previousPromises,M],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var ht,dt,pt;u.init({element:at.node(),prepFn:function(){ht=at.attr("transform"),h(at)},moveFn:function(t,e){at.attr("transform",ht+" translate("+t+","+e+")"),dt=u.align(Y+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,H,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);h(at,r)},doneFn:function(e){h(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},x().index)}})}return ft}function x(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":364,"./flip_scale":279,"./scales":286}],275:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":359,"./attributes":273,"./scales.js":286}],276:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":286}],277:[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,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,g=f?i.nestedProperty(e,d).get()||{}:e,v=p[h+"min"],m=p[h+"max"],y=p.colorscale,b=n(v)&&n(m)&&v=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],280:[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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):e}},{"./default_scale":276,"./is_valid_scale_array":284,"./scales":286}],281:[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(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],288:[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":364}],289:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,g=o.getPlotDiv(t.element)||{},v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":364,"../../plotly":388,"../../plots/cartesian/constants":398,"./align":287,"./cursor":288,"./unhover":290}],290:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":358}],291:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,f,h;t.so?(h=o.outlierwidth,f=o.outliercolor,c=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(h||1)+"px",fill:"none"}):(e.style("stroke-width",h+"px").call(l.fill,c),h&&e.call(l.stroke,f))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),f=(c*c*i-u*u*s)*n,h=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&f/d),2),a.round(e[1]+(d&&h/d),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&h/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var v=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=g.tryColorscale(i,""),s=g.tryColorscale(i,"line");n(t,e,r,o,s,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),i=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,a.select(this),e,n,i)})}},g.tryColorscale=function(t,e){var r=e?c.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):c.identity};var b={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(f.convertToTspans);var h=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*x+1,v=b[l]*c,m=.75*u+b[s]*c+(b[s]-1)*p*u/2;h.attr("transform","translate("+v+","+m+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=k&&(a.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":352,"../../lib":364,"../../lib/svg_text_utils":378,"../../registry":438,"../../traces/scatter/make_bubble_size_func":469,"../../traces/scatter/subtypes":474,"../color":268,"../colorscale":282,"./symbol_defs":292,d3:74,"fast-isnumeric":82}],292:[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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2); +return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:74}],293:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],294:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),f=0;f0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);c&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;f="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");s=!v.size(),s?v=e.append("path").classed("yerror",!0):c&&(v=v.transition().duration(r.duration).ease(r.easing)),v.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var m=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-m)+"v"+2*m+"m0,-"+m+"H"+o.xs,o.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":474,d3:74,"fast-isnumeric":82}],299:[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":268,d3:74}],300:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":398}],301:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}var o=n("source"),l=n("visible",!!o);if(!l)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var u={_fullLayout:r},c=["x","y"],f=0;f<2;f++)a.coerceRef(t,e,u,c[f],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var r={name:l,handleItemDefaults:n};o(t,e,r)}},{"../../lib":364,"../../plots/array_container_defaults":390,"../../plots/cartesian/axes":393,"./attributes":300}],302:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,f=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,h=c*d.x[e.xanchor].offset,p=f*d.y[e.yanchor].offset,g=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,v=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+h,m=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:v,y:m,width:c,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=o?o._id:"",b=l?l._id:"",x=y+b;x&&r.call(i.setClipUrl,"clip"+s._uid+x)}for(var s=t._fullLayout,l=[],u=[],c=[],f=0;f=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}},{}],305:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":359,"../../plots/font_attributes":413,"../color/attributes":267}],306:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],307:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(b!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",v),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":364,"../../plots/layout_attributes":428,"../../registry":438,"./attributes":305,"./helpers":310}],308:[function(t,e,r){"use strict";function n(t,e){function r(r){m.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?f.call(m.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=r.indexOf(f);h===-1?r.push(f):r.splice(h,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;r=s*h,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cn.width-(n.margin.r+n.margin.l)&&(b=0,v+=m,i.height=i.height+m,m=0),f.setTranslate(this,a+b,5+a+e.height/2+v),i.width+=o+r,i.height=Math.max(i.height,e.height),b+=o+r,m=Math.max(e.height,m)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),b=t("./get_legend_data"),x=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(g.setRect,F,t,y.scrollBarWidth,y.scrollBarHeight),k.select("rect").attr({y:m.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var m=r.legend,_=r.showlegend&&b(t.calcdata,m),A=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var E=M.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=M.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=E.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var C=S.selectAll("g.traces").data(f.identity);C.enter().append("g").attr("class","traces"),C.exit().remove(),C.call(x).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?A.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var P=0!==M.enter().size();P&&(o(t,S,C),s(t));var R=0,N=r.width,O=0,I=r.height;o(t,S,C),m.height>I?l(t):s(t);var z=r._size,j=z.l+z.w*m.x,D=z.t+z.h*(1-m.y);w.isRightAnchor(m)?j-=m.width:w.isCenterAnchor(m)&&(j-=m.width/2),w.isBottomAnchor(m)?D-=m.height:w.isMiddleAnchor(m)&&(D-=m.height/2);var F=m.width,B=z.w;F>B?(j=z.l,F=B):(j+F>N&&(j=N-F),jV?(D=z.t,U=V):(D+U>I&&(D=I-U),Dr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":364,"../../registry":438,"../../traces/pie/style_one":452,"../../traces/scatter/subtypes":474,"../color":268,"../drawing":291,d3:74}],313:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(v,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",o.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":364,"../color":268,"./attributes":317,"./button_attributes":318,"./constants":319}],321:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},i=S.line.width?S.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",S.opacity).call(_.stroke,i).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);C&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+C),t._context.editable&&f(t,a,S,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:b.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>W&&!t.shiftKey?A.getCursor(i/r,1-a/n):"move";M(e,o),G=o.split("-")[0]}function a(e){F=x.getFromId(t,r.xref),B=x.getFromId(t,r.yref),U=T.getDataToPixel(t,F),V=T.getDataToPixel(t,B,!0),H=T.getPixelToData(t,F),q=T.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(j=r.path,D=a+".path"):(c=U(r.x0),f=V(r.y0),h=U(r.x1),d=V(r.y1),g=a+".x0",m=a+".y0",b=a+".x1",_=a+".y1"),cW&&(u[S]=r[N]=q(s),u[C]=r[O]=q(l)),f-c>X&&(u[P]=r[I]=H(c),u[R]=r[z]=H(f))}e.attr("d",p(t,r))}var u,c,f,h,d,g,m,b,_,w,k,E,L,S,C,P,R,N,O,I,z,j,D,F,B,U,V,H,q,G,X=10,W=10,Y={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=Y.element.getBoundingClientRect();A.init(Y)}function h(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):b.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=x.getFromId(t,r.id,"x")._id,i=x.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=x.getFromId(t,e.xref),l=x.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),f=n(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,v=(h+d)/2,m=Math.abs(p-c),y=Math.abs(v-h),b="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),b.log("Ignoring extra params in segment "+t)),i+l})}function v(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var m=t("fast-isnumeric"),y=t("../../plotly"),b=t("../../lib"),x=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),A=t("../dragelement"),M=t("../../lib/setcursor"),k=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),L=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":364,"../../lib/setcursor":374,"../../plotly":388,"../../plots/cartesian/axes":393,"../color":268,"../dragelement":289,"../drawing":291,"./constants":331,"./defaults":332,"./helpers":334,"./shape_defaults":336,"fast-isnumeric":82}],334:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e); +i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],335:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":329,"./calc_autorange":330,"./defaults":332,"./draw":333}],336:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var f=t.path?"path":"rect",h=u("type",f),d=["x","y"],p=0;p<2;p++){var g=d[p],v={_fullLayout:r},m=i.coerceRef(t,e,v,g,"","paper");if("path"!==h){var y,b,x,_=.25,w=.75;"paper"!==m?(y=i.getFromId(v,m),x=o.rangeToShapePosition(y),b=o.shapePositionToRange(y)):b=x=n.identity;var A=g+"0",M=g+"1",k=t[A],T=t[M];t[A]=b(t[A],!0),t[M]=b(t[M],!0),i.coercePosition(e,v,u,m,A,_),i.coercePosition(e,v,u,m,M,w),e[A]=x(e[A]),e[M]=x(e[M]),t[A]=k,t[M]=T}}return"path"===h?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":364,"../../plots/cartesian/axes":393,"./attributes":329,"./helpers":334}],337:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":359,"../../plots/animation_attributes":389,"../../plots/font_attributes":413,"../../plots/pad_attributes":429,"./constants":338}],338:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],339:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+S.railTouchRectClass).data([0]);n.enter().append("rect").classed(S.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,S.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),M.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+S.railRectClass).data([0]);r.enter().append("rect").classed(S.railRectClass,!0);var n=e.inputAreaLength-2*S.railInset;r.attr({width:n,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(r,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+S.groupClassName).data(r,i);l.enter().append("g").classed(S.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,L=!0,S=P,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,M=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,L=!1,S=g.title.trim();""===S&&(E=0),S.match(/Click to enter .+ title/)&&(E=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var P="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?a.restyle(t,v,e,m):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":364,"../../lib/svg_text_utils":378,"../../plotly":388,"../../plots/plots":430,"../color":268,"../drawing":291,d3:74,"fast-isnumeric":82}],343:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":359,"../../plots/font_attributes":413,"../../plots/pad_attributes":429,"../color/attributes":267}],344:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],345:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var f=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){b.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],352:[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}},{}],353:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":266,"./components/images":303,"./components/legend":311,"./components/rangeselector":323,"./components/rangeslider":328,"./components/shapes":335,"./components/sliders":341,"./components/updatemenus":347,"./fonts/mathjax_config":354,"./lib/queue":372,"./plot_api/plot_schema":382,"./plot_api/register":383,"./plot_api/set_plot_config":384,"./plot_api/to_image":386,"./plot_api/validate":387,"./plotly":388,"./snapshot":443,"./snapshot/download":440,"./traces/scatter":464,d3:74,"es6-promise":79}],354:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],355:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":350,"fast-isnumeric":82}],356:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r); +if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var v=(new Date).getFullYear();e=((Number(u[0])-v+70)%100+200)%100+v-70}if(!a(e))return l;var m=new Date(0,0,1);if(m.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(m.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(m.setDate(i),m.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(m.setHours(o),m.getHours()!==o)return l;if(u.length>1)return i=m.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=f*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return m.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,v=3*c,m=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":355,"./coerce":356,"./dates":357,"./extend":359,"./filter_unique":360,"./filter_visible":361,"./is_array":365,"./is_plain_object":366,"./loggers":367,"./matrix":368,"./nested_property":369,"./notifier":370,"./search":373,"./stats":376,d3:74}],365:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],366:[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}},{}],367:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,h(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;uMath.max(c,g)||l>Math.max(f,v)))if(lc||Math.abs(n(o,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":368}],372:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;f90&&l.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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":82}],377:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:15,tinycolor2:241}],378:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,v.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold" +},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":351,"../constants/xmlns_namespaces":352,"../lib":364,d3:74}],379:[function(t,e,r){"use strict";function n(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=f.cleanId(r,n))}function i(t){var e="middle",r="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?r="left":t.indexOf("right")!==-1&&(r="right"),e+" "+r}function a(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var o=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),l=t("../registry"),u=t("../lib"),c=t("../plots/plots"),f=t("../plots/cartesian/axes"),h=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.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);var i=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lP.range[0]?[1,2]:[2,1]);else{var R=P.range[0],N=P.range[1];"log"===x?(R<=0&&N<=0&&r(E+".autorange",!0),R<=0?R=N/1e6:N<=0&&(N=R/1e6),r(E+".range[0]",Math.log(R)/Math.LN10),r(E+".range[1]",Math.log(N)/Math.LN10)):(r(E+".range[0]",Math.pow(10,R)),r(E+".range[1]",Math.pow(10,N)))}else r(E+".autorange",!0)}if("reverse"===k)L.range?L.range.reverse():(r(E+".autorange",!0),L.range=[1,0]),S.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var O=m.parts[1],I=m.parts[0],z=a[I]||[],j=z[O]||{};2===m.parts.length&&(null===x&&(e[v]="remove"),"add"===e[v]||b.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?O===-1?(g[I]=z,delete g[v]):g[v]=j:b.log("???",e)),!n(j,"x")&&!n(j,"y")||b.containsAny(v,["color","opacity","align","dash"])||(d.docalc=!0);var D=w.getComponentMethod(I,"drawOne");D(t,O,m.parts.slice(2).join("."),e[v]),delete e[v]}else if(A.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1])C.manageArrayContainers(m,x,g),d.doplot=!0;else{var F=String(m.parts[1]||"");0===m.parts[0].indexOf("scene")?d.doplot=!0:0===m.parts[0].indexOf("geo")?d.doplot=!0:0===m.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===v?d.doplot=!0:!o._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?d.docalc=!0:m.parts[0].indexOf("legend")!==-1?d.dolegend=!0:v.indexOf("title")!==-1?d.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&b.containsAny(F,["tick","exponent","grid","zeroline"])?d.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:m.parts.length>1&&F.indexOf("line")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&"mirror"===F?d.doticks=d.dolayoutstyle=!0:"margin.pad"===v?d.doticks=d.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(d.doplot=!0):d.doplot=!0,m.set(x)}}}var B=t._fullLayout.width,U=t._fullLayout.height;A.supplyDefaults(t),t.layout.autosize&&A.plotAutoSize(t,t.layout,t._fullLayout);var V=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==U;return V&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:b.extendDeep({},p)}}function g(t){var e=v.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];v.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=b.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(L.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),b=t("../lib"),x=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),A=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),k=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),L=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),C=t("./helpers"),P=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=R._basePlotModules,r=0;r=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=C.getGraphDiv(t),!b.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=A.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function g(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var v,m,y=0,x=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&b.isPlainObject(e);if(M)x.push({type:"object",data:g(b.extendFlat({},e))});else if(_||"string"==typeof e)for(v=0;v0&&EE)&&L.push(m);x=L}}x.length>0?f(x):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=C.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!b.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:A.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),A.modifyFrames(t,a)},y.purge=function(t){t=C.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return A.cleanPlot([],{},r,e),A.purge(t),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":291,"../components/errorbars":297,"../constants/xmlns_namespaces":352,"../lib":364,"../lib/events":358,"../lib/queue":372,"../lib/svg_text_utils":378,"../plotly":388,"../plots/cartesian/graph_interact":400,"../plots/plots":430,"../plots/polar":433,"../registry":438,"./helpers":379,"./subroutines":385,d3:74,"fast-isnumeric":82}],381:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],382:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};_(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return _(t,g),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)c(t,r,"xaxis"),c(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;c(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){f(t,r,e+r.name)}):f(t,r,r.name))}),{layoutAttributes:o(t)}}function a(t){var e=h.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):t.arrayOk===!0&&(i[n+"src"]=e(n)):d.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function l(t){function e(t,e,r){if(t){var n=t[A];n&&(delete t[A],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return x(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),x(t,b.layout),t}function c(t,e,r){var n=d.nestedProperty(t,r),i=_({},e.layoutAttributes);i[w]=!0,n.set(i)}function f(t,e,r){var n=d.nestedProperty(t,r),i=_(n.get()||{},e.layoutAttributes);n.set(i)}var h=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),m=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),x=d.extendFlat,_=d.extendDeep,w="_isSubplotObj",A="_isLinkedToArray",M="_deprecated",k=[w,A,M];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=A,r.DEPRECATED=M,r.UNDERSCORE_ATTRS=k,r.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:k.concat.role},traces:t,layout:i(),transforms:e,frames:o(v),animation:o(m)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];k.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||d.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){a=a.slice(0,s).concat([r]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=n(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":364,"../plotly":388,"../snapshot/cloneplot":439,"../snapshot/helpers":442,"../snapshot/svgtoimg":444,"../snapshot/tosvg":446,"fast-isnumeric":82}],387:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;mc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=C&&i<=10||e>=15*C)t._tickround="d";else if(e>=R&&i<=16||e>=P)t._tickround="M";else if(e>=N&&i<=19||e>=R)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(b(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);b(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(Y),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(b(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=V(c):"m"===l?a=H(c):"d"===l?(r||(i="
"+V(c)),a=q(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=W(c),"S"!==l&&(a+=h(y.round(m(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=q(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&m(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,m(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},O.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===i){var g=n-1,v=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,v)]:[g,v]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r.map(t.l2r||Number)},O.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=O.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},O.saveRangeInitial=function(t,e){for(var r=O.list(t,"",!0),n=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=v-1;a>5;a--)i(a)}},O.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},O.autoTicks(f,s);var h,d=O.tickIncrement(O.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*x||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&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),a(t),t._tmin=O.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=O.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),f=0;fL?(e/=L,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,z)):n>S?(e/=S,t.dtick="M"+i(e,1,j)):n>C?(t.dtick=i(e,C,F),t.tick0="2000-01-02"):n>P?t.dtick=i(e,P,j):n>R?t.dtick=i(e,R,D):n>N?t.dtick=i(e,N,D):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,z))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,z)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,z));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},O.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?U:B,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},O.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]a:f1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":350,"../../lib":364,"fast-isnumeric":82}],395:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),f=[],h=0;h0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],398:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],399:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),b=t("./constants"),x=!0;e.exports=function(t,e,r,s,_,w,A,M){function k(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+vt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+vt+")").attr("d","M0,0Z"),L()}function L(){pt.selectAll(".select-outline").remove()}function S(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(H,e+at)),i=Math.max(0,Math.min(q,r+ot)),a=Math.abs(n-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,X)/2);st.l=Math.min(at,n),st.r=Math.max(at,n),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!J||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function C(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),x=!1)))}function R(e,r){var i=1===(A+M).length;if(e)j();else if(2!==r||i){if(1===r&&i){var a=A?V[0]:U[0],o="s"===A||"w"===M?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",f="middle";if(a.fixedrange)return;A?(f="n"===A?"top":"bottom","right"===a.side&&(c="right")):"e"===M&&(c="right"),rt.call(h.makeEditable,null,{immediate:!0,background:F.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&u.relayout(t,s,r)})}}else z()}function N(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||F._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void f.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=mt[0]+mt[2]*l,c=(s.bottom-e.clientY)/s.height,h=mt[1]+mt[3]*(1-c);if(M){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,r){for(var n,a,o=1-e,s=0;s0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nY.width||W<0||W>Y.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:M[0]._length/2,W="ypx"in e?e.ypx:k[0]._length/2;if(P="xval"in e?n(a,e.xval):i(M,X),R="yval"in e?n(a,e.yval):i(k,W),!g(P[0])||!g(R[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(O=0;O1||z.hoverinfo.indexOf("name")!==-1?z.name:void 0,index:!1,distance:Math.min(Z,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[j]&&(V.subplot=o[j]._subplot),H=q.length,"array"===F){var Q=e[O];"pointNumber"in Q?(V.index=Q.pointNumber,F="closest"):(F="","xval"in Q&&(B=Q.xval,F="x"),"yval"in Q&&(U=Q.yval,F=F?"closest":"y"))}else B=P[D],U=R[D];if(z._module&&z._module.hoverPoints){var $=z._module.hoverPoints(V,B,U,F);if($)for(var K,J=0;J<$.length;J++)K=$[J],g(K.x0)&&g(K.y0)&&q.push(l(K,C))}else v.log("Unrecognized trace type in hover:",z);"closest"===C&&q.length>H&&(q.splice(0,H),Z=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var tt="y"===C&&G.length>1;q.sort(function(t,e){return t.distance-e.distance});var et=b.combine(o.plot_bgcolor||b.background,o.paper_bgcolor),rt={hovermode:C,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(q,rt);c(q,tt?"xa":"ya"),f(nt,tt);var it=t._hoverdata,at=[];for(N=0;N128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):k&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0;r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0),v=h.node().getBoundingClientRect().width+2*N):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,T=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),O=T.width+R+N+v;t.ty0=_-T.top,t.bx=T.width+2*N,t.by=T.height+2*N,t.anchor="start",t.txwidth=T.width,t.tx2width=v,t.offset=0,a?(t.pos=L,m=S+P/2+O<=M,A=S-P/2-O>=0,"top"!==t.idealAlign&&m||!A?m?(S+=P/2,t.anchor="start"):t.anchor="middle":(S-=P/2,t.anchor="end")):(t.pos=S,m=L+C/2+O<=w,A=L-C/2-O>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(a?"rotate("+E+")":""))}),S}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?S:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var v=f[o];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(R+N),s=o+a*(t.txwidth+N),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-P,l=t.offset*C),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*R+l)+","+(R+u)+"v"+(t.by/2-R)+"h"+n*t.bx+"v-"+t.by+"H"+(n*R+l)+"V"+(u-R)+"Z"),i.call(x.setPosition,o+l,u+t.ty0-t.by/2+N).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+a*N+l,u+t.ty0-t.by/2+N),r.select("rect").call(x.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),M=t("./dragbox"),k=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,k,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=T.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":364,"fast-isnumeric":82}],406:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,M=i.xaxes[0]._length,k=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,P,R,N,O,I=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),z=[],j=i.gd,D=[];for(C=0;C0)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*f*Math.abs(n-i))}return l}function r(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var f=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?r:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,o=t[e],l=(t._id||"x").charAt(0);if(n="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,n=n.slice(),!o||2!==o.length)return void(t[e]=n);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),r=0;r<2;r++)if("date"===t.type){if(!a.isDateTime(o[r])){t[e]=n;break}if(o[r]a.MAX_MS&&(o[r]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[r])){if(!i(o[1-r])){t[e]=n;break}o[r]=o[1-r]*(r?10:.1)}if(o[r]<-s?o[r]=-s:o[r]>s&&(o[r]=s),o[0]===o[1]){var f=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=f,o[1]+=f}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=r.l+t.domain[0]*r.w, +t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?l:r},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var f=c.charAt(0),h=c.substr(1);h=n(h)?Number(h):0,(h<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":350,"../../lib":364,"fast-isnumeric":82}],411:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(t){var e,r,n,i,a,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,b.push(s),o[s]=a}return o}function f(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=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[u]?r[u].to:f,a=r[c]?r[c].to:h,f[0]===i[0]&&f[1]===i[1]&&h[0]===a[0]&&h[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function h(e,r){function n(e,r){for(i=0;ir.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,b=[],x=c(e),_=Object.keys(x),w=f(y,_,x);if(!w.length)return!1;var A;u&&(A=u());var M,k,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),M=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":364,"../../plotly":388,"../../registry":438,"./axes":393,d3:74}],412:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;fMath.abs(e))n.rotate(o,0,0,-t*r*Math.PI*h.rotateSpeed/window.innerWidth);else{var s=-h.zoomSpeed*a*e/window.innerHeight*(o-n.lastT())/100;n.pan(o,0,0,u*(Math.exp(s)-1))}},!0),h}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":9,"mouse-change":178,"mouse-wheel":180,"right-now":214}],416:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<3;++r){var n=s[r];e[n]._gd=t}}var i=t("./scene"),a=t("../plots"),o=t("../../constants/xmlns_namespaces"),s=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,o=a.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var s=0;sh[1][o]?d[o]=1:h[1][o]===h[0][o]?d[o]=1:d[o]=1/(h[1][o]-h[0][o]);for(this.dataScale=d,a=0;ag[1][a])g[0][a]=-1,g[1][a]=1;else{var x=g[1][a]-g[0][a];g[0][a]-=x/32,g[1][a]+=x/32}}else{var w=c[T[a]].range;g[0][a]=w[0],g[1][a]=w[1]}g[0][a]===g[1][a]&&(g[0][a]-=1,g[1][a]+=1),v[a]=g[1][a]-g[0][a],this.glplot.bounds[0][a]=g[0][a]*d[a],this.glplot.bounds[1][a]=g[1][a]*d[a]}var A=[1,1,1];for(a=0;a<3;++a){l=c[T[a]],u=l.type;var M=y[u];A[a]=Math.pow(M.acc,1/M.count)/d[a]}var k,E=4;if("auto"===c.aspectmode)k=Math.max.apply(null,A)/Math.min.apply(null,A)<=E?A:[1,1,1];else if("cube"===c.aspectmode)k=[1,1,1];else if("data"===c.aspectmode)k=A;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var L=c.aspectratio;k=[L.x,L.y,L.z]}c.aspectratio.x=f.aspectratio.x=k[0],c.aspectratio.y=f.aspectratio.y=k[1],c.aspectratio.z=f.aspectratio.z=k[2],this.glplot.aspect=k;var S=c.domain||null,C=e._size||null;if(S&&C){var P=this.container.style;P.position="absolute",P.left=C.l+S.x[0]*C.w+"px",P.top=C.t+(1-S.y[1])*C.h+"px",P.width=C.w*(S.x[1]-S.x[0])+"px",P.height=C.h*(S.y[1]-S.y[0])+"px"}this.glplot.redraw()}},k.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},k.setCameraToDefault=function(){this.setCamera({eye:{x:1.25,y:1.25,z:1.25},center:{x:0,y:0,z:0},up:{x:0,y:0,z:1}})},k.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},k.setCamera=function(t){var e={};e[this.id]=t,this.glplot.camera.lookAt.apply(this,l(t)),this.graphDiv.emit("plotly_relayout",e)},k.saveCamera=function(t){function e(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]]}var r=this.getCamera(),n=p.nestedProperty(t,this.id+".camera"),i=n.get(),a=!1;if(void 0===i)a=!0;else for(var o=0;o<3;o++)for(var s=0;s<3;s++)if(!e(r,i,o,s)){a=!0;break}return a&&n.set(r),a},k.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},k.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(c),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var a=0,o=n-1;a=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"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,f=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=f)}else{p.supplyLayoutGlobalDefaults(a,n);var h=!a.width||!a.height,d=n.autosize,g=t._context&&t._context.autosizable,v=h&&(d||g);v?p.plotAutoSize(t,a,n):h&&p.sanitizeMargins(t),!d&&h&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,n),n._has=p._hasPlotType.bind(n);var m=n._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),f=c.left+c.right,d=c.bottom+c.top,g=1-2*o,v=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(v.width-f)),i=Math.round(g*(v.height-d))}else{var m=l?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,i=parseFloat(m.height)||r.height}var y=p.layoutAttributes.width.min,b=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-i)>1;(_||x)&&(x&&(r.width=n),_&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a;c.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(i=0;i.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,f=r.size,h=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(f*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(f-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var v=l[t].t.val,m=l[t].t.size;if(v>h){var y=(d*v+(m-e.height)*h)/(v-h),b=(m*(1-h)+(d-e.height)*(1-v))/(v-h);y>=0&&b>=0&&y+b>s+o&&(s=y,o=b)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):h.isJSDate(t)?h.ms2DateTime(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)},p.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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,S=L?f.angularAxis.domain:n.extent(M),C=Math.abs(M[1]-M[0]);T&&!k&&(C=0);var P=S.slice();E&&k&&(P[1]+=C);var R=f.angularAxis.ticksCount||4;R>8&&(R=R/(R/8)+R%8),f.angularAxis.ticksStep&&(R=(P[1]-P[0])/R);var N=f.angularAxis.ticksStep||(P[1]-P[0])/(R*(f.minorTicks+1));A&&(N=Math.max(Math.round(N),1)),P[2]||(P[2]=N);var O=n.range.apply(this,P);if(O=O.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(P.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?C:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var I="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",z=(new DOMParser).parseFromString(I,"application/xml"),j=this.appendChild(this.ownerDocument.importNode(z.documentElement,!0));e=n.select(j)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var D,F=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},U={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){D=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:D,elements:V,reverseOrder:f.legend.reverseOrder})})();var H=D.node().getBBox();b=Math.min(f.width-H.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,b=Math.max(10,b),_=[f.margin.left+b,f.margin.top+b],i.range([0,b]),c.layout.radialAxis.domain=i.domain(),D.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else D=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var q=[(f.width-(f.margin.left+f.margin.right+2*b+(H?H.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2]; +if(q[0]=Math.max(0,q[0]),q[1]=Math.max(0,q[1]),e.select(".outer-group").attr("transform","translate("+q+")"),f.title){var G=e.select("g.title-group text").style(U).text(f.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var W=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=W.selectAll("circle.grid-circle").data(i.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(B),Y.attr("r",i),Y.exit().remove()}W.select("circle.outside-circle").attr({r:b}).style(B);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=n.svg.axis().scale(i).ticks(5).tickSize(5);W.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),W.selectAll(".domain").style(B),W.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),W.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(O),K=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),K.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),K.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(U);var J=$.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+f.labelOffset,i=f.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:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":A?A[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(U);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));D.attr({transform:"translate("+[b+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!k){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;ot=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ct.text(o.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=i.invert(o.util.getMousePos(Z).radius);var n=o.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(o.util.round(st)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var i=n.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(u.t=A[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-q[0]-h.left,f.top+f.height/2-q[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.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")})})}),h}var e,r,i,s,l={data:[],layout:{}},u={},c={},f=n.dispatch("hover"),h={};return h.render=function(e){return t(e),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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return i},h.angularScale=function(t){return s},h.svg=function(){return e},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,i=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return i},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("undefined"==typeof 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 r===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=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 s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:h(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,i,a)},"stroke-width":function(t,e){return v["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,i,a)},opacity:function(t,e){return v.opacity(r,i,a)},display:function(t,e){return v.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var v={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},m=n.select(this).selectAll("g.layer").data(l);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],i=n.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=n.merge(i);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,f=c?r.height:u*o.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.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"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(o.length),v=n.scale[c?"linear":"ordinal"]().domain(g).range(l),m=n.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,m(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return v(e)}}),x.exit().remove()}var _=n.svg.axis().scale(m).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var n=t.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(f);var h=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[i.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=i.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};n.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../lib":364,d3:74}],435:[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,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(f=i),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(r),a.config(c).render(f),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,i,a,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},u.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":268,"../../lib":364,"./micropolar":434,"./undo_manager":436,d3:74}],436:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,u=t.layout,c=l([],a),f=l({},u,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(r=0;r0)s=f(t.alphahull,l);else{var u=["x","y","z"].indexOf(t.delaunayaxis);s=c(l.map(function(t){return[t[(u+1)%3],t[(u+2)%3]]}))}var p={positions:l,cells:s,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:d(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",p.vertexIntensity=t.intensity,p.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolors[0],p.vertexColors=a(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],p.cellColors=a(t.facecolor)):(this.color=t.color,p.meshColor=d(t.color)),this.mesh.update(p)},p.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=s},{"../../lib/str2rgbarray":377,"alpha-shape":14,"convex-hull":65,"delaunay-triangulate":75,"gl-mesh3d":126,tinycolor2:241}],450:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorbar/defaults"),a=t("./attributes");e.exports=function(t,e,r,o){function s(r,i){return n.coerce(t,e,a,r,i)}function l(t){var e=t.map(function(t){var e=s(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=l(["x","y","z"]),c=l(["i","j","k"]);return u?(c&&c.forEach(function(t){for(var e=0;ep&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var m={type:"linear"};i.setConvert(m),l=m.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},g.ppad=v.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,i.expand(c,h,g),i.expand(f,d,v);var x=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],457:[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,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=i.aggNums(Math.min,null,c)),n(h)||(h=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":271,"../../components/colorscale":282,"../../lib":364,"../../plots/plots":430,"fast-isnumeric":82}],458:[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":274,"../../components/colorscale/has_colorscale":281,"./subtypes":474}],459:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],460:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var v=s(t,e,g),m=vU!=N>=U&&(C=L[T-1][0],P=L[T][0],S=C+(P-C)*(U-R)/(N-R),j=Math.min(j,S),D=Math.max(D,S));j=Math.max(j,0),D=Math.min(D,h._length);var V=l.defaultLine;return l.opacity(f.fillcolor)?V=f.fillcolor:l.opacity((f.line||{}).color)&&(V=f.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:j,x1:D,y0:U,y1:U,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":268,"../../components/errorbars":297,"../../lib":364,"../../plots/cartesian/constants":398,"../../plots/cartesian/graph_interact":400,"./get_trace_color":462}],464:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":401,"./arrays_to_calcdata":453,"./attributes":454,"./calc":455,"./clean_data":456,"./colorbar":457,"./defaults":460,"./hover":463,"./plot":471,"./select":472,"./style":473,"./subtypes":474}],465:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":277,"../../components/colorscale/has_colorscale":281}],466:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),i=A.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/w._length,r=t[1]/A._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w=e.xaxis,A=e.yaxis,M=e.simplify,k=e.connectGaps,T=e.baseTolerance,E=e.linear,L=[],S=.2,C=new Array(t.length),P=0;for(M||(T=S=-1),o=0;oi(f))break;l=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,u=f,d=!1):y=t.length||!f)break;C[P++]=f,s=f}}else C[P++]=u}L.push(C.slice(0,P))}return L}},{"../../constants/numerical":350}],467:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],468:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":82}],470:[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){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":268,"../../components/colorscale/defaults":277,"../../components/colorscale/has_colorscale":281,"./subtypes":474}],471:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function i(t,e,r,n,i,d,g){function v(t){return M?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function b(t){if(t.ids)return y}function x(){return!1}function _(t){var e,r,n=t[0].trace,i=o.select(this),a=c.hasMarkers(n),u=c.hasText(n),f=b(n),h=x,d=x;a&&(h=n.marker.maxdisplayed?m:s.identity),u&&(d=n.marker.maxdisplayed?m:s.identity),r=i.selectAll("path.point"),e=r.data(h,f);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,n).call(l.translatePoints,k,T,n),M&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=v(o.select(this));l.translatePoint(t,e,k,T),l.singlePointStyle(t,e,n)}),M?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=i.selectAll("g"),e=r.data(d,f),e.enter().append("g").append("text"),e.each(function(t){var e=v(o.select(this).select("text"));l.translatePoint(t,e,k,T)}),e.selectAll("text").call(l.textPointStyle,n).each(function(t){var e=t.xp||k.c2p(t.x),r=t.yp||T.c2p(t.y);o.select(this).selectAll("tspan").each(function(){v(o.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,A;a(t,e,r,n,i);var M=!!g&&g.duration>0,k=r.xaxis,T=r.yaxis,E=n[0].trace,L=E.line,S=o.select(d);if(S.call(u.plot,r,g),E.visible===!0){v(S).style("opacity",E.opacity);var C,P,R=E.fill.charAt(E.fill.length-1);"x"!==R&&"y"!==R&&(R=""),n[0].node3=S,f(n);var N="",O=[],I=E._prevtrace;I&&(N=I._prevRevpath||"",P=I._nextFill,O=I._polygons);var z,j,D,F,B,U,V,H,q,G="",X="",W=[],Y=[],Z=s.noop;if(C=E._ownFill,c.hasLines(E)||"none"!==E.fill){for(P&&P.datum(n),["hv","vh","hvh","vhv"].indexOf(L.shape)!==-1?(D=l.steps(L.shape),F=l.steps(L.shape.split("").reverse().join(""))):D=F="spline"===L.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),L.smoothing):l.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return F(t.reverse())},W=h(n,{xaxis:k,yaxis:T,connectGaps:E.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),q=E._polygons=new Array(W.length),A=0;A1}),Z=function(t){return function(e){if(z=D(e),j=B(e),G?R?(G+="L"+z.substr(1),X=j+("L"+X.substr(1))):(G+="Z"+z,X=j+"Z"+X):(G=z,X=j),c.hasLines(E)&&e.length>1){var r=o.select(this);if(r.datum(n),t)v(r.style("opacity",0).attr("d",z).call(l.lineGroupStyle)).style("opacity",1);else{var i=v(r);i.attr("d",z),l.singleLineStyle(n,i)}}}}}var Q=S.selectAll(".js-line").data(Y);v(Q.exit()).style("opacity",0).remove(),Q.each(Z(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Z(!0)),W.length&&(C?U&&H&&(R?("y"===R?U[1]=H[1]=T.c2p(0,!0):"x"===R&&(U[0]=H[0]=k.c2p(0,!0)),v(C).attr("d","M"+H+"L"+U+"L"+G.substr(1))):v(C).attr("d",G+"Z")):"tonext"===E.fill.substr(0,6)&&G&&N&&("tonext"===E.fill?v(P).attr("d",G+"Z"+N+"Z"):v(P).attr("d",G+"L"+N.substr(1)+"Z"),E._polygons=E._polygons.concat(O)),E._prevRevpath=X,E._prevPolygons=q);var $=S.selectAll(".points");w=$.data([n]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,s=r.yaxis,l=o.extent(a.range.map(a.r2l).map(a.l2c)),u=o.extent(s.range.map(s.r2l).map(s.l2c)),f=n[0].trace;if(c.hasMarkers(f)){var h=f.marker.maxdisplayed;if(0!==h){var d=n.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/h),g=0;i.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),f=c.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,r),n(t,p),l=0,u=[];ln?1:-1}),v){s&&(h=s());var m=o.transition().duration(a.duration).ease(a.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()});m.each(function(){p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)})})}else p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":291,"../../components/errorbars":297,"../../lib":364,"../../lib/polygon":371,"./arrays_to_calcdata":453,"./line_points":466,"./link_traces":468,"./subtypes":474,d3:74}],472:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,g=!n.hasMarkers(h)&&!n.hasText(h);if(h.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return A[t]}function u(t,e,r,n,i){var a=null;if(Array.isArray(t)){a=[];for(var o=0;o=0){var h=i(l.position,l.delaunayColor,l.delaunayAxis);h.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(h):(h.gl=o,this.delaunayMesh=v(h),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},k.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=h},{"../../constants/gl3d_dashes":348,"../../constants/gl_markers":349,"../../lib":364,"../../lib/gl_format_color":362,"../../lib/str2rgbarray":377,"../scatter/make_bubble_size_func":469,"./calc_errors":479,"delaunay-triangulate":75,"gl-error3d":98,"gl-line3d":103,"gl-mesh3d":126,"gl-scatter3d":132}],481:[function(t,e,r){"use strict";function n(t,e,r){var n=0,i=r("x"),a=r("y"),o=r("z");return i&&a&&o&&(n=Math.min(i.length,a.length,o.length),n=0&&h("surfacecolor",p||g);for(var v=["x","y","z"],m=0;m<3;++m){var y="projection."+v[m];h(y+".show")&&(h(y+".opacity"),h(y+".scale"))}u(t,e,r,{axis:"z"}),u(t,e,r,{axis:"y",inherit:"z"}),u(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":296,"../../lib":364,"../scatter/line_defaults":465,"../scatter/marker_defaults":470,"../scatter/subtypes":474,"../scatter/text_defaults":475,"./attributes":477}],482:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl_markers":349,"../../plots/gl3d":416,"../scatter/colorbar":457,"./attributes":477,"./calc":478,"./convert":480,"./defaults":481}],483:[function(t,e,r){"use strict";function n(t){return{valType:"boolean",dflt:!1}}function i(t){return{show:{valType:"boolean",dflt:!1},project:{x:n("x"),y:n("y"),z:n("z")},color:{valType:"color",dflt:a.defaultLine},usecolormap:{valType:"boolean",dflt:!1},width:{valType:"number",min:1,max:16,dflt:2},highlight:{valType:"boolean",dflt:!0},highlightcolor:{valType:"color",dflt:a.defaultLine},highlightwidth:{valType:"number",min:1,max:16,dflt:2}}}var a=t("../../components/color"),o=t("../../components/colorscale/attributes"),s=t("../../components/colorbar/attributes"),l=t("../../lib/extend").extendFlat;e.exports={z:{valType:"data_array"},x:{valType:"data_array"},y:{valType:"data_array"},text:{valType:"data_array"},surfacecolor:{valType:"data_array"},cauto:o.zauto,cmin:o.zmin,cmax:o.zmax,colorscale:o.colorscale,autocolorscale:l({},o.autocolorscale,{dflt:!1}),reversescale:o.reversescale,showscale:o.showscale,colorbar:s,contours:{x:i("x"),y:i("y"),z:i("z")},hidesurface:{valType:"boolean",dflt:!1},lightposition:{x:{valType:"number",min:-1e5,max:1e5,dflt:10},y:{valType:"number",min:-1e5,max:1e5,dflt:1e4},z:{valType:"number",min:-1e5,max:1e5,dflt:0}},lighting:{ambient:{valType:"number",min:0,max:1,dflt:.8},diffuse:{valType:"number",min:0,max:1,dflt:.8},specular:{valType:"number",min:0,max:2,dflt:.05},roughness:{valType:"number",min:0,max:1,dflt:.5},fresnel:{valType:"number",min:0,max:5,dflt:.2}},opacity:{valType:"number",min:0,max:1,dflt:1},_deprecated:{zauto:l({},o.zauto,{}),zmin:l({},o.zmin,{}),zmax:l({},o.zmax,{})}}},{"../../components/color":268,"../../components/colorbar/attributes":269,"../../components/colorscale/attributes":273,"../../lib/extend":359}],484:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){e.surfacecolor?n(e,e.surfacecolor,"","c"):n(e,e.z,"","c")}},{"../../components/colorscale/calc":274}],485:[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="cb"+r.uid,u=r.cmin,c=r.cmax,f=r.surfacecolor||r.z;if(n(u)||(u=i.aggNums(Math.min,null,f)),n(c)||(c=i.aggNums(Math.max,null,f)),t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void a.autoMargin(t,l);var h=e[0].t.cb=s(t,l),d=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});h.fillcolor(d).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":271,"../../components/colorscale":282,"../../lib":364,"../../plots/plots":430,"fast-isnumeric":82}],486:[function(t,e,r){"use strict";function n(t,e,r){this.scene=t,this.uid=r,this.surface=e,this.data=null,this.showContour=[!1,!1,!1],this.dataScale=1}function i(t,e){return void 0===e&&(e=1),t.map(function(t){var r=t[0],n=p(t[1]),i=n.toRgb();return{index:r,rgb:[i.r,i.g,i.b,e]}})}function a(t){var e=t[0].rgb,r=t[t.length-1].rgb;return e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]&&e[3]===r[3]}function o(t){var e=t.shape,r=[e[0]+2,e[1]+2],n=c(new Float32Array(r[0]*r[1]),r);return d.assign(n.lo(1,1).hi(e[0],e[1]),t),d.assign(n.lo(1).hi(e[0],1),t.hi(e[0],1)),d.assign(n.lo(1,r[1]-1).hi(e[0],1),t.lo(0,e[1]-1).hi(e[0],1)),d.assign(n.lo(0,1).hi(1,e[1]),t.hi(1)),d.assign(n.lo(r[0]-1,1).hi(1,e[1]),t.lo(e[0]-1)),n.set(0,0,t.get(0,0)),n.set(0,r[1]-1,t.get(0,e[1]-1)),n.set(r[0]-1,0,t.get(e[0]-1,0)),n.set(r[0]-1,r[1]-1,t.get(e[0]-1,e[1]-1)),n}function s(t){var e=Math.max(t[0].shape[0],t[0].shape[1]);if(e=3;break;case"AAAsmall":a=o>=7}return a},r.mostReadable= Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]]}},{}],242:[function(t,e,n){"use strict";e.exports=function(t,e,n,r,i){var a=(t-n)/(r-n),o=a+e/(r-n),s=(a+o)/2;return"left"===i||"bottom"===i?a:"center"===i||"middle"===i?s:"right"===i||"top"===i?o:a<2/3-s?a:o>4/3-s?o:s}},{}],243:[function(t,e,n){"use strict";var r=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,n,a){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===a?0:"middle"===a?1:"top"===a?2:r.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":316}],244:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,m._dragged=!1,m._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-m._mouseDownTimev&&(g=Math.max(g-1,1)),t.doneFn&&t.doneFn(m._dragged,g),!m._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),d.dispatchEvent(n)}return i(m),m._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,m=o.getPlotDiv(t.element)||{},g=1,v=s.DBLCLICKDELAY;m._mouseDownTime||(m._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=r},{"../../lib":316,"../../plotly":338,"../../plots/cartesian/constants":348,"./align":242,"./cursor":243,"./unhover":245}],245:[function(t,e,n){"use strict";var r=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,n)},i.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":311}],246:[function(t,e,n){"use strict";function r(t,e,n,r,i,a,o){if(s.traceIs(n,"symbols")){var u=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(n)?u(t.ms):(a.size||6)/2,t.mrc=e;var r=m.symbolNumber(t.mx||a.symbol)||0,i=r%100;return t.om=r%200>=100,m.symbolFuncs[i](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,f,h;t.so?(h=o.outlierwidth,f=o.outliercolor,c=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=r(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(h||1)+"px",fill:"none"}):(e.style("stroke-width",h+"px").call(l.fill,c),h&&e.call(l.stroke,f))}function i(t,e,n,r){var i=t[0]-e[0],o=t[1]-e[1],s=n[0]-e[0],l=n[1]-e[1],u=Math.pow(i*i+o*o,b/2),c=Math.pow(s*s+l*l,b/2),f=(c*c*i-u*u*s)*r,h=(c*c*o-u*u*l)*r,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&f/d),2),a.round(e[1]+(d&&h/d),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&h/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),m=e.exports={};m.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(l.fill,r)},m.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},m.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},m.setRect=function(t,e,n,r,i){t.call(m.setPosition,e,n).call(m.setSize,r,i)},m.translatePoint=function(t,e,n,r){var i=t.xp||n.c2p(t.x),a=t.yp||r.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},m.translatePoints=function(t,e,n,r){t.each(function(t){var i=a.select(this);m.translatePoint(t,i,e,n,r)})},m.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},m.crispRound=function(t,e,n){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},m.singleLineStyle=function(t,e,n,r,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=n||a.width||0,s=i||a.dash||"";l.stroke(e,r||a.color),m.dashLine(e,s,o)},m.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=r||i.dash||"";a.select(this).call(l.stroke,n||i.color).call(m.dashLine,s,o)})},m.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},m.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=a.select(this);try{n.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),n.remove()}})};var g=t("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolList=[],Object.keys(g).forEach(function(t){var e=g[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"])});var v=m.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";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),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},m.singlePointStyle=function(t,e,n){var i=n.marker,a=i.line,o=m.tryColorscale(i,""),s=m.tryColorscale(i,"line");r(t,e,n,o,s,i,a)},m.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=m.tryColorscale(n,""),i=m.tryColorscale(n,"line");t.each(function(t){m.singlePointStyle(t,a.select(this),e,r,i)})}},m.tryColorscale=function(t,e){var n=e?c.nestedProperty(t,e).get():t,r=n.colorscale,i=n.color;return r&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(r,n.cmin,n.cmax)):c.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},_=1.3;m.textPointStyle=function(t,e){t.each(function(t){var n=a.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,n.call(m.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(r).call(f.convertToTspans);var h=a.select(this.parentNode),d=n.selectAll("tspan.line"),p=((d[0].length||1)-1)*_+1,g=x[l]*c,v=.75*u+x[s]*c+(x[s]-1)*p*u/2;h.attr("transform","translate("+g+","+v+")"),p>1&&d.attr({x:n.attr("x"),y:n.attr("y")})})};var b=.5;m.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],a=[];for(n=1;n=A&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(l),c.extendFlat({},l)},m.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=a.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":305,"../../lib":316,"../../lib/svg_text_utils":328,"../../registry":382,"../../traces/scatter/make_bubble_size_func":408,"../../traces/scatter/subtypes":413,"../color":223,"../colorscale":237,"./symbol_defs":247,d3:8,"fast-isnumeric":12}],247:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,i="l"+e+",-"+e,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+n+i+a+i+a+o+a+o+n+o+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),i=r.round(-t,2),a=r.round(t*-.309,2),o=r.round(.809*t,2);return"M"+e+","+a+"L"+n+","+o+"H-"+n+"L-"+e+","+a+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),i=r.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+n+"V"+n+"L0,"+e+"L-"+i+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),i=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+i+"H"+n+"L"+e+",0L"+n+",-"+i+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),i=r.round(.951*e,2),a=r.round(.363*e,2),o=r.round(.588*e,2),s=r.round(-e,2),l=r.round(e*-.309,2),u=r.round(.118*e,2),c=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+n+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),i=r.round(.76*t,2);return"M-"+i+",0l-"+n+",-"+e+"h"+i+"l"+n+",-"+e+"l"+n+","+e+"h"+i+"l-"+n+","+e+"l"+n+","+e+"h-"+i+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),i=r.round(1.6*t,2),a=r.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M-"+e+","+n+o+e+","+n+o+"0,-"+i+o+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),i=r.round(1.6*t,2),a=r.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M"+e+",-"+n+o+"-"+e+",-"+n+o+"0,"+i+o+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),i="A "+n+","+n+" 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=r.round(1.4*t,2),n=r.round(1.9*t,2),i="A "+n+","+n+" 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=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:8}],248:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],249:[function(t,e,n){"use strict";function r(t,e,n,r){var a=e["error_"+r]||{},l=a.visible&&["linear","log"].indexOf(n.type)!==-1,u=[];if(l){for(var c=s(a),f=0;f0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var m=i.select(this).selectAll("g.errorbar").data(t,e);m.exit().remove(),m.style("opacity",1);var g=m.enter().append("g").classed("errorbar",!0);c&&g.style("opacity",0).transition().duration(n.duration).style("opacity",1),m.each(function(t){var e=i.select(this),o=r(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var m=d.width;f="M"+(o.x-m)+","+o.yh+"h"+2*m+"m-"+m+",0V"+o.ys,o.noYS||(f+="m-"+m+",0h"+2*m);var g=e.select("path.yerror");s=!g.size(),s?g=e.append("path").classed("yerror",!0):c&&(g=g.transition().duration(n.duration).ease(n.easing)),g.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var v=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-v)+"v"+2*v+"m0,-"+v+"H"+o.xs,o.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":413,d3:8,"fast-isnumeric":12}],254:[function(t,e,n){"use strict";var r=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},a=e.error_x||{},o=r.select(this);o.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(i.stroke,n.color),a.copy_ystyle&&(a=n),o.selectAll("path.xerror").style("stroke-width",a.thickness+"px").call(i.stroke,a.color)})}},{"../color":223,d3:8}],255:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":348}],256:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return i.coerce(t,e,s,n,r)}var o=r("source"),l=r("visible",!!o);if(!l)return e;r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var u={_fullLayout:n},c=["x","y"],f=0;f<2;f++)a.coerceRef(t,e,u,c[f],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var n={name:l,handleItemDefaults:r};o(t,e,n)}},{"../../lib":316,"../../plots/array_container_defaults":340,"../../plots/cartesian/axes":343,"./attributes":255}],257:[function(t,e,n){"use strict";var r=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var n=r.select(this);if(!this.img||this.img.src!==e.source){n.attr("xmlns",o.svg);var i=new Promise(function(t){function r(){n.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=r,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var r=t.toDataURL("image/png");n.attr("xlink:href",r)},n.on("error",r),n.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function n(e){var n=r.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,f=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,h=c*d.x[e.xanchor].offset,p=f*d.y[e.yanchor].offset,m=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,g=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+h,v=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":m+=" slice";break;case"stretch":m="none"}n.attr({x:g,y:v,width:c,height:f,preserveAspectRatio:m,opacity:e.opacity});var y=o?o._id:"",x=l?l._id:"",_=y+x;_&&n.call(i.setClipUrl,"clip"+s._uid+_)}for(var s=t._fullLayout,l=[],u=[],c=[],f=0;f=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],260:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":312,"../../plots/font_attributes":363,"../color/attributes":222}],261:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],262:[function(t,e,n){"use strict";var r=t("../../registry"),i=t("../../lib"),a=t("./attributes"),o=t("../../plots/layout_attributes"),s=t("./helpers");e.exports=function(t,e,n){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},m=0,g="normal",v=0;v1);if(x!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var _=t.xaxis;_&&_.rangeslider&&_.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",g),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"]); }}},{"../../lib":316,"../../plots/layout_attributes":365,"../../registry":382,"./attributes":260,"./helpers":265}],263:[function(t,e,n){"use strict";function r(t,e){function n(n){v.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(a,e)})}var r=t.data()[0][0],i=e._fullLayout,o=r.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?r.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(m.font,i.legend.font).text(u),e._context.editable&&!s?f.call(v.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var i,a=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=r.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(n)}function i(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=n.indexOf(f);h===-1?n.push(f):n.splice(h,1),c.relayout(e,"hiddenlabels",n)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;n=s*h,r=u.node()&&m.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}n=Math.max(n,16)+3,i.height=n,i.width=r}function o(t,e,n){var r=t._fullLayout,i=r.legend,a=i.borderwidth,o=b.isGrouped(i);if(b.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,a,5+a+i.height+n/2),i.height+=n,i.width=Math.max(i.width,r)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),n.each(function(e){var n=e[0],r=u.select(this).select(".legendtoggle");r.call(m.setRect,0,-n.height/2,(t._context.editable?0:i.width)+40,n.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cr.width-(r.margin.r+r.margin.l)&&(x=0,g+=v,i.height=i.height+v,v=0),f.setTranslate(this,a+x,5+a+e.height/2+g),i.width+=o+n,i.height=Math.max(i.height,e.height),x+=o+n,v=Math.max(e.height,v)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),n.each(function(e){var n=e[0],r=u.select(this).select(".legendtoggle");r.call(m.setRect,0,-n.height/2,t._context.editable?0:i.width,n.height)})}}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var i="top";w.isBottomAnchor(n)?i="bottom":w.isMiddleAnchor(n)&&(i="middle"),h.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[i]||0),t:n.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),h.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),m=t("../drawing"),g=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),_=t("./style"),b=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),z.call(m.setRect,N,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,a="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,b=n.showlegend&&x(t.calcdata,v),M=n.hiddenlabels||[];if(!n.showlegend||!b.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+a).data([0]);A.enter().append("clipPath").attr("id",a).append("rect");var S=k.selectAll("rect.bg").data([0]);S.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),S.call(g.stroke,v.bordercolor),S.call(g.fill,v.bgcolor),S.style("stroke-width",v.borderwidth+"px");var T=k.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var z=k.selectAll("rect.scrollbar").data([0]);z.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var E=T.selectAll("g.groups").data(b);E.enter().append("g").attr("class","groups"),E.exit().remove();var L=E.selectAll("g.traces").data(f.identity);L.enter().append("g").attr("class","traces"),L.exit().remove(),L.call(_).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(r,t).call(i,t)});var I=0!==k.enter().size();I&&(o(t,E,L),s(t));var D=0,P=n.width,C=0,O=n.height;o(t,E,L),v.height>O?l(t):s(t);var F=n._size,R=F.l+F.w*v.x,j=F.t+F.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?j-=v.height:w.isMiddleAnchor(v)&&(j-=v.height/2);var N=v.width,B=F.w;N>B?(R=F.l,N=B):(R+N>P&&(R=P-N),RV?(j=F.t,q=V):(j+q>O&&(j=O-q),jn[1])return n[1]}return i}function n(t){return t[0]}var r,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},m={};s&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",c.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(m.line={width:e("line.width",n,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[c.minExtend(a,p)],i=c.minExtend(o,m)}var g=l.select(this).select("g.legendpoints"),v=g.selectAll("path.scatterpts").data(s?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,i),s&&(r[0].mrc=3);var y=g.selectAll("g.pointtext").data(u?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||r.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||n.color),e&&i.call(h.stroke,t.mlc||r.color)})}function o(t){var e=t[0].trace,n=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=l.select(this);r.style("stroke-width",n+"px").call(h.fill,t.fc||e.fillcolor),n&&r.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,n=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(r).each(i)}},{"../../lib":316,"../../registry":382,"../../traces/pie/style_one":391,"../../traces/scatter/subtypes":413,"../color":223,"../drawing":246,d3:8}],268:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),i=n.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===r){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),m=0;m1)return r(["resetViews","toggleHover"]),o(g,n);c&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),h&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=i(s),y=[];return((u||p)&&!v||m)&&(y=["zoom2d","pan2d"]),(u||m)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!u&&!p||v||m||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):u?r(["hoverClosestCartesian","hoverCompareCartesian"]):d&&r(["hoverClosestPie"]),o(g,n)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var m=i(e,n,l);c("x",m[0]),c("y",m[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",n.font);var g=c("bgcolor");c("activecolor",o.contrast(g,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":316,"../color":223,"./attributes":272,"./button_attributes":273,"./constants":274}],276:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=i.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var s=0;se;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,n,r){function i(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,E)},i=E.line.width?E.line.color:"rgba(0,0,0,0)",a=n.append("path").attr(r).style("opacity",E.opacity).call(b.stroke,i).call(b.fill,E.fillcolor).call(w.dashLine,E.line.dash,E.line.width);L&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+L),t._context.editable&&f(t,a,E,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof n&&n?l[n]=r:x.isPlainObject(n)&&(l=n);var u=Object.keys(l);for(a=0;aZ&&r>X&&!t.shiftKey?M.getCursor(i/n,1-a/r):"move";k(e,o),H=o.split("-")[0]}function a(e){N=_.getFromId(t,n.xref),B=_.getFromId(t,n.yref),q=S.getDataToPixel(t,N),V=S.getDataToPixel(t,B,!0),U=S.getPixelToData(t,N),G=S.getPixelToData(t,B,!0);var a="shapes["+r+"]";"path"===n.type?(R=n.path,j=a+".path"):(c=q(n.x0),f=V(n.y0),h=q(n.x1),d=V(n.y1),m=a+".x0",v=a+".y0",x=a+".x1",b=a+".y1"),cX&&(u[E]=n[P]=G(s),u[L]=n[C]=G(l)),f-c>Z&&(u[I]=n[O]=U(c),u[D]=n[F]=U(f))}e.attr("d",p(t,n))}var u,c,f,h,d,m,v,x,b,w,A,T,z,E,L,I,D,P,C,O,F,R,j,N,B,q,V,U,G,H,Z=10,X=10,Y={setCursor:i,element:e.node(),prepFn:a,doneFn:o},W=Y.element.getBoundingClientRect();M.init(Y)}function h(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function d(t,e,n){var r=_.getFromId(t,n.id,"x")._id,i=_.getFromId(t,n.id,"y")._id,a="below"===e.layer,o=r===e.xref||i===e.yref,s=!!n.shapelayer;return a&&o&&s}function p(t,e){var n,r,i,a,o=e.type,s=_.getFromId(t,e.xref),l=_.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=S.shapePositionToRange(s),r=function(t){return s._offset+s.r2p(n(t,!0))}):r=function(t){return u.l+u.w*t},l?(i=S.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(r=S.decodeDate(r)),l&&"date"===l.type&&(a=S.decodeDate(a)),m(e.path,r,a);var c=r(e.x0),f=r(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,g=(h+d)/2,v=Math.abs(p-c),y=Math.abs(g-h),x="A"+v+","+y,b=p+v+","+g,w=p+","+(g-y);return"M"+b+x+" 0 1,1 "+w+x+" 0 0,1 "+b+"Z"}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,i=t.charAt(0),a=A.paramIsX[i],o=A.paramIsY[i],s=A.numParams[i],l=t.substr(1).replace(A.paramRE,function(t){return a[r]?t=e(t):o[r]&&(t=n(t)),r++,r>s&&(t="X"),t});return r>s&&(l=l.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),i+l})}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,i=t.charAt(0),a=A.paramIsX[i],o=A.paramIsY[i],s=A.numParams[i],l=t.substr(1).replace(A.paramRE,function(t){return r>=s?t:(a[r]?t=e(t):o[r]&&(t=n(t)),r++,t)});return i+l})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),_=t("../../plots/cartesian/axes"),b=t("../color"),w=t("../drawing"),M=t("../dragelement"),k=t("../../lib/setcursor"),A=t("./constants"),S=t("./helpers"),T=t("./shape_defaults"),z=t("./defaults");e.exports={draw:r,drawOne:i}},{"../../lib":316,"../../lib/setcursor":326,"../../plotly":338,"../../plots/cartesian/axes":343,"../color":223,"../dragelement":244,"../drawing":246,"./constants":286,"./defaults":287,"./helpers":289,"./shape_defaults":291,"fast-isnumeric":12}],289:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var i,a=t._fullLayout._size;if(e){var o=n.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=n.decodeDate(i))}else i=r?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},n.getPixelToData=function(t,e,r){var i,a=t._fullLayout._size;if(e){var o=n.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=r?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],290:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":284,"./calc_autorange":285,"./defaults":287,"./draw":288}],291:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,n,s,l){function u(n,i){return r.coerce(t,e,a,n,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var f=t.path?"path":"rect",h=u("type",f),d=["x","y"],p=0;p<2;p++){var m=d[p],g={_fullLayout:n},v=i.coerceRef(t,e,g,m,"","paper");if("path"!==h){var y,x,_,b=.25,w=.75;"paper"!==v?(y=i.getFromId(g,v),_=o.rangeToShapePosition(y),x=o.shapePositionToRange(y)):x=_=r.identity;var M=m+"0",k=m+"1",A=t[M],S=t[k];t[M]=x(t[M],!0),t[k]=x(t[k],!0),i.coercePosition(e,g,u,v,M,b),i.coercePosition(e,g,u,v,k,w),e[M]=_(e[M]),e[k]=_(e[k]),t[M]=A,t[k]=S}}return"path"===h?u("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":316,"../../plots/cartesian/axes":343,"./attributes":284,"./helpers":289}],292:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},r,{})},font:a({},r,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":312,"../../plots/animation_attributes":339,"../../plots/font_attributes":363,"../../plots/pad_attributes":373,"./constants":293}],293:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],294:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}var o=i(t,e),l=r("visible",o.length>0);if(l){r("active"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),a.coerceFont(r,"font",n.font);var u=r("currentvalue.visible");u&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),a.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function i(t,e){function n(t,e){return a.coerce(r,i,c,t,e)}for(var r,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*E.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+E.stepInset+(t.inputAreaLength-2*E.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-E.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*E.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+E.railTouchRectClass).data([0]);r.enter().append("rect").classed(E.railTouchRectClass,!0).call(d,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,E.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),k.setTranslate(r,0,n.currentValueTotalHeight)}function _(t,e){var n=t.selectAll("rect."+E.railRectClass).data([0]);n.enter().append("rect").classed(E.railRectClass,!0);var r=e.inputAreaLength-2*E.railInset;n.attr({width:r,height:E.railWidth,rx:E.railRadius,ry:E.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(n,E.railInset,.5*(e.inputAreaWidth-E.railWidth)+e.currentValueTotalHeight)}function b(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(s.enter().append("g").classed(E.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&b(t),0!==n.length){var l=s.selectAll("g."+E.groupClassName).data(n,i);l.enter().append("g").classed(E.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,E.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+d+")")}}}function p(){T=0,z=!0,E=I,M._infolayer.select("."+e).attr({"data-unformatted":E}).text(E).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var m=n.propContainer,g=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},_=n.attributes,b=n.transform,w=n.containerGroup,M=t._fullLayout,k=m.titlefont.family,A=m.titlefont.size,S=m.titlefont.color,T=1,z=!1,E=m.title.trim();""===E&&(T=0),E.match(/Click to enter .+ title/)&&(T=.2,z=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var L=w.selectAll("text").data([0]);L.enter().append("text"),L.text(E).attr("class",e),L.attr({"data-unformatted":E}).call(f);var I="Click to enter "+y+" title";t._context.editable?(E||p(),L.call(c.makeEditable).on("edit",function(e){void 0!==v?a.restyle(t,g,e,v):a.relayout(t,g,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(_).selectAll("tspan.line").attr(_)})):E&&!E.match(/Click to enter .+ title/)||L.remove(),L.classed("js-placeholder",z)}},{"../../lib":316,"../../lib/svg_text_utils":328,"../../plotly":338,"../../plots/plots":374,"../color":223,"../drawing":246,d3:8,"fast-isnumeric":12}],298:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":312,"../../plots/font_attributes":363,"../../plots/pad_attributes":373,"../color/attributes":222}],299:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],300:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}var o=i(t,e),l=r("visible",o.length>0);l&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),a.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function i(t,e){function n(t,e){return a.coerce(r,i,c,t,e)}for(var r,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==n.length){var c=u.selectAll("g."+S.headerGroupClassName).data(n,i);c.enter().append("g").classed(S.headerGroupClassName,!0);var f=u.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(v).attr(S.menuIndexAttrName,"-1"),c.exit().each(function(e){x.select(this).remove(),f.call(v).attr(S.menuIndexAttrName,"-1"),_.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],305:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],306:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":221,"./components/images":258,"./components/legend":266,"./components/rangeselector":278,"./components/rangeslider":283,"./components/shapes":290,"./components/sliders":296,"./components/updatemenus":302,"./fonts/mathjax_config":307,"./lib/queue":324,"./plot_api/plot_schema":332,"./plot_api/register":333,"./plot_api/set_plot_config":334,"./plot_api/to_image":336,"./plot_api/validate":337,"./plotly":338,"./snapshot":387,"./snapshot/download":384,"./traces/scatter":403,d3:8,"es6-promise":10}],307:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],308:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),r(t)?Number(t):i}},{"../constants/numerical":303,"fast-isnumeric":12}],309:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,i){!r(t)||void 0!==i.min&&ti.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,i){t%1||!r(t)||void 0!==i.min&&ti.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var i="number"==typeof t;r.strict!==!0&&i?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){i(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(a(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!s.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,r,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var m=u.length;if(m>3||3!==m&&s[1]||!m)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var g=(new Date).getFullYear();e=((Number(u[0])-g+70)%100+200)%100+g-70}if(!a(e))return l;var v=new Date(0,0,1);if(v.setFullYear(c?e:-e),u.length>1){if(r=Number(u[1])-1,u[1].length>2||!(r>=0&&r<=11))return l;if(v.setMonth(r),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(v.setDate(i),v.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(v.setHours(o),v.getHours()!==o)return l;if(u.length>1)return i=v.getTime(),r=Number(u[1]),2===u[1].length&&r>=0&&r<=59?(i+=f*r,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return v.getTime()},d=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==l};var m=90*u,g=3*c,v=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var n=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(n),o=e0&&(r.push(i),i=[])}return r.push(i),r},n.makeLine=function(t,e){var n={};return n=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(n.trace=e),n},n.makePolygon=function(t,e){var n={};if(1===t.length)n={type:"Polygon",coordinates:t};else{for(var r=new Array(t.length),i=0;in?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},i.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,n))/Math.log(r),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,n/i))/Math.log(r)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,n)?t(e,n,r):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(n=0;n=s&&(i-=s*Math.floor(i/s)),i<0?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[r];c[n]=a}return c},i.syncOrAsync=function(t,e,n){function r(){return i.syncOrAsync(t,e,n)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(r).then(void 0,i.promiseError);return n&&n(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,n){if(t){var r,i,a=!1,o=!0;for(r=0;r0?[0]:[]);if(s.enter().append("g").classed(E.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&b(t),0!==n.length){var l=s.selectAll("g."+E.groupClassName).data(n,i);l.enter().append("g").classed(E.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,E.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+d+")")}}}function p(){T=0,z=!0,E=I,M._infolayer.select("."+e).attr({"data-unformatted":E}).text(E).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var m=n.propContainer,g=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},_=n.attributes,b=n.transform,w=n.containerGroup,M=t._fullLayout,k=m.titlefont.family,A=m.titlefont.size,S=m.titlefont.color,T=1,z=!1,E=m.title.trim();""===E&&(T=0),E.match(/Click to enter .+ title/)&&(T=.2,z=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var L=w.selectAll("text").data([0]);L.enter().append("text"),L.text(E).attr("class",e),L.attr({"data-unformatted":E}).call(f);var I="Click to enter "+y+" title";t._context.editable?(E||p(),L.call(c.makeEditable).on("edit",function(e){void 0!==v?a.restyle(t,g,e,v):a.relayout(t,g,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(_).selectAll("tspan.line").attr(_)})):E&&!E.match(/Click to enter .+ title/)||L.remove(),L.classed("js-placeholder",z)}},{"../../lib":316,"../../lib/svg_text_utils":328,"../../plotly":338,"../../plots/plots":374,"../color":223,"../drawing":246,d3:8,"fast-isnumeric":12}],298:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":312,"../../plots/font_attributes":363,"../../plots/pad_attributes":373,"../color/attributes":222}],299:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],300:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}var o=i(t,e),l=r("visible",o.length>0);l&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),a.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function i(t,e){function n(t,e){return a.coerce(r,i,c,t,e)}for(var r,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==n.length){var c=u.selectAll("g."+S.headerGroupClassName).data(n,i);c.enter().append("g").classed(S.headerGroupClassName,!0);var f=u.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(v).attr(S.menuIndexAttrName,"-1"),c.exit().each(function(e){x.select(this).remove(),f.call(v).attr(S.menuIndexAttrName,"-1"),_.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],305:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],306:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":221,"./components/images":258,"./components/legend":266,"./components/rangeselector":278,"./components/rangeslider":283,"./components/shapes":290,"./components/sliders":296,"./components/updatemenus":302,"./fonts/mathjax_config":307,"./lib/queue":324,"./plot_api/plot_schema":332,"./plot_api/register":333,"./plot_api/set_plot_config":334,"./plot_api/to_image":336,"./plot_api/validate":337,"./plotly":338,"./snapshot":387,"./snapshot/download":384,"./traces/scatter":403,d3:8,"es6-promise":10}],307:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],308:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),r(t)?Number(t):i}},{"../constants/numerical":303,"fast-isnumeric":12}],309:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,i){!r(t)||void 0!==i.min&&ti.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,i){t%1||!r(t)||void 0!==i.min&&ti.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var i="number"==typeof t;r.strict!==!0&&i?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){i(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(a(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!s.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,r,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var m=u.length;if(m>3||3!==m&&s[1]||!m)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var g=(new Date).getFullYear();e=((Number(u[0])-g+70)%100+200)%100+g-70}if(!a(e))return l;var v=new Date(0,0,1);if(v.setFullYear(c?e:-e),u.length>1){if(r=Number(u[1])-1,u[1].length>2||!(r>=0&&r<=11))return l;if(v.setMonth(r),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(v.setDate(i),v.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(v.setHours(o),v.getHours()!==o)return l;if(u.length>1)return i=v.getTime(),r=Number(u[1]),2===u[1].length&&r>=0&&r<=59?(i+=f*r,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return v.getTime()},d=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==l};var m=90*u,g=3*c,v=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var n=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(n),o=e0&&(r.push(i),i=[])}return r.push(i),r},n.makeLine=function(t,e){var n={};return n=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(n.trace=e),n},n.makePolygon=function(t,e){var n={};if(1===t.length)n={type:"Polygon",coordinates:t};else{for(var r=new Array(t.length),i=0;in?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},i.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,n))/Math.log(r),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,n/i))/Math.log(r)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,n)?t(e,n,r):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(n=0;n=s&&(i-=s*Math.floor(i/s)),i<0?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[r];c[n]=a}return c},i.syncOrAsync=function(t,e,n){function r(){return i.syncOrAsync(t,e,n)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(r).then(void 0,i.promiseError);return n&&n(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,n){if(t){var r,i,a=!1,o=!0;for(r=0;r1?i+o[1]:"";if(a&&(o.length>1||s.length>4||n))for(;r.test(s);)s=s.replace(r,"$1"+a+"$2");return s+l}},{"./clean_number":308,"./coerce":309,"./dates":310,"./extend":312,"./filter_unique":313,"./filter_visible":314,"./is_array":317,"./is_plain_object":318,"./loggers":319,"./matrix":320,"./nested_property":321,"./notifier":322,"./search":325,"./stats":327,d3:8}],317:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],318:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],319:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],o=!1,h(r))for(n=r.length-1;n>=0;n--)u(r[n])?o?r[n]=void 0:r.pop():o=!0;else if("object"==typeof r&&null!==r)for(a=Object.keys(r),o=!1,n=a.length-1;n>=0;n--)u(r[a[n]])&&!i(r[a[n]],a[n])?delete r[a[n]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,i,o,s=0,l=e.split(".");sa||rs)&&(!e||!u(t))}function n(t,e){var n=t[0],l=t[1];if(na||ls)return!1;var u,c,f,h,d,p=r.length,m=r[0][0],g=r[0][1],v=0;for(u=1;uMath.max(c,m)||l>Math.max(f,g)))if(lc||Math.abs(r(o,h))>i)return!0;return!1};i.filter=function(t,e){function n(n){t.push(n);var s=r.length,l=i;r.splice(o+1);for(var u=l+1;u1){var s=t.pop();n(s)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":320}],324:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");n.findBin=function(t,e,n){if(s(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?n?r:i:n?o:a;f90&&l.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,i=e[r]-e[0]||1,a=i/(r||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}},n.roundUp=function(t,e,n){for(var r,i=0,a=e.length-1,o=0,s=n?0:1,l=n?1:0,u=n?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":12}],328:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,n){var r="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),n();else{var r=a.select("svg").node().getBoundingClientRect();n(a.select(".MathJax_SVG"),e,r)}a.remove()})}function o(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),i=m[r];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,g.indexOf(c.protocol)===-1?"":''}if("br"===r)return"
";if(a)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))r.push(i);var a=0;r.forEach(function(t){for(var n=t+a,r=e.slice(0,n),i="",o=r.length-1;o>=0;o--){var s=r[o].match(/<(\/?).*>/i);if(s&&"
"!==r[o]){s[1]||(i=r[o]);break}}i&&(e.splice(n+1,0,i),e.splice(n,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,n){var r,i,a,o=n.horizontalAlign,s=n.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-r.height}:"middle"===s?function(){return l.top+(l.height-r.height)/2}:function(){return l.top},a="right"===o?function(){return l.right-r.width}:"center"===o?function(){return l.left+(l.width-r.width)/2}:function(){return l.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(h.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var m=t.node();m&&m.removeAttribute;m=m.parentNode)m.removeAttribute("data-bb");if(l){var g=h.getPlotDiv(s.node());(g&&g._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return n(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=r(l,"width"),h=r(l,"height"),m=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],g=parseInt(s.style("font-size"),10)||r(s,"height"),v=-g/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,v-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:v-h/2}):"a"===p[0]?l.attr({x:0,y:v}):l.attr({x:m,y:+s.attr("y")+v-h/2}),e&&e.call(s,u),t(u)})}))}else n();return t}};var m={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},g=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:n.fill||o.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||o.attr("data-unformatted")).call(c(o,e,n)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}n||(n={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),n.immediate?r():u.on("click",r),f.rebind(this,s,"on")}},{"../constants/string_mappings":304,"../constants/xmlns_namespaces":305,"../lib":316,d3:8}],329:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function i(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function a(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var o=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),l=t("../registry"),u=t("../lib"),c=t("../plots/plots"),f=t("../plots/cartesian/axes"),h=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var i=f.list({_fullLayout:t});for(e=0;e3?(g.x=1.02,g.xanchor="left"):g.x<-2&&(g.x=-.02,g.xanchor="right"),g.y>3?(g.y=1.02,g.yanchor="bottom"):g.y<-2&&(g.y=-.02,g.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=c.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||i<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(i,r+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 "+n+" must be unique.")}}function l(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&s(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,n){var r,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&lI.range[0]?[1,2]:[2,1]);else{var D=I.range[0],P=I.range[1];"log"===_?(D<=0&&P<=0&&n(T+".autorange",!0),D<=0?D=P/1e6:P<=0&&(P=D/1e6),n(T+".range[0]",Math.log(D)/Math.LN10),n(T+".range[1]",Math.log(P)/Math.LN10)):(n(T+".range[0]",Math.pow(10,D)),n(T+".range[1]",Math.pow(10,P)))}else n(T+".autorange",!0)}if("reverse"===A)z.range?z.range.reverse():(n(T+".autorange",!0),z.range=[1,0]),E.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var C=v.parts[1],O=v.parts[0],F=a[O]||[],R=F[C]||{};2===v.parts.length&&(null===_&&(e[g]="remove"),"add"===e[g]||x.isPlainObject(e[g])?m[g]="remove":"remove"===e[g]?C===-1?(m[O]=F,delete m[g]):m[g]=R:x.log("???",e)),!r(R,"x")&&!r(R,"y")||x.containsAny(g,["color","opacity","align","dash"])||(d.docalc=!0);var j=w.getComponentMethod(O,"drawOne");j(t,C,v.parts.slice(2).join("."),e[g]),delete e[g]}else if(M.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])L.manageArrayContainers(v,_,m),d.doplot=!0;else{var N=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?d.doplot=!0:0===v.parts[0].indexOf("geo")?d.doplot=!0:0===v.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===g?d.doplot=!0:!o._has("gl2d")||g.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===g?d.docalc=!0:v.parts[0].indexOf("legend")!==-1?d.dolegend=!0:g.indexOf("title")!==-1?d.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(N,["tick","exponent","grid","zeroline"])?d.doticks=!0:g.indexOf(".linewidth")!==-1&&g.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:v.parts.length>1&&N.indexOf("line")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&"mirror"===N?d.doticks=d.dolayoutstyle=!0:"margin.pad"===g?d.doticks=d.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||g.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(g)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(g)===-1&&(d.doplot=!0):d.doplot=!0,v.set(_)}}}var B=t._fullLayout.width,q=t._fullLayout.height;M.supplyDefaults(t),t.layout.autosize&&M.plotAutoSize(t,t.layout,t._fullLayout);var V=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==q;return V&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:m,redoit:p,eventData:x.extendDeep({},p)}}function m(t){var e=g.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];g.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(z.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var i=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=i.append("g").classed("imagelayer",!0),n._shapeLowerLayer=i.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var a=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=a.append("g").classed("imagelayer",!0),n._shapeUpperLayer=a.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var g=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),_=t("../lib/events"),b=t("../lib/queue"),w=t("../registry"),M=t("../plots/plots"),k=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),S=t("../components/drawing"),T=t("../components/errorbars"),z=t("../constants/xmlns_namespaces"),E=t("../lib/svg_text_utils"),L=t("./helpers"),I=t("./subroutines");y.plot=function(t,e,n,r){function o(){if(b)return y.addFrames(t,b)}function s(){for(var e=D._basePlotModules,n=0;n=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=L.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),n=M.supplyAnimationDefaults(n);var s=n.transition,l=n.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function m(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var g,v,y=0,_=[],b=void 0===e||null===e,w=Array.isArray(e),k=!b&&!w&&x.isPlainObject(e);if(k)_.push({type:"object",data:m(x.extendFlat({},e))});else if(b||"string"==typeof e)for(g=0;g0&&T<_.length-1){var z=[];for(g=0;g<_.length;g++)v=_[g],("byname"!==_[g].type||g>T)&&z.push(v);_=z}}_.length>0?f(_):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,n){if(t=L.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(r=e.length-1;r>=0;r--)c.push({frame:M.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:u+r});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(i=c[r].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;n--)r=e[n],a.push({type:"delete",index:r}),o.unshift({type:"insert",index:r,value:i[r]});var s=M.modifyFrames,l=M.modifyFrames,u=[t,o],c=[t,a];return b&&b.add(t,s,u,l,c),M.modifyFrames(t,a)},y.purge=function(t){t=L.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return M.cleanPlot([],{},n,e),M.purge(t),_.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":246,"../components/errorbars":252,"../constants/xmlns_namespaces":305,"../lib":316,"../lib/events":311,"../lib/queue":324,"../lib/svg_text_utils":328,"../plotly":338,"../plots/cartesian/graph_interact":350,"../plots/plots":374,"../plots/polar":377,"../registry":382,"./helpers":329,"./subroutines":335,d3:8,"fast-isnumeric":12}],331:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],332:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:y},n={}):(e=h.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,b(r,p),b(r,e.attributes),n.attributes&&b(r,n.attributes),r.type=t;var i={meta:e.meta||{},attributes:o(r)};if(e.layoutAttributes){var a={};b(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return b(t,m),Object.keys(h.subplotsRegistry).forEach(function(e){var n=h.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)c(t,n,"xaxis"),c(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;c(t,n,r)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.layoutAttributes&&(Array.isArray(n.layoutNodes)?n.layoutNodes.forEach(function(e){f(t,n,e+n.name)}):f(t,n,n.name))}),{layoutAttributes:o(t)}}function a(t){var e=h.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function r(t,r,i){n.isValObject(t)?"data_array"===t.valType?(t.role="data",i[r+"src"]=e(r)):t.arrayOk===!0&&(i[r+"src"]=e(r)):d.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function l(t){function e(t,e,n){if(t){var r=t[M];r&&(delete t[M],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function u(t){return _(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),_(t,x.layout),t}function c(t,e,n){var r=d.nestedProperty(t,n),i=b({},e.layoutAttributes);i[w]=!0,r.set(i)}function f(t,e,n){var r=d.nestedProperty(t,n),i=b(r.get()||{},e.layoutAttributes);r.set(i)}var h=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),m=t("../plots/layout_attributes"),g=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),_=d.extendFlat,b=d.extendDeep,w="_isSubplotObj",M="_isLinkedToArray",k="_deprecated",A=[w,M,k];n.IS_SUBPLOT_OBJ=w,n.IS_LINKED_TO_ARRAY=M,n.DEPRECATED=k,n.UNDERSCORE_ATTRS=A,n.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:A.concat.role},traces:t,layout:i(),transforms:e,frames:o(g),animation:o(v)}},n.crawl=function(t,e,r){var i=r||0;Object.keys(t).forEach(function(r){var a=t[r];A.indexOf(r)===-1&&(e(a,r,t,i),n.isValObject(a)||d.isPlainObject(a)&&n.crawl(a,e,i+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,o,s){a=a.slice(0,s).concat([n]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=r(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function r(t){return t.join(".")}var i=[],a=[];if(n.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};h(e.width)&&h(e.height)||r(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var m=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(m).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=r},{"../lib":316,"../plotly":338,"../snapshot/cloneplot":383,"../snapshot/helpers":386,"../snapshot/svgtoimg":388,"../snapshot/tosvg":390,"fast-isnumeric":12}],337:[function(t,e,n){"use strict";function r(t,e,n,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,g=n.length,v=0;vc&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=L&&i<=10||e>=15*L)t._tickround="d";else if(e>=D&&i<=16||e>=I)t._tickround="M";else if(e>=P&&i<=19||e>=D)t._tickround="S";else{var a=b.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(x(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var n=t.match(Y),r=new Date(e);if(n){var i=Math.min(+n[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,a))(r)}return y.time.format(t)(r)}function s(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function l(t,e,n,r){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);n&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(r&&(x(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=V(c):"m"===l?a=U(c):"d"===l?(n||(i="
"+V(c)),a=G(c)):(n||(i="
"+H(c)),a=Z(c),"M"!==l?(a+=X(c),"S"!==l&&(a+=h(y.round(v(s/1e3,1),4),t,"none",n).substr(1))):"d"===u&&(a=G(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,n,r,i){var a=t.dtick,o=e.x;if(!r||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,r);else if(x(a)||"D"===a.charAt(0)&&v(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,v(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,r)}function h(t,e,n,r){var i=t<0,o=e._tickround,s=n||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+m:"E"===s?t+="E"+m:"power"===s?t+="\xd710"+m+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=W[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var n,r,i=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},C.getAutoRange=function(t){var e,n=[],r=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(r===i){var m=r-1,g=r+1;n="tozero"===t.rangemode?r<0?[m,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,m),Math.max(0,g)]:[m,g]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),n=[l.val-h*l.pad,u.val+h*u.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),d&&n.reverse(),n.map(t.l2r||Number)},C.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=C.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},C.saveRangeInitial=function(t,e){for(var n=C.list(t,"",!0),r=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(r(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,m,g=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),_=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),b=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),M=r(n.vpadminus||n.vpad);for(a=0;a<6;a++)i(a);for(a=g-1;a>5;a--)i(a)}},C.autoBin=function(t,e,n,r){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=b.aggNums(Math.min,null,t),o=b.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(n)s=(o-a)/n;else{var l=b.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*b.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*b.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},C.autoTicks(f,s);var h,d=C.tickIncrement(C.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,m=0,g=0,v=0,y=0;y.3*_||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&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),a(t),t._tmin=C.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=C.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),f=0;fz?(e/=z,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,n,F)):r>E?(e/=E,t.dtick="M"+i(e,1,R)):r>L?(t.dtick=i(e,L,N),t.tick0="2000-01-02"):r>I?t.dtick=i(e,I,R):r>D?t.dtick=i(e,D,j):r>P?t.dtick=i(e,P,j):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,F))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,n,F)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,F));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},C.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var i=e.charAt(0),a=r*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?q:B,l=t+.01*r,u=b.roundUp(v(l,1),s,n);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},C.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]a:f1&&e1)};h(e.width)&&h(e.height)||r(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var m=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(m).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=r},{"../lib":316,"../plotly":338,"../snapshot/cloneplot":383,"../snapshot/helpers":386,"../snapshot/svgtoimg":388,"../snapshot/tosvg":390,"fast-isnumeric":12}],337:[function(t,e,n){"use strict";function r(t,e,n,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,g=n.length,v=0;vc&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=L&&i<=10||e>=15*L)t._tickround="d";else if(e>=D&&i<=16||e>=I)t._tickround="M";else if(e>=P&&i<=19||e>=D)t._tickround="S";else{var a=b.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(x(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var n=t.match(Y),r=new Date(e);if(n){var i=Math.min(+n[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,a))(r)}return y.time.format(t)(r)}function s(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function l(t,e,n,r){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);n&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(r&&(x(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=V(c):"m"===l?a=U(c):"d"===l?(n||(i="
"+V(c)),a=G(c)):(n||(i="
"+H(c)),a=Z(c),"M"!==l?(a+=X(c),"S"!==l&&(a+=h(y.round(v(s/1e3,1),4),t,"none",n).substr(1))):"d"===u&&(a=G(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,n,r,i){var a=t.dtick,o=e.x;if(!r||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,r);else if(x(a)||"D"===a.charAt(0)&&v(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,v(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,r)}function h(t,e,n,r){var i=t<0,o=e._tickround,s=n||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+m:"E"===s?t+="E"+m:"power"===s?t+="\xd710"+m+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=W[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var n,r,i=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},C.getAutoRange=function(t){var e,n=[],r=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(r===i){var m=r-1,g=r+1;n="tozero"===t.rangemode?r<0?[m,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,m),Math.max(0,g)]:[m,g]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),n=[l.val-h*l.pad,u.val+h*u.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),d&&n.reverse(),n.map(t.l2r||Number)},C.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=C.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},C.saveRangeInitial=function(t,e){for(var n=C.list(t,"",!0),r=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(r(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,m,g=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),_=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),b=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),M=r(n.vpadminus||n.vpad);for(a=0;a<6;a++)i(a);for(a=g-1;a>5;a--)i(a)}},C.autoBin=function(t,e,n,r){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=b.aggNums(Math.min,null,t),o=b.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(n)s=(o-a)/n;else{var l=b.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*b.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*b.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},C.autoTicks(f,s);var h,d=C.tickIncrement(C.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,m=0,g=0,v=0,y=0;y.3*_||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&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),a(t),t._tmin=C.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=C.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),f=0;fz?(e/=z,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,n,F)):r>E?(e/=E,t.dtick="M"+i(e,1,R)):r>L?(t.dtick=i(e,L,N),t.tick0="2000-01-02"):r>I?t.dtick=i(e,I,R):r>D?t.dtick=i(e,D,j):r>P?t.dtick=i(e,P,j):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,F))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,n,F)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,F));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},C.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var i=e.charAt(0),a=r*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?q:B,l=t+.01*r,u=b.roundUp(v(l,1),s,n);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},C.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]a:f1&&e2*r}function a(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,i=0,a=0;a2*r}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":303,"../../lib":316,"fast-isnumeric":12}],345:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var s=o(e,n,r);if(s){if("histogram"===s.type&&r==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,r)){for(var l,c=i(s),f=[],h=0;h0;a&&(r="array");var o=n("categoryorder",r);"array"===o&&n("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],348:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],349:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],i=Math.abs(r-t.range[1-e]);return"date"===t.type?r:"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(n)+"g")(r))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),m=t("../../lib/setcursor"),g=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),_=!0;e.exports=function(t,e,n,s,b,w,M,k){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+mt+", "+gt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+mt+", "+gt+")").attr("d","M0,0Z"),z()}function z(){pt.selectAll(".select-outline").remove()}function E(e,n){if(t._transitioningWithDuration)return!1;var r=Math.max(0,Math.min(U,e+at)),i=Math.max(0,Math.min(G,n+ot)),a=Math.abs(r-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,Z)/2);st.l=Math.min(at,r),st.r=Math.max(at,r),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!K||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function L(t,e,n){var r,i,a;for(r=0;rzoom back out","long"),_=!1)))}function D(e,n){var i=1===(M+k).length;if(e)R();else if(2!==n||i){if(1===n&&i){var a=M?V[0]:q[0],o="s"===M||"w"===k?0:1,s=a._name+".range["+o+"]",l=r(a,o),c="left",f="middle";if(a.fixedrange)return;M?(f="n"===M?"top":"bottom","right"===a.side&&(c="right")):"e"===k&&(c="right"),nt.call(h.makeEditable,null,{immediate:!0,background:N.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var n=a.d2r(e);void 0!==n&&u.relayout(t,s,n)})}}else F()}function P(e){function n(t,e,n){function r(e){return t.l2r(a+(e-a)*n)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(r)}}if(t._context.scrollZoom||N._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(S(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void f.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=_t.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=vt[0]+vt[2]*l,c=(s.bottom-e.clientY)/s.height,h=vt[1]+vt[3]*(1-c);if(k){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,n){for(var r,a,o=1-e,s=0;s0;r--)n.push(e);return n}function i(t,e){for(var n=[],r=0;rY.width||X<0||X>Y.height)return b.unhoverRaw(t,e)}else Z="xpx"in e?e.xpx:k[0]._length/2,X="ypx"in e?e.ypx:A[0]._length/2;if(I="xval"in e?r(a,e.xval):i(k,Z),D="yval"in e?r(a,e.yval):i(A,X),!m(I[0])||!m(D[0]))return g.warn("Fx.hover failed",e,t),b.unhoverRaw(t,e)}var W=1/0;for(C=0;C1||F.hoverinfo.indexOf("name")!==-1?F.name:void 0,index:!1,distance:Math.min(W,M.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[R]&&(V.subplot=o[R]._subplot),U=G.length,"array"===N){var Q=e[C];"pointNumber"in Q?(V.index=Q.pointNumber,N="closest"):(N="","xval"in Q&&(B=Q.xval,N="x"),"yval"in Q&&(q=Q.yval,N=N?"closest":"y"))}else B=I[j],q=D[j];if(F._module&&F._module.hoverPoints){var J=F._module.hoverPoints(V,B,q,N);if(J)for(var $,K=0;KU&&(G.splice(0,U),W=G[0].distance)}if(0===G.length)return b.unhoverRaw(t,e);var tt="y"===L&&H.length>1;G.sort(function(t,e){return t.distance-e.distance});var et=x.combine(o.plot_bgcolor||x.background,o.paper_bgcolor),nt={hovermode:L,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},rt=u(G,nt);c(G,tt?"xa":"ya"),f(rt,tt);var it=t._hoverdata,at=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,n=c.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[i+"Label"]===m?r=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",u).call(_.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(_.setPosition,0,0);var h=e.select("text.name"),g=0;n&&n!==r?(h.style("fill",l).text(n).call(_.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(_.setPosition,0,0),g=h.node().getBoundingClientRect().width+2*P):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var v,M,S=f.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,E=t.ya._offset+(t.y0+t.y1)/2,L=Math.abs(t.x1-t.x0),I=Math.abs(t.y1-t.y0),C=S.width+D+P+g;t.ty0=b-S.top,t.bx=S.width+2*P,t.by=S.height+2*P,t.anchor="start",t.txwidth=S.width,t.tx2width=g,t.offset=0,a?(t.pos=z,v=E+I/2+C<=k,M=E-I/2-C>=0,"top"!==t.idealAlign&&v||!M?v?(E+=I/2,t.anchor="start"):t.anchor="middle":(E-=I/2,t.anchor="end")):(t.pos=E,v=z+L/2+C<=w,M=z-L/2-C>=0,"left"!==t.idealAlign&&v||!M?v?(z+=L/2,t.anchor="start"):t.anchor="middle":(z-=L/2,t.anchor="end")),f.attr("text-anchor",t.anchor),g&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+E+")"+(a?"rotate("+T+")":""))}),E}function c(t,e){function n(t){var e=t[0],n=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,a=n.pos+n.dp+n.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;r=!1}if(!(a<.01)){if(i<-.01){for(s=t.length-1;s>=0;s--)t[s].dp-=a;r=!1}if(r){var u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var r,i,a,o,s,l,u,c=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?E:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&c<=t.length;){for(c++,r=!0,o=0;o.01&&p.pmin===m.pmin&&p.pmax===m.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;r=!1}else o++}f.forEach(n)}for(o=f.length-1;o>=0;o--){var g=f[o];for(s=g.length-1;s>=0;s--){var v=g[s],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var n=d.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,i=n.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(D+P),s=o+a*(t.txwidth+P),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-I,l=t.offset*L),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*D+l)+","+(D+u)+"v"+(t.by/2-D)+"h"+r*t.bx+"v-"+t.by+"H"+(r*D+l)+"V"+(u-D)+"Z"),i.call(_.setPosition,o+l,u+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(_.setPosition,s+a*P+l,u+t.ty0-t.by/2+P),n.select("rect").call(_.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var i=n[r],a=t._hoverdata[r];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),m=t("fast-isnumeric"),g=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),_=t("../../components/drawing"),b=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),k=t("./dragbox"),A=t("../layout_attributes"),S=e.exports={};S.unhover=b.unhover,S.layoutAttributes={},S.supplyLayoutDefaults=function(t,e,n){function r(n,r){return g.coerce(t,e,A,n,r)}r("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=S.isHoriz(n);i=a?"y":"x"}else i="closest";r("hovermode",i)},S.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+M.HOVERMINTIME?(o(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},S.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||a(e,n):"x"===t?e:n},S.getClosest=function(t,e,n){ if(n.index!==!1)n.index>=0&&n.indexf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":316,"fast-isnumeric":12}],356:[function(t,e,n){"use strict";function r(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,n,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function d(t,e){return t-e}var p,m=i.gd._fullLayout._zoomlayer,g=i.element.getBoundingClientRect(),v=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,x=e-g.left,_=n-g.top,b=x,w=_,M="M"+x+","+_,k=i.xaxes[0]._length,A=i.yaxes[0]._length,S=i.xaxes.map(r),T=i.yaxes.map(r),z=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[x,_]],s.BENDPX));var E=m.selectAll("path.select-outline").data([1,2]);E.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",M+"Z");var L,I,D,P,C,O=m.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),F=[],R=i.gd,j=[];for(L=0;L0)return Math.log(e)/Math.LN10;if(e<=0&&n&&t.range&&2===t.range.length){var r=t.range[0],i=t.range[1];return.5*(r+i-3*f*Math.abs(r-i))}return l}function n(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var f=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?n:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var n,r,o=t[e],l=(t._id||"x").charAt(0);if(r="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,r=r.slice(),!o||2!==o.length)return void(t[e]=r);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),n=0;n<2;n++)if("date"===t.type){if(!a.isDateTime(o[n])){t[e]=r;break}if(o[n]a.MAX_MS&&(o[n]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[n])){if(!i(o[1-n])){t[e]=r;break}o[n]=o[1-n]*(n?10:.1)}if(o[n]<-s?o[n]=-s:o[n]>s&&(o[n]=s),o[0]===o[1]){var f=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=f,o[1]+=f}}},t.fraction2r=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return t.l2r(n+e*(r-n))},t.r2fraction=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return(t.r2l(e)-n)/(r-n)},t.setScale=function(e){var n=t._gd._fullLayout._size,r=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===r?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?r.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,n){return t.l2p(t.r2l(e,n))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,n){return t.c2l(t.d2c(e),n)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var n=t._categories.indexOf(e);return n===-1?l:n},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,n){var r,i,a;if(n in e)for(r=e[n],i=new Array(r.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var f=c.charAt(0),h=c.substr(1);h=r(h)?Number(h):0,(h<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=n("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):r(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var m=n("tickvals");void 0===m?e.tickmode="auto":n("ticktext")}}},{"../../constants/numerical":303,"../../lib":316,"fast-isnumeric":12}],361:[function(t,e,n){"use strict";var r=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,n,u){function c(t){var e,n,r,i,a,o={};for(e in t)if(n=e.split("."),r=n[0].match(l)){var s=r[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,x.push(s),o[s]=a}return o}function f(t,e,n){var r,i,a,o=t._plots,s=[];for(r in o){var l=o[r];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=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=n[u]?n[u].to:f,a=n[c]?n[c].to:h,f[0]===i[0]&&f[1]===i[1]&&h[0]===a[0]&&h[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function h(e,n){function r(e,n){for(i=0;in.duration?(m(),S=window.cancelAnimationFrame(v)):S=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],_=c(e),b=Object.keys(_),w=f(y,b,_);if(!w.length)return!1;var M;u&&(M=u());var k,A,S,T=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(S),S=null,g()}),k=Date.now(),S=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":316,"../../plotly":338,"../../registry":382,"./axes":343,d3:8}],362:[function(t,e,n){"use strict";function r(t,e,n){var r,i,a,o=!1;if("data"===e.type)r=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;r=t._fullLayout}return i=u.nestedProperty(r,e.prop).get(),a=n[e.type]=n[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var n=[],r=e[0],i={};if("string"==typeof r)i[r]=e[1];else{if(!u.isPlainObject(r))return n;i=r}return s(i,function(t,e,r){n.push({type:"layout",prop:t,value:r})},"",0),n}function o(t,e){var n,r,i,a,o=[];if(r=e[0],i=e[1],n=e[2],a={},"string"==typeof r)a[r]=i;else{if(!u.isPlainObject(r))return o;a=r,void 0===n&&(n=i)}return void 0===n&&(n=null),s(a,function(e,r,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);n&&(s=Math.min(s,n.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,r+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");n.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=n.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){r(t,l,o.cache),o.check=function(){if(s){var e=r(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f0}function a(t){var e={},n={};switch(t.type){case"circle":s.extendFlat(n,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":s.extendFlat(n,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":s.extendFlat(n,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var r=t.symbol,i=l(r.textposition,r.iconsize); s.extendFlat(e,{"icon-image":r.icon+"-15","icon-size":r.iconsize/10,"text-field":r.text,"text-size":r.textfont.size,"text-anchor":i.anchor,"text-offset":i.offset}),s.extendFlat(n,{"icon-color":t.color,"text-color":r.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:n}}function o(t){var e,n=t.sourcetype,r=t.source,i={type:n},a="string"==typeof r;return"geojson"===n?e="data":"vector"===n&&(e=a?"url":"tiles"),i[e]=r,i}var s=t("../../lib"),l=t("./convert_text_opts"),u=r.prototype;u.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)&&this.updateLayer(t):(this.updateSource(t),this.updateLayer(t)),this.updateStyle(t),this.visible=i(t)},u.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},u.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},u.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,i(t)){var n=o(t);e.addSource(this.idSource,n)}},u.updateLayer=function(t){var e=this.map;if(e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,i(t)){e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type},t.below);var n={visibility:"visible"};this.mapbox.setOptions(this.idLayer,"setLayoutProperty",n)}},u.updateStyle=function(t){var e=a(t);i(t)&&(this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint))},u.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)},e.exports=function(t,e,n){var i=new r(t,e);return i.update(n),i}},{"../../lib":316,"./convert_text_opts":367}],370:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("../../components/color").defaultLine,a=t("../font_attributes"),o=t("../../traces/scatter/attributes").textposition;e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},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:r.extendDeep({},a,{family:{dflt:"Open Sans Regular, Arial Unicode MS Regular"}}),textposition:r.extendFlat({},o,{arrayOk:!1})}}}},{"../../components/color":223,"../../lib":316,"../../traces/scatter/attributes":393,"../font_attributes":363}],371:[function(t,e,n){"use strict";function r(t,e,n){n("accesstoken"),n("style"),n("center.lon"),n("center.lat"),n("zoom"),n("bearing"),n("pitch"),i(t,e),e._input=t}function i(t,e){function n(t,e){return a.coerce(r,i,s.layers,t,e)}for(var r,i,o=t.layers||[],l=e.layers=[],u=0;u=e.width-20?(a["text-anchor"]="start",a.x=5):(a["text-anchor"]="end",a.x=e._paper.attr("width")-7),n.attr(a);var o=n.select(".js-link-to-tool"),s=n.select(".js-link-spacer"),u=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=l.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=r.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),n._initialAutoSizeIsDone){var u=n.width,f=n.height;p.supplyLayoutGlobalDefaults(a,r),a.width||(r.width=u),a.height||(r.height=f)}else{p.supplyLayoutGlobalDefaults(a,r);var h=!a.width||!a.height,d=r.autosize,m=t._context&&t._context.autosizable,g=h&&(d||m);g?p.plotAutoSize(t,a,r):h&&p.sanitizeMargins(t),!d&&h&&(a.width=r.width,a.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=l.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,r),r._has=p._hasPlotType.bind(r);var v=r._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),f=c.left+c.right,d=c.bottom+c.top,m=1-2*o,g=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(m*(g.width-f)),i=Math.round(m*(g.height-d))}else{var v=l?window.getComputedStyle(t):{};r=parseFloat(v.width)||n.width,i=parseFloat(v.height)||n.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;r1,b=!e.height&&Math.abs(n.height-i)>1;(b||_)&&(_&&(n.width=r),b&&(n.height=i)),t._initialAutoSize||(t._initialAutoSize={width:r,height:i}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n,r){var i,a;c.Axes.supplyLayoutDefaults(t,e,n);var o=e._basePlotModules;for(i=0;i.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+i},r:{val:n.x,size:n.r+i},b:{val:n.y,size:n.b+i},t:{val:n.y,size:n.t+i}}}else delete r._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var n=l[t].l||{},r=l[t].b||{},c=n.val,f=n.size,h=r.val,d=r.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var n=l[t].r.val,r=l[t].r.size;if(n>c){var p=(f*n+(r-e.width)*c)/(n-c),m=(r*(1-c)+(f-e.width)*(1-n))/(n-c);p>=0&&m>=0&&p+m>i+a&&(i=p,a=m)}}if(u(d)&&l[t].t){var g=l[t].t.val,v=l[t].t.size;if(g>h){var y=(d*g+(v-e.height)*h)/(g-h),x=(v*(1-h)+(d-e.height)*(1-g))/(g-h);y>=0&&x>=0&&y+x>s+o&&(s=y,o=x)}}})})),n.l=Math.round(i),n.r=Math.round(a),n.t=Math.round(o),n.b=Math.round(s),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!t._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,n,r,i){function a(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,r,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):h.isJSDate(t)?h.ms2DateTime(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var n=a(t);return e&&delete n.fit,n})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===r?l:JSON.stringify(l)},p.modifyFrames=function(t,e){var n,r,i,a=t._transitionData._frames,o=t._transitionData._frameHash;for(n=0;n0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){b=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(n)for(s=0;s= max) { + return res.substr(0, max); } - while (max > res.length && num > 0) { + while (max > res.length && num > 1) { if (num & 1) { res += str; } num >>= 1; - if (!num) break; str += str; } - return res.substr(0, max); + res += str; + res = res.substr(0, max); + return res; } - },{}],458:[function(require,module,exports){ // Copyright 2014 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) @@ -98515,7 +98519,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.20.0'; +exports.version = '1.20.1'; // inject promise polyfill require('es6-promise').polyfill(); @@ -107784,7 +107788,7 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { // if position is given as a category name, convert it to a number if(typeof pos === 'string' && (ax._categories || []).length) { newPos = ax._categories.indexOf(pos); - containerOut[attr] = (newPos !== -1) ? dflt : newPos; + containerOut[attr] = (newPos === -1) ? dflt : newPos; return; } } @@ -136347,40 +136351,6 @@ module.exports = { ].join(' ') } }, - // 3D attributes commented out until I finish them in a later PR - // tilt: { - // // degrees to tilt the pie back from straight on - // valType: 'number', - // min: 0, - // max: 90, - // dflt: 0 - // }, - // tiltaxis: { - // // degrees away from straight up to tilt the pie - // // only has an effect if tilt is nonzero - // valType: 'number', - // min: -360, - // max: 360, - // dflt: 0 - // }, - // depth: { - // // "3D" size, as a fraction of radius - // // only has an effect if tilt is nonzero - // valType: 'number', - // min: 0, - // max: 10, - // dflt: 0.5 - // }, - // shading: { - // // how much darker to make the sides than the top, - // // with a 3D effect. We could of course get all - // // fancy with lighting effects, but maybe this is - // // sufficient. - // valType: 'number', - // min: 0, - // max: 1, - // dflt: 0.2 - // }, hole: { valType: 'number', role: 'style', diff --git a/dist/plotly.js b/dist/plotly.js index e5b39ffe16a..0bc3a88e5bf 100644 --- a/dist/plotly.js +++ b/dist/plotly.js @@ -1,5 +1,5 @@ /** -* plotly.js v1.20.0 +* plotly.js v1.20.1 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -43548,7 +43548,7 @@ var ndarray = require('ndarray') var nextPow2 = require('bit-twiddle').nextPow2 -var selectRange = require('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_49_arg0_<255||_inline_49_arg1_<255||_inline_49_arg2_<255||_inline_49_arg3_<255){var _inline_49_l=_inline_49_arg4_-_inline_49_arg6_[0],_inline_49_a=_inline_49_arg5_-_inline_49_arg6_[1],_inline_49_f=_inline_49_l*_inline_49_l+_inline_49_a*_inline_49_a;_inline_49_f= max) { + return res.substr(0, max); } - while (max > res.length && num > 0) { + while (max > res.length && num > 1) { if (num & 1) { res += str; } num >>= 1; - if (!num) break; str += str; } - return res.substr(0, max); + res += str; + res = res.substr(0, max); + return res; } - },{}],458:[function(require,module,exports){ // Copyright 2014 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) @@ -97999,7 +98003,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.20.0'; +exports.version = '1.20.1'; // inject promise polyfill require('es6-promise').polyfill(); @@ -107155,7 +107159,7 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { // if position is given as a category name, convert it to a number if(typeof pos === 'string' && (ax._categories || []).length) { newPos = ax._categories.indexOf(pos); - containerOut[attr] = (newPos !== -1) ? dflt : newPos; + containerOut[attr] = (newPos === -1) ? dflt : newPos; return; } } @@ -134807,40 +134811,6 @@ module.exports = { } }, - // 3D attributes commented out until I finish them in a later PR - // tilt: { - // // degrees to tilt the pie back from straight on - // valType: 'number', - // min: 0, - // max: 90, - // dflt: 0 - // }, - // tiltaxis: { - // // degrees away from straight up to tilt the pie - // // only has an effect if tilt is nonzero - // valType: 'number', - // min: -360, - // max: 360, - // dflt: 0 - // }, - // depth: { - // // "3D" size, as a fraction of radius - // // only has an effect if tilt is nonzero - // valType: 'number', - // min: 0, - // max: 10, - // dflt: 0.5 - // }, - // shading: { - // // how much darker to make the sides than the top, - // // with a 3D effect. We could of course get all - // // fancy with lighting effects, but maybe this is - // // sufficient. - // valType: 'number', - // min: 0, - // max: 1, - // dflt: 0.2 - // }, hole: { valType: 'number', diff --git a/dist/plotly.min.js b/dist/plotly.min.js index 0692bb541b9..1bf300214d3 100644 --- a/dist/plotly.min.js +++ b/dist/plotly.min.js @@ -1,5 +1,5 @@ /** -* plotly.js v1.20.0 +* plotly.js v1.20.1 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -21,10 +21,10 @@ return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},i.str=function(t){return"mat2("+t[0] t[14]=-(f*m+d*v+p*y),t[15]=1,t)},i.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},i.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t},i.sub=i.subtract,i.multiplyScalar=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[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t},i.multiplyScalarAndAdd=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[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&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]},i.equals=function(t,e){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],f=t[9],d=t[10],p=t[11],g=t[12],m=t[13],v=t[14],y=t[15],x=e[0],b=e[1],_=e[2],w=e[3],M=e[4],A=e[5],k=e[6],T=e[7],E=e[8],S=e[9],L=e[10],z=e[11],C=e[12],I=e[13],P=e[14],D=e[15];return Math.abs(r-x)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(i-b)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(a-_)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(o-w)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(s-M)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(l-A)<=n.EPSILON*Math.max(1,Math.abs(l),Math.abs(A))&&Math.abs(u-k)<=n.EPSILON*Math.max(1,Math.abs(u),Math.abs(k))&&Math.abs(c-T)<=n.EPSILON*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(h-E)<=n.EPSILON*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(f-S)<=n.EPSILON*Math.max(1,Math.abs(f),Math.abs(S))&&Math.abs(d-L)<=n.EPSILON*Math.max(1,Math.abs(d),Math.abs(L))&&Math.abs(p-z)<=n.EPSILON*Math.max(1,Math.abs(p),Math.abs(z))&&Math.abs(g-C)<=n.EPSILON*Math.max(1,Math.abs(g),Math.abs(C))&&Math.abs(m-I)<=n.EPSILON*Math.max(1,Math.abs(m),Math.abs(I))&&Math.abs(v-P)<=n.EPSILON*Math.max(1,Math.abs(v),Math.abs(P))&&Math.abs(y-D)<=n.EPSILON*Math.max(1,Math.abs(y),Math.abs(D))},e.exports=i},{"./common.js":162}],167:[function(t,e,r){var n=t("./common.js"),i=t("./mat3.js"),a=t("./vec3.js"),o=t("./vec4.js"),s={};s.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.rotationTo=function(){var t=a.create(),e=a.fromValues(1,0,0),r=a.fromValues(0,1,0);return function(n,i,o){var l=a.dot(i,o);return l<-.999999?(a.cross(t,e,i),a.length(t)<1e-6&&a.cross(t,r,i),a.normalize(t,t),s.setAxisAngle(n,t,Math.PI),n):l>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(a.cross(t,i,o),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+l,s.normalize(n,n))}}(),s.setAxes=function(){var t=i.create();return function(e,r,n,i){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],s.normalize(e,s.fromMat3(e,t))}}(),s.clone=o.clone,s.fromValues=o.fromValues,s.copy=o.copy,s.set=o.set,s.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.setAxisAngle=function(t,e,r){r*=.5;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t},s.getAxisAngle=function(t,e){var r=2*Math.acos(e[3]),n=Math.sin(r/2);return 0!=n?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r},s.add=o.add,s.multiply=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*c+o*s+i*u-a*l,t[1]=i*c+o*l+a*s-n*u,t[2]=a*c+o*u+n*l-i*s,t[3]=o*c-n*s-i*l-a*u,t},s.mul=s.multiply,s.scale=o.scale,s.rotateX=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+o*s,t[1]=i*l+a*s,t[2]=a*l-i*s,t[3]=o*l-n*s,t},s.rotateY=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l-a*s,t[1]=i*l+o*s,t[2]=a*l+n*s,t[3]=o*l-i*s,t},s.rotateZ=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*s,t[1]=i*l-n*s,t[2]=a*l+o*s,t[3]=o*l-a*s,t},s.calculateW=function(t,e){var r=e[0],n=e[1],i=e[2];return t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),t},s.dot=o.dot,s.lerp=o.lerp,s.slerp=function(t,e,r,n){var i,a,o,s,l,u=e[0],c=e[1],h=e[2],f=e[3],d=r[0],p=r[1],g=r[2],m=r[3];return a=u*d+c*p+h*g+f*m,a<0&&(a=-a,d=-d,p=-p,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),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*h+l*g,t[3]=s*f+l*m,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(r,n,i,a,o,l){return s.slerp(t,n,o,l),s.slerp(e,i,a,l),s.slerp(r,t,e,2*l*(1-l)),r}}(),s.invert=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-i*s,t[3]=a*s,t},s.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},s.length=o.length,s.len=s.length,s.squaredLength=o.squaredLength,s.sqrLen=s.squaredLength,s.normalize=o.normalize,s.fromMat3=function(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*o+o]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*a+o]-e[3*o+a])*r,t[a]=(e[3*a+i]+e[3*i+a])*r,t[o]=(e[3*o+i]+e[3*i+o])*r}return t},s.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},s.exactEquals=o.exactEquals,s.equals=o.equals,e.exports=s},{"./common.js":162,"./mat3.js":165,"./vec3.js":169,"./vec4.js":170}],168:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},i.fromValues=function(t,e){var r=new n.ARRAY_TYPE(2);return r[0]=t,r[1]=e,r},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},i.set=function(t,e,r){return t[0]=e,t[1]=r,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(r*r+n*n)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1];return e*e+r*r},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},i.cross=function(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t},i.lerp=function(t,e,r,n){var i=e[0],a=e[1];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t},i.transformMat2=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t},i.transformMat2d=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=2),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.cross=function(t,e,r){var n=e[0],i=e[1],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},i.lerp=function(t,e,r,n){var i=e[0],a=e[1],o=e[2];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t},i.hermite=function(t,e,r,n,i,a){var o=a*a,s=o*(2*a-3)+1,l=o*(a-2)+a,u=o*(a-1),c=o*(3-2*a);return t[0]=e[0]*s+r[0]*l+n[0]*u+i[0]*c,t[1]=e[1]*s+r[1]*l+n[1]*u+i[1]*c,t[2]=e[2]*s+r[2]*l+n[2]*u+i[2]*c,t},i.bezier=function(t,e,r,n,i,a){var o=1-a,s=o*o,l=a*a,u=s*o,c=3*a*s,h=3*l*o,f=l*a;return t[0]=e[0]*u+r[0]*c+n[0]*h+i[0]*f,t[1]=e[1]*u+r[1]*c+n[1]*h+i[1]*f,t[2]=e[2]*u+r[2]*c+n[2]*h+i[2]*f,t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI,i=2*n.RANDOM()-1,a=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*a,t[1]=Math.sin(r)*a,t[2]=i*e,t},i.transformMat4=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},i.transformMat3=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},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*a-l*i,h=u*i+l*n-o*a,f=u*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=c*u+d*-o+h*-l-f*-s,t[1]=h*u+d*-s+f*-o-c*-l,t[2]=f*u+d*-l+c*-s-h*-o,t},i.rotateX=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},i.rotateY=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},i.rotateZ=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},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=3),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s1?0:Math.acos(a)},i.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},i.equals=function(t,e){var r=t[0],i=t[1],a=t[2],o=e[0],s=e[1],l=e[2];return Math.abs(r-o)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(a-l)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))},e.exports=i},{"./common.js":162}],170:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.fromValues=function(t,e,r,i){var a=new n.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=r,a[3]=i,a},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.set=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+a*a)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return r*r+n*n+i*i+a*a},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=n*o,t[2]=i*o,t[3]=a*o),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.lerp=function(t,e,r,n){var i=e[0],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},i.random=function(t,e){return e=e||1,t[0]=n.RANDOM(),t[1]=n.RANDOM(),t[2]=n.RANDOM(),t[3]=n.RANDOM(),i.normalize(t,t),i.scale(t,t,e),t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],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},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*a-l*i,h=u*i+l*n-o*a,f=u*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=c*u+d*-o+h*-l-f*-s,t[1]=h*u+d*-s+f*-o-c*-l,t[2]=f*u+d*-l+c*-s-h*-o,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s1.0001)return null;m+=g[c]}return Math.abs(m-1)>.001?null:[h,o(t,g),g]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:36,"polytope-closest-point/lib/closest_point_2d.js":444}],172:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}",i="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat cookTorranceSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution_2_0(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\n\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n \n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular_1_1(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}",a="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}",o="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",u="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}",c="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}",h="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}",f="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}",d="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n";r.meshShader={vertex:n,fragment:i,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:a,fragment:o,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:s,fragment:l,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:h,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:f,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{}],173:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u,c,h,f,d,p,g,m,v,y,x,b,_,w,M,A,k,T){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=a,this.pointPickShader=o,this.contourShader=s,this.trianglePositions=l,this.triangleColors=c,this.triangleNormals=f,this.triangleUVs=h,this.triangleIds=u,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=m,this.edgeUVs=v,this.edgeIds=g,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=x,this.pointColors=_,this.pointUVs=w,this.pointSizes=M,this.pointIds=b,this.pointVAO=A,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=k,this.contourVAO=T,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=O,this._view=O,this._projection=O,this._resolution=[1,1]}function i(t){for(var e=A({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return M(r,[256,256,4],[4,0,1])}function a(t,e,r){for(var n=new Array(e),i=0;i=1},R.isTransparent=function(){return this.opacity<1},R.pickSlots=1,R.setPickBase=function(t){this.pickId=t},R.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=k(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=T.mallocFloat32(6*a),s=0,l=0;l0){var f=this.triShader;f.bind(),f.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var f=this.lineShader;f.bind(),f.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){var f=this.pointShader;f.bind(),f.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}if(this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0){var f=this.contourShader;f.bind(),f.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind()}},R.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||O,n=t.view||O,i=t.projection||O,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={model:r,view:n,projection:i,clipBounds:a,pickId:this.pickId/255},l=this.pickShader;if(l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0){var l=this.pointPickShader;l.bind(),l.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}},R.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;as[A]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=m[n],a.uniforms.angle=v[n],u.drawArrays(u.TRIANGLES,s[A],s[k]-s[A]))),y[n]&&M&&(e[1^n]-=T*d*x[n],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=b[n],a.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,M)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*g[n+2],As[A]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=m[n+2],a.uniforms.angle=v[n+2],u.drawArrays(u.TRIANGLES,s[A],s[k]-s[A]))),y[n+2]&&M&&(e[1^n]+=T*d*x[n+2],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=b[n+2],a.uniforms.angle=_[n+2],u.drawArrays(u.TRIANGLES,w,M))}}(),c.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,i=r.gl,a=r.screenBox,o=r.titleCenter,s=r.titleAngle,l=r.titleColor,u=r.pixelRatio;if(this.titleCount){for(var c=0;c<2;++c)e[c]=2*(o[c]*u-a[c])/(a[2+c]-a[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,a=n._tickBounds,o=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var u=0;u<2;++u){var c=a[u],h=a[u+2],f=h-c,d=.5*(o[u+2]+o[u]),p=o[u+2]-o[u],g=l[u],m=l[u+2],v=m-g,y=s[u],x=s[u+2],b=x-y;e[u]=2*f/p*v/b,t[u]=2*(c-d)/p*v/b}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){var e,r,n,i,a,o=[],l=t.ticks,u=t.bounds;for(a=0;a<2;++a){var c=[Math.floor(o.length/3)],h=[-(1/0)],f=l[a];for(e=0;er)for(t=r;te)for(t=e;t=0){for(var A=0|M.type.charAt(M.type.length-1),k=new Array(A),T=0;T=0;)E+=1;w[x]=E}var S=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,w),Object.defineProperty(d,"uniforms",o(p,d,r,S))},e.exports=a},{"./lib/GLError":181,"./lib/create-attributes":182,"./lib/create-uniforms":183,"./lib/reflect":184,"./lib/runtime-reflect":185,"./lib/shader-cache":186}],181:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="GLError",n.prototype.constructor=n,e.exports=n},{}],182:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}function i(t,e,r,i,a,o,s){for(var l=["gl","v"],u=[],c=0;c=0){var p=f.charCodeAt(f.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);i(t,e,d[0],n,p,o,h)}else{if(!(f.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+h+": "+f);var p=f.charCodeAt(f.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);a(t,e,d,n,p,o,h)}}}return o}e.exports=o;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,a=i._gl,o=i._locations[i._index];a.vertexAttribPointer(o,i._dimension,t||a.FLOAT,!!e,r||0,n||0),a.enableVertexAttribArray(o)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":181}],183:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;n4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(i<2||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],a=t;a+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function h(e){for(var n=["return function updateProperty(obj){"],i=c("",e),o=0;o4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var o=p(i);Object.defineProperty(t,e,{get:n(o),set:h(i),enumerable:!0,configurable:!1})}else a[i]?Object.defineProperty(t,e,{get:l(i),set:h(i),enumerable:!0,configurable:!1}):t[e]=f(r[i].type)}function p(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){l[0]in o||(o[l[0]]=[]),o=o[l[0]];for(var u=1;u1)for(var l=0;l=0){var g=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(g,e[1],g,e[3],d[p],f[p]):o.drawLine(e[0],g,e[2],g,d[p],f[p])}}for(var p=0;p=0;--t)this.objects[t].dispose();this.objects.length=0;for(var t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},f.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},f.removeObject=function(t){for(var e=this.objects,r=0;r0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function o(t){return"boolean"!=typeof t||t}function s(t){function e(){if(!_&&H.autoResize){var t=w.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*H.pixelRatio),i=0|Math.ceil(r*H.pixelRatio);if(n!==w.width||i!==w.height){w.width=n,w.height=i;var a=w.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",j=!0}}}function r(){for(var t=D.length,e=F.length,r=0;r0&&0===R[e-1];)R.pop(),F.pop().dispose()}function s(){return!!H.contextLost||void(A.isContextLost()&&(H.contextLost=!0,H.mouseListener.enabled=!1,H.selection.object=null,H.oncontextloss&&H.oncontextloss()))}function y(){if(!s()){A.colorMask(!0,!0,!0,!0),A.depthMask(!0),A.disable(A.BLEND),A.enable(A.DEPTH_TEST);for(var t=D.length,e=F.length,r=0;rT.distance)continue;for(var u=0;u>>1;for(r=0;r=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}function a(t,e){var r=t.gl,i=s(r),a=s(r),l=o(r,u.pointVertex,u.pointFragment),c=o(r,u.pickVertex,u.pickFragment),h=new n(t,i,a,l,c);return h.update(e),t.addObject(h),h}var o=t("gl-shader"),s=t("gl-buffer"),l=t("typedarray-pool"),u=t("./lib/shader");e.exports=a;var c=n.prototype;c.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},c.update=function(t){function e(e,r){return e in t?t[e]:r}var r;t=t||{},this.sizeMin=e("sizeMin",.5),this.sizeMax=e("sizeMax",20),this.color=e("color",[1,0,0,1]).slice(),this.areaRatio=e("areaRatio",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.blend=e("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,a=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,o=t.positions,s=i?o:l.mallocFloat32(o.length),u=a?t.idToIndex:l.mallocInt32(n);if(i||s.set(o),!a)for(s.set(o),r=0;r>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),a.attributes.pickId.pointer(o.UNSIGNED_BYTE),a.uniforms.pickOffset=e,this.pickOffset=r);var f=o.getParameter(o.BLEND),d=o.getParameter(o.DITHER);return f&&!this.blend&&o.disable(o.BLEND),d&&o.disable(o.DITHER),o.drawArrays(o.POINTS,0,this.pointCount),f&&!this.blend&&o.enable(o.BLEND),d&&o.enable(o.DITHER),r+this.pointCount}}(),c.draw=c.unifiedDraw,c.drawPick=c.unifiedDraw,c.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":190,"gl-buffer":128,"gl-shader":191,"typedarray-pool":496}],199:[function(t,e,r){function n(t,e,r,n){var i,a,o,s,l,u=e[0],c=e[1],h=e[2],f=e[3],d=r[0],p=r[1],g=r[2],m=r[3];return a=u*d+c*p+h*g+f*m,a<0&&(a=-a,d=-d,p=-p,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),t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*h+l*g,t[3]=s*f+l*m,t}e.exports=n},{}],200:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4((posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n",fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4((posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],201:[function(t,e,r){arguments[4][180][0].apply(r,arguments)},{"./lib/GLError":202,"./lib/create-attributes":203,"./lib/create-uniforms":204,"./lib/reflect":205,"./lib/runtime-reflect":206,"./lib/shader-cache":207,dup:180}],202:[function(t,e,r){arguments[4][181][0].apply(r,arguments)},{dup:181}],203:[function(t,e,r){arguments[4][182][0].apply(r,arguments)},{"./GLError":202,dup:182}],204:[function(t,e,r){arguments[4][183][0].apply(r,arguments)},{"./GLError":202,"./reflect":205,dup:183}],205:[function(t,e,r){arguments[4][184][0].apply(r,arguments)},{dup:184}],206:[function(t,e,r){arguments[4][185][0].apply(r,arguments)},{dup:185}],207:[function(t,e,r){arguments[4][186][0].apply(r,arguments)},{"./GLError":202,dup:186,"gl-format-compiler-error":136,"weakmap-shim":517}],208:[function(t,e,r){"use strict";function n(t){if(t in f)return f[t];var e=c(t,{polygons:!0,font:"sans-serif",textAlign:"left",textBaseline:"alphabetic"}),r=[],n=[];e.forEach(function(t){t.forEach(function(t){for(var e=0;e>8*d&255;f.uniforms.pickOffset=o,this.idBuffer.bind(),f.attributes.id.pointer(h.UNSIGNED_BYTE,!1)}else this.colorBuffer.bind(),f.attributes.color.pointer(h.UNSIGNED_BYTE,!0);return this.posHiBuffer.bind(),f.attributes.positionHi.pointer(),this.posLoBuffer.bind(),f.attributes.positionLo.pointer(),this.offsetBuffer.bind(),f.attributes.offset.pointer(),f.uniforms.pixelScale=a,f.uniforms.scaleHi=e,f.uniforms.scaleLo=r,f.uniforms.translateHi=n,f.uniforms.translateLo=i,h.drawArrays(h.TRIANGLES,0,c),l?s+this.numPoints:void 0}}(),d.draw=d.drawPick,d.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;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]]}},d.update=function(t){t=t||{};var e,r,i=t.positions||[],a=t.colors||[],o=t.glyphs||[],s=t.sizes||[],c=t.borderWidths||[],h=t.borderColors||[];this.points=i;var f,d,p=this.bounds=[1/0,1/0,-(1/0),-(1/0)],g=0,m=[],v=[];for(e=0;e>1,r=0;r<2;++r)p[r]=Math.min(p[r],i[2*e+r]),p[2+r]=Math.max(p[2+r],i[2*e+r]);p[0]===p[2]&&(p[2]+=1),p[3]===p[1]&&(p[3]+=1);var y=1/(p[2]-p[0]),x=1/(p[3]-p[1]),b=p[0],_=p[1],w=u.mallocFloat64(2*g),M=u.mallocFloat32(2*g),A=u.mallocFloat32(2*g),k=u.mallocFloat32(2*g),T=u.mallocUint8(4*g),E=u.mallocUint32(g),S=0;for(e=0;et;){var d=r[f-1],p=n[2*(f-1)];if((d-s||l-p)>=0)break;r[f]=d,n[2*f]=p,n[2*f+1]=n[2*f-1],i[f]=i[f-1],a[f]=a[f-1],f-=1}r[f]=s,n[2*f]=l,n[2*f+1]=u,i[f]=c,a[f]=h}}function a(t,e,r,n,i,a){var o=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=a[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,i[e]=u,a[e]=c}function o(t,e,r,n,i,a){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e]}function s(t,e,r,n,i,a,o){var s=n[t],l=i[2*t],u=i[2*t+1],c=a[t],h=o[t]; -n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],a[t]=a[e],o[t]=o[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],a[e]=a[r],o[e]=o[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,a[r]=c,o[r]=h}function l(t,e,r,n,i,a,o,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=a,c[e]=o}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,a,o,s){return(e-a[t]||o[2*t]-r||i-s[t])<0}function h(t,e,r,n,d,p){var g=(e-t+1)/6|0,m=t+g,v=e-g,y=t+e>>1,x=y-g,b=y+g,_=m,w=x,M=y,A=b,k=v,T=t+1,E=e-1,S=0;u(_,w,r,n,d,p)&&(S=_,_=w,w=S),u(A,k,r,n,d,p)&&(S=A,A=k,k=S),u(_,M,r,n,d,p)&&(S=_,_=M,M=S),u(w,M,r,n,d,p)&&(S=w,w=M,M=S),u(_,A,r,n,d,p)&&(S=_,_=A,A=S),u(M,A,r,n,d,p)&&(S=M,M=A,A=S),u(w,k,r,n,d,p)&&(S=w,w=k,k=S),u(w,M,r,n,d,p)&&(S=w,w=M,M=S),u(A,k,r,n,d,p)&&(S=A,A=k,k=S);var L=r[w],z=n[2*w],C=n[2*w+1],I=d[w],P=p[w],D=r[A],O=n[2*A],R=n[2*A+1],F=d[A],j=p[A],N=_,B=M,U=k,V=m,q=y,H=v,G=r[N],X=r[B],Y=r[U];r[V]=G,r[q]=X,r[H]=Y;for(var W=0;W<2;++W){var Z=n[2*N+W],Q=n[2*B+W],K=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=Q,n[2*H+W]=K}var $=d[N],J=d[B],tt=d[U];d[V]=$,d[q]=J,d[H]=tt;var et=p[N],rt=p[B],nt=p[U];p[V]=et,p[q]=rt,p[H]=nt,o(x,t,r,n,d,p),o(b,e,r,n,d,p);for(var it=T;it<=E;++it)if(c(it,L,z,C,I,r,n,d))it!==T&&a(it,T,r,n,d,p),++T;else if(!c(it,D,O,R,F,r,n,d))for(;;){if(c(E,D,O,R,F,r,n,d)){c(E,L,z,C,I,r,n,d)?(s(it,T,E,r,n,d,p),++T,--E):(a(it,E,r,n,d,p),--E);break}if(--E=Math.max(.9*d,32)){var x=u+s>>>1;l(m,v,h,f,x,c+1),f=x}l(m,v,h,f,y,c+1),f=y}}}var u=t.length>>>1;if(u<1)return[];for(var c=1/0,h=1/0,f=-(1/0),d=-(1/0),p=0;p=0;--_){t[2*_]=(t[2*_]-c)*v,t[2*_+1]=(t[2*_+1]-h)*y;var k=b[_];k!==M&&(w.push(new i(x*Math.pow(.5,k),_+1,A-(_+1))),A=_+1,M=k)}return w.push(new i(x*Math.pow(.5,k+1),0,A)),o.free(b),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=a},{"./lib/sort":211,"typedarray-pool":496}],213:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.plot=t,this.positionBufferHi=e,this.positionBufferLo=r,this.pickBuffer=n,this.weightBuffer=i,this.shader=a,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=o(r),s=o(r),l=o(r),u=o(r),h=a(r,c.pointVertex,c.pointFragment),f=a(r,c.pickVertex,c.pickFragment),d=new n(t,i,s,l,u,h,f);return d.update(e),t.addObject(d),d}var a=t("gl-shader"),o=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var h=n.prototype,f=new Float32Array(2),d=new Float32Array(2),p=new Float32Array(2),g=new Float32Array(2),m=[0,0,0,0];h.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBufferHi.dispose(),this.positionBufferLo.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},h.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords),this.points=t.positions;var r=this.points.length>>>1,n=u.mallocInt32(r),i=u.mallocFloat32(2*r),a=u.mallocFloat64(2*r);a.set(this.points),this.scales=l(a,n,i,this.bounds);var o=u.mallocFloat64(r),s=u.mallocFloat32(2*r),c=u.mallocFloat32(2*r);s.set(a);for(var h=0,f=0;h>8&255,m[2]=t>>16&255,m[3]=t>>24&255,n.uniforms.pickOffset=m,l.bind(),n.attributes.pickId.pointer(v.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());for(var I=this.xCoords,P=(b[0]-u[0]-E*c*y)/_,D=(b[2]-u[0]+E*c*y)/_,O=!0,R=i.length-1;R>=0;R--){var F=i[R];if(!(F.pixelSize1)){var j=F.offset,N=F.count+j,B=s.ge(I,P,j,N-1),U=s.lt(I,D,B,N-1)+1;U>B&&v.drawArrays(v.POINTS,B,U-B),!e&&O&&(O=!1,n.uniforms.useWeight=0)}}return t+this.pointCount},h.drawPick=h.draw,h.pick=function(t,e,r){var n=r-this.pickOffset;return n<0||n>=this.pointCount?null:{object:this,pointId:n,dataCoord:[this.points[2*n],this.points[2*n+1]]}}},{"./lib/shader":209,"binary-search-bounds":210,"gl-buffer":128,"gl-shader":220,"snap-points-2d":212,"typedarray-pool":496}],214:[function(t,e,r){"use strict";function n(t,e){var r=a[e];if(r||(r=a[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-(1/0),-(1/0)]],l=0;lMath.abs(R[1])){var F=O;O=R,R=F,F=P,P=D,D=F;var j=C;C=I,I=j}O[0]<0&&(P[C]=-1),R[1]>0&&(D[I]=-1);for(var N=0,B=0,z=0;z<4;++z)N+=Math.pow(p[4*C+z],2),B+=Math.pow(p[4*I+z],2);P[C]/=Math.sqrt(N),D[I]/=Math.sqrt(B),d.axes[0]=P,d.axes[1]=D,d.fragClipBounds[0]=u(S,x[0],_,-1e8),d.fragClipBounds[1]=u(S,x[1],_,1e8),e.vao.draw(f.TRIANGLES,e.vertexCount),e.lineWidth>0&&(f.lineWidth(e.lineWidth),e.vao.draw(f.LINES,e.lineVertexCount,e.vertexCount))}}function f(t,e,r,n,i,a){var o=r.gl;if(r.vao.bind(),i===r.opacity<1||a){t.bind();var s=t.uniforms;s.model=n.model||b,s.view=n.view||b,s.projection=n.projection||b,w[0]=2/o.drawingBufferWidth,w[1]=2/o.drawingBufferHeight,s.screenSize=w,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),r.lineWidth>0&&(o.lineWidth(r.lineWidth),r.vao.draw(o.LINES,r.lineVertexCount,r.vertexCount))}h(e,r,n,i,a),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),a=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=p(e),c=p(e),h=p(e),f=p(e),d=g(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:h,size:2,type:e.FLOAT},{buffer:f,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),m=new o(e,r,n,i,u,c,h,f,d,a,s,l);return m.update(t),m}var p=t("gl-buffer"),g=t("gl-vao"),m=t("typedarray-pool"),v=t("gl-mat4/multiply"),y=t("./lib/shaders"),x=t("./lib/glyphs"),b=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=d;var _=o.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],M=[0,0,0],A=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=b.slice(),S=[0,0,0],L=[[0,0,0],[0,0,0]],z=[-1e8,-1e8,-1e8],C=[1e8,1e8,1e8],I=[z,C];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;f(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||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},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",a=t.alignment||[0,0],o=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,h=t.angle,f=t.lineColor,d=0,p=0,g=0,v=n.length;t:for(var y=0;y0&&(C[0]=-a[0]*(1+k[0][0]));for(var q=M.cells,H=M.positions,_=0;_0){var v=r*c;o.drawBox(h-v,f-v,d+v,f+v,a),o.drawBox(h-v,p-v,d+v,p+v,a),o.drawBox(h-v,f-v,h+v,p+v,a),o.drawBox(d-v,f-v,d+v,p+v,a)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":217,"gl-buffer":128,"gl-shader":220}],219:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function a(t,e){var r=o(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=a;var o=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(_inline_49_arg0_<255||_inline_49_arg1_<255||_inline_49_arg2_<255||_inline_49_arg3_<255){var _inline_49_l=_inline_49_arg4_-_inline_49_arg6_[0],_inline_49_a=_inline_49_arg5_-_inline_49_arg6_[1],_inline_49_f=_inline_49_l*_inline_49_l+_inline_49_a*_inline_49_a;_inline_49_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;i=0){for(var A=0|M.type.charAt(M.type.length-1),k=new Array(A),T=0;T=0;)E+=1;_[w]=E}var S=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,x,_),Object.defineProperty(d,"uniforms",o(p,d,r,S))},e.exports=a},{"./lib/GLError":221,"./lib/create-attributes":222,"./lib/create-uniforms":223,"./lib/reflect":224,"./lib/runtime-reflect":225,"./lib/shader-cache":226}],221:[function(t,e,r){arguments[4][181][0].apply(r,arguments)},{dup:181}],222:[function(t,e,r){arguments[4][182][0].apply(r,arguments)},{"./GLError":221,dup:182}],223:[function(t,e,r){arguments[4][183][0].apply(r,arguments)},{"./GLError":221,"./reflect":224,dup:183}],224:[function(t,e,r){arguments[4][184][0].apply(r,arguments)},{dup:184}],225:[function(t,e,r){arguments[4][185][0].apply(r,arguments)},{dup:185}],226:[function(t,e,r){arguments[4][186][0].apply(r,arguments)},{"./GLError":221,dup:186,"gl-format-compiler-error":136,"weakmap-shim":517}],227:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}function i(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=i;var a=n.prototype;a.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},a.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,a=i.line,o=i.dataBox,s=i.viewBox;if(a.bind(),o[0]<=n[0]&&n[0]<=o[2]&&o[1]<=n[1]&&n[1]<=o[3]){var l=s[0]+(n[0]-o[0])/(o[2]-o[0])*(s[2]-s[0]),u=s[1]+(n[1]-o[1])/(o[3]-o[1])*(s[3]-s[1]);t[0]&&a.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&a.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&a.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&a.drawLine(l,u,l,s[3],e[3],r[3])}},a.dispose=function(){this.plot.removeOverlay(this)}},{}],228:[function(t,e,r){"use strict";var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, color;\nattribute float weight;\n\nuniform mat4 model, view, projection;\nuniform vec3 coordinates[3];\nuniform vec4 colors[3];\nuniform vec2 screenShape;\nuniform float lineWidth;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vertexPosition = mix(coordinates[0],\n mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));\n\n vec4 clipPos = projection * view * model * vec4(vertexPosition, 1.0);\n vec2 clipOffset = (projection * view * model * vec4(color, 0.0)).xy;\n vec2 delta = weight * clipOffset * screenShape;\n vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;\n\n gl_Position = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);\n fragColor = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}";e.exports=function(t){return n(t,i,a,null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":220}],229:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n,this.pixelRatio=1,this.bounds=[[-1e3,-1e3,-1e3],[1e3,1e3,1e3]],this.position=[0,0,0],this.lineWidth=[2,2,2],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.enabled=[!0,!0,!0],this.drawSides=[!0,!0,!0],this.axes=null}function i(t,e){function r(t,e,r,n,a,o){var s=[t,e,r,0,0,0,1];s[n+3]=1,s[n]=a,i.push.apply(i,s),s[6]=-1,i.push.apply(i,s),s[n]=o,i.push.apply(i,s),i.push.apply(i,s),s[6]=1,i.push.apply(i,s),s[n]=a,i.push.apply(i,s)}var i=[];r(0,0,0,0,0,1),r(0,0,0,1,0,1),r(0,0,0,2,0,1),r(1,0,0,1,-1,1),r(1,0,0,2,-1,1),r(0,1,0,0,-1,1),r(0,1,0,2,-1,1),r(0,0,1,0,-1,1),r(0,0,1,1,-1,1);var l=a(t,i),u=o(t,[{type:t.FLOAT,buffer:l,size:3,offset:0,stride:28},{type:t.FLOAT,buffer:l,size:3,offset:12,stride:28},{type:t.FLOAT,buffer:l,size:1,offset:24,stride:28}]),c=s(t);c.attributes.position.location=0,c.attributes.color.location=1,c.attributes.weight.location=2;var h=new n(t,l,u,c);return h.update(e),h}var a=t("gl-buffer"),o=t("gl-vao"),s=t("./shaders/index");e.exports=i;var l=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],u=n.prototype,c=[0,0,0],h=[0,0,0],f=[0,0];u.isTransparent=function(){return!1},u.drawTransparent=function(t){}, -u.draw=function(t){var e=this.gl,r=this.vao,n=this.shader;r.bind(),n.bind();var i,a=t.model||l,o=t.view||l,s=t.projection||l;this.axes&&(i=this.axes.lastCubeProps.axis);for(var u=c,d=h,p=0;p<3;++p)i&&i[p]<0?(u[p]=this.bounds[0][p],d[p]=this.bounds[1][p]):(u[p]=this.bounds[1][p],d[p]=this.bounds[0][p]);f[0]=e.drawingBufferWidth,f[1]=e.drawingBufferHeight,n.uniforms.model=a,n.uniforms.view=o,n.uniforms.projection=s,n.uniforms.coordinates=[this.position,u,d],n.uniforms.colors=this.colors,n.uniforms.screenShape=f;for(var p=0;p<3;++p)n.uniforms.lineWidth=this.lineWidth[p]*this.pixelRatio,this.enabled[p]&&(r.draw(e.TRIANGLES,6,6*p),this.drawSides[p]&&r.draw(e.TRIANGLES,12,18+12*p));r.unbind()},u.update=function(t){t&&("bounds"in t&&(this.bounds=t.bounds),"position"in t&&(this.position=t.position),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"colors"in t&&(this.colors=t.colors),"enabled"in t&&(this.enabled=t.enabled),"drawSides"in t&&(this.drawSides=t.drawSides))},u.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders/index":228,"gl-buffer":128,"gl-vao":236}],230:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\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 worldCoordinate = vec3(uv.zw, f.x);\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n vec4 clipPosition = projection * view * worldPosition;\n gl_Position = clipPosition;\n kill = f.y;\n value = f.z;\n planeCoordinate = uv.xy;\n\n vColor = texture2D(colormap, vec2(value, value));\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat beckmannSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution_2_0(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\n}\n\n\n\nuniform vec3 lowerBound, upperBound;\nuniform float contourTint;\nuniform vec4 contourColor;\nuniform sampler2D colormap;\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform float vertexColor;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n if (kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = beckmannSpecular_1_1(L, V, N, roughness);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //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",o="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",s="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n";r.createShader=function(t){var e=n(t,i,a,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createPickShader=function(t){var e=n(t,i,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createContourShader=function(t){var e=n(t,o,a,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,o,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":220}],231:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}function i(t){var e=b([y({colormap:t,nshades:R,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);return x.divseq(e,255),e}function a(t,e,r,i,a,o,s,l,u,c,h,f,d,p){this.gl=t,this.shape=e,this.bounds=r,this.intensityBounds=[],this._shader=i,this._pickShader=a,this._coordinateBuffer=o,this._vao=s,this._colorMap=l,this._contourShader=u,this._contourPickShader=c,this._contourBuffer=h,this._contourVAO=f,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new n([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=d,this._dynamicVAO=p,this._dynamicOffsets=[0,0,0],this._dynamicCounts=[0,0,0],this.contourWidth=[1,1,1],this.contourLevels=[[1],[1],[1]],this.contourTint=[0,0,0],this.contourColor=[[.5,.5,.5,1],[.5,.5,.5,1],[.5,.5,.5,1]],this.showContour=!0,this.showSurface=!0,this.enableHighlight=[!0,!0,!0],this.highlightColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.highlightTint=[1,1,1],this.highlightLevel=[-1,-1,-1],this.enableDynamic=[!0,!0,!0],this.dynamicLevel=[NaN,NaN,NaN],this.dynamicColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.dynamicTint=[1,1,1],this.dynamicWidth=[1,1,1],this.axesBounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.surfaceProject=[!1,!1,!1],this.contourProject=[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],this.colorBounds=[!1,!1],this._field=[_(v.mallocFloat(1024),[0,0]),_(v.mallocFloat(1024),[0,0]),_(v.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.snapToData=!1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.vertexColor=0,this.dirty=!0}function o(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||j,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=N.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],M(l,t.model,l);var u=N.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return N.showSurface=o,N.showContour=s,N}function s(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=B;n.model=t.model||P,n.view=t.view||P,n.projection=t.projection||P,n.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],n.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],n.contourColor=this.contourColor[0],n.inverseModel=A(n.inverseModel,n.model);for(var i=0;i<2;++i)for(var a=n.clipBounds[i],s=0;s<3;++s)a[s]=Math.min(Math.max(this.clipBounds[i][s],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=V,n.vertexColor=this.vertexColor;var l=U;for(M(l,n.view,n.model),M(l,n.projection,l),A(l,l),i=0;i<3;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;i<3;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;i<3;++i){var c=l[12+i];for(s=0;s<3;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var h=o(n,this);if(h.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;i<3;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=h.projections[i],this._shader.uniforms.clipBounds=h.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(h.showContour&&!e){var f=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,f.bind(),f.uniforms=n;var d=this._contourVAO;for(d.bind(),i=0;i<3;++i)for(f.uniforms.permutation=O[i],r.lineWidth(this.contourWidth[i]),s=0;s=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},F.pickSlots=1,F.setPickBase=function(t){this.pickId=t};var j=[0,0,0],N={showSurface:!1,showContour:!1,projections:[P.slice(),P.slice(),P.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:P,view:P,projection:P,inverseModel:P.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1,vertexColor:0},U=P.slice(),V=[1,0,0,0,1,0,0,0,1];F.draw=function(t){return s.call(this,t,!1)},F.drawTransparent=function(t){return s.call(this,t,!0)};var q={model:P,view:P,projection:P,inverseModel:P,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};F.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=q;r.model=t.model||P,r.view=t.view||P,r.projection=t.projection||P,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.permutation=V;for(var n=0;n<2;++n)for(var i=r.clipBounds[n],a=0;a<3;++a)i[a]=Math.min(Math.max(this.clipBounds[n][a],-1e8),1e8);var s=o(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;n<3;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var u=this._contourVAO;for(u.bind(),a=0;a<3;++a)for(e.lineWidth(this.contourWidth[a]),l.uniforms.permutation=O[a],n=0;n>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 u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;c<2;++c)for(var h=c?a:1-a,f=0;f<2;++f)for(var d=f?l:1-l,p=i+c,g=s+f,m=h*d,v=0;v<3;++v)u[v]+=this._field[v].get(p,g)*m;for(var y=this._pickResult.level,x=0;x<3;++x)if(y[x]=k.le(this.contourLevels[x],u[x]),y[x]<0)this.contourLevels[x].length>0&&(y[x]=0);else if(y[x]Math.abs(_-u[x])&&(y[x]+=1)}for(r.index[0]=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},F.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=u(t.contourWidth,Number)),"showContour"in t&&(this.showContour=u(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=u(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=h(t.contourColor)),"contourProject"in t&&(this.contourProject=u(t.contourProject,function(t){return u(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=h(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=u(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=u(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"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 n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(v.freeFloat(this._field[2].data),this._field[2].data=v.mallocFloat(d.nextPow2(n))),this._field[2]=_(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),l(this._field[2],e),this.shape=e.shape.slice();for(var a=this.shape,o=0;o<2;++o)this._field[2].size>this._field[o].data.length&&(v.freeFloat(this._field[o].data),this._field[o].data=v.mallocFloat(this._field[2].size)),this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2]);if(t.coords){var s=t.coords;if(!Array.isArray(s)||3!==s.length)throw new Error("gl-surface: invalid coordinates for x/y");for(o=0;o<2;++o){var c=s[o];for(y=0;y<2;++y)if(c.shape[y]!==a[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[o],c)}}else if(t.ticks){var f=t.ticks;if(!Array.isArray(f)||2!==f.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var p=f[o];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var g=_(p.data,a);g.stride[o]=p.stride[0],g.stride[1^o]=0,l(this._field[o],g)}}else{for(o=0;o<2;++o){var m=[0,0];m[o]=1,this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2],m,0)}this._field[0].set(0,0,0);for(var y=0;y0){for(var bt=0;bt<5;++bt)tt.pop();q-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),q+=1}}nt.push(q)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=v.mallocFloat(tt.length);for(o=0;oi||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 a(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}function o(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,a,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var h=0,f=0,m=o(c,l.stride.slice());"float32"===u?h=t.FLOAT:"float64"===u?(h=t.FLOAT,m=!1,u="float32"):"uint8"===u?h=t.UNSIGNED_BYTE:(h=t.UNSIGNED_BYTE,m=!1,u="uint8");var v=1;if(2===c.length)f=t.LUMINANCE,c=[c[0],c[1],1],l=d(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])f=t.ALPHA;else if(2===c[2])f=t.LUMINANCE_ALPHA;else if(3===c[2])f=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");f=t.RGBA}v=c[2]}if(f!==t.LUMINANCE&&f!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(f=i),f!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,b=s.indexOf(n)<0;if(b&&s.push(n),h===a&&m)0===l.offset&&l.data.length===y?b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data):b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var _;_=a===t.FLOAT?g.mallocFloat32(y):g.mallocUint8(y);var w=d(_,c,[c[2],c[2]*c[0],1]);h===t.FLOAT&&a===t.UNSIGNED_BYTE?x(w,l):p.assign(w,l),b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,_.subarray(0,y)),a===t.FLOAT?g.freeFloat32(_):g.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var o=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>o||r<0||r>o)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new a(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new a(t,i,0|e.width,0|e.height,r,n)}function h(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=o(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=d(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var h,f,m=e.size;if(s)h=0===e.offset&&e.data.length===m?e.data:e.data.subarray(e.offset,e.offset+m);else{var v=[n[2],n[2]*n[0],1];f=g.malloc(m,r);var y=d(f,n,v,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?p.assign(y,e):x(y,e),h=f.subarray(0,m)}var b=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,h),s||g.free(f),new a(t,b,n[0],n[1],c,u)}function f(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(m||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return h(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var d=t("ndarray"),p=t("ndarray-ops"),g=t("typedarray-pool");e.exports=f;var m=null,v=null,y=null,x=function(t,e){p.muls(t,e,255)},b=a.prototype;Object.defineProperties(b,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),v.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),v.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=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(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t); -return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t|=0,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,i(this,this._shape[0],t),t}}}),b.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},b.dispose=function(){this.gl.deleteTexture(this.handle)},b.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},b.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var a=this._mipLevels.indexOf(n)<0;a?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:427,"ndarray-ops":421,"typedarray-pool":496}],233:[function(t,e,r){"use strict";function n(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;i0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}e.exports=n},{}],242:[function(t,e,r){function n(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}e.exports=n},{}],243:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,a[0]}e.exports=n;var i=new Uint8Array(4),a=new Float32Array(i.buffer)},{}],244:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function C(){return/[^a-fA-F0-9]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function I(){return"."===O?(U.push(O),B=m,R=O,j+1):/[eE]/.test(O)?(U.push(O),B=m,R=O,j+1):"x"===O&&1===U.length&&"0"===U[0]?(B=w,U.push(O),R=O,j+1):/[^\d]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function P(){return"f"===O&&(U.push(O),R=O,j+=1),/[eE]/.test(O)?(U.push(O),R=O,j+1):"-"===O&&/[eE]/.test(R)?(U.push(O),R=O,j+1):/[^\d]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function D(){if(/[^\d\w_]/.test(O)){var t=U.join("");return B=Q.indexOf(t)>-1?x:Z.indexOf(t)>-1?y:v,e(U.join("")),B=u,j}return U.push(O),R=O,j+1}var O,R,F,j=0,N=0,B=u,U=[],V=[],q=1,H=0,G=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return V=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var i=t("./lib/literals"),a=t("./lib/operators"),o=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,h=0,f=1,d=2,p=3,g=4,m=5,v=6,y=7,x=8,b=9,_=10,w=11,M=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":247,"./lib/builtins-300es":246,"./lib/literals":249,"./lib/literals-300es":248,"./lib/operators":250}],246:[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":247}],247:[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"]},{}],248:[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":249}],249:[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"]},{}],250:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],251:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":245}],252:[function(t,e,r){"use strict";function n(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var a=new Int32Array(this.arrayBuffer);t=a[0],e=a[1],r=a[2],this.d=e+2*r;for(var o=0;o=u[f+0]&&n>=u[f+1]?(o[h]=!0,a.push(l[h])):o[h]=!1}}},n.prototype._forEachCell=function(t,e,r,n,i,a,o){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=s;h<=u;h++)for(var f=l;f<=c;f++){var d=this.d*f+h;if(i.call(this,t,e,r,n,d,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,c=-7,h=r?i-1:0,f=r?-1:1,d=t[e+h];for(h+=f,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+h],h+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+h],h+=f,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=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=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),e+=o+h>=1?f/l:f*Math.pow(2,1-h),e*l>=2&&(o++,l/=2),o+h>=c?(s=0,o=c):o+h>=1?(s=(e*l-1)*Math.pow(2,i),o+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],254:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function a(t,e){return c(t.vertices,e.vertices)}function o(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;r<=t;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=u[t+1];return i||(i=u),n(i)}function s(t,e,r){this.dimension=t,this.vertices=e,this.simplices=r,this.interior=r.filter(function(t){return!t.boundary}),this.tuple=new Array(t+1);for(var n=0;n<=t;++n)this.tuple[n]=this.vertices[n];var i=h[t];i||(i=h[t]=o(t)),this.orient=i}function l(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var i=t[0].length;if(r<=i)throw new Error("Must input at least d+1 points");var a=t.slice(0,i+1),o=u.apply(void 0,a);if(0===o)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;c<=i;++c)l[c]=c;o<0&&(l[0]=1,l[1]=0);for(var h=new n(l,new Array(i+1),!1),f=h.adjacent,d=new Array(i+2),c=0;c<=i;++c){for(var p=l.slice(),g=0;g<=i;++g)g===c&&(p[g]=-1);var m=p[0];p[0]=p[1],p[1]=m;var v=new n(p,new Array(i+1),!0);f[c]=v,d[c]=v}d[i+1]=h;for(var c=0;c<=i;++c)for(var p=f[c].vertices,y=f[c].adjacent,g=0;g<=i;++g){var x=p[g];if(x<0)y[g]=h;else for(var b=0;b<=i;++b)f[b].vertices.indexOf(x)<0&&(y[g]=f[b])}for(var _=new s(i,a,d),w=!!e,c=i+1;c0;){t=o.pop();for(var s=(t.vertices,t.adjacent),l=0;l<=r;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,h=0;h<=r;++h){var f=c[h];f<0?i[h]=e:i[h]=a[f]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&o.push(u)}}}return null},f.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,u=s.adjacent,c=0;c<=n;++c)a[c]=i[l[c]];s.lastVisited=r;for(var c=0;c<=n;++c){var h=u[c];if(!(h.lastVisited>=r)){var f=a[c];a[c]=t;var d=this.orient();if(a[c]=f,d<0){s=h;continue t}h.boundary?h.lastVisited=-r:h.lastVisited=r}}return}return s},f.addPeaks=function(t,e){var r=this.vertices.length-1,o=this.dimension,s=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,h=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var f=[];h.length>0;){var e=h.pop(),d=e.vertices,p=e.adjacent,g=d.indexOf(r);if(!(g<0))for(var m=0;m<=o;++m)if(m!==g){var v=p[m];if(v.boundary&&!(v.lastVisited>=r)){var y=v.vertices;if(v.lastVisited!==-r){for(var x=0,b=0;b<=o;++b)y[b]<0?(x=b,l[b]=t):l[b]=s[y[b]];var _=this.orient();if(_>0){y[x]=r,v.boundary=!1,u.push(v),h.push(v),v.lastVisited=r;continue}v.lastVisited=-r}var w=v.adjacent,M=d.slice(),A=p.slice(),k=new n(M,A,!0);c.push(k);var T=w.indexOf(e);if(!(T<0)){w[T]=k,A[g]=v,M[m]=-1,A[m]=e,p[m]=k,k.flip();for(var b=0;b<=o;++b){var E=M[b];if(!(E<0||E===r)){for(var S=new Array(o-1),L=0,z=0;z<=o;++z){var C=M[z];C<0||z===b||(S[L++]=C)}f.push(new i(S,k,b))}}}}}}f.sort(a);for(var m=0;m+1=0?o[l++]=s[c]:u=1&c;if(u===(1&t)){var h=o[0];o[0]=o[1],o[1]=h}e.push(o)}}return e}},{"robust-orientation":465,"simplicial-complex":476}],255:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function a(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),a(t,r),x)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],a=[],o=[],s=[],r=0;r3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=v.ge(this.leftPoints,t,f),n=v.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===b?(this.left=null,this.count-=1,x):(n===x&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var a=this.left?this.left.count:0;if(4*a>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===b?(this.right=null,this.count-=1,x):(n===x&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?b:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var o=this,l=this.left;l.right;)o=l,l=l.right;if(o===this)l.right=this.right;else{var u=this.left,n=this.right;o.count-=l.count,o.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return x}for(var u=v.ge(this.leftPoints,t,f);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===b&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},w.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":53}],256:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;r=r&&s<=i&&l>=n&&l<=a&&c.push(t[p]);else{var g=Math.floor((d+f)/2);s=e[2*g],l=e[2*g+1],s>=r&&s<=i&&l>=n&&l<=a&&c.push(t[g]);var m=(h+1)%2;(0===h?r<=s:n<=l)&&(u.push(d),u.push(g-1),u.push(m)),(0===h?i>=s:a>=l)&&(u.push(g+1),u.push(f),u.push(m))}}return c}e.exports=n},{}],261:[function(t,e,r){"use strict";function n(t,e,r,a,o,s){if(!(o-a<=r)){var l=Math.floor((a+o)/2);i(t,e,l,a,o,s%2),n(t,e,r,a,l-1,s+1),n(t,e,r,l+1,o,s+1)}}function i(t,e,r,n,o,s){for(;o>n;){if(o-n>600){var l=o-n+1,u=r-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),d=Math.max(n,Math.floor(r-u*h/l+f)),p=Math.min(o,Math.floor(r+(l-u)*h/l+f));i(t,e,r,d,p,s)}var g=e[2*r+s],m=n,v=o;for(a(t,e,n,r),e[2*o+s]>g&&a(t,e,n,o);mg;)v--}e[2*n+s]===g?a(t,e,n,v):(v++,a(t,e,v,o)),v<=r&&(n=v+1),r<=v&&(o=v-1)}}function a(t,e,r,n){o(t,r,n),o(e,2*r,2*n),o(e,2*r+1,2*n+1)}function o(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=n},{}],262:[function(t,e,r){"use strict";function n(t,e,r,n,a,o){for(var s=[0,t.length-1,0],l=[],u=a*a;s.length;){var c=s.pop(),h=s.pop(),f=s.pop();if(h-f<=o)for(var d=f;d<=h;d++)i(e[2*d],e[2*d+1],r,n)<=u&&l.push(t[d]);else{var p=Math.floor((f+h)/2),g=e[2*p],m=e[2*p+1];i(g,m,r,n)<=u&&l.push(t[p]);var v=(c+1)%2;(0===c?r-a<=g:n-a<=m)&&(s.push(f),s.push(p-1),s.push(v)),(0===c?r+a>=g:n+a>=m)&&(s.push(p+1),s.push(h),s.push(v))}}return l}function i(t,e,r,n){var i=t-r,a=e-n;return i*i+a*a}e.exports=n},{}],263:[function(t,e,r){"use strict";function n(t,e){var r;if(h(t)){var l,u=t.stops&&"object"==typeof t.stops[0][0],c=u||void 0!==t.property,f=u||!c,d=t.type||e||"exponential";if("exponential"===d)l=o;else if("interval"===d)l=a;else if("categorical"===d)l=i;else{if("identity"!==d)throw new Error('Unknown function type "'+d+'"');l=s}if(u){for(var p={},g=[],m=0;m=t.stops.length)break;if(e<=t.stops[n][0])break;n++}return 0===n?t.stops[n][1]:n===t.stops.length?t.stops[n-1][1]:l(e,r,t.stops[n-1][0],t.stops[n][0],t.stops[n-1][1],t.stops[n][1])}function s(t,e){return e}function l(t,e,r,n,i,a){return"function"==typeof i?function(){var o=i.apply(void 0,arguments),s=a.apply(void 0,arguments);return l(t,e,r,n,o,s)}:i.length?c(t,e,r,n,i,a):u(t,e,r,n,i,a)}function u(t,e,r,n,i,a){var o,s=n-r,l=t-r;return o=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-o)+a*o}function c(t,e,r,n,i,a){for(var o=[],s=0;s -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linesdfpattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},outline:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},outlinepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\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\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},pattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform 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\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n}\n"},raster:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity0;\nuniform float u_opacity1;\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 vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\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);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform 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 v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},icon:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_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:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},sdf:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nconst float PI = 3.141592653589793;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_data[1] / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_data[1] / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = (gl_Position.w - 0.5);\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" +n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],a[t]=a[e],o[t]=o[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],a[e]=a[r],o[e]=o[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,a[r]=c,o[r]=h}function l(t,e,r,n,i,a,o,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=a,c[e]=o}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,a,o,s){return(e-a[t]||o[2*t]-r||i-s[t])<0}function h(t,e,r,n,d,p){var g=(e-t+1)/6|0,m=t+g,v=e-g,y=t+e>>1,x=y-g,b=y+g,_=m,w=x,M=y,A=b,k=v,T=t+1,E=e-1,S=0;u(_,w,r,n,d,p)&&(S=_,_=w,w=S),u(A,k,r,n,d,p)&&(S=A,A=k,k=S),u(_,M,r,n,d,p)&&(S=_,_=M,M=S),u(w,M,r,n,d,p)&&(S=w,w=M,M=S),u(_,A,r,n,d,p)&&(S=_,_=A,A=S),u(M,A,r,n,d,p)&&(S=M,M=A,A=S),u(w,k,r,n,d,p)&&(S=w,w=k,k=S),u(w,M,r,n,d,p)&&(S=w,w=M,M=S),u(A,k,r,n,d,p)&&(S=A,A=k,k=S);var L=r[w],z=n[2*w],C=n[2*w+1],I=d[w],P=p[w],D=r[A],O=n[2*A],R=n[2*A+1],F=d[A],j=p[A],N=_,B=M,U=k,V=m,q=y,H=v,G=r[N],X=r[B],Y=r[U];r[V]=G,r[q]=X,r[H]=Y;for(var W=0;W<2;++W){var Z=n[2*N+W],Q=n[2*B+W],K=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=Q,n[2*H+W]=K}var $=d[N],J=d[B],tt=d[U];d[V]=$,d[q]=J,d[H]=tt;var et=p[N],rt=p[B],nt=p[U];p[V]=et,p[q]=rt,p[H]=nt,o(x,t,r,n,d,p),o(b,e,r,n,d,p);for(var it=T;it<=E;++it)if(c(it,L,z,C,I,r,n,d))it!==T&&a(it,T,r,n,d,p),++T;else if(!c(it,D,O,R,F,r,n,d))for(;;){if(c(E,D,O,R,F,r,n,d)){c(E,L,z,C,I,r,n,d)?(s(it,T,E,r,n,d,p),++T,--E):(a(it,E,r,n,d,p),--E);break}if(--E=Math.max(.9*d,32)){var x=u+s>>>1;l(m,v,h,f,x,c+1),f=x}l(m,v,h,f,y,c+1),f=y}}}var u=t.length>>>1;if(u<1)return[];for(var c=1/0,h=1/0,f=-(1/0),d=-(1/0),p=0;p=0;--_){t[2*_]=(t[2*_]-c)*v,t[2*_+1]=(t[2*_+1]-h)*y;var k=b[_];k!==M&&(w.push(new i(x*Math.pow(.5,k),_+1,A-(_+1))),A=_+1,M=k)}return w.push(new i(x*Math.pow(.5,k+1),0,A)),o.free(b),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=a},{"./lib/sort":211,"typedarray-pool":496}],213:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.plot=t,this.positionBufferHi=e,this.positionBufferLo=r,this.pickBuffer=n,this.weightBuffer=i,this.shader=a,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=o(r),s=o(r),l=o(r),u=o(r),h=a(r,c.pointVertex,c.pointFragment),f=a(r,c.pickVertex,c.pickFragment),d=new n(t,i,s,l,u,h,f);return d.update(e),t.addObject(d),d}var a=t("gl-shader"),o=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var h=n.prototype,f=new Float32Array(2),d=new Float32Array(2),p=new Float32Array(2),g=new Float32Array(2),m=[0,0,0,0];h.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBufferHi.dispose(),this.positionBufferLo.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},h.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords),this.points=t.positions;var r=this.points.length>>>1,n=u.mallocInt32(r),i=u.mallocFloat32(2*r),a=u.mallocFloat64(2*r);a.set(this.points),this.scales=l(a,n,i,this.bounds);var o=u.mallocFloat64(r),s=u.mallocFloat32(2*r),c=u.mallocFloat32(2*r);s.set(a);for(var h=0,f=0;h>8&255,m[2]=t>>16&255,m[3]=t>>24&255,n.uniforms.pickOffset=m,l.bind(),n.attributes.pickId.pointer(v.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());for(var I=this.xCoords,P=(b[0]-u[0]-E*c*y)/_,D=(b[2]-u[0]+E*c*y)/_,O=!0,R=i.length-1;R>=0;R--){var F=i[R];if(!(F.pixelSize1)){var j=F.offset,N=F.count+j,B=s.ge(I,P,j,N-1),U=s.lt(I,D,B,N-1)+1;U>B&&v.drawArrays(v.POINTS,B,U-B),!e&&O&&(O=!1,n.uniforms.useWeight=0)}}return t+this.pointCount},h.drawPick=h.draw,h.pick=function(t,e,r){var n=r-this.pickOffset;return n<0||n>=this.pointCount?null:{object:this,pointId:n,dataCoord:[this.points[2*n],this.points[2*n+1]]}}},{"./lib/shader":209,"binary-search-bounds":210,"gl-buffer":128,"gl-shader":220,"snap-points-2d":212,"typedarray-pool":496}],214:[function(t,e,r){"use strict";function n(t,e){var r=a[e];if(r||(r=a[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-(1/0),-(1/0)]],l=0;lMath.abs(R[1])){var F=O;O=R,R=F,F=P,P=D,D=F;var j=C;C=I,I=j}O[0]<0&&(P[C]=-1),R[1]>0&&(D[I]=-1);for(var N=0,B=0,z=0;z<4;++z)N+=Math.pow(p[4*C+z],2),B+=Math.pow(p[4*I+z],2);P[C]/=Math.sqrt(N),D[I]/=Math.sqrt(B),d.axes[0]=P,d.axes[1]=D,d.fragClipBounds[0]=u(S,x[0],_,-1e8),d.fragClipBounds[1]=u(S,x[1],_,1e8),e.vao.draw(f.TRIANGLES,e.vertexCount),e.lineWidth>0&&(f.lineWidth(e.lineWidth),e.vao.draw(f.LINES,e.lineVertexCount,e.vertexCount))}}function f(t,e,r,n,i,a){var o=r.gl;if(r.vao.bind(),i===r.opacity<1||a){t.bind();var s=t.uniforms;s.model=n.model||b,s.view=n.view||b,s.projection=n.projection||b,w[0]=2/o.drawingBufferWidth,w[1]=2/o.drawingBufferHeight,s.screenSize=w,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),r.lineWidth>0&&(o.lineWidth(r.lineWidth),r.vao.draw(o.LINES,r.lineVertexCount,r.vertexCount))}h(e,r,n,i,a),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),a=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=p(e),c=p(e),h=p(e),f=p(e),d=g(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:h,size:2,type:e.FLOAT},{buffer:f,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),m=new o(e,r,n,i,u,c,h,f,d,a,s,l);return m.update(t),m}var p=t("gl-buffer"),g=t("gl-vao"),m=t("typedarray-pool"),v=t("gl-mat4/multiply"),y=t("./lib/shaders"),x=t("./lib/glyphs"),b=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=d;var _=o.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],M=[0,0,0],A=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=b.slice(),S=[0,0,0],L=[[0,0,0],[0,0,0]],z=[-1e8,-1e8,-1e8],C=[1e8,1e8,1e8],I=[z,C];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;f(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||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},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",a=t.alignment||[0,0],o=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,h=t.angle,f=t.lineColor,d=0,p=0,g=0,v=n.length;t:for(var y=0;y0&&(C[0]=-a[0]*(1+k[0][0]));for(var q=M.cells,H=M.positions,_=0;_0){var v=r*c;o.drawBox(h-v,f-v,d+v,f+v,a),o.drawBox(h-v,p-v,d+v,p+v,a),o.drawBox(h-v,f-v,h+v,p+v,a),o.drawBox(d-v,f-v,d+v,p+v,a)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":217,"gl-buffer":128,"gl-shader":220}],219:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function a(t,e){var r=o(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=a;var o=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(_inline_46_arg0_<255||_inline_46_arg1_<255||_inline_46_arg2_<255||_inline_46_arg3_<255){var _inline_46_l=_inline_46_arg4_-_inline_46_arg6_[0],_inline_46_a=_inline_46_arg5_-_inline_46_arg6_[1],_inline_46_f=_inline_46_l*_inline_46_l+_inline_46_a*_inline_46_a;_inline_46_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;i=0){for(var A=0|M.type.charAt(M.type.length-1),k=new Array(A),T=0;T=0;)E+=1;_[w]=E}var S=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,x,_),Object.defineProperty(d,"uniforms",o(p,d,r,S))},e.exports=a},{"./lib/GLError":221,"./lib/create-attributes":222,"./lib/create-uniforms":223,"./lib/reflect":224,"./lib/runtime-reflect":225,"./lib/shader-cache":226}],221:[function(t,e,r){arguments[4][181][0].apply(r,arguments)},{dup:181}],222:[function(t,e,r){arguments[4][182][0].apply(r,arguments)},{"./GLError":221,dup:182}],223:[function(t,e,r){arguments[4][183][0].apply(r,arguments)},{"./GLError":221,"./reflect":224,dup:183}],224:[function(t,e,r){arguments[4][184][0].apply(r,arguments)},{dup:184}],225:[function(t,e,r){arguments[4][185][0].apply(r,arguments)},{dup:185}],226:[function(t,e,r){arguments[4][186][0].apply(r,arguments)},{"./GLError":221,dup:186,"gl-format-compiler-error":136,"weakmap-shim":517}],227:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}function i(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=i;var a=n.prototype;a.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},a.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,a=i.line,o=i.dataBox,s=i.viewBox;if(a.bind(),o[0]<=n[0]&&n[0]<=o[2]&&o[1]<=n[1]&&n[1]<=o[3]){var l=s[0]+(n[0]-o[0])/(o[2]-o[0])*(s[2]-s[0]),u=s[1]+(n[1]-o[1])/(o[3]-o[1])*(s[3]-s[1]);t[0]&&a.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&a.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&a.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&a.drawLine(l,u,l,s[3],e[3],r[3])}},a.dispose=function(){this.plot.removeOverlay(this)}},{}],228:[function(t,e,r){"use strict";var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, color;\nattribute float weight;\n\nuniform mat4 model, view, projection;\nuniform vec3 coordinates[3];\nuniform vec4 colors[3];\nuniform vec2 screenShape;\nuniform float lineWidth;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vertexPosition = mix(coordinates[0],\n mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));\n\n vec4 clipPos = projection * view * model * vec4(vertexPosition, 1.0);\n vec2 clipOffset = (projection * view * model * vec4(color, 0.0)).xy;\n vec2 delta = weight * clipOffset * screenShape;\n vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;\n\n gl_Position = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);\n fragColor = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}";e.exports=function(t){return n(t,i,a,null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":220}],229:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n,this.pixelRatio=1,this.bounds=[[-1e3,-1e3,-1e3],[1e3,1e3,1e3]],this.position=[0,0,0],this.lineWidth=[2,2,2],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.enabled=[!0,!0,!0],this.drawSides=[!0,!0,!0],this.axes=null}function i(t,e){function r(t,e,r,n,a,o){var s=[t,e,r,0,0,0,1];s[n+3]=1,s[n]=a,i.push.apply(i,s),s[6]=-1,i.push.apply(i,s),s[n]=o,i.push.apply(i,s),i.push.apply(i,s),s[6]=1,i.push.apply(i,s),s[n]=a,i.push.apply(i,s)}var i=[];r(0,0,0,0,0,1),r(0,0,0,1,0,1),r(0,0,0,2,0,1),r(1,0,0,1,-1,1),r(1,0,0,2,-1,1),r(0,1,0,0,-1,1),r(0,1,0,2,-1,1),r(0,0,1,0,-1,1),r(0,0,1,1,-1,1);var l=a(t,i),u=o(t,[{type:t.FLOAT,buffer:l,size:3,offset:0,stride:28},{type:t.FLOAT,buffer:l,size:3,offset:12,stride:28},{type:t.FLOAT,buffer:l,size:1,offset:24,stride:28}]),c=s(t);c.attributes.position.location=0,c.attributes.color.location=1,c.attributes.weight.location=2;var h=new n(t,l,u,c);return h.update(e),h}var a=t("gl-buffer"),o=t("gl-vao"),s=t("./shaders/index");e.exports=i;var l=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],u=n.prototype,c=[0,0,0],h=[0,0,0],f=[0,0];u.isTransparent=function(){return!1},u.drawTransparent=function(t){}, +u.draw=function(t){var e=this.gl,r=this.vao,n=this.shader;r.bind(),n.bind();var i,a=t.model||l,o=t.view||l,s=t.projection||l;this.axes&&(i=this.axes.lastCubeProps.axis);for(var u=c,d=h,p=0;p<3;++p)i&&i[p]<0?(u[p]=this.bounds[0][p],d[p]=this.bounds[1][p]):(u[p]=this.bounds[1][p],d[p]=this.bounds[0][p]);f[0]=e.drawingBufferWidth,f[1]=e.drawingBufferHeight,n.uniforms.model=a,n.uniforms.view=o,n.uniforms.projection=s,n.uniforms.coordinates=[this.position,u,d],n.uniforms.colors=this.colors,n.uniforms.screenShape=f;for(var p=0;p<3;++p)n.uniforms.lineWidth=this.lineWidth[p]*this.pixelRatio,this.enabled[p]&&(r.draw(e.TRIANGLES,6,6*p),this.drawSides[p]&&r.draw(e.TRIANGLES,12,18+12*p));r.unbind()},u.update=function(t){t&&("bounds"in t&&(this.bounds=t.bounds),"position"in t&&(this.position=t.position),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"colors"in t&&(this.colors=t.colors),"enabled"in t&&(this.enabled=t.enabled),"drawSides"in t&&(this.drawSides=t.drawSides))},u.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders/index":228,"gl-buffer":128,"gl-vao":236}],230:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\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 worldCoordinate = vec3(uv.zw, f.x);\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n vec4 clipPosition = projection * view * worldPosition;\n gl_Position = clipPosition;\n kill = f.y;\n value = f.z;\n planeCoordinate = uv.xy;\n\n vColor = texture2D(colormap, vec2(value, value));\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat beckmannSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution_2_0(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\n}\n\n\n\nuniform vec3 lowerBound, upperBound;\nuniform float contourTint;\nuniform vec4 contourColor;\nuniform sampler2D colormap;\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform float vertexColor;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n if (kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = beckmannSpecular_1_1(L, V, N, roughness);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //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",o="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",s="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n";r.createShader=function(t){var e=n(t,i,a,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createPickShader=function(t){var e=n(t,i,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createContourShader=function(t){var e=n(t,o,a,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,o,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":220}],231:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}function i(t){var e=b([y({colormap:t,nshades:R,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);return x.divseq(e,255),e}function a(t,e,r,i,a,o,s,l,u,c,h,f,d,p){this.gl=t,this.shape=e,this.bounds=r,this.intensityBounds=[],this._shader=i,this._pickShader=a,this._coordinateBuffer=o,this._vao=s,this._colorMap=l,this._contourShader=u,this._contourPickShader=c,this._contourBuffer=h,this._contourVAO=f,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new n([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=d,this._dynamicVAO=p,this._dynamicOffsets=[0,0,0],this._dynamicCounts=[0,0,0],this.contourWidth=[1,1,1],this.contourLevels=[[1],[1],[1]],this.contourTint=[0,0,0],this.contourColor=[[.5,.5,.5,1],[.5,.5,.5,1],[.5,.5,.5,1]],this.showContour=!0,this.showSurface=!0,this.enableHighlight=[!0,!0,!0],this.highlightColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.highlightTint=[1,1,1],this.highlightLevel=[-1,-1,-1],this.enableDynamic=[!0,!0,!0],this.dynamicLevel=[NaN,NaN,NaN],this.dynamicColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.dynamicTint=[1,1,1],this.dynamicWidth=[1,1,1],this.axesBounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.surfaceProject=[!1,!1,!1],this.contourProject=[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],this.colorBounds=[!1,!1],this._field=[_(v.mallocFloat(1024),[0,0]),_(v.mallocFloat(1024),[0,0]),_(v.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.snapToData=!1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.vertexColor=0,this.dirty=!0}function o(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||j,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=N.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],M(l,t.model,l);var u=N.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return N.showSurface=o,N.showContour=s,N}function s(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=B;n.model=t.model||P,n.view=t.view||P,n.projection=t.projection||P,n.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],n.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],n.contourColor=this.contourColor[0],n.inverseModel=A(n.inverseModel,n.model);for(var i=0;i<2;++i)for(var a=n.clipBounds[i],s=0;s<3;++s)a[s]=Math.min(Math.max(this.clipBounds[i][s],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=V,n.vertexColor=this.vertexColor;var l=U;for(M(l,n.view,n.model),M(l,n.projection,l),A(l,l),i=0;i<3;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;i<3;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;i<3;++i){var c=l[12+i];for(s=0;s<3;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var h=o(n,this);if(h.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;i<3;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=h.projections[i],this._shader.uniforms.clipBounds=h.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(h.showContour&&!e){var f=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,f.bind(),f.uniforms=n;var d=this._contourVAO;for(d.bind(),i=0;i<3;++i)for(f.uniforms.permutation=O[i],r.lineWidth(this.contourWidth[i]),s=0;s=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},F.pickSlots=1,F.setPickBase=function(t){this.pickId=t};var j=[0,0,0],N={showSurface:!1,showContour:!1,projections:[P.slice(),P.slice(),P.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:P,view:P,projection:P,inverseModel:P.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1,vertexColor:0},U=P.slice(),V=[1,0,0,0,1,0,0,0,1];F.draw=function(t){return s.call(this,t,!1)},F.drawTransparent=function(t){return s.call(this,t,!0)};var q={model:P,view:P,projection:P,inverseModel:P,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};F.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=q;r.model=t.model||P,r.view=t.view||P,r.projection=t.projection||P,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.permutation=V;for(var n=0;n<2;++n)for(var i=r.clipBounds[n],a=0;a<3;++a)i[a]=Math.min(Math.max(this.clipBounds[n][a],-1e8),1e8);var s=o(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;n<3;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var u=this._contourVAO;for(u.bind(),a=0;a<3;++a)for(e.lineWidth(this.contourWidth[a]),l.uniforms.permutation=O[a],n=0;n>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 u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;c<2;++c)for(var h=c?a:1-a,f=0;f<2;++f)for(var d=f?l:1-l,p=i+c,g=s+f,m=h*d,v=0;v<3;++v)u[v]+=this._field[v].get(p,g)*m;for(var y=this._pickResult.level,x=0;x<3;++x)if(y[x]=k.le(this.contourLevels[x],u[x]),y[x]<0)this.contourLevels[x].length>0&&(y[x]=0);else if(y[x]Math.abs(_-u[x])&&(y[x]+=1)}for(r.index[0]=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},F.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=u(t.contourWidth,Number)),"showContour"in t&&(this.showContour=u(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=u(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=h(t.contourColor)),"contourProject"in t&&(this.contourProject=u(t.contourProject,function(t){return u(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=h(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=u(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=u(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"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 n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(v.freeFloat(this._field[2].data),this._field[2].data=v.mallocFloat(d.nextPow2(n))),this._field[2]=_(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),l(this._field[2],e),this.shape=e.shape.slice();for(var a=this.shape,o=0;o<2;++o)this._field[2].size>this._field[o].data.length&&(v.freeFloat(this._field[o].data),this._field[o].data=v.mallocFloat(this._field[2].size)),this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2]);if(t.coords){var s=t.coords;if(!Array.isArray(s)||3!==s.length)throw new Error("gl-surface: invalid coordinates for x/y");for(o=0;o<2;++o){var c=s[o];for(y=0;y<2;++y)if(c.shape[y]!==a[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[o],c)}}else if(t.ticks){var f=t.ticks;if(!Array.isArray(f)||2!==f.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var p=f[o];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var g=_(p.data,a);g.stride[o]=p.stride[0],g.stride[1^o]=0,l(this._field[o],g)}}else{for(o=0;o<2;++o){var m=[0,0];m[o]=1,this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2],m,0)}this._field[0].set(0,0,0);for(var y=0;y0){for(var bt=0;bt<5;++bt)tt.pop();q-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),q+=1}}nt.push(q)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=v.mallocFloat(tt.length);for(o=0;oi||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 o(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}function s(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 l(t,e,r,n,i,a,o,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var h=0,f=0,d=s(c,l.stride.slice());"float32"===u?h=t.FLOAT:"float64"===u?(h=t.FLOAT,d=!1,u="float32"):"uint8"===u?h=t.UNSIGNED_BYTE:(h=t.UNSIGNED_BYTE,d=!1,u="uint8");var v=1;if(2===c.length)f=t.LUMINANCE,c=[c[0],c[1],1],l=p(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])f=t.ALPHA;else if(2===c[2])f=t.LUMINANCE_ALPHA;else if(3===c[2])f=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");f=t.RGBA}v=c[2]}if(f!==t.LUMINANCE&&f!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(f=i),f!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,x=o.indexOf(n)<0;if(x&&o.push(n),h===a&&d)0===l.offset&&l.data.length===y?x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data):x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var _;_=a===t.FLOAT?m.mallocFloat32(y):m.mallocUint8(y);var w=p(_,c,[c[2],c[2]*c[0],1]);h===t.FLOAT&&a===t.UNSIGNED_BYTE?b(w,l):g.assign(w,l),x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,_.subarray(0,y)),a===t.FLOAT?m.freeFloat32(_):m.freeUint8(_)}}function u(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function c(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(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 s=u(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new o(t,s,e,r,n,i)}function h(t,e,r,n){var i=u(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new o(t,i,0|e.width,0|e.height,r,n)}function f(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var a=s(n,e.stride.slice()),l=0;"float32"===r?l=t.FLOAT:"float64"===r?(l=t.FLOAT,a=!1,r="float32"):"uint8"===r?l=t.UNSIGNED_BYTE:(l=t.UNSIGNED_BYTE,a=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=p(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}l!==t.FLOAT||t.getExtension("OES_texture_float")||(l=t.UNSIGNED_BYTE,a=!1);var h,f,d=e.size;if(a)h=0===e.offset&&e.data.length===d?e.data:e.data.subarray(e.offset,e.offset+d);else{var v=[n[2],n[2]*n[0],1];f=m.malloc(d,r);var y=p(f,n,v,0);"float32"!==r&&"float64"!==r||l!==t.UNSIGNED_BYTE?g.assign(y,e):b(y,e),h=f.subarray(0,d)}var x=u(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,l,h),a||m.free(f),new o(t,x,n[0],n[1],c,l)}function d(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(v||n(t),"number"==typeof arguments[1])return c(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return c(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(i(e))return h(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return f(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var p=t("ndarray"),g=t("ndarray-ops"),m=t("typedarray-pool");e.exports=d;var v=null,y=null,x=null,b=function(t,e){g.muls(t,e,255)},_=o.prototype;Object.defineProperties(_,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),y.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(),x.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(),x.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(x.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 a(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t|=0,a(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,a(this,this._shape[0],t),t}}}),_.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},_.dispose=function(){this.gl.deleteTexture(this.handle)},_.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)},_.setPixels=function(t,e,r,n){var a=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,i(t)){var o=this._mipLevels.indexOf(n)<0;o?(a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):a.texSubImage2D(a.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");l(a,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:427,"ndarray-ops":421,"typedarray-pool":496}],233:[function(t,e,r){"use strict";function n(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;i0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}e.exports=n},{}],242:[function(t,e,r){function n(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}e.exports=n},{}],243:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,a[0]}e.exports=n;var i=new Uint8Array(4),a=new Float32Array(i.buffer)},{}],244:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function C(){return/[^a-fA-F0-9]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function I(){return"."===O?(U.push(O),B=m,R=O,j+1):/[eE]/.test(O)?(U.push(O),B=m,R=O,j+1):"x"===O&&1===U.length&&"0"===U[0]?(B=w,U.push(O),R=O,j+1):/[^\d]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function P(){return"f"===O&&(U.push(O),R=O,j+=1),/[eE]/.test(O)?(U.push(O),R=O,j+1):"-"===O&&/[eE]/.test(R)?(U.push(O),R=O,j+1):/[^\d]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),R=O,j+1)}function D(){if(/[^\d\w_]/.test(O)){var t=U.join("");return B=Q.indexOf(t)>-1?x:Z.indexOf(t)>-1?y:v,e(U.join("")),B=u,j}return U.push(O),R=O,j+1}var O,R,F,j=0,N=0,B=u,U=[],V=[],q=1,H=0,G=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return V=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var i=t("./lib/literals"),a=t("./lib/operators"),o=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,h=0,f=1,d=2,p=3,g=4,m=5,v=6,y=7,x=8,b=9,_=10,w=11,M=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":247,"./lib/builtins-300es":246,"./lib/literals":249,"./lib/literals-300es":248,"./lib/operators":250}],246:[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":247}],247:[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"]},{}],248:[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":249}],249:[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"]},{}],250:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],251:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":245}],252:[function(t,e,r){"use strict";function n(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var a=new Int32Array(this.arrayBuffer);t=a[0],e=a[1],r=a[2],this.d=e+2*r;for(var o=0;o=u[f+0]&&n>=u[f+1]?(o[h]=!0,a.push(l[h])):o[h]=!1}}},n.prototype._forEachCell=function(t,e,r,n,i,a,o){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=s;h<=u;h++)for(var f=l;f<=c;f++){var d=this.d*f+h;if(i.call(this,t,e,r,n,d,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,c=-7,h=r?i-1:0,f=r?-1:1,d=t[e+h];for(h+=f,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+h],h+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+h],h+=f,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=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=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),e+=o+h>=1?f/l:f*Math.pow(2,1-h),e*l>=2&&(o++,l/=2),o+h>=c?(s=0,o=c):o+h>=1?(s=(e*l-1)*Math.pow(2,i),o+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],254:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function a(t,e){return c(t.vertices,e.vertices)}function o(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;r<=t;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=u[t+1];return i||(i=u),n(i)}function s(t,e,r){this.dimension=t,this.vertices=e,this.simplices=r,this.interior=r.filter(function(t){return!t.boundary}),this.tuple=new Array(t+1);for(var n=0;n<=t;++n)this.tuple[n]=this.vertices[n];var i=h[t];i||(i=h[t]=o(t)),this.orient=i}function l(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var i=t[0].length;if(r<=i)throw new Error("Must input at least d+1 points");var a=t.slice(0,i+1),o=u.apply(void 0,a);if(0===o)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;c<=i;++c)l[c]=c;o<0&&(l[0]=1,l[1]=0);for(var h=new n(l,new Array(i+1),!1),f=h.adjacent,d=new Array(i+2),c=0;c<=i;++c){for(var p=l.slice(),g=0;g<=i;++g)g===c&&(p[g]=-1);var m=p[0];p[0]=p[1],p[1]=m;var v=new n(p,new Array(i+1),!0);f[c]=v,d[c]=v}d[i+1]=h;for(var c=0;c<=i;++c)for(var p=f[c].vertices,y=f[c].adjacent,g=0;g<=i;++g){var x=p[g];if(x<0)y[g]=h;else for(var b=0;b<=i;++b)f[b].vertices.indexOf(x)<0&&(y[g]=f[b])}for(var _=new s(i,a,d),w=!!e,c=i+1;c0;){t=o.pop();for(var s=(t.vertices,t.adjacent),l=0;l<=r;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,h=0;h<=r;++h){var f=c[h];f<0?i[h]=e:i[h]=a[f]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&o.push(u)}}}return null},f.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,u=s.adjacent,c=0;c<=n;++c)a[c]=i[l[c]];s.lastVisited=r;for(var c=0;c<=n;++c){var h=u[c];if(!(h.lastVisited>=r)){var f=a[c];a[c]=t;var d=this.orient();if(a[c]=f,d<0){s=h;continue t}h.boundary?h.lastVisited=-r:h.lastVisited=r}}return}return s},f.addPeaks=function(t,e){var r=this.vertices.length-1,o=this.dimension,s=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,h=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var f=[];h.length>0;){var e=h.pop(),d=e.vertices,p=e.adjacent,g=d.indexOf(r);if(!(g<0))for(var m=0;m<=o;++m)if(m!==g){var v=p[m];if(v.boundary&&!(v.lastVisited>=r)){var y=v.vertices;if(v.lastVisited!==-r){for(var x=0,b=0;b<=o;++b)y[b]<0?(x=b,l[b]=t):l[b]=s[y[b]];var _=this.orient();if(_>0){y[x]=r,v.boundary=!1,u.push(v),h.push(v),v.lastVisited=r;continue}v.lastVisited=-r}var w=v.adjacent,M=d.slice(),A=p.slice(),k=new n(M,A,!0);c.push(k);var T=w.indexOf(e);if(!(T<0)){w[T]=k,A[g]=v,M[m]=-1,A[m]=e,p[m]=k,k.flip();for(var b=0;b<=o;++b){var E=M[b];if(!(E<0||E===r)){for(var S=new Array(o-1),L=0,z=0;z<=o;++z){var C=M[z];C<0||z===b||(S[L++]=C)}f.push(new i(S,k,b))}}}}}}f.sort(a);for(var m=0;m+1=0?o[l++]=s[c]:u=1&c;if(u===(1&t)){var h=o[0];o[0]=o[1],o[1]=h}e.push(o)}}return e}},{"robust-orientation":465,"simplicial-complex":476}],255:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function a(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),a(t,r),x)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],a=[],o=[],s=[],r=0;r3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=v.ge(this.leftPoints,t,f),n=v.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===b?(this.left=null,this.count-=1,x):(n===x&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var a=this.left?this.left.count:0;if(4*a>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===b?(this.right=null,this.count-=1,x):(n===x&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?b:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var o=this,l=this.left;l.right;)o=l,l=l.right;if(o===this)l.right=this.right;else{var u=this.left,n=this.right;o.count-=l.count,o.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return x}for(var u=v.ge(this.leftPoints,t,f);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===b&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},w.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":53}],256:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;r=r&&s<=i&&l>=n&&l<=a&&c.push(t[p]);else{var g=Math.floor((d+f)/2);s=e[2*g],l=e[2*g+1],s>=r&&s<=i&&l>=n&&l<=a&&c.push(t[g]);var m=(h+1)%2;(0===h?r<=s:n<=l)&&(u.push(d),u.push(g-1),u.push(m)),(0===h?i>=s:a>=l)&&(u.push(g+1),u.push(f),u.push(m))}}return c}e.exports=n},{}],261:[function(t,e,r){"use strict";function n(t,e,r,a,o,s){if(!(o-a<=r)){var l=Math.floor((a+o)/2);i(t,e,l,a,o,s%2),n(t,e,r,a,l-1,s+1),n(t,e,r,l+1,o,s+1)}}function i(t,e,r,n,o,s){for(;o>n;){if(o-n>600){var l=o-n+1,u=r-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),d=Math.max(n,Math.floor(r-u*h/l+f)),p=Math.min(o,Math.floor(r+(l-u)*h/l+f));i(t,e,r,d,p,s)}var g=e[2*r+s],m=n,v=o;for(a(t,e,n,r),e[2*o+s]>g&&a(t,e,n,o);mg;)v--}e[2*n+s]===g?a(t,e,n,v):(v++,a(t,e,v,o)),v<=r&&(n=v+1),r<=v&&(o=v-1)}}function a(t,e,r,n){o(t,r,n),o(e,2*r,2*n),o(e,2*r+1,2*n+1)}function o(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=n},{}],262:[function(t,e,r){"use strict";function n(t,e,r,n,a,o){for(var s=[0,t.length-1,0],l=[],u=a*a;s.length;){var c=s.pop(),h=s.pop(),f=s.pop();if(h-f<=o)for(var d=f;d<=h;d++)i(e[2*d],e[2*d+1],r,n)<=u&&l.push(t[d]);else{var p=Math.floor((f+h)/2),g=e[2*p],m=e[2*p+1];i(g,m,r,n)<=u&&l.push(t[p]);var v=(c+1)%2;(0===c?r-a<=g:n-a<=m)&&(s.push(f),s.push(p-1),s.push(v)),(0===c?r+a>=g:n+a>=m)&&(s.push(p+1),s.push(h),s.push(v))}}return l}function i(t,e,r,n){var i=t-r,a=e-n;return i*i+a*a}e.exports=n},{}],263:[function(t,e,r){"use strict";function n(t,e){var r;if(h(t)){var l,u=t.stops&&"object"==typeof t.stops[0][0],c=u||void 0!==t.property,f=u||!c,d=t.type||e||"exponential";if("exponential"===d)l=o;else if("interval"===d)l=a;else if("categorical"===d)l=i;else{if("identity"!==d)throw new Error('Unknown function type "'+d+'"');l=s}if(u){for(var p={},g=[],m=0;m=t.stops.length)break;if(e<=t.stops[n][0])break;n++}return 0===n?t.stops[n][1]:n===t.stops.length?t.stops[n-1][1]:l(e,r,t.stops[n-1][0],t.stops[n][0],t.stops[n-1][1],t.stops[n][1])}function s(t,e){return e}function l(t,e,r,n,i,a){return"function"==typeof i?function(){var o=i.apply(void 0,arguments),s=a.apply(void 0,arguments);return l(t,e,r,n,o,s)}:i.length?c(t,e,r,n,i,a):u(t,e,r,n,i,a)}function u(t,e,r,n,i,a){var o,s=n-r,l=t-r;return o=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-o)+a*o}function c(t,e,r,n,i,a){for(var o=[],s=0;s -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linesdfpattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},outline:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},outlinepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\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\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},pattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform 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\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n}\n"},raster:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity0;\nuniform float u_opacity1;\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 vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\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);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform 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 v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},icon:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_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:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},sdf:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nconst float PI = 3.141592653589793;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_data[1] / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_data[1] / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = (gl_Position.w - 0.5);\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n" },collisionbox:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n"}},e.exports.util="float evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n"},{path:434}],265:[function(t,e,r){"use strict";function n(t,e){this.message=(t?t+": ":"")+i.apply(i,Array.prototype.slice.call(arguments,2)),null!==e&&void 0!==e&&e.__line__&&(this.line=e.__line__)}var i=t("util").format;e.exports=n},{util:504}],266:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1;e7)return[new n(c,l,"constants have been deprecated as of v8")];if(!(l in f.constants))return[new n(c,l,'constant "%s" not found',l)];e=a({},e,{value:f.constants[l]})}return u.function&&"object"===i(l)?r(e):u.type&&s[u.type]?s[u.type](e):o(a({},e,{valueSpec:u.type?h[u.type]:u}))}},{"../error/validation_error":265,"../util/extend":266,"../util/get_type":267,"./validate_array":270,"./validate_boolean":271,"./validate_color":272,"./validate_constants":273,"./validate_enum":274,"./validate_filter":275,"./validate_function":276,"./validate_layer":278,"./validate_number":280,"./validate_object":281,"./validate_source":283,"./validate_string":284}],270:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("./validate"),a=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.valueSpec,o=t.style,s=t.styleSpec,l=t.key,u=t.arrayElementValidator||i;if("array"!==n(e))return[new a(l,e,"array expected, %s found",n(e))];if(r.length&&e.length!==r.length)return[new a(l,e,"array length %d expected, length %d found",r.length,e.length)];if(r["min-length"]&&e.length7)return r?[new n(e,r,"constants have been deprecated as of v8")]:[];var o=i(r);if("object"!==o)return[new n(e,r,"object expected, %s found",o)];var s=[];for(var l in r)"@"!==l[0]&&s.push(new n(e+"."+l,r[l],'constants must start with "@"'));return s}},{"../error/validation_error":265,"../util/get_type":267}],274:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint");e.exports=function(t){var e=t.key,r=t.value,a=t.valueSpec,o=[];return a.values.indexOf(i(r))===-1&&o.push(new n(e,r,"expected one of [%s], %s found",a.values.join(", "),r)),o}},{"../error/validation_error":265,"../util/unbundle_jsonlint":268}],275:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_enum"),a=t("../util/get_type"),o=t("../util/unbundle_jsonlint");e.exports=function t(e){var r,s=e.value,l=e.key,u=e.styleSpec,c=[];if("array"!==a(s))return[new n(l,s,"array expected, %s found",a(s))];if(s.length<1)return[new n(l,s,"filter array must have at least 1 element")];switch(c=c.concat(i({key:l+"[0]",value:s[0],valueSpec:u.filter_operator,style:e.style,styleSpec:e.styleSpec})),o(s[0])){case"<":case"<=":case">":case">=":s.length>=2&&"$type"==s[1]&&c.push(new n(l,s,'"$type" cannot be use with operator "%s"',s[0]));case"==":case"!=":3!=s.length&&c.push(new n(l,s,'filter array for operator "%s" must have 3 elements',s[0]));case"in":case"!in":s.length>=2&&(r=a(s[1]),"string"!==r?c.push(new n(l+"[1]",s[1],"string expected, %s found",r)):"@"===s[1][0]&&c.push(new n(l+"[1]",s[1],"filter key cannot be a constant")));for(var h=2;h=8&&(f&&!t.valueSpec["property-function"]?p.push(new n(t.key,t.value,"property functions not supported")):d&&!t.valueSpec["zoom-function"]&&p.push(new n(t.key,t.value,"zoom functions not supported"))),p}},{"../error/validation_error":265,"../util/get_type":267,"./validate":269,"./validate_array":270,"./validate_number":280,"./validate_object":281}],277:[function(t,e,r){"use strict";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:(e.indexOf("{fontstack}")===-1&&a.push(new n(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&a.push(new n(r,e,'"glyphs" url must include a "{range}" token')),a)}},{"../error/validation_error":265,"./validate_string":284}],278:[function(t,e,r){"use strict";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"),u=t("../util/extend");e.exports=function(t){var e=[],r=t.value,c=t.key,h=t.style,f=t.styleSpec;r.type||r.ref||e.push(new n(c,r,'either "type" or "ref" is required'));var d=i(r.type),p=i(r.ref);if(r.id)for(var g=0;ga.maximum?[new i(e,r,"%s is greater than the maximum value %s",r,a.maximum)]:[]}},{"../error/validation_error":265,"../util/get_type":267}],281:[function(t,e,r){"use strict";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,u=t.styleSpec,c=[],h=i(r);if("object"!==h)return[new n(e,r,"object expected, %s found",h)];for(var f in r){var d=f.split(".")[0],p=o&&(o[d]||o["*"]),g=s[d]||s["*"];p||g?c=c.concat((g||a)({key:(e?e+".":e)+f,value:r[f],valueSpec:p,style:l,styleSpec:u,object:r,objectKey:f})):""!==e&&1!==e.split(".").length&&c.push(new n(e,r[f],'unknown property "%s"',f))}for(d in o)o[d].required&&void 0===o[d].default&&void 0===r[d]&&c.push(new n(e,r,'missing required property "%s"',d));return c}},{"../error/validation_error":265,"../util/get_type":267,"./validate":269}],282:[function(t,e,r){"use strict";var n=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.style,a=t.styleSpec,o=t.value,s=t.objectKey,l=a["paint_"+t.layerType],u=s.match(/^(.*)-transition$/);return u&&l[u[1]]&&l[u[1]].transition?n({key:e,value:o,valueSpec:a.transition,style:r,styleSpec:a}):t.valueSpec||l[s]?n({key:t.key,value:o,valueSpec:t.valueSpec||l[s],style:r,styleSpec:a}):[new i(e,o,'unknown property "%s"',s)]}},{"../error/validation_error":265,"./validate":269}],283:[function(t,e,r){"use strict";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 u=i(e.type);switch(u){case"vector":case"raster":var c=[];if(c=c.concat(a({key:r,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var h in e)["type","url","tileSize"].indexOf(h)<0&&c.push(new n(r+"."+h,e[h],'a source with a "url" property may not include a "%s" property',h));return c;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});default:return o({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":265,"../util/unbundle_jsonlint":268,"./validate_enum":274,"./validate_object":281}],284:[function(t,e,r){"use strict";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, %s found",a)]:[]}},{"../error/validation_error":265,"../util/get_type":267}],285:[function(t,e,r){"use strict";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:u}})),e.$version>7&&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.min"),u=t("./validate/validate_glyphs_url");n.source=a(t("./validate/validate_source")),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.min":286,"./validate/validate":269,"./validate/validate_constants":273,"./validate/validate_filter":275,"./validate/validate_glyphs_url":277,"./validate/validate_layer":278,"./validate/validate_layout_property":279,"./validate/validate_paint_property":282,"./validate/validate_source":283}],286:[function(t,e,r){e.exports=t("./v8.min.json")},{"./v8.min.json":287}],287:[function(t,e,r){e.exports={$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"},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_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"]},url:{type:"string"},tiles:{type:"array",value:"string"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"]},data:{type:"*"},maxzoom:{type:"number",default:14},buffer:{type:"number",default:64},tolerance:{type:"number",default:3},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:400},clusterMaxZoom:{type:"number"}},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","raster","background"]},metadata:{type:"*"},ref:{type:"string"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:22},maxzoom:{type:"number",minimum:0,maximum:22},interactive:{type:"boolean",default:!1},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"},"paint.*":{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_fill:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_circle:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_line:{"line-cap":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number",default:1.05,function:"interpolated","zoom-function":!0,"property-function":!0,requires:[{"line-join":"round"}]},visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_symbol:{"symbol-placement":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["point","line"],default:"point"},"symbol-spacing":{type:"number",default:250,minimum:1,function:"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1},"icon-allow-overlap":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image"]},"icon-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"viewport",requires:["icon-image"]},"icon-size":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image"]},"icon-text-fit":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!1,values:["none","both","width","height"],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,"property-function":!0,requires:["icon-image","icon-text-fit","text-field"]},"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,"property-function":!0,units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-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"]},"text-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],requires:["text-field"]},"text-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"viewport",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:"em",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-line-height":{type:"number",default:1.2,units:"em",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-letter-spacing":{type:"number",default:0,units:"em",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,"property-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,"property-function":!0,requires:["text-field"]},"text-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,default:!1,requires:["text-field"]},"text-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["text-field"]},"text-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["text-field","icon-image"]},visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_raster:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,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"]},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"]},function:{stops:{type:"array",required:!0,value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],default:"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["fill-translate"]},"fill-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["circle-translate"]},"circle-pitch-scale":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map"}},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,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-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:!0,units:"milliseconds"}},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"}}}},{}],288:[function(t,e,r){"use strict";function n(t){return!!(i()&&a()&&o()&&s()&&l()&&u()&&c()&&h(t&&t.failIfMajorPerformanceCaveat))}function i(){return"undefined"!=typeof window&&"undefined"!=typeof document}function a(){return 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 o(){return Function.prototype&&Function.prototype.bind}function s(){return 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}function l(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON}function u(){return"Worker"in window}function c(){return"Uint8ClampedArray"in window}function h(t){return void 0===d[t]&&(d[t]=f(t)),d[t]}function f(t){var e=document.createElement("canvas"),r=Object.create(n.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=t,e.probablySupportsContext?e.probablySupportsContext("webgl",r)||e.probablySupportsContext("experimental-webgl",r):e.supportsContext?e.supportsContext("webgl",r)||e.supportsContext("experimental-webgl",r):e.getContext("webgl",r)||e.getContext("experimental-webgl",r)}"undefined"!=typeof e&&e.exports?e.exports=n:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=n);var d={};n.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}},{}],289:[function(t,e,r){"use strict";function n(t){var e=t.layoutVertexArrayType;this.layoutVertexArray=new e;var r=t.elementArrayType;r&&(this.elementArray=new r);var n=t.elementArrayType2;n&&(this.elementArray2=new n),this.paintVertexArrays=i.mapObject(t.paintVertexArrayTypes,function(t){return new t})}var i=t("../util/util");e.exports=n,n.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,n.prototype.hasCapacityFor=function(t){return this.layoutVertexArray.length+t<=n.MAX_VERTEX_ARRAY_LENGTH},n.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},n.prototype.trim=function(){this.layoutVertexArray.trim(),this.elementArray&&this.elementArray.trim(),this.elementArray2&&this.elementArray2.trim();for(var t in this.paintVertexArrays)this.paintVertexArrays[t].trim()},n.prototype.serialize=function(){return{layoutVertexArray:this.layoutVertexArray.serialize(),elementArray:this.elementArray&&this.elementArray.serialize(),elementArray2:this.elementArray2&&this.elementArray2.serialize(),paintVertexArrays:i.mapObject(this.paintVertexArrays,function(t){return t.serialize()})}},n.prototype.getTransferables=function(t){t.push(this.layoutVertexArray.arrayBuffer),this.elementArray&&t.push(this.elementArray.arrayBuffer),this.elementArray2&&t.push(this.elementArray2.arrayBuffer);for(var e in this.paintVertexArrays)t.push(this.paintVertexArrays[e].arrayBuffer)}},{"../util/util":403}],290:[function(t,e,r){"use strict";function n(t){if(this.zoom=t.zoom,this.overscaling=t.overscaling,this.layer=t.layer,this.childLayers=t.childLayers,this.type=this.layer.type,this.features=[],this.id=this.layer.id,this.index=t.index,this.sourceLayer=this.layer.sourceLayer,this.sourceLayerIndex=t.sourceLayerIndex,this.minZoom=this.layer.minzoom,this.maxZoom=this.layer.maxzoom,this.paintAttributes=i(this),t.arrays){var e=this.programInterfaces;this.bufferGroups=c.mapObject(t.arrays,function(r,n){var i=e[n],a=t.paintVertexArrayTypes[n];return r.map(function(t){return new u(t,{layoutVertexArrayType:i.layoutVertexArrayType.serialize(),elementArrayType:i.elementArrayType&&i.elementArrayType.serialize(),elementArrayType2:i.elementArrayType2&&i.elementArrayType2.serialize(),paintVertexArrayTypes:a})})})}}function i(t){var e={};for(var r in t.programInterfaces){for(var n=e[r]={},i=0;i1?p.name+_:p.name;b[w]=g[_]*m}}},n.VertexArrayType=function(t){return new h({members:t,alignment:4})},n.ElementArrayType=function(t){return new h({members:[{type:"Uint16",name:"vertices",components:t||3}]})}},{"../util/struct_array":401,"../util/util":403,"./array_group":289,"./bucket/circle_bucket":291,"./bucket/fill_bucket":292,"./bucket/line_bucket":293,"./bucket/symbol_bucket":294,"./buffer_group":296,assert:34,"feature-filter":105}],291:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=i.EXTENT;e.exports=n,n.prototype=a.inherit(i,{}),n.prototype.addCircleVertex=function(t,e,r,n,i){return t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)},n.prototype.programInterfaces={circle:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType,paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("circle-color",e,r)},multiplier:255,paintProperty:"circle-color"},{name:"a_radius",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-radius",e,r)]},multiplier:10,paintProperty:"circle-radius"},{name:"a_blur",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-blur",e,r)]},multiplier:10,paintProperty:"circle-blur"},{name:"a_opacity",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-opacity",e,r)]},multiplier:255,paintProperty:"circle-opacity"}]}},n.prototype.addFeature=function(t){for(var e={zoom:this.zoom},r=o(t),n=this.prepareArrayGroup("circle",0),i=n.layoutVertexArray.length,a=0;a=s||c<0||c>=s)){var h=this.prepareArrayGroup("circle",4),f=h.layoutVertexArray,d=this.addCircleVertex(f,u,c,-1,-1);this.addCircleVertex(f,u,c,1,-1),this.addCircleVertex(f,u,c,1,1),this.addCircleVertex(f,u,c,-1,1),h.elementArray.emplaceBack(d,d+1,d+2),h.elementArray.emplaceBack(d,d+3,d+2)}}this.populatePaintArrays("circle",e,t.properties,n,i)}},{"../../util/util":403,"../bucket":290,"../load_geometry":298}],292:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=t("earcut"),l=t("../../util/classify_rings"),u=500;e.exports=n,n.prototype=a.inherit(i,{}),n.prototype.programInterfaces={fill:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType(1),elementArrayType2:new i.ElementArrayType(2),paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("fill-color",e,r)},multiplier:255,paintProperty:"fill-color"},{name:"a_outline_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("fill-outline-color",e,r)},multiplier:255,paintProperty:"fill-outline-color"},{name:"a_opacity",components:1,type:"Uint8",getValue:function(t,e,r){return[t.getPaintValue("fill-opacity",e,r)]},multiplier:255,paintProperty:"fill-opacity"}]}},n.prototype.addFeature=function(t){for(var e=o(t),r=l(e,u),n=this.prepareArrayGroup("fill",0),i=n.layoutVertexArray.length,a=0;a0&&a.push(i.length/2);for(var c=0;c=1&&n.elementArray2.emplaceBack(f-1,f),i.push(h.x),i.push(h.y)}}for(var d=s(i,a),p=0;p>6)},n.prototype.programInterfaces={line:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}]),elementArrayType:new i.ElementArrayType}},n.prototype.addFeature=function(t){for(var e=o(t,h),r=0;r2&&t[a-1].equals(t[a-2]);)a--;if(!(t.length<2)){"bevel"===e&&(n=1.05);var o=c*(s/(512*this.overscaling)),l=t[0],h=t[a-1],f=l.equals(h);if(this.prepareArrayGroup("line",10*a),2!==a||!f){this.distance=0;var d,p,g,m,v,y,x,b=r,_=f?"butt":r,w=!0;this.e1=this.e2=this.e3=-1,f&&(d=t[a-2],v=l.sub(d)._unit()._perp());for(var M=0;M0){var S=d.dist(p);if(S>2*o){var L=d.sub(d.sub(p)._mult(o/S)._round());this.distance+=L.dist(p),this.addCurrentVertex(L,this.distance,m.mult(1),0,0,!1),p=L}}var z=p&&g,C=z?e:g?b:_;if(z&&"round"===C&&(Tn&&(C="bevel"),"bevel"===C&&(T>2&&(C="flipbevel"),T100)A=v.clone();else{var I=m.x*v.y-m.y*v.x>0?-1:1,P=T*m.add(v).mag()/m.sub(v).mag();A._perp()._mult(P*I)}this.addCurrentVertex(d,this.distance,A,0,0,!1),this.addCurrentVertex(d,this.distance,A.mult(-1),0,0,!1)}else if("bevel"===C||"fakeround"===C){var D=m.x*v.y-m.y*v.x>0,O=-Math.sqrt(T*T-1);if(D?(x=0,y=O):(y=0,x=O),w||this.addCurrentVertex(d,this.distance,m,y,x,!1),"fakeround"===C){for(var R,F=Math.floor(8*(.5-(k-.5))),j=0;j=0;N--)R=m.mult((N+1)/(F+1))._add(v)._unit(),this.addPieSliceVertex(d,this.distance,R,D)}g&&this.addCurrentVertex(d,this.distance,v,-y,-x,!1)}else"butt"===C?(w||this.addCurrentVertex(d,this.distance,m,0,0,!1),g&&this.addCurrentVertex(d,this.distance,v,0,0,!1)):"square"===C?(w||(this.addCurrentVertex(d,this.distance,m,1,1,!1),this.e1=this.e2=-1),g&&this.addCurrentVertex(d,this.distance,v,-1,-1,!1)):"round"===C&&(w||(this.addCurrentVertex(d,this.distance,m,0,0,!1),this.addCurrentVertex(d,this.distance,m,1,1,!0),this.e1=this.e2=-1),g&&(this.addCurrentVertex(d,this.distance,v,-1,-1,!0),this.addCurrentVertex(d,this.distance,v,0,0,!1)));if(E&&M2*o){var U=d.add(g.sub(d)._mult(o/B)._round());this.distance+=U.dist(d),this.addCurrentVertex(U,this.distance,v.mult(1),0,0,!1),d=U}}w=!1}}}},n.prototype.addCurrentVertex=function(t,e,r,n,i,a){var o,s=a?1:0,l=this.arrayGroups.line[this.arrayGroups.line.length-1],u=l.layoutVertexArray,c=l.elementArray;o=r.clone(),n&&o._sub(r.perp()._mult(n)),this.e3=this.addLineVertex(u,t,o,s,0,n,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,o=r.mult(-1),i&&o._sub(r.perp()._mult(i)),this.e3=this.addLineVertex(u,t,o,s,1,-i,e),this.e1>=0&&this.e2>=0&&c.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>d/2&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,n,i,a))},n.prototype.addPieSliceVertex=function(t,e,r,n){var i=n?1:0;r=r.mult(n?-1:1);var a=this.arrayGroups.line[this.arrayGroups.line.length-1],o=a.layoutVertexArray,s=a.elementArray;this.e3=this.addLineVertex(o,t,r,0,i,0,e),this.e1>=0&&this.e2>=0&&s.emplaceBack(this.e1,this.e2,this.e3),n?this.e2=this.e3:this.e1=this.e3}},{"../../util/util":403,"../bucket":290,"../load_geometry":298}],294:[function(t,e,r){"use strict";function n(t){o.apply(this,arguments),this.showCollisionBoxes=t.showCollisionBoxes,this.overscaling=t.overscaling,this.collisionBoxArray=t.collisionBoxArray,this.symbolQuadsArray=t.symbolQuadsArray,this.symbolInstancesArray=t.symbolInstancesArray,this.sdfIcons=t.sdfIcons,this.iconsNeedLinear=t.iconsNeedLinear,this.adjustedTextSize=t.adjustedTextSize,this.adjustedIconSize=t.adjustedIconSize,this.fontstack=t.fontstack}function i(t,e,r,n,i,a,o,s,l,u,c){return t.emplaceBack(e,r,Math.round(64*n),Math.round(64*i),a/4,o/4,10*(u||0),c,10*(s||0),10*Math.min(l||25,25))}var a=t("point-geometry"),o=t("../bucket"),s=t("../../symbol/anchor"),l=t("../../symbol/get_anchors"),u=t("../../util/token"),c=t("../../symbol/quads"),h=t("../../symbol/shaping"),f=t("../../symbol/resolve_text"),d=t("../../symbol/mergelines"),p=t("../../symbol/clip_line"),g=t("../../util/util"),m=t("../load_geometry"),v=t("../../symbol/collision_feature"),y=h.shapeText,x=h.shapeIcon,b=c.getGlyphQuads,_=c.getIconQuads,w=o.EXTENT;e.exports=n,n.MAX_QUADS=65535,n.prototype=g.inherit(o,{}),n.prototype.serialize=function(){var t=o.prototype.serialize.apply(this);return t.sdfIcons=this.sdfIcons,t.iconsNeedLinear=this.iconsNeedLinear,t.adjustedTextSize=this.adjustedTextSize,t.adjustedIconSize=this.adjustedIconSize,t.fontstack=this.fontstack,t};var M=new o.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_offset",components:2,type:"Int16"},{name:"a_texture_pos",components:2,type:"Uint16"},{name:"a_data",components:4,type:"Uint8"}]),A=new o.ElementArrayType;n.prototype.addCollisionBoxVertex=function(t,e,r,n,i){return t.emplaceBack(e.x,e.y,Math.round(r.x),Math.round(r.y),10*n,10*i)},n.prototype.programInterfaces={glyph:{layoutVertexArrayType:M,elementArrayType:A},icon:{layoutVertexArrayType:M,elementArrayType:A},collisionBox:{layoutVertexArrayType:new o.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}])}},n.prototype.populateArrays=function(t,e,r){var n={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",{zoom:18,zoomHistory:n}),this.adjustedTextSize=this.layer.getLayoutValue("text-size",{zoom:this.zoom+1,zoomHistory:n}),this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",{zoom:18,zoomHistory:n}),this.adjustedIconSize=this.layer.getLayoutValue("icon-size",{zoom:this.zoom+1,zoomHistory:n});var i=512*this.overscaling;this.tilePixelRatio=w/i,this.compareText={},this.iconsNeedLinear=!1,this.symbolInstancesStartIndex=this.symbolInstancesArray.length;var a=this.layer.layout,o=this.features,s=this.textFeatures,l=.5,c=.5;switch(a["text-anchor"]){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(a["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":c=1;break;case"top":case"top-right":case"top-left":c=0}for(var h="right"===a["text-justify"]?1:"left"===a["text-justify"]?0:.5,f=24,p=a["text-line-height"]*f,v="line"!==a["symbol-placement"]?a["text-max-width"]*f:0,b=a["text-letter-spacing"]*f,_=[a["text-offset"][0]*f,a["text-offset"][1]*f],M=this.fontstack=a["text-font"].join(","),A=[],k=0;kw||z.y<0||z.y>w);if(!g||C){var I=C||_;this.addSymbolInstance(z,E,e,r,this.layer,I,this.symbolInstancesArray.length,this.collisionBoxArray,n.index,this.sourceLayerIndex,this.index,c,m,x,f,v,b,{zoom:this.zoom},n.properties)}}}}},n.prototype.anchorIsTooClose=function(t,e,r){var n=this.compareText;if(t in n){for(var i=n[t],a=i.length-1;a>=0;a--)if(r.dist(i[a])3*Math.PI/2))){var m=p.tl,v=p.tr,y=p.bl,x=p.br,b=p.tex,_=p.anchorPoint,w=Math.max(h+Math.log(p.minScale)/Math.LN2,f),M=Math.min(h+Math.log(p.maxScale)/Math.LN2,25);if(!(M<=w)){w===f&&(w=0);var A=Math.round(p.glyphAngle/(2*Math.PI)*256),k=i(c,_.x,_.y,m.x,m.y,b.x,b.y,w,M,f,A);i(c,_.x,_.y,v.x,v.y,b.x+b.w,b.y,w,M,f,A),i(c,_.x,_.y,y.x,y.y,b.x,b.y+b.h,w,M,f,A),i(c,_.x,_.y,x.x,x.y,b.x+b.w,b.y+b.h,w,M,f,A),u.emplaceBack(k,k+1,k+2),u.emplaceBack(k+1,k+2,k+3)}}}},n.prototype.updateIcons=function(t){this.recalculateStyleLayers();var e=this.layer.layout["icon-image"];if(e)for(var r=0;rn.MAX_QUADS&&g.warnOnce("Too many symbols being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),k>n.MAX_QUADS&&g.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),this.symbolInstancesArray.emplaceBack(P,D,O,R,A,k,T,E,t.x,t.y,s)},n.prototype.addSymbolQuad=function(t){return this.symbolQuadsArray.emplaceBack(t.anchorPoint.x,t.anchorPoint.y,t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y,t.tex.h,t.tex.w,t.tex.x,t.tex.y,t.anchorAngle,t.glyphAngle,t.maxScale,t.minScale)}},{"../../symbol/anchor":352,"../../symbol/clip_line":354,"../../symbol/collision_feature":356,"../../symbol/get_anchors":358,"../../symbol/mergelines":361,"../../symbol/quads":362,"../../symbol/resolve_text":363,"../../symbol/shaping":364,"../../util/token":402,"../../util/util":403,"../bucket":290,"../load_geometry":298,"point-geometry":442}],295:[function(t,e,r){"use strict";function n(t,e,r){this.arrayBuffer=t.arrayBuffer, this.length=t.length,this.attributes=e.members,this.itemSize=e.bytesPerElement,this.type=r,this.arrayType=e}e.exports=n,n.prototype.bind=function(t){var e=t[this.type];this.buffer?t.bindBuffer(e,this.buffer):(this.buffer=t.createBuffer(),t.bindBuffer(e,this.buffer),t.bufferData(e,this.arrayBuffer,t.STATIC_DRAW),this.arrayBuffer=null)};var i={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT"};n.prototype.setVertexAttribPointers=function(t,e){for(var r=0;r0?t["line-gap-width"]+2*t["line-width"]:t["line-width"]}function s(t,e,r,n,i){if(!e[0]&&!e[1])return t;e=u.convert(e),"viewport"===r&&e._rotate(-n);for(var a=[],o=0;or.max||f.yr.max)&&i.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return l}},{"../util/util":403,"./bucket":290,assert:34}],299:[function(t,e,r){"use strict";function n(t,e,r){this.column=t,this.row=e,this.zoom=r}e.exports=n,n.prototype={clone:function(){return new n(this.column,this.row,this.zoom)},zoomTo:function(t){return this.clone()._zoomTo(t)},sub:function(t){return this.clone()._sub(t)},_zoomTo:function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},_sub:function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this}}},{}],300:[function(t,e,r){"use strict";function n(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}e.exports=n;var i=t("../util/util").wrap;n.prototype.wrap=function(){return new n(i(this.lng,-180,180),this.lat)},n.prototype.toArray=function(){return[this.lng,this.lat]},n.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{"../util/util":403}],301:[function(t,e,r){"use strict";function n(t,e){t&&(e?this.extend(t).extend(e):4===t.length?this.extend([t[0],t[1]]).extend([t[2],t[3]]):this.extend(t[0]).extend(t[1]))}e.exports=n;var i=t("./lng_lat");n.prototype={extend:function(t){var e,r,a=this._sw,o=this._ne;if(t instanceof i)e=t,r=t;else{if(!(t instanceof n))return t?this.extend(i.convert(t)||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 i(e.lng,e.lat),this._ne=new i(r.lng,r.lat)),this},getCenter:function(){return new i((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},getSouthWest:function(){return this._sw},getNorthEast:function(){return this._ne},getNorthWest:function(){return new i(this.getWest(),this.getNorth())},getSouthEast:function(){return new i(this.getEast(),this.getSouth())},getWest:function(){return this._sw.lng},getSouth:function(){return this._sw.lat},getEast:function(){return this._ne.lng},getNorth:function(){return this._ne.lat},toArray:function(){return[this._sw.toArray(),this._ne.toArray()]},toString:function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"}},n.convert=function(t){return!t||t instanceof n?t:new n(t)}},{"./lng_lat":300}],302:[function(t,e,r){"use strict";function n(t,e){this.tileSize=512,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new i(0,0),this.zoom=0,this.angle=0,this._altitude=1.5,this._pitch=0,this._unmodified=!0}var i=t("./lng_lat"),a=t("point-geometry"),o=t("./coordinate"),s=t("../util/util").wrap,l=t("../util/interpolate"),u=t("../source/tile_coord"),c=t("../data/bucket").EXTENT,h=t("gl-matrix"),f=h.vec4,d=h.mat4,p=h.mat2;e.exports=n,n.prototype={get minZoom(){return this._minZoom},set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},get maxZoom(){return this._maxZoom},set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},get worldSize(){return this.tileSize*this.scale},get centerPoint(){return this.size._div(2)},get size(){return new a(this.width,this.height)},get bearing(){return-this.angle/Math.PI*180},set bearing(t){var e=-s(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcMatrices(),this.rotationMatrix=p.create(),p.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},get pitch(){return this._pitch/Math.PI*180},set pitch(t){var e=Math.min(60,t)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcMatrices())},get altitude(){return this._altitude},set altitude(t){var e=Math.max(.75,t);this._altitude!==e&&(this._unmodified=!1,this._altitude=e,this._calcMatrices())},get zoom(){return this._zoom},set zoom(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._calcMatrices(),this._constrain())},get center(){return this._center},set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._calcMatrices(),this._constrain())},coveringZoomLevel:function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},coveringTiles:function(t){var e=this.coveringZoomLevel(t),r=e;if(et.maxzoom&&(e=t.maxzoom);var n=this,i=n.locationCoordinate(n.center)._zoomTo(e),o=new a(i.column-.5,i.row-.5);return u.cover(e,[n.pointCoordinate(new a(0,0))._zoomTo(e),n.pointCoordinate(new a(n.width,0))._zoomTo(e),n.pointCoordinate(new a(n.width,n.height))._zoomTo(e),n.pointCoordinate(new a(0,n.height))._zoomTo(e)],t.reparseOverscaled?r:e).sort(function(t,e){return o.dist(t)-o.dist(e)})},resize:function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._calcMatrices(),this._constrain()},get unmodified(){return this._unmodified},zoomScale:function(t){return Math.pow(2,t)},scaleZoom:function(t){return Math.log(t)/Math.LN2},project:function(t,e){return new a(this.lngX(t.lng,e),this.latY(t.lat,e))},unproject:function(t,e){return new i(this.xLng(t.x,e),this.yLat(t.y,e))},get x(){return this.lngX(this.center.lng)},get y(){return this.latY(this.center.lat)},get point(){return new a(this.x,this.y)},lngX:function(t,e){return(180+t)*(e||this.worldSize)/360},latY:function(t,e){var r=180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360));return(180-r)*(e||this.worldSize)/360},xLng:function(t,e){return 360*t/(e||this.worldSize)-180},yLat:function(t,e){var r=180-360*t/(e||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90},panBy:function(t){var e=this.centerPoint._add(t);this.center=this.pointLocation(e)},setLocationAtPoint:function(t,e){var r=this.locationCoordinate(t),n=this.pointCoordinate(e),i=this.pointCoordinate(this.centerPoint),a=n._sub(r);this._unmodified=!1,this.center=this.coordinateLocation(i._sub(a))},locationPoint:function(t){return this.coordinatePoint(this.locationCoordinate(t))},pointLocation:function(t){return this.coordinateLocation(this.pointCoordinate(t))},locationCoordinate:function(t){var e=this.zoomScale(this.tileZoom)/this.worldSize,r=i.convert(t);return new o(this.lngX(r.lng)*e,this.latY(r.lat)*e,this.tileZoom)},coordinateLocation:function(t){var e=this.zoomScale(t.zoom);return new i(this.xLng(t.column,e),this.yLat(t.row,e))},pointCoordinate:function(t){var e=0,r=[t.x,t.y,0,1],n=[t.x,t.y,1,1];f.transformMat4(r,r,this.pixelMatrixInverse),f.transformMat4(n,n,this.pixelMatrixInverse);var i=r[3],a=n[3],s=r[0]/i,u=n[0]/a,c=r[1]/i,h=n[1]/a,d=r[2]/i,p=n[2]/a,g=d===p?0:(e-d)/(p-d),m=this.worldSize/this.zoomScale(this.tileZoom);return new o(l(s,u,g)/m,l(c,h,g)/m,this.tileZoom)},coordinatePoint:function(t){var e=this.worldSize/this.zoomScale(t.zoom),r=[t.column*e,t.row*e,0,1];return f.transformMat4(r,r,this.pixelMatrix),new a(r[0]/r[3],r[1]/r[3])},calculatePosMatrix:function(t,e){void 0===e&&(e=1/0),t instanceof u&&(t=t.toCoordinate(e));var r=Math.min(t.zoom,e),n=this.worldSize/Math.pow(2,r),i=new Float64Array(16);return d.identity(i),d.translate(i,i,[t.column*n,t.row*n,0]),d.scale(i,i,[n/c,n/c,1]),d.multiply(i,this.projMatrix,i),new Float32Array(i)},_constrain:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,e,r,n,i,o,s,l,u=this.size,c=this._unmodified;this.latRange&&(t=this.latY(this.latRange[1]),e=this.latY(this.latRange[0]),i=e-te&&(l=e-d)}if(this.lngRange){var p=this.x,g=u.x/2;p-gn&&(s=n-g)}void 0===s&&void 0===l||(this.center=this.unproject(new a(void 0!==s?s:this.x,void 0!==l?l:this.y))),this._unmodified=c,this._constraining=!1}},_calcMatrices:function(){if(this.height){var t=Math.atan(.5/this.altitude),e=Math.sin(t)*this.altitude/Math.sin(Math.PI/2-this._pitch-t),r=Math.cos(Math.PI/2-this._pitch)*e+this.altitude,n=new Float64Array(16);if(d.perspective(n,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,r),d.translate(n,n,[0,0,-this.altitude]),d.scale(n,n,[1,-1,1/this.height]),d.rotateX(n,n,this._pitch),d.rotateZ(n,n,this.angle),d.translate(n,n,[-this.x,-this.y,0]),this.projMatrix=n,n=d.create(),d.scale(n,n,[this.width/2,-this.height/2,1]),d.translate(n,n,[1,-1,0]),this.pixelMatrix=d.multiply(new Float64Array(16),n,this.projMatrix),n=d.invert(new Float64Array(16),this.pixelMatrix),!n)throw new Error("failed to invert matrix");this.pixelMatrixInverse=n}}}},{"../data/bucket":290,"../source/tile_coord":330,"../util/interpolate":397,"../util/util":403,"./coordinate":299,"./lng_lat":300,"gl-matrix":161,"point-geometry":442}],303:[function(t,e,r){"use strict";var n={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,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]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[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]]};e.exports=function(t,e,r,i){i=i||1;var a,o,s,l,u,c,h,f,d=[];for(a=0,o=t.length;a>16,_>>16),s.uniform2f(n.u_pixel_coord_lower,65535&b,65535&_)}s.uniformMatrix4fv(n.u_matrix,!1,t.transform.calculatePosMatrix(v)),s.drawArrays(s.TRIANGLE_STRIP,0,t.tileExtentBuffer.length)}s.stencilMask(0),s.stencilFunc(s.EQUAL,128,128)}var i=t("../source/pixels_to_tile_units"),a=t("./create_uniform_pragmas"),o=512;e.exports=n},{"../source/pixels_to_tile_units":324,"./create_uniform_pragmas":305}],307:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var a=t.gl;t.setDepthSublayer(0),t.depthMask(!1),a.disable(a.STENCIL_TEST);for(var o=0;o=l||e>=l)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=o,this.height*=o,this.bin.resize(this.width,this.height);for(var r=new ArrayBuffer(this.width*this.height),n=0;n65535)return r("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var n=this.loading[t];if(n[e])n[e].push(r);else{n[e]=[r];var i=256*e+"-"+(256*e+255),o=a(t,i,this.url);s(o,function(t,r){for(var i=!t&&new l(new c(new Uint8Array(r))),a=0;an&&null!==c){var b=v[c+1].x;m=Math.max(b,m);for(var _=c+1;_<=y;_++)v[_].y+=r,v[_].x-=b;if(o){var w=c;h[v[c].codePoint]&&w--,s(v,e,p,w,o)}p=c+1,c=null,d+=b,g++}f[x.codePoint]&&(c=y)}var M=v[v.length-1],A=M.x+e[M.codePoint].advance;m=Math.max(m,A);var k=(g+1)*r;s(v,e,p,v.length-1,o),l(v,o,i,a,m,r,g,u),t.top+=-a*k,t.bottom=t.top+k,t.left+=-i*m,t.right=t.left+m}function s(t,e,r,n,i){for(var a=e[t[n].codePoint].advance,o=(t[n].x+a)*i,s=r;s<=n;s++)t[s].x-=o}function l(t,e,r,n,i,a,o,s){for(var l=(e-r)*i+s[0],u=(-n*(o+1)+.5)*a+s[1],c=0;c1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},n.prototype.addIcons=function(t,e){for(var r=0;r1||(w?(clearTimeout(w),w=null,v("dblclick",e)):w=setTimeout(d,300))}function c(t){y("touchmove",t)}function h(t){y("touchend",t)}function f(t){y("touchcancel",t)}function d(){w=null}function p(t){var e=n.mousePos(x,t);e.equals(_)&&v("click",t)}function g(t){v("dblclick",t),t.preventDefault()}function m(t){b=t,t.preventDefault()}function v(e,r){var i=n.mousePos(x,r);return t.fire(e,{lngLat:t.unproject(i),point:i,originalEvent:r})}function y(e,r){var a=n.touchPos(x,r),o=a.reduce(function(t,e,r,n){return t.add(e.div(n.length))},new i(0,0));return t.fire(e,{lngLat:t.unproject(o),point:o,lngLats:a.map(function(e){return t.unproject(e)},this),points:a,originalEvent:r})}var x=t.getCanvasContainer(),b=null,_=null,w=null;for(var M in a)t[M]=new a[M](t,e),e.interactive&&e[M]&&t[M].enable();x.addEventListener("mouseout",r,!1),x.addEventListener("mousedown",o,!1),x.addEventListener("mouseup",s,!1),x.addEventListener("mousemove",l,!1),x.addEventListener("touchstart",u,!1),x.addEventListener("touchend",h,!1),x.addEventListener("touchmove",c,!1),x.addEventListener("touchcancel",f,!1),x.addEventListener("click",p,!1),x.addEventListener("dblclick",g,!1),x.addEventListener("contextmenu",m,!1)}},{"../util/dom":389,"./handler/box_zoom":374,"./handler/dblclick_zoom":375,"./handler/drag_pan":376,"./handler/drag_rotate":377,"./handler/keyboard":378,"./handler/scroll_zoom":379,"./handler/touch_zoom_rotate":380,"point-geometry":442}],369:[function(t,e,r){"use strict";var n=t("../util/util"),i=t("../util/interpolate"),a=t("../util/browser"),o=t("../geo/lng_lat"),s=t("../geo/lng_lat_bounds"),l=t("point-geometry"),u=e.exports=function(){};n.extend(u.prototype,{getCenter:function(){return this.transform.center},setCenter:function(t,e){return this.jumpTo({center:t},e),this},panBy:function(t,e,r){return this.panTo(this.transform.center,n.extend({offset:l.convert(t).mult(-1)},e),r),this},panTo:function(t,e,r){return this.easeTo(n.extend({center:t},e),r)},getZoom:function(){return this.transform.zoom},setZoom:function(t,e){return this.jumpTo({zoom:t},e),this},zoomTo:function(t,e,r){return this.easeTo(n.extend({zoom:t},e),r)},zoomIn:function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},zoomOut:function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},getBearing:function(){return this.transform.bearing},setBearing:function(t,e){return this.jumpTo({bearing:t},e),this},rotateTo:function(t,e,r){return this.easeTo(n.extend({bearing:t},e),r)},resetNorth:function(t,e){return this.rotateTo(0,n.extend({duration:1e3},t),e),this},snapToNorth:function(t,e){return Math.abs(this.getBearing())180&&(c.center.lng>0&&g.lng<0?g.lng+=360:c.center.lng<0&&g.lng>0&&(g.lng-=360));var x=c.zoomScale(m-f),b=c.point,_="center"in t?c.project(g).sub(h.div(x)):b,w=c.worldSize,M=t.curve,A=Math.max(c.width,c.height),k=A/x,T=_.sub(b).mag();if("minZoom"in t){var E=n.clamp(Math.min(t.minZoom,f,m),c.minZoom,c.maxZoom),S=A/c.zoomScale(E-f);M=Math.sqrt(S/T*2)}var L=M*M,z=r(0),C=function(t){return s(z)/s(z+M*t)},I=function(t){return A*((s(z)*u(z+M*t)-a(z))/L)/T},P=(r(1)-z)/M;if(Math.abs(T)<1e-6){if(Math.abs(A-k)<1e-6)return this.easeTo(t);var D=k=0)return!1;return!0}),e.join(" | ")},n.prototype=o.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e="mapboxgl-ctrl-attrib",r=this._container=a.create("div",e,t.getContainer());return this._update(),t.on("source.load",this._update.bind(this)),t.on("source.change",this._update.bind(this)),t.on("source.remove",this._update.bind(this)),t.on("moveend",this._updateEditLink.bind(this)),r},_update:function(){this._map.style&&(this._container.innerHTML=n.createAttributionString(this._map.style.sources)),this._editLink=this._container.getElementsByClassName("mapbox-improve-map")[0],this._updateEditLink()},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}})},{"../../util/dom":389,"../../util/util":403,"./control":371}],371:[function(t,e,r){"use strict";function n(){}var i=t("../../util/util"),a=t("../../util/evented");e.exports=n,n.prototype={addTo:function(t){this._map=t;var e=this._container=this.onAdd(t);if(this.options&&this.options.position){var r=this.options.position,n=t._controlCorners[r];e.className+=" mapboxgl-ctrl",r.indexOf("bottom")!==-1?n.insertBefore(e,n.firstChild):n.appendChild(e)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}},i.extend(n.prototype,a)},{"../../util/evented":395,"../../util/util":403}],372:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}var i=t("./control"),a=t("../../util/browser"),o=t("../../util/dom"),s=t("../../util/util");e.exports=n;var l={enableHighAccuracy:!1,timeout:6e3};n.prototype=s.inherit(i,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=o.create("div",e+"-group",t.getContainer());return a.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=o.create("button",e+"-icon "+e+"-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),r):r},_onContextMenu:function(t){t.preventDefault()},_onClickGeolocate:function(){navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),l),this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this.fire("geolocate",t),this._finish()},_error:function(t){this.fire("error",t),this._finish()},_finish:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}})},{"../../util/browser":387,"../../util/dom":389,"../../util/util":403,"./control":371}],373:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}function i(t){return new MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var a=t("./control"),o=t("../../util/dom"),s=t("../../util/util");e.exports=n,n.prototype=s.inherit(a,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=o.create("div",e+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(e+"-icon "+e+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(e+"-icon "+e+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(e+"-icon "+e+"-compass",t.resetNorth.bind(t)),this._compassArrow=o.create("div","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),r},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(o.disableDrag(),document.addEventListener("mousemove",this._onCompassMove),document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(document.removeEventListener("mousemove",this._onCompassMove),document.removeEventListener("mouseup",this._onCompassUp),o.enableDrag(),this._el.dispatchEvent(i(t)),t.stopPropagation())},_createButton:function(t,e){var r=o.create("button",t,this._container);return r.type="button",r.addEventListener("click",function(){e()}),r},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}})},{"../../util/dom":389,"../../util/util":403,"./control":371}],374:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../geo/lng_lat_bounds"),o=t("../../util/util");e.exports=n,n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onMouseDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},_onMouseDown:function(t){t.shiftKey&&0===t.button&&(document.addEventListener("mousemove",this._onMouseMove,!1),document.addEventListener("keydown",this._onKeyDown,!1),document.addEventListener("mouseup",this._onMouseUp,!1),i.disableDrag(),this._startPos=i.mousePos(this._el,t),this._active=!0)},_onMouseMove:function(t){var e=this._startPos,r=i.mousePos(this._el,t);this._box||(this._box=i.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var n=Math.min(e.x,r.x),a=Math.max(e.x,r.x),o=Math.min(e.y,r.y),s=Math.max(e.y,r.y);i.setTransform(this._box,"translate("+n+"px,"+o+"px)"),this._box.style.width=a-n+"px",this._box.style.height=s-o+"px"},_onMouseUp:function(t){if(0===t.button){var e=this._startPos,r=i.mousePos(this._el,t),n=new a(this._map.unproject(e),this._map.unproject(r));this._finish(),e.x===r.x&&e.y===r.y?this._fireEvent("boxzoomcancel",t):this._map.fitBounds(n,{linear:!0}).fire("boxzoomend",{originalEvent:t,boxZoomBounds:n})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},_finish:function(){this._active=!1,document.removeEventListener("mousemove",this._onMouseMove,!1),document.removeEventListener("keydown",this._onKeyDown,!1),document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),i.enableDrag()},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})}}},{"../../geo/lng_lat_bounds":301,"../../util/dom":389,"../../util/util":403}],375:[function(t,e,r){"use strict";function n(t){this._map=t,this._onDblClick=this._onDblClick.bind(this)}e.exports=n,n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},_onDblClick:function(t){this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)}}},{}],376:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/util");e.exports=n;var o=.3,s=a.bezier(0,0,o,1),l=1400,u=2500;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},_onDown:function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp)),this._active=!1,this._startPos=this._pos=i.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=i.mousePos(this._el,t),r=this._map;r.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),r.transform.setLocationAtPoint(r.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},_onUp:function(t){if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=function(){this._fireEvent("moveend",t)}.bind(this),r=this._inertia;if(r.length<2)return void e();var n=r[r.length-1],i=r[0],a=n[1].sub(i[1]),c=(n[0]-i[0])/1e3;if(0===c||n[1].equals(i[1]))return void e();var h=a.mult(o/c),f=h.mag();f>l&&(f=l,h._unit()._mult(f));var d=f/(u*o),p=h.mult(-d/2);this._map.panBy(p,{duration:1e3*d,easing:s,noMoveStart:!0},{originalEvent:t})}},_onMouseUp:function(t){this._ignoreEvent(t)||(this._onUp(t), document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onMouseUp))},_onTouchEnd:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onTouchEnd))},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragRotate&&e.dragRotate.isActive())return!0;if(t.touches)return t.touches.length>1;if(t.ctrlKey)return!0;var r=1,n=0;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>0&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":389,"../../util/util":403}],377:[function(t,e,r){"use strict";function n(t,e){this._map=t,this._el=t.getCanvasContainer(),this._bearingSnap=e.bearingSnap,o.bindHandlers(this)}var i=t("../../util/dom"),a=t("point-geometry"),o=t("../../util/util");e.exports=n;var s=.25,l=o.bezier(0,0,s,1),u=180,c=720;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},_onDown:function(t){if(!this._ignoreEvent(t)&&!this.isActive()){document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onUp),this._active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=i.mousePos(this._el,t),this._center=this._map.transform.centerPoint;var e=this._startPos.sub(this._center),r=e.mag();r<200&&(this._center=this._startPos.add(new a(-200,0)._rotate(e.angle()))),t.preventDefault()}},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t));var e=this._map;e.stop();var r=this._pos,n=i.mousePos(this._el,t),a=this._center,o=r.sub(a).angleWith(n.sub(a))/Math.PI*180,s=e.getBearing()-o,l=this._inertia,u=l[l.length-1];this._drainInertiaBuffer(),l.push([Date.now(),e._normalizeBearing(s,u[1])]),e.transform.bearing=s,this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=n}},_onUp:function(t){if(!this._ignoreEvent(t)&&(document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onUp),this.isActive())){this._active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var e=this._map,r=e.getBearing(),n=this._inertia,i=function(){Math.abs(r)u&&(m=u);var v=m/(c*s),y=p*m*(v/2);f+=y,Math.abs(e._normalizeBearing(f,0))1;var r=t.ctrlKey?1:2,n=t.ctrlKey?0:2;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>0&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":389,"../../util/util":403,"point-geometry":442}],378:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._onKeyDown=this._onKeyDown.bind(this)}e.exports=n;var i=80,a=2,o=5;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=this._map,r={originalEvent:t};if(!e.isEasing())switch(t.keyCode){case 61:case 107:case 171:case 187:e.zoomTo(Math.round(e.getZoom())+(t.shiftKey?2:1),r);break;case 189:case 109:case 173:e.zoomTo(Math.round(e.getZoom())-(t.shiftKey?2:1),r);break;case 37:t.shiftKey?e.easeTo({bearing:e.getBearing()-a},r):(t.preventDefault(),e.panBy([-i,0],r));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+a},r):(t.preventDefault(),e.panBy([i,0],r));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+o},r):(t.preventDefault(),e.panBy([0,-i],r));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-o,0)},r):(t.preventDefault(),e.panBy([0,i],r))}}}}},{}],379:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/browser"),o=t("../../util/util");e.exports=n;var s="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",l=s.indexOf("firefox")!==-1,u=s.indexOf("safari")!==-1&&s.indexOf("chrom")===-1;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},_onWheel:function(t){var e;"wheel"===t.type?(e=t.deltaY,l&&t.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(e/=a.devicePixelRatio),t.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(e*=40)):"mousewheel"===t.type&&(e=-t.wheelDeltaY,u&&(e/=3));var r=a.now(),n=r-(this._time||0);this._pos=i.mousePos(this._el,t),this._time=r,0!==e&&e%4.000244140625===0?(this._type="wheel",e=Math.floor(e/4)):0!==e&&Math.abs(e)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(n*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&this._zoom(-e,t),t.preventDefault()},_onTimeout:function(){this._type="wheel",this._zoom(-this._lastValue)},_zoom:function(t,e){if(0!==t){var r=this._map,n=2/(1+Math.exp(-Math.abs(t/100)));t<0&&0!==n&&(n=1/n);var i=r.ease?r.ease.to:r.transform.scale,a=r.transform.scaleZoom(i*n);r.zoomTo(a,{duration:0,around:r.unproject(this._pos),delayEndEvents:200},{originalEvent:e})}}}},{"../../util/browser":387,"../../util/dom":389,"../../util/util":403}],380:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/util");e.exports=n;var o=.15,s=a.bezier(0,0,o,1),l=12,u=2.5,c=.15,h=4;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},disableRotation:function(){this._rotationDisabled=!0},enableRotation:function(){this._rotationDisabled=!1},_onStart:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]);this._startVec=e.sub(r),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],document.addEventListener("touchmove",this._onMove,!1),document.addEventListener("touchend",this._onEnd,!1)}},_onMove:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]),n=e.add(r).div(2),a=e.sub(r),o=a.mag()/this._startVec.mag(),s=this._rotationDisabled?0:180*a.angleWith(this._startVec)/Math.PI,l=this._map;if(this._gestureIntent){var u={duration:0,around:l.unproject(n)};"rotate"===this._gestureIntent&&(u.bearing=this._startBearing+s),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(u.zoom=l.transform.scaleZoom(this._startScale*o)),l.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),o,n]),l.easeTo(u,{originalEvent:t})}else{var f=Math.abs(1-o)>c,d=Math.abs(s)>h;d?this._gestureIntent="rotate":f&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=a,this._startScale=l.transform.scale,this._startBearing=l.transform.bearing)}t.preventDefault()}},_onEnd:function(t){document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,r=this._map;if(e.length<2)return void r.snapToNorth({},{originalEvent:t});var n=e[e.length-1],i=e[0],a=r.transform.scaleZoom(this._startScale*n[1]),c=r.transform.scaleZoom(this._startScale*i[1]),h=a-c,f=(n[0]-i[0])/1e3,d=n[2];if(0===f||a===c)return void r.snapToNorth({},{originalEvent:t});var p=h*o/f;Math.abs(p)>u&&(p=p>0?u:-u);var g=1e3*Math.abs(p/(l*o)),m=a+p*g/2e3;m<0&&(m=0),r.easeTo({zoom:m,duration:g,easing:s,around:r.unproject(d)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>2&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":389,"../../util/util":403}],381:[function(t,e,r){"use strict";function n(){i.bindAll(["_onHashChange","_updateHash"],this)}e.exports=n;var i=t("../util/util");n.prototype={addTo:function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},remove:function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},_onHashChange:function(){var t=location.hash.replace("#","").split("/");return t.length>=3&&(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0)}),!0)},_updateHash:function(){var t=this._map.getCenter(),e=this._map.getZoom(),r=this._map.getBearing(),n=Math.max(0,Math.ceil(Math.log(e)/Math.LN2)),i="#"+Math.round(100*e)/100+"/"+t.lat.toFixed(n)+"/"+t.lng.toFixed(n)+(r?"/"+Math.round(10*r)/10:"");window.history.replaceState("","",i)}}},{"../util/util":403}],382:[function(t,e,r){"use strict";function n(t){t.parentNode&&t.parentNode.removeChild(t)}var i=t("../util/canvas"),a=t("../util/util"),o=t("../util/browser"),s=t("../util/browser").window,l=t("../util/evented"),u=t("../util/dom"),c=t("../style/style"),h=t("../style/animation_loop"),f=t("../render/painter"),d=t("../geo/transform"),p=t("./hash"),g=t("./bind_handlers"),m=t("./camera"),v=t("../geo/lng_lat"),y=t("../geo/lng_lat_bounds"),x=t("point-geometry"),b=t("./control/attribution"),_=0,w=20,M={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:_,maxZoom:w,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,workerCount:Math.max(o.hardwareConcurrency-1,1)},A=e.exports=function(t){if(t=a.extend({},M,t),t.workerCount<1)throw new Error("workerCount must an integer greater than or equal to 1.");this._interactive=t.interactive,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._trackResize=t.trackResize,this._workerCount=t.workerCount,this._bearingSnap=t.bearingSnap,"string"==typeof t.container?this._container=document.getElementById(t.container):this._container=t.container,this.animationLoop=new h,this.transform=new d(t.minZoom,t.maxZoom),t.maxBounds&&this.setMaxBounds(t.maxBounds),a.bindAll(["_forwardStyleEvent","_forwardSourceEvent","_forwardLayerEvent","_forwardTileEvent","_onStyleLoad","_onStyleChange","_onSourceAdd","_onSourceRemove","_onSourceUpdate","_onWindowOnline","_onWindowResize","_update","_render"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){this.animationLoop.set(300),this._rerender()}.bind(this)),"undefined"!=typeof s&&(s.addEventListener("online",this._onWindowOnline,!1),s.addEventListener("resize",this._onWindowResize,!1)),g(this,t),this._hash=t.hash&&(new p).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),this.stacks={},this._classes=[],this.resize(),t.classes&&this.setClasses(t.classes),t.style&&this.setStyle(t.style),t.attributionControl&&this.addControl(new b(t.attributionControl));var e=this.fire.bind(this,"error");this.on("style.error",e),this.on("source.error",e),this.on("tile.error",e),this.on("layer.error",e)};a.extend(A.prototype,l),a.extend(A.prototype,m.prototype),a.extend(A.prototype,{addControl:function(t){return t.addTo(this),this},addClass:function(t,e){return this._classes.indexOf(t)>=0||""===t?this:(this._classes.push(t),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},removeClass:function(t,e){var r=this._classes.indexOf(t);return r<0||""===t?this:(this._classes.splice(r,1),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},setClasses:function(t,e){for(var r={},n=0;n=0},getClasses:function(){return this._classes},resize:function(){var t=0,e=0;return this._container&&(t=this._container.offsetWidth||400,e=this._container.offsetHeight||300),this._canvas.resize(t,e),this.transform.resize(t,e),this.painter.resize(t,e),this.fire("movestart").fire("move").fire("resize").fire("moveend")},getBounds:function(){var t=new y(this.transform.pointLocation(new x(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new x(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new x(0,this.transform.size.y)))),t},setMaxBounds:function(t){if(t){var e=y.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=[],this.transform.latRange=[],this._update());return this},setMinZoom:function(t){if(t=null===t||void 0===t?_:t,t>=_&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom&&t<=w)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be between the current minZoom and "+w+", inclusive")},project:function(t){return this.transform.locationPoint(v.convert(t))},unproject:function(t){return this.transform.pointLocation(x.convert(t))},queryRenderedFeatures:function(){function t(t){return t instanceof x||Array.isArray(t)}var e,r={};return 2===arguments.length?(e=arguments[0],r=arguments[1]):1===arguments.length&&t(arguments[0])?e=arguments[0]:1===arguments.length&&(r=arguments[0]),this.style.queryRenderedFeatures(this._makeQueryGeometry(e),r,this.transform.zoom,this.transform.angle)},_makeQueryGeometry:function(t){void 0===t&&(t=[x.convert([0,0]),x.convert([this.transform.width,this.transform.height])]);var e,r=t instanceof x||"number"==typeof t[0];if(r){var n=x.convert(t);e=[n]}else{var i=[x.convert(t[0]),x.convert(t[1])];e=[i[0],new x(i[1].x,i[0].y),i[1],new x(i[0].x,i[1].y),i[0]]}return e=e.map(function(t){return this.transform.pointCoordinate(t)}.bind(this))},querySourceFeatures:function(t,e){return this.style.querySourceFeatures(t,e)},setStyle:function(t){return this.style&&(this.style.off("load",this._onStyleLoad).off("error",this._forwardStyleEvent).off("change",this._onStyleChange).off("source.add",this._onSourceAdd).off("source.remove",this._onSourceRemove).off("source.load",this._onSourceUpdate).off("source.error",this._forwardSourceEvent).off("source.change",this._onSourceUpdate).off("layer.add",this._forwardLayerEvent).off("layer.remove",this._forwardLayerEvent).off("layer.error",this._forwardLayerEvent).off("tile.add",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.load",this._update).off("tile.error",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent)._remove(),this.off("rotate",this.style._redoPlacement),this.off("pitch",this.style._redoPlacement)),t?(t instanceof c?this.style=t:this.style=new c(t,this.animationLoop,this._workerCount),this.style.on("load",this._onStyleLoad).on("error",this._forwardStyleEvent).on("change",this._onStyleChange).on("source.add",this._onSourceAdd).on("source.remove",this._onSourceRemove).on("source.load",this._onSourceUpdate).on("source.error",this._forwardSourceEvent).on("source.change",this._onSourceUpdate).on("layer.add",this._forwardLayerEvent).on("layer.remove",this._forwardLayerEvent).on("layer.error",this._forwardLayerEvent).on("tile.add",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.load",this._update).on("tile.error",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this.on("rotate",this.style._redoPlacement),this.on("pitch",this.style._redoPlacement),this):(this.style=null,this)},getStyle:function(){if(this.style)return this.style.serialize()},addSource:function(t,e){return this.style.addSource(t,e),this._update(!0),this},addSourceType:function(t,e,r){return this.style.addSourceType(t,e,r)},removeSource:function(t){return this.style.removeSource(t),this._update(!0),this},getSource:function(t){return this.style.getSource(t)},addLayer:function(t,e){return this.style.addLayer(t,e),this._update(!0),this},removeLayer:function(t){return this.style.removeLayer(t),this._update(!0),this},getLayer:function(t){return this.style.getLayer(t)},setFilter:function(t,e){return this.style.setFilter(t,e),this._update(!0),this},setLayerZoomRange:function(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0),this},getFilter:function(t){return this.style.getFilter(t)},setPaintProperty:function(t,e,r,n){return this.style.setPaintProperty(t,e,r,n),this._update(!0),this},getPaintProperty:function(t,e,r){return this.style.getPaintProperty(t,e,r)},setLayoutProperty:function(t,e,r){return this.style.setLayoutProperty(t,e,r),this._update(!0),this},getLayoutProperty:function(t,e){return this.style.getLayoutProperty(t,e)},getContainer:function(){return this._container},getCanvasContainer:function(){return this._canvasContainer},getCanvas:function(){return this._canvas.getElement()},_setupContainer:function(){var t=this._container;t.classList.add("mapboxgl-map");var e=this._canvasContainer=u.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=new i(this,e);var r=this._controlContainer=u.create("div","mapboxgl-control-container",t),n=this._controlCorners={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(t){n[t]=u.create("div","mapboxgl-ctrl-"+t,r)})},_setupPainter:function(){var t=this._canvas.getWebGLContext({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer});return t?void(this.painter=new f(t,this.transform)):void this.fire("error",{error:new Error("Failed to initialize WebGL")})},_contextLost:function(t){t.preventDefault(),this._frameId&&o.cancelFrame(this._frameId),this.fire("webglcontextlost",{originalEvent:t})},_contextRestored:function(t){this._setupPainter(),this.resize(),this._update(),this.fire("webglcontextrestored",{originalEvent:t})},loaded:function(){return!this._styleDirty&&!this._sourcesDirty&&!(!this.style||!this.style.loaded())},_update:function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this._rerender(),this):this},_render:function(){try{this.style&&this._styleDirty&&(this._styleDirty=!1,this.style.update(this._classes,this._classOptions),this._classOptions=null,this.style._recalculate(this.transform.zoom)),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.painter.render(this.style,{debug:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,vertices:this.vertices,rotating:this.rotating,zooming:this.zooming}),this.fire("render"),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire("load")),this._frameId=null,this.animationLoop.stopped()||(this._styleDirty=!0),(this._sourcesDirty||this._repaint||this._styleDirty)&&this._rerender()}catch(t){this.fire("error",{error:t})}return this},remove:function(){this._hash&&this._hash.remove(),o.cancelFrame(this._frameId),this.setStyle(null),"undefined"!=typeof s&&s.removeEventListener("resize",this._onWindowResize,!1);var t=this.painter.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),n(this._canvasContainer),n(this._controlContainer),this._container.classList.remove("mapboxgl-map")},_rerender:function(){this.style&&!this._frameId&&(this._frameId=o.frame(this._render))},_forwardStyleEvent:function(t){this.fire("style."+t.type,a.extend({style:t.target},t))},_forwardSourceEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_forwardLayerEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_forwardTileEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_onStyleLoad:function(t){this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this.style.update(this._classes,{transition:!1}),this._forwardStyleEvent(t)},_onStyleChange:function(t){this._update(!0),this._forwardStyleEvent(t)},_onSourceAdd:function(t){var e=t.source;e.onAdd&&e.onAdd(this),this._forwardSourceEvent(t)},_onSourceRemove:function(t){var e=t.source;e.onRemove&&e.onRemove(this),this._forwardSourceEvent(t)},_onSourceUpdate:function(t){this._update(),this._forwardSourceEvent(t)},_onWindowOnline:function(){this._update()},_onWindowResize:function(){this._trackResize&&this.stop().resize()._update()}}),a.extendAll(A.prototype,{_showTileBoundaries:!1,get showTileBoundaries(){return this._showTileBoundaries},set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},_showCollisionBoxes:!1,get showCollisionBoxes(){return this._showCollisionBoxes},set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,this.style._redoPlacement())},_showOverdrawInspector:!1,get showOverdrawInspector(){return this._showOverdrawInspector},set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},_repaint:!1,get repaint(){return this._repaint},set repaint(t){this._repaint=t,this._update()},_vertices:!1,get vertices(){return this._vertices},set vertices(t){this._vertices=t,this._update()}})},{"../geo/lng_lat":300,"../geo/lng_lat_bounds":301,"../geo/transform":302,"../render/painter":316,"../style/animation_loop":336,"../style/style":339,"../util/browser":387,"../util/canvas":388,"../util/dom":389,"../util/evented":395,"../util/util":403,"./bind_handlers":368,"./camera":369,"./control/attribution":370,"./hash":381,"point-geometry":442}],383:[function(t,e,r){"use strict";function n(t,e){t||(t=i.create("div")),t.classList.add("mapboxgl-marker"),this._el=t,this._offset=o.convert(e&&e.offset||[0,0]),this._update=this._update.bind(this)}e.exports=n;var i=t("../util/dom"),a=t("../geo/lng_lat"),o=t("point-geometry");n.prototype={addTo:function(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._el),t.on("move",this._update),this._update(),this},remove:function(){this._map&&(this._map.off("move",this._update),this._map=null);var t=this._el.parentNode;return t&&t.removeChild(this._el),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=a.convert(t),this._update(),this},getElement:function(){return this._el},_update:function(){if(this._map){var t=this._map.project(this._lngLat)._add(this._offset);i.setTransform(this._el,"translate("+t.x+"px,"+t.y+"px)")}}}},{"../geo/lng_lat":300,"../util/dom":389,"point-geometry":442}],384:[function(t,e,r){"use strict";function n(t){i.setOptions(this,t),i.bindAll(["_update","_onClickClose"],this)}e.exports=n;var i=t("../util/util"),a=t("../util/evented"),o=t("../util/dom"),s=t("../geo/lng_lat");n.prototype=i.inherit(a,{options:{closeButton:!0,closeOnClick:!0},addTo:function(t){return this._map=t,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this},remove:function(){return this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this.fire("close"),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=s.convert(t),this._update(),this},setText:function(t){return this.setDOMContent(document.createTextNode(t))},setHTML:function(t){var e,r=document.createDocumentFragment(),n=document.createElement("body");for(n.innerHTML=t;;){if(e=n.firstChild,!e)break;r.appendChild(e)}return this.setDOMContent(r)},setDOMContent:function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},_createContent:function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._content=o.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=o.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},_update:function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=o.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=o.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content));var t=this._map.project(this._lngLat).round(),e=this.options.anchor;if(!e){var r=this._container.offsetWidth,n=this._container.offsetHeight;e=t.ythis._map.transform.height-n?["bottom"]:[],t.xthis._map.transform.width-r/2&&e.push("right"),e=0===e.length?"bottom":e.join("-")}var i={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},a=this._container.classList;for(var s in i)a.remove("mapboxgl-popup-anchor-"+s);a.add("mapboxgl-popup-anchor-"+e),o.setTransform(this._container,i[e]+" translate("+t.x+"px,"+t.y+"px)")}},_onClickClose:function(){this.remove()}})},{"../geo/lng_lat":300,"../util/dom":389,"../util/evented":395,"../util/util":403}],385:[function(t,e,r){"use strict";function n(t,e){this.target=t,this.parent=e,this.callbacks={},this.callbackID=0,this.receive=this.receive.bind(this),this.target.addEventListener("message",this.receive,!1)}e.exports=n,n.prototype.receive=function(t){function e(t,e,r){this.postMessage({type:"",id:String(i),error:t?String(t):null,data:e},r)}var r,n=t.data,i=n.id;if(""===n.type)r=this.callbacks[n.id],delete this.callbacks[n.id],r&&r(n.error||null,n.data);else if("undefined"!=typeof n.id&&this.parent[n.type])this.parent[n.type](n.data,e.bind(this));else if("undefined"!=typeof n.id&&this.parent.workerSources){var a=n.type.split(".");this.parent.workerSources[a[0]][a[1]](n.data,e.bind(this))}else this.parent[n.type](n.data)},n.prototype.send=function(t,e,r,n){var i=null;r&&(this.callbacks[i=this.callbackID++]=r),this.postMessage({type:t,id:String(i),data:e},n)},n.prototype.postMessage=function(t,e){this.target.postMessage(t,e)}},{}],386:[function(t,e,r){"use strict";function n(t){var e=document.createElement("a");return e.href=t,e.protocol===document.location.protocol&&e.host===document.location.host}r.getJSON=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.setRequestHeader("Accept","application/json"),r.onerror=function(t){e(t)},r.onload=function(){if(r.status>=200&&r.status<300&&r.response){var t;try{t=JSON.parse(r.response)}catch(t){return e(t)}e(null,t)}else e(new Error(r.statusText))},r.send(),r},r.getArrayBuffer=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.responseType="arraybuffer",r.onerror=function(t){e(t)},r.onload=function(){r.status>=200&&r.status<300&&r.response?e(null,r.response):e(new Error(r.statusText))},r.send(),r},r.getImage=function(t,e){return r.getArrayBuffer(t,function(t,r){if(t)return e(t);var n=new Image;n.onload=function(){e(null,n),(window.URL||window.webkitURL).revokeObjectURL(n.src)};var i=new Blob([new Uint8Array(r)],{type:"image/png"});return n.src=(window.URL||window.webkitURL).createObjectURL(i),n.getData=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return t.width=n.width,t.height=n.height,e.drawImage(n,0,0),e.getImageData(0,0,n.width,n.height).data},n})},r.getVideo=function(t,e){var r=document.createElement("video");r.onloadstart=function(){e(null,r)};for(var i=0;i=s+n?t.call(i,1):(t.call(i,(l-s)/n),r.frame(a)))}if(!n)return t.call(i,1),null;var o=!1,s=e.exports.now();return r.frame(a),function(){o=!0}},r.supported=t("mapbox-gl-supported"),r.hardwareConcurrency=navigator.hardwareConcurrency||4,Object.defineProperty(r,"devicePixelRatio",{get:function(){return window.devicePixelRatio}}),r.supportsWebp=!1;var a=document.createElement("img");a.onload=function(){r.supportsWebp=!0},a.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=",r.supportsGeolocation=!!navigator.geolocation},{"mapbox-gl-supported":288}],388:[function(t,e,r){"use strict";function n(t,e){this.canvas=document.createElement("canvas"),t&&e&&(this.canvas.style.position="absolute",this.canvas.classList.add("mapboxgl-canvas"),this.canvas.addEventListener("webglcontextlost",t._contextLost.bind(t),!1),this.canvas.addEventListener("webglcontextrestored",t._contextRestored.bind(t),!1),this.canvas.setAttribute("tabindex",0),e.appendChild(this.canvas))}var i=t("../util"),a=t("mapbox-gl-supported");e.exports=n,n.prototype.resize=function(t,e){var r=window.devicePixelRatio||1;this.canvas.width=r*t,this.canvas.height=r*e,this.canvas.style.width=t+"px",this.canvas.style.height=e+"px"},n.prototype.getWebGLContext=function(t){return t=i.extend({},t,a.webGLContextAttributes),this.canvas.getContext("webgl",t)||this.canvas.getContext("experimental-webgl",t)},n.prototype.getElement=function(){return this.canvas}},{"../util":403,"mapbox-gl-supported":288}],389:[function(t,e,r){"use strict";function n(t){for(var e=0;e1)for(var h=0;h=0&&this._events[t].splice(r,1),this._events[t].length||delete this._events[t]}else delete this._events[t];return this},once:function(t,e){var r=function(n){this.off(t,r),e.call(this,n)}.bind(this);return this.on(t,r),this},fire:function(t,e){if(!this.listens(t))return n.endsWith(t,"error")&&console.error(e&&e.error||e||"Empty error event"),this;e=n.extend({},e),n.extend(e,{type:t,target:this});for(var r=this._events[t].slice(),i=0;i=3)for(var l=0;l1){if(s(t,e))return!0;for(var n=0;n(e.y-t.y)*(r.x-t.x)}function u(t,e,r,n){return l(t,r,n)!==l(e,r,n)&&l(t,e,r)!==l(t,e,n)}function c(t,e,r){var n=r*r;if(1===e.length)return t.distSqr(e[0])1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function f(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 d(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}e.exports={multiPolygonIntersectsBufferedMultiPoint:n,multiPolygonIntersectsMultiPolygon:i,multiPolygonIntersectsBufferedMultiLine:a}},{}],399:[function(t,e,r){"use strict";function n(t,e){this.max=t,this.onRemove=e,this.reset()}e.exports=n,n.prototype.reset=function(){for(var t in this.data)this.onRemove(this.data[t]);return this.data={},this.order=[],this},n.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var r=this.get(this.order[0]);r&&this.onRemove(r)}return this},n.prototype.has=function(t){return t in this.data},n.prototype.keys=function(){return this.order},n.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},n.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this.get(this.order[0]);e&&this.onRemove(e)}return this}},{}],400:[function(t,e,r){"use strict";function n(t,e,r){if(r=r||o.ACCESS_TOKEN,!r&&o.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox GL. See https://www.mapbox.com/developers/api/#access-tokens");if(t=t.replace(/^mapbox:\/\//,o.API_URL+e),t+=t.indexOf("?")!==-1?"&access_token=":"?access_token=",o.REQUIRE_ACCESS_TOKEN){if("s"===r[0])throw new Error("Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). See https://www.mapbox.com/developers/api/#access-tokens");t+=r}return t}function i(t){return t?"?"+t:""}function a(t){return t.access_token&&"tk."===t.access_token.slice(0,3)?u.extend({},t,{access_token:o.ACCESS_TOKEN}):t}var o=t("./config"),s=t("./browser"),l=t("url"),u=t("./util");e.exports.normalizeStyleURL=function(t,e){var r=l.parse(t);return"mapbox:"!==r.protocol?t:n("mapbox:/"+r.pathname+i(r.query),"/styles/v1/",e)},e.exports.normalizeSourceURL=function(t,e){var r=l.parse(t);return"mapbox:"!==r.protocol?t:n(t+".json","/v4/",e)+"&secure"},e.exports.normalizeGlyphsURL=function(t,e){var r=l.parse(t);if("mapbox:"!==r.protocol)return t;var a=r.pathname.split("/")[1];return n("mapbox://"+a+"/{fontstack}/{range}.pbf"+i(r.query),"/fonts/v1/",e)},e.exports.normalizeSpriteURL=function(t,e,r,a){var o=l.parse(t);return"mapbox:"!==o.protocol?(o.pathname+=e+r,l.format(o)):n("mapbox:/"+o.pathname+"/sprite"+e+r+i(o.query),"/styles/v1/",a)},e.exports.normalizeTileURL=function(t,e,r){var n=l.parse(t,!0);if(!e)return t;var i=l.parse(e);if("mapbox:"!==i.protocol)return t;var o=s.supportsWebp?".webp":"$1",u=s.devicePixelRatio>=2||512===r?"@2x":"";return l.format({protocol:n.protocol,hostname:n.hostname,pathname:n.pathname.replace(/(\.(?:png|jpg)\d*)/,u+o),query:a(n.query)})}},{"./browser":387,"./config":392,"./util":403,url:500}],401:[function(t,e,r){"use strict";function n(t){function e(){f.apply(this,arguments)}function r(){d.apply(this,arguments),this.members=e.prototype.members}var n=JSON.stringify(t);if(m[n])return m[n];void 0===t.alignment&&(t.alignment=1),e.prototype=Object.create(f.prototype);var s=0,u=0,v=["Uint8"];return e.prototype.members=t.members.map(function(r){r={name:r.name,type:r.type,components:r.components||1},p(r.name.length),p(r.type in g),v.indexOf(r.type)<0&&v.push(r.type);var n=o(r.type);u=Math.max(u,n),r.offset=s=a(s,Math.max(t.alignment,n));for(var i=0;ithis.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*this.RESIZE_MULTIPLIER),this.DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},d.prototype._refreshViews=function(){for(var t=0;t=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.coalesce=function(){for(var t=0;t=0)return!0;return!1};var o={};r.warnOnce=function(t){o[t]||("undefined"!=typeof console&&console.warn(t),o[t]=!0)}},{"../geo/coordinate":299,unitbezier:499}],404:[function(t,e,r){"use strict";function n(t,e,r,n){this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,null!=t.id&&(this.id=t.id)}e.exports=n,n.prototype={type:"Feature",get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},set geometry(t){this._geometry=t},toJSON:function(){var t={};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&"toJSON"!==e&&(t[e]=this[e]);return t}}},{}],405:[function(t,e,r){e.exports={_args:[[{raw:"mapbox-gl@^0.22.0",scope:null,escapedName:"mapbox-gl",name:"mapbox-gl",rawSpec:"^0.22.0",spec:">=0.22.0 <0.23.0",type:"range"},"/home/etienne/Documents/plotly/plotly.js"]],_from:"mapbox-gl@>=0.22.0 <0.23.0",_id:"mapbox-gl@0.22.1",_inCache:!0,_location:"/mapbox-gl",_nodeVersion:"4.4.5",_npmOperationalInternal:{host:"packages-12-west.internal.npmjs.com",tmp:"tmp/mapbox-gl-0.22.1.tgz_1471549891670_0.8762630566488951"},_npmUser:{name:"lucaswoj",email:"lucas@lucaswoj.com"},_npmVersion:"2.15.5",_phantomChildren:{},_requested:{raw:"mapbox-gl@^0.22.0",scope:null,escapedName:"mapbox-gl",name:"mapbox-gl",rawSpec:"^0.22.0",spec:">=0.22.0 <0.23.0",type:"range"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.1.tgz",_shasum:"92a965547d4c2f24c22cbc487eeda48694cb627a",_shrinkwrap:null,_spec:"mapbox-gl@^0.22.0",_where:"/home/etienne/Documents/plotly/plotly.js",browser:{"./js/util/ajax.js":"./js/util/browser/ajax.js","./js/util/browser.js":"./js/util/browser/browser.js","./js/util/canvas.js":"./js/util/browser/canvas.js","./js/util/dom.js":"./js/util/browser/dom.js","./js/util/web_worker.js":"./js/util/browser/web_worker.js"},bugs:{url:"https://github.com/mapbox/mapbox-gl-js/issues"},dependencies:{csscolorparser:"^1.0.2",earcut:"^2.0.3","feature-filter":"^2.2.0","geojson-rewind":"^0.1.0","geojson-vt":"^2.4.0","gl-matrix":"^2.3.1","grid-index":"^1.0.0","mapbox-gl-function":"^1.2.1","mapbox-gl-shaders":"github:mapbox/mapbox-gl-shaders#de2ab007455aa2587c552694c68583f94c9f2747","mapbox-gl-style-spec":"github:mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae","mapbox-gl-supported":"^1.2.0",pbf:"^1.3.2",pngjs:"^2.2.0","point-geometry":"^0.0.0",quickselect:"^1.0.0",request:"^2.39.0","resolve-url":"^0.2.1","shelf-pack":"^1.0.0",supercluster:"^2.0.1",unassertify:"^2.0.0",unitbezier:"^0.0.0","vector-tile":"^1.3.0","vt-pbf":"^2.0.2",webworkify:"^1.3.0","whoots-js":"^2.0.0"},description:"A WebGL interactive maps library",devDependencies:{"babel-preset-react":"^6.11.1",babelify:"^7.3.0",benchmark:"~2.1.0",browserify:"^13.0.0",clipboard:"^1.5.12","concat-stream":"1.5.1",coveralls:"^2.11.8",doctrine:"^1.2.1",documentation:"https://github.com/documentationjs/documentation/archive/bb41619c734e59ef3fbc3648610032efcfdaaace.tar.gz","documentation-theme-utils":"3.0.0",envify:"^3.4.0",eslint:"^2.5.3","eslint-config-mourner":"^2.0.0","eslint-plugin-html":"^1.5.1",gl:"^4.0.1",handlebars:"4.0.5","highlight.js":"9.3.0",istanbul:"^0.4.2","json-loader":"^0.5.4",lodash:"^4.13.1","mapbox-gl-test-suite":"github:mapbox/mapbox-gl-test-suite#7babab52fb02788ebbc38384139bf350e8e38552","memory-fs":"^0.3.0",minifyify:"^7.0.1","npm-run-all":"^3.0.0",nyc:"6.4.0",proxyquire:"^1.7.9",remark:"4.2.2","remark-html":"3.0.0",sinon:"^1.15.4",st:"^1.2.0",tap:"^5.7.0","transform-loader":"^0.2.3","unist-util-visit":"1.1.0",vinyl:"1.1.1","vinyl-fs":"2.4.3",watchify:"^3.7.0",webpack:"^1.13.1","webworkify-webpack":"^1.1.3"},directories:{},dist:{shasum:"92a965547d4c2f24c22cbc487eeda48694cb627a",tarball:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.1.tgz"},engines:{node:">=4.0.0"},gitHead:"13a9015341f0602ccb55c98c53079838ad4b70b5",homepage:"https://github.com/mapbox/mapbox-gl-js#readme",license:"BSD-3-Clause",main:"js/mapbox-gl.js",maintainers:[{name:"aaronlidman",email:"aaronlidman@gmail.com"},{name:"ajashton",email:"aj.ashton@gmail.com"},{name:"ansis",email:"ansis.brammanis@gmail.com"},{name:"bergwerkgis",email:"wb@bergwerk-gis.at"},{name:"bhousel",email:"bryan@mapbox.com"},{name:"bsudekum",email:"bobby@mapbox.com"},{name:"camilleanne",email:"camille@mapbox.com"},{name:"dnomadb",email:"damon@mapbox.com"},{name:"dthompson",email:"dthompson@gmail.com"},{name:"emilymcafee",email:"emily@mapbox.com"},{name:"flippmoke",email:"flippmoke@gmail.com"},{name:"freenerd",email:"spam@freenerd.de"},{name:"gretacb",email:"carol@mapbox.com"},{name:"ian29",email:"ian.villeda@gmail.com"},{name:"ianshward",email:"ian@mapbox.com"},{name:"ingalls",email:"nicholas.ingalls@gmail.com"},{name:"jfirebaugh",email:"john.firebaugh@gmail.com"},{name:"jrpruit1",email:"jake@jakepruitt.com"},{name:"karenzshea",email:"karen@mapbox.com"},{name:"kkaefer",email:"kkaefer@gmail.com"},{name:"lbud",email:"lauren@mapbox.com"},{name:"lucaswoj",email:"lucas@lucaswoj.com"},{name:"lxbarth",email:"alex@mapbox.com"},{name:"lyzidiamond",email:"lyzi@mapbox.com"},{name:"mapbox-admin",email:"accounts@mapbox.com"},{name:"mateov",email:"matt@mapbox.com"},{name:"mcwhittemore",email:"mcwhittemore@gmail.com"},{name:"miccolis",email:"jeff@miccolis.net"},{name:"mikemorris",email:"michael.patrick.morris@gmail.com"},{name:"morganherlocker",email:"morgan.herlocker@gmail.com"},{name:"mourner",email:"agafonkin@gmail.com"},{name:"nickidlugash",email:"nicki@mapbox.com"},{name:"rclark",email:"ryan.clark.j@gmail.com"},{name:"samanbb",email:"saman@mapbox.com"},{name:"sbma44",email:"tlee@mapbox.com"},{name:"scothis",email:"scothis@gmail.com"},{name:"sgillies",email:"sean@mapbox.com"},{name:"springmeyer",email:"dane@mapbox.com"},{name:"themarex",email:"patrick@mapbox.com"},{name:"tmcw",email:"tom@macwright.org"},{name:"tristen",email:"tristen.brown@gmail.com"},{name:"willwhite",email:"will@mapbox.com"},{name:"yhahn",email:"young@mapbox.com"}],name:"mapbox-gl",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git://github.com/mapbox/mapbox-gl-js.git"},scripts:{build:"npm run build-docs # invoked by publisher when publishing docs on the mb-pages branch","build-dev":"browserify js/mapbox-gl.js --debug --standalone mapboxgl > dist/mapbox-gl-dev.js && tap --no-coverage test/build/dev.test.js","build-docs":"documentation build --github --format html -c documentation.yml --theme ./docs/_theme --output docs/api/","build-min":"browserify js/mapbox-gl.js --debug -t unassertify --plugin [minifyify --map mapbox-gl.js.map --output dist/mapbox-gl.js.map] --standalone mapboxgl > dist/mapbox-gl.js && tap --no-coverage test/build/min.test.js","build-token":"browserify debug/access-token-src.js --debug -t envify > debug/access-token.js",lint:"eslint --ignore-path .gitignore js test bench docs/_posts/examples/*.html","open-changed-examples":"git diff --name-only mb-pages HEAD -- docs/_posts/examples/*.html | awk '{print \"http://127.0.0.1:4000/mapbox-gl-js/example/\" substr($0,33,length($0)-37)}' | xargs open",start:"run-p build-token watch-dev watch-bench start-server","start-bench":"run-p build-token watch-bench start-server","start-debug":"run-p build-token watch-dev start-server","start-docs":"npm run build-min && npm run build-docs && jekyll serve -w","start-server":"st --no-cache --localhost --port 9966 --index index.html .",test:"npm run lint && tap --reporter dot test/js/*/*.js test/build/webpack.test.js","test-suite":"node test/render.test.js && node test/query.test.js","watch-bench":"node bench/download-data.js && watchify bench/index.js --plugin [minifyify --no-map] -t [babelify --presets react] -t unassertify -t envify -o bench/bench.js -v","watch-dev":"watchify js/mapbox-gl.js --debug --standalone mapboxgl -o dist/mapbox-gl-dev.js -v"},version:"0.22.1"}},{}],406:[function(t,e,r){"use strict";function n(t,e,r){for(var n=new Array(t),i=0;im[1][2]&&(x[0]=-x[0]),m[0][2]>m[2][0]&&(x[1]=-x[1]),m[1][0]>m[0][1]&&(x[2]=-x[2]),!0}},{"./normalize":408,"gl-mat4/clone":143,"gl-mat4/create":144,"gl-mat4/determinant":145,"gl-mat4/invert":149,"gl-mat4/transpose":159,"gl-vec3/cross":237,"gl-vec3/dot":238,"gl-vec3/length":239,"gl-vec3/normalize":241}],408:[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}},{}],409:[function(t,e,r){function n(t,e,r,n){if(0===c(e)||0===c(r))return!1;var i=u(e,f.translate,f.scale,f.skew,f.perspective,f.quaternion),a=u(r,d.translate,d.scale,d.skew,d.perspective,d.quaternion);return!(!i||!a)&&(s(p.translate,f.translate,d.translate,n),s(p.skew,f.skew,d.skew,n),s(p.scale,f.scale,d.scale,n),s(p.perspective,f.perspective,d.perspective,n),h(p.quaternion,f.quaternion,d.quaternion,n),l(t,p.translate,p.scale,p.skew,p.perspective,p.quaternion),!0)}function i(){return{translate:a(),scale:a(1),skew:a(),perspective:o(),quaternion:o()}}function a(t){return[t||0,t||0,t||0]}function o(){return[0,0,0,1]}var s=t("gl-vec3/lerp"),l=t("mat4-recompose"),u=t("mat4-decompose"),c=t("gl-mat4/determinant"),h=t("quat-slerp"),f=i(),d=i(),p=i();e.exports=n},{"gl-mat4/determinant":145,"gl-vec3/lerp":240,"mat4-decompose":407,"mat4-recompose":410,"quat-slerp":447}],410:[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":144,"gl-mat4/fromRotationTranslation":147,"gl-mat4/identity":148,"gl-mat4/multiply":151,"gl-mat4/scale":157,"gl-mat4/translate":158}],411:[function(t,e,r){"use strict";function n(t){this._components=t.slice(),this._time=[0],this.prevMatrix=t.slice(),this.nextMatrix=t.slice(),this.computedMatrix=t.slice(),this.computedInverse=t.slice(),this.computedEye=[0,0,0],this.computedUp=[0,0,0],this.computedCenter=[0,0,0],this.computedRadius=[0],this._limits=[-(1/0),1/0]}function i(t){t=t||{};var e=t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return new n(e)}var a=t("binary-search-bounds"),o=t("mat4-interpolate"),s=t("gl-mat4/invert"),l=t("gl-mat4/rotateX"),u=t("gl-mat4/rotateY"),c=t("gl-mat4/rotateZ"),h=t("gl-mat4/lookAt"),f=t("gl-mat4/translate"),d=(t("gl-mat4/scale"),t("gl-vec3/normalize")),p=[0,0,0];e.exports=i;var g=n.prototype;g.recalcMatrix=function(t){var e=this._time,r=a.le(e,t),n=this.computedMatrix;if(!(r<0)){var i=this._components;if(r===e.length-1)for(var l=16*r,u=0;u<16;++u)n[u]=i[l++];else{for(var c=e[r+1]-e[r],l=16*r,h=this.prevMatrix,f=!0,u=0;u<16;++u)h[u]=i[l++];for(var p=this.nextMatrix,u=0;u<16;++u)p[u]=i[l++],f=f&&h[u]===p[u];if(c<1e-6||f)for(var u=0;u<16;++u)n[u]=h[u];else o(n,h,p,(t-e[r])/c)}var g=this.computedUp;g[0]=n[1],g[1]=n[5],g[2]=n[6],d(g,g);var m=this.computedInverse;s(m,n);var v=this.computedEye,y=m[15];v[0]=m[12]/y,v[1]=m[13]/y,v[2]=m[14]/y;for(var x=this.computedCenter,b=Math.exp(this.computedRadius[0]),u=0;u<3;++u)x[u]=v[u]-n[2+4*u]*b}},g.idle=function(t){if(!(t1&&i(t[o[c-2]],t[o[c-1]],u)<=0;)c-=1,o.pop();for(o.push(l),c=s.length;c>1&&i(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(l)}for(var r=new Array(s.length+o.length-2),h=0,n=0,f=o.length;n0;--d)r[h++]=s[d];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":465}],413:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==g.alt,g.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==g.shift,g.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==g.control,g.control=!!t.ctrlKey), -"metaKey"in t&&(e=e||t.metaKey!==g.meta,g.meta=!!t.metaKey),e}function n(t,n){var a=i.x(n),o=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==f||a!==d||o!==p||r(n))&&(f=0|t,d=a||0,p=o||0,e&&e(f,d,p,g))}function a(t){n(0,t)}function o(){(f||d||p||g.shift||g.alt||g.meta||g.control)&&(d=p=0,f=0,g.shift=g.alt=g.control=g.meta=!1,e&&e(0,0,0,g))}function s(t){r(t)&&e&&e(f,d,p,g)}function l(t){0===i.buttons(t)?n(0,t):n(f,t)}function u(t){n(f|i.buttons(t),t)}function c(t){n(f&~i.buttons(t),t)}function h(){m||(m=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",a),t.addEventListener("mouseenter",a),t.addEventListener("mouseout",a),t.addEventListener("mouseover",a),t.addEventListener("blur",o),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",o),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var f=0,d=0,p=0,g={shift:!1,alt:!1,control:!1,meta:!1},m=!1;h();var v={element:t};return Object.defineProperties(v,{enabled:{get:function(){return m},set:function(t){t&&h()},enumerable:!0},buttons:{get:function(){return f},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return g},enumerable:!0}}),v}e.exports=n;var i=t("mouse-event")},{"mouse-event":414}],414:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<=0;--e)L(e,0);for(var r=[],e=0;e0;_=_-1&g)b.push(w+"["+T+"+"+m(_)+"]");b.push(v(0));for(var _=0;_0){",f(b[t]),"=1;"),D(t-1,e|1<0&&G.push(s(U,b[V-1])+"*"+o(b[V-1])),N.push(d(U,b[V])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)X.push(o(b[U]));N.push(k+"=("+X.join("*")+")|0",M+"=mallocUint32("+k+")",w+"=mallocUint32("+k+")",T+"=0"),N.push(p(0)+"=0");for(var V=1;V<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 a=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return x(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=b;var w="V",M="P",A="N",k="Q",T="X",E="T"},{"typedarray-pool":496}],417:[function(t,e,r){"use strict";var n=t("cwise/lib/wrapper")({args:["index","array","scalar"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{_inline_4_arg1_=_inline_4_arg2_.apply(void 0,_inline_4_arg0_)}",args:[{name:"_inline_4_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_4_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_4_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":94}],418:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;r=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){o.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push("&&s[",l,"]>2");o.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push(",dst.pick(",s.join(),",",l,")",u);o.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",f.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>1){diff(",h,",src.pick(",f.join(),")",u,",src.pick(",d.join(),")",u,");}else{zero(",h,");};");break;case"mirror":0===r?o.push("dst.set(",s.join(),",",c,",0);"):o.push("zero(",h,");");break;case"wrap":var p=s.slice(),g=s.slice();e[l]<0?(p[c]="s["+c+"]-2",g[c]="0"):(p[c]="s["+c+"]-1",g[c]="1"),0===r?o.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>2){diff(",h,",src.pick(",p.join(),")",u,",src.pick(",g.join(),")",u,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&o.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var a=t.length,o=["function gradient(dst,src){var s=src.shape.slice();"],s=0;s<1<>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=a({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]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var h=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=o({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=o({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=o({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=a({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=a({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=o({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":91}],422:[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":423,ndarray:427}],423:[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":91}],424:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;r1){for(var h=[],f=1;f1){o.push("dptr=0;sptr=ptr");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&o.push(["for(i",d,"=0;i",d,"left){","dptr=0","sptr=cptr-s0");for(var f=1;fb){break __l}"].join(""));for(var f=t.length-1;f>=1;--f)o.push("sptr+=e"+f,"dptr+=f"+f,"}");o.push("dptr=cptr;sptr=cptr-s0");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&o.push(["for(i",d,"=0;i",d,"=0;--f){var d=t[f];0!==d&&o.push(["for(i",d,"=0;i",d,"left)&&("+r("cptr-s0")+">scratch)){",a("cptr",r("cptr-s0")),"cptr-=s0","}",a("cptr","scratch"));if(o.push("}"),t.length>1&&u&&o.push("free(scratch)"),o.push("} return "+s),u){var p=new Function("malloc","free",o.join("\n"));return p(u[0],u[1])}var p=new Function(o.join("\n"));return p()}function o(t,e,r){function a(t){return["(offset+",t,"*s0)"].join("")}function o(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+a(e[0]));else for(var i=0;i=0;--i){var o=t[i];0!==o&&_.push(["for(i",o,"=0;i",o,"1)for(var i=0;i1?_.push("ptr_shift+=d"+o):_.push("ptr0+=d"+o),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+a(r[0]));else{for(var o=0;o1)for(var o=0;o=1;--o)n&&_.push("pivot_ptr+=f"+o),r.length>1?_.push("ptr_shift+=e"+o):_.push("ptr0+=e"+o),_.push("}")}function h(){t.length>1&&A&&_.push("free(pivot1)","free(pivot2)")}function f(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++k;c(s,[n,i],!1,["comp=",o("ptr0"),"-",o("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",o(a(n)),">",o(a(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?l([e,r],!1,s("ptr0",o("ptr1"))):_.push(s(a(e),o(a(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++k;c(i,[r],!0,[e,"=",o("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",o(a(r)),"-pivot",n].join(""))}function g(e,r){t.length>1?l([e,r],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join(""))}function m(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","ptr2=",a(n),"\n","++",r,"\n","--",n,"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join(""))}function v(t,e){g(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",o("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(a(e),o(a(r))),s(a(r),"pivot"+n))}function x(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function b(e,r,n){t.length>1?(_.push(["__l",++k,":while(true){"].join("")),l([e],!0,["if(",o("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",k,"}"].join("")),_.push(n,"}")):_.push(["while(",o(a(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),M=["left","right","data","offset"].concat(i(t.length)),A=n(e),k=0;_.push(["function ",w,"(",M.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],S=1;S1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",o("ptr1"),"\n","pivot2[pivot_ptr]=",o("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",o("ptr0"),"\n","y=",o("ptr2"),"\n","z=",o("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",o(a("el2")),"\n","pivot2=",o(a("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",o(a("el1")),"\n","y=",o(a("el3")),"\n","z=",o(a("el5")),"\n",s(a("index1"),"x"),"\n",s(a("index3"),"y"),"\n",s(a("index5"),"z")].join("")),d("index2","left"),d("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),p("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),p("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),m("k","less","great"),_.push("break"),_.push("}else{"),v("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"), -_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp>0){"),_.push("if(--greatindex5){"),b("less",1,"++less"),b("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp===0){"),_.push("if(--great1&&A){var L=new Function("insertionSort","malloc","free",_.join("\n"));return L(r,A[0],A[1])}var L=new Function("insertionSort",_.join("\n"));return L(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c0?l.push(["d",m,"=s",m,"-d",p,"*n",p].join("")):l.push(["d",m,"=s",m].join("")),p=m);var d=t.length-1-c;0!==d&&(g>0?l.push(["e",d,"=s",d,"-e",g,"*n",g,",f",d,"=",h[d],"-f",g,"*n",g].join("")):l.push(["e",d,"=s",d,",f",d,"=",h[d]].join("")),g=d)}r.push("var "+l.join(","));var v=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",v.join(","),")}else{","quickSort(",v.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),x=a(t,e),b=o(t,e,x);return y(x,b)}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":496}],425:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],o=n.join(":"),s=a[o];return s||(a[o]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),a={};e.exports=n},{"./lib/compile_sort.js":424}],426:[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_21_arg4_)}",args:[{name:"_inline_21_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_21_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_21_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_21_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_21_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_22_arg2_(this_warped,_inline_22_arg0_),_inline_22_arg1_=_inline_22_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_22_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_22_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_22_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_22_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_22_arg4_",lvalue:!1,rvalue:!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_25_arg2_(this_warped,_inline_25_arg0_),_inline_25_arg1_=_inline_25_arg3_(_inline_25_arg4_,this_warped[0])}",args:[{name:"_inline_25_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_25_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_25_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_25_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_25_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"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_28_arg2_(this_warped,_inline_28_arg0_),_inline_28_arg1_=_inline_28_arg3_(_inline_28_arg4_,this_warped[0],this_warped[1])}",args:[{name:"_inline_28_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_28_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_28_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_28_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_28_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"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_31_arg2_(this_warped,_inline_31_arg0_),_inline_31_arg1_=_inline_31_arg3_(_inline_31_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_31_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_31_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_31_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_31_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_31_arg4_",lvalue:!1,rvalue:!0,count:1}],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":94,"ndarray-linear-interpolate":420}],427:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;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("+u.join(",")+",v){"),n?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var m=0;m=0){d=i"+m+"|0;b+=c"+m+"*d;a"+m+"-=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var m=0;m=0){c=(c+this.stride["+m+"]*i"+m+")|0}else{a.push(this.shape["+m+"]);b.push(this.stride["+m+"])}");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,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",a.join("\n"));return o(h[t],i)}function o(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=h.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),a=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":97}],429:[function(t,e,r){var n=1e-6,i=1e-6;r.vertexNormals=function(t,e,r){for(var i=e.length,a=new Array(i),o=void 0===r?n:r,s=0;so)for(var _=a[c],w=1/Math.sqrt(v*x),b=0;b<3;++b){var M=(b+1)%3,A=(b+2)%3;_[b]+=w*(y[M]*m[A]-y[A]*m[M])}}for(var s=0;so)for(var w=1/Math.sqrt(k),b=0;b<3;++b)_[b]*=w;else for(var b=0;b<3;++b)_[b]=0}return a},r.faceNormals=function(t,e,r){for(var n=t.length,a=new Array(n),o=void 0===r?i:r,s=0;so?1/Math.sqrt(p):0;for(var c=0;c<3;++c)d[c]*=p;a[s]=d}return a}},{}],430:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u){var c=e+a+u;if(h>0){var h=Math.sqrt(c+1);t[0]=.5*(o-l)/h,t[1]=.5*(s-n)/h,t[2]=.5*(r-a)/h,t[3]=.5*h}else{var f=Math.max(e,a,u),h=Math.sqrt(2*f-c+1);e>=f?(t[0]=.5*h,t[1]=.5*(i+r)/h,t[2]=.5*(s+n)/h,t[3]=.5*(o-l)/h):a>=f?(t[0]=.5*(r+i)/h,t[1]=.5*h,t[2]=.5*(l+o)/h,t[3]=.5*(s-n)/h):(t[0]=.5*(n+s)/h,t[1]=.5*(o+l)/h,t[2]=.5*h,t[3]=.5*(r-i)/h)}return t}e.exports=n},{}],431:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function a(t,e){var r=e[0],n=e[1],a=e[2],o=e[3],s=i(r,n,a,o);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=a/s,t[3]=o/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function o(t,e,r){this.radius=l([r]),this.center=l(e),this.rotation=l(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),r=[].slice.call(r,0,4),a(r,r);var i=new o(r,e,Math.log(n));return i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up),i}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/lookAt"),c=t("gl-mat4/fromQuat"),h=t("gl-mat4/invert"),f=t("./lib/quatFromFrame"),d=o.prototype;d.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},d.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;a(e,e);var r=this.computedMatrix;c(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 u=0,h=0;h<3;++h)u+=r[l+4*h]*i[h];r[12+l]=-u}},d.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},d.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},d.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},d.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=a[1],s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],h=a[4],f=a[8],d=c*o+h*s+f*l;c-=o*d,h-=s*d,f-=l*d;var p=n(c,h,f);c/=p,h/=p,f/=p;var g=a[2],m=a[6],v=a[10],y=g*o+m*s+v*l,x=g*c+m*h+v*f;g-=y*o+x*c,m-=y*s+x*h,v-=y*l+x*f;var b=n(g,m,v);g/=b,m/=b,v/=b;var _=c*e+o*r,w=h*e+s*r,M=f*e+l*r;this.center.move(t,_,w,M);var A=Math.exp(this.computedRadius[0]);A=Math.max(1e-4,A+i),this.radius.set(t,Math.log(A))},d.rotate=function(t,e,r,a){this.recalcMatrix(t),e=e||0,r=r||0;var o=this.computedMatrix,s=o[0],l=o[4],u=o[8],c=o[1],h=o[5],f=o[9],d=o[2],p=o[6],g=o[10],m=e*s+r*c,v=e*l+r*h,y=e*u+r*f,x=-(p*y-g*v),b=-(g*m-d*y),_=-(d*v-p*m),w=Math.sqrt(Math.max(0,1-Math.pow(x,2)-Math.pow(b,2)-Math.pow(_,2))),M=i(x,b,_,w);M>1e-6?(x/=M,b/=M,_/=M,w/=M):(x=b=_=0,w=1);var A=this.computedRotation,k=A[0],T=A[1],E=A[2],S=A[3],L=k*w+S*x+T*_-E*b,z=T*w+S*b+E*x-k*_,C=E*w+S*_+k*b-T*x,I=S*w-k*x-T*b-E*_;if(a){x=d,b=p,_=g;var P=Math.sin(a)/n(x,b,_);x*=P,b*=P,_*=P,w=Math.cos(e),L=L*w+I*x+z*_-C*b,z=z*w+I*b+C*x-L*_,C=C*w+I*_+L*b-z*x,I=I*w-L*x-z*b-C*_}var D=i(L,z,C,I);D>1e-6?(L/=D,z/=D,C/=D,I/=D):(L=z=C=0,I=1),this.rotation.set(t,L,z,C,I)},d.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var i=this.computedMatrix;u(i,e,r,n);var o=this.computedRotation;f(o,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),a(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var s=0,l=0;l<3;++l)s+=Math.pow(r[l]-e[l],2);this.radius.set(t,.5*Math.log(Math.max(s,1e-6))),this.center.set(t,r[0],r[1],r[2])},d.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},d.setMatrix=function(t,e){var r=this.computedRotation;f(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),a(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;h(n,e);var i=n[15];if(Math.abs(i)>1e-6){var o=n[12]/i,s=n[13]/i,l=n[14]/i;this.recalcMatrix(t);var u=Math.exp(this.computedRadius[0]);this.center.set(t,o-n[2]*u,s-n[6]*u,l-n[10]*u),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},d.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},d.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},d.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},d.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":430,"filtered-vector":106,"gl-mat4/fromQuat":146,"gl-mat4/invert":149,"gl-mat4/lookAt":150}],432:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r="undefined"!=typeof r?r+"":" ",n(r,e)+t}},{"repeat-string":457}],433:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],434:[function(t,e,r){(function(t){function e(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n=-1&&!i;a--){var o=a>=0?arguments[a]:t.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(r=o+"/"+r,i="/"===o.charAt(0))}return r=e(n(r.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(t){var i=r.isAbsolute(t),a="/"===o(t,-1);return t=e(n(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&a&&(t+="/"),(i?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},r.relative=function(t,e){function n(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var i=n(t.split("/")),a=n(e.split("/")),o=Math.min(i.length,a.length),s=o,l=0;l55295&&e<57344){if(!r){e>56319||a+1===n?i.push(239,191,189):r=e;continue}if(e<56320){i.push(239,191,189),r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(i.push(239,191,189),r=null);e<128?i.push(e):e<2048?i.push(e>>6|192,63&e|128):e<65536?i.push(e>>12|224,e>>6&63|128,63&e|128):i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}return i}e.exports=n;var a,o,s,l=t("ieee754");a={readUInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},writeUInt32LE:function(t,e){this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24},readInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+(this[t+3]<<24)},readFloatLE:function(t){return l.read(this,t,!0,23,4)},readDoubleLE:function(t){return l.read(this,t,!0,52,8)},writeFloatLE:function(t,e){return l.write(this,t,e,!0,23,4)},writeDoubleLE:function(t,e){return l.write(this,t,e,!0,52,8)},toString:function(t,e,r){var n="",i="";e=e||0,r=Math.min(this.length,r||this.length);for(var a=e;a=1;){if(e.pos>=r)throw new Error("Given varint doesn't fit into 10 bytes");var n=255&t;e.buf[e.pos++]=n|(t>=128?128:0),t/=128}}function 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>3,a=this.pos;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=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*v;return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*v;return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,e,r=this.buf;return e=r[this.pos++],t=127&e,e<128?t:(e=r[this.pos++],t|=(127&e)<<7,e<128?t:(e=r[this.pos++],t|=(127&e)<<14,e<128?t:(e=r[this.pos++],t|=(127&e)<<21,e<128?t:i(t,this))))},readVarint64:function(){var t=this.pos,e=this.readVarint();if(e127;);else if(e===n.Bytes)this.pos=this.readVarint()+this.pos;else if(e===n.Fixed32)this.pos+=4;else{if(e!==n.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455?void a(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(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);var e=m.byteLength(t);this.writeVarint(e),this.realloc(e),this.buf.write(t,this.pos),this.pos+=e},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;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,h,e)},writePackedFloat:function(t,e){this.writeMessage(t,u,e)},writePackedDouble:function(t,e){this.writeMessage(t,c,e)},writePackedFixed32:function(t,e){this.writeMessage(t,f,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,d,e)},writePackedFixed64:function(t,e){this.writeMessage(t,p,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))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":435}],437:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return a.freeUint32(l),a.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,a,o=1;for(r[0]=0,a=1;a0;--a)n=e/o|0,e=e-n*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}var a=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":256,"typedarray-pool":496}],439:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,s,l,c=0;c<2;++c)if(u[c][n].length>0){o=u[c][n][0],l=c;break}s=o[1^l];for(var h=0;h<2;++h)for(var f=u[h][n],d=0;d0&&(o=p,s=g,l=h)}return a?s:(o&&r(o,l),s)}function a(t,a){var o=u[a][t][0],s=[t];r(o,a);for(var l=o[1^a];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],h=t,f=s[1],d=n(c,h,!0);if(i(e[c],e[h],e[f],e[d])<0)break;s.push(t),l=n(c,h)}return s}function o(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;c0;){var g=(u[0][c].length,a(c,d));o(p,g)?p.push.apply(p,g):(p.length>0&&f.push(p),p=g)}p.length>0&&f.push(p)}return f}e.exports=n;var i=t("compare-angle")},{"compare-angle":81}],440:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function a(t){for(var e=t.length,r=0;r0;){var U=N.pop(),V=I[U];h(V,function(t,e){return t-e});var q,H=V.length,G=B[U];if(0===G){var T=v[U];q=[T]}for(var m=0;m=0)&&(B[X]=1^G,N.push(X),0===G)){var T=v[X];a(T)||(T.reverse(),q.push(T))}}0===G&&d.push(q)}return d}e.exports=a;var o=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),h=t("uniq"),f=t("./lib/trim-leaves")},{"./lib/trim-leaves":440,"edges-to-adjacency-list":100,"planar-dual":439,"point-in-big-polygon":443,"robust-sum":470,"two-product":494,uniq:498}],442:[function(t,e,r){"use strict";function n(t,e){this.x=t,this.y=e}e.exports=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{}],443:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return!!i&&!!i.queryPoint(r,n)}}function a(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var o=i.key,s=h(r,o[0],o[1]);if(o[0][0]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))return 0;a=1,i=i.right}}return a}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;i=u?(b=1,y=u+2*f+p):(b=-f/u,y=f*b+p)):(b=0,d>=0?(_=0,y=p):-d>=h?(_=1,y=h+2*d+p):(_=-d/h,y=d*_+p));else if(_<0)_=0,f>=0?(b=0,y=p):-f>=u?(b=1,y=u+2*f+p):(b=-f/u,y=f*b+p);else{var w=1/x;b*=w,_*=w,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p}else{var M,A,k,T;b<0?(M=c+f,A=h+d,A>M?(k=A-M,T=u-2*c+h,k>=T?(b=1,_=0,y=u+2*f+p):(b=k/T,_=1-b,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p)):(b=0,A<=0?(_=1,y=h+2*d+p):d>=0?(_=0,y=p):(_=-d/h,y=d*_+p))):_<0?(M=c+d,A=u+f,A>M?(k=A-M,T=u-2*c+h,k>=T?(_=1,b=0,y=h+2*d+p):(_=k/T,b=1-_,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p)):(_=0,A<=0?(b=1,y=u+2*f+p):f>=0?(b=0,y=p):(b=-f/u,y=f*b+p))):(k=h+d-c-f,k<=0?(b=0,_=1,y=h+2*d+p):(T=u-2*c+h,k>=T?(b=1,_=0,y=u+2*f+p):(b=k/T,_=1-b,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p)))}for(var E=1-b-_,l=0;l1)for(var r=1;r1&&(n=r[0]+"@",t=r[1]),t=t.replace(P,".");var i=t.split("."),a=o(i,e).join(".");return n+a}function l(t){for(var e,r,n=[],i=0,a=t.length;i=55296&&e<=56319&&i65535&&(t-=65536,e+=F(t>>>10&1023|55296),t=56320|1023&t),e+=F(t)}).join("")}function c(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:M}function h(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function f(t,e,r){var n=0;for(t=r?R(t/E):t>>1,t+=R(t/e);t>O*k>>1;n+=M)t=R(t/O);return R(n+(O+1)*t/(t+T))}function d(t){var e,r,n,i,o,s,l,h,d,p,g=[],m=t.length,v=0,y=L,x=S;for(r=t.lastIndexOf(z),r<0&&(r=0),n=0;n=128&&a("not-basic"),g.push(t.charCodeAt(n));for(i=r>0?r+1:0;i=m&&a("invalid-input"),h=c(t.charCodeAt(i++)),(h>=M||h>R((w-v)/s))&&a("overflow"),v+=h*s,d=l<=x?A:l>=x+k?k:l-x,!(hR(w/p)&&a("overflow"),s*=p;e=g.length+1,x=f(v-o,e,0==o),R(v/e)>w-y&&a("overflow"),y+=R(v/e),v%=e,g.splice(v++,0,y)}return u(g)}function p(t){var e,r,n,i,o,s,u,c,d,p,g,m,v,y,x,b=[];for(t=l(t),m=t.length,e=L,r=0,o=S,s=0;s=e&&gR((w-r)/v)&&a("overflow"),r+=(u-e)*v,e=u,s=0;sw&&a("overflow"),g==e){for(c=r,d=M;p=d<=o?A:d>=o+k?k:d-o,!(c= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=M-A,R=Math.floor,F=String.fromCharCode;if(b={version:"1.4.1",ucs2:{decode:l,encode:u},decode:d,encode:p,toASCII:m,toUnicode:g},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return b});else if(v&&y)if(r.exports==v)y.exports=b;else for(_ in b)b.hasOwnProperty(_)&&(v[_]=b[_]);else i.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],447:[function(t,e,r){e.exports=t("gl-quat/slerp")},{"gl-quat/slerp":199}],448:[function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,r,a){e=e||"&",r=r||"=";var o={};if("string"!=typeof t||0===t.length)return o;var s=/\+/g;t=t.split(e);var l=1e3;a&&"number"==typeof a.maxKeys&&(l=a.maxKeys);var u=t.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(h=g.substr(0,m),f=g.substr(m+1)):(h=g,f=""),d=decodeURIComponent(h),p=decodeURIComponent(f),n(o,d)?i(o[d])?o[d].push(p):o[d]=[o[d],p]:o[d]=p}return o};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],449:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;nr;){if(o-r>600){var l=o-r+1,u=e-r+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),d=Math.max(r,Math.floor(e-u*h/l+f)),p=Math.min(o,Math.floor(e+(l-u)*h/l+f));n(t,e,d,p,s)}var g=t[e],m=r,v=o;for(i(t,r,e),s(t[o],g)>0&&i(t,r,o);m0;)v--}0===s(t[r],g)?i(t,r,v):(v++,i(t,v,o)),v<=e&&(r=v+1),e<=v&&(o=v-1)}}function i(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function a(t,e){return te?1:0}e.exports=n},{}],452:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),a=0;a0){var u=t[r-1];if(0===i(s,u)&&o(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}var i=t("compare-cell"),a=t("compare-oriented-cell"),o=t("cell-orientation");e.exports=n},{"cell-orientation":73,"compare-cell":82,"compare-oriented-cell":83}],457:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("repeat-string expects a string.");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;for(i===t&&"undefined"!=typeof i||(i=t,a="");r>a.length&&e>0&&(1&e&&(a+=t),e>>=1);)t+=t;return a.substr(0,r)}var i,a="";e.exports=n},{}],458:[function(e,r,n){void function(e,i){"function"==typeof t&&t.amd?t(i):"object"==typeof n?r.exports=i():e.resolveUrl=i()}(this,function(){function t(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var r=document.getElementsByTagName("head")[0];r.insertBefore(e,r.firstChild);for(var n,i=document.createElement("a"),a=1;a=0;--i){var a=r,o=t[i];r=a+o;var s=r-a,l=o-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;i>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;r>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r0&&r.push(","),r.push("[");for(var a=0;a0&&r.push(","),a===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",a,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var o=new Function("det",r.join(""));return o(t<6?s[t]:s)}function i(){return[0]}function a(t,e){return[[e[0]],[t[0][0]]]}function o(){for(;u.length>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;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=v*n;return o>=s||o<=-s?o:x(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],u=r[1]-n[1],c=t[2]-n[2],h=e[2]-n[2],f=r[2]-n[2],d=a*u,p=o*l,g=o*s,m=i*u,v=i*l,x=a*s,_=c*(d-p)+h*(g-m)+f*(v-x),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(m))*Math.abs(h)+(Math.abs(v)+Math.abs(x))*Math.abs(f),M=y*w;return _>M||-_>M?_:b(t,e,r,n)}];c()},{"robust-scale":467,"robust-subtract":469,"robust-sum":470,"two-product":494}],466:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return a(e,t[0]);if(1===e.length)return a(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.length0&&s>0||o<0&&s<0)return!1;var l=a(r,t,e),u=a(i,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,i))}e.exports=i;var a=t("robust-orientation")[3]},{"robust-orientation":465}],469:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,h=0,f=Math.abs,d=t[c],p=f(d),g=-e[h],m=f(g);p=i?(a=d,c+=1,c=i?(a=d,c+=1,c0){for(var s=0,l=0,u=0;un.h||t>n.free||rc)&&(h=2*Math.max(t,c)),(ll)&&(u=2*Math.max(r,l)),this.resize(h,u),this.packOne(t,r)}return null},t.prototype.clear=function(){this.shelves=[],this.stats={}},t.prototype.resize=function(t,e){this.w=t,this.h=e;for(var r=0;rthis.free||e>this.h)return null;var r=this.x;return this.x+=t,this.free-=t,{x:r,y:this.y,w:t,h:e,width:t,height:e}},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t})},{}],472:[function(t,e,r){"use strict";e.exports=function(t){return t<0?-1:t>0?1:0}},{}],473:[function(t,e,r){"use strict";function n(t){return a(i(t))}e.exports=n;var i=t("boundary-cells"),a=t("reduce-simplicial-complex")},{"boundary-cells":56,"reduce-simplicial-complex":456}],474:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;n0&&u.push(","),u.push("[");for(var n=0;n0&&u.push(","),u.push("B(C,E,c[",i[0],"],c[",i[1],"])")}u.push("]")}u.push(");")}}var r=0,n=new Array(t+1);n[0]=[[]];for(var i=1;i<=t;++i)for(var s=n[i]=o(i),l=0;l>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--i){i>1,s=o(t[a],e);s<=0?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function h(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[g],a))break}return r}function f(t,e){if(!e)return h(u(p(t,0)),t,0);for(var r=new Array(e),n=0;n>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){var n=s(r);if(e0){var t=k[0];return a(0,S-1),S-=1,u(0),t}return-1}function f(t,e){var r=k[t];return x[r]===e?t:(x[r]=-(1/0),c(t),h(),x[r]=e,S+=1,c(S-1))}function d(t){if(!b[t]){b[t]=!0;var e=v[t],r=y[t];v[r]>=0&&(v[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&f(T[e],i(e)),T[r]>=0&&f(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!b[n]||i<0||i===n)break;if(n=i,i=t[n],!b[n]||i<0||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var g=e.length,m=t.length,v=new Array(g),y=new Array(g),x=new Array(g),b=new Array(g),_=0;_>1;_>=0;--_)u(_);for(;;){var L=h();if(L<0||x[L]>r)break;d(L)}for(var z=[],_=0;_=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&C.push([n,i])}}),o.unique(o.normalize(C)),{positions:z,edges:C}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":465,"simplicial-complex":478}],481:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return ol?i-l:o-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=a(r,i,s),u=a(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;if(l=a(s,o,i),u=a(s,o,r),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]}e.exports=i;var a=t("robust-orientation")},{"robust-orientation":465}],482:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=a(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=a(t.right,e);if(l)return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;a0){var s=a(this.slabs[e-1],t);s&&(o?f(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(o){var p=h(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":481,"binary-search-bounds":53,"functional-red-black-tree":107,"robust-orientation":465}],483:[function(t,e,r){"use strict";function n(t,e){var r=u(l(t,e),[e[e.length-1]]);return r[r.length-1]}function i(t,e,r,n){var i=n-e,a=-e/i;a<0?a=0:a>1&&(a=1);for(var o=1-a,s=t.length,l=new Array(s),u=0;u0||o>0&&c<0){var h=i(s,c,l,o);r.push(h),a.push(h.slice())}c<0?a.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),a.push(l.slice())),o=c}return{positive:r,negative:a}}function o(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u>=0&&r.push(s.slice()),a=u}return r}function s(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u<=0&&r.push(s.slice()),a=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=a,e.exports.positive=o,e.exports.negative=s},{"robust-dot-product":462,"robust-sum":470}],484:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function a(t,e){return Array(e+1).join(t)}var o={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,h,f,d=1,p=t.length,g="",m=[],v=!0,y="";for(s=0;s=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?m[m.length]=n:(!o.number.test(u[8])||v&&!u[3]?y="":(y=v?"+":"-",n=n.toString().replace(o.sign,"")),h=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",f=u[6]-(y+n).length,c=u[6]&&f>0?a(h,f):"",m[m.length]=u[5]?y+n+c:"0"===h?y+c+n:c+y+n)}return m.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],485:[function(t,e,r){"use strict";function n(t){return new i(t)}function i(t){this.options=d(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function a(t,e,r,n){return{x:t,y:e,zoom:1/0,id:n,numPoints:r}}function o(t,e){var r=t.geometry.coordinates;return a(u(r[0]),c(r[1]),1,e)}function s(t){return{type:"Feature",properties:l(t),geometry:{type:"Point",coordinates:[h(t.x),f(t.y)]}}}function l(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:r}}function u(t){return t/360+.5}function c(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function h(t){return 360*(t-.5)}function f(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function d(t,e){for(var r in e)t[r]=e[r];return t}function p(t){return t.x}function g(t){return t.y}var m=t("kdbush");e.exports=n,i.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var r="prepare "+t.length+" points";e&&console.time(r),this.points=t;var n=t.map(o);e&&console.timeEnd(r);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var a=+Date.now();this.trees[i+1]=m(n,p,g,this.options.nodeSize,Float32Array),n=this._cluster(n,i),e&&console.log("z%d: %d clusters in %dms",i,n.length,+Date.now()-a)}return this.trees[this.options.minZoom]=m(n,p,g,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(u(t[0]),c(t[3]),u(t[2]),c(t[1])),i=[],a=0;a c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128===0){h.length>0&&f.push("}}");var d="vExtra"+h.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),f=["function ",d,"(m,",l.join(),"){switch(m){"],h.push(f)}f.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),m=new Array(r),v=new Array(r),y=0,x=0;xx)&&!(u&1<<_)!=!(u&1<0&&(k="+"+m[b]+"*c");var T=.5*(p[b].length/y),E=.5+.5*(v[b]/y);A.push("d"+b+"-"+E+"-"+T+"*("+p[b].join("+")+k+")/("+g[b].join("+")+")")}f.push("a.push([",A.join(),"]);","break;")}n.push("}},"),h.length>0&&f.push("}}");for(var S=[],u=0;u<1<0&&(f+=.02);for(var p=new Float32Array(h),g=0,m=-.5*f,d=0;d.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=S(t,360),e=S(e,100),r=S(r,100),0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,r){t=S(t,255),e=S(e,255),r=S(r,255);var n,i,a=G(t,e,r),o=H(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function k(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function S(t,r){C(t)&&(t="100%");var n=I(t);return t=H(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function L(t){return H(1,G(0,t))}function z(t){return parseInt(t,16)}function C(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function I(t){return"string"==typeof t&&t.indexOf("%")!=-1}function P(t){return 1==t.length?"0"+t:""+t}function D(t){return t<=1&&(t=100*t+"%"),t}function O(t){return e.round(255*parseFloat(t)).toString(16)}function R(t){return z(t)/255}function F(t){return!!Z.CSS_UNIT.exec(t)}function j(t){t=t.replace(B,"").replace(U,"").toLowerCase();var e=!1;if(Y[t])t=Y[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Z.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(t))?{r:z(r[1]),g:z(r[2]),b:z(r[3]),a:R(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:z(r[1]),g:z(r[2]),b:z(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:z(r[1]+""+r[1]),g:z(r[2]+""+r[2]),b:z(r[3]+""+r[3]),a:R(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.hex3.exec(t))&&{r:z(r[1]+""+r[1]),g:z(r[2]+""+r[2]),b:z(r[3]+""+r[3]),format:e?"name":"hex"}}function N(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var B=/^\s+/,U=/\s+$/,V=0,q=e.round,H=e.min,G=e.max,X=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=E(t),this._roundA=q(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=q(360*t.h),r=q(100*t.s),n=q(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=q(360*t.h),r=q(100*t.s),n=q(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return h(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:q(this._r),g:q(this._g),b:q(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+q(this._r)+", "+q(this._g)+", "+q(this._b)+")":"rgba("+q(this._r)+", "+q(this._g)+", "+q(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:q(100*S(this._r,255))+"%",g:q(100*S(this._g,255))+"%",b:q(100*S(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+q(100*S(this._r,255))+"%, "+q(100*S(this._g,255))+"%, "+q(100*S(this._b,255))+"%)":"rgba("+q(100*S(this._r,255))+"%, "+q(100*S(this._g,255))+"%, "+q(100*S(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(W[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+f(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+f(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){ -return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,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(b,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=D(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return n(s)},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=N(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},n.mostReadable=function(t,e,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var Y=n.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"},W=n.hexNames=T(Y),Z=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],490:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":433}],491:[function(e,r,n){!function(e,i){"object"==typeof n&&"undefined"!=typeof r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.topojson=e.topojson||{})}(this,function(t){"use strict";function e(t,e){var n=e.id,i=e.bbox,a=null==e.properties?{}:e.properties,o=r(t,e);return null==n&&null==i?{type:"Feature",properties:a,geometry:o}:null==i?{type:"Feature",id:n,properties:a,geometry:o}:{type:"Feature",id:n,bbox:i,properties:a,geometry:o}}function r(t,e){function r(t,e){e.length&&e.pop();for(var r=h[t<0?~t:t],n=0,i=r.length;n1)n=i(t,e,r);else for(a=0,n=new Array(o=t.arcs.length);a1)for(var i,a,l=1,u=o(n[0]);lu&&(a=n[0],n[0]=n[l],n[l]=a,u=i);return n})}}var s=function(t){return t},l=function(t){if(null==(e=t.transform))return s;var e,r,n,i=e.scale[0],a=e.scale[1],o=e.translate[0],l=e.translate[1];return function(t,e){return e||(r=n=0),t[0]=(r+=t[0])*i+o,t[1]=(n+=t[1])*a+l,t}},u=function(t){function e(t){s[0]=t[0],s[1]=t[1],o(s),s[0]h&&(h=s[0]),s[1]f&&(f=s[1])}function r(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(r);break;case"Point":e(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(e)}}var n=t.bbox;if(!n){var i,a,o=l(t),s=new Array(2),u=1/0,c=u,h=-u,f=-u;t.arcs.forEach(function(t){for(var e=-1,r=t.length;++eh&&(h=s[0]),s[1]f&&(f=s[1])});for(a in t.objects)r(t.objects[a]);n=t.bbox=[u,c,h,f]}return n},c=function(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r},h=function(t,r){return"GeometryCollection"===r.type?{type:"FeatureCollection",features:r.geometries.map(function(r){return e(t,r)})}:e(t,r)},f=function(t,e){function r(e){var r,n=t.arcs[e<0?~e:e],i=n[0];return t.transform?(r=[0,0],n.forEach(function(t){r[0]+=t[0],r[1]+=t[1]})):r=n[n.length-1],e<0?[r,i]:[i,r]}function n(t,e){for(var r in t){var n=t[r];delete e[n.start],delete n.start,delete n.end,n.forEach(function(t){i[t<0?~t:t]=1}),s.push(n)}}var i={},a={},o={},s=[],l=-1;return e.forEach(function(r,n){var i,a=t.arcs[r<0?~r:r];a.length<3&&!a[1][0]&&!a[1][1]&&(i=e[++l],e[l]=r,e[n]=i)}),e.forEach(function(t){var e,n,i=r(t),s=i[0],l=i[1];if(e=o[s])if(delete o[e.end],e.push(t),e.end=l,n=a[l]){delete a[n.start];var u=n===e?e:e.concat(n);a[u.start=e.start]=o[u.end=n.end]=u}else a[e.start]=o[e.end]=e;else if(e=a[l])if(delete a[e.start],e.unshift(t),e.start=s,n=o[s]){delete o[n.end];var c=n===e?e:n.concat(e);a[c.start=n.start]=o[c.end=e.end]=c}else a[e.start]=o[e.end]=e;else e=[t],a[e.start=s]=o[e.end=l]=e}),n(o,a),n(a,o),e.forEach(function(t){i[t<0?~t:t]||s.push([t])}),s},d=function(t){return r(t,n.apply(this,arguments))},p=function(t){return r(t,o.apply(this,arguments))},g=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 i,a=u(t),o=a[0],s=(a[2]-o)/(e-1)||1,l=a[1],c=(a[3]-l)/(e-1)||1;t.arcs.forEach(function(t){for(var e,r,n,i=1,a=1,u=t.length,h=t[0],f=h[0]=Math.round((h[0]-o)/s),d=h[1]=Math.round((h[1]-l)/c);iMath.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var a=0,o=0,s=0;s<3;++s)a+=t[s]*t[s],o+=i[s]*t[s];for(var s=0;s<3;++s)i[s]-=o/a*t[s];return f(i,i),i}function o(t,e,r,n,i,a,o,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([a]),this.angle=l([o,s]),this.angle.bounds=[[-(1/0),-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;u<16;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.up||[0,1,0],i=t.right||a(r),s=t.radius||1,l=t.theta||0,u=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),f(r,r),i=[].slice.call(i,0,3),f(i,i),"eye"in t){var c=t.eye,p=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];h(i,p,r),n(i[0],i[1],i[2])<1e-6?i=a(r):f(i,i),s=n(p[0],p[1],p[2]);var g=d(r,p)/s,m=d(i,p)/s;u=Math.acos(g),l=Math.acos(m)}return s=Math.log(s),new o(t.zoomMin,t.zoomMax,e,r,i,s,l,u)}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),h=t("gl-vec3/cross"),f=t("gl-vec3/normalize"),d=t("gl-vec3/dot"),p=o.prototype;p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,i=0,a=0,o=0;o<3;++o)a+=e[o]*r[o],i+=e[o]*e[o];for(var s=Math.sqrt(i),l=0,o=0;o<3;++o)r[o]-=e[o]*a/i,l+=r[o]*r[o],e[o]/=s;for(var u=Math.sqrt(l),o=0;o<3;++o)r[o]/=u;var c=this.computedToward;h(c,e,r),f(c,c);for(var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],g=this.computedAngle[1],m=Math.cos(p),v=Math.sin(p),y=Math.cos(g),x=Math.sin(g),b=this.computedCenter,_=m*y,w=v*y,M=x,A=-m*x,k=-v*x,T=y,E=this.computedEye,S=this.computedMatrix,o=0;o<3;++o){var L=_*r[o]+w*c[o]+M*e[o];S[4*o+1]=A*r[o]+k*c[o]+T*e[o],S[4*o+2]=L,S[4*o+3]=0}var z=S[1],C=S[5],I=S[9],P=S[2],D=S[6],O=S[10],R=C*O-I*D,F=I*P-z*O,j=z*D-C*P,N=n(R,F,j);R/=N,F/=N,j/=N,S[0]=R,S[4]=F,S[8]=j;for(var o=0;o<3;++o)E[o]=b[o]+S[2+4*o]*d;for(var o=0;o<3;++o){for(var l=0,B=0;B<3;++B)l+=S[o+4*B]*E[B];S[12+o]=-l}S[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 g=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;g[0]=i[2],g[1]=i[6],g[2]=i[10];for(var a=this.computedUp,o=this.computedRight,s=this.computedToward,l=0;l<3;++l)i[4*l]=a[l],i[4*l+1]=o[l],i[4*l+2]=s[l];c(i,i,n,g);for(var l=0;l<3;++l)a[l]=i[4*l],o[l]=i[4*l+1];this.up.set(t,a[0],a[1],a[2]),this.right.set(t,o[0],o[1],o[2])}},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=(Math.exp(this.computedRadius[0]),a[1]),s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],h=a[4],f=a[8],d=c*o+h*s+f*l;c-=o*d,h-=s*d,f-=l*d;var p=n(c,h,f);c/=p,h/=p,f/=p;var g=c*e+o*r,m=h*e+s*r,v=f*e+l*r;this.center.move(t,g,m,v);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e,r,a){var o=1;"number"==typeof r&&(o=0|r),(o<0||o>3)&&(o=1);var s=(o+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[o],c=e[o+4],h=e[o+8];if(a){var f=Math.abs(l),d=Math.abs(c),p=Math.abs(h),g=Math.max(f,d,p);f===g?(l=l<0?-1:1,c=h=0):p===g?(h=h<0?-1:1,l=c=0):(c=c<0?-1:1,l=h=0)}else{var m=n(l,c,h);l/=m,c/=m,h/=m}var v=e[s],y=e[s+4],x=e[s+8],b=v*l+y*c+x*h;v-=l*b,y-=c*b,x-=h*b;var _=n(v,y,x);v/=_,y/=_,x/=_;var w=c*x-h*y,M=h*v-l*x,A=l*y-c*v,k=n(w,M,A);w/=k,M/=k,A/=k,this.center.jump(t,H,G,X),this.radius.idle(t),this.up.jump(t,l,c,h),this.right.jump(t,v,y,x);var T,E;if(2===o){var S=e[1],L=e[5],z=e[9],C=S*v+L*y+z*x,I=S*w+L*M+z*A;T=R<0?-Math.PI/2:Math.PI/2,E=Math.atan2(I,C)}else{var P=e[2],D=e[6],O=e[10],R=P*l+D*c+O*h,F=P*v+D*y+O*x,j=P*w+D*M+O*A;T=Math.asin(i(R)),E=Math.atan2(j,F)}this.angle.jump(t,E,T),this.recalcMatrix(t);var N=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var q=V[15],H=V[12]/q,G=V[13]/q,X=V[14]/q,Y=Math.exp(this.computedRadius[0]);this.center.jump(t,H-N*Y,G-B*Y,X-U*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,a){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,a=a||this.computedUp;var o=a[0],s=a[1],l=a[2],u=n(o,s,l);if(!(u<1e-6)){o/=u,s/=u,l/=u;var c=e[0]-r[0],h=e[1]-r[1],f=e[2]-r[2],d=n(c,h,f);if(!(d<1e-6)){c/=d,h/=d,f/=d;var p=this.computedRight,g=p[0],m=p[1],v=p[2],y=o*g+s*m+l*v;g-=y*o,m-=y*s,v-=y*l;var x=n(g,m,v);if(!(x<.01&&(g=s*f-l*h,m=l*c-o*f,v=o*h-s*c,x=n(g,m,v),x<1e-6))){g/=x,m/=x,v/=x,this.up.set(t,o,s,l),this.right.set(t,g,m,v),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var b=s*v-l*m,_=l*g-o*v,w=o*m-s*g,M=n(b,_,w);b/=M,_/=M,w/=M;var A=o*c+s*h+l*f,k=g*c+m*h+v*f,T=b*c+_*h+w*f,E=Math.asin(i(A)),S=Math.atan2(T,k),L=this.angle._state,z=L[L.length-1],C=L[L.length-2];z%=2*Math.PI;var I=Math.abs(z+2*Math.PI-S),P=Math.abs(z-S),D=Math.abs(z-2*Math.PI-S);I0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function h(t){return new Int16Array(o(2*t),0,t)}function f(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return b?new Uint8ClampedArray(o(t),0,t):s(t)}function m(t){return new DataView(o(t),0,t)}function v(t){t=y.nextPow2(t);var e=y.log2(t),r=M[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),x=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:x([32,0]),UINT16:x([32,0]),UINT32:x([32,0]),INT8:x([32,0]),INT16:x([32,0]),INT32:x([32,0]),FLOAT:x([32,0]),DOUBLE:x([32,0]),DATA:x([32,0]),UINT8C:x([32,0]),BUFFER:x([32,0])});var b="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=x([32,0])),_.BUFFER||(_.BUFFER=x([32,0]));var w=_.DATA,M=_.BUFFER;r.free=function(t){if(n.isBuffer(t))M[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){M[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return h(t);case"int32":return f(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return v(t);case"data":case"dataview":return m(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=h,r.mallocInt32=f,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=m,r.mallocBuffer=v,r.clearCache=function(){for(var t=0;t<32;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,M[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":54,buffer:64,dup:98}],497:[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;en)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))}},{}],500:[function(t,e,r){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function i(t,e,r){if(t&&u.isObject(t)&&t instanceof n)return t;var i=new n;return i.parse(t,e,r),i}function a(t){return u.isString(t)&&(t=i(t)),t instanceof n?t.format():n.prototype.format.call(t)}function o(t,e){return i(t,!1,!0).resolve(e)}function s(t,e){return t?i(t,!1,!0).resolveObject(e):e}var l=t("punycode"),u=t("./util");r.parse=i,r.resolve=o,r.resolveObject=s,r.format=a,r.Url=n;var c=/^([a-z0-9.+-]+:)/i,h=/:[0-9]*$/,f=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["<",">",'"',"`"," ","\r","\n","\t"],p=["{","}","|","\\","^","`"].concat(d),g=["'"].concat(p),m=["%","/","?",";","#"].concat(g),v=["/","?","#"],y=255,x=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},M={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=t("querystring");n.prototype.parse=function(t,e,r){if(!u.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),i=n!==-1&&n127?"x":D[R];if(!O.match(x)){var j=I.slice(0,E),N=I.slice(E+1),B=D.match(b);B&&(j.push(B[1]),N.unshift(B[2])),N.length&&(s="/"+N.join(".")+s),this.hostname=j.join(".");break}}}this.hostname.length>y?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=l.toASCII(this.hostname));var U=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+U,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!_[p])for(var E=0,P=g.length;E0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return r.search=t.search,r.query=t.query,u.isNull(r.pathname)&&u.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!_.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=_.slice(-1)[0],E=(r.host||t.host||_.length>1)&&("."===T||".."===T)||""===T,S=0,L=_.length;L>=0;L--)T=_[L],"."===T?_.splice(L,1):".."===T?(_.splice(L,1),S++):S&&(_.splice(L,1),S--);if(!x&&!b)for(;S--;S)_.unshift("..");!x||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""), -E&&"/"!==_.join("/").substr(-1)&&_.push("");var z=""===_[0]||_[0]&&"/"===_[0].charAt(0);if(A){r.hostname=r.host=z?"":_.length?_.shift():"";var k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return x=x||r.host&&_.length,x&&!z&&_.unshift(""),_.length?r.pathname=_.join("/"):(r.pathname=null,r.path=null),u.isNull(r.pathname)&&u.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=h.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":501,punycode:446,querystring:450}],501:[function(t,e,r){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],502:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],503:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],504:[function(t,e,r){(function(e,n){function i(t,e){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(e)?n.showHidden=e:e&&r._extend(n,e),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a),l(n,t,n.depth)}function a(t,e){var r=i.styles[e];return r?"\x1b["+i.colors[r][0]+"m"+t+"\x1b["+i.colors[r][1]+"m":t}function o(t,e){return t}function s(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function l(t,e,n){if(t.customInspect&&e&&T(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return x(i)||(i=l(t,i,n)),i}var a=u(t,e);if(a)return a;var o=Object.keys(e),g=s(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),k(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(e);if(0===o.length){if(T(e)){var m=e.name?": "+e.name:"";return t.stylize("[Function"+m+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(A(e))return t.stylize(Date.prototype.toString.call(e),"date");if(k(e))return c(e)}var v="",y=!1,b=["{","}"];if(p(e)&&(y=!0,b=["[","]"]),T(e)){var _=e.name?": "+e.name:"";v=" [Function"+_+"]"}if(w(e)&&(v=" "+RegExp.prototype.toString.call(e)),A(e)&&(v=" "+Date.prototype.toUTCString.call(e)),k(e)&&(v=" "+c(e)),0===o.length&&(!y||0==e.length))return b[0]+v+b[1];if(n<0)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=y?h(t,e,n,g,o):o.map(function(r){return f(t,e,n,g,r,y)}),t.seen.pop(),d(M,v,b)}function u(t,e){if(_(e))return t.stylize("undefined","undefined");if(x(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return y(e)?t.stylize(""+e,"number"):g(e)?t.stylize(""+e,"boolean"):m(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var a=[],o=0,s=e.length;o-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")),_(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.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 d(t,e,r){var n=0,i=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function p(t){return Array.isArray(t)}function g(t){return"boolean"==typeof t}function m(t){return null===t}function v(t){return null==t}function y(t){return"number"==typeof t}function x(t){return"string"==typeof t}function b(t){return"symbol"==typeof t}function _(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===S(t)}function M(t){return"object"==typeof t&&null!==t}function A(t){return M(t)&&"[object Date]"===S(t)}function k(t){return M(t)&&("[object Error]"===S(t)||t instanceof Error)}function T(t){return"function"==typeof t}function E(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function S(t){return Object.prototype.toString.call(t)}function L(t){return t<10?"0"+t.toString(10):t.toString(10)}function z(){var t=new Date,e=[L(t.getHours()),L(t.getMinutes()),L(t.getSeconds())].join(":");return[t.getDate(),O[t.getMonth()],e].join(" ")}function C(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var I=/%[sdj%]/g;r.format=function(t){if(!x(t)){for(var e=[],r=0;r=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}}),s=n[r];r>3}if(i--,1===n||2===n)a+=t.readSVarint(),o+=t.readSVarint(),1===n&&(e&&s.push(e),e=[]),e.push(new l(a,o));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&s.push(e),s},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,u=-(1/0);t.pos>3}if(n--,1===r||2===r)i+=t.readSVarint(),a+=t.readSVarint(),is&&(s=i),au&&(u=a);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,u]},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}var o=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 o(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":507}],509:[function(t,e,r){"use strict";function n(t,e){return"object"==typeof e&&null!==e||(e={}),i(t,e.canvas||a,e.context||o,e)}e.exports=n;var i=t("./lib/vtext"),a=null,o=null;"undefined"!=typeof document&&(a=document.createElement("canvas"),a.width=8192,a.height=1024,o=a.getContext("2d"))},{"./lib/vtext":510}],510:[function(t,e,r){"use strict";function n(t,e,r){for(var n=e.textAlign||"start",i=e.textBaseline||"alphabetic",a=[1<<30,1<<30],o=[0,0],s=t.length,l=0;l8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height>31}function l(t){for(var e=[],r=0,n=0,i=t.length,a=0;a=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function o(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),!(e<0)&&(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof b||a();var s=[],l=[],u=x++;return Object.create(b.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(o)}})};b.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||!!c&&c.has___(t)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof b||a();var l,u=new s,c=void 0,h=!1;return l=o?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new b),c.set(t,e)),this}:function(t,e){if(h)try{u.set(t,e)}catch(r){c||(c=new b),c.set___(t,e)}else u.set(t,e);return this},Object.create(b.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");h=!0})}})}o&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=b.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=b)}}()},{}],515:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":516}],516:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],517:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":515}],518:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":119}],519:[function(t,e,r){var n=arguments[3],i=arguments[4],a=arguments[5],o=JSON.stringify;e.exports=function(t,e){function r(t){m[t]=!0;for(var e in i[t][1]){var n=i[t][1][e];m[n]||r(n)}}for(var s,l=Object.keys(a),u=0,c=l.length;u= 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":91}],523:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":522}],524:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("opacity"),u("align"),u("bgcolor");var h=u("bordercolor"),f=i.opacity(h);u("borderpad");var d=u("borderwidth"),p=u("showarrow");u("text",p?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font);for(var g=["x","y"],m=[-10,-30],v={_fullLayout:r},y=0;y<2;y++){var x=g[y],b=a.coerceRef(t,e,v,x,"","paper");if(a.coercePosition(e,v,u,b,x,.5),p){var _="a"+x,w=a.coerceRef(t,e,v,_,"pixel");"pixel"!==w&&w!==b&&(w=e[_]="pixel");var M="pixel"===w?m[y]:.4;a.coercePosition(e,v,u,w,_,M)}else u(x+"anchor")}return n.noneOrAll(t,e,["x","y"]),p&&(u("arrowcolor",f?e.bordercolor:i.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(f&&d||1)),n.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":633,"../../plots/cartesian/axes":664,"../color":533,"./attributes":526}],525:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],526:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":626,"../../plots/cartesian/constants":669,"../../plots/font_attributes":684,"./arrow_paths":525}],527:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,h=s-l,f=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),h=Math.max(h,d),f=Math.max(f,d)}r&&r.autorange&&a.expand(r,[r.l2c(r.r2l(e.x))],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(n.r2l(e.y))],{ppadplus:f,ppadminus:h})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":633,"../../plots/cartesian/axes":664,"./draw":529}],528:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),i=t("./annotation_defaults");e.exports=function(t,e){var r={name:"annotations",handleItemDefaults:i};n(t,e,r)}},{"../../plots/array_container_defaults":661,"./annotation_defaults":524}],529:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=K.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,v=Math.round(u+2*tt),y=Math.round(p+2*tt);H._w=u,H._h=p;var b=!1;if(["x","y"].forEach(function(e){var n,i=H[e+"ref"]||e,a=h.getFromId(t,i),o=(W+("x"===e?0:90))*Math.PI/180,s=v*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=H[e+"anchor"];if(a){var u=a.r2fraction(H[e]);if(!a.autorange&&(u<0||u>1)&&(H["a"+e+"ref"]===i?(u=a.r2fraction(H["a"+e]), -(u<0||u>1)&&(b=!0)):b=!0,b))return;Y[e]=a._offset+a.r2p(H[e]),n=.5}else n=H[e],"y"===e&&(n=1-n),Y[e]="x"===e?C.l+C.w*n:C.t+C.h*n;var c=0;H["a"+e+"ref"]===i?Y["aa"+e]=a._offset+a.r2p(H["a"+e]):(c=H.showarrow?H["a"+e]:s*r(n,l),Y[e]+=c),H["_"+e+"type"]=a&&a.type,H["_"+e+"size"]=s,H["_"+e+"shift"]=c}),b)return void K.remove();var _,w;H.showarrow&&(_=H.axref===H.xref?Y.x:c.constrain(Y.x-H.ax,1,A.width-1),w=H.ayref===H.yref?Y.y:c.constrain(Y.y-H.ay,1,A.height-1)),Y.x=c.constrain(Y.x,1,A.width-1),Y.y=c.constrain(Y.y,1,A.height-1);var M=tt-s.top,k=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:k,y:M}),nt.selectAll("tspan.line").attr({y:M,x:k})),et.call(d.setRect,$/2,$/2,v-$,y-$);var T=0,E=0;T=H.axref===H.xref?Math.round(Y.aax-v/2):Math.round(Y.x-v/2),E=H.ayref===H.yref?Math.round(Y.aay-y/2):Math.round(Y.y-y/2),K.call(c.setTranslate,T,E);var S="annotations["+e+"]",L=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=H.axref===H.xref?Y.aax+r:Y.x+r,s=H.ayref===H.yref?Y.aay+n:Y.y+n;var u=c.rotationXYMatrix(W,i,s),h=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,v=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!v.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=H.arrowwidth,b=H.arrowcolor,M=Z.append("g").style({opacity:f.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),A=M.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(f.stroke,f.rgb(b));x(A,H.arrowhead,"end",H.arrowsize);var k=M.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,L;m.init({element:k.node(),prepFn:function(){var t=c.getTranslate(K);E=t.x,L=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){M.attr("transform","translate("+t+","+e+")");var r=h(E,L),n=r[0]+t,i=r[1]+e;K.call(c.setTranslate,n,i),T[S+".x"]=G?G.p2r(G.r2p(H.x)+t):(_+t-C.l)/C.w,T[S+".y"]=X?X.p2r(X.r2p(H.y)+e):1-(w+e-C.t)/C.h,H.axref===H.xref&&(T[S+".ax"]=G?G.p2r(G.r2p(H.ax)+t):(_+t-C.l)/C.w),H.ayref===H.yref&&(T[S+".ay"]=X?X.p2r(X.r2p(H.ay)+e):1-(w+e-C.t)/C.h),Q.attr({transform:"rotate("+W+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};H.showarrow&&L(0,0);var z=c.rotationXYMatrix(W,Y.x,Y.y),I=c.apply2DTransform(z);if(t._context.editable){var P,D,O;m.init({element:K.node(),prepFn:function(){var t=c.getTranslate(K);P=t.x,D=t.y,O={}},moveFn:function(t,e){K.call(c.setTranslate,P+t,D+e);var r="pointer";if(H.showarrow)H.axref===H.xref?O[S+".ax"]=G.p2r(G.r2p(H.ax)+t):O[S+".ax"]=H.ax+t,H.ayref===H.yref?O[S+".ay"]=X.p2r(X.r2p(H.ay)+e):O[S+".ay"]=H.ay+e,L(t,e);else{if(G)O[S+".x"]=H.x+t/G._m;else{var n=H._xsize/C.w,i=H.x+H._xshift/C.w-n/2;O[S+".x"]=m.align(i+t/C.w,n,0,1,H.xanchor)}if(X)O[S+".y"]=H.y+e/X._m;else{var a=H._ysize/C.h,o=H.y-H._yshift/C.h-a/2;O[S+".y"]=m.align(o-e/C.h,a,0,1,H.yanchor)}G&&X||(r=m.getCursor(G?.5:O[S+".x"],X?.5:O[S+".y"],H.xanchor,H.yanchor))}var s=I(P,D),l=s[0]+t,u=s[1]+e;K.call(c.setTranslate,P+t,D+e),Q.attr({transform:"rotate("+W+","+l+","+u+")"}),g(K,r)},doneFn:function(e){if(g(K),e){l.relayout(t,O);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,M=t.layout,A=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return M.annotations=u,y(M,A),void n(t);if("remove"===u)return delete M.annotations,A.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)A._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}A._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=M.annotations[e],E=A.annotations[e];if(T){var S={};"string"==typeof r&&r?S[r]=u:c.isPlainObject(r)&&(S=r);var L=Object.keys(S);for(w=0;w4/3&&(F=V)}}else R&&(N&&(F<1/3?F+=U:F>2/3&&(F-=U)),F=(F-R.domain[0])/(R.domain[1]-R.domain[0]),F=R.fraction2r(F))}R&&R===O&&j&&("log"===j&&"log"!==R.type?F=Math.pow(10,F):"log"!==j&&"log"===R.type&&(F=F>0?Math.log(F)/Math.LN10:void 0)),T[D]=F}}var H={};v(T,H,A),A.annotations[e]=H;var G=h.getFromId(t,H.xref),X=h.getFromId(t,H.yref),Y={x:0,y:0},W=+H.textangle||0,Z=A._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",H.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:H})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),K=Q.append("g"),$=H.borderwidth,J=H.borderpad,tt=$+J,et=K.append("rect").attr("class","bg").style("stroke-width",$+"px").call(f.stroke,H.bordercolor).call(f.fill,H.bgcolor),rt=H.font,nt=K.append("text").classed("annotation",!0).attr("data-unformatted",H.text).text(H.text);t._context.editable?nt.call(p.makeEditable,K).call(b).on("edit",function(r){H.text=r,this.attr({"data-unformatted":H.text}),this.call(b);var n={};n["annotations["+e+"].text"]=H.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(b),Q.attr({transform:"rotate("+W+","+Y.x+","+Y.y+")"}).call(d.setPosition,Y.x,Y.y)}}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,h=n-e,f=a-e,d=s-a,p=l*d-c*h;if(0===p)return null;var g=(u*d-c*f)/p,m=(u*h-l*f)/p;return m<0||m>1||g<0||g>1?null:{x:t+l*g,y:e+h*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),h=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":633,"../../lib/setcursor":643,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/cartesian/axes":664,"../../plots/plots":724,"../color":533,"../dragelement":554,"../drawing":556,"./annotation_defaults":524,"./defaults":528,"./draw_arrow_head":530,d3:95,"fast-isnumeric":104}],530:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var h,f,d,p,g=(o.getPx(t,"stroke-width")||1)*l,m=t.style("stroke")||a.defaultLine,v=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,x=r.indexOf("end")>=0,b=c.backoff*g;if("line"===u.nodeName){if(h={x:+t.attr("x1"),y:+t.attr("y1")},f={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(h.y-f.y,h.x-f.x),p=d+Math.PI,b){var _=b*Math.cos(d),w=b*Math.sin(d);y&&(h.x-=_,h.y-=w,t.attr({x1:h.x,y1:h.y})),x&&(f.x+=_,f.y+=w,t.attr({x2:f.x,y2:f.y}))}}else if("path"===u.nodeName){var M=u.getTotalLength(),A="";if(y){var k=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(k.y-T.y,k.x-T.x),h=u.getPointAtLength(Math.min(b,M)),b&&(A="0px,"+b+"px,")}if(x){var E=u.getPointAtLength(M),S=u.getPointAtLength(M-.1);if(p=Math.atan2(E.y-S.y,E.x-S.x),f=u.getPointAtLength(Math.max(0,M-b)),b){var L=A?2*b:b;A+=M-L+"px,"+M+"px"}}else A&&(A+=M+"px");A&&t.style("stroke-dasharray",A)}var z=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&z(h,d),x&&z(f,p)}}},{"../color":533,"../drawing":556,"./arrow_paths":525,d3:95,"fast-isnumeric":104}],531:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":526,"./calc_autorange":527,"./defaults":528,"./draw":529}],532:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],533:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var h=at.select(".cbfills").selectAll("rect.cbfill").data(z);h.enter().append("rect").classed("cbfill",!0).style("stroke","none"),h.exit().remove(),h.each(function(t,e){var r=[0===e?S[0]:(z[e]+z[e-1])/2,e===z.length-1?S[1]:(z[e]+z[e+1])/2].map(J.c2p).map(Math.round);e!==z.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=I(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({x:Y,width:Math.max(B,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var f=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?L:[]);return f.enter().append("path").classed("cbline",!0),f.exit().remove(),f.each(function(t){n.select(this).attr("d","M"+Y+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+B).call(d.lineGroupStyle,_.line.width,C(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=Y+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));M("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:k.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,r){var n,i=b();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,h(a,r||{}))}function A(){var r=B+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(F=ot.select("text"),F.node()&&!F.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-Y-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-K;at.select(".cbbg").attr({x:Y-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:K-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:Y,y:K+_.ypad+("top"===_.titleside?st:0),width:Math.max(B,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var k=t._fullLayout,T=k._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void k._infolayer.selectAll("g."+e).remove();var E,S=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),L=[],z=[],C="function"==typeof _.line.color?_.line.color:function(){return _.line.color},I="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},P=_.levels.end+_.levels.size/100,D=_.levels.size,O=1.001*S[0]-.001*S[1],R=1.001*S[1]-.001*S[0];for(E=_.levels.start;(E-P)*D<0;E+=D)E>O&&ES[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+q-X],J.setScale();var at=k._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+H)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+q-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,M(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ht=c.syncOrAsync([o.previousPromises,w,o.previousPromises,A],t);if(ht&&ht.then&&(t._promises||[]).push(ht),t._context.editable){var ft,dt,pt;u.init({element:at.node(),prepFn:function(){ft=at.attr("transform"),f(at)},moveFn:function(t,e){at.attr("transform",ft+" translate("+t+","+e+")"),dt=u.align(W+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,q,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);f(at,r)},doneFn:function(e){f(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},b().index)}})}return ht}function b(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=f,s.reversescale&&(f=a(f)),s.colorscale=f)}},{"../../lib":633,"./flip_scale":544,"./scales":551}],540:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":626,"./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,u,c){var h=c.prefix,f=c.cLetter,d=h.slice(0,h.length-1),p=h?i.nestedProperty(t,d).get()||{}:t,g=h?i.nestedProperty(e,d).get()||{}:e,m=p[f+"min"],v=p[f+"max"],y=p.colorscale,x=n(m)&&n(v)&&m=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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):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(Array.isArray(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":633}],554:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,h=(new Date).getTime(),h-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,h,f,d,p,g=o.getPlotDiv(t.element)||{},m=1,v=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":633,"../../plotly":659,"../../plots/cartesian/constants":669,"./align":552,"./cursor":553,"./unhover":555}],555:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":625}],556:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,h,f;t.so?(f=o.outlierwidth,h=o.outliercolor,c=a.outliercolor):(f=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,h="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(f||1)+"px",fill:"none"}):(e.style("stroke-width",f+"px").call(l.fill,c),f&&e.call(l.stroke,h))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),h=(c*c*i-u*u*s)*n,f=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&h/d),2),a.round(e[1]+(d&&f/d),2)],[a.round(e[0]-(p&&h/p),2),a.round(e[1]-(p&&f/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),h=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=g.tryColorscale(i,""),s=g.tryColorscale(i,"line");n(t,e,r,o,s,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),i=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,a.select(this),e,n,i)})}},g.tryColorscale=function(t,e){var r=e?c.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):c.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(h.convertToTspans);var f=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*b+1,m=x[l]*c,v=.75*u+x[s]*c+(x[s]-1)*p*u/2;f.attr("transform","translate("+m+","+v+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=k&&(a.selectAll("[data-bb]").attr("data-bb",null),A=[]),t.setAttribute("data-bb",A.length),A.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":618,"../../lib":633,"../../lib/svg_text_utils":647,"../../registry":739,"../../traces/scatter/make_bubble_size_func":861,"../../traces/scatter/subtypes":866,"../color":533,"../colorscale":547,"./symbol_defs":557,d3:95,"fast-isnumeric":104}],557:[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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),h=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+h+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:95}],558:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],559:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),h=0;h0;t.each(function(t){var e,h=t[0].trace,f=h.error_x||{},d=h.error_y||{};h.ids&&(e=function(t){return t.id});var p=o.hasMarkers(h)&&h.marker.maxdisplayed>0;if(d.visible||f.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().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),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var h;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;h="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(h+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");s=!m.size(),s?m=e.append("path").classed("yerror",!0):c&&(m=m.transition().duration(r.duration).ease(r.easing)),m.attr("d",h)}if(f.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var v=(f.copy_ystyle?d:f).width;h="M"+o.xh+","+(o.y-v)+"v"+2*v+"m0,-"+v+"H"+o.xs,o.noXS||(h+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",h)}}})}})}},{"../../traces/scatter/subtypes":866,d3:95,"fast-isnumeric":104}],564:[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":533,d3:95}],565:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":669}],566:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}var o=n("source"),l=n("visible",!!o);if(!l)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var u={_fullLayout:r},c=["x","y"],h=0;h<2;h++)a.coerceRef(t,e,u,c[h],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var r={name:l,handleItemDefaults:n};o(t,e,r)}},{"../../lib":633,"../../plots/array_container_defaults":661,"../../plots/cartesian/axes":664,"./attributes":565}],567:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,h=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,f=c*d.x[e.xanchor].offset,p=h*d.y[e.yanchor].offset,g=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,m=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+f,v=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:m,y:v,width:c,height:h,preserveAspectRatio:g,opacity:e.opacity});var y=o?o._id:"",x=l?l._id:"",b=y+x;b&&r.call(i.setClipUrl,"clip"+s._uid+b)}for(var s=t._fullLayout,l=[],u=[],c=[],h=0;h=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}},{}],570:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":626,"../../plots/font_attributes":684,"../color/attributes":532}],571:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],572:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,h,f,d=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(u=0,h="left",c=1.1,f="bottom"):(u=0,h="left",c=-.1,f="top")}l("traceorder",m),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",h),l("y",c),l("yanchor",f),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":633,"../../plots/layout_attributes":715,"../../registry":739,"./attributes":570,"./helpers":575}],573:[function(t,e,r){"use strict";function n(t,e){function r(r){v.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,h=t.selectAll("text.legendtext").data([0]);h.enter().append("text").classed("legendtext",!0),h.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?h.call(v.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):h.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var h=a.label,f=r.indexOf(h);f===-1?r.push(h):r.splice(f,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),f=c[0].length||1;r=s*f,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-f)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){h.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;h.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,f=l.length;cn.width-(n.margin.r+n.margin.l)&&(x=0,m+=v,i.height=i.height+v,v=0),h.setTranslate(this,a+x,5+a+e.height/2+m),i.width+=o+r,i.height=Math.max(i.height,e.height),x+=o+r,v=Math.max(e.height,v)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),f.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),f.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),h=t("../../lib"),f=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(h.setTranslate,0,e),S.call(g.setRect,N,t,y.scrollBarWidth,y.scrollBarHeight),k.select("rect").attr({y:v.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var v=r.legend,_=r.showlegend&&x(t.calcdata,v),M=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void f.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var T=A.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var E=A.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var S=A.selectAll("rect.scrollbar").data([0]);S.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var L=E.selectAll("g.groups").data(_);L.enter().append("g").attr("class","groups"),L.exit().remove();var z=L.selectAll("g.traces").data(h.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var C=0!==A.enter().size();C&&(o(t,L,z),s(t));var I=0,P=r.width,D=0,O=r.height;o(t,L,z),v.height>O?l(t):s(t);var R=r._size,F=R.l+R.w*v.x,j=R.t+R.h*(1-v.y);w.isRightAnchor(v)?F-=v.width:w.isCenterAnchor(v)&&(F-=v.width/2),w.isBottomAnchor(v)?j-=v.height:w.isMiddleAnchor(v)&&(j-=v.height/2);var N=v.width,B=R.w;N>B?(F=R.l,N=B):(F+N>P&&(F=P-N),FV?(j=R.t,U=V):(j+U>O&&(j=O-U),jr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),f=d.hasLines(o);if(s||u||f){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),f&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var m=l.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(s?n:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(h.pointStyle,i),s&&(n[0].mrc=3);var y=m.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(h.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(f.fill,t.mc||r.color),e&&i.call(f.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(f.fill,t.fc||e.fillcolor),r&&n.call(f.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),h=t("../drawing"),f=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":633,"../../registry":739,"../../traces/pie/style_one":840,"../../traces/scatter/subtypes":866,"../color":533,"../drawing":556,d3:95}],578:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,f=(1+c)/2,d=(1-c)/2,p=h.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(m,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=i(s),y=[];return((u||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||v||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(m,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var m=c("bgcolor");c("activecolor",o.contrast(m,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":633,"../color":533,"./attributes":582,"./button_attributes":583,"./constants":584}],586:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=f)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)f(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,L)},i=L.line.width?L.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",L.opacity).call(_.stroke,i).call(_.fill,L.fillcolor).call(w.dashLine,L.line.dash,L.line.width);z&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&h(t,a,L,e)}var a,o;f(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:x.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>Y&&!t.shiftKey?M.getCursor(i/r,1-a/n):"move";A(e,o),G=o.split("-")[0]}function a(e){N=b.getFromId(t,r.xref),B=b.getFromId(t,r.yref),U=T.getDataToPixel(t,N),V=T.getDataToPixel(t,B,!0),q=T.getPixelToData(t,N),H=T.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(F=r.path,j=a+".path"):(c=U(r.x0),h=V(r.y0),f=U(r.x1),d=V(r.y1),g=a+".x0",v=a+".y0",x=a+".x1",_=a+".y1"),cY&&(u[L]=r[P]=H(s),u[z]=r[D]=H(l)),h-c>X&&(u[C]=r[O]=q(c),u[I]=r[R]=q(h))}e.attr("d",p(t,r))}var u,c,h,f,d,g,v,x,_,w,k,E,S,L,z,C,I,P,D,O,R,F,j,N,B,U,V,q,H,G,X=10,Y=10,W={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=W.element.getBoundingClientRect();M.init(W)}function f(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=b.getFromId(t,r.id,"x")._id,i=b.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=b.getFromId(t,e.xref),l=b.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),h=n(e.x1),f=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+f+"L"+h+","+d;if("rect"===o)return"M"+c+","+f+"H"+h+"V"+d+"H"+c+"Z";var p=(c+h)/2,m=(f+d)/2,v=Math.abs(p-c),y=Math.abs(m-f),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),i+l})}function m(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),M=t("../dragelement"),A=t("../../lib/setcursor"),k=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),S=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":633,"../../lib/setcursor":643,"../../plotly":659,"../../plots/cartesian/axes":664,"../color":533,"../dragelement":554,"../drawing":556,"./constants":596,"./defaults":597,"./helpers":599,"./shape_defaults":601,"fast-isnumeric":104}],599:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],600:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":594,"./calc_autorange":595,"./defaults":597,"./draw":598}],601:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var h=t.path?"path":"rect",f=u("type",h),d=["x","y"],p=0;p<2;p++){var g=d[p],m={_fullLayout:r},v=i.coerceRef(t,e,m,g,"","paper");if("path"!==f){var y,x,b,_=.25,w=.75;"paper"!==v?(y=i.getFromId(m,v),b=o.rangeToShapePosition(y),x=o.shapePositionToRange(y)):x=b=n.identity;var M=g+"0",A=g+"1",k=t[M],T=t[A];t[M]=x(t[M],!0),t[A]=x(t[A],!0),i.coercePosition(e,m,u,v,M,_),i.coercePosition(e,m,u,v,A,w),e[M]=b(e[M]),e[A]=b(e[A]),t[M]=k,t[A]=T}}return"path"===f?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":633,"../../plots/cartesian/axes":664,"./attributes":594,"./helpers":599}],602:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":626,"../../plots/animation_attributes":660,"../../plots/font_attributes":684,"../../plots/pad_attributes":723,"./constants":603}],603:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],604:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*L.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+L.stepInset+(t.inputAreaLength-2*L.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-L.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*L.stepInset-2*t.inputAreaStart)))}function x(t,e,r){var n=t.selectAll("rect."+L.railTouchRectClass).data([0]);n.enter().append("rect").classed(L.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,L.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),A.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+L.railRectClass).data([0]);r.enter().append("rect").classed(L.railRectClass,!0);var n=e.inputAreaLength-2*L.railInset;r.attr({width:n,height:L.railWidth,rx:L.railRadius,ry:L.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(r,L.railInset,.5*(e.inputAreaWidth-L.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(L.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+L.groupClassName).data(r,i);l.enter().append("g").classed(L.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,L.autoMarginIdRoot+e._index)});for(var u=0;u0||f<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,S=!0,L=C,M._infolayer.select("."+e).attr({"data-unformatted":L}).text(L).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,m=r.propName,v=r.traceIndex,y=r.dfltName,x=r.avoid||{},b=r.attributes,_=r.transform,w=r.containerGroup,M=t._fullLayout,A=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,S=!1,L=g.title.trim(); -""===L&&(E=0),L.match(/Click to enter .+ title/)&&(E=.2,S=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(L).attr("class",e),z.attr({"data-unformatted":L}).call(h);var C="Click to enter "+y+" title";t._context.editable?(L||p(),z.call(c.makeEditable).on("edit",function(e){void 0!==v?a.restyle(t,m,e,v):a.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):L&&!L.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",S)}},{"../../lib":633,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/plots":724,"../color":533,"../drawing":556,d3:95,"fast-isnumeric":104}],608:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":626,"../../plots/font_attributes":684,"../../plots/pad_attributes":723,"../color/attributes":532}],609:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],610:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var h=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);h.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&h.call(v).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){x.select(this).remove(),h.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],618:[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}},{}],619:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":531,"./components/images":568,"./components/legend":576,"./components/rangeselector":588,"./components/rangeslider":593,"./components/shapes":600,"./components/sliders":606,"./components/updatemenus":612,"./fonts/mathjax_config":620,"./lib/queue":641,"./plot_api/plot_schema":653,"./plot_api/register":654,"./plot_api/set_plot_config":655,"./plot_api/to_image":657,"./plot_api/validate":658,"./plotly":659,"./snapshot":744,"./snapshot/download":741,"./traces/scatter":856,d3:95,"es6-promise":101}],620:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],621:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],622:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":616,"fast-isnumeric":104}],623:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var m=(new Date).getFullYear();e=((Number(u[0])-m+70)%100+200)%100+m-70}if(!a(e))return l;var v=new Date(0,0,1);if(v.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(v.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(v.setDate(i),v.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(v.setHours(o),v.getHours()!==o)return l;if(u.length>1)return i=v.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=h*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*f:l)):l}}}return v.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,m=3*c,v=5*h;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e0&&(n.push(i),i=[])}return n.push(i),n},r.makeLine=function(t,e){var r={};return r=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(r.trace=e),r},r.makePolygon=function(t,e){var r={};if(1===t.length)r={type:"Polygon",coordinates:t};else{for(var n=new Array(t.length),i=0;i",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":622, +"metaKey"in t&&(e=e||t.metaKey!==g.meta,g.meta=!!t.metaKey),e}function n(t,n){var a=i.x(n),o=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==f||a!==d||o!==p||r(n))&&(f=0|t,d=a||0,p=o||0,e&&e(f,d,p,g))}function a(t){n(0,t)}function o(){(f||d||p||g.shift||g.alt||g.meta||g.control)&&(d=p=0,f=0,g.shift=g.alt=g.control=g.meta=!1,e&&e(0,0,0,g))}function s(t){r(t)&&e&&e(f,d,p,g)}function l(t){0===i.buttons(t)?n(0,t):n(f,t)}function u(t){n(f|i.buttons(t),t)}function c(t){n(f&~i.buttons(t),t)}function h(){m||(m=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",a),t.addEventListener("mouseenter",a),t.addEventListener("mouseout",a),t.addEventListener("mouseover",a),t.addEventListener("blur",o),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",o),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var f=0,d=0,p=0,g={shift:!1,alt:!1,control:!1,meta:!1},m=!1;h();var v={element:t};return Object.defineProperties(v,{enabled:{get:function(){return m},set:function(t){t&&h()},enumerable:!0},buttons:{get:function(){return f},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return g},enumerable:!0}}),v}e.exports=n;var i=t("mouse-event")},{"mouse-event":414}],414:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<=0;--e)L(e,0);for(var r=[],e=0;e0;_=_-1&g)b.push(w+"["+T+"+"+m(_)+"]");b.push(v(0));for(var _=0;_0){",f(b[t]),"=1;"),D(t-1,e|1<0&&G.push(s(U,b[V-1])+"*"+o(b[V-1])),N.push(d(U,b[V])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)X.push(o(b[U]));N.push(k+"=("+X.join("*")+")|0",M+"=mallocUint32("+k+")",w+"=mallocUint32("+k+")",T+"=0"),N.push(p(0)+"=0");for(var V=1;V<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 a=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return x(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=b;var w="V",M="P",A="N",k="Q",T="X",E="T"},{"typedarray-pool":496}],417:[function(t,e,r){"use strict";var n=t("cwise/lib/wrapper")({args:["index","array","scalar"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{_inline_1_arg1_=_inline_1_arg2_.apply(void 0,_inline_1_arg0_)}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":94}],418:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;r=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){o.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push("&&s[",l,"]>2");o.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||o.push(",dst.pick(",s.join(),",",l,")",u);o.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",f.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>1){diff(",h,",src.pick(",f.join(),")",u,",src.pick(",d.join(),")",u,");}else{zero(",h,");};");break;case"mirror":0===r?o.push("dst.set(",s.join(),",",c,",0);"):o.push("zero(",h,");");break;case"wrap":var p=s.slice(),g=s.slice();e[l]<0?(p[c]="s["+c+"]-2",g[c]="0"):(p[c]="s["+c+"]-1",g[c]="1"),0===r?o.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):o.push("if(s[",c,"]>2){diff(",h,",src.pick(",p.join(),")",u,",src.pick(",g.join(),")",u,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&o.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var a=t.length,o=["function gradient(dst,src){var s=src.shape.slice();"],s=0;s<1<>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=a({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]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var h=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=o({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=o({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=o({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=a({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=a({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=o({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":91}],422:[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":423,ndarray:427}],423:[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":91}],424:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;r1){for(var h=[],f=1;f1){o.push("dptr=0;sptr=ptr");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&o.push(["for(i",d,"=0;i",d,"left){","dptr=0","sptr=cptr-s0");for(var f=1;fb){break __l}"].join(""));for(var f=t.length-1;f>=1;--f)o.push("sptr+=e"+f,"dptr+=f"+f,"}");o.push("dptr=cptr;sptr=cptr-s0");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&o.push(["for(i",d,"=0;i",d,"=0;--f){var d=t[f];0!==d&&o.push(["for(i",d,"=0;i",d,"left)&&("+r("cptr-s0")+">scratch)){",a("cptr",r("cptr-s0")),"cptr-=s0","}",a("cptr","scratch"));if(o.push("}"),t.length>1&&u&&o.push("free(scratch)"),o.push("} return "+s),u){var p=new Function("malloc","free",o.join("\n"));return p(u[0],u[1])}var p=new Function(o.join("\n"));return p()}function o(t,e,r){function a(t){return["(offset+",t,"*s0)"].join("")}function o(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+a(e[0]));else for(var i=0;i=0;--i){var o=t[i];0!==o&&_.push(["for(i",o,"=0;i",o,"1)for(var i=0;i1?_.push("ptr_shift+=d"+o):_.push("ptr0+=d"+o),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+a(r[0]));else{for(var o=0;o1)for(var o=0;o=1;--o)n&&_.push("pivot_ptr+=f"+o),r.length>1?_.push("ptr_shift+=e"+o):_.push("ptr0+=e"+o),_.push("}")}function h(){t.length>1&&A&&_.push("free(pivot1)","free(pivot2)")}function f(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++k;c(s,[n,i],!1,["comp=",o("ptr0"),"-",o("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",o(a(n)),">",o(a(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?l([e,r],!1,s("ptr0",o("ptr1"))):_.push(s(a(e),o(a(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++k;c(i,[r],!0,[e,"=",o("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",o(a(r)),"-pivot",n].join(""))}function g(e,r){t.length>1?l([e,r],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1","tmp")].join(""))}function m(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","ptr2=",a(n),"\n","++",r,"\n","--",n,"\n","tmp=",o("ptr0"),"\n",s("ptr0",o("ptr1")),"\n",s("ptr1",o("ptr2")),"\n",s("ptr2","tmp")].join(""))}function v(t,e){g(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",o("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(a(e),o(a(r))),s(a(r),"pivot"+n))}function x(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function b(e,r,n){t.length>1?(_.push(["__l",++k,":while(true){"].join("")),l([e],!0,["if(",o("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",k,"}"].join("")),_.push(n,"}")):_.push(["while(",o(a(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),M=["left","right","data","offset"].concat(i(t.length)),A=n(e),k=0;_.push(["function ",w,"(",M.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],S=1;S1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",o("ptr1"),"\n","pivot2[pivot_ptr]=",o("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",o("ptr0"),"\n","y=",o("ptr2"),"\n","z=",o("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",o(a("el2")),"\n","pivot2=",o(a("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",o(a("el1")),"\n","y=",o(a("el3")),"\n","z=",o(a("el5")),"\n",s(a("index1"),"x"),"\n",s(a("index3"),"y"),"\n",s(a("index5"),"z")].join("")),d("index2","left"),d("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),p("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),p("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),m("k","less","great"),_.push("break"),_.push("}else{"),v("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"), +_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp>0){"),_.push("if(--greatindex5){"),b("less",1,"++less"),b("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp===0){"),_.push("if(--great1&&A){var L=new Function("insertionSort","malloc","free",_.join("\n"));return L(r,A[0],A[1])}var L=new Function("insertionSort",_.join("\n"));return L(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c0?l.push(["d",m,"=s",m,"-d",p,"*n",p].join("")):l.push(["d",m,"=s",m].join("")),p=m);var d=t.length-1-c;0!==d&&(g>0?l.push(["e",d,"=s",d,"-e",g,"*n",g,",f",d,"=",h[d],"-f",g,"*n",g].join("")):l.push(["e",d,"=s",d,",f",d,"=",h[d]].join("")),g=d)}r.push("var "+l.join(","));var v=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",v.join(","),")}else{","quickSort(",v.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),x=a(t,e),b=o(t,e,x);return y(x,b)}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":496}],425:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],o=n.join(":"),s=a[o];return s||(a[o]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),a={};e.exports=n},{"./lib/compile_sort.js":424}],426:[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_9_arg4_)}",args:[{name:"_inline_9_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_10_arg2_(this_warped,_inline_10_arg0_),_inline_10_arg1_=_inline_10_arg3_.apply(void 0,this_warped)}",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:!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_13_arg2_(this_warped,_inline_13_arg0_),_inline_13_arg1_=_inline_13_arg3_(_inline_13_arg4_,this_warped[0])}",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:"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_16_arg2_(this_warped,_inline_16_arg0_),_inline_16_arg1_=_inline_16_arg3_(_inline_16_arg4_,this_warped[0],this_warped[1])}",args:[{name:"_inline_16_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_16_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"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_19_arg2_(this_warped,_inline_19_arg0_),_inline_19_arg1_=_inline_19_arg3_(_inline_19_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_19_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_19_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg4_",lvalue:!1,rvalue:!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":94,"ndarray-linear-interpolate":420}],427:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;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("+u.join(",")+",v){"),n?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var m=0;m=0){d=i"+m+"|0;b+=c"+m+"*d;a"+m+"-=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var m=0;m=0){c=(c+this.stride["+m+"]*i"+m+")|0}else{a.push(this.shape["+m+"]);b.push(this.stride["+m+"])}");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,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",a.join("\n"));return o(h[t],i)}function o(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=h.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;lt==t>0?n===o?(r+=1,n=0):n+=1:0===n?(n=o,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),a=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":97}],429:[function(t,e,r){var n=1e-6,i=1e-6;r.vertexNormals=function(t,e,r){for(var i=e.length,a=new Array(i),o=void 0===r?n:r,s=0;so)for(var _=a[c],w=1/Math.sqrt(v*x),b=0;b<3;++b){var M=(b+1)%3,A=(b+2)%3;_[b]+=w*(y[M]*m[A]-y[A]*m[M])}}for(var s=0;so)for(var w=1/Math.sqrt(k),b=0;b<3;++b)_[b]*=w;else for(var b=0;b<3;++b)_[b]=0}return a},r.faceNormals=function(t,e,r){for(var n=t.length,a=new Array(n),o=void 0===r?i:r,s=0;so?1/Math.sqrt(p):0;for(var c=0;c<3;++c)d[c]*=p;a[s]=d}return a}},{}],430:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u){var c=e+a+u;if(h>0){var h=Math.sqrt(c+1);t[0]=.5*(o-l)/h,t[1]=.5*(s-n)/h,t[2]=.5*(r-a)/h,t[3]=.5*h}else{var f=Math.max(e,a,u),h=Math.sqrt(2*f-c+1);e>=f?(t[0]=.5*h,t[1]=.5*(i+r)/h,t[2]=.5*(s+n)/h,t[3]=.5*(o-l)/h):a>=f?(t[0]=.5*(r+i)/h,t[1]=.5*h,t[2]=.5*(l+o)/h,t[3]=.5*(s-n)/h):(t[0]=.5*(n+s)/h,t[1]=.5*(o+l)/h,t[2]=.5*h,t[3]=.5*(r-i)/h)}return t}e.exports=n},{}],431:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function a(t,e){var r=e[0],n=e[1],a=e[2],o=e[3],s=i(r,n,a,o);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=a/s,t[3]=o/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function o(t,e,r){this.radius=l([r]),this.center=l(e),this.rotation=l(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),r=[].slice.call(r,0,4),a(r,r);var i=new o(r,e,Math.log(n));return i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up),i}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/lookAt"),c=t("gl-mat4/fromQuat"),h=t("gl-mat4/invert"),f=t("./lib/quatFromFrame"),d=o.prototype;d.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},d.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;a(e,e);var r=this.computedMatrix;c(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 u=0,h=0;h<3;++h)u+=r[l+4*h]*i[h];r[12+l]=-u}},d.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},d.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},d.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},d.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=a[1],s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],h=a[4],f=a[8],d=c*o+h*s+f*l;c-=o*d,h-=s*d,f-=l*d;var p=n(c,h,f);c/=p,h/=p,f/=p;var g=a[2],m=a[6],v=a[10],y=g*o+m*s+v*l,x=g*c+m*h+v*f;g-=y*o+x*c,m-=y*s+x*h,v-=y*l+x*f;var b=n(g,m,v);g/=b,m/=b,v/=b;var _=c*e+o*r,w=h*e+s*r,M=f*e+l*r;this.center.move(t,_,w,M);var A=Math.exp(this.computedRadius[0]);A=Math.max(1e-4,A+i),this.radius.set(t,Math.log(A))},d.rotate=function(t,e,r,a){this.recalcMatrix(t),e=e||0,r=r||0;var o=this.computedMatrix,s=o[0],l=o[4],u=o[8],c=o[1],h=o[5],f=o[9],d=o[2],p=o[6],g=o[10],m=e*s+r*c,v=e*l+r*h,y=e*u+r*f,x=-(p*y-g*v),b=-(g*m-d*y),_=-(d*v-p*m),w=Math.sqrt(Math.max(0,1-Math.pow(x,2)-Math.pow(b,2)-Math.pow(_,2))),M=i(x,b,_,w);M>1e-6?(x/=M,b/=M,_/=M,w/=M):(x=b=_=0,w=1);var A=this.computedRotation,k=A[0],T=A[1],E=A[2],S=A[3],L=k*w+S*x+T*_-E*b,z=T*w+S*b+E*x-k*_,C=E*w+S*_+k*b-T*x,I=S*w-k*x-T*b-E*_;if(a){x=d,b=p,_=g;var P=Math.sin(a)/n(x,b,_);x*=P,b*=P,_*=P,w=Math.cos(e),L=L*w+I*x+z*_-C*b,z=z*w+I*b+C*x-L*_,C=C*w+I*_+L*b-z*x,I=I*w-L*x-z*b-C*_}var D=i(L,z,C,I);D>1e-6?(L/=D,z/=D,C/=D,I/=D):(L=z=C=0,I=1),this.rotation.set(t,L,z,C,I)},d.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var i=this.computedMatrix;u(i,e,r,n);var o=this.computedRotation;f(o,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),a(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var s=0,l=0;l<3;++l)s+=Math.pow(r[l]-e[l],2);this.radius.set(t,.5*Math.log(Math.max(s,1e-6))),this.center.set(t,r[0],r[1],r[2])},d.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},d.setMatrix=function(t,e){var r=this.computedRotation;f(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),a(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;h(n,e);var i=n[15];if(Math.abs(i)>1e-6){var o=n[12]/i,s=n[13]/i,l=n[14]/i;this.recalcMatrix(t);var u=Math.exp(this.computedRadius[0]);this.center.set(t,o-n[2]*u,s-n[6]*u,l-n[10]*u),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},d.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},d.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},d.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},d.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":430,"filtered-vector":106,"gl-mat4/fromQuat":146,"gl-mat4/invert":149,"gl-mat4/lookAt":150}],432:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r="undefined"!=typeof r?r+"":" ",n(r,e)+t}},{"repeat-string":457}],433:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],434:[function(t,e,r){(function(t){function e(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n=-1&&!i;a--){var o=a>=0?arguments[a]:t.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(r=o+"/"+r,i="/"===o.charAt(0))}return r=e(n(r.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(t){var i=r.isAbsolute(t),a="/"===o(t,-1);return t=e(n(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&a&&(t+="/"),(i?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},r.relative=function(t,e){function n(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var i=n(t.split("/")),a=n(e.split("/")),o=Math.min(i.length,a.length),s=o,l=0;l55295&&e<57344){if(!r){e>56319||a+1===n?i.push(239,191,189):r=e;continue}if(e<56320){i.push(239,191,189),r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(i.push(239,191,189),r=null);e<128?i.push(e):e<2048?i.push(e>>6|192,63&e|128):e<65536?i.push(e>>12|224,e>>6&63|128,63&e|128):i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}return i}e.exports=n;var a,o,s,l=t("ieee754");a={readUInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},writeUInt32LE:function(t,e){this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24},readInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+(this[t+3]<<24)},readFloatLE:function(t){return l.read(this,t,!0,23,4)},readDoubleLE:function(t){return l.read(this,t,!0,52,8)},writeFloatLE:function(t,e){return l.write(this,t,e,!0,23,4)},writeDoubleLE:function(t,e){return l.write(this,t,e,!0,52,8)},toString:function(t,e,r){var n="",i="";e=e||0,r=Math.min(this.length,r||this.length);for(var a=e;a=1;){if(e.pos>=r)throw new Error("Given varint doesn't fit into 10 bytes");var n=255&t;e.buf[e.pos++]=n|(t>=128?128:0),t/=128}}function 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>3,a=this.pos;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=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*v;return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*v;return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,e,r=this.buf;return e=r[this.pos++],t=127&e,e<128?t:(e=r[this.pos++],t|=(127&e)<<7,e<128?t:(e=r[this.pos++],t|=(127&e)<<14,e<128?t:(e=r[this.pos++],t|=(127&e)<<21,e<128?t:i(t,this))))},readVarint64:function(){var t=this.pos,e=this.readVarint();if(e127;);else if(e===n.Bytes)this.pos=this.readVarint()+this.pos;else if(e===n.Fixed32)this.pos+=4;else{if(e!==n.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455?void a(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(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);var e=m.byteLength(t);this.writeVarint(e),this.realloc(e),this.buf.write(t,this.pos),this.pos+=e},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;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,h,e)},writePackedFloat:function(t,e){this.writeMessage(t,u,e)},writePackedDouble:function(t,e){this.writeMessage(t,c,e)},writePackedFixed32:function(t,e){this.writeMessage(t,f,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,d,e)},writePackedFixed64:function(t,e){this.writeMessage(t,p,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))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":435}],437:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return a.freeUint32(l),a.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,a,o=1;for(r[0]=0,a=1;a0;--a)n=e/o|0,e=e-n*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}var a=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":256,"typedarray-pool":496}],439:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,s,l,c=0;c<2;++c)if(u[c][n].length>0){o=u[c][n][0],l=c;break}s=o[1^l];for(var h=0;h<2;++h)for(var f=u[h][n],d=0;d0&&(o=p,s=g,l=h)}return a?s:(o&&r(o,l),s)}function a(t,a){var o=u[a][t][0],s=[t];r(o,a);for(var l=o[1^a];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],h=t,f=s[1],d=n(c,h,!0);if(i(e[c],e[h],e[f],e[d])<0)break;s.push(t),l=n(c,h)}return s}function o(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;c0;){var g=(u[0][c].length,a(c,d));o(p,g)?p.push.apply(p,g):(p.length>0&&f.push(p),p=g)}p.length>0&&f.push(p)}return f}e.exports=n;var i=t("compare-angle")},{"compare-angle":81}],440:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function a(t){for(var e=t.length,r=0;r0;){var U=N.pop(),V=I[U];h(V,function(t,e){return t-e});var q,H=V.length,G=B[U];if(0===G){var T=v[U];q=[T]}for(var m=0;m=0)&&(B[X]=1^G,N.push(X),0===G)){var T=v[X];a(T)||(T.reverse(),q.push(T))}}0===G&&d.push(q)}return d}e.exports=a;var o=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),h=t("uniq"),f=t("./lib/trim-leaves")},{"./lib/trim-leaves":440,"edges-to-adjacency-list":100,"planar-dual":439,"point-in-big-polygon":443,"robust-sum":470,"two-product":494,uniq:498}],442:[function(t,e,r){"use strict";function n(t,e){this.x=t,this.y=e}e.exports=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{}],443:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return!!i&&!!i.queryPoint(r,n)}}function a(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var o=i.key,s=h(r,o[0],o[1]);if(o[0][0]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))return 0;a=1,i=i.right}}return a}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;i=u?(b=1,y=u+2*f+p):(b=-f/u,y=f*b+p)):(b=0,d>=0?(_=0,y=p):-d>=h?(_=1,y=h+2*d+p):(_=-d/h,y=d*_+p));else if(_<0)_=0,f>=0?(b=0,y=p):-f>=u?(b=1,y=u+2*f+p):(b=-f/u,y=f*b+p);else{var w=1/x;b*=w,_*=w,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p}else{var M,A,k,T;b<0?(M=c+f,A=h+d,A>M?(k=A-M,T=u-2*c+h,k>=T?(b=1,_=0,y=u+2*f+p):(b=k/T,_=1-b,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p)):(b=0,A<=0?(_=1,y=h+2*d+p):d>=0?(_=0,y=p):(_=-d/h,y=d*_+p))):_<0?(M=c+d,A=u+f,A>M?(k=A-M,T=u-2*c+h,k>=T?(_=1,b=0,y=h+2*d+p):(_=k/T,b=1-_,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p)):(_=0,A<=0?(b=1,y=u+2*f+p):f>=0?(b=0,y=p):(b=-f/u,y=f*b+p))):(k=h+d-c-f,k<=0?(b=0,_=1,y=h+2*d+p):(T=u-2*c+h,k>=T?(b=1,_=0,y=u+2*f+p):(b=k/T,_=1-b,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*d)+p)))}for(var E=1-b-_,l=0;l1)for(var r=1;r1&&(n=r[0]+"@",t=r[1]),t=t.replace(P,".");var i=t.split("."),a=o(i,e).join(".");return n+a}function l(t){for(var e,r,n=[],i=0,a=t.length;i=55296&&e<=56319&&i65535&&(t-=65536,e+=F(t>>>10&1023|55296),t=56320|1023&t),e+=F(t)}).join("")}function c(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:M}function h(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function f(t,e,r){var n=0;for(t=r?R(t/E):t>>1,t+=R(t/e);t>O*k>>1;n+=M)t=R(t/O);return R(n+(O+1)*t/(t+T))}function d(t){var e,r,n,i,o,s,l,h,d,p,g=[],m=t.length,v=0,y=L,x=S;for(r=t.lastIndexOf(z),r<0&&(r=0),n=0;n=128&&a("not-basic"),g.push(t.charCodeAt(n));for(i=r>0?r+1:0;i=m&&a("invalid-input"),h=c(t.charCodeAt(i++)),(h>=M||h>R((w-v)/s))&&a("overflow"),v+=h*s,d=l<=x?A:l>=x+k?k:l-x,!(hR(w/p)&&a("overflow"),s*=p;e=g.length+1,x=f(v-o,e,0==o),R(v/e)>w-y&&a("overflow"),y+=R(v/e),v%=e,g.splice(v++,0,y)}return u(g)}function p(t){var e,r,n,i,o,s,u,c,d,p,g,m,v,y,x,b=[];for(t=l(t),m=t.length,e=L,r=0,o=S,s=0;s=e&&gR((w-r)/v)&&a("overflow"),r+=(u-e)*v,e=u,s=0;sw&&a("overflow"),g==e){for(c=r,d=M;p=d<=o?A:d>=o+k?k:d-o,!(c= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=M-A,R=Math.floor,F=String.fromCharCode;if(b={version:"1.4.1",ucs2:{decode:l,encode:u},decode:d,encode:p,toASCII:m,toUnicode:g},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return b});else if(v&&y)if(r.exports==v)y.exports=b;else for(_ in b)b.hasOwnProperty(_)&&(v[_]=b[_]);else i.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],447:[function(t,e,r){e.exports=t("gl-quat/slerp")},{"gl-quat/slerp":199}],448:[function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,r,a){e=e||"&",r=r||"=";var o={};if("string"!=typeof t||0===t.length)return o;var s=/\+/g;t=t.split(e);var l=1e3;a&&"number"==typeof a.maxKeys&&(l=a.maxKeys);var u=t.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(h=g.substr(0,m),f=g.substr(m+1)):(h=g,f=""),d=decodeURIComponent(h),p=decodeURIComponent(f),n(o,d)?i(o[d])?o[d].push(p):o[d]=[o[d],p]:o[d]=p}return o};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],449:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;nr;){if(o-r>600){var l=o-r+1,u=e-r+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),d=Math.max(r,Math.floor(e-u*h/l+f)),p=Math.min(o,Math.floor(e+(l-u)*h/l+f));n(t,e,d,p,s)}var g=t[e],m=r,v=o;for(i(t,r,e),s(t[o],g)>0&&i(t,r,o);m0;)v--}0===s(t[r],g)?i(t,r,v):(v++,i(t,v,o)),v<=e&&(r=v+1),e<=v&&(o=v-1)}}function i(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function a(t,e){return te?1:0}e.exports=n},{}],452:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),a=0;a0){var u=t[r-1];if(0===i(s,u)&&o(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}var i=t("compare-cell"),a=t("compare-oriented-cell"),o=t("cell-orientation");e.exports=n},{"cell-orientation":73,"compare-cell":82,"compare-oriented-cell":83}],457:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("expected a string");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;if(i!==t||"undefined"==typeof i)i=t,a="";else if(a.length>=r)return a.substr(0,r);for(;r>a.length&&e>1;)1&e&&(a+=t),e>>=1,t+=t;return a+=t,a=a.substr(0,r)}var i,a="";e.exports=n},{}],458:[function(e,r,n){void function(e,i){"function"==typeof t&&t.amd?t(i):"object"==typeof n?r.exports=i():e.resolveUrl=i()}(this,function(){function t(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var r=document.getElementsByTagName("head")[0];r.insertBefore(e,r.firstChild);for(var n,i=document.createElement("a"),a=1;a=0;--i){var a=r,o=t[i];r=a+o;var s=r-a,l=o-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;i>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;r>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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 o(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",o(t[0][0],t[1][1]),",",o(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r0&&r.push(","),r.push("[");for(var a=0;a0&&r.push(","),a===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",a,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var o=new Function("det",r.join(""));return o(t<6?s[t]:s)}function i(){return[0]}function a(t,e){return[[e[0]],[t[0][0]]]}function o(){for(;u.length>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;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=v*n;return o>=s||o<=-s?o:x(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],u=r[1]-n[1],c=t[2]-n[2],h=e[2]-n[2],f=r[2]-n[2],d=a*u,p=o*l,g=o*s,m=i*u,v=i*l,x=a*s,_=c*(d-p)+h*(g-m)+f*(v-x),w=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(m))*Math.abs(h)+(Math.abs(v)+Math.abs(x))*Math.abs(f),M=y*w;return _>M||-_>M?_:b(t,e,r,n)}];c()},{"robust-scale":467,"robust-subtract":469,"robust-sum":470,"two-product":494}],466:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return a(e,t[0]);if(1===e.length)return a(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.length0&&s>0||o<0&&s<0)return!1;var l=a(r,t,e),u=a(i,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,i))}e.exports=i;var a=t("robust-orientation")[3]},{"robust-orientation":465}],469:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,h=0,f=Math.abs,d=t[c],p=f(d),g=-e[h],m=f(g);p=i?(a=d,c+=1,c=i?(a=d,c+=1,c0){for(var s=0,l=0,u=0;un.h||t>n.free||rc)&&(h=2*Math.max(t,c)),(ll)&&(u=2*Math.max(r,l)),this.resize(h,u),this.packOne(t,r)}return null},t.prototype.clear=function(){this.shelves=[],this.stats={}},t.prototype.resize=function(t,e){this.w=t,this.h=e;for(var r=0;rthis.free||e>this.h)return null;var r=this.x;return this.x+=t,this.free-=t,{x:r,y:this.y,w:t,h:e,width:t,height:e}},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t})},{}],472:[function(t,e,r){"use strict";e.exports=function(t){return t<0?-1:t>0?1:0}},{}],473:[function(t,e,r){"use strict";function n(t){return a(i(t))}e.exports=n;var i=t("boundary-cells"),a=t("reduce-simplicial-complex")},{"boundary-cells":56,"reduce-simplicial-complex":456}],474:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;n0&&u.push(","),u.push("[");for(var n=0;n0&&u.push(","),u.push("B(C,E,c[",i[0],"],c[",i[1],"])")}u.push("]")}u.push(");")}}var r=0,n=new Array(t+1);n[0]=[[]];for(var i=1;i<=t;++i)for(var s=n[i]=o(i),l=0;l>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--i){i>1,s=o(t[a],e);s<=0?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function h(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[g],a))break}return r}function f(t,e){if(!e)return h(u(p(t,0)),t,0);for(var r=new Array(e),n=0;n>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){var n=s(r);if(e0){var t=k[0];return a(0,S-1),S-=1,u(0),t}return-1}function f(t,e){var r=k[t];return x[r]===e?t:(x[r]=-(1/0),c(t),h(),x[r]=e,S+=1,c(S-1))}function d(t){if(!b[t]){b[t]=!0;var e=v[t],r=y[t];v[r]>=0&&(v[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&f(T[e],i(e)),T[r]>=0&&f(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!b[n]||i<0||i===n)break;if(n=i,i=t[n],!b[n]||i<0||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var g=e.length,m=t.length,v=new Array(g),y=new Array(g),x=new Array(g),b=new Array(g),_=0;_>1;_>=0;--_)u(_);for(;;){var L=h();if(L<0||x[L]>r)break;d(L)}for(var z=[],_=0;_=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&C.push([n,i])}}),o.unique(o.normalize(C)),{positions:z,edges:C}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":465,"simplicial-complex":478}],481:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return ol?i-l:o-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=a(r,i,s),u=a(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;if(l=a(s,o,i),u=a(s,o,r),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]}e.exports=i;var a=t("robust-orientation")},{"robust-orientation":465}],482:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=a(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=a(t.right,e);if(l)return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;a0){var s=a(this.slabs[e-1],t);s&&(o?f(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(o){var p=h(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":481,"binary-search-bounds":53,"functional-red-black-tree":107,"robust-orientation":465}],483:[function(t,e,r){"use strict";function n(t,e){var r=u(l(t,e),[e[e.length-1]]);return r[r.length-1]}function i(t,e,r,n){var i=n-e,a=-e/i;a<0?a=0:a>1&&(a=1);for(var o=1-a,s=t.length,l=new Array(s),u=0;u0||o>0&&c<0){var h=i(s,c,l,o);r.push(h),a.push(h.slice())}c<0?a.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),a.push(l.slice())),o=c}return{positive:r,negative:a}}function o(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u>=0&&r.push(s.slice()),a=u}return r}function s(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u<=0&&r.push(s.slice()),a=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=a,e.exports.positive=o,e.exports.negative=s},{"robust-dot-product":462,"robust-sum":470}],484:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function a(t,e){return Array(e+1).join(t)}var o={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,h,f,d=1,p=t.length,g="",m=[],v=!0,y="";for(s=0;s=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?m[m.length]=n:(!o.number.test(u[8])||v&&!u[3]?y="":(y=v?"+":"-",n=n.toString().replace(o.sign,"")),h=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",f=u[6]-(y+n).length,c=u[6]&&f>0?a(h,f):"",m[m.length]=u[5]?y+n+c:"0"===h?y+c+n:c+y+n)}return m.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],485:[function(t,e,r){"use strict";function n(t){return new i(t)}function i(t){this.options=d(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function a(t,e,r,n){return{x:t,y:e,zoom:1/0,id:n,numPoints:r}}function o(t,e){var r=t.geometry.coordinates;return a(u(r[0]),c(r[1]),1,e)}function s(t){return{type:"Feature",properties:l(t),geometry:{type:"Point",coordinates:[h(t.x),f(t.y)]}}}function l(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:r}}function u(t){return t/360+.5}function c(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function h(t){return 360*(t-.5)}function f(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function d(t,e){for(var r in e)t[r]=e[r];return t}function p(t){return t.x}function g(t){return t.y}var m=t("kdbush");e.exports=n,i.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var r="prepare "+t.length+" points";e&&console.time(r),this.points=t;var n=t.map(o);e&&console.timeEnd(r);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var a=+Date.now();this.trees[i+1]=m(n,p,g,this.options.nodeSize,Float32Array),n=this._cluster(n,i),e&&console.log("z%d: %d clusters in %dms",i,n.length,+Date.now()-a)}return this.trees[this.options.minZoom]=m(n,p,g,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(u(t[0]),c(t[3]),u(t[2]),c(t[1])),i=[],a=0;a c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128===0){h.length>0&&f.push("}}");var d="vExtra"+h.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),f=["function ",d,"(m,",l.join(),"){switch(m){"],h.push(f)}f.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),m=new Array(r),v=new Array(r),y=0,x=0;xx)&&!(u&1<<_)!=!(u&1<0&&(k="+"+m[b]+"*c");var T=.5*(p[b].length/y),E=.5+.5*(v[b]/y);A.push("d"+b+"-"+E+"-"+T+"*("+p[b].join("+")+k+")/("+g[b].join("+")+")")}f.push("a.push([",A.join(),"]);","break;")}n.push("}},"),h.length>0&&f.push("}}");for(var S=[],u=0;u<1<0&&(f+=.02);for(var p=new Float32Array(h),g=0,m=-.5*f,d=0;d.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=S(t,360),e=S(e,100),r=S(r,100),0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,r){t=S(t,255),e=S(e,255),r=S(r,255);var n,i,a=G(t,e,r),o=H(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function k(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function S(t,r){C(t)&&(t="100%");var n=I(t);return t=H(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function L(t){return H(1,G(0,t))}function z(t){return parseInt(t,16)}function C(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function I(t){return"string"==typeof t&&t.indexOf("%")!=-1}function P(t){return 1==t.length?"0"+t:""+t}function D(t){return t<=1&&(t=100*t+"%"),t}function O(t){return e.round(255*parseFloat(t)).toString(16)}function R(t){return z(t)/255}function F(t){return!!Z.CSS_UNIT.exec(t)}function j(t){t=t.replace(B,"").replace(U,"").toLowerCase();var e=!1;if(Y[t])t=Y[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Z.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(t))?{r:z(r[1]),g:z(r[2]),b:z(r[3]),a:R(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:z(r[1]),g:z(r[2]),b:z(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:z(r[1]+""+r[1]),g:z(r[2]+""+r[2]),b:z(r[3]+""+r[3]),a:R(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.hex3.exec(t))&&{r:z(r[1]+""+r[1]),g:z(r[2]+""+r[2]),b:z(r[3]+""+r[3]),format:e?"name":"hex"}}function N(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var B=/^\s+/,U=/\s+$/,V=0,q=e.round,H=e.min,G=e.max,X=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=E(t),this._roundA=q(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=q(360*t.h),r=q(100*t.s),n=q(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=q(360*t.h),r=q(100*t.s),n=q(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return h(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:q(this._r),g:q(this._g),b:q(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+q(this._r)+", "+q(this._g)+", "+q(this._b)+")":"rgba("+q(this._r)+", "+q(this._g)+", "+q(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:q(100*S(this._r,255))+"%",g:q(100*S(this._g,255))+"%",b:q(100*S(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+q(100*S(this._r,255))+"%, "+q(100*S(this._g,255))+"%, "+q(100*S(this._b,255))+"%)":"rgba("+q(100*S(this._r,255))+"%, "+q(100*S(this._g,255))+"%, "+q(100*S(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(W[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+f(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+f(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},brighten:function(){ +return this._applyModification(v,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,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(b,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=D(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return n(s)},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=N(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},n.mostReadable=function(t,e,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var Y=n.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"},W=n.hexNames=T(Y),Z=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],490:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":433}],491:[function(e,r,n){!function(e,i){"object"==typeof n&&"undefined"!=typeof r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.topojson=e.topojson||{})}(this,function(t){"use strict";function e(t,e){var n=e.id,i=e.bbox,a=null==e.properties?{}:e.properties,o=r(t,e);return null==n&&null==i?{type:"Feature",properties:a,geometry:o}:null==i?{type:"Feature",id:n,properties:a,geometry:o}:{type:"Feature",id:n,bbox:i,properties:a,geometry:o}}function r(t,e){function r(t,e){e.length&&e.pop();for(var r=h[t<0?~t:t],n=0,i=r.length;n1)n=i(t,e,r);else for(a=0,n=new Array(o=t.arcs.length);a1)for(var i,a,l=1,u=o(n[0]);lu&&(a=n[0],n[0]=n[l],n[l]=a,u=i);return n})}}var s=function(t){return t},l=function(t){if(null==(e=t.transform))return s;var e,r,n,i=e.scale[0],a=e.scale[1],o=e.translate[0],l=e.translate[1];return function(t,e){return e||(r=n=0),t[0]=(r+=t[0])*i+o,t[1]=(n+=t[1])*a+l,t}},u=function(t){function e(t){s[0]=t[0],s[1]=t[1],o(s),s[0]h&&(h=s[0]),s[1]f&&(f=s[1])}function r(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(r);break;case"Point":e(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(e)}}var n=t.bbox;if(!n){var i,a,o=l(t),s=new Array(2),u=1/0,c=u,h=-u,f=-u;t.arcs.forEach(function(t){for(var e=-1,r=t.length;++eh&&(h=s[0]),s[1]f&&(f=s[1])});for(a in t.objects)r(t.objects[a]);n=t.bbox=[u,c,h,f]}return n},c=function(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r},h=function(t,r){return"GeometryCollection"===r.type?{type:"FeatureCollection",features:r.geometries.map(function(r){return e(t,r)})}:e(t,r)},f=function(t,e){function r(e){var r,n=t.arcs[e<0?~e:e],i=n[0];return t.transform?(r=[0,0],n.forEach(function(t){r[0]+=t[0],r[1]+=t[1]})):r=n[n.length-1],e<0?[r,i]:[i,r]}function n(t,e){for(var r in t){var n=t[r];delete e[n.start],delete n.start,delete n.end,n.forEach(function(t){i[t<0?~t:t]=1}),s.push(n)}}var i={},a={},o={},s=[],l=-1;return e.forEach(function(r,n){var i,a=t.arcs[r<0?~r:r];a.length<3&&!a[1][0]&&!a[1][1]&&(i=e[++l],e[l]=r,e[n]=i)}),e.forEach(function(t){var e,n,i=r(t),s=i[0],l=i[1];if(e=o[s])if(delete o[e.end],e.push(t),e.end=l,n=a[l]){delete a[n.start];var u=n===e?e:e.concat(n);a[u.start=e.start]=o[u.end=n.end]=u}else a[e.start]=o[e.end]=e;else if(e=a[l])if(delete a[e.start],e.unshift(t),e.start=s,n=o[s]){delete o[n.end];var c=n===e?e:n.concat(e);a[c.start=n.start]=o[c.end=e.end]=c}else a[e.start]=o[e.end]=e;else e=[t],a[e.start=s]=o[e.end=l]=e}),n(o,a),n(a,o),e.forEach(function(t){i[t<0?~t:t]||s.push([t])}),s},d=function(t){return r(t,n.apply(this,arguments))},p=function(t){return r(t,o.apply(this,arguments))},g=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 i,a=u(t),o=a[0],s=(a[2]-o)/(e-1)||1,l=a[1],c=(a[3]-l)/(e-1)||1;t.arcs.forEach(function(t){for(var e,r,n,i=1,a=1,u=t.length,h=t[0],f=h[0]=Math.round((h[0]-o)/s),d=h[1]=Math.round((h[1]-l)/c);iMath.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var a=0,o=0,s=0;s<3;++s)a+=t[s]*t[s],o+=i[s]*t[s];for(var s=0;s<3;++s)i[s]-=o/a*t[s];return f(i,i),i}function o(t,e,r,n,i,a,o,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([a]),this.angle=l([o,s]),this.angle.bounds=[[-(1/0),-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;u<16;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.up||[0,1,0],i=t.right||a(r),s=t.radius||1,l=t.theta||0,u=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),f(r,r),i=[].slice.call(i,0,3),f(i,i),"eye"in t){var c=t.eye,p=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];h(i,p,r),n(i[0],i[1],i[2])<1e-6?i=a(r):f(i,i),s=n(p[0],p[1],p[2]);var g=d(r,p)/s,m=d(i,p)/s;u=Math.acos(g),l=Math.acos(m)}return s=Math.log(s),new o(t.zoomMin,t.zoomMax,e,r,i,s,l,u)}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),h=t("gl-vec3/cross"),f=t("gl-vec3/normalize"),d=t("gl-vec3/dot"),p=o.prototype;p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,i=0,a=0,o=0;o<3;++o)a+=e[o]*r[o],i+=e[o]*e[o];for(var s=Math.sqrt(i),l=0,o=0;o<3;++o)r[o]-=e[o]*a/i,l+=r[o]*r[o],e[o]/=s;for(var u=Math.sqrt(l),o=0;o<3;++o)r[o]/=u;var c=this.computedToward;h(c,e,r),f(c,c);for(var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],g=this.computedAngle[1],m=Math.cos(p),v=Math.sin(p),y=Math.cos(g),x=Math.sin(g),b=this.computedCenter,_=m*y,w=v*y,M=x,A=-m*x,k=-v*x,T=y,E=this.computedEye,S=this.computedMatrix,o=0;o<3;++o){var L=_*r[o]+w*c[o]+M*e[o];S[4*o+1]=A*r[o]+k*c[o]+T*e[o],S[4*o+2]=L,S[4*o+3]=0}var z=S[1],C=S[5],I=S[9],P=S[2],D=S[6],O=S[10],R=C*O-I*D,F=I*P-z*O,j=z*D-C*P,N=n(R,F,j);R/=N,F/=N,j/=N,S[0]=R,S[4]=F,S[8]=j;for(var o=0;o<3;++o)E[o]=b[o]+S[2+4*o]*d;for(var o=0;o<3;++o){for(var l=0,B=0;B<3;++B)l+=S[o+4*B]*E[B];S[12+o]=-l}S[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 g=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;g[0]=i[2],g[1]=i[6],g[2]=i[10];for(var a=this.computedUp,o=this.computedRight,s=this.computedToward,l=0;l<3;++l)i[4*l]=a[l],i[4*l+1]=o[l],i[4*l+2]=s[l];c(i,i,n,g);for(var l=0;l<3;++l)a[l]=i[4*l],o[l]=i[4*l+1];this.up.set(t,a[0],a[1],a[2]),this.right.set(t,o[0],o[1],o[2])}},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=(Math.exp(this.computedRadius[0]),a[1]),s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],h=a[4],f=a[8],d=c*o+h*s+f*l;c-=o*d,h-=s*d,f-=l*d;var p=n(c,h,f);c/=p,h/=p,f/=p;var g=c*e+o*r,m=h*e+s*r,v=f*e+l*r;this.center.move(t,g,m,v);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e,r,a){var o=1;"number"==typeof r&&(o=0|r),(o<0||o>3)&&(o=1);var s=(o+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[o],c=e[o+4],h=e[o+8];if(a){var f=Math.abs(l),d=Math.abs(c),p=Math.abs(h),g=Math.max(f,d,p);f===g?(l=l<0?-1:1,c=h=0):p===g?(h=h<0?-1:1,l=c=0):(c=c<0?-1:1,l=h=0)}else{var m=n(l,c,h);l/=m,c/=m,h/=m}var v=e[s],y=e[s+4],x=e[s+8],b=v*l+y*c+x*h;v-=l*b,y-=c*b,x-=h*b;var _=n(v,y,x);v/=_,y/=_,x/=_;var w=c*x-h*y,M=h*v-l*x,A=l*y-c*v,k=n(w,M,A);w/=k,M/=k,A/=k,this.center.jump(t,H,G,X),this.radius.idle(t),this.up.jump(t,l,c,h),this.right.jump(t,v,y,x);var T,E;if(2===o){var S=e[1],L=e[5],z=e[9],C=S*v+L*y+z*x,I=S*w+L*M+z*A;T=R<0?-Math.PI/2:Math.PI/2,E=Math.atan2(I,C)}else{var P=e[2],D=e[6],O=e[10],R=P*l+D*c+O*h,F=P*v+D*y+O*x,j=P*w+D*M+O*A;T=Math.asin(i(R)),E=Math.atan2(j,F)}this.angle.jump(t,E,T),this.recalcMatrix(t);var N=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var q=V[15],H=V[12]/q,G=V[13]/q,X=V[14]/q,Y=Math.exp(this.computedRadius[0]);this.center.jump(t,H-N*Y,G-B*Y,X-U*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,a){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,a=a||this.computedUp;var o=a[0],s=a[1],l=a[2],u=n(o,s,l);if(!(u<1e-6)){o/=u,s/=u,l/=u;var c=e[0]-r[0],h=e[1]-r[1],f=e[2]-r[2],d=n(c,h,f);if(!(d<1e-6)){c/=d,h/=d,f/=d;var p=this.computedRight,g=p[0],m=p[1],v=p[2],y=o*g+s*m+l*v;g-=y*o,m-=y*s,v-=y*l;var x=n(g,m,v);if(!(x<.01&&(g=s*f-l*h,m=l*c-o*f,v=o*h-s*c,x=n(g,m,v),x<1e-6))){g/=x,m/=x,v/=x,this.up.set(t,o,s,l),this.right.set(t,g,m,v),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var b=s*v-l*m,_=l*g-o*v,w=o*m-s*g,M=n(b,_,w);b/=M,_/=M,w/=M;var A=o*c+s*h+l*f,k=g*c+m*h+v*f,T=b*c+_*h+w*f,E=Math.asin(i(A)),S=Math.atan2(T,k),L=this.angle._state,z=L[L.length-1],C=L[L.length-2];z%=2*Math.PI;var I=Math.abs(z+2*Math.PI-S),P=Math.abs(z-S),D=Math.abs(z-2*Math.PI-S);I0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function h(t){return new Int16Array(o(2*t),0,t)}function f(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return b?new Uint8ClampedArray(o(t),0,t):s(t)}function m(t){return new DataView(o(t),0,t)}function v(t){t=y.nextPow2(t);var e=y.log2(t),r=M[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),x=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:x([32,0]),UINT16:x([32,0]),UINT32:x([32,0]),INT8:x([32,0]),INT16:x([32,0]),INT32:x([32,0]),FLOAT:x([32,0]),DOUBLE:x([32,0]),DATA:x([32,0]),UINT8C:x([32,0]),BUFFER:x([32,0])});var b="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=x([32,0])),_.BUFFER||(_.BUFFER=x([32,0]));var w=_.DATA,M=_.BUFFER;r.free=function(t){if(n.isBuffer(t))M[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){M[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return h(t);case"int32":return f(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return v(t);case"data":case"dataview":return m(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=h,r.mallocInt32=f,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=m,r.mallocBuffer=v,r.clearCache=function(){for(var t=0;t<32;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,M[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":54,buffer:64,dup:98}],497:[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;en)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))}},{}],500:[function(t,e,r){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function i(t,e,r){if(t&&u.isObject(t)&&t instanceof n)return t;var i=new n;return i.parse(t,e,r),i}function a(t){return u.isString(t)&&(t=i(t)),t instanceof n?t.format():n.prototype.format.call(t)}function o(t,e){return i(t,!1,!0).resolve(e)}function s(t,e){return t?i(t,!1,!0).resolveObject(e):e}var l=t("punycode"),u=t("./util");r.parse=i,r.resolve=o,r.resolveObject=s,r.format=a,r.Url=n;var c=/^([a-z0-9.+-]+:)/i,h=/:[0-9]*$/,f=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["<",">",'"',"`"," ","\r","\n","\t"],p=["{","}","|","\\","^","`"].concat(d),g=["'"].concat(p),m=["%","/","?",";","#"].concat(g),v=["/","?","#"],y=255,x=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},M={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=t("querystring");n.prototype.parse=function(t,e,r){if(!u.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),i=n!==-1&&n127?"x":D[R];if(!O.match(x)){var j=I.slice(0,E),N=I.slice(E+1),B=D.match(b);B&&(j.push(B[1]),N.unshift(B[2])),N.length&&(s="/"+N.join(".")+s),this.hostname=j.join(".");break}}}this.hostname.length>y?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=l.toASCII(this.hostname));var U=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+U,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!_[p])for(var E=0,P=g.length;E0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return r.search=t.search,r.query=t.query,u.isNull(r.pathname)&&u.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!_.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=_.slice(-1)[0],E=(r.host||t.host||_.length>1)&&("."===T||".."===T)||""===T,S=0,L=_.length;L>=0;L--)T=_[L],"."===T?_.splice(L,1):".."===T?(_.splice(L,1),S++):S&&(_.splice(L,1),S--);if(!x&&!b)for(;S--;S)_.unshift(".."); +!x||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),E&&"/"!==_.join("/").substr(-1)&&_.push("");var z=""===_[0]||_[0]&&"/"===_[0].charAt(0);if(A){r.hostname=r.host=z?"":_.length?_.shift():"";var k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return x=x||r.host&&_.length,x&&!z&&_.unshift(""),_.length?r.pathname=_.join("/"):(r.pathname=null,r.path=null),u.isNull(r.pathname)&&u.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=h.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":501,punycode:446,querystring:450}],501:[function(t,e,r){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],502:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],503:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],504:[function(t,e,r){(function(e,n){function i(t,e){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(e)?n.showHidden=e:e&&r._extend(n,e),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a),l(n,t,n.depth)}function a(t,e){var r=i.styles[e];return r?"\x1b["+i.colors[r][0]+"m"+t+"\x1b["+i.colors[r][1]+"m":t}function o(t,e){return t}function s(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function l(t,e,n){if(t.customInspect&&e&&T(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return x(i)||(i=l(t,i,n)),i}var a=u(t,e);if(a)return a;var o=Object.keys(e),g=s(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),k(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(e);if(0===o.length){if(T(e)){var m=e.name?": "+e.name:"";return t.stylize("[Function"+m+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(A(e))return t.stylize(Date.prototype.toString.call(e),"date");if(k(e))return c(e)}var v="",y=!1,b=["{","}"];if(p(e)&&(y=!0,b=["[","]"]),T(e)){var _=e.name?": "+e.name:"";v=" [Function"+_+"]"}if(w(e)&&(v=" "+RegExp.prototype.toString.call(e)),A(e)&&(v=" "+Date.prototype.toUTCString.call(e)),k(e)&&(v=" "+c(e)),0===o.length&&(!y||0==e.length))return b[0]+v+b[1];if(n<0)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=y?h(t,e,n,g,o):o.map(function(r){return f(t,e,n,g,r,y)}),t.seen.pop(),d(M,v,b)}function u(t,e){if(_(e))return t.stylize("undefined","undefined");if(x(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return y(e)?t.stylize(""+e,"number"):g(e)?t.stylize(""+e,"boolean"):m(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var a=[],o=0,s=e.length;o-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")),_(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.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 d(t,e,r){var n=0,i=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function p(t){return Array.isArray(t)}function g(t){return"boolean"==typeof t}function m(t){return null===t}function v(t){return null==t}function y(t){return"number"==typeof t}function x(t){return"string"==typeof t}function b(t){return"symbol"==typeof t}function _(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===S(t)}function M(t){return"object"==typeof t&&null!==t}function A(t){return M(t)&&"[object Date]"===S(t)}function k(t){return M(t)&&("[object Error]"===S(t)||t instanceof Error)}function T(t){return"function"==typeof t}function E(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function S(t){return Object.prototype.toString.call(t)}function L(t){return t<10?"0"+t.toString(10):t.toString(10)}function z(){var t=new Date,e=[L(t.getHours()),L(t.getMinutes()),L(t.getSeconds())].join(":");return[t.getDate(),O[t.getMonth()],e].join(" ")}function C(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var I=/%[sdj%]/g;r.format=function(t){if(!x(t)){for(var e=[],r=0;r=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}}),s=n[r];r>3}if(i--,1===n||2===n)a+=t.readSVarint(),o+=t.readSVarint(),1===n&&(e&&s.push(e),e=[]),e.push(new l(a,o));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&s.push(e),s},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,u=-(1/0);t.pos>3}if(n--,1===r||2===r)i+=t.readSVarint(),a+=t.readSVarint(),is&&(s=i),au&&(u=a);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,u]},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}var o=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 o(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":507}],509:[function(t,e,r){"use strict";function n(t,e){return"object"==typeof e&&null!==e||(e={}),i(t,e.canvas||a,e.context||o,e)}e.exports=n;var i=t("./lib/vtext"),a=null,o=null;"undefined"!=typeof document&&(a=document.createElement("canvas"),a.width=8192,a.height=1024,o=a.getContext("2d"))},{"./lib/vtext":510}],510:[function(t,e,r){"use strict";function n(t,e,r){for(var n=e.textAlign||"start",i=e.textBaseline||"alphabetic",a=[1<<30,1<<30],o=[0,0],s=t.length,l=0;l8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height>31}function l(t){for(var e=[],r=0,n=0,i=t.length,a=0;a=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function o(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),!(e<0)&&(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof b||a();var s=[],l=[],u=x++;return Object.create(b.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(o)}})};b.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||!!c&&c.has___(t)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof b||a();var l,u=new s,c=void 0,h=!1;return l=o?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new b),c.set(t,e)),this}:function(t,e){if(h)try{u.set(t,e)}catch(r){c||(c=new b),c.set___(t,e)}else u.set(t,e);return this},Object.create(b.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");h=!0})}})}o&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=b.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=b)}}()},{}],515:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":516}],516:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],517:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":515}],518:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":119}],519:[function(t,e,r){var n=arguments[3],i=arguments[4],a=arguments[5],o=JSON.stringify;e.exports=function(t,e){function r(t){m[t]=!0;for(var e in i[t][1]){var n=i[t][1][e];m[n]||r(n)}}for(var s,l=Object.keys(a),u=0,c=l.length;u= 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":91}],523:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":522}],524:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("opacity"),u("align"),u("bgcolor");var h=u("bordercolor"),f=i.opacity(h);u("borderpad");var d=u("borderwidth"),p=u("showarrow");u("text",p?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font);for(var g=["x","y"],m=[-10,-30],v={_fullLayout:r},y=0;y<2;y++){var x=g[y],b=a.coerceRef(t,e,v,x,"","paper");if(a.coercePosition(e,v,u,b,x,.5),p){var _="a"+x,w=a.coerceRef(t,e,v,_,"pixel");"pixel"!==w&&w!==b&&(w=e[_]="pixel");var M="pixel"===w?m[y]:.4;a.coercePosition(e,v,u,w,_,M)}else u(x+"anchor")}return n.noneOrAll(t,e,["x","y"]),p&&(u("arrowcolor",f?e.bordercolor:i.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(f&&d||1)),n.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":633,"../../plots/cartesian/axes":664,"../color":533,"./attributes":526}],525:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],526:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":626,"../../plots/cartesian/constants":669,"../../plots/font_attributes":684,"./arrow_paths":525}],527:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,h=s-l,f=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),h=Math.max(h,d),f=Math.max(f,d)}r&&r.autorange&&a.expand(r,[r.l2c(r.r2l(e.x))],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(n.r2l(e.y))],{ppadplus:f,ppadminus:h})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":633,"../../plots/cartesian/axes":664,"./draw":529}],528:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),i=t("./annotation_defaults");e.exports=function(t,e){var r={name:"annotations",handleItemDefaults:i};n(t,e,r)}},{"../../plots/array_container_defaults":661,"./annotation_defaults":524}],529:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=K.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,v=Math.round(u+2*tt),y=Math.round(p+2*tt);H._w=u,H._h=p;var b=!1;if(["x","y"].forEach(function(e){var n,i=H[e+"ref"]||e,a=h.getFromId(t,i),o=(W+("x"===e?0:90))*Math.PI/180,s=v*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=H[e+"anchor"];if(a){ +var u=a.r2fraction(H[e]);if(!a.autorange&&(u<0||u>1)&&(H["a"+e+"ref"]===i?(u=a.r2fraction(H["a"+e]),(u<0||u>1)&&(b=!0)):b=!0,b))return;Y[e]=a._offset+a.r2p(H[e]),n=.5}else n=H[e],"y"===e&&(n=1-n),Y[e]="x"===e?C.l+C.w*n:C.t+C.h*n;var c=0;H["a"+e+"ref"]===i?Y["aa"+e]=a._offset+a.r2p(H["a"+e]):(c=H.showarrow?H["a"+e]:s*r(n,l),Y[e]+=c),H["_"+e+"type"]=a&&a.type,H["_"+e+"size"]=s,H["_"+e+"shift"]=c}),b)return void K.remove();var _,w;H.showarrow&&(_=H.axref===H.xref?Y.x:c.constrain(Y.x-H.ax,1,A.width-1),w=H.ayref===H.yref?Y.y:c.constrain(Y.y-H.ay,1,A.height-1)),Y.x=c.constrain(Y.x,1,A.width-1),Y.y=c.constrain(Y.y,1,A.height-1);var M=tt-s.top,k=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:k,y:M}),nt.selectAll("tspan.line").attr({y:M,x:k})),et.call(d.setRect,$/2,$/2,v-$,y-$);var T=0,E=0;T=H.axref===H.xref?Math.round(Y.aax-v/2):Math.round(Y.x-v/2),E=H.ayref===H.yref?Math.round(Y.aay-y/2):Math.round(Y.y-y/2),K.call(c.setTranslate,T,E);var S="annotations["+e+"]",L=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=H.axref===H.xref?Y.aax+r:Y.x+r,s=H.ayref===H.yref?Y.aay+n:Y.y+n;var u=c.rotationXYMatrix(W,i,s),h=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,v=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!v.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=H.arrowwidth,b=H.arrowcolor,M=Z.append("g").style({opacity:f.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),A=M.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(f.stroke,f.rgb(b));x(A,H.arrowhead,"end",H.arrowsize);var k=M.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,L;m.init({element:k.node(),prepFn:function(){var t=c.getTranslate(K);E=t.x,L=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){M.attr("transform","translate("+t+","+e+")");var r=h(E,L),n=r[0]+t,i=r[1]+e;K.call(c.setTranslate,n,i),T[S+".x"]=G?G.p2r(G.r2p(H.x)+t):(_+t-C.l)/C.w,T[S+".y"]=X?X.p2r(X.r2p(H.y)+e):1-(w+e-C.t)/C.h,H.axref===H.xref&&(T[S+".ax"]=G?G.p2r(G.r2p(H.ax)+t):(_+t-C.l)/C.w),H.ayref===H.yref&&(T[S+".ay"]=X?X.p2r(X.r2p(H.ay)+e):1-(w+e-C.t)/C.h),Q.attr({transform:"rotate("+W+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};H.showarrow&&L(0,0);var z=c.rotationXYMatrix(W,Y.x,Y.y),I=c.apply2DTransform(z);if(t._context.editable){var P,D,O;m.init({element:K.node(),prepFn:function(){var t=c.getTranslate(K);P=t.x,D=t.y,O={}},moveFn:function(t,e){K.call(c.setTranslate,P+t,D+e);var r="pointer";if(H.showarrow)H.axref===H.xref?O[S+".ax"]=G.p2r(G.r2p(H.ax)+t):O[S+".ax"]=H.ax+t,H.ayref===H.yref?O[S+".ay"]=X.p2r(X.r2p(H.ay)+e):O[S+".ay"]=H.ay+e,L(t,e);else{if(G)O[S+".x"]=H.x+t/G._m;else{var n=H._xsize/C.w,i=H.x+H._xshift/C.w-n/2;O[S+".x"]=m.align(i+t/C.w,n,0,1,H.xanchor)}if(X)O[S+".y"]=H.y+e/X._m;else{var a=H._ysize/C.h,o=H.y-H._yshift/C.h-a/2;O[S+".y"]=m.align(o-e/C.h,a,0,1,H.yanchor)}G&&X||(r=m.getCursor(G?.5:O[S+".x"],X?.5:O[S+".y"],H.xanchor,H.yanchor))}var s=I(P,D),l=s[0]+t,u=s[1]+e;K.call(c.setTranslate,P+t,D+e),Q.attr({transform:"rotate("+W+","+l+","+u+")"}),g(K,r)},doneFn:function(e){if(g(K),e){l.relayout(t,O);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,M=t.layout,A=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return M.annotations=u,y(M,A),void n(t);if("remove"===u)return delete M.annotations,A.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)A._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}A._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=M.annotations[e],E=A.annotations[e];if(T){var S={};"string"==typeof r&&r?S[r]=u:c.isPlainObject(r)&&(S=r);var L=Object.keys(S);for(w=0;w4/3&&(F=V)}}else R&&(N&&(F<1/3?F+=U:F>2/3&&(F-=U)),F=(F-R.domain[0])/(R.domain[1]-R.domain[0]),F=R.fraction2r(F))}R&&R===O&&j&&("log"===j&&"log"!==R.type?F=Math.pow(10,F):"log"!==j&&"log"===R.type&&(F=F>0?Math.log(F)/Math.LN10:void 0)),T[D]=F}}var H={};v(T,H,A),A.annotations[e]=H;var G=h.getFromId(t,H.xref),X=h.getFromId(t,H.yref),Y={x:0,y:0},W=+H.textangle||0,Z=A._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",H.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:H})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),K=Q.append("g"),$=H.borderwidth,J=H.borderpad,tt=$+J,et=K.append("rect").attr("class","bg").style("stroke-width",$+"px").call(f.stroke,H.bordercolor).call(f.fill,H.bgcolor),rt=H.font,nt=K.append("text").classed("annotation",!0).attr("data-unformatted",H.text).text(H.text);t._context.editable?nt.call(p.makeEditable,K).call(b).on("edit",function(r){H.text=r,this.attr({"data-unformatted":H.text}),this.call(b);var n={};n["annotations["+e+"].text"]=H.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(b),Q.attr({transform:"rotate("+W+","+Y.x+","+Y.y+")"}).call(d.setPosition,Y.x,Y.y)}}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,h=n-e,f=a-e,d=s-a,p=l*d-c*h;if(0===p)return null;var g=(u*d-c*f)/p,m=(u*h-l*f)/p;return m<0||m>1||g<0||g>1?null:{x:t+l*g,y:e+h*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),h=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":633,"../../lib/setcursor":643,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/cartesian/axes":664,"../../plots/plots":724,"../color":533,"../dragelement":554,"../drawing":556,"./annotation_defaults":524,"./defaults":528,"./draw_arrow_head":530,d3:95,"fast-isnumeric":104}],530:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var h,f,d,p,g=(o.getPx(t,"stroke-width")||1)*l,m=t.style("stroke")||a.defaultLine,v=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,x=r.indexOf("end")>=0,b=c.backoff*g;if("line"===u.nodeName){if(h={x:+t.attr("x1"),y:+t.attr("y1")},f={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(h.y-f.y,h.x-f.x),p=d+Math.PI,b){var _=b*Math.cos(d),w=b*Math.sin(d);y&&(h.x-=_,h.y-=w,t.attr({x1:h.x,y1:h.y})),x&&(f.x+=_,f.y+=w,t.attr({x2:f.x,y2:f.y}))}}else if("path"===u.nodeName){var M=u.getTotalLength(),A="";if(y){var k=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(k.y-T.y,k.x-T.x),h=u.getPointAtLength(Math.min(b,M)),b&&(A="0px,"+b+"px,")}if(x){var E=u.getPointAtLength(M),S=u.getPointAtLength(M-.1);if(p=Math.atan2(E.y-S.y,E.x-S.x),f=u.getPointAtLength(Math.max(0,M-b)),b){var L=A?2*b:b;A+=M-L+"px,"+M+"px"}}else A&&(A+=M+"px");A&&t.style("stroke-dasharray",A)}var z=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&z(h,d),x&&z(f,p)}}},{"../color":533,"../drawing":556,"./arrow_paths":525,d3:95,"fast-isnumeric":104}],531:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":526,"./calc_autorange":527,"./defaults":528,"./draw":529}],532:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],533:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var h=at.select(".cbfills").selectAll("rect.cbfill").data(z);h.enter().append("rect").classed("cbfill",!0).style("stroke","none"),h.exit().remove(),h.each(function(t,e){var r=[0===e?S[0]:(z[e]+z[e-1])/2,e===z.length-1?S[1]:(z[e]+z[e+1])/2].map(J.c2p).map(Math.round);e!==z.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=I(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({x:Y,width:Math.max(B,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var f=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?L:[]);return f.enter().append("path").classed("cbline",!0),f.exit().remove(),f.each(function(t){n.select(this).attr("d","M"+Y+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+B).call(d.lineGroupStyle,_.line.width,C(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=Y+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));M("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:k.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,r){var n,i=b();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,h(a,r||{}))}function A(){var r=B+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(F=ot.select("text"),F.node()&&!F.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-Y-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-K;at.select(".cbbg").attr({x:Y-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:K-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:Y,y:K+_.ypad+("top"===_.titleside?st:0),width:Math.max(B,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var k=t._fullLayout,T=k._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void k._infolayer.selectAll("g."+e).remove();var E,S=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),L=[],z=[],C="function"==typeof _.line.color?_.line.color:function(){return _.line.color},I="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},P=_.levels.end+_.levels.size/100,D=_.levels.size,O=1.001*S[0]-.001*S[1],R=1.001*S[1]-.001*S[0];for(E=_.levels.start;(E-P)*D<0;E+=D)E>O&&ES[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+q-X],J.setScale();var at=k._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+H)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+q-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,M(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ht=c.syncOrAsync([o.previousPromises,w,o.previousPromises,A],t);if(ht&&ht.then&&(t._promises||[]).push(ht),t._context.editable){var ft,dt,pt;u.init({element:at.node(),prepFn:function(){ft=at.attr("transform"),f(at)},moveFn:function(t,e){at.attr("transform",ft+" translate("+t+","+e+")"),dt=u.align(W+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,q,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);f(at,r)},doneFn:function(e){f(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},b().index)}})}return ht}function b(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=f,s.reversescale&&(f=a(f)),s.colorscale=f)}},{"../../lib":633,"./flip_scale":544,"./scales":551}],540:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":626,"./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,u,c){var h=c.prefix,f=c.cLetter,d=h.slice(0,h.length-1),p=h?i.nestedProperty(t,d).get()||{}:t,g=h?i.nestedProperty(e,d).get()||{}:e,m=p[f+"min"],v=p[f+"max"],y=p.colorscale,x=n(m)&&n(v)&&m=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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):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(Array.isArray(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":633}],554:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,h=(new Date).getTime(),h-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,h,f,d,p,g=o.getPlotDiv(t.element)||{},m=1,v=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":633,"../../plotly":659,"../../plots/cartesian/constants":669,"./align":552,"./cursor":553,"./unhover":555}],555:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":625}],556:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,h,f;t.so?(f=o.outlierwidth,h=o.outliercolor,c=a.outliercolor):(f=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,h="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(f||1)+"px",fill:"none"}):(e.style("stroke-width",f+"px").call(l.fill,c),f&&e.call(l.stroke,h))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),h=(c*c*i-u*u*s)*n,f=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&h/d),2),a.round(e[1]+(d&&f/d),2)],[a.round(e[0]-(p&&h/p),2),a.round(e[1]-(p&&f/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),h=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=g.tryColorscale(i,""),s=g.tryColorscale(i,"line");n(t,e,r,o,s,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),i=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,a.select(this),e,n,i)})}},g.tryColorscale=function(t,e){var r=e?c.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):c.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(h.convertToTspans);var f=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*b+1,m=x[l]*c,v=.75*u+x[s]*c+(x[s]-1)*p*u/2;f.attr("transform","translate("+m+","+v+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=k&&(a.selectAll("[data-bb]").attr("data-bb",null),A=[]),t.setAttribute("data-bb",A.length),A.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":618,"../../lib":633,"../../lib/svg_text_utils":647,"../../registry":739,"../../traces/scatter/make_bubble_size_func":861,"../../traces/scatter/subtypes":866,"../color":533,"../colorscale":547,"./symbol_defs":557,d3:95,"fast-isnumeric":104}],557:[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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),h=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+h+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:95}],558:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],559:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),h=0;h0;t.each(function(t){var e,h=t[0].trace,f=h.error_x||{},d=h.error_y||{};h.ids&&(e=function(t){return t.id});var p=o.hasMarkers(h)&&h.marker.maxdisplayed>0;if(d.visible||f.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().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),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var h;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;h="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(h+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");s=!m.size(),s?m=e.append("path").classed("yerror",!0):c&&(m=m.transition().duration(r.duration).ease(r.easing)),m.attr("d",h)}if(f.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var v=(f.copy_ystyle?d:f).width;h="M"+o.xh+","+(o.y-v)+"v"+2*v+"m0,-"+v+"H"+o.xs,o.noXS||(h+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",h)}}})}})}},{"../../traces/scatter/subtypes":866,d3:95,"fast-isnumeric":104}],564:[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":533,d3:95}],565:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":669}],566:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}var o=n("source"),l=n("visible",!!o);if(!l)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var u={_fullLayout:r},c=["x","y"],h=0;h<2;h++)a.coerceRef(t,e,u,c[h],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var r={name:l,handleItemDefaults:n};o(t,e,r)}},{"../../lib":633,"../../plots/array_container_defaults":661,"../../plots/cartesian/axes":664,"./attributes":565}],567:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,h=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,f=c*d.x[e.xanchor].offset,p=h*d.y[e.yanchor].offset,g=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,m=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+f,v=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:m,y:v,width:c,height:h,preserveAspectRatio:g,opacity:e.opacity});var y=o?o._id:"",x=l?l._id:"",b=y+x;b&&r.call(i.setClipUrl,"clip"+s._uid+b)}for(var s=t._fullLayout,l=[],u=[],c=[],h=0;h=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}},{}],570:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":626,"../../plots/font_attributes":684,"../color/attributes":532}],571:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],572:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,h,f,d=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(u=0,h="left",c=1.1,f="bottom"):(u=0,h="left",c=-.1,f="top")}l("traceorder",m),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",h),l("y",c),l("yanchor",f),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":633,"../../plots/layout_attributes":715,"../../registry":739,"./attributes":570,"./helpers":575}],573:[function(t,e,r){"use strict";function n(t,e){function r(r){v.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,h=t.selectAll("text.legendtext").data([0]);h.enter().append("text").classed("legendtext",!0),h.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?h.call(v.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):h.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var h=a.label,f=r.indexOf(h);f===-1?r.push(h):r.splice(f,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),f=c[0].length||1;r=s*f,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-f)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){h.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;h.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,f=l.length;cn.width-(n.margin.r+n.margin.l)&&(x=0,m+=v,i.height=i.height+v,v=0),h.setTranslate(this,a+x,5+a+e.height/2+m),i.width+=o+r,i.height=Math.max(i.height,e.height),x+=o+r,v=Math.max(e.height,v)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),f.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),f.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),h=t("../../lib"),f=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(h.setTranslate,0,e),S.call(g.setRect,N,t,y.scrollBarWidth,y.scrollBarHeight),k.select("rect").attr({y:v.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var v=r.legend,_=r.showlegend&&x(t.calcdata,v),M=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void f.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var T=A.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var E=A.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var S=A.selectAll("rect.scrollbar").data([0]);S.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var L=E.selectAll("g.groups").data(_);L.enter().append("g").attr("class","groups"),L.exit().remove();var z=L.selectAll("g.traces").data(h.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var C=0!==A.enter().size();C&&(o(t,L,z),s(t));var I=0,P=r.width,D=0,O=r.height;o(t,L,z),v.height>O?l(t):s(t);var R=r._size,F=R.l+R.w*v.x,j=R.t+R.h*(1-v.y);w.isRightAnchor(v)?F-=v.width:w.isCenterAnchor(v)&&(F-=v.width/2),w.isBottomAnchor(v)?j-=v.height:w.isMiddleAnchor(v)&&(j-=v.height/2);var N=v.width,B=R.w;N>B?(F=R.l,N=B):(F+N>P&&(F=P-N),FV?(j=R.t,U=V):(j+U>O&&(j=O-U),jr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),f=d.hasLines(o);if(s||u||f){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),f&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var m=l.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(s?n:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(h.pointStyle,i),s&&(n[0].mrc=3);var y=m.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(h.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(f.fill,t.mc||r.color),e&&i.call(f.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(f.fill,t.fc||e.fillcolor),r&&n.call(f.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),h=t("../drawing"),f=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":633,"../../registry":739,"../../traces/pie/style_one":840,"../../traces/scatter/subtypes":866,"../color":533,"../drawing":556,d3:95}],578:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,f=(1+c)/2,d=(1-c)/2,p=h.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(m,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=i(s),y=[];return((u||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||v||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(m,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var m=c("bgcolor");c("activecolor",o.contrast(m,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":633,"../color":533,"./attributes":582,"./button_attributes":583,"./constants":584}],586:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=f)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)f(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,L)},i=L.line.width?L.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",L.opacity).call(_.stroke,i).call(_.fill,L.fillcolor).call(w.dashLine,L.line.dash,L.line.width);z&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&h(t,a,L,e)}var a,o;f(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:x.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>Y&&!t.shiftKey?M.getCursor(i/r,1-a/n):"move";A(e,o),G=o.split("-")[0]}function a(e){N=b.getFromId(t,r.xref),B=b.getFromId(t,r.yref),U=T.getDataToPixel(t,N),V=T.getDataToPixel(t,B,!0),q=T.getPixelToData(t,N),H=T.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(F=r.path,j=a+".path"):(c=U(r.x0),h=V(r.y0),f=U(r.x1),d=V(r.y1),g=a+".x0",v=a+".y0",x=a+".x1",_=a+".y1"),cY&&(u[L]=r[P]=H(s),u[z]=r[D]=H(l)),h-c>X&&(u[C]=r[O]=q(c),u[I]=r[R]=q(h))}e.attr("d",p(t,r))}var u,c,h,f,d,g,v,x,_,w,k,E,S,L,z,C,I,P,D,O,R,F,j,N,B,U,V,q,H,G,X=10,Y=10,W={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=W.element.getBoundingClientRect();M.init(W)}function f(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=b.getFromId(t,r.id,"x")._id,i=b.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=b.getFromId(t,e.xref),l=b.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),h=n(e.x1),f=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+f+"L"+h+","+d;if("rect"===o)return"M"+c+","+f+"H"+h+"V"+d+"H"+c+"Z";var p=(c+h)/2,m=(f+d)/2,v=Math.abs(p-c),y=Math.abs(m-f),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),i+l})}function m(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),M=t("../dragelement"),A=t("../../lib/setcursor"),k=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),S=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":633,"../../lib/setcursor":643,"../../plotly":659,"../../plots/cartesian/axes":664,"../color":533,"../dragelement":554,"../drawing":556,"./constants":596,"./defaults":597,"./helpers":599,"./shape_defaults":601,"fast-isnumeric":104}],599:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],600:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":594,"./calc_autorange":595,"./defaults":597,"./draw":598}],601:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var h=t.path?"path":"rect",f=u("type",h),d=["x","y"],p=0;p<2;p++){var g=d[p],m={_fullLayout:r},v=i.coerceRef(t,e,m,g,"","paper");if("path"!==f){var y,x,b,_=.25,w=.75;"paper"!==v?(y=i.getFromId(m,v),b=o.rangeToShapePosition(y),x=o.shapePositionToRange(y)):x=b=n.identity;var M=g+"0",A=g+"1",k=t[M],T=t[A];t[M]=x(t[M],!0),t[A]=x(t[A],!0),i.coercePosition(e,m,u,v,M,_),i.coercePosition(e,m,u,v,A,w),e[M]=b(e[M]),e[A]=b(e[A]),t[M]=k,t[A]=T}}return"path"===f?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":633,"../../plots/cartesian/axes":664,"./attributes":594,"./helpers":599}],602:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":626,"../../plots/animation_attributes":660,"../../plots/font_attributes":684,"../../plots/pad_attributes":723,"./constants":603}],603:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],604:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*L.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+L.stepInset+(t.inputAreaLength-2*L.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-L.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*L.stepInset-2*t.inputAreaStart)))}function x(t,e,r){var n=t.selectAll("rect."+L.railTouchRectClass).data([0]);n.enter().append("rect").classed(L.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,L.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),A.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+L.railRectClass).data([0]);r.enter().append("rect").classed(L.railRectClass,!0);var n=e.inputAreaLength-2*L.railInset;r.attr({width:n,height:L.railWidth,rx:L.railRadius,ry:L.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(r,L.railInset,.5*(e.inputAreaWidth-L.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(L.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+L.groupClassName).data(r,i);l.enter().append("g").classed(L.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,L.autoMarginIdRoot+e._index)});for(var u=0;u0||f<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,S=!0,L=C,M._infolayer.select("."+e).attr({"data-unformatted":L}).text(L).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,m=r.propName,v=r.traceIndex,y=r.dfltName,x=r.avoid||{},b=r.attributes,_=r.transform,w=r.containerGroup,M=t._fullLayout,A=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,S=!1,L=g.title.trim(); +""===L&&(E=0),L.match(/Click to enter .+ title/)&&(E=.2,S=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(L).attr("class",e),z.attr({"data-unformatted":L}).call(h);var C="Click to enter "+y+" title";t._context.editable?(L||p(),z.call(c.makeEditable).on("edit",function(e){void 0!==v?a.restyle(t,m,e,v):a.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):L&&!L.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",S)}},{"../../lib":633,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/plots":724,"../color":533,"../drawing":556,d3:95,"fast-isnumeric":104}],608:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":626,"../../plots/font_attributes":684,"../../plots/pad_attributes":723,"../color/attributes":532}],609:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],610:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var h=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);h.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&h.call(v).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){x.select(this).remove(),h.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],618:[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}},{}],619:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":531,"./components/images":568,"./components/legend":576,"./components/rangeselector":588,"./components/rangeslider":593,"./components/shapes":600,"./components/sliders":606,"./components/updatemenus":612,"./fonts/mathjax_config":620,"./lib/queue":641,"./plot_api/plot_schema":653,"./plot_api/register":654,"./plot_api/set_plot_config":655,"./plot_api/to_image":657,"./plot_api/validate":658,"./plotly":659,"./snapshot":744,"./snapshot/download":741,"./traces/scatter":856,d3:95,"es6-promise":101}],620:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],621:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],622:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":616,"fast-isnumeric":104}],623:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var m=(new Date).getFullYear();e=((Number(u[0])-m+70)%100+200)%100+m-70}if(!a(e))return l;var v=new Date(0,0,1);if(v.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(v.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(v.setDate(i),v.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(v.setHours(o),v.getHours()!==o)return l;if(u.length>1)return i=v.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=h*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*f:l)):l}}}return v.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,m=3*c,v=5*h;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e0&&(n.push(i),i=[])}return n.push(i),n},r.makeLine=function(t,e){var r={};return r=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(r.trace=e),r},r.makePolygon=function(t,e){var r={};if(1===t.length)r={type:"Polygon",coordinates:t};else{for(var n=new Array(t.length),i=0;i",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":622, "./coerce":623,"./dates":624,"./extend":626,"./filter_unique":627,"./filter_visible":628,"./is_array":634,"./is_plain_object":635,"./loggers":636,"./matrix":637,"./nested_property":638,"./notifier":639,"./search":642,"./stats":645,d3:95}],634:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],635:[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}},{}],636:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,f(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(f(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric"),f=t("./is_array");e.exports=function(t,e){if(h(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,h,f,d,p=n.length,g=n[0][0],m=n[0][1],v=0;for(u=1;uMath.max(c,g)||l>Math.max(h,m)))if(lc||Math.abs(n(o,f))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":637}],641:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,h=0,f=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;h90&&l.log("Long binary search..."),h-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":104}],646:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:33,tinycolor2:489}],647:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+f.randstr([],64),a=h.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=h.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())f.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,m.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var h=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var h=t("d3"),f=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");h.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(f.log(r.querySelector("parsererror div").textContent),null):h.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=h.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=h.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var m=f.getPlotDiv(s.node());(m&&m._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var h=n(l,"width"),f=n(l,"height"),g=+s.attr("x")-h*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],m=parseInt(s.style("font-size"),10)||n(s,"height"),v=-m/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-h/2,v-f/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:v-f/2}):"a"===p[0]?l.attr({x:0,y:v}):l.attr({x:g,y:+s.attr("y")+v-f/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(v," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=h.select(f.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=h.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;h.select(this).transition().duration(0).remove(),h.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;h.select(document).on("mouseup",function(){return h.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===h.event.which?(o.style({opacity:1}),h.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),h.select(this).call(c(o,e,r)))}).on("keydown",function(){13===h.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=h.dispatch("edit","input","cancel"),l=h.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),h.rebind(this,s,"on")}},{"../constants/string_mappings":617,"../constants/xmlns_namespaces":618,"../lib":633,d3:95}],648:[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":686,"topojson-client":491}],649:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0&&u.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);var i=h.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lC.range[0]?[1,2]:[2,1]);else{var I=C.range[0],P=C.range[1];"log"===b?(I<=0&&P<=0&&r(E+".autorange",!0),I<=0?I=P/1e6:P<=0&&(P=I/1e6),r(E+".range[0]",Math.log(I)/Math.LN10),r(E+".range[1]",Math.log(P)/Math.LN10)):(r(E+".range[0]",Math.pow(10,I)),r(E+".range[1]",Math.pow(10,P)))}else r(E+".autorange",!0)}if("reverse"===k)S.range?S.range.reverse():(r(E+".autorange",!0),S.range=[1,0]),L.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var D=v.parts[1],O=v.parts[0],R=a[O]||[],F=R[D]||{};2===v.parts.length&&(null===b&&(e[m]="remove"),"add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?D===-1?(g[O]=R,delete g[m]):g[m]=F:x.log("???",e)),!n(F,"x")&&!n(F,"y")||x.containsAny(m,["color","opacity","align","dash"])||(d.docalc=!0);var j=w.getComponentMethod(O,"drawOne");j(t,D,v.parts.slice(2).join("."),e[m]),delete e[m]}else if(M.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])z.manageArrayContainers(v,b,g),d.doplot=!0;else{var N=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?d.doplot=!0:0===v.parts[0].indexOf("geo")?d.doplot=!0:0===v.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===m?d.doplot=!0:!o._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?d.docalc=!0:v.parts[0].indexOf("legend")!==-1?d.dolegend=!0:m.indexOf("title")!==-1?d.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(N,["tick","exponent","grid","zeroline"])?d.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:v.parts.length>1&&N.indexOf("line")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&"mirror"===N?d.doticks=d.dolayoutstyle=!0:"margin.pad"===m?d.doticks=d.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(d.doplot=!0):d.doplot=!0,v.set(b)}}}var B=t._fullLayout.width,U=t._fullLayout.height;M.supplyDefaults(t),t.layout.autosize&&M.plotAutoSize(t,t.layout,t._fullLayout);var V=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==U;return V&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];m.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=x.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(S.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),M=t("../plots/plots"),A=t("../plots/cartesian/graph_interact"),k=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),S=t("../constants/xmlns_namespaces"),L=t("../lib/svg_text_utils"),z=t("./helpers"),C=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=I._basePlotModules,r=0;r=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=z.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=M.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function h(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function g(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var m,v,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),A=!_&&!w&&x.isPlainObject(e);if(A)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&EE)&&S.push(v);b=S}}b.length>0?h(b):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=z.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:M.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=M.modifyFrames,l=M.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),M.modifyFrames(t,a)},y.purge=function(t){t=z.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return M.cleanPlot([],{},r,e),M.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":556,"../components/errorbars":562,"../constants/xmlns_namespaces":618,"../lib":633,"../lib/events":625,"../lib/queue":641,"../lib/svg_text_utils":647,"../plotly":659,"../plots/cartesian/graph_interact":671,"../plots/plots":724,"../plots/polar":727,"../registry":739,"./helpers":650,"./subroutines":656,d3:95,"fast-isnumeric":104}],652:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],653:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=f.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};_(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return _(t,g),Object.keys(f.subplotsRegistry).forEach(function(e){var r=f.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)c(t,r,"xaxis"),c(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;c(t,r,n)}}),t=u(t),Object.keys(f.componentsRegistry).forEach(function(e){var r=f.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){h(t,r,e+r.name)}):h(t,r,r.name))}),{layoutAttributes:o(t)}}function a(t){var e=f.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):t.arrayOk===!0&&(i[n+"src"]=e(n)):d.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function l(t){function e(t,e,r){if(t){var n=t[M];n&&(delete t[M],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function c(t,e,r){var n=d.nestedProperty(t,r),i=_({},e.layoutAttributes);i[w]=!0,n.set(i)}function h(t,e,r){var n=d.nestedProperty(t,r),i=_(n.get()||{},e.layoutAttributes);n.set(i)}var f=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=d.extendFlat,_=d.extendDeep,w="_isSubplotObj",M="_isLinkedToArray",A="_deprecated",k=[w,M,A];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=M,r.DEPRECATED=A,r.UNDERSCORE_ATTRS=k,r.get=function(){var t={};f.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(f.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:k.concat.role},traces:t,layout:i(),transforms:e,frames:o(m),animation:o(v)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];k.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||d.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){a=a.slice(0,s).concat([r]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=n(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};f(e.width)&&f(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(h).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":633,"../plotly":659,"../snapshot/cloneplot":740,"../snapshot/helpers":743,"../snapshot/svgtoimg":745,"../snapshot/tosvg":747,"fast-isnumeric":104}],658:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),f=0;f1&&l.push(o("object","layout"))),f.supplyDefaults(u);for(var c=u._fullData,m=r.length,v=0;vc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=z&&i<=10||e>=15*z)t._tickround="d";else if(e>=I&&i<=16||e>=C)t._tickround="M";else if(e>=P&&i<=19||e>=I)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(x(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(W),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(W,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(x(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=V(c):"m"===l?a=q(c):"d"===l?(r||(i="
"+V(c)),a=H(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=Y(c),"S"!==l&&(a+=f(y.round(v(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=H(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=f(Math.pow(10,o),t,i,n);else if(x(a)||"D"===a.charAt(0)&&v(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=f(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,v(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function h(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=f(e.x,t,i,n)}function f(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var h={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(h),o=(Number(h._tickround)||0)+4,l=h._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},D.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&h/c>f&&(l=o,u=s,f=h/c);if(n===i){var g=n-1,m=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else f&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-f*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),f=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-f*l.pad,u.val+f*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r.map(t.l2r||Number)},D.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=D.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},D.saveRangeInitial=function(t,e){for(var r=D.list(t,"",!0),n=!1,i=0;i=f?d=!1:s.val>=u&&s.pad<=f&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:f})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=h?d=!1:s.val<=c&&s.pad<=h&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:h})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,h,f,d,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=m-1;a>5;a--)i(a)}},D.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/h.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var h;h="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},D.autoTicks(h,s);var f,d=D.tickIncrement(D.tickFirst(h),h.dtick,"reverse");if("number"==typeof h.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||i(a)||i(o))){var w=h.dtick/2;d+=d+w0&&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),a(t),t._tmin=D.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=D.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),h=0;hS?(e/=S,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,R)):n>L?(e/=L,t.dtick="M"+i(e,1,F)):n>z?(t.dtick=i(e,z,N),t.tick0="2000-01-02"):n>C?t.dtick=i(e,C,F):n>I?t.dtick=i(e,I,j):n>P?t.dtick=i(e,P,j):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,R))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,R)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,R));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},D.tickIncrement=function(t,e,r){var n=r?-1:1;if(x(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?U:B,l=t+.01*n,u=_.roundUp(v(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},D.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]a:h1&&e1)};f(e.width)&&f(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(h).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":633,"../plotly":659,"../snapshot/cloneplot":740,"../snapshot/helpers":743,"../snapshot/svgtoimg":745,"../snapshot/tosvg":747,"fast-isnumeric":104}],658:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),f=0;f1&&l.push(o("object","layout"))),f.supplyDefaults(u);for(var c=u._fullData,m=r.length,v=0;vc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=z&&i<=10||e>=15*z)t._tickround="d";else if(e>=I&&i<=16||e>=C)t._tickround="M";else if(e>=P&&i<=19||e>=I)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(x(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(W),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(W,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(x(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=V(c):"m"===l?a=q(c):"d"===l?(r||(i="
"+V(c)),a=H(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=Y(c),"S"!==l&&(a+=f(y.round(v(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=H(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=f(Math.pow(10,o),t,i,n);else if(x(a)||"D"===a.charAt(0)&&v(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=f(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,v(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function h(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=f(e.x,t,i,n)}function f(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var h={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(h),o=(Number(h._tickround)||0)+4,l=h._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},D.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&h/c>f&&(l=o,u=s,f=h/c);if(n===i){var g=n-1,m=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else f&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-f*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),f=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-f*l.pad,u.val+f*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r.map(t.l2r||Number)},D.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=D.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},D.saveRangeInitial=function(t,e){for(var r=D.list(t,"",!0),n=!1,i=0;i=f?d=!1:s.val>=u&&s.pad<=f&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:f})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=h?d=!1:s.val<=c&&s.pad<=h&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:h})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,h,f,d,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=m-1;a>5;a--)i(a)}},D.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/h.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var h;h="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},D.autoTicks(h,s);var f,d=D.tickIncrement(D.tickFirst(h),h.dtick,"reverse");if("number"==typeof h.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||i(a)||i(o))){var w=h.dtick/2;d+=d+w0&&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),a(t),t._tmin=D.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=D.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),h=0;hS?(e/=S,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,R)):n>L?(e/=L,t.dtick="M"+i(e,1,F)):n>z?(t.dtick=i(e,z,N),t.tick0="2000-01-02"):n>C?t.dtick=i(e,C,F):n>I?t.dtick=i(e,I,j):n>P?t.dtick=i(e,P,j):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,R))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,R)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,R));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},D.tickIncrement=function(t,e,r){var n=r?-1:1;if(x(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?U:B,l=t+.01*n,u=_.roundUp(v(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},D.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]a:h1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],666:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),h=[],f=0;f0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],669:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],670:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),h=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,r,s,_,w,M,A){function k(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+mt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+mt+")").attr("d","M0,0Z"),S()}function S(){pt.selectAll(".select-outline").remove()}function L(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(q,e+at)),i=Math.max(0,Math.min(H,r+ot)),a=Math.abs(n-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,X)/2);st.l=Math.min(at,n),st.r=Math.max(at,n),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!J||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function z(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),b=!1)))}function I(e,r){var i=1===(M+A).length;if(e)F();else if(2!==r||i){if(1===r&&i){var a=M?V[0]:U[0],o="s"===M||"w"===A?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",h="middle";if(a.fixedrange)return;M?(h="n"===M?"top":"bottom","right"===a.side&&(c="right")):"e"===A&&(c="right"),rt.call(f.makeEditable,null,{immediate:!0,background:N.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:h}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&u.relayout(t,s,r)})}}else R()}function P(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||N._enablescrollzoom){if(t._transitioningWithDuration)return h.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void h.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=vt[0]+vt[2]*l,c=(s.bottom-e.clientY)/s.height,f=vt[1]+vt[3]*(1-c);if(A){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,r){for(var n,a,o=1-e,s=0;s0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nW.width||Y<0||Y>W.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:A[0]._length/2,Y="ypx"in e?e.ypx:k[0]._length/2;if(C="xval"in e?n(a,e.xval):i(A,X),I="yval"in e?n(a,e.yval):i(k,Y),!g(C[0])||!g(I[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(D=0;D1||R.hoverinfo.indexOf("name")!==-1?R.name:void 0,index:!1,distance:Math.min(Z,M.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[F]&&(V.subplot=o[F]._subplot),q=H.length,"array"===N){var Q=e[D];"pointNumber"in Q?(V.index=Q.pointNumber,N="closest"):(N="","xval"in Q&&(B=Q.xval,N="x"),"yval"in Q&&(U=Q.yval,N=N?"closest":"y"))}else B=C[j],U=I[j];if(R._module&&R._module.hoverPoints){var K=R._module.hoverPoints(V,B,U,N);if(K)for(var $,J=0;Jq&&(H.splice(0,q),Z=H[0].distance)}if(0===H.length)return _.unhoverRaw(t,e);var tt="y"===z&&G.length>1;H.sort(function(t,e){return t.distance-e.distance});var et=x.combine(o.plot_bgcolor||x.background,o.paper_bgcolor),rt={hovermode:z,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(H,rt);c(H,tt?"xa":"ya"),h(nt,tt);var it=t._hoverdata,at=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):k&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var h=e.select("text.nums").style("fill",u).call(b.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);h.selectAll("tspan.line").call(b.setPosition,0,0);var f=e.select("text.name"),m=0;r&&r!==n?(f.style("fill",l).text(r).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),f.selectAll("tspan.line").call(b.setPosition,0,0),m=f.node().getBoundingClientRect().width+2*P):(f.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var v,M,T=h.node().getBoundingClientRect(),S=t.xa._offset+(t.x0+t.x1)/2,L=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),C=Math.abs(t.y1-t.y0),D=T.width+I+P+m;t.ty0=_-T.top,t.bx=T.width+2*P,t.by=T.height+2*P,t.anchor="start",t.txwidth=T.width,t.tx2width=m,t.offset=0,a?(t.pos=S,v=L+C/2+D<=A,M=L-C/2-D>=0,"top"!==t.idealAlign&&v||!M?v?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")):(t.pos=L,v=S+z/2+D<=w,M=S-z/2-D>=0,"left"!==t.idealAlign&&v||!M?v?(S+=z/2,t.anchor="start"):t.anchor="middle":(S-=z/2,t.anchor="end")),h.attr("text-anchor",t.anchor),m&&f.attr("text-anchor",t.anchor),e.attr("transform","translate("+S+","+L+")"+(a?"rotate("+E+")":""))}),L}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,h=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?L:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(f.push.apply(f,d),h.splice(o+1,1),u=0,s=f.length-1;s>=0;s--)u+=f[s].dp;for(a=u/f.length,s=f.length-1;s>=0;s--)f[s].dp-=a;n=!1}else o++}h.forEach(r)}for(o=h.length-1;o>=0;o--){var m=h[o];for(s=m.length-1;s>=0;s--){var v=m[s],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function h(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(I+P),s=o+a*(t.txwidth+P),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-C,l=t.offset*z),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*I+l)+","+(I+u)+"v"+(t.by/2-I)+"h"+n*t.bx+"v-"+t.by+"H"+(n*I+l)+"V"+(u-I)+"Z"),i.call(b.setPosition,o+l,u+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(b.setPosition,s+a*P+l,u+t.ty0-t.by/2+P),r.select("rect").call(b.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function f(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),A=t("./dragbox"),k=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return m.coerce(t,e,k,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=T.isHoriz(r);i=a?"y":"x"}else i="closest"; n("hovermode",i)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+M.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexh[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":633,"fast-isnumeric":104}],677:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,h){function f(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,m=i.element.getBoundingClientRect(),v=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,x=e-m.left,b=r-m.top,_=x,w=b,M="M"+x+","+b,A=i.xaxes[0]._length,k=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),S=i.xaxes.concat(i.yaxes);"lasso"===h&&(p=l([[x,b]],s.BENDPX));var L=g.selectAll("path.select-outline").data([1,2]);L.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",M+"Z");var z,C,I,P,D,O=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),R=[],F=i.gd,j=[];for(z=0;z0)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*h*Math.abs(n-i))}return l}function r(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var h=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?r:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,o=t[e],l=(t._id||"x").charAt(0);if(n="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,n=n.slice(),!o||2!==o.length)return void(t[e]=n);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),r=0;r<2;r++)if("date"===t.type){if(!a.isDateTime(o[r])){t[e]=n;break}if(o[r]a.MAX_MS&&(o[r]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[r])){if(!i(o[1-r])){t[e]=n;break}o[r]=o[1-r]*(r?10:.1)}if(o[r]<-s?o[r]=-s:o[r]>s&&(o[r]=s),o[0]===o[1]){var h=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=h,o[1]+=h}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?l:r},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var h=c.charAt(0),f=c.substr(1);f=n(f)?Number(f):0,(f<=0||!("date"===o&&"M"===h&&f===Math.round(f)||"log"===o&&"L"===h||"log"===o&&"D"===h&&(1===f||2===f)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],682:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(t){var e,r,n,i,a,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,x.push(s),o[s]=a}return o}function h(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=l.yaxis._id,h=l.xaxis.range,f=l.yaxis.range;l.xaxis._r=l.xaxis.range.slice(),l.yaxis._r=l.yaxis.range.slice(),i=r[u]?r[u].to:h,a=r[c]?r[c].to:f,h[0]===i[0]&&h[1]===i[1]&&f[0]===a[0]&&f[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function f(e,r){function n(e,r){for(i=0;ir.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=c(e),_=Object.keys(b),w=h(y,_,b);if(!w.length)return!1;var M;u&&(M=u());var A,k,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),A=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":633,"../../plotly":659,"../../registry":739,"./axes":664,d3:95}],683:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],h=0;hi},M.render=function(){function t(t){var e=r.projection(t.lonlat);return e?"translate("+e[0]+","+e[1]+")":null}function e(t){return r.isLonLatOverEdges(t.lonlat)?"0":"1.0"}var r=this,n=r.framework,i=n.select("g.choroplethlayer"),a=n.select("g.scattergeolayer"),o=r.path;n.selectAll("path.basepath").attr("d",o),n.selectAll("path.graticulepath").attr("d",o),i.selectAll("path.choroplethlocation").attr("d",o),i.selectAll("path.basepath").attr("d",o),a.selectAll("path.js-line").attr("d",o),null!==r.clipAngle?(a.selectAll("path.point").style("opacity",e).attr("transform",t),a.selectAll("text").style("opacity",e).attr("transform",t)):(a.selectAll("path.point").attr("transform",t),a.selectAll("text").attr("transform",t))}},{"../../components/color":533,"../../components/drawing":556,"../../constants/xmlns_namespaces":618,"../../lib/topojson_utils":648,"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"./constants":686,"./projections":694,"./set_scale":695,"./zoom":696,"./zoom_reset":697,d3:95,"topojson-client":491}],688:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;nn^d>n&&r<(f-u)*(n-c)/(d-c)+u&&(i=!i)}return i}function o(t){return t?t/Math.sin(t):1}function s(t){return t>1?I:t<-1?-I:Math.asin(t)}function l(t){return t>1?0:t<-1?C:Math.acos(t)}function u(t,e){var r=(2+I)*Math.sin(e);e/=2;for(var n=0,i=1/0;n<10&&Math.abs(i)>L;n++){var a=Math.cos(e);e-=i=(e+Math.sin(e)*(a+2)-r)/(2*a*(1+a))}return[2/Math.sqrt(C*(4+C))*t*(1+Math.cos(e)),2*Math.sqrt(C/(4+C))*Math.sin(e)]}function c(t,e){function r(r,n){var i=F(r/e,n);return i[0]*=t,i}return arguments.length<2&&(e=t),1===e?F:e===1/0?f:(r.invert=function(r,n){var i=F.invert(r/t,n);return i[0]*=e,i},r)}function h(){var t=2,e=R(c),r=e(t);return r.coefficient=function(r){return arguments.length?e(t=+r):t},r}function f(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function d(t,e){return[3*t/(2*C)*Math.sqrt(C*C/3-e*e),e]}function p(t,e){return[t,1.25*Math.log(Math.tan(C/4+.4*e))]}function g(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)>L&&--i>0);return e/2}}function m(t,e,r){function n(r,n){return[t*r*Math.cos(n=i(n)),e*Math.sin(n)]}var i=g(r);return n.invert=function(n,i){var a=s(i/e);return[n/(t*Math.cos(a)),s((2*a+Math.sin(2*a))/r)]},n}function v(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(-.013791+n*(.003971*r-.001529*n))),e*(1.007226+r*(.015085+n*(-.044475+.028874*r-.005916*n)))]}function y(t,e){var r,n=Math.min(18,36*Math.abs(e)/C),i=Math.floor(n),a=n-i,o=(r=N[i])[0],s=r[1],l=(r=N[++i])[0],u=r[1],c=(r=N[Math.min(19,++i)])[0],h=r[1];return[t*(l+a*(c-o)/2+a*a*(c-2*l+o)/2),(e>0?I:-I)*(u+a*(h-s)/2+a*a*(h-2*u+s)/2)]}function x(t,e){return[t*Math.cos(e),e]}function b(t,e){var r=Math.cos(e),n=o(l(r*Math.cos(t/=2)));return[2*r*Math.sin(t)*n,Math.sin(e)*n]}function _(t,e){var r=b(t,e);return[(r[0]+t/I)/2,(r[1]+e)/2]}t.geo.project=function(t,e){var n=e.stream;if(!n)throw new Error("not yet supported");return(t&&w.hasOwnProperty(t.type)?w[t.type]:r)(t,n)};var w={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,r)})}}},M=[],A=[],k={point:function(t,e){M.push([t,e])},result:function(){var t=M.length?M.length<2?{type:"Point",coordinates:M[0]}:{type:"MultiPoint",coordinates:M}:null;return M=[],t}},T={lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){M.length&&(A.push(M),M=[])},result:function(){var t=A.length?A.length<2?{type:"LineString",coordinates:A[0]}:{type:"MultiLineString",coordinates:A}:null;return A=[],t}},E={polygonStart:n,lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){var t=M.length;if(t){do M.push(M[0].slice());while(++t<4);A.push(M),M=[]}},polygonEnd:n,result:function(){if(!A.length)return null;var t=[],e=[];return A.forEach(function(r){i(r)?t.push([r]):e.push(r)}),e.forEach(function(e){var r=e[0];t.some(function(t){if(a(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}},S={Point:k,MultiPoint:k,LineString:T,MultiLineString:T,Polygon:E,MultiPolygon:E,Sphere:E},L=1e-6,z=L*L,C=Math.PI,I=C/2,P=(Math.sqrt(C),C/180),D=180/C,O=t.geo.projection,R=t.geo.projectionMutator;t.geo.interrupt=function(e){function r(t,r){for(var n=r<0?-1:1,i=l[+(r<0)],a=0,o=i.length-1;ai[a][2][0];++a);var s=e(t-i[a][1][0],r);return s[0]+=e(i[a][1][0],n*r>n*i[a][0][1]?i[a][0][1]:r)[0],s}function n(){s=l.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]]})})}function i(){for(var e=1e-6,r=[],n=0,i=l[0].length;n=0;--n){var o=l[1][n],s=180*o[0][0]/C,u=180*o[0][1]/C,c=180*o[1][1]/C,h=180*o[2][0]/C,f=180*o[2][1]/C;r.push(a([[h-e,f-e],[h-e,c+e],[s+e,c+e],[s+e,u-e]],30))}return{type:"Polygon",coordinates:[t.merge(r)]}}function a(t,e){for(var r,n,i,a=-1,o=t.length,s=t[0],l=[];++aL&&--i>0);return[t/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]},(t.geo.naturalEarth=function(){return O(v)}).raw=v;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}),y.invert=function(t,e){var r=e/I,n=90*r,i=Math.min(18,Math.abs(n/5)),a=Math.max(0,Math.floor(i));do{var o=N[a][1],s=N[a+1][1],l=N[Math.min(19,a+2)][1],u=l-o,c=l-2*s+o,h=2*(Math.abs(r)-s)/u,f=c/u,d=h*(1-f*h*(1-2*f*h));if(d>=0||1===a){n=(e>=0?5:-5)*(d+i);var p,g=50;do i=Math.min(18,Math.abs(n)/5),a=Math.floor(i),d=i-a,o=N[a][1],s=N[a+1][1],l=N[Math.min(19,a+2)][1],n-=(p=(e>=0?I:-I)*(s+d*(l-o)/2+d*d*(l-2*s+o)/2)-e)*D;while(Math.abs(p)>z&&--g>0);break}}while(--a>=0);var m=N[a][0],v=N[a+1][0],y=N[Math.min(19,a+2)][0];return[t/(v+d*(y-m)/2+d*d*(y-2*v+m)/2),n*P]},(t.geo.robinson=function(){return O(y)}).raw=y,x.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return O(x)}).raw=x,b.invert=function(t,e){if(!(t*t+4*e*e>C*C+L)){var r=t,n=e,i=25;do{var a,o=Math.sin(r),s=Math.sin(r/2),u=Math.cos(r/2),c=Math.sin(n),h=Math.cos(n),f=Math.sin(2*n),d=c*c,p=h*h,g=s*s,m=1-p*u*u,v=m?l(h*u)*Math.sqrt(a=1/m):a=0,y=2*v*h*s-t,x=v*c-e,b=a*(p*g+v*h*u*d),_=a*(.5*o*f-2*v*c*s),w=.25*a*(f*s-v*c*p*o),M=a*(d*u+v*g*h),A=_*w-M*b;if(!A)break;var k=(x*_-y*M)/A,T=(y*w-x*b)/A;r-=k,n-=T}while((Math.abs(k)>L||Math.abs(T)>L)&&--i>0);return[r,n]}},(t.geo.aitoff=function(){return O(b)}).raw=b,_.invert=function(t,e){var r=t,n=e,i=25;do{var a,o=Math.cos(n),s=Math.sin(n),u=Math.sin(2*n),c=s*s,h=o*o,f=Math.sin(r),d=Math.cos(r/2),p=Math.sin(r/2),g=p*p,m=1-h*d*d,v=m?l(o*d)*Math.sqrt(a=1/m):a=0,y=.5*(2*v*o*p+r/I)-t,x=.5*(v*s+n)-e,b=.5*a*(h*g+v*o*d*c)+.5/I,_=a*(f*u/4-v*s*p),w=.125*a*(u*p-v*s*h*f),M=.5*a*(c*d+v*g*o)+.5,A=_*w-M*b,k=(x*_-y*M)/A,T=(y*w-x*b)/A;r-=k,n-=T}while((Math.abs(k)>L||Math.abs(T)>L)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return O(_)}).raw=_}e.exports=n},{}],695:[function(t,e,r){"use strict";function n(t,e){var r=t.projection,n=t.lonaxis,o=t.lataxis,l=t.domain,u=t.framewidth||0,c=e.w*(l.x[1]-l.x[0]),h=e.h*(l.y[1]-l.y[0]),f=n.range[0]+s,d=n.range[1]-s,p=o.range[0]+s,g=o.range[1]-s,m=n._fullRange[0]+s,v=n._fullRange[1]-s,y=o._fullRange[0]+s,x=o._fullRange[1]-s;r._translate0=[e.l+c/2,e.t+h/2];var b=d-f,_=g-p,w=[f+b/2,p+_/2],M=r._rotate;r._center=[w[0]+M[0],w[1]+M[1]];var A=function(e){function n(t){return Math.min(_*c/(t[1][0]-t[0][0]),_*h/(t[1][1]-t[0][1]))}var o,s,l,b,_=e.scale(),w=r._translate0,M=i(f,p,d,g),A=i(m,y,v,x);l=a(e,M),o=n(l),b=a(e,A),r._fullScale=n(b),e.scale(o),l=a(e,M),s=[w[0]-l[0][0]+u,w[1]-l[0][1]+u],r._translate=s,e.translate(s),l=a(e,M),t._isAlbersUsa||e.clipExtent(l),o=r.scale*o,r._scale=o,t._width=Math.round(l[1][0])+u,t._height=Math.round(l[1][1])+u,t._marginX=(c-Math.round(l[1][0]))/2,t._marginY=(h-Math.round(l[1][1]))/2};return A}function i(t,e,r,n){var i=(r-t)/4;return{type:"Polygon",coordinates:[[[t,e],[t,n],[t+i,n],[t+2*i,n],[t+3*i,n],[r,n],[r,e],[r-i,e],[r-2*i,e],[r-3*i,e],[t,e]]]}}function a(t,e){return o.geo.path().projection(t).bounds(e)}var o=t("d3"),s=t("./constants").clipPad;e.exports=n},{"./constants":686,d3:95}],696:[function(t,e,r){"use strict";function n(t,e){var r;return(r=e._isScoped?a:e._clipAngle?s:o)(t,e.projection)}function i(t,e){var r=e._fullScale;return _.behavior.zoom().translate(t.translate()).scale(t.scale()).scaleExtent([.5*r,100*r])}function a(t,e){function r(){_.select(this).style(A)}function n(){o.scale(_.event.scale).translate(_.event.translate),t.render()}function a(){_.select(this).style(k)}var o=t.projection,s=i(o,e);return s.on("zoomstart",r).on("zoom",n).on("zoomend",a),s}function o(t,e){function r(t){return m.invert(t)}function n(t){var e=m(r(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function a(){_.select(this).style(A),l=_.mouse(this),u=m.rotate(),c=m.translate(),h=u,f=r(l)}function o(){return d=_.mouse(this),n(l)?(v.scale(m.scale()),void v.translate(m.translate())):(m.scale(_.event.scale),m.translate([c[0],_.event.translate[1]]),f?r(d)&&(g=r(d),p=[h[0]+(g[0]-f[0]),u[1],u[2]],m.rotate(p),h=p):(l=d,f=r(l)),void t.render())}function s(){_.select(this).style(k)}var l,u,c,h,f,d,p,g,m=t.projection,v=i(m,e),y=2;return v.on("zoomstart",a).on("zoom",o).on("zoomend",s),v}function s(t,e){function r(t){v++||t({type:"zoomstart"})}function n(t){t({type:"zoom"})}function a(t){--v||t({type:"zoomend"})}var o,s=t.projection,d={r:s.rotate(),k:s.scale()},p=i(s,e),g=b(p,"zoomstart","zoom","zoomend"),v=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(A);var t=_.mouse(this),e=s.rotate(),i=e,a=s.translate(),v=u(e);o=l(s,t),y.call(p,"zoom",function(){var r=_.mouse(this);if(s.scale(d.k=_.event.scale),o){if(l(s,r)){s.rotate(e).translate(a);var u=l(s,r),p=h(o,u),y=m(c(v,p)),x=d.r=f(y,o,i);isFinite(x[0])&&isFinite(x[1])&&isFinite(x[2])||(x=i),s.rotate(x),i=x}}else t=r,o=l(s,t);n(g.of(this,arguments))}),r(g.of(this,arguments))}).on("zoomend",function(){_.select(this).style(k),y.call(p,"zoom",null),a(g.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,g,"on")}function l(t,e){var r=t.invert(e);return r&&isFinite(r[0])&&isFinite(r[1])&&v(r)}function u(t){var e=.5*t[0]*w,r=.5*t[1]*w,n=.5*t[2]*w,i=Math.sin(e),a=Math.cos(e),o=Math.sin(r),s=Math.cos(r),l=Math.sin(n),u=Math.cos(n);return[a*s*u+i*o*l,i*s*u-a*o*l,a*o*u+i*s*l,a*s*l-i*o*u]}function c(t,e){var r=t[0],n=t[1],i=t[2],a=t[3],o=e[0],s=e[1],l=e[2],u=e[3];return[r*o-n*s-i*l-a*u,r*s+n*o+i*u-a*l,r*l-n*u+i*o+a*s,r*u+n*l-i*s+a*o]}function h(t,e){if(t&&e){var r=x(t,e),n=Math.sqrt(y(r,r)),i=.5*Math.acos(Math.max(-1,Math.min(1,y(t,e)))),a=Math.sin(i)/n;return n&&[Math.cos(i),r[2]*a,-r[1]*a,r[0]*a]}}function f(t,e,r){var n=g(e,2,t[0]);n=g(n,1,t[1]),n=g(n,0,t[2]-r[2]);var i,a,o=e[0],s=e[1],l=e[2],u=n[0],c=n[1],h=n[2],f=Math.atan2(s,o)*M,p=Math.sqrt(o*o+s*s);Math.abs(c)>p?(a=(c>0?90:-90)-f,i=0):(a=Math.asin(c/p)*M-f,i=Math.sqrt(p*p-c*c));var m=180-a-2*f,v=(Math.atan2(h,u)-Math.atan2(l,i))*M,y=(Math.atan2(h,u)-Math.atan2(l,-i))*M,x=d(r[0],r[1],a,v),b=d(r[0],r[1],m,y);return x<=b?[a,v,r[2]]:[m,y,r[2]]}function d(t,e,r,n){var i=p(r-t),a=p(n-e);return Math.sqrt(i*i+a*a)}function p(t){return(t%360+540)%360-180}function g(t,e,r){var n=r*w,i=t.slice(),a=0===e?1:0,o=2===e?1:2,s=Math.cos(n),l=Math.sin(n);return i[a]=t[a]*s-t[o]*l,i[o]=t[o]*s+t[a]*l,i}function m(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*M,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*M,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*M]}function v(t){var e=t[0]*w,r=t[1]*w,n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function y(t,e){for(var r=0,n=0,i=t.length;n Date: Thu, 17 Nov 2016 15:25:00 +0100 Subject: [PATCH 09/51] issue #1160 fix If we play with timestamps, we have to leave range bounds integers --- src/components/modebar/buttons.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/modebar/buttons.js b/src/components/modebar/buttons.js index 7536885207f..e487098b1f6 100644 --- a/src/components/modebar/buttons.js +++ b/src/components/modebar/buttons.js @@ -205,8 +205,8 @@ function handleCartesian(gd, ev) { } else { var rangeNow = ax.range; - aobj[axName + '.range[0]'] = r0 * rangeNow[0] + r1 * rangeNow[1]; - aobj[axName + '.range[1]'] = r0 * rangeNow[1] + r1 * rangeNow[0]; + aobj[axName + '.range[0]'] = Math.floor(r0 * rangeNow[0] + r1 * rangeNow[1]); + aobj[axName + '.range[1]'] = Math.floor(r0 * rangeNow[1] + r1 * rangeNow[0]); } } } From 665e56c6ad865161ac5dcbce6f6742951fd100f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Thu, 17 Nov 2016 11:41:01 -0500 Subject: [PATCH 10/51] modebar: use axis r21 and l2r to compute zoom +/- ranges - so that zoomed ranges are computed consistently for all axis types --- src/components/modebar/buttons.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/modebar/buttons.js b/src/components/modebar/buttons.js index e487098b1f6..064d02e9fe5 100644 --- a/src/components/modebar/buttons.js +++ b/src/components/modebar/buttons.js @@ -204,9 +204,18 @@ function handleCartesian(gd, ev) { } } else { - var rangeNow = ax.range; - aobj[axName + '.range[0]'] = Math.floor(r0 * rangeNow[0] + r1 * rangeNow[1]); - aobj[axName + '.range[1]'] = Math.floor(r0 * rangeNow[1] + r1 * rangeNow[0]); + var rangeNow = [ + ax.r2l(ax.range[0]), + ax.r2l(ax.range[1]), + ]; + + var rangeNew = [ + r0 * rangeNow[0] + r1 * rangeNow[1], + r0 * rangeNow[1] + r1 * rangeNow[0] + ]; + + aobj[axName + '.range[0]'] = ax.l2r(rangeNew[0]); + aobj[axName + '.range[1]'] = ax.l2r(rangeNew[1]); } } } From 8e9d4581bf24ec30d53fbc2ba44590d7e0d4fab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Thu, 17 Nov 2016 11:41:36 -0500 Subject: [PATCH 11/51] test: test all cartesian axis types in modebar click cases --- test/jasmine/tests/modebar_test.js | 66 ++++++++++++++++++------------ 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/test/jasmine/tests/modebar_test.js b/test/jasmine/tests/modebar_test.js index 047312179de..f4c2e82e605 100644 --- a/test/jasmine/tests/modebar_test.js +++ b/test/jasmine/tests/modebar_test.js @@ -1,7 +1,9 @@ var d3 = require('d3'); +var isNumeric = require('fast-isnumeric'); var createModeBar = require('@src/components/modebar/modebar'); var manageModeBar = require('@src/components/modebar/manage'); +var customMatchers = require('../assets/custom_matchers'); var Plotly = require('@lib/index'); var Plots = require('@src/plots/plots'); @@ -613,12 +615,21 @@ describe('ModeBar', function() { describe('modebar on clicks', function() { var gd, modeBar; + beforeAll(function() { + jasmine.addMatchers(customMatchers); + }); + afterEach(destroyGraphDiv); - function assertRange(actual, expected) { + function assertRange(axName, expected) { var PRECISION = 2; - expect(actual[0]).toBeCloseTo(expected[0], PRECISION); - expect(actual[1]).toBeCloseTo(expected[1], PRECISION); + + var actual = gd._fullLayout[axName].range; + + if(isNumeric(expected[0])) { + expect(actual).toBeCloseToArray(expected, PRECISION, axName); + } + else expect(actual).toEqual(expected, axName); } function assertActive(buttons, activeButton) { @@ -634,9 +645,11 @@ describe('ModeBar', function() { beforeEach(function(done) { var mockData = [{ type: 'scatter', - y: [2, 1, 2] + x: ['2016-01-01', '2016-02-01', '2016-03-01'], + y: [10, 100, 1000], }, { type: 'bar', + x: ['a', 'b', 'c'], y: [2, 1, 2], xaxis: 'x2', yaxis: 'y2' @@ -646,11 +659,12 @@ describe('ModeBar', function() { xaxis: { anchor: 'y', domain: [0, 0.5], - range: [0, 5] + range: ['2016-01-01', '2016-04-01'] }, yaxis: { anchor: 'x', - range: [0, 3] + type: 'log', + range: [1, 3] }, xaxis2: { anchor: 'y2', @@ -679,35 +693,35 @@ describe('ModeBar', function() { buttonAutoScale = selectButton(modeBar, 'autoScale2d'), buttonResetScale = selectButton(modeBar, 'resetScale2d'); - assertRange(gd._fullLayout.xaxis.range, [0, 5]); - assertRange(gd._fullLayout.yaxis.range, [0, 3]); - assertRange(gd._fullLayout.xaxis2.range, [-1, 4]); - assertRange(gd._fullLayout.yaxis2.range, [0, 4]); + assertRange('xaxis', ['2016-01-01', '2016-04-01']); + assertRange('yaxis', [1, 3]); + assertRange('xaxis2', [-1, 4]); + assertRange('yaxis2', [0, 4]); buttonZoomIn.click(); - assertRange(gd._fullLayout.xaxis.range, [1.25, 3.75]); - assertRange(gd._fullLayout.yaxis.range, [0.75, 2.25]); - assertRange(gd._fullLayout.xaxis2.range, [0.25, 2.75]); - assertRange(gd._fullLayout.yaxis2.range, [1, 3]); + assertRange('xaxis', ['2016-01-23 17:45', '2016-03-09 05:15']); + assertRange('yaxis', [1.5, 2.5]); + assertRange('xaxis2', [0.25, 2.75]); + assertRange('yaxis2', [1, 3]); buttonZoomOut.click(); - assertRange(gd._fullLayout.xaxis.range, [0, 5]); - assertRange(gd._fullLayout.yaxis.range, [0, 3]); - assertRange(gd._fullLayout.xaxis2.range, [-1, 4]); - assertRange(gd._fullLayout.yaxis2.range, [0, 4]); + assertRange('xaxis', ['2016-01-01', '2016-04-01']); + assertRange('yaxis', [1, 3]); + assertRange('xaxis2', [-1, 4]); + assertRange('yaxis2', [0, 4]); buttonZoomIn.click(); buttonAutoScale.click(); - assertRange(gd._fullLayout.xaxis.range, [-0.1584327, 2.1584327]); - assertRange(gd._fullLayout.yaxis.range, [0.92675159, 2.073248]); - assertRange(gd._fullLayout.xaxis2.range, [-0.5, 2.5]); - assertRange(gd._fullLayout.yaxis2.range, [0, 2.105263]); + assertRange('xaxis', ['2015-12-27 06:36:39.6661', '2016-03-05 17:23:20.3339']); + assertRange('yaxis', [0.8591, 3.1408]); + assertRange('xaxis2', [-0.5, 2.5]); + assertRange('yaxis2', [0, 2.105263]); buttonResetScale.click(); - assertRange(gd._fullLayout.xaxis.range, [0, 5]); - assertRange(gd._fullLayout.yaxis.range, [0, 3]); - assertRange(gd._fullLayout.xaxis2.range, [-1, 4]); - assertRange(gd._fullLayout.yaxis2.range, [0, 4]); + assertRange('xaxis', ['2016-01-01', '2016-04-01']); + assertRange('yaxis', [1, 3]); + assertRange('xaxis2', [-1, 4]); + assertRange('yaxis2', [0, 4]); }); }); From c45338dc12c6c6ac6a1ba32cc60cb7de7c4fb91d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Thu, 17 Nov 2016 12:07:42 -0500 Subject: [PATCH 12/51] test: use ax.r2l to assert range - so that date axis ranges can be tested with some tolerance --- test/jasmine/tests/modebar_test.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/jasmine/tests/modebar_test.js b/test/jasmine/tests/modebar_test.js index f4c2e82e605..92166b3a824 100644 --- a/test/jasmine/tests/modebar_test.js +++ b/test/jasmine/tests/modebar_test.js @@ -1,5 +1,4 @@ var d3 = require('d3'); -var isNumeric = require('fast-isnumeric'); var createModeBar = require('@src/components/modebar/modebar'); var manageModeBar = require('@src/components/modebar/manage'); @@ -624,12 +623,10 @@ describe('ModeBar', function() { function assertRange(axName, expected) { var PRECISION = 2; - var actual = gd._fullLayout[axName].range; + var ax = gd._fullLayout[axName]; + var actual = ax.range.map(ax.r2l); - if(isNumeric(expected[0])) { - expect(actual).toBeCloseToArray(expected, PRECISION, axName); - } - else expect(actual).toEqual(expected, axName); + expect(actual).toBeCloseToArray(expected.map(ax.r2l), PRECISION, axName); } function assertActive(buttons, activeButton) { From 84722547081ece58708c712a44c1253b835596cd Mon Sep 17 00:00:00 2001 From: Nicolas Riesco Date: Thu, 17 Nov 2016 15:44:05 +0000 Subject: [PATCH 13/51] bar: fix wrong bar size in hover labels * Fixed incorrect bar size in the hover labels of stacked bars. Fixes #1157 --- src/traces/bar/hover.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/traces/bar/hover.js b/src/traces/bar/hover.js index f1fe8d8cc82..a4e58c7f4cb 100644 --- a/src/traces/bar/hover.js +++ b/src/traces/bar/hover.js @@ -65,9 +65,10 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { if(Color.opacity(mc)) pointData.color = mc; else if(Color.opacity(mlc) && mlw) pointData.color = mlc; + var size = (trace.base) ? di.b + di.s : di.s; if(trace.orientation === 'h') { pointData.x0 = pointData.x1 = xa.c2p(di.x, true); - pointData.xLabelVal = di.b + di.s; + pointData.xLabelVal = size; pointData.y0 = ya.c2p(barPos(di) - barDelta, true); pointData.y1 = ya.c2p(barPos(di) + barDelta, true); @@ -75,7 +76,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } else { pointData.y0 = pointData.y1 = ya.c2p(di.y, true); - pointData.yLabelVal = di.b + di.s; + pointData.yLabelVal = size; pointData.x0 = xa.c2p(barPos(di) - barDelta, true); pointData.x1 = xa.c2p(barPos(di) + barDelta, true); From f1b686f7ebfc4a77121854f207fe26562b1b2bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Thu, 17 Nov 2016 14:58:35 -0500 Subject: [PATCH 14/51] test: assert up to yyyy-mm-dd for date ranges - looks like the CI machine has less precision than my laptop --- test/jasmine/tests/modebar_test.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/jasmine/tests/modebar_test.js b/test/jasmine/tests/modebar_test.js index 92166b3a824..b3be9a51b43 100644 --- a/test/jasmine/tests/modebar_test.js +++ b/test/jasmine/tests/modebar_test.js @@ -624,9 +624,15 @@ describe('ModeBar', function() { var PRECISION = 2; var ax = gd._fullLayout[axName]; - var actual = ax.range.map(ax.r2l); + var actual = ax.range; - expect(actual).toBeCloseToArray(expected.map(ax.r2l), PRECISION, axName); + if(ax.type === 'date') { + var truncate = function(v) { return v.substr(0, 10); }; + expect(actual.map(truncate)).toEqual(expected.map(truncate), axName); + } + else { + expect(actual).toBeCloseToArray(expected, PRECISION, axName); + } } function assertActive(buttons, activeButton) { From 9e7120964f0c1d6b7fca37defbd30eb8b8010bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Thu, 17 Nov 2016 15:25:39 -0500 Subject: [PATCH 15/51] update changelog for 1.20.2 --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 042fb090ea3..fdf4656fc68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,13 @@ https://github.com/plotly/plotly.js/compare/vX.Y.Z...master where X.Y.Z is the semver of most recent plotly.js release. +## [1.20.2] -- 2016-11-17 + +### Fixed +- Fix hover labels in stacked bar charts [#1163] +- Fix mode bar zoom buttons on date axes [#1162] + + ## [1.20.1] -- 2016-11-16 ### Fixed From 775682fc797f4b74d4476b7acbc641fdfae33a8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Thu, 17 Nov 2016 15:28:09 -0500 Subject: [PATCH 16/51] 1.20.2 --- dist/README.md | 42 ++++++++++++++++++------------------ dist/npm-ls.json | 2 +- dist/plotly-basic.js | 24 +++++++++++++++------ dist/plotly-basic.min.js | 12 +++++------ dist/plotly-cartesian.js | 24 +++++++++++++++------ dist/plotly-cartesian.min.js | 20 ++++++++--------- dist/plotly-finance.js | 24 +++++++++++++++------ dist/plotly-finance.min.js | 12 +++++------ dist/plotly-geo-assets.js | 4 ++-- dist/plotly-geo.js | 19 +++++++++++----- dist/plotly-geo.min.js | 8 +++---- dist/plotly-gl2d.js | 21 ++++++++++++------ dist/plotly-gl2d.min.js | 30 +++++++++++++------------- dist/plotly-gl3d.js | 19 +++++++++++----- dist/plotly-gl3d.min.js | 14 ++++++------ dist/plotly-mapbox.js | 19 +++++++++++----- dist/plotly-mapbox.min.js | 8 +++---- dist/plotly-with-meta.js | 24 +++++++++++++++------ dist/plotly.js | 24 +++++++++++++++------ dist/plotly.min.js | 40 +++++++++++++++++----------------- package.json | 2 +- src/assets/geo_assets.js | 2 +- src/core.js | 2 +- 23 files changed, 241 insertions(+), 155 deletions(-) diff --git a/dist/README.md b/dist/README.md index f31becb287a..44e9170e85e 100644 --- a/dist/README.md +++ b/dist/README.md @@ -37,11 +37,11 @@ The main plotly.js bundle includes all the official (non-beta) trace modules. It be can imported as minified javascript - using dist file `dist/plotly.min.js` -- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.min.js OR https://cdn.plot.ly/plotly-plotly-1.20.1.min.js +- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.min.js OR https://cdn.plot.ly/plotly-plotly-1.20.2.min.js or as raw javascript: - using dist file `dist/plotly.js` -- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.js OR https://cdn.plot.ly/plotly-plotly-1.20.1.js +- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.js OR https://cdn.plot.ly/plotly-plotly-1.20.2.js - using CommonJS with `require('plotly.js')` If you would like to have access to the attribute meta information (including attribute descriptions as on the [schema reference page](https://plot.ly/javascript/reference/)), use dist file `dist/plotly-with-meta.js` @@ -74,13 +74,13 @@ The `basic` partial bundle contains the `scatter`, `bar` and `pie` trace modules | dist bundle (minified) | `dist/plotly-basic.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-basic-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-basic-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-basic-1.20.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-basic-1.20.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-basic-1.20.2.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-basic-1.20.2.min.js | | CommonJS | `require('plotly.js/lib/index-basic')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.6 MB | 606.4 kB | 196.5 kB | +| 1.6 MB | 606.5 kB | 196.6 kB | ### plotly.js cartesian @@ -92,13 +92,13 @@ The `cartesian` partial bundle contains the `scatter`, `bar`, `box`, `heatmap`, | dist bundle (minified) | `dist/plotly-cartesian.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-cartesian-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-cartesian-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-cartesian-1.20.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-cartesian-1.20.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-cartesian-1.20.2.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-cartesian-1.20.2.min.js | | CommonJS | `require('plotly.js/lib/index-cartesian')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.8 MB | 677.1 kB | 217.7 kB | +| 1.8 MB | 677.2 kB | 217.8 kB | ### plotly.js geo @@ -110,13 +110,13 @@ The `geo` partial bundle contains the `scatter`, `scattergeo` and `choropleth` t | dist bundle (minified) | `dist/plotly-geo.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-geo-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-geo-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-geo-1.20.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-geo-1.20.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-geo-1.20.2.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-geo-1.20.2.min.js | | CommonJS | `require('plotly.js/lib/index-geo')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.6 MB | 634.9 kB | 207.1 kB | +| 1.6 MB | 635 kB | 207.1 kB | ### plotly.js gl3d @@ -128,8 +128,8 @@ The `gl3d` partial bundle contains the `scatter`, `scatter3d`, `surface` and `me | dist bundle (minified) | `dist/plotly-gl3d.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-gl3d-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-gl3d-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl3d-1.20.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl3d-1.20.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl3d-1.20.2.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl3d-1.20.2.min.js | | CommonJS | `require('plotly.js/lib/index-gl3d')` | | Raw size | Minified size | Minified + gzip size | @@ -146,13 +146,13 @@ The `gl2d` partial bundle contains the `scatter`, `scattergl`, `pointcloud`, `he | dist bundle (minified) | `dist/plotly-gl2d.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-gl2d-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-gl2d-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl2d-1.20.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl2d-1.20.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl2d-1.20.2.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl2d-1.20.2.min.js | | CommonJS | `require('plotly.js/lib/index-gl2d')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.2 MB | 928.8 kB | 290.7 kB | +| 2.2 MB | 928.9 kB | 290.7 kB | ### plotly.js mapbox @@ -164,8 +164,8 @@ The `mapbox` partial bundle contains the `scatter` and `scattermapbox` trace mod | dist bundle (minified) | `dist/plotly-mapbox.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-mapbox-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-mapbox-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-mapbox-1.20.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-mapbox-1.20.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-mapbox-1.20.2.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-mapbox-1.20.2.min.js | | CommonJS | `require('plotly.js/lib/index-mapbox')` | | Raw size | Minified size | Minified + gzip size | @@ -182,13 +182,13 @@ The `finance` partial bundle contains the `scatter`, `bar`, `histogram`, `pie`, | dist bundle (minified) | `dist/plotly-finance.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-finance-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-finance-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-finance-1.20.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-finance-1.20.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-finance-1.20.2.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-finance-1.20.2.min.js | | CommonJS | `require('plotly.js/lib/index-finance')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.6 MB | 631.6 kB | 203.4 kB | +| 1.6 MB | 631.7 kB | 203.5 kB | ---------------- diff --git a/dist/npm-ls.json b/dist/npm-ls.json index 4554fd70b12..a6aaa45867d 100644 --- a/dist/npm-ls.json +++ b/dist/npm-ls.json @@ -1,6 +1,6 @@ { "name": "plotly.js", - "version": "1.20.1", + "version": "1.20.2", "dependencies": { "3d-view": { "version": "2.0.0", diff --git a/dist/plotly-basic.js b/dist/plotly-basic.js index e967204c0c0..75e96ba9967 100644 --- a/dist/plotly-basic.js +++ b/dist/plotly-basic.js @@ -1,5 +1,5 @@ /** -* plotly.js (basic) v1.20.1 +* plotly.js (basic) v1.20.2 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -19798,9 +19798,18 @@ function handleCartesian(gd, ev) { } } else { - var rangeNow = ax.range; - aobj[axName + '.range[0]'] = r0 * rangeNow[0] + r1 * rangeNow[1]; - aobj[axName + '.range[1]'] = r0 * rangeNow[1] + r1 * rangeNow[0]; + var rangeNow = [ + ax.r2l(ax.range[0]), + ax.r2l(ax.range[1]), + ]; + + var rangeNew = [ + r0 * rangeNow[0] + r1 * rangeNow[1], + r0 * rangeNow[1] + r1 * rangeNow[0] + ]; + + aobj[axName + '.range[0]'] = ax.l2r(rangeNew[0]); + aobj[axName + '.range[1]'] = ax.l2r(rangeNew[1]); } } } @@ -25295,7 +25304,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.20.1'; +exports.version = '1.20.2'; // inject promise polyfill require('es6-promise').polyfill(); @@ -46312,9 +46321,10 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { if(Color.opacity(mc)) pointData.color = mc; else if(Color.opacity(mlc) && mlw) pointData.color = mlc; + var size = (trace.base) ? di.b + di.s : di.s; if(trace.orientation === 'h') { pointData.x0 = pointData.x1 = xa.c2p(di.x, true); - pointData.xLabelVal = di.b + di.s; + pointData.xLabelVal = size; pointData.y0 = ya.c2p(barPos(di) - barDelta, true); pointData.y1 = ya.c2p(barPos(di) + barDelta, true); @@ -46322,7 +46332,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } else { pointData.y0 = pointData.y1 = ya.c2p(di.y, true); - pointData.yLabelVal = di.b + di.s; + pointData.yLabelVal = size; pointData.x0 = xa.c2p(barPos(di) - barDelta, true); pointData.x1 = xa.c2p(barPos(di) + barDelta, true); diff --git a/dist/plotly-basic.min.js b/dist/plotly-basic.min.js index 635e06aa04a..4ca47e0ee47 100644 --- a/dist/plotly-basic.min.js +++ b/dist/plotly-basic.min.js @@ -1,5 +1,5 @@ /** -* plotly.js (basic - minified) v1.20.1 +* plotly.js (basic - minified) v1.20.2 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -12,15 +12,15 @@ var u=s[0],f=s[1],d=u[0]-f[0],h=u[1]-f[1];m=d*d+h*h}}function r(){var t,e,n,r,i= g=Ys[!c<<1|!u],t):u},t.clamp=function(e){return arguments.length?(c&&u?(h=!!e[0],p=!!e[1]):c?h=!!e:u&&(p=!!e),t):c&&u?[h,p]:c?h:u?p:null},t.extent=function(e){var n,r,a,o,s;return arguments.length?(c&&(n=e[0],r=e[1],u&&(n=n[0],r=r[0]),i=[n,r],c.invert&&(n=c(n),r=c(r)),r0&&this._events[t].length>n&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!a(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,l;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||a(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(n)){for(l=o;l-- >0;)if(n[l]===e||n[l].listener&&n[l].listener===e){r=l;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;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(n=this._events[t],a(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],10:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;r13)&&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}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return t-t<1}},{}],11:[function(t,e,n){function r(t,e){var n=e[0],r=e[1],a=e[2],o=e[3],i=n+n,l=r+r,s=a+a,c=n*i,u=r*i,f=r*l,d=a*i,h=a*l,p=a*s,g=o*i,v=o*l,m=o*s;return t[0]=1-f-p,t[1]=u+m,t[2]=d-v,t[3]=0,t[4]=u-m,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+v,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=r},{}],12:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function i(t){if(d===clearTimeout)return clearTimeout(t);if((d===a||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{return d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}function l(){v&&p&&(v=!1,p.length?g=p.concat(g):m=-1,g.length&&s())}function s(){if(!v){var t=o(l);v=!0;for(var e=g.length;e;){for(p=g,g=[];++m1)for(var n=1;n.5?s/(2-o-i):s/(o+i),o){case t:r=(e-n)/s+(e1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var a,o,i;if(t=C(t,360),e=C(e,100),n=C(n,100),0===e)a=o=i=n;else{var l=n<.5?n*(1+e):n+e-n*e,s=2*n-l;a=r(s,l,t+1/3),o=r(s,l,t),i=r(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function s(t,e,n){t=C(t,255),e=C(e,255),n=C(n,255);var r,a,o=U(t,e,n),i=X(t,e,n),l=o,s=o-i;if(a=0===o?0:s/o,o==i)r=0;else{switch(o){case t:r=(e-n)/s+(e>1)+720)%360;--e;)a.h=(a.h+o)%360,i.push(r(a));return i}function A(t,e){e=e||6;for(var n=r(t).toHsv(),a=n.h,o=n.s,i=n.v,l=[],s=1/e;e--;)l.push(r({h:a,s:o,v:i})),i=(i+s)%1;return l}function T(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function C(t,n){O(t)&&(t="100%");var r=P(t);return t=X(n,U(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function S(t){return X(1,U(0,t))}function z(t){return parseInt(t,16)}function O(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function P(t){return"string"==typeof t&&t.indexOf("%")!=-1}function D(t){return 1==t.length?"0"+t:""+t}function N(t){return t<=1&&(t=100*t+"%"),t}function E(t){return e.round(255*parseFloat(t)).toString(16)}function I(t){return z(t)/255}function R(t){return!!W.CSS_UNIT.exec(t)}function F(t){t=t.replace(B,"").replace(q,"").toLowerCase();var e=!1;if(G[t])t=G[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=W.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=W.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=W.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=W.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=W.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=W.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=W.hex8.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),a:I(n[4]),format:e?"name":"hex8"}:(n=W.hex6.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),format:e?"name":"hex"}:(n=W.hex4.exec(t))?{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),a:I(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=W.hex3.exec(t))&&{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),format:e?"name":"hex"}}function j(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var B=/^\s+/,q=/\s+$/,H=0,V=e.round,X=e.min,U=e.max,Z=e.random;r.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,a,o,i,l=this.toRgb();return t=l.r/255,n=l.g/255,r=l.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),i=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),.2126*a+.7152*o+.0722*i},setAlpha:function(t){return this._a=L(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*C(this._r,255))+"%",g:V(100*C(this._g,255))+"%",b:V(100*C(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%)":"rgba("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[u(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),n=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=r(t);n="#"+d(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,a=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return r(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(v,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},r.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?n[a]=t[a]:n[a]=N(t[a]));t=n}return r(t,e)},r.equals=function(t,e){return!(!t||!e)&&r(t).toRgbString()==r(e).toRgbString()},r.random=function(){return r.fromRatio({r:Z(),g:Z(),b:Z()})},r.mix=function(t,e,n){n=0===n?0:n||50;var a=r(t).toRgb(),o=r(e).toRgb(),i=n/100,l={r:(o.r-a.r)*i+a.r,g:(o.g-a.g)*i+a.g,b:(o.b-a.b)*i+a.b,a:(o.a-a.a)*i+a.a};return r(l)},r.readability=function(t,n){var a=r(t),o=r(n);return(e.max(a.getLuminance(),o.getLuminance())+.05)/(e.min(a.getLuminance(),o.getLuminance())+.05)},r.isReadable=function(t,e,n){var a,o,i=r.readability(t,e);switch(o=!1,a=j(n),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},r.mostReadable=function(t,e,n){var a,o,i,l,s=null,c=0;n=n||{},o=n.includeFallbackColors,i=n.level,l=n.size;for(var u=0;uc&&(c=a,s=r(e[u]));return r.isReadable(t,s,{level:i,size:l})||!o?s:(n.includeFallbackColors=!1,r.mostReadable(t,["#fff","#000"],n))};var G=r.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=r.hexNames=T(G),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+r),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})$/}}();"undefined"!=typeof n&&n.exports?n.exports=r:"function"==typeof t&&t.amd?t(function(){return r}):window.tinycolor=r}(Math)},{}],14:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../color"),o=t("../../plots/cartesian/axes"),i=t("./attributes");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,i,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("opacity"),c("align"),c("bgcolor");var f=c("bordercolor"),d=a.opacity(f);c("borderpad");var h=c("borderwidth"),p=c("showarrow");c("text",p?" ":"new text"),c("textangle"),r.coerceFont(c,"font",n.font);for(var g=["x","y"],v=[-10,-30],m={_fullLayout:n},y=0;y<2;y++){var x=g[y],b=o.coerceRef(t,e,m,x,"","paper");if(o.coercePosition(e,m,c,b,x,.5),p){var _="a"+x,w=o.coerceRef(t,e,m,_,"pixel");"pixel"!==w&&w!==b&&(w=e[_]="pixel");var k="pixel"===w?v[y]:.4;o.coercePosition(e,m,c,w,_,k)}else c(x+"anchor")}return r.noneOrAll(t,e,["x","y"]),p&&(c("arrowcolor",d?e.bordercolor:a.defaultLine),c("arrowhead"),c("arrowsize"),c("arrowwidth",2*(d&&h||1)),r.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":115,"../../plots/cartesian/axes":142,"../color":23,"./attributes":16}],15:[function(t,e,n){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z", backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],16:[function(t,e,n){"use strict";var r=t("./arrow_paths"),a=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),i=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:i({},a,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:r.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":112,"../../plots/cartesian/constants":147,"../../plots/font_attributes":162,"./arrow_paths":15}],17:[function(t,e,n){"use strict";function r(t){var e=t._fullLayout;e.annotations.forEach(function(e){var n=o.getFromId(t,e.xref),r=o.getFromId(t,e.yref);if(n||r){var a=(e._xsize||0)/2,i=e._xshift||0,l=(e._ysize||0)/2,s=e._yshift||0,c=a-i,u=a+i,f=l-s,d=l+s;if(e.showarrow){var h=3*e.arrowsize*e.arrowwidth;c=Math.max(c,h),u=Math.max(u,h),f=Math.max(f,h),d=Math.max(d,h)}n&&n.autorange&&o.expand(n,[n.l2c(n.r2l(e.x))],{ppadplus:u,ppadminus:c}),r&&r.autorange&&o.expand(r,[r.l2c(r.r2l(e.y))],{ppadplus:d,ppadminus:f})}})}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.annotations);if(n.length&&t._fullData.length){var l={};n.forEach(function(t){l[t.xref]=!0,l[t.yref]=!0});var s=o.list(t).filter(function(t){return t.autorange&&l[t._id]});if(s.length)return a.syncOrAsync([i,r],t)}}},{"../../lib":115,"../../plots/cartesian/axes":142,"./draw":19}],18:[function(t,e,n){"use strict";var r=t("../../plots/array_container_defaults"),a=t("./annotation_defaults");e.exports=function(t,e){var n={name:"annotations",handleItemDefaults:a};r(t,e,n)}},{"../../plots/array_container_defaults":139,"./annotation_defaults":14}],19:[function(t,e,n){"use strict";function r(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var n=0;n2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}rt.selectAll("tspan.line").attr({y:0,x:0});var r=$.select(".annotation-math-group"),a=!r.empty(),l=h.bBox((a?r:rt).node()),c=l.width,p=l.height,m=Math.round(c+2*tt),y=Math.round(p+2*tt);X._w=c,X._h=p;var b=!1;if(["x","y"].forEach(function(e){var r,a=X[e+"ref"]||e,o=f.getFromId(t,a),i=(Y+("x"===e?0:90))*Math.PI/180,l=m*Math.abs(Math.cos(i))+y*Math.abs(Math.sin(i)),s=X[e+"anchor"];if(o){var c=o.r2fraction(X[e]);if(!o.autorange&&(c<0||c>1)&&(X["a"+e+"ref"]===a?(c=o.r2fraction(X["a"+e]),(c<0||c>1)&&(b=!0)):b=!0,b))return;G[e]=o._offset+o.r2p(X[e]),r=.5}else r=X[e],"y"===e&&(r=1-r),G[e]="x"===e?O.l+O.w*r:O.t+O.h*r;var u=0;X["a"+e+"ref"]===a?G["aa"+e]=o._offset+o.r2p(X["a"+e]):(u=X.showarrow?X["a"+e]:l*n(r,s),G[e]+=u),X["_"+e+"type"]=o&&o.type,X["_"+e+"size"]=l,X["_"+e+"shift"]=u}),b)return void $.remove();var _,w;X.showarrow&&(_=X.axref===X.xref?G.x:u.constrain(G.x-X.ax,1,M.width-1),w=X.ayref===X.yref?G.y:u.constrain(G.y-X.ay,1,M.height-1)),G.x=u.constrain(G.x,1,M.width-1),G.y=u.constrain(G.y,1,M.height-1);var k=tt-l.top,A=tt-l.left;a?r.select("svg").attr({x:tt-1,y:tt}):(rt.attr({x:A,y:k}),rt.selectAll("tspan.line").attr({y:k,x:A})),et.call(h.setRect,J/2,J/2,m-J,y-J);var T=0,L=0;T=X.axref===X.xref?Math.round(G.aax-m/2):Math.round(G.x-m/2),L=X.ayref===X.yref?Math.round(G.aay-y/2):Math.round(G.y-y/2),$.call(u.setTranslate,T,L);var C="annotations["+e+"]",S=function(n,r){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=X.axref===X.xref?G.aax+n:G.x+n,l=X.ayref===X.yref?G.aay+r:G.y+r;var c=u.rotationXYMatrix(Y,a,l),f=u.apply2DTransform(c),h=u.apply2DTransform2(c),p=et.attr("width")/2,g=et.attr("height")/2,m=[[a-p,l-g,a-p,l+g],[a-p,l+g,a+p,l+g],[a+p,l+g,a+p,l-g],[a+p,l-g,a-p,l-g]].map(h);if(!m.reduce(function(t,e){return t^!!o(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){m.forEach(function(t){var e=o(a,l,_,w,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var y=X.arrowwidth,b=X.arrowcolor,k=W.append("g").style({opacity:d.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=k.append("path").attr("d","M"+a+","+l+"L"+_+","+w).style("stroke-width",y+"px").call(d.stroke,d.rgb(b));x(M,X.arrowhead,"end",X.arrowsize);var A=k.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-_)+","+(l-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,S;v.init({element:A.node(),prepFn:function(){var t=u.getTranslate($);L=t.x,S=t.y,T={},U&&U.autorange&&(T[U._name+".autorange"]=!0),Z&&Z.autorange&&(T[Z._name+".autorange"]=!0)},moveFn:function(t,e){k.attr("transform","translate("+t+","+e+")");var n=f(L,S),r=n[0]+t,a=n[1]+e;$.call(u.setTranslate,r,a),T[C+".x"]=U?U.p2r(U.r2p(X.x)+t):(_+t-O.l)/O.w,T[C+".y"]=Z?Z.p2r(Z.r2p(X.y)+e):1-(w+e-O.t)/O.h,X.axref===X.xref&&(T[C+".ax"]=U?U.p2r(U.r2p(X.ax)+t):(_+t-O.l)/O.w),X.ayref===X.yref&&(T[C+".ay"]=Z?Z.p2r(Z.r2p(X.ay)+e):1-(w+e-O.t)/O.h),Q.attr({transform:"rotate("+Y+","+r+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};X.showarrow&&S(0,0);var z=u.rotationXYMatrix(Y,G.x,G.y),P=u.apply2DTransform(z);if(t._context.editable){var D,N,E;v.init({element:$.node(),prepFn:function(){var t=u.getTranslate($);D=t.x,N=t.y,E={}},moveFn:function(t,e){$.call(u.setTranslate,D+t,N+e);var n="pointer";if(X.showarrow)X.axref===X.xref?E[C+".ax"]=U.p2r(U.r2p(X.ax)+t):E[C+".ax"]=X.ax+t,X.ayref===X.yref?E[C+".ay"]=Z.p2r(Z.r2p(X.ay)+e):E[C+".ay"]=X.ay+e,S(t,e);else{if(U)E[C+".x"]=X.x+t/U._m;else{var r=X._xsize/O.w,a=X.x+X._xshift/O.w-r/2;E[C+".x"]=v.align(a+t/O.w,r,0,1,X.xanchor)}if(Z)E[C+".y"]=X.y+e/Z._m;else{var o=X._ysize/O.h,i=X.y-X._yshift/O.h-o/2;E[C+".y"]=v.align(i-e/O.h,o,0,1,X.yanchor)}U&&Z||(n=v.getCursor(U?.5:E[C+".x"],Z?.5:E[C+".y"],X.xanchor,X.yanchor))}var l=P(D,N),s=l[0]+t,c=l[1]+e;$.call(u.setTranslate,D+t,N+e),Q.attr({transform:"rotate("+Y+","+s+","+c+")"}),g($,n)},doneFn:function(e){if(g($),e){s.relayout(t,E);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var w,k=t.layout,M=t._fullLayout;if(!l(e)||e===-1){if(!e&&Array.isArray(c))return k.annotations=c,y(k,M),void r(t);if("remove"===c)return delete k.annotations,M.annotations=[],void r(t);if(n&&"add"!==c){for(w=0;we;w--)M._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),a(t,w)}}M._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=k.annotations[e],L=M.annotations[e];if(T){var C={};"string"==typeof n&&n?C[n]=c:u.isPlainObject(n)&&(C=n);var S=Object.keys(C);for(w=0;w4/3&&(R=H)}}else I&&(j&&(R<1/3?R+=q:R>2/3&&(R-=q)),R=(R-I.domain[0])/(I.domain[1]-I.domain[0]),R=I.fraction2r(R))}I&&I===E&&F&&("log"===F&&"log"!==I.type?R=Math.pow(10,R):"log"!==F&&"log"===I.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),T[N]=R}}var X={};m(T,X,M),M.annotations[e]=X;var U=f.getFromId(t,X.xref),Z=f.getFromId(t,X.yref),G={x:0,y:0},Y=+X.textangle||0,W=M._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",X.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:X})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),J=X.borderwidth,K=X.borderpad,tt=J+K,et=$.append("rect").attr("class","bg").style("stroke-width",J+"px").call(d.stroke,X.bordercolor).call(d.fill,X.bgcolor),nt=X.font,rt=$.append("text").classed("annotation",!0).attr("data-unformatted",X.text).text(X.text);t._context.editable?rt.call(p.makeEditable,$).call(b).on("edit",function(n){X.text=n,this.attr({"data-unformatted":X.text}),this.call(b);var r={};r["annotations["+e+"].text"]=X.text,U&&U.autorange&&(r[U._name+".autorange"]=!0),Z&&Z.autorange&&(r[Z._name+".autorange"]=!0),s.relayout(t,r)}):rt.call(b),Q.attr({transform:"rotate("+Y+","+G.x+","+G.y+")"}).call(h.setPosition,G.x,G.y)}}}function o(t,e,n,r,a,o,i,l){var s=n-t,c=a-t,u=i-a,f=r-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,v=(c*f-s*d)/p;return v<0||v>1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:r,drawOne:a}},{"../../lib":115,"../../lib/setcursor":125,"../../lib/svg_text_utils":127,"../../plotly":137,"../../plots/cartesian/axes":142,"../../plots/plots":166,"../color":23,"../dragelement":44,"../drawing":46,"./annotation_defaults":14,"./defaults":18,"./draw_arrow_head":20,d3:7,"fast-isnumeric":10}],20:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../color"),i=t("../drawing"),l=t("./arrow_paths");e.exports=function(t,e,n,s){a(s)||(s=1);var c=t.node(),u=l[e||0];if(u){"string"==typeof n&&n||(n="end");var f,d,h,p,g=(i.getPx(t,"stroke-width")||1)*s,v=t.style("stroke")||o.defaultLine,m=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,b=u.backoff*g;if("line"===c.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},d={x:+t.attr("x2"),y:+t.attr("y2")},h=Math.atan2(f.y-d.y,f.x-d.x),p=h+Math.PI,b){var _=b*Math.cos(h),w=b*Math.sin(h);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(d.x+=_,d.y+=w,t.attr({x2:d.x,y2:d.y}))}}else if("path"===c.nodeName){var k=c.getTotalLength(),M="";if(y){var A=c.getPointAtLength(0),T=c.getPointAtLength(.1);h=Math.atan2(A.y-T.y,A.x-T.x),f=c.getPointAtLength(Math.min(b,k)),b&&(M="0px,"+b+"px,")}if(x){var L=c.getPointAtLength(k),C=c.getPointAtLength(k-.1);if(p=Math.atan2(L.y-C.y,L.x-C.x),d=c.getPointAtLength(Math.max(0,k-b)),b){var S=M?2*b:b;M+=k-S+"px,"+k+"px"}}else M&&(M+=k+"px");M&&t.style("stroke-dasharray",M)}var z=function(n,a){e>5&&(a=0),r.select(c.parentElement).append("path").attr({class:t.attr("class"),d:u.path,transform:"translate("+n.x+","+n.y+")rotate("+180*a/Math.PI+")scale("+g+")"}).style({fill:v,opacity:m,"stroke-width":0})};y&&z(f,h),x&&z(d,p)}}},{"../color":23,"../drawing":46,"./arrow_paths":15,d3:7,"fast-isnumeric":10}],21:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":16,"./calc_autorange":17,"./defaults":18,"./draw":19}],22:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],23:[function(t,e,n){"use strict";function r(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===r.length;if(!a&&3!==r.length)return t;for(var i=0;i=0))return t;if(3===i)r[i]>1&&(r[i]=1);else if(r[i]>=1)return t}var l=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return a?"rgba("+l+", "+r[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var n=a(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},i.combine=function(t,e){var n=a(t).toRgb();if(1===n.a)return a(t).toRgbString();var r=a(e||i.background).toRgb(),o=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},l={r:o.r*(1-n.a)+n.r*n.a,g:o.g*(1-n.a)+n.g*n.a,b:o.b*(1-n.a)+n.b*n.a};return a(l).toRgbString()},i.contrast=function(t,e,n){var r=a(t),o=r.isLight()?r.darken(n):r.lighten(e);return o.toString()},i.stroke=function(t,e){var n=a(e);t.style({stroke:i.tinyRGB(n),"stroke-opacity":n.getAlpha()})},i.fill=function(t,e){var n=a(e);t.style({fill:i.tinyRGB(n),"fill-opacity":n.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,n,a,o,l=Object.keys(t);for(e=0;el&&(o[1]-=(lt-l)/2)):n.node()&&!n.classed("js-placeholder")&&(lt=h.bBox(e.node()).height),lt){if(lt+=5,"top"===_.titleside)K.domain[1]-=lt/T.h,o[1]*=-1;else{K.domain[0]+=lt/T.h;var c=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),K.setScale()}}ot.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-K.domain[1]))+")");var f=ot.select(".cbfills").selectAll("rect.cbfill").data(z);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?C[0]:(z[e]+z[e-1])/2,e===z.length-1?C[1]:(z[e]+z[e+1])/2].map(K.c2p).map(Math.round);e!==z.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=P(t).replace("e-",""),i=a(o).toHexString();r.select(this).attr({x:G,width:Math.max(B,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var d=ot.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){r.select(this).attr("d","M"+G+","+(Math.round(K.c2p(t))+_.line.width/2%1)+"h"+B).call(h.lineGroupStyle,_.line.width,O(t),_.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=G+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=K.titlefont.size,n=K._offset+K._length/2,a=T.l+(K.position||0)*T.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));k("h"+K._id+"title",{avoid:{selection:r.select(t).selectAll("g."+K._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:A.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function k(e,n){var r,a=b();r=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:K,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:ot.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;ot.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,n||{}))}function M(){var n=B+_.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(R=it.select("text"),R.node()&&!R.classed("js-placeholder")){var r,a=it.select(".h"+K._id+"title-math-group").node();r=a&&["top","bottom"].indexOf(_.titleside)!==-1?h.bBox(a).width:h.bBox(it.node()).right-G-T.l,n=Math.max(n,r)}var o=2*_.xpad+n+_.borderwidth+_.outlinewidth/2,l=Q-$;ot.select(".cbbg").attr({x:G-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-U,width:Math.max(o,2),height:Math.max(l+2*U,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),ot.selectAll(".cboutline").attr({x:G,y:$+_.ypad+("top"===_.titleside?lt:0),width:Math.max(B,2),height:Math.max(l-2*_.ypad-lt,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var s=({center:.5,right:1}[_.xanchor]||0)*o;ot.attr("transform","translate("+(T.l-s)+","+T.t+")"),i.autoMargin(t,e,{x:_.x,y:_.y,l:o*({right:1,center:.5}[_.xanchor]||0),r:o*({left:1,center:.5}[_.xanchor]||0),t:l*({bottom:1,middle:.5}[_.yanchor]||0),b:l*({top:1,middle:.5}[_.yanchor]||0)})}var A=t._fullLayout,T=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var L,C=r.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],z=[],O="function"==typeof _.line.color?_.line.color:function(){return _.line.color},P="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},D=_.levels.end+_.levels.size/100,N=_.levels.size,E=1.001*C[0]-.001*C[1],I=1.001*C[1]-.001*C[0];for(L=_.levels.start;(L-D)*N<0;L+=N)L>E&&LC[0]&&L1){var at=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));et*=at*u.roundUp(rt/at,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+Z,W+V-Z],K.setScale();var ot=A._infolayer.selectAll("g."+e).data([0]);ot.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),ot.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var it=ot.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");K._axislayer=ot.select(".cbaxis");var lt=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var st,ct=T.l+(_.x+X)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-Z))*T.h+T.t+3+.75*ut:(1-(W+Z))*T.h+T.t-3-.25*ut,k(K._id+"title",{attributes:{x:ct,y:st,"text-anchor":"start"}})}var ft=u.syncOrAsync([i.previousPromises,w,i.previousPromises,M],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var dt,ht,pt;c.init({element:ot.node(),prepFn:function(){dt=ot.attr("transform"),d(ot)},moveFn:function(t,e){ot.attr("transform",dt+" translate("+t+","+e+")"),ht=c.align(Y+t/T.w,q,0,1,_.xanchor),pt=c.align(W-e/T.h,V,0,1,_.yanchor);var n=c.getCursor(ht,pt,_.xanchor,_.yanchor);d(ot,n)},doneFn:function(e){d(ot),e&&void 0!==ht&&void 0!==pt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":pt},b().index)}})}return ft}function b(){var n,r,a=e.substr(2);for(n=0;n=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":115,"./flip_scale":34,"./scales":41}],30:[function(t,e,n){"use strict";var r=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},r.colorscale,{}),cauto:a({},r.zauto,{}),cmax:a({},r.zmax,{}),cmin:a({},r.zmin,{}),autocolorscale:a({},r.autocolorscale,{}),reversescale:a({},r.reversescale,{})}}},{"../../lib/extend":112,"./attributes":28,"./scales.js":41}],31:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":41}],32:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,n,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,v=p[d+"min"],m=p[d+"max"],y=p.colorscale,x=r(v)&&r(m)&&v=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],35:[function(t,e,n){"use strict";var r=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=a),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":31,"./is_valid_scale_array":39,"./scales":41}],36:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?a.nestedProperty(t,e).get()||{}:t,i=n.color,l=!1;if(Array.isArray(i))for(var s=0;s4/3-l?i:l}},{}],43:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":115}],44:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},v=1,m=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=r},{"../../lib":115,"../../plotly":137,"../../plots/cartesian/constants":147,"./align":42,"./cursor":43,"./unhover":45}],45:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":111}],46:[function(t,e,n){"use strict";function r(t,e,n,r,a,o,i){if(l.traceIs(n,"symbols")){var c=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(n)?c(t.ms):(o.size||6)/2,t.mrc=e;var r=g.symbolNumber(t.mx||o.symbol)||0,a=r%100;return t.om=r%200>=100,g.symbolFuncs[a](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=r(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,n,r){var a=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(s.fill,r)},g.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},g.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},g.setRect=function(t,e,n,r,a){t.call(g.setPosition,e,n).call(g.setSize,r,a)},g.translatePoint=function(t,e,n,r){var a=t.xp||n.c2p(t.x),o=t.yp||r.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,n,r){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,n,r)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,n){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},g.singleLineStyle=function(t,e,n,r,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=n||o.width||0,l=a||o.dash||"";s.stroke(e,r||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=r||a.dash||"";o.select(this).call(s.stroke,n||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=o.select(this);try{n.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),n.remove()}})};var v=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,n){var a=n.marker,o=a.line,i=g.tryColorscale(a,""),l=g.tryColorscale(a,"line");r(t,e,n,i,l,a,o)},g.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=g.tryColorscale(n,""),a=g.tryColorscale(n,"line");t.each(function(t){g.singlePointStyle(t,o.select(this),e,r,a)})}},g.tryColorscale=function(t,e){var n=e?u.nestedProperty(t,e).get():t,r=n.colorscale,a=n.color;return r&&Array.isArray(a)?c.makeColorScaleFunc(c.extractScale(r,n.cmin,n.cmax)):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var n=o.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,n.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(f.convertToTspans);var d=o.select(this.parentNode),h=n.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,v=x[s]*u,m=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+v+","+m+")"),p>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],o=[];for(n=1;n=A&&(o.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=o.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":105,"../../lib":115,"../../lib/svg_text_utils":127,"../../registry":173,"../../traces/scatter/make_bubble_size_func":222,"../../traces/scatter/subtypes":227,"../color":23,"../colorscale":37,"./symbol_defs":47,d3:7,"fast-isnumeric":10}],47:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:7}],48:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],49:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&["linear","log"].indexOf(n.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);u&&v.style("opacity",0).transition().duration(n.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=r(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");l=!v.size(),l?v=e.append("path").classed("yerror",!0):u&&(v=v.transition().duration(n.duration).ease(n.easing)),v.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var m=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-m)+"v"+2*m+"m0,-"+m+"H"+i.xs,i.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":227,d3:7,"fast-isnumeric":10}],54:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":23,d3:7}],55:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":147}],56:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,l,n,r)}var i=r("source"),s=r("visible",!!i);if(!s)return e;r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var c={_fullLayout:n},u=["x","y"],f=0;f<2;f++)o.coerceRef(t,e,c,u[f],"paper");return e}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("../../plots/array_container_defaults"),l=t("./attributes"),s="images";e.exports=function(t,e){var n={name:s,handleItemDefaults:r};i(t,e,n)}},{"../../lib":115,"../../plots/array_container_defaults":139,"../../plots/cartesian/axes":142,"./attributes":55}],57:[function(t,e,n){"use strict";var r=t("d3"),a=t("../drawing"),o=t("../../plots/cartesian/axes"),i=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var n=r.select(this);if(!this.img||this.img.src!==e.source){n.attr("xmlns",i.svg);var a=new Promise(function(t){function r(){n.remove(),t()}var a=new Image;this.img=a,a.setAttribute("crossOrigin","anonymous"),a.onerror=r,a.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var r=t.toDataURL("image/png");n.attr("xlink:href",r)},n.on("error",r),n.on("load",t),a.src=e.source}.bind(this));t._promises.push(a)}}function n(e){var n=r.select(this),i=o.getFromId(t,e.xref),s=o.getFromId(t,e.yref),c=l._size,u=i?Math.abs(i.l2p(e.sizex)-i.l2p(0)):e.sizex*c.w,f=s?Math.abs(s.l2p(e.sizey)-s.l2p(0)):e.sizey*c.h,d=u*h.x[e.xanchor].offset,p=f*h.y[e.yanchor].offset,g=h.x[e.xanchor].sizing+h.y[e.yanchor].sizing,v=(i?i.r2p(e.x)+i._offset:e.x*c.w+c.l)+d,m=(s?s.r2p(e.y)+s._offset:c.h-e.y*c.h+c.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}n.attr({x:v,y:m,width:u,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=i?i._id:"",x=s?s._id:"",b=y+x;b&&n.call(a.setClipUrl,"clip"+l._uid+b)}for(var l=t._fullLayout,s=[],c=[],u=[],f=0;f=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],60:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":112,"../../plots/font_attributes":162,"../color/attributes":22}],61:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],62:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",v),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":115,"../../plots/layout_attributes":164,"../../registry":173,"./attributes":60,"./helpers":65}],63:[function(t,e,n){"use strict";function r(t,e){function n(n){m.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(m.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,v+=m,a.height=a.height+m,m=0),f.setTranslate(this,o+x,5+o+e.height/2+v),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,m=Math.max(e.height,m)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,j,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:m.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var m=n.legend,_=n.showlegend&&x(t.calcdata,m),k=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=n._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=M.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=L.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var z=S.selectAll("g.traces").data(f.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,S,z),l(t));var P=0,D=n.width,N=0,E=n.height;i(t,S,z),m.height>E?s(t):l(t);var I=n._size,R=I.l+I.w*m.x,F=I.t+I.h*(1-m.y);w.isRightAnchor(m)?R-=m.width:w.isCenterAnchor(m)&&(R-=m.width/2),w.isBottomAnchor(m)?F-=m.height:w.isMiddleAnchor(m)&&(F-=m.height/2);var j=m.width,B=I.w;j>B?(R=I.l,j=B):(R+j>D&&(R=D-j),RH?(F=I.t,q=H):(F+q>E&&(F=E-q),Fn[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var v=s.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(l?r:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=v.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":115,"../../registry":173,"../../traces/pie/style_one":205,"../../traces/scatter/subtypes":227,"../color":23,"../drawing":46,d3:7}],68:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(v,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var m=a(l),y=[];return((c||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||m||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(v,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var v=u("bgcolor");u("activecolor",i.contrast(v,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":115,"../color":23,"./attributes":72,"./button_attributes":73,"./constants":74}],76:[function(t,e,n){"use strict";function r(t){for(var e=m.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},a=S.line.width?S.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",S.opacity).call(_.stroke,a).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);z&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&f(t,o,S,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof n&&n?s[n]=r:x.isPlainObject(n)&&(s=n);var c=Object.keys(s);for(o=0;oZ&&r>G&&!t.shiftKey?k.getCursor(a/n,1-o/r):"move";M(e,i),U=i.split("-")[0]}function o(e){j=b.getFromId(t,n.xref),B=b.getFromId(t,n.yref),q=T.getDataToPixel(t,j),H=T.getDataToPixel(t,B,!0),V=T.getPixelToData(t,j),X=T.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(R=n.path,F=o+".path"):(u=q(n.x0),f=H(n.y0),d=q(n.x1),h=H(n.y1),g=o+".x0",m=o+".y0",x=o+".x1",_=o+".y1"),uG&&(c[S]=n[D]=X(l),c[z]=n[N]=X(s)),f-u>Z&&(c[O]=n[E]=V(u),c[P]=n[I]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,m,x,_,w,A,L,C,S,z,O,P,D,N,E,I,R,F,j,B,q,H,V,X,U,Z=10,G=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();k.init(Y)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,v=(d+h)/2,m=Math.abs(p-u),y=Math.abs(v-d),x="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function v(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var m=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults");e.exports={draw:r,drawOne:a}},{"../../lib":115,"../../lib/setcursor":125,"../../plotly":137,"../../plots/cartesian/axes":142,"../color":23,"../dragelement":44,"../drawing":46,"./constants":86,"./defaults":87,"./helpers":89,"./shape_defaults":91,"fast-isnumeric":10}],89:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],90:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":84,"./calc_autorange":85,"./defaults":87,"./draw":88}],91:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],v={_fullLayout:n},m=a.coerceRef(t,e,v,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==m?(y=a.getFromId(v,m),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=r.identity;var k=g+"0",M=g+"1",A=t[k],T=t[M];t[k]=x(t[k],!0),t[M]=x(t[M],!0),a.coercePosition(e,v,c,m,k,_),a.coercePosition(e,v,c,m,M,w),e[k]=b(e[k]),e[M]=b(e[M]),t[k]=A,t[M]=T}}return"path"===d?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":115,"../../plots/cartesian/axes":142,"./attributes":84,"./helpers":89}],92:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":112,"../../plots/animation_attributes":138,"../../plots/font_attributes":162,"../../plots/pad_attributes":165,"./constants":93}],93:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],94:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+S.railTouchRectClass).data([0]);r.enter().append("rect").classed(S.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,S.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0), -M.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+S.railRectClass).data([0]);n.enter().append("rect").classed(S.railRectClass,!0);var r=e.inputAreaLength-2*S.railInset;n.attr({width:r,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(n,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+S.groupClassName).data(n,a);s.enter().append("g").classed(S.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,S=O,k._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,v=n.propName,m=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(S).attr("class",e),z.attr({"data-unformatted":S}).call(f);var O="Click to enter "+y+" title";t._context.editable?(S||p(),z.call(u.makeEditable).on("edit",function(e){void 0!==m?o.restyle(t,v,e,m):o.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",C)}},{"../../lib":115,"../../lib/svg_text_utils":127,"../../plotly":137,"../../plots/plots":166,"../color":23,"../drawing":46,d3:7,"fast-isnumeric":10}],98:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":112,"../../plots/font_attributes":162,"../../plots/pad_attributes":165,"../color/attributes":22}],99:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],100:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],105:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],106:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":21,"./components/images":58,"./components/legend":66,"./components/rangeselector":78,"./components/rangeslider":83,"./components/shapes":90,"./components/sliders":96,"./components/updatemenus":102,"./fonts/mathjax_config":107,"./lib/queue":123,"./plot_api/plot_schema":131,"./plot_api/register":132,"./plot_api/set_plot_config":133,"./plot_api/to_image":135,"./plot_api/validate":136,"./plotly":137,"./snapshot":178,"./snapshot/download":175,"./traces/scatter":217,d3:7,"es6-promise":8}],107:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],108:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":103,"fast-isnumeric":10}],109:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(o(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,r,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var v=(new Date).getFullYear();e=((Number(c[0])-v+70)%100+200)%100+v-70}if(!o(e))return s;var m=new Date(0,0,1);if(m.setFullYear(u?e:-e),c.length>1){if(r=Number(c[1])-1,c[1].length>2||!(r>=0&&r<=11))return s;if(m.setMonth(r),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(m.setDate(a),m.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(m.setHours(i),m.getHours()!==i)return s;if(c.length>1)return a=m.getTime(),r=Number(c[1]),2===c[1].length&&r>=0&&r<=59?(a+=f*r,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return m.getTime()},h=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==s};var g=90*c,v=3*u,m=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var n=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(n),i=en?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",v),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":115,"../../plots/layout_attributes":164,"../../registry":173,"./attributes":60,"./helpers":65}],63:[function(t,e,n){"use strict";function r(t,e){function n(n){m.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(m.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,v+=m,a.height=a.height+m,m=0),f.setTranslate(this,o+x,5+o+e.height/2+v),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,m=Math.max(e.height,m)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,j,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:m.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var m=n.legend,_=n.showlegend&&x(t.calcdata,m),k=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=n._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=M.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=L.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var z=S.selectAll("g.traces").data(f.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,S,z),l(t));var P=0,D=n.width,N=0,E=n.height;i(t,S,z),m.height>E?s(t):l(t);var I=n._size,R=I.l+I.w*m.x,F=I.t+I.h*(1-m.y);w.isRightAnchor(m)?R-=m.width:w.isCenterAnchor(m)&&(R-=m.width/2),w.isBottomAnchor(m)?F-=m.height:w.isMiddleAnchor(m)&&(F-=m.height/2);var j=m.width,B=I.w;j>B?(R=I.l,j=B):(R+j>D&&(R=D-j),RH?(F=I.t,q=H):(F+q>E&&(F=E-q),Fn[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var v=s.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(l?r:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=v.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":115,"../../registry":173,"../../traces/pie/style_one":205,"../../traces/scatter/subtypes":227,"../color":23,"../drawing":46,d3:7}],68:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(v,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var m=a(l),y=[];return((c||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||m||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(v,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var v=u("bgcolor");u("activecolor",i.contrast(v,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":115,"../color":23,"./attributes":72,"./button_attributes":73,"./constants":74}],76:[function(t,e,n){"use strict";function r(t){for(var e=m.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},a=S.line.width?S.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",S.opacity).call(_.stroke,a).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);z&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&f(t,o,S,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof n&&n?s[n]=r:x.isPlainObject(n)&&(s=n);var c=Object.keys(s);for(o=0;oZ&&r>G&&!t.shiftKey?k.getCursor(a/n,1-o/r):"move";M(e,i),U=i.split("-")[0]}function o(e){j=b.getFromId(t,n.xref),B=b.getFromId(t,n.yref),q=T.getDataToPixel(t,j),H=T.getDataToPixel(t,B,!0),V=T.getPixelToData(t,j),X=T.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(R=n.path,F=o+".path"):(u=q(n.x0),f=H(n.y0),d=q(n.x1),h=H(n.y1),g=o+".x0",m=o+".y0",x=o+".x1",_=o+".y1"),uG&&(c[S]=n[D]=X(l),c[z]=n[N]=X(s)),f-u>Z&&(c[O]=n[E]=V(u),c[P]=n[I]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,m,x,_,w,A,L,C,S,z,O,P,D,N,E,I,R,F,j,B,q,H,V,X,U,Z=10,G=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();k.init(Y)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,v=(d+h)/2,m=Math.abs(p-u),y=Math.abs(v-d),x="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function v(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var m=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults");e.exports={draw:r,drawOne:a}},{"../../lib":115,"../../lib/setcursor":125,"../../plotly":137,"../../plots/cartesian/axes":142,"../color":23,"../dragelement":44,"../drawing":46,"./constants":86,"./defaults":87,"./helpers":89,"./shape_defaults":91,"fast-isnumeric":10}],89:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],90:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":84,"./calc_autorange":85,"./defaults":87,"./draw":88}],91:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],v={_fullLayout:n},m=a.coerceRef(t,e,v,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==m?(y=a.getFromId(v,m),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=r.identity;var k=g+"0",M=g+"1",A=t[k],T=t[M];t[k]=x(t[k],!0),t[M]=x(t[M],!0),a.coercePosition(e,v,c,m,k,_),a.coercePosition(e,v,c,m,M,w),e[k]=b(e[k]),e[M]=b(e[M]),t[k]=A,t[M]=T}}return"path"===d?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":115,"../../plots/cartesian/axes":142,"./attributes":84,"./helpers":89}],92:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":112,"../../plots/animation_attributes":138,"../../plots/font_attributes":162,"../../plots/pad_attributes":165,"./constants":93}],93:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],94:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+S.railTouchRectClass).data([0]);r.enter().append("rect").classed(S.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,S.tickOffset+n.ticklen+n.labelHeight) +}).call(A.fill,n.bgcolor).attr("opacity",0),M.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+S.railRectClass).data([0]);n.enter().append("rect").classed(S.railRectClass,!0);var r=e.inputAreaLength-2*S.railInset;n.attr({width:r,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(n,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+S.groupClassName).data(n,a);s.enter().append("g").classed(S.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,S=O,k._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,v=n.propName,m=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(S).attr("class",e),z.attr({"data-unformatted":S}).call(f);var O="Click to enter "+y+" title";t._context.editable?(S||p(),z.call(u.makeEditable).on("edit",function(e){void 0!==m?o.restyle(t,v,e,m):o.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",C)}},{"../../lib":115,"../../lib/svg_text_utils":127,"../../plotly":137,"../../plots/plots":166,"../color":23,"../drawing":46,d3:7,"fast-isnumeric":10}],98:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":112,"../../plots/font_attributes":162,"../../plots/pad_attributes":165,"../color/attributes":22}],99:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],100:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],105:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],106:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":21,"./components/images":58,"./components/legend":66,"./components/rangeselector":78,"./components/rangeslider":83,"./components/shapes":90,"./components/sliders":96,"./components/updatemenus":102,"./fonts/mathjax_config":107,"./lib/queue":123,"./plot_api/plot_schema":131,"./plot_api/register":132,"./plot_api/set_plot_config":133,"./plot_api/to_image":135,"./plot_api/validate":136,"./plotly":137,"./snapshot":178,"./snapshot/download":175,"./traces/scatter":217,d3:7,"es6-promise":8}],107:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],108:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":103,"fast-isnumeric":10}],109:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(o(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,r,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var v=(new Date).getFullYear();e=((Number(c[0])-v+70)%100+200)%100+v-70}if(!o(e))return s;var m=new Date(0,0,1);if(m.setFullYear(u?e:-e),c.length>1){if(r=Number(c[1])-1,c[1].length>2||!(r>=0&&r<=11))return s;if(m.setMonth(r),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(m.setDate(a),m.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(m.setHours(i),m.getHours()!==i)return s;if(c.length>1)return a=m.getTime(),r=Number(c[1]),2===c[1].length&&r>=0&&r<=59?(a+=f*r,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return m.getTime()},h=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==s};var g=90*c,v=3*u,m=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var n=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(n),i=en?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"./clean_number":108,"./coerce":109,"./dates":110,"./extend":112,"./filter_unique":113,"./filter_visible":114,"./is_array":116,"./is_plain_object":117,"./loggers":118,"./matrix":119,"./nested_property":120,"./notifier":121,"./search":124,"./stats":126,d3:7}],116:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],117:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],118:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],i=!1,d(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");lo||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],s=t[1];if(no||sl)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],v=r[0][1],m=0;for(c=1;cMath.max(u,g)||s>Math.max(f,v)))if(su||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":119}],123:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;f90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":10}],127:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,v.indexOf(u.protocol)===-1?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var v=d.getPlotDiv(l.node());(v&&v._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],v=parseInt(l.style("font-size"),10)||r(l,"height"),m=-v/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,m-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:m-d/2}):"a"===p[0]?s.attr({x:0,y:m}):s.attr({x:g,y:+l.attr("y")+m-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(m," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":104,"../constants/xmlns_namespaces":105,"../lib":115,d3:7}],128:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function a(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var a=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=u.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&l(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sO.range[0]?[1,2]:[2,1]);else{var P=O.range[0],D=O.range[1];"log"===b?(P<=0&&D<=0&&n(L+".autorange",!0),P<=0?P=D/1e6:D<=0&&(D=P/1e6),n(L+".range[0]",Math.log(P)/Math.LN10),n(L+".range[1]",Math.log(D)/Math.LN10)):(n(L+".range[0]",Math.pow(10,P)),n(L+".range[1]",Math.pow(10,D)))}else n(L+".autorange",!0)}if("reverse"===A)C.range?C.range.reverse():(n(L+".autorange",!0),C.range=[1,0]),S.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var N=m.parts[1],E=m.parts[0],I=o[E]||[],R=I[N]||{};2===m.parts.length&&(null===b&&(e[v]="remove"),"add"===e[v]||x.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?N===-1?(g[E]=I,delete g[v]):g[v]=R:x.log("???",e)),!r(R,"x")&&!r(R,"y")||x.containsAny(v,["color","opacity","align","dash"])||(h.docalc=!0);var F=w.getComponentMethod(E,"drawOne");F(t,N,m.parts.slice(2).join("."),e[v]),delete e[v]}else if(k.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1])z.manageArrayContainers(m,b,g),h.doplot=!0;else{var j=String(m.parts[1]||"");0===m.parts[0].indexOf("scene")?h.doplot=!0:0===m.parts[0].indexOf("geo")?h.doplot=!0:0===m.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===v?h.doplot=!0:!i._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?h.docalc=!0:m.parts[0].indexOf("legend")!==-1?h.dolegend=!0:v.indexOf("title")!==-1?h.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:m.parts.length>1&&x.containsAny(j,["tick","exponent","grid","zeroline"])?h.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:m.parts.length>1&&j.indexOf("line")!==-1?h.dolayoutstyle=!0:m.parts.length>1&&"mirror"===j?h.doticks=h.dolayoutstyle=!0:"margin.pad"===v?h.doticks=h.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(h.doplot=!0):h.doplot=!0,m.set(b)}}}var B=t._fullLayout.width,q=t._fullLayout.height;k.supplyDefaults(t),t.layout.autosize&&k.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==q;return H&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=v.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];v.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(C.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var o=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=o.append("g").classed("imagelayer",!0),n._shapeUpperLayer=o.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),k=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),C=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),z=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,n,r){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=P._basePlotModules,n=0;n=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=z.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),n=k.supplyAnimationDefaults(n);var l=n.transition,s=n.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){if(0!==i._frameQueue.length){for(;i._frameQueue.length;){var e=i._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var l=0;li._timeToNext&&h()};e()}function g(t){return Array.isArray(l)?y>=l.length?t.transitionOpts=l[y]:t.transitionOpts=l[0]:t.transitionOpts=l,y++,t}var v,m,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&x.isPlainObject(e);if(M)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(v=0;v0&&LL)&&C.push(m);b=C}}b.length>0?f(b):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,n){if(t=z.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,a,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(r=e.length-1;r>=0;r--)u.push({frame:k.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:c+r});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(a=u[r].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=k.modifyFrames,s=k.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),k.modifyFrames(t,o)},y.purge=function(t){t=z.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return k.cleanPlot([],{},n,e),k.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":46,"../components/errorbars":52,"../constants/xmlns_namespaces":105,"../lib":115,"../lib/events":111,"../lib/queue":123,"../lib/svg_text_utils":127,"../plotly":137,"../plots/cartesian/graph_interact":149,"../plots/plots":166,"../plots/polar":169,"../registry":173,"./helpers":128,"./subroutines":134,d3:7,"fast-isnumeric":10}],130:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],131:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:y},n={}):(e=d.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,_(r,p),_(r,e.attributes),n.attributes&&_(r,n.attributes),r.type=t;var a={meta:e.meta||{},attributes:i(r)};if(e.layoutAttributes){var o={};_(o,e.layoutAttributes),a.layoutAttributes=i(o)}return a}function a(){var t={};return _(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var n=d.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)u(t,n,"xaxis"),u(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;u(t,n,r)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.layoutAttributes&&(Array.isArray(n.layoutNodes)?n.layoutNodes.forEach(function(e){f(t,n,e+n.name)}):f(t,n,n.name))}),{layoutAttributes:i(t)}}function o(t){var e=d.transformsRegistry[t];return{attributes:i(e.attributes)}}function i(t){return l(t),s(t),t}function l(t){function e(t){return{valType:"string"}}function r(t,r,a){n.isValObject(t)?"data_array"===t.valType?(t.role="data",a[r+"src"]=e(r)):t.arrayOk===!0&&(a[r+"src"]=e(r)):h.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function s(t){function e(t,e,n){if(t){var r=t[k];r&&(delete t[k],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function c(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function u(t,e,n){var r=h.nestedProperty(t,n),a=_({},e.layoutAttributes);a[w]=!0,r.set(a)}function f(t,e,n){var r=h.nestedProperty(t,n),a=_(r.get()||{},e.layoutAttributes);r.set(a)}var d=t("../registry"),h=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),m=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=h.extendFlat,_=h.extendDeep,w="_isSubplotObj",k="_isLinkedToArray",M="_deprecated",A=[w,k,M];n.IS_SUBPLOT_OBJ=w,n.IS_LINKED_TO_ARRAY=k,n.DEPRECATED=M,n.UNDERSCORE_ATTRS=A,n.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:h.valObjects,metaKeys:A.concat.role},traces:t,layout:a(),transforms:e,frames:i(v),animation:i(m)}},n.crawl=function(t,e,r){var a=r||0;Object.keys(t).forEach(function(r){var o=t[r];A.indexOf(r)===-1&&(e(o,r,t,a),n.isValObject(o)||h.isPlainObject(o)&&n.crawl(o,e,a+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,i,l){o=o.slice(0,l).concat([n]);var s="data_array"===e.valType||e.arrayOk===!0;if(s){var c=r(o),u=h.nestedProperty(t,c).get();Array.isArray(u)&&a.push(c)}}function r(t){return t.join(".")}var a=[],o=[];if(n.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":115,"../plotly":137,"../snapshot/cloneplot":174,"../snapshot/helpers":177,"../snapshot/svgtoimg":179,"../snapshot/tosvg":181,"fast-isnumeric":10}],136:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,v=n.length,m=0;mu&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=z&&a<=10||e>=15*z)t._tickround="d";else if(e>=P&&a<=16||e>=O)t._tickround="M";else if(e>=D&&a<=19||e>=P)t._tickround="S";else{var o=_.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var n=t.match(Y),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);n&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(r&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(n||(a="
"+H(u)),o=X(u)):(n||(a="
"+U(u)),o=Z(u),"M"!==s?(o+=G(u),"S"!==s&&(o+=d(y.round(m(l/1e3,1),4),t,"none",n).substr(1))):"d"===c&&(o=X(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&m(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,m(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=t<0,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var g=r-1,v=r+1;n="tozero"===t.rangemode?r<0?[g,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,v)]:[g,v]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n.map(t.l2r||Number)},N.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=N.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},N.saveRangeInitial=function(t,e){for(var n=N.list(t,"",!0),r=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,v=e.length,m=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=v-1;o>5;o--)a(o)}},N.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},N.autoTicks(f,l);var d,h=N.tickIncrement(N.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=N.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=N.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fC?(e/=C,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,I)):r>S?(e/=S,t.dtick="M"+a(e,1,R)):r>z?(t.dtick=a(e,z,j),t.tick0="2000-01-02"):r>O?t.dtick=a(e,O,R):r>P?t.dtick=a(e,P,F):r>D?t.dtick=a(e,D,F):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,I)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},N.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?q:B,s=t+.01*r,c=_.roundUp(m(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]o:f1&&e2*r}function o(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("../../constants/numerical").BADNUM;e.exports=function(t){return a(t)?"date":o(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":103,"../../lib":115,"fast-isnumeric":10}],144:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var l=i(e,n,r);if(l){if("histogram"===l.type&&r==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,r)){for(var s,u=a(l),f=[],d=0;d0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],147:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],148:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?r:"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,n,l,_,w,k,M){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+vt+")").attr("d",ct+"Z"),ht=pt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+vt+")").attr("d","M0,0Z"),C()}function C(){pt.selectAll(".select-outline").remove()}function S(e,n){if(t._transitioningWithDuration)return!1;var r=Math.max(0,Math.min(V,e+ot)),a=Math.max(0,Math.min(X,n+it)),o=Math.abs(r-ot),i=Math.abs(a-it),l=Math.floor(Math.min(i,o,Z)/2);lt.l=Math.min(ot,r),lt.r=Math.max(ot,r),lt.t=Math.min(it,a),lt.b=Math.max(it,a),!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function z(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),b=!1)))}function P(e,n){var a=1===(k+M).length;if(e)R();else if(2!==n||a){if(1===n&&a){var o=k?H[0]:q[0],i="s"===k||"w"===M?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",f="middle";if(o.fixedrange)return;k?(f="n"===k?"top":"bottom","right"===o.side&&(u="right")):"e"===M&&(u="right"),nt.call(d.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var n=o.d2r(e);void 0!==n&&c.relayout(t,l,n)})}}else I()}function D(e){function n(t,e,n){function r(e){return t.l2r(o+(e-o)*n)}if(!t.fixedrange){var a=t.range.map(t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(r)}}if(t._context.scrollZoom||j._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(T(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(yt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=mt[0]+mt[2]*s,u=(l.bottom-e.clientY)/l.height,d=mt[1]+mt[3]*(1-u);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,n){for(var r,o,i=1-e,l=0;l0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rY.width||G<0||G>Y.height)return _.unhoverRaw(t,e)}else Z="xpx"in e?e.xpx:M[0]._length/2,G="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?r(o,e.xval):a(M,Z),P="yval"in e?r(o,e.yval):a(A,G),!g(O[0])||!g(P[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(N=0;N1||I.hoverinfo.indexOf("name")!==-1?I.name:void 0,index:!1,distance:Math.min(W,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[R]&&(H.subplot=i[R]._subplot),V=X.length,"array"===j){var Q=e[N];"pointNumber"in Q?(H.index=Q.pointNumber,j="closest"):(j="","xval"in Q&&(B=Q.xval,j="x"),"yval"in Q&&(q=Q.yval,j=j?"closest":"y"))}else B=O[F],q=P[F];if(I._module&&I._module.hoverPoints){var $=I._module.hoverPoints(H,B,q,j);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&X.push(s(J,z))}else v.log("Unrecognized trace type in hover:",I);"closest"===z&&X.length>V&&(X.splice(0,V),W=X[0].distance)}if(0===X.length)return _.unhoverRaw(t,e);var tt="y"===z&&U.length>1;X.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),nt={hovermode:z,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},rt=c(X,nt);u(X,tt?"xa":"ya"),f(rt,tt);var at=t._hoverdata,ot=[];for(D=0;D128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),v=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),v=d.node().getBoundingClientRect().width+2*D):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var m,k,T=f.node().getBoundingClientRect(),C=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),N=T.width+P+D+v;t.ty0=_-T.top,t.bx=T.width+2*D,t.by=T.height+2*D,t.anchor="start",t.txwidth=T.width,t.tx2width=v,t.offset=0,o?(t.pos=C,m=S+O/2+N<=M,k=S-O/2-N>=0,"top"!==t.idealAlign&&m||!k?m?(S+=O/2,t.anchor="start"):t.anchor="middle":(S-=O/2,t.anchor="end")):(t.pos=S,m=C+z/2+N<=w,k=C-z/2-N>=0,"left"!==t.idealAlign&&m||!k?m?(C+=z/2,t.anchor="start"):t.anchor="middle":(C-=z/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+C+","+S+")"+(o?"rotate("+L+")":""))}),S}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?S:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var v=f[i];for(l=v.length-1;l>=0;l--){var m=v[l],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(P+D),l=i+o*(t.txwidth+D),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-O,s=t.offset*z),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*P+s)+","+(P+c)+"v"+(t.by/2-P)+"h"+r*t.bx+"v-"+t.by+"H"+(r*P+s)+"V"+(c-P)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+D).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*D+s,c+t.ty0-t.by/2+D),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,n){function r(n,r){return v.coerce(t,e,A,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=T.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},T.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+k.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},T.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},T.getClosest=function(t,e,n){ if(n.index!==!1)n.index>=0&&n.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":115,"fast-isnumeric":10}],155:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,v=a.element.getBoundingClientRect(),m=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-v.left,b=n-v.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),C=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",k+"Z");var z,O,P,D,N,E=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,F=[];for(z=0;z0)return Math.log(e)/Math.LN10;if(e<=0&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*f*Math.abs(r-a))}return s}function n(t){return Math.pow(10,t)}function i(t){return a(t)?(t=Number(t),t<-l||t>l?s:a(t)?Number(t):s):s}var f=10;t.c2l="log"===t.type?e:i,t.l2c="log"===t.type?n:i,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var n,r,i=t[e],s=(t._id||"x").charAt(0);if(r="date"===t.type?c.DFLTRANGEDATE:"y"===s?c.DFLTRANGEY:c.DFLTRANGEX,r=r.slice(),!i||2!==i.length)return void(t[e]=r);for("date"===t.type&&(i[0]=o.cleanDate(i[0]),i[1]=o.cleanDate(i[1])),n=0;n<2;n++)if("date"===t.type){if(!o.isDateTime(i[n])){t[e]=r;break}if(i[n]o.MAX_MS&&(i[n]=o.MAX_MS),t.r2l(i[0])===t.r2l(i[1])){var u=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(u-1e3),i[1]=t.l2r(u+1e3);break}}else{if(!a(i[n])){if(!a(i[1-n])){t[e]=r;break}i[n]=i[1-n]*(n?10:.1)}if(i[n]<-l?i[n]=-l:i[n]>l&&(i[n]=l),i[0]===i[1]){var f=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=f,i[1]+=f}}},t.fraction2r=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return t.l2r(n+e*(r-n))},t.r2fraction=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return(t.r2l(e)-n)/(r-n)},t.setScale=function(e){var n=t._gd._fullLayout._size,r=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var a=u.getFromId(t._gd,t.overlaying);t.domain=a.domain}var i=e&&t._r?"_r":"range";t.cleanRange(i);var l=t.r2l(t[i][0]),s=t.r2l(t[i][1]);if("y"===r?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):s},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,n){return t.l2p(t.r2l(e,n))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=i,t.d2c=o.cleanNumber,"log"===t.type?(t.d2l=function(e,n){return t.c2l(t.d2c(e),n)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=o.cleanNumber,t.d2r=o.cleanNumber,t.r2d=i),t.r2l=i,t.l2r=i):"date"===t.type?(t.c2d=o.ms2DateTime,t.d2c=function(t){var e=o.dateTime2ms(t);if(e===s){if(!a(t))return s;e=Number(t)}return o.constrain(e,o.MIN_MS,o.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=o.identity,t.r2d=o.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var n=t._categories.indexOf(e);return n===-1?s:n},t.d2l=t.d2c,t.r2l=i,t.l2r=i,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;o0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var f=u.charAt(0),d=u.substr(1);d=r(d)?Number(d):0,(d<=0||!("date"===i&&"M"===f&&d===Math.round(d)||"log"===i&&"L"===f||"log"===i&&"D"===f&&(1===d||2===d)))&&(e.dtick=c)}var h="date"===i?"2000-01-01":0,p=n("tick0",h);"date"===i?e.tick0=a.cleanDate(p,h):r(p)&&"D1"!==u&&"D2"!==u?e.tick0=Number(p):e.tick0=h}else{var g=n("tickvals");void 0===g?e.tickmode="auto":n("ticktext")}}},{"../../constants/numerical":103,"../../lib":115,"fast-isnumeric":10}],160:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../lib"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,n,c){function u(t){var e,n,r,a,o,i={};for(e in t)if(n=e.split("."),r=n[0].match(s)){var l=r[1],c=l+"axis";if(a=y[c],o={},Array.isArray(t[e])?o.to=t[e].slice(0):Array.isArray(t[e].range)&&(o.to=t[e].range.slice(0)),!o.to)continue;o.axisName=c,o.length=a._length,x.push(l),i[l]=o}return i}function f(t,e,n){var r,a,o,i=t._plots,l=[];for(r in i){var s=i[r];if(l.indexOf(s)===-1){var c=s.xaxis._id,u=s.yaxis._id,f=s.xaxis.range,d=s.yaxis.range;s.xaxis._r=s.xaxis.range.slice(),s.yaxis._r=s.yaxis.range.slice(),a=n[c]?n[c].to:f,o=n[u]?n[u].to:d,f[0]===a[0]&&f[1]===a[1]&&d[0]===o[0]&&d[1]===o[1]||e.indexOf(c)===-1&&e.indexOf(u)===-1||l.push(s)}}return l}function d(e,n){function r(e,n){for(a=0;an.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var k;c&&(k=c());var M,A,T,L=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),M=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":115,"../../plotly":137,"../../registry":173,"./axes":142,d3:7}],161:[function(t,e,n){"use strict";function r(t,e,n){var r,a,o,i=!1;if("data"===e.type)r=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;r=t._fullLayout}return a=c.nestedProperty(r,e.prop).get(),o=n[e.type]=n[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var n=[],r=e[0],a={};if("string"==typeof r)a[r]=e[1];else{if(!c.isPlainObject(r))return n;a=r}return l(a,function(t,e,r){n.push({type:"layout",prop:t,value:r})},"",0),n}function i(t,e){var n,r,a,o,i=[];if(r=e[0],a=e[1],n=e[2],o={},"string"==typeof r)o[r]=a;else{if(!c.isPlainObject(r))return i;o=r,void 0===n&&(n=a)}return void 0===n&&(n=null),l(o,function(e,r,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);n&&(l=Math.min(l,n.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,r+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");n.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=n.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){r(t,s,i.cache),i.check=function(){if(l){var e=r(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),n._initialAutoSizeIsDone){var c=n.width,f=n.height;p.supplyLayoutGlobalDefaults(o,r),o.width||(r.width=c),o.height||(r.height=f)}else{p.supplyLayoutGlobalDefaults(o,r);var d=!o.width||!o.height,h=r.autosize,g=t._context&&t._context.autosizable,v=d&&(h||g);v?p.plotAutoSize(t,o,r):d&&p.sanitizeMargins(t),!h&&d&&(o.width=r.width,o.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=s.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,r),r._has=p._hasPlotType.bind(r);var m=r._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,v=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(g*(v.width-f)),a=Math.round(g*(v.height-h))}else{var m=s?window.getComputedStyle(t):{};r=parseFloat(m.width)||n.width,a=parseFloat(m.height)||n.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;r1,_=!e.height&&Math.abs(n.height-a)>1;(_||b)&&(b&&(n.width=r),_&&(n.height=a)),t._initialAutoSize||(t._initialAutoSize={width:r,height:a}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n,r){var a,o;u.Axes.supplyLayoutDefaults(t,e,n);var i=e._basePlotModules;for(a=0;a.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var v=s[t].t.val,m=s[t].t.size;if(v>d){var y=(h*v+(m-e.height)*d)/(v-d),x=(m*(1-d)+(h-e.height)*(1-v))/(v-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!t._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):d.isJSDate(t)?d.ms2DateTime(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var n,r,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(n=0;n0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(n)for(l=0;l=0,S=C?f.angularAxis.domain:r.extent(M),z=Math.abs(M[1]-M[0]);T&&!A&&(z=0);var O=S.slice();L&&A&&(O[1]+=z);var P=f.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),f.angularAxis.ticksStep&&(P=(O[1]-O[0])/P);var D=f.angularAxis.ticksStep||(O[1]-O[0])/(P*(f.minorTicks+1));k&&(D=Math.max(Math.round(D),1)),O[2]||(O[2]=D);var N=r.range.apply(this,O);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=r.scale.linear().domain(O.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?z:0,e=r.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var E="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(E,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=r.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,j=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},q={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=i.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});i.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},i.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],a.range([0,x]),u.layout.radialAxis.domain=a.domain(),F.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),j.attr("transform","translate("+_+")").style({cursor:"crosshair"});var X=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(X[0]=Math.max(0,X[0]),X[1]=Math.max(0,X[1]),e.select(".outer-group").attr("transform","translate("+X+")"),f.title){var U=e.select("g.title-group text").style(q).text(f.title),Z=U.node().getBBox();U.attr({x:_[0]-Z.width/2,y:_[1]-x-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=G.selectAll("circle.grid-circle").data(a.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(B),Y.attr("r",a),Y.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(B);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=r.svg.axis().scale(a).ticks(5).tickSize(5);G.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(B),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(q).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,q["font-size"]]+")":"translate("+[0,q["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),J=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(B),J.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(q);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?n<270&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(n<=180&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(q);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=r.max(j.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=a,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=r.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return o(i[n].defaultConfig(),t)});i[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=i.tooltipPanel().config({container:ct,fontSize:8})(),ft=i.tooltipPanel().config({container:ct,fontSize:8})(),dt=i.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});j.on("mousemove.angular-guide",function(t,e){var n=i.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=i.util.convertToCartesian(x+12,n+180);ut.text(i.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});j.on("mousemove.radial-guide",function(t,e){var n=i.util.getMousePos(W).radius;pt.attr({r:n}).style({opacity:.5}),lt=a.invert(i.util.getMousePos(W).radius);var r=i.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(i.util.round(lt)).move([r[0]+_[0],r[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var a=r.select(this),o=a.style("fill"),l="black",s=a.style("opacity")||1;if(a.attr({"data-opacity":s}),"none"!=o){a.attr({"data-fill":o}),l=r.hsl(o).darker().toString(),a.style({fill:l,opacity:1});var c={t:i.util.round(t[0]),r:i.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-X[0]-d.left,f.top+f.height/2-X[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else o=a.style("stroke"),a.attr({"data-stroke":o}),l=r.hsl(o).darker().toString(),a.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==r.event.which&&void(r.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=r.select(this),a=n.attr("data-fill");a?n.style({fill:a,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,a,l,s={data:[],layout:{}},c={},u={},f=r.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=i.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),o(s.data[e],i.Axis.defaultConfig().data[0]),o(s.data[e],t)}),o(s.layout,i.Axis.defaultConfig().layout),o(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},r.rebind(d,f,"on"),d},i.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:r.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},i.util={},i.DATAEXTENT="dataExtent",i.AREA="AreaChart",i.LINE="LinePlot",i.DOT="DotPlot",i.BAR="BarChart",i.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},i.util._extend=function(t,e){for(var n in t)e[n]=t[n]},i.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},i.util.dataFromEquation2=function(t,e){var n=e||6,a=r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return a},i.util.dataFromEquation=function(t,e,n){var a=e||6,o=[],i=[];r.range(0,360+a,a).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},i.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return r.range(e).map(function(t,e){return n[e]||n[0]})},i.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=i.util.ensureArray(t[e],n)}),t},i.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},i.util.validateKeys=function(t,e){ -"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},i.util.sumArrays=function(t,e){return r.zip(t,e).map(function(t,e){return r.sum(t)})},i.util.arrayLast=function(t){return t[t.length-1]},i.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return n===-2},i.util.flattenArray=function(t){for(var e=[];!i.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},i.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},i.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},i.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},i.util.getMousePos=function(t){var e=r.mouse(t.node()),n=e[0],a=e[1],o={};return o.x=n,o.y=a,o.pos=e,o.angle=180*(Math.atan2(a,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+a*a),o},i.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;a0)){var l=r.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(n,a,o)},"fill-opacity":0,stroke:function(t,e){return v.stroke(n,a,o)},"stroke-width":function(t,e){return v["stroke-width"](n,a,o)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](n,a,o)},opacity:function(t,e){return v.opacity(n,a,o)},display:function(t,e){return v.display(n,a,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=r.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,a){r.select(this).attr({class:"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var v={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},m=r.select(this).selectAll("g.layer").data(s);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,n=[i.PolyChart.defaultConfig()],a=r.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),o(n[e],i.PolyChart.defaultConfig()),o(n[e],t)}),this):n},t.getColorScale=function(){return e},r.rebind(t,a,"on"),t},i.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}};return t},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},i.Legend=function(){function t(){var n=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=o({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),i=r.merge(a);i=i.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(i=i.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=r.select(l));var s=i.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof i[0]:n.isContinuous,f=u?n.height:c*i.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=r.range(i.length),v=r.scale[u?"linear":"ordinal"]().domain(g).range(s),m=r.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":r.svg.symbolTypes.indexOf(t)!=-1?r.svg.symbol().type(t).size(n)():r.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(i);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,m(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return v(e)}}),b.exit().remove()}var _=r.svg.axis().scale(m).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return i[e].name}),t}var e=i.Legend.defaultConfig(),n=r.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},r.rebind(t,n,"on"),t},i.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},i.tooltipPanel=function(){var t,e,n,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=10,c=function(){t=a.container.selectAll("g."+l).data([0]);var r=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=r.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=r.append("text").attr({dx:a.padding+s,dy:.3*+a.fontSize}),c};return c.text=function(o){var i=r.hsl(a.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var d=a.padding,h=e.node().getBBox(),p={fill:a.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,v=h.height+2*d;return n.attr({d:"M"+[[s,-v/2],[s,-v/4],[a.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-v/2+2*d]+")"}),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 o(a,t),c},c},i.tooltipPanel.uid=1,i.adapter={},i.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=o({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var r=a.indexOf(t.geometry);r!=-1&&(n.data[e].groupId=r)})}if(t.layout){var l=o({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};r.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../lib":115,d3:7}],171:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../lib"),o=t("../../components/color"),i=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){function e(e,a){return a&&(f=a),r.select(r.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?s(n,e):e,o||(o=i.Axis()),u=i.adapter.plotly().convert(n),o.config(u).render(f),t.data=n.data,t.layout=n.layout,c.fillLayout(t),n}var n,a,o,u,f,d=new l;return e.isPolar=!0,e.svg=function(){return o.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return i.adapter.plotly().convert(o.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:o.angularScale(),r:o.radialScale()}},e.setUndoPoint=function(){var t=this,e=i.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,a),a=i.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},c.fillLayout=function(t){var e=r.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:o.background,_container:e,_paperdiv:n,_paper:a};t._fullLayout=s(i,t.layout)}},{"../../components/color":23,"../../lib":115,"./micropolar":170,"./undo_manager":172,d3:7}],172:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return r!==-1},hasRedo:function(){return r-1}var o=t("../lib"),i=t("../plots/plots"),l=o.extendFlat,s=o.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,o=t.data,c=t.layout,u=s([],o),f=s({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;n=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var v,m,y,x,b=e.p+(h?d[n]:d),_=b+(g?p[n]:p),w=e.b,k=w+e.s;if("h"===l.orientation?(y=u.c2p(b,!0),x=u.c2p(_,!0),v=c.c2p(w,!0),m=c.c2p(k,!0)):(v=c.c2p(b,!0),m=c.c2p(_,!0),y=u.c2p(w,!0),x=u.c2p(k,!0)),!(a(v)&&a(m)&&a(y)&&a(x)&&v!==m&&y!==x))return void r.select(this).remove();var M=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,A=r.round(M/2%1,2);if(!t._context.staticPlot){var T=i.opacity(e.mc||l.marker.color),L=T<1||M>.01?o:s;v=L(v,m),m=L(m,v),y=L(y,x),x=L(x,y)}r.select(this).attr("d","M"+v+","+y+"V"+x+"H"+m+"V"+y+"Z")})}),d.call(l.plot,e)}},{"../../components/color":23,"../../components/errorbars":52,"../../lib":115,"./arrays_to_calcdata":182,d3:7,"fast-isnumeric":10}],191:[function(t,e,n){"use strict";function r(t,e,n,r){if(r.length){var l,s,c,u,f,d=t._fullLayout.barmode,h="overlay"===d,p="group"===d;if(h)a(t,e,n,r);else if(p){for(l=[], -s=[],c=0;cs+i&&(c=!0,s=y)),m(e.c2l(g))&&(gs+i&&(c=!0,s=g))}}x.expand(e,[l,s],{tozero:!0,padded:c})}function v(t){return t._id.charAt(0)}var m=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var n,a=e.xaxis,o=e.yaxis,i=t._fullData,l=t.calcdata,s=[],c=[];for(n=0;n1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&r.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,n=e.marker,i=n.line,l=o.tryColorscale(n,""),s=o.tryColorscale(n,"line");r.select(this).selectAll("path").each(function(t){var e,o,c=(t.mlw+1||i.width+1)-1,u=r.select(this);e="mc"in t?t.mcc=l(t.mc):Array.isArray(n.color)?a.defaultLine:n.color,u.style("stroke-width",c+"px").call(a.fill,e),c&&(o="mlc"in t?t.mlcc=s(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":23,"../../components/drawing":46,"../../components/errorbars":52,d3:7}],194:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,n,i,l){n("marker.color",i),a(t,"marker")&&o(t,e,l,n,{prefix:"marker.",cLetter:"c"}),n("marker.line.color",r.defaultLine),a(t,"marker.line")&&o(t,e,l,n,{prefix:"marker.line.",cLetter:"c"}),n("marker.line.width")}},{"../../components/color":23,"../../components/colorscale/defaults":32,"../../components/colorscale/has_colorscale":36}],195:[function(t,e,n){"use strict";var r=t("../../components/color/attributes"),a=t("../../plots/font_attributes"),o=t("../../plots/attributes"),i=t("../../lib/extend").extendFlat;e.exports={labels:{valType:"data_array"},label0:{valType:"number",dflt:0},dlabel:{valType:"number",dflt:1},values:{valType:"data_array"},marker:{colors:{valType:"data_array"},line:{color:{valType:"color",dflt:r.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},scalegroup:{valType:"string",dflt:""},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"]},hoverinfo:i({},o.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0},textfont:i({},a,{}),insidetextfont:i({},a,{}),outsidetextfont:i({},a,{}),domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},hole:{valType:"number",min:0,max:1,dflt:0},sort:{valType:"boolean",dflt:!0},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise"},rotation:{valType:"number",min:-360,max:360,dflt:0},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0}}},{"../../components/color/attributes":22,"../../lib/extend":112,"../../plots/attributes":140,"../../plots/font_attributes":162}],196:[function(t,e,n){"use strict";function r(t,e){for(var n=[],r=0;r")}return g};var s},{"../../components/color":23,"./helpers":199,"fast-isnumeric":10,tinycolor2:13}],198:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(n,o){return r.coerce(t,e,a,n,o)}var l=r.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,v=g||"inside"===p,m=g||"outside"===p;if(v||m){var y=l(i,"textfont",o.font);v&&l(i,"insidetextfont",y),m&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":115,"./attributes":195}],199:[function(t,e,n){"use strict";var r=t("../../lib");n.formatPiePercent=function(t,e){var n=(100*t).toPrecision(3);return n.lastIndexOf(".")!==-1&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)+"%"},n.formatPieValue=function(t,e){var n=t.toPrecision(10);return n.lastIndexOf(".")!==-1&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)}},{"../../lib":115}],200:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.layoutAttributes=t("./layout_attributes"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.styleOne=t("./style_one"),r.moduleType="trace",r.name="pie",r.basePlotModule=t("./base_plot"),r.categories=["pie","showLegend"],r.meta={},e.exports=r},{"./attributes":195,"./base_plot":196,"./calc":197,"./defaults":198,"./layout_attributes":201,"./layout_defaults":202,"./plot":203,"./style":204,"./style_one":205}],201:[function(t,e,n){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],202:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function n(n,o){return r.coerce(t,e,a,n,o)}n("hiddenlabels")}},{"../../lib":115,"./layout_attributes":201}],203:[function(t,e,n){"use strict";function r(t,e,n){var r=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/n.vTotal,.5),l=1-n.trace.hole,s=a(e,n),c={scale:s*n.r*2/r,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=n.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/n.r)-f*o/n.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=n.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),v={scale:2*g/t.width,rCenter:Math.cos(g/n.r)-g/o/n.r,rotate:(180/Math.PI*e.midangle+810)%180-90},m=v.scale>d.scale?v:d;return c.scale<1&&m.scale>c.scale?m:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var n=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(n)),(1-e.trace.hole)/2)}function o(t,e){var n=e.pxmid[0],r=e.pxmid[1],a=t.width/2,o=t.height/2;return n<0&&(a*=-1),r<0&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+n*n/(r*r)),outside:!0}}function i(t,e){function n(t,e){return t.pxmid[1]-e.pxmid[1]}function r(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,n){n||(n={});var r,a,o,l,d,h,g=n.labelExtraY+(i?n.yLabelMax:n.yLabelMin),v=i?t.yLabelMin:t.yLabelMax,m=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-v;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-v-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(m+t.labelExtraY-y)*f>0&&(r=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+r-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,v,m;for(i=0;i<2;i++)for(l=i?n:r,c=i?Math.max:Math.min,f=i?1:-1,o=0;o<2;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),v=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(n/c(l.tilt,Math.sin(s),l.depth),r/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&h.indexOf(l.scalegroup)===-1&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,n){if(!t)return 1;var r=Math.sin(t*Math.PI/180);return Math.max(.01,n*r*Math.abs(e)+2*Math.sqrt(1-r*r*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var n=t._fullLayout;l(e,n._size);var c=n._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],v=c.trace,m=0,y=(v.depth||0)*c.r*Math.sin(m)/2,x=v.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(m),k=l.selectAll("g.part").data(v.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],m=!1;l.each(function(i){function l(e){var r=t._fullLayout,o=t._fullData[v.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&r.hovermode!==!1&&"none"!==l&&"skip"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=n.separators,p=[];l.indexOf("label")!==-1&&p.push(i.label),o.text&&o.text[i.i]&&l.indexOf("text")!==-1&&p.push(o.text[i.i]),l.indexOf("value")!==-1&&p.push(g.formatPieValue(i.v,h)),l.indexOf("percent")!==-1&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:l.indexOf("name")!==-1?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:r._hoverlayer.node(),outerContainer:r._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(n._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],t._hoverdata.trace=e.trace,f.click(t,{target:!0})}function b(t,e,n,r){return"a"+r*c.r+","+r*w+" "+x+" "+i.largeArc+(n?" 1 ":" 0 ")+r*(e[0]-t[0])+","+r*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y),v.pull){var C=+(Array.isArray(v.pull)?v.pull[i.i]:v.pull)||0;C>0&&(k+=C*i.pxmid[0],M+=C*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var S=v.hole;if(i.v===c.vTotal){var z="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";S?T.attr("d","M"+(k+S*i.px0[0])+","+(M+S*i.px0[1])+b(i.px0,i.pxmid,!1,S)+b(i.pxmid,i.px0,!1,S)+"Z"+z):T.attr("d",z)}else{var O=b(i.px0,i.px1,!0,1);if(S){var P=1-S;T.attr("d","M"+(k+S*i.px1[0])+","+(M+S*i.px1[1])+b(i.px1,i.px0,!1,S)+"l"+P*i.px0[0]+","+P*i.px0[1]+O+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+O+"Z")}var D=Array.isArray(v.textposition)?v.textposition[i.i]:v.textposition,N=A.selectAll("g.slicetext").data(i.text&&"none"!==D?[0]:[]);N.enter().append("g").classed("slicetext",!0),N.exit().remove(),N.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===D?v.outsidetextfont:v.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,n=h.bBox(t.node());"outside"===D?e=o(n,i):(e=r(n,i,c),"auto"===D&&e.scale<1&&(t.call(h.font,v.outsidetextfont),v.outsidetextfont.family===v.insidetextfont.family&&v.outsidetextfont.size===v.insidetextfont.size||(t.attr({"data-bb":""}),n=h.bBox(t.node())),e=o(n,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-n.height/2,i.yLabelMid=l,i.yLabelMax=l+n.height/2,i.labelExtraX=0,i.labelExtraY=0,m=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(n.left+n.right)/2+","+-(n.top+n.bottom)/2+")")})}),m&&i(s,v),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),n=e.select("g.slicetext text");n.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+n.attr("transform"));var r=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+r+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(r+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,v.outsidetextfont.color).attr({"stroke-width":Math.min(2,v.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":23,"../../components/drawing":46,"../../lib/svg_text_utils":127,"../../plots/cartesian/graph_interact":149,"./helpers":199,d3:7}],204:[function(t,e,n){"use strict";var r=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],n=e.trace,o=r.select(this);o.style({opacity:n.opacity}),o.selectAll(".top path.surface").each(function(t){r.select(this).call(a,t,n)})})}},{"./style_one":205,d3:7}],205:[function(t,e,n){"use strict";var r=t("../../components/color");e.exports=function(t,e,n){var a=n.marker.line.color;Array.isArray(a)&&(a=a[e.i]||r.defaultLine);var o=n.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(r.stroke,a)}},{"../../components/color":23}],206:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t){var e=t[0].trace,n=e.marker;if(r.mergeArray(e.text,t,"tx"),r.mergeArray(e.textposition,t,"tp"),e.textfont&&(r.mergeArray(e.textfont.size,t,"ts"),r.mergeArray(e.textfont.color,t,"tc"),r.mergeArray(e.textfont.family,t,"tf")),n&&n.line){var a=n.line;r.mergeArray(n.opacity,t,"mo"),r.mergeArray(n.symbol,t,"mx"),r.mergeArray(n.color,t,"mc"),r.mergeArray(a.color,t,"mlc"),r.mergeArray(a.width,t,"mlw")}}},{"../../lib":115}],207:[function(t,e,n){"use strict";var r=t("../../components/colorscale/color_attributes"),a=t("../../components/errorbars/attributes"),o=t("../../components/colorbar/attributes"),i=t("../../components/drawing"),l=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},ids:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"},simplify:{valType:"boolean",dflt:!0}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:l({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},colorbar:o,line:l({},{width:{valType:"number",min:0,arrayOk:!0}},r("marker.line"))},r("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},error_y:a,error_x:a}},{"../../components/colorbar/attributes":24,"../../components/colorscale/color_attributes":30,"../../components/drawing":46,"../../components/errorbars/attributes":48,"../../lib/extend":112,"./constants":212}],208:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var n,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},v={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var m={type:"linear"};a.setConvert(m),s=m.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=v.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,a.expand(u,d,g),a.expand(f,h,v);var b=new Array(p);for(c=0;c=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}}}}},{}],210:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,s=n.marker,c="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===s||!s.showscale)return void o.autoMargin(t,c);var u=s.color,f=s.cmin,d=s.cmax;r(f)||(f=a.aggNums(Math.min,null,u)),r(d)||(d=a.aggNums(Math.max,null,u));var h=e[0].t.cb=l(t,c),p=i.makeColorScaleFunc(i.extractScale(s.colorscale,f,d),{noNumericCheck:!0});h.fillcolor(p).filllevels({start:f,end:d,size:(d-f)/254}).options(s.colorbar)()}},{"../../components/colorbar/draw":26,"../../components/colorscale":37,"../../lib":115,"../../plots/plots":166,"fast-isnumeric":10}],211:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":29,"../../components/colorscale/has_colorscale":36,"./subtypes":227}],212:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],213:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var v=l(t,e,g),m=vq!=D>=q&&(z=C[T-1][0],O=C[T][0],S=z+(O-z)*(q-P)/(D-P),R=Math.min(R,S),F=Math.max(F,S));R=Math.max(R,0),F=Math.min(F,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:F,y0:q,y1:q,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":23,"../../components/errorbars":52,"../../lib":115,"../../plots/cartesian/constants":147,"../../plots/cartesian/graph_interact":149,"./get_trace_color":215}],217:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.animatable=!0,r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"), +"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},i.util.sumArrays=function(t,e){return r.zip(t,e).map(function(t,e){return r.sum(t)})},i.util.arrayLast=function(t){return t[t.length-1]},i.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return n===-2},i.util.flattenArray=function(t){for(var e=[];!i.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},i.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},i.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},i.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},i.util.getMousePos=function(t){var e=r.mouse(t.node()),n=e[0],a=e[1],o={};return o.x=n,o.y=a,o.pos=e,o.angle=180*(Math.atan2(a,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+a*a),o},i.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;a0)){var l=r.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(n,a,o)},"fill-opacity":0,stroke:function(t,e){return v.stroke(n,a,o)},"stroke-width":function(t,e){return v["stroke-width"](n,a,o)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](n,a,o)},opacity:function(t,e){return v.opacity(n,a,o)},display:function(t,e){return v.display(n,a,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=r.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,a){r.select(this).attr({class:"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var v={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},m=r.select(this).selectAll("g.layer").data(s);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,n=[i.PolyChart.defaultConfig()],a=r.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),o(n[e],i.PolyChart.defaultConfig()),o(n[e],t)}),this):n},t.getColorScale=function(){return e},r.rebind(t,a,"on"),t},i.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}};return t},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},i.Legend=function(){function t(){var n=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=o({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),i=r.merge(a);i=i.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(i=i.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=r.select(l));var s=i.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof i[0]:n.isContinuous,f=u?n.height:c*i.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=r.range(i.length),v=r.scale[u?"linear":"ordinal"]().domain(g).range(s),m=r.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":r.svg.symbolTypes.indexOf(t)!=-1?r.svg.symbol().type(t).size(n)():r.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(i);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,m(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return v(e)}}),b.exit().remove()}var _=r.svg.axis().scale(m).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return i[e].name}),t}var e=i.Legend.defaultConfig(),n=r.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},r.rebind(t,n,"on"),t},i.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},i.tooltipPanel=function(){var t,e,n,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=10,c=function(){t=a.container.selectAll("g."+l).data([0]);var r=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=r.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=r.append("text").attr({dx:a.padding+s,dy:.3*+a.fontSize}),c};return c.text=function(o){var i=r.hsl(a.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var d=a.padding,h=e.node().getBBox(),p={fill:a.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,v=h.height+2*d;return n.attr({d:"M"+[[s,-v/2],[s,-v/4],[a.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-v/2+2*d]+")"}),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 o(a,t),c},c},i.tooltipPanel.uid=1,i.adapter={},i.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=o({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var r=a.indexOf(t.geometry);r!=-1&&(n.data[e].groupId=r)})}if(t.layout){var l=o({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};r.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../lib":115,d3:7}],171:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../lib"),o=t("../../components/color"),i=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){function e(e,a){return a&&(f=a),r.select(r.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?s(n,e):e,o||(o=i.Axis()),u=i.adapter.plotly().convert(n),o.config(u).render(f),t.data=n.data,t.layout=n.layout,c.fillLayout(t),n}var n,a,o,u,f,d=new l;return e.isPolar=!0,e.svg=function(){return o.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return i.adapter.plotly().convert(o.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:o.angularScale(),r:o.radialScale()}},e.setUndoPoint=function(){var t=this,e=i.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,a),a=i.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},c.fillLayout=function(t){var e=r.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:o.background,_container:e,_paperdiv:n,_paper:a};t._fullLayout=s(i,t.layout)}},{"../../components/color":23,"../../lib":115,"./micropolar":170,"./undo_manager":172,d3:7}],172:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return r!==-1},hasRedo:function(){return r-1}var o=t("../lib"),i=t("../plots/plots"),l=o.extendFlat,s=o.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,o=t.data,c=t.layout,u=s([],o),f=s({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;n=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var v,m,y,x,b=e.p+(h?d[n]:d),_=b+(g?p[n]:p),w=e.b,k=w+e.s;if("h"===l.orientation?(y=u.c2p(b,!0),x=u.c2p(_,!0),v=c.c2p(w,!0),m=c.c2p(k,!0)):(v=c.c2p(b,!0),m=c.c2p(_,!0),y=u.c2p(w,!0),x=u.c2p(k,!0)),!(a(v)&&a(m)&&a(y)&&a(x)&&v!==m&&y!==x))return void r.select(this).remove();var M=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,A=r.round(M/2%1,2);if(!t._context.staticPlot){var T=i.opacity(e.mc||l.marker.color),L=T<1||M>.01?o:s;v=L(v,m),m=L(m,v),y=L(y,x),x=L(x,y)}r.select(this).attr("d","M"+v+","+y+"V"+x+"H"+m+"V"+y+"Z")})}),d.call(l.plot,e)}},{"../../components/color":23,"../../components/errorbars":52,"../../lib":115,"./arrays_to_calcdata":182,d3:7,"fast-isnumeric":10}],191:[function(t,e,n){"use strict";function r(t,e,n,r){if(r.length){var l,s,c,u,f,d=t._fullLayout.barmode,h="overlay"===d,p="group"===d;if(h)a(t,e,n,r);else if(p){ +for(l=[],s=[],c=0;cs+i&&(c=!0,s=y)),m(e.c2l(g))&&(gs+i&&(c=!0,s=g))}}x.expand(e,[l,s],{tozero:!0,padded:c})}function v(t){return t._id.charAt(0)}var m=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var n,a=e.xaxis,o=e.yaxis,i=t._fullData,l=t.calcdata,s=[],c=[];for(n=0;n1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&r.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,n=e.marker,i=n.line,l=o.tryColorscale(n,""),s=o.tryColorscale(n,"line");r.select(this).selectAll("path").each(function(t){var e,o,c=(t.mlw+1||i.width+1)-1,u=r.select(this);e="mc"in t?t.mcc=l(t.mc):Array.isArray(n.color)?a.defaultLine:n.color,u.style("stroke-width",c+"px").call(a.fill,e),c&&(o="mlc"in t?t.mlcc=s(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":23,"../../components/drawing":46,"../../components/errorbars":52,d3:7}],194:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,n,i,l){n("marker.color",i),a(t,"marker")&&o(t,e,l,n,{prefix:"marker.",cLetter:"c"}),n("marker.line.color",r.defaultLine),a(t,"marker.line")&&o(t,e,l,n,{prefix:"marker.line.",cLetter:"c"}),n("marker.line.width")}},{"../../components/color":23,"../../components/colorscale/defaults":32,"../../components/colorscale/has_colorscale":36}],195:[function(t,e,n){"use strict";var r=t("../../components/color/attributes"),a=t("../../plots/font_attributes"),o=t("../../plots/attributes"),i=t("../../lib/extend").extendFlat;e.exports={labels:{valType:"data_array"},label0:{valType:"number",dflt:0},dlabel:{valType:"number",dflt:1},values:{valType:"data_array"},marker:{colors:{valType:"data_array"},line:{color:{valType:"color",dflt:r.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},scalegroup:{valType:"string",dflt:""},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"]},hoverinfo:i({},o.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0},textfont:i({},a,{}),insidetextfont:i({},a,{}),outsidetextfont:i({},a,{}),domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},hole:{valType:"number",min:0,max:1,dflt:0},sort:{valType:"boolean",dflt:!0},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise"},rotation:{valType:"number",min:-360,max:360,dflt:0},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0}}},{"../../components/color/attributes":22,"../../lib/extend":112,"../../plots/attributes":140,"../../plots/font_attributes":162}],196:[function(t,e,n){"use strict";function r(t,e){for(var n=[],r=0;r")}return g};var s},{"../../components/color":23,"./helpers":199,"fast-isnumeric":10,tinycolor2:13}],198:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(n,o){return r.coerce(t,e,a,n,o)}var l=r.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,v=g||"inside"===p,m=g||"outside"===p;if(v||m){var y=l(i,"textfont",o.font);v&&l(i,"insidetextfont",y),m&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":115,"./attributes":195}],199:[function(t,e,n){"use strict";var r=t("../../lib");n.formatPiePercent=function(t,e){var n=(100*t).toPrecision(3);return n.lastIndexOf(".")!==-1&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)+"%"},n.formatPieValue=function(t,e){var n=t.toPrecision(10);return n.lastIndexOf(".")!==-1&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)}},{"../../lib":115}],200:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.layoutAttributes=t("./layout_attributes"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.styleOne=t("./style_one"),r.moduleType="trace",r.name="pie",r.basePlotModule=t("./base_plot"),r.categories=["pie","showLegend"],r.meta={},e.exports=r},{"./attributes":195,"./base_plot":196,"./calc":197,"./defaults":198,"./layout_attributes":201,"./layout_defaults":202,"./plot":203,"./style":204,"./style_one":205}],201:[function(t,e,n){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],202:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function n(n,o){return r.coerce(t,e,a,n,o)}n("hiddenlabels")}},{"../../lib":115,"./layout_attributes":201}],203:[function(t,e,n){"use strict";function r(t,e,n){var r=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/n.vTotal,.5),l=1-n.trace.hole,s=a(e,n),c={scale:s*n.r*2/r,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=n.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/n.r)-f*o/n.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=n.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),v={scale:2*g/t.width,rCenter:Math.cos(g/n.r)-g/o/n.r,rotate:(180/Math.PI*e.midangle+810)%180-90},m=v.scale>d.scale?v:d;return c.scale<1&&m.scale>c.scale?m:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var n=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(n)),(1-e.trace.hole)/2)}function o(t,e){var n=e.pxmid[0],r=e.pxmid[1],a=t.width/2,o=t.height/2;return n<0&&(a*=-1),r<0&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+n*n/(r*r)),outside:!0}}function i(t,e){function n(t,e){return t.pxmid[1]-e.pxmid[1]}function r(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,n){n||(n={});var r,a,o,l,d,h,g=n.labelExtraY+(i?n.yLabelMax:n.yLabelMin),v=i?t.yLabelMin:t.yLabelMax,m=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-v;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-v-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(m+t.labelExtraY-y)*f>0&&(r=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+r-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,v,m;for(i=0;i<2;i++)for(l=i?n:r,c=i?Math.max:Math.min,f=i?1:-1,o=0;o<2;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),v=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(n/c(l.tilt,Math.sin(s),l.depth),r/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&h.indexOf(l.scalegroup)===-1&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,n){if(!t)return 1;var r=Math.sin(t*Math.PI/180);return Math.max(.01,n*r*Math.abs(e)+2*Math.sqrt(1-r*r*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var n=t._fullLayout;l(e,n._size);var c=n._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],v=c.trace,m=0,y=(v.depth||0)*c.r*Math.sin(m)/2,x=v.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(m),k=l.selectAll("g.part").data(v.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],m=!1;l.each(function(i){function l(e){var r=t._fullLayout,o=t._fullData[v.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&r.hovermode!==!1&&"none"!==l&&"skip"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=n.separators,p=[];l.indexOf("label")!==-1&&p.push(i.label),o.text&&o.text[i.i]&&l.indexOf("text")!==-1&&p.push(o.text[i.i]),l.indexOf("value")!==-1&&p.push(g.formatPieValue(i.v,h)),l.indexOf("percent")!==-1&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:l.indexOf("name")!==-1?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:r._hoverlayer.node(),outerContainer:r._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(n._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],t._hoverdata.trace=e.trace,f.click(t,{target:!0})}function b(t,e,n,r){return"a"+r*c.r+","+r*w+" "+x+" "+i.largeArc+(n?" 1 ":" 0 ")+r*(e[0]-t[0])+","+r*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y),v.pull){var C=+(Array.isArray(v.pull)?v.pull[i.i]:v.pull)||0;C>0&&(k+=C*i.pxmid[0],M+=C*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var S=v.hole;if(i.v===c.vTotal){var z="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";S?T.attr("d","M"+(k+S*i.px0[0])+","+(M+S*i.px0[1])+b(i.px0,i.pxmid,!1,S)+b(i.pxmid,i.px0,!1,S)+"Z"+z):T.attr("d",z)}else{var O=b(i.px0,i.px1,!0,1);if(S){var P=1-S;T.attr("d","M"+(k+S*i.px1[0])+","+(M+S*i.px1[1])+b(i.px1,i.px0,!1,S)+"l"+P*i.px0[0]+","+P*i.px0[1]+O+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+O+"Z")}var D=Array.isArray(v.textposition)?v.textposition[i.i]:v.textposition,N=A.selectAll("g.slicetext").data(i.text&&"none"!==D?[0]:[]);N.enter().append("g").classed("slicetext",!0),N.exit().remove(),N.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===D?v.outsidetextfont:v.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,n=h.bBox(t.node());"outside"===D?e=o(n,i):(e=r(n,i,c),"auto"===D&&e.scale<1&&(t.call(h.font,v.outsidetextfont),v.outsidetextfont.family===v.insidetextfont.family&&v.outsidetextfont.size===v.insidetextfont.size||(t.attr({"data-bb":""}),n=h.bBox(t.node())),e=o(n,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-n.height/2,i.yLabelMid=l,i.yLabelMax=l+n.height/2,i.labelExtraX=0,i.labelExtraY=0,m=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(n.left+n.right)/2+","+-(n.top+n.bottom)/2+")")})}),m&&i(s,v),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),n=e.select("g.slicetext text");n.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+n.attr("transform"));var r=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+r+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(r+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,v.outsidetextfont.color).attr({"stroke-width":Math.min(2,v.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":23,"../../components/drawing":46,"../../lib/svg_text_utils":127,"../../plots/cartesian/graph_interact":149,"./helpers":199,d3:7}],204:[function(t,e,n){"use strict";var r=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],n=e.trace,o=r.select(this);o.style({opacity:n.opacity}),o.selectAll(".top path.surface").each(function(t){r.select(this).call(a,t,n)})})}},{"./style_one":205,d3:7}],205:[function(t,e,n){"use strict";var r=t("../../components/color");e.exports=function(t,e,n){var a=n.marker.line.color;Array.isArray(a)&&(a=a[e.i]||r.defaultLine);var o=n.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(r.stroke,a)}},{"../../components/color":23}],206:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t){var e=t[0].trace,n=e.marker;if(r.mergeArray(e.text,t,"tx"),r.mergeArray(e.textposition,t,"tp"),e.textfont&&(r.mergeArray(e.textfont.size,t,"ts"),r.mergeArray(e.textfont.color,t,"tc"),r.mergeArray(e.textfont.family,t,"tf")),n&&n.line){var a=n.line;r.mergeArray(n.opacity,t,"mo"),r.mergeArray(n.symbol,t,"mx"),r.mergeArray(n.color,t,"mc"),r.mergeArray(a.color,t,"mlc"),r.mergeArray(a.width,t,"mlw")}}},{"../../lib":115}],207:[function(t,e,n){"use strict";var r=t("../../components/colorscale/color_attributes"),a=t("../../components/errorbars/attributes"),o=t("../../components/colorbar/attributes"),i=t("../../components/drawing"),l=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},ids:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"},simplify:{valType:"boolean",dflt:!0}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:l({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},colorbar:o,line:l({},{width:{valType:"number",min:0,arrayOk:!0}},r("marker.line"))},r("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},error_y:a,error_x:a}},{"../../components/colorbar/attributes":24,"../../components/colorscale/color_attributes":30,"../../components/drawing":46,"../../components/errorbars/attributes":48,"../../lib/extend":112,"./constants":212}],208:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var n,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},v={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var m={type:"linear"};a.setConvert(m),s=m.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=v.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,a.expand(u,d,g),a.expand(f,h,v);var b=new Array(p);for(c=0;c=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}}}}},{}],210:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,s=n.marker,c="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===s||!s.showscale)return void o.autoMargin(t,c);var u=s.color,f=s.cmin,d=s.cmax;r(f)||(f=a.aggNums(Math.min,null,u)),r(d)||(d=a.aggNums(Math.max,null,u));var h=e[0].t.cb=l(t,c),p=i.makeColorScaleFunc(i.extractScale(s.colorscale,f,d),{noNumericCheck:!0});h.fillcolor(p).filllevels({start:f,end:d,size:(d-f)/254}).options(s.colorbar)()}},{"../../components/colorbar/draw":26,"../../components/colorscale":37,"../../lib":115,"../../plots/plots":166,"fast-isnumeric":10}],211:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":29,"../../components/colorscale/has_colorscale":36,"./subtypes":227}],212:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],213:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var v=l(t,e,g),m=vq!=D>=q&&(z=C[T-1][0],O=C[T][0],S=z+(O-z)*(q-P)/(D-P),R=Math.min(R,S),F=Math.max(F,S));R=Math.max(R,0),F=Math.min(F,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:F,y0:q,y1:q,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":23,"../../components/errorbars":52,"../../lib":115,"../../plots/cartesian/constants":147,"../../plots/cartesian/graph_interact":149,"./get_trace_color":215}],217:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.animatable=!0,r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"), r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":150,"./arrays_to_calcdata":206,"./attributes":207,"./calc":208,"./clean_data":209,"./colorbar":210,"./defaults":213,"./hover":216,"./plot":224,"./select":225,"./style":226,"./subtypes":227}],218:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=!Array.isArray(l)&&l||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":32,"../../components/colorscale/has_colorscale":36}],219:[function(t,e,n){"use strict";var r=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),a=k.c2p(t[e].y);return n!==r&&a!==r&&[n,a]}function a(t){var e=t[0]/w._length,n=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*T}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,v,m,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.simplify,A=e.connectGaps,T=e.baseTolerance,L=e.linear,C=[],S=.2,z=new Array(t.length),O=0;for(M||(T=S=-1),i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,c=f,h=!1):y=t.length||!f)break;z[O++]=f,l=f}}else z[O++]=c}C.push(z.slice(0,O))}return C}},{"../../constants/numerical":103}],220:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],221:[function(t,e,n){"use strict";e.exports=function(t,e,n){for(var r,a,o=null,i=0;i0?Math.max(e,a):0}}},{"fast-isnumeric":10}],223:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":23,"../../components/colorscale/defaults":32,"../../components/colorscale/has_colorscale":36,"./subtypes":227}],224:[function(t,e,n){"use strict";function r(t,e){var n;e.selectAll("g.trace").each(function(t){var e=i.select(this);if(n=t[0].trace,n._nexttrace){if(n._nextFill=e.select(".js-fill.js-tonext"),!n._nextFill.size()){var r=":first-child";e.select(".js-fill.js-tozero").size()&&(r+=" + *"),n._nextFill=e.insert("path",r).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),n._nextFill=null;n.fill&&("tozero"===n.fill.substr(0,6)||"toself"===n.fill||"to"===n.fill.substr(0,2)&&!n._prevtrace)?(n._ownFill=e.select(".js-fill.js-tozero"),n._ownFill.size()||(n._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),n._ownFill=null)})}function a(t,e,n,r,a,h,g){function v(t){return M?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,n,r=t[0].trace,a=i.select(this),o=u.hasMarkers(r),c=u.hasText(r),f=x(r),d=b,h=b;o&&(d=r.marker.maxdisplayed?m:l.identity),c&&(h=r.marker.maxdisplayed?m:l.identity),n=a.selectAll("path.point"),e=n.data(d,f);var p=e.enter().append("path").classed("point",!0);p.call(s.pointStyle,r).call(s.translatePoints,A,T,r),M&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=v(i.select(this));s.translatePoint(t,e,A,T),s.singlePointStyle(t,e,r)}),M?e.exit().transition().style("opacity",0).remove():e.exit().remove(),n=a.selectAll("g"),e=n.data(h,f),e.enter().append("g").append("text"),e.each(function(t){var e=v(i.select(this).select("text"));s.translatePoint(t,e,A,T)}),e.selectAll("text").call(s.textPointStyle,r).each(function(t){var e=t.xp||A.c2p(t.x),n=t.yp||T.c2p(t.y);i.select(this).selectAll("tspan").each(function(){v(i.select(this)).attr({x:e,y:n})})}),e.exit().remove()}var w,k;o(t,e,n,r,a);var M=!!g&&g.duration>0,A=n.xaxis,T=n.yaxis,L=r[0].trace,C=L.line,S=i.select(h);if(S.call(c.plot,n,g),L.visible===!0){v(S).style("opacity",L.opacity);var z,O,P=L.fill.charAt(L.fill.length-1);"x"!==P&&"y"!==P&&(P=""),r[0].node3=S,f(r);var D="",N=[],E=L._prevtrace;E&&(D=E._prevRevpath||"",O=E._nextFill,N=E._polygons);var I,R,F,j,B,q,H,V,X,U="",Z="",G=[],Y=[],W=l.noop;if(z=L._ownFill,u.hasLines(L)||"none"!==L.fill){for(O&&O.datum(r),["hv","vh","hvh","vhv"].indexOf(C.shape)!==-1?(F=s.steps(C.shape),j=s.steps(C.shape.split("").reverse().join(""))):F=j="spline"===C.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?s.smoothclosed(t.slice(1),C.smoothing):s.smoothopen(t,C.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return j(t.reverse())},G=d(r,{xaxis:A,yaxis:T,connectGaps:L.connectgaps,baseTolerance:Math.max(C.width||1,3)/4,linear:"linear"===C.shape,simplify:C.simplify}),X=L._polygons=new Array(G.length),k=0;k1}),W=function(t){return function(e){if(I=F(e),R=B(e),U?P?(U+="L"+I.substr(1),Z=R+("L"+Z.substr(1))):(U+="Z"+I,Z=R+"Z"+Z):(U=I,Z=R),u.hasLines(L)&&e.length>1){var n=i.select(this);if(n.datum(r),t)v(n.style("opacity",0).attr("d",I).call(s.lineGroupStyle)).style("opacity",1);else{var a=v(n);a.attr("d",I),s.singleLineStyle(r,a)}}}}}var Q=S.selectAll(".js-line").data(Y);v(Q.exit()).style("opacity",0).remove(),Q.each(W(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(W(!0)),G.length&&(z?q&&V&&(P?("y"===P?q[1]=V[1]=T.c2p(0,!0):"x"===P&&(q[0]=V[0]=A.c2p(0,!0)),v(z).attr("d","M"+V+"L"+q+"L"+U.substr(1))):v(z).attr("d",U+"Z")):"tonext"===L.fill.substr(0,6)&&U&&D&&("tonext"===L.fill?v(O).attr("d",U+"Z"+D+"Z"):v(O).attr("d",U+"L"+D.substr(1)+"Z"),L._polygons=L._polygons.concat(N)),L._prevRevpath=Z,L._prevPolygons=X);var $=S.selectAll(".points");w=$.data([r]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function o(t,e,n,r,a){var o=n.xaxis,l=n.yaxis,s=i.extent(o.range.map(o.r2l).map(o.l2c)),c=i.extent(l.range.map(l.r2l).map(l.l2c)),f=r[0].trace;if(u.hasMarkers(f)){var d=f.marker.maxdisplayed;if(0!==d){var h=r.filter(function(t){return t.x>=s[0]&&t.x<=s[1]&&t.y>=c[0]&&t.y<=c[1]}),p=Math.ceil(h.length/d),g=0;a.forEach(function(t,n){var r=t[0].trace;u.hasMarkers(r)&&r.marker.maxdisplayed>0&&n0;for(u=p.selectAll("g.trace"),f=u.data(n,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),h(t,e,n),r(t,p),s=0,c=[];sr?1:-1}),v){l&&(d=l());var m=i.transition().duration(o.duration).ease(o.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()});m.each(function(){p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)})})}else p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":46,"../../components/errorbars":52,"../../lib":115,"../../lib/polygon":122,"./arrays_to_calcdata":206,"./line_points":219,"./link_traces":221,"./subtypes":227,d3:7}],225:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;n0&&(e=e.transition().duration(C)),e.call(t.event)}function l(){_&&_.domain(b.r O[0]=f[P],O[1]=d[N]}else ui.event.altKey&&(x=O.slice());M.style("pointer-events","none").selectAll(".resize").style("display",null),ui.select("body").style("cursor",w.style("cursor")),k({type:"brushstart"}),m()}var i,l,s=z(t,"brushstart","brush","brushend"),c=null,u=null,f=[0,0],d=[0,0],h=!0,p=!0,g=Ys[0];return t.event=function(t){t.each(function(){var t=s.of(this,arguments),e={x:f,y:d,i:i,j:l},r=this.__chart__||e;this.__chart__=e,qs?ui.select(this).transition().each("start.brush",function(){i=r.i,l=r.j,f=r.x,d=r.y,t({type:"brushstart"})}).tween("brush:brush",function(){var r=wn(f,e.x),n=wn(d,e.y);return i=l=null,function(a){f=e.x=r(a),d=e.y=n(a),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){i=e.i,l=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(c=e,g=Ys[!c<<1|!u],t):c},t.y=function(e){return arguments.length?(u=e,g=Ys[!c<<1|!u],t):u},t.clamp=function(e){return arguments.length?(c&&u?(h=!!e[0],p=!!e[1]):c?h=!!e:u&&(p=!!e),t):c&&u?[h,p]:c?h:u?p:null},t.extent=function(e){var r,n,a,o,s;return arguments.length?(c&&(r=e[0],n=e[1],u&&(r=r[0],n=n[0]),i=[r,n],c.invert&&(r=c(r),n=c(n)),n0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!a(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,o,l;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,n=-1,r===e||a(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(r)){for(l=o;l-- >0;)if(r[l]===e||r[l].listener&&r[l].listener===e){n=l;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(r=this._events[t],a(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],17:[function(t,e,r){"use strict";function n(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}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],18:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],a=e[2],o=e[3],i=r+r,l=n+n,s=a+a,c=r*i,u=n*i,f=n*l,d=a*i,h=a*l,p=a*s,g=o*i,m=o*l,v=o*s;return t[0]=1-f-p,t[1]=u+v,t[2]=d-m,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+m,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],19:[function(t,e,r){function n(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function i(t){if(d===clearTimeout)return clearTimeout(t);if((d===a||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{return d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}function l(){m&&p&&(m=!1,p.length?g=p.concat(g):v=-1,g.length&&s())}function s(){if(!m){var t=o(l);m=!0;for(var e=g.length;e;){for(p=g,g=[];++v1)for(var r=1;r.5?s/(2-o-i):s/(o+i),o){case t:n=(e-r)/s+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var a,o,i;if(t=z(t,360),e=z(e,100),r=z(r,100),0===e)a=o=i=r;else{var l=r<.5?r*(1+e):r+e-r*e,s=2*r-l;a=n(s,l,t+1/3),o=n(s,l,t),i=n(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function s(t,e,r){t=z(t,255),e=z(e,255),r=z(r,255);var n,a,o=X(t,e,r),i=Z(t,e,r),l=o,s=o-i;if(a=0===o?0:s/o,o==i)n=0;else{switch(o){case t:n=(e-r)/s+(e>1)+720)%360;--e;)a.h=(a.h+o)%360,i.push(n(a));return i}function A(t,e){e=e||6;for(var r=n(t).toHsv(),a=r.h,o=r.s,i=r.v,l=[],s=1/e;e--;)l.push(n({h:a,s:o,v:i})),i=(i+s)%1;return l}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function z(t,r){O(t)&&(t="100%");var n=D(t);return t=Z(r,X(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function C(t){return Z(1,X(0,t))}function S(t){return parseInt(t,16)}function O(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function D(t){return"string"==typeof t&&t.indexOf("%")!=-1}function P(t){return 1==t.length?"0"+t:""+t}function N(t){return t<=1&&(t=100*t+"%"),t}function E(t){return e.round(255*parseFloat(t)).toString(16)}function I(t){return S(t)/255}function R(t){return!!W.CSS_UNIT.exec(t)}function F(t){t=t.replace(q,"").replace(B,"").toLowerCase();var e=!1;if(G[t])t=G[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=W.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=W.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=W.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=W.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=W.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=W.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=W.hex8.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),a:I(r[4]),format:e?"name":"hex8"}:(r=W.hex6.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),format:e?"name":"hex"}:(r=W.hex4.exec(t))?{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),a:I(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=W.hex3.exec(t))&&{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),format:e?"name":"hex"}}function j(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var q=/^\s+/,B=/\s+$/,H=0,V=e.round,Z=e.min,X=e.max,U=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,a,o,i,l=this.toRgb();return t=l.r/255,r=l.g/255,n=l.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),o=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),i=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*a+.7152*o+.0722*i},setAlpha:function(t){return this._a=L(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*z(this._r,255))+"%",g:V(100*z(this._g,255))+"%",b:V(100*z(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*z(this._r,255))+"%, "+V(100*z(this._g,255))+"%, "+V(100*z(this._b,255))+"%)":"rgba("+V(100*z(this._r,255))+"%, "+V(100*z(this._g,255))+"%, "+V(100*z(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[u(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),r=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=n(t);r="#"+d(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,a=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?r[a]=t[a]:r[a]=N(t[a]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:U(),g:U(),b:U()})},n.mix=function(t,e,r){r=0===r?0:r||50;var a=n(t).toRgb(),o=n(e).toRgb(),i=r/100,l={r:(o.r-a.r)*i+a.r,g:(o.g-a.g)*i+a.g,b:(o.b-a.b)*i+a.b,a:(o.a-a.a)*i+a.a};return n(l)},n.readability=function(t,r){var a=n(t),o=n(r);return(e.max(a.getLuminance(),o.getLuminance())+.05)/(e.min(a.getLuminance(),o.getLuminance())+.05)},n.isReadable=function(t,e,r){var a,o,i=n.readability(t,e);switch(o=!1,a=j(r),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},n.mostReadable=function(t,e,r){var a,o,i,l,s=null,c=0;r=r||{},o=r.includeFallbackColors,i=r.level,l=r.size;for(var u=0;uc&&(c=a,s=n(e[u]));return n.isReadable(t,s,{level:i,size:l})||!o?s:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var G=n.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=n.hexNames=T(G),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],21:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../color"),o=t("../../plots/cartesian/axes"),i=t("./attributes");e.exports=function(t,e,r,l,s){function c(r,a){return n.coerce(t,e,i,r,a); }l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("opacity"),c("align"),c("bgcolor");var f=c("bordercolor"),d=a.opacity(f);c("borderpad");var h=c("borderwidth"),p=c("showarrow");c("text",p?" ":"new text"),c("textangle"),n.coerceFont(c,"font",r.font);for(var g=["x","y"],m=[-10,-30],v={_fullLayout:r},y=0;y<2;y++){var x=g[y],b=o.coerceRef(t,e,v,x,"","paper");if(o.coercePosition(e,v,c,b,x,.5),p){var _="a"+x,w=o.coerceRef(t,e,v,_,"pixel");"pixel"!==w&&w!==b&&(w=e[_]="pixel");var k="pixel"===w?m[y]:.4;o.coercePosition(e,v,c,w,_,k)}else c(x+"anchor")}return n.noneOrAll(t,e,["x","y"]),p&&(c("arrowcolor",d?e.bordercolor:a.defaultLine),c("arrowhead"),c("arrowsize"),c("arrowwidth",2*(d&&h||1)),n.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":122,"../../plots/cartesian/axes":149,"../color":30,"./attributes":23}],22:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],23:[function(t,e,r){"use strict";var n=t("./arrow_paths"),a=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),i=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:i({},a,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":119,"../../plots/cartesian/constants":154,"../../plots/font_attributes":169,"./arrow_paths":22}],24:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=o.getFromId(t,e.xref),n=o.getFromId(t,e.yref);if(r||n){var a=(e._xsize||0)/2,i=e._xshift||0,l=(e._ysize||0)/2,s=e._yshift||0,c=a-i,u=a+i,f=l-s,d=l+s;if(e.showarrow){var h=3*e.arrowsize*e.arrowwidth;c=Math.max(c,h),u=Math.max(u,h),f=Math.max(f,h),d=Math.max(d,h)}r&&r.autorange&&o.expand(r,[r.l2c(r.r2l(e.x))],{ppadplus:u,ppadminus:c}),n&&n.autorange&&o.expand(n,[n.l2c(n.r2l(e.y))],{ppadplus:d,ppadminus:f})}})}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.annotations);if(r.length&&t._fullData.length){var l={};r.forEach(function(t){l[t.xref]=!0,l[t.yref]=!0});var s=o.list(t).filter(function(t){return t.autorange&&l[t._id]});if(s.length)return a.syncOrAsync([i,n],t)}}},{"../../lib":122,"../../plots/cartesian/axes":149,"./draw":26}],25:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),a=t("./annotation_defaults");e.exports=function(t,e){var r={name:"annotations",handleItemDefaults:a};n(t,e,r)}},{"../../plots/array_container_defaults":146,"./annotation_defaults":21}],26:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=$.select(".annotation-math-group"),a=!n.empty(),l=h.bBox((a?n:nt).node()),c=l.width,p=l.height,v=Math.round(c+2*tt),y=Math.round(p+2*tt);Z._w=c,Z._h=p;var b=!1;if(["x","y"].forEach(function(e){var n,a=Z[e+"ref"]||e,o=f.getFromId(t,a),i=(Y+("x"===e?0:90))*Math.PI/180,l=v*Math.abs(Math.cos(i))+y*Math.abs(Math.sin(i)),s=Z[e+"anchor"];if(o){var c=o.r2fraction(Z[e]);if(!o.autorange&&(c<0||c>1)&&(Z["a"+e+"ref"]===a?(c=o.r2fraction(Z["a"+e]),(c<0||c>1)&&(b=!0)):b=!0,b))return;G[e]=o._offset+o.r2p(Z[e]),n=.5}else n=Z[e],"y"===e&&(n=1-n),G[e]="x"===e?O.l+O.w*n:O.t+O.h*n;var u=0;Z["a"+e+"ref"]===a?G["aa"+e]=o._offset+o.r2p(Z["a"+e]):(u=Z.showarrow?Z["a"+e]:l*r(n,s),G[e]+=u),Z["_"+e+"type"]=o&&o.type,Z["_"+e+"size"]=l,Z["_"+e+"shift"]=u}),b)return void $.remove();var _,w;Z.showarrow&&(_=Z.axref===Z.xref?G.x:u.constrain(G.x-Z.ax,1,M.width-1),w=Z.ayref===Z.yref?G.y:u.constrain(G.y-Z.ay,1,M.height-1)),G.x=u.constrain(G.x,1,M.width-1),G.y=u.constrain(G.y,1,M.height-1);var k=tt-l.top,A=tt-l.left;a?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:A,y:k}),nt.selectAll("tspan.line").attr({y:k,x:A})),et.call(h.setRect,J/2,J/2,v-J,y-J);var T=0,L=0;T=Z.axref===Z.xref?Math.round(G.aax-v/2):Math.round(G.x-v/2),L=Z.ayref===Z.yref?Math.round(G.aay-y/2):Math.round(G.y-y/2),$.call(u.setTranslate,T,L);var z="annotations["+e+"]",C=function(r,n){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=Z.axref===Z.xref?G.aax+r:G.x+r,l=Z.ayref===Z.yref?G.aay+n:G.y+n;var c=u.rotationXYMatrix(Y,a,l),f=u.apply2DTransform(c),h=u.apply2DTransform2(c),p=et.attr("width")/2,g=et.attr("height")/2,v=[[a-p,l-g,a-p,l+g],[a-p,l+g,a+p,l+g],[a+p,l+g,a+p,l-g],[a+p,l-g,a-p,l-g]].map(h);if(!v.reduce(function(t,e){return t^!!o(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=o(a,l,_,w,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var y=Z.arrowwidth,b=Z.arrowcolor,k=W.append("g").style({opacity:d.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=k.append("path").attr("d","M"+a+","+l+"L"+_+","+w).style("stroke-width",y+"px").call(d.stroke,d.rgb(b));x(M,Z.arrowhead,"end",Z.arrowsize);var A=k.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-_)+","+(l-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,C;m.init({element:A.node(),prepFn:function(){var t=u.getTranslate($);L=t.x,C=t.y,T={},X&&X.autorange&&(T[X._name+".autorange"]=!0),U&&U.autorange&&(T[U._name+".autorange"]=!0)},moveFn:function(t,e){k.attr("transform","translate("+t+","+e+")");var r=f(L,C),n=r[0]+t,a=r[1]+e;$.call(u.setTranslate,n,a),T[z+".x"]=X?X.p2r(X.r2p(Z.x)+t):(_+t-O.l)/O.w,T[z+".y"]=U?U.p2r(U.r2p(Z.y)+e):1-(w+e-O.t)/O.h,Z.axref===Z.xref&&(T[z+".ax"]=X?X.p2r(X.r2p(Z.ax)+t):(_+t-O.l)/O.w),Z.ayref===Z.yref&&(T[z+".ay"]=U?U.p2r(U.r2p(Z.ay)+e):1-(w+e-O.t)/O.h),Q.attr({transform:"rotate("+Y+","+n+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};Z.showarrow&&C(0,0);var S=u.rotationXYMatrix(Y,G.x,G.y),D=u.apply2DTransform(S);if(t._context.editable){var P,N,E;m.init({element:$.node(),prepFn:function(){var t=u.getTranslate($);P=t.x,N=t.y,E={}},moveFn:function(t,e){$.call(u.setTranslate,P+t,N+e);var r="pointer";if(Z.showarrow)Z.axref===Z.xref?E[z+".ax"]=X.p2r(X.r2p(Z.ax)+t):E[z+".ax"]=Z.ax+t,Z.ayref===Z.yref?E[z+".ay"]=U.p2r(U.r2p(Z.ay)+e):E[z+".ay"]=Z.ay+e,C(t,e);else{if(X)E[z+".x"]=Z.x+t/X._m;else{var n=Z._xsize/O.w,a=Z.x+Z._xshift/O.w-n/2;E[z+".x"]=m.align(a+t/O.w,n,0,1,Z.xanchor)}if(U)E[z+".y"]=Z.y+e/U._m;else{var o=Z._ysize/O.h,i=Z.y-Z._yshift/O.h-o/2;E[z+".y"]=m.align(i-e/O.h,o,0,1,Z.yanchor)}X&&U||(r=m.getCursor(X?.5:E[z+".x"],U?.5:E[z+".y"],Z.xanchor,Z.yanchor))}var l=D(P,N),s=l[0]+t,c=l[1]+e;$.call(u.setTranslate,P+t,N+e),Q.attr({transform:"rotate("+Y+","+s+","+c+")"}),g($,r)},doneFn:function(e){if(g($),e){s.relayout(t,E);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,k=t.layout,M=t._fullLayout;if(!l(e)||e===-1){if(!e&&Array.isArray(c))return k.annotations=c,y(k,M),void n(t);if("remove"===c)return delete k.annotations,M.annotations=[],void n(t);if(r&&"add"!==c){for(w=0;we;w--)M._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),a(t,w)}}M._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=k.annotations[e],L=M.annotations[e];if(T){var z={};"string"==typeof r&&r?z[r]=c:u.isPlainObject(r)&&(z=r);var C=Object.keys(z);for(w=0;w4/3&&(R=H)}}else I&&(j&&(R<1/3?R+=B:R>2/3&&(R-=B)),R=(R-I.domain[0])/(I.domain[1]-I.domain[0]),R=I.fraction2r(R))}I&&I===E&&F&&("log"===F&&"log"!==I.type?R=Math.pow(10,R):"log"!==F&&"log"===I.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),T[N]=R}}var Z={};v(T,Z,M),M.annotations[e]=Z;var X=f.getFromId(t,Z.xref),U=f.getFromId(t,Z.yref),G={x:0,y:0},Y=+Z.textangle||0,W=M._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",Z.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:Z})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),J=Z.borderwidth,K=Z.borderpad,tt=J+K,et=$.append("rect").attr("class","bg").style("stroke-width",J+"px").call(d.stroke,Z.bordercolor).call(d.fill,Z.bgcolor),rt=Z.font,nt=$.append("text").classed("annotation",!0).attr("data-unformatted",Z.text).text(Z.text);t._context.editable?nt.call(p.makeEditable,$).call(b).on("edit",function(r){Z.text=r,this.attr({"data-unformatted":Z.text}),this.call(b);var n={};n["annotations["+e+"].text"]=Z.text,X&&X.autorange&&(n[X._name+".autorange"]=!0),U&&U.autorange&&(n[U._name+".autorange"]=!0),s.relayout(t,n)}):nt.call(b),Q.attr({transform:"rotate("+Y+","+G.x+","+G.y+")"}).call(h.setPosition,G.x,G.y)}}}function o(t,e,r,n,a,o,i,l){var s=r-t,c=a-t,u=i-a,f=n-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,m=(c*f-s*d)/p;return m<0||m>1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:n,drawOne:a}},{"../../lib":122,"../../lib/setcursor":132,"../../lib/svg_text_utils":134,"../../plotly":144,"../../plots/cartesian/axes":149,"../../plots/plots":173,"../color":30,"../dragelement":51,"../drawing":53,"./annotation_defaults":21,"./defaults":25,"./draw_arrow_head":27,d3:14,"fast-isnumeric":17}],27:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),o=t("../color"),i=t("../drawing"),l=t("./arrow_paths");e.exports=function(t,e,r,s){a(s)||(s=1);var c=t.node(),u=l[e||0];if(u){"string"==typeof r&&r||(r="end");var f,d,h,p,g=(i.getPx(t,"stroke-width")||1)*s,m=t.style("stroke")||o.defaultLine,v=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,x=r.indexOf("end")>=0,b=u.backoff*g;if("line"===c.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},d={x:+t.attr("x2"),y:+t.attr("y2")},h=Math.atan2(f.y-d.y,f.x-d.x),p=h+Math.PI,b){var _=b*Math.cos(h),w=b*Math.sin(h);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(d.x+=_,d.y+=w,t.attr({x2:d.x,y2:d.y}))}}else if("path"===c.nodeName){var k=c.getTotalLength(),M="";if(y){var A=c.getPointAtLength(0),T=c.getPointAtLength(.1);h=Math.atan2(A.y-T.y,A.x-T.x),f=c.getPointAtLength(Math.min(b,k)),b&&(M="0px,"+b+"px,")}if(x){var L=c.getPointAtLength(k),z=c.getPointAtLength(k-.1);if(p=Math.atan2(L.y-z.y,L.x-z.x),d=c.getPointAtLength(Math.max(0,k-b)),b){var C=M?2*b:b;M+=k-C+"px,"+k+"px"}}else M&&(M+=k+"px");M&&t.style("stroke-dasharray",M)}var S=function(r,a){e>5&&(a=0),n.select(c.parentElement).append("path").attr({class:t.attr("class"),d:u.path,transform:"translate("+r.x+","+r.y+")rotate("+180*a/Math.PI+")scale("+g+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&S(f,h),x&&S(d,p)}}},{"../color":30,"../drawing":53,"./arrow_paths":22,d3:14,"fast-isnumeric":17}],28:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":23,"./calc_autorange":24,"./defaults":25,"./draw":26}],29:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],30:[function(t,e,r){"use strict";function n(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===n.length;if(!a&&3!==n.length)return t;for(var i=0;i=0))return t;if(3===i)n[i]>1&&(n[i]=1);else if(n[i]>=1)return t}var l=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return a?"rgba("+l+", "+n[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var r=a(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},i.combine=function(t,e){var r=a(t).toRgb();if(1===r.a)return a(t).toRgbString();var n=a(e||i.background).toRgb(),o=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},l={r:o.r*(1-r.a)+r.r*r.a,g:o.g*(1-r.a)+r.g*r.a,b:o.b*(1-r.a)+r.b*r.a};return a(l).toRgbString()},i.contrast=function(t,e,r){var n=a(t),o=n.isLight()?n.darken(r):n.lighten(e);return o.toString()},i.stroke=function(t,e){var r=a(e);t.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(t,e){var r=a(e);t.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,r,a,o,l=Object.keys(t);for(e=0;el&&(o[1]-=(lt-l)/2)):r.node()&&!r.classed("js-placeholder")&&(lt=h.bBox(e.node()).height),lt){if(lt+=5,"top"===_.titleside)K.domain[1]-=lt/T.h,o[1]*=-1;else{K.domain[0]+=lt/T.h;var c=Math.max(1,r.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),K.setScale()}}ot.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-K.domain[1]))+")");var f=ot.select(".cbfills").selectAll("rect.cbfill").data(S);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?z[0]:(S[e]+S[e-1])/2,e===S.length-1?z[1]:(S[e]+S[e+1])/2].map(K.c2p).map(Math.round);e!==S.length-1&&(r[1]+=r[1]>r[0]?1:-1);var o=D(t).replace("e-",""),i=a(o).toHexString();n.select(this).attr({x:G,width:Math.max(q,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:i})});var d=ot.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?C:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){n.select(this).attr("d","M"+G+","+(Math.round(K.c2p(t))+_.line.width/2%1)+"h"+q).call(h.lineGroupStyle,_.line.width,O(t),_.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=G+q+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=K.titlefont.size,r=K._offset+K._length/2,a=T.l+(K.position||0)*T.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));k("h"+K._id+"title",{avoid:{selection:n.select(t).selectAll("g."+K._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:A.width},attributes:{x:a,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function k(e,r){var n,a=b();n=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:K,propName:n,traceIndex:a.index,dfltName:"colorscale",containerGroup:ot.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;ot.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,r||{}))}function M(){var r=q+_.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(R=it.select("text"),R.node()&&!R.classed("js-placeholder")){var n,a=it.select(".h"+K._id+"title-math-group").node();n=a&&["top","bottom"].indexOf(_.titleside)!==-1?h.bBox(a).width:h.bBox(it.node()).right-G-T.l,r=Math.max(r,n)}var o=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,l=Q-$;ot.select(".cbbg").attr({x:G-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-X,width:Math.max(o,2),height:Math.max(l+2*X,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),ot.selectAll(".cboutline").attr({x:G,y:$+_.ypad+("top"===_.titleside?lt:0),width:Math.max(q,2),height:Math.max(l-2*_.ypad-lt,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var s=({center:.5,right:1}[_.xanchor]||0)*o;ot.attr("transform","translate("+(T.l-s)+","+T.t+")"),i.autoMargin(t,e,{x:_.x,y:_.y,l:o*({right:1,center:.5}[_.xanchor]||0),r:o*({left:1,center:.5}[_.xanchor]||0),t:l*({bottom:1,middle:.5}[_.yanchor]||0),b:l*({top:1,middle:.5}[_.yanchor]||0)})}var A=t._fullLayout,T=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var L,z=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),C=[],S=[],O="function"==typeof _.line.color?_.line.color:function(){return _.line.color},D="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},P=_.levels.end+_.levels.size/100,N=_.levels.size,E=1.001*z[0]-.001*z[1],I=1.001*z[1]-.001*z[0];for(L=_.levels.start;(L-P)*N<0;L+=N)L>E&&Lz[0]&&L1){var at=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=at*u.roundUp(nt/at,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+U,W+V-U],K.setScale();var ot=A._infolayer.selectAll("g."+e).data([0]);ot.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),ot.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var it=ot.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");K._axislayer=ot.select(".cbaxis");var lt=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var st,ct=T.l+(_.x+Z)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-U))*T.h+T.t+3+.75*ut:(1-(W+U))*T.h+T.t-3-.25*ut,k(K._id+"title",{attributes:{x:ct,y:st,"text-anchor":"start"}})}var ft=u.syncOrAsync([i.previousPromises,w,i.previousPromises,M],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var dt,ht,pt;c.init({element:ot.node(),prepFn:function(){dt=ot.attr("transform"),d(ot)},moveFn:function(t,e){ot.attr("transform",dt+" translate("+t+","+e+")"),ht=c.align(Y+t/T.w,B,0,1,_.xanchor),pt=c.align(W-e/T.h,V,0,1,_.yanchor);var r=c.getCursor(ht,pt,_.xanchor,_.yanchor);d(ot,r)},doneFn:function(e){d(ot),e&&void 0!==ht&&void 0!==pt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":pt},b().index)}})}return ft}function b(){var r,n,a=e.substr(2);for(r=0;r=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":122,"./flip_scale":41,"./scales":48}],37:[function(t,e,r){"use strict";var n=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},n.colorscale,{}),cauto:a({},n.zauto,{}),cmax:a({},n.zmax,{}),cmin:a({},n.zmin,{}),autocolorscale:a({},n.autocolorscale,{}),reversescale:a({},n.reversescale,{})}}},{"../../lib/extend":119,"./attributes":35,"./scales.js":48}],38:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":48}],39:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,r,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,m=p[d+"min"],v=p[d+"max"],y=p.colorscale,x=n(m)&&n(v)&&m=0;a--,o++)e=t[a],n[o]=[1-e[0],e[1]];return n}},{}],42:[function(t,e,r){"use strict";var n=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=a),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),o(t)?t:e):e}},{"./default_scale":38,"./is_valid_scale_array":46,"./scales":48}],43:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var r=e?a.nestedProperty(t,e).get()||{}:t,i=r.color,l=!1;if(Array.isArray(i))for(var s=0;s4/3-l?i:l}},{}],50:[function(t,e,r){"use strict";var n=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,o){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:n.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":122}],51:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),h.dispatchEvent(r)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=n},{"../../lib":122,"../../plotly":144,"../../plots/cartesian/constants":154,"./align":49,"./cursor":50,"./unhover":52}],52:[function(t,e,r){"use strict";var n=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,r)},a.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":118}],53:[function(t,e,r){"use strict";function n(t,e,r,n,a,o,i){if(l.traceIs(r,"symbols")){var c=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(r)?c(t.ms):(o.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||o.symbol)||0,a=n%100;return t.om=n%200>=100,g.symbolFuncs[a](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=n(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,r,n){var a=t[0]-e[0],i=t[1]-e[1],l=r[0]-e[0],s=r[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*n,d=(u*u*i-c*c*s)*n,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,a){t.call(g.setPosition,e,r).call(g.setSize,n,a)},g.translatePoint=function(t,e,r,n){var a=t.xp||r.c2p(t.x),o=t.yp||n.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=r||o.width||0,l=a||o.dash||"";s.stroke(e,n||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=n||a.dash||"";o.select(this).call(s.stroke,r||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=o.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),r.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var a=r.marker,o=a.line,i=g.tryColorscale(a,""),l=g.tryColorscale(a,"line");n(t,e,r,i,l,a,o)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),a=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,o.select(this),e,n,a)})}},g.tryColorscale=function(t,e){var r=e?u.nestedProperty(t,e).get():t,n=r.colorscale,a=r.color;return n&&Array.isArray(a)?c.makeColorScaleFunc(c.extractScale(n,r.cmin,r.cmax)):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=o.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,r.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(n).call(f.convertToTspans);var d=o.select(this.parentNode),h=r.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,m=x[s]*u,v=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+m+","+v+")"),p>1&&h.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],o=[];for(r=1;r=A&&(o.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=o.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":112,"../../lib":122,"../../lib/svg_text_utils":134,"../../registry":188,"../../traces/scatter/make_bubble_size_func":286,"../../traces/scatter/subtypes":291,"../color":30,"../colorscale":44,"./symbol_defs":54,d3:14,"fast-isnumeric":17}],54:[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,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+r+a+o+a+o+i+o+i+r+i+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),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(2*t/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(2*t/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(2*t/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(.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),a=n.round(-t,2),o=n.round(t*-.309,2),i=n.round(.809*t,2);return"M"+e+","+o+"L"+r+","+i+"H-"+r+"L-"+e+","+o+"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(.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),a=n.round(.951*e,2),o=n.round(.363*e,2),i=n.round(.588*e,2),l=n.round(-e,2),s=n.round(e*-.309,2),c=n.round(.118*e,2),u=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+r+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),a=n.round(.76*t,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(.8*t,2),a=n.round(1.6*t,2),o=n.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+r+i+e+","+r+i+"0,-"+a+i+"-"+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),a=n.round(1.6*t,2),o=n.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+r+i+"-"+e+",-"+r+i+"0,"+a+i+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,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(1.4*t,2),r=n.round(1.9*t,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),a=n.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:14}],55:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],56:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e["error_"+n]||{},s=o.visible&&["linear","log"].indexOf(r.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var m=g.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=n(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");l=!m.size(),l?m=e.append("path").classed("yerror",!0):u&&(m=m.transition().duration(r.duration).ease(r.easing)),m.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var v=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-v)+"v"+2*v+"m0,-"+v+"H"+i.xs,i.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":291,d3:14,"fast-isnumeric":17}],61:[function(t,e,r){"use strict";var n=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},o=e.error_x||{},i=n.select(this);i.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),o.copy_ystyle&&(o=r),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":30,d3:14}],62:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":154}],63:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,l,r,n)}var i=n("source"),s=n("visible",!!i);if(!s)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var c={_fullLayout:r},u=["x","y"],f=0;f<2;f++)o.coerceRef(t,e,c,u[f],"paper");return e}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("../../plots/array_container_defaults"),l=t("./attributes"),s="images";e.exports=function(t,e){var r={name:s,handleItemDefaults:n};i(t,e,r)}},{"../../lib":122,"../../plots/array_container_defaults":146,"../../plots/cartesian/axes":149,"./attributes":62}],64:[function(t,e,r){"use strict";var n=t("d3"),a=t("../drawing"),o=t("../../plots/cartesian/axes"),i=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",i.svg);var a=new Promise(function(t){function n(){r.remove(),t()}var a=new Image;this.img=a,a.setAttribute("crossOrigin","anonymous"),a.onerror=n,a.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),a.src=e.source}.bind(this));t._promises.push(a)}}function r(e){var r=n.select(this),i=o.getFromId(t,e.xref),s=o.getFromId(t,e.yref),c=l._size,u=i?Math.abs(i.l2p(e.sizex)-i.l2p(0)):e.sizex*c.w,f=s?Math.abs(s.l2p(e.sizey)-s.l2p(0)):e.sizey*c.h,d=u*h.x[e.xanchor].offset,p=f*h.y[e.yanchor].offset,g=h.x[e.xanchor].sizing+h.y[e.yanchor].sizing,m=(i?i.r2p(e.x)+i._offset:e.x*c.w+c.l)+d,v=(s?s.r2p(e.y)+s._offset:c.h-e.y*c.h+c.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:m,y:v,width:u,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=i?i._id:"",x=s?s._id:"",b=y+x;b&&r.call(a.setClipUrl,"clip"+l._uid+b)}for(var l=t._fullLayout,s=[],c=[],u=[],f=0;f=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}},{}],67:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat; -e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":119,"../../plots/font_attributes":169,"../color/attributes":29}],68:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],69:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,r){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":122,"../../plots/layout_attributes":171,"../../registry":188,"./attributes":67,"./helpers":72}],70:[function(t,e,r){"use strict";function n(t,e){function r(r){v.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(o,e)})}var n=t.data()[0][0],a=e._fullLayout,i=n.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?n.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var a,o=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=n.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(r)}function a(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=r.indexOf(f);d===-1?r.push(f):r.splice(d,1),u.relayout(e,"hiddenlabels",r)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;r=l*d,n=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}r=Math.max(r,16)+3,a.height=r,a.width=n}function i(t,e,r){var n=t._fullLayout,a=n.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.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,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),r.each(function(e){var r=e[0],n=c.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:a.width)+40,r.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;un.width-(n.margin.r+n.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+r,a.height=Math.max(a.height,e.height),x+=i+r,v=Math.max(e.height,v)}),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],n=c.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:a.width,r.height)})}}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var a="top";w.isBottomAnchor(r)?a="bottom":w.isMiddleAnchor(r)&&(a="middle"),d.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[a]||0),t:r.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),d.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),z.call(g.setRect,j,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){var v=r.legend,_=r.showlegend&&x(t.calcdata,v),k=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=r._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var z=M.selectAll("rect.scrollbar").data([0]);z.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var C=L.selectAll("g.groups").data(_);C.enter().append("g").attr("class","groups"),C.exit().remove();var S=C.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,C,S),l(t));var D=0,P=r.width,N=0,E=r.height;i(t,C,S),v.height>E?s(t):l(t);var I=r._size,R=I.l+I.w*v.x,F=I.t+I.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?F-=v.height:w.isMiddleAnchor(v)&&(F-=v.height/2);var j=v.width,q=I.w;j>q?(R=I.l,j=q):(R+j>P&&(R=P-j),RH?(F=I.t,B=H):(F+B>E&&(F=E-B),Fr[1])return r[1]}return a}function r(t){return t[0]}var n,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",r,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?n:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(n[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||n.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||r.color),e&&a.call(d.stroke,t.mlc||n.color)})}function i(t){var e=t[0].trace,r=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=s.select(this);n.style("stroke-width",r+"px").call(d.fill,t.fc||e.fillcolor),r&&n.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,r=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(n).each(a)}},{"../../lib":122,"../../registry":188,"../../traces/pie/style_one":269,"../../traces/scatter/subtypes":291,"../color":30,"../drawing":53,d3:14}],75:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),a=r.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===n){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),i(m,r);u&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),d&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!c&&!p||v||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):c?n(["hoverClosestCartesian","hoverCompareCartesian"]):h&&n(["hoverClosestPie"]),i(m,r)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=a(e,r,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",r.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":122,"../color":30,"./attributes":79,"./button_attributes":80,"./constants":81}],83:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,r,n){function a(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,C)},a=C.line.width?C.line.color:"rgba(0,0,0,0)",o=r.append("path").attr(n).style("opacity",C.opacity).call(_.stroke,a).call(_.fill,C.fillcolor).call(w.dashLine,C.line.dash,C.line.width);S&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+S),t._context.editable&&f(t,o,C,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof r&&r?s[r]=n:x.isPlainObject(r)&&(s=r);var c=Object.keys(s);for(o=0;oU&&n>G&&!t.shiftKey?k.getCursor(a/r,1-o/n):"move";M(e,i),X=i.split("-")[0]}function o(e){j=b.getFromId(t,r.xref),q=b.getFromId(t,r.yref),B=T.getDataToPixel(t,j),H=T.getDataToPixel(t,q,!0),V=T.getPixelToData(t,j),Z=T.getPixelToData(t,q,!0);var o="shapes["+n+"]";"path"===r.type?(R=r.path,F=o+".path"):(u=B(r.x0),f=H(r.y0),d=B(r.x1),h=H(r.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uG&&(c[C]=r[P]=Z(l),c[S]=r[N]=Z(s)),f-u>U&&(c[O]=r[E]=V(u),c[D]=r[I]=V(f))}e.attr("d",p(t,r))}var c,u,f,d,h,g,v,x,_,w,A,L,z,C,S,O,D,P,N,E,I,R,F,j,q,B,H,V,Z,X,U=10,G=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();k.init(Y)}function d(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),n}function h(t,e,r){var n=b.getFromId(t,r.id,"x")._id,a=b.getFromId(t,r.id,"y")._id,o="below"===e.layer,i=n===e.xref||a===e.yref,l=!!r.shapelayer;return o&&i&&l}function p(t,e){var r,n,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=T.shapePositionToRange(l),n=function(t){return l._offset+l.r2p(r(t,!0))}):n=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(n=T.decodeDate(n)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,n,o);var u=n(e.x0),f=n(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(A.segmentRE,function(t){var n=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[n]?t=e(t):i[n]&&(t=r(t)),n++,n>l&&(t="X"),t});return n>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,r){return t.replace(A.segmentRE,function(t){var n=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return n>=l?t:(o[n]?t=e(t):i[n]&&(t=r(t)),n++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),z=t("./defaults");e.exports={draw:n,drawOne:a}},{"../../lib":122,"../../lib/setcursor":132,"../../plotly":144,"../../plots/cartesian/axes":149,"../color":30,"../dragelement":51,"../drawing":53,"./constants":93,"./defaults":94,"./helpers":96,"./shape_defaults":98,"fast-isnumeric":17}],96:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var a,o=t._fullLayout._size;if(e){var i=r.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=r.decodeDate(a))}else a=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},r.getPixelToData=function(t,e,n){var a,o=t._fullLayout._size;if(e){var i=r.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=n?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],97:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":91,"./calc_autorange":92,"./defaults":94,"./draw":95}],98:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,r,l,s){function c(r,a){return n.coerce(t,e,o,r,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],m={_fullLayout:r},v=a.coerceRef(t,e,m,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==v?(y=a.getFromId(m,v),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=n.identity;var k=g+"0",M=g+"1",A=t[k],T=t[M];t[k]=x(t[k],!0),t[M]=x(t[M],!0),a.coercePosition(e,m,c,v,k,_),a.coercePosition(e,m,c,v,M,w),e[k]=b(e[k]),e[M]=b(e[M]),t[k]=A,t[M]=T}}return"path"===d?c("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":122,"../../plots/cartesian/axes":149,"./attributes":91,"./helpers":96}],99:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},n,{})},font:o({},n,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":119,"../../plots/animation_attributes":145,"../../plots/font_attributes":169,"../../plots/pad_attributes":172,"./constants":100}],100:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],101:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}var i=a(t,e),s=n("visible",i.length>0);if(s){n("active"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),o.coerceFont(n,"font",r.font);var c=n("currentvalue.visible");c&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),o.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function a(t,e){function r(t,e){return o.coerce(n,a,u,t,e)}for(var n,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+C.stepInset+(t.inputAreaLength-2*C.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-C.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*C.stepInset-2*t.inputAreaStart)))}function x(t,e,r){var n=t.selectAll("rect."+C.railTouchRectClass).data([0]);n.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,C.tickOffset+r.ticklen+r.labelHeight)}).call(A.fill,r.bgcolor).attr("opacity",0),M.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+C.railRectClass).data([0]);r.enter().append("rect").classed(C.railRectClass,!0);var n=e.inputAreaLength-2*C.railInset;r.attr({width:n,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(r,C.railInset,.5*(e.inputAreaWidth-C.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(l.enter().append("g").classed(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==r.length){var s=l.selectAll("g."+C.groupClassName).data(r,a);s.enter().append("g").classed(C.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,C.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,z=!0,C=O,k._infolayer.select("."+e).attr({"data-unformatted":C}).text(C).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,m=r.propName,v=r.traceIndex,y=r.dfltName,x=r.avoid||{},b=r.attributes,_=r.transform,w=r.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,z=!1,C=g.title.trim();""===C&&(L=0),C.match(/Click to enter .+ title/)&&(L=.2,z=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var S=w.selectAll("text").data([0]);S.enter().append("text"),S.text(C).attr("class",e),S.attr({"data-unformatted":C}).call(f);var O="Click to enter "+y+" title";t._context.editable?(C||p(),S.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):C&&!C.match(/Click to enter .+ title/)||S.remove(),S.classed("js-placeholder",z)}},{"../../lib":122,"../../lib/svg_text_utils":134,"../../plotly":144,"../../plots/plots":173,"../color":30,"../drawing":53,d3:14,"fast-isnumeric":17}],105:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":119,"../../plots/font_attributes":169,"../../plots/pad_attributes":172,"../color/attributes":29}],106:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],107:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}var i=a(t,e),s=n("visible",i.length>0);s&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),o.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function a(t,e){function r(t,e){return o.coerce(n,a,u,t,e)}for(var n,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==r.length){var u=c.selectAll("g."+T.headerGroupClassName).data(r,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],112:[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}},{}],113:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":28,"./components/images":65,"./components/legend":73,"./components/rangeselector":85,"./components/rangeslider":90,"./components/shapes":97,"./components/sliders":103,"./components/updatemenus":109,"./fonts/mathjax_config":114,"./lib/queue":130,"./plot_api/plot_schema":138,"./plot_api/register":139,"./plot_api/set_plot_config":140,"./plot_api/to_image":142,"./plot_api/validate":143,"./plotly":144,"./snapshot":193,"./snapshot/download":190,"./traces/scatter":281,d3:14,"es6-promise":15}],114:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],115:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),n(t)?Number(t):a}},{"../constants/numerical":110,"fast-isnumeric":17}],116:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,a){!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){t%1||!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;n.strict!==!0&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(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)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!l.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,n,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var m=(new Date).getFullYear();e=((Number(c[0])-m+70)%100+200)%100+m-70}if(!o(e))return s;var v=new Date(0,0,1);if(v.setFullYear(u?e:-e),c.length>1){if(n=Number(c[1])-1,c[1].length>2||!(n>=0&&n<=11))return s;if(v.setMonth(n),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(v.setDate(a),v.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(v.setHours(i),v.getHours()!==i)return s;if(c.length>1)return a=v.getTime(),n=Number(c[1]),2===c[1].length&&n>=0&&n<=59?(a+=f*n,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return v.getTime()},h=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==s};var g=90*c,m=3*u,v=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var r=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(r),i=er?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},a.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},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,r))/Math.log(n),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,r/a))/Math.log(n)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,r)?t(e,r,n):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[n];u[r]=o}return u},a.syncOrAsync=function(t,e,r){function n(){return a.syncOrAsync(t,e,r)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(n).then(void 0,a.promiseError);return r&&r(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,r){if(t){var n,a,o=!1,i=!0;for(n=0;n1?a+i[1]:"";if(o&&(i.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+o+"$2");return l+s}},{"./clean_number":115,"./coerce":116,"./dates":117,"./extend":119,"./filter_unique":120,"./filter_visible":121,"./is_array":123,"./is_plain_object":124,"./loggers":125,"./matrix":126,"./nested_property":127,"./notifier":128,"./search":131,"./stats":133,d3:14}],123:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],124:[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}},{}],125:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],i=!1,d(n))for(r=n.length-1;r>=0;r--)c(n[r])?i?n[r]=void 0:n.pop():i=!0;else if("object"==typeof n&&null!==n)for(o=Object.keys(n),i=!1,r=o.length-1;r>=0;r--)c(n[o[r]])&&!a(n[o[r]],o[r])?delete n[o[r]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,a,i,l=0,s=e.split(".");lo||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],s=t[1];if(ro||sl)return!1;var c,u,f,d,h,p=n.length,g=n[0][0],m=n[0][1],v=0;for(c=1;cMath.max(u,g)||s>Math.max(f,m)))if(su||Math.abs(n(i,d))>a)return!0;return!1};a.filter=function(t,e){function r(r){t.push(r);var l=n.length,s=a;n.splice(i+1);for(var c=s+1;c1){var l=t.pop();r(l)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":126}],130:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");r.findBin=function(t,e,r){if(l(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?r?n:a:r?i:o;f90&&s.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,a=e[n]-e[0]||1,o=a/(n||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},r.roundUp=function(t,e,r){for(var n,a=0,o=e.length-1,i=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":17}],134:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,r){var n="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),r();else{var n=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,n)}o.remove()})}function i(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),a=g[n];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,m.indexOf(u.protocol)===-1?"":''}if("br"===n)return"
";if(o)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))n.push(a);var o=0;n.forEach(function(t){for(var r=t+o,n=e.slice(0,r),a="",i=n.length-1;i>=0;i--){var l=n[i].match(/<(\/?).*>/i);if(l&&"
"!==n[i]){l[1]||(a=n[i]);break}}a&&(e.splice(r+1,0,a),e.splice(r,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,r){var n,a,o,i=r.horizontalAlign,l=r.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-n.height}:"middle"===l?function(){return s.top+(s.height-n.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-n.width}:"center"===i?function(){return s.left+(s.width-n.width)/2}:function(){return s.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(d.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return r(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=n(s,"width"),d=n(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||n(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(v," ")},r.makeEditable=function(t,e,r){function n(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:r.fill||i.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||i.attr("data-unformatted")).call(u(i,e,r)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}r||(r={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),r.immediate?n():c.on("click",n),f.rebind(this,l,"on")}},{"../constants/string_mappings":111,"../constants/xmlns_namespaces":112,"../lib":122,d3:14}],135:[function(t,e,r){"use strict";function n(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=f.cleanId(r,n))}function a(t){var e="middle",r="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?r="left":t.indexOf("right")!==-1&&(r="right"),e+" "+r}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.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);var a=f.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=u.getSubplotIds(t,"gl3d");for(e=0;e=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 s(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&l(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&sO.range[0]?[1,2]:[2,1]);else{var D=O.range[0],P=O.range[1];"log"===b?(D<=0&&P<=0&&r(L+".autorange",!0),D<=0?D=P/1e6:P<=0&&(P=D/1e6),r(L+".range[0]",Math.log(D)/Math.LN10),r(L+".range[1]",Math.log(P)/Math.LN10)):(r(L+".range[0]",Math.pow(10,D)),r(L+".range[1]",Math.pow(10,P)))}else r(L+".autorange",!0)}if("reverse"===A)z.range?z.range.reverse():(r(L+".autorange",!0),z.range=[1,0]),C.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var N=v.parts[1],E=v.parts[0],I=o[E]||[],R=I[N]||{};2===v.parts.length&&(null===b&&(e[m]="remove"),"add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?N===-1?(g[E]=I,delete g[m]):g[m]=R:x.log("???",e)),!n(R,"x")&&!n(R,"y")||x.containsAny(m,["color","opacity","align","dash"])||(h.docalc=!0);var F=w.getComponentMethod(E,"drawOne");F(t,N,v.parts.slice(2).join("."),e[m]),delete e[m]}else if(k.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])S.manageArrayContainers(v,b,g),h.doplot=!0;else{var j=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?h.doplot=!0:0===v.parts[0].indexOf("geo")?h.doplot=!0:0===v.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===m?h.doplot=!0:!i._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?h.docalc=!0:v.parts[0].indexOf("legend")!==-1?h.dolegend=!0:m.indexOf("title")!==-1?h.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(j,["tick","exponent","grid","zeroline"])?h.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:v.parts.length>1&&j.indexOf("line")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&"mirror"===j?h.doticks=h.dolayoutstyle=!0:"margin.pad"===m?h.doticks=h.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(h.doplot=!0):h.doplot=!0,v.set(b)}}}var q=t._fullLayout.width,B=t._fullLayout.height;k.supplyDefaults(t),t.layout.autosize&&k.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==q||t._fullLayout.height!==B;return H&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];m.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=x.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(z.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var a=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=a.append("g").classed("imagelayer",!0),r._shapeLowerLayer=a.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var o=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=o.append("g").classed("imagelayer",!0),r._shapeUpperLayer=o.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),k=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),z=t("../constants/xmlns_namespaces"),C=t("../lib/svg_text_utils"),S=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,r,n){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=D._basePlotModules,r=0;r=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=S.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),r=k.supplyAnimationDefaults(r);var l=r.transition,s=r.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){if(0!==i._frameQueue.length){for(;i._frameQueue.length;){var e=i._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var l=0;li._timeToNext&&h()};e()}function g(t){return Array.isArray(l)?y>=l.length?t.transitionOpts=l[y]:t.transitionOpts=l[0]:t.transitionOpts=l,y++,t}var m,v,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&x.isPlainObject(e);if(M)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&LL)&&z.push(v);b=z}}b.length>0?f(b):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,r){if(t=S.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(n=e.length-1;n>=0;n--)u.push({frame:k.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:c+n});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(a=u[n].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;r--)n=e[r],o.push({type:"delete",index:n}),i.unshift({type:"insert",index:n,value:a[n]});var l=k.modifyFrames,s=k.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),k.modifyFrames(t,o)},y.purge=function(t){t=S.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return k.cleanPlot([],{},r,e),k.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":53,"../components/errorbars":59,"../constants/xmlns_namespaces":112,"../lib":122,"../lib/events":118,"../lib/queue":130,"../lib/svg_text_utils":134,"../plotly":144,"../plots/cartesian/graph_interact":156,"../plots/plots":173,"../plots/polar":176,"../registry":188,"./helpers":135,"./subroutines":141,d3:14,"fast-isnumeric":17}],137:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],138:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=d.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var a={meta:e.meta||{},attributes:i(n)};if(e.layoutAttributes){var o={};_(o,e.layoutAttributes),a.layoutAttributes=i(o)}return a}function a(){var t={};return _(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var r=d.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)u(t,r,"xaxis"),u(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;u(t,r,n)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){f(t,r,e+r.name)}):f(t,r,r.name))}),{layoutAttributes:i(t)}}function o(t){var e=d.transformsRegistry[t];return{attributes:i(e.attributes)}}function i(t){return l(t),s(t),t}function l(t){function e(t){return{valType:"string"}}function n(t,n,a){r.isValObject(t)?"data_array"===t.valType?(t.role="data",a[n+"src"]=e(n)):t.arrayOk===!0&&(a[n+"src"]=e(n)):h.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function s(t){function e(t,e,r){if(t){var n=t[k];n&&(delete t[k],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function c(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function u(t,e,r){var n=h.nestedProperty(t,r),a=_({},e.layoutAttributes);a[w]=!0,n.set(a)}function f(t,e,r){var n=h.nestedProperty(t,r),a=_(n.get()||{},e.layoutAttributes);n.set(a)}var d=t("../registry"),h=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=h.extendFlat,_=h.extendDeep,w="_isSubplotObj",k="_isLinkedToArray",M="_deprecated",A=[w,k,M];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=k,r.DEPRECATED=M,r.UNDERSCORE_ATTRS=A,r.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:h.valObjects,metaKeys:A.concat.role},traces:t,layout:a(),transforms:e,frames:i(m),animation:i(v)}},r.crawl=function(t,e,n){var a=n||0;Object.keys(t).forEach(function(n){var o=t[n];A.indexOf(n)===-1&&(e(o,n,t,a),r.isValObject(o)||h.isPlainObject(o)&&r.crawl(o,e,a+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,i,l){o=o.slice(0,l).concat([r]);var s="data_array"===e.valType||e.arrayOk===!0;if(s){var c=n(o),u=h.nestedProperty(t,c).get();Array.isArray(u)&&a.push(c)}}function n(t){return t.join(".")}var a=[],o=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l1)};d(e.width)&&d(e.height)||n(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=n},{"../lib":122,"../plotly":144,"../snapshot/cloneplot":189,"../snapshot/helpers":192,"../snapshot/svgtoimg":194,"../snapshot/tosvg":196,"fast-isnumeric":17}],143:[function(t,e,r){"use strict";function n(t,e,r,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=r.length,v=0;vu&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=S&&a<=10||e>=15*S)t._tickround="d";else if(e>=D&&a<=16||e>=O)t._tickround="M";else if(e>=P&&a<=19||e>=D)t._tickround="S";else{var o=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var r=t.match(Y),n=new Date(e);if(r){var a=Math.min(+r[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(n)}return y.time.format(t)(n)}function l(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function s(t,e,r,n){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);r&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(n&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(r||(a="
"+H(u)),o=Z(u)):(r||(a="
"+X(u)),o=U(u),"M"!==s?(o+=G(u),"S"!==s&&(o+=d(y.round(v(l/1e3,1),4),t,"none",r).substr(1))):"d"===c&&(o=Z(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,r,n,a){var o=t.dtick,i=e.x;if(!n||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,n);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,n)}function d(t,e,r,n){var a=t<0,i=e._tickround,l=r||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var r,n,a=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.getAutoRange=function(t){var e,r=[],n=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(n===a){var g=n-1,m=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),r=[s.val-d*s.pad,c.val+d*c.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),h&&r.reverse(),r.map(t.l2r||Number)},N.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=N.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},N.saveRangeInitial=function(t,e){for(var r=N.list(t,"",!0),n=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(n(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),k=n(r.vpadminus||r.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},N.autoBin=function(t,e,r,n){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(r)l=(i-o)/r;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},N.autoTicks(f,l);var d,h=N.tickIncrement(N.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=N.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=N.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fz?(e/=z,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,r,I)):n>C?(e/=C,t.dtick="M"+a(e,1,R)):n>S?(t.dtick=a(e,S,j),t.tick0="2000-01-02"):n>O?t.dtick=a(e,O,R):n>D?t.dtick=a(e,D,F):n>P?t.dtick=a(e,P,F):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,r,I))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,r,I)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,r,I));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},N.tickIncrement=function(t,e,r){var n=r?-1:1;if(x(e))return t+n*e;var a=e.charAt(0),o=n*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?B:q,s=t+.01*n,c=_.roundUp(v(s,1),l,r);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]o:f1&&e2*n}function o(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,a=0,o=0;o2*n}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("../../constants/numerical").BADNUM;e.exports=function(t){return a(t)?"date":o(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":110,"../../lib":122,"fast-isnumeric":17}],151:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var l=i(e,r,n);if(l){if("histogram"===l.type&&n==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,n)){for(var s,u=a(l),f=[],d=0;d0;o&&(n="array");var i=r("categoryorder",n);"array"===i&&r("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],154:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],155:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],a=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(r)+"g")(n))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,r,l,_,w,k,M){function A(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+mt+")").attr("d",ct+"Z"),ht=pt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+mt+")").attr("d","M0,0Z"),z()}function z(){pt.selectAll(".select-outline").remove()}function C(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(V,e+ot)),a=Math.max(0,Math.min(Z,r+it)),o=Math.abs(n-ot),i=Math.abs(a-it),l=Math.floor(Math.min(i,o,U)/2);lt.l=Math.min(ot,n),lt.r=Math.max(ot,n),lt.t=Math.min(it,a),lt.b=Math.max(it,a),!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function S(t,e,r){var n,a,o;for(n=0;nzoom back out","long"),b=!1)))}function D(e,r){var a=1===(k+M).length;if(e)R();else if(2!==r||a){if(1===r&&a){var o=k?H[0]:B[0],i="s"===k||"w"===M?0:1,l=o._name+".range["+i+"]",s=n(o,i),u="left",f="middle";if(o.fixedrange)return;k?(f="n"===k?"top":"bottom","right"===o.side&&(u="right")):"e"===M&&(u="right"),rt.call(d.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var r=o.d2r(e);void 0!==r&&c.relayout(t,l,r)})}}else I()}function P(e){function r(t,e,r){function n(e){return t.l2r(o+(e-o)*r)}if(!t.fixedrange){var a=t.range.map(t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(n)}}if(t._context.scrollZoom||j._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=vt[0]+vt[2]*s,u=(l.bottom-e.clientY)/l.height,d=vt[1]+vt[3]*(1-u);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,r){for(var n,o,i=1-e,l=0;l0;n--)r.push(e);return r}function a(t,e){for(var r=[],n=0;nY.width||G<0||G>Y.height)return _.unhoverRaw(t,e)}else U="xpx"in e?e.xpx:M[0]._length/2,G="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?n(o,e.xval):a(M,U),D="yval"in e?n(o,e.yval):a(A,G),!g(O[0])||!g(D[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(N=0;N1||I.hoverinfo.indexOf("name")!==-1?I.name:void 0,index:!1,distance:Math.min(W,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[R]&&(H.subplot=i[R]._subplot),V=Z.length,"array"===j){var Q=e[N];"pointNumber"in Q?(H.index=Q.pointNumber,j="closest"):(j="","xval"in Q&&(q=Q.xval,j="x"),"yval"in Q&&(B=Q.yval,j=j?"closest":"y"))}else q=O[F],B=D[F];if(I._module&&I._module.hoverPoints){var $=I._module.hoverPoints(H,q,B,j);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&Z.push(s(J,S))}else m.log("Unrecognized trace type in hover:",I);"closest"===S&&Z.length>V&&(Z.splice(0,V),W=Z[0].distance)}if(0===Z.length)return _.unhoverRaw(t,e);var tt="y"===S&&X.length>1;Z.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),rt={hovermode:S,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},nt=c(Z,rt);u(Z,tt?"xa":"ya"),f(nt,tt);var at=t._hoverdata,ot=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,r=u.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?n=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),m=0;r&&r!==n?(d.style("fill",s).text(r).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),m=d.node().getBoundingClientRect().width+2*P):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var v,k,T=f.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,C=t.ya._offset+(t.y0+t.y1)/2,S=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),N=T.width+D+P+m;t.ty0=_-T.top,t.bx=T.width+2*P,t.by=T.height+2*P,t.anchor="start",t.txwidth=T.width,t.tx2width=m,t.offset=0,o?(t.pos=z,v=C+O/2+N<=M,k=C-O/2-N>=0,"top"!==t.idealAlign&&v||!k?v?(C+=O/2,t.anchor="start"):t.anchor="middle":(C-=O/2,t.anchor="end")):(t.pos=C,v=z+S/2+N<=w,k=z-S/2-N>=0,"left"!==t.idealAlign&&v||!k?v?(z+=S/2,t.anchor="start"):t.anchor="middle":(z-=S/2,t.anchor="end")),f.attr("text-anchor",t.anchor),m&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+C+")"+(o?"rotate("+L+")":""))}),C}function u(t,e){function r(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=r.pos+r.dp+r.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;n=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;n=!1}if(n){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var n,a,o,i,l,s,c,u=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?C:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&u<=t.length;){for(u++,n=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;n=!1}else i++}f.forEach(r)}for(i=f.length-1;i>=0;i--){var m=f[i];for(l=m.length-1;l>=0;l--){var v=m[l],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var r=h.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,a=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(D+P),l=i+o*(t.txwidth+P),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-O,s=t.offset*S),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*D+s)+","+(D+c)+"v"+(t.by/2-D)+"h"+n*t.bx+"v-"+t.by+"H"+(n*D+s)+"V"+(c-D)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(b.setPosition,l+o*P+s,c+t.ty0-t.by/2+P),r.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],o=t._hoverdata[n];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return m.coerce(t,e,A,r,n)}n("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=T.isHoriz(r);a=o?"y":"x"}else a="closest";n("hovermode",a)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+k.HOVERMINTIME?(i(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||o(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":122,"fast-isnumeric":17}],162:[function(t,e,r){"use strict";function n(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,r,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-m.left,b=r-m.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(n),L=a.yaxes.map(n),z=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var C=g.selectAll("path.select-outline").data([1,2]);C.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",k+"Z");var S,O,D,P,N,E=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,F=[];for(S=0;S0)return Math.log(e)/Math.LN10;if(e<=0&&r&&t.range&&2===t.range.length){var n=t.range[0],a=t.range[1];return.5*(n+a-3*f*Math.abs(n-a))}return s}function r(t){return Math.pow(10,t)}function i(t){return a(t)?(t=Number(t),t<-l||t>l?s:a(t)?Number(t):s):s}var f=10;t.c2l="log"===t.type?e:i,t.l2c="log"===t.type?r:i,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,i=t[e],s=(t._id||"x").charAt(0);if(n="date"===t.type?c.DFLTRANGEDATE:"y"===s?c.DFLTRANGEY:c.DFLTRANGEX,n=n.slice(),!i||2!==i.length)return void(t[e]=n);for("date"===t.type&&(i[0]=o.cleanDate(i[0]),i[1]=o.cleanDate(i[1])),r=0;r<2;r++)if("date"===t.type){if(!o.isDateTime(i[r])){t[e]=n;break}if(i[r]o.MAX_MS&&(i[r]=o.MAX_MS),t.r2l(i[0])===t.r2l(i[1])){var u=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(u-1e3),i[1]=t.l2r(u+1e3);break}}else{if(!a(i[r])){if(!a(i[1-r])){t[e]=n;break}i[r]=i[1-r]*(r?10:.1)}if(i[r]<-l?i[r]=-l:i[r]>l&&(i[r]=l),i[0]===i[1]){var f=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=f,i[1]+=f}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var a=u.getFromId(t._gd,t.overlaying);t.domain=a.domain}var i=e&&t._r?"_r":"range";t.cleanRange(i);var l=t.r2l(t[i][0]),s=t.r2l(t[i][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?n.round(t._b+t._m*e,2):s},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=i,t.d2c=o.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=o.cleanNumber,t.d2r=o.cleanNumber,t.r2d=i),t.r2l=i,t.l2r=i):"date"===t.type?(t.c2d=o.ms2DateTime,t.d2c=function(t){var e=o.dateTime2ms(t);if(e===s){if(!a(t))return s;e=Number(t)}return o.constrain(e,o.MIN_MS,o.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=o.identity,t.r2d=o.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?s:r},t.d2l=t.d2c,t.r2l=i,t.l2r=i,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,a,o;if(r in e)for(n=e[r],a=new Array(n.length),o=0;o0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var f=u.charAt(0),d=u.substr(1);d=n(d)?Number(d):0,(d<=0||!("date"===i&&"M"===f&&d===Math.round(d)||"log"===i&&"L"===f||"log"===i&&"D"===f&&(1===d||2===d)))&&(e.dtick=c)}var h="date"===i?"2000-01-01":0,p=r("tick0",h);"date"===i?e.tick0=a.cleanDate(p,h):n(p)&&"D1"!==u&&"D2"!==u?e.tick0=Number(p):e.tick0=h}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":110,"../../lib":122,"fast-isnumeric":17}],167:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../lib"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,c){function u(t){var e,r,n,a,o,i={};for(e in t)if(r=e.split("."),n=r[0].match(s)){var l=n[1],c=l+"axis";if(a=y[c],o={},Array.isArray(t[e])?o.to=t[e].slice(0):Array.isArray(t[e].range)&&(o.to=t[e].range.slice(0)),!o.to)continue;o.axisName=c,o.length=a._length,x.push(l),i[l]=o}return i}function f(t,e,r){var n,a,o,i=t._plots,l=[];for(n in i){var s=i[n];if(l.indexOf(s)===-1){var c=s.xaxis._id,u=s.yaxis._id,f=s.xaxis.range,d=s.yaxis.range;s.xaxis._r=s.xaxis.range.slice(),s.yaxis._r=s.yaxis.range.slice(),a=r[c]?r[c].to:f,o=r[u]?r[u].to:d,f[0]===a[0]&&f[1]===a[1]&&d[0]===o[0]&&d[1]===o[1]||e.indexOf(c)===-1&&e.indexOf(u)===-1||l.push(s)}}return l}function d(e,r){function n(e,r){for(a=0;ar.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var k;c&&(k=c());var M,A,T,L=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),M=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":122,"../../plotly":144,"../../registry":188,"./axes":149,d3:14}],168:[function(t,e,r){"use strict";function n(t,e,r){var n,a,o,i=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return a=c.nestedProperty(n,e.prop).get(),o=r[e.type]=r[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var r=[],n=e[0],a={};if("string"==typeof n)a[n]=e[1];else{if(!c.isPlainObject(n))return r;a=n}return l(a,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function i(t,e){var r,n,a,o,i=[];if(n=e[0],a=e[1],r=e[2],o={},"string"==typeof n)o[n]=a;else{if(!c.isPlainObject(n))return i;o=n,void 0===r&&(r=a)}return void 0===r&&(r=null),l(o,function(e,n,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);r&&(l=Math.min(l,r.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,n+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");r.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=r.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){n(t,s,i.cache),i.check=function(){if(l){var e=n(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":122,"../../plots/layout_attributes":171,"../../registry":188,"./attributes":67,"./helpers":72}],70:[function(t,e,r){"use strict";function n(t,e){function r(r){v.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(o,e)})}var n=t.data()[0][0],a=e._fullLayout,i=n.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?n.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var a,o=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=n.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(r)}function a(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=r.indexOf(f);d===-1?r.push(f):r.splice(d,1),u.relayout(e,"hiddenlabels",r)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;r=l*d,n=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}r=Math.max(r,16)+3,a.height=r,a.width=n}function i(t,e,r){var n=t._fullLayout,a=n.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.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,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),r.each(function(e){var r=e[0],n=c.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:a.width)+40,r.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;un.width-(n.margin.r+n.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+r,a.height=Math.max(a.height,e.height),x+=i+r,v=Math.max(e.height,v)}),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],n=c.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:a.width,r.height)})}}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var a="top";w.isBottomAnchor(r)?a="bottom":w.isMiddleAnchor(r)&&(a="middle"),d.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[a]||0),t:r.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),d.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),z.call(g.setRect,j,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){var v=r.legend,_=r.showlegend&&x(t.calcdata,v),k=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=r._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var z=M.selectAll("rect.scrollbar").data([0]);z.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var C=L.selectAll("g.groups").data(_);C.enter().append("g").attr("class","groups"),C.exit().remove();var S=C.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,C,S),l(t));var D=0,P=r.width,N=0,E=r.height;i(t,C,S),v.height>E?s(t):l(t);var I=r._size,R=I.l+I.w*v.x,F=I.t+I.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?F-=v.height:w.isMiddleAnchor(v)&&(F-=v.height/2);var j=v.width,q=I.w;j>q?(R=I.l,j=q):(R+j>P&&(R=P-j),RH?(F=I.t,B=H):(F+B>E&&(F=E-B),Fr[1])return r[1]}return a}function r(t){return t[0]}var n,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",r,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?n:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(n[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||n.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||r.color),e&&a.call(d.stroke,t.mlc||n.color)})}function i(t){var e=t[0].trace,r=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=s.select(this);n.style("stroke-width",r+"px").call(d.fill,t.fc||e.fillcolor),r&&n.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,r=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(n).each(a)}},{"../../lib":122,"../../registry":188,"../../traces/pie/style_one":269,"../../traces/scatter/subtypes":291,"../color":30,"../drawing":53,d3:14}],75:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),a=r.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===n){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),i(m,r);u&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),d&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!c&&!p||v||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):c?n(["hoverClosestCartesian","hoverCompareCartesian"]):h&&n(["hoverClosestPie"]),i(m,r)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=a(e,r,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",r.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":122,"../color":30,"./attributes":79,"./button_attributes":80,"./constants":81}],83:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,r,n){function a(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,C)},a=C.line.width?C.line.color:"rgba(0,0,0,0)",o=r.append("path").attr(n).style("opacity",C.opacity).call(_.stroke,a).call(_.fill,C.fillcolor).call(w.dashLine,C.line.dash,C.line.width);S&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+S),t._context.editable&&f(t,o,C,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof r&&r?s[r]=n:x.isPlainObject(r)&&(s=r);var c=Object.keys(s);for(o=0;oU&&n>G&&!t.shiftKey?k.getCursor(a/r,1-o/n):"move";M(e,i),X=i.split("-")[0]}function o(e){j=b.getFromId(t,r.xref),q=b.getFromId(t,r.yref),B=T.getDataToPixel(t,j),H=T.getDataToPixel(t,q,!0),V=T.getPixelToData(t,j),Z=T.getPixelToData(t,q,!0);var o="shapes["+n+"]";"path"===r.type?(R=r.path,F=o+".path"):(u=B(r.x0),f=H(r.y0),d=B(r.x1),h=H(r.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uG&&(c[C]=r[P]=Z(l),c[S]=r[N]=Z(s)),f-u>U&&(c[O]=r[E]=V(u),c[D]=r[I]=V(f))}e.attr("d",p(t,r))}var c,u,f,d,h,g,v,x,_,w,A,L,z,C,S,O,D,P,N,E,I,R,F,j,q,B,H,V,Z,X,U=10,G=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();k.init(Y)}function d(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),n}function h(t,e,r){var n=b.getFromId(t,r.id,"x")._id,a=b.getFromId(t,r.id,"y")._id,o="below"===e.layer,i=n===e.xref||a===e.yref,l=!!r.shapelayer;return o&&i&&l}function p(t,e){var r,n,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=T.shapePositionToRange(l),n=function(t){return l._offset+l.r2p(r(t,!0))}):n=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(n=T.decodeDate(n)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,n,o);var u=n(e.x0),f=n(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(A.segmentRE,function(t){var n=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[n]?t=e(t):i[n]&&(t=r(t)),n++,n>l&&(t="X"),t});return n>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,r){return t.replace(A.segmentRE,function(t){var n=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return n>=l?t:(o[n]?t=e(t):i[n]&&(t=r(t)),n++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),z=t("./defaults");e.exports={draw:n,drawOne:a}},{"../../lib":122,"../../lib/setcursor":132,"../../plotly":144,"../../plots/cartesian/axes":149,"../color":30,"../dragelement":51,"../drawing":53,"./constants":93,"./defaults":94,"./helpers":96,"./shape_defaults":98,"fast-isnumeric":17}],96:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var a,o=t._fullLayout._size;if(e){var i=r.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=r.decodeDate(a))}else a=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},r.getPixelToData=function(t,e,n){var a,o=t._fullLayout._size;if(e){var i=r.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=n?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],97:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":91,"./calc_autorange":92,"./defaults":94,"./draw":95}],98:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,r,l,s){function c(r,a){return n.coerce(t,e,o,r,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],m={_fullLayout:r},v=a.coerceRef(t,e,m,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==v?(y=a.getFromId(m,v),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=n.identity;var k=g+"0",M=g+"1",A=t[k],T=t[M];t[k]=x(t[k],!0),t[M]=x(t[M],!0),a.coercePosition(e,m,c,v,k,_),a.coercePosition(e,m,c,v,M,w),e[k]=b(e[k]),e[M]=b(e[M]),t[k]=A,t[M]=T}}return"path"===d?c("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":122,"../../plots/cartesian/axes":149,"./attributes":91,"./helpers":96}],99:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},n,{})},font:o({},n,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":119,"../../plots/animation_attributes":145,"../../plots/font_attributes":169,"../../plots/pad_attributes":172,"./constants":100}],100:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],101:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}var i=a(t,e),s=n("visible",i.length>0);if(s){n("active"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),o.coerceFont(n,"font",r.font);var c=n("currentvalue.visible");c&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),o.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function a(t,e){function r(t,e){return o.coerce(n,a,u,t,e)}for(var n,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+C.stepInset+(t.inputAreaLength-2*C.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-C.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*C.stepInset-2*t.inputAreaStart)))}function x(t,e,r){var n=t.selectAll("rect."+C.railTouchRectClass).data([0]);n.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,C.tickOffset+r.ticklen+r.labelHeight)}).call(A.fill,r.bgcolor).attr("opacity",0),M.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+C.railRectClass).data([0]);r.enter().append("rect").classed(C.railRectClass,!0);var n=e.inputAreaLength-2*C.railInset;r.attr({width:n,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(r,C.railInset,.5*(e.inputAreaWidth-C.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(l.enter().append("g").classed(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==r.length){var s=l.selectAll("g."+C.groupClassName).data(r,a);s.enter().append("g").classed(C.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,C.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,z=!0,C=O,k._infolayer.select("."+e).attr({"data-unformatted":C}).text(C).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,m=r.propName,v=r.traceIndex,y=r.dfltName,x=r.avoid||{},b=r.attributes,_=r.transform,w=r.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,z=!1,C=g.title.trim();""===C&&(L=0),C.match(/Click to enter .+ title/)&&(L=.2,z=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var S=w.selectAll("text").data([0]);S.enter().append("text"),S.text(C).attr("class",e),S.attr({"data-unformatted":C}).call(f);var O="Click to enter "+y+" title";t._context.editable?(C||p(),S.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):C&&!C.match(/Click to enter .+ title/)||S.remove(),S.classed("js-placeholder",z)}},{"../../lib":122,"../../lib/svg_text_utils":134,"../../plotly":144,"../../plots/plots":173,"../color":30,"../drawing":53,d3:14,"fast-isnumeric":17}],105:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":119,"../../plots/font_attributes":169,"../../plots/pad_attributes":172,"../color/attributes":29}],106:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],107:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}var i=a(t,e),s=n("visible",i.length>0);s&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),o.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function a(t,e){function r(t,e){return o.coerce(n,a,u,t,e)}for(var n,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==r.length){var u=c.selectAll("g."+T.headerGroupClassName).data(r,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],112:[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}},{}],113:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":28,"./components/images":65,"./components/legend":73,"./components/rangeselector":85,"./components/rangeslider":90,"./components/shapes":97,"./components/sliders":103,"./components/updatemenus":109,"./fonts/mathjax_config":114,"./lib/queue":130,"./plot_api/plot_schema":138,"./plot_api/register":139,"./plot_api/set_plot_config":140,"./plot_api/to_image":142,"./plot_api/validate":143,"./plotly":144,"./snapshot":193,"./snapshot/download":190,"./traces/scatter":281,d3:14,"es6-promise":15}],114:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],115:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),n(t)?Number(t):a}},{"../constants/numerical":110,"fast-isnumeric":17}],116:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,a){!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){t%1||!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;n.strict!==!0&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(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)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!l.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,n,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var m=(new Date).getFullYear();e=((Number(c[0])-m+70)%100+200)%100+m-70}if(!o(e))return s;var v=new Date(0,0,1);if(v.setFullYear(u?e:-e),c.length>1){if(n=Number(c[1])-1,c[1].length>2||!(n>=0&&n<=11))return s;if(v.setMonth(n),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(v.setDate(a),v.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(v.setHours(i),v.getHours()!==i)return s;if(c.length>1)return a=v.getTime(),n=Number(c[1]),2===c[1].length&&n>=0&&n<=59?(a+=f*n,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return v.getTime()},h=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==s};var g=90*c,m=3*u,v=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var r=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(r),i=er?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},a.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},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,r))/Math.log(n),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,r/a))/Math.log(n)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,r)?t(e,r,n):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[n];u[r]=o}return u},a.syncOrAsync=function(t,e,r){function n(){return a.syncOrAsync(t,e,r)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(n).then(void 0,a.promiseError);return r&&r(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,r){if(t){var n,a,o=!1,i=!0;for(n=0;n1?a+i[1]:"";if(o&&(i.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+o+"$2");return l+s}},{"./clean_number":115,"./coerce":116,"./dates":117,"./extend":119,"./filter_unique":120,"./filter_visible":121,"./is_array":123,"./is_plain_object":124,"./loggers":125,"./matrix":126,"./nested_property":127,"./notifier":128,"./search":131,"./stats":133,d3:14}],123:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],124:[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}},{}],125:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],i=!1,d(n))for(r=n.length-1;r>=0;r--)c(n[r])?i?n[r]=void 0:n.pop():i=!0;else if("object"==typeof n&&null!==n)for(o=Object.keys(n),i=!1,r=o.length-1;r>=0;r--)c(n[o[r]])&&!a(n[o[r]],o[r])?delete n[o[r]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,a,i,l=0,s=e.split(".");lo||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],s=t[1];if(ro||sl)return!1;var c,u,f,d,h,p=n.length,g=n[0][0],m=n[0][1],v=0;for(c=1;cMath.max(u,g)||s>Math.max(f,m)))if(su||Math.abs(n(i,d))>a)return!0;return!1};a.filter=function(t,e){function r(r){t.push(r);var l=n.length,s=a;n.splice(i+1);for(var c=s+1;c1){var l=t.pop();r(l)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":126}],130:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");r.findBin=function(t,e,r){if(l(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?r?n:a:r?i:o;f90&&s.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,a=e[n]-e[0]||1,o=a/(n||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},r.roundUp=function(t,e,r){for(var n,a=0,o=e.length-1,i=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":17}],134:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,r){var n="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),r();else{var n=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,n)}o.remove()})}function i(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),a=g[n];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,m.indexOf(u.protocol)===-1?"":''}if("br"===n)return"
";if(o)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))n.push(a);var o=0;n.forEach(function(t){for(var r=t+o,n=e.slice(0,r),a="",i=n.length-1;i>=0;i--){var l=n[i].match(/<(\/?).*>/i);if(l&&"
"!==n[i]){l[1]||(a=n[i]);break}}a&&(e.splice(r+1,0,a),e.splice(r,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,r){var n,a,o,i=r.horizontalAlign,l=r.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-n.height}:"middle"===l?function(){return s.top+(s.height-n.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-n.width}:"center"===i?function(){return s.left+(s.width-n.width)/2}:function(){return s.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(d.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return r(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=n(s,"width"),d=n(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||n(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(v," ")},r.makeEditable=function(t,e,r){function n(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:r.fill||i.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||i.attr("data-unformatted")).call(u(i,e,r)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}r||(r={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),r.immediate?n():c.on("click",n),f.rebind(this,l,"on")}},{"../constants/string_mappings":111,"../constants/xmlns_namespaces":112,"../lib":122,d3:14}],135:[function(t,e,r){"use strict";function n(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=f.cleanId(r,n))}function a(t){var e="middle",r="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?r="left":t.indexOf("right")!==-1&&(r="right"),e+" "+r}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.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);var a=f.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=u.getSubplotIds(t,"gl3d");for(e=0;e=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 s(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&l(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&sO.range[0]?[1,2]:[2,1]);else{var D=O.range[0],P=O.range[1];"log"===b?(D<=0&&P<=0&&r(L+".autorange",!0),D<=0?D=P/1e6:P<=0&&(P=D/1e6),r(L+".range[0]",Math.log(D)/Math.LN10),r(L+".range[1]",Math.log(P)/Math.LN10)):(r(L+".range[0]",Math.pow(10,D)),r(L+".range[1]",Math.pow(10,P)))}else r(L+".autorange",!0)}if("reverse"===A)z.range?z.range.reverse():(r(L+".autorange",!0),z.range=[1,0]),C.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var N=v.parts[1],E=v.parts[0],I=o[E]||[],R=I[N]||{};2===v.parts.length&&(null===b&&(e[m]="remove"),"add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?N===-1?(g[E]=I,delete g[m]):g[m]=R:x.log("???",e)),!n(R,"x")&&!n(R,"y")||x.containsAny(m,["color","opacity","align","dash"])||(h.docalc=!0);var F=w.getComponentMethod(E,"drawOne");F(t,N,v.parts.slice(2).join("."),e[m]),delete e[m]}else if(k.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])S.manageArrayContainers(v,b,g),h.doplot=!0;else{var j=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?h.doplot=!0:0===v.parts[0].indexOf("geo")?h.doplot=!0:0===v.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===m?h.doplot=!0:!i._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?h.docalc=!0:v.parts[0].indexOf("legend")!==-1?h.dolegend=!0:m.indexOf("title")!==-1?h.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(j,["tick","exponent","grid","zeroline"])?h.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:v.parts.length>1&&j.indexOf("line")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&"mirror"===j?h.doticks=h.dolayoutstyle=!0:"margin.pad"===m?h.doticks=h.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(h.doplot=!0):h.doplot=!0,v.set(b)}}}var q=t._fullLayout.width,B=t._fullLayout.height;k.supplyDefaults(t),t.layout.autosize&&k.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==q||t._fullLayout.height!==B;return H&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];m.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=x.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(z.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var a=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=a.append("g").classed("imagelayer",!0),r._shapeLowerLayer=a.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var o=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=o.append("g").classed("imagelayer",!0),r._shapeUpperLayer=o.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),k=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),z=t("../constants/xmlns_namespaces"),C=t("../lib/svg_text_utils"),S=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,r,n){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=D._basePlotModules,r=0;r=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=S.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),r=k.supplyAnimationDefaults(r);var l=r.transition,s=r.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){if(0!==i._frameQueue.length){for(;i._frameQueue.length;){var e=i._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var l=0;li._timeToNext&&h()};e()}function g(t){return Array.isArray(l)?y>=l.length?t.transitionOpts=l[y]:t.transitionOpts=l[0]:t.transitionOpts=l,y++,t}var m,v,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&x.isPlainObject(e);if(M)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&LL)&&z.push(v);b=z}}b.length>0?f(b):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,r){if(t=S.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(n=e.length-1;n>=0;n--)u.push({frame:k.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:c+n});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(a=u[n].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;r--)n=e[r],o.push({type:"delete",index:n}),i.unshift({type:"insert",index:n,value:a[n]});var l=k.modifyFrames,s=k.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),k.modifyFrames(t,o)},y.purge=function(t){t=S.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return k.cleanPlot([],{},r,e),k.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":53,"../components/errorbars":59,"../constants/xmlns_namespaces":112,"../lib":122,"../lib/events":118,"../lib/queue":130,"../lib/svg_text_utils":134,"../plotly":144,"../plots/cartesian/graph_interact":156,"../plots/plots":173,"../plots/polar":176,"../registry":188,"./helpers":135,"./subroutines":141,d3:14,"fast-isnumeric":17}],137:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],138:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=d.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var a={meta:e.meta||{},attributes:i(n)};if(e.layoutAttributes){var o={};_(o,e.layoutAttributes),a.layoutAttributes=i(o)}return a}function a(){var t={};return _(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var r=d.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)u(t,r,"xaxis"),u(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;u(t,r,n)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){f(t,r,e+r.name)}):f(t,r,r.name))}),{layoutAttributes:i(t)}}function o(t){var e=d.transformsRegistry[t];return{attributes:i(e.attributes)}}function i(t){return l(t),s(t),t}function l(t){function e(t){return{valType:"string"}}function n(t,n,a){r.isValObject(t)?"data_array"===t.valType?(t.role="data",a[n+"src"]=e(n)):t.arrayOk===!0&&(a[n+"src"]=e(n)):h.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function s(t){function e(t,e,r){if(t){var n=t[k];n&&(delete t[k],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function c(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function u(t,e,r){var n=h.nestedProperty(t,r),a=_({},e.layoutAttributes);a[w]=!0,n.set(a)}function f(t,e,r){var n=h.nestedProperty(t,r),a=_(n.get()||{},e.layoutAttributes);n.set(a)}var d=t("../registry"),h=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=h.extendFlat,_=h.extendDeep,w="_isSubplotObj",k="_isLinkedToArray",M="_deprecated",A=[w,k,M];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=k,r.DEPRECATED=M,r.UNDERSCORE_ATTRS=A,r.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:h.valObjects,metaKeys:A.concat.role},traces:t,layout:a(),transforms:e,frames:i(m),animation:i(v)}},r.crawl=function(t,e,n){var a=n||0;Object.keys(t).forEach(function(n){var o=t[n];A.indexOf(n)===-1&&(e(o,n,t,a),r.isValObject(o)||h.isPlainObject(o)&&r.crawl(o,e,a+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,i,l){o=o.slice(0,l).concat([r]);var s="data_array"===e.valType||e.arrayOk===!0;if(s){var c=n(o),u=h.nestedProperty(t,c).get();Array.isArray(u)&&a.push(c)}}function n(t){return t.join(".")}var a=[],o=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l1)};d(e.width)&&d(e.height)||n(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=n},{"../lib":122,"../plotly":144,"../snapshot/cloneplot":189,"../snapshot/helpers":192,"../snapshot/svgtoimg":194,"../snapshot/tosvg":196,"fast-isnumeric":17}],143:[function(t,e,r){"use strict";function n(t,e,r,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=r.length,v=0;vu&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=S&&a<=10||e>=15*S)t._tickround="d";else if(e>=D&&a<=16||e>=O)t._tickround="M";else if(e>=P&&a<=19||e>=D)t._tickround="S";else{var o=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var r=t.match(Y),n=new Date(e);if(r){var a=Math.min(+r[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(n)}return y.time.format(t)(n)}function l(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function s(t,e,r,n){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);r&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(n&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(r||(a="
"+H(u)),o=Z(u)):(r||(a="
"+X(u)),o=U(u),"M"!==s?(o+=G(u),"S"!==s&&(o+=d(y.round(v(l/1e3,1),4),t,"none",r).substr(1))):"d"===c&&(o=Z(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,r,n,a){var o=t.dtick,i=e.x;if(!n||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,n);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,n)}function d(t,e,r,n){var a=t<0,i=e._tickround,l=r||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var r,n,a=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.getAutoRange=function(t){var e,r=[],n=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(n===a){var g=n-1,m=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),r=[s.val-d*s.pad,c.val+d*c.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),h&&r.reverse(),r.map(t.l2r||Number)},N.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=N.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},N.saveRangeInitial=function(t,e){for(var r=N.list(t,"",!0),n=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(n(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),k=n(r.vpadminus||r.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},N.autoBin=function(t,e,r,n){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(r)l=(i-o)/r;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},N.autoTicks(f,l);var d,h=N.tickIncrement(N.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=N.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=N.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fz?(e/=z,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,r,I)):n>C?(e/=C,t.dtick="M"+a(e,1,R)):n>S?(t.dtick=a(e,S,j),t.tick0="2000-01-02"):n>O?t.dtick=a(e,O,R):n>D?t.dtick=a(e,D,F):n>P?t.dtick=a(e,P,F):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,r,I))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,r,I)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,r,I));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},N.tickIncrement=function(t,e,r){var n=r?-1:1;if(x(e))return t+n*e;var a=e.charAt(0),o=n*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?B:q,s=t+.01*n,c=_.roundUp(v(s,1),l,r);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]o:f1&&e2*n}function o(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,a=0,o=0;o2*n}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("../../constants/numerical").BADNUM;e.exports=function(t){return a(t)?"date":o(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":110,"../../lib":122,"fast-isnumeric":17}],151:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var l=i(e,r,n);if(l){if("histogram"===l.type&&n==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,n)){for(var s,u=a(l),f=[],d=0;d0;o&&(n="array");var i=r("categoryorder",n);"array"===i&&r("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],154:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],155:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],a=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(r)+"g")(n))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,r,l,_,w,k,M){function A(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+mt+")").attr("d",ct+"Z"),ht=pt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+mt+")").attr("d","M0,0Z"),z()}function z(){pt.selectAll(".select-outline").remove()}function C(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(V,e+ot)),a=Math.max(0,Math.min(Z,r+it)),o=Math.abs(n-ot),i=Math.abs(a-it),l=Math.floor(Math.min(i,o,U)/2);lt.l=Math.min(ot,n),lt.r=Math.max(ot,n),lt.t=Math.min(it,a),lt.b=Math.max(it,a),!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function S(t,e,r){var n,a,o;for(n=0;nzoom back out","long"),b=!1)))}function D(e,r){var a=1===(k+M).length;if(e)R();else if(2!==r||a){if(1===r&&a){var o=k?H[0]:B[0],i="s"===k||"w"===M?0:1,l=o._name+".range["+i+"]",s=n(o,i),u="left",f="middle";if(o.fixedrange)return;k?(f="n"===k?"top":"bottom","right"===o.side&&(u="right")):"e"===M&&(u="right"),rt.call(d.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var r=o.d2r(e);void 0!==r&&c.relayout(t,l,r)})}}else I()}function P(e){function r(t,e,r){function n(e){return t.l2r(o+(e-o)*r)}if(!t.fixedrange){var a=t.range.map(t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(n)}}if(t._context.scrollZoom||j._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=vt[0]+vt[2]*s,u=(l.bottom-e.clientY)/l.height,d=vt[1]+vt[3]*(1-u);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,r){for(var n,o,i=1-e,l=0;l0;n--)r.push(e);return r}function a(t,e){for(var r=[],n=0;nY.width||G<0||G>Y.height)return _.unhoverRaw(t,e)}else U="xpx"in e?e.xpx:M[0]._length/2,G="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?n(o,e.xval):a(M,U),D="yval"in e?n(o,e.yval):a(A,G),!g(O[0])||!g(D[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(N=0;N1||I.hoverinfo.indexOf("name")!==-1?I.name:void 0,index:!1,distance:Math.min(W,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[R]&&(H.subplot=i[R]._subplot),V=Z.length,"array"===j){var Q=e[N];"pointNumber"in Q?(H.index=Q.pointNumber,j="closest"):(j="","xval"in Q&&(q=Q.xval,j="x"),"yval"in Q&&(B=Q.yval,j=j?"closest":"y"))}else q=O[F],B=D[F];if(I._module&&I._module.hoverPoints){var $=I._module.hoverPoints(H,q,B,j);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&Z.push(s(J,S))}else m.log("Unrecognized trace type in hover:",I);"closest"===S&&Z.length>V&&(Z.splice(0,V),W=Z[0].distance)}if(0===Z.length)return _.unhoverRaw(t,e);var tt="y"===S&&X.length>1;Z.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),rt={hovermode:S,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},nt=c(Z,rt);u(Z,tt?"xa":"ya"),f(nt,tt);var at=t._hoverdata,ot=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,r=u.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?n=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),m=0;r&&r!==n?(d.style("fill",s).text(r).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),m=d.node().getBoundingClientRect().width+2*P):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var v,k,T=f.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,C=t.ya._offset+(t.y0+t.y1)/2,S=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),N=T.width+D+P+m;t.ty0=_-T.top,t.bx=T.width+2*P,t.by=T.height+2*P,t.anchor="start",t.txwidth=T.width,t.tx2width=m,t.offset=0,o?(t.pos=z,v=C+O/2+N<=M,k=C-O/2-N>=0,"top"!==t.idealAlign&&v||!k?v?(C+=O/2,t.anchor="start"):t.anchor="middle":(C-=O/2,t.anchor="end")):(t.pos=C,v=z+S/2+N<=w,k=z-S/2-N>=0,"left"!==t.idealAlign&&v||!k?v?(z+=S/2,t.anchor="start"):t.anchor="middle":(z-=S/2,t.anchor="end")),f.attr("text-anchor",t.anchor),m&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+C+")"+(o?"rotate("+L+")":""))}),C}function u(t,e){function r(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=r.pos+r.dp+r.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;n=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;n=!1}if(n){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var n,a,o,i,l,s,c,u=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?C:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&u<=t.length;){for(u++,n=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;n=!1}else i++}f.forEach(r)}for(i=f.length-1;i>=0;i--){var m=f[i];for(l=m.length-1;l>=0;l--){var v=m[l],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var r=h.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,a=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(D+P),l=i+o*(t.txwidth+P),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-O,s=t.offset*S),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*D+s)+","+(D+c)+"v"+(t.by/2-D)+"h"+n*t.bx+"v-"+t.by+"H"+(n*D+s)+"V"+(c-D)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(b.setPosition,l+o*P+s,c+t.ty0-t.by/2+P),r.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],o=t._hoverdata[n];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return m.coerce(t,e,A,r,n)}n("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=T.isHoriz(r);a=o?"y":"x"}else a="closest";n("hovermode",a)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+k.HOVERMINTIME?(i(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||o(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":122,"fast-isnumeric":17}],162:[function(t,e,r){"use strict";function n(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,r,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-m.left,b=r-m.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(n),L=a.yaxes.map(n),z=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var C=g.selectAll("path.select-outline").data([1,2]);C.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",k+"Z");var S,O,D,P,N,E=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,F=[];for(S=0;S0)return Math.log(e)/Math.LN10;if(e<=0&&r&&t.range&&2===t.range.length){var n=t.range[0],a=t.range[1];return.5*(n+a-3*f*Math.abs(n-a))}return s}function r(t){return Math.pow(10,t)}function i(t){return a(t)?(t=Number(t),t<-l||t>l?s:a(t)?Number(t):s):s}var f=10;t.c2l="log"===t.type?e:i,t.l2c="log"===t.type?r:i,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,i=t[e],s=(t._id||"x").charAt(0);if(n="date"===t.type?c.DFLTRANGEDATE:"y"===s?c.DFLTRANGEY:c.DFLTRANGEX,n=n.slice(),!i||2!==i.length)return void(t[e]=n);for("date"===t.type&&(i[0]=o.cleanDate(i[0]),i[1]=o.cleanDate(i[1])),r=0;r<2;r++)if("date"===t.type){if(!o.isDateTime(i[r])){t[e]=n;break}if(i[r]o.MAX_MS&&(i[r]=o.MAX_MS),t.r2l(i[0])===t.r2l(i[1])){var u=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(u-1e3),i[1]=t.l2r(u+1e3);break}}else{if(!a(i[r])){if(!a(i[1-r])){t[e]=n;break}i[r]=i[1-r]*(r?10:.1)}if(i[r]<-l?i[r]=-l:i[r]>l&&(i[r]=l),i[0]===i[1]){var f=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=f,i[1]+=f}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var a=u.getFromId(t._gd,t.overlaying);t.domain=a.domain}var i=e&&t._r?"_r":"range";t.cleanRange(i);var l=t.r2l(t[i][0]),s=t.r2l(t[i][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?n.round(t._b+t._m*e,2):s},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=i,t.d2c=o.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=o.cleanNumber,t.d2r=o.cleanNumber,t.r2d=i),t.r2l=i,t.l2r=i):"date"===t.type?(t.c2d=o.ms2DateTime,t.d2c=function(t){var e=o.dateTime2ms(t);if(e===s){if(!a(t))return s;e=Number(t)}return o.constrain(e,o.MIN_MS,o.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=o.identity,t.r2d=o.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?s:r},t.d2l=t.d2c,t.r2l=i,t.l2r=i,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,a,o;if(r in e)for(n=e[r],a=new Array(n.length),o=0;o0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var f=u.charAt(0),d=u.substr(1);d=n(d)?Number(d):0,(d<=0||!("date"===i&&"M"===f&&d===Math.round(d)||"log"===i&&"L"===f||"log"===i&&"D"===f&&(1===d||2===d)))&&(e.dtick=c)}var h="date"===i?"2000-01-01":0,p=r("tick0",h);"date"===i?e.tick0=a.cleanDate(p,h):n(p)&&"D1"!==u&&"D2"!==u?e.tick0=Number(p):e.tick0=h}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":110,"../../lib":122,"fast-isnumeric":17}],167:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../lib"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,c){function u(t){var e,r,n,a,o,i={};for(e in t)if(r=e.split("."),n=r[0].match(s)){var l=n[1],c=l+"axis";if(a=y[c],o={},Array.isArray(t[e])?o.to=t[e].slice(0):Array.isArray(t[e].range)&&(o.to=t[e].range.slice(0)),!o.to)continue;o.axisName=c,o.length=a._length,x.push(l),i[l]=o}return i}function f(t,e,r){var n,a,o,i=t._plots,l=[];for(n in i){var s=i[n];if(l.indexOf(s)===-1){var c=s.xaxis._id,u=s.yaxis._id,f=s.xaxis.range,d=s.yaxis.range;s.xaxis._r=s.xaxis.range.slice(),s.yaxis._r=s.yaxis.range.slice(),a=r[c]?r[c].to:f,o=r[u]?r[u].to:d,f[0]===a[0]&&f[1]===a[1]&&d[0]===o[0]&&d[1]===o[1]||e.indexOf(c)===-1&&e.indexOf(u)===-1||l.push(s)}}return l}function d(e,r){function n(e,r){for(a=0;ar.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var k;c&&(k=c());var M,A,T,L=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),M=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":122,"../../plotly":144,"../../registry":188,"./axes":149,d3:14}],168:[function(t,e,r){"use strict";function n(t,e,r){var n,a,o,i=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return a=c.nestedProperty(n,e.prop).get(),o=r[e.type]=r[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var r=[],n=e[0],a={};if("string"==typeof n)a[n]=e[1];else{if(!c.isPlainObject(n))return r;a=n}return l(a,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function i(t,e){var r,n,a,o,i=[];if(n=e[0],a=e[1],r=e[2],o={},"string"==typeof n)o[n]=a;else{if(!c.isPlainObject(n))return i;o=n,void 0===r&&(r=a)}return void 0===r&&(r=null),l(o,function(e,n,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);r&&(l=Math.min(l,r.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,n+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");r.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=r.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){n(t,s,i.cache),i.check=function(){if(l){var e=n(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),r.attr(o);var i=r.select(".js-link-to-tool"),l=r.select(".js-link-spacer"),c=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=s.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=n.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var c=r.width,f=r.height;p.supplyLayoutGlobalDefaults(o,n),o.width||(n.width=c),o.height||(n.height=f)}else{p.supplyLayoutGlobalDefaults(o,n);var d=!o.width||!o.height,h=n.autosize,g=t._context&&t._context.autosizable,m=d&&(h||g);m?p.plotAutoSize(t,o,n):d&&p.sanitizeMargins(t),!h&&d&&(o.width=n.width,o.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=s.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,n),n._has=p._hasPlotType.bind(n);var v=n._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,m=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(m.width-f)),a=Math.round(g*(m.height-h))}else{var v=s?window.getComputedStyle(t):{};n=parseFloat(v.width)||r.width,a=parseFloat(v.height)||r.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-a)>1;(_||b)&&(b&&(r.width=n),_&&(r.height=a)),t._initialAutoSize||(t._initialAutoSize={width:n,height:a}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var a,o;u.Axes.supplyLayoutDefaults(t,e,r);var i=e._basePlotModules;for(a=0;a.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+a},r:{val:r.x,size:r.r+a},b:{val:r.y,size:r.b+a},t:{val:r.y,size:r.t+a}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var r=s[t].l||{},n=s[t].b||{},u=r.val,f=r.size,d=n.val,h=n.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var r=s[t].r.val,n=s[t].r.size;if(r>u){var p=(f*r+(n-e.width)*u)/(r-u),g=(n*(1-u)+(f-e.width)*(1-r))/(r-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var m=s[t].t.val,v=s[t].t.size;if(m>d){var y=(h*m+(v-e.height)*d)/(m-d),x=(v*(1-d)+(h-e.height)*(1-m))/(m-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),r.l=Math.round(a),r.r=Math.round(o),r.t=Math.round(i),r.b=Math.round(l),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,r,n,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,n,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):d.isJSDate(t)?d.ms2DateTime(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===n?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var r,n,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(r=0;r0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(r)for(l=0;l=0,C=z?f.angularAxis.domain:n.extent(M),S=Math.abs(M[1]-M[0]);T&&!A&&(S=0);var O=C.slice();L&&A&&(O[1]+=S);var D=f.angularAxis.ticksCount||4;D>8&&(D=D/(D/8)+D%8),f.angularAxis.ticksStep&&(D=(O[1]-O[0])/D);var P=f.angularAxis.ticksStep||(O[1]-O[0])/(D*(f.minorTicks+1));k&&(P=Math.max(Math.round(P),1)),O[2]||(O[2]=P);var N=n.range.apply(this,O);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=n.scale.linear().domain(O.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?S:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var E="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(E,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=n.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,j=e.select(".chart-group"),q={fill:"none",stroke:f.tickColor},B={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var r=i.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});i.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},i.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],a.range([0,x]),u.layout.radialAxis.domain=a.domain(),F.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),j.attr("transform","translate("+_+")").style({cursor:"crosshair"});var Z=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(Z[0]=Math.max(0,Z[0]),Z[1]=Math.max(0,Z[1]),e.select(".outer-group").attr("transform","translate("+Z+")"),f.title){var X=e.select("g.title-group text").style(B).text(f.title),U=X.node().getBBox();X.attr({x:_[0]-U.width/2,y:_[1]-x-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=G.selectAll("circle.grid-circle").data(a.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(q),Y.attr("r",a),Y.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(q);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=n.svg.axis().scale(a).ticks(5).tickSize(5);G.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(q),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(B).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),J=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(q),J.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(B);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var r=s(t,e),n=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(B);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(j.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),h[0]||et){var nt=[];h.forEach(function(t,e){var r={};r.radialScale=a,r.angularScale=l,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var at=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return o(i[r].defaultConfig(),t)});i[r]().config(n)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=i.tooltipPanel().config({container:ct,fontSize:8})(),ft=i.tooltipPanel().config({container:ct,fontSize:8})(),dt=i.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});j.on("mousemove.angular-guide",function(t,e){var r=i.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;it=l.invert(n);var a=i.util.convertToCartesian(x+12,r+180);ut.text(i.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});j.on("mousemove.radial-guide",function(t,e){var r=i.util.getMousePos(W).radius;pt.attr({r:r}).style({opacity:.5}),lt=a.invert(i.util.getMousePos(W).radius);var n=i.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(i.util.round(lt)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var a=n.select(this),o=a.style("fill"),l="black",s=a.style("opacity")||1;if(a.attr({"data-opacity":s}),"none"!=o){a.attr({"data-fill":o}),l=n.hsl(o).darker().toString(),a.style({fill:l,opacity:1});var c={t:i.util.round(t[0]),r:i.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-Z[0]-d.left,f.top+f.height/2-Z[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else o=a.style("stroke"),a.attr({"data-stroke":o}),l=n.hsl(o).darker().toString(),a.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})}),d}var e,r,a,l,s={data:[],layout:{}},c={},u={},f=n.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=i.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),o(s.data[e],i.Axis.defaultConfig().data[0]),o(s.data[e],t)}),o(s.layout,i.Axis.defaultConfig().layout), o(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},n.rebind(d,f,"on"),d},i.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},i.util={},i.DATAEXTENT="dataExtent",i.AREA="AreaChart",i.LINE="LinePlot",i.DOT="DotPlot",i.BAR="BarChart",i.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},i.util._extend=function(t,e){for(var r in t)e[r]=t[r]},i.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},i.util.dataFromEquation2=function(t,e){var r=e||6,a=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,a=t(n);return[e,a]});return a},i.util.dataFromEquation=function(t,e,r){var a=e||6,o=[],i=[];n.range(0,360+a,a).forEach(function(e,r){var n=e*Math.PI/180,a=t(n);o.push(e),i.push(a)});var l={t:o,r:i};return r&&(l.name=r),l},i.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},i.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=i.util.ensureArray(t[e],r)}),t},i.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},i.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},i.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},i.util.arrayLast=function(t){return t[t.length-1]},i.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return r===-2},i.util.flattenArray=function(t){for(var e=[];!i.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},i.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},i.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),a=t*Math.sin(r);return[n,a]},i.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},i.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],a=e[1],o={};return o.x=r,o.y=a,o.pos=e,o.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,o.radius=Math.sqrt(r*r+a*a),o},i.util.duplicatesCount=function(t){for(var e,r={},n={},a=0,o=t.length;a0)){var l=n.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:d(i),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(r,a,o)},"fill-opacity":0,stroke:function(t,e){return m.stroke(r,a,o)},"stroke-width":function(t,e){return m["stroke-width"](r,a,o)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](r,a,o)},opacity:function(t,e){return m.opacity(r,a,o)},display:function(t,e){return m.display(r,a,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,a){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var m={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 l[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},v=n.select(this).selectAll("g.layer").data(s);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(m).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,r=[i.PolyChart.defaultConfig()],a=n.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),o(r[e],i.PolyChart.defaultConfig()),o(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,a,"on"),t},i.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},i.Legend=function(){function t(){var r=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var a=o({},r.elements[e]);return a.name=t,a.color=[].concat(r.elements[e].color)[n],a})}),i=n.merge(a);i=i.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(i=i.reverse());var l=r.container;("string"==typeof l||l.nodeName)&&(l=n.select(l));var s=i.map(function(t,e){return t.color}),c=r.fontSize,u=null==r.isContinuous?"number"==typeof i[0]:r.isContinuous,f=u?r.height:c*i.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(i.length),m=n.scale[u?"linear":"ordinal"]().domain(g).range(s),v=n.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(i);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,v(e)+c/2]+")"},d:function(t,e){var r=t.symbol;return y(r,c)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=n.svg.axis().scale(v).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?r.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return i[e].name}),t}var e=i.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},n.rebind(t,r,"on"),t},i.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},i.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=10,c=function(){t=a.container.selectAll("g."+l).data([0]);var n=t.enter().append("g").classed(l,!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+s,dy:.3*+a.fontSize}),c};return c.text=function(o){var i=n.hsl(a.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var d=a.padding,h=e.node().getBBox(),p={fill:a.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,m=h.height+2*d;return r.attr({d:"M"+[[s,-m/2],[s,-m/4],[a.hasTick?0:s,0],[s,m/4],[s,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-m/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){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 o(a,t),c},c},i.tooltipPanel.uid=1,i.adapter={},i.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=o({},t),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"]]];return a.forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=a.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var l=o({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};n.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),r.layout=l}return r},t}},{"../../lib":122,d3:14}],178:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),o=t("../../components/color"),i=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){function e(e,a){return a&&(f=a),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?s(r,e):e,o||(o=i.Axis()),u=i.adapter.plotly().convert(r),o.config(u).render(f),t.data=r.data,t.layout=r.layout,c.fillLayout(t),r}var r,a,o,u,f,d=new l;return e.isPolar=!0,e.svg=function(){return o.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return i.adapter.plotly().convert(o.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:o.angularScale(),r:o.radialScale()}},e.setUndoPoint=function(){var t=this,e=i.util.cloneJson(r);!function(e,r){d.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,a),a=i.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},c.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(),i={width:800,height:600,paper_bgcolor:o.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=s(i,t.layout)}},{"../../components/color":30,"../../lib":122,"./micropolar":177,"./undo_manager":179,d3:14}],179:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,r=[],n=-1,a=!1;return{add:function(t){return a?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=r[n];return a?(t(a,"undo"),n-=1,e&&e(a.undo),this):this},redo:function(){var a=r[n+1];return a?(t(a,"redo"),n+=1,e&&e(a.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n=i&&(h.min=0,p.min=0,g.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var a=t("../../../components/color"),o=t("../../subplot_defaults"),i=t("./layout_attributes"),l=t("./axis_defaults"),s=["aaxis","baxis","caxis"];e.exports=function(t,e,r){o(t,e,r,{type:"ternary",attributes:i,handleDefaults:n,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":30,"../../subplot_defaults":180,"./axis_defaults":184,"./layout_attributes":186}],186:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),a=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:a,baxis:a,caxis:a}},{"../../../components/color/attributes":29,"./axis_attributes":183}],187:[function(t,e,r){"use strict";function n(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework()}function a(t){o.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var o=t("d3"),i=t("tinycolor2"),l=t("../../plotly"),s=t("../../lib"),c=t("../../components/color"),u=t("../../components/drawing"),f=t("../cartesian/set_convert"),d=t("../../lib/extend").extendFlat,h=t("../cartesian/axes"),p=t("../../components/dragelement"),g=t("../../components/titles"),m=t("../cartesian/select"),v=t("../cartesian/constants"),y=t("../cartesian/graph_interact");e.exports=n;var x=n.prototype;x.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={}},x.plot=function(t,e){var r,n=this,a=e[n.id],o=e._size;s.getPlotDiv(n.plotContainer.node())!==n.graphDiv&&(n.init(n.graphDiv._fullLayout),n.makeFramework()),n.adjustLayout(a,o);var i=n.traceHash,l={};for(r=0;rb*y?(o=y,a=o*b):(a=v,o=a/b),i=g*a/v,l=m*o/y,r=e.l+e.w*h-a/2,n=e.t+e.h*(1-p)-o/2,s.x0=r,s.y0=n,s.w=a,s.h=o,s.sum=x,s.xaxis={type:"linear",range:[_+2*k-x,x-_-2*w],domain:[h-i/2,h+i/2],_id:"x",_gd:s.graphDiv},f(s.xaxis),s.xaxis.setScale(),s.yaxis={type:"linear",range:[_,x-w-k],domain:[p-l/2,p+l/2],_id:"y",_gd:s.graphDiv},f(s.yaxis),s.yaxis.setScale();var M=s.yaxis.domain[0],A=s.aaxis=d({},t.aaxis,{range:[_,x-w-k],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[M,M+l*b],_axislayer:s.layers.aaxis,_gridlayer:s.layers.agrid,_pos:0,_gd:s.graphDiv,_id:"y",_length:a,_gridpath:"M0,0l"+o+",-"+a/2});f(A);var T=s.baxis=d({},t.baxis,{range:[x-_-k,w],side:"bottom",_counterangle:30,domain:s.xaxis.domain,_axislayer:s.layers.baxis,_gridlayer:s.layers.bgrid,_counteraxis:s.aaxis,_pos:0,_gd:s.graphDiv,_id:"x",_length:a,_gridpath:"M0,0l-"+a/2+",-"+o});f(T),A._counteraxis=T;var L=s.caxis=d({},t.caxis,{range:[x-_-w,k],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[M,M+l*b],_axislayer:s.layers.caxis,_gridlayer:s.layers.cgrid,_counteraxis:s.baxis,_pos:0,_gd:s.graphDiv,_id:"y",_length:a,_gridpath:"M0,0l-"+o+","+a/2});f(L);var z="M"+r+","+(n+o)+"h"+a+"l-"+a/2+",-"+o+"Z";s.clipDef.select("path").attr("d",z),s.layers.plotbg.select("path").attr("d",z);var C="translate("+r+","+n+")";s.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",C);var S="translate("+r+","+(n+o)+")";s.layers.baxis.attr("transform",S),s.layers.bgrid.attr("transform",S);var O="translate("+(r+a/2)+","+n+")rotate(30)";s.layers.aaxis.attr("transform",O),s.layers.agrid.attr("transform",O);var D="translate("+(r+a/2)+","+n+")rotate(-30)";s.layers.caxis.attr("transform",D),s.layers.cgrid.attr("transform",D),s.drawAxes(!0),s.plotContainer.selectAll(".crisp").classed("crisp",!1);var P=s.layers.axlines;P.select(".aline").attr("d",A.showline?"M"+r+","+(n+o)+"l"+a/2+",-"+o:"M0,0").call(c.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),P.select(".bline").attr("d",T.showline?"M"+r+","+(n+o)+"h"+a:"M0,0").call(c.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),P.select(".cline").attr("d",L.showline?"M"+(r+a/2)+","+n+"l"+a/2+","+o:"M0,0").call(c.stroke,L.linecolor||"#000").style("stroke-width",(L.linewidth||0)+"px")},x.drawAxes=function(t){var e=this,r=e.graphDiv,n=e.id.substr(7)+"title",a=e.aaxis,o=e.baxis,i=e.caxis;if(h.doTicks(r,a,!0),h.doTicks(r,o,!0),h.doTicks(r,i,!0),t){var l=Math.max(a.showticklabels?a.tickfont.size/2:0,(i.showticklabels?.75*i.tickfont.size:0)+("outside"===i.ticks?.87*i.ticklen:0));g.draw(r,"a"+n,{propContainer:a,propName:e.id+".aaxis.title",dfltName:"Component A",attributes:{x:e.x0+e.w/2,y:e.y0-a.titlefont.size/3-l,"text-anchor":"middle"}});var s=(o.showticklabels?o.tickfont.size:0)+("outside"===o.ticks?o.ticklen:0)+3;g.draw(r,"b"+n,{propContainer:o,propName:e.id+".baxis.title",dfltName:"Component B",attributes:{x:e.x0-s,y:e.y0+e.h+.83*o.titlefont.size+s,"text-anchor":"middle"}}),g.draw(r,"c"+n,{propContainer:i,propName:e.id+".caxis.title",dfltName:"Component C",attributes:{x:e.x0+e.w+s,y:e.y0+e.h+.83*i.titlefont.size+s,"text-anchor":"middle"}})}};var _=v.MINZOOM/2+.87,w="m-0.87,.5h"+_+"v3h-"+(_+5.2)+"l"+(_/2+2.6)+",-"+(.87*_+4.5)+"l2.6,1.5l-"+_/2+","+.87*_+"Z",k="m0.87,.5h-"+_+"v3h"+(_+5.2)+"l-"+(_/2+2.6)+",-"+(.87*_+4.5)+"l-2.6,1.5l"+_/2+","+.87*_+"Z",M="m0,1l"+_/2+","+.87*_+"l2.6,-1.5l-"+(_/2+2.6)+",-"+(.87*_+4.5)+"l-"+(_/2+2.6)+","+(.87*_+4.5)+"l2.6,1.5l"+_/2+",-"+.87*_+"Z",A="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",T=!0;x.initInteractions=function(){function t(t,e,r){var n=R.getBoundingClientRect();_=e-n.left,L=r-n.top,z={a:I.aaxis.range[0],b:I.baxis.range[1],c:I.caxis.range[1]},S=z,C=I.aaxis.range[1]-z.a,O=i(I.graphDiv._fullLayout[I.id].bgcolor).getLuminance(),D="M0,"+I.h+"L"+I.w/2+", 0L"+I.w+","+I.h+"Z",P=!1,N=j.append("path").attr("class","zoombox").style({fill:O>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",D),E=j.append("path").attr("class","zoombox-corners").style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),g()}function e(t,e){return 1-e/I.h}function r(t,e){return 1-(t+(I.h-e)/Math.sqrt(3))/I.w}function n(t,e){return(t-(I.h-e)/Math.sqrt(3))/I.w}function o(t,a){var o=_+t,i=L+a,l=Math.max(0,Math.min(1,e(_,L),e(o,i))),s=Math.max(0,Math.min(1,r(_,L),r(o,i))),c=Math.max(0,Math.min(1,n(_,L),n(o,i))),u=(l/2+c)*I.w,f=(1-l/2-s)*I.w,d=(u+f)/2,h=f-u,p=(1-l)*I.h,g=p-h/b;h.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),E.transition().style("opacity",1).duration(200),P=!0)}function u(t,e){if(S===z)return 2===e&&x(),a(F);a(F);var r={};r[I.id+".aaxis.min"]=S.a,r[I.id+".baxis.min"]=S.b,r[I.id+".caxis.min"]=S.c,l.relayout(F,r),T&&F.data&&F._context.showTips&&(s.notifier("Double-click to
zoom back out","long"),T=!1)}function f(){z={a:I.aaxis.range[0],b:I.baxis.range[1],c:I.caxis.range[1]},S=z}function d(t,e){var r=t/I.xaxis._m,n=e/I.yaxis._m;S={a:z.a-n,b:z.b+(r+n)/2,c:z.c-(r-n)/2};var a=[S.a,S.b,S.c].sort(),o={a:a.indexOf(S.a),b:a.indexOf(S.b),c:a.indexOf(S.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),S={a:a[o.a],b:a[o.b],c:a[o.c]},e=(z.a-S.a)*I.yaxis._m,t=(z.c-S.c-z.b+S.b)*I.xaxis._m);var i="translate("+(I.x0+t)+","+(I.y0+e)+")";I.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",i),I.aaxis.range=[S.a,I.sum-S.b-S.c],I.baxis.range=[I.sum-S.a-S.c,S.b],I.caxis.range=[I.sum-S.a-S.b,S.c],I.drawAxes(!1),I.plotContainer.selectAll(".crisp").classed("crisp",!1)}function h(t,e){if(t){var r={};r[I.id+".aaxis.min"]=S.a,r[I.id+".baxis.min"]=S.b,r[I.id+".caxis.min"]=S.c,l.relayout(F,r)}else 2===e&&x()}function g(){I.plotContainer.selectAll(".select-outline").remove()}function x(){var t={};t[I.id+".aaxis.min"]=0,t[I.id+".baxis.min"]=0,t[I.id+".caxis.min"]=0,F.emit("plotly_doubleclick",null),l.relayout(F,t)}var _,L,z,C,S,O,D,P,N,E,I=this,R=I.layers.plotbg.select("path").node(),F=I.graphDiv,j=I.layers.zoom,q={element:R,gd:F,plotinfo:{ -plot:j},doubleclick:x,subplot:I.id,prepFn:function(e,r,n){q.xaxes=[I.xaxis],q.yaxes=[I.yaxis];var a=F._fullLayout.dragmode;e.shiftKey&&(a="pan"===a?"zoom":"pan"),"lasso"===a?q.minDrag=1:q.minDrag=void 0,"zoom"===a?(q.moveFn=o,q.doneFn=u,t(e,r,n)):"pan"===a?(q.moveFn=d,q.doneFn=h,f(),g()):"select"!==a&&"lasso"!==a||m(e,r,n,q,a)}};R.onmousemove=function(t){y.hover(F,t,I.id),F._fullLayout._lasthover=R,F._fullLayout._hoversubplot=I.id},R.onmouseout=function(t){F._dragging||p.unhover(F,t)},R.onclick=function(t){y.click(F,t)},p.init(q)}},{"../../components/color":30,"../../components/dragelement":51,"../../components/drawing":53,"../../components/titles":104,"../../lib":122,"../../lib/extend":119,"../../plotly":144,"../cartesian/axes":149,"../cartesian/constants":154,"../cartesian/graph_interact":156,"../cartesian/select":162,"../cartesian/set_convert":163,d3:14,tinycolor2:20}],188:[function(t,e,r){"use strict";function n(t){return"object"==typeof t&&(t=t.type),t}var a=t("./lib"),o=t("./plots/attributes");r.modules={},r.allCategories={},r.allTypes=[],r.subplotsRegistry={},r.transformsRegistry={},r.componentsRegistry={},r.layoutArrayContainers=[],r.register=function(t,e,n,o){if(r.modules[e])return void a.log("Type "+e+" already registered");for(var i={},l=0;l-1}var o=t("../lib"),i=t("../plots/plots"),l=o.extendFlat,s=o.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,o=t.data,c=t.layout,u=s([],o),f=s({},c,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(r=0;r=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var m,v,y,x,b=e.p+(h?d[r]:d),_=b+(g?p[r]:p),w=e.b,k=w+e.s;if("h"===l.orientation?(y=u.c2p(b,!0),x=u.c2p(_,!0),m=c.c2p(w,!0),v=c.c2p(k,!0)):(m=c.c2p(b,!0),v=c.c2p(_,!0),y=u.c2p(w,!0),x=u.c2p(k,!0)),!(a(m)&&a(v)&&a(y)&&a(x)&&m!==v&&y!==x))return void n.select(this).remove();var M=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,A=n.round(M/2%1,2);if(!t._context.staticPlot){var T=i.opacity(e.mc||l.marker.color),L=T<1||M>.01?o:s;m=L(m,v),v=L(v,m),y=L(y,x),x=L(x,y)}n.select(this).attr("d","M"+m+","+y+"V"+x+"H"+v+"V"+y+"Z")})}),d.call(l.plot,e)}},{"../../components/color":30,"../../components/errorbars":59,"../../lib":122,"./arrays_to_calcdata":197,d3:14,"fast-isnumeric":17}],206:[function(t,e,r){"use strict";function n(t,e,r,n){if(n.length){var l,s,c,u,f,d=t._fullLayout.barmode,h="overlay"===d,p="group"===d;if(h)a(t,e,r,n);else if(p){for(l=[],s=[],c=0;cs+i&&(c=!0,s=y)),v(e.c2l(g))&&(gs+i&&(c=!0,s=g))}}x.expand(e,[l,s],{tozero:!0,padded:c})}function m(t){return t._id.charAt(0)}var v=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var r,a=e.xaxis,o=e.yaxis,i=t._fullData,l=t.calcdata,s=[],c=[];for(r=0;r1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,r=e.marker,i=r.line,l=o.tryColorscale(r,""),s=o.tryColorscale(r,"line");n.select(this).selectAll("path").each(function(t){var e,o,c=(t.mlw+1||i.width+1)-1,u=n.select(this);e="mc"in t?t.mcc=l(t.mc):Array.isArray(r.color)?a.defaultLine:r.color,u.style("stroke-width",c+"px").call(a.fill,e),c&&(o="mlc"in t?t.mlcc=s(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":30,"../../components/drawing":53,"../../components/errorbars":59,d3:14}],209:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,r,i,l){r("marker.color",i),a(t,"marker")&&o(t,e,l,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),a(t,"marker.line")&&o(t,e,l,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width")}},{"../../components/color":30,"../../components/colorscale/defaults":39,"../../components/colorscale/has_colorscale":43}],210:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),a=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,i=n.marker,l=i.line;e.exports={y:{valType:"data_array"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:o({},i.symbol,{arrayOk:!1}),opacity:o({},i.opacity,{arrayOk:!1,dflt:1}),size:o({},i.size,{arrayOk:!1}),color:o({},i.color,{arrayOk:!1}),line:{color:o({},l.color,{arrayOk:!1,dflt:a.defaultLine}),width:o({},l.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:n.fillcolor}},{"../../components/color/attributes":29,"../../lib/extend":119,"../scatter/attributes":271}],211:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(t,e,r,o,i){var l;return r in e?p=o.makeCalcdata(e,r):(l=r+"0"in e?e[r+"0"]:"name"in e&&("category"===o.type||n(e.name)&&["linear","log"].indexOf(o.type)!==-1||a.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,l=o.d2c(l),p=i.map(function(){return l})),p}function i(t,e,r,o,i){var l,s,c,u,f=o.length,d=e.length,h=[],p=[];for(l=0;l=0&&c1,v=r.dPos*(1-d.boxgap)*(1-d.boxgroupgap)/(m?t.numboxes:1),y=m?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-d.boxgap):0,x=v*g.whiskerwidth;return g.visible!==!0||r.emptybox?void o.select(this).remove():("h"===g.orientation?(s=p,f=h):(s=h,f=p),r.bPos=y,r.bdPos=v,n(),o.select(this).selectAll("path.box").data(i.identity).enter().append("path").attr("class","box").each(function(t){var e=s.c2p(t.pos+y,!0),r=s.c2p(t.pos+y-v,!0),n=s.c2p(t.pos+y+v,!0),a=s.c2p(t.pos+y-x,!0),l=s.c2p(t.pos+y+x,!0),c=f.c2p(t.q1,!0),u=f.c2p(t.q3,!0),d=i.constrain(f.c2p(t.med,!0),Math.min(c,u)+1,Math.max(c,u)-1),h=f.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=f.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?o.select(this).attr("d","M"+d+","+r+"V"+n+"M"+c+","+r+"V"+n+"H"+u+"V"+r+"ZM"+c+","+e+"H"+h+"M"+u+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+h+","+a+"V"+l+"M"+p+","+a+"V"+l)):o.select(this).attr("d","M"+r+","+d+"H"+n+"M"+r+","+c+"H"+n+"V"+u+"H"+r+"ZM"+e+","+c+"V"+h+"M"+e+","+u+"V"+p+(0===g.whiskerwidth?"":"M"+a+","+h+"H"+l+"M"+a+","+p+"H"+l))}),g.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,o,l,s,f,d="all"===g.boxpoints?t.val:t.val.filter(function(e){return et.uf}),h=Math.max((t.max-t.min)/10,t.q3-t.q1),p=1e-9*h,m=h*u,x=[],b=0;if(g.jitter){if(0===h)for(b=1,x=new Array(d.length),e=0;e-1}var o=t("../lib"),i=t("../plots/plots"),l=o.extendFlat,s=o.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,o=t.data,c=t.layout,u=s([],o),f=s({},c,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(r=0;r=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var m,v,y,x,b=e.p+(h?d[r]:d),_=b+(g?p[r]:p),w=e.b,k=w+e.s;if("h"===l.orientation?(y=u.c2p(b,!0),x=u.c2p(_,!0),m=c.c2p(w,!0),v=c.c2p(k,!0)):(m=c.c2p(b,!0),v=c.c2p(_,!0),y=u.c2p(w,!0),x=u.c2p(k,!0)),!(a(m)&&a(v)&&a(y)&&a(x)&&m!==v&&y!==x))return void n.select(this).remove();var M=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,A=n.round(M/2%1,2);if(!t._context.staticPlot){var T=i.opacity(e.mc||l.marker.color),L=T<1||M>.01?o:s;m=L(m,v),v=L(v,m),y=L(y,x),x=L(x,y)}n.select(this).attr("d","M"+m+","+y+"V"+x+"H"+v+"V"+y+"Z")})}),d.call(l.plot,e)}},{"../../components/color":30,"../../components/errorbars":59,"../../lib":122,"./arrays_to_calcdata":197,d3:14,"fast-isnumeric":17}],206:[function(t,e,r){"use strict";function n(t,e,r,n){if(n.length){var l,s,c,u,f,d=t._fullLayout.barmode,h="overlay"===d,p="group"===d;if(h)a(t,e,r,n);else if(p){for(l=[],s=[],c=0;cs+i&&(c=!0,s=y)),v(e.c2l(g))&&(gs+i&&(c=!0,s=g))}}x.expand(e,[l,s],{tozero:!0,padded:c})}function m(t){return t._id.charAt(0)}var v=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var r,a=e.xaxis,o=e.yaxis,i=t._fullData,l=t.calcdata,s=[],c=[];for(r=0;r1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,r=e.marker,i=r.line,l=o.tryColorscale(r,""),s=o.tryColorscale(r,"line");n.select(this).selectAll("path").each(function(t){var e,o,c=(t.mlw+1||i.width+1)-1,u=n.select(this);e="mc"in t?t.mcc=l(t.mc):Array.isArray(r.color)?a.defaultLine:r.color,u.style("stroke-width",c+"px").call(a.fill,e),c&&(o="mlc"in t?t.mlcc=s(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":30,"../../components/drawing":53,"../../components/errorbars":59,d3:14}],209:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,r,i,l){r("marker.color",i),a(t,"marker")&&o(t,e,l,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),a(t,"marker.line")&&o(t,e,l,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width")}},{"../../components/color":30,"../../components/colorscale/defaults":39,"../../components/colorscale/has_colorscale":43}],210:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),a=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,i=n.marker,l=i.line;e.exports={y:{valType:"data_array"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:o({},i.symbol,{arrayOk:!1}),opacity:o({},i.opacity,{arrayOk:!1,dflt:1}),size:o({},i.size,{arrayOk:!1}),color:o({},i.color,{arrayOk:!1}),line:{color:o({},l.color,{arrayOk:!1,dflt:a.defaultLine}),width:o({},l.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:n.fillcolor}},{"../../components/color/attributes":29,"../../lib/extend":119,"../scatter/attributes":271}],211:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(t,e,r,o,i){var l;return r in e?p=o.makeCalcdata(e,r):(l=r+"0"in e?e[r+"0"]:"name"in e&&("category"===o.type||n(e.name)&&["linear","log"].indexOf(o.type)!==-1||a.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,l=o.d2c(l),p=i.map(function(){return l})),p}function i(t,e,r,o,i){var l,s,c,u,f=o.length,d=e.length,h=[],p=[];for(l=0;l=0&&c1,v=r.dPos*(1-d.boxgap)*(1-d.boxgroupgap)/(m?t.numboxes:1),y=m?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-d.boxgap):0,x=v*g.whiskerwidth;return g.visible!==!0||r.emptybox?void o.select(this).remove():("h"===g.orientation?(s=p,f=h):(s=h,f=p),r.bPos=y,r.bdPos=v,n(),o.select(this).selectAll("path.box").data(i.identity).enter().append("path").attr("class","box").each(function(t){var e=s.c2p(t.pos+y,!0),r=s.c2p(t.pos+y-v,!0),n=s.c2p(t.pos+y+v,!0),a=s.c2p(t.pos+y-x,!0),l=s.c2p(t.pos+y+x,!0),c=f.c2p(t.q1,!0),u=f.c2p(t.q3,!0),d=i.constrain(f.c2p(t.med,!0),Math.min(c,u)+1,Math.max(c,u)-1),h=f.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=f.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?o.select(this).attr("d","M"+d+","+r+"V"+n+"M"+c+","+r+"V"+n+"H"+u+"V"+r+"ZM"+c+","+e+"H"+h+"M"+u+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+h+","+a+"V"+l+"M"+p+","+a+"V"+l)):o.select(this).attr("d","M"+r+","+d+"H"+n+"M"+r+","+c+"H"+n+"V"+u+"H"+r+"ZM"+e+","+c+"V"+h+"M"+e+","+u+"V"+p+(0===g.whiskerwidth?"":"M"+a+","+h+"H"+l+"M"+a+","+p+"H"+l))}),g.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,o,l,s,f,d="all"===g.boxpoints?t.val:t.val.filter(function(e){return et.uf}),h=Math.max((t.max-t.min)/10,t.q3-t.q1),p=1e-9*h,m=h*u,x=[],b=0;if(g.jitter){if(0===h)for(b=1,x=new Array(d.length),e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(l.translatePoints,h,p),void(g.boxmean&&o.select(this).selectAll("path.mean").data(i.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=s.c2p(t.pos+y,!0),r=s.c2p(t.pos+y-v,!0),n=s.c2p(t.pos+y+v,!0),a=f.c2p(t.mean,!0),i=f.c2p(t.mean-t.sd,!0),l=f.c2p(t.mean+t.sd,!0);"h"===g.orientation?o.select(this).attr("d","M"+a+","+r+"V"+n+("sd"!==g.boxmean?"":"m0,0L"+i+","+e+"L"+a+","+r+"L"+l+","+e+"Z")):o.select(this).attr("d","M"+r+","+a+"H"+n+("sd"!==g.boxmean?"":"m0,0L"+e+","+i+"L"+r+","+a+"L"+e+","+l+"Z"))})))})}},{"../../components/drawing":53,"../../lib":122,d3:14}],218:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../plots/cartesian/axes"),o=t("../../lib");e.exports=function(t,e){var r,i,l,s,c=t._fullLayout,u=e.xaxis,f=e.yaxis,d=["v","h"];for(i=0;it?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===r||10===r){var n=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;return t>n?5===r?713:1114:5===r?104:208}return 15===r?0:r}function i(t){var e,r,n,a,i,l,s,c,u,f=t[0].z,d=f.length,h=f[0].length,p=2===d||2===h;for(r=0;r20?(l=C[l][(s[0]||s[1])<0?0:1],t.crossings[i]=S[l]):delete t.crossings[i],s=z[l],!s){_.log("Found bad marching index:",l,e,t.level);break}if(h.push(d(t,e,s)),e[0]+=s[0],e[1]+=s[1],u(h[h.length-1],h[h.length-2])&&h.pop(),i=e.join(","),i===o&&s.join(",")===p||r&&(s[0]&&(e[0]<0||e[0]>m-2)||s[1]&&(e[1]<0||e[1]>g-2)))break;l=t.crossings[i]}1e4===a&&_.log("Infinite loop in contour?");var v,y,x,b,w,k,M,A=u(h[0],h[h.length-1]),T=0,L=.2*t.smoothing,O=[],D=0;for(a=1;a=D;a--)if(v=O[a],v=D&&v+O[y]20&&e?208===t||1114===t?n=0===r[0]?1:-1:a=0===r[1]?1:-1:M.indexOf(t)!==-1?a=1:T.indexOf(t)!==-1?n=1:A.indexOf(t)!==-1?a=-1:n=-1,[n,a]}function u(t,e){return Math.abs(t[0]-e[0])<.01&&Math.abs(t[1]-e[1])<.01}function f(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function d(t,e,r){var n=e[0]+Math.max(r[0],0),a=e[1]+Math.max(r[1],0),o=t.z[a][n],i=t.xaxis,l=t.yaxis;if(r[1]){var s=(t.level-o)/(t.z[a][n+1]-o);return[i.c2p((1-s)*t.x[n]+s*t.x[n+1],!0),l.c2p(t.y[a],!0)]}var c=(t.level-o)/(t.z[a+1][n]-o);return[i.c2p(t.x[n],!0),l.c2p((1-c)*t.y[a]+c*t.y[a+1],!0)]}function h(t,e,r){var n=t.plot.select(".maplayer").selectAll("g.contour."+r).data(e);return n.enter().append("g").classed("contour",!0).classed(r,!0),n.exit().remove(),n}function p(t,e,r){var n=t.selectAll("g.contourbg").data([0]);n.enter().append("g").classed("contourbg",!0);var a=n.selectAll("path").data("fill"===r.coloring?[0]:[]);a.enter().append("path"),a.exit().remove(),a.attr("d","M"+e.join("L")+"Z").style("stroke","none")}function g(t,e,r,n){var a=t.selectAll("g.contourfill").data([0]);a.enter().append("g").classed("contourfill",!0);var o=a.selectAll("path").data("fill"===n.coloring?e:[]);o.enter().append("path"),o.exit().remove(),o.each(function(t){var e=m(t,r);e?b.select(this).attr("d",e).style("stroke","none"):b.select(this).remove()})}function m(t,e){function r(t){return Math.abs(t[1]-e[0][1])<.01}function n(t){return Math.abs(t[1]-e[2][1])<.01}function a(t){return Math.abs(t[0]-e[0][0])<.01}function o(t){return Math.abs(t[0]-e[2][0])<.01}for(var i,l,s,c,u,f,d=t.edgepaths.length||t.z[0][0]=0&&(l=m,c=u):Math.abs(i[1]-l[1])<.01?Math.abs(i[1]-m[1])<.01&&(m[0]-i[0])*(l[0]-m[0])>=0&&(l=m,c=u):_.log("endpt to newendpt is not vert. or horz.",i,l,m)}if(i=l,c>=0)break;d+="L"+l}if(c===t.edgepaths.length){_.log("unclosed perimeter path");break}h=c,g=p.indexOf(h)===-1,g&&(h=p[0],d+="Z")}for(h=0;h1;if(p&&!d&&"category"!==o.type){var g=e.length;if(!(g<=a))return f?e.slice(0,a):e.slice(0,a+1);if(f||h)c=e.slice(0,a);else if(1===a)c=[e[0]-.5,e[0]+.5];else{for(c=[1.5*e[0]-.5*e[1]],s=1;sy;n++)i=s(t,e,o(i));return i>y&&f.log("interp2d didn't converge quickly",i),t}function l(t){var e,r,n,a,o,i,l,s,c=[],u={},f=[],d=t[0],h=[],p=[0,0,0],g=v(t);for(r=0;r=0;o--)a=f[o],r=a[0],n=a[1],i=((u[[r-1,n]]||p)[2]+(u[[r+1,n]]||p)[2]+(u[[r,n-1]]||p)[2]+(u[[r,n+1]]||p)[2])/20,i&&(l[a]=[r,n,i],f.splice(o,1),s=!0);if(!s)throw"findEmpties iterated with no new neighbors";for(a in l)u[a]=l[a],c.push(l[a])}return c.sort(function(t,e){return e[2]-t[2]})}function s(t,e,r){var n,a,o,i,l,s,c,u,f,d,h,p,g,m=0;for(i=0;ip&&(m=Math.max(m,Math.abs(t[a][o]-h)/(g-p))))}return m}var c=t("fast-isnumeric"),u=t("../../registry"),f=t("../../lib"),d=t("../../plots/cartesian/axes"),h=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),m=t("./convert_column_xyz"),v=t("./max_row_length");e.exports=function(t,e){function r(t){z=e._input.zsmooth=e.zsmooth=!1,f.notifier("cannot fast-zsmooth: "+t)}var o,s,c,y,x,b,_,w,k=d.getFromId(t,e.xaxis||"x"),M=d.getFromId(t,e.yaxis||"y"),A=u.traceIs(e,"contour"),T=u.traceIs(e,"histogram"),L=u.traceIs(e,"gl2d"),z=A?"best":e.zsmooth;if(k._minDtick=0,M._minDtick=0,T){var C=h(t,e);o=C.x,s=C.x0,c=C.dx,y=C.y,x=C.y0,b=C.dy,_=C.z}else g(e)&&m(e,k,M),o=e.x?k.makeCalcdata(e,"x"):[],y=e.y?M.makeCalcdata(e,"y"):[],s=e.x0||0,c=e.dx||1,x=e.y0||0,b=e.dy||1,_=n(e),(A||e.connectgaps)&&(e._emptypoints=l(_),e._interpz=i(_,e._emptypoints,e._interpz));if("fast"===z)if("log"===k.type||"log"===M.type)r("log axis found");else if(!T){if(o.length){var S=(o[o.length-1]-o[0])/(o.length-1),O=Math.abs(S/100);for(w=0;wO){r("x scale is not linear");break}}if(y.length&&"fast"===z){var D=(y[y.length-1]-y[0])/(y.length-1),P=Math.abs(D/100);for(w=0;wP){r("y scale is not linear");break}}}var N=v(_),E="scaled"===e.xtype?"":o,I=a(e,E,s,c,N,k),R="scaled"===e.ytype?"":y,F=a(e,R,x,b,_.length,M);L||(d.expand(k,I),d.expand(M,F));var j={x:I,y:F,z:_};if(p(e,_,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var q="contour"===e.type?"heatmap":"histogram2d";j.xfill=a(q,E,s,c,N,k),j.yfill=a(q,R,x,b,_.length,M)}return[j]};var y=.01,x=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":36,"../../lib":122,"../../plots/cartesian/axes":149,"../../registry":188,"../histogram2d/calc":252,"./convert_column_xyz":233,"./has_columns":235,"./max_row_length":238,"fast-isnumeric":17}],232:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,s="cb"+r.uid,c=r.zmin,u=r.zmax;if(n(c)||(c=a.aggNums(Math.min,null,r.z)),n(u)||(u=a.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+s).remove(),!r.showscale)return void o.autoMargin(t,s);var f=e[0].t.cb=l(t,s),d=i.makeColorScaleFunc(i.extractScale(r.colorscale,c,u),{noNumericCheck:!0});f.fillcolor(d).filllevels({start:c,end:u,size:(u-c)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":33,"../../components/colorscale":44,"../../lib":122,"../../plots/plots":173,"fast-isnumeric":17}],233:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var a,o=t.x.slice(),i=t.y.slice(),l=t.z,s=t.text,c=Math.min(o.length,i.length,l.length),u=void 0!==s&&!Array.isArray(s[0]);for(c=y[0].length||f<0||f>y.length)return}else{if(n.inbox(e-m[0],e-m[m.length-1])>o||n.inbox(r-v[0],r-v[v.length-1])>o)return;if(l){var w;for(b=[2*m[0]-m[1]],w=1;w0&&o0&&l0;)_=m.c2p(L[A]),A--;for(_0;)M=v.c2p(z[A]),A--;if(M0&&(n=!0);for(var l=0;lo)return r[t]=o,o-r[t]}return 0},max:function(t,e,r,a){var o=a[e];if(n(o)){if(o=Number(o),!n(r[t]))return r[t]=o,o;if(r[t]=0&&yR;r--)if(f[r]){F=r;break}for(r=R;r<=F;r++)n(u[r])&&n(f[r])&&I.push({p:u[r],s:f[r],b:0});return I}}},{"../../lib":122,"../../plots/cartesian/axes":149,"./average":243,"./bin_functions":245,"./clean_bins":247,"./norm_functions":250,"fast-isnumeric":17}],247:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib").cleanDate,o=t("../../constants/numerical").ONEDAY;e.exports=function(t,e,r){var i=e.type,l=r+"bins",s=t[l];s||(s=t[l]={});var c="date"===i?function(t){return t||0===t?a(t):null}:function(t){return n(t)?Number(t):null};s.start=c(s.start),s.end=c(s.end);var u="date"===i?o:1,f=s.size;if(n(f))s.size=f>0?Number(f):u;else if("string"!=typeof f)s.size=u;else{var d=f.charAt(0),h=f.substr(1);h=n(h)?Number(h):0,(h<=0||"date"!==i||"M"!==d||h!==Math.round(h))&&(s.size=u)}var p="autobin"+r;"boolean"!=typeof t[p]&&(t[p]=!((s.start||0===s.start)&&(s.end||0===s.end))),t[p]||delete t["nbins"+r]}},{"../../constants/numerical":110,"../../lib":122,"fast-isnumeric":17}],248:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../components/color"),o=t("./bin_defaults"),i=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),s=t("./attributes");e.exports=function(t,e,r,c){function u(r,a){return n.coerce(t,e,s,r,a)}var f=u("x"),d=u("y");u("text");var h=u("orientation",d&&!f?"h":"v"),p=e["v"===h?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===h?"x":"y"];g&&u("histfunc");var m="h"===h?["y"]:["x"];o(t,e,u,m),i(t,e,u,r,c),l(t,e,a.defaultLine,{axis:"y"}),l(t,e,a.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":30,"../../components/errorbars/defaults":58,"../../lib":122,"../bar/style_defaults":209,"./attributes":242,"./bin_defaults":244}],249:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("../bar/layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("../bar/layout_defaults"),n.calc=t("./calc"),n.setPositions=t("../bar/set_positions"),n.plot=t("../bar/plot"),n.style=t("../bar/style"),n.colorbar=t("../scatter/colorbar"),n.hoverPoints=t("../bar/hover"),n.moduleType="trace",n.name="histogram",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":157,"../bar/hover":201,"../bar/layout_attributes":203,"../bar/layout_defaults":204,"../bar/plot":205,"../bar/set_positions":206,"../bar/style":208,"../scatter/colorbar":274,"./attributes":242,"./calc":246,"./defaults":248}],250:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,a=0;ay&&g.splice(y,g.length-y),v.length>y&&v.splice(y,v.length-y),!e.autobinx&&"xbins"in e||(e.xbins=a.autoBin(g,p,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start=p.c2r(a.tickIncrement(p.r2c(e.xbins.start),e.xbins.size,!0)),e.xbins.end=p.c2r(a.tickIncrement(p.r2c(e.xbins.end),e.xbins.size))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=a.autoBin(v,m,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start=m.c2r(a.tickIncrement(m.r2c(e.ybins.start),e.ybins.size,!0)),e.ybins.end=m.c2r(a.tickIncrement(m.r2c(e.ybins.end),e.ybins.size))),e._input.ybins=e.ybins),d=[];var x,b,_=[],w=[],k="string"==typeof e.xbins.size?[]:e.xbins,M="string"==typeof e.xbins.size?[]:e.ybins,A=0,T=[],L=e.histnorm,z=e.histfunc,C=L.indexOf("density")!==-1,S="max"===z||"min"===z,O=S?null:0,D=o.count,P=i[L],N=!1,E=[],I=[],R="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";R&&"count"!==z&&(N="avg"===z,D=o[z]);var F=e.xbins,j=p.r2c(F.start),q=p.r2c(F.end)+(j-a.tickIncrement(j,F.size))/1e6;for(h=j;h=0&&x=0&&b")}return g};var s},{"../../components/color":30,"./helpers":263,"fast-isnumeric":17,tinycolor2:20}],262:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r,o){function i(r,o){return n.coerce(t,e,a,r,o)}var l=n.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,m=g||"inside"===p,v=g||"outside"===p;if(m||v){var y=l(i,"textfont",o.font);m&&l(i,"insidetextfont",y),v&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":122,"./attributes":259}],263:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return r.lastIndexOf(".")!==-1&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return r.lastIndexOf(".")!==-1&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":122}],264:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.layoutAttributes=t("./layout_attributes"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.styleOne=t("./style_one"),n.moduleType="trace",n.name="pie",n.basePlotModule=t("./base_plot"),n.categories=["pie","showLegend"],n.meta={},e.exports=n},{"./attributes":259,"./base_plot":260,"./calc":261,"./defaults":262,"./layout_attributes":265,"./layout_defaults":266,"./plot":267,"./style":268,"./style_one":269}],265:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],266:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function r(r,o){return n.coerce(t,e,a,r,o)}r("hiddenlabels")}},{"../../lib":122,"./layout_attributes":265}],267:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/r.vTotal,.5),l=1-r.trace.hole,s=a(e,r),c={scale:s*r.r*2/n,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=r.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/r.r)-f*o/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=r.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),m={scale:2*g/t.width,rCenter:Math.cos(g/r.r)-g/o/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>d.scale?m:d;return c.scale<1&&v.scale>c.scale?v:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var r=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(r)),(1-e.trace.hole)/2)}function o(t,e){var r=e.pxmid[0],n=e.pxmid[1],a=t.width/2,o=t.height/2;return r<0&&(a*=-1),n<0&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+r*r/(n*n)),outside:!0}}function i(t,e){function r(t,e){return t.pxmid[1]-e.pxmid[1]}function n(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,r){r||(r={});var n,a,o,l,d,h,g=r.labelExtraY+(i?r.yLabelMax:r.yLabelMin),m=i?t.yLabelMin:t.yLabelMax,v=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-m;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-m-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*f>0&&(n=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,m,v;for(i=0;i<2;i++)for(l=i?r:n,c=i?Math.max:Math.min,f=i?1:-1,o=0;o<2;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),m=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(r/c(l.tilt,Math.sin(s),l.depth),n/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&h.indexOf(l.scalegroup)===-1&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,r){if(!t)return 1;var n=Math.sin(t*Math.PI/180);return Math.max(.01,r*n*Math.abs(e)+2*Math.sqrt(1-n*n*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;l(e,r._size);var c=r._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],m=c.trace,v=0,y=(m.depth||0)*c.r*Math.sin(v)/2,x=m.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(v),k=l.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],v=!1;l.each(function(i){function l(e){var n=t._fullLayout,o=t._fullData[m.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&n.hovermode!==!1&&"none"!==l&&"skip"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=r.separators,p=[];l.indexOf("label")!==-1&&p.push(i.label),o.text&&o.text[i.i]&&l.indexOf("text")!==-1&&p.push(o.text[i.i]),l.indexOf("value")!==-1&&p.push(g.formatPieValue(i.v,h)),l.indexOf("percent")!==-1&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:l.indexOf("name")!==-1?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:n._hoverlayer.node(),outerContainer:n._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(r._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],t._hoverdata.trace=e.trace,f.click(t,{target:!0})}function b(t,e,r,n){return"a"+n*c.r+","+n*w+" "+x+" "+i.largeArc+(r?" 1 ":" 0 ")+n*(e[0]-t[0])+","+n*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y),m.pull){var z=+(Array.isArray(m.pull)?m.pull[i.i]:m.pull)||0;z>0&&(k+=z*i.pxmid[0],M+=z*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var C=m.hole;if(i.v===c.vTotal){var S="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";C?T.attr("d","M"+(k+C*i.px0[0])+","+(M+C*i.px0[1])+b(i.px0,i.pxmid,!1,C)+b(i.pxmid,i.px0,!1,C)+"Z"+S):T.attr("d",S)}else{var O=b(i.px0,i.px1,!0,1);if(C){var D=1-C;T.attr("d","M"+(k+C*i.px1[0])+","+(M+C*i.px1[1])+b(i.px1,i.px0,!1,C)+"l"+D*i.px0[0]+","+D*i.px0[1]+O+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+O+"Z")}var P=Array.isArray(m.textposition)?m.textposition[i.i]:m.textposition,N=A.selectAll("g.slicetext").data(i.text&&"none"!==P?[0]:[]);N.enter().append("g").classed("slicetext",!0),N.exit().remove(),N.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===P?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,r=h.bBox(t.node());"outside"===P?e=o(r,i):(e=n(r,i,c),"auto"===P&&e.scale<1&&(t.call(h.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),r=h.bBox(t.node())),e=o(r,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-r.height/2,i.yLabelMid=l,i.yLabelMax=l+r.height/2,i.labelExtraX=0,i.labelExtraY=0,v=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(r.left+r.right)/2+","+-(r.top+r.bottom)/2+")")})}),v&&i(s,m),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+n+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(n+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":30,"../../components/drawing":53,"../../lib/svg_text_utils":134,"../../plots/cartesian/graph_interact":156,"./helpers":263,d3:14}],268:[function(t,e,r){"use strict";var n=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],r=e.trace,o=n.select(this);o.style({opacity:r.opacity}),o.selectAll(".top path.surface").each(function(t){n.select(this).call(a,t,r)})})}},{"./style_one":269,d3:14}],269:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var a=r.marker.line.color;Array.isArray(a)&&(a=a[e.i]||n.defaultLine);var o=r.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(n.stroke,a)}},{"../../components/color":30}],270:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){var e=t[0].trace,r=e.marker;if(n.mergeArray(e.text,t,"tx"),n.mergeArray(e.textposition,t,"tp"),e.textfont&&(n.mergeArray(e.textfont.size,t,"ts"),n.mergeArray(e.textfont.color,t,"tc"),n.mergeArray(e.textfont.family,t,"tf")),r&&r.line){var a=r.line;n.mergeArray(r.opacity,t,"mo"),n.mergeArray(r.symbol,t,"mx"),n.mergeArray(r.color,t,"mc"),n.mergeArray(a.color,t,"mlc"),n.mergeArray(a.width,t,"mlw")}}},{"../../lib":122}],271:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),a=t("../../components/errorbars/attributes"),o=t("../../components/colorbar/attributes"),i=t("../../components/drawing"),l=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},ids:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"},simplify:{valType:"boolean",dflt:!0}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:l({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},colorbar:o,line:l({},{width:{valType:"number",min:0,arrayOk:!0}},n("marker.line"))},n("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},error_y:a,error_x:a}},{"../../components/colorbar/attributes":31,"../../components/colorscale/color_attributes":37,"../../components/drawing":53,"../../components/errorbars/attributes":55,"../../lib/extend":119,"./constants":276}],272:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var r,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(r=e.marker,s=r.size,Array.isArray(s)){var v={type:"linear"};a.setConvert(v),s=v.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,a.expand(u,d,g),a.expand(f,h,m);var b=new Array(p);for(c=0;c=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}}}}},{}],274:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,s=r.marker,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===s||!s.showscale)return void o.autoMargin(t,c);var u=s.color,f=s.cmin,d=s.cmax;n(f)||(f=a.aggNums(Math.min,null,u)),n(d)||(d=a.aggNums(Math.max,null,u));var h=e[0].t.cb=l(t,c),p=i.makeColorScaleFunc(i.extractScale(s.colorscale,f,d),{noNumericCheck:!0});h.fillcolor(p).filllevels({start:f,end:d,size:(d-f)/254}).options(s.colorbar)()}},{"../../components/colorbar/draw":33,"../../components/colorscale":44,"../../lib":122,"../../plots/plots":173,"fast-isnumeric":17}],275:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&n(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(n(t,"marker")&&a(t,t.marker.color,"marker","c"),n(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":36,"../../components/colorscale/has_colorscale":43,"./subtypes":291}],276:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],277:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,o){return n.coerce(t,e,a,r,o)}var m=l(t,e,g),v=mB!=P>=B&&(S=z[T-1][0],O=z[T][0],C=S+(O-S)*(B-D)/(P-D),R=Math.min(R,C),F=Math.max(F,C));R=Math.max(R,0),F=Math.min(F,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),n.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:F,y0:B,y1:B,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":30,"../../components/errorbars":59,"../../lib":122,"../../plots/cartesian/constants":154,"../../plots/cartesian/graph_interact":156,"./get_trace_color":279}],281:[function(t,e,r){"use strict";var n={},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"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":157,"./arrays_to_calcdata":270,"./attributes":271,"./calc":272,"./clean_data":273,"./colorbar":274,"./defaults":277,"./hover":280,"./plot":288,"./select":289,"./style":290,"./subtypes":291}],282:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,i){var l=(t.marker||{}).color;if(i("line.color",r),n(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=!Array.isArray(l)&&l||r;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":39,"../../components/colorscale/has_colorscale":43}],283:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),a=k.c2p(t[e].y);return r!==n&&a!==n&&[r,a]}function a(t){var e=t[0]/w._length,r=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function o(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var i,l,s,c,u,f,d,h,p,g,m,v,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.simplify,A=e.connectGaps,T=e.baseTolerance,L=e.linear,z=[],C=.2,S=new Array(t.length),O=0;for(M||(T=C=-1),i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,c=f,h=!1):y=t.length||!f)break;S[O++]=f,l=f}}else S[O++]=c}z.push(S.slice(0,O))}return z}},{"../../constants/numerical":110}],284:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],285:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,a,o=null,i=0;i0?Math.max(e,a):0}}},{"fast-isnumeric":17}],287:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,r,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(r=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",r),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?n.background:n.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":30,"../../components/colorscale/defaults":39,"../../components/colorscale/has_colorscale":43,"./subtypes":291}],288:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=i.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function a(t,e,r,n,a,h,g){function m(t){return M?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,r,n=t[0].trace,a=i.select(this),o=u.hasMarkers(n),c=u.hasText(n),f=x(n),d=b,h=b;o&&(d=n.marker.maxdisplayed?v:l.identity),c&&(h=n.marker.maxdisplayed?v:l.identity),r=a.selectAll("path.point"),e=r.data(d,f);var p=e.enter().append("path").classed("point",!0);p.call(s.pointStyle,n).call(s.translatePoints,A,T,n),M&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=m(i.select(this));s.translatePoint(t,e,A,T),s.singlePointStyle(t,e,n)}),M?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=a.selectAll("g"),e=r.data(h,f),e.enter().append("g").append("text"),e.each(function(t){var e=m(i.select(this).select("text"));s.translatePoint(t,e,A,T)}),e.selectAll("text").call(s.textPointStyle,n).each(function(t){var e=t.xp||A.c2p(t.x),r=t.yp||T.c2p(t.y);i.select(this).selectAll("tspan").each(function(){m(i.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,k;o(t,e,r,n,a);var M=!!g&&g.duration>0,A=r.xaxis,T=r.yaxis,L=n[0].trace,z=L.line,C=i.select(h);if(C.call(c.plot,r,g),L.visible===!0){m(C).style("opacity",L.opacity);var S,O,D=L.fill.charAt(L.fill.length-1);"x"!==D&&"y"!==D&&(D=""),n[0].node3=C,f(n);var P="",N=[],E=L._prevtrace;E&&(P=E._prevRevpath||"",O=E._nextFill,N=E._polygons);var I,R,F,j,q,B,H,V,Z,X="",U="",G=[],Y=[],W=l.noop;if(S=L._ownFill,u.hasLines(L)||"none"!==L.fill){for(O&&O.datum(n),["hv","vh","hvh","vhv"].indexOf(z.shape)!==-1?(F=s.steps(z.shape),j=s.steps(z.shape.split("").reverse().join(""))):F=j="spline"===z.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?s.smoothclosed(t.slice(1),z.smoothing):s.smoothopen(t,z.smoothing)}:function(t){return"M"+t.join("L")},q=function(t){return j(t.reverse())},G=d(n,{xaxis:A,yaxis:T,connectGaps:L.connectgaps,baseTolerance:Math.max(z.width||1,3)/4,linear:"linear"===z.shape,simplify:z.simplify}),Z=L._polygons=new Array(G.length),k=0;k1}),W=function(t){return function(e){if(I=F(e),R=q(e),X?D?(X+="L"+I.substr(1),U=R+("L"+U.substr(1))):(X+="Z"+I,U=R+"Z"+U):(X=I,U=R),u.hasLines(L)&&e.length>1){var r=i.select(this);if(r.datum(n),t)m(r.style("opacity",0).attr("d",I).call(s.lineGroupStyle)).style("opacity",1);else{var a=m(r);a.attr("d",I),s.singleLineStyle(n,a)}}}}}var Q=C.selectAll(".js-line").data(Y);m(Q.exit()).style("opacity",0).remove(),Q.each(W(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(W(!0)),G.length&&(S?B&&V&&(D?("y"===D?B[1]=V[1]=T.c2p(0,!0):"x"===D&&(B[0]=V[0]=A.c2p(0,!0)),m(S).attr("d","M"+V+"L"+B+"L"+X.substr(1))):m(S).attr("d",X+"Z")):"tonext"===L.fill.substr(0,6)&&X&&P&&("tonext"===L.fill?m(O).attr("d",X+"Z"+P+"Z"):m(O).attr("d",X+"L"+P.substr(1)+"Z"),L._polygons=L._polygons.concat(N)),L._prevRevpath=U,L._prevPolygons=Z);var $=C.selectAll(".points");w=$.data([n]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function o(t,e,r,n,a){var o=r.xaxis,l=r.yaxis,s=i.extent(o.range.map(o.r2l).map(o.l2c)),c=i.extent(l.range.map(l.r2l).map(l.l2c)),f=n[0].trace;if(u.hasMarkers(f)){var d=f.marker.maxdisplayed;if(0!==d){var h=n.filter(function(t){return t.x>=s[0]&&t.x<=s[1]&&t.y>=c[0]&&t.y<=c[1]}),p=Math.ceil(h.length/d),g=0;a.forEach(function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(u=p.selectAll("g.trace"),f=u.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),h(t,e,r),n(t,p),s=0,c=[];sn?1:-1}),m){l&&(d=l());var v=i.transition().duration(o.duration).ease(o.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()});v.each(function(){p.selectAll("g.trace").each(function(n,i){a(t,i,e,n,r,this,o)})})}else p.selectAll("g.trace").each(function(n,i){a(t,i,e,n,r,this,o)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":53,"../../components/errorbars":59,"../../lib":122,"../../lib/polygon":129,"./arrays_to_calcdata":270,"./line_points":283,"./link_traces":285,"./subtypes":291,d3:14}],289:[function(t,e,r){"use strict";var n=t("./subtypes"),a=.2;e.exports=function(t,e){var r,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!n.hasMarkers(d)&&!n.hasText(d);if(d.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;rM&&L.splice(M,L.length-M)}return l(e),"undefined"!=typeof L&&o.mergeArray(L,A,"ms"),A}},{"../../lib":122,"../../plots/cartesian/axes":149,"../scatter/colorscale_calc":275,"../scatter/subtypes":291,"fast-isnumeric":17}],296:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../scatter/constants"),o=t("../scatter/subtypes"),i=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),s=t("../scatter/line_shape_defaults"),c=t("../scatter/text_defaults"),u=t("../scatter/fillcolor_defaults"),f=t("./attributes");e.exports=function(t,e,r,d){function h(r,a){return n.coerce(t,e,f,r,a)}var p,g=h("a"),m=h("b"),v=h("c");if(g?(p=g.length,m?(p=Math.min(p,m.length),v&&(p=Math.min(p,v.length))):p=v?Math.min(p,v.length):0):m&&v&&(p=Math.min(m.length,v.length)),!p)return void(e.visible=!1);g&&p"),l}}},{"../../plots/cartesian/axes":149,"../scatter/hover":280}],298:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/ternary":181,"../scatter/colorbar":274,"./attributes":294,"./calc":295,"./defaults":296,"./hover":297,"./plot":299,"./select":300,"./style":301}],299:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e){var r=t.plotContainer;r.select(".scatterlayer").selectAll("*").remove();for(var a={xaxis:t.xaxis,yaxis:t.yaxis,plot:r},o=new Array(e.length),i=t.graphDiv.calcdata,l=0;l0&&this._events[t].length>n&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!a(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,l;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||a(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(n)){for(l=o;l-- >0;)if(n[l]===e||n[l].listener&&n[l].listener===e){r=l;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;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(n=this._events[t],a(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],13:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;r13)&&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}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return t-t<1}},{}],14:[function(t,e,n){function r(t,e){var n=e[0],r=e[1],a=e[2],o=e[3],i=n+n,l=r+r,s=a+a,c=n*i,u=r*i,f=r*l,d=a*i,h=a*l,p=a*s,g=o*i,m=o*l,v=o*s;return t[0]=1-f-p,t[1]=u+v,t[2]=d-m,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+m,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=r},{}],15:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function i(t){if(d===clearTimeout)return clearTimeout(t);if((d===a||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{return d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}function l(){m&&p&&(m=!1,p.length?g=p.concat(g):v=-1,g.length&&s())}function s(){if(!m){var t=o(l);m=!0;for(var e=g.length;e;){for(p=g,g=[];++v1)for(var n=1;n.5?s/(2-o-i):s/(o+i),o){case t:r=(e-n)/s+(e1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var a,o,i;if(t=C(t,360),e=C(e,100),n=C(n,100),0===e)a=o=i=n;else{var l=n<.5?n*(1+e):n+e-n*e,s=2*n-l;a=r(s,l,t+1/3),o=r(s,l,t),i=r(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function s(t,e,n){t=C(t,255),e=C(e,255),n=C(n,255);var r,a,o=Z(t,e,n),i=X(t,e,n),l=o,s=o-i;if(a=0===o?0:s/o,o==i)r=0;else{switch(o){case t:r=(e-n)/s+(e>1)+720)%360;--e;)a.h=(a.h+o)%360,i.push(r(a));return i}function A(t,e){e=e||6;for(var n=r(t).toHsv(),a=n.h,o=n.s,i=n.v,l=[],s=1/e;e--;)l.push(r({h:a,s:o,v:i})),i=(i+s)%1;return l}function T(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function C(t,n){O(t)&&(t="100%");var r=P(t);return t=X(n,Z(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function z(t){return X(1,Z(0,t))}function S(t){return parseInt(t,16)}function O(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function P(t){return"string"==typeof t&&t.indexOf("%")!=-1}function D(t){return 1==t.length?"0"+t:""+t}function N(t){return t<=1&&(t=100*t+"%"),t}function E(t){return e.round(255*parseFloat(t)).toString(16)}function I(t){return S(t)/255}function R(t){return!!W.CSS_UNIT.exec(t)}function F(t){t=t.replace(q,"").replace(B,"").toLowerCase();var e=!1;if(G[t])t=G[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=W.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=W.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=W.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=W.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=W.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=W.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=W.hex8.exec(t))?{r:S(n[1]),g:S(n[2]),b:S(n[3]),a:I(n[4]),format:e?"name":"hex8"}:(n=W.hex6.exec(t))?{r:S(n[1]),g:S(n[2]),b:S(n[3]),format:e?"name":"hex"}:(n=W.hex4.exec(t))?{r:S(n[1]+""+n[1]),g:S(n[2]+""+n[2]),b:S(n[3]+""+n[3]),a:I(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=W.hex3.exec(t))&&{r:S(n[1]+""+n[1]),g:S(n[2]+""+n[2]),b:S(n[3]+""+n[3]),format:e?"name":"hex"}}function j(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var q=/^\s+/,B=/\s+$/,H=0,V=e.round,X=e.min,Z=e.max,U=e.random;r.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,a,o,i,l=this.toRgb();return t=l.r/255,n=l.g/255,r=l.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),i=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),.2126*a+.7152*o+.0722*i},setAlpha:function(t){return this._a=L(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*C(this._r,255))+"%",g:V(100*C(this._g,255))+"%",b:V(100*C(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%)":"rgba("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[u(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),n=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=r(t);n="#"+d(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,a=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return r(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},r.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?n[a]=t[a]:n[a]=N(t[a]));t=n}return r(t,e)},r.equals=function(t,e){return!(!t||!e)&&r(t).toRgbString()==r(e).toRgbString()},r.random=function(){return r.fromRatio({r:U(),g:U(),b:U()})},r.mix=function(t,e,n){n=0===n?0:n||50;var a=r(t).toRgb(),o=r(e).toRgb(),i=n/100,l={r:(o.r-a.r)*i+a.r,g:(o.g-a.g)*i+a.g,b:(o.b-a.b)*i+a.b,a:(o.a-a.a)*i+a.a};return r(l)},r.readability=function(t,n){var a=r(t),o=r(n);return(e.max(a.getLuminance(),o.getLuminance())+.05)/(e.min(a.getLuminance(),o.getLuminance())+.05)},r.isReadable=function(t,e,n){var a,o,i=r.readability(t,e);switch(o=!1,a=j(n),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},r.mostReadable=function(t,e,n){var a,o,i,l,s=null,c=0;n=n||{},o=n.includeFallbackColors,i=n.level,l=n.size;for(var u=0;uc&&(c=a,s=r(e[u]));return r.isReadable(t,s,{level:i,size:l})||!o?s:(n.includeFallbackColors=!1,r.mostReadable(t,["#fff","#000"],n))};var G=r.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=r.hexNames=T(G),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+r),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})$/}}();"undefined"!=typeof n&&n.exports?n.exports=r:"function"==typeof t&&t.amd?t(function(){return r}):window.tinycolor=r}(Math)},{}],17:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../color"),o=t("../../plots/cartesian/axes"),i=t("./attributes");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,i,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("opacity"),c("align"),c("bgcolor");var f=c("bordercolor"),d=a.opacity(f);c("borderpad");var h=c("borderwidth"),p=c("showarrow");c("text",p?" ":"new text"),c("textangle"),r.coerceFont(c,"font",n.font);for(var g=["x","y"],m=[-10,-30],v={_fullLayout:n},y=0;y<2;y++){var x=g[y],b=o.coerceRef(t,e,v,x,"","paper");if(o.coercePosition(e,v,c,b,x,.5),p){var _="a"+x,w=o.coerceRef(t,e,v,_,"pixel");"pixel"!==w&&w!==b&&(w=e[_]="pixel"); var k="pixel"===w?m[y]:.4;o.coercePosition(e,v,c,w,_,k)}else c(x+"anchor")}return r.noneOrAll(t,e,["x","y"]),p&&(c("arrowcolor",d?e.bordercolor:a.defaultLine),c("arrowhead"),c("arrowsize"),c("arrowwidth",2*(d&&h||1)),r.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":118,"../../plots/cartesian/axes":145,"../color":26,"./attributes":19}],18:[function(t,e,n){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],19:[function(t,e,n){"use strict";var r=t("./arrow_paths"),a=t("../../plots/font_attributes"),o=t("../../plots/cartesian/constants"),i=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:i({},a,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:r.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",o.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":115,"../../plots/cartesian/constants":150,"../../plots/font_attributes":165,"./arrow_paths":18}],20:[function(t,e,n){"use strict";function r(t){var e=t._fullLayout;e.annotations.forEach(function(e){var n=o.getFromId(t,e.xref),r=o.getFromId(t,e.yref);if(n||r){var a=(e._xsize||0)/2,i=e._xshift||0,l=(e._ysize||0)/2,s=e._yshift||0,c=a-i,u=a+i,f=l-s,d=l+s;if(e.showarrow){var h=3*e.arrowsize*e.arrowwidth;c=Math.max(c,h),u=Math.max(u,h),f=Math.max(f,h),d=Math.max(d,h)}n&&n.autorange&&o.expand(n,[n.l2c(n.r2l(e.x))],{ppadplus:u,ppadminus:c}),r&&r.autorange&&o.expand(r,[r.l2c(r.r2l(e.y))],{ppadplus:d,ppadminus:f})}})}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.annotations);if(n.length&&t._fullData.length){var l={};n.forEach(function(t){l[t.xref]=!0,l[t.yref]=!0});var s=o.list(t).filter(function(t){return t.autorange&&l[t._id]});if(s.length)return a.syncOrAsync([i,r],t)}}},{"../../lib":118,"../../plots/cartesian/axes":145,"./draw":22}],21:[function(t,e,n){"use strict";var r=t("../../plots/array_container_defaults"),a=t("./annotation_defaults");e.exports=function(t,e){var n={name:"annotations",handleItemDefaults:a};r(t,e,n)}},{"../../plots/array_container_defaults":142,"./annotation_defaults":17}],22:[function(t,e,n){"use strict";function r(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var n=0;n2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}rt.selectAll("tspan.line").attr({y:0,x:0});var r=$.select(".annotation-math-group"),a=!r.empty(),l=h.bBox((a?r:rt).node()),c=l.width,p=l.height,v=Math.round(c+2*tt),y=Math.round(p+2*tt);X._w=c,X._h=p;var b=!1;if(["x","y"].forEach(function(e){var r,a=X[e+"ref"]||e,o=f.getFromId(t,a),i=(Y+("x"===e?0:90))*Math.PI/180,l=v*Math.abs(Math.cos(i))+y*Math.abs(Math.sin(i)),s=X[e+"anchor"];if(o){var c=o.r2fraction(X[e]);if(!o.autorange&&(c<0||c>1)&&(X["a"+e+"ref"]===a?(c=o.r2fraction(X["a"+e]),(c<0||c>1)&&(b=!0)):b=!0,b))return;G[e]=o._offset+o.r2p(X[e]),r=.5}else r=X[e],"y"===e&&(r=1-r),G[e]="x"===e?O.l+O.w*r:O.t+O.h*r;var u=0;X["a"+e+"ref"]===a?G["aa"+e]=o._offset+o.r2p(X["a"+e]):(u=X.showarrow?X["a"+e]:l*n(r,s),G[e]+=u),X["_"+e+"type"]=o&&o.type,X["_"+e+"size"]=l,X["_"+e+"shift"]=u}),b)return void $.remove();var _,w;X.showarrow&&(_=X.axref===X.xref?G.x:u.constrain(G.x-X.ax,1,M.width-1),w=X.ayref===X.yref?G.y:u.constrain(G.y-X.ay,1,M.height-1)),G.x=u.constrain(G.x,1,M.width-1),G.y=u.constrain(G.y,1,M.height-1);var k=tt-l.top,A=tt-l.left;a?r.select("svg").attr({x:tt-1,y:tt}):(rt.attr({x:A,y:k}),rt.selectAll("tspan.line").attr({y:k,x:A})),et.call(h.setRect,J/2,J/2,v-J,y-J);var T=0,L=0;T=X.axref===X.xref?Math.round(G.aax-v/2):Math.round(G.x-v/2),L=X.ayref===X.yref?Math.round(G.aay-y/2):Math.round(G.y-y/2),$.call(u.setTranslate,T,L);var C="annotations["+e+"]",z=function(n,r){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=X.axref===X.xref?G.aax+n:G.x+n,l=X.ayref===X.yref?G.aay+r:G.y+r;var c=u.rotationXYMatrix(Y,a,l),f=u.apply2DTransform(c),h=u.apply2DTransform2(c),p=et.attr("width")/2,g=et.attr("height")/2,v=[[a-p,l-g,a-p,l+g],[a-p,l+g,a+p,l+g],[a+p,l+g,a+p,l-g],[a+p,l-g,a-p,l-g]].map(h);if(!v.reduce(function(t,e){return t^!!o(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=o(a,l,_,w,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var y=X.arrowwidth,b=X.arrowcolor,k=W.append("g").style({opacity:d.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=k.append("path").attr("d","M"+a+","+l+"L"+_+","+w).style("stroke-width",y+"px").call(d.stroke,d.rgb(b));x(M,X.arrowhead,"end",X.arrowsize);var A=k.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-_)+","+(l-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,z;m.init({element:A.node(),prepFn:function(){var t=u.getTranslate($);L=t.x,z=t.y,T={},Z&&Z.autorange&&(T[Z._name+".autorange"]=!0),U&&U.autorange&&(T[U._name+".autorange"]=!0)},moveFn:function(t,e){k.attr("transform","translate("+t+","+e+")");var n=f(L,z),r=n[0]+t,a=n[1]+e;$.call(u.setTranslate,r,a),T[C+".x"]=Z?Z.p2r(Z.r2p(X.x)+t):(_+t-O.l)/O.w,T[C+".y"]=U?U.p2r(U.r2p(X.y)+e):1-(w+e-O.t)/O.h,X.axref===X.xref&&(T[C+".ax"]=Z?Z.p2r(Z.r2p(X.ax)+t):(_+t-O.l)/O.w),X.ayref===X.yref&&(T[C+".ay"]=U?U.p2r(U.r2p(X.ay)+e):1-(w+e-O.t)/O.h),Q.attr({transform:"rotate("+Y+","+r+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};X.showarrow&&z(0,0);var S=u.rotationXYMatrix(Y,G.x,G.y),P=u.apply2DTransform(S);if(t._context.editable){var D,N,E;m.init({element:$.node(),prepFn:function(){var t=u.getTranslate($);D=t.x,N=t.y,E={}},moveFn:function(t,e){$.call(u.setTranslate,D+t,N+e);var n="pointer";if(X.showarrow)X.axref===X.xref?E[C+".ax"]=Z.p2r(Z.r2p(X.ax)+t):E[C+".ax"]=X.ax+t,X.ayref===X.yref?E[C+".ay"]=U.p2r(U.r2p(X.ay)+e):E[C+".ay"]=X.ay+e,z(t,e);else{if(Z)E[C+".x"]=X.x+t/Z._m;else{var r=X._xsize/O.w,a=X.x+X._xshift/O.w-r/2;E[C+".x"]=m.align(a+t/O.w,r,0,1,X.xanchor)}if(U)E[C+".y"]=X.y+e/U._m;else{var o=X._ysize/O.h,i=X.y-X._yshift/O.h-o/2;E[C+".y"]=m.align(i-e/O.h,o,0,1,X.yanchor)}Z&&U||(n=m.getCursor(Z?.5:E[C+".x"],U?.5:E[C+".y"],X.xanchor,X.yanchor))}var l=P(D,N),s=l[0]+t,c=l[1]+e;$.call(u.setTranslate,D+t,N+e),Q.attr({transform:"rotate("+Y+","+s+","+c+")"}),g($,n)},doneFn:function(e){if(g($),e){s.relayout(t,E);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var w,k=t.layout,M=t._fullLayout;if(!l(e)||e===-1){if(!e&&Array.isArray(c))return k.annotations=c,y(k,M),void r(t);if("remove"===c)return delete k.annotations,M.annotations=[],void r(t);if(n&&"add"!==c){for(w=0;we;w--)M._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),a(t,w)}}M._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=k.annotations[e],L=M.annotations[e];if(T){var C={};"string"==typeof n&&n?C[n]=c:u.isPlainObject(n)&&(C=n);var z=Object.keys(C);for(w=0;w4/3&&(R=H)}}else I&&(j&&(R<1/3?R+=B:R>2/3&&(R-=B)),R=(R-I.domain[0])/(I.domain[1]-I.domain[0]),R=I.fraction2r(R))}I&&I===E&&F&&("log"===F&&"log"!==I.type?R=Math.pow(10,R):"log"!==F&&"log"===I.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),T[N]=R}}var X={};v(T,X,M),M.annotations[e]=X;var Z=f.getFromId(t,X.xref),U=f.getFromId(t,X.yref),G={x:0,y:0},Y=+X.textangle||0,W=M._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",X.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:X})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),J=X.borderwidth,K=X.borderpad,tt=J+K,et=$.append("rect").attr("class","bg").style("stroke-width",J+"px").call(d.stroke,X.bordercolor).call(d.fill,X.bgcolor),nt=X.font,rt=$.append("text").classed("annotation",!0).attr("data-unformatted",X.text).text(X.text);t._context.editable?rt.call(p.makeEditable,$).call(b).on("edit",function(n){X.text=n,this.attr({"data-unformatted":X.text}),this.call(b);var r={};r["annotations["+e+"].text"]=X.text,Z&&Z.autorange&&(r[Z._name+".autorange"]=!0),U&&U.autorange&&(r[U._name+".autorange"]=!0),s.relayout(t,r)}):rt.call(b),Q.attr({transform:"rotate("+Y+","+G.x+","+G.y+")"}).call(h.setPosition,G.x,G.y)}}}function o(t,e,n,r,a,o,i,l){var s=n-t,c=a-t,u=i-a,f=r-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,m=(c*f-s*d)/p;return m<0||m>1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:r,drawOne:a}},{"../../lib":118,"../../lib/setcursor":128,"../../lib/svg_text_utils":130,"../../plotly":140,"../../plots/cartesian/axes":145,"../../plots/plots":169,"../color":26,"../dragelement":47,"../drawing":49,"./annotation_defaults":17,"./defaults":21,"./draw_arrow_head":23,d3:10,"fast-isnumeric":13}],23:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../color"),i=t("../drawing"),l=t("./arrow_paths");e.exports=function(t,e,n,s){a(s)||(s=1);var c=t.node(),u=l[e||0];if(u){"string"==typeof n&&n||(n="end");var f,d,h,p,g=(i.getPx(t,"stroke-width")||1)*s,m=t.style("stroke")||o.defaultLine,v=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,b=u.backoff*g;if("line"===c.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},d={x:+t.attr("x2"),y:+t.attr("y2")},h=Math.atan2(f.y-d.y,f.x-d.x),p=h+Math.PI,b){var _=b*Math.cos(h),w=b*Math.sin(h);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(d.x+=_,d.y+=w,t.attr({x2:d.x,y2:d.y}))}}else if("path"===c.nodeName){var k=c.getTotalLength(),M="";if(y){var A=c.getPointAtLength(0),T=c.getPointAtLength(.1);h=Math.atan2(A.y-T.y,A.x-T.x),f=c.getPointAtLength(Math.min(b,k)),b&&(M="0px,"+b+"px,")}if(x){var L=c.getPointAtLength(k),C=c.getPointAtLength(k-.1);if(p=Math.atan2(L.y-C.y,L.x-C.x),d=c.getPointAtLength(Math.max(0,k-b)),b){var z=M?2*b:b;M+=k-z+"px,"+k+"px"}}else M&&(M+=k+"px");M&&t.style("stroke-dasharray",M)}var S=function(n,a){e>5&&(a=0),r.select(c.parentElement).append("path").attr({class:t.attr("class"),d:u.path,transform:"translate("+n.x+","+n.y+")rotate("+180*a/Math.PI+")scale("+g+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&S(f,h),x&&S(d,p)}}},{"../color":26,"../drawing":49,"./arrow_paths":18,d3:10,"fast-isnumeric":13}],24:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":19,"./calc_autorange":20,"./defaults":21,"./draw":22}],25:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],26:[function(t,e,n){"use strict";function r(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===r.length;if(!a&&3!==r.length)return t;for(var i=0;i=0))return t;if(3===i)r[i]>1&&(r[i]=1);else if(r[i]>=1)return t}var l=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return a?"rgba("+l+", "+r[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var n=a(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},i.combine=function(t,e){var n=a(t).toRgb();if(1===n.a)return a(t).toRgbString();var r=a(e||i.background).toRgb(),o=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},l={r:o.r*(1-n.a)+n.r*n.a,g:o.g*(1-n.a)+n.g*n.a,b:o.b*(1-n.a)+n.b*n.a};return a(l).toRgbString()},i.contrast=function(t,e,n){var r=a(t),o=r.isLight()?r.darken(n):r.lighten(e);return o.toString()},i.stroke=function(t,e){var n=a(e);t.style({stroke:i.tinyRGB(n),"stroke-opacity":n.getAlpha()})},i.fill=function(t,e){var n=a(e);t.style({fill:i.tinyRGB(n),"fill-opacity":n.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,n,a,o,l=Object.keys(t);for(e=0;el&&(o[1]-=(lt-l)/2)):n.node()&&!n.classed("js-placeholder")&&(lt=h.bBox(e.node()).height),lt){if(lt+=5,"top"===_.titleside)K.domain[1]-=lt/T.h,o[1]*=-1;else{K.domain[0]+=lt/T.h;var c=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),K.setScale()}}ot.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-K.domain[1]))+")");var f=ot.select(".cbfills").selectAll("rect.cbfill").data(S);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?C[0]:(S[e]+S[e-1])/2,e===S.length-1?C[1]:(S[e]+S[e+1])/2].map(K.c2p).map(Math.round);e!==S.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=P(t).replace("e-",""),i=a(o).toHexString();r.select(this).attr({x:G,width:Math.max(q,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var d=ot.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?z:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){r.select(this).attr("d","M"+G+","+(Math.round(K.c2p(t))+_.line.width/2%1)+"h"+q).call(h.lineGroupStyle,_.line.width,O(t),_.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=G+q+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=K.titlefont.size,n=K._offset+K._length/2,a=T.l+(K.position||0)*T.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));k("h"+K._id+"title",{avoid:{selection:r.select(t).selectAll("g."+K._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:A.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function k(e,n){var r,a=b();r=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:K,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:ot.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;ot.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,n||{}))}function M(){var n=q+_.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(R=it.select("text"),R.node()&&!R.classed("js-placeholder")){var r,a=it.select(".h"+K._id+"title-math-group").node();r=a&&["top","bottom"].indexOf(_.titleside)!==-1?h.bBox(a).width:h.bBox(it.node()).right-G-T.l,n=Math.max(n,r)}var o=2*_.xpad+n+_.borderwidth+_.outlinewidth/2,l=Q-$;ot.select(".cbbg").attr({x:G-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-Z,width:Math.max(o,2),height:Math.max(l+2*Z,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),ot.selectAll(".cboutline").attr({x:G,y:$+_.ypad+("top"===_.titleside?lt:0),width:Math.max(q,2),height:Math.max(l-2*_.ypad-lt,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var s=({center:.5,right:1}[_.xanchor]||0)*o;ot.attr("transform","translate("+(T.l-s)+","+T.t+")"),i.autoMargin(t,e,{x:_.x,y:_.y,l:o*({right:1,center:.5}[_.xanchor]||0),r:o*({left:1,center:.5}[_.xanchor]||0),t:l*({bottom:1,middle:.5}[_.yanchor]||0),b:l*({top:1,middle:.5}[_.yanchor]||0)})}var A=t._fullLayout,T=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var L,C=r.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),z=[],S=[],O="function"==typeof _.line.color?_.line.color:function(){return _.line.color},P="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},D=_.levels.end+_.levels.size/100,N=_.levels.size,E=1.001*C[0]-.001*C[1],I=1.001*C[1]-.001*C[0];for(L=_.levels.start;(L-D)*N<0;L+=N)L>E&&LC[0]&&L1){var at=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));et*=at*u.roundUp(rt/at,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+U,W+V-U],K.setScale();var ot=A._infolayer.selectAll("g."+e).data([0]);ot.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),ot.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var it=ot.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");K._axislayer=ot.select(".cbaxis");var lt=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var st,ct=T.l+(_.x+X)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-U))*T.h+T.t+3+.75*ut:(1-(W+U))*T.h+T.t-3-.25*ut,k(K._id+"title",{attributes:{x:ct,y:st,"text-anchor":"start"}})}var ft=u.syncOrAsync([i.previousPromises,w,i.previousPromises,M],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var dt,ht,pt;c.init({element:ot.node(),prepFn:function(){dt=ot.attr("transform"),d(ot)},moveFn:function(t,e){ot.attr("transform",dt+" translate("+t+","+e+")"),ht=c.align(Y+t/T.w,B,0,1,_.xanchor),pt=c.align(W-e/T.h,V,0,1,_.yanchor);var n=c.getCursor(ht,pt,_.xanchor,_.yanchor);d(ot,n)},doneFn:function(e){d(ot),e&&void 0!==ht&&void 0!==pt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":pt},b().index)}})}return ft}function b(){var n,r,a=e.substr(2);for(n=0;n=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":118,"./flip_scale":37,"./scales":44}],33:[function(t,e,n){"use strict";var r=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},r.colorscale,{}),cauto:a({},r.zauto,{}),cmax:a({},r.zmax,{}),cmin:a({},r.zmin,{}),autocolorscale:a({},r.autocolorscale,{}),reversescale:a({},r.reversescale,{})}}},{"../../lib/extend":115,"./attributes":31,"./scales.js":44}],34:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":44}],35:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,n,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,m=p[d+"min"],v=p[d+"max"],y=p.colorscale,x=r(m)&&r(v)&&m=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],38:[function(t,e,n){"use strict";var r=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=a),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":34,"./is_valid_scale_array":42,"./scales":44}],39:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?a.nestedProperty(t,e).get()||{}:t,i=n.color,l=!1;if(Array.isArray(i))for(var s=0;s4/3-l?i:l}},{}],46:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":118}],47:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=r},{"../../lib":118,"../../plotly":140,"../../plots/cartesian/constants":150,"./align":45,"./cursor":46,"./unhover":48}],48:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":114}],49:[function(t,e,n){"use strict";function r(t,e,n,r,a,o,i){if(l.traceIs(n,"symbols")){var c=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(n)?c(t.ms):(o.size||6)/2,t.mrc=e;var r=g.symbolNumber(t.mx||o.symbol)||0,a=r%100;return t.om=r%200>=100,g.symbolFuncs[a](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=r(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,n,r){var a=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(s.fill,r)},g.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},g.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},g.setRect=function(t,e,n,r,a){t.call(g.setPosition,e,n).call(g.setSize,r,a)},g.translatePoint=function(t,e,n,r){var a=t.xp||n.c2p(t.x),o=t.yp||r.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,n,r){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,n,r)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,n){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},g.singleLineStyle=function(t,e,n,r,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=n||o.width||0,l=a||o.dash||"";s.stroke(e,r||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=r||a.dash||"";o.select(this).call(s.stroke,n||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=o.select(this);try{n.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),n.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,n){var a=n.marker,o=a.line,i=g.tryColorscale(a,""),l=g.tryColorscale(a,"line");r(t,e,n,i,l,a,o)},g.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=g.tryColorscale(n,""),a=g.tryColorscale(n,"line");t.each(function(t){g.singlePointStyle(t,o.select(this),e,r,a)})}},g.tryColorscale=function(t,e){var n=e?u.nestedProperty(t,e).get():t,r=n.colorscale,a=n.color;return r&&Array.isArray(a)?c.makeColorScaleFunc(c.extractScale(r,n.cmin,n.cmax)):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var n=o.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,n.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(f.convertToTspans);var d=o.select(this.parentNode),h=n.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,m=x[s]*u,v=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+m+","+v+")"),p>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],o=[];for(n=1;n=A&&(o.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=o.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":108,"../../lib":118,"../../lib/svg_text_utils":130,"../../registry":176,"../../traces/scatter/make_bubble_size_func":255,"../../traces/scatter/subtypes":260,"../color":26,"../colorscale":40,"./symbol_defs":50,d3:10,"fast-isnumeric":13}],50:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:10}],51:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],52:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&["linear","log"].indexOf(n.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var m=g.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(n.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=r(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");l=!m.size(),l?m=e.append("path").classed("yerror",!0):u&&(m=m.transition().duration(n.duration).ease(n.easing)),m.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var v=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-v)+"v"+2*v+"m0,-"+v+"H"+i.xs,i.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":260,d3:10,"fast-isnumeric":13}],57:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":26,d3:10}],58:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":150}],59:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,l,n,r)}var i=r("source"),s=r("visible",!!i);if(!s)return e;r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var c={_fullLayout:n},u=["x","y"],f=0;f<2;f++)o.coerceRef(t,e,c,u[f],"paper");return e}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("../../plots/array_container_defaults"),l=t("./attributes"),s="images";e.exports=function(t,e){var n={name:s,handleItemDefaults:r};i(t,e,n)}},{"../../lib":118,"../../plots/array_container_defaults":142,"../../plots/cartesian/axes":145,"./attributes":58}],60:[function(t,e,n){"use strict";var r=t("d3"),a=t("../drawing"),o=t("../../plots/cartesian/axes"),i=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var n=r.select(this);if(!this.img||this.img.src!==e.source){n.attr("xmlns",i.svg);var a=new Promise(function(t){function r(){n.remove(),t()}var a=new Image;this.img=a,a.setAttribute("crossOrigin","anonymous"),a.onerror=r,a.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var r=t.toDataURL("image/png");n.attr("xlink:href",r)},n.on("error",r),n.on("load",t),a.src=e.source}.bind(this));t._promises.push(a)}}function n(e){var n=r.select(this),i=o.getFromId(t,e.xref),s=o.getFromId(t,e.yref),c=l._size,u=i?Math.abs(i.l2p(e.sizex)-i.l2p(0)):e.sizex*c.w,f=s?Math.abs(s.l2p(e.sizey)-s.l2p(0)):e.sizey*c.h,d=u*h.x[e.xanchor].offset,p=f*h.y[e.yanchor].offset,g=h.x[e.xanchor].sizing+h.y[e.yanchor].sizing,m=(i?i.r2p(e.x)+i._offset:e.x*c.w+c.l)+d,v=(s?s.r2p(e.y)+s._offset:c.h-e.y*c.h+c.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}n.attr({x:m,y:v,width:u,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=i?i._id:"",x=s?s._id:"",b=y+x;b&&n.call(a.setClipUrl,"clip"+l._uid+b)}for(var l=t._fullLayout,s=[],c=[],u=[],f=0;f=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],63:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2, -max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":115,"../../plots/font_attributes":165,"../color/attributes":25}],64:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],65:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":118,"../../plots/layout_attributes":167,"../../registry":176,"./attributes":63,"./helpers":68}],66:[function(t,e,n){"use strict";function r(t,e){function n(n){v.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,v=Math.max(e.height,v)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,j,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,_=n.showlegend&&x(t.calcdata,v),k=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=n._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=M.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var z=L.selectAll("g.groups").data(_);z.enter().append("g").attr("class","groups"),z.exit().remove();var S=z.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,z,S),l(t));var P=0,D=n.width,N=0,E=n.height;i(t,z,S),v.height>E?s(t):l(t);var I=n._size,R=I.l+I.w*v.x,F=I.t+I.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?F-=v.height:w.isMiddleAnchor(v)&&(F-=v.height/2);var j=v.width,q=I.w;j>q?(R=I.l,j=q):(R+j>D&&(R=D-j),RH?(F=I.t,B=H):(F+B>E&&(F=E-B),Fn[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":118,"../../registry":176,"../../traces/pie/style_one":238,"../../traces/scatter/subtypes":260,"../color":26,"../drawing":49,d3:10}],71:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||v||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(m,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":118,"../color":26,"./attributes":75,"./button_attributes":76,"./constants":77}],79:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,z)},a=z.line.width?z.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",z.opacity).call(_.stroke,a).call(_.fill,z.fillcolor).call(w.dashLine,z.line.dash,z.line.width);S&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+S),t._context.editable&&f(t,o,z,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof n&&n?s[n]=r:x.isPlainObject(n)&&(s=n);var c=Object.keys(s);for(o=0;oU&&r>G&&!t.shiftKey?k.getCursor(a/n,1-o/r):"move";M(e,i),Z=i.split("-")[0]}function o(e){j=b.getFromId(t,n.xref),q=b.getFromId(t,n.yref),B=T.getDataToPixel(t,j),H=T.getDataToPixel(t,q,!0),V=T.getPixelToData(t,j),X=T.getPixelToData(t,q,!0);var o="shapes["+r+"]";"path"===n.type?(R=n.path,F=o+".path"):(u=B(n.x0),f=H(n.y0),d=B(n.x1),h=H(n.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uG&&(c[z]=n[D]=X(l),c[S]=n[N]=X(s)),f-u>U&&(c[O]=n[E]=V(u),c[P]=n[I]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,v,x,_,w,A,L,C,z,S,O,P,D,N,E,I,R,F,j,q,B,H,V,X,Z,U=10,G=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();k.init(Y)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults");e.exports={draw:r,drawOne:a}},{"../../lib":118,"../../lib/setcursor":128,"../../plotly":140,"../../plots/cartesian/axes":145,"../color":26,"../dragelement":47,"../drawing":49,"./constants":89,"./defaults":90,"./helpers":92,"./shape_defaults":94,"fast-isnumeric":13}],92:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],93:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":87,"./calc_autorange":88,"./defaults":90,"./draw":91}],94:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],m={_fullLayout:n},v=a.coerceRef(t,e,m,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==v?(y=a.getFromId(m,v),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=r.identity;var k=g+"0",M=g+"1",A=t[k],T=t[M];t[k]=x(t[k],!0),t[M]=x(t[M],!0),a.coercePosition(e,m,c,v,k,_),a.coercePosition(e,m,c,v,M,w),e[k]=b(e[k]),e[M]=b(e[M]),t[k]=A,t[M]=T}}return"path"===d?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":118,"../../plots/cartesian/axes":145,"./attributes":87,"./helpers":92}],95:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":115,"../../plots/animation_attributes":141,"../../plots/font_attributes":165,"../../plots/pad_attributes":168,"./constants":96}],96:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],97:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*z.gripWidth)+","+e.currentValueTotalHeight+")"); -}}function v(t,e){return t.inputAreaStart+z.stepInset+(t.inputAreaLength-2*z.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-z.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*z.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+z.railTouchRectClass).data([0]);r.enter().append("rect").classed(z.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,z.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),M.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+z.railRectClass).data([0]);n.enter().append("rect").classed(z.railRectClass,!0);var r=e.inputAreaLength-2*z.railInset;n.attr({width:r,height:z.railWidth,rx:z.railRadius,ry:z.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(n,z.railInset,.5*(e.inputAreaWidth-z.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(z.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+z.groupClassName).data(n,a);s.enter().append("g").classed(z.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,z.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,z=O,k._infolayer.select("."+e).attr({"data-unformatted":z}).text(z).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,z=g.title.trim();""===z&&(L=0),z.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var S=w.selectAll("text").data([0]);S.enter().append("text"),S.text(z).attr("class",e),S.attr({"data-unformatted":z}).call(f);var O="Click to enter "+y+" title";t._context.editable?(z||p(),S.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):z&&!z.match(/Click to enter .+ title/)||S.remove(),S.classed("js-placeholder",C)}},{"../../lib":118,"../../lib/svg_text_utils":130,"../../plotly":140,"../../plots/plots":169,"../color":26,"../drawing":49,d3:10,"fast-isnumeric":13}],101:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":115,"../../plots/font_attributes":165,"../../plots/pad_attributes":168,"../color/attributes":25}],102:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],103:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],108:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],109:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":24,"./components/images":61,"./components/legend":69,"./components/rangeselector":81,"./components/rangeslider":86,"./components/shapes":93,"./components/sliders":99,"./components/updatemenus":105,"./fonts/mathjax_config":110,"./lib/queue":126,"./plot_api/plot_schema":134,"./plot_api/register":135,"./plot_api/set_plot_config":136,"./plot_api/to_image":138,"./plot_api/validate":139,"./plotly":140,"./snapshot":181,"./snapshot/download":178,"./traces/scatter":250,d3:10,"es6-promise":11}],110:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],111:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":106,"fast-isnumeric":13}],112:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(o(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,r,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var m=(new Date).getFullYear();e=((Number(c[0])-m+70)%100+200)%100+m-70}if(!o(e))return s;var v=new Date(0,0,1);if(v.setFullYear(u?e:-e),c.length>1){if(r=Number(c[1])-1,c[1].length>2||!(r>=0&&r<=11))return s;if(v.setMonth(r),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(v.setDate(a),v.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(v.setHours(i),v.getHours()!==i)return s;if(c.length>1)return a=v.getTime(),r=Number(c[1]),2===c[1].length&&r>=0&&r<=59?(a+=f*r,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return v.getTime()},h=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==s};var g=90*c,m=3*u,v=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var n=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(n),i=en?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"./clean_number":111,"./coerce":112,"./dates":113,"./extend":115,"./filter_unique":116,"./filter_visible":117,"./is_array":119,"./is_plain_object":120,"./loggers":121,"./matrix":122,"./nested_property":123,"./notifier":124,"./search":127,"./stats":129,d3:10}],119:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],120:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],121:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],i=!1,d(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");lo||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],s=t[1];if(no||sl)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],m=r[0][1],v=0;for(c=1;cMath.max(u,g)||s>Math.max(f,m)))if(su||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":122}],126:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;f90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":13}],130:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,m.indexOf(u.protocol)===-1?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||r(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":107,"../constants/xmlns_namespaces":108,"../lib":118,d3:10}],131:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function a(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var a=f.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=u.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&l(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&s1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":118,"../../plots/layout_attributes":167,"../../registry":176,"./attributes":63,"./helpers":68}],66:[function(t,e,n){"use strict";function r(t,e){function n(n){v.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,v=Math.max(e.height,v)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,j,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,_=n.showlegend&&x(t.calcdata,v),k=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var M=n._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=M.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=M.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var z=L.selectAll("g.groups").data(_);z.enter().append("g").attr("class","groups"),z.exit().remove();var S=z.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==M.enter().size();O&&(i(t,z,S),l(t));var P=0,D=n.width,N=0,E=n.height;i(t,z,S),v.height>E?s(t):l(t);var I=n._size,R=I.l+I.w*v.x,F=I.t+I.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?F-=v.height:w.isMiddleAnchor(v)&&(F-=v.height/2);var j=v.width,q=I.w;j>q?(R=I.l,j=q):(R+j>D&&(R=D-j),RH?(F=I.t,B=H):(F+B>E&&(F=E-B),Fn[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":118,"../../registry":176,"../../traces/pie/style_one":238,"../../traces/scatter/subtypes":260,"../color":26,"../drawing":49,d3:10}],71:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||v||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(m,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":118,"../color":26,"./attributes":75,"./button_attributes":76,"./constants":77}],79:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,z)},a=z.line.width?z.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",z.opacity).call(_.stroke,a).call(_.fill,z.fillcolor).call(w.dashLine,z.line.dash,z.line.width);S&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+S),t._context.editable&&f(t,o,z,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof n&&n?s[n]=r:x.isPlainObject(n)&&(s=n);var c=Object.keys(s);for(o=0;oU&&r>G&&!t.shiftKey?k.getCursor(a/n,1-o/r):"move";M(e,i),Z=i.split("-")[0]}function o(e){j=b.getFromId(t,n.xref),q=b.getFromId(t,n.yref),B=T.getDataToPixel(t,j),H=T.getDataToPixel(t,q,!0),V=T.getPixelToData(t,j),X=T.getPixelToData(t,q,!0);var o="shapes["+r+"]";"path"===n.type?(R=n.path,F=o+".path"):(u=B(n.x0),f=H(n.y0),d=B(n.x1),h=H(n.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uG&&(c[z]=n[D]=X(l),c[S]=n[N]=X(s)),f-u>U&&(c[O]=n[E]=V(u),c[P]=n[I]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,v,x,_,w,A,L,C,z,S,O,P,D,N,E,I,R,F,j,q,B,H,V,X,Z,U=10,G=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();k.init(Y)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),k=t("../dragelement"),M=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults");e.exports={draw:r,drawOne:a}},{"../../lib":118,"../../lib/setcursor":128,"../../plotly":140,"../../plots/cartesian/axes":145,"../color":26,"../dragelement":47,"../drawing":49,"./constants":89,"./defaults":90,"./helpers":92,"./shape_defaults":94,"fast-isnumeric":13}],92:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],93:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":87,"./calc_autorange":88,"./defaults":90,"./draw":91}],94:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],m={_fullLayout:n},v=a.coerceRef(t,e,m,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==v?(y=a.getFromId(m,v),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=r.identity;var k=g+"0",M=g+"1",A=t[k],T=t[M];t[k]=x(t[k],!0),t[M]=x(t[M],!0),a.coercePosition(e,m,c,v,k,_),a.coercePosition(e,m,c,v,M,w),e[k]=b(e[k]),e[M]=b(e[M]),t[k]=A,t[M]=T}}return"path"===d?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":118,"../../plots/cartesian/axes":145,"./attributes":87,"./helpers":92}],95:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":115,"../../plots/animation_attributes":141,"../../plots/font_attributes":165,"../../plots/pad_attributes":168,"./constants":96}],96:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],97:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)), +i.attr("transform","translate("+(o-.5*z.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+z.stepInset+(t.inputAreaLength-2*z.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-z.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*z.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+z.railTouchRectClass).data([0]);r.enter().append("rect").classed(z.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,z.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),M.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+z.railRectClass).data([0]);n.enter().append("rect").classed(z.railRectClass,!0);var r=e.inputAreaLength-2*z.railInset;n.attr({width:r,height:z.railWidth,rx:z.railRadius,ry:z.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(n,z.railInset,.5*(e.inputAreaWidth-z.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(z.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+z.groupClassName).data(n,a);s.enter().append("g").classed(z.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,k.autoMargin(t,z.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,z=O,k._infolayer.select("."+e).attr({"data-unformatted":z}).text(z).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,z=g.title.trim();""===z&&(L=0),z.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var S=w.selectAll("text").data([0]);S.enter().append("text"),S.text(z).attr("class",e),S.attr({"data-unformatted":z}).call(f);var O="Click to enter "+y+" title";t._context.editable?(z||p(),S.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):z&&!z.match(/Click to enter .+ title/)||S.remove(),S.classed("js-placeholder",C)}},{"../../lib":118,"../../lib/svg_text_utils":130,"../../plotly":140,"../../plots/plots":169,"../color":26,"../drawing":49,d3:10,"fast-isnumeric":13}],101:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":115,"../../plots/font_attributes":165,"../../plots/pad_attributes":168,"../color/attributes":25}],102:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],103:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],108:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],109:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":24,"./components/images":61,"./components/legend":69,"./components/rangeselector":81,"./components/rangeslider":86,"./components/shapes":93,"./components/sliders":99,"./components/updatemenus":105,"./fonts/mathjax_config":110,"./lib/queue":126,"./plot_api/plot_schema":134,"./plot_api/register":135,"./plot_api/set_plot_config":136,"./plot_api/to_image":138,"./plot_api/validate":139,"./plotly":140,"./snapshot":181,"./snapshot/download":178,"./traces/scatter":250,d3:10,"es6-promise":11}],110:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],111:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":106,"fast-isnumeric":13}],112:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(o(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,r,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var m=(new Date).getFullYear();e=((Number(c[0])-m+70)%100+200)%100+m-70}if(!o(e))return s;var v=new Date(0,0,1);if(v.setFullYear(u?e:-e),c.length>1){if(r=Number(c[1])-1,c[1].length>2||!(r>=0&&r<=11))return s;if(v.setMonth(r),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(v.setDate(a),v.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(v.setHours(i),v.getHours()!==i)return s;if(c.length>1)return a=v.getTime(),r=Number(c[1]),2===c[1].length&&r>=0&&r<=59?(a+=f*r,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return v.getTime()},h=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==s};var g=90*c,m=3*u,v=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var n=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(n),i=en?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"./clean_number":111,"./coerce":112,"./dates":113,"./extend":115,"./filter_unique":116,"./filter_visible":117,"./is_array":119,"./is_plain_object":120,"./loggers":121,"./matrix":122,"./nested_property":123,"./notifier":124,"./search":127,"./stats":129,d3:10}],119:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],120:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],121:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],i=!1,d(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");lo||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],s=t[1];if(no||sl)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],m=r[0][1],v=0;for(c=1;cMath.max(u,g)||s>Math.max(f,m)))if(su||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":122}],126:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;f90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":13}],130:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,m.indexOf(u.protocol)===-1?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||r(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":107,"../constants/xmlns_namespaces":108,"../lib":118,d3:10}],131:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function a(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var a=f.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=u.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&l(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sO.range[0]?[1,2]:[2,1]);else{var P=O.range[0],D=O.range[1];"log"===b?(P<=0&&D<=0&&n(L+".autorange",!0),P<=0?P=D/1e6:D<=0&&(D=P/1e6),n(L+".range[0]",Math.log(P)/Math.LN10),n(L+".range[1]",Math.log(D)/Math.LN10)):(n(L+".range[0]",Math.pow(10,P)),n(L+".range[1]",Math.pow(10,D)))}else n(L+".autorange",!0)}if("reverse"===A)C.range?C.range.reverse():(n(L+".autorange",!0),C.range=[1,0]),z.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var N=v.parts[1],E=v.parts[0],I=o[E]||[],R=I[N]||{};2===v.parts.length&&(null===b&&(e[m]="remove"),"add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?N===-1?(g[E]=I,delete g[m]):g[m]=R:x.log("???",e)),!r(R,"x")&&!r(R,"y")||x.containsAny(m,["color","opacity","align","dash"])||(h.docalc=!0);var F=w.getComponentMethod(E,"drawOne");F(t,N,v.parts.slice(2).join("."),e[m]),delete e[m]}else if(k.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])S.manageArrayContainers(v,b,g),h.doplot=!0;else{var j=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?h.doplot=!0:0===v.parts[0].indexOf("geo")?h.doplot=!0:0===v.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===m?h.doplot=!0:!i._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?h.docalc=!0:v.parts[0].indexOf("legend")!==-1?h.dolegend=!0:m.indexOf("title")!==-1?h.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(j,["tick","exponent","grid","zeroline"])?h.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:v.parts.length>1&&j.indexOf("line")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&"mirror"===j?h.doticks=h.dolayoutstyle=!0:"margin.pad"===m?h.doticks=h.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(h.doplot=!0):h.doplot=!0,v.set(b)}}}var q=t._fullLayout.width,B=t._fullLayout.height;k.supplyDefaults(t),t.layout.autosize&&k.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==q||t._fullLayout.height!==B;return H&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];m.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(C.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var o=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=o.append("g").classed("imagelayer",!0),n._shapeUpperLayer=o.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),k=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),C=t("../constants/xmlns_namespaces"),z=t("../lib/svg_text_utils"),S=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,n,r){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=P._basePlotModules,n=0;n=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=S.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),n=k.supplyAnimationDefaults(n);var l=n.transition,s=n.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){if(0!==i._frameQueue.length){for(;i._frameQueue.length;){var e=i._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var l=0;li._timeToNext&&h()};e()}function g(t){return Array.isArray(l)?y>=l.length?t.transitionOpts=l[y]:t.transitionOpts=l[0]:t.transitionOpts=l,y++,t}var m,v,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&x.isPlainObject(e);if(M)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&LL)&&C.push(v);b=C}}b.length>0?f(b):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,n){if(t=S.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,a,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(r=e.length-1;r>=0;r--)u.push({frame:k.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:c+r});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(a=u[r].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=k.modifyFrames,s=k.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),k.modifyFrames(t,o)},y.purge=function(t){t=S.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return k.cleanPlot([],{},n,e),k.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":49,"../components/errorbars":55,"../constants/xmlns_namespaces":108,"../lib":118,"../lib/events":114,"../lib/queue":126,"../lib/svg_text_utils":130,"../plotly":140,"../plots/cartesian/graph_interact":152,"../plots/plots":169,"../plots/polar":172,"../registry":176,"./helpers":131,"./subroutines":137,d3:10,"fast-isnumeric":13}],133:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],134:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:y},n={}):(e=d.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,_(r,p),_(r,e.attributes),n.attributes&&_(r,n.attributes),r.type=t;var a={meta:e.meta||{},attributes:i(r)};if(e.layoutAttributes){var o={};_(o,e.layoutAttributes),a.layoutAttributes=i(o)}return a}function a(){var t={};return _(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var n=d.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)u(t,n,"xaxis"),u(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;u(t,n,r)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.layoutAttributes&&(Array.isArray(n.layoutNodes)?n.layoutNodes.forEach(function(e){f(t,n,e+n.name)}):f(t,n,n.name))}),{layoutAttributes:i(t)}}function o(t){var e=d.transformsRegistry[t];return{attributes:i(e.attributes)}}function i(t){return l(t),s(t),t}function l(t){function e(t){return{valType:"string"}}function r(t,r,a){n.isValObject(t)?"data_array"===t.valType?(t.role="data",a[r+"src"]=e(r)):t.arrayOk===!0&&(a[r+"src"]=e(r)):h.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function s(t){function e(t,e,n){if(t){var r=t[k];r&&(delete t[k],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function c(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function u(t,e,n){var r=h.nestedProperty(t,n),a=_({},e.layoutAttributes);a[w]=!0,r.set(a)}function f(t,e,n){var r=h.nestedProperty(t,n),a=_(r.get()||{},e.layoutAttributes);r.set(a)}var d=t("../registry"),h=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=h.extendFlat,_=h.extendDeep,w="_isSubplotObj",k="_isLinkedToArray",M="_deprecated",A=[w,k,M];n.IS_SUBPLOT_OBJ=w,n.IS_LINKED_TO_ARRAY=k,n.DEPRECATED=M,n.UNDERSCORE_ATTRS=A,n.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:h.valObjects,metaKeys:A.concat.role},traces:t,layout:a(),transforms:e,frames:i(m),animation:i(v)}},n.crawl=function(t,e,r){var a=r||0;Object.keys(t).forEach(function(r){var o=t[r];A.indexOf(r)===-1&&(e(o,r,t,a),n.isValObject(o)||h.isPlainObject(o)&&n.crawl(o,e,a+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,i,l){o=o.slice(0,l).concat([n]);var s="data_array"===e.valType||e.arrayOk===!0;if(s){var c=r(o),u=h.nestedProperty(t,c).get();Array.isArray(u)&&a.push(c)}}function r(t){return t.join(".")}var a=[],o=[];if(n.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":118,"../plotly":140,"../snapshot/cloneplot":177,"../snapshot/helpers":180,"../snapshot/svgtoimg":182,"../snapshot/tosvg":184,"fast-isnumeric":13}],139:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=n.length,v=0;vu&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=S&&a<=10||e>=15*S)t._tickround="d";else if(e>=P&&a<=16||e>=O)t._tickround="M";else if(e>=D&&a<=19||e>=P)t._tickround="S";else{var o=_.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var n=t.match(Y),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);n&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(r&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(n||(a="
"+H(u)),o=X(u)):(n||(a="
"+Z(u)),o=U(u),"M"!==s?(o+=G(u),"S"!==s&&(o+=d(y.round(v(l/1e3,1),4),t,"none",n).substr(1))):"d"===c&&(o=X(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=t<0,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var g=r-1,m=r+1;n="tozero"===t.rangemode?r<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n.map(t.l2r||Number)},N.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=N.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},N.saveRangeInitial=function(t,e){for(var n=N.list(t,"",!0),r=!1,a=0;a=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},N.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[o,i],r2l:Number}:{type:e.type,range:[o,i].map(e.l2r),r2l:e.r2l},N.autoTicks(f,l);var d,h=N.tickIncrement(N.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||a(o)||a(i))){var w=f.dtick/2;h+=h+w0&&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),o(t),t._tmin=N.tickFirst(t);var i=e[1]=s:c<=s)&&(l.push(c),!(l.length>1e3));c=N.tickIncrement(c,t.dtick,i));t._tmax=l[l.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var u=new Array(l.length),f=0;fC?(e/=C,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,I)):r>z?(e/=z,t.dtick="M"+a(e,1,R)):r>S?(t.dtick=a(e,S,j),t.tick0="2000-01-02"):r>O?t.dtick=a(e,O,R):r>P?t.dtick=a(e,P,F):r>D?t.dtick=a(e,D,F):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I))}else if("log"===t.type){t.tick0=0;var o=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var i=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/i,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,I)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,I));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},N.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?B:q,s=t+.01*r,c=_.roundUp(v(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]o:f1&&e2*r}function o(t){for(var e,n=Math.max(1,(t.length-1)/1e3),r=0,a=0,o=0;o2*r}var i=t("fast-isnumeric"),l=t("../../lib"),s=t("../../constants/numerical").BADNUM;e.exports=function(t){return a(t)?"date":o(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":106,"../../lib":118,"fast-isnumeric":13}],147:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);n.indexOf("scene")!==-1&&(n=r);var l=i(e,n,r);if(l){if("histogram"===l.type&&r==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");if(o(l,r)){for(var s,u=a(l),f=[],d=0;d0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],150:[function(t,e,n){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],151:[function(t,e,n){"use strict";function r(t,e){var n,r=t.range[e],a=Math.abs(r-t.range[1-e]);return"date"===t.type?r:"log"===t.type?(n=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,l.format("."+n+"g")(Math.pow(10,r))):(n=Math.floor(Math.log(Math.abs(r))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,l.format("."+String(n)+"g")(r))}function a(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){l.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function i(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var l=t("d3"),s=t("tinycolor2"),c=t("../../plotly"),u=t("../../registry"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,n,l,_,w,k,M){function A(t,e){for(var n=0;n.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+mt+")").attr("d",ct+"Z"),ht=pt.append("path").attr("class","zoombox-corners").style({fill:h.background,stroke:h.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+mt+")").attr("d","M0,0Z"),C()}function C(){pt.selectAll(".select-outline").remove()}function z(e,n){if(t._transitioningWithDuration)return!1;var r=Math.max(0,Math.min(V,e+ot)),a=Math.max(0,Math.min(X,n+it)),o=Math.abs(r-ot),i=Math.abs(a-it),l=Math.floor(Math.min(i,o,U)/2);lt.l=Math.min(ot,r),lt.r=Math.max(ot,r),lt.t=Math.min(it,a),lt.b=Math.max(it,a),!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ht.transition().style("opacity",1).duration(200),ut=!0)}function S(t,e,n){var r,a,o;for(r=0;rzoom back out","long"),b=!1)))}function P(e,n){var a=1===(k+M).length;if(e)R();else if(2!==n||a){if(1===n&&a){var o=k?H[0]:B[0],i="s"===k||"w"===M?0:1,l=o._name+".range["+i+"]",s=r(o,i),u="left",f="middle";if(o.fixedrange)return;k?(f="n"===k?"top":"bottom","right"===o.side&&(u="right")):"e"===M&&(u="right"),nt.call(d.makeEditable,null,{immediate:!0,background:j.paper_bgcolor,text:String(s),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:u,verticalAlign:f}).on("edit",function(e){var n=o.d2r(e);void 0!==n&&c.relayout(t,l,n)})}}else I()}function D(e){function n(t,e,n){function r(e){return t.l2r(o+(e-o)*n)}if(!t.fixedrange){var a=t.range.map(t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(r)}}if(t._context.scrollZoom||j._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var r=t.querySelector(".plotly");if(T(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(yt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void f.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=vt[0]+vt[2]*s,u=(l.bottom-e.clientY)/l.height,d=vt[1]+vt[3]*(1-u);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function o(t,e,n){for(var r,o,i=1-e,l=0;l0;r--)n.push(e);return n}function a(t,e){for(var n=[],r=0;rY.width||G<0||G>Y.height)return _.unhoverRaw(t,e)}else U="xpx"in e?e.xpx:M[0]._length/2,G="ypx"in e?e.ypx:A[0]._length/2;if(O="xval"in e?r(o,e.xval):a(M,U),P="yval"in e?r(o,e.yval):a(A,G),!g(O[0])||!g(P[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var W=1/0;for(N=0;N1||I.hoverinfo.indexOf("name")!==-1?I.name:void 0,index:!1,distance:Math.min(W,k.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},i[R]&&(H.subplot=i[R]._subplot),V=X.length,"array"===j){var Q=e[N];"pointNumber"in Q?(H.index=Q.pointNumber,j="closest"):(j="","xval"in Q&&(q=Q.xval,j="x"),"yval"in Q&&(B=Q.yval,j=j?"closest":"y"))}else q=O[F],B=P[F];if(I._module&&I._module.hoverPoints){var $=I._module.hoverPoints(H,q,B,j);if($)for(var J,K=0;K<$.length;K++)J=$[K],g(J.x0)&&g(J.y0)&&X.push(s(J,S))}else m.log("Unrecognized trace type in hover:",I);"closest"===S&&X.length>V&&(X.splice(0,V),W=X[0].distance)}if(0===X.length)return _.unhoverRaw(t,e);var tt="y"===S&&Z.length>1;X.sort(function(t,e){return t.distance-e.distance});var et=x.combine(i.plot_bgcolor||x.background,i.paper_bgcolor),nt={hovermode:S,rotateLabels:tt,bgColor:et,container:i._hoverlayer,outerContainer:i._paperdiv},rt=c(X,nt);u(X,tt?"xa":"ya"),f(rt,tt);var at=t._hoverdata,ot=[];for(D=0;D128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var u=document.createElement("p");u.innerHTML=t.name,n=u.textContent||"",n.length>15&&(n=n.substr(0,12)+"...")}void 0!==t.extraText&&(r+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(r+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(r+="y: "+t.yLabel+"
"),r+=(r?"z: ":"")+t.zLabel):A&&t[a+"Label"]===g?r=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(r=t.yLabel):r=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(r+=(r?"
":"")+t.text),""===r&&(""===n&&e.remove(),r=n);var f=e.select("text.nums").style("fill",c).call(b.setPosition,0,0).text(r).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(b.setPosition,0,0);var d=e.select("text.name"),m=0;n&&n!==r?(d.style("fill",s).text(n).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),d.selectAll("tspan.line").call(b.setPosition,0,0),m=d.node().getBoundingClientRect().width+2*D):(d.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var v,k,T=f.node().getBoundingClientRect(),C=t.xa._offset+(t.x0+t.x1)/2,z=t.ya._offset+(t.y0+t.y1)/2,S=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),N=T.width+P+D+m;t.ty0=_-T.top,t.bx=T.width+2*D,t.by=T.height+2*D,t.anchor="start",t.txwidth=T.width,t.tx2width=m,t.offset=0,o?(t.pos=C,v=z+O/2+N<=M,k=z-O/2-N>=0,"top"!==t.idealAlign&&v||!k?v?(z+=O/2,t.anchor="start"):t.anchor="middle":(z-=O/2,t.anchor="end")):(t.pos=z,v=C+S/2+N<=w,k=C-S/2-N>=0,"left"!==t.idealAlign&&v||!k?v?(C+=S/2,t.anchor="start"):t.anchor="middle":(C-=S/2,t.anchor="end")),f.attr("text-anchor",t.anchor),m&&d.attr("text-anchor",t.anchor),e.attr("transform","translate("+C+","+z+")"+(o?"rotate("+L+")":""))}),z}function u(t,e){function n(t){var e=t[0],n=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=n.pos+n.dp+n.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;r=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;r=!1}if(r){var c=0;for(i=0;ie.pmax&&c++;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos>e.pmax-1&&(s.del=!0,c--);for(i=0;i=0;l--)t[l].dp-=o;for(i=t.length-1;i>=0&&!(c<=0);i--)s=t[i],s.pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}for(var r,a,o,i,l,s,c,u=0,f=t.map(function(t,n){var r=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===r._id.charAt(0)?z:1)/2,pmin:r._offset,pmax:r._offset+r._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!r&&u<=t.length;){for(u++,r=!0,i=0;i.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(l=h.length-1;l>=0;l--)h[l].dp+=a;for(d.push.apply(d,h),f.splice(i+1,1),c=0,l=d.length-1;l>=0;l--)c+=d[l].dp;for(o=c/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;r=!1}else i++}f.forEach(n)}for(i=f.length-1;i>=0;i--){var m=f[i];for(l=m.length-1;l>=0;l--){var v=m[l],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function f(t,e){t.each(function(t){var n=h.select(this);if(t.del)return void n.remove();var r="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],i=o*(P+D),l=i+o*(t.txwidth+D),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-O,s=t.offset*S),n.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(r*P+s)+","+(P+c)+"v"+(t.by/2-P)+"h"+r*t.bx+"v-"+t.by+"H"+(r*P+s)+"V"+(c-P)+"Z"),a.call(b.setPosition,i+s,c+t.ty0-t.by/2+D).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(b.setPosition,l+o*D+s,c+t.ty0-t.by/2+D),n.select("rect").call(b.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function d(t,e,n){if(!e.target)return!1;if(!n||n.length!==t._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],o=t._hoverdata[r];if(a.curveNumber!==o.curveNumber||String(a.pointNumber)!==String(o.pointNumber))return!0}return!1}var h=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),k=t("./constants"),M=t("./dragbox"),A=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,n){function r(n,r){return m.coerce(t,e,A,n,r)}r("dragmode");var a;if(e._has("cartesian")){var o=e._isHoriz=T.isHoriz(n);a=o?"y":"x"}else a="closest";r("hovermode",a)},T.isHoriz=function(t){for(var e=!0,n=0;nt._lastHoverTime+k.HOVERMINTIME?(i(t,e,n),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){i(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME))},T.getDistanceFunction=function(t,e,n,r){return"closest"===t?r||o(e,n):"x"===t?e:n},T.getClosest=function(t,e,n){ if(n.index!==!1)n.index>=0&&n.indexf[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":118,"fast-isnumeric":13}],158:[function(t,e,n){"use strict";function r(t){return t._id}var a=t("../../lib/polygon"),o=t("../../components/color"),i=t("./axes"),l=t("./constants"),s=a.filter,c=a.tester,u=l.MINSELECT;e.exports=function(t,e,n,a,f){function d(t){var e="y"===t._id.charAt(0)?1:0;return function(n){return t.p2d(n[e])}}function h(t,e){return t-e}var p,g=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-m.left,b=n-m.top,_=x,w=b,k="M"+x+","+b,M=a.xaxes[0]._length,A=a.yaxes[0]._length,T=a.xaxes.map(r),L=a.yaxes.map(r),C=a.xaxes.concat(a.yaxes);"lasso"===f&&(p=s([[x,b]],l.BENDPX));var z=g.selectAll("path.select-outline").data([1,2]);z.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",k+"Z");var S,O,P,D,N,E=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),I=[],R=a.gd,F=[];for(S=0;S0)return Math.log(e)/Math.LN10;if(e<=0&&n&&t.range&&2===t.range.length){var r=t.range[0],a=t.range[1];return.5*(r+a-3*f*Math.abs(r-a))}return s}function n(t){return Math.pow(10,t)}function i(t){return a(t)?(t=Number(t),t<-l||t>l?s:a(t)?Number(t):s):s}var f=10;t.c2l="log"===t.type?e:i,t.l2c="log"===t.type?n:i,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var n,r,i=t[e],s=(t._id||"x").charAt(0);if(r="date"===t.type?c.DFLTRANGEDATE:"y"===s?c.DFLTRANGEY:c.DFLTRANGEX,r=r.slice(),!i||2!==i.length)return void(t[e]=r);for("date"===t.type&&(i[0]=o.cleanDate(i[0]),i[1]=o.cleanDate(i[1])),n=0;n<2;n++)if("date"===t.type){if(!o.isDateTime(i[n])){t[e]=r;break}if(i[n]o.MAX_MS&&(i[n]=o.MAX_MS),t.r2l(i[0])===t.r2l(i[1])){var u=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(u-1e3),i[1]=t.l2r(u+1e3);break}}else{if(!a(i[n])){if(!a(i[1-n])){t[e]=r;break}i[n]=i[1-n]*(n?10:.1)}if(i[n]<-l?i[n]=-l:i[n]>l&&(i[n]=l),i[0]===i[1]){var f=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=f,i[1]+=f}}},t.fraction2r=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return t.l2r(n+e*(r-n))},t.r2fraction=function(e){var n=t.r2l(t.range[0]),r=t.r2l(t.range[1]);return(t.r2l(e)-n)/(r-n)},t.setScale=function(e){var n=t._gd._fullLayout._size,r=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var a=u.getFromId(t._gd,t.overlaying);t.domain=a.domain}var i=e&&t._r?"_r":"range";t.cleanRange(i);var l=t.r2l(t[i][0]),s=t.r2l(t[i][1]);if("y"===r?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return a(e)?r.round(t._b+t._m*e,2):s},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,n){return t.l2p(t.c2l(e,n))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,n){return t.l2p(t.r2l(e,n))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=i,t.d2c=o.cleanNumber,"log"===t.type?(t.d2l=function(e,n){return t.c2l(t.d2c(e),n)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=o.cleanNumber,t.d2r=o.cleanNumber,t.r2d=i),t.r2l=i,t.l2r=i):"date"===t.type?(t.c2d=o.ms2DateTime,t.d2c=function(t){var e=o.dateTime2ms(t);if(e===s){if(!a(t))return s;e=Number(t)}return o.constrain(e,o.MIN_MS,o.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=o.identity,t.r2d=o.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var n=t._categories.indexOf(e);return n===-1?s:n},t.d2l=t.d2c,t.r2l=i,t.l2r=i,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,n){var r,a,o;if(n in e)for(r=e[n],a=new Array(r.length),o=0;o0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var f=u.charAt(0),d=u.substr(1);d=r(d)?Number(d):0,(d<=0||!("date"===i&&"M"===f&&d===Math.round(d)||"log"===i&&"L"===f||"log"===i&&"D"===f&&(1===d||2===d)))&&(e.dtick=c)}var h="date"===i?"2000-01-01":0,p=n("tick0",h);"date"===i?e.tick0=a.cleanDate(p,h):r(p)&&"D1"!==u&&"D2"!==u?e.tick0=Number(p):e.tick0=h}else{var g=n("tickvals");void 0===g?e.tickmode="auto":n("ticktext")}}},{"../../constants/numerical":106,"../../lib":118,"fast-isnumeric":13}],163:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../lib"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,n,c){function u(t){var e,n,r,a,o,i={};for(e in t)if(n=e.split("."),r=n[0].match(s)){var l=r[1],c=l+"axis";if(a=y[c],o={},Array.isArray(t[e])?o.to=t[e].slice(0):Array.isArray(t[e].range)&&(o.to=t[e].range.slice(0)),!o.to)continue;o.axisName=c,o.length=a._length,x.push(l),i[l]=o}return i}function f(t,e,n){var r,a,o,i=t._plots,l=[];for(r in i){var s=i[r];if(l.indexOf(s)===-1){var c=s.xaxis._id,u=s.yaxis._id,f=s.xaxis.range,d=s.yaxis.range;s.xaxis._r=s.xaxis.range.slice(),s.yaxis._r=s.yaxis.range.slice(),a=n[c]?n[c].to:f,o=n[u]?n[u].to:d,f[0]===a[0]&&f[1]===a[1]&&d[0]===o[0]&&d[1]===o[1]||e.indexOf(c)===-1&&e.indexOf(u)===-1||l.push(s)}}return l}function d(e,n){function r(e,n){for(a=0;an.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=u(e),_=Object.keys(b),w=f(y,_,b);if(!w.length)return!1;var k;c&&(k=c());var M,A,T,L=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),M=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":118,"../../plotly":140,"../../registry":176,"./axes":145,d3:10}],164:[function(t,e,n){"use strict";function r(t,e,n){var r,a,o,i=!1;if("data"===e.type)r=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;r=t._fullLayout}return a=c.nestedProperty(r,e.prop).get(),o=n[e.type]=n[e.type]||{},o.hasOwnProperty(e.prop)&&o[e.prop]!==a&&(i=!0),o[e.prop]=a,{changed:i,value:a}}function a(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function o(t,e){var n=[],r=e[0],a={};if("string"==typeof r)a[r]=e[1];else{if(!c.isPlainObject(r))return n;a=r}return l(a,function(t,e,r){n.push({type:"layout",prop:t,value:r})},"",0),n}function i(t,e){var n,r,a,o,i=[];if(r=e[0],a=e[1],n=e[2],o={},"string"==typeof r)o[r]=a;else{if(!c.isPlainObject(r))return i;o=r,void 0===n&&(n=a)}return void 0===n&&(n=null),l(o,function(e,r,a){var o;if(Array.isArray(a)){var l=Math.min(a.length,t.data.length);n&&(l=Math.min(l,n.length)),o=[];for(var s=0;s0?".":"")+a;c.isPlainObject(o)?l(o,e,i,r+1):e(i,a,o)}})}var s=t("../plotly"),c=t("../lib");n.manageCommandObserver=function(t,e,a,o){var i={},l=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var s=n.hasSimpleAPICommandBindings(t,a,i.lookupTable);if(e&&e._commandObserver){if(s)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(s){r(t,s,i.cache),i.check=function(){if(l){var e=r(t,s,i.cache);return e.changed&&o&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(o({value:e.value,type:s.type,prop:s.prop,traces:s.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),n.attr(o);var i=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,i),l.text(i.text()&&c.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),a=r.append("input").attr({type:"text",name:"data"});return a.node().value=p.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,n=t._fullLayout||{},r=t._fullLayout={},o=t.layout||{},i=t._fullData||[],l=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),n._initialAutoSizeIsDone){var c=n.width,f=n.height;p.supplyLayoutGlobalDefaults(o,r),o.width||(r.width=c),o.height||(r.height=f)}else{p.supplyLayoutGlobalDefaults(o,r);var d=!o.width||!o.height,h=r.autosize,g=t._context&&t._context.autosizable,m=d&&(h||g);m?p.plotAutoSize(t,o,r):d&&p.sanitizeMargins(t),!h&&d&&(o.width=r.width,o.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=s.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,l,o,r),r._has=p._hasPlotType.bind(r);var v=r._modules;for(e=0;e0){var u=l(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,g=1-2*i,m=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(g*(m.width-f)),a=Math.round(g*(m.height-h))}else{var v=s?window.getComputedStyle(t):{};r=parseFloat(v.width)||n.width,a=parseFloat(v.height)||n.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;r1,_=!e.height&&Math.abs(n.height-a)>1;(_||b)&&(b&&(n.width=r),_&&(n.height=a)),t._initialAutoSize||(t._initialAutoSize={width:r,height:a}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n,r){var a,o;u.Axes.supplyLayoutDefaults(t,e,n);var i=e._basePlotModules;for(a=0;a.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;if(e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var m=s[t].t.val,v=s[t].t.size;if(m>d){var y=(h*m+(v-e.height)*d)/(m-d),x=(v*(1-d)+(h-e.height)*(1-m))/(m-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!t._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):d.isJSDate(t)?d.ms2DateTime(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)},p.modifyFrames=function(t,e){var n,r,a,o=t._transitionData._frames,i=t._transitionData._frameHash;for(n=0;n0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){_=!0}),a.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,c=0,h=t._fullLayout._basePlotModules,p=!1;if(n)for(l=0;l=0,z=C?f.angularAxis.domain:r.extent(M),S=Math.abs(M[1]-M[0]);T&&!A&&(S=0);var O=z.slice();L&&A&&(O[1]+=S);var P=f.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),f.angularAxis.ticksStep&&(P=(O[1]-O[0])/P);var D=f.angularAxis.ticksStep||(O[1]-O[0])/(P*(f.minorTicks+1));k&&(D=Math.max(Math.round(D),1)),O[2]||(O[2]=D);var N=r.range.apply(this,O);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=r.scale.linear().domain(O.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?S:0,e=r.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var E="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(E,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=r.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,j=e.select(".chart-group"),q={fill:"none",stroke:f.tickColor},B={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=i.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});i.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:o({},i.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],a.range([0,x]),u.layout.radialAxis.domain=a.domain(),F.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),j.attr("transform","translate("+_+")").style({cursor:"crosshair"});var X=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(X[0]=Math.max(0,X[0]),X[1]=Math.max(0,X[1]),e.select(".outer-group").attr("transform","translate("+X+")"),f.title){var Z=e.select("g.title-group text").style(B).text(f.title),U=Z.node().getBBox();Z.attr({x:_[0]-U.width/2,y:_[1]-x-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Y=G.selectAll("circle.grid-circle").data(a.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(q),Y.attr("r",a),Y.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(q);var W=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=r.svg.axis().scale(a).ticks(5).tickSize(5);G.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(q),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(B).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),J=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(q),J.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(B);var K=$.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?n<270&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(n<=180&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(B);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=r.max(j.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=a,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=r.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return o(i[n].defaultConfig(),t)});i[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=i.tooltipPanel().config({container:ct,fontSize:8})(),ft=i.tooltipPanel().config({container:ct,fontSize:8})(),dt=i.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});j.on("mousemove.angular-guide",function(t,e){var n=i.util.getMousePos(W).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=i.util.convertToCartesian(x+12,n+180);ut.text(i.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});j.on("mousemove.radial-guide",function(t,e){var n=i.util.getMousePos(W).radius;pt.attr({r:n}).style({opacity:.5}),lt=a.invert(i.util.getMousePos(W).radius);var r=i.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(i.util.round(lt)).move([r[0]+_[0],r[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var a=r.select(this),o=a.style("fill"),l="black",s=a.style("opacity")||1;if(a.attr({"data-opacity":s}),"none"!=o){a.attr({"data-fill":o}),l=r.hsl(o).darker().toString(),a.style({fill:l,opacity:1});var c={t:i.util.round(t[0]),r:i.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-X[0]-d.left,f.top+f.height/2-X[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else o=a.style("stroke"),a.attr({"data-stroke":o}),l=r.hsl(o).darker().toString(),a.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==r.event.which&&void(r.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=r.select(this),a=n.attr("data-fill");a?n.style({fill:a,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,a,l,s={data:[],layout:{}},c={},u={},f=r.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=i.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),o(s.data[e],i.Axis.defaultConfig().data[0]),o(s.data[e],t)}),o(s.layout,i.Axis.defaultConfig().layout),o(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return a},d.angularScale=function(t){return l},d.svg=function(){return e},r.rebind(d,f,"on"),d},i.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:r.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},i.util={},i.DATAEXTENT="dataExtent",i.AREA="AreaChart",i.LINE="LinePlot",i.DOT="DotPlot",i.BAR="BarChart",i.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},i.util._extend=function(t,e){for(var n in t)e[n]=t[n]},i.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},i.util.dataFromEquation2=function(t,e){var n=e||6,a=r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return a},i.util.dataFromEquation=function(t,e,n){var a=e||6,o=[],i=[];r.range(0,360+a,a).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},i.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return r.range(e).map(function(t,e){return n[e]||n[0]})},i.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=i.util.ensureArray(t[e],n)}),t},i.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},i.util.validateKeys=function(t,e){ -"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},i.util.sumArrays=function(t,e){return r.zip(t,e).map(function(t,e){return r.sum(t)})},i.util.arrayLast=function(t){return t[t.length-1]},i.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return n===-2},i.util.flattenArray=function(t){for(var e=[];!i.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},i.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},i.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},i.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},i.util.getMousePos=function(t){var e=r.mouse(t.node()),n=e[0],a=e[1],o={};return o.x=n,o.y=a,o.pos=e,o.angle=180*(Math.atan2(a,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+a*a),o},i.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;a0)){var l=r.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(n,a,o)},"fill-opacity":0,stroke:function(t,e){return m.stroke(n,a,o)},"stroke-width":function(t,e){return m["stroke-width"](n,a,o)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](n,a,o)},opacity:function(t,e){return m.opacity(n,a,o)},display:function(t,e){return m.display(n,a,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=r.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,a){r.select(this).attr({class:"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var m={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},v=r.select(this).selectAll("g.layer").data(s);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(m).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,n=[i.PolyChart.defaultConfig()],a=r.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),o(n[e],i.PolyChart.defaultConfig()),o(n[e],t)}),this):n},t.getColorScale=function(){return e},r.rebind(t,a,"on"),t},i.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}};return t},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},i.Legend=function(){function t(){var n=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=o({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),i=r.merge(a);i=i.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(i=i.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=r.select(l));var s=i.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof i[0]:n.isContinuous,f=u?n.height:c*i.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=r.range(i.length),m=r.scale[u?"linear":"ordinal"]().domain(g).range(s),v=r.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":r.svg.symbolTypes.indexOf(t)!=-1?r.svg.symbol().type(t).size(n)():r.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(i);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,v(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=r.svg.axis().scale(v).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return i[e].name}),t}var e=i.Legend.defaultConfig(),n=r.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},r.rebind(t,n,"on"),t},i.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},i.tooltipPanel=function(){var t,e,n,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=10,c=function(){t=a.container.selectAll("g."+l).data([0]);var r=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=r.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=r.append("text").attr({dx:a.padding+s,dy:.3*+a.fontSize}),c};return c.text=function(o){var i=r.hsl(a.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var d=a.padding,h=e.node().getBBox(),p={fill:a.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,m=h.height+2*d;return n.attr({d:"M"+[[s,-m/2],[s,-m/4],[a.hasTick?0:s,0],[s,m/4],[s,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-m/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){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 o(a,t),c},c},i.tooltipPanel.uid=1,i.adapter={},i.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=o({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var r=a.indexOf(t.geometry);r!=-1&&(n.data[e].groupId=r)})}if(t.layout){var l=o({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};r.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../lib":118,d3:10}],174:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../lib"),o=t("../../components/color"),i=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){function e(e,a){return a&&(f=a),r.select(r.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?s(n,e):e,o||(o=i.Axis()),u=i.adapter.plotly().convert(n),o.config(u).render(f),t.data=n.data,t.layout=n.layout,c.fillLayout(t),n}var n,a,o,u,f,d=new l;return e.isPolar=!0,e.svg=function(){return o.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return i.adapter.plotly().convert(o.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:o.angularScale(),r:o.radialScale()}},e.setUndoPoint=function(){var t=this,e=i.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,a),a=i.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},c.fillLayout=function(t){var e=r.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:o.background,_container:e,_paperdiv:n,_paper:a};t._fullLayout=s(i,t.layout)}},{"../../components/color":26,"../../lib":118,"./micropolar":173,"./undo_manager":175,d3:10}],175:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return r!==-1},hasRedo:function(){return r-1}var o=t("../lib"),i=t("../plots/plots"),l=o.extendFlat,s=o.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,o=t.data,c=t.layout,u=s([],o),f=s({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;n=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var m,v,y,x,b=e.p+(h?d[n]:d),_=b+(g?p[n]:p),w=e.b,k=w+e.s;if("h"===l.orientation?(y=u.c2p(b,!0),x=u.c2p(_,!0),m=c.c2p(w,!0),v=c.c2p(k,!0)):(m=c.c2p(b,!0),v=c.c2p(_,!0),y=u.c2p(w,!0),x=u.c2p(k,!0)),!(a(m)&&a(v)&&a(y)&&a(x)&&m!==v&&y!==x))return void r.select(this).remove();var M=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,A=r.round(M/2%1,2);if(!t._context.staticPlot){var T=i.opacity(e.mc||l.marker.color),L=T<1||M>.01?o:s;m=L(m,v),v=L(v,m),y=L(y,x),x=L(x,y)}r.select(this).attr("d","M"+m+","+y+"V"+x+"H"+v+"V"+y+"Z")})}),d.call(l.plot,e)}},{"../../components/color":26,"../../components/errorbars":55,"../../lib":118,"./arrays_to_calcdata":185,d3:10,"fast-isnumeric":13}],194:[function(t,e,n){"use strict";function r(t,e,n,r){if(r.length){var l,s,c,u,f,d=t._fullLayout.barmode,h="overlay"===d,p="group"===d;if(h)a(t,e,n,r);else if(p){ +"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},i.util.sumArrays=function(t,e){return r.zip(t,e).map(function(t,e){return r.sum(t)})},i.util.arrayLast=function(t){return t[t.length-1]},i.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return n===-2},i.util.flattenArray=function(t){for(var e=[];!i.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},i.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},i.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},i.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},i.util.getMousePos=function(t){var e=r.mouse(t.node()),n=e[0],a=e[1],o={};return o.x=n,o.y=a,o.pos=e,o.angle=180*(Math.atan2(a,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+a*a),o},i.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;a0)){var l=r.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(n,a,o)},"fill-opacity":0,stroke:function(t,e){return m.stroke(n,a,o)},"stroke-width":function(t,e){return m["stroke-width"](n,a,o)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](n,a,o)},opacity:function(t,e){return m.opacity(n,a,o)},display:function(t,e){return m.display(n,a,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=r.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,a){r.select(this).attr({class:"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var m={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},v=r.select(this).selectAll("g.layer").data(s);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(m).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,n=[i.PolyChart.defaultConfig()],a=r.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),o(n[e],i.PolyChart.defaultConfig()),o(n[e],t)}),this):n},t.getColorScale=function(){return e},r.rebind(t,a,"on"),t},i.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}};return t},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},i.Legend=function(){function t(){var n=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=o({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),i=r.merge(a);i=i.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(i=i.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=r.select(l));var s=i.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof i[0]:n.isContinuous,f=u?n.height:c*i.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=r.range(i.length),m=r.scale[u?"linear":"ordinal"]().domain(g).range(s),v=r.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":r.svg.symbolTypes.indexOf(t)!=-1?r.svg.symbol().type(t).size(n)():r.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(i);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,v(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=r.svg.axis().scale(v).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return i[e].name}),t}var e=i.Legend.defaultConfig(),n=r.dispatch("hover");return t.config=function(t){return arguments.length?(o(e,t),this):e},r.rebind(t,n,"on"),t},i.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},i.tooltipPanel=function(){var t,e,n,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=10,c=function(){t=a.container.selectAll("g."+l).data([0]);var r=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=r.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=r.append("text").attr({dx:a.padding+s,dy:.3*+a.fontSize}),c};return c.text=function(o){var i=r.hsl(a.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var d=a.padding,h=e.node().getBBox(),p={fill:a.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,m=h.height+2*d;return n.attr({d:"M"+[[s,-m/2],[s,-m/4],[a.hasTick?0:s,0],[s,m/4],[s,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-m/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){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 o(a,t),c},c},i.tooltipPanel.uid=1,i.adapter={},i.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=o({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var r=a.indexOf(t.geometry);r!=-1&&(n.data[e].groupId=r)})}if(t.layout){var l=o({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};r.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../lib":118,d3:10}],174:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../lib"),o=t("../../components/color"),i=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){function e(e,a){return a&&(f=a),r.select(r.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?s(n,e):e,o||(o=i.Axis()),u=i.adapter.plotly().convert(n),o.config(u).render(f),t.data=n.data,t.layout=n.layout,c.fillLayout(t),n}var n,a,o,u,f,d=new l;return e.isPolar=!0,e.svg=function(){return o.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return i.adapter.plotly().convert(o.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:o.angularScale(),r:o.radialScale()}},e.setUndoPoint=function(){var t=this,e=i.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,a),a=i.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},c.fillLayout=function(t){var e=r.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:o.background,_container:e,_paperdiv:n,_paper:a};t._fullLayout=s(i,t.layout)}},{"../../components/color":26,"../../lib":118,"./micropolar":173,"./undo_manager":175,d3:10}],175:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return r!==-1},hasRedo:function(){return r-1}var o=t("../lib"),i=t("../plots/plots"),l=o.extendFlat,s=o.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,o=t.data,c=t.layout,u=s([],o),f=s({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;n=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var m,v,y,x,b=e.p+(h?d[n]:d),_=b+(g?p[n]:p),w=e.b,k=w+e.s;if("h"===l.orientation?(y=u.c2p(b,!0),x=u.c2p(_,!0),m=c.c2p(w,!0),v=c.c2p(k,!0)):(m=c.c2p(b,!0),v=c.c2p(_,!0),y=u.c2p(w,!0),x=u.c2p(k,!0)),!(a(m)&&a(v)&&a(y)&&a(x)&&m!==v&&y!==x))return void r.select(this).remove();var M=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,A=r.round(M/2%1,2);if(!t._context.staticPlot){var T=i.opacity(e.mc||l.marker.color),L=T<1||M>.01?o:s;m=L(m,v),v=L(v,m),y=L(y,x),x=L(x,y)}r.select(this).attr("d","M"+m+","+y+"V"+x+"H"+v+"V"+y+"Z")})}),d.call(l.plot,e)}},{"../../components/color":26,"../../components/errorbars":55,"../../lib":118,"./arrays_to_calcdata":185,d3:10,"fast-isnumeric":13}],194:[function(t,e,n){"use strict";function r(t,e,n,r){if(r.length){var l,s,c,u,f,d=t._fullLayout.barmode,h="overlay"===d,p="group"===d;if(h)a(t,e,n,r);else if(p){ for(l=[],s=[],c=0;cs+i&&(c=!0,s=y)),v(e.c2l(g))&&(gs+i&&(c=!0,s=g))}}x.expand(e,[l,s],{tozero:!0,padded:c})}function m(t){return t._id.charAt(0)}var v=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var n,a=e.xaxis,o=e.yaxis,i=t._fullData,l=t.calcdata,s=[],c=[];for(n=0;n1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&r.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,n=e.marker,i=n.line,l=o.tryColorscale(n,""),s=o.tryColorscale(n,"line");r.select(this).selectAll("path").each(function(t){var e,o,c=(t.mlw+1||i.width+1)-1,u=r.select(this);e="mc"in t?t.mcc=l(t.mc):Array.isArray(n.color)?a.defaultLine:n.color,u.style("stroke-width",c+"px").call(a.fill,e),c&&(o="mlc"in t?t.mlcc=s(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":26,"../../components/drawing":49,"../../components/errorbars":55,d3:10}],197:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,n,i,l){n("marker.color",i),a(t,"marker")&&o(t,e,l,n,{prefix:"marker.",cLetter:"c"}),n("marker.line.color",r.defaultLine),a(t,"marker.line")&&o(t,e,l,n,{prefix:"marker.line.",cLetter:"c"}),n("marker.line.width")}},{"../../components/color":26,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":39}],198:[function(t,e,n){"use strict";var r=t("../scatter/attributes"),a=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,i=r.marker,l=i.line;e.exports={y:{valType:"data_array"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:o({},i.symbol,{arrayOk:!1}),opacity:o({},i.opacity,{arrayOk:!1,dflt:1}),size:o({},i.size,{arrayOk:!1}),color:o({},i.color,{arrayOk:!1}),line:{color:o({},l.color,{arrayOk:!1,dflt:a.defaultLine}),width:o({},l.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:r.fillcolor}},{"../../components/color/attributes":25,"../../lib/extend":115,"../scatter/attributes":240}],199:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(t,e,n,o,i){var l;return n in e?p=o.makeCalcdata(e,n):(l=n+"0"in e?e[n+"0"]:"name"in e&&("category"===o.type||r(e.name)&&["linear","log"].indexOf(o.type)!==-1||a.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,l=o.d2c(l),p=i.map(function(){return l})),p}function i(t,e,n,o,i){var l,s,c,u,f=o.length,d=e.length,h=[],p=[];for(l=0;l=0&&c1,v=n.dPos*(1-d.boxgap)*(1-d.boxgroupgap)/(m?t.numboxes:1),y=m?2*n.dPos*(-.5+(n.boxnum+.5)/t.numboxes)*(1-d.boxgap):0,x=v*g.whiskerwidth;return g.visible!==!0||n.emptybox?void o.select(this).remove():("h"===g.orientation?(s=p,f=h):(s=h,f=p),n.bPos=y,n.bdPos=v,r(),o.select(this).selectAll("path.box").data(i.identity).enter().append("path").attr("class","box").each(function(t){var e=s.c2p(t.pos+y,!0),n=s.c2p(t.pos+y-v,!0),r=s.c2p(t.pos+y+v,!0),a=s.c2p(t.pos+y-x,!0),l=s.c2p(t.pos+y+x,!0),c=f.c2p(t.q1,!0),u=f.c2p(t.q3,!0),d=i.constrain(f.c2p(t.med,!0),Math.min(c,u)+1,Math.max(c,u)-1),h=f.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=f.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?o.select(this).attr("d","M"+d+","+n+"V"+r+"M"+c+","+n+"V"+r+"H"+u+"V"+n+"ZM"+c+","+e+"H"+h+"M"+u+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+h+","+a+"V"+l+"M"+p+","+a+"V"+l)):o.select(this).attr("d","M"+n+","+d+"H"+r+"M"+n+","+c+"H"+r+"V"+u+"H"+n+"ZM"+e+","+c+"V"+h+"M"+e+","+u+"V"+p+(0===g.whiskerwidth?"":"M"+a+","+h+"H"+l+"M"+a+","+p+"H"+l))}),g.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=n,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,n,r,o,l,s,f,d="all"===g.boxpoints?t.val:t.val.filter(function(e){return et.uf}),h=Math.max((t.max-t.min)/10,t.q3-t.q1),p=1e-9*h,m=h*u,x=[],b=0;if(g.jitter){if(0===h)for(b=1,x=new Array(d.length),e=0;et.lo&&(r.so=!0),r})}).enter().append("path").call(l.translatePoints,h,p),void(g.boxmean&&o.select(this).selectAll("path.mean").data(i.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=s.c2p(t.pos+y,!0),n=s.c2p(t.pos+y-v,!0),r=s.c2p(t.pos+y+v,!0),a=f.c2p(t.mean,!0),i=f.c2p(t.mean-t.sd,!0),l=f.c2p(t.mean+t.sd,!0);"h"===g.orientation?o.select(this).attr("d","M"+a+","+n+"V"+r+("sd"!==g.boxmean?"":"m0,0L"+i+","+e+"L"+a+","+n+"L"+l+","+e+"Z")):o.select(this).attr("d","M"+n+","+a+"H"+r+("sd"!==g.boxmean?"":"m0,0L"+e+","+i+"L"+n+","+a+"L"+e+","+l+"Z"))})))})}},{"../../components/drawing":49,"../../lib":118,d3:10}],206:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../plots/cartesian/axes"),o=t("../../lib");e.exports=function(t,e){var n,i,l,s,c=t._fullLayout,u=e.xaxis,f=e.yaxis,d=["v","h"];for(i=0;io)return n[t]=o,o-n[t]}return 0},max:function(t,e,n,a){var o=a[e];if(r(o)){if(o=Number(o),!r(n[t]))return n[t]=o,o;if(n[t]=0&&yR;n--)if(f[n]){F=n;break}for(n=R;n<=F;n++)r(u[n])&&r(f[n])&&I.push({p:u[n],s:f[n],b:0});return I}}},{"../../lib":118,"../../plots/cartesian/axes":145,"./average":213,"./bin_functions":215,"./clean_bins":217,"./norm_functions":220,"fast-isnumeric":13}],217:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib").cleanDate,o=t("../../constants/numerical").ONEDAY;e.exports=function(t,e,n){var i=e.type,l=n+"bins",s=t[l];s||(s=t[l]={});var c="date"===i?function(t){return t||0===t?a(t):null}:function(t){return r(t)?Number(t):null};s.start=c(s.start),s.end=c(s.end);var u="date"===i?o:1,f=s.size;if(r(f))s.size=f>0?Number(f):u;else if("string"!=typeof f)s.size=u;else{var d=f.charAt(0),h=f.substr(1);h=r(h)?Number(h):0,(h<=0||"date"!==i||"M"!==d||h!==Math.round(h))&&(s.size=u)}var p="autobin"+n;"boolean"!=typeof t[p]&&(t[p]=!((s.start||0===s.start)&&(s.end||0===s.end))),t[p]||delete t["nbins"+n]}},{"../../constants/numerical":106,"../../lib":118,"fast-isnumeric":13}],218:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../components/color"),o=t("./bin_defaults"),i=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),s=t("./attributes");e.exports=function(t,e,n,c){function u(n,a){return r.coerce(t,e,s,n,a)}var f=u("x"),d=u("y");u("text");var h=u("orientation",d&&!f?"h":"v"),p=e["v"===h?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===h?"x":"y"];g&&u("histfunc");var m="h"===h?["y"]:["x"];o(t,e,u,m),i(t,e,u,n,c),l(t,e,a.defaultLine,{axis:"y"}),l(t,e,a.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":26,"../../components/errorbars/defaults":54,"../../lib":118,"../bar/style_defaults":197,"./attributes":212,"./bin_defaults":214}],219:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.layoutAttributes=t("../bar/layout_attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("../bar/layout_defaults"),r.calc=t("./calc"),r.setPositions=t("../bar/set_positions"),r.plot=t("../bar/plot"),r.style=t("../bar/style"),r.colorbar=t("../scatter/colorbar"),r.hoverPoints=t("../bar/hover"),r.moduleType="trace",r.name="histogram",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":153,"../bar/hover":189,"../bar/layout_attributes":191,"../bar/layout_defaults":192,"../bar/plot":193,"../bar/set_positions":194,"../bar/style":196,"../scatter/colorbar":243,"./attributes":212,"./calc":216,"./defaults":218}],220:[function(t,e,n){"use strict";e.exports={percent:function(t,e){for(var n=t.length,r=100/e,a=0;ae}}},n.addRangeSlider=function(t){t.xaxis||(t.xaxis={}),t.xaxis.rangeslider||(t.xaxis.rangeslider={})}},{"../../lib":118}],225:[function(t,e,n){"use strict";var r=t("../../plot_api/register");e.exports={moduleType:"trace",name:"ohlc",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","showLegend"],meta:{},attributes:t("./attributes"),supplyDefaults:t("./defaults")},r(t("../scatter")),r(t("./transform"))},{"../../plot_api/register":135,"../../plots/cartesian":153,"../scatter":250,"./attributes":221,"./defaults":222,"./transform":227}],226:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r,a=n("x"),o=n("open"),i=n("high"),l=n("low"),s=n("close");return r=Math.min(o.length,i.length,l.length,s.length),a&&(r=Math.min(r,a.length),r1)){var f=i.distinctVals(u.x.map(e.d2c)).minDiff;o=Math.min(o,f)}}for(o===1/0&&(o=1),c=0;c");_.push(i,i,i,i,i,i,null)},O=0;O")}return g};var s},{"../../components/color":26,"./helpers":232,"fast-isnumeric":13,tinycolor2:16}],231:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(n,o){return r.coerce(t,e,a,n,o)}var l=r.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,m=g||"inside"===p,v=g||"outside"===p;if(m||v){var y=l(i,"textfont",o.font);m&&l(i,"insidetextfont",y),v&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":118,"./attributes":228}],232:[function(t,e,n){"use strict";var r=t("../../lib");n.formatPiePercent=function(t,e){var n=(100*t).toPrecision(3);return n.lastIndexOf(".")!==-1&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)+"%"},n.formatPieValue=function(t,e){var n=t.toPrecision(10);return n.lastIndexOf(".")!==-1&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)}},{"../../lib":118}],233:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.layoutAttributes=t("./layout_attributes"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.styleOne=t("./style_one"),r.moduleType="trace",r.name="pie",r.basePlotModule=t("./base_plot"),r.categories=["pie","showLegend"],r.meta={},e.exports=r},{"./attributes":228,"./base_plot":229,"./calc":230,"./defaults":231,"./layout_attributes":234,"./layout_defaults":235,"./plot":236,"./style":237,"./style_one":238}],234:[function(t,e,n){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],235:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function n(n,o){return r.coerce(t,e,a,n,o)}n("hiddenlabels")}},{"../../lib":118,"./layout_attributes":234}],236:[function(t,e,n){"use strict";function r(t,e,n){var r=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/n.vTotal,.5),l=1-n.trace.hole,s=a(e,n),c={scale:s*n.r*2/r,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=n.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/n.r)-f*o/n.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=n.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),m={scale:2*g/t.width,rCenter:Math.cos(g/n.r)-g/o/n.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>d.scale?m:d;return c.scale<1&&v.scale>c.scale?v:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var n=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(n)),(1-e.trace.hole)/2)}function o(t,e){var n=e.pxmid[0],r=e.pxmid[1],a=t.width/2,o=t.height/2;return n<0&&(a*=-1),r<0&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+n*n/(r*r)),outside:!0}}function i(t,e){function n(t,e){return t.pxmid[1]-e.pxmid[1]}function r(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,n){n||(n={});var r,a,o,l,d,h,g=n.labelExtraY+(i?n.yLabelMax:n.yLabelMin),m=i?t.yLabelMin:t.yLabelMax,v=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-m;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-m-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*f>0&&(r=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+r-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,m,v;for(i=0;i<2;i++)for(l=i?n:r,c=i?Math.max:Math.min,f=i?1:-1,o=0;o<2;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),m=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(n/c(l.tilt,Math.sin(s),l.depth),r/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&h.indexOf(l.scalegroup)===-1&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,n){if(!t)return 1;var r=Math.sin(t*Math.PI/180);return Math.max(.01,n*r*Math.abs(e)+2*Math.sqrt(1-r*r*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var n=t._fullLayout;l(e,n._size);var c=n._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],m=c.trace,v=0,y=(m.depth||0)*c.r*Math.sin(v)/2,x=m.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(v),k=l.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],v=!1;l.each(function(i){function l(e){var r=t._fullLayout,o=t._fullData[m.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&r.hovermode!==!1&&"none"!==l&&"skip"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=n.separators,p=[];l.indexOf("label")!==-1&&p.push(i.label),o.text&&o.text[i.i]&&l.indexOf("text")!==-1&&p.push(o.text[i.i]),l.indexOf("value")!==-1&&p.push(g.formatPieValue(i.v,h)),l.indexOf("percent")!==-1&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:l.indexOf("name")!==-1?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:r._hoverlayer.node(),outerContainer:r._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(n._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],t._hoverdata.trace=e.trace,f.click(t,{target:!0})}function b(t,e,n,r){return"a"+r*c.r+","+r*w+" "+x+" "+i.largeArc+(n?" 1 ":" 0 ")+r*(e[0]-t[0])+","+r*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y),m.pull){var C=+(Array.isArray(m.pull)?m.pull[i.i]:m.pull)||0;C>0&&(k+=C*i.pxmid[0],M+=C*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var z=m.hole;if(i.v===c.vTotal){var S="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";z?T.attr("d","M"+(k+z*i.px0[0])+","+(M+z*i.px0[1])+b(i.px0,i.pxmid,!1,z)+b(i.pxmid,i.px0,!1,z)+"Z"+S):T.attr("d",S)}else{var O=b(i.px0,i.px1,!0,1);if(z){var P=1-z;T.attr("d","M"+(k+z*i.px1[0])+","+(M+z*i.px1[1])+b(i.px1,i.px0,!1,z)+"l"+P*i.px0[0]+","+P*i.px0[1]+O+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+O+"Z")}var D=Array.isArray(m.textposition)?m.textposition[i.i]:m.textposition,N=A.selectAll("g.slicetext").data(i.text&&"none"!==D?[0]:[]);N.enter().append("g").classed("slicetext",!0),N.exit().remove(),N.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===D?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,n=h.bBox(t.node());"outside"===D?e=o(n,i):(e=r(n,i,c),"auto"===D&&e.scale<1&&(t.call(h.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),n=h.bBox(t.node())),e=o(n,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-n.height/2,i.yLabelMid=l,i.yLabelMax=l+n.height/2,i.labelExtraX=0,i.labelExtraY=0,v=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(n.left+n.right)/2+","+-(n.top+n.bottom)/2+")")})}),v&&i(s,m),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),n=e.select("g.slicetext text");n.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+n.attr("transform"));var r=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+r+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(r+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":26,"../../components/drawing":49,"../../lib/svg_text_utils":130,"../../plots/cartesian/graph_interact":152,"./helpers":232,d3:10}],237:[function(t,e,n){"use strict";var r=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],n=e.trace,o=r.select(this);o.style({opacity:n.opacity}),o.selectAll(".top path.surface").each(function(t){r.select(this).call(a,t,n)})})}},{"./style_one":238,d3:10}],238:[function(t,e,n){"use strict";var r=t("../../components/color");e.exports=function(t,e,n){var a=n.marker.line.color;Array.isArray(a)&&(a=a[e.i]||r.defaultLine);var o=n.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(r.stroke,a)}},{"../../components/color":26}],239:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t){var e=t[0].trace,n=e.marker;if(r.mergeArray(e.text,t,"tx"),r.mergeArray(e.textposition,t,"tp"),e.textfont&&(r.mergeArray(e.textfont.size,t,"ts"),r.mergeArray(e.textfont.color,t,"tc"),r.mergeArray(e.textfont.family,t,"tf")),n&&n.line){var a=n.line;r.mergeArray(n.opacity,t,"mo"),r.mergeArray(n.symbol,t,"mx"),r.mergeArray(n.color,t,"mc"),r.mergeArray(a.color,t,"mlc"),r.mergeArray(a.width,t,"mlw")}}},{"../../lib":118}],240:[function(t,e,n){"use strict";var r=t("../../components/colorscale/color_attributes"),a=t("../../components/errorbars/attributes"),o=t("../../components/colorbar/attributes"),i=t("../../components/drawing"),l=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},ids:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"},simplify:{valType:"boolean",dflt:!0}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:l({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},colorbar:o,line:l({},{width:{valType:"number",min:0,arrayOk:!0}},r("marker.line"))},r("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},error_y:a,error_x:a}},{"../../components/colorbar/attributes":27,"../../components/colorscale/color_attributes":33,"../../components/drawing":49,"../../components/errorbars/attributes":51,"../../lib/extend":115,"./constants":245}],241:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var n,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var v={type:"linear"};a.setConvert(v),s=v.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,a.expand(u,d,g),a.expand(f,h,m);var b=new Array(p);for(c=0;c=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}}}}},{}],243:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/plots"),i=t("../../components/colorscale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,s=n.marker,c="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===s||!s.showscale)return void o.autoMargin(t,c);var u=s.color,f=s.cmin,d=s.cmax;r(f)||(f=a.aggNums(Math.min,null,u)),r(d)||(d=a.aggNums(Math.max,null,u));var h=e[0].t.cb=l(t,c),p=i.makeColorScaleFunc(i.extractScale(s.colorscale,f,d),{noNumericCheck:!0});h.fillcolor(p).filllevels({start:f,end:d,size:(d-f)/254}).options(s.colorbar)()}},{"../../components/colorbar/draw":29,"../../components/colorscale":40,"../../lib":118,"../../plots/plots":169,"fast-isnumeric":13}],244:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":32,"../../components/colorscale/has_colorscale":39,"./subtypes":260}],245:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],246:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var m=l(t,e,g),v=mB!=D>=B&&(S=C[T-1][0],O=C[T][0],z=S+(O-S)*(B-P)/(D-P),R=Math.min(R,z),F=Math.max(F,z));R=Math.max(R,0),F=Math.min(F,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:F,y0:B,y1:B,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":26,"../../components/errorbars":55,"../../lib":118,"../../plots/cartesian/constants":150,"../../plots/cartesian/graph_interact":152,"./get_trace_color":248}],250:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.animatable=!0,r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":153,"./arrays_to_calcdata":239,"./attributes":240,"./calc":241,"./clean_data":242,"./colorbar":243,"./defaults":246,"./hover":249,"./plot":257,"./select":258,"./style":259,"./subtypes":260}],251:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=!Array.isArray(l)&&l||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":39}],252:[function(t,e,n){"use strict";var r=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),a=k.c2p(t[e].y);return n!==r&&a!==r&&[n,a]}function a(t){var e=t[0]/w._length,n=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*T}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,m,v,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.simplify,A=e.connectGaps,T=e.baseTolerance,L=e.linear,C=[],z=.2,S=new Array(t.length),O=0;for(M||(T=z=-1),i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,c=f,h=!1):y=t.length||!f)break;S[O++]=f,l=f}}else S[O++]=c}C.push(S.slice(0,O))}return C}},{"../../constants/numerical":106}],253:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],254:[function(t,e,n){"use strict";e.exports=function(t,e,n){for(var r,a,o=null,i=0;i0?Math.max(e,a):0}}},{"fast-isnumeric":13}],256:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":26,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":39,"./subtypes":260}],257:[function(t,e,n){"use strict";function r(t,e){var n;e.selectAll("g.trace").each(function(t){var e=i.select(this);if(n=t[0].trace,n._nexttrace){if(n._nextFill=e.select(".js-fill.js-tonext"),!n._nextFill.size()){var r=":first-child";e.select(".js-fill.js-tozero").size()&&(r+=" + *"),n._nextFill=e.insert("path",r).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),n._nextFill=null;n.fill&&("tozero"===n.fill.substr(0,6)||"toself"===n.fill||"to"===n.fill.substr(0,2)&&!n._prevtrace)?(n._ownFill=e.select(".js-fill.js-tozero"),n._ownFill.size()||(n._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),n._ownFill=null)})}function a(t,e,n,r,a,h,g){function m(t){return M?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,n,r=t[0].trace,a=i.select(this),o=u.hasMarkers(r),c=u.hasText(r),f=x(r),d=b,h=b;o&&(d=r.marker.maxdisplayed?v:l.identity),c&&(h=r.marker.maxdisplayed?v:l.identity),n=a.selectAll("path.point"),e=n.data(d,f);var p=e.enter().append("path").classed("point",!0);p.call(s.pointStyle,r).call(s.translatePoints,A,T,r),M&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=m(i.select(this));s.translatePoint(t,e,A,T),s.singlePointStyle(t,e,r)}),M?e.exit().transition().style("opacity",0).remove():e.exit().remove(),n=a.selectAll("g"),e=n.data(h,f),e.enter().append("g").append("text"),e.each(function(t){var e=m(i.select(this).select("text"));s.translatePoint(t,e,A,T)}),e.selectAll("text").call(s.textPointStyle,r).each(function(t){var e=t.xp||A.c2p(t.x),n=t.yp||T.c2p(t.y);i.select(this).selectAll("tspan").each(function(){m(i.select(this)).attr({x:e,y:n})})}),e.exit().remove()}var w,k;o(t,e,n,r,a);var M=!!g&&g.duration>0,A=n.xaxis,T=n.yaxis,L=r[0].trace,C=L.line,z=i.select(h);if(z.call(c.plot,n,g),L.visible===!0){m(z).style("opacity",L.opacity);var S,O,P=L.fill.charAt(L.fill.length-1);"x"!==P&&"y"!==P&&(P=""),r[0].node3=z,f(r);var D="",N=[],E=L._prevtrace;E&&(D=E._prevRevpath||"",O=E._nextFill,N=E._polygons);var I,R,F,j,q,B,H,V,X,Z="",U="",G=[],Y=[],W=l.noop;if(S=L._ownFill,u.hasLines(L)||"none"!==L.fill){for(O&&O.datum(r),["hv","vh","hvh","vhv"].indexOf(C.shape)!==-1?(F=s.steps(C.shape),j=s.steps(C.shape.split("").reverse().join(""))):F=j="spline"===C.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?s.smoothclosed(t.slice(1),C.smoothing):s.smoothopen(t,C.smoothing)}:function(t){return"M"+t.join("L")},q=function(t){return j(t.reverse())},G=d(r,{xaxis:A,yaxis:T,connectGaps:L.connectgaps,baseTolerance:Math.max(C.width||1,3)/4,linear:"linear"===C.shape,simplify:C.simplify}),X=L._polygons=new Array(G.length),k=0;k1}),W=function(t){return function(e){if(I=F(e),R=q(e),Z?P?(Z+="L"+I.substr(1),U=R+("L"+U.substr(1))):(Z+="Z"+I,U=R+"Z"+U):(Z=I,U=R),u.hasLines(L)&&e.length>1){var n=i.select(this);if(n.datum(r),t)m(n.style("opacity",0).attr("d",I).call(s.lineGroupStyle)).style("opacity",1);else{var a=m(n);a.attr("d",I),s.singleLineStyle(r,a)}}}}}var Q=z.selectAll(".js-line").data(Y);m(Q.exit()).style("opacity",0).remove(),Q.each(W(!1)), Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(W(!0)),G.length&&(S?B&&V&&(P?("y"===P?B[1]=V[1]=T.c2p(0,!0):"x"===P&&(B[0]=V[0]=A.c2p(0,!0)),m(S).attr("d","M"+V+"L"+B+"L"+Z.substr(1))):m(S).attr("d",Z+"Z")):"tonext"===L.fill.substr(0,6)&&Z&&D&&("tonext"===L.fill?m(O).attr("d",Z+"Z"+D+"Z"):m(O).attr("d",Z+"L"+D.substr(1)+"Z"),L._polygons=L._polygons.concat(N)),L._prevRevpath=U,L._prevPolygons=X);var $=z.selectAll(".points");w=$.data([r]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function o(t,e,n,r,a){var o=n.xaxis,l=n.yaxis,s=i.extent(o.range.map(o.r2l).map(o.l2c)),c=i.extent(l.range.map(l.r2l).map(l.l2c)),f=r[0].trace;if(u.hasMarkers(f)){var d=f.marker.maxdisplayed;if(0!==d){var h=r.filter(function(t){return t.x>=s[0]&&t.x<=s[1]&&t.y>=c[0]&&t.y<=c[1]}),p=Math.ceil(h.length/d),g=0;a.forEach(function(t,n){var r=t[0].trace;u.hasMarkers(r)&&r.marker.maxdisplayed>0&&n0;for(u=p.selectAll("g.trace"),f=u.data(n,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),h(t,e,n),r(t,p),s=0,c=[];sr?1:-1}),m){l&&(d=l());var v=i.transition().duration(o.duration).ease(o.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()});v.each(function(){p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)})})}else p.selectAll("g.trace").each(function(r,i){a(t,i,e,r,n,this,o)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":49,"../../components/errorbars":55,"../../lib":118,"../../lib/polygon":125,"./arrays_to_calcdata":239,"./line_points":252,"./link_traces":254,"./subtypes":260,d3:10}],258:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;nrect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",d[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==ui.event.keyCode&&(S||(x=null,O[0]-=f[1],O[1]-=d[1],S=2),T())}function g(){32==ui.event.keyCode&&2==S&&(O[0]+=f[1],O[1]+=d[1],S=0,T())}function m(){var t=ui.mouse(_),r=!1;b&&(t[0]+=b[0],t[1]+=b[1]),S||(ui.event.altKey?(x||(x=[(f[0]+f[1])/2,(d[0]+d[1])/2]),O[0]=f[+(t[0]0&&this._events[t].length>n&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!a(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,l;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||a(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(n)){for(l=o;l-- >0;)if(n[l]===e||n[l].listener&&n[l].listener===e){r=l;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;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(n=this._events[t],a(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?a(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],11:[function(t,e,n){"use strict";function r(t){for(var e,n=t.length,r=0;r13)&&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}e.exports=function(t){var e=typeof t;if("string"===e){var n=t;if(t=+t,0===t&&r(n))return!1}else if("number"!==e)return!1;return t-t<1}},{}],12:[function(t,e,n){function r(t,e){var n=e[0],r=e[1],a=e[2],o=e[3],i=n+n,l=r+r,s=a+a,c=n*i,u=r*i,f=r*l,d=a*i,h=a*l,p=a*s,g=o*i,m=o*l,v=o*s;return t[0]=1-f-p,t[1]=u+v,t[2]=d-m,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=h+g,t[7]=0,t[8]=d+m,t[9]=h-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=r},{}],13:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function i(t){if(d===clearTimeout)return clearTimeout(t);if((d===a||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{return d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}function l(){m&&p&&(m=!1,p.length?g=p.concat(g):v=-1,g.length&&s())}function s(){if(!m){var t=o(l);m=!0;for(var e=g.length;e;){for(p=g,g=[];++v1)for(var n=1;n.5?s/(2-o-i):s/(o+i),o){case t:r=(e-n)/s+(e1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var a,o,i;if(t=C(t,360),e=C(e,100),n=C(n,100),0===e)a=o=i=n;else{var l=n<.5?n*(1+e):n+e-n*e,s=2*n-l;a=r(s,l,t+1/3),o=r(s,l,t),i=r(s,l,t-1/3)}return{r:255*a,g:255*o,b:255*i}}function s(t,e,n){t=C(t,255),e=C(e,255),n=C(n,255);var r,a,o=U(t,e,n),i=G(t,e,n),l=o,s=o-i;if(a=0===o?0:s/o,o==i)r=0;else{switch(o){case t:r=(e-n)/s+(e>1)+720)%360;--e;)a.h=(a.h+o)%360,i.push(r(a));return i}function A(t,e){e=e||6;for(var n=r(t).toHsv(),a=n.h,o=n.s,i=n.v,l=[],s=1/e;e--;)l.push(r({h:a,s:o,v:i})),i=(i+s)%1;return l}function T(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function C(t,n){O(t)&&(t="100%");var r=N(t);return t=G(n,U(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function S(t){return G(1,U(0,t))}function z(t){return parseInt(t,16)}function O(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function N(t){return"string"==typeof t&&t.indexOf("%")!=-1}function P(t){return 1==t.length?"0"+t:""+t}function E(t){return t<=1&&(t=100*t+"%"),t}function D(t){return e.round(255*parseFloat(t)).toString(16)}function R(t){return z(t)/255}function j(t){return!!W.CSS_UNIT.exec(t)}function I(t){t=t.replace(B,"").replace(q,"").toLowerCase();var e=!1;if(Z[t])t=Z[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=W.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=W.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=W.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=W.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=W.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=W.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=W.hex8.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),a:R(n[4]),format:e?"name":"hex8"}:(n=W.hex6.exec(t))?{r:z(n[1]),g:z(n[2]),b:z(n[3]),format:e?"name":"hex"}:(n=W.hex4.exec(t))?{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),a:R(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=W.hex3.exec(t))&&{r:z(n[1]+""+n[1]),g:z(n[2]+""+n[2]),b:z(n[3]+""+n[3]),format:e?"name":"hex"}}function F(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:e,size:n}}var B=/^\s+/,q=/\s+$/,H=0,V=e.round,G=e.min,U=e.max,X=e.random;r.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,a,o,i,l=this.toRgb();return t=l.r/255,n=l.g/255,r=l.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),i=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),.2126*a+.7152*o+.0722*i},setAlpha:function(t){return this._a=L(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=V(360*t.h),n=V(100*t.s),r=V(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*C(this._r,255))+"%",g:V(100*C(this._g,255))+"%",b:V(100*C(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%)":"rgba("+V(100*C(this._r,255))+"%, "+V(100*C(this._g,255))+"%, "+V(100*C(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[u(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),n=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var o=r(t);n="#"+d(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0,a=!e&&r&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return a?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return r(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(k,arguments); },complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},r.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?n[a]=t[a]:n[a]=E(t[a]));t=n}return r(t,e)},r.equals=function(t,e){return!(!t||!e)&&r(t).toRgbString()==r(e).toRgbString()},r.random=function(){return r.fromRatio({r:X(),g:X(),b:X()})},r.mix=function(t,e,n){n=0===n?0:n||50;var a=r(t).toRgb(),o=r(e).toRgb(),i=n/100,l={r:(o.r-a.r)*i+a.r,g:(o.g-a.g)*i+a.g,b:(o.b-a.b)*i+a.b,a:(o.a-a.a)*i+a.a};return r(l)},r.readability=function(t,n){var a=r(t),o=r(n);return(e.max(a.getLuminance(),o.getLuminance())+.05)/(e.min(a.getLuminance(),o.getLuminance())+.05)},r.isReadable=function(t,e,n){var a,o,i=r.readability(t,e);switch(o=!1,a=F(n),a.level+a.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},r.mostReadable=function(t,e,n){var a,o,i,l,s=null,c=0;n=n||{},o=n.includeFallbackColors,i=n.level,l=n.size;for(var u=0;uc&&(c=a,s=r(e[u]));return r.isReadable(t,s,{level:i,size:l})||!o?s:(n.includeFallbackColors=!1,r.mostReadable(t,["#fff","#000"],n))};var Z=r.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=r.hexNames=T(Z),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+r),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})$/}}();"undefined"!=typeof n&&n.exports?n.exports=r:"function"==typeof t&&t.amd?t(function(){return r}):window.tinycolor=r}(Math)},{}],15:[function(e,n,r){!function(e,a){"object"==typeof r&&"undefined"!=typeof n?a(r):"function"==typeof t&&t.amd?t(["exports"],a):a(e.topojson=e.topojson||{})}(this,function(t){"use strict";function e(t,e){var r=e.id,a=e.bbox,o=null==e.properties?{}:e.properties,i=n(t,e);return null==r&&null==a?{type:"Feature",properties:o,geometry:i}:null==a?{type:"Feature",id:r,properties:o,geometry:i}:{type:"Feature",id:r,bbox:a,properties:o,geometry:i}}function n(t,e){function n(t,e){e.length&&e.pop();for(var n=f[t<0?~t:t],r=0,a=n.length;r1)r=a(t,e,n);else for(o=0,r=new Array(i=t.arcs.length);o1)for(var a,o,s=1,c=i(r[0]);sc&&(o=r[0],r[0]=r[s],r[s]=o,c=a);return r})}}var l=function(t){return t},s=function(t){if(null==(e=t.transform))return l;var e,n,r,a=e.scale[0],o=e.scale[1],i=e.translate[0],s=e.translate[1];return function(t,e){return e||(n=r=0),t[0]=(n+=t[0])*a+i,t[1]=(r+=t[1])*o+s,t}},c=function(t){function e(t){l[0]=t[0],l[1]=t[1],i(l),l[0]f&&(f=l[0]),l[1]d&&(d=l[1])}function n(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(n);break;case"Point":e(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(e)}}var r=t.bbox;if(!r){var a,o,i=s(t),l=new Array(2),c=1/0,u=c,f=-c,d=-c;t.arcs.forEach(function(t){for(var e=-1,n=t.length;++ef&&(f=l[0]),l[1]d&&(d=l[1])});for(o in t.objects)n(t.objects[o]);r=t.bbox=[c,u,f,d]}return r},u=function(t,e){for(var n,r=t.length,a=r-e;a<--r;)n=t[a],t[a++]=t[r],t[r]=n},f=function(t,n){return"GeometryCollection"===n.type?{type:"FeatureCollection",features:n.geometries.map(function(n){return e(t,n)})}:e(t,n)},d=function(t,e){function n(e){var n,r=t.arcs[e<0?~e:e],a=r[0];return t.transform?(n=[0,0],r.forEach(function(t){n[0]+=t[0],n[1]+=t[1]})):n=r[r.length-1],e<0?[n,a]:[a,n]}function r(t,e){for(var n in t){var r=t[n];delete e[r.start],delete r.start,delete r.end,r.forEach(function(t){a[t<0?~t:t]=1}),l.push(r)}}var a={},o={},i={},l=[],s=-1;return e.forEach(function(n,r){var a,o=t.arcs[n<0?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(a=e[++s],e[s]=n,e[r]=a)}),e.forEach(function(t){var e,r,a=n(t),l=a[0],s=a[1];if(e=i[l])if(delete i[e.end],e.push(t),e.end=s,r=o[s]){delete o[r.start];var c=r===e?e:e.concat(r);o[c.start=e.start]=i[c.end=r.end]=c}else o[e.start]=i[e.end]=e;else if(e=o[s])if(delete o[e.start],e.unshift(t),e.start=l,r=i[l]){delete i[r.end];var u=r===e?e:r.concat(e);o[u.start=r.start]=i[u.end=e.end]=u}else o[e.start]=i[e.end]=e;else e=[t],o[e.start=l]=i[e.end=s]=e}),r(i,o),r(o,i),e.forEach(function(t){a[t<0?~t:t]||l.push([t])}),l},h=function(t){return n(t,r.apply(this,arguments))},p=function(t){return n(t,i.apply(this,arguments))},g=function(t,e){for(var n=0,r=t.length;n>>1;t[a]=2))throw new Error("n must be \u22652");if(t.transform)throw new Error("already quantized");var a,o=c(t),i=o[0],l=(o[2]-i)/(e-1)||1,s=o[1],u=(o[3]-s)/(e-1)||1;t.arcs.forEach(function(t){for(var e,n,r,a=1,o=1,c=t.length,f=t[0],d=f[0]=Math.round((f[0]-i)/l),h=f[1]=Math.round((f[1]-s)/u);a2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}rt.selectAll("tspan.line").attr({y:0,x:0});var r=$.select(".annotation-math-group"),a=!r.empty(),l=h.bBox((a?r:rt).node()),c=l.width,p=l.height,v=Math.round(c+2*tt),y=Math.round(p+2*tt);G._w=c,G._h=p;var b=!1;if(["x","y"].forEach(function(e){var r,a=G[e+"ref"]||e,o=f.getFromId(t,a),i=(Y+("x"===e?0:90))*Math.PI/180,l=v*Math.abs(Math.cos(i))+y*Math.abs(Math.sin(i)),s=G[e+"anchor"];if(o){var c=o.r2fraction(G[e]);if(!o.autorange&&(c<0||c>1)&&(G["a"+e+"ref"]===a?(c=o.r2fraction(G["a"+e]),(c<0||c>1)&&(b=!0)):b=!0,b))return;Z[e]=o._offset+o.r2p(G[e]),r=.5}else r=G[e],"y"===e&&(r=1-r),Z[e]="x"===e?O.l+O.w*r:O.t+O.h*r;var u=0;G["a"+e+"ref"]===a?Z["aa"+e]=o._offset+o.r2p(G["a"+e]):(u=G.showarrow?G["a"+e]:l*n(r,s),Z[e]+=u),G["_"+e+"type"]=o&&o.type,G["_"+e+"size"]=l,G["_"+e+"shift"]=u}),b)return void $.remove();var _,w;G.showarrow&&(_=G.axref===G.xref?Z.x:u.constrain(Z.x-G.ax,1,k.width-1),w=G.ayref===G.yref?Z.y:u.constrain(Z.y-G.ay,1,k.height-1)),Z.x=u.constrain(Z.x,1,k.width-1),Z.y=u.constrain(Z.y,1,k.height-1);var M=tt-l.top,A=tt-l.left;a?r.select("svg").attr({x:tt-1,y:tt}):(rt.attr({x:A,y:M}),rt.selectAll("tspan.line").attr({y:M,x:A})),et.call(h.setRect,J/2,J/2,v-J,y-J);var T=0,L=0;T=G.axref===G.xref?Math.round(Z.aax-v/2):Math.round(Z.x-v/2),L=G.ayref===G.yref?Math.round(Z.aay-y/2):Math.round(Z.y-y/2),$.call(u.setTranslate,T,L);var C="annotations["+e+"]",S=function(n,r){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=G.axref===G.xref?Z.aax+n:Z.x+n,l=G.ayref===G.yref?Z.aay+r:Z.y+r;var c=u.rotationXYMatrix(Y,a,l),f=u.apply2DTransform(c),h=u.apply2DTransform2(c),p=et.attr("width")/2,g=et.attr("height")/2,v=[[a-p,l-g,a-p,l+g],[a-p,l+g,a+p,l+g],[a+p,l+g,a+p,l-g],[a+p,l-g,a-p,l-g]].map(h);if(!v.reduce(function(t,e){return t^!!o(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=o(a,l,_,w,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var y=G.arrowwidth,b=G.arrowcolor,M=W.append("g").style({opacity:d.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=M.append("path").attr("d","M"+a+","+l+"L"+_+","+w).style("stroke-width",y+"px").call(d.stroke,d.rgb(b));x(k,G.arrowhead,"end",G.arrowsize);var A=M.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-_)+","+(l-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,S;m.init({element:A.node(),prepFn:function(){var t=u.getTranslate($);L=t.x,S=t.y,T={},U&&U.autorange&&(T[U._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){M.attr("transform","translate("+t+","+e+")");var n=f(L,S),r=n[0]+t,a=n[1]+e;$.call(u.setTranslate,r,a),T[C+".x"]=U?U.p2r(U.r2p(G.x)+t):(_+t-O.l)/O.w,T[C+".y"]=X?X.p2r(X.r2p(G.y)+e):1-(w+e-O.t)/O.h,G.axref===G.xref&&(T[C+".ax"]=U?U.p2r(U.r2p(G.ax)+t):(_+t-O.l)/O.w),G.ayref===G.yref&&(T[C+".ay"]=X?X.p2r(X.r2p(G.ay)+e):1-(w+e-O.t)/O.h),Q.attr({transform:"rotate("+Y+","+r+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};G.showarrow&&S(0,0);var z=u.rotationXYMatrix(Y,Z.x,Z.y),N=u.apply2DTransform(z);if(t._context.editable){var P,E,D;m.init({element:$.node(),prepFn:function(){var t=u.getTranslate($);P=t.x,E=t.y,D={}},moveFn:function(t,e){$.call(u.setTranslate,P+t,E+e);var n="pointer";if(G.showarrow)G.axref===G.xref?D[C+".ax"]=U.p2r(U.r2p(G.ax)+t):D[C+".ax"]=G.ax+t,G.ayref===G.yref?D[C+".ay"]=X.p2r(X.r2p(G.ay)+e):D[C+".ay"]=G.ay+e,S(t,e);else{if(U)D[C+".x"]=G.x+t/U._m;else{var r=G._xsize/O.w,a=G.x+G._xshift/O.w-r/2;D[C+".x"]=m.align(a+t/O.w,r,0,1,G.xanchor)}if(X)D[C+".y"]=G.y+e/X._m;else{var o=G._ysize/O.h,i=G.y-G._yshift/O.h-o/2;D[C+".y"]=m.align(i-e/O.h,o,0,1,G.yanchor)}U&&X||(n=m.getCursor(U?.5:D[C+".x"],X?.5:D[C+".y"],G.xanchor,G.yanchor))}var l=N(P,E),s=l[0]+t,c=l[1]+e;$.call(u.setTranslate,P+t,E+e),Q.attr({transform:"rotate("+Y+","+s+","+c+")"}),g($,n)},doneFn:function(e){if(g($),e){s.relayout(t,D);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var w,M=t.layout,k=t._fullLayout;if(!l(e)||e===-1){if(!e&&Array.isArray(c))return M.annotations=c,y(M,k),void r(t);if("remove"===c)return delete M.annotations,k.annotations=[],void r(t);if(n&&"add"!==c){for(w=0;we;w--)k._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),a(t,w)}}k._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=M.annotations[e],L=k.annotations[e];if(T){var C={};"string"==typeof n&&n?C[n]=c:u.isPlainObject(n)&&(C=n);var S=Object.keys(C);for(w=0;w4/3&&(j=H)}}else R&&(F&&(j<1/3?j+=q:j>2/3&&(j-=q)),j=(j-R.domain[0])/(R.domain[1]-R.domain[0]),j=R.fraction2r(j))}R&&R===D&&I&&("log"===I&&"log"!==R.type?j=Math.pow(10,j):"log"!==I&&"log"===R.type&&(j=j>0?Math.log(j)/Math.LN10:void 0)),T[E]=j}}var G={};v(T,G,k),k.annotations[e]=G;var U=f.getFromId(t,G.xref),X=f.getFromId(t,G.yref),Z={x:0,y:0},Y=+G.textangle||0,W=k._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",G.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:G})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),J=G.borderwidth,K=G.borderpad,tt=J+K,et=$.append("rect").attr("class","bg").style("stroke-width",J+"px").call(d.stroke,G.bordercolor).call(d.fill,G.bgcolor),nt=G.font,rt=$.append("text").classed("annotation",!0).attr("data-unformatted",G.text).text(G.text);t._context.editable?rt.call(p.makeEditable,$).call(b).on("edit",function(n){G.text=n,this.attr({"data-unformatted":G.text}),this.call(b);var r={};r["annotations["+e+"].text"]=G.text,U&&U.autorange&&(r[U._name+".autorange"]=!0),X&&X.autorange&&(r[X._name+".autorange"]=!0),s.relayout(t,r)}):rt.call(b),Q.attr({transform:"rotate("+Y+","+Z.x+","+Z.y+")"}).call(h.setPosition,Z.x,Z.y)}}}function o(t,e,n,r,a,o,i,l){var s=n-t,c=a-t,u=i-a,f=r-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,m=(c*f-s*d)/p;return m<0||m>1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:r,drawOne:a}},{"../../lib":120,"../../lib/setcursor":130,"../../lib/svg_text_utils":132,"../../plotly":143,"../../plots/cartesian/axes":148,"../../plots/plots":184,"../color":25,"../dragelement":46,"../drawing":48,"./annotation_defaults":16,"./defaults":20,"./draw_arrow_head":22,d3:8,"fast-isnumeric":11}],22:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../color"),i=t("../drawing"),l=t("./arrow_paths");e.exports=function(t,e,n,s){a(s)||(s=1);var c=t.node(),u=l[e||0];if(u){"string"==typeof n&&n||(n="end");var f,d,h,p,g=(i.getPx(t,"stroke-width")||1)*s,m=t.style("stroke")||o.defaultLine,v=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,b=u.backoff*g;if("line"===c.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},d={x:+t.attr("x2"),y:+t.attr("y2")},h=Math.atan2(f.y-d.y,f.x-d.x),p=h+Math.PI,b){var _=b*Math.cos(h),w=b*Math.sin(h);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(d.x+=_,d.y+=w,t.attr({x2:d.x,y2:d.y}))}}else if("path"===c.nodeName){var M=c.getTotalLength(),k="";if(y){var A=c.getPointAtLength(0),T=c.getPointAtLength(.1);h=Math.atan2(A.y-T.y,A.x-T.x),f=c.getPointAtLength(Math.min(b,M)),b&&(k="0px,"+b+"px,")}if(x){var L=c.getPointAtLength(M),C=c.getPointAtLength(M-.1);if(p=Math.atan2(L.y-C.y,L.x-C.x),d=c.getPointAtLength(Math.max(0,M-b)),b){var S=k?2*b:b;k+=M-S+"px,"+M+"px"}}else k&&(k+=M+"px");k&&t.style("stroke-dasharray",k)}var z=function(n,a){e>5&&(a=0),r.select(c.parentElement).append("path").attr({class:t.attr("class"),d:u.path,transform:"translate("+n.x+","+n.y+")rotate("+180*a/Math.PI+")scale("+g+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&z(f,h),x&&z(d,p)}}},{"../color":25,"../drawing":48,"./arrow_paths":17,d3:8,"fast-isnumeric":11}],23:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":18,"./calc_autorange":19,"./defaults":20,"./draw":21}],24:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],25:[function(t,e,n){"use strict";function r(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===r.length;if(!a&&3!==r.length)return t;for(var i=0;i=0))return t;if(3===i)r[i]>1&&(r[i]=1);else if(r[i]>=1)return t}var l=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return a?"rgba("+l+", "+r[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var n=a(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},i.combine=function(t,e){var n=a(t).toRgb();if(1===n.a)return a(t).toRgbString();var r=a(e||i.background).toRgb(),o=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},l={r:o.r*(1-n.a)+n.r*n.a,g:o.g*(1-n.a)+n.g*n.a,b:o.b*(1-n.a)+n.b*n.a};return a(l).toRgbString()},i.contrast=function(t,e,n){var r=a(t),o=r.isLight()?r.darken(n):r.lighten(e);return o.toString()},i.stroke=function(t,e){var n=a(e);t.style({stroke:i.tinyRGB(n),"stroke-opacity":n.getAlpha()})},i.fill=function(t,e){var n=a(e);t.style({fill:i.tinyRGB(n),"fill-opacity":n.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,n,a,o,l=Object.keys(t);for(e=0;el&&(o[1]-=(lt-l)/2)):n.node()&&!n.classed("js-placeholder")&&(lt=h.bBox(e.node()).height),lt){if(lt+=5,"top"===_.titleside)K.domain[1]-=lt/T.h,o[1]*=-1;else{K.domain[0]+=lt/T.h;var c=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),K.setScale()}}ot.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-K.domain[1]))+")");var f=ot.select(".cbfills").selectAll("rect.cbfill").data(z);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?C[0]:(z[e]+z[e-1])/2,e===z.length-1?C[1]:(z[e]+z[e+1])/2].map(K.c2p).map(Math.round);e!==z.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=N(t).replace("e-",""),i=a(o).toHexString();r.select(this).attr({x:Z,width:Math.max(B,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var d=ot.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){r.select(this).attr("d","M"+Z+","+(Math.round(K.c2p(t))+_.line.width/2%1)+"h"+B).call(h.lineGroupStyle,_.line.width,O(t),_.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=Z+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=K.titlefont.size,n=K._offset+K._length/2,a=T.l+(K.position||0)*T.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));M("h"+K._id+"title",{avoid:{selection:r.select(t).selectAll("g."+K._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:A.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,n){var r,a=b();r=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:K,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:ot.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;ot.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,n||{}))}function k(){var n=B+_.outlinewidth/2+h.bBox(K._axislayer.node()).width;if(j=it.select("text"),j.node()&&!j.classed("js-placeholder")){var r,a=it.select(".h"+K._id+"title-math-group").node();r=a&&["top","bottom"].indexOf(_.titleside)!==-1?h.bBox(a).width:h.bBox(it.node()).right-Z-T.l,n=Math.max(n,r)}var o=2*_.xpad+n+_.borderwidth+_.outlinewidth/2,l=Q-$;ot.select(".cbbg").attr({x:Z-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-U,width:Math.max(o,2),height:Math.max(l+2*U,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),ot.selectAll(".cboutline").attr({x:Z,y:$+_.ypad+("top"===_.titleside?lt:0),width:Math.max(B,2),height:Math.max(l-2*_.ypad-lt,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var s=({center:.5,right:1}[_.xanchor]||0)*o;ot.attr("transform","translate("+(T.l-s)+","+T.t+")"),i.autoMargin(t,e,{x:_.x,y:_.y,l:o*({right:1,center:.5}[_.xanchor]||0),r:o*({left:1,center:.5}[_.xanchor]||0),t:l*({bottom:1,middle:.5}[_.yanchor]||0),b:l*({top:1,middle:.5}[_.yanchor]||0)})}var A=t._fullLayout,T=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var L,C=r.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],z=[],O="function"==typeof _.line.color?_.line.color:function(){return _.line.color},N="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},P=_.levels.end+_.levels.size/100,E=_.levels.size,D=1.001*C[0]-.001*C[1],R=1.001*C[1]-.001*C[0];for(L=_.levels.start;(L-P)*E<0;L+=E)L>D&&LC[0]&&L1){var at=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));et*=at*u.roundUp(rt/at,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+X,W+V-X],K.setScale();var ot=A._infolayer.selectAll("g."+e).data([0]);ot.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),ot.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var it=ot.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");K._axislayer=ot.select(".cbaxis");var lt=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var st,ct=T.l+(_.x+G)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-X))*T.h+T.t+3+.75*ut:(1-(W+X))*T.h+T.t-3-.25*ut,M(K._id+"title",{attributes:{x:ct,y:st,"text-anchor":"start"}})}var ft=u.syncOrAsync([i.previousPromises,w,i.previousPromises,k],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var dt,ht,pt;c.init({element:ot.node(),prepFn:function(){dt=ot.attr("transform"),d(ot)},moveFn:function(t,e){ot.attr("transform",dt+" translate("+t+","+e+")"),ht=c.align(Y+t/T.w,q,0,1,_.xanchor),pt=c.align(W-e/T.h,V,0,1,_.yanchor);var n=c.getCursor(ht,pt,_.xanchor,_.yanchor);d(ot,n)},doneFn:function(e){d(ot),e&&void 0!==ht&&void 0!==pt&&o.restyle(t,{"colorbar.x":ht,"colorbar.y":pt},b().index)}})}return ft}function b(){var n,r,a=e.substr(2);for(n=0;n=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":120,"./flip_scale":36,"./scales":43}],32:[function(t,e,n){"use strict";var r=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},r.colorscale,{}),cauto:a({},r.zauto,{}),cmax:a({},r.zmax,{}),cmin:a({},r.zmin,{}),autocolorscale:a({},r.autocolorscale,{}),reversescale:a({},r.reversescale,{})}}},{"../../lib/extend":115,"./attributes":30,"./scales.js":43}],33:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":43}],34:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,n,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,m=p[d+"min"],v=p[d+"max"],y=p.colorscale,x=r(m)&&r(v)&&m=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],37:[function(t,e,n){"use strict";var r=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=a),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":33,"./is_valid_scale_array":41,"./scales":43}],38:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?a.nestedProperty(t,e).get()||{}:t,i=n.color,l=!1;if(Array.isArray(i))for(var s=0;s4/3-l?i:l}},{}],45:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":120}],46:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},s.coverSlip=r},{"../../lib":120,"../../plotly":143,"../../plots/cartesian/constants":153,"./align":44,"./cursor":45,"./unhover":47}],47:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":114}],48:[function(t,e,n){"use strict";function r(t,e,n,r,a,o,i){if(l.traceIs(n,"symbols")){var c=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:h.isBubble(n)?c(t.ms):(o.size||6)/2,t.mrc=e;var r=g.symbolNumber(t.mx||o.symbol)||0,a=r%100;return t.om=r%200>=100,g.symbolFuncs[a](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var u,f,d;t.so?(d=i.outlierwidth,f=i.outliercolor,u=o.outliercolor):(d=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?s.defaultLine:i.color,u="mc"in t?t.mcc=r(t.mc):Array.isArray(o.color)?s.defaultLine:o.color||"rgba(0,0,0,0)"),t.om?e.call(s.stroke,u).style({"stroke-width":(d||1)+"px",fill:"none"}):(e.style("stroke-width",d+"px").call(s.fill,u),d&&e.call(s.stroke,f))}function a(t,e,n,r){var a=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(a*a+i*i,_/2),u=Math.pow(l*l+s*s,_/2),f=(u*u*a-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(h&&f/h),2),o.round(e[1]+(h&&d/h),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&d/p),2)]]}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../registry"),s=t("../color"),c=t("../colorscale"),u=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(s.fill,r)},g.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},g.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},g.setRect=function(t,e,n,r,a){t.call(g.setPosition,e,n).call(g.setSize,r,a)},g.translatePoint=function(t,e,n,r){var a=t.xp||n.c2p(t.x),o=t.yp||r.c2p(t.y);i(a)&&i(o)?"text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"):e.remove()},g.translatePoints=function(t,e,n,r){t.each(function(t){var a=o.select(this);g.translatePoint(t,a,e,n,r)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,n){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},g.singleLineStyle=function(t,e,n,r,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=n||o.width||0,l=a||o.dash||"";s.stroke(e,r||o.color),g.dashLine(e,l,i)},g.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,l=r||a.dash||"";o.select(this).call(s.stroke,n||a.color).call(g.dashLine,l,i)})},g.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=o.select(this);try{n.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),n.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,n){var a=n.marker,o=a.line,i=g.tryColorscale(a,""),l=g.tryColorscale(a,"line");r(t,e,n,i,l,a,o)},g.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=g.tryColorscale(n,""),a=g.tryColorscale(n,"line");t.each(function(t){g.singlePointStyle(t,o.select(this),e,r,a)})}},g.tryColorscale=function(t,e){var n=e?u.nestedProperty(t,e).get():t,r=n.colorscale,a=n.color;return r&&Array.isArray(a)?c.makeColorScaleFunc(c.extractScale(r,n.cmin,n.cmax)):u.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var n=o.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var a=t.tp||e.textposition,l=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",s=a.indexOf("left")!==-1?"end":a.indexOf("right")!==-1?"start":"middle",c=t.ts||e.textfont.size,u=t.mrc?t.mrc/.8+1:0;c=i(c)&&c>0?c:0,n.call(g.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(f.convertToTspans);var d=o.select(this.parentNode),h=n.selectAll("tspan.line"),p=((h[0].length||1)-1)*b+1,m=x[s]*u,v=.75*c+x[l]*u+(x[l]-1)*p*c/2;d.attr("transform","translate("+m+","+v+")"),p>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],o=[];for(n=1;n=A&&(o.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(s),u.extendFlat({},s)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=o.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":107,"../../lib":120,"../../lib/svg_text_utils":132,"../../registry":192,"../../traces/scatter/make_bubble_size_func":224,"../../traces/scatter/subtypes":229,"../color":25,"../colorscale":39,"./symbol_defs":49,d3:8,"fast-isnumeric":11}],49:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2); -return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:8}],50:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],51:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&["linear","log"].indexOf(n.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var m=g.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(n.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=r(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");l=!m.size(),l?m=e.append("path").classed("yerror",!0):u&&(m=m.transition().duration(n.duration).ease(n.easing)),m.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var v=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-v)+"v"+2*v+"m0,-"+v+"H"+i.xs,i.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":229,d3:8,"fast-isnumeric":11}],56:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":25,d3:8}],57:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":153}],58:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,l,n,r)}var i=r("source"),s=r("visible",!!i);if(!s)return e;r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var c={_fullLayout:n},u=["x","y"],f=0;f<2;f++)o.coerceRef(t,e,c,u[f],"paper");return e}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("../../plots/array_container_defaults"),l=t("./attributes"),s="images";e.exports=function(t,e){var n={name:s,handleItemDefaults:r};i(t,e,n)}},{"../../lib":120,"../../plots/array_container_defaults":145,"../../plots/cartesian/axes":148,"./attributes":57}],59:[function(t,e,n){"use strict";var r=t("d3"),a=t("../drawing"),o=t("../../plots/cartesian/axes"),i=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var n=r.select(this);if(!this.img||this.img.src!==e.source){n.attr("xmlns",i.svg);var a=new Promise(function(t){function r(){n.remove(),t()}var a=new Image;this.img=a,a.setAttribute("crossOrigin","anonymous"),a.onerror=r,a.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var r=t.toDataURL("image/png");n.attr("xlink:href",r)},n.on("error",r),n.on("load",t),a.src=e.source}.bind(this));t._promises.push(a)}}function n(e){var n=r.select(this),i=o.getFromId(t,e.xref),s=o.getFromId(t,e.yref),c=l._size,u=i?Math.abs(i.l2p(e.sizex)-i.l2p(0)):e.sizex*c.w,f=s?Math.abs(s.l2p(e.sizey)-s.l2p(0)):e.sizey*c.h,d=u*h.x[e.xanchor].offset,p=f*h.y[e.yanchor].offset,g=h.x[e.xanchor].sizing+h.y[e.yanchor].sizing,m=(i?i.r2p(e.x)+i._offset:e.x*c.w+c.l)+d,v=(s?s.r2p(e.y)+s._offset:c.h-e.y*c.h+c.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}n.attr({x:m,y:v,width:u,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=i?i._id:"",x=s?s._id:"",b=y+x;b&&n.call(a.setClipUrl,"clip"+l._uid+b)}for(var l=t._fullLayout,s=[],c=[],u=[],f=0;f=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],62:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":115,"../../plots/font_attributes":168,"../color/attributes":24}],63:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],64:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":120,"../../plots/layout_attributes":182,"../../registry":192,"./attributes":62,"./helpers":67}],65:[function(t,e,n){"use strict";function r(t,e){function n(n){v.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,v=Math.max(e.height,v)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,F,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,_=n.showlegend&&x(t.calcdata,v),M=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=k.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=k.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=k.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var S=L.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var z=S.selectAll("g.traces").data(f.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==k.enter().size();O&&(i(t,S,z),l(t));var N=0,P=n.width,E=0,D=n.height;i(t,S,z),v.height>D?s(t):l(t);var R=n._size,j=R.l+R.w*v.x,I=R.t+R.h*(1-v.y);w.isRightAnchor(v)?j-=v.width:w.isCenterAnchor(v)&&(j-=v.width/2),w.isBottomAnchor(v)?I-=v.height:w.isMiddleAnchor(v)&&(I-=v.height/2);var F=v.width,B=R.w;F>B?(j=R.l,F=B):(j+F>P&&(j=P-F),jH?(I=R.t,q=H):(I+q>D&&(I=D-q),In[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":120,"../../registry":192,"../../traces/pie/style_one":207,"../../traces/scatter/subtypes":229,"../color":25,"../drawing":48,d3:8}],70:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||v||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(m,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":120,"../color":25,"./attributes":74,"./button_attributes":75,"./constants":76}],78:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},a=S.line.width?S.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",S.opacity).call(_.stroke,a).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);z&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&f(t,o,S,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof n&&n?s[n]=r:x.isPlainObject(n)&&(s=n);var c=Object.keys(s);for(o=0;oX&&r>Z&&!t.shiftKey?M.getCursor(a/n,1-o/r):"move";k(e,i),U=i.split("-")[0]}function o(e){F=b.getFromId(t,n.xref),B=b.getFromId(t,n.yref),q=T.getDataToPixel(t,F),H=T.getDataToPixel(t,B,!0),V=T.getPixelToData(t,F),G=T.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(j=n.path,I=o+".path"):(u=q(n.x0),f=H(n.y0),d=q(n.x1),h=H(n.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uZ&&(c[S]=n[P]=G(l),c[z]=n[E]=G(s)),f-u>X&&(c[O]=n[D]=V(u),c[N]=n[R]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,v,x,_,w,A,L,C,S,z,O,N,P,E,D,R,j,I,F,B,q,H,V,G,U,X=10,Z=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();M.init(Y)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),M=t("../dragelement"),k=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults");e.exports={ -draw:r,drawOne:a}},{"../../lib":120,"../../lib/setcursor":130,"../../plotly":143,"../../plots/cartesian/axes":148,"../color":25,"../dragelement":46,"../drawing":48,"./constants":88,"./defaults":89,"./helpers":91,"./shape_defaults":93,"fast-isnumeric":11}],91:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],92:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":86,"./calc_autorange":87,"./defaults":89,"./draw":90}],93:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],m={_fullLayout:n},v=a.coerceRef(t,e,m,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==v?(y=a.getFromId(m,v),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=r.identity;var M=g+"0",k=g+"1",A=t[M],T=t[k];t[M]=x(t[M],!0),t[k]=x(t[k],!0),a.coercePosition(e,m,c,v,M,_),a.coercePosition(e,m,c,v,k,w),e[M]=b(e[M]),e[k]=b(e[k]),t[M]=A,t[k]=T}}return"path"===d?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":120,"../../plots/cartesian/axes":148,"./attributes":86,"./helpers":91}],94:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":115,"../../plots/animation_attributes":144,"../../plots/font_attributes":168,"../../plots/pad_attributes":183,"./constants":95}],95:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],96:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+S.railTouchRectClass).data([0]);r.enter().append("rect").classed(S.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,S.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),k.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+S.railRectClass).data([0]);n.enter().append("rect").classed(S.railRectClass,!0);var r=e.inputAreaLength-2*S.railInset;n.attr({width:r,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(n,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+S.groupClassName).data(n,a);s.enter().append("g").classed(S.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,S=O,M._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,M=t._fullLayout,k=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(S).attr("class",e),z.attr({"data-unformatted":S}).call(f);var O="Click to enter "+y+" title";t._context.editable?(S||p(),z.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",C)}},{"../../lib":120,"../../lib/svg_text_utils":132,"../../plotly":143,"../../plots/plots":184,"../color":25,"../drawing":48,d3:8,"fast-isnumeric":11}],100:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":115,"../../plots/font_attributes":168,"../../plots/pad_attributes":183,"../color/attributes":24}],101:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],102:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],107:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],108:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":23,"./components/images":60,"./components/legend":68,"./components/rangeselector":80,"./components/rangeslider":85,"./components/shapes":92,"./components/sliders":98,"./components/updatemenus":104,"./fonts/mathjax_config":109,"./lib/queue":128,"./plot_api/plot_schema":137,"./plot_api/register":138,"./plot_api/set_plot_config":139,"./plot_api/to_image":141,"./plot_api/validate":142,"./plotly":143,"./snapshot":197,"./snapshot/download":194,"./traces/scatter":219,d3:8,"es6-promise":9}],109:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],110:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){Array.isArray(t)&&(e[n]=t[r])}},{}],111:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":105,"fast-isnumeric":11}],112:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n); +return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:8}],50:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],51:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&["linear","log"].indexOf(n.type)!==-1,c=[];if(s){for(var u=l(o),f=0;f0;t.each(function(t){var e,f=t[0].trace,d=f.error_x||{},h=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=i.hasMarkers(f)&&f.marker.maxdisplayed>0;if(h.visible||d.visible){var g=a.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var m=g.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(n.duration).style("opacity",1),g.each(function(t){var e=a.select(this),i=r(t,s,c);if(!p||t.vis){var f;if(h.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var g=h.width;f="M"+(i.x-g)+","+i.yh+"h"+2*g+"m-"+g+",0V"+i.ys,i.noYS||(f+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");l=!m.size(),l?m=e.append("path").classed("yerror",!0):u&&(m=m.transition().duration(n.duration).ease(n.easing)),m.attr("d",f)}if(d.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var v=(d.copy_ystyle?h:d).width;f="M"+i.xh+","+(i.y-v)+"v"+2*v+"m0,-"+v+"H"+i.xs,i.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");l=!y.size(),l?y=e.append("path").classed("xerror",!0):u&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":229,d3:8,"fast-isnumeric":11}],56:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":25,d3:8}],57:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":153}],58:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,l,n,r)}var i=r("source"),s=r("visible",!!i);if(!s)return e;r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var c={_fullLayout:n},u=["x","y"],f=0;f<2;f++)o.coerceRef(t,e,c,u[f],"paper");return e}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("../../plots/array_container_defaults"),l=t("./attributes"),s="images";e.exports=function(t,e){var n={name:s,handleItemDefaults:r};i(t,e,n)}},{"../../lib":120,"../../plots/array_container_defaults":145,"../../plots/cartesian/axes":148,"./attributes":57}],59:[function(t,e,n){"use strict";var r=t("d3"),a=t("../drawing"),o=t("../../plots/cartesian/axes"),i=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var n=r.select(this);if(!this.img||this.img.src!==e.source){n.attr("xmlns",i.svg);var a=new Promise(function(t){function r(){n.remove(),t()}var a=new Image;this.img=a,a.setAttribute("crossOrigin","anonymous"),a.onerror=r,a.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var r=t.toDataURL("image/png");n.attr("xlink:href",r)},n.on("error",r),n.on("load",t),a.src=e.source}.bind(this));t._promises.push(a)}}function n(e){var n=r.select(this),i=o.getFromId(t,e.xref),s=o.getFromId(t,e.yref),c=l._size,u=i?Math.abs(i.l2p(e.sizex)-i.l2p(0)):e.sizex*c.w,f=s?Math.abs(s.l2p(e.sizey)-s.l2p(0)):e.sizey*c.h,d=u*h.x[e.xanchor].offset,p=f*h.y[e.yanchor].offset,g=h.x[e.xanchor].sizing+h.y[e.yanchor].sizing,m=(i?i.r2p(e.x)+i._offset:e.x*c.w+c.l)+d,v=(s?s.r2p(e.y)+s._offset:c.h-e.y*c.h+c.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}n.attr({x:m,y:v,width:u,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=i?i._id:"",x=s?s._id:"",b=y+x;b&&n.call(a.setClipUrl,"clip"+l._uid+b)}for(var l=t._fullLayout,s=[],c=[],u=[],f=0;f=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],62:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":115,"../../plots/font_attributes":168,"../color/attributes":24}],63:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],64:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("../../lib"),o=t("./attributes"),i=t("../../plots/layout_attributes"),l=t("./helpers");e.exports=function(t,e,n){function s(t,e){return a.coerce(h,p,o,t,e)}for(var c,u,f,d,h=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,f="left",u=1.1,d="bottom"):(c=0,f="left",u=-.1,d="top")}s("traceorder",m),l.isGrouped(e.legend)&&s("tracegroupgap"),s("x",c),s("xanchor",f),s("y",u),s("yanchor",d),a.noneOrAll(h,p,["x","y"])}}},{"../../lib":120,"../../plots/layout_attributes":182,"../../registry":192,"./attributes":62,"./helpers":67}],65:[function(t,e,n){"use strict";function r(t,e){function n(n){v.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=h.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,a.legend.font).text(c),e._context.editable&&!l?f.call(v.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(o.type)!==-1){var i=r.trace.transforms,l=i[i.length-1].direction;a=l+".legenditem.name"}else a="name";u.restyle(e,a,t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[];if(h.traceIs(l,"pie")){var f=o.label,d=n.indexOf(f);d===-1?n.push(f):n.splice(d,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),d=u[0].length||1;n=l*d,r=c.node()&&g.bBox(c.node()).width;var h=l*(.3+(1-d)/2);c.attr("y",h),u.attr("y",h)}n=Math.max(n,16)+3,a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=_.isGrouped(a);if(_.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,(t._context.editable?0:a.width)+40,n.height)});else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;ur.width-(r.margin.r+r.margin.l)&&(x=0,m+=v,a.height=a.height+v,v=0),f.setTranslate(this,o+x,5+o+e.height/2+m),a.width+=i+n,a.height=Math.max(a.height,e.height),x+=i+n,v=Math.max(e.height,v)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.each(function(e){var n=e[0],r=c.select(this).select(".legendtoggle");r.call(g.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var a="top";w.isBottomAnchor(n)?a="bottom":w.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(f.setTranslate,0,e),C.call(g.setRect,F,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,_=n.showlegend&&x(t.calcdata,v),M=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var T=k.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var L=k.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=k.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var S=L.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var z=S.selectAll("g.traces").data(f.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var O=0!==k.enter().size();O&&(i(t,S,z),l(t));var N=0,P=n.width,E=0,D=n.height;i(t,S,z),v.height>D?s(t):l(t);var R=n._size,j=R.l+R.w*v.x,I=R.t+R.h*(1-v.y);w.isRightAnchor(v)?j-=v.width:w.isCenterAnchor(v)&&(j-=v.width/2),w.isBottomAnchor(v)?I-=v.height:w.isMiddleAnchor(v)&&(I-=v.height/2);var F=v.width,B=R.w;F>B?(j=R.l,F=B):(j+F>P&&(j=P-F),jH?(I=R.t,q=H):(I+q>D&&(I=D-q),In[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),c=h.hasText(i),d=h.hasLines(i);if(l||c||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",u.mean,[.2,1]),p.ms=e("marker.size",u.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",u.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),c&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[u.minExtend(o,p)],a=u.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=m.selectAll("g.pointtext").data(c?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../registry"),u=t("../../lib"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":120,"../../registry":192,"../../traces/pie/style_one":207,"../../traces/scatter/subtypes":229,"../color":25,"../drawing":48,d3:8}],70:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,d=(1+u)/2,h=(1-u)/2,p=f.list(t,null,!0),g=0;g1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||v||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(m,n)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":120,"../color":25,"./attributes":74,"./button_attributes":75,"./constants":76}],78:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=d)));return p>=h?[h,p]:void 0}}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),i=t("./constants"),l=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=a.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var l=0;le;o--)d(t,o).selectAll('[data-index="'+(o-1)+'"]').attr("data-index",o),a(t,o)}function u(t,e,n,r){function a(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},a=S.line.width?S.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",S.opacity).call(_.stroke,a).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);z&&o.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&f(t,o,S,e)}var o,i;d(t,e).selectAll('[data-index="'+e+'"]').remove();var l=t.layout.shapes[e];if(l){var s={};"string"==typeof n&&n?s[n]=r:x.isPlainObject(n)&&(s=n);var c=Object.keys(s);for(o=0;oX&&r>Z&&!t.shiftKey?M.getCursor(a/n,1-o/r):"move";k(e,i),U=i.split("-")[0]}function o(e){F=b.getFromId(t,n.xref),B=b.getFromId(t,n.yref),q=T.getDataToPixel(t,F),H=T.getDataToPixel(t,B,!0),V=T.getPixelToData(t,F),G=T.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(j=n.path,I=o+".path"):(u=q(n.x0),f=H(n.y0),d=q(n.x1),h=H(n.y1),g=o+".x0",v=o+".y0",x=o+".x1",_=o+".y1"),uZ&&(c[S]=n[P]=G(l),c[z]=n[E]=G(s)),f-u>X&&(c[O]=n[D]=V(u),c[N]=n[R]=V(f))}e.attr("d",p(t,n))}var c,u,f,d,h,g,v,x,_,w,A,L,C,S,z,O,N,P,E,D,R,j,I,F,B,q,H,V,G,U,X=10,Z=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Y.element.getBoundingClientRect();M.init(Y)}function d(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function h(t,e,n){var r=b.getFromId(t,n.id,"x")._id,a=b.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function p(t,e){var n,r,a,o,i=e.type,l=b.getFromId(t,e.xref),s=b.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=T.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},s?(a=T.shapePositionToRange(s),o=function(t){return s._offset+s.r2p(a(t,!0))}):o=function(t){return c.t+c.h*(1-t)},"path"===i)return l&&"date"===l.type&&(r=T.decodeDate(r)),s&&"date"===s.type&&(o=T.decodeDate(o)),g(e.path,r,o);var u=r(e.x0),f=r(e.x1),d=o(e.y0),h=o(e.y1);if("line"===i)return"M"+u+","+d+"L"+f+","+h;if("rect"===i)return"M"+u+","+d+"H"+f+"V"+h+"H"+u+"Z";var p=(u+f)/2,m=(d+h)/2,v=Math.abs(p-u),y=Math.abs(m-d),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return o[r]?t=e(t):i[r]&&(t=n(t)),r++,r>l&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),a+s})}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,a=t.charAt(0),o=A.paramIsX[a],i=A.paramIsY[a],l=A.numParams[a],s=t.substr(1).replace(A.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),M=t("../dragelement"),k=t("../../lib/setcursor"),A=t("./constants"),T=t("./helpers"),L=t("./shape_defaults"),C=t("./defaults"); +e.exports={draw:r,drawOne:a}},{"../../lib":120,"../../lib/setcursor":130,"../../plotly":143,"../../plots/cartesian/axes":148,"../color":25,"../dragelement":46,"../drawing":48,"./constants":88,"./defaults":89,"./helpers":91,"./shape_defaults":93,"fast-isnumeric":11}],91:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(i(t,!0))},"date"===e.type&&(a=n.decodeDate(a))}else a=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return a},n.getPixelToData=function(t,e,r){var a,o=t._fullLayout._size;if(e){var i=n.rangeToShapePosition(e);a=function(t){return i(e.p2r(t-e._offset))}}else a=r?function(t){return 1-(t-o.t)/o.h}:function(t){return(t-o.l)/o.w};return a}},{}],92:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":86,"./calc_autorange":87,"./defaults":89,"./draw":90}],93:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n,l,s){function c(n,a){return r.coerce(t,e,o,n,a)}l=l||{},s=s||{};var u=c("visible",!s.itemIsNotPlainObject);if(!u)return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var f=t.path?"path":"rect",d=c("type",f),h=["x","y"],p=0;p<2;p++){var g=h[p],m={_fullLayout:n},v=a.coerceRef(t,e,m,g,"","paper");if("path"!==d){var y,x,b,_=.25,w=.75;"paper"!==v?(y=a.getFromId(m,v),b=i.rangeToShapePosition(y),x=i.shapePositionToRange(y)):x=b=r.identity;var M=g+"0",k=g+"1",A=t[M],T=t[k];t[M]=x(t[M],!0),t[k]=x(t[k],!0),a.coercePosition(e,m,c,v,M,_),a.coercePosition(e,m,c,v,k,w),e[M]=b(e[M]),e[k]=b(e[k]),t[M]=A,t[k]=T}}return"path"===d?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":120,"../../plots/cartesian/axes":148,"./attributes":86,"./helpers":91}],94:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),o=t("../../lib/extend").extendFlat,i=t("../../lib/extend").extendDeep,l=t("../../plots/animation_attributes"),s=t("./constants"),c={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:c,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:i({},a,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:l.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:o({},r,{})},font:o({},r,{}),activebgcolor:{valType:"color",dflt:s.gripBgActiveColor},bgcolor:{valType:"color",dflt:s.railBgColor},bordercolor:{valType:"color",dflt:s.railBorderColor},borderwidth:{valType:"number",min:0,dflt:s.railBorderWidth},ticklen:{valType:"number",min:0,dflt:s.tickLength},tickcolor:{valType:"color",dflt:s.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:s.minorTickLength}}},{"../../lib/extend":115,"../../plots/animation_attributes":144,"../../plots/font_attributes":168,"../../plots/pad_attributes":183,"./constants":95}],95:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],96:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);if(s){r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font);var c=r("currentvalue.visible");c&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),o.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.steps||[],l=e.steps=[],s=0;s0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+S.railTouchRectClass).data([0]);r.enter().append("rect").classed(S.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,S.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),k.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+S.railRectClass).data([0]);n.enter().append("rect").classed(S.railRectClass,!0);var r=e.inputAreaLength-2*S.railInset;n.attr({width:r,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(n,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(l.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+S.groupClassName).data(n,a);s.enter().append("g").classed(S.groupClassName,!0),s.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var c=0;c0||d<0){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,C=!0,S=O,M._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,M=t._fullLayout,k=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,C=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,C=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(S).attr("class",e),z.attr({"data-unformatted":S}).call(f);var O="Click to enter "+y+" title";t._context.editable?(S||p(),z.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",C)}},{"../../lib":120,"../../lib/svg_text_utils":132,"../../plotly":143,"../../plots/plots":184,"../color":25,"../drawing":48,d3:8,"fast-isnumeric":11}],100:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i=t("../../plots/pad_attributes"),l={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:l,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:o({},i,{}),font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":115,"../../plots/font_attributes":168,"../../plots/pad_attributes":183,"../color/attributes":24}],101:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],102:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}var i=a(t,e),s=r("visible",i.length>0);s&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,u,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(c.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&y(t),0!==n.length){var u=c.selectAll("g."+T.headerGroupClassName).data(n,a);u.enter().append("g").classed(T.headerGroupClassName,!0);var f=c.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&f.call(v).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){x.select(this).remove(),f.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var d=0;d",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],107:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],108:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":23,"./components/images":60,"./components/legend":68,"./components/rangeselector":80,"./components/rangeslider":85,"./components/shapes":92,"./components/sliders":98,"./components/updatemenus":104,"./fonts/mathjax_config":109,"./lib/queue":128,"./plot_api/plot_schema":137,"./plot_api/register":138,"./plot_api/set_plot_config":139,"./plot_api/to_image":141,"./plot_api/validate":142,"./plotly":143,"./snapshot":197,"./snapshot/download":194,"./traces/scatter":219,d3:8,"es6-promise":9}],109:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],110:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){Array.isArray(t)&&(e[n]=t[r])}},{}],111:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+/,i=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"").replace(i,"")),r(t)?Number(t):a}},{"../constants/numerical":105,"fast-isnumeric":11}],112:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../components/colorscale/get_scale"),i=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n); }else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(o(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var a=t.split("+"),o=0;o=h&&t<=p?t:s;if("string"!=typeof t&&"number"!=typeof t)return s;var e,r,a,i,l=String(t).trim().split(" ");if(l.length>2)return s;var c=l[0].split("-"),u=!0;""===c[0]&&(u=!1,c.splice(0,1));var g=c.length;if(g>3||3!==g&&l[1]||!g)return s;if(4===c[0].length)e=Number(c[0]);else{if(2!==c[0].length)return s;if(!u)return s;var m=(new Date).getFullYear();e=((Number(c[0])-m+70)%100+200)%100+m-70}if(!o(e))return s;var v=new Date(0,0,1);if(v.setFullYear(u?e:-e),c.length>1){if(r=Number(c[1])-1,c[1].length>2||!(r>=0&&r<=11))return s;if(v.setMonth(r),c.length>2){if(a=Number(c[2]),c[2].length>2||!(a>=1&&a<=31))return s;if(v.setDate(a),v.getDate()!==a)return s;if(l[1]){if(c=l[1].split(":"),c.length>3)return s;if(i=Number(c[0]),c[0].length>2||!c[0].length||!(i>=0&&i<=23))return s;if(v.setHours(i),v.getHours()!==i)return s;if(c.length>1)return a=v.getTime(),r=Number(c[1]),2===c[1].length&&r>=0&&r<=59?(a+=f*r,2===c.length?a:2!==c[2].split(".")[0].length?s:(t=Number(c[2]),t>=0&&t<60?a+t*d:s)):s}}}return v.getTime()},h=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==s};var g=90*c,m=3*u,v=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=h&&t<=p))return s;e||(e=0);var n=new Date(Math.floor(t)),o=a.time.format("%Y-%m-%d")(n),i=e0&&(r.push(a),a=[])}return r.push(a),r},n.makeLine=function(t,e){var n={};return n=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(n.trace=e),n},n.makePolygon=function(t,e){var n={};if(1===t.length)n={type:"Polygon",coordinates:t};else{for(var r=new Array(t.length),a=0;an?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.noop=function(){},a.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var a,o,i,l=Math.log(Math.pow(2,n))/Math.log(r),s="";for(a=2;l===1/0;a*=2)l=Math.log(Math.pow(2,n/a))/Math.log(r)*a;var c=l-Math.floor(l);for(a=0;a-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;r1?a+i[1]:"";if(o&&(i.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+o+"$2");return l+s}},{"./clean_number":111,"./coerce":112,"./dates":113,"./extend":115,"./filter_unique":116,"./filter_visible":117,"./is_array":121,"./is_plain_object":122,"./loggers":123,"./matrix":124,"./nested_property":125,"./notifier":126,"./search":129,"./stats":131,d3:8}],121:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],122:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],123:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],i=!1,d(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),d=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");lo||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],s=t[1];if(no||sl)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],m=r[0][1],v=0;for(c=1;cMath.max(u,g)||s>Math.max(f,m)))if(su||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":124}],128:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("./loggers");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;f90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;le[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;at.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":11}],132:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"
";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,m.indexOf(u.protocol)===-1?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({class:p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||r(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{ regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":106,"../constants/xmlns_namespaces":107,"../lib":120,d3:8}],133:[function(t,e,n){"use strict";var r=e.exports={},a=t("../plots/geo/constants").locationmodeToLayer,o=t("topojson-client").feature;r.getTopojsonName=function(t){return[t.scope.replace(/ /g,"-"),"_",t.resolution.toString(),"m"].join("")},r.getTopojsonPath=function(t,e){return t+e+".json"},r.getTopojsonFeatures=function(t,e){var n=a[t.locationmode],r=e.objects[n];return o(e,r).features}},{"../plots/geo/constants":170,"topojson-client":15}],134:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function a(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function o(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var i=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),s=t("../registry"),c=t("../lib"),u=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&c.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var a=f.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=u.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function s(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&l(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sO.range[0]?[1,2]:[2,1]);else{var N=O.range[0],P=O.range[1];"log"===b?(N<=0&&P<=0&&n(L+".autorange",!0),N<=0?N=P/1e6:P<=0&&(P=N/1e6),n(L+".range[0]",Math.log(N)/Math.LN10),n(L+".range[1]",Math.log(P)/Math.LN10)):(n(L+".range[0]",Math.pow(10,N)),n(L+".range[1]",Math.pow(10,P)))}else n(L+".autorange",!0)}if("reverse"===A)C.range?C.range.reverse():(n(L+".autorange",!0),C.range=[1,0]),S.autorange?h.docalc=!0:h.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var E=v.parts[1],D=v.parts[0],R=o[D]||[],j=R[E]||{};2===v.parts.length&&(null===b&&(e[m]="remove"),"add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?E===-1?(g[D]=R,delete g[m]):g[m]=j:x.log("???",e)),!r(j,"x")&&!r(j,"y")||x.containsAny(m,["color","opacity","align","dash"])||(h.docalc=!0);var I=w.getComponentMethod(D,"drawOne");I(t,E,v.parts.slice(2).join("."),e[m]),delete e[m]}else if(M.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])z.manageArrayContainers(v,b,g),h.doplot=!0;else{var F=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?h.doplot=!0:0===v.parts[0].indexOf("geo")?h.doplot=!0:0===v.parts[0].indexOf("ternary")?h.doplot=!0:"paper_bgcolor"===m?h.doplot=!0:!i._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?h.docalc=!0:v.parts[0].indexOf("legend")!==-1?h.dolegend=!0:m.indexOf("title")!==-1?h.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(F,["tick","exponent","grid","zeroline"])?h.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?h.doticks=h.dolayoutstyle=!0:v.parts.length>1&&F.indexOf("line")!==-1?h.dolayoutstyle=!0:v.parts.length>1&&"mirror"===F?h.doticks=h.dolayoutstyle=!0:"margin.pad"===m?h.doticks=h.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?h.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?h.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(h.doplot=!0):h.doplot=!0,v.set(b)}}}var B=t._fullLayout.width,q=t._fullLayout.height;M.supplyDefaults(t),t.layout.autosize&&M.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==q;return H&&(h.docalc=!0),(h.doplot||h.docalc)&&(h.layoutReplot=!0),{flags:h,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];m.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(C.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var o=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=o.append("g").classed("imagelayer",!0),n._shapeUpperLayer=o.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),M=t("../plots/plots"),k=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),T=t("../components/drawing"),L=t("../components/errorbars"),C=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),z=t("./helpers"),O=t("./subroutines");y.plot=function(t,e,n,r){function i(){if(_)return y.addFrames(t,_)}function l(){for(var e=N._basePlotModules,n=0;n=l.length?l[0]:l[t]:l}function a(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function o(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=z.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var i=t._transitionData;i._frameQueue||(i._frameQueue=[]),n=M.supplyAnimationDefaults(n);var l=n.transition,s=n.frame;return void 0===i._frameWaitingCnt&&(i._frameWaitingCnt=0),new Promise(function(s,c){function u(){if(0!==i._frameQueue.length){for(;i._frameQueue.length;){var e=i._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var l=0;li._timeToNext&&h()};e()}function g(t){return Array.isArray(l)?y>=l.length?t.transitionOpts=l[y]:t.transitionOpts=l[0]:t.transitionOpts=l,y++,t}var m,v,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),k=!_&&!w&&x.isPlainObject(e);if(k)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&LL)&&C.push(v);b=C}}b.length>0?f(b):(t.emit("plotly_animated"),s())})},y.addFrames=function(t,e,n){if(t=z.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,a,o,i,l=t._transitionData._frames,s=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var c=l.length+2*e.length,u=[];for(r=e.length-1;r>=0;r--)u.push({frame:M.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:c+r});u.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(a=u[r].frame,!a.name)for(;s[a.name="frame "+t._transitionData._counter++];);if(s[a.name]){for(o=0;o=0;n--)r=e[n],o.push({type:"delete",index:r}),i.unshift({type:"insert",index:r,value:a[r]});var l=M.modifyFrames,s=M.modifyFrames,c=[t,i],u=[t,o];return _&&_.add(t,l,c,s,u),M.modifyFrames(t,o)},y.purge=function(t){t=z.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return M.cleanPlot([],{},n,e),M.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":48,"../components/errorbars":54,"../constants/xmlns_namespaces":107,"../lib":120,"../lib/events":114,"../lib/queue":128,"../lib/svg_text_utils":132,"../plotly":143,"../plots/cartesian/graph_interact":155,"../plots/plots":184,"../plots/polar":187,"../registry":192,"./helpers":134,"./subroutines":140,d3:8,"fast-isnumeric":11}],136:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],137:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:y},n={}):(e=d.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,_(r,p),_(r,e.attributes),n.attributes&&_(r,n.attributes),r.type=t;var a={meta:e.meta||{},attributes:i(r)};if(e.layoutAttributes){var o={};_(o,e.layoutAttributes),a.layoutAttributes=i(o)}return a}function a(){var t={};return _(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var n=d.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)u(t,n,"xaxis"),u(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;u(t,n,r)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.layoutAttributes&&(Array.isArray(n.layoutNodes)?n.layoutNodes.forEach(function(e){f(t,n,e+n.name)}):f(t,n,n.name))}),{layoutAttributes:i(t)}}function o(t){var e=d.transformsRegistry[t];return{attributes:i(e.attributes)}}function i(t){return l(t),s(t),t}function l(t){function e(t){return{valType:"string"}}function r(t,r,a){n.isValObject(t)?"data_array"===t.valType?(t.role="data",a[r+"src"]=e(r)):t.arrayOk===!0&&(a[r+"src"]=e(r)):h.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function s(t){function e(t,e,n){if(t){var r=t[M];r&&(delete t[M],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function c(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function u(t,e,n){var r=h.nestedProperty(t,n),a=_({},e.layoutAttributes);a[w]=!0,r.set(a)}function f(t,e,n){var r=h.nestedProperty(t,n),a=_(r.get()||{},e.layoutAttributes);r.set(a)}var d=t("../registry"),h=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=h.extendFlat,_=h.extendDeep,w="_isSubplotObj",M="_isLinkedToArray",k="_deprecated",A=[w,M,k];n.IS_SUBPLOT_OBJ=w,n.IS_LINKED_TO_ARRAY=M,n.DEPRECATED=k,n.UNDERSCORE_ATTRS=A,n.get=function(){var t={};d.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(d.transformsRegistry).forEach(function(t){e[t]=o(t)}),{defs:{valObjects:h.valObjects,metaKeys:A.concat.role},traces:t,layout:a(),transforms:e,frames:i(m),animation:i(v)}},n.crawl=function(t,e,r){var a=r||0;Object.keys(t).forEach(function(r){var o=t[r];A.indexOf(r)===-1&&(e(o,r,t,a),n.isValObject(o)||h.isPlainObject(o)&&n.crawl(o,e,a+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,i,l){o=o.slice(0,l).concat([n]);var s="data_array"===e.valType||e.arrayOk===!0;if(s){var c=r(o),u=h.nestedProperty(t,c).get();Array.isArray(u)&&a.push(c)}}function r(t){return t.join(".")}var a=[],o=[];if(n.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l1)};d(e.width)&&d(e.height)||r(new Error("Height and width should be pixel values."));var h=s(t,{format:"png",height:e.height,width:e.width}),p=h.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=l.getRedrawFunc(p);o.plot(p,h.data,h.layout,h.config).then(g).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/cloneplot"),c=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg");e.exports=r},{"../lib":120,"../plotly":143,"../snapshot/cloneplot":193,"../snapshot/helpers":196,"../snapshot/svgtoimg":198,"../snapshot/tosvg":200,"fast-isnumeric":11}],142:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=n.length,v=0;vu&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=z&&a<=10||e>=15*z)t._tickround="d";else if(e>=N&&a<=16||e>=O)t._tickround="M";else if(e>=P&&a<=19||e>=N)t._tickround="S";else{var o=_.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(x(e)||"L"===e.charAt(0)){var i=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(i[0]),Math.abs(i[1])),s=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(s)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((s-1)/3):t._tickexponent=s)}else t._tickround=null}function i(t,e){var n=t.match(Y),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o,l=e.x,s=t._tickround,c=s,u=new Date(l);n&&t.hoverformat?o=i(t.hoverformat,l):t.tickformat?o=i(t.tickformat,l):(r&&(x(s)?s+=2:s={y:"m",m:"d",d:"M",M:"S",S:2}[s]),"y"===s?o=H(u):"m"===s?o=V(u):"d"===s?(n||(a="
"+H(u)),o=G(u)):(n||(a="
"+U(u)),o=X(u),"M"!==s?(o+=Z(u),"S"!==s&&(o+=d(y.round(v(l/1e3,1),4),t,"none",n).substr(1))):"d"===c&&(o=G(u)+" "+o))),!a||t._inCalcTicks&&a===t._prevSuffix||(o+=a,t._prevSuffix=a),e.text=o}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(i<0?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=t<0,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat,u=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(f),i=(Number(f._tickround)||0)+4,s=f._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var d=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),t12||s<-15)?t+="e"+g:"E"===l?t+="E"+g:"power"===l?t+="\xd710"+g+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=W[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r1&&e.push(e.pop().concat(e.shift()))}}}function Fe darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});as.forEach(function(t,e){as.set(t,xt(e))}),uo.functor=Lt,uo.xhr=St(x),uo.dsv=function(t,e){function r(t,r,a){arguments.length<3&&(a=r,r=null);var o=Ct(t,e,null==r?n:i(r),a);return o.row=function(t){return arguments.length?o.response(null==(r=t)?n:i(t)):r},o}function n(t){return r.parse(t.responseText)}function i(t){return function(e){return r.parse(e.responseText,t)}}function a(e){return e.map(o).join(t)}function o(t){return s.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var s=new RegExp('["'+t+"\n]"),l=t.charCodeAt(0);return r.parse=function(t,e){var n;return r.parseRows(t,function(t,r){if(n)return n(t,r-1);var i=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");n=e?function(t,r){return e(i(t),r)}:i})},r.parseRows=function(t,e){function r(){if(c>=u)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ds=uo.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=uo.round(t,zt(t,e))).toFixed(Math.max(0,Math.min(20,zt(t*(1+1e-15),e))))}}),ps=uo.time={},gs=Date;Ut.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){vs.setUTCDate.apply(this._,arguments)},setDay:function(){vs.setUTCDay.apply(this._,arguments)},setFullYear:function(){vs.setUTCFullYear.apply(this._,arguments)},setHours:function(){vs.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){vs.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){vs.setUTCMinutes.apply(this._,arguments)},setMonth:function(){vs.setUTCMonth.apply(this._,arguments)},setSeconds:function(){vs.setUTCSeconds.apply(this._,arguments)},setTime:function(){vs.setTime.apply(this._,arguments)}};var vs=Date.prototype;ps.year=Ht(function(t){return t=ps.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),ps.years=ps.year.range,ps.years.utc=ps.year.utc.range,ps.day=Ht(function(t){var e=new gs(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),ps.days=ps.day.range,ps.days.utc=ps.day.utc.range,ps.dayOfYear=function(t){var e=ps.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var r=ps[t]=Ht(function(t){return(t=ps.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var r=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});ps[t+"s"]=r.range,ps[t+"s"].utc=r.utc.range,ps[t+"OfYear"]=function(t){var r=ps.year(t).getDay();return Math.floor((ps.dayOfYear(t)+(r+e)%7)/7)}}),ps.week=ps.sunday,ps.weeks=ps.sunday.range,ps.weeks.utc=ps.sunday.utc.range,ps.weekOfYear=ps.sundayOfYear;var ms={"-":"",_:" ",0:"0"},ys=/^\s*\d+/,bs=/^%/;uo.locale=function(t){return{numberFormat:Bt(t),timeFormat:qt(t)}};var xs=uo.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"]});uo.format=xs.numberFormat,uo.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,_s),he(_s.s,this.s,this),this.s?this.t+=_s.t:this.s=_s.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var _s=new fe;uo.geo.stream=function(t,e){t&&ws.hasOwnProperty(t.type)?ws[t.type](t,e):de(t,e)};var ws={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nd&&(d=e)}function e(e,r){var n=me([e*Vo,r*Vo]);if(m){var i=be(m,n),a=[i[1],-i[0],0],o=be(a,i);we(o),o=Ae(o);var l=e-p,u=l>0?1:-1,g=o[0]*qo*u,v=xo(l)>180;if(v^(u*pd&&(d=y)}else if(g=(g+360)%360-180,v^(u*pd&&(d=r);v?es(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e):h>=c?(eh&&(h=e)):e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,r);m=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=h,_.point=t,m=null}function i(t,r){if(m){var n=t-p;y+=xo(n)>180?n+(n>0?360:-360):n}else g=t,v=r;Ts.point(t,r),e(t,r)}function a(){Ts.lineStart()}function o(){i(g,v),Ts.lineEnd(),xo(y)>zo&&(c=-(h=180)),x[0]=c,x[1]=h,m=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tzo?d=90:y<-zo&&(f=-90),x[0]=c,x[1]=h}};return function(t){d=h=-(c=f=1/0),b=[],uo.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,i=b[0],a=[i];ns(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):a.push(i=r);for(var o,r,p=-(1/0),e=a.length-1,n=0,i=a[e];n<=e;i=r,++n)r=a[n],(o=s(i[1],r[0]))>p&&(p=o,c=r[0],h=i[1])}return b=x=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){Es=Ls=Ss=Cs=Rs=Os=Is=Ps=Ns=Ds=zs=0,uo.geo.stream(t,Fs);var e=Ns,r=Ds,n=zs,i=e*e+r*r+n*n;return i=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},t.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()}}},t.precision=function(e){return arguments.length?(a.precision(e),o.precision(e),s.precision(e),t):a.precision()},t.scale=function(e){return arguments.length?(a.scale(e),o.scale(.35*e),s.scale(e),t.translate(a.translate())):a.scale()},t.translate=function(e){if(!arguments.length)return a.translate();var u=a.scale(),c=+e[0],f=+e[1];return r=a.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,n=o.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+zo,f+.12*u+zo],[c-.214*u-zo,f+.234*u-zo]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+zo,f+.166*u+zo],[c-.115*u-zo,f+.234*u-zo]]).stream(l).point,t},t.scale(1070)};var Us,Hs,Vs,qs,Gs,Xs,Ys={point:A,lineStart:A,lineEnd:A,polygonStart:function(){Hs=0,Ys.lineStart=We},polygonEnd:function(){Ys.lineStart=Ys.lineEnd=Ys.point=A,Us+=xo(Hs/2)}},Ws={point:Ze,lineStart:A,lineEnd:A,polygonStart:A,polygonEnd:A},Zs={point:Ke,lineStart:Je,lineEnd:tr,polygonStart:function(){Zs.lineStart=er},polygonEnd:function(){Zs.point=Ke,Zs.lineStart=Je,Zs.lineEnd=tr}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),uo.geo.stream(t,o)),a.result()}function e(){return o=null,t}var r,n,i,a,o,s=4.5;return t.area=function(t){return Us=0,uo.geo.stream(t,i(Ys)),Us},t.centroid=function(t){return Ss=Cs=Rs=Os=Is=Ps=Ns=Ds=zs=0,uo.geo.stream(t,i(Zs)),zs?[Ns/zs,Ds/zs]:Ps?[Os/Ps,Is/Ps]:Rs?[Ss/Rs,Cs/Rs]:[NaN,NaN]},t.bounds=function(t){return Gs=Xs=-(Vs=qs=1/0),uo.geo.stream(t,i(Ws)),[[Vs,qs],[Gs,Xs]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):x,e()):r},t.context=function(t){return arguments.length?(a=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&a.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(a.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var r=new ar(e);for(var n in t)r[n]=t[n];return r}}},ar.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()}},uo.geo.projection=sr,uo.geo.projectionMutator=lr,(uo.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,uo.geo.rotation=function(t){function e(e){return e=t(e[0]*Vo,e[1]*Vo),e[0]*=qo,e[1]*=qo,e}return t=hr(t[0]%360*Vo,t[1]*Vo,t.length>2?t[2]*Vo:0),e.invert=function(e){return e=t.invert(e[0]*Vo,e[1]*Vo),e[0]*=qo,e[1]*=qo,e},e},fr.invert=cr,uo.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=hr(-t[0]*Vo,-t[1]*Vo,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=qo,t[1]*=qo}}),{type:"Polygon",coordinates:[i]}}var e,r,n=[0,0],i=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=vr((e=+n)*Vo,i*Vo),t):e},t.precision=function(n){return arguments.length?(r=vr(e*Vo,(i=+n)*Vo),t):i},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Vo,i=t[1]*Vo,a=e[1]*Vo,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((r=f*o)*r+(r=u*c-l*f*s)*r),l*c+u*f*s)},uo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return uo.range(Math.ceil(a/v)*v,i,v).map(h).concat(uo.range(Math.ceil(u/m)*m,l,m).map(d)).concat(uo.range(Math.ceil(n/p)*p,r,p).filter(function(t){return xo(t%v)>zo}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return xo(t%m)>zo}).map(f))}var r,n,i,a,o,s,l,u,c,f,h,d,p=10,g=p,v=90,m=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[h(a).concat(d(l).slice(1),h(i).reverse().slice(1),d(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(a=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],a>i&&(e=a,a=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[a,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(v=+e[0],m=+e[1],t):[v,m]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,o,90),f=br(n,r,y),h=yr(u,l,90),d=br(a,i,y),t):y},t.majorExtent([[-180,-90+zo],[180,90-zo]]).minorExtent([[-180,-80-zo],[180,80+zo]])},uo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}var e,r,n=xr,i=_r;return t.distance=function(){return uo.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(i=e,r="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},uo.geo.interpolate=function(t,e){return wr(t[0]*Vo,t[1]*Vo,e[0]*Vo,e[1]*Vo)},uo.geo.length=function(t){return Qs=0,uo.geo.stream(t,$s),Qs};var Qs,$s={sphere:A,point:A,lineStart:Ar,lineEnd:A,polygonStart:A,polygonEnd:A},Ks=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Ks)}).raw=Ks;var Js=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr(Js)}).raw=Js,(uo.geo.conicConformal=function(){return Xe(Mr)}).raw=Mr,(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var tl=kr(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(tl)}).raw=tl,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Ho]},(uo.geo.mercator=function(){return Lr(Er)}).raw=Er;var el=kr(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr(el)}).raw=el;var rl=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(rl)}).raw=rl,Sr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ho]},(uo.geo.transverseMercator=function(){var t=Lr(Sr),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=Sr,uo.geom={},uo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Lt(r),a=Lt(n),o=t.length,s=[],l=[];for(e=0;e=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e=n&&u.x<=a&&u.y>=i&&u.y<=o?[[n,o],[a,o],[a,i],[n,i]]:[];c.point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/zo)*zo,y:Math.round(o(t,e)/zo)*zo,i:e}})}var n=Cr,i=Rr,a=n,o=i,s=fl;return t?e(t):(e.links=function(t){return un(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return un(r(t)).cells.forEach(function(r,n){for(var i,a,o=r.site,s=r.edges.sort(Xr),l=-1,u=s.length,c=s[u-1].edge,f=c.l===o?c.r:c.l;++l=u,h=n>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),f?i=u:s=u,h?o=c:l=c,a(t,e,r,n,i,o,s,l)}var c,f,h,d,p,g,v,m,y,b=Lt(s),x=Lt(l);if(null!=e)g=e,v=r,m=n,y=i;else if(m=y=-(g=v=1/0),f=[],h=[],p=t.length,o)for(d=0;dm&&(m=c.x),c.y>y&&(y=c.y),f.push(c.x),h.push(c.y);else for(d=0;dm&&(m=_),w>y&&(y=w),f.push(_),h.push(w)}var A=m-g,k=y-v;A>k?y=v+A:m=g+k;var M=pn();if(M.add=function(t){a(M,t,+b(t,++d),+x(t,d),g,v,m,y)},M.visit=function(t){gn(t,M,g,v,m,y)},M.find=function(t){return vn(M,t[0],t[1],g,v,m,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=gl.get(r)||pl,n=vl.get(n)||x,An(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=Dn,uo.interpolateHsl=zn,uo.interpolateLab=Fn,uo.interpolateRound=Bn,uo.transform=function(t){var e=ho.createElementNS(uo.ns.prefix.svg,"g");return(uo.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new jn(r?r.matrix:ml)})(t)},jn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ml={a:1,b:0,c:0,d:1,e:0,f:0};uo.interpolateTransform=Zn,uo.layout={},uo.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r0?i=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),r=It(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;l=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;n&&(a.value=0),a.children=u}else n&&(a.value=+n.call(t,a,a.depth)||0),delete a.children;return li(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=fi,r=ui,n=ci;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0),(r=e.parent)&&(r.value+=e.value); })),e},t},uo.layout.partition=function(){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,u=-1;for(n=e.value?n/e.value:0;++us&&(s=n),o.push(n)}for(r=0;r0)for(a=-1;++a=c[0]&&s<=c[1]&&(o=l[uo.bisect(f,s,1,d)-1],o.y+=p,o.push(t[a]));return l}var e=!0,r=Number,n=Ai,i=_i;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=Lt(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:Lt(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},uo.layout.pack=function(){function t(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,Li),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=f}),li(s,Li),li(s,function(t){t.r-=f})}return Ri(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),o}var e,r=uo.layout.hierarchy().sort(ki),n=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},oi(t,r)},uo.layout.tree=function(){function t(t,i){var c=o.call(this,t,i),f=c[0],h=e(f);if(li(h,r),h.parent.m=-h.z,si(h,n),u)si(f,a);else{var d=f,p=f,g=f;si(f,function(t){t.xp.x&&(p=t),t.depth>g.depth&&(g=t)});var v=s(d,p)/2-d.x,m=l[0]/(p.x+s(p,d)/2+v),y=l[1]/(g.depth||1);si(f,function(t){t.x=(t.x+v)*m,t.y=t.depth*y})}return c}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var i,a=e.children,o=0,s=a.length;o0&&(Di(Fi(o,t,r),t,n),u+=n,c+=n),f+=o.m,u+=i.m,h+=l.m,c+=a.m;o&&!Ni(a)&&(a.t=o,a.m+=f-c),i&&!Pi(l)&&(l.t=i,l.m+=u-h,r=t)}return r}function a(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Ii,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?a:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:a,t):u?l:null},oi(t,o)},uo.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=ji(e),t.y=Bi(e)):(t.x=o?u+=r(t,o):0,t.y=0,o=t)});var c=Ui(l),f=Hi(l),h=c.x-r(c,f)/2,d=f.x+r(f,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*n[0],t.y=(l.y-t.y)*n[1]}:function(t){t.x=(t.x-h)/(d-h)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=uo.layout.hierarchy().sort(null).value(null),r=Ii,n=[1,1],i=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(i=null==(n=e),t):i?null:n},t.nodeSize=function(e){return arguments.length?(i=null!=(n=e),t):i?n:null},oi(t,e)},uo.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,a=t.length;++i0;)c.push(o=h[l-1]),c.area+=o.area,"squarify"!==d||(s=n(c,g))<=p?(h.pop(),p=s):(c.area-=c.pop().area,i(c,g,u,!1),g=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,g,u,!0),c.length=c.area=0),a.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var a,o=f(e),s=n.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(i(l,a.z?o.dx:o.dy,o,!s.length),l.length=l.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=r));return n*=n,e*=e,n?Math.max(e*i*p/n,n/(e*a*p)):1/0}function i(t,e,r,n){var i,a=-1,o=t.length,s=r.x,u=r.y,c=e?l(t.area/e):0;if(e==r.dx){for((n||c>r.dy)&&(c=r.dy);++ar.dx)&&(c=r.dx);++a1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=uo.random.normal.apply(uo,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=uo.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;rf?0:1;if(u=Uo)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,v,m,y,b,x,_,w,A,k,M,T=0,E=0,L=[];if((m=(+l.apply(this,arguments)||0)/2)&&(v=a===Ol?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(E*=-1),u&&(E=nt(v/u*Math.sin(m))),t&&(T=nt(v/t*Math.sin(m)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(f-E),_=u*Math.sin(f-E);var S=Math.abs(f-c-2*E)<=Bo?0:1;if(E&&ba(y,b,x,_)===d^S){var C=(c+f)/2;y=u*Math.cos(C),b=u*Math.sin(C),x=_=null}}else y=b=0;if(t){w=t*Math.cos(f-T),A=t*Math.sin(f-T),k=t*Math.cos(c+T),M=t*Math.sin(c+T);var R=Math.abs(c-f+2*T)<=Bo?0:1;if(T&&ba(w,A,k,M)===1-d^R){var O=(c+f)/2;w=t*Math.cos(O),A=t*Math.sin(O),k=M=null}}else w=A=0;if(h>zo&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){g=tBo)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var a=xr,o=_r,s=qa,l=va,u=ma;return t.radius=function(e){return arguments.length?(s=Lt(e),t):s},t.source=function(e){return arguments.length?(a=Lt(e),t):a},t.target=function(e){return arguments.length?(o=Lt(e),t):o},t.startAngle=function(e){return arguments.length?(l=Lt(e),t):l},t.endAngle=function(e){return arguments.length?(u=Lt(e),t):u},t},uo.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=r.call(this,t,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return l=l.map(n),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=xr,r=_r,n=Ga;return t.source=function(r){return arguments.length?(e=Lt(r),t):e},t.target=function(e){return arguments.length?(r=Lt(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},uo.svg.diagonal.radial=function(){var t=uo.svg.diagonal(),e=Ga,r=t.projection;return t.projection=function(t){return arguments.length?r(Xa(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(zl.get(e.call(this,t,n))||Za)(r.call(this,t,n))}var e=Wa,r=Ya;return t.type=function(r){return arguments.length?(e=Lt(r),t):e},t.size=function(e){return arguments.length?(r=Lt(e),t):r},t};var zl=uo.map({circle:Za,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Bl)),r=e*Bl;return"M0,"+-e+"L"+r+",0 0,"+e+" "+-r+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/Fl),r=e*Fl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Fl),r=e*Fl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=zl.keys();var Fl=Math.sqrt(3),Bl=Math.tan(30*Vo);So.transition=function(t){for(var e,r,n=jl||++ql,i=to(t),a=[],o=Ul||{time:Date.now(),ease:Ln,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",f[1]-f[0])}function i(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function a(){function a(){32==uo.event.keyCode&&(S||(b=null,R[0]-=f[1],R[1]-=h[1],S=2),T())}function g(){32==uo.event.keyCode&&2==S&&(R[0]+=f[1],R[1]+=h[1],S=0,T())}function v(){var t=uo.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),S||(uo.event.altKey?(b||(b=[(f[0]+f[1])/2,(h[0]+h[1])/2]),R[0]=f[+(t[0]>>31},e.exports.exponent=function(t){var r=e.exports.hi(t);return(r<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){var r=e.exports.hi(t);return!(2146435072&r)}}).call(this,t("buffer").Buffer)},{buffer:38}],57:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(i<=0)return[];var a,o=new Array(i);if(r===t.length-1)for(a=0;a0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=a},{}],58:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;n0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],a=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(s=a;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(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],61:[function(t,e,r){"use strict";function n(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}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],62:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=a}function i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function a(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}function l(t,e){if(e.left){var r=l(t,e.left);if(r)return r}var r=t(e.key,e.value);return r?r:e.right?l(t,e.right):void 0}function u(t,e,r,n){var i=e(t,n.key);if(i<=0){if(n.left){var a=u(t,e,r,n.left);if(a)return a}var a=r(n.key,n.value);if(a)return a}if(n.right)return u(t,e,r,n.right)}function c(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=c(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return c(t,e,r,n,i.right)}function f(t,e){this.tree=t,this._stack=e}function h(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t._color=e._color,t._count=e._count}function d(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=m);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===v){if(n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=m,r._color=m,s._color=m,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}return void(t[l-1]=n)}if(n.left&&n.left._color===v){if(n=r.right=i(n),s=n.left=i(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=m,n._color=m,e._color=m,o(r),o(n),o(s),l>1){var u=t[l-2];u.left===r?u.left=s:u.right=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.right=a(v,n));r.right=a(v,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=v,o(r),o(n),l>1){var u=t[l-2];u.left===r?u.left=n:u.right=n}t[l-1]=n,t[l]=r,l+11){var u=t[l-2];u.right===r?u.right=n:u.left=n}return void(t[l-1]=n)}if(n.right&&n.right._color===v){if(n=r.left=i(n),s=n.right=i(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=m,n._color=m,e._color=m,o(r),o(n),o(s),l>1){var u=t[l-2];u.right===r?u.right=s:u.left=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.left=a(v,n));r.left=a(v,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=v,o(r),o(n),l>1){var u=t[l-2];u.right===r?u.right=n:u.left=n}t[l-1]=n,t[l]=r,l+1e?1:0}function g(t){return new s(t||p,null)}e.exports=g;var v=0,m=1,y=s.prototype;Object.defineProperty(y,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(y,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(y,"length",{get:function(){return this.root?this.root._count:0}}),y.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],u=[];i;){var c=r(t,i.key);l.push(i),u.push(c),i=c<=0?i.left:i.right}l.push(new n(v,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){var i=l[f];u[f]<=0?l[f]=new n(i._color,i.key,i.value,l[f+1],i.right,i._count+1):l[f]=new n(i._color,i.key,i.value,i.left,l[f+1],i._count+1)}for(var f=l.length-1;f>1;--f){var h=l[f-1],i=l[f];if(h._color===m||i._color===m)break;var d=l[f-2];if(d.left===h)if(h.left===i){var p=d.right;if(!p||p._color!==v){if(d._color=v,d.left=h.right,h._color=m,h.right=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3){var g=l[f-3];g.left===d?g.left=h:g.right=h}break}h._color=m,d.right=a(m,p),d._color=v,f-=1}else{var p=d.right;if(!p||p._color!==v){if(h.right=i.left,d._color=v,d.left=i.right,i._color=m,i.left=h,i.right=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3){var g=l[f-3];g.left===d?g.left=i:g.right=i}break}h._color=m,d.right=a(m,p),d._color=v,f-=1}else if(h.right===i){var p=d.left;if(!p||p._color!==v){if(d._color=v,d.right=h.left,h._color=m,h.left=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3){var g=l[f-3];g.right===d?g.right=h:g.left=h}break}h._color=m,d.left=a(m,p),d._color=v,f-=1}else{var p=d.left;if(!p||p._color!==v){if(h.left=i.right,d._color=v,d.right=i.left,i._color=m,i.right=h,i.left=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3){var g=l[f-3];g.right===d?g.right=i:g.left=i}break}h._color=m,d.left=a(m,p),d._color=v,f-=1}}return l[0]._color=m,new s(r,l[0])},y.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return c(e,r,this._compare,t,this.root)}},Object.defineProperty(y,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new f(this,t)}}),Object.defineProperty(y,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new f(this,t)}}),y.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,[])},y.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)},y.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)},y.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)},y.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)},y.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var i=e(t,r.key);if(n.push(r),0===i)return new f(this,n);r=i<=0?r.left:r.right}return new f(this,[])},y.remove=function(t){var e=this.find(t);return e?e.remove():this},y.get=function(t){for(var e=this._compare,r=this.root;r;){var n=e(t,r.key);if(0===n)return r.value;r=n<=0?r.left:r.right}};var b=f.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new f(this.tree,this._stack.slice())},b.remove=function(){var t=this._stack;if(0===t.length)return this.tree;var e=new Array(t.length),r=t[t.length-1];e[e.length-1]=new n(r._color,r.key,r.value,r.left,r.right,r._count);for(var i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var a=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var o=e[a-1];e.push(new n(r._color,o.key,o.value,r.left,r.right,r._count)),e[a-1].key=r.key,e[a-1].value=r.value;for(var i=e.length-2;i>=a;--i)r=e[i],e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count);e[a-1].left=e[a]}if(r=e[e.length-1],r._color===v){var l=e[e.length-2];l.left===r?l.left=null:l.right===r&&(l.right=null),e.pop();for(var i=0;i0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(b,"index",{get:function(){var t=0,e=this._stack;if(0===e.length){var r=this.tree.root;return r?r._count:0}e[e.length-1].left&&(t=e[e.length-1].left._count);for(var n=e.length-2;n>=0;--n)e[n+1]===e[n].right&&(++t,e[n].left&&(t+=e[n].left._count));return t},enumerable:!0}),b.next=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.right)for(e=e.right;e;)t.push(e),e=e.left;else for(t.pop();t.length>0&&t[t.length-1].right===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(b,"hasNext",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].right)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].left===t[e])return!0;return!1}}),b.update=function(t){var e=this._stack;if(0===e.length)throw new Error("Can't update empty node!");var r=new Array(e.length),i=e[e.length-1];r[r.length-1]=new n(i._color,i.key,t,i.left,i.right,i._count);for(var a=e.length-2;a>=0;--a)i=e[a],i.left===e[a+1]?r[a]=new n(i._color,i.key,i.value,r[a+1],i.right,i._count):r[a]=new n(i._color,i.key,i.value,i.left,r[a+1],i._count);return new s(this.tree._compare,r[0])},b.prev=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.left)for(e=e.left;e;)t.push(e),e=e.right;else for(t.pop();t.length>0&&t[t.length-1].left===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(b,"hasPrev",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].left)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].right===t[e])return!0;return!1}})},{}],63:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=s[0],r=s.length-1;r>0;--r)e+=s[r]/(t+r);var n=t+o+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=7,a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],o=607/128,s=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];e.exports=function t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(n(e));e-=1;for(var r=a[0],o=1;or)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,a,i),r}function a(t,e){for(var r=l.malloc(t.length,e),n=t.length,i=0;i=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,i){if(r=r||t.ARRAY_BUFFER,i=i||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var a=t.createBuffer(),o=new n(t,r,a,0,i);return o.update(e),o}var l=t("typedarray-pool"),u=t("ndarray-ops"),c=t("ndarray"),f=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],h=n.prototype;h.bind=function(){this.gl.bindBuffer(this.type,this.handle)},h.unbind=function(){this.gl.bindBuffer(this.type,null)},h.dispose=function(){this.gl.deleteBuffer(this.handle)},h.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&"undefined"!=typeof t.shape){var r=t.dtype;if(f.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var n=gl.getExtension("OES_element_index_uint");r=n&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&o(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=l.malloc(t.size,r),h=c(s,t.shape);u.assign(h,t),e<0?this.length=i(this.gl,this.type,this.length,this.usage,s,e):this.length=i(this.gl,this.type,this.length,this.usage,s.subarray(0,t.size),e),l.free(s)}}else if(Array.isArray(t)){var d;d=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),e<0?this.length=i(this.gl,this.type,this.length,this.usage,d,e):this.length=i(this.gl,this.type,this.length,this.usage,d.subarray(0,t.length),e),l.free(d)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");t|=0,t<=0&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:148,"ndarray-ops":147,"typedarray-pool":187}],66:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE", -36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],67:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":66}],68:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){this.plot=t,this.shader=e,this.fillShader=r,this.positionBuffer=n,this.colorBuffer=i,this.idBuffer=a,this.fillPositionBuffer=o,this.fillColorBuffer=s,this.fillVerts=0,this.shape=[0,0],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numVertices=0,this.lineWidth=1}function i(t,e){var r=Math.floor(e);if(r<0)return t[0];if(r>=t.length-1)return t[t.length-1];var n=e-r;return(1-n)*t[r]+n*t[r+1]}function a(t,e){var r=t.gl,i=s(r,p.vertex,p.fragment),a=s(r,p.fillVertex,p.fragment),o=l(r),u=l(r),c=l(r),f=l(r),h=l(r),d=new n(t,i,a,o,u,c,f,h);return d.update(e),t.addObject(d),d}e.exports=a;var o=t("iota-array"),s=t("gl-shader"),l=t("gl-buffer"),u=t("ndarray"),c=t("surface-nets"),f=t("cdt2d"),h=t("clean-pslg"),d=t("binary-search-bounds"),p=t("./lib/shaders"),g=n.prototype,v=[1,0,0,0,0,1,1,0,1,1,0,1];g.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0];return function(){var r,n,i=this.plot,a=this.shader,o=this.fillShader,s=this.bounds,l=this.numVertices,u=this.fillVerts,c=i.gl,f=i.viewBox,h=i.dataBox,d=s[2]-s[0],p=s[3]-s[1],g=h[2]-h[0],v=h[3]-h[1];if(t[0]=2*d/g,t[4]=2*p/v,t[6]=2*(s[0]-h[0])/g-1,t[7]=2*(s[1]-h[1])/v-1,e[0]=f[2]-f[0],e[1]=f[3]-f[1],u>0&&(o.bind(),r=o.uniforms,r.viewTransform=t,r.screenShape=e,n=a.attributes,this.fillPositionBuffer.bind(),n.position.pointer(),this.fillColorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0),c.drawArrays(c.TRIANGLES,0,u)),l>0){a.bind();var m=this.lineWidth*i.pixelRatio;r=a.uniforms,r.viewTransform=t,r.screenShape=e,r.lineWidth=m,r.pointSize=1e3,n=a.attributes,this.positionBuffer.bind(),n.position.pointer(c.FLOAT,!1,16,0),n.tangent.pointer(c.FLOAT,!1,16,8),this.colorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0),c.drawArrays(c.TRIANGLES,0,l),r.lineWidth=0,r.pointSize=m,this.positionBuffer.bind(),n.position.pointer(c.FLOAT,!1,48,0),n.tangent.pointer(c.FLOAT,!1,48,8),this.colorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0,12,0),c.drawArrays(c.POINTS,0,l/3)}}}(),g.drawPick=function(){return function(t){return t}}(),g.pick=function(t,e,r){return null},g.update=function(t){function e(t,e,r,n){var i=n-r;return Math.abs(i)<1e-6?e:Math.floor(e)+Math.max(.001,Math.min(.999,(t-r)/i))}t=t||{};var r=t.shape||[0,0],n=t.x||o(r[0]),a=t.y||o(r[1]),s=t.z||new Float32Array(r[0]*r[1]),l=t.levels||[],p=t.levelColors||[],g=this.bounds,m=g[0]=n[0],y=g[1]=a[0],b=g[2]=n[n.length-1],x=g[3]=a[a.length-1];m===b&&(g[2]+=1,b+=1),y===x&&(g[3]+=1,x+=1);var _=1/(b-m),w=1/(x-y);this.lineWidth=t.lineWidth||1;for(var A=u(s,r),k=[],M=[],T=[],E=[],L=[[0,0],[r[0]-1,0],[0,r[1]-1],[r[0]-1,r[1]-1]],S=0;S0&&C===l[S-1])){for(var R=c(A,C),O=255*p[4*S]|0,I=255*p[4*S+1]|0,P=255*p[4*S+2]|0,N=255*p[4*S+3]|0,D=R.cells,z=R.positions,F=Array(z.length),B=0;B1)){var V,q=H[0],G=H[1],X=A.get(Math.floor(q),Math.floor(G)),Y=A.get(Math.floor(q),Math.ceil(G)),W=A.get(Math.ceil(q),Math.floor(G)),Z=A.get(Math.ceil(q),Math.ceil(G));0===Math.floor(H[0])&&X<=C!=Y>1;for(e=0;e0&&(T*=_),E<0?E*=w:E>0&&(E*=A),v[b++]=h*(r-p+T),v[b++]=d*(n-g+E),v[b++]=o*M[2]+(l+o)*M[4],v[b++]=o*M[3]+(l+o)*M[5]}}for(e=0;e1&&h.drawBuffersWEBGL(y[f]);var m=r.getExtension("WEBGL_depth_texture");m?d?t.depth=s(r,u,c,m.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=s(r,u,c,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=l(r,u,c,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=l(r,u,c,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=l(r,u,c,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var v=0;vs||r<0||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(a),u=0;uo||r<0||r>o)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),s<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var f=!0;"depth"in n&&(f=!!n.depth);var h=!1;return"stencil"in n&&(h=!!n.stencil),new c(t,e,r,l,s,f,h,i)}var d=t("gl-texture2d");e.exports=h;var p,g,v,m,y=null,b=c.prototype;Object.defineProperties(b,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return f(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t|=0,f(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t|=0,f(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e>8*h&255;this.pickOffset=r,i.bind();var d=i.uniforms;d.viewTransform=t,d.pickOffset=e;var p=i.attributes;return this.positionBuffer.bind(),p.position.pointer(),this.idBuffer.bind(),p.pickId.pointer(o.UNSIGNED_BYTE,!1),o.drawArrays(o.TRIANGLES,0,this.numVertices),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){t=t||{};var e=t.shape||[0,0],r=t.x||o(e[0]),n=t.y||o(e[1]),i=t.z||new Float32Array(e[0]*e[1]);this.xData=r,this.yData=n;var l=t.colorLevels||[0],u=t.colorValues||[0,0,0,1],c=l.length,f=this.bounds,d=f[0]=r[0],p=f[1]=n[0],g=f[2]=r[r.length-1],v=f[3]=n[n.length-1],m=1/(g-d),y=1/(v-p),b=e[0]*e[1]*(h.length>>>1);this.numVertices=b;var x=s.mallocUint8(4*b),_=s.mallocFloat32(2*b),w=s.mallocUint32(b),A=e[0],k=e[1];this.shape=[A,k];for(var M=0,T=0;T2&&!this.usingDashes){var b=this.mitreShader;this.lineBufferLo.bind(),b.attributes.aLo.pointer(l.FLOAT,!1,48,0),this.lineBufferHi.bind(),b.bind();var x=b.uniforms;this.setProjectionUniforms(x,a),x.color=c,x.radius=s*u,b.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,i/3|0)}}}}(),h.drawPick=function(){var t=[0,0,0,0];return function(e){var r=this.vertCount,n=this.numPoints;if(this.pickOffset=e,!r)return e+n;var i=this.setProjectionModel(),a=this.plot,o=this.width,s=a.gl,l=a.pickPixelRatio,u=this.pickShader,c=this.pickBuffer;t[0]=255&e,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24,u.bind();var f=u.uniforms;this.setProjectionUniforms(f,i),f.width=o*l,f.pickOffset=t;var h=u.attributes;return this.lineBufferHi.bind(),h.aHi.pointer(s.FLOAT,!1,16,0),h.dHi.pointer(s.FLOAT,!1,16,8),this.lineBufferLo.bind(),h.aLo.pointer(s.FLOAT,!1,16,0),c.bind(),h.pick0.pointer(s.UNSIGNED_BYTE,!1,8,0),h.pick1.pointer(s.UNSIGNED_BYTE,!1,8,4),s.drawArrays(s.TRIANGLES,0,r),e+n}}(),h.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(r=n+i)return null;var a=r-n,o=this.data;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}},h.update=function(t){t=t||{};var e,r,n,a,o,s=this.plot.gl;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=i(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var f=t.dashes||[1],h=0;for(e=0;e1,this.dashPattern=l(s,u(d,[h,1,4],[1,0,0])),this.dashPattern.minFilter=s.NEAREST,this.dashPattern.magFilter=s.NEAREST,this.dashLength=h,c.free(d);var g=t.positions;this.data=g;var v=this.bounds;v[0]=v[1]=1/0,v[2]=v[3]=-(1/0);var m=this.numPoints=g.length>>>1;if(0!==m){for(e=0;e=t.length-1)return t[t.length-1];var n=e-r;return(1-n)*t[r]+n*t[r+1]}function a(t,e){var r=t.gl,i=s(r,p.vertex,p.fragment),a=s(r,p.fillVertex,p.fragment),o=l(r),u=l(r),c=l(r),f=l(r),h=l(r),d=new n(t,i,a,o,u,c,f,h);return d.update(e),t.addObject(d),d}e.exports=a;var o=t("iota-array"),s=t("gl-shader"),l=t("gl-buffer"),u=t("ndarray"),c=t("surface-nets"),f=t("cdt2d"),h=t("clean-pslg"),d=t("binary-search-bounds"),p=t("./lib/shaders"),g=n.prototype,v=[1,0,0,0,0,1,1,0,1,1,0,1];g.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0];return function(){var r,n,i=this.plot,a=this.shader,o=this.fillShader,s=this.bounds,l=this.numVertices,u=this.fillVerts,c=i.gl,f=i.viewBox,h=i.dataBox,d=s[2]-s[0],p=s[3]-s[1],g=h[2]-h[0],v=h[3]-h[1];if(t[0]=2*d/g,t[4]=2*p/v,t[6]=2*(s[0]-h[0])/g-1,t[7]=2*(s[1]-h[1])/v-1,e[0]=f[2]-f[0],e[1]=f[3]-f[1],u>0&&(o.bind(),r=o.uniforms,r.viewTransform=t,r.screenShape=e,n=a.attributes,this.fillPositionBuffer.bind(),n.position.pointer(),this.fillColorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0),c.drawArrays(c.TRIANGLES,0,u)),l>0){a.bind();var m=this.lineWidth*i.pixelRatio;r=a.uniforms,r.viewTransform=t,r.screenShape=e,r.lineWidth=m,r.pointSize=1e3,n=a.attributes,this.positionBuffer.bind(),n.position.pointer(c.FLOAT,!1,16,0),n.tangent.pointer(c.FLOAT,!1,16,8),this.colorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0),c.drawArrays(c.TRIANGLES,0,l),r.lineWidth=0,r.pointSize=m,this.positionBuffer.bind(),n.position.pointer(c.FLOAT,!1,48,0),n.tangent.pointer(c.FLOAT,!1,48,8),this.colorBuffer.bind(),n.color.pointer(c.UNSIGNED_BYTE,!0,12,0),c.drawArrays(c.POINTS,0,l/3)}}}(),g.drawPick=function(){return function(t){return t}}(),g.pick=function(t,e,r){return null},g.update=function(t){function e(t,e,r,n){var i=n-r;return Math.abs(i)<1e-6?e:Math.floor(e)+Math.max(.001,Math.min(.999,(t-r)/i))}t=t||{};var r=t.shape||[0,0],n=t.x||o(r[0]),a=t.y||o(r[1]),s=t.z||new Float32Array(r[0]*r[1]),l=t.levels||[],p=t.levelColors||[],g=this.bounds,m=g[0]=n[0],y=g[1]=a[0],b=g[2]=n[n.length-1],x=g[3]=a[a.length-1];m===b&&(g[2]+=1,b+=1),y===x&&(g[3]+=1,x+=1);var _=1/(b-m),w=1/(x-y);this.lineWidth=t.lineWidth||1;for(var A=u(s,r),k=[],M=[],T=[],E=[],L=[[0,0],[r[0]-1,0],[0,r[1]-1],[r[0]-1,r[1]-1]],S=0;S0&&C===l[S-1])){for(var R=c(A,C),O=255*p[4*S]|0,I=255*p[4*S+1]|0,P=255*p[4*S+2]|0,N=255*p[4*S+3]|0,D=R.cells,z=R.positions,F=Array(z.length),B=0;B1)){var V,q=H[0],G=H[1],X=A.get(Math.floor(q),Math.floor(G)),Y=A.get(Math.floor(q),Math.ceil(G)),W=A.get(Math.ceil(q),Math.floor(G)),Z=A.get(Math.ceil(q),Math.ceil(G));0===Math.floor(H[0])&&X<=C!=Y>1;for(e=0;e0&&(T*=_),E<0?E*=w:E>0&&(E*=A),v[b++]=h*(r-p+T),v[b++]=d*(n-g+E),v[b++]=o*M[2]+(l+o)*M[4],v[b++]=o*M[3]+(l+o)*M[5]}}for(e=0;e1&&h.drawBuffersWEBGL(y[f]);var m=r.getExtension("WEBGL_depth_texture");m?d?t.depth=s(r,u,c,m.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=s(r,u,c,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=l(r,u,c,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=l(r,u,c,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=l(r,u,c,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var v=0;vs||r<0||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(a),u=0;uo||r<0||r>o)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),s<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var f=!0;"depth"in n&&(f=!!n.depth);var h=!1;return"stencil"in n&&(h=!!n.stencil),new c(t,e,r,l,s,f,h,i)}var d=t("gl-texture2d");e.exports=h;var p,g,v,m,y=null,b=c.prototype;Object.defineProperties(b,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return f(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t|=0,f(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t|=0,f(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e>8*h&255;this.pickOffset=r,i.bind();var d=i.uniforms;d.viewTransform=t,d.pickOffset=e;var p=i.attributes;return this.positionBuffer.bind(),p.position.pointer(),this.idBuffer.bind(),p.pickId.pointer(o.UNSIGNED_BYTE,!1),o.drawArrays(o.TRIANGLES,0,this.numVertices),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){t=t||{};var e=t.shape||[0,0],r=t.x||o(e[0]),n=t.y||o(e[1]),i=t.z||new Float32Array(e[0]*e[1]);this.xData=r,this.yData=n;var l=t.colorLevels||[0],u=t.colorValues||[0,0,0,1],c=l.length,f=this.bounds,d=f[0]=r[0],p=f[1]=n[0],g=f[2]=r[r.length-1],v=f[3]=n[n.length-1],m=1/(g-d),y=1/(v-p),b=e[0]*e[1]*(h.length>>>1);this.numVertices=b;var x=s.mallocUint8(4*b),_=s.mallocFloat32(2*b),w=s.mallocUint32(b),A=e[0],k=e[1];this.shape=[A,k];for(var M=0,T=0;T2&&!this.usingDashes){var b=this.mitreShader;this.lineBufferLo.bind(),b.attributes.aLo.pointer(l.FLOAT,!1,48,0),this.lineBufferHi.bind(),b.bind();var x=b.uniforms;this.setProjectionUniforms(x,a),x.color=c,x.radius=s*u,b.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,i/3|0)}}}}(),h.drawPick=function(){var t=[0,0,0,0];return function(e){var r=this.vertCount,n=this.numPoints;if(this.pickOffset=e,!r)return e+n;var i=this.setProjectionModel(),a=this.plot,o=this.width,s=a.gl,l=a.pickPixelRatio,u=this.pickShader,c=this.pickBuffer;t[0]=255&e,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24,u.bind();var f=u.uniforms;this.setProjectionUniforms(f,i),f.width=o*l,f.pickOffset=t;var h=u.attributes;return this.lineBufferHi.bind(),h.aHi.pointer(s.FLOAT,!1,16,0),h.dHi.pointer(s.FLOAT,!1,16,8),this.lineBufferLo.bind(),h.aLo.pointer(s.FLOAT,!1,16,0),c.bind(),h.pick0.pointer(s.UNSIGNED_BYTE,!1,8,0),h.pick1.pointer(s.UNSIGNED_BYTE,!1,8,4),s.drawArrays(s.TRIANGLES,0,r),e+n}}(),h.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(r=n+i)return null;var a=r-n,o=this.data;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}},h.update=function(t){t=t||{};var e,r,n,a,o,s=this.plot.gl;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=i(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var f=t.dashes||[1],h=0;for(e=0;e1,this.dashPattern=l(s,u(d,[h,1,4],[1,0,0])),this.dashPattern.minFilter=s.NEAREST,this.dashPattern.magFilter=s.NEAREST,this.dashLength=h,c.free(d);var g=t.positions;this.data=g;var v=this.bounds;v[0]=v[1]=1/0,v[2]=v[3]=-(1/0);var m=this.numPoints=g.length>>>1;if(0!==m){for(e=0;e1;){var M=--n;a=g[2*n],o=g[2*n+1];var T=M-1,E=g[2*T],L=g[2*T+1];if(!(isNaN(a)||isNaN(o)||isNaN(E)||isNaN(L))){k+=1,a=(a-v[0])/(v[2]-v[0]),o=(o-v[1])/(v[3]-v[1]),E=(E-v[0])/(v[2]-v[0]),L=(L-v[1])/(v[3]-v[1]);var S=E-a,C=L-o,R=M|1<<24,O=M-1,I=M,P=M-1|1<<24;y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=a,_[--A]=R,_[--A]=O,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=I,_[--A]=P,y[--w]=-C,y[--w]=-S,y[--w]=L,y[--w]=E,_[--A]=I,_[--A]=P,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=I,_[--A]=P,y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=a,_[--A]=R,_[--A]=O,y[--w]=C,y[--w]=S,y[--w]=o,y[--w]=a,_[--A]=R,_[--A]=O}}for(e=0;es[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n],a.uniforms.angle=m[n],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n]&&A&&(e[1^n]-=T*d*b[n],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n],a.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,A)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*g[n+2],ks[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n+2],a.uniforms.angle=m[n+2],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n+2]&&A&&(e[1^n]+=T*d*b[n+2],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n+2],a.uniforms.angle=_[n+2],u.drawArrays(u.TRIANGLES,w,A))}}(),c.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,u=r.pixelRatio;if(this.titleCount){for(var c=0;c<2;++c)e[c]=2*(o[c]*u-a[c])/(a[2+c]-a[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,a=n._tickBounds,o=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var u=0;u<2;++u){var c=a[u],f=a[u+2],h=f-c,d=.5*(o[u+2]+o[u]),p=o[u+2]-o[u],g=l[u],v=l[u+2],m=v-g,y=s[u],b=s[u+2],x=b-y;e[u]=2*h/p*m/x,t[u]=2*(c-d)/p*m/x}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){var e,r,n,i,a,o=[],l=t.ticks,u=t.bounds;for(a=0;a<2;++a){var c=[Math.floor(o.length/3)],f=[-(1/0)],h=l[a];for(e=0;er)for(t=r;te)for(t=e;t=0){for(var k=0|A.type.charAt(A.type.length-1),M=new Array(k),T=0;T=0;)E+=1;w[b]=E}var L=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,x,w),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=a},{"./lib/GLError":88,"./lib/create-attributes":89,"./lib/create-uniforms":90,"./lib/reflect":91,"./lib/runtime-reflect":92,"./lib/shader-cache":93}],88:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="GLError",n.prototype.constructor=n,e.exports=n},{}],89:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}function i(t,e,r,i,a,o,s){for(var l=["gl","v"],u=[],c=0;c=0){var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);i(t,e,d[0],n,p,o,f)}else{if(!(h.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+f+": "+h);var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new s("","Invalid data type for attribute "+f+": "+h);a(t,e,d,n,p,o,f)}}}return o}e.exports=o;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,a=i._gl,o=i._locations[i._index];a.vertexAttribPointer(o,i._dimension,t||a.FLOAT,!!e,r||0,n||0),a.enableVertexAttribArray(o)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":88}],90:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;n4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(i<2||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],a=t;a+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function f(e){for(var n=["return function updateProperty(obj){"],i=c("",e),o=0;o4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var o=p(i);Object.defineProperty(t,e,{get:n(o),set:f(i),enumerable:!0,configurable:!1})}else a[i]?Object.defineProperty(t,e,{get:l(i),set:f(i),enumerable:!0,configurable:!1}):t[e]=h(r[i].type)}function p(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 u=1;u1)for(var l=0;l=0){var g=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(g,e[1],g,e[3],d[p],h[p]):o.drawLine(e[0],g,e[2],g,d[p],h[p])}}for(var p=0;p=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},h.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},h.removeObject=function(t){ for(var e=this.objects,r=0;r>>1;for(r=0;r=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}function a(t,e){var r=t.gl,i=s(r),a=s(r),l=o(r,u.pointVertex,u.pointFragment),c=o(r,u.pickVertex,u.pickFragment),f=new n(t,i,a,l,c);return f.update(e),t.addObject(f),f}var o=t("gl-shader"),s=t("gl-buffer"),l=t("typedarray-pool"),u=t("./lib/shader");e.exports=a;var c=n.prototype;c.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},c.update=function(t){function e(e,r){return e in t?t[e]:r}var r;t=t||{},this.sizeMin=e("sizeMin",.5),this.sizeMax=e("sizeMax",20),this.color=e("color",[1,0,0,1]).slice(),this.areaRatio=e("areaRatio",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.blend=e("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,a=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,o=t.positions,s=i?o:l.mallocFloat32(o.length),u=a?t.idToIndex:l.mallocInt32(n);if(i||s.set(o),!a)for(s.set(o),r=0;r>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),a.attributes.pickId.pointer(o.UNSIGNED_BYTE),a.uniforms.pickOffset=e,this.pickOffset=r);var h=o.getParameter(o.BLEND),d=o.getParameter(o.DITHER);return h&&!this.blend&&o.disable(o.BLEND),d&&o.disable(o.DITHER),o.drawArrays(o.POINTS,0,this.pointCount),h&&!this.blend&&o.enable(o.BLEND),d&&o.enable(o.DITHER),r+this.pointCount}}(),c.draw=c.unifiedDraw,c.drawPick=c.unifiedDraw,c.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":95,"gl-buffer":65,"gl-shader":96,"typedarray-pool":187}],104:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4((posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n",fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {\n return vec4((posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n + screenScale * screenOffset, 0, 1);\n}\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo,\n pixelScale, offset);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],105:[function(t,e,r){arguments[4][87][0].apply(r,arguments)},{"./lib/GLError":106,"./lib/create-attributes":107,"./lib/create-uniforms":108,"./lib/reflect":109,"./lib/runtime-reflect":110,"./lib/shader-cache":111,dup:87}],106:[function(t,e,r){arguments[4][88][0].apply(r,arguments)},{dup:88}],107:[function(t,e,r){arguments[4][89][0].apply(r,arguments)},{"./GLError":106,dup:89}],108:[function(t,e,r){arguments[4][90][0].apply(r,arguments)},{"./GLError":106,"./reflect":109,dup:90}],109:[function(t,e,r){arguments[4][91][0].apply(r,arguments)},{dup:91}],110:[function(t,e,r){arguments[4][92][0].apply(r,arguments)},{dup:92}],111:[function(t,e,r){arguments[4][93][0].apply(r,arguments)},{"./GLError":106,dup:93,"gl-format-compiler-error":74,"weakmap-shim":194}],112:[function(t,e,r){"use strict";function n(t){if(t in h)return h[t];var e=c(t,{polygons:!0,font:"sans-serif",textAlign:"left",textBaseline:"alphabetic"}),r=[],n=[];e.forEach(function(t){t.forEach(function(t){for(var e=0;e>8*d&255;h.uniforms.pickOffset=o,this.idBuffer.bind(),h.attributes.id.pointer(f.UNSIGNED_BYTE,!1)}else this.colorBuffer.bind(),h.attributes.color.pointer(f.UNSIGNED_BYTE,!0);return this.posHiBuffer.bind(),h.attributes.positionHi.pointer(),this.posLoBuffer.bind(),h.attributes.positionLo.pointer(),this.offsetBuffer.bind(),h.attributes.offset.pointer(),h.uniforms.pixelScale=a,h.uniforms.scaleHi=e,h.uniforms.scaleLo=r,h.uniforms.translateHi=n,h.uniforms.translateLo=i,f.drawArrays(f.TRIANGLES,0,c),l?s+this.numPoints:void 0}}(),d.draw=d.drawPick,d.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;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]]}},d.update=function(t){t=t||{};var e,r,i=t.positions||[],a=t.colors||[],o=t.glyphs||[],s=t.sizes||[],c=t.borderWidths||[],f=t.borderColors||[];this.points=i;var h,d,p=this.bounds=[1/0,1/0,-(1/0),-(1/0)],g=0,v=[],m=[];for(e=0;e>1,r=0;r<2;++r)p[r]=Math.min(p[r],i[2*e+r]),p[2+r]=Math.max(p[2+r],i[2*e+r]);p[0]===p[2]&&(p[2]+=1),p[3]===p[1]&&(p[3]+=1);var y=1/(p[2]-p[0]),b=1/(p[3]-p[1]),x=p[0],_=p[1],w=u.mallocFloat64(2*g),A=u.mallocFloat32(2*g),k=u.mallocFloat32(2*g),M=u.mallocFloat32(2*g),T=u.mallocUint8(4*g),E=u.mallocUint32(g),L=0;for(e=0;et;){var d=r[h-1],p=n[2*(h-1)];if((d-s||l-p)>=0)break;r[h]=d,n[2*h]=p,n[2*h+1]=n[2*h-1],i[h]=i[h-1],a[h]=a[h-1],h-=1}r[h]=s,n[2*h]=l,n[2*h+1]=u,i[h]=c,a[h]=f}}function a(t,e,r,n,i,a){var o=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=a[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,i[e]=u,a[e]=c}function o(t,e,r,n,i,a){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e]}function s(t,e,r,n,i,a,o){var s=n[t],l=i[2*t],u=i[2*t+1],c=a[t],f=o[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],a[t]=a[e],o[t]=o[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],a[e]=a[r],o[e]=o[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,a[r]=c,o[r]=f}function l(t,e,r,n,i,a,o,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=a,c[e]=o}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,a,o,s){return(e-a[t]||o[2*t]-r||i-s[t])<0}function f(t,e,r,n,d,p){var g=(e-t+1)/6|0,v=t+g,m=e-g,y=t+e>>1,b=y-g,x=y+g,_=v,w=b,A=y,k=x,M=m,T=t+1,E=e-1,L=0;u(_,w,r,n,d,p)&&(L=_,_=w,w=L),u(k,M,r,n,d,p)&&(L=k,k=M,M=L),u(_,A,r,n,d,p)&&(L=_,_=A,A=L),u(w,A,r,n,d,p)&&(L=w,w=A,A=L),u(_,k,r,n,d,p)&&(L=_,_=k,k=L),u(A,k,r,n,d,p)&&(L=A,A=k,k=L),u(w,M,r,n,d,p)&&(L=w,w=M,M=L),u(w,A,r,n,d,p)&&(L=w,w=A,A=L),u(k,M,r,n,d,p)&&(L=k,k=M,M=L);var S=r[w],C=n[2*w],R=n[2*w+1],O=d[w],I=p[w],P=r[k],N=n[2*k],D=n[2*k+1],z=d[k],F=p[k],B=_,j=A,U=M,H=v,V=y,q=m,G=r[B],X=r[j],Y=r[U];r[H]=G,r[V]=X,r[q]=Y;for(var W=0;W<2;++W){var Z=n[2*B+W],Q=n[2*j+W],$=n[2*U+W];n[2*H+W]=Z,n[2*V+W]=Q,n[2*q+W]=$}var K=d[B],J=d[j],tt=d[U];d[H]=K,d[V]=J,d[q]=tt;var et=p[B],rt=p[j],nt=p[U];p[H]=et,p[V]=rt,p[q]=nt,o(b,t,r,n,d,p),o(x,e,r,n,d,p);for(var it=T;it<=E;++it)if(c(it,S,C,R,O,r,n,d))it!==T&&a(it,T,r,n,d,p),++T;else if(!c(it,P,N,D,z,r,n,d))for(;;){if(c(E,P,N,D,z,r,n,d)){c(E,S,C,R,O,r,n,d)?(s(it,T,E,r,n,d,p),++T,--E):(a(it,E,r,n,d,p),--E);break}if(--E=Math.max(.9*d,32)){var b=u+s>>>1;l(v,m,f,h,b,c+1),h=b}l(v,m,f,h,y,c+1),h=y}}}var u=t.length>>>1;if(u<1)return[];for(var c=1/0,f=1/0,h=-(1/0),d=-(1/0),p=0;p=0;--_){t[2*_]=(t[2*_]-c)*m,t[2*_+1]=(t[2*_+1]-f)*y;var M=x[_];M!==A&&(w.push(new i(b*Math.pow(.5,M),_+1,k-(_+1))),k=_+1,A=M)}return w.push(new i(b*Math.pow(.5,M+1),0,k)),o.free(x),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=a},{"./lib/sort":115,"typedarray-pool":187}],117:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.plot=t,this.positionBufferHi=e,this.positionBufferLo=r,this.pickBuffer=n,this.weightBuffer=i,this.shader=a,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=o(r),s=o(r),l=o(r),u=o(r),f=a(r,c.pointVertex,c.pointFragment),h=a(r,c.pickVertex,c.pickFragment),d=new n(t,i,s,l,u,f,h);return d.update(e),t.addObject(d),d}var a=t("gl-shader"),o=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var f=n.prototype,h=new Float32Array(2),d=new Float32Array(2),p=new Float32Array(2),g=new Float32Array(2),v=[0,0,0,0];f.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBufferHi.dispose(),this.positionBufferLo.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},f.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords),this.points=t.positions;var r=this.points.length>>>1,n=u.mallocInt32(r),i=u.mallocFloat32(2*r),a=u.mallocFloat64(2*r);a.set(this.points),this.scales=l(a,n,i,this.bounds);var o=u.mallocFloat64(r),s=u.mallocFloat32(2*r),c=u.mallocFloat32(2*r);s.set(a);for(var f=0,h=0;f>8&255,v[2]=t>>16&255,v[3]=t>>24&255,n.uniforms.pickOffset=v,l.bind(),n.attributes.pickId.pointer(m.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());for(var O=this.xCoords,I=(x[0]-u[0]-E*c*y)/_,P=(x[2]-u[0]+E*c*y)/_,N=!0,D=i.length-1;D>=0;D--){var z=i[D];if(!(z.pixelSize1)){var F=z.offset,B=z.count+F,j=s.ge(O,I,F,B-1),U=s.lt(O,P,j,B-1)+1;U>j&&m.drawArrays(m.POINTS,j,U-j),!e&&N&&(N=!1,n.uniforms.useWeight=0)}}return t+this.pointCount},f.drawPick=f.draw,f.pick=function(t,e,r){var n=r-this.pickOffset;return n<0||n>=this.pointCount?null:{object:this,pointId:n,dataCoord:[this.points[2*n],this.points[2*n+1]]}}},{"./lib/shader":113,"binary-search-bounds":114,"gl-buffer":65,"gl-shader":121,"snap-points-2d":116,"typedarray-pool":187}],118:[function(t,e,r){"use strict";r.boxVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n",r.boxFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"},{}],119:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.boxBuffer=e,this.boxShader=r,this.enabled=!0,this.selectBox=[1/0,1/0,-(1/0),-(1/0)],this.borderColor=[0,0,0,1],this.innerFill=!1,this.innerColor=[0,0,0,.25],this.outerFill=!0,this.outerColor=[0,0,0,.5],this.borderWidth=10}function i(t,e){var r=t.gl,i=o(r,[0,0,0,1,1,0,1,1]),l=a(r,s.boxVertex,s.boxFragment),u=new n(t,i,l);return u.update(e),t.addOverlay(u),u}var a=t("gl-shader"),o=t("gl-buffer"),s=t("./lib/shaders");e.exports=i;var l=n.prototype;l.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),i=(this.outerFill,this.outerColor),a=this.borderColor,o=t.box,s=t.screenBox,l=t.dataBox,u=t.viewBox,c=t.pixelRatio,f=(e[0]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],h=(e[1]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1],d=(e[2]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],p=(e[3]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1];if(f=Math.max(f,u[0]),h=Math.max(h,u[1]),d=Math.min(d,u[2]),p=Math.min(p,u[3]),!(d0){var m=r*c;o.drawBox(f-m,h-m,d+m,h+m,a),o.drawBox(f-m,p-m,d+m,p+m,a),o.drawBox(f-m,h-m,f+m,p+m,a),o.drawBox(d-m,h-m,d+m,p+m,a)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":118,"gl-buffer":65,"gl-shader":121}],120:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function a(t,e){var r=o(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=a;var o=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(_inline_55_arg0_<255||_inline_55_arg1_<255||_inline_55_arg2_<255||_inline_55_arg3_<255){var _inline_55_l=_inline_55_arg4_-_inline_55_arg6_[0],_inline_55_a=_inline_55_arg5_-_inline_55_arg6_[1],_inline_55_f=_inline_55_l*_inline_55_l+_inline_55_a*_inline_55_a;_inline_55_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;i=0){for(var k=0|A.type.charAt(A.type.length-1),M=new Array(k),T=0;T=0;)E+=1;_[w]=E}var L=new Array(r.length);a(),d._relink=a,d.types={uniforms:l(r),attributes:l(n) },d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",o(p,d,r,L))},e.exports=a},{"./lib/GLError":122,"./lib/create-attributes":123,"./lib/create-uniforms":124,"./lib/reflect":125,"./lib/runtime-reflect":126,"./lib/shader-cache":127}],122:[function(t,e,r){arguments[4][88][0].apply(r,arguments)},{dup:88}],123:[function(t,e,r){arguments[4][89][0].apply(r,arguments)},{"./GLError":122,dup:89}],124:[function(t,e,r){arguments[4][90][0].apply(r,arguments)},{"./GLError":122,"./reflect":125,dup:90}],125:[function(t,e,r){arguments[4][91][0].apply(r,arguments)},{dup:91}],126:[function(t,e,r){arguments[4][92][0].apply(r,arguments)},{dup:92}],127:[function(t,e,r){arguments[4][93][0].apply(r,arguments)},{"./GLError":122,dup:93,"gl-format-compiler-error":74,"weakmap-shim":194}],128:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}function i(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=i;var a=n.prototype;a.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},a.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,a=i.line,o=i.dataBox,s=i.viewBox;if(a.bind(),o[0]<=n[0]&&n[0]<=o[2]&&o[1]<=n[1]&&n[1]<=o[3]){var l=s[0]+(n[0]-o[0])/(o[2]-o[0])*(s[2]-s[0]),u=s[1]+(n[1]-o[1])/(o[3]-o[1])*(s[3]-s[1]);t[0]&&a.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&a.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&a.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&a.drawLine(l,u,l,s[3],e[3],r[3])}},a.dispose=function(){this.plot.removeOverlay(this)}},{}],129:[function(t,e,r){"use strict";function n(t){m=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],y=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],b=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function i(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}function a(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 o(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}function s(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 l(t,e,r,n,i,a,o,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var f=0,h=0,d=s(c,l.stride.slice());"float32"===u?f=t.FLOAT:"float64"===u?(f=t.FLOAT,d=!1,u="float32"):"uint8"===u?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,d=!1,u="uint8");var m=1;if(2===c.length)h=t.LUMINANCE,c=[c[0],c[1],1],l=p(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])h=t.ALPHA;else if(2===c[2])h=t.LUMINANCE_ALPHA;else if(3===c[2])h=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");h=t.RGBA}m=c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(h=i),h!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,b=o.indexOf(n)<0;if(b&&o.push(n),f===a&&d)0===l.offset&&l.data.length===y?b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data):b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var _;_=a===t.FLOAT?v.mallocFloat32(y):v.mallocUint8(y);var w=p(_,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&a===t.UNSIGNED_BYTE?x(w,l):g.assign(w,l),b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,_.subarray(0,y)),a===t.FLOAT?v.freeFloat32(_):v.freeUint8(_)}}function u(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function c(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(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 s=u(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new o(t,s,e,r,n,i)}function f(t,e,r,n){var i=u(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new o(t,i,0|e.width,0|e.height,r,n)}function h(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var a=s(n,e.stride.slice()),l=0;"float32"===r?l=t.FLOAT:"float64"===r?(l=t.FLOAT,a=!1,r="float32"):"uint8"===r?l=t.UNSIGNED_BYTE:(l=t.UNSIGNED_BYTE,a=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=p(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}l!==t.FLOAT||t.getExtension("OES_texture_float")||(l=t.UNSIGNED_BYTE,a=!1);var f,h,d=e.size;if(a)f=0===e.offset&&e.data.length===d?e.data:e.data.subarray(e.offset,e.offset+d);else{var m=[n[2],n[2]*n[0],1];h=v.malloc(d,r);var y=p(h,n,m,0);"float32"!==r&&"float64"!==r||l!==t.UNSIGNED_BYTE?g.assign(y,e):x(y,e),f=h.subarray(0,d)}var b=u(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,l,f),a||v.free(h),new o(t,b,n[0],n[1],c,l)}function d(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(m||n(t),"number"==typeof arguments[1])return c(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return c(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(i(e))return f(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return h(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var p=t("ndarray"),g=t("ndarray-ops"),v=t("typedarray-pool");e.exports=d;var m=null,y=null,b=null,x=function(t,e){g.muls(t,e,255)},_=o.prototype;Object.defineProperties(_,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),y.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&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),y.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(),b.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(),b.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(b.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 a(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t|=0,a(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,a(this,this._shape[0],t),t}}}),_.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},_.dispose=function(){this.gl.deleteTexture(this.handle)},_.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)},_.setPixels=function(t,e,r,n){var a=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,i(t)){var o=this._mipLevels.indexOf(n)<0;o?(a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):a.texSubImage2D(a.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");l(a,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:148,"ndarray-ops":147,"typedarray-pool":187}],130:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,U=U.slice(n.length),U.length}}function R(){return/[^a-fA-F0-9]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function O(){return"."===N?(U.push(N),j=v,D=N,F+1):/[eE]/.test(N)?(U.push(N),j=v,D=N,F+1):"x"===N&&1===U.length&&"0"===U[0]?(j=w,U.push(N),D=N,F+1):/[^\d]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function I(){return"f"===N&&(U.push(N),D=N,F+=1),/[eE]/.test(N)?(U.push(N),D=N,F+1):"-"===N&&/[eE]/.test(D)?(U.push(N),D=N,F+1):/[^\d]/.test(N)?(e(U.join("")),j=u,F):(U.push(N),D=N,F+1)}function P(){if(/[^\d\w_]/.test(N)){var t=U.join("");return j=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:m,e(U.join("")),j=u,F}return U.push(N),D=N,F+1}var N,D,z,F=0,B=0,j=u,U=[],H=[],V=1,q=0,G=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return H=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var i=t("./lib/literals"),a=t("./lib/operators"),o=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,f=0,h=1,d=2,p=3,g=4,v=5,m=6,y=7,b=8,x=9,_=10,w=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":133,"./lib/builtins-300es":132,"./lib/literals":135,"./lib/literals-300es":134,"./lib/operators":136}],132:[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":133}],133:[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"]},{}],134:[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":135}],135:[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"]},{}],136:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],137:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":131}],138:[function(t,e,r){r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=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=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),e*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):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+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],139:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function a(t,e){var r=p(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),a(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],a=[],o=[],s=[],r=0;r3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=m.ge(this.leftPoints,t,h),n=m.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var a=this.left?this.left.count:0;if(4*a>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var o=this,l=this.left;l.right;)o=l,l=l.right;if(o===this)l.right=this.right;else{var u=this.left,n=this.right;o.count-=l.count,o.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var u=m.ge(this.leftPoints,t,h);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=g.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===x&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},w.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":28}],140:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;r0)return 1<=0)return 1<=0;--e)S(e,0);for(var r=[],e=0;e0;_=_-1&g)x.push(w+"["+T+"+"+v(_)+"]");x.push(m(0));for(var _=0;_0){",h(x[t]),"=1;"),P(t-1,e|1<0&&s>0||o<0&&s<0)return!1;var l=a(r,t,e),u=a(i,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,i))}e.exports=i;var a=t("robust-orientation")[3]},{"robust-orientation":165}],169:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,a=e-n,o=t-i,s=o+a;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var a,o,s=r+i,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],v=h(g);p=i?(a=d,c+=1,c=i?(a=d,c+=1,c0?1:0}},{}],172:[function(t,e,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],173:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,i=t.length;n>1,s=o(t[a],e);s<=0?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function f(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[g],a))break}return r}function h(t,e){if(!e)return f(u(p(t,0)),t,0);for(var r=new Array(e),n=0;n>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function p(t,e){if(e<0)return[];for(var r=[],n=(1<>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){var n=s(r);if(e0){var t=M[0];return a(0,L-1),L-=1,u(0),t}return-1}function h(t,e){var r=M[t];return b[r]===e?t:(b[r]=-(1/0),c(t),f(),b[r]=e,L+=1,c(L-1))}function d(t){if(!x[t]){x[t]=!0;var e=m[t],r=y[t];m[r]>=0&&(m[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&h(T[e],i(e)),T[r]>=0&&h(T[r],i(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||i<0||i===n)break;if(n=i,i=t[n],!x[n]||i<0||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var g=e.length,v=t.length,m=new Array(g),y=new Array(g),b=new Array(g),x=new Array(g),_=0;_>1;_>=0;--_)u(_);for(;;){var S=f();if(S<0||b[S]>r)break;d(S)}for(var C=[],_=0;_=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&R.push([n,i])}}),o.unique(o.normalize(R)),{positions:C,edges:R}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":165,"simplicial-complex":173}],176:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return ol?i-l:o-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=a(r,i,s),u=a(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;if(l=a(s,o,i),u=a(s,o,r),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]}e.exports=i;var a=t("robust-orientation")},{"robust-orientation":165}],177:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=a(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=a(t.right,e);if(l)return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;a0){var s=a(this.slabs[e-1],t);s&&(o?h(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;d=l[c]}}if(d.start)if(o){var p=f(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":176,"binary-search-bounds":28,"functional-red-black-tree":62,"robust-orientation":165}],178:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function a(t,e){return Array(e+1).join(t)}var o={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,f,h,d=1,p=t.length,g="",v=[],m=!0,y="";for(s=0;s=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?v[v.length]=n:(!o.number.test(u[8])||m&&!u[3]?y="":(y=m?"+":"-",n=n.toString().replace(o.sign,"")),f=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",h=u[6]-(y+n).length,c=u[6]&&h>0?a(f,h):"",v[v.length]=u[5]?y+n+c:"0"===f?y+c+n:c+y+n)}return v.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],179:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],180:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128===0){f.length>0&&h.push("}}");var d="vExtra"+f.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(M="+"+v[x]+"*c");var T=.5*(p[x].length/y),E=.5+.5*(m[x]/y);k.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+M+")/("+g[x].join("+")+")")}h.push("a.push([",k.join(),"]);","break;")}n.push("}},"),f.length>0&&h.push("}}");for(var L=[],u=0;u<1<0&&(h+=.02);for(var p=new Float32Array(f),g=0,v=-.5*h,d=0;d.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=L(t,360),e=L(e,100),r=L(r,100),0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,i,a=G(t,e,r),o=q(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function M(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){R(t)&&(t="100%");var n=O(t);return t=q(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function S(t){return q(1,G(0,t))}function C(t){return parseInt(t,16)}function R(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function O(t){return"string"==typeof t&&t.indexOf("%")!=-1}function I(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function N(t){return e.round(255*parseFloat(t)).toString(16)}function D(t){return C(t)/255}function z(t){return!!Z.CSS_UNIT.exec(t)}function F(t){t=t.replace(j,"").replace(U,"").toLowerCase();var e=!1;if(Y[t])t=Y[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Z.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),a:D(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),a:D(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.hex3.exec(t))&&{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),format:e?"name":"hex"}}function B(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var j=/^\s+/,U=/\s+$/,H=0,V=e.round,q=e.min,G=e.max,X=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=E(t),this._roundA=V(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=V(360*t.h),r=V(100*t.s),n=V(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:V(this._r),g:V(this._g),b:V(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+V(this._r)+", "+V(this._g)+", "+V(this._b)+")":"rgba("+V(this._r)+", "+V(this._g)+", "+V(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:V(100*L(this._r,255))+"%",g:V(100*L(this._g,255))+"%",b:V(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*L(this._r,255))+"%, "+V(100*L(this._g,255))+"%, "+V(100*L(this._b,255))+"%)":"rgba("+V(100*L(this._r,255))+"%, "+V(100*L(this._g,255))+"%, "+V(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(W[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,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(k,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=P(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return n(s)},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=B(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},n.mostReadable=function(t,e,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var Y=n.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"},W=n.hexNames=T(Y),Z=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],183:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":151}],184:[function(t,e,r){"use strict";function n(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(o(t+1)),r=[],n=0;n0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function f(t){return new Int16Array(o(2*t),0,t)}function h(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return x?new Uint8ClampedArray(o(t),0,t):s(t)}function v(t){return new DataView(o(t),0,t)}function m(t){t=y.nextPow2(t);var e=y.log2(t),r=A[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,A=_.BUFFER;r.free=function(t){if(n.isBuffer(t))A[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){A[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return f(t);case"int32":return h(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return m(t);case"data":case"dataview":return v(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=f,r.mallocInt32=h,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=v,r.mallocBuffer=m,r.clearCache=function(){for(var t=0;t<32;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,A[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":29,buffer:38,dup:57}],188:[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;e8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height= 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":51}],197:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":196}],198:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("opacity"),u("align"),u("bgcolor");var f=u("bordercolor"),h=i.opacity(f);u("borderpad");var d=u("borderwidth"),p=u("showarrow");u("text",p?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font);for(var g=["x","y"],v=[-10,-30],m={_fullLayout:r},y=0;y<2;y++){var b=g[y],x=a.coerceRef(t,e,m,b,"","paper");if(a.coercePosition(e,m,u,x,b,.5),p){var _="a"+b,w=a.coerceRef(t,e,m,_,"pixel");"pixel"!==w&&w!==x&&(w=e[_]="pixel");var A="pixel"===w?v[y]:.4;a.coercePosition(e,m,u,w,_,A)}else u(b+"anchor")}return n.noneOrAll(t,e,["x","y"]),p&&(u("arrowcolor",h?e.bordercolor:i.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(h&&d||1)),n.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":303,"../../plots/cartesian/axes":333,"../color":207,"./attributes":200}],199:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],200:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":298,"../../plots/cartesian/constants":338,"../../plots/font_attributes":353,"./arrow_paths":199}],201:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,f=s-l,h=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),f=Math.max(f,d),h=Math.max(h,d)}r&&r.autorange&&a.expand(r,[r.l2c(r.r2l(e.x))],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(n.r2l(e.y))],{ppadplus:h,ppadminus:f})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":303,"../../plots/cartesian/axes":333,"./draw":203}],202:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),i=t("./annotation_defaults");e.exports=function(t,e){var r={name:"annotations",handleItemDefaults:i};n(t,e,r)}},{"../../plots/array_container_defaults":330,"./annotation_defaults":198}],203:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=$.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,m=Math.round(u+2*tt),y=Math.round(p+2*tt);q._w=u,q._h=p;var x=!1;if(["x","y"].forEach(function(e){var n,i=q[e+"ref"]||e,a=f.getFromId(t,i),o=(W+("x"===e?0:90))*Math.PI/180,s=m*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=q[e+"anchor"];if(a){var u=a.r2fraction(q[e]);if(!a.autorange&&(u<0||u>1)&&(q["a"+e+"ref"]===i?(u=a.r2fraction(q["a"+e]),(u<0||u>1)&&(x=!0)):x=!0,x))return;Y[e]=a._offset+a.r2p(q[e]),n=.5}else n=q[e],"y"===e&&(n=1-n),Y[e]="x"===e?R.l+R.w*n:R.t+R.h*n;var c=0;q["a"+e+"ref"]===i?Y["aa"+e]=a._offset+a.r2p(q["a"+e]):(c=q.showarrow?q["a"+e]:s*r(n,l),Y[e]+=c),q["_"+e+"type"]=a&&a.type,q["_"+e+"size"]=s,q["_"+e+"shift"]=c}),x)return void $.remove();var _,w;q.showarrow&&(_=q.axref===q.xref?Y.x:c.constrain(Y.x-q.ax,1,k.width-1),w=q.ayref===q.yref?Y.y:c.constrain(Y.y-q.ay,1,k.height-1)),Y.x=c.constrain(Y.x,1,k.width-1),Y.y=c.constrain(Y.y,1,k.height-1);var A=tt-s.top,M=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:M,y:A}),nt.selectAll("tspan.line").attr({y:A,x:M})),et.call(d.setRect,K/2,K/2,m-K,y-K);var T=0,E=0;T=q.axref===q.xref?Math.round(Y.aax-m/2):Math.round(Y.x-m/2),E=q.ayref===q.yref?Math.round(Y.aay-y/2):Math.round(Y.y-y/2),$.call(c.setTranslate,T,E);var L="annotations["+e+"]",S=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=q.axref===q.xref?Y.aax+r:Y.x+r,s=q.ayref===q.yref?Y.aay+n:Y.y+n;var u=c.rotationXYMatrix(W,i,s),f=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,m=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!m.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){m.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=q.arrowwidth,x=q.arrowcolor,A=Z.append("g").style({opacity:h.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=A.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(h.stroke,h.rgb(x));b(k,q.arrowhead,"end",q.arrowsize);var M=A.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,S;v.init({element:M.node(),prepFn:function(){var t=c.getTranslate($);E=t.x,S=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){A.attr("transform","translate("+t+","+e+")");var r=f(E,S),n=r[0]+t,i=r[1]+e;$.call(c.setTranslate,n,i),T[L+".x"]=G?G.p2r(G.r2p(q.x)+t):(_+t-R.l)/R.w,T[L+".y"]=X?X.p2r(X.r2p(q.y)+e):1-(w+e-R.t)/R.h,q.axref===q.xref&&(T[L+".ax"]=G?G.p2r(G.r2p(q.ax)+t):(_+t-R.l)/R.w),q.ayref===q.yref&&(T[L+".ay"]=X?X.p2r(X.r2p(q.ay)+e):1-(w+e-R.t)/R.h),Q.attr({transform:"rotate("+W+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};q.showarrow&&S(0,0);var C=c.rotationXYMatrix(W,Y.x,Y.y),O=c.apply2DTransform(C);if(t._context.editable){var I,P,N;v.init({element:$.node(),prepFn:function(){var t=c.getTranslate($);I=t.x,P=t.y,N={}},moveFn:function(t,e){$.call(c.setTranslate,I+t,P+e);var r="pointer";if(q.showarrow)q.axref===q.xref?N[L+".ax"]=G.p2r(G.r2p(q.ax)+t):N[L+".ax"]=q.ax+t,q.ayref===q.yref?N[L+".ay"]=X.p2r(X.r2p(q.ay)+e):N[L+".ay"]=q.ay+e,S(t,e);else{if(G)N[L+".x"]=q.x+t/G._m;else{var n=q._xsize/R.w,i=q.x+q._xshift/R.w-n/2;N[L+".x"]=v.align(i+t/R.w,n,0,1,q.xanchor)}if(X)N[L+".y"]=q.y+e/X._m;else{var a=q._ysize/R.h,o=q.y-q._yshift/R.h-a/2;N[L+".y"]=v.align(o-e/R.h,a,0,1,q.yanchor)}G&&X||(r=v.getCursor(G?.5:N[L+".x"],X?.5:N[L+".y"],q.xanchor,q.yanchor))}var s=O(I,P),l=s[0]+t,u=s[1]+e;$.call(c.setTranslate,I+t,P+e),Q.attr({transform:"rotate("+W+","+l+","+u+")"}),g($,r)},doneFn:function(e){if(g($),e){l.relayout(t,N);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,A=t.layout,k=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return A.annotations=u,y(A,k),void n(t);if("remove"===u)return delete A.annotations,k.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)k._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}k._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=A.annotations[e],E=k.annotations[e];if(T){var L={};"string"==typeof r&&r?L[r]=u:c.isPlainObject(r)&&(L=r);var S=Object.keys(L);for(w=0;w4/3&&(z=H)}}else D&&(B&&(z<1/3?z+=U:z>2/3&&(z-=U)),z=(z-D.domain[0])/(D.domain[1]-D.domain[0]),z=D.fraction2r(z))}D&&D===N&&F&&("log"===F&&"log"!==D.type?z=Math.pow(10,z):"log"!==F&&"log"===D.type&&(z=z>0?Math.log(z)/Math.LN10:void 0)),T[P]=z}}var q={};m(T,q,k),k.annotations[e]=q;var G=f.getFromId(t,q.xref),X=f.getFromId(t,q.yref),Y={x:0,y:0},W=+q.textangle||0,Z=k._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",q.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:q})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),K=q.borderwidth,J=q.borderpad,tt=K+J,et=$.append("rect").attr("class","bg").style("stroke-width",K+"px").call(h.stroke,q.bordercolor).call(h.fill,q.bgcolor),rt=q.font,nt=$.append("text").classed("annotation",!0).attr("data-unformatted",q.text).text(q.text);t._context.editable?nt.call(p.makeEditable,$).call(x).on("edit",function(r){q.text=r,this.attr({"data-unformatted":q.text}),this.call(x);var n={};n["annotations["+e+"].text"]=q.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(x),Q.attr({transform:"rotate("+W+","+Y.x+","+Y.y+")"}).call(d.setPosition,Y.x,Y.y)}}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,f=n-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var g=(u*d-c*h)/p,v=(u*f-l*h)/p;return v<0||v>1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./annotation_defaults"),y=t("./defaults"),b=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":303,"../../lib/setcursor":313,"../../lib/svg_text_utils":317,"../../plotly":328,"../../plots/cartesian/axes":333,"../../plots/plots":361,"../color":207,"../dragelement":228,"../drawing":230,"./annotation_defaults":198,"./defaults":202,"./draw_arrow_head":204,d3:55,"fast-isnumeric":61}],204:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var f,h,d,p,g=(o.getPx(t,"stroke-width")||1)*l,v=t.style("stroke")||a.defaultLine,m=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=c.backoff*g;if("line"===u.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},h={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(f.y-h.y,f.x-h.x),p=d+Math.PI,x){var _=x*Math.cos(d),w=x*Math.sin(d);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),b&&(h.x+=_,h.y+=w,t.attr({x2:h.x,y2:h.y}))}}else if("path"===u.nodeName){var A=u.getTotalLength(),k="";if(y){var M=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(M.y-T.y,M.x-T.x),f=u.getPointAtLength(Math.min(x,A)),x&&(k="0px,"+x+"px,")}if(b){var E=u.getPointAtLength(A),L=u.getPointAtLength(A-.1);if(p=Math.atan2(E.y-L.y,E.x-L.x),h=u.getPointAtLength(Math.max(0,A-x)),x){var S=k?2*x:x;k+=A-S+"px,"+A+"px"}}else k&&(k+=A+"px");k&&t.style("stroke-dasharray",k)}var C=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:v,opacity:m,"stroke-width":0})};y&&C(f,d),b&&C(h,p)}}},{"../color":207,"../drawing":230,"./arrow_paths":199,d3:55,"fast-isnumeric":61}],205:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":200,"./calc_autorange":201,"./defaults":202,"./draw":203}],206:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],207:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(C);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?L[0]:(C[e]+C[e-1])/2,e===C.length-1?L[1]:(C[e]+C[e+1])/2].map(J.c2p).map(Math.round);e!==C.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=O(t).replace("e-",""),o=i(a).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 h=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){n.select(this).attr("d","M"+Y+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+j).call(d.lineGroupStyle,_.line.width,R(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=Y+j+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));A("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:M.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,i=x();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(a,r||{}))}function k(){var r=j+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(z=ot.select("text"),z.node()&&!z.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-Y-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-$;at.select(".cbbg").attr({x:Y-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:Y,y:$+_.ypad+("top"===_.titleside?st:0),width:Math.max(j,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var M=t._fullLayout,T=M._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void M._infolayer.selectAll("g."+e).remove();var E,L=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],C=[],R="function"==typeof _.line.color?_.line.color:function(){return _.line.color},O="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},I=_.levels.end+_.levels.size/100,P=_.levels.size,N=1.001*L[0]-.001*L[1],D=1.001*L[1]-.001*L[0];for(E=_.levels.start;(E-I)*P<0;E+=P)E>N&&EL[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+V-X],J.setScale();var at=M._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+q)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+V-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,A(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ft=c.syncOrAsync([o.previousPromises,w,o.previousPromises,k],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var ht,dt,pt;u.init({element:at.node(),prepFn:function(){ht=at.attr("transform"),h(at)},moveFn:function(t,e){at.attr("transform",ht+" translate("+t+","+e+")"),dt=u.align(W+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,V,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);h(at,r)},doneFn:function(e){h(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},x().index)}})}return ft}function x(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":303,"./flip_scale":218,"./scales":225}],214:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":298,"./attributes":212,"./scales.js":225}],215:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":225}],216:[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,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,g=f?i.nestedProperty(e,d).get()||{}:e,v=p[h+"min"],m=p[h+"max"],y=p.colorscale,b=n(v)&&n(m)&&v=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],219:[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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):e}},{"./default_scale":215,"./is_valid_scale_array":223,"./scales":225}],220:[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(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],227:[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":303}],228:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,g=o.getPlotDiv(t.element)||{},v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":303,"../../plotly":328,"../../plots/cartesian/constants":338,"./align":226,"./cursor":227,"./unhover":229}],229:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":297}],230:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,f,h;t.so?(h=o.outlierwidth,f=o.outliercolor,c=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(h||1)+"px",fill:"none"}):(e.style("stroke-width",h+"px").call(l.fill,c),h&&e.call(l.stroke,f))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),f=(c*c*i-u*u*s)*n,h=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&f/d),2),a.round(e[1]+(d&&h/d),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&h/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var v=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=g.tryColorscale(i,""),s=g.tryColorscale(i,"line");n(t,e,r,o,s,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),i=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,a.select(this),e,n,i)})}},g.tryColorscale=function(t,e){var r=e?c.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):c.identity};var b={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(f.convertToTspans);var h=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*x+1,v=b[l]*c,m=.75*u+b[s]*c+(b[s]-1)*p*u/2;h.attr("transform","translate("+v+","+m+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=M&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":291,"../../lib":303,"../../lib/svg_text_utils":317,"../../registry":368,"../../traces/scatter/make_bubble_size_func":422,"../../traces/scatter/subtypes":427,"../color":207,"../colorscale":221,"./symbol_defs":231,d3:55,"fast-isnumeric":61}],231:[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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:55}],232:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],233:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),f=0;f0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);c&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;f="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");s=!v.size(),s?v=e.append("path").classed("yerror",!0):c&&(v=v.transition().duration(r.duration).ease(r.easing)),v.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var m=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-m)+"v"+2*m+"m0,-"+m+"H"+o.xs,o.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":427,d3:55,"fast-isnumeric":61}],238:[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":207,d3:55}],239:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":338}],240:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}var o=n("source"),l=n("visible",!!o);if(!l)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var u={_fullLayout:r},c=["x","y"],f=0;f<2;f++)a.coerceRef(t,e,u,c[f],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var r={name:l,handleItemDefaults:n};o(t,e,r)}},{"../../lib":303,"../../plots/array_container_defaults":330,"../../plots/cartesian/axes":333,"./attributes":239}],241:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,f=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,h=c*d.x[e.xanchor].offset,p=f*d.y[e.yanchor].offset,g=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,v=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+h,m=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:v,y:m,width:c,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=o?o._id:"",b=l?l._id:"",x=y+b;x&&r.call(i.setClipUrl,"clip"+s._uid+x)}for(var s=t._fullLayout,l=[],u=[],c=[],f=0;f=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}},{}],244:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":298,"../../plots/font_attributes":353,"../color/attributes":206}],245:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],246:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(b!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",v),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":303,"../../plots/layout_attributes":359,"../../registry":368,"./attributes":244,"./helpers":249}],247:[function(t,e,r){"use strict";function n(t,e){function r(r){m.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?f.call(m.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=r.indexOf(f);h===-1?r.push(f):r.splice(h,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;r=s*h,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cn.width-(n.margin.r+n.margin.l)&&(b=0,v+=m,i.height=i.height+m,m=0),f.setTranslate(this,a+b,5+a+e.height/2+v),i.width+=o+r,i.height=Math.max(i.height,e.height),b+=o+r,m=Math.max(e.height,m)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),b=t("./get_legend_data"),x=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(g.setRect,B,t,y.scrollBarWidth,y.scrollBarHeight),M.select("rect").attr({y:m.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var m=r.legend,_=r.showlegend&&b(t.calcdata,m),A=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var k=r._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var M=r._topdefs.selectAll("#"+a).data([0]);M.enter().append("clipPath").attr("id",a).append("rect");var T=k.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var E=k.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=k.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=E.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var C=S.selectAll("g.traces").data(f.identity);C.enter().append("g").attr("class","traces"),C.exit().remove(),C.call(x).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?A.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var R=0!==k.enter().size();R&&(o(t,S,C),s(t));var O=0,I=r.width,P=0,N=r.height;o(t,S,C),m.height>N?l(t):s(t);var D=r._size,z=D.l+D.w*m.x,F=D.t+D.h*(1-m.y);w.isRightAnchor(m)?z-=m.width:w.isCenterAnchor(m)&&(z-=m.width/2),w.isBottomAnchor(m)?F-=m.height:w.isMiddleAnchor(m)&&(F-=m.height/2);var B=m.width,j=D.w;B>j?(z=D.l,B=j):(z+B>I&&(z=I-B),zH?(F=D.t,U=H):(F+U>N&&(F=N-U),Fr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":303,"../../registry":368,"../../traces/pie/style_one":401,"../../traces/scatter/subtypes":427,"../color":207,"../drawing":230,d3:55}],252:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(v,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",o.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":303,"../color":207,"./attributes":256,"./button_attributes":257,"./constants":258}],260:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},i=S.line.width?S.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",S.opacity).call(_.stroke,i).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);C&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+C),t._context.editable&&f(t,a,S,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:b.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>Y&&!t.shiftKey?A.getCursor(i/r,1-a/n):"move";k(e,o),G=o.split("-")[0]}function a(e){B=x.getFromId(t,r.xref),j=x.getFromId(t,r.yref),U=T.getDataToPixel(t,B),H=T.getDataToPixel(t,j,!0),V=T.getPixelToData(t,B),q=T.getPixelToData(t,j,!0);var a="shapes["+n+"]";"path"===r.type?(z=r.path,F=a+".path"):(c=U(r.x0),f=H(r.y0),h=U(r.x1),d=H(r.y1),g=a+".x0",m=a+".y0",b=a+".x1",_=a+".y1"),cY&&(u[S]=r[I]=q(s),u[C]=r[P]=q(l)),f-c>X&&(u[R]=r[N]=V(c),u[O]=r[D]=V(f))}e.attr("d",p(t,r))}var u,c,f,h,d,g,m,b,_,w,M,E,L,S,C,R,O,I,P,N,D,z,F,B,j,U,H,V,q,G,X=10,Y=10,W={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=W.element.getBoundingClientRect();A.init(W)}function h(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):b.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=x.getFromId(t,r.id,"x")._id,i=x.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=x.getFromId(t,e.xref),l=x.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),f=n(e.x1),h=a(e.y0),d=a(e.y1); -if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,v=(h+d)/2,m=Math.abs(p-c),y=Math.abs(v-h),b="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(M.segmentRE,function(t){var n=0,i=t.charAt(0),a=M.paramIsX[i],o=M.paramIsY[i],s=M.numParams[i],l=t.substr(1).replace(M.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),b.log("Ignoring extra params in segment "+t)),i+l})}function v(t,e,r){return t.replace(M.segmentRE,function(t){var n=0,i=t.charAt(0),a=M.paramIsX[i],o=M.paramIsY[i],s=M.numParams[i],l=t.substr(1).replace(M.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var m=t("fast-isnumeric"),y=t("../../plotly"),b=t("../../lib"),x=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),A=t("../dragelement"),k=t("../../lib/setcursor"),M=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),L=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":303,"../../lib/setcursor":313,"../../plotly":328,"../../plots/cartesian/axes":333,"../color":207,"../dragelement":228,"../drawing":230,"./constants":270,"./defaults":271,"./helpers":273,"./shape_defaults":275,"fast-isnumeric":61}],273:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],274:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":268,"./calc_autorange":269,"./defaults":271,"./draw":272}],275:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var f=t.path?"path":"rect",h=u("type",f),d=["x","y"],p=0;p<2;p++){var g=d[p],v={_fullLayout:r},m=i.coerceRef(t,e,v,g,"","paper");if("path"!==h){var y,b,x,_=.25,w=.75;"paper"!==m?(y=i.getFromId(v,m),x=o.rangeToShapePosition(y),b=o.shapePositionToRange(y)):b=x=n.identity;var A=g+"0",k=g+"1",M=t[A],T=t[k];t[A]=b(t[A],!0),t[k]=b(t[k],!0),i.coercePosition(e,v,u,m,A,_),i.coercePosition(e,v,u,m,k,w),e[A]=x(e[A]),e[k]=x(e[k]),t[A]=M,t[k]=T}}return"path"===h?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":303,"../../plots/cartesian/axes":333,"./attributes":268,"./helpers":273}],276:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":298,"../../plots/animation_attributes":329,"../../plots/font_attributes":353,"../../plots/pad_attributes":360,"./constants":277}],277:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],278:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+S.railTouchRectClass).data([0]);n.enter().append("rect").classed(S.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,S.tickOffset+r.ticklen+r.labelHeight)}).call(M.fill,r.bgcolor).attr("opacity",0),k.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+S.railRectClass).data([0]);r.enter().append("rect").classed(S.railRectClass,!0);var n=e.inputAreaLength-2*S.railInset;r.attr({width:n,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(r,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+S.groupClassName).data(r,i);l.enter().append("g").classed(S.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,L=!0,S=R,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,k=g.titlefont.family,M=g.titlefont.size,T=g.titlefont.color,E=1,L=!1,S=g.title.trim();""===S&&(E=0),S.match(/Click to enter .+ title/)&&(E=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var R="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?a.restyle(t,v,e,m):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":303,"../../lib/svg_text_utils":317,"../../plotly":328,"../../plots/plots":361,"../color":207,"../drawing":230,d3:55,"fast-isnumeric":61}],282:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":298,"../../plots/font_attributes":353,"../../plots/pad_attributes":360,"../color/attributes":206}],283:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],284:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var f=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){b.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],291:[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}},{}],292:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":205,"./components/images":242,"./components/legend":250,"./components/rangeselector":262,"./components/rangeslider":267,"./components/shapes":274,"./components/sliders":280,"./components/updatemenus":286,"./fonts/mathjax_config":293,"./lib/queue":311,"./plot_api/plot_schema":322,"./plot_api/register":323,"./plot_api/set_plot_config":324,"./plot_api/to_image":326,"./plot_api/validate":327,"./plotly":328,"./snapshot":373,"./snapshot/download":370,"./traces/scatter":417,d3:55,"es6-promise":59}],293:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0, -MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],294:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":289,"fast-isnumeric":61}],295:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var v=(new Date).getFullYear();e=((Number(u[0])-v+70)%100+200)%100+v-70}if(!a(e))return l;var m=new Date(0,0,1);if(m.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(m.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(m.setDate(i),m.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(m.setHours(o),m.getHours()!==o)return l;if(u.length>1)return i=m.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=f*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return m.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,v=3*c,m=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":294,"./coerce":295,"./dates":296,"./extend":298,"./filter_unique":299,"./filter_visible":300,"./is_array":304,"./is_plain_object":305,"./loggers":306,"./matrix":307,"./nested_property":308,"./notifier":309,"./search":312,"./stats":315,d3:55}],304:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],305:[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}},{}],306:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,h(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;uMath.max(c,g)||l>Math.max(f,v)))if(lc||Math.abs(n(o,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":307}],311:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;f90&&l.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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":61}],316:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:10,tinycolor2:182}],317:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,v.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&"); -},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":290,"../constants/xmlns_namespaces":291,"../lib":303,d3:55}],318:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0&&u.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);var i=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lR.range[0]?[1,2]:[2,1]);else{var O=R.range[0],I=R.range[1];"log"===x?(O<=0&&I<=0&&r(E+".autorange",!0),O<=0?O=I/1e6:I<=0&&(I=O/1e6),r(E+".range[0]",Math.log(O)/Math.LN10),r(E+".range[1]",Math.log(I)/Math.LN10)):(r(E+".range[0]",Math.pow(10,O)),r(E+".range[1]",Math.pow(10,I)))}else r(E+".autorange",!0)}if("reverse"===M)L.range?L.range.reverse():(r(E+".autorange",!0),L.range=[1,0]),S.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var P=m.parts[1],N=m.parts[0],D=a[N]||[],z=D[P]||{};2===m.parts.length&&(null===x&&(e[v]="remove"),"add"===e[v]||b.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?P===-1?(g[N]=D,delete g[v]):g[v]=z:b.log("???",e)),!n(z,"x")&&!n(z,"y")||b.containsAny(v,["color","opacity","align","dash"])||(d.docalc=!0);var F=w.getComponentMethod(N,"drawOne");F(t,P,m.parts.slice(2).join("."),e[v]),delete e[v]}else if(A.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1])C.manageArrayContainers(m,x,g),d.doplot=!0;else{var B=String(m.parts[1]||"");0===m.parts[0].indexOf("scene")?d.doplot=!0:0===m.parts[0].indexOf("geo")?d.doplot=!0:0===m.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===v?d.doplot=!0:!o._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?d.docalc=!0:m.parts[0].indexOf("legend")!==-1?d.dolegend=!0:v.indexOf("title")!==-1?d.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&b.containsAny(B,["tick","exponent","grid","zeroline"])?d.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:m.parts.length>1&&B.indexOf("line")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&"mirror"===B?d.doticks=d.dolayoutstyle=!0:"margin.pad"===v?d.doticks=d.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(d.doplot=!0):d.doplot=!0,m.set(x)}}}var j=t._fullLayout.width,U=t._fullLayout.height;A.supplyDefaults(t),t.layout.autosize&&A.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==j||t._fullLayout.height!==U;return H&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:b.extendDeep({},p)}}function g(t){var e=v.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];v.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=b.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(L.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),b=t("../lib"),x=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),A=t("../plots/plots"),k=t("../plots/cartesian/graph_interact"),M=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),L=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),C=t("./helpers"),R=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=O._basePlotModules,r=0;r=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=C.getGraphDiv(t),!b.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=A.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function g(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var v,m,y=0,x=[],_=void 0===e||null===e,w=Array.isArray(e),k=!_&&!w&&b.isPlainObject(e);if(k)x.push({type:"object",data:g(b.extendFlat({},e))});else if(_||"string"==typeof e)for(v=0;v0&&EE)&&L.push(m);x=L}}x.length>0?f(x):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=C.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!b.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:A.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),A.modifyFrames(t,a)},y.purge=function(t){t=C.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return A.cleanPlot([],{},r,e),A.purge(t),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":230,"../components/errorbars":236,"../constants/xmlns_namespaces":291,"../lib":303,"../lib/events":297,"../lib/queue":311,"../lib/svg_text_utils":317,"../plotly":328,"../plots/cartesian/graph_interact":340,"../plots/plots":361,"../plots/polar":364,"../registry":368,"./helpers":319,"./subroutines":325,d3:55,"fast-isnumeric":61}],321:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],322:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};_(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return _(t,g),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)c(t,r,"xaxis"),c(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;c(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){f(t,r,e+r.name)}):f(t,r,r.name))}),{layoutAttributes:o(t)}}function a(t){var e=h.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):t.arrayOk===!0&&(i[n+"src"]=e(n)):d.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function l(t){function e(t,e,r){if(t){var n=t[A];n&&(delete t[A],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return x(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),x(t,b.layout),t}function c(t,e,r){var n=d.nestedProperty(t,r),i=_({},e.layoutAttributes);i[w]=!0,n.set(i)}function f(t,e,r){var n=d.nestedProperty(t,r),i=_(n.get()||{},e.layoutAttributes);n.set(i)}var h=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),m=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),x=d.extendFlat,_=d.extendDeep,w="_isSubplotObj",A="_isLinkedToArray",k="_deprecated",M=[w,A,k];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=A,r.DEPRECATED=k,r.UNDERSCORE_ATTRS=M,r.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:M.concat.role},traces:t,layout:i(),transforms:e,frames:o(v),animation:o(m)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];M.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||d.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){a=a.slice(0,s).concat([r]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=n(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":303,"../plotly":328,"../snapshot/cloneplot":369,"../snapshot/helpers":372,"../snapshot/svgtoimg":374,"../snapshot/tosvg":376,"fast-isnumeric":61}],327:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;mc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=C&&i<=10||e>=15*C)t._tickround="d";else if(e>=O&&i<=16||e>=R)t._tickround="M";else if(e>=I&&i<=19||e>=O)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(b(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);b(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(W),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(W,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(b(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=H(c):"m"===l?a=V(c):"d"===l?(r||(i="
"+H(c)),a=q(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=Y(c),"S"!==l&&(a+=h(y.round(m(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=q(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&m(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,m(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},P.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===i){var g=n-1,v=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,v)]:[g,v]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r.map(t.l2r||Number)},P.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=P.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},P.saveRangeInitial=function(t,e){for(var r=P.list(t,"",!0),n=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=v-1;a>5;a--)i(a)}},P.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},P.autoTicks(f,s);var h,d=P.tickIncrement(P.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*x||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&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),a(t),t._tmin=P.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=P.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),f=0;fL?(e/=L,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,D)):n>S?(e/=S,t.dtick="M"+i(e,1,z)):n>C?(t.dtick=i(e,C,B),t.tick0="2000-01-02"):n>R?t.dtick=i(e,R,z):n>O?t.dtick=i(e,O,F):n>I?t.dtick=i(e,I,F):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,D))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,D)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,D));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},P.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?U:j,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},P.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]a:f1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],335:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),f=[],h=0;h0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],338:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],339:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),b=t("./constants"),x=!0;e.exports=function(t,e,r,s,_,w,A,k){function M(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+vt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+vt+")").attr("d","M0,0Z"),L()}function L(){pt.selectAll(".select-outline").remove()}function S(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(V,e+at)),i=Math.max(0,Math.min(q,r+ot)),a=Math.abs(n-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,X)/2);st.l=Math.min(at,n),st.r=Math.max(at,n),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!J||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function C(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),x=!1)))}function O(e,r){var i=1===(A+k).length;if(e)z();else if(2!==r||i){if(1===r&&i){var a=A?H[0]:U[0],o="s"===A||"w"===k?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",f="middle";if(a.fixedrange)return;A?(f="n"===A?"top":"bottom","right"===a.side&&(c="right")):"e"===k&&(c="right"),rt.call(h.makeEditable,null,{immediate:!0,background:B.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&u.relayout(t,s,r)})}}else D()}function I(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||B._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void f.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=mt[0]+mt[2]*l,c=(s.bottom-e.clientY)/s.height,h=mt[1]+mt[3]*(1-c);if(k){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,r){for(var n,a,o=1-e,s=0;s0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nW.width||Y<0||Y>W.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:k[0]._length/2,Y="ypx"in e?e.ypx:M[0]._length/2;if(R="xval"in e?n(a,e.xval):i(k,X),O="yval"in e?n(a,e.yval):i(M,Y),!g(R[0])||!g(O[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(P=0;P1||D.hoverinfo.indexOf("name")!==-1?D.name:void 0,index:!1,distance:Math.min(Z,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[z]&&(H.subplot=o[z]._subplot),V=q.length,"array"===B){var Q=e[P];"pointNumber"in Q?(H.index=Q.pointNumber,B="closest"):(B="","xval"in Q&&(j=Q.xval,B="x"),"yval"in Q&&(U=Q.yval,B=B?"closest":"y"))}else j=R[F],U=O[F];if(D._module&&D._module.hoverPoints){var $=D._module.hoverPoints(H,j,U,B);if($)for(var K,J=0;J<$.length;J++)K=$[J],g(K.x0)&&g(K.y0)&&q.push(l(K,C))}else v.log("Unrecognized trace type in hover:",D);"closest"===C&&q.length>V&&(q.splice(0,V),Z=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var tt="y"===C&&G.length>1;q.sort(function(t,e){return t.distance-e.distance});var et=b.combine(o.plot_bgcolor||b.background,o.paper_bgcolor),rt={hovermode:C,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(q,rt);c(q,tt?"xa":"ya"),f(nt,tt);var it=t._hoverdata,at=[];for(I=0;I128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):M&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0;r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0),v=h.node().getBoundingClientRect().width+2*I):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,T=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),R=Math.abs(t.y1-t.y0),P=T.width+O+I+v;t.ty0=_-T.top,t.bx=T.width+2*I,t.by=T.height+2*I,t.anchor="start",t.txwidth=T.width,t.tx2width=v,t.offset=0,a?(t.pos=L,m=S+R/2+P<=k,A=S-R/2-P>=0,"top"!==t.idealAlign&&m||!A?m?(S+=R/2,t.anchor="start"):t.anchor="middle":(S-=R/2,t.anchor="end")):(t.pos=S,m=L+C/2+P<=w,A=L-C/2-P>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(a?"rotate("+E+")":""))}),S}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?S:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var v=f[o];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(O+I),s=o+a*(t.txwidth+I),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-R,l=t.offset*C),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*O+l)+","+(O+u)+"v"+(t.by/2-O)+"h"+n*t.bx+"v-"+t.by+"H"+(n*O+l)+"V"+(u-O)+"Z"),i.call(x.setPosition,o+l,u+t.ty0-t.by/2+I).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+a*I+l,u+t.ty0-t.by/2+I),r.select("rect").call(x.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),k=t("./dragbox"),M=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,M,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=T.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":303,"fast-isnumeric":61}],346:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,k=i.xaxes[0]._length,M=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,R,O,I,P,N=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),D=[],z=i.gd,F=[];for(C=0;C0)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*f*Math.abs(n-i))}return l}function r(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var f=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?r:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,o=t[e],l=(t._id||"x").charAt(0);if(n="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,n=n.slice(),!o||2!==o.length)return void(t[e]=n);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),r=0;r<2;r++)if("date"===t.type){if(!a.isDateTime(o[r])){t[e]=n;break}if(o[r]a.MAX_MS&&(o[r]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[r])){if(!i(o[1-r])){t[e]=n;break}o[r]=o[1-r]*(r?10:.1)}if(o[r]<-s?o[r]=-s:o[r]>s&&(o[r]=s),o[0]===o[1]){var f=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=f,o[1]+=f}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?l:r},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var f=c.charAt(0),h=c.substr(1);h=n(h)?Number(h):0,(h<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],351:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(t){var e,r,n,i,a,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,b.push(s),o[s]=a}return o}function f(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=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[u]?r[u].to:f,a=r[c]?r[c].to:h,f[0]===i[0]&&f[1]===i[1]&&h[0]===a[0]&&h[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function h(e,r){function n(e,r){for(i=0;ir.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,b=[],x=c(e),_=Object.keys(x),w=f(y,_,x);if(!w.length)return!1;var A;u&&(A=u());var k,M,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),k=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":303,"../../plotly":328,"../../registry":368,"./axes":333,d3:55}],352:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;ff[d+2]&&(f[d]=-1,f[d+2]=1),h=this[m[d]],h._length=o.viewBox[d+2]-o.viewBox[d],s.doAutoRange(h);o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},y.calcDataBox=function(){var t=this.xaxis,e=this.yaxis,r=t.range,n=e.range,i=t.r2l,a=e.r2l;return[i(r[0]),a(n[0]),i(r[1]),a(n[1])]},y.setRanges=function(t){var e=this.xaxis,r=this.yaxis,n=e.l2r,i=r.l2r;e.range=[n(t[0]),n(t[2])],r.range=[i(t[1]),i(t[3])]},y.updateTraces=function(t,e){var r,n,i,a=Object.keys(this.traces);this.fullData=t;t:for(r=0;r=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"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,f=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=f)}else{p.supplyLayoutGlobalDefaults(a,n);var h=!a.width||!a.height,d=n.autosize,g=t._context&&t._context.autosizable,v=h&&(d||g);v?p.plotAutoSize(t,a,n):h&&p.sanitizeMargins(t),!d&&h&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,n),n._has=p._hasPlotType.bind(n);var m=n._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),f=c.left+c.right,d=c.bottom+c.top,g=1-2*o,v=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(v.width-f)),i=Math.round(g*(v.height-d))}else{var m=l?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,i=parseFloat(m.height)||r.height}var y=p.layoutAttributes.width.min,b=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-i)>1;(_||x)&&(x&&(r.width=n),_&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a;c.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(i=0;i.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,f=r.size,h=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(f*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(f-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var v=l[t].t.val,m=l[t].t.size;if(v>h){var y=(d*v+(m-e.height)*h)/(v-h),b=(m*(1-h)+(d-e.height)*(1-v))/(v-h);y>=0&&b>=0&&y+b>s+o&&(s=y,o=b)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):h.isJSDate(t)?h.ms2DateTime(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)},p.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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,S=L?f.angularAxis.domain:n.extent(k),C=Math.abs(k[1]-k[0]);T&&!M&&(C=0);var R=S.slice();E&&M&&(R[1]+=C);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(R[1]-R[0])/O);var I=f.angularAxis.ticksStep||(R[1]-R[0])/(O*(f.minorTicks+1));A&&(I=Math.max(Math.round(I),1)),R[2]||(R[2]=I);var P=n.range.apply(this,R);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(R.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?C:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var N="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",D=(new DOMParser).parseFromString(N,"application/xml"),z=this.appendChild(this.ownerDocument.importNode(D.documentElement,!0));e=n.select(z)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,B=e.select(".chart-group"),j={fill:"none",stroke:f.tickColor},U={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var H=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();b=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,b=Math.max(10,b),_=[f.margin.left+b,f.margin.top+b],i.range([0,b]),c.layout.radialAxis.domain=i.domain(),F.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),B.attr("transform","translate("+_+")").style({cursor:"crosshair"});var q=[(f.width-(f.margin.left+f.margin.right+2*b+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2];if(q[0]=Math.max(0,q[0]),q[1]=Math.max(0,q[1]),e.select(".outer-group").attr("transform","translate("+q+")"),f.title){var G=e.select("g.title-group text").style(U).text(f.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var Y=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(i.ticks(5));W.enter().append("circle").attr({class:"grid-circle"}).style(j),W.attr("r",i),W.exit().remove()}Y.select("circle.outside-circle").attr({r:b}).style(j);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=n.svg.axis().scale(i).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Y.selectAll(".domain").style(j),Y.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),K=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),K.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(j),K.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(U);var J=$.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+f.labelOffset,i=f.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:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":A?A[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(U);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(B.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[b+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!M){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});B.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;ot=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ct.text(o.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});B.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=i.invert(o.util.getMousePos(Z).radius);var n=o.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(o.util.round(st)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var i=n.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};M&&(u.t=A[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-q[0]-h.left,f.top+f.height/2-q[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.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")})})}),h}var e,r,i,s,l={data:[],layout:{}},u={},c={},f=n.dispatch("hover"),h={};return h.render=function(e){return t(e),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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return i},h.angularScale=function(t){return s},h.svg=function(){return e},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,i=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return i},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("undefined"==typeof 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 r===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=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 s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:h(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,i,a)},"stroke-width":function(t,e){return v["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,i,a)},opacity:function(t,e){return v.opacity(r,i,a)},display:function(t,e){return v.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var v={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},m=n.select(this).selectAll("g.layer").data(l);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],i=n.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=n.merge(i);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,f=c?r.height:u*o.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.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"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(o.length),v=n.scale[c?"linear":"ordinal"]().domain(g).range(l),m=n.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,m(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return v(e)}}),x.exit().remove()}var _=n.svg.axis().scale(m).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var n=t.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(f);var h=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[i.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=i.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};n.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../lib":303,d3:55}],366:[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,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(f=i),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(r),a.config(c).render(f),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,i,a,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},u.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":207,"../../lib":303,"./micropolar":365,"./undo_manager":367,d3:55}],367:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,u=t.layout,c=l([],a),f=l({},u,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(r=0;r1;if(p&&!h&&"category"!==a.type){var g=e.length;if(!(g<=i))return f?e.slice(0,i):e.slice(0,i+1);if(f||d)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;ly;n++)o=l(t,e,a(o));return o>y&&f.log("interp2d didn't converge quickly",o),t}function s(t){var e,r,n,i,a,o,s,l,u=[],c={},f=[],h=t[0],d=[],p=[0,0,0],g=m(t);for(r=0;r=0;a--)i=f[a],r=i[0],n=i[1],o=((c[[r-1,n]]||p)[2]+(c[[r+1,n]]||p)[2]+(c[[r,n-1]]||p)[2]+(c[[r,n+1]]||p)[2])/20,o&&(s[i]=[r,n,o],f.splice(a,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,a,o,s,l,u,c,f,h,d,p,g,v=0;for(o=0;op&&(v=Math.max(v,Math.abs(t[i][a]-d)/(g-p))))}return v}var u=t("fast-isnumeric"),c=t("../../registry"),f=t("../../lib"),h=t("../../plots/cartesian/axes"),d=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),v=t("./convert_column_xyz"),m=t("./max_row_length");e.exports=function(t,e){function r(t){L=e._input.zsmooth=e.zsmooth=!1,f.notifier("cannot fast-zsmooth: "+t)}var a,l,u,y,b,x,_,w,A=h.getFromId(t,e.xaxis||"x"),k=h.getFromId(t,e.yaxis||"y"),M=c.traceIs(e,"contour"),T=c.traceIs(e,"histogram"),E=c.traceIs(e,"gl2d"),L=M?"best":e.zsmooth;if(A._minDtick=0,k._minDtick=0,T){var S=d(t,e);a=S.x,l=S.x0,u=S.dx,y=S.y,b=S.y0,x=S.dy,_=S.z}else g(e)&&v(e,A,k),a=e.x?A.makeCalcdata(e,"x"):[],y=e.y?k.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,b=e.y0||0,x=e.dy||1,_=n(e),(M||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=o(_,e._emptypoints,e._interpz));if("fast"===L)if("log"===A.type||"log"===k.type)r("log axis found");else if(!T){if(a.length){var C=(a[a.length-1]-a[0])/(a.length-1),R=Math.abs(C/100);for(w=0;wR){r("x scale is not linear");break}}if(y.length&&"fast"===L){var O=(y[y.length-1]-y[0])/(y.length-1),I=Math.abs(O/100);for(w=0;wI){r("y scale is not linear");break}}}var P=m(_),N="scaled"===e.xtype?"":a,D=i(e,N,l,u,P,A),z="scaled"===e.ytype?"":y,F=i(e,z,b,x,_.length,k);E||(h.expand(A,D),h.expand(k,F));var B={x:D,y:F,z:_};if(p(e,_,"","z"),M&&e.contours&&"heatmap"===e.contours.coloring){var j="contour"===e.type?"heatmap":"histogram2d";B.xfill=i(j,N,l,u,P,A),B.yfill=i(j,z,b,x,_.length,k)}return[B]};var y=.01,b=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":213,"../../lib":303,"../../plots/cartesian/axes":333,"../../registry":368,"../histogram2d/calc":400,"./convert_column_xyz":388,"./has_columns":390,"./max_row_length":391,"fast-isnumeric":61}],387:[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="cb"+r.uid,u=r.zmin,c=r.zmax;if(n(u)||(u=i.aggNums(Math.min,null,r.z)),n(c)||(c=i.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void a.autoMargin(t,l);var f=e[0].t.cb=s(t,l),h=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});f.fillcolor(h).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":210,"../../components/colorscale":221,"../../lib":303,"../../plots/plots":361,"fast-isnumeric":61}],388:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a=t.x.slice(),o=t.y.slice(),s=t.z,l=t.text,u=Math.min(a.length,o.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(u0&&(n=!0);for(var s=0;sa)return r[t]=a,a-r[t]}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]0?Number(f):c;else if("string"!=typeof f)l.size=c;else{var h=f.charAt(0),d=f.substr(1);d=n(d)?Number(d):0,(d<=0||"date"!==o||"M"!==h||d!==Math.round(d))&&(l.size=c)}var p="autobin"+r;"boolean"!=typeof t[p]&&(t[p]=!((l.start||0===l.start)&&(l.end||0===l.end))),t[p]||delete t["nbins"+r]}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],399:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;iy&&g.splice(y,g.length-y),m.length>y&&m.splice(y,m.length-y),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(g,p,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start=p.c2r(i.tickIncrement(p.r2c(e.xbins.start),e.xbins.size,!0)),e.xbins.end=p.c2r(i.tickIncrement(p.r2c(e.xbins.end),e.xbins.size))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(m,v,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start=v.c2r(i.tickIncrement(v.r2c(e.ybins.start),e.ybins.size,!0)),e.ybins.end=v.c2r(i.tickIncrement(v.r2c(e.ybins.end),e.ybins.size))),e._input.ybins=e.ybins),h=[];var b,x,_=[],w=[],A="string"==typeof e.xbins.size?[]:e.xbins,k="string"==typeof e.xbins.size?[]:e.ybins,M=0,T=[],E=e.histnorm,L=e.histfunc,S=E.indexOf("density")!==-1,C="max"===L||"min"===L,R=C?null:0,O=a.count,I=o[E],P=!1,N=[],D=[],z="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";z&&"count"!==L&&(P="avg"===L,O=a[L]);var F=e.xbins,B=p.r2c(F.start),j=p.r2c(F.end)+(B-i.tickIncrement(B,F.size))/1e6;for(d=B;d=0&&b=0&&x>>1,f)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);if(h)r=h;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var p=o(t.marker.color),g=o(t.marker.border.color),v=t.opacity*t.marker.opacity;p[3]*=v,this.pointcloudOptions.color=p;var m=t.marker.blend;if(null===m){var y=100;m=l.lengthp&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var m={type:"linear"};i.setConvert(m),l=m.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},g.ppad=v.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,i.expand(c,h,g),i.expand(f,d,v);var x=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],410:[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,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=i.aggNums(Math.min,null,c)),n(h)||(h=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":210,"../../components/colorscale":221,"../../lib":303,"../../plots/plots":361,"fast-isnumeric":61}],411:[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":213,"../../components/colorscale/has_colorscale":220,"./subtypes":427}],412:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],413:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var v=s(t,e,g),m=vU!=I>=U&&(C=L[T-1][0],R=L[T][0],S=C+(R-C)*(U-O)/(I-O),z=Math.min(z,S),F=Math.max(F,S));z=Math.max(z,0),F=Math.min(F,h._length);var H=l.defaultLine;return l.opacity(f.fillcolor)?H=f.fillcolor:l.opacity((f.line||{}).color)&&(H=f.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:z,x1:F,y0:U,y1:U,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":207,"../../components/errorbars":236,"../../lib":303,"../../plots/cartesian/constants":338,"../../plots/cartesian/graph_interact":340,"./get_trace_color":415}],417:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":341,"./arrays_to_calcdata":406,"./attributes":407,"./calc":408,"./clean_data":409,"./colorbar":410,"./defaults":413,"./hover":416,"./plot":424,"./select":425,"./style":426,"./subtypes":427}],418:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":216, -"../../components/colorscale/has_colorscale":220}],419:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),i=A.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/w._length,r=t[1]/A._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w=e.xaxis,A=e.yaxis,k=e.simplify,M=e.connectGaps,T=e.baseTolerance,E=e.linear,L=[],S=.2,C=new Array(t.length),R=0;for(k||(T=S=-1),o=0;oi(f))break;l=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,u=f,d=!1):y=t.length||!f)break;C[R++]=f,s=f}}else C[R++]=u}L.push(C.slice(0,R))}return L}},{"../../constants/numerical":289}],420:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],421:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":61}],423:[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){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":207,"../../components/colorscale/defaults":216,"../../components/colorscale/has_colorscale":220,"./subtypes":427}],424:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function i(t,e,r,n,i,d,g){function v(t){return k?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function b(t){if(t.ids)return y}function x(){return!1}function _(t){var e,r,n=t[0].trace,i=o.select(this),a=c.hasMarkers(n),u=c.hasText(n),f=b(n),h=x,d=x;a&&(h=n.marker.maxdisplayed?m:s.identity),u&&(d=n.marker.maxdisplayed?m:s.identity),r=i.selectAll("path.point"),e=r.data(h,f);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,n).call(l.translatePoints,M,T,n),k&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=v(o.select(this));l.translatePoint(t,e,M,T),l.singlePointStyle(t,e,n)}),k?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=i.selectAll("g"),e=r.data(d,f),e.enter().append("g").append("text"),e.each(function(t){var e=v(o.select(this).select("text"));l.translatePoint(t,e,M,T)}),e.selectAll("text").call(l.textPointStyle,n).each(function(t){var e=t.xp||M.c2p(t.x),r=t.yp||T.c2p(t.y);o.select(this).selectAll("tspan").each(function(){v(o.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,A;a(t,e,r,n,i);var k=!!g&&g.duration>0,M=r.xaxis,T=r.yaxis,E=n[0].trace,L=E.line,S=o.select(d);if(S.call(u.plot,r,g),E.visible===!0){v(S).style("opacity",E.opacity);var C,R,O=E.fill.charAt(E.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=S,f(n);var I="",P=[],N=E._prevtrace;N&&(I=N._prevRevpath||"",R=N._nextFill,P=N._polygons);var D,z,F,B,j,U,H,V,q,G="",X="",Y=[],W=[],Z=s.noop;if(C=E._ownFill,c.hasLines(E)||"none"!==E.fill){for(R&&R.datum(n),["hv","vh","hvh","vhv"].indexOf(L.shape)!==-1?(F=l.steps(L.shape),B=l.steps(L.shape.split("").reverse().join(""))):F=B="spline"===L.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),L.smoothing):l.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},j=function(t){return B(t.reverse())},Y=h(n,{xaxis:M,yaxis:T,connectGaps:E.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),q=E._polygons=new Array(Y.length),A=0;A1}),Z=function(t){return function(e){if(D=F(e),z=j(e),G?O?(G+="L"+D.substr(1),X=z+("L"+X.substr(1))):(G+="Z"+D,X=z+"Z"+X):(G=D,X=z),c.hasLines(E)&&e.length>1){var r=o.select(this);if(r.datum(n),t)v(r.style("opacity",0).attr("d",D).call(l.lineGroupStyle)).style("opacity",1);else{var i=v(r);i.attr("d",D),l.singleLineStyle(n,i)}}}}}var Q=S.selectAll(".js-line").data(W);v(Q.exit()).style("opacity",0).remove(),Q.each(Z(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Z(!0)),Y.length&&(C?U&&V&&(O?("y"===O?U[1]=V[1]=T.c2p(0,!0):"x"===O&&(U[0]=V[0]=M.c2p(0,!0)),v(C).attr("d","M"+V+"L"+U+"L"+G.substr(1))):v(C).attr("d",G+"Z")):"tonext"===E.fill.substr(0,6)&&G&&I&&("tonext"===E.fill?v(R).attr("d",G+"Z"+I+"Z"):v(R).attr("d",G+"L"+I.substr(1)+"Z"),E._polygons=E._polygons.concat(P)),E._prevRevpath=X,E._prevPolygons=q);var $=S.selectAll(".points");w=$.data([n]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,s=r.yaxis,l=o.extent(a.range.map(a.r2l).map(a.l2c)),u=o.extent(s.range.map(s.r2l).map(s.l2c)),f=n[0].trace;if(c.hasMarkers(f)){var h=f.marker.maxdisplayed;if(0!==h){var d=n.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/h),g=0;i.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),f=c.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,r),n(t,p),l=0,u=[];ln?1:-1}),v){s&&(h=s());var m=o.transition().duration(a.duration).ease(a.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()});m.each(function(){p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)})})}else p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":230,"../../components/errorbars":236,"../../lib":303,"../../lib/polygon":310,"./arrays_to_calcdata":406,"./line_points":419,"./link_traces":421,"./subtypes":427,d3:55}],425:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,g=!n.hasMarkers(h)&&!n.hasText(h);if(h.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r=e.length?i:e[a]);return n}function o(t,e,r){return l(R(t,r),C(e,r),r)}function s(t,e,r,n){var i=w(t,e,n);return i=Array.isArray(i[0])?i:a(v.identity,[i],n),l(i,C(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;i0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);c&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;f="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");s=!v.size(),s?v=e.append("path").classed("yerror",!0):c&&(v=v.transition().duration(r.duration).ease(r.easing)),v.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var m=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-m)+"v"+2*m+"m0,-"+m+"H"+o.xs,o.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":427,d3:55,"fast-isnumeric":61}],238:[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":207,d3:55}],239:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":338}],240:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}var o=n("source"),l=n("visible",!!o);if(!l)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var u={_fullLayout:r},c=["x","y"],f=0;f<2;f++)a.coerceRef(t,e,u,c[f],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var r={name:l,handleItemDefaults:n};o(t,e,r)}},{"../../lib":303,"../../plots/array_container_defaults":330,"../../plots/cartesian/axes":333,"./attributes":239}],241:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,f=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,h=c*d.x[e.xanchor].offset,p=f*d.y[e.yanchor].offset,g=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,v=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+h,m=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:v,y:m,width:c,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=o?o._id:"",b=l?l._id:"",x=y+b;x&&r.call(i.setClipUrl,"clip"+s._uid+x)}for(var s=t._fullLayout,l=[],u=[],c=[],f=0;f=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}},{}],244:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":298,"../../plots/font_attributes":353,"../color/attributes":206}],245:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],246:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(b!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",v),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":303,"../../plots/layout_attributes":359,"../../registry":368,"./attributes":244,"./helpers":249}],247:[function(t,e,r){"use strict";function n(t,e){function r(r){m.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?f.call(m.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=r.indexOf(f);h===-1?r.push(f):r.splice(h,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;r=s*h,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cn.width-(n.margin.r+n.margin.l)&&(b=0,v+=m,i.height=i.height+m,m=0),f.setTranslate(this,a+b,5+a+e.height/2+v),i.width+=o+r,i.height=Math.max(i.height,e.height),b+=o+r,m=Math.max(e.height,m)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),b=t("./get_legend_data"),x=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(g.setRect,B,t,y.scrollBarWidth,y.scrollBarHeight),M.select("rect").attr({y:m.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var m=r.legend,_=r.showlegend&&b(t.calcdata,m),A=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var k=r._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var M=r._topdefs.selectAll("#"+a).data([0]);M.enter().append("clipPath").attr("id",a).append("rect");var T=k.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var E=k.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=k.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=E.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var C=S.selectAll("g.traces").data(f.identity);C.enter().append("g").attr("class","traces"),C.exit().remove(),C.call(x).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?A.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var R=0!==k.enter().size();R&&(o(t,S,C),s(t));var O=0,I=r.width,P=0,N=r.height;o(t,S,C),m.height>N?l(t):s(t);var D=r._size,z=D.l+D.w*m.x,F=D.t+D.h*(1-m.y);w.isRightAnchor(m)?z-=m.width:w.isCenterAnchor(m)&&(z-=m.width/2),w.isBottomAnchor(m)?F-=m.height:w.isMiddleAnchor(m)&&(F-=m.height/2);var B=m.width,j=D.w;B>j?(z=D.l,B=j):(z+B>I&&(z=I-B),zH?(F=D.t,U=H):(F+U>N&&(F=N-U),Fr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":303,"../../registry":368,"../../traces/pie/style_one":401,"../../traces/scatter/subtypes":427,"../color":207,"../drawing":230,d3:55}],252:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(v,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",o.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":303,"../color":207,"./attributes":256,"./button_attributes":257,"./constants":258}],260:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},i=S.line.width?S.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",S.opacity).call(_.stroke,i).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);C&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+C),t._context.editable&&f(t,a,S,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:b.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>Y&&!t.shiftKey?A.getCursor(i/r,1-a/n):"move";k(e,o),G=o.split("-")[0]}function a(e){B=x.getFromId(t,r.xref),j=x.getFromId(t,r.yref),U=T.getDataToPixel(t,B),H=T.getDataToPixel(t,j,!0),V=T.getPixelToData(t,B),q=T.getPixelToData(t,j,!0);var a="shapes["+n+"]";"path"===r.type?(z=r.path,F=a+".path"):(c=U(r.x0),f=H(r.y0),h=U(r.x1),d=H(r.y1),g=a+".x0",m=a+".y0",b=a+".x1",_=a+".y1"),cY&&(u[S]=r[I]=q(s),u[C]=r[P]=q(l)),f-c>X&&(u[R]=r[N]=V(c),u[O]=r[D]=V(f))}e.attr("d",p(t,r))}var u,c,f,h,d,g,m,b,_,w,M,E,L,S,C,R,O,I,P,N,D,z,F,B,j,U,H,V,q,G,X=10,Y=10,W={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=W.element.getBoundingClientRect();A.init(W)}function h(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):b.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=x.getFromId(t,r.id,"x")._id,i=x.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=x.getFromId(t,e.xref),l=x.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)), +g(e.path,n,a);var c=n(e.x0),f=n(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,v=(h+d)/2,m=Math.abs(p-c),y=Math.abs(v-h),b="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(M.segmentRE,function(t){var n=0,i=t.charAt(0),a=M.paramIsX[i],o=M.paramIsY[i],s=M.numParams[i],l=t.substr(1).replace(M.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),b.log("Ignoring extra params in segment "+t)),i+l})}function v(t,e,r){return t.replace(M.segmentRE,function(t){var n=0,i=t.charAt(0),a=M.paramIsX[i],o=M.paramIsY[i],s=M.numParams[i],l=t.substr(1).replace(M.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var m=t("fast-isnumeric"),y=t("../../plotly"),b=t("../../lib"),x=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),A=t("../dragelement"),k=t("../../lib/setcursor"),M=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),L=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":303,"../../lib/setcursor":313,"../../plotly":328,"../../plots/cartesian/axes":333,"../color":207,"../dragelement":228,"../drawing":230,"./constants":270,"./defaults":271,"./helpers":273,"./shape_defaults":275,"fast-isnumeric":61}],273:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],274:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":268,"./calc_autorange":269,"./defaults":271,"./draw":272}],275:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var f=t.path?"path":"rect",h=u("type",f),d=["x","y"],p=0;p<2;p++){var g=d[p],v={_fullLayout:r},m=i.coerceRef(t,e,v,g,"","paper");if("path"!==h){var y,b,x,_=.25,w=.75;"paper"!==m?(y=i.getFromId(v,m),x=o.rangeToShapePosition(y),b=o.shapePositionToRange(y)):b=x=n.identity;var A=g+"0",k=g+"1",M=t[A],T=t[k];t[A]=b(t[A],!0),t[k]=b(t[k],!0),i.coercePosition(e,v,u,m,A,_),i.coercePosition(e,v,u,m,k,w),e[A]=x(e[A]),e[k]=x(e[k]),t[A]=M,t[k]=T}}return"path"===h?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":303,"../../plots/cartesian/axes":333,"./attributes":268,"./helpers":273}],276:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":298,"../../plots/animation_attributes":329,"../../plots/font_attributes":353,"../../plots/pad_attributes":360,"./constants":277}],277:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],278:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+S.railTouchRectClass).data([0]);n.enter().append("rect").classed(S.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,S.tickOffset+r.ticklen+r.labelHeight)}).call(M.fill,r.bgcolor).attr("opacity",0),k.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+S.railRectClass).data([0]);r.enter().append("rect").classed(S.railRectClass,!0);var n=e.inputAreaLength-2*S.railInset;r.attr({width:n,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(r,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+S.groupClassName).data(r,i);l.enter().append("g").classed(S.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,L=!0,S=R,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,k=g.titlefont.family,M=g.titlefont.size,T=g.titlefont.color,E=1,L=!1,S=g.title.trim();""===S&&(E=0),S.match(/Click to enter .+ title/)&&(E=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var R="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?a.restyle(t,v,e,m):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":303,"../../lib/svg_text_utils":317,"../../plotly":328,"../../plots/plots":361,"../color":207,"../drawing":230,d3:55,"fast-isnumeric":61}],282:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":298,"../../plots/font_attributes":353,"../../plots/pad_attributes":360,"../color/attributes":206}],283:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],284:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var f=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){b.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],291:[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}},{}],292:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":205,"./components/images":242,"./components/legend":250,"./components/rangeselector":262,"./components/rangeslider":267,"./components/shapes":274,"./components/sliders":280,"./components/updatemenus":286,"./fonts/mathjax_config":293,"./lib/queue":311,"./plot_api/plot_schema":322,"./plot_api/register":323,"./plot_api/set_plot_config":324,"./plot_api/to_image":326,"./plot_api/validate":327,"./plotly":328,"./snapshot":373,"./snapshot/download":370,"./traces/scatter":417,d3:55,"es6-promise":59}],293:[function(t,e,r){ +"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],294:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":289,"fast-isnumeric":61}],295:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var v=(new Date).getFullYear();e=((Number(u[0])-v+70)%100+200)%100+v-70}if(!a(e))return l;var m=new Date(0,0,1);if(m.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(m.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(m.setDate(i),m.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(m.setHours(o),m.getHours()!==o)return l;if(u.length>1)return i=m.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=f*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return m.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,v=3*c,m=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":294,"./coerce":295,"./dates":296,"./extend":298,"./filter_unique":299,"./filter_visible":300,"./is_array":304,"./is_plain_object":305,"./loggers":306,"./matrix":307,"./nested_property":308,"./notifier":309,"./search":312,"./stats":315,d3:55}],304:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],305:[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}},{}],306:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,h(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;uMath.max(c,g)||l>Math.max(f,v)))if(lc||Math.abs(n(o,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":307}],311:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;f90&&l.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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":61}],316:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:10,tinycolor2:182}],317:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,v.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(), +r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":290,"../constants/xmlns_namespaces":291,"../lib":303,d3:55}],318:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0&&u.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);var i=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lR.range[0]?[1,2]:[2,1]);else{var O=R.range[0],I=R.range[1];"log"===x?(O<=0&&I<=0&&r(E+".autorange",!0),O<=0?O=I/1e6:I<=0&&(I=O/1e6),r(E+".range[0]",Math.log(O)/Math.LN10),r(E+".range[1]",Math.log(I)/Math.LN10)):(r(E+".range[0]",Math.pow(10,O)),r(E+".range[1]",Math.pow(10,I)))}else r(E+".autorange",!0)}if("reverse"===M)L.range?L.range.reverse():(r(E+".autorange",!0),L.range=[1,0]),S.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var P=m.parts[1],N=m.parts[0],D=a[N]||[],z=D[P]||{};2===m.parts.length&&(null===x&&(e[v]="remove"),"add"===e[v]||b.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?P===-1?(g[N]=D,delete g[v]):g[v]=z:b.log("???",e)),!n(z,"x")&&!n(z,"y")||b.containsAny(v,["color","opacity","align","dash"])||(d.docalc=!0);var F=w.getComponentMethod(N,"drawOne");F(t,P,m.parts.slice(2).join("."),e[v]),delete e[v]}else if(A.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1])C.manageArrayContainers(m,x,g),d.doplot=!0;else{var B=String(m.parts[1]||"");0===m.parts[0].indexOf("scene")?d.doplot=!0:0===m.parts[0].indexOf("geo")?d.doplot=!0:0===m.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===v?d.doplot=!0:!o._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?d.docalc=!0:m.parts[0].indexOf("legend")!==-1?d.dolegend=!0:v.indexOf("title")!==-1?d.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&b.containsAny(B,["tick","exponent","grid","zeroline"])?d.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:m.parts.length>1&&B.indexOf("line")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&"mirror"===B?d.doticks=d.dolayoutstyle=!0:"margin.pad"===v?d.doticks=d.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(d.doplot=!0):d.doplot=!0,m.set(x)}}}var j=t._fullLayout.width,U=t._fullLayout.height;A.supplyDefaults(t),t.layout.autosize&&A.plotAutoSize(t,t.layout,t._fullLayout);var H=e.height||e.width||t._fullLayout.width!==j||t._fullLayout.height!==U;return H&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:b.extendDeep({},p)}}function g(t){var e=v.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];v.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=b.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(L.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),b=t("../lib"),x=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),A=t("../plots/plots"),k=t("../plots/cartesian/graph_interact"),M=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),L=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),C=t("./helpers"),R=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=O._basePlotModules,r=0;r=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=C.getGraphDiv(t),!b.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=A.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function g(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var v,m,y=0,x=[],_=void 0===e||null===e,w=Array.isArray(e),k=!_&&!w&&b.isPlainObject(e);if(k)x.push({type:"object",data:g(b.extendFlat({},e))});else if(_||"string"==typeof e)for(v=0;v0&&EE)&&L.push(m);x=L}}x.length>0?f(x):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=C.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!b.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:A.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),A.modifyFrames(t,a)},y.purge=function(t){t=C.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return A.cleanPlot([],{},r,e),A.purge(t),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":230,"../components/errorbars":236,"../constants/xmlns_namespaces":291,"../lib":303,"../lib/events":297,"../lib/queue":311,"../lib/svg_text_utils":317,"../plotly":328,"../plots/cartesian/graph_interact":340,"../plots/plots":361,"../plots/polar":364,"../registry":368,"./helpers":319,"./subroutines":325,d3:55,"fast-isnumeric":61}],321:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],322:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};_(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return _(t,g),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)c(t,r,"xaxis"),c(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;c(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){f(t,r,e+r.name)}):f(t,r,r.name))}),{layoutAttributes:o(t)}}function a(t){var e=h.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):t.arrayOk===!0&&(i[n+"src"]=e(n)):d.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function l(t){function e(t,e,r){if(t){var n=t[A];n&&(delete t[A],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return x(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),x(t,b.layout),t}function c(t,e,r){var n=d.nestedProperty(t,r),i=_({},e.layoutAttributes);i[w]=!0,n.set(i)}function f(t,e,r){var n=d.nestedProperty(t,r),i=_(n.get()||{},e.layoutAttributes);n.set(i)}var h=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),m=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),x=d.extendFlat,_=d.extendDeep,w="_isSubplotObj",A="_isLinkedToArray",k="_deprecated",M=[w,A,k];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=A,r.DEPRECATED=k,r.UNDERSCORE_ATTRS=M,r.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:M.concat.role},traces:t,layout:i(),transforms:e,frames:o(v),animation:o(m)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];M.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||d.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){a=a.slice(0,s).concat([r]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=n(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":303,"../plotly":328,"../snapshot/cloneplot":369,"../snapshot/helpers":372,"../snapshot/svgtoimg":374,"../snapshot/tosvg":376,"fast-isnumeric":61}],327:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;mc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=C&&i<=10||e>=15*C)t._tickround="d";else if(e>=O&&i<=16||e>=R)t._tickround="M";else if(e>=I&&i<=19||e>=O)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(b(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);b(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(W),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(W,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(b(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=H(c):"m"===l?a=V(c):"d"===l?(r||(i="
"+H(c)),a=q(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=Y(c),"S"!==l&&(a+=h(y.round(m(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=q(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&m(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,m(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},P.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===i){var g=n-1,v=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,v)]:[g,v]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r.map(t.l2r||Number)},P.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=P.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},P.saveRangeInitial=function(t,e){for(var r=P.list(t,"",!0),n=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=v-1;a>5;a--)i(a)}},P.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},P.autoTicks(f,s);var h,d=P.tickIncrement(P.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*x||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&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),a(t),t._tmin=P.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=P.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),f=0;fL?(e/=L,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,D)):n>S?(e/=S,t.dtick="M"+i(e,1,z)):n>C?(t.dtick=i(e,C,B),t.tick0="2000-01-02"):n>R?t.dtick=i(e,R,z):n>O?t.dtick=i(e,O,F):n>I?t.dtick=i(e,I,F):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,D))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,D)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,D));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},P.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?U:j,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},P.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]a:f1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],335:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),f=[],h=0;h0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],338:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],339:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),b=t("./constants"),x=!0;e.exports=function(t,e,r,s,_,w,A,k){function M(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+vt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+vt+")").attr("d","M0,0Z"),L()}function L(){pt.selectAll(".select-outline").remove()}function S(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(V,e+at)),i=Math.max(0,Math.min(q,r+ot)),a=Math.abs(n-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,X)/2);st.l=Math.min(at,n),st.r=Math.max(at,n),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!J||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function C(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),x=!1)))}function O(e,r){var i=1===(A+k).length;if(e)z();else if(2!==r||i){if(1===r&&i){var a=A?H[0]:U[0],o="s"===A||"w"===k?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",f="middle";if(a.fixedrange)return;A?(f="n"===A?"top":"bottom","right"===a.side&&(c="right")):"e"===k&&(c="right"),rt.call(h.makeEditable,null,{immediate:!0,background:B.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&u.relayout(t,s,r)})}}else D()}function I(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||B._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void f.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=mt[0]+mt[2]*l,c=(s.bottom-e.clientY)/s.height,h=mt[1]+mt[3]*(1-c);if(k){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,r){for(var n,a,o=1-e,s=0;s0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nW.width||Y<0||Y>W.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:k[0]._length/2,Y="ypx"in e?e.ypx:M[0]._length/2;if(R="xval"in e?n(a,e.xval):i(k,X),O="yval"in e?n(a,e.yval):i(M,Y),!g(R[0])||!g(O[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(P=0;P1||D.hoverinfo.indexOf("name")!==-1?D.name:void 0,index:!1,distance:Math.min(Z,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[z]&&(H.subplot=o[z]._subplot),V=q.length,"array"===B){var Q=e[P];"pointNumber"in Q?(H.index=Q.pointNumber,B="closest"):(B="","xval"in Q&&(j=Q.xval,B="x"),"yval"in Q&&(U=Q.yval,B=B?"closest":"y"))}else j=R[F],U=O[F];if(D._module&&D._module.hoverPoints){var $=D._module.hoverPoints(H,j,U,B);if($)for(var K,J=0;J<$.length;J++)K=$[J],g(K.x0)&&g(K.y0)&&q.push(l(K,C))}else v.log("Unrecognized trace type in hover:",D);"closest"===C&&q.length>V&&(q.splice(0,V),Z=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var tt="y"===C&&G.length>1;q.sort(function(t,e){return t.distance-e.distance});var et=b.combine(o.plot_bgcolor||b.background,o.paper_bgcolor),rt={hovermode:C,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(q,rt);c(q,tt?"xa":"ya"),f(nt,tt);var it=t._hoverdata,at=[];for(I=0;I128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):M&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0;r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0),v=h.node().getBoundingClientRect().width+2*I):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,T=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),R=Math.abs(t.y1-t.y0),P=T.width+O+I+v;t.ty0=_-T.top,t.bx=T.width+2*I,t.by=T.height+2*I,t.anchor="start",t.txwidth=T.width,t.tx2width=v,t.offset=0,a?(t.pos=L,m=S+R/2+P<=k,A=S-R/2-P>=0,"top"!==t.idealAlign&&m||!A?m?(S+=R/2,t.anchor="start"):t.anchor="middle":(S-=R/2,t.anchor="end")):(t.pos=S,m=L+C/2+P<=w,A=L-C/2-P>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(a?"rotate("+E+")":""))}),S}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?S:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var v=f[o];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(O+I),s=o+a*(t.txwidth+I),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-R,l=t.offset*C),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*O+l)+","+(O+u)+"v"+(t.by/2-O)+"h"+n*t.bx+"v-"+t.by+"H"+(n*O+l)+"V"+(u-O)+"Z"),i.call(x.setPosition,o+l,u+t.ty0-t.by/2+I).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+a*I+l,u+t.ty0-t.by/2+I),r.select("rect").call(x.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),k=t("./dragbox"),M=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,M,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=T.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":303,"fast-isnumeric":61}],346:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,k=i.xaxes[0]._length,M=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,R,O,I,P,N=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),D=[],z=i.gd,F=[];for(C=0;C0)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*f*Math.abs(n-i))}return l}function r(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var f=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?r:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,o=t[e],l=(t._id||"x").charAt(0);if(n="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,n=n.slice(),!o||2!==o.length)return void(t[e]=n);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),r=0;r<2;r++)if("date"===t.type){if(!a.isDateTime(o[r])){t[e]=n;break}if(o[r]a.MAX_MS&&(o[r]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[r])){if(!i(o[1-r])){t[e]=n;break}o[r]=o[1-r]*(r?10:.1)}if(o[r]<-s?o[r]=-s:o[r]>s&&(o[r]=s),o[0]===o[1]){var f=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=f,o[1]+=f}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?l:r},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var f=c.charAt(0),h=c.substr(1);h=n(h)?Number(h):0,(h<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],351:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(t){var e,r,n,i,a,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,b.push(s),o[s]=a}return o}function f(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=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[u]?r[u].to:f,a=r[c]?r[c].to:h,f[0]===i[0]&&f[1]===i[1]&&h[0]===a[0]&&h[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function h(e,r){function n(e,r){for(i=0;ir.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,b=[],x=c(e),_=Object.keys(x),w=f(y,_,x);if(!w.length)return!1;var A;u&&(A=u());var k,M,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),k=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":303,"../../plotly":328,"../../registry":368,"./axes":333,d3:55}],352:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;ff[d+2]&&(f[d]=-1,f[d+2]=1),h=this[m[d]],h._length=o.viewBox[d+2]-o.viewBox[d],s.doAutoRange(h);o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},y.calcDataBox=function(){var t=this.xaxis,e=this.yaxis,r=t.range,n=e.range,i=t.r2l,a=e.r2l;return[i(r[0]),a(n[0]),i(r[1]),a(n[1])]},y.setRanges=function(t){var e=this.xaxis,r=this.yaxis,n=e.l2r,i=r.l2r;e.range=[n(t[0]),n(t[2])],r.range=[i(t[1]),i(t[3])]},y.updateTraces=function(t,e){var r,n,i,a=Object.keys(this.traces);this.fullData=t;t:for(r=0;r=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"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,f=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=f)}else{p.supplyLayoutGlobalDefaults(a,n);var h=!a.width||!a.height,d=n.autosize,g=t._context&&t._context.autosizable,v=h&&(d||g);v?p.plotAutoSize(t,a,n):h&&p.sanitizeMargins(t),!d&&h&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,n),n._has=p._hasPlotType.bind(n);var m=n._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),f=c.left+c.right,d=c.bottom+c.top,g=1-2*o,v=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(v.width-f)),i=Math.round(g*(v.height-d))}else{var m=l?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,i=parseFloat(m.height)||r.height}var y=p.layoutAttributes.width.min,b=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-i)>1;(_||x)&&(x&&(r.width=n),_&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a;c.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(i=0;i.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,f=r.size,h=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(f)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(f*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(f-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var v=l[t].t.val,m=l[t].t.size;if(v>h){var y=(d*v+(m-e.height)*h)/(v-h),b=(m*(1-h)+(d-e.height)*(1-v))/(v-h);y>=0&&b>=0&&y+b>s+o&&(s=y,o=b)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):h.isJSDate(t)?h.ms2DateTime(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)},p.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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,S=L?f.angularAxis.domain:n.extent(k),C=Math.abs(k[1]-k[0]);T&&!M&&(C=0);var R=S.slice();E&&M&&(R[1]+=C);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(R[1]-R[0])/O);var I=f.angularAxis.ticksStep||(R[1]-R[0])/(O*(f.minorTicks+1));A&&(I=Math.max(Math.round(I),1)),R[2]||(R[2]=I);var P=n.range.apply(this,R);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(R.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?C:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var N="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",D=(new DOMParser).parseFromString(N,"application/xml"),z=this.appendChild(this.ownerDocument.importNode(D.documentElement,!0));e=n.select(z)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var F,B=e.select(".chart-group"),j={fill:"none",stroke:f.tickColor},U={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){F=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var H=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:F,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=F.node().getBBox();b=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,b=Math.max(10,b),_=[f.margin.left+b,f.margin.top+b],i.range([0,b]),c.layout.radialAxis.domain=i.domain(),F.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),B.attr("transform","translate("+_+")").style({cursor:"crosshair"});var q=[(f.width-(f.margin.left+f.margin.right+2*b+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2];if(q[0]=Math.max(0,q[0]),q[1]=Math.max(0,q[1]),e.select(".outer-group").attr("transform","translate("+q+")"),f.title){var G=e.select("g.title-group text").style(U).text(f.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-b-20})}var Y=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(i.ticks(5));W.enter().append("circle").attr({class:"grid-circle"}).style(j),W.attr("r",i),W.exit().remove()}Y.select("circle.outside-circle").attr({r:b}).style(j);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=n.svg.axis().scale(i).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),Y.selectAll(".domain").style(j),Y.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),K=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),$.exit().remove(),K.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(j),K.selectAll(".minor").style({stroke:f.minorTickColor}),$.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(U);var J=$.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+f.labelOffset,i=f.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:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":A?A[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(U);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(B.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[b+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!M){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});B.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;ot=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ct.text(o.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});B.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=i.invert(o.util.getMousePos(Z).radius);var n=o.util.convertToCartesian(r,f.radialAxis.orientation);ft.text(o.util.round(st)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ht.hide(),ct.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var i=n.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};M&&(u.t=A[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-q[0]-h.left,f.top+f.height/2-q[1]-h.top];ht.config({color:s}).text(c),ht.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&ht.show())}).on("mouseout.tooltip",function(t,e){ht.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")})})}),h}var e,r,i,s,l={data:[],layout:{}},u={},c={},f=n.dispatch("hover"),h={};return h.render=function(e){return t(e),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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return i},h.angularScale=function(t){return s},h.svg=function(){return e},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,i=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return i},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("undefined"==typeof 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 r===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=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 s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:h(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,i,a)},"stroke-width":function(t,e){return v["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,i,a)},opacity:function(t,e){return v.opacity(r,i,a)},display:function(t,e){return v.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var v={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},m=n.select(this).selectAll("g.layer").data(l);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(f[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],i=n.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=n.merge(i);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,f=c?r.height:u*o.length,h=s.classed("legend-group",!0),d=h.selectAll("svg").data([0]),p=d.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"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(o.length),v=n.scale[c?"linear":"ordinal"]().domain(g).range(l),m=n.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,f]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(c){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[u/2,m(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return v(e)}}),x.exit().remove()}var _=n.svg.axis().scale(m).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var n=t.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(f);var h=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[i.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=i.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],f={};n.entries(s.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value}),s.margin=f}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../lib":303,d3:55}],366:[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,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(f=i),n.select(n.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(r),a.config(c).render(f),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,i,a,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.redo()},e},u.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":207,"../../lib":303,"./micropolar":365,"./undo_manager":367,d3:55}],367:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,u=t.layout,c=l([],a),f=l({},u,n(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var h=Object.keys(f);for(r=0;r1;if(p&&!h&&"category"!==a.type){var g=e.length;if(!(g<=i))return f?e.slice(0,i):e.slice(0,i+1);if(f||d)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;ly;n++)o=l(t,e,a(o));return o>y&&f.log("interp2d didn't converge quickly",o),t}function s(t){var e,r,n,i,a,o,s,l,u=[],c={},f=[],h=t[0],d=[],p=[0,0,0],g=m(t);for(r=0;r=0;a--)i=f[a],r=i[0],n=i[1],o=((c[[r-1,n]]||p)[2]+(c[[r+1,n]]||p)[2]+(c[[r,n-1]]||p)[2]+(c[[r,n+1]]||p)[2])/20,o&&(s[i]=[r,n,o],f.splice(a,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,a,o,s,l,u,c,f,h,d,p,g,v=0;for(o=0;op&&(v=Math.max(v,Math.abs(t[i][a]-d)/(g-p))))}return v}var u=t("fast-isnumeric"),c=t("../../registry"),f=t("../../lib"),h=t("../../plots/cartesian/axes"),d=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),v=t("./convert_column_xyz"),m=t("./max_row_length");e.exports=function(t,e){function r(t){L=e._input.zsmooth=e.zsmooth=!1,f.notifier("cannot fast-zsmooth: "+t)}var a,l,u,y,b,x,_,w,A=h.getFromId(t,e.xaxis||"x"),k=h.getFromId(t,e.yaxis||"y"),M=c.traceIs(e,"contour"),T=c.traceIs(e,"histogram"),E=c.traceIs(e,"gl2d"),L=M?"best":e.zsmooth;if(A._minDtick=0,k._minDtick=0,T){var S=d(t,e);a=S.x,l=S.x0,u=S.dx,y=S.y,b=S.y0,x=S.dy,_=S.z}else g(e)&&v(e,A,k),a=e.x?A.makeCalcdata(e,"x"):[],y=e.y?k.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,b=e.y0||0,x=e.dy||1,_=n(e),(M||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=o(_,e._emptypoints,e._interpz));if("fast"===L)if("log"===A.type||"log"===k.type)r("log axis found");else if(!T){if(a.length){var C=(a[a.length-1]-a[0])/(a.length-1),R=Math.abs(C/100);for(w=0;wR){r("x scale is not linear");break}}if(y.length&&"fast"===L){var O=(y[y.length-1]-y[0])/(y.length-1),I=Math.abs(O/100);for(w=0;wI){r("y scale is not linear");break}}}var P=m(_),N="scaled"===e.xtype?"":a,D=i(e,N,l,u,P,A),z="scaled"===e.ytype?"":y,F=i(e,z,b,x,_.length,k);E||(h.expand(A,D),h.expand(k,F));var B={x:D,y:F,z:_};if(p(e,_,"","z"),M&&e.contours&&"heatmap"===e.contours.coloring){var j="contour"===e.type?"heatmap":"histogram2d";B.xfill=i(j,N,l,u,P,A),B.yfill=i(j,z,b,x,_.length,k)}return[B]};var y=.01,b=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":213,"../../lib":303,"../../plots/cartesian/axes":333,"../../registry":368,"../histogram2d/calc":400,"./convert_column_xyz":388,"./has_columns":390,"./max_row_length":391,"fast-isnumeric":61}],387:[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="cb"+r.uid,u=r.zmin,c=r.zmax;if(n(u)||(u=i.aggNums(Math.min,null,r.z)),n(c)||(c=i.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void a.autoMargin(t,l);var f=e[0].t.cb=s(t,l),h=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});f.fillcolor(h).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":210,"../../components/colorscale":221,"../../lib":303,"../../plots/plots":361,"fast-isnumeric":61}],388:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a=t.x.slice(),o=t.y.slice(),s=t.z,l=t.text,u=Math.min(a.length,o.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(u0&&(n=!0);for(var s=0;sa)return r[t]=a,a-r[t]}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]0?Number(f):c;else if("string"!=typeof f)l.size=c;else{var h=f.charAt(0),d=f.substr(1);d=n(d)?Number(d):0,(d<=0||"date"!==o||"M"!==h||d!==Math.round(d))&&(l.size=c)}var p="autobin"+r;"boolean"!=typeof t[p]&&(t[p]=!((l.start||0===l.start)&&(l.end||0===l.end))),t[p]||delete t["nbins"+r]}},{"../../constants/numerical":289,"../../lib":303,"fast-isnumeric":61}],399:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;iy&&g.splice(y,g.length-y),m.length>y&&m.splice(y,m.length-y),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(g,p,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start=p.c2r(i.tickIncrement(p.r2c(e.xbins.start),e.xbins.size,!0)),e.xbins.end=p.c2r(i.tickIncrement(p.r2c(e.xbins.end),e.xbins.size))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(m,v,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start=v.c2r(i.tickIncrement(v.r2c(e.ybins.start),e.ybins.size,!0)),e.ybins.end=v.c2r(i.tickIncrement(v.r2c(e.ybins.end),e.ybins.size))),e._input.ybins=e.ybins),h=[];var b,x,_=[],w=[],A="string"==typeof e.xbins.size?[]:e.xbins,k="string"==typeof e.xbins.size?[]:e.ybins,M=0,T=[],E=e.histnorm,L=e.histfunc,S=E.indexOf("density")!==-1,C="max"===L||"min"===L,R=C?null:0,O=a.count,I=o[E],P=!1,N=[],D=[],z="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";z&&"count"!==L&&(P="avg"===L,O=a[L]);var F=e.xbins,B=p.r2c(F.start),j=p.r2c(F.end)+(B-i.tickIncrement(B,F.size))/1e6;for(d=B;d=0&&b=0&&x>>1,f)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);if(h)r=h;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var p=o(t.marker.color),g=o(t.marker.border.color),v=t.opacity*t.marker.opacity;p[3]*=v,this.pointcloudOptions.color=p;var m=t.marker.blend;if(null===m){var y=100;m=l.lengthp&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var m={type:"linear"};i.setConvert(m),l=m.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},g.ppad=v.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,i.expand(c,h,g),i.expand(f,d,v);var x=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],410:[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,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=i.aggNums(Math.min,null,c)),n(h)||(h=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":210,"../../components/colorscale":221,"../../lib":303,"../../plots/plots":361,"fast-isnumeric":61}],411:[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":213,"../../components/colorscale/has_colorscale":220,"./subtypes":427}],412:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],413:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),f=t("./text_defaults"),h=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var v=s(t,e,g),m=vU!=I>=U&&(C=L[T-1][0],R=L[T][0],S=C+(R-C)*(U-O)/(I-O),z=Math.min(z,S),F=Math.max(F,S));z=Math.max(z,0),F=Math.min(F,h._length);var H=l.defaultLine;return l.opacity(f.fillcolor)?H=f.fillcolor:l.opacity((f.line||{}).color)&&(H=f.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:z,x1:F,y0:U,y1:U,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":207,"../../components/errorbars":236,"../../lib":303,"../../plots/cartesian/constants":338,"../../plots/cartesian/graph_interact":340,"./get_trace_color":415}],417:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":341,"./arrays_to_calcdata":406,"./attributes":407,"./calc":408,"./clean_data":409,"./colorbar":410,"./defaults":413,"./hover":416,"./plot":424,"./select":425,"./style":426,"./subtypes":427}],418:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r), +n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":216,"../../components/colorscale/has_colorscale":220}],419:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),i=A.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/w._length,r=t[1]/A._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w=e.xaxis,A=e.yaxis,k=e.simplify,M=e.connectGaps,T=e.baseTolerance,E=e.linear,L=[],S=.2,C=new Array(t.length),R=0;for(k||(T=S=-1),o=0;oi(f))break;l=f,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,u=f,d=!1):y=t.length||!f)break;C[R++]=f,s=f}}else C[R++]=u}L.push(C.slice(0,R))}return L}},{"../../constants/numerical":289}],420:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],421:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":61}],423:[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){var u,c=o.isBubble(t),f=(t.line||{}).color;f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":207,"../../components/colorscale/defaults":216,"../../components/colorscale/has_colorscale":220,"./subtypes":427}],424:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function i(t,e,r,n,i,d,g){function v(t){return k?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function b(t){if(t.ids)return y}function x(){return!1}function _(t){var e,r,n=t[0].trace,i=o.select(this),a=c.hasMarkers(n),u=c.hasText(n),f=b(n),h=x,d=x;a&&(h=n.marker.maxdisplayed?m:s.identity),u&&(d=n.marker.maxdisplayed?m:s.identity),r=i.selectAll("path.point"),e=r.data(h,f);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,n).call(l.translatePoints,M,T,n),k&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=v(o.select(this));l.translatePoint(t,e,M,T),l.singlePointStyle(t,e,n)}),k?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=i.selectAll("g"),e=r.data(d,f),e.enter().append("g").append("text"),e.each(function(t){var e=v(o.select(this).select("text"));l.translatePoint(t,e,M,T)}),e.selectAll("text").call(l.textPointStyle,n).each(function(t){var e=t.xp||M.c2p(t.x),r=t.yp||T.c2p(t.y);o.select(this).selectAll("tspan").each(function(){v(o.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,A;a(t,e,r,n,i);var k=!!g&&g.duration>0,M=r.xaxis,T=r.yaxis,E=n[0].trace,L=E.line,S=o.select(d);if(S.call(u.plot,r,g),E.visible===!0){v(S).style("opacity",E.opacity);var C,R,O=E.fill.charAt(E.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=S,f(n);var I="",P=[],N=E._prevtrace;N&&(I=N._prevRevpath||"",R=N._nextFill,P=N._polygons);var D,z,F,B,j,U,H,V,q,G="",X="",Y=[],W=[],Z=s.noop;if(C=E._ownFill,c.hasLines(E)||"none"!==E.fill){for(R&&R.datum(n),["hv","vh","hvh","vhv"].indexOf(L.shape)!==-1?(F=l.steps(L.shape),B=l.steps(L.shape.split("").reverse().join(""))):F=B="spline"===L.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),L.smoothing):l.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},j=function(t){return B(t.reverse())},Y=h(n,{xaxis:M,yaxis:T,connectGaps:E.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),q=E._polygons=new Array(Y.length),A=0;A1}),Z=function(t){return function(e){if(D=F(e),z=j(e),G?O?(G+="L"+D.substr(1),X=z+("L"+X.substr(1))):(G+="Z"+D,X=z+"Z"+X):(G=D,X=z),c.hasLines(E)&&e.length>1){var r=o.select(this);if(r.datum(n),t)v(r.style("opacity",0).attr("d",D).call(l.lineGroupStyle)).style("opacity",1);else{var i=v(r);i.attr("d",D),l.singleLineStyle(n,i)}}}}}var Q=S.selectAll(".js-line").data(W);v(Q.exit()).style("opacity",0).remove(),Q.each(Z(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Z(!0)),Y.length&&(C?U&&V&&(O?("y"===O?U[1]=V[1]=T.c2p(0,!0):"x"===O&&(U[0]=V[0]=M.c2p(0,!0)),v(C).attr("d","M"+V+"L"+U+"L"+G.substr(1))):v(C).attr("d",G+"Z")):"tonext"===E.fill.substr(0,6)&&G&&I&&("tonext"===E.fill?v(R).attr("d",G+"Z"+I+"Z"):v(R).attr("d",G+"L"+I.substr(1)+"Z"),E._polygons=E._polygons.concat(P)),E._prevRevpath=X,E._prevPolygons=q);var $=S.selectAll(".points");w=$.data([n]),$.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,s=r.yaxis,l=o.extent(a.range.map(a.r2l).map(a.l2c)),u=o.extent(s.range.map(s.r2l).map(s.l2c)),f=n[0].trace;if(c.hasMarkers(f)){var h=f.marker.maxdisplayed;if(0!==h){var d=n.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/h),g=0;i.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),f=c.data(r,function(t){return t[0].trace.uid}),f.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,r),n(t,p),l=0,u=[];ln?1:-1}),v){s&&(h=s());var m=o.transition().duration(a.duration).ease(a.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()});m.each(function(){p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)})})}else p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":230,"../../components/errorbars":236,"../../lib":303,"../../lib/polygon":310,"./arrays_to_calcdata":406,"./line_points":419,"./link_traces":421,"./subtypes":427,d3:55}],425:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,f=[],h=l[0].trace,d=h.index,p=h.marker,g=!n.hasMarkers(h)&&!n.hasText(h);if(h.visible===!0&&!g){var v=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r=e.length?i:e[a]);return n}function o(t,e,r){return l(R(t,r),C(e,r),r)}function s(t,e,r,n){var i=w(t,e,n);return i=Array.isArray(i[0])?i:a(v.identity,[i],n),l(i,C(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;ithis.mid&&this.right){va "binary-search-bounds":34,"functional-red-black-tree":84,"robust-orientation":220}],237:[function(t,e,r){"use strict";function n(t,e){var r=u(l(t,e),[e[e.length-1]]);return r[r.length-1]}function i(t,e,r,n){var i=n-e,a=-e/i;a<0?a=0:a>1&&(a=1);for(var o=1-a,s=t.length,l=new Array(s),u=0;u0||o>0&&c<0){var f=i(s,c,l,o);r.push(f),a.push(f.slice())}c<0?a.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),a.push(l.slice())),o=c}return{positive:r,negative:a}}function o(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u>=0&&r.push(s.slice()),a=u}return r}function s(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l0||a>0&&u<0)&&r.push(i(o,u,s,a)),u<=0&&r.push(s.slice()),a=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=a,e.exports.positive=o,e.exports.negative=s},{"robust-dot-product":217,"robust-sum":225}],238:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function a(t,e){return Array(e+1).join(t)}var o={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,f,h,d=1,p=t.length,g="",v=[],m=!0,y="";for(s=0;s=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}o.json.test(u[8])?v[v.length]=n:(!o.number.test(u[8])||m&&!u[3]?y="":(y=m?"+":"-",n=n.toString().replace(o.sign,"")),f=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",h=u[6]-(y+n).length,c=u[6]&&h>0?a(f,h):"",v[v.length]=u[5]?y+n+c:"0"===f?y+c+n:c+y+n)}return v.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=o.text.exec(e)))n[n.length]=r[0];else if(null!==(r=o.modulo.exec(e)))n[n.length]="%";else{if(null===(r=o.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var a=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a[a.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))a[a.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a[a.length]=l[1]}r[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],239:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],240:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128===0){f.length>0&&h.push("}}");var d="vExtra"+f.length;n.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(k="+"+v[x]+"*c");var T=.5*(p[x].length/y),E=.5+.5*(m[x]/y);M.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+k+")/("+g[x].join("+")+")")}h.push("a.push([",M.join(),"]);","break;")}n.push("}},"),f.length>0&&h.push("}}");for(var L=[],u=0;u<1<.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var i,a,o;if(t=L(t,360),e=L(e,100),r=L(r,100),0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}function l(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,i,a=G(t,e,r),o=q(t,e,r),s=a,l=a-o;if(i=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-r)/l+(e>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(n(i));return o}function k(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,a=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:i,s:a,v:o})),o=(o+l)%1;return s}function T(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){P(t)&&(t="100%");var n=R(t);return t=q(r,G(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function S(t){return q(1,G(0,t))}function C(t){return parseInt(t,16)}function P(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function R(t){return"string"==typeof t&&t.indexOf("%")!=-1}function N(t){return 1==t.length?"0"+t:""+t}function O(t){return t<=1&&(t=100*t+"%"),t}function I(t){return e.round(255*parseFloat(t)).toString(16)}function z(t){return C(t)/255}function j(t){return!!Z.CSS_UNIT.exec(t)}function D(t){t=t.replace(B,"").replace(U,"").toLowerCase();var e=!1;if(W[t])t=W[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Z.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),a:z(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),a:z(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.hex3.exec(t))&&{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),format:e?"name":"hex"}}function F(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var B=/^\s+/,U=/\s+$/,V=0,H=e.round,q=e.min,G=e.max,X=e.random;n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,n,i,a,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,i=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=E(t),this._roundA=H(100*this._a)/100,this},toHsv:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=l(this._r,this._g,this._b),e=H(360*t.h),r=H(100*t.s),n=H(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=H(360*t.h),r=H(100*t.s),n=H(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return f(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:H(this._r),g:H(this._g),b:H(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+H(this._r)+", "+H(this._g)+", "+H(this._b)+")":"rgba("+H(this._r)+", "+H(this._g)+", "+H(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:H(100*L(this._r,255))+"%",g:H(100*L(this._g,255))+"%",b:H(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+H(100*L(this._r,255))+"%, "+H(100*L(this._g,255))+"%, "+H(100*L(this._b,255))+"%)":"rgba("+H(100*L(this._r,255))+"%, "+H(100*L(this._g,255))+"%, "+H(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[c(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);r="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"hex4"===t||"hex8"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"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())},clone:function(){return n(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(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,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(M,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?r[i]=t[i]:r[i]=O(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100,s={r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a};return n(s)},n.readability=function(t,r){var i=n(t),a=n(r);return(e.max(i.getLuminance(),a.getLuminance())+.05)/(e.min(i.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,a,o=n.readability(t,e);switch(a=!1,i=F(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},n.mostReadable=function(t,e,r){var i,a,o,s,l=null,u=0;r=r||{},a=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=i,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!a?l:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var W=n.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=n.hexNames=T(W),Z=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],242:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function a(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var o=t("parse-unit");e.exports=a;var s=96},{"parse-unit":198}],243:[function(t,e,r){"use strict";function n(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(o(t+1)),r=[],n=0;nMath.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var a=0,o=0,s=0;s<3;++s)a+=t[s]*t[s],o+=i[s]*t[s];for(var s=0;s<3;++s)i[s]-=o/a*t[s];return h(i,i),i}function o(t,e,r,n,i,a,o,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([a]),this.angle=l([o,s]),this.angle.bounds=[[-(1/0),-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;u<16;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.up||[0,1,0],i=t.right||a(r),s=t.radius||1,l=t.theta||0,u=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),h(r,r),i=[].slice.call(i,0,3),h(i,i),"eye"in t){var c=t.eye,p=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];f(i,p,r),n(i[0],i[1],i[2])<1e-6?i=a(r):h(i,i),s=n(p[0],p[1],p[2]);var g=d(r,p)/s,v=d(i,p)/s;u=Math.acos(g),l=Math.acos(v)}return s=Math.log(s),new o(t.zoomMin,t.zoomMax,e,r,i,s,l,u)}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),f=t("gl-vec3/cross"),h=t("gl-vec3/normalize"),d=t("gl-vec3/dot"),p=o.prototype;p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,i=0,a=0,o=0;o<3;++o)a+=e[o]*r[o],i+=e[o]*e[o];for(var s=Math.sqrt(i),l=0,o=0;o<3;++o)r[o]-=e[o]*a/i,l+=r[o]*r[o],e[o]/=s;for(var u=Math.sqrt(l),o=0;o<3;++o)r[o]/=u;var c=this.computedToward;f(c,e,r),h(c,c);for(var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],g=this.computedAngle[1],v=Math.cos(p),m=Math.sin(p),y=Math.cos(g),b=Math.sin(g),x=this.computedCenter,_=v*y,w=m*y,A=b,M=-v*b,k=-m*b,T=y,E=this.computedEye,L=this.computedMatrix,o=0;o<3;++o){var S=_*r[o]+w*c[o]+A*e[o];L[4*o+1]=M*r[o]+k*c[o]+T*e[o],L[4*o+2]=S,L[4*o+3]=0}var C=L[1],P=L[5],R=L[9],N=L[2],O=L[6],I=L[10],z=P*I-R*O,j=R*N-C*I,D=C*O-P*N,F=n(z,j,D);z/=F,j/=F,D/=F,L[0]=z,L[4]=j,L[8]=D;for(var o=0;o<3;++o)E[o]=x[o]+L[2+4*o]*d;for(var o=0;o<3;++o){for(var l=0,B=0;B<3;++B)l+=L[o+4*B]*E[B];L[12+o]=-l}L[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 g=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;g[0]=i[2],g[1]=i[6],g[2]=i[10];for(var a=this.computedUp,o=this.computedRight,s=this.computedToward,l=0;l<3;++l)i[4*l]=a[l],i[4*l+1]=o[l],i[4*l+2]=s[l];c(i,i,n,g);for(var l=0;l<3;++l)a[l]=i[4*l],o[l]=i[4*l+1];this.up.set(t,a[0],a[1],a[2]),this.right.set(t,o[0],o[1],o[2])}},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=(Math.exp(this.computedRadius[0]),a[1]),s=a[5],l=a[9],u=n(o,s,l);o/=u,s/=u,l/=u;var c=a[0],f=a[4],h=a[8],d=c*o+f*s+h*l;c-=o*d,f-=s*d,h-=l*d;var p=n(c,f,h);c/=p,f/=p,h/=p;var g=c*e+o*r,v=f*e+s*r,m=h*e+l*r;this.center.move(t,g,v,m);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e,r,a){var o=1;"number"==typeof r&&(o=0|r),(o<0||o>3)&&(o=1);var s=(o+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[o],c=e[o+4],f=e[o+8];if(a){var h=Math.abs(l),d=Math.abs(c),p=Math.abs(f),g=Math.max(h,d,p);h===g?(l=l<0?-1:1,c=f=0):p===g?(f=f<0?-1:1,l=c=0):(c=c<0?-1:1,l=f=0)}else{var v=n(l,c,f);l/=v,c/=v,f/=v}var m=e[s],y=e[s+4],b=e[s+8],x=m*l+y*c+b*f;m-=l*x,y-=c*x,b-=f*x;var _=n(m,y,b);m/=_,y/=_,b/=_;var w=c*b-f*y,A=f*m-l*b,M=l*y-c*m,k=n(w,A,M);w/=k,A/=k,M/=k,this.center.jump(t,q,G,X),this.radius.idle(t),this.up.jump(t,l,c,f),this.right.jump(t,m,y,b);var T,E;if(2===o){var L=e[1],S=e[5],C=e[9],P=L*m+S*y+C*b,R=L*w+S*A+C*M;T=z<0?-Math.PI/2:Math.PI/2,E=Math.atan2(R,P)}else{var N=e[2],O=e[6],I=e[10],z=N*l+O*c+I*f,j=N*m+O*y+I*b,D=N*w+O*A+I*M;T=Math.asin(i(z)),E=Math.atan2(D,j)}this.angle.jump(t,E,T),this.recalcMatrix(t);var F=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var H=V[15],q=V[12]/H,G=V[13]/H,X=V[14]/H,W=Math.exp(this.computedRadius[0]);this.center.jump(t,q-F*W,G-B*W,X-U*W)},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,a){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,a=a||this.computedUp;var o=a[0],s=a[1],l=a[2],u=n(o,s,l);if(!(u<1e-6)){o/=u,s/=u,l/=u;var c=e[0]-r[0],f=e[1]-r[1],h=e[2]-r[2],d=n(c,f,h);if(!(d<1e-6)){c/=d,f/=d,h/=d;var p=this.computedRight,g=p[0],v=p[1],m=p[2],y=o*g+s*v+l*m;g-=y*o,v-=y*s,m-=y*l;var b=n(g,v,m);if(!(b<.01&&(g=s*h-l*f,v=l*c-o*h,m=o*f-s*c,b=n(g,v,m),b<1e-6))){g/=b,v/=b,m/=b,this.up.set(t,o,s,l),this.right.set(t,g,v,m),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=s*m-l*v,_=l*g-o*m,w=o*v-s*g,A=n(x,_,w);x/=A,_/=A,w/=A;var M=o*c+s*f+l*h,k=g*c+v*f+m*h,T=x*c+_*f+w*h,E=Math.asin(i(M)),L=Math.atan2(T,k),S=this.angle._state,C=S[S.length-1],P=S[S.length-2];C%=2*Math.PI;var R=Math.abs(C+2*Math.PI-L),N=Math.abs(C-L),O=Math.abs(C-2*Math.PI-L);R0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(o(t),0,t)}function l(t){return new Uint16Array(o(2*t),0,t)}function u(t){return new Uint32Array(o(4*t),0,t)}function c(t){return new Int8Array(o(t),0,t)}function f(t){return new Int16Array(o(2*t),0,t)}function h(t){return new Int32Array(o(4*t),0,t)}function d(t){return new Float32Array(o(4*t),0,t)}function p(t){return new Float64Array(o(8*t),0,t)}function g(t){return x?new Uint8ClampedArray(o(t),0,t):s(t)}function v(t){return new DataView(o(t),0,t)}function m(t){t=y.nextPow2(t);var e=y.log2(t),r=A[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,A=_.BUFFER;r.free=function(t){if(n.isBuffer(t))A[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(t){A[y.log2(t.length)].push(t)},r.malloc=function(t,e){ if(void 0===e||"arraybuffer"===e)return o(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return u(t);case"int8":return c(t);case"int16":return f(t);case"int32":return h(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return m(t);case"data":case"dataview":return v(t);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=f,r.mallocInt32=h,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=v,r.mallocBuffer=m,r.clearCache=function(){for(var t=0;t<32;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,A[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":35,buffer:45,dup:77}],248:[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;e8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function o(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),!(e<0)&&(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof x||a();var s=[],l=[],u=b++;return Object.create(x.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(o)}})};x.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||!!c&&c.has___(t)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof x||a();var l,u=new s,c=void 0,f=!1;return l=o?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new x),c.set(t,e)),this}:function(t,e){if(f)try{u.set(t,e)}catch(r){c||(c=new x),c.set___(t,e)}else u.set(t,e);return this},Object.create(x.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");f=!0})}})}o&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=x.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=x)}}()},{}],253:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":254}],254:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],255:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":253}],256:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":86}],257:[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":70}],258:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":257}],259:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("opacity"),u("align"),u("bgcolor");var f=u("bordercolor"),h=i.opacity(f);u("borderpad");var d=u("borderwidth"),p=u("showarrow");u("text",p?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font);for(var g=["x","y"],v=[-10,-30],m={_fullLayout:r},y=0;y<2;y++){var b=g[y],x=a.coerceRef(t,e,m,b,"","paper");if(a.coercePosition(e,m,u,x,b,.5),p){var _="a"+b,w=a.coerceRef(t,e,m,_,"pixel");"pixel"!==w&&w!==x&&(w=e[_]="pixel");var A="pixel"===w?v[y]:.4;a.coercePosition(e,m,u,w,_,A)}else u(b+"anchor")}return n.noneOrAll(t,e,["x","y"]),p&&(u("arrowcolor",h?e.bordercolor:i.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(h&&d||1)),n.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":364,"../../plots/cartesian/axes":393,"../color":268,"./attributes":261}],260:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],261:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":359,"../../plots/cartesian/constants":398,"../../plots/font_attributes":413,"./arrow_paths":260}],262:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,f=s-l,h=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),f=Math.max(f,d),h=Math.max(h,d)}r&&r.autorange&&a.expand(r,[r.l2c(r.r2l(e.x))],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(n.r2l(e.y))],{ppadplus:h,ppadminus:f})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":364,"../../plots/cartesian/axes":393,"./draw":264}],263:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),i=t("./annotation_defaults");e.exports=function(t,e){var r={name:"annotations",handleItemDefaults:i};n(t,e,r)}},{"../../plots/array_container_defaults":390,"./annotation_defaults":259}],264:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=$.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,m=Math.round(u+2*tt),y=Math.round(p+2*tt);q._w=u,q._h=p;var x=!1;if(["x","y"].forEach(function(e){var n,i=q[e+"ref"]||e,a=f.getFromId(t,i),o=(Y+("x"===e?0:90))*Math.PI/180,s=m*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=q[e+"anchor"];if(a){var u=a.r2fraction(q[e]);if(!a.autorange&&(u<0||u>1)&&(q["a"+e+"ref"]===i?(u=a.r2fraction(q["a"+e]),(u<0||u>1)&&(x=!0)):x=!0,x))return;W[e]=a._offset+a.r2p(q[e]),n=.5}else n=q[e],"y"===e&&(n=1-n),W[e]="x"===e?P.l+P.w*n:P.t+P.h*n;var c=0;q["a"+e+"ref"]===i?W["aa"+e]=a._offset+a.r2p(q["a"+e]):(c=q.showarrow?q["a"+e]:s*r(n,l),W[e]+=c),q["_"+e+"type"]=a&&a.type,q["_"+e+"size"]=s,q["_"+e+"shift"]=c}),x)return void $.remove();var _,w;q.showarrow&&(_=q.axref===q.xref?W.x:c.constrain(W.x-q.ax,1,M.width-1),w=q.ayref===q.yref?W.y:c.constrain(W.y-q.ay,1,M.height-1)),W.x=c.constrain(W.x,1,M.width-1),W.y=c.constrain(W.y,1,M.height-1);var A=tt-s.top,k=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:k,y:A}),nt.selectAll("tspan.line").attr({y:A,x:k})),et.call(d.setRect,K/2,K/2,m-K,y-K);var T=0,E=0;T=q.axref===q.xref?Math.round(W.aax-m/2):Math.round(W.x-m/2),E=q.ayref===q.yref?Math.round(W.aay-y/2):Math.round(W.y-y/2),$.call(c.setTranslate,T,E);var L="annotations["+e+"]",S=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=q.axref===q.xref?W.aax+r:W.x+r,s=q.ayref===q.yref?W.aay+n:W.y+n;var u=c.rotationXYMatrix(Y,i,s),f=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,m=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!m.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){m.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=q.arrowwidth,x=q.arrowcolor,A=Z.append("g").style({opacity:h.opacity(x)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=A.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(h.stroke,h.rgb(x));b(M,q.arrowhead,"end",q.arrowsize);var k=A.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,S;v.init({element:k.node(),prepFn:function(){var t=c.getTranslate($);E=t.x,S=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){A.attr("transform","translate("+t+","+e+")");var r=f(E,S),n=r[0]+t,i=r[1]+e;$.call(c.setTranslate,n,i),T[L+".x"]=G?G.p2r(G.r2p(q.x)+t):(_+t-P.l)/P.w,T[L+".y"]=X?X.p2r(X.r2p(q.y)+e):1-(w+e-P.t)/P.h,q.axref===q.xref&&(T[L+".ax"]=G?G.p2r(G.r2p(q.ax)+t):(_+t-P.l)/P.w),q.ayref===q.yref&&(T[L+".ay"]=X?X.p2r(X.r2p(q.ay)+e):1-(w+e-P.t)/P.h),Q.attr({transform:"rotate("+Y+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};q.showarrow&&S(0,0);var C=c.rotationXYMatrix(Y,W.x,W.y),R=c.apply2DTransform(C);if(t._context.editable){var N,O,I;v.init({element:$.node(),prepFn:function(){var t=c.getTranslate($);N=t.x,O=t.y,I={}},moveFn:function(t,e){$.call(c.setTranslate,N+t,O+e);var r="pointer";if(q.showarrow)q.axref===q.xref?I[L+".ax"]=G.p2r(G.r2p(q.ax)+t):I[L+".ax"]=q.ax+t,q.ayref===q.yref?I[L+".ay"]=X.p2r(X.r2p(q.ay)+e):I[L+".ay"]=q.ay+e,S(t,e);else{if(G)I[L+".x"]=q.x+t/G._m;else{var n=q._xsize/P.w,i=q.x+q._xshift/P.w-n/2;I[L+".x"]=v.align(i+t/P.w,n,0,1,q.xanchor)}if(X)I[L+".y"]=q.y+e/X._m;else{var a=q._ysize/P.h,o=q.y-q._yshift/P.h-a/2;I[L+".y"]=v.align(o-e/P.h,a,0,1,q.yanchor)}G&&X||(r=v.getCursor(G?.5:I[L+".x"],X?.5:I[L+".y"],q.xanchor,q.yanchor))}var s=R(N,O),l=s[0]+t,u=s[1]+e;$.call(c.setTranslate,N+t,O+e),Q.attr({transform:"rotate("+Y+","+l+","+u+")"}),g($,r)},doneFn:function(e){if(g($),e){l.relayout(t,I);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,A=t.layout,M=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return A.annotations=u,y(A,M),void n(t);if("remove"===u)return delete A.annotations,M.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)M._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}M._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=A.annotations[e],E=M.annotations[e];if(T){var L={};"string"==typeof r&&r?L[r]=u:c.isPlainObject(r)&&(L=r);var S=Object.keys(L);for(w=0;w4/3&&(j=V)}}else z&&(F&&(j<1/3?j+=U:j>2/3&&(j-=U)),j=(j-z.domain[0])/(z.domain[1]-z.domain[0]),j=z.fraction2r(j))}z&&z===I&&D&&("log"===D&&"log"!==z.type?j=Math.pow(10,j):"log"!==D&&"log"===z.type&&(j=j>0?Math.log(j)/Math.LN10:void 0)),T[O]=j}}var q={};m(T,q,M),M.annotations[e]=q;var G=f.getFromId(t,q.xref),X=f.getFromId(t,q.yref),W={x:0,y:0},Y=+q.textangle||0,Z=M._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",q.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:q})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),$=Q.append("g"),K=q.borderwidth,J=q.borderpad,tt=K+J,et=$.append("rect").attr("class","bg").style("stroke-width",K+"px").call(h.stroke,q.bordercolor).call(h.fill,q.bgcolor),rt=q.font,nt=$.append("text").classed("annotation",!0).attr("data-unformatted",q.text).text(q.text);t._context.editable?nt.call(p.makeEditable,$).call(x).on("edit",function(r){q.text=r,this.attr({"data-unformatted":q.text}),this.call(x);var n={};n["annotations["+e+"].text"]=q.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(x),Q.attr({transform:"rotate("+Y+","+W.x+","+W.y+")"}).call(d.setPosition,W.x,W.y)}}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,f=n-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var g=(u*d-c*h)/p,v=(u*f-l*h)/p;return v<0||v>1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./annotation_defaults"),y=t("./defaults"),b=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":364,"../../lib/setcursor":374,"../../lib/svg_text_utils":378,"../../plotly":388,"../../plots/cartesian/axes":393,"../../plots/plots":430,"../color":268,"../dragelement":289,"../drawing":291,"./annotation_defaults":259,"./defaults":263,"./draw_arrow_head":265,d3:74,"fast-isnumeric":82}],265:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var f,h,d,p,g=(o.getPx(t,"stroke-width")||1)*l,v=t.style("stroke")||a.defaultLine,m=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,b=r.indexOf("end")>=0,x=c.backoff*g;if("line"===u.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},h={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(f.y-h.y,f.x-h.x),p=d+Math.PI,x){var _=x*Math.cos(d),w=x*Math.sin(d);y&&(f.x-=_,f.y-=w,t.attr({x1:f.x,y1:f.y})),b&&(h.x+=_,h.y+=w,t.attr({x2:h.x,y2:h.y}))}}else if("path"===u.nodeName){var A=u.getTotalLength(),M="";if(y){var k=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(k.y-T.y,k.x-T.x),f=u.getPointAtLength(Math.min(x,A)),x&&(M="0px,"+x+"px,")}if(b){var E=u.getPointAtLength(A),L=u.getPointAtLength(A-.1);if(p=Math.atan2(E.y-L.y,E.x-L.x),h=u.getPointAtLength(Math.max(0,A-x)),x){var S=M?2*x:x;M+=A-S+"px,"+A+"px"}}else M&&(M+=A+"px");M&&t.style("stroke-dasharray",M)}var C=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:v,opacity:m,"stroke-width":0})};y&&C(f,d),b&&C(h,p)}}},{"../color":268,"../drawing":291,"./arrow_paths":260,d3:74,"fast-isnumeric":82}],266:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":261,"./calc_autorange":262,"./defaults":263,"./draw":264}],267:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],268:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(C);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?L[0]:(C[e]+C[e-1])/2,e===C.length-1?L[1]:(C[e]+C[e+1])/2].map(J.c2p).map(Math.round);e!==C.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=R(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({ x:W,width:Math.max(B,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var h=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?S:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){n.select(this).attr("d","M"+W+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+B).call(d.lineGroupStyle,_.line.width,P(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=W+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));A("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:k.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,i=x();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(a,r||{}))}function M(){var r=B+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(j=ot.select("text"),j.node()&&!j.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-W-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-$;at.select(".cbbg").attr({x:W-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:W,y:$+_.ypad+("top"===_.titleside?st:0),width:Math.max(B,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var k=t._fullLayout,T=k._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void k._infolayer.selectAll("g."+e).remove();var E,L=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],C=[],P="function"==typeof _.line.color?_.line.color:function(){return _.line.color},R="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},N=_.levels.end+_.levels.size/100,O=_.levels.size,I=1.001*L[0]-.001*L[1],z=1.001*L[1]-.001*L[0];for(E=_.levels.start;(E-N)*O<0;E+=O)E>I&&EL[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+H-X],J.setScale();var at=k._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+q)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+H-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,A(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ft=c.syncOrAsync([o.previousPromises,w,o.previousPromises,M],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var ht,dt,pt;u.init({element:at.node(),prepFn:function(){ht=at.attr("transform"),h(at)},moveFn:function(t,e){at.attr("transform",ht+" translate("+t+","+e+")"),dt=u.align(Y+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,H,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);h(at,r)},doneFn:function(e){h(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},x().index)}})}return ft}function x(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":364,"./flip_scale":279,"./scales":286}],275:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":359,"./attributes":273,"./scales.js":286}],276:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":286}],277:[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,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,g=f?i.nestedProperty(e,d).get()||{}:e,v=p[h+"min"],m=p[h+"max"],y=p.colorscale,b=n(v)&&n(m)&&v=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],280:[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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):e}},{"./default_scale":276,"./is_valid_scale_array":284,"./scales":286}],281:[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(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],288:[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":364}],289:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,g=o.getPlotDiv(t.element)||{},v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":364,"../../plotly":388,"../../plots/cartesian/constants":398,"./align":287,"./cursor":288,"./unhover":290}],290:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":358}],291:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,f,h;t.so?(h=o.outlierwidth,f=o.outliercolor,c=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(h||1)+"px",fill:"none"}):(e.style("stroke-width",h+"px").call(l.fill,c),h&&e.call(l.stroke,f))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),f=(c*c*i-u*u*s)*n,h=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&f/d),2),a.round(e[1]+(d&&h/d),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&h/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var v=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=g.tryColorscale(i,""),s=g.tryColorscale(i,"line");n(t,e,r,o,s,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),i=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,a.select(this),e,n,i)})}},g.tryColorscale=function(t,e){var r=e?c.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):c.identity};var b={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(f.convertToTspans);var h=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*x+1,v=b[l]*c,m=.75*u+b[s]*c+(b[s]-1)*p*u/2;h.attr("transform","translate("+v+","+m+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=k&&(a.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":352,"../../lib":364,"../../lib/svg_text_utils":378,"../../registry":438,"../../traces/scatter/make_bubble_size_func":469,"../../traces/scatter/subtypes":474,"../color":268,"../colorscale":282,"./symbol_defs":292,d3:74,"fast-isnumeric":82}],292:[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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),f=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2); -return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:74}],293:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],294:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),f=0;f0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);c&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;f="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");s=!v.size(),s?v=e.append("path").classed("yerror",!0):c&&(v=v.transition().duration(r.duration).ease(r.easing)),v.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var m=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-m)+"v"+2*m+"m0,-"+m+"H"+o.xs,o.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":474,d3:74,"fast-isnumeric":82}],299:[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":268,d3:74}],300:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":398}],301:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}var o=n("source"),l=n("visible",!!o);if(!l)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var u={_fullLayout:r},c=["x","y"],f=0;f<2;f++)a.coerceRef(t,e,u,c[f],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var r={name:l,handleItemDefaults:n};o(t,e,r)}},{"../../lib":364,"../../plots/array_container_defaults":390,"../../plots/cartesian/axes":393,"./attributes":300}],302:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,f=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,h=c*d.x[e.xanchor].offset,p=f*d.y[e.yanchor].offset,g=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,v=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+h,m=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:v,y:m,width:c,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=o?o._id:"",b=l?l._id:"",x=y+b;x&&r.call(i.setClipUrl,"clip"+s._uid+x)}for(var s=t._fullLayout,l=[],u=[],c=[],f=0;f=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}},{}],305:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":359,"../../plots/font_attributes":413,"../color/attributes":267}],306:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],307:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(b!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",v),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":364,"../../plots/layout_attributes":428,"../../registry":438,"./attributes":305,"./helpers":310}],308:[function(t,e,r){"use strict";function n(t,e){function r(r){m.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?f.call(m.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=r.indexOf(f);h===-1?r.push(f):r.splice(h,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;r=s*h,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cn.width-(n.margin.r+n.margin.l)&&(b=0,v+=m,i.height=i.height+m,m=0),f.setTranslate(this,a+b,5+a+e.height/2+v),i.width+=o+r,i.height=Math.max(i.height,e.height),b+=o+r,m=Math.max(e.height,m)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),b=t("./get_legend_data"),x=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(g.setRect,F,t,y.scrollBarWidth,y.scrollBarHeight),k.select("rect").attr({y:m.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var m=r.legend,_=r.showlegend&&b(t.calcdata,m),A=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var E=M.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=M.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=E.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var C=S.selectAll("g.traces").data(f.identity);C.enter().append("g").attr("class","traces"),C.exit().remove(),C.call(x).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?A.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var P=0!==M.enter().size();P&&(o(t,S,C),s(t));var R=0,N=r.width,O=0,I=r.height;o(t,S,C),m.height>I?l(t):s(t);var z=r._size,j=z.l+z.w*m.x,D=z.t+z.h*(1-m.y);w.isRightAnchor(m)?j-=m.width:w.isCenterAnchor(m)&&(j-=m.width/2),w.isBottomAnchor(m)?D-=m.height:w.isMiddleAnchor(m)&&(D-=m.height/2);var F=m.width,B=z.w;F>B?(j=z.l,F=B):(j+F>N&&(j=N-F),jV?(D=z.t,U=V):(D+U>I&&(D=I-U),Dr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":364,"../../registry":438,"../../traces/pie/style_one":452,"../../traces/scatter/subtypes":474,"../color":268,"../drawing":291,d3:74}],313:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(v,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",o.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":364,"../color":268,"./attributes":317,"./button_attributes":318,"./constants":319}],321:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},i=S.line.width?S.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",S.opacity).call(_.stroke,i).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);C&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+C),t._context.editable&&f(t,a,S,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:b.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>W&&!t.shiftKey?A.getCursor(i/r,1-a/n):"move";M(e,o),G=o.split("-")[0]}function a(e){F=x.getFromId(t,r.xref),B=x.getFromId(t,r.yref),U=T.getDataToPixel(t,F),V=T.getDataToPixel(t,B,!0),H=T.getPixelToData(t,F),q=T.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(j=r.path,D=a+".path"):(c=U(r.x0),f=V(r.y0),h=U(r.x1),d=V(r.y1),g=a+".x0",m=a+".y0",b=a+".x1",_=a+".y1"),cW&&(u[S]=r[N]=q(s),u[C]=r[O]=q(l)),f-c>X&&(u[P]=r[I]=H(c),u[R]=r[z]=H(f))}e.attr("d",p(t,r))}var u,c,f,h,d,g,m,b,_,w,k,E,L,S,C,P,R,N,O,I,z,j,D,F,B,U,V,H,q,G,X=10,W=10,Y={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=Y.element.getBoundingClientRect();A.init(Y)}function h(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):b.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=x.getFromId(t,r.id,"x")._id,i=x.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=x.getFromId(t,e.xref),l=x.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),f=n(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,v=(h+d)/2,m=Math.abs(p-c),y=Math.abs(v-h),b="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),b.log("Ignoring extra params in segment "+t)),i+l})}function v(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var m=t("fast-isnumeric"),y=t("../../plotly"),b=t("../../lib"),x=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),A=t("../dragelement"),M=t("../../lib/setcursor"),k=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),L=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":364,"../../lib/setcursor":374,"../../plotly":388,"../../plots/cartesian/axes":393,"../color":268,"../dragelement":289,"../drawing":291,"./constants":331,"./defaults":332,"./helpers":334,"./shape_defaults":336,"fast-isnumeric":82}],334:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e); -i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],335:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":329,"./calc_autorange":330,"./defaults":332,"./draw":333}],336:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var f=t.path?"path":"rect",h=u("type",f),d=["x","y"],p=0;p<2;p++){var g=d[p],v={_fullLayout:r},m=i.coerceRef(t,e,v,g,"","paper");if("path"!==h){var y,b,x,_=.25,w=.75;"paper"!==m?(y=i.getFromId(v,m),x=o.rangeToShapePosition(y),b=o.shapePositionToRange(y)):b=x=n.identity;var A=g+"0",M=g+"1",k=t[A],T=t[M];t[A]=b(t[A],!0),t[M]=b(t[M],!0),i.coercePosition(e,v,u,m,A,_),i.coercePosition(e,v,u,m,M,w),e[A]=x(e[A]),e[M]=x(e[M]),t[A]=k,t[M]=T}}return"path"===h?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":364,"../../plots/cartesian/axes":393,"./attributes":329,"./helpers":334}],337:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":359,"../../plots/animation_attributes":389,"../../plots/font_attributes":413,"../../plots/pad_attributes":429,"./constants":338}],338:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],339:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+S.railTouchRectClass).data([0]);n.enter().append("rect").classed(S.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,S.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),M.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+S.railRectClass).data([0]);r.enter().append("rect").classed(S.railRectClass,!0);var n=e.inputAreaLength-2*S.railInset;r.attr({width:n,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(r,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+S.groupClassName).data(r,i);l.enter().append("g").classed(S.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,L=!0,S=P,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,M=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,L=!1,S=g.title.trim();""===S&&(E=0),S.match(/Click to enter .+ title/)&&(E=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var P="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?a.restyle(t,v,e,m):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":364,"../../lib/svg_text_utils":378,"../../plotly":388,"../../plots/plots":430,"../color":268,"../drawing":291,d3:74,"fast-isnumeric":82}],343:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":359,"../../plots/font_attributes":413,"../../plots/pad_attributes":429,"../color/attributes":267}],344:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],345:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var f=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){b.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],352:[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}},{}],353:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":266,"./components/images":303,"./components/legend":311,"./components/rangeselector":323,"./components/rangeslider":328,"./components/shapes":335,"./components/sliders":341,"./components/updatemenus":347,"./fonts/mathjax_config":354,"./lib/queue":372,"./plot_api/plot_schema":382,"./plot_api/register":383,"./plot_api/set_plot_config":384,"./plot_api/to_image":386,"./plot_api/validate":387,"./plotly":388,"./snapshot":443,"./snapshot/download":440,"./traces/scatter":464,d3:74,"es6-promise":79}],354:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],355:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":350,"fast-isnumeric":82}],356:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r); -if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var v=(new Date).getFullYear();e=((Number(u[0])-v+70)%100+200)%100+v-70}if(!a(e))return l;var m=new Date(0,0,1);if(m.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(m.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(m.setDate(i),m.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(m.setHours(o),m.getHours()!==o)return l;if(u.length>1)return i=m.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=f*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return m.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,v=3*c,m=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":355,"./coerce":356,"./dates":357,"./extend":359,"./filter_unique":360,"./filter_visible":361,"./is_array":365,"./is_plain_object":366,"./loggers":367,"./matrix":368,"./nested_property":369,"./notifier":370,"./search":373,"./stats":376,d3:74}],365:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],366:[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}},{}],367:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,h(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;uMath.max(c,g)||l>Math.max(f,v)))if(lc||Math.abs(n(o,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":368}],372:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;f90&&l.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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":82}],377:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:15,tinycolor2:241}],378:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,v.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold" -},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":351,"../constants/xmlns_namespaces":352,"../lib":364,d3:74}],379:[function(t,e,r){"use strict";function n(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=f.cleanId(r,n))}function i(t){var e="middle",r="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?r="left":t.indexOf("right")!==-1&&(r="right"),e+" "+r}function a(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var o=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),l=t("../registry"),u=t("../lib"),c=t("../plots/plots"),f=t("../plots/cartesian/axes"),h=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.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);var i=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lP.range[0]?[1,2]:[2,1]);else{var R=P.range[0],N=P.range[1];"log"===x?(R<=0&&N<=0&&r(E+".autorange",!0),R<=0?R=N/1e6:N<=0&&(N=R/1e6),r(E+".range[0]",Math.log(R)/Math.LN10),r(E+".range[1]",Math.log(N)/Math.LN10)):(r(E+".range[0]",Math.pow(10,R)),r(E+".range[1]",Math.pow(10,N)))}else r(E+".autorange",!0)}if("reverse"===k)L.range?L.range.reverse():(r(E+".autorange",!0),L.range=[1,0]),S.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var O=m.parts[1],I=m.parts[0],z=a[I]||[],j=z[O]||{};2===m.parts.length&&(null===x&&(e[v]="remove"),"add"===e[v]||b.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?O===-1?(g[I]=z,delete g[v]):g[v]=j:b.log("???",e)),!n(j,"x")&&!n(j,"y")||b.containsAny(v,["color","opacity","align","dash"])||(d.docalc=!0);var D=w.getComponentMethod(I,"drawOne");D(t,O,m.parts.slice(2).join("."),e[v]),delete e[v]}else if(A.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1])C.manageArrayContainers(m,x,g),d.doplot=!0;else{var F=String(m.parts[1]||"");0===m.parts[0].indexOf("scene")?d.doplot=!0:0===m.parts[0].indexOf("geo")?d.doplot=!0:0===m.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===v?d.doplot=!0:!o._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?d.docalc=!0:m.parts[0].indexOf("legend")!==-1?d.dolegend=!0:v.indexOf("title")!==-1?d.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&b.containsAny(F,["tick","exponent","grid","zeroline"])?d.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:m.parts.length>1&&F.indexOf("line")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&"mirror"===F?d.doticks=d.dolayoutstyle=!0:"margin.pad"===v?d.doticks=d.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(d.doplot=!0):d.doplot=!0,m.set(x)}}}var B=t._fullLayout.width,U=t._fullLayout.height;A.supplyDefaults(t),t.layout.autosize&&A.plotAutoSize(t,t.layout,t._fullLayout);var V=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==U;return V&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:b.extendDeep({},p)}}function g(t){var e=v.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];v.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=b.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(L.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),b=t("../lib"),x=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),A=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),k=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),L=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),C=t("./helpers"),P=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=R._basePlotModules,r=0;r=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=C.getGraphDiv(t),!b.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=A.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function g(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var v,m,y=0,x=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&b.isPlainObject(e);if(M)x.push({type:"object",data:g(b.extendFlat({},e))});else if(_||"string"==typeof e)for(v=0;v0&&EE)&&L.push(m);x=L}}x.length>0?f(x):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=C.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!b.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:A.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),A.modifyFrames(t,a)},y.purge=function(t){t=C.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return A.cleanPlot([],{},r,e),A.purge(t),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":291,"../components/errorbars":297,"../constants/xmlns_namespaces":352,"../lib":364,"../lib/events":358,"../lib/queue":372,"../lib/svg_text_utils":378,"../plotly":388,"../plots/cartesian/graph_interact":400,"../plots/plots":430,"../plots/polar":433,"../registry":438,"./helpers":379,"./subroutines":385,d3:74,"fast-isnumeric":82}],381:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],382:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};_(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return _(t,g),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)c(t,r,"xaxis"),c(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;c(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){f(t,r,e+r.name)}):f(t,r,r.name))}),{layoutAttributes:o(t)}}function a(t){var e=h.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):t.arrayOk===!0&&(i[n+"src"]=e(n)):d.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function l(t){function e(t,e,r){if(t){var n=t[A];n&&(delete t[A],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return x(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),x(t,b.layout),t}function c(t,e,r){var n=d.nestedProperty(t,r),i=_({},e.layoutAttributes);i[w]=!0,n.set(i)}function f(t,e,r){var n=d.nestedProperty(t,r),i=_(n.get()||{},e.layoutAttributes);n.set(i)}var h=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),m=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),x=d.extendFlat,_=d.extendDeep,w="_isSubplotObj",A="_isLinkedToArray",M="_deprecated",k=[w,A,M];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=A,r.DEPRECATED=M,r.UNDERSCORE_ATTRS=k,r.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:k.concat.role},traces:t,layout:i(),transforms:e,frames:o(v),animation:o(m)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];k.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||d.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){a=a.slice(0,s).concat([r]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=n(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":364,"../plotly":388,"../snapshot/cloneplot":439,"../snapshot/helpers":442,"../snapshot/svgtoimg":444,"../snapshot/tosvg":446,"fast-isnumeric":82}],387:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;mc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=C&&i<=10||e>=15*C)t._tickround="d";else if(e>=R&&i<=16||e>=P)t._tickround="M";else if(e>=N&&i<=19||e>=R)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(b(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);b(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(Y),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(b(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=V(c):"m"===l?a=H(c):"d"===l?(r||(i="
"+V(c)),a=q(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=W(c),"S"!==l&&(a+=h(y.round(m(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=q(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&m(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,m(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);c&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;f="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(f+="m-"+g+",0h"+2*g);var v=e.select("path.yerror");s=!v.size(),s?v=e.append("path").classed("yerror",!0):c&&(v=v.transition().duration(r.duration).ease(r.easing)),v.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var m=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-m)+"v"+2*m+"m0,-"+m+"H"+o.xs,o.noXS||(f+="m0,-"+m+"v"+2*m);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":474,d3:74,"fast-isnumeric":82}],299:[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":268,d3:74}],300:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":398}],301:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}var o=n("source"),l=n("visible",!!o);if(!l)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var u={_fullLayout:r},c=["x","y"],f=0;f<2;f++)a.coerceRef(t,e,u,c[f],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var r={name:l,handleItemDefaults:n};o(t,e,r)}},{"../../lib":364,"../../plots/array_container_defaults":390,"../../plots/cartesian/axes":393,"./attributes":300}],302:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,f=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,h=c*d.x[e.xanchor].offset,p=f*d.y[e.yanchor].offset,g=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,v=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+h,m=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:v,y:m,width:c,height:f,preserveAspectRatio:g,opacity:e.opacity});var y=o?o._id:"",b=l?l._id:"",x=y+b;x&&r.call(i.setClipUrl,"clip"+s._uid+x)}for(var s=t._fullLayout,l=[],u=[],c=[],f=0;f=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}},{}],305:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":359,"../../plots/font_attributes":413,"../color/attributes":267}],306:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],307:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,v="normal",m=0;m1);if(b!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",v),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":364,"../../plots/layout_attributes":428,"../../registry":438,"./attributes":305,"./helpers":310}],308:[function(t,e,r){"use strict";function n(t,e){function r(r){m.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?f.call(m.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=r.indexOf(f);h===-1?r.push(f):r.splice(h,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;r=s*h,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;f.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cn.width-(n.margin.r+n.margin.l)&&(b=0,v+=m,i.height=i.height+m,m=0),f.setTranslate(this,a+b,5+a+e.height/2+v),i.width+=o+r,i.height=Math.max(i.height,e.height),b+=o+r,m=Math.max(e.height,m)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),h.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),h.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),v=t("../color"),m=t("../../lib/svg_text_utils"),y=t("./constants"),b=t("./get_legend_data"),x=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(g.setRect,F,t,y.scrollBarWidth,y.scrollBarHeight),k.select("rect").attr({y:m.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var m=r.legend,_=r.showlegend&&b(t.calcdata,m),A=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var T=M.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(v.stroke,m.bordercolor),T.call(v.fill,m.bgcolor),T.style("stroke-width",m.borderwidth+"px");var E=M.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=M.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var S=E.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var C=S.selectAll("g.traces").data(f.identity);C.enter().append("g").attr("class","traces"),C.exit().remove(),C.call(x).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?A.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var P=0!==M.enter().size();P&&(o(t,S,C),s(t));var R=0,N=r.width,O=0,I=r.height;o(t,S,C),m.height>I?l(t):s(t);var z=r._size,j=z.l+z.w*m.x,D=z.t+z.h*(1-m.y);w.isRightAnchor(m)?j-=m.width:w.isCenterAnchor(m)&&(j-=m.width/2),w.isBottomAnchor(m)?D-=m.height:w.isMiddleAnchor(m)&&(D-=m.height/2);var F=m.width,B=z.w;F>B?(j=z.l,F=B):(j+F>N&&(j=N-F),jV?(D=z.t,U=V):(D+U>I&&(D=I-U),Dr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var v=l.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(s?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,i),s&&(n[0].mrc=3);var y=v.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||r.color),e&&i.call(h.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(h.fill,t.fc||e.fillcolor),r&&n.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":364,"../../registry":438,"../../traces/pie/style_one":452,"../../traces/scatter/subtypes":474,"../color":268,"../drawing":291,d3:74}],313:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=i(s),y=[];return((u||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(v,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var v=c("bgcolor");c("activecolor",o.contrast(v,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":364,"../color":268,"./attributes":317,"./button_attributes":318,"./constants":319}],321:[function(t,e,r){"use strict";function n(t){for(var e=m.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,S)},i=S.line.width?S.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",S.opacity).call(_.stroke,i).call(_.fill,S.fillcolor).call(w.dashLine,S.line.dash,S.line.width);C&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+C),t._context.editable&&f(t,a,S,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:b.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>W&&!t.shiftKey?A.getCursor(i/r,1-a/n):"move";M(e,o),G=o.split("-")[0]}function a(e){F=x.getFromId(t,r.xref),B=x.getFromId(t,r.yref),U=T.getDataToPixel(t,F),V=T.getDataToPixel(t,B,!0),H=T.getPixelToData(t,F),q=T.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(j=r.path,D=a+".path"):(c=U(r.x0),f=V(r.y0),h=U(r.x1),d=V(r.y1),g=a+".x0",m=a+".y0",b=a+".x1",_=a+".y1"),cW&&(u[S]=r[N]=q(s),u[C]=r[O]=q(l)),f-c>X&&(u[P]=r[I]=H(c),u[R]=r[z]=H(f))}e.attr("d",p(t,r))}var u,c,f,h,d,g,m,b,_,w,k,E,L,S,C,P,R,N,O,I,z,j,D,F,B,U,V,H,q,G,X=10,W=10,Y={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=Y.element.getBoundingClientRect();A.init(Y)}function h(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):b.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=x.getFromId(t,r.id,"x")._id,i=x.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=x.getFromId(t,e.xref),l=x.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),f=n(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,v=(h+d)/2,m=Math.abs(p-c),y=Math.abs(v-h),b="A"+m+","+y,_=p+m+","+v,w=p+","+(v-y);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),b.log("Ignoring extra params in segment "+t)),i+l})}function v(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var m=t("fast-isnumeric"),y=t("../../plotly"),b=t("../../lib"),x=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),A=t("../dragelement"),M=t("../../lib/setcursor"),k=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),L=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":364,"../../lib/setcursor":374,"../../plotly":388,"../../plots/cartesian/axes":393,"../color":268,"../dragelement":289,"../drawing":291,"./constants":331,"./defaults":332,"./helpers":334,"./shape_defaults":336,"fast-isnumeric":82}],334:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){ +var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],335:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":329,"./calc_autorange":330,"./defaults":332,"./draw":333}],336:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var f=t.path?"path":"rect",h=u("type",f),d=["x","y"],p=0;p<2;p++){var g=d[p],v={_fullLayout:r},m=i.coerceRef(t,e,v,g,"","paper");if("path"!==h){var y,b,x,_=.25,w=.75;"paper"!==m?(y=i.getFromId(v,m),x=o.rangeToShapePosition(y),b=o.shapePositionToRange(y)):b=x=n.identity;var A=g+"0",M=g+"1",k=t[A],T=t[M];t[A]=b(t[A],!0),t[M]=b(t[M],!0),i.coercePosition(e,v,u,m,A,_),i.coercePosition(e,v,u,m,M,w),e[A]=x(e[A]),e[M]=x(e[M]),t[A]=k,t[M]=T}}return"path"===h?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":364,"../../plots/cartesian/axes":393,"./attributes":329,"./helpers":334}],337:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":359,"../../plots/animation_attributes":389,"../../plots/font_attributes":413,"../../plots/pad_attributes":429,"./constants":338}],338:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],339:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*S.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(t,e){return t.inputAreaStart+S.stepInset+(t.inputAreaLength-2*S.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-S.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*S.stepInset-2*t.inputAreaStart)))}function b(t,e,r){var n=t.selectAll("rect."+S.railTouchRectClass).data([0]);n.enter().append("rect").classed(S.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,S.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),M.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+S.railRectClass).data([0]);r.enter().append("rect").classed(S.railRectClass,!0);var n=e.inputAreaLength-2*S.railInset;r.attr({width:n,height:S.railWidth,rx:S.railRadius,ry:S.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),M.setTranslate(r,S.railInset,.5*(e.inputAreaWidth-S.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(S.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+S.groupClassName).data(r,i);l.enter().append("g").classed(S.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,L=!0,S=P,A._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,A=t._fullLayout,M=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,L=!1,S=g.title.trim();""===S&&(E=0),S.match(/Click to enter .+ title/)&&(E=.2,L=!0),w||(w=A._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var P="Click to enter "+y+" title";t._context.editable?(S||p(),C.call(c.makeEditable).on("edit",function(e){void 0!==m?a.restyle(t,v,e,m):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",L)}},{"../../lib":364,"../../lib/svg_text_utils":378,"../../plotly":388,"../../plots/plots":430,"../color":268,"../drawing":291,d3:74,"fast-isnumeric":82}],343:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":359,"../../plots/font_attributes":413,"../../plots/pad_attributes":429,"../color/attributes":267}],344:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],345:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var f=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){b.select(this).remove(),f.call(m).attr(T.menuIndexAttrName,"-1"),x.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],352:[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}},{}],353:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":266,"./components/images":303,"./components/legend":311,"./components/rangeselector":323,"./components/rangeslider":328,"./components/shapes":335,"./components/sliders":341,"./components/updatemenus":347,"./fonts/mathjax_config":354,"./lib/queue":372,"./plot_api/plot_schema":382,"./plot_api/register":383,"./plot_api/set_plot_config":384,"./plot_api/to_image":386,"./plot_api/validate":387,"./plotly":388,"./snapshot":443,"./snapshot/download":440,"./traces/scatter":464,d3:74,"es6-promise":79}],354:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],355:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":350,"fast-isnumeric":82}],356:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{ +coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var v=(new Date).getFullYear();e=((Number(u[0])-v+70)%100+200)%100+v-70}if(!a(e))return l;var m=new Date(0,0,1);if(m.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(m.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(m.setDate(i),m.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(m.setHours(o),m.getHours()!==o)return l;if(u.length>1)return i=m.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=f*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return m.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,v=3*c,m=5*f;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":355,"./coerce":356,"./dates":357,"./extend":359,"./filter_unique":360,"./filter_visible":361,"./is_array":365,"./is_plain_object":366,"./loggers":367,"./matrix":368,"./nested_property":369,"./notifier":370,"./search":373,"./stats":376,d3:74}],365:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],366:[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}},{}],367:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,h(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,f,h,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(u=1;uMath.max(c,g)||l>Math.max(f,v)))if(lc||Math.abs(n(o,h))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":368}],372:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;f90&&l.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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":82}],377:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:15,tinycolor2:241}],378:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,v.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var f=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(h.log(r.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var v=h.getPlotDiv(s.node());(v&&v._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=n(l,"width"),h=n(l,"height"),g=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],v=parseInt(s.style("font-size"),10)||n(s,"height"),m=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,m-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-h/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-h/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold", +i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},v=["http:","https:","mailto:"],m=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),b=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(m," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,r)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),f.rebind(this,s,"on")}},{"../constants/string_mappings":351,"../constants/xmlns_namespaces":352,"../lib":364,d3:74}],379:[function(t,e,r){"use strict";function n(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=f.cleanId(r,n))}function i(t){var e="middle",r="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?r="left":t.indexOf("right")!==-1&&(r="right"),e+" "+r}function a(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var o=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),l=t("../registry"),u=t("../lib"),c=t("../plots/plots"),f=t("../plots/cartesian/axes"),h=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.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);var i=f.list({_fullLayout:t});for(e=0;e3?(v.x=1.02,v.xanchor="left"):v.x<-2&&(v.x=-.02,v.xanchor="right"),v.y>3?(v.y=1.02,v.yanchor="bottom"):v.y<-2&&(v.y=-.02,v.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var m=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lP.range[0]?[1,2]:[2,1]);else{var R=P.range[0],N=P.range[1];"log"===x?(R<=0&&N<=0&&r(E+".autorange",!0),R<=0?R=N/1e6:N<=0&&(N=R/1e6),r(E+".range[0]",Math.log(R)/Math.LN10),r(E+".range[1]",Math.log(N)/Math.LN10)):(r(E+".range[0]",Math.pow(10,R)),r(E+".range[1]",Math.pow(10,N)))}else r(E+".autorange",!0)}if("reverse"===k)L.range?L.range.reverse():(r(E+".autorange",!0),L.range=[1,0]),S.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===m.parts[0]||"shapes"===m.parts[0]){var O=m.parts[1],I=m.parts[0],z=a[I]||[],j=z[O]||{};2===m.parts.length&&(null===x&&(e[v]="remove"),"add"===e[v]||b.isPlainObject(e[v])?g[v]="remove":"remove"===e[v]?O===-1?(g[I]=z,delete g[v]):g[v]=j:b.log("???",e)),!n(j,"x")&&!n(j,"y")||b.containsAny(v,["color","opacity","align","dash"])||(d.docalc=!0);var D=w.getComponentMethod(I,"drawOne");D(t,O,m.parts.slice(2).join("."),e[v]),delete e[v]}else if(A.layoutArrayContainers.indexOf(m.parts[0])!==-1||"mapbox"===m.parts[0]&&"layers"===m.parts[1])C.manageArrayContainers(m,x,g),d.doplot=!0;else{var F=String(m.parts[1]||"");0===m.parts[0].indexOf("scene")?d.doplot=!0:0===m.parts[0].indexOf("geo")?d.doplot=!0:0===m.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===v?d.doplot=!0:!o._has("gl2d")||v.indexOf("axis")===-1&&"plot_bgcolor"!==m.parts[0]?"hiddenlabels"===v?d.docalc=!0:m.parts[0].indexOf("legend")!==-1?d.dolegend=!0:v.indexOf("title")!==-1?d.doticks=!0:m.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&b.containsAny(F,["tick","exponent","grid","zeroline"])?d.doticks=!0:v.indexOf(".linewidth")!==-1&&v.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:m.parts.length>1&&F.indexOf("line")!==-1?d.dolayoutstyle=!0:m.parts.length>1&&"mirror"===F?d.doticks=d.dolayoutstyle=!0:"margin.pad"===v?d.doticks=d.dolayoutstyle=!0:"margin"===m.parts[0]||"autorange"===m.parts[1]||"rangemode"===m.parts[1]||"type"===m.parts[1]||"domain"===m.parts[1]||v.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(v)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(v)===-1&&(d.doplot=!0):d.doplot=!0,m.set(x)}}}var B=t._fullLayout.width,U=t._fullLayout.height;A.supplyDefaults(t),t.layout.autosize&&A.plotAutoSize(t,t.layout,t._fullLayout);var V=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==U;return V&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:b.extendDeep({},p)}}function g(t){var e=v.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];v.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=b.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(L.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var v=t("d3"),m=t("fast-isnumeric"),y=t("../plotly"),b=t("../lib"),x=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),A=t("../plots/plots"),M=t("../plots/cartesian/graph_interact"),k=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),L=t("../constants/xmlns_namespaces"),S=t("../lib/svg_text_utils"),C=t("./helpers"),P=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=R._basePlotModules,r=0;r=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=C.getGraphDiv(t),!b.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=A.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function g(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var v,m,y=0,x=[],_=void 0===e||null===e,w=Array.isArray(e),M=!_&&!w&&b.isPlainObject(e);if(M)x.push({type:"object",data:g(b.extendFlat({},e))});else if(_||"string"==typeof e)for(v=0;v0&&EE)&&L.push(m);x=L}}x.length>0?f(x):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=C.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!b.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:A.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),A.modifyFrames(t,a)},y.purge=function(t){t=C.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return A.cleanPlot([],{},r,e),A.purge(t),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":291,"../components/errorbars":297,"../constants/xmlns_namespaces":352,"../lib":364,"../lib/events":358,"../lib/queue":372,"../lib/svg_text_utils":378,"../plotly":388,"../plots/cartesian/graph_interact":400,"../plots/plots":430,"../plots/polar":433,"../registry":438,"./helpers":379,"./subroutines":385,d3:74,"fast-isnumeric":82}],381:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],382:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};_(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return _(t,g),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)c(t,r,"xaxis"),c(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;c(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){f(t,r,e+r.name)}):f(t,r,r.name))}),{layoutAttributes:o(t)}}function a(t){var e=h.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):t.arrayOk===!0&&(i[n+"src"]=e(n)):d.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function l(t){function e(t,e,r){if(t){var n=t[A];n&&(delete t[A],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return x(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),x(t,b.layout),t}function c(t,e,r){var n=d.nestedProperty(t,r),i=_({},e.layoutAttributes);i[w]=!0,n.set(i)}function f(t,e,r){var n=d.nestedProperty(t,r),i=_(n.get()||{},e.layoutAttributes);n.set(i)}var h=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),m=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),x=d.extendFlat,_=d.extendDeep,w="_isSubplotObj",A="_isLinkedToArray",M="_deprecated",k=[w,A,M];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=A,r.DEPRECATED=M,r.UNDERSCORE_ATTRS=k,r.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:k.concat.role},traces:t,layout:i(),transforms:e,frames:o(v),animation:o(m)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];k.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||d.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){a=a.slice(0,s).concat([r]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=n(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};h(e.width)&&h(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":364,"../plotly":388,"../snapshot/cloneplot":439,"../snapshot/helpers":442,"../snapshot/svgtoimg":444,"../snapshot/tosvg":446,"fast-isnumeric":82}],387:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,v=r.length,m=0;mc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=C&&i<=10||e>=15*C)t._tickround="d";else if(e>=R&&i<=16||e>=P)t._tickround="M";else if(e>=N&&i<=19||e>=R)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(b(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);b(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(Y),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(b(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=V(c):"m"===l?a=H(c):"d"===l?(r||(i="
"+V(c)),a=q(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=W(c),"S"!==l&&(a+=h(y.round(m(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=q(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&m(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,m(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function f(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,n)}function h(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},O.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(n===i){var g=n-1,v=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,v)]:[g,v]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-h*l.pad,u.val+h*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r.map(t.l2r||Number)},O.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=O.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},O.saveRangeInitial=function(t,e){for(var r=O.list(t,"",!0),n=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,g,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=v-1;a>5;a--)i(a)}},O.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},O.autoTicks(f,s);var h,d=O.tickIncrement(O.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,v=0,m=0,y=0;y.3*x||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&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),a(t),t._tmin=O.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=O.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),f=0;fL?(e/=L,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,z)):n>S?(e/=S,t.dtick="M"+i(e,1,j)):n>C?(t.dtick=i(e,C,F),t.tick0="2000-01-02"):n>P?t.dtick=i(e,P,j):n>R?t.dtick=i(e,R,D):n>N?t.dtick=i(e,N,D):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,z))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,z)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,z));if(0===t.dtick&&(t.dtick=1),!b(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},O.tickIncrement=function(t,e,r){var n=r?-1:1;if(b(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?U:B,l=t+.01*n,u=_.roundUp(m(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},O.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]a:f1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":350,"../../lib":364,"fast-isnumeric":82}],395:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),f=[],h=0;h0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],398:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],399:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),v=t("../../components/dragelement"),m=t("./axes"),y=t("./select"),b=t("./constants"),x=!0;e.exports=function(t,e,r,s,_,w,A,M){function k(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+vt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+vt+")").attr("d","M0,0Z"),L()}function L(){pt.selectAll(".select-outline").remove()}function S(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(H,e+at)),i=Math.max(0,Math.min(q,r+ot)),a=Math.abs(n-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,X)/2);st.l=Math.min(at,n),st.r=Math.max(at,n),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!J||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function C(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),x=!1)))}function R(e,r){var i=1===(A+M).length;if(e)j();else if(2!==r||i){if(1===r&&i){var a=A?V[0]:U[0],o="s"===A||"w"===M?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",f="middle";if(a.fixedrange)return;A?(f="n"===A?"top":"bottom","right"===a.side&&(c="right")):"e"===M&&(c="right"),rt.call(h.makeEditable,null,{immediate:!0,background:F.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&u.relayout(t,s,r)})}}else z()}function N(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||F._enablescrollzoom){if(t._transitioningWithDuration)return f.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void f.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=mt[0]+mt[2]*l,c=(s.bottom-e.clientY)/s.height,h=mt[1]+mt[3]*(1-c);if(M){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,r){for(var n,a,o=1-e,s=0;s0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nY.width||W<0||W>Y.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:M[0]._length/2,W="ypx"in e?e.ypx:k[0]._length/2;if(P="xval"in e?n(a,e.xval):i(M,X),R="yval"in e?n(a,e.yval):i(k,W),!g(P[0])||!g(R[0]))return v.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(O=0;O1||z.hoverinfo.indexOf("name")!==-1?z.name:void 0,index:!1,distance:Math.min(Z,A.MAXDIST),color:b.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[j]&&(V.subplot=o[j]._subplot),H=q.length,"array"===F){var Q=e[O];"pointNumber"in Q?(V.index=Q.pointNumber,F="closest"):(F="","xval"in Q&&(B=Q.xval,F="x"),"yval"in Q&&(U=Q.yval,F=F?"closest":"y"))}else B=P[D],U=R[D];if(z._module&&z._module.hoverPoints){var $=z._module.hoverPoints(V,B,U,F);if($)for(var K,J=0;J<$.length;J++)K=$[J],g(K.x0)&&g(K.y0)&&q.push(l(K,C))}else v.log("Unrecognized trace type in hover:",z);"closest"===C&&q.length>H&&(q.splice(0,H),Z=q[0].distance)}if(0===q.length)return _.unhoverRaw(t,e);var tt="y"===C&&G.length>1;q.sort(function(t,e){return t.distance-e.distance});var et=b.combine(o.plot_bgcolor||b.background,o.paper_bgcolor),rt={hovermode:C,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(q,rt);c(q,tt?"xa":"ya"),f(nt,tt);var it=t._hoverdata,at=[];for(N=0;N128?"#000":b.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):k&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var f=e.select("text.nums").style("fill",u).call(x.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);f.selectAll("tspan.line").call(x.setPosition,0,0);var h=e.select("text.name"),v=0;r&&r!==n?(h.style("fill",l).text(r).call(x.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),h.selectAll("tspan.line").call(x.setPosition,0,0),v=h.node().getBoundingClientRect().width+2*N):(h.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var m,A,T=f.node().getBoundingClientRect(),L=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),O=T.width+R+N+v;t.ty0=_-T.top,t.bx=T.width+2*N,t.by=T.height+2*N,t.anchor="start",t.txwidth=T.width,t.tx2width=v,t.offset=0,a?(t.pos=L,m=S+P/2+O<=M,A=S-P/2-O>=0,"top"!==t.idealAlign&&m||!A?m?(S+=P/2,t.anchor="start"):t.anchor="middle":(S-=P/2,t.anchor="end")):(t.pos=S,m=L+C/2+O<=w,A=L-C/2-O>=0,"left"!==t.idealAlign&&m||!A?m?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")),f.attr("text-anchor",t.anchor),v&&h.attr("text-anchor",t.anchor),e.attr("transform","translate("+L+","+S+")"+(a?"rotate("+E+")":""))}),S}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,f=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?S:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(h.push.apply(h,d),f.splice(o+1,1),u=0,s=h.length-1;s>=0;s--)u+=h[s].dp;for(a=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=a;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var v=f[o];for(s=v.length-1;s>=0;s--){var m=v[s],y=t[m.i];y.offset=m.dp,y.del=m.del}}}function f(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(R+N),s=o+a*(t.txwidth+N),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-P,l=t.offset*C),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*R+l)+","+(R+u)+"v"+(t.by/2-R)+"h"+n*t.bx+"v-"+t.by+"H"+(n*R+l)+"V"+(u-R)+"Z"),i.call(x.setPosition,o+l,u+t.ty0-t.by/2+N).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(x.setPosition,s+a*N+l,u+t.ty0-t.by/2+N),r.select("rect").call(x.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),v=t("../../lib"),m=t("../../lib/events"),y=t("../../lib/svg_text_utils"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),A=t("./constants"),M=t("./dragbox"),k=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return v.coerce(t,e,k,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=T.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+A.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexf[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":364,"fast-isnumeric":82}],406:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,f){function h(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),m=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,b=e-v.left,x=r-v.top,_=b,w=x,A="M"+b+","+x,M=i.xaxes[0]._length,k=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),L=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],s.BENDPX));var S=g.selectAll("path.select-outline").data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+m+", "+y+")").attr("d",A+"Z");var C,P,R,N,O,I=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+m+", "+y+")").attr("d","M0,0Z"),z=[],j=i.gd,D=[];for(C=0;C0)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*f*Math.abs(n-i))}return l}function r(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var f=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?r:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,o=t[e],l=(t._id||"x").charAt(0);if(n="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,n=n.slice(),!o||2!==o.length)return void(t[e]=n);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),r=0;r<2;r++)if("date"===t.type){if(!a.isDateTime(o[r])){t[e]=n;break}if(o[r]a.MAX_MS&&(o[r]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[r])){if(!i(o[1-r])){t[e]=n;break}o[r]=o[1-r]*(r?10:.1)}if(o[r]<-s?o[r]=-s:o[r]>s&&(o[r]=s),o[0]===o[1]){var f=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=f,o[1]+=f}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=r.l+t.domain[0]*r.w, t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?l:r},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var f=c.charAt(0),h=c.substr(1);h=n(h)?Number(h):0,(h<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":350,"../../lib":364,"fast-isnumeric":82}],411:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(t){var e,r,n,i,a,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,b.push(s),o[s]=a}return o}function f(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=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[u]?r[u].to:f,a=r[c]?r[c].to:h,f[0]===i[0]&&f[1]===i[1]&&h[0]===a[0]&&h[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function h(e,r){function n(e,r){for(i=0;ir.duration?(g(),T=window.cancelAnimationFrame(m)):T=window.requestAnimationFrame(m)}var y=t._fullLayout,b=[],x=c(e),_=Object.keys(x),w=f(y,_,x);if(!w.length)return!1;var A;u&&(A=u());var M,k,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,v()}),M=Date.now(),T=window.requestAnimationFrame(m),Promise.resolve()}},{"../../lib":364,"../../plotly":388,"../../registry":438,"./axes":393,d3:74}],412:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;fMath.abs(e))n.rotate(o,0,0,-t*r*Math.PI*h.rotateSpeed/window.innerWidth);else{var s=-h.zoomSpeed*a*e/window.innerHeight*(o-n.lastT())/100;n.pan(o,0,0,u*(Math.exp(s)-1))}},!0),h}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":9,"mouse-change":178,"mouse-wheel":180,"right-now":214}],416:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<3;++r){var n=s[r];e[n]._gd=t}}var i=t("./scene"),a=t("../plots"),o=t("../../constants/xmlns_namespaces"),s=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,o=a.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var s=0;sh[1][o]?d[o]=1:h[1][o]===h[0][o]?d[o]=1:d[o]=1/(h[1][o]-h[0][o]);for(this.dataScale=d,a=0;a=3;break;case"AAAsmall":a=o>=7}return a},r.mostReadable=function(t,e,n){var i,a,o,s,l=null,u=0;n=n||{},a=n.includeFallbackColors,o=n.level,s=n.size;for(var c=0;cu&&(u=i,l=r(e[c]));return r.isReadable(t,l,{level:o,size:s})||!a?l:(n.includeFallbackColors=!1,r.mostReadable(t,["#fff","#000"],n))};var X=r.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=r.hexNames=S(X),W=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,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})$/}}();"undefined"!=typeof n&&n.exports?n.exports=r:"function"==typeof t&&t.amd?t(function(){return r}):window.tinycolor=r}(Math)},{}],198:[function(t,e,n){function r(t,e,n,r){this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=n,this.p2y=r}e.exports=r,r.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},r.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},r.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},r.prototype.solveCurveX=function(t,e){"undefined"==typeof e&&(e=1e-6);var n,r,i,a,o;for(i=t,o=0;o<8;o++){if(a=this.sampleCurveX(i)-t,Math.abs(a)r)return r;for(;na?n=i:r=i,i=.5*(r-n)+n}return i},r.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],199:[function(t,e,n){"use strict";function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function i(t,e,n){if(t&&u.isObject(t)&&t instanceof r)return t;var i=new r;return i.parse(t,e,n),i}function a(t){return u.isString(t)&&(t=i(t)),t instanceof r?t.format():r.prototype.format.call(t)}function o(t,e){return i(t,!1,!0).resolve(e)}function s(t,e){return t?i(t,!1,!0).resolveObject(e):e}var l=t("punycode"),u=t("./util");n.parse=i,n.resolve=o,n.resolveObject=s,n.format=a,n.Url=r;var c=/^([a-z0-9.+-]+:)/i,f=/:[0-9]*$/,h=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["<",">",'"',"`"," ","\r","\n","\t"],p=["{","}","|","\\","^","`"].concat(d),m=["'"].concat(p),g=["%","/","?",";","#"].concat(m),v=["/","?","#"],y=255,x=/^[+a-z0-9A-Z_-]{0,63}$/,_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,b={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},M={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},k=t("querystring");r.prototype.parse=function(t,e,n){if(!u.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),i=r!==-1&&r127?"x":C[F];if(!O.match(x)){var j=D.slice(0,T),N=D.slice(T+1),B=C.match(_);B&&(j.push(B[1]),N.unshift(B[2])),N.length&&(s="/"+N.join(".")+s),this.hostname=j.join(".");break}}}this.hostname.length>y?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=l.toASCII(this.hostname));var q=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+q,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!b[p])for(var T=0,P=m.length;T0)&&n.host.split("@");A&&(n.auth=A.shift(),n.host=n.hostname=A.shift())}return n.search=t.search,n.query=t.query,u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!b.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=b.slice(-1)[0],T=(n.host||t.host||b.length>1)&&("."===S||".."===S)||""===S,z=0,E=b.length;E>=0;E--)S=b[E],"."===S?b.splice(E,1):".."===S?(b.splice(E,1),z++):z&&(b.splice(E,1),z--);if(!x&&!_)for(;z--;z)b.unshift("..");!x||""===b[0]||b[0]&&"/"===b[0].charAt(0)||b.unshift(""),T&&"/"!==b.join("/").substr(-1)&&b.push("");var L=""===b[0]||b[0]&&"/"===b[0].charAt(0);if(k){n.hostname=n.host=L?"":b.length?b.shift():"";var A=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");A&&(n.auth=A.shift(),n.host=n.hostname=A.shift())}return x=x||n.host&&b.length,x&&!L&&b.unshift(""),b.length?n.pathname=b.join("/"):(n.pathname=null,n.path=null),u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var t=this.host,e=f.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":200,punycode:189,querystring:192}],200:[function(t,e,n){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],201:[function(t,e,n){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],202:[function(t,e,n){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],203:[function(t,e,n){(function(e,r){function i(t,e){var r={seen:[],stylize:o};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(e)?r.showHidden=e:e&&n._extend(r,e),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),l(r,t,r.depth)}function a(t,e){var n=i.styles[e];return n?"\x1b["+i.colors[n][0]+"m"+t+"\x1b["+i.colors[n][1]+"m":t}function o(t,e){return t}function s(t){var e={};return t.forEach(function(t,n){e[t]=!0}),e}function l(t,e,r){if(t.customInspect&&e&&S(e.inspect)&&e.inspect!==n.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(r,t);return x(i)||(i=l(t,i,r)),i}var a=u(t,e);if(a)return a;var o=Object.keys(e),m=s(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),A(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(e);if(0===o.length){if(S(e)){var g=e.name?": "+e.name:"";return t.stylize("[Function"+g+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(k(e))return t.stylize(Date.prototype.toString.call(e),"date");if(A(e))return c(e)}var v="",y=!1,_=["{","}"];if(p(e)&&(y=!0,_=["[","]"]),S(e)){var b=e.name?": "+e.name:"";v=" [Function"+b+"]"}if(w(e)&&(v=" "+RegExp.prototype.toString.call(e)),k(e)&&(v=" "+Date.prototype.toUTCString.call(e)),A(e)&&(v=" "+c(e)),0===o.length&&(!y||0==e.length))return _[0]+v+_[1];if(r<0)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=y?f(t,e,r,m,o):o.map(function(n){return h(t,e,r,m,n,y)}),t.seen.pop(),d(M,v,_)}function u(t,e){if(b(e))return t.stylize("undefined","undefined");if(x(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return y(e)?t.stylize(""+e,"number"):m(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,e,n,r,i){for(var a=[],o=0,s=e.length;o-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")),b(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.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 d(t,e,n){var r=0,i=t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}function p(t){return Array.isArray(t)}function m(t){return"boolean"==typeof t}function g(t){return null===t}function v(t){return null==t}function y(t){return"number"==typeof t}function x(t){return"string"==typeof t}function _(t){return"symbol"==typeof t}function b(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===z(t)}function M(t){return"object"==typeof t&&null!==t}function k(t){return M(t)&&"[object Date]"===z(t)}function A(t){return M(t)&&("[object Error]"===z(t)||t instanceof Error)}function S(t){return"function"==typeof t}function T(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function z(t){return Object.prototype.toString.call(t)}function E(t){return t<10?"0"+t.toString(10):t.toString(10)}function L(){var t=new Date,e=[E(t.getHours()),E(t.getMinutes()),E(t.getSeconds())].join(":");return[t.getDate(),O[t.getMonth()],e].join(" ")}function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var D=/%[sdj%]/g;n.format=function(t){if(!x(t)){for(var e=[],n=0;n=a)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}}),s=r[n];n>3}if(i--,1===r||2===r)a+=t.readSVarint(),o+=t.readSVarint(),1===r&&(e&&s.push(e),e=[]),e.push(new l(a,o));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&s.push(e),s},r.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,r=0,i=0,a=0,o=1/0,s=-(1/0),l=1/0,u=-(1/0);t.pos>3}if(r--,1===n||2===n)i+=t.readSVarint(),a+=t.readSVarint(),is&&(s=i),au&&(u=a);else if(7!==n)throw new Error("unknown command "+n)}return[o,l,s,u]},r.prototype.toGeoJSON=function(t,e,n){function i(t){for(var e=0;e>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}var o=t("./vectortilefeature.js");e.exports=r,r.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 o(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":206}],208:[function(t,e,n){function r(t){var e=[];for(var n in t.layers)e.push(a(t.layers[n]));var r=new c;return f.tile.write({layers:e},r),r.finish()}function i(t){var e={};for(var n in t)e[n]=new h(t[n].features),e[n].name=n;return r({layers:e})}function a(t){for(var e={name:t.name||"",version:t.version||1,extent:t.extent||4096,keys:[],values:[],features:[]},n={},r={},i=0;i>31}function l(t){for(var e=[],n=0,r=0,i=t.length,a=0;a2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}rt.selectAll("tspan.line").attr({y:0,x:0});var r=J.select(".annotation-math-group"),i=!r.empty(),s=d.bBox((i?r:rt).node()),u=s.width,p=s.height,v=Math.round(u+2*tt),y=Math.round(p+2*tt);G._w=u,G._h=p;var _=!1;if(["x","y"].forEach(function(e){var r,i=G[e+"ref"]||e,a=f.getFromId(t,i),o=(Y+("x"===e?0:90))*Math.PI/180,s=v*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=G[e+"anchor"];if(a){var u=a.r2fraction(G[e]);if(!a.autorange&&(u<0||u>1)&&(G["a"+e+"ref"]===i?(u=a.r2fraction(G["a"+e]),(u<0||u>1)&&(_=!0)):_=!0,_))return;X[e]=a._offset+a.r2p(G[e]),r=.5}else r=G[e],"y"===e&&(r=1-r),X[e]="x"===e?I.l+I.w*r:I.t+I.h*r;var c=0;G["a"+e+"ref"]===i?X["aa"+e]=a._offset+a.r2p(G["a"+e]):(c=G.showarrow?G["a"+e]:s*n(r,l),X[e]+=c),G["_"+e+"type"]=a&&a.type,G["_"+e+"size"]=s,G["_"+e+"shift"]=c}),_)return void J.remove();var b,w;G.showarrow&&(b=G.axref===G.xref?X.x:c.constrain(X.x-G.ax,1,k.width-1),w=G.ayref===G.yref?X.y:c.constrain(X.y-G.ay,1,k.height-1)),X.x=c.constrain(X.x,1,k.width-1),X.y=c.constrain(X.y,1,k.height-1);var M=tt-s.top,A=tt-s.left;i?r.select("svg").attr({x:tt-1,y:tt}):(rt.attr({x:A,y:M}),rt.selectAll("tspan.line").attr({y:M,x:A})),et.call(d.setRect,$/2,$/2,v-$,y-$);var S=0,T=0;S=G.axref===G.xref?Math.round(X.aax-v/2):Math.round(X.x-v/2),T=G.ayref===G.yref?Math.round(X.aay-y/2):Math.round(X.y-y/2),J.call(c.setTranslate,S,T);var z="annotations["+e+"]",E=function(n,r){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=G.axref===G.xref?X.aax+n:X.x+n,s=G.ayref===G.yref?X.aay+r:X.y+r;var u=c.rotationXYMatrix(Y,i,s),f=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,m=et.attr("height")/2,v=[[i-p,s-m,i-p,s+m],[i-p,s+m,i+p,s+m],[i+p,s+m,i+p,s-m],[i+p,s-m,i-p,s-m]].map(d);if(!v.reduce(function(t,e){return t^!!a(b,w,b+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=a(i,s,b,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=G.arrowwidth,_=G.arrowcolor,M=W.append("g").style({opacity:h.opacity(_)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=M.append("path").attr("d","M"+i+","+s+"L"+b+","+w).style("stroke-width",y+"px").call(h.stroke,h.rgb(_));x(k,G.arrowhead,"end",G.arrowsize);var A=M.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-b)+","+(s-w),transform:"translate("+b+","+w+")"}).style("stroke-width",y+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");if(t._context.editable){var S,T,E;g.init({element:A.node(),prepFn:function(){var t=c.getTranslate(J);T=t.x,E=t.y,S={},H&&H.autorange&&(S[H._name+".autorange"]=!0),Z&&Z.autorange&&(S[Z._name+".autorange"]=!0)},moveFn:function(t,e){M.attr("transform","translate("+t+","+e+")");var n=f(T,E),r=n[0]+t,i=n[1]+e;J.call(c.setTranslate,r,i),S[z+".x"]=H?H.p2r(H.r2p(G.x)+t):(b+t-I.l)/I.w,S[z+".y"]=Z?Z.p2r(Z.r2p(G.y)+e):1-(w+e-I.t)/I.h,G.axref===G.xref&&(S[z+".ax"]=H?H.p2r(H.r2p(G.ax)+t):(b+t-I.l)/I.w),G.ayref===G.yref&&(S[z+".ay"]=Z?Z.p2r(Z.r2p(G.ay)+e):1-(w+e-I.t)/I.h),Q.attr({transform:"rotate("+Y+","+r+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,S);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};G.showarrow&&E(0,0);var L=c.rotationXYMatrix(Y,X.x,X.y),D=c.apply2DTransform(L);if(t._context.editable){var P,C,O;g.init({element:J.node(),prepFn:function(){var t=c.getTranslate(J);P=t.x,C=t.y,O={}},moveFn:function(t,e){J.call(c.setTranslate,P+t,C+e);var n="pointer";if(G.showarrow)G.axref===G.xref?O[z+".ax"]=H.p2r(H.r2p(G.ax)+t):O[z+".ax"]=G.ax+t,G.ayref===G.yref?O[z+".ay"]=Z.p2r(Z.r2p(G.ay)+e):O[z+".ay"]=G.ay+e,E(t,e);else{if(H)O[z+".x"]=G.x+t/H._m;else{var r=G._xsize/I.w,i=G.x+G._xshift/I.w-r/2;O[z+".x"]=g.align(i+t/I.w,r,0,1,G.xanchor)}if(Z)O[z+".y"]=G.y+e/Z._m;else{var a=G._ysize/I.h,o=G.y-G._yshift/I.h-a/2;O[z+".y"]=g.align(o-e/I.h,a,0,1,G.yanchor)}H&&Z||(n=g.getCursor(H?.5:O[z+".x"],Z?.5:O[z+".y"],G.xanchor,G.yanchor))}var s=D(P,C),l=s[0]+t,u=s[1]+e;J.call(c.setTranslate,P+t,C+e),Q.attr({transform:"rotate("+Y+","+l+","+u+")"}),m(J,n)},doneFn:function(e){if(m(J),e){l.relayout(t,O);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var w,M=t.layout,k=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return M.annotations=u,y(M,k),void r(t);if("remove"===u)return delete M.annotations,k.annotations=[],void r(t);if(n&&"add"!==u){for(w=0;we;w--)k._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}k._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var S=M.annotations[e],T=k.annotations[e];if(S){var z={};"string"==typeof n&&n?z[n]=u:c.isPlainObject(n)&&(z=n);var E=Object.keys(z);for(w=0;w4/3&&(R=V)}}else F&&(N&&(R<1/3?R+=q:R>2/3&&(R-=q)),R=(R-F.domain[0])/(F.domain[1]-F.domain[0]),R=F.fraction2r(R))}F&&F===O&&j&&("log"===j&&"log"!==F.type?R=Math.pow(10,R):"log"!==j&&"log"===F.type&&(R=R>0?Math.log(R)/Math.LN10:void 0)),S[C]=R}}var G={};v(S,G,k),k.annotations[e]=G;var H=f.getFromId(t,G.xref),Z=f.getFromId(t,G.yref),X={x:0,y:0},Y=+G.textangle||0,W=k._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",G.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:S,fullAnnotation:G})}),Q=W.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),J=Q.append("g"),$=G.borderwidth,K=G.borderpad,tt=$+K,et=J.append("rect").attr("class","bg").style("stroke-width",$+"px").call(h.stroke,G.bordercolor).call(h.fill,G.bgcolor),nt=G.font,rt=J.append("text").classed("annotation",!0).attr("data-unformatted",G.text).text(G.text);t._context.editable?rt.call(p.makeEditable,J).call(_).on("edit",function(n){G.text=n,this.attr({"data-unformatted":G.text}),this.call(_);var r={};r["annotations["+e+"].text"]=G.text,H&&H.autorange&&(r[H._name+".autorange"]=!0),Z&&Z.autorange&&(r[Z._name+".autorange"]=!0),l.relayout(t,r)}):rt.call(_),Q.attr({transform:"rotate("+Y+","+X.x+","+X.y+")"}).call(d.setPosition,X.x,X.y)}}}function a(t,e,n,r,i,a,o,s){var l=n-t,u=i-t,c=o-i,f=r-e,h=a-e,d=s-a,p=l*d-c*f;if(0===p)return null;var m=(u*d-c*h)/p,g=(u*f-l*h)/p;return g<0||g>1||m<0||m>1?null:{x:t+l*m,y:e+f*m}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),m=t("../../lib/setcursor"),g=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:r,drawOne:i}},{"../../lib":316,"../../lib/setcursor":326,"../../lib/svg_text_utils":328,"../../plotly":338,"../../plots/cartesian/axes":343,"../../plots/plots":374,"../color":223,"../dragelement":244,"../drawing":246,"./annotation_defaults":214,"./defaults":218,"./draw_arrow_head":220,d3:8,"fast-isnumeric":12}],220:[function(t,e,n){"use strict";var r=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,n,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof n&&n||(n="end");var f,h,d,p,m=(o.getPx(t,"stroke-width")||1)*l,g=t.style("stroke")||a.defaultLine,v=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,_=c.backoff*m;if("line"===u.nodeName){if(f={x:+t.attr("x1"),y:+t.attr("y1")},h={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(f.y-h.y,f.x-h.x),p=d+Math.PI,_){var b=_*Math.cos(d),w=_*Math.sin(d);y&&(f.x-=b,f.y-=w,t.attr({x1:f.x,y1:f.y})),x&&(h.x+=b,h.y+=w,t.attr({x2:h.x,y2:h.y}))}}else if("path"===u.nodeName){var M=u.getTotalLength(),k="";if(y){var A=u.getPointAtLength(0),S=u.getPointAtLength(.1);d=Math.atan2(A.y-S.y,A.x-S.x),f=u.getPointAtLength(Math.min(_,M)),_&&(k="0px,"+_+"px,")}if(x){var T=u.getPointAtLength(M),z=u.getPointAtLength(M-.1);if(p=Math.atan2(T.y-z.y,T.x-z.x),h=u.getPointAtLength(Math.max(0,M-_)),_){var E=k?2*_:_;k+=M-E+"px,"+M+"px"}}else k&&(k+=M+"px");k&&t.style("stroke-dasharray",k)}var L=function(n,i){e>5&&(i=0),r.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+n.x+","+n.y+")rotate("+180*i/Math.PI+")scale("+m+")"}).style({fill:g,opacity:v,"stroke-width":0})};y&&L(f,d),x&&L(h,p)}}},{"../color":223,"../drawing":246,"./arrow_paths":215,d3:8,"fast-isnumeric":12}],221:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":216,"./calc_autorange":217,"./defaults":218,"./draw":219}],222:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],223:[function(t,e,n){"use strict";function r(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===r.length;if(!i&&3!==r.length)return t;for(var o=0;o=0))return t;if(3===o)r[o]>1&&(r[o]=1);else if(r[o]>=1)return t}var s=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return i?"rgba("+s+", "+r[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var n=i(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},o.combine=function(t,e){var n=i(t).toRgb();if(1===n.a)return i(t).toRgbString();var r=i(e||o.background).toRgb(),a=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},s={r:a.r*(1-n.a)+n.r*n.a,g:a.g*(1-n.a)+n.g*n.a,b:a.b*(1-n.a)+n.b*n.a};return i(s).toRgbString()},o.contrast=function(t,e,n){var r=i(t),a=r.isLight()?r.darken(n):r.lighten(e);return a.toString()},o.stroke=function(t,e){var n=i(e);t.style({stroke:o.tinyRGB(n),"stroke-opacity":n.getAlpha()})},o.fill=function(t,e){var n=i(e);t.style({fill:o.tinyRGB(n),"fill-opacity":n.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,n,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):n.node()&&!n.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===b.titleside)K.domain[1]-=st/S.h,a[1]*=-1;else{K.domain[0]+=st/S.h;var u=Math.max(1,n.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),K.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(S.h*(1-K.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(L);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?z[0]:(L[e]+L[e-1])/2,e===L.length-1?z[1]:(L[e]+L[e+1])/2].map(K.c2p).map(Math.round);e!==L.length-1&&(n[1]+=n[1]>n[0]?1:-1);var a=D(t).replace("e-",""),o=i(a).toHexString();r.select(this).attr({x:X,width:Math.max(B,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:o})});var h=at.select(".cblines").selectAll("path.cbline").data(b.line.color&&b.line.width?E:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){r.select(this).attr("d","M"+X+","+(Math.round(K.c2p(t))+b.line.width/2%1)+"h"+B).call(d.lineGroupStyle,b.line.width,I(t),b.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=X+B+(b.outlinewidth||0)/2-("outside"===b.ticks?1:0),K.side="right",c.syncOrAsync([function(){return l.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(b.titleside)===-1){var e=K.titlefont.size,n=K._offset+K._length/2,i=S.l+(K.position||0)*S.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));M("h"+K._id+"title",{avoid:{selection:r.select(t).selectAll("g."+K._id+"tick"),side:b.titleside,offsetLeft:S.l,offsetTop:S.t,maxShift:A.width},attributes:{x:i,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,n){var r,i=_();r=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:K,propName:r,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),m.draw(t,e,f(a,n||{}))}function k(){var n=B+b.outlinewidth/2+d.bBox(K._axislayer.node()).width;if(R=ot.select("text"),R.node()&&!R.classed("js-placeholder")){var r,i=ot.select(".h"+K._id+"title-math-group").node();r=i&&["top","bottom"].indexOf(b.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-X-S.l,n=Math.max(n,r)}var a=2*b.xpad+n+b.borderwidth+b.outlinewidth/2,s=Q-J;at.select(".cbbg").attr({x:X-b.xpad-(b.borderwidth+b.outlinewidth)/2,y:J-H,width:Math.max(a,2),height:Math.max(s+2*H,2)}).call(p.fill,b.bgcolor).call(p.stroke,b.bordercolor).style({"stroke-width":b.borderwidth}),at.selectAll(".cboutline").attr({x:X,y:J+b.ypad+("top"===b.titleside?st:0),width:Math.max(B,2),height:Math.max(s-2*b.ypad-st,2)}).call(p.stroke,b.outlinecolor).style({fill:"None","stroke-width":b.outlinewidth});var l=({center:.5,right:1}[b.xanchor]||0)*a;at.attr("transform","translate("+(S.l-l)+","+S.t+")"),o.autoMargin(t,e,{x:b.x,y:b.y,l:a*({right:1,center:.5}[b.xanchor]||0),r:a*({left:1,center:.5}[b.xanchor]||0),t:s*({bottom:1,middle:.5}[b.yanchor]||0),b:s*({top:1,middle:.5}[b.yanchor]||0)})}var A=t._fullLayout,S=A._size;if("function"!=typeof b.fillcolor&&"function"!=typeof b.line.color)return void A._infolayer.selectAll("g."+e).remove();var T,z=r.extent(("function"==typeof b.fillcolor?b.fillcolor:b.line.color).domain()),E=[],L=[],I="function"==typeof b.line.color?b.line.color:function(){return b.line.color},D="function"==typeof b.fillcolor?b.fillcolor:function(){return b.fillcolor},P=b.levels.end+b.levels.size/100,C=b.levels.size,O=1.001*z[0]-.001*z[1],F=1.001*z[1]-.001*z[0];for(T=b.levels.start;(T-P)*C<0;T+=C)T>O&&Tz[0]&&T1){var it=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));et*=it*c.roundUp(rt/it,[2,5,10]),(Math.abs(b.levels.start)/b.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=et}K.domain=[W+Z,W+U-Z],K.setScale();var at=A._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(S.l)+","+Math.round(S.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(S.l)+",-"+Math.round(S.t)+")");K._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(b.titleside)!==-1){var lt,ut=S.l+(b.x+G)*S.w,ct=K.titlefont.size;lt="top"===b.titleside?(1-(W+U-Z))*S.h+S.t+3+.75*ct:(1-(W+Z))*S.h+S.t-3-.25*ct,M(K._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ft=c.syncOrAsync([o.previousPromises,w,o.previousPromises,k],t);if(ft&&ft.then&&(t._promises||[]).push(ft),t._context.editable){var ht,dt,pt;u.init({element:at.node(),prepFn:function(){ht=at.attr("transform"),h(at)},moveFn:function(t,e){at.attr("transform",ht+" translate("+t+","+e+")"),dt=u.align(Y+t/S.w,q,0,1,b.xanchor),pt=u.align(W-e/S.h,U,0,1,b.yanchor);var n=u.getCursor(dt,pt,b.xanchor,b.yanchor);h(at,n)},doneFn:function(e){h(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},_().index)}})}return ft}function _(){var n,r,i=e.substr(2);for(n=0;n=0?i.Reds:i.Blues,l.colorscale=h,s.reversescale&&(h=a(h)),s.colorscale=h)}},{"../../lib":316,"./flip_scale":234,"./scales":241}],230:[function(t,e,n){"use strict";var r=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},r.colorscale,{}),cauto:i({},r.zauto,{}),cmax:i({},r.zmax,{}),cmin:i({},r.zmin,{}),autocolorscale:i({},r.autocolorscale,{}),reversescale:i({},r.reversescale,{})}}},{"../../lib/extend":312,"./attributes":228,"./scales.js":241}],231:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":241}],232:[function(t,e,n){"use strict";var r=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,n,u,c){var f=c.prefix,h=c.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,m=f?i.nestedProperty(e,d).get()||{}:e,g=p[h+"min"],v=p[h+"max"],y=p.colorscale,x=r(g)&&r(v)&&g=0;i--,a++)e=t[i],r[a]=[1-e[0],e[1]];return r}},{}],235:[function(t,e,n){"use strict";var r=t("./scales"),i=t("./default_scale"),a=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=i),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),a(t)?t:e):e}},{"./default_scale":231,"./is_valid_scale_array":239,"./scales":241}],236:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../../lib"),a=t("./is_valid_scale");e.exports=function(t,e){var n=e?i.nestedProperty(t,e).get()||{}:t,o=n.color,s=!1;if(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],243:[function(t,e,n){"use strict";var r=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,n,a){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===a?0:"middle"===a?1:"top"===a?2:r.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":316}],244:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,m._dragged=!1,m._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,f=(new Date).getTime(),f-m._mouseDownTimev&&(g=Math.max(g-1,1)),t.doneFn&&t.doneFn(m._dragged,g),!m._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),d.dispatchEvent(n)}return i(m),m._dragged=!1,o.pauseEvent(e)}var u,c,f,h,d,p,m=o.getPlotDiv(t.element)||{},g=1,v=s.DBLCLICKDELAY;m._mouseDownTime||(m._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=r},{"../../lib":316,"../../plotly":338,"../../plots/cartesian/constants":348,"./align":242,"./cursor":243,"./unhover":245}],245:[function(t,e,n){"use strict";var r=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,n)},i.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":311}],246:[function(t,e,n){"use strict";function r(t,e,n,r,i,a,o){if(s.traceIs(n,"symbols")){var u=p(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(n)?u(t.ms):(a.size||6)/2,t.mrc=e;var r=m.symbolNumber(t.mx||a.symbol)||0,i=r%100;return t.om=r%200>=100,m.symbolFuncs[i](e)+(r>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,f,h;t.so?(h=o.outlierwidth,f=o.outliercolor,c=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,f="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=r(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(h||1)+"px",fill:"none"}):(e.style("stroke-width",h+"px").call(l.fill,c),h&&e.call(l.stroke,f))}function i(t,e,n,r){var i=t[0]-e[0],o=t[1]-e[1],s=n[0]-e[0],l=n[1]-e[1],u=Math.pow(i*i+o*o,b/2),c=Math.pow(s*s+l*l,b/2),f=(c*c*i-u*u*s)*r,h=(c*c*o-u*u*l)*r,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&f/d),2),a.round(e[1]+(d&&h/d),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&h/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),m=e.exports={};m.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(l.fill,r)},m.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},m.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},m.setRect=function(t,e,n,r,i){t.call(m.setPosition,e,n).call(m.setSize,r,i)},m.translatePoint=function(t,e,n,r){var i=t.xp||n.c2p(t.x),a=t.yp||r.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},m.translatePoints=function(t,e,n,r){t.each(function(t){var i=a.select(this);m.translatePoint(t,i,e,n,r)})},m.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},m.crispRound=function(t,e,n){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},m.singleLineStyle=function(t,e,n,r,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=n||a.width||0,s=i||a.dash||"";l.stroke(e,r||a.color),m.dashLine(e,s,o)},m.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=r||i.dash||"";a.select(this).call(l.stroke,n||i.color).call(m.dashLine,s,o)})},m.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},m.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=a.select(this);try{n.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),n.remove()}})};var g=t("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolList=[],Object.keys(g).forEach(function(t){var e=g[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"])});var v=m.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";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),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},m.singlePointStyle=function(t,e,n){var i=n.marker,a=i.line,o=m.tryColorscale(i,""),s=m.tryColorscale(i,"line");r(t,e,n,o,s,i,a)},m.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=m.tryColorscale(n,""),i=m.tryColorscale(n,"line");t.each(function(t){m.singlePointStyle(t,a.select(this),e,r,i)})}},m.tryColorscale=function(t,e){var n=e?c.nestedProperty(t,e).get():t,r=n.colorscale,i=n.color;return r&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(r,n.cmin,n.cmax)):c.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},_=1.3;m.textPointStyle=function(t,e){t.each(function(t){var n=a.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,n.call(m.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(r).call(f.convertToTspans);var h=a.select(this.parentNode),d=n.selectAll("tspan.line"),p=((d[0].length||1)-1)*_+1,g=x[l]*c,v=.75*u+x[s]*c+(x[s]-1)*p*u/2;h.attr("transform","translate("+g+","+v+")"),p>1&&d.attr({x:n.attr("x"),y:n.attr("y")})})};var b=.5;m.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],a=[];for(n=1;n=A&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(l),c.extendFlat({},l)},m.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=a.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":305,"../../lib":316,"../../lib/svg_text_utils":328,"../../registry":382,"../../traces/scatter/make_bubble_size_func":408,"../../traces/scatter/subtypes":413,"../color":223,"../colorscale":237,"./symbol_defs":247,d3:8,"fast-isnumeric":12}],247:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,i="l"+e+",-"+e,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+n+i+a+i+a+o+a+o+n+o+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),i=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),i=r.round(-t,2),a=r.round(t*-.309,2),o=r.round(.809*t,2);return"M"+e+","+a+"L"+n+","+o+"H-"+n+"L-"+e+","+a+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),i=r.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+n+"V"+n+"L0,"+e+"L-"+i+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),i=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+i+"H"+n+"L"+e+",0L"+n+",-"+i+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),i=r.round(.951*e,2),a=r.round(.363*e,2),o=r.round(.588*e,2),s=r.round(-e,2),l=r.round(e*-.309,2),u=r.round(.118*e,2),c=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+n+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),i=r.round(.76*t,2);return"M-"+i+",0l-"+n+",-"+e+"h"+i+"l"+n+",-"+e+"l"+n+","+e+"h"+i+"l-"+n+","+e+"l"+n+","+e+"h-"+i+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),i=r.round(1.6*t,2),a=r.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M-"+e+","+n+o+e+","+n+o+"0,-"+i+o+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),i=r.round(1.6*t,2),a=r.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M"+e+",-"+n+o+"-"+e+",-"+n+o+"0,"+i+o+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),i="A "+n+","+n+" 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=r.round(1.4*t,2),n=r.round(1.9*t,2),i="A "+n+","+n+" 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=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),i=r.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:8}],248:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],249:[function(t,e,n){"use strict";function r(t,e,n,r){var a=e["error_"+r]||{},l=a.visible&&["linear","log"].indexOf(n.type)!==-1,u=[];if(l){for(var c=s(a),f=0;f0;t.each(function(t){var e,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(e=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;if(d.visible||h.visible){var m=i.select(this).selectAll("g.errorbar").data(t,e);m.exit().remove(),m.style("opacity",1);var g=m.enter().append("g").classed("errorbar",!0);c&&g.style("opacity",0).transition().duration(n.duration).style("opacity",1),m.each(function(t){var e=i.select(this),o=r(t,l,u);if(!p||t.vis){var f;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var m=d.width;f="M"+(o.x-m)+","+o.yh+"h"+2*m+"m-"+m+",0V"+o.ys,o.noYS||(f+="m-"+m+",0h"+2*m);var g=e.select("path.yerror");s=!g.size(),s?g=e.append("path").classed("yerror",!0):c&&(g=g.transition().duration(n.duration).ease(n.easing)),g.attr("d",f)}if(h.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var v=(h.copy_ystyle?d:h).width;f="M"+o.xh+","+(o.y-v)+"v"+2*v+"m0,-"+v+"H"+o.xs,o.noXS||(f+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(n.duration).ease(n.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":413,d3:8,"fast-isnumeric":12}],254:[function(t,e,n){"use strict";var r=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},a=e.error_x||{},o=r.select(this);o.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(i.stroke,n.color),a.copy_ystyle&&(a=n),o.selectAll("path.xerror").style("stroke-width",a.thickness+"px").call(i.stroke,a.color)})}},{"../color":223,d3:8}],255:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":348}],256:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return i.coerce(t,e,s,n,r)}var o=r("source"),l=r("visible",!!o);if(!l)return e;r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var u={_fullLayout:n},c=["x","y"],f=0;f<2;f++)a.coerceRef(t,e,u,c[f],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var n={name:l,handleItemDefaults:r};o(t,e,n)}},{"../../lib":316,"../../plots/array_container_defaults":340,"../../plots/cartesian/axes":343,"./attributes":255}],257:[function(t,e,n){"use strict";var r=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var n=r.select(this);if(!this.img||this.img.src!==e.source){n.attr("xmlns",o.svg);var i=new Promise(function(t){function r(){n.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=r,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var r=t.toDataURL("image/png");n.attr("xlink:href",r)},n.on("error",r),n.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function n(e){var n=r.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,f=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,h=c*d.x[e.xanchor].offset,p=f*d.y[e.yanchor].offset,m=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,g=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+h,v=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":m+=" slice";break;case"stretch":m="none"}n.attr({x:g,y:v,width:c,height:f,preserveAspectRatio:m,opacity:e.opacity});var y=o?o._id:"",x=l?l._id:"",_=y+x;_&&n.call(i.setClipUrl,"clip"+s._uid+_)}for(var s=t._fullLayout,l=[],u=[],c=[],f=0;f=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],260:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":312,"../../plots/font_attributes":363,"../color/attributes":222}],261:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],262:[function(t,e,n){"use strict";var r=t("../../registry"),i=t("../../lib"),a=t("./attributes"),o=t("../../plots/layout_attributes"),s=t("./helpers");e.exports=function(t,e,n){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},m=0,g="normal",v=0;v1);if(x!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var _=t.xaxis;_&&_.rangeslider&&_.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",g),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),i.noneOrAll(d,p,["x","y"]); -}}},{"../../lib":316,"../../plots/layout_attributes":365,"../../registry":382,"./attributes":260,"./helpers":265}],263:[function(t,e,n){"use strict";function r(t,e){function n(n){v.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(a,e)})}var r=t.data()[0][0],i=e._fullLayout,o=r.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?r.label:o.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(m.font,i.legend.font).text(u),e._context.editable&&!s?f.call(v.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" ");var i,a=r.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=r.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):f.call(n)}function i(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var f=a.label,h=n.indexOf(f);h===-1?n.push(f):n.splice(h,1),c.relayout(e,"hiddenlabels",n)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),h=c[0].length||1;n=s*h,r=u.node()&&m.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}n=Math.max(n,16)+3,i.height=n,i.width=r}function o(t,e,n){var r=t._fullLayout,i=r.legend,a=i.borderwidth,o=b.isGrouped(i);if(b.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,a,5+a+i.height+n/2),i.height+=n,i.width=Math.max(i.width,r)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),n.each(function(e){var n=e[0],r=u.select(this).select(".legendtoggle");r.call(m.setRect,0,-n.height/2,(t._context.editable?0:i.width)+40,n.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cr.width-(r.margin.r+r.margin.l)&&(x=0,g+=v,i.height=i.height+v,v=0),f.setTranslate(this,a+x,5+a+e.height/2+g),i.width+=o+n,i.height=Math.max(i.height,e.height),x+=o+n,v=Math.max(e.height,v)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),n.each(function(e){var n=e[0],r=u.select(this).select(".legendtoggle");r.call(m.setRect,0,-n.height/2,t._context.editable?0:i.width,n.height)})}}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var i="top";w.isBottomAnchor(n)?i="bottom":w.isMiddleAnchor(n)&&(i="middle"),h.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[i]||0),t:n.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),h.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),m=t("../drawing"),g=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),_=t("./style"),b=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),z.call(m.setRect,N,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,a="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,b=n.showlegend&&x(t.calcdata,v),M=n.hiddenlabels||[];if(!n.showlegend||!b.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+a).data([0]);A.enter().append("clipPath").attr("id",a).append("rect");var S=k.selectAll("rect.bg").data([0]);S.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),S.call(g.stroke,v.bordercolor),S.call(g.fill,v.bgcolor),S.style("stroke-width",v.borderwidth+"px");var T=k.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var z=k.selectAll("rect.scrollbar").data([0]);z.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var E=T.selectAll("g.groups").data(b);E.enter().append("g").attr("class","groups"),E.exit().remove();var L=E.selectAll("g.traces").data(f.identity);L.enter().append("g").attr("class","traces"),L.exit().remove(),L.call(_).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(r,t).call(i,t)});var I=0!==k.enter().size();I&&(o(t,E,L),s(t));var D=0,P=n.width,C=0,O=n.height;o(t,E,L),v.height>O?l(t):s(t);var F=n._size,R=F.l+F.w*v.x,j=F.t+F.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?j-=v.height:w.isMiddleAnchor(v)&&(j-=v.height/2);var N=v.width,B=F.w;N>B?(R=F.l,N=B):(R+N>P&&(R=P-N),RV?(j=F.t,q=V):(j+q>O&&(j=O-q),jn[1])return n[1]}return i}function n(t){return t[0]}var r,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},m={};s&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",c.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(m.line={width:e("line.width",n,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[c.minExtend(a,p)],i=c.minExtend(o,m)}var g=l.select(this).select("g.legendpoints"),v=g.selectAll("path.scatterpts").data(s?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,i),s&&(r[0].mrc=3);var y=g.selectAll("g.pointtext").data(u?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||r.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||n.color),e&&i.call(h.stroke,t.mlc||r.color)})}function o(t){var e=t[0].trace,n=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=l.select(this);r.style("stroke-width",n+"px").call(h.fill,t.fc||e.fillcolor),n&&r.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,n=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(r).each(i)}},{"../../lib":316,"../../registry":382,"../../traces/pie/style_one":391,"../../traces/scatter/subtypes":413,"../color":223,"../drawing":246,d3:8}],268:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),i=n.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===r){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),m=0;m1)return r(["resetViews","toggleHover"]),o(g,n);c&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),h&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=i(s),y=[];return((u||p)&&!v||m)&&(y=["zoom2d","pan2d"]),(u||m)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!u&&!p||v||m||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):u?r(["hoverClosestCartesian","hoverCompareCartesian"]):d&&r(["hoverClosestPie"]),o(g,n)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var m=i(e,n,l);c("x",m[0]),c("y",m[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",n.font);var g=c("bgcolor");c("activecolor",o.contrast(g,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":316,"../color":223,"./attributes":272,"./button_attributes":273,"./constants":274}],276:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=i.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var s=0;se;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,n,r){function i(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,E)},i=E.line.width?E.line.color:"rgba(0,0,0,0)",a=n.append("path").attr(r).style("opacity",E.opacity).call(b.stroke,i).call(b.fill,E.fillcolor).call(w.dashLine,E.line.dash,E.line.width);L&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+L),t._context.editable&&f(t,a,E,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof n&&n?l[n]=r:x.isPlainObject(n)&&(l=n);var u=Object.keys(l);for(a=0;aZ&&r>X&&!t.shiftKey?M.getCursor(i/n,1-a/r):"move";k(e,o),H=o.split("-")[0]}function a(e){N=_.getFromId(t,n.xref),B=_.getFromId(t,n.yref),q=S.getDataToPixel(t,N),V=S.getDataToPixel(t,B,!0),U=S.getPixelToData(t,N),G=S.getPixelToData(t,B,!0);var a="shapes["+r+"]";"path"===n.type?(R=n.path,j=a+".path"):(c=q(n.x0),f=V(n.y0),h=q(n.x1),d=V(n.y1),m=a+".x0",v=a+".y0",x=a+".x1",b=a+".y1"),cX&&(u[E]=n[P]=G(s),u[L]=n[C]=G(l)),f-c>Z&&(u[I]=n[O]=U(c),u[D]=n[F]=U(f))}e.attr("d",p(t,n))}var u,c,f,h,d,m,v,x,b,w,A,T,z,E,L,I,D,P,C,O,F,R,j,N,B,q,V,U,G,H,Z=10,X=10,Y={setCursor:i,element:e.node(),prepFn:a,doneFn:o},W=Y.element.getBoundingClientRect();M.init(Y)}function h(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function d(t,e,n){var r=_.getFromId(t,n.id,"x")._id,i=_.getFromId(t,n.id,"y")._id,a="below"===e.layer,o=r===e.xref||i===e.yref,s=!!n.shapelayer;return a&&o&&s}function p(t,e){var n,r,i,a,o=e.type,s=_.getFromId(t,e.xref),l=_.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=S.shapePositionToRange(s),r=function(t){return s._offset+s.r2p(n(t,!0))}):r=function(t){return u.l+u.w*t},l?(i=S.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(r=S.decodeDate(r)),l&&"date"===l.type&&(a=S.decodeDate(a)),m(e.path,r,a);var c=r(e.x0),f=r(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,g=(h+d)/2,v=Math.abs(p-c),y=Math.abs(g-h),x="A"+v+","+y,b=p+v+","+g,w=p+","+(g-y);return"M"+b+x+" 0 1,1 "+w+x+" 0 0,1 "+b+"Z"}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,i=t.charAt(0),a=A.paramIsX[i],o=A.paramIsY[i],s=A.numParams[i],l=t.substr(1).replace(A.paramRE,function(t){return a[r]?t=e(t):o[r]&&(t=n(t)),r++,r>s&&(t="X"),t});return r>s&&(l=l.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),i+l})}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,i=t.charAt(0),a=A.paramIsX[i],o=A.paramIsY[i],s=A.numParams[i],l=t.substr(1).replace(A.paramRE,function(t){return r>=s?t:(a[r]?t=e(t):o[r]&&(t=n(t)),r++,t)});return i+l})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),_=t("../../plots/cartesian/axes"),b=t("../color"),w=t("../drawing"),M=t("../dragelement"),k=t("../../lib/setcursor"),A=t("./constants"),S=t("./helpers"),T=t("./shape_defaults"),z=t("./defaults");e.exports={draw:r,drawOne:i}},{"../../lib":316,"../../lib/setcursor":326,"../../plotly":338,"../../plots/cartesian/axes":343,"../color":223,"../dragelement":244,"../drawing":246,"./constants":286,"./defaults":287,"./helpers":289,"./shape_defaults":291,"fast-isnumeric":12}],289:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var i,a=t._fullLayout._size;if(e){var o=n.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=n.decodeDate(i))}else i=r?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},n.getPixelToData=function(t,e,r){var i,a=t._fullLayout._size;if(e){var o=n.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=r?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],290:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":284,"./calc_autorange":285,"./defaults":287,"./draw":288}],291:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,n,s,l){function u(n,i){return r.coerce(t,e,a,n,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var f=t.path?"path":"rect",h=u("type",f),d=["x","y"],p=0;p<2;p++){var m=d[p],g={_fullLayout:n},v=i.coerceRef(t,e,g,m,"","paper");if("path"!==h){var y,x,_,b=.25,w=.75;"paper"!==v?(y=i.getFromId(g,v),_=o.rangeToShapePosition(y),x=o.shapePositionToRange(y)):x=_=r.identity;var M=m+"0",k=m+"1",A=t[M],S=t[k];t[M]=x(t[M],!0),t[k]=x(t[k],!0),i.coercePosition(e,g,u,v,M,b),i.coercePosition(e,g,u,v,k,w),e[M]=_(e[M]),e[k]=_(e[k]),t[M]=A,t[k]=S}}return"path"===h?u("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":316,"../../plots/cartesian/axes":343,"./attributes":284,"./helpers":289}],292:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},r,{})},font:a({},r,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":312,"../../plots/animation_attributes":339,"../../plots/font_attributes":363,"../../plots/pad_attributes":373,"./constants":293}],293:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],294:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}var o=i(t,e),l=r("visible",o.length>0);if(l){r("active"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),a.coerceFont(r,"font",n.font);var u=r("currentvalue.visible");u&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),a.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function i(t,e){function n(t,e){return a.coerce(r,i,c,t,e)}for(var r,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*E.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+E.stepInset+(t.inputAreaLength-2*E.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-E.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*E.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+E.railTouchRectClass).data([0]);r.enter().append("rect").classed(E.railTouchRectClass,!0).call(d,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,E.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),k.setTranslate(r,0,n.currentValueTotalHeight)}function _(t,e){var n=t.selectAll("rect."+E.railRectClass).data([0]);n.enter().append("rect").classed(E.railRectClass,!0);var r=e.inputAreaLength-2*E.railInset;n.attr({width:r,height:E.railWidth,rx:E.railRadius,ry:E.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(n,E.railInset,.5*(e.inputAreaWidth-E.railWidth)+e.currentValueTotalHeight)}function b(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(s.enter().append("g").classed(E.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&b(t),0!==n.length){var l=s.selectAll("g."+E.groupClassName).data(n,i);l.enter().append("g").classed(E.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,E.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+d+")")}}}function p(){T=0,z=!0,E=I,M._infolayer.select("."+e).attr({"data-unformatted":E}).text(E).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var m=n.propContainer,g=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},_=n.attributes,b=n.transform,w=n.containerGroup,M=t._fullLayout,k=m.titlefont.family,A=m.titlefont.size,S=m.titlefont.color,T=1,z=!1,E=m.title.trim();""===E&&(T=0),E.match(/Click to enter .+ title/)&&(T=.2,z=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var L=w.selectAll("text").data([0]);L.enter().append("text"),L.text(E).attr("class",e),L.attr({"data-unformatted":E}).call(f);var I="Click to enter "+y+" title";t._context.editable?(E||p(),L.call(c.makeEditable).on("edit",function(e){void 0!==v?a.restyle(t,g,e,v):a.relayout(t,g,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(_).selectAll("tspan.line").attr(_)})):E&&!E.match(/Click to enter .+ title/)||L.remove(),L.classed("js-placeholder",z)}},{"../../lib":316,"../../lib/svg_text_utils":328,"../../plotly":338,"../../plots/plots":374,"../color":223,"../drawing":246,d3:8,"fast-isnumeric":12}],298:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":312,"../../plots/font_attributes":363,"../../plots/pad_attributes":373,"../color/attributes":222}],299:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],300:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}var o=i(t,e),l=r("visible",o.length>0);l&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),a.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function i(t,e){function n(t,e){return a.coerce(r,i,c,t,e)}for(var r,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==n.length){var c=u.selectAll("g."+S.headerGroupClassName).data(n,i);c.enter().append("g").classed(S.headerGroupClassName,!0);var f=u.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(v).attr(S.menuIndexAttrName,"-1"),c.exit().each(function(e){x.select(this).remove(),f.call(v).attr(S.menuIndexAttrName,"-1"),_.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],305:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],306:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":221,"./components/images":258,"./components/legend":266,"./components/rangeselector":278,"./components/rangeslider":283,"./components/shapes":290,"./components/sliders":296,"./components/updatemenus":302,"./fonts/mathjax_config":307,"./lib/queue":324,"./plot_api/plot_schema":332,"./plot_api/register":333,"./plot_api/set_plot_config":334,"./plot_api/to_image":336,"./plot_api/validate":337,"./plotly":338,"./snapshot":387,"./snapshot/download":384,"./traces/scatter":403,d3:8,"es6-promise":10}],307:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],308:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),r(t)?Number(t):i}},{"../constants/numerical":303,"fast-isnumeric":12}],309:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,i){!r(t)||void 0!==i.min&&ti.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,i){t%1||!r(t)||void 0!==i.min&&ti.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var i="number"==typeof t;r.strict!==!0&&i?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){i(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(a(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!s.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,r,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var m=u.length;if(m>3||3!==m&&s[1]||!m)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var g=(new Date).getFullYear();e=((Number(u[0])-g+70)%100+200)%100+g-70}if(!a(e))return l;var v=new Date(0,0,1);if(v.setFullYear(c?e:-e),u.length>1){if(r=Number(u[1])-1,u[1].length>2||!(r>=0&&r<=11))return l;if(v.setMonth(r),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(v.setDate(i),v.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(v.setHours(o),v.getHours()!==o)return l;if(u.length>1)return i=v.getTime(),r=Number(u[1]),2===u[1].length&&r>=0&&r<=59?(i+=f*r,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return v.getTime()},d=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==l};var m=90*u,g=3*c,v=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var n=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(n),o=e0&&(r.push(i),i=[])}return r.push(i),r},n.makeLine=function(t,e){var n={};return n=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(n.trace=e),n},n.makePolygon=function(t,e){var n={};if(1===t.length)n={type:"Polygon",coordinates:t};else{for(var r=new Array(t.length),i=0;in?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},i.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,n))/Math.log(r),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,n/i))/Math.log(r)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,n)?t(e,n,r):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(n=0;n=s&&(i-=s*Math.floor(i/s)),i<0?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[r];c[n]=a}return c},i.syncOrAsync=function(t,e,n){function r(){return i.syncOrAsync(t,e,n)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(r).then(void 0,i.promiseError);return n&&n(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,n){if(t){var r,i,a=!1,o=!0;for(r=0;rtspan"),h=c[0].length||1;n=s*h,r=u.node()&&m.bBox(u.node()).width;var d=s*(.3+(1-h)/2);u.attr("y",d),c.attr("y",d)}n=Math.max(n,16)+3,i.height=n,i.width=r}function o(t,e,n){var r=t._fullLayout,i=r.legend,a=i.borderwidth,o=b.isGrouped(i);if(b.isVertical(i))o&&e.each(function(t,e){f.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,a,5+a+i.height+n/2),i.height+=n,i.width=Math.max(i.width,r)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),n.each(function(e){var n=e[0],r=u.select(this).select(".legendtoggle");r.call(m.setRect,0,-n.height/2,(t._context.editable?0:i.width)+40,n.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,h=l.length;cr.width-(r.margin.r+r.margin.l)&&(x=0,g+=v,i.height=i.height+v,v=0),f.setTranslate(this,a+x,5+a+e.height/2+g),i.width+=o+n,i.height=Math.max(i.height,e.height),x+=o+n,v=Math.max(e.height,v)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),n.each(function(e){var n=e[0],r=u.select(this).select(".legendtoggle");r.call(m.setRect,0,-n.height/2,t._context.editable?0:i.width,n.height)})}}function s(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center");var i="top";w.isBottomAnchor(n)?i="bottom":w.isMiddleAnchor(n)&&(i="middle"),h.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[i]||0),t:n.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,n=e.legend,r="left";w.isRightAnchor(n)?r="right":w.isCenterAnchor(n)&&(r="center"),h.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),f=t("../../lib"),h=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),m=t("../drawing"),g=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),_=t("./style"),b=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),z.call(m.setRect,N,t,y.scrollBarWidth,y.scrollBarHeight),A.select("rect").attr({y:v.borderwidth-e})}var n=t._fullLayout,a="legend"+n._uid;if(n._infolayer&&t.calcdata){var v=n.legend,b=n.showlegend&&x(t.calcdata,v),M=n.hiddenlabels||[];if(!n.showlegend||!b.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+a).remove(),void h.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=n._topdefs.selectAll("#"+a).data([0]);A.enter().append("clipPath").attr("id",a).append("rect");var S=k.selectAll("rect.bg").data([0]);S.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),S.call(g.stroke,v.bordercolor),S.call(g.fill,v.bgcolor),S.style("stroke-width",v.borderwidth+"px");var T=k.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var z=k.selectAll("rect.scrollbar").data([0]);z.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var E=T.selectAll("g.groups").data(b);E.enter().append("g").attr("class","groups"),E.exit().remove();var L=E.selectAll("g.traces").data(f.identity);L.enter().append("g").attr("class","traces"),L.exit().remove(),L.call(_).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(r,t).call(i,t)});var I=0!==k.enter().size();I&&(o(t,E,L),s(t));var D=0,P=n.width,C=0,O=n.height;o(t,E,L),v.height>O?l(t):s(t);var F=n._size,R=F.l+F.w*v.x,j=F.t+F.h*(1-v.y);w.isRightAnchor(v)?R-=v.width:w.isCenterAnchor(v)&&(R-=v.width/2),w.isBottomAnchor(v)?j-=v.height:w.isMiddleAnchor(v)&&(j-=v.height/2);var N=v.width,B=F.w;N>B?(R=F.l,N=B):(R+N>P&&(R=P-N),RV?(j=F.t,q=V):(j+q>O&&(j=O-q),jn[1])return n[1]}return i}function n(t){return t[0]}var r,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),h=d.hasLines(o);if(s||u||h){var p={},m={};s&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",c.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(m.line={width:e("line.width",n,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[c.minExtend(a,p)],i=c.minExtend(o,m)}var g=l.select(this).select("g.legendpoints"),v=g.selectAll("path.scatterpts").data(s?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,i),s&&(r[0].mrc=3);var y=g.selectAll("g.pointtext").data(u?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,i)}function a(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||r.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(h.fill,t.mc||n.color),e&&i.call(h.stroke,t.mlc||r.color)})}function o(t){var e=t[0].trace,n=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=l.select(this);r.style("stroke-width",n+"px").call(h.fill,t.fc||e.fillcolor),n&&r.call(h.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,n=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),f=t("../drawing"),h=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(r).each(i)}},{"../../lib":316,"../../registry":382,"../../traces/pie/style_one":391,"../../traces/scatter/subtypes":413,"../color":223,"../drawing":246,d3:8}],268:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),i=n.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===r){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,d=(1-c)/2,p=f.list(t,null,!0),m=0;m1)return r(["resetViews","toggleHover"]),o(g,n);c&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),h&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=i(s),y=[];return((u||p)&&!v||m)&&(y=["zoom2d","pan2d"]),(u||m)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!u&&!p||v||m||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):u?r(["hoverClosestCartesian","hoverCompareCartesian"]):d&&r(["hoverClosestPie"]),o(g,n)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var m=i(e,n,l);c("x",m[0]),c("y",m[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",n.font);var g=c("bgcolor");c("activecolor",o.contrast(g,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":316,"../color":223,"./attributes":272,"./button_attributes":273,"./constants":274}],276:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;rp&&(p=h)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,n=i.filterVisible(e.shapes);if(n.length&&t._fullData.length)for(var s=0;se;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,n,r){function i(n){var r={"data-index":e,"fill-rule":"evenodd",d:p(t,E)},i=E.line.width?E.line.color:"rgba(0,0,0,0)",a=n.append("path").attr(r).style("opacity",E.opacity).call(b.stroke,i).call(b.fill,E.fillcolor).call(w.dashLine,E.line.dash,E.line.width);L&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+L),t._context.editable&&f(t,a,E,e)}var a,o;h(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof n&&n?l[n]=r:x.isPlainObject(n)&&(l=n);var u=Object.keys(l);for(a=0;aZ&&r>X&&!t.shiftKey?M.getCursor(i/n,1-a/r):"move";k(e,o),H=o.split("-")[0]}function a(e){N=_.getFromId(t,n.xref),B=_.getFromId(t,n.yref),q=S.getDataToPixel(t,N),V=S.getDataToPixel(t,B,!0),U=S.getPixelToData(t,N),G=S.getPixelToData(t,B,!0);var a="shapes["+r+"]";"path"===n.type?(R=n.path,j=a+".path"):(c=q(n.x0),f=V(n.y0),h=q(n.x1),d=V(n.y1),m=a+".x0",v=a+".y0",x=a+".x1",b=a+".y1"),cX&&(u[E]=n[P]=G(s),u[L]=n[C]=G(l)),f-c>Z&&(u[I]=n[O]=U(c),u[D]=n[F]=U(f))}e.attr("d",p(t,n))}var u,c,f,h,d,m,v,x,b,w,A,T,z,E,L,I,D,P,C,O,F,R,j,N,B,q,V,U,G,H,Z=10,X=10,Y={setCursor:i,element:e.node(),prepFn:a,doneFn:o},W=Y.element.getBoundingClientRect();M.init(Y)}function h(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),r}function d(t,e,n){var r=_.getFromId(t,n.id,"x")._id,i=_.getFromId(t,n.id,"y")._id,a="below"===e.layer,o=r===e.xref||i===e.yref,s=!!n.shapelayer;return a&&o&&s}function p(t,e){var n,r,i,a,o=e.type,s=_.getFromId(t,e.xref),l=_.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=S.shapePositionToRange(s),r=function(t){return s._offset+s.r2p(n(t,!0))}):r=function(t){return u.l+u.w*t},l?(i=S.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(r=S.decodeDate(r)),l&&"date"===l.type&&(a=S.decodeDate(a)),m(e.path,r,a);var c=r(e.x0),f=r(e.x1),h=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+h+"L"+f+","+d;if("rect"===o)return"M"+c+","+h+"H"+f+"V"+d+"H"+c+"Z";var p=(c+f)/2,g=(h+d)/2,v=Math.abs(p-c),y=Math.abs(g-h),x="A"+v+","+y,b=p+v+","+g,w=p+","+(g-y);return"M"+b+x+" 0 1,1 "+w+x+" 0 0,1 "+b+"Z"}function m(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,i=t.charAt(0),a=A.paramIsX[i],o=A.paramIsY[i],s=A.numParams[i],l=t.substr(1).replace(A.paramRE,function(t){return a[r]?t=e(t):o[r]&&(t=n(t)),r++,r>s&&(t="X"),t});return r>s&&(l=l.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),i+l})}function g(t,e,n){return t.replace(A.segmentRE,function(t){var r=0,i=t.charAt(0),a=A.paramIsX[i],o=A.paramIsY[i],s=A.numParams[i],l=t.substr(1).replace(A.paramRE,function(t){return r>=s?t:(a[r]?t=e(t):o[r]&&(t=n(t)),r++,t)});return i+l})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),_=t("../../plots/cartesian/axes"),b=t("../color"),w=t("../drawing"),M=t("../dragelement"),k=t("../../lib/setcursor"),A=t("./constants"),S=t("./helpers"),T=t("./shape_defaults"),z=t("./defaults");e.exports={draw:r,drawOne:i}},{"../../lib":316,"../../lib/setcursor":326,"../../plotly":338,"../../plots/cartesian/axes":343,"../color":223,"../dragelement":244,"../drawing":246,"./constants":286,"./defaults":287,"./helpers":289,"./shape_defaults":291,"fast-isnumeric":12}],289:[function(t,e,n){"use strict";n.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},n.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},n.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},n.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},n.getDataToPixel=function(t,e,r){var i,a=t._fullLayout._size;if(e){var o=n.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=n.decodeDate(i))}else i=r?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},n.getPixelToData=function(t,e,r){var i,a=t._fullLayout._size;if(e){var o=n.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=r?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],290:[function(t,e,n){"use strict";var r=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:r.draw,drawOne:r.drawOne}},{"./attributes":284,"./calc_autorange":285,"./defaults":287,"./draw":288}],291:[function(t,e,n){"use strict";var r=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,n,s,l){function u(n,i){return r.coerce(t,e,a,n,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var f=t.path?"path":"rect",h=u("type",f),d=["x","y"],p=0;p<2;p++){var m=d[p],g={_fullLayout:n},v=i.coerceRef(t,e,g,m,"","paper");if("path"!==h){var y,x,_,b=.25,w=.75;"paper"!==v?(y=i.getFromId(g,v),_=o.rangeToShapePosition(y),x=o.shapePositionToRange(y)):x=_=r.identity;var M=m+"0",k=m+"1",A=t[M],S=t[k];t[M]=x(t[M],!0),t[k]=x(t[k],!0),i.coercePosition(e,g,u,v,M,b),i.coercePosition(e,g,u,v,k,w),e[M]=_(e[M]),e[k]=_(e[k]),t[M]=A,t[k]=S}}return"path"===h?u("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":316,"../../plots/cartesian/axes":343,"./attributes":284,"./helpers":289}],292:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},r,{})},font:a({},r,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":312,"../../plots/animation_attributes":339,"../../plots/font_attributes":363,"../../plots/pad_attributes":373,"./constants":293}],293:[function(t,e,n){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],294:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}var o=i(t,e),l=r("visible",o.length>0);if(l){r("active"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("len"),r("lenmode"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),a.coerceFont(r,"font",n.font);var u=r("currentvalue.visible");u&&(r("currentvalue.xanchor"),r("currentvalue.prefix"),r("currentvalue.suffix"),r("currentvalue.offset"),a.coerceFont(r,"currentvalue.font",e.font)),r("transition.duration"),r("transition.easing"),r("bgcolor"),r("activebgcolor"),r("bordercolor"),r("borderwidth"),r("ticklen"),r("tickwidth"),r("tickcolor"),r("minorticklen")}}function i(t,e){function n(t,e){return a.coerce(r,i,c,t,e)}for(var r,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*E.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+E.stepInset+(t.inputAreaLength-2*E.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-E.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*E.stepInset-2*t.inputAreaStart)))}function x(t,e,n){var r=t.selectAll("rect."+E.railTouchRectClass).data([0]);r.enter().append("rect").classed(E.railTouchRectClass,!0).call(d,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,E.tickOffset+n.ticklen+n.labelHeight)}).call(A.fill,n.bgcolor).attr("opacity",0),k.setTranslate(r,0,n.currentValueTotalHeight)}function _(t,e){var n=t.selectAll("rect."+E.railRectClass).data([0]);n.enter().append("rect").classed(E.railRectClass,!0);var r=e.inputAreaLength-2*E.railInset;n.attr({width:r,height:E.railWidth,rx:E.railRadius,ry:E.railRadius,"shape-rendering":"crispEdges"}).call(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.setTranslate(n,E.railInset,.5*(e.inputAreaWidth-E.railWidth)+e.currentValueTotalHeight)}function b(t){for(var e=t._fullLayout._pushmargin||{},n=Object.keys(e),r=0;r0?[0]:[]);if(s.enter().append("g").classed(E.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&b(t),0!==n.length){var l=s.selectAll("g."+E.groupClassName).data(n,i);l.enter().append("g").classed(E.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,E.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var d={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+d+")")}}}function p(){T=0,z=!0,E=I,M._infolayer.select("."+e).attr({"data-unformatted":E}).text(E).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var m=n.propContainer,g=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},_=n.attributes,b=n.transform,w=n.containerGroup,M=t._fullLayout,k=m.titlefont.family,A=m.titlefont.size,S=m.titlefont.color,T=1,z=!1,E=m.title.trim();""===E&&(T=0),E.match(/Click to enter .+ title/)&&(T=.2,z=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var L=w.selectAll("text").data([0]);L.enter().append("text"),L.text(E).attr("class",e),L.attr({"data-unformatted":E}).call(f);var I="Click to enter "+y+" title";t._context.editable?(E||p(),L.call(c.makeEditable).on("edit",function(e){void 0!==v?a.restyle(t,g,e,v):a.relayout(t,g,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(_).selectAll("tspan.line").attr(_)})):E&&!E.match(/Click to enter .+ title/)||L.remove(),L.classed("js-placeholder",z)}},{"../../lib":316,"../../lib/svg_text_utils":328,"../../plotly":338,"../../plots/plots":374,"../color":223,"../drawing":246,d3:8,"fast-isnumeric":12}],298:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":312,"../../plots/font_attributes":363,"../../plots/pad_attributes":373,"../color/attributes":222}],299:[function(t,e,n){"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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],300:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}var o=i(t,e),l=r("visible",o.length>0);l&&(r("active"),r("direction"),r("type"),r("showactive"),r("x"),r("y"),a.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),r("pad.t"),r("pad.r"),r("pad.b"),r("pad.l"),a.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function i(t,e){function n(t,e){return a.coerce(r,i,c,t,e)}for(var r,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==n.length){var c=u.selectAll("g."+S.headerGroupClassName).data(n,i);c.enter().append("g").classed(S.headerGroupClassName,!0);var f=u.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&f.call(v).attr(S.menuIndexAttrName,"-1"),c.exit().each(function(e){x.select(this).remove(),f.call(v).attr(S.menuIndexAttrName,"-1"),_.autoMargin(t,S.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],305:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],306:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.20.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.update=r.update,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=t("./plot_api/register"),n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.addFrames=r.addFrames,n.deleteFrames=r.deleteFrames,n.animate=r.animate,n.register(t("./traces/scatter")),n.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=t("./snapshot"),n.PlotSchema=t("./plot_api/plot_schema"),n.Queue=t("./lib/queue"),n.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":221,"./components/images":258,"./components/legend":266,"./components/rangeselector":278,"./components/rangeslider":283,"./components/shapes":290,"./components/sliders":296,"./components/updatemenus":302,"./fonts/mathjax_config":307,"./lib/queue":324,"./plot_api/plot_schema":332,"./plot_api/register":333,"./plot_api/set_plot_config":334,"./plot_api/to_image":336,"./plot_api/validate":337,"./plotly":338,"./snapshot":387,"./snapshot/download":384,"./traces/scatter":403,d3:8,"es6-promise":10}],307:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],308:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),r(t)?Number(t):i}},{"../constants/numerical":303,"fast-isnumeric":12}],309:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),r.values.indexOf(t)===-1?e.set(n):e.set(t)}},boolean:{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,i){!r(t)||void 0!==i.min&&ti.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,i){t%1||!r(t)||void 0!==i.min&&ti.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var i="number"==typeof t;r.strict!==!0&&i?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){i(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(a(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n||"string"==typeof t&&!(t.substr(0,r)!==n||!s.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if((r.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,r,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var m=u.length;if(m>3||3!==m&&s[1]||!m)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var g=(new Date).getFullYear();e=((Number(u[0])-g+70)%100+200)%100+g-70}if(!a(e))return l;var v=new Date(0,0,1);if(v.setFullYear(c?e:-e),u.length>1){if(r=Number(u[1])-1,u[1].length>2||!(r>=0&&r<=11))return l;if(v.setMonth(r),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(v.setDate(i),v.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(v.setHours(o),v.getHours()!==o)return l;if(u.length>1)return i=v.getTime(),r=Number(u[1]),2===u[1].length&&r>=0&&r<=59?(i+=f*r,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*h:l)):l}}}return v.getTime()},d=n.MIN_MS=n.dateTime2ms("-9999"),p=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t){return n.dateTime2ms(t)!==l};var m=90*u,g=3*c,v=5*f;n.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var n=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(n),o=e0&&(r.push(i),i=[])}return r.push(i),r},n.makeLine=function(t,e){var n={};return n=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(n.trace=e),n},n.makePolygon=function(t,e){var n={};if(1===t.length)n={type:"Polygon",coordinates:t};else{for(var r=new Array(t.length),i=0;in?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},i.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,n,r){if(r||(r=16),void 0===n&&(n=24),n<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,n))/Math.log(r),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,n/i))/Math.log(r)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,n)?t(e,n,r):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var n,r,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(n=0;n=s&&(i-=s*Math.floor(i/s)),i<0?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[r];c[n]=a}return c},i.syncOrAsync=function(t,e,n){function r(){return i.syncOrAsync(t,e,n)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(r).then(void 0,i.promiseError);return n&&n(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,n){if(t){var r,i,a=!1,o=!0;for(r=0;r1?i+o[1]:"";if(a&&(o.length>1||s.length>4||n))for(;r.test(s);)s=s.replace(r,"$1"+a+"$2");return s+l}},{"./clean_number":308,"./coerce":309,"./dates":310,"./extend":312,"./filter_unique":313,"./filter_visible":314,"./is_array":317,"./is_plain_object":318,"./loggers":319,"./matrix":320,"./nested_property":321,"./notifier":322,"./search":325,"./stats":327,d3:8}],317:[function(t,e,n){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],318:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],319:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(r=t[e],o=!1,h(r))for(n=r.length-1;n>=0;n--)u(r[n])?o?r[n]=void 0:r.pop():o=!0;else if("object"==typeof r&&null!==r)for(a=Object.keys(r),o=!1,n=a.length-1;n>=0;n--)u(r[a[n]])&&!i(r[a[n]],a[n])?delete r[a[n]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function c(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric"),h=t("./is_array");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,i,o,s=0,l=e.split(".");sa||rs)&&(!e||!u(t))}function n(t,e){var n=t[0],l=t[1];if(na||ls)return!1;var u,c,f,h,d,p=r.length,m=r[0][0],g=r[0][1],v=0;for(u=1;uMath.max(c,m)||l>Math.max(f,g)))if(lc||Math.abs(r(o,h))>i)return!0;return!1};i.filter=function(t,e){function n(n){t.push(n);var s=r.length,l=i;r.splice(o+1);for(var u=l+1;u1){var s=t.pop();n(s)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":320}],324:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;ne}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");n.findBin=function(t,e,n){if(s(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,f=0,h=e.length,d=0;for(c=e[e.length-1]>=e[0]?n?r:i:n?o:a;f90&&l.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,i=e[r]-e[0]||1,a=i/(r||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}},n.roundUp=function(t,e,n){for(var r,i=0,a=e.length-1,o=0,s=n?0:1,l=n?1:0,u=n?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":12}],328:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,n){var r="math-output-"+h.randstr([],64),a=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())h.log("There was an error in the tex syntax.",t),n();else{var r=a.select("svg").node().getBoundingClientRect();n(a.select(".MathJax_SVG"),e,r)}a.remove()})}function o(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),i=m[r];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,g.indexOf(c.protocol)===-1?"":''}if("br"===r)return"
";if(a)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))r.push(i);var a=0;r.forEach(function(t){for(var n=t+a,r=e.slice(0,n),i="",o=r.length-1;o>=0;o--){var s=r[o].match(/<(\/?).*>/i);if(s&&"
"!==r[o]){s[1]||(i=r[o]);break}}i&&(e.splice(n+1,0,i),e.splice(n,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,n){var r,i,a,o=n.horizontalAlign,s=n.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-r.height}:"middle"===s?function(){return l.top+(l.height-r.height)/2}:function(){return l.top},a="right"===o?function(){return l.right-r.width}:"center"===o?function(){return l.left+(l.width-r.width)/2}:function(){return l.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(h.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=f.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var m=t.node();m&&m.removeAttribute;m=m.parentNode)m.removeAttribute("data-bb");if(l){var g=h.getPlotDiv(s.node());(g&&g._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return n(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var f=r(l,"width"),h=r(l,"height"),m=+s.attr("x")-f*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],g=parseInt(s.style("font-size"),10)||r(s,"height"),v=-g/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,v-h/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:v-h/2}):"a"===p[0]?l.attr({x:0,y:v}):l.attr({x:m,y:+s.attr("y")+v-h/2}),e&&e.call(s,u),t(u)})}))}else n();return t}};var m={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},g=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function a(){var t=f.select(h.getPlotDiv(o.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:n.fill||o.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||o.attr("data-unformatted")).call(c(o,e,n)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(o.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(o,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target!==t&&void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(o.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),f.select(this).call(c(o,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(i)}n||(n={});var o=this,s=f.dispatch("edit","input","cancel"),l=f.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),n.immediate?r():u.on("click",r),f.rebind(this,s,"on")}},{"../constants/string_mappings":304,"../constants/xmlns_namespaces":305,"../lib":316,d3:8}],329:[function(t,e,n){"use strict";function r(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=f.cleanId(n,r))}function i(t){var e="middle",n="center";return t.indexOf("top")!==-1?e="top":t.indexOf("bottom")!==-1&&(e="bottom"),t.indexOf("left")!==-1?n="left":t.indexOf("right")!==-1&&(n="right"),e+" "+n}function a(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}var o=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),l=t("../registry"),u=t("../lib"),c=t("../plots/plots"),f=t("../plots/cartesian/axes"),h=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},n.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.log("Clearing previous rejected promises from queue."),t._promises=[]},n.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var i=f.list({_fullLayout:t});for(e=0;e3?(g.x=1.02,g.xanchor="left"):g.x<-2&&(g.x=-.02,g.xanchor="right"),g.y>3?(g.y=1.02,g.yanchor="bottom"):g.y<-2&&(g.y=-.02,g.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=c.getSubplotIds(t,"gl3d");for(e=0;e=t.data.length||i<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(i,r+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 "+n+" must be unique.")}}function l(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&s(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,n){var r,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&lI.range[0]?[1,2]:[2,1]);else{var D=I.range[0],P=I.range[1];"log"===_?(D<=0&&P<=0&&n(T+".autorange",!0),D<=0?D=P/1e6:P<=0&&(P=D/1e6),n(T+".range[0]",Math.log(D)/Math.LN10),n(T+".range[1]",Math.log(P)/Math.LN10)):(n(T+".range[0]",Math.pow(10,D)),n(T+".range[1]",Math.pow(10,P)))}else n(T+".autorange",!0)}if("reverse"===A)z.range?z.range.reverse():(n(T+".autorange",!0),z.range=[1,0]),E.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var C=v.parts[1],O=v.parts[0],F=a[O]||[],R=F[C]||{};2===v.parts.length&&(null===_&&(e[g]="remove"),"add"===e[g]||x.isPlainObject(e[g])?m[g]="remove":"remove"===e[g]?C===-1?(m[O]=F,delete m[g]):m[g]=R:x.log("???",e)),!r(R,"x")&&!r(R,"y")||x.containsAny(g,["color","opacity","align","dash"])||(d.docalc=!0);var j=w.getComponentMethod(O,"drawOne");j(t,C,v.parts.slice(2).join("."),e[g]),delete e[g]}else if(M.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])L.manageArrayContainers(v,_,m),d.doplot=!0;else{var N=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?d.doplot=!0:0===v.parts[0].indexOf("geo")?d.doplot=!0:0===v.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===g?d.doplot=!0:!o._has("gl2d")||g.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===g?d.docalc=!0:v.parts[0].indexOf("legend")!==-1?d.dolegend=!0:g.indexOf("title")!==-1?d.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(N,["tick","exponent","grid","zeroline"])?d.doticks=!0:g.indexOf(".linewidth")!==-1&&g.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:v.parts.length>1&&N.indexOf("line")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&"mirror"===N?d.doticks=d.dolayoutstyle=!0:"margin.pad"===g?d.doticks=d.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||g.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(g)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(g)===-1&&(d.doplot=!0):d.doplot=!0,v.set(_)}}}var B=t._fullLayout.width,q=t._fullLayout.height;M.supplyDefaults(t),t.layout.autosize&&M.plotAutoSize(t,t.layout,t._fullLayout);var V=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==q;return V&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:m,redoit:p,eventData:x.extendDeep({},p)}}function m(t){var e=g.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];g.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=x.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(z.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var i=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=i.append("g").classed("imagelayer",!0),n._shapeLowerLayer=i.append("g").classed("shapelayer",!0),n._cartesianlayer=n._paper.append("g").classed("cartesianlayer",!0),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var a=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=a.append("g").classed("imagelayer",!0),n._shapeUpperLayer=a.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var g=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),_=t("../lib/events"),b=t("../lib/queue"),w=t("../registry"),M=t("../plots/plots"),k=t("../plots/cartesian/graph_interact"),A=t("../plots/polar"),S=t("../components/drawing"),T=t("../components/errorbars"),z=t("../constants/xmlns_namespaces"),E=t("../lib/svg_text_utils"),L=t("./helpers"),I=t("./subroutines");y.plot=function(t,e,n,r){function o(){if(b)return y.addFrames(t,b)}function s(){for(var e=D._basePlotModules,n=0;n=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var n=0;return function(){if(t&&++n===e)return t()}}if(t=L.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),n=M.supplyAnimationDefaults(n);var s=n.transition,l=n.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function f(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function m(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var g,v,y=0,_=[],b=void 0===e||null===e,w=Array.isArray(e),k=!b&&!w&&x.isPlainObject(e);if(k)_.push({type:"object",data:m(x.extendFlat({},e))});else if(b||"string"==typeof e)for(g=0;g0&&T<_.length-1){var z=[];for(g=0;g<_.length;g++)v=_[g],("byname"!==_[g].type||g>T)&&z.push(v);_=z}}_.length>0?f(_):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,n){if(t=L.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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 r,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(r=e.length-1;r>=0;r--)c.push({frame:M.supplyFrameDefaults(e[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:u+r});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;r--){if(i=c[r].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;n--)r=e[n],a.push({type:"delete",index:r}),o.unshift({type:"insert",index:r,value:i[r]});var s=M.modifyFrames,l=M.modifyFrames,u=[t,o],c=[t,a];return b&&b.add(t,s,u,l,c),M.modifyFrames(t,a)},y.purge=function(t){t=L.getGraphDiv(t);var e=t._fullLayout||{},n=t._fullData||[];return M.cleanPlot([],{},n,e),M.purge(t),_.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":246,"../components/errorbars":252,"../constants/xmlns_namespaces":305,"../lib":316,"../lib/events":311,"../lib/queue":324,"../lib/svg_text_utils":328,"../plotly":338,"../plots/cartesian/graph_interact":350,"../plots/plots":374,"../plots/polar":377,"../registry":382,"./helpers":329,"./subroutines":335,d3:8,"fast-isnumeric":12}],331:[function(t,e,n){"use strict";function r(t,n){try{t._fullLayout._paper.style("background",n)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:r,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],332:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:y},n={}):(e=h.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,b(r,p),b(r,e.attributes),n.attributes&&b(r,n.attributes),r.type=t;var i={meta:e.meta||{},attributes:o(r)};if(e.layoutAttributes){var a={};b(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return b(t,m),Object.keys(h.subplotsRegistry).forEach(function(e){var n=h.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)c(t,n,"xaxis"),c(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;c(t,n,r)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.layoutAttributes&&(Array.isArray(n.layoutNodes)?n.layoutNodes.forEach(function(e){f(t,n,e+n.name)}):f(t,n,n.name))}),{layoutAttributes:o(t)}}function a(t){var e=h.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function r(t,r,i){n.isValObject(t)?"data_array"===t.valType?(t.role="data",i[r+"src"]=e(r)):t.arrayOk===!0&&(i[r+"src"]=e(r)):d.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function l(t){function e(t,e,n){if(t){var r=t[M];r&&(delete t[M],n[e]={items:{}},n[e].items[r]=t,n[e].role="object")}}n.crawl(t,e)}function u(t){return _(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),_(t,x.layout),t}function c(t,e,n){var r=d.nestedProperty(t,n),i=b({},e.layoutAttributes);i[w]=!0,r.set(i)}function f(t,e,n){var r=d.nestedProperty(t,n),i=b(r.get()||{},e.layoutAttributes);r.set(i)}var h=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),m=t("../plots/layout_attributes"),g=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),_=d.extendFlat,b=d.extendDeep,w="_isSubplotObj",M="_isLinkedToArray",k="_deprecated",A=[w,M,k];n.IS_SUBPLOT_OBJ=w,n.IS_LINKED_TO_ARRAY=M,n.DEPRECATED=k,n.UNDERSCORE_ATTRS=A,n.get=function(){var t={};h.allTypes.concat("area").forEach(function(e){t[e]=r(e)});var e={};return Object.keys(h.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:A.concat.role},traces:t,layout:i(),transforms:e,frames:o(g),animation:o(v)}},n.crawl=function(t,e,r){var i=r||0;Object.keys(t).forEach(function(r){var a=t[r];A.indexOf(r)===-1&&(e(a,r,t,i),n.isValObject(a)||d.isPlainObject(a)&&n.crawl(a,e,i+1))})},n.isValObject=function(t){return t&&void 0!==t.valType},n.findArrayAttributes=function(t){function e(e,n,o,s){a=a.slice(0,s).concat([n]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=r(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function r(t){return t.join(".")}var i=[],a=[];if(n.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};h(e.width)&&h(e.height)||r(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var m=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(m).then(f).then(function(t){n(t)}).catch(function(t){r(t)})});return n}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=r},{"../lib":316,"../plotly":338,"../snapshot/cloneplot":383,"../snapshot/helpers":386,"../snapshot/svgtoimg":388,"../snapshot/tosvg":390,"fast-isnumeric":12}],337:[function(t,e,n){"use strict";function r(t,e,n,i,a,u){u=u||[];for(var c=Object.keys(t),h=0;h1&&l.push(o("object","layout"))),h.supplyDefaults(u);for(var c=u._fullData,g=n.length,v=0;vc&&e10||"01-01"!==r.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=L&&i<=10||e>=15*L)t._tickround="d";else if(e>=D&&i<=16||e>=I)t._tickround="M";else if(e>=P&&i<=19||e>=D)t._tickround="S";else{var a=b.ms2DateTime(n+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(x(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var n=t.match(Y),r=new Date(e);if(n){var i=Math.min(+n[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(Y,a))(r)}return y.time.format(t)(r)}function s(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function l(t,e,n,r){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);n&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(r&&(x(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=V(c):"m"===l?a=U(c):"d"===l?(n||(i="
"+V(c)),a=G(c)):(n||(i="
"+H(c)),a=Z(c),"M"!==l?(a+=X(c),"S"!==l&&(a+=h(y.round(v(s/1e3,1),4),t,"none",n).substr(1))):"d"===u&&(a=G(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,n,r,i){var a=t.dtick,o=e.x;if(!r||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=h(Math.pow(10,o),t,i,r);else if(x(a)||"D"===a.charAt(0)&&v(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=h(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,v(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=h(e.x,t,i,r)}function h(t,e,n,r){var i=t<0,o=e._tickround,s=n||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(r){var f={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(f),o=(Number(f._tickround)||0)+4,l=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+m:"E"===s?t+="E"+m:"power"===s?t+="\xd710"+m+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=W[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var n,r,i=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},C.getAutoRange=function(t){var e,n=[],r=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);if(r===i){var m=r-1,g=r+1;n="tozero"===t.rangemode?r<0?[m,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,m),Math.max(0,g)]:[m,g]}else h&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-h*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),h=(u.val-l.val)/(t._length-l.pad-u.pad)),n=[l.val-h*l.pad,u.val+h*u.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),d&&n.reverse(),n.map(t.l2r||Number)},C.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=C.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},C.saveRangeInitial=function(t,e){for(var n=C.list(t,"",!0),r=!1,i=0;i=h?d=!1:s.val>=u&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:h})}if(r(c)){for(d=!0,o=0;o=c&&s.pad>=f?d=!1:s.val<=c&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var a,o,s,l,u,c,f,h,d,p,m,g=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),_=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),b=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),M=r(n.vpadminus||n.vpad);for(a=0;a<6;a++)i(a);for(a=g-1;a>5;a--)i(a)}},C.autoBin=function(t,e,n,r){function i(t){return(1+100*(t-d)/f.dtick)%100<2}var a=b.aggNums(Math.min,null,t),o=b.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(n)s=(o-a)/n;else{var l=b.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*b.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*b.stdev(t)/Math.pow(t.length,r?.25:.4))}var f;f="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},C.autoTicks(f,s);var h,d=C.tickIncrement(C.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,m=0,g=0,v=0,y=0;y.3*_||i(a)||i(o))){var w=f.dtick/2;d+=d+w0&&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),a(t),t._tmin=C.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=C.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),f=0;fz?(e/=z,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,n,F)):r>E?(e/=E,t.dtick="M"+i(e,1,R)):r>L?(t.dtick=i(e,L,N),t.tick0="2000-01-02"):r>I?t.dtick=i(e,I,R):r>D?t.dtick=i(e,D,j):r>P?t.dtick=i(e,P,j):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,F))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,n,F)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,F));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},C.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var i=e.charAt(0),a=r*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?q:B,l=t+.01*r,u=b.roundUp(v(l,1),s,n);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},C.tickFirst=function(t){var e=t.r2l||Number,n=t.range.map(e),r=n[1]a:f1&&e0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return x=x||r.host&&_.length,x&&!z&&_.unshift(""),_.length?r.pathname=_.join("/"):(r.pathname=null,r.path=null),u.isNull(r.pathname)&&u.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=h.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":501,punycode:446,querystring:450}],501:[function(t,e,r){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],502:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],503:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],504:[function(t,e,r){(function(e,n){function i(t,e){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(e)?n.showHidden=e:e&&r._extend(n,e),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a),l(n,t,n.depth)}function a(t,e){var r=i.styles[e];return r?"\x1b["+i.colors[r][0]+"m"+t+"\x1b["+i.colors[r][1]+"m":t}function o(t,e){return t}function s(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function l(t,e,n){if(t.customInspect&&e&&T(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return x(i)||(i=l(t,i,n)),i}var a=u(t,e);if(a)return a;var o=Object.keys(e),g=s(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),k(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(e);if(0===o.length){if(T(e)){var m=e.name?": "+e.name:"";return t.stylize("[Function"+m+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(A(e))return t.stylize(Date.prototype.toString.call(e),"date");if(k(e))return c(e)}var v="",y=!1,b=["{","}"];if(p(e)&&(y=!0,b=["[","]"]),T(e)){var _=e.name?": "+e.name:"";v=" [Function"+_+"]"}if(w(e)&&(v=" "+RegExp.prototype.toString.call(e)),A(e)&&(v=" "+Date.prototype.toUTCString.call(e)),k(e)&&(v=" "+c(e)),0===o.length&&(!y||0==e.length))return b[0]+v+b[1];if(n<0)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=y?h(t,e,n,g,o):o.map(function(r){return f(t,e,n,g,r,y)}),t.seen.pop(),d(M,v,b)}function u(t,e){if(_(e))return t.stylize("undefined","undefined");if(x(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return y(e)?t.stylize(""+e,"number"):g(e)?t.stylize(""+e,"boolean"):m(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var a=[],o=0,s=e.length;o-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")),_(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.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 d(t,e,r){var n=0,i=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function p(t){return Array.isArray(t)}function g(t){return"boolean"==typeof t}function m(t){return null===t}function v(t){return null==t}function y(t){return"number"==typeof t}function x(t){return"string"==typeof t}function b(t){return"symbol"==typeof t}function _(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===S(t)}function M(t){return"object"==typeof t&&null!==t}function A(t){return M(t)&&"[object Date]"===S(t)}function k(t){return M(t)&&("[object Error]"===S(t)||t instanceof Error)}function T(t){return"function"==typeof t}function E(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function S(t){return Object.prototype.toString.call(t)}function L(t){return t<10?"0"+t.toString(10):t.toString(10)}function z(){var t=new Date,e=[L(t.getHours()),L(t.getMinutes()),L(t.getSeconds())].join(":");return[t.getDate(),O[t.getMonth()],e].join(" ")}function C(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var I=/%[sdj%]/g;r.format=function(t){if(!x(t)){for(var e=[],r=0;r=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}}),s=n[r];r>3}if(i--,1===n||2===n)a+=t.readSVarint(),o+=t.readSVarint(),1===n&&(e&&s.push(e),e=[]),e.push(new l(a,o));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&s.push(e),s},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,u=-(1/0);t.pos>3}if(n--,1===r||2===r)i+=t.readSVarint(),a+=t.readSVarint(),is&&(s=i),au&&(u=a);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,u]},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}var o=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 o(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":507}],509:[function(t,e,r){"use strict";function n(t,e){return"object"==typeof e&&null!==e||(e={}),i(t,e.canvas||a,e.context||o,e)}e.exports=n;var i=t("./lib/vtext"),a=null,o=null;"undefined"!=typeof document&&(a=document.createElement("canvas"),a.width=8192,a.height=1024,o=a.getContext("2d"))},{"./lib/vtext":510}],510:[function(t,e,r){"use strict";function n(t,e,r){for(var n=e.textAlign||"start",i=e.textBaseline||"alphabetic",a=[1<<30,1<<30],o=[0,0],s=t.length,l=0;l8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height>31}function l(t){for(var e=[],r=0,n=0,i=t.length,a=0;a=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function o(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),!(e<0)&&(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof b||a();var s=[],l=[],u=x++;return Object.create(b.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(o)}})};b.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||!!c&&c.has___(t)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof b||a();var l,u=new s,c=void 0,h=!1;return l=o?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new b),c.set(t,e)),this}:function(t,e){if(h)try{u.set(t,e)}catch(r){c||(c=new b),c.set___(t,e)}else u.set(t,e);return this},Object.create(b.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");h=!0})}})}o&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=b.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=b)}}()},{}],515:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":516}],516:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],517:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":515}],518:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":119}],519:[function(t,e,r){var n=arguments[3],i=arguments[4],a=arguments[5],o=JSON.stringify;e.exports=function(t,e){function r(t){m[t]=!0;for(var e in i[t][1]){var n=i[t][1][e];m[n]||r(n)}}for(var s,l=Object.keys(a),u=0,c=l.length;u= 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":91}],523:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":522}],524:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("opacity"),u("align"),u("bgcolor");var h=u("bordercolor"),f=i.opacity(h);u("borderpad");var d=u("borderwidth"),p=u("showarrow");u("text",p?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font);for(var g=["x","y"],m=[-10,-30],v={_fullLayout:r},y=0;y<2;y++){var x=g[y],b=a.coerceRef(t,e,v,x,"","paper");if(a.coercePosition(e,v,u,b,x,.5),p){var _="a"+x,w=a.coerceRef(t,e,v,_,"pixel");"pixel"!==w&&w!==b&&(w=e[_]="pixel");var M="pixel"===w?m[y]:.4;a.coercePosition(e,v,u,w,_,M)}else u(x+"anchor")}return n.noneOrAll(t,e,["x","y"]),p&&(u("arrowcolor",f?e.bordercolor:i.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(f&&d||1)),n.noneOrAll(t,e,["ax","ay"])),e}},{"../../lib":633,"../../plots/cartesian/axes":664,"../color":533,"./attributes":526}],525:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],526:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0},text:{valType:"string"},textangle:{valType:"angle",dflt:0},font:o({},i,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)"},borderpad:{valType:"number",min:0,dflt:1},borderwidth:{valType:"number",min:0,dflt:1},showarrow:{valType:"boolean",dflt:!0},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":626,"../../plots/cartesian/constants":669,"../../plots/font_attributes":684,"./arrow_paths":525}],527:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,u=i-o,c=i+o,h=s-l,f=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;u=Math.max(u,d),c=Math.max(c,d),h=Math.max(h,d),f=Math.max(f,d)}r&&r.autorange&&a.expand(r,[r.l2c(r.r2l(e.x))],{ppadplus:c,ppadminus:u}),n&&n.autorange&&a.expand(n,[n.l2c(n.r2l(e.y))],{ppadplus:f,ppadminus:h})}})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});var l=a.list(t).filter(function(t){return t.autorange&&s[t._id]});if(l.length)return i.syncOrAsync([o,n],t)}}},{"../../lib":633,"../../plots/cartesian/axes":664,"./draw":529}],528:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),i=t("./annotation_defaults");e.exports=function(t,e){var r={name:"annotations",handleItemDefaults:i};n(t,e,r)}},{"../../plots/array_container_defaults":661,"./annotation_defaults":524}],529:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}nt.selectAll("tspan.line").attr({y:0,x:0});var n=K.select(".annotation-math-group"),i=!n.empty(),s=d.bBox((i?n:nt).node()),u=s.width,p=s.height,v=Math.round(u+2*tt),y=Math.round(p+2*tt);H._w=u,H._h=p;var b=!1;if(["x","y"].forEach(function(e){var n,i=H[e+"ref"]||e,a=h.getFromId(t,i),o=(W+("x"===e?0:90))*Math.PI/180,s=v*Math.abs(Math.cos(o))+y*Math.abs(Math.sin(o)),l=H[e+"anchor"];if(a){ var u=a.r2fraction(H[e]);if(!a.autorange&&(u<0||u>1)&&(H["a"+e+"ref"]===i?(u=a.r2fraction(H["a"+e]),(u<0||u>1)&&(b=!0)):b=!0,b))return;Y[e]=a._offset+a.r2p(H[e]),n=.5}else n=H[e],"y"===e&&(n=1-n),Y[e]="x"===e?C.l+C.w*n:C.t+C.h*n;var c=0;H["a"+e+"ref"]===i?Y["aa"+e]=a._offset+a.r2p(H["a"+e]):(c=H.showarrow?H["a"+e]:s*r(n,l),Y[e]+=c),H["_"+e+"type"]=a&&a.type,H["_"+e+"size"]=s,H["_"+e+"shift"]=c}),b)return void K.remove();var _,w;H.showarrow&&(_=H.axref===H.xref?Y.x:c.constrain(Y.x-H.ax,1,A.width-1),w=H.ayref===H.yref?Y.y:c.constrain(Y.y-H.ay,1,A.height-1)),Y.x=c.constrain(Y.x,1,A.width-1),Y.y=c.constrain(Y.y,1,A.height-1);var M=tt-s.top,k=tt-s.left;i?n.select("svg").attr({x:tt-1,y:tt}):(nt.attr({x:k,y:M}),nt.selectAll("tspan.line").attr({y:M,x:k})),et.call(d.setRect,$/2,$/2,v-$,y-$);var T=0,E=0;T=H.axref===H.xref?Math.round(Y.aax-v/2):Math.round(Y.x-v/2),E=H.ayref===H.yref?Math.round(Y.aay-y/2):Math.round(Y.y-y/2),K.call(c.setTranslate,T,E);var S="annotations["+e+"]",L=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i,s;i=H.axref===H.xref?Y.aax+r:Y.x+r,s=H.ayref===H.yref?Y.aay+n:Y.y+n;var u=c.rotationXYMatrix(W,i,s),h=c.apply2DTransform(u),d=c.apply2DTransform2(u),p=et.attr("width")/2,g=et.attr("height")/2,v=[[i-p,s-g,i-p,s+g],[i-p,s+g,i+p,s+g],[i+p,s+g,i+p,s-g],[i+p,s-g,i-p,s-g]].map(d);if(!v.reduce(function(t,e){return t^!!a(_,w,_+1e6,w+1e6,e[0],e[1],e[2],e[3])},!1)){v.forEach(function(t){var e=a(i,s,_,w,t[0],t[1],t[2],t[3]);e&&(i=e.x,s=e.y)});var y=H.arrowwidth,b=H.arrowcolor,M=Z.append("g").style({opacity:f.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),A=M.append("path").attr("d","M"+i+","+s+"L"+_+","+w).style("stroke-width",y+"px").call(f.stroke,f.rgb(b));x(A,H.arrowhead,"end",H.arrowsize);var k=M.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-_)+","+(s-w),transform:"translate("+_+","+w+")"}).style("stroke-width",y+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,E,L;m.init({element:k.node(),prepFn:function(){var t=c.getTranslate(K);E=t.x,L=t.y,T={},G&&G.autorange&&(T[G._name+".autorange"]=!0),X&&X.autorange&&(T[X._name+".autorange"]=!0)},moveFn:function(t,e){M.attr("transform","translate("+t+","+e+")");var r=h(E,L),n=r[0]+t,i=r[1]+e;K.call(c.setTranslate,n,i),T[S+".x"]=G?G.p2r(G.r2p(H.x)+t):(_+t-C.l)/C.w,T[S+".y"]=X?X.p2r(X.r2p(H.y)+e):1-(w+e-C.t)/C.h,H.axref===H.xref&&(T[S+".ax"]=G?G.p2r(G.r2p(H.ax)+t):(_+t-C.l)/C.w),H.ayref===H.yref&&(T[S+".ay"]=X?X.p2r(X.r2p(H.ay)+e):1-(w+e-C.t)/C.h),Q.attr({transform:"rotate("+W+","+n+","+i+")"})},doneFn:function(e){if(e){l.relayout(t,T);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};H.showarrow&&L(0,0);var z=c.rotationXYMatrix(W,Y.x,Y.y),I=c.apply2DTransform(z);if(t._context.editable){var P,D,O;m.init({element:K.node(),prepFn:function(){var t=c.getTranslate(K);P=t.x,D=t.y,O={}},moveFn:function(t,e){K.call(c.setTranslate,P+t,D+e);var r="pointer";if(H.showarrow)H.axref===H.xref?O[S+".ax"]=G.p2r(G.r2p(H.ax)+t):O[S+".ax"]=H.ax+t,H.ayref===H.yref?O[S+".ay"]=X.p2r(X.r2p(H.ay)+e):O[S+".ay"]=H.ay+e,L(t,e);else{if(G)O[S+".x"]=H.x+t/G._m;else{var n=H._xsize/C.w,i=H.x+H._xshift/C.w-n/2;O[S+".x"]=m.align(i+t/C.w,n,0,1,H.xanchor)}if(X)O[S+".y"]=H.y+e/X._m;else{var a=H._ysize/C.h,o=H.y-H._yshift/C.h-a/2;O[S+".y"]=m.align(o-e/C.h,a,0,1,H.yanchor)}G&&X||(r=m.getCursor(G?.5:O[S+".x"],X?.5:O[S+".y"],H.xanchor,H.yanchor))}var s=I(P,D),l=s[0]+t,u=s[1]+e;K.call(c.setTranslate,P+t,D+e),Q.attr({transform:"rotate("+W+","+l+","+u+")"}),g(K,r)},doneFn:function(e){if(g(K),e){l.relayout(t,O);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var w,M=t.layout,A=t._fullLayout;if(!s(e)||e===-1){if(!e&&Array.isArray(u))return M.annotations=u,y(M,A),void n(t);if("remove"===u)return delete M.annotations,A.annotations=[],void n(t);if(r&&"add"!==u){for(w=0;we;w--)A._infolayer.selectAll('.annotation[data-index="'+(w-1)+'"]').attr("data-index",String(w)),i(t,w)}}A._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var T=M.annotations[e],E=A.annotations[e];if(T){var S={};"string"==typeof r&&r?S[r]=u:c.isPlainObject(r)&&(S=r);var L=Object.keys(S);for(w=0;w4/3&&(F=V)}}else R&&(N&&(F<1/3?F+=U:F>2/3&&(F-=U)),F=(F-R.domain[0])/(R.domain[1]-R.domain[0]),F=R.fraction2r(F))}R&&R===O&&j&&("log"===j&&"log"!==R.type?F=Math.pow(10,F):"log"!==j&&"log"===R.type&&(F=F>0?Math.log(F)/Math.LN10:void 0)),T[D]=F}}var H={};v(T,H,A),A.annotations[e]=H;var G=h.getFromId(t,H.xref),X=h.getFromId(t,H.yref),Y={x:0,y:0},W=+H.textangle||0,Z=A._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",H.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:T,fullAnnotation:H})}),Q=Z.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),K=Q.append("g"),$=H.borderwidth,J=H.borderpad,tt=$+J,et=K.append("rect").attr("class","bg").style("stroke-width",$+"px").call(f.stroke,H.bordercolor).call(f.fill,H.bgcolor),rt=H.font,nt=K.append("text").classed("annotation",!0).attr("data-unformatted",H.text).text(H.text);t._context.editable?nt.call(p.makeEditable,K).call(b).on("edit",function(r){H.text=r,this.attr({"data-unformatted":H.text}),this.call(b);var n={};n["annotations["+e+"].text"]=H.text,G&&G.autorange&&(n[G._name+".autorange"]=!0),X&&X.autorange&&(n[X._name+".autorange"]=!0),l.relayout(t,n)}):nt.call(b),Q.attr({transform:"rotate("+W+","+Y.x+","+Y.y+")"}).call(d.setPosition,Y.x,Y.y)}}}function a(t,e,r,n,i,a,o,s){var l=r-t,u=i-t,c=o-i,h=n-e,f=a-e,d=s-a,p=l*d-c*h;if(0===p)return null;var g=(u*d-c*f)/p,m=(u*h-l*f)/p;return m<0||m>1||g<0||g>1?null:{x:t+l*g,y:e+h*g}}var o=t("d3"),s=t("fast-isnumeric"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),h=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./annotation_defaults"),y=t("./defaults"),x=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":633,"../../lib/setcursor":643,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/cartesian/axes":664,"../../plots/plots":724,"../color":533,"../dragelement":554,"../drawing":556,"./annotation_defaults":524,"./defaults":528,"./draw_arrow_head":530,d3:95,"fast-isnumeric":104}],530:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l){i(l)||(l=1);var u=t.node(),c=s[e||0];if(c){"string"==typeof r&&r||(r="end");var h,f,d,p,g=(o.getPx(t,"stroke-width")||1)*l,m=t.style("stroke")||a.defaultLine,v=t.style("stroke-opacity")||1,y=r.indexOf("start")>=0,x=r.indexOf("end")>=0,b=c.backoff*g;if("line"===u.nodeName){if(h={x:+t.attr("x1"),y:+t.attr("y1")},f={x:+t.attr("x2"),y:+t.attr("y2")},d=Math.atan2(h.y-f.y,h.x-f.x),p=d+Math.PI,b){var _=b*Math.cos(d),w=b*Math.sin(d);y&&(h.x-=_,h.y-=w,t.attr({x1:h.x,y1:h.y})),x&&(f.x+=_,f.y+=w,t.attr({x2:f.x,y2:f.y}))}}else if("path"===u.nodeName){var M=u.getTotalLength(),A="";if(y){var k=u.getPointAtLength(0),T=u.getPointAtLength(.1);d=Math.atan2(k.y-T.y,k.x-T.x),h=u.getPointAtLength(Math.min(b,M)),b&&(A="0px,"+b+"px,")}if(x){var E=u.getPointAtLength(M),S=u.getPointAtLength(M-.1);if(p=Math.atan2(E.y-S.y,E.x-S.x),f=u.getPointAtLength(Math.max(0,M-b)),b){var L=A?2*b:b;A+=M-L+"px,"+M+"px"}}else A&&(A+=M+"px");A&&t.style("stroke-dasharray",A)}var z=function(r,i){e>5&&(i=0),n.select(u.parentElement).append("path").attr({class:t.attr("class"),d:c.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+g+")"}).style({fill:m,opacity:v,"stroke-width":0})};y&&z(h,d),x&&z(f,p)}}},{"../color":533,"../drawing":556,"./arrow_paths":525,d3:95,"fast-isnumeric":104}],531:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":526,"./calc_autorange":527,"./defaults":528,"./draw":529}],532:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],533:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults,o.defaultLine=s.defaultLine,o.lightLine=s.lightLine,o.background=s.background,o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||o.background).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r: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 i(s).toRgbString()},o.contrast=function(t,e,r){var n=i(t),a=n.isLight()?n.darken(r):n.lighten(e);return a.toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;es&&(a[1]-=(st-s)/2)):r.node()&&!r.classed("js-placeholder")&&(st=d.bBox(e.node()).height),st){if(st+=5,"top"===_.titleside)J.domain[1]-=st/T.h,a[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var h=at.select(".cbfills").selectAll("rect.cbfill").data(z);h.enter().append("rect").classed("cbfill",!0).style("stroke","none"),h.exit().remove(),h.each(function(t,e){var r=[0===e?S[0]:(z[e]+z[e-1])/2,e===z.length-1?S[1]:(z[e]+z[e+1])/2].map(J.c2p).map(Math.round);e!==z.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=I(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({x:Y,width:Math.max(B,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var f=at.select(".cblines").selectAll("path.cbline").data(_.line.color&&_.line.width?L:[]);return f.enter().append("path").classed("cbline",!0),f.exit().remove(),f.each(function(t){n.select(this).attr("d","M"+Y+","+(Math.round(J.c2p(t))+_.line.width/2%1)+"h"+B).call(d.lineGroupStyle,_.line.width,C(t),_.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=Y+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=J.titlefont.size,r=J._offset+J._length/2,i=T.l+(J.position||0)*T.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));M("h"+J._id+"title",{avoid:{selection:n.select(t).selectAll("g."+J._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:k.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,r){var n,i=b();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:J,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,h(a,r||{}))}function A(){var r=B+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(F=ot.select("text"),F.node()&&!F.classed("js-placeholder")){var n,i=ot.select(".h"+J._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-Y-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-K;at.select(".cbbg").attr({x:Y-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:K-G,width:Math.max(a,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),at.selectAll(".cboutline").attr({x:Y,y:K+_.ypad+("top"===_.titleside?st:0),width:Math.max(B,2),height:Math.max(s-2*_.ypad-st,2)}).call(p.stroke,_.outlinecolor).style({fill:"None","stroke-width":_.outlinewidth});var l=({center:.5,right:1}[_.xanchor]||0)*a;at.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:a*({right:1,center:.5}[_.xanchor]||0),r:a*({left:1,center:.5}[_.xanchor]||0),t:s*({bottom:1,middle:.5}[_.yanchor]||0),b:s*({top:1,middle:.5}[_.yanchor]||0)})}var k=t._fullLayout,T=k._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void k._infolayer.selectAll("g."+e).remove();var E,S=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),L=[],z=[],C="function"==typeof _.line.color?_.line.color:function(){return _.line.color},I="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},P=_.levels.end+_.levels.size/100,D=_.levels.size,O=1.001*S[0]-.001*S[1],R=1.001*S[1]-.001*S[0];for(E=_.levels.start;(E-P)*D<0;E+=D)E>O&&ES[0]&&E1){var it=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=it*c.roundUp(nt/it,[2,5,10]),(Math.abs(_.levels.start)/_.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=et}J.domain=[Z+X,Z+q-X],J.setScale();var at=k._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=n.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+H)*T.w,ct=J.titlefont.size;lt="top"===_.titleside?(1-(Z+q-X))*T.h+T.t+3+.75*ct:(1-(Z+X))*T.h+T.t-3-.25*ct,M(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ht=c.syncOrAsync([o.previousPromises,w,o.previousPromises,A],t);if(ht&&ht.then&&(t._promises||[]).push(ht),t._context.editable){var ft,dt,pt;u.init({element:at.node(),prepFn:function(){ft=at.attr("transform"),f(at)},moveFn:function(t,e){at.attr("transform",ft+" translate("+t+","+e+")"),dt=u.align(W+t/T.w,U,0,1,_.xanchor),pt=u.align(Z-e/T.h,q,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);f(at,r)},doneFn:function(e){f(at),e&&void 0!==dt&&void 0!==pt&&a.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},b().index)}})}return ht}function b(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=f,s.reversescale&&(f=a(f)),s.colorscale=f)}},{"../../lib":633,"./flip_scale":544,"./scales":551}],540:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":626,"./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,u,c){var h=c.prefix,f=c.cLetter,d=h.slice(0,h.length-1),p=h?i.nestedProperty(t,d).get()||{}:t,g=h?i.nestedProperty(e,d).get()||{}:e,m=p[f+"min"],v=p[f+"max"],y=p.colorscale,x=n(m)&&n(v)&&m=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){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):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(Array.isArray(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":633}],554:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&a.plot(t)}var a=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,u=e.clientX,c=e.clientY,d=e.target,h=(new Date).getTime(),h-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),d.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var u,c,h,f,d,p,g=o.getPlotDiv(t.element)||{},m=1,v=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},l.coverSlip=n},{"../../lib":633,"../../plotly":659,"../../plots/cartesian/constants":669,"./align":552,"./cursor":553,"./unhover":555}],555:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":625}],556:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){if(s.traceIs(r,"symbols")){var u=p(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:d.isBubble(r)?u(t.ms):(a.size||6)/2,t.mrc=e;var n=g.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,g.symbolFuncs[i](e)+(n>=200?y:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var c,h,f;t.so?(f=o.outlierwidth,h=o.outliercolor,c=a.outliercolor):(f=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,h="mlc"in t?t.mlcc=i(t.mlc):Array.isArray(o.color)?l.defaultLine:o.color,c="mc"in t?t.mcc=n(t.mc):Array.isArray(a.color)?l.defaultLine:a.color||"rgba(0,0,0,0)"),t.om?e.call(l.stroke,c).style({"stroke-width":(f||1)+"px",fill:"none"}):(e.style("stroke-width",f+"px").call(l.fill,c),f&&e.call(l.stroke,h))}function i(t,e,r,n){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,_/2),c=Math.pow(s*s+l*l,_/2),h=(c*c*i-u*u*s)*n,f=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[a.round(e[0]+(d&&h/d),2),a.round(e[1]+(d&&f/d),2)],[a.round(e[0]-(p&&h/p),2),a.round(e[1]-(p&&f/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../registry"),l=t("../color"),u=t("../colorscale"),c=t("../../lib"),h=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),g=e.exports={};g.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(l.fill,n)},g.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},g.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},g.setRect=function(t,e,r,n,i){t.call(g.setPosition,e,r).call(g.setSize,n,i)},g.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);o(i)&&o(a)?"text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"):e.remove()},g.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,r,n)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},g.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";l.stroke(e,n||a.color),g.dashLine(e,s,o)},g.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=n||i.dash||"";a.select(this).call(l.stroke,r||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(l.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var m=t("./symbol_defs");g.symbolNames=[],g.symbolFuncs=[],g.symbolNeedLines={},g.symbolNoDot={},g.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];g.symbolList=g.symbolList.concat([e.n,t,e.n+100,t+"-open"]),g.symbolNames[e.n]=t,g.symbolFuncs[e.n]=e.f,e.needLine&&(g.symbolNeedLines[e.n]=!0),e.noDot?g.symbolNoDot[e.n]=!0:g.symbolList=g.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var v=g.symbolNames.length,y="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";g.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=g.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=v||t>=400?0:Math.floor(Math.max(t,0))},g.singlePointStyle=function(t,e,r){var i=r.marker,a=i.line,o=g.tryColorscale(i,""),s=g.tryColorscale(i,"line");n(t,e,r,o,s,i,a)},g.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=g.tryColorscale(r,""),i=g.tryColorscale(r,"line");t.each(function(t){g.singlePointStyle(t,a.select(this),e,n,i)})}},g.tryColorscale=function(t,e){var r=e?c.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):c.identity};var x={start:1,end:-1,middle:0,bottom:1,top:-1},b=1.3;g.textPointStyle=function(t,e){t.each(function(t){var r=a.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var i=t.tp||e.textposition,s=i.indexOf("top")!==-1?"top":i.indexOf("bottom")!==-1?"bottom":"middle",l=i.indexOf("left")!==-1?"end":i.indexOf("right")!==-1?"start":"middle",u=t.ts||e.textfont.size,c=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(h.convertToTspans);var f=a.select(this.parentNode),d=r.selectAll("tspan.line"),p=((d[0].length||1)-1)*b+1,m=x[l]*c,v=.75*u+x[s]*c+(x[s]-1)*p*u/2;f.attr("transform","translate("+m+","+v+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var _=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=k&&(a.selectAll("[data-bb]").attr("data-bb",null),A=[]),t.setAttribute("data-bb",A.length),A.push(l),c.extendFlat({},l)},g.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=a.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":618,"../../lib":633,"../../lib/svg_text_utils":647,"../../registry":739,"../../traces/scatter/make_bubble_size_func":861,"../../traces/scatter/subtypes":866,"../color":533,"../colorscale":547,"./symbol_defs":557,d3:95,"fast-isnumeric":104}],557:[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),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2),o=n.round(.809*t,2);return"M"+e+","+a+"L"+r+","+o+"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(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),h=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+h+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),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},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:95}],558:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],559:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(a),h=0;h0;t.each(function(t){var e,h=t[0].trace,f=h.error_x||{},d=h.error_y||{};h.ids&&(e=function(t){return t.id});var p=o.hasMarkers(h)&&h.marker.maxdisplayed>0;if(d.visible||f.visible){var g=i.select(this).selectAll("g.errorbar").data(t,e);g.exit().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),g.each(function(t){var e=i.select(this),o=n(t,l,u);if(!p||t.vis){var h;if(d.visible&&a(o.x)&&a(o.yh)&&a(o.ys)){var g=d.width;h="M"+(o.x-g)+","+o.yh+"h"+2*g+"m-"+g+",0V"+o.ys,o.noYS||(h+="m-"+g+",0h"+2*g);var m=e.select("path.yerror");s=!m.size(),s?m=e.append("path").classed("yerror",!0):c&&(m=m.transition().duration(r.duration).ease(r.easing)),m.attr("d",h)}if(f.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var v=(f.copy_ystyle?d:f).width;h="M"+o.xh+","+(o.y-v)+"v"+2*v+"m0,-"+v+"H"+o.xs,o.noXS||(h+="m0,-"+v+"v"+2*v);var y=e.select("path.xerror");s=!y.size(),s?y=e.append("path").classed("xerror",!0):c&&(y=y.transition().duration(r.duration).ease(r.easing)),y.attr("d",h)}}})}})}},{"../../traces/scatter/subtypes":866,d3:95,"fast-isnumeric":104}],564:[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":533,d3:95}],565:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0},source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"any",dflt:0},y:{valType:"any",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":669}],566:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}var o=n("source"),l=n("visible",!!o);if(!l)return e;n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var u={_fullLayout:r},c=["x","y"],h=0;h<2;h++)a.coerceRef(t,e,u,c[h],"paper");return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes"),l="images";e.exports=function(t,e){var r={name:l,handleItemDefaults:n};o(t,e,r)}},{"../../lib":633,"../../plots/array_container_defaults":661,"../../plots/cartesian/axes":664,"./attributes":565}],567:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var t=document.createElement("canvas");t.width=this.width,t.height=this.height;var e=t.getContext("2d");e.drawImage(this,0,0);var n=t.toDataURL("image/png");r.attr("xlink:href",n)},r.on("error",n),r.on("load",t),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),u=s._size,c=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*u.w,h=l?Math.abs(l.l2p(e.sizey)-l.l2p(0)):e.sizey*u.h,f=c*d.x[e.xanchor].offset,p=h*d.y[e.yanchor].offset,g=d.x[e.xanchor].sizing+d.y[e.yanchor].sizing,m=(o?o.r2p(e.x)+o._offset:e.x*u.w+u.l)+f,v=(l?l.r2p(e.y)+l._offset:u.h-e.y*u.h+u.t)+p;switch(e.sizing){case"fill":g+=" slice";break;case"stretch":g="none"}r.attr({x:m,y:v,width:c,height:h,preserveAspectRatio:g,opacity:e.opacity});var y=o?o._id:"",x=l?l._id:"",b=y+x;b&&r.call(i.setClipUrl,"clip"+s._uid+b)}for(var s=t._fullLayout,l=[],u=[],c=[],h=0;h=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}},{}],570:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:a({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":626,"../../plots/font_attributes":684,"../color/attributes":532}],571:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],572:[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){function l(t,e){return i.coerce(d,p,a,t,e)}for(var u,c,h,f,d=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1);if(x!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(u=0,h="left",c=1.1,f="bottom"):(u=0,h="left",c=-.1,f="top")}l("traceorder",m),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",h),l("y",c),l("yanchor",f),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":633,"../../plots/layout_attributes":715,"../../registry":739,"./attributes":570,"./helpers":575}],573:[function(t,e,r){"use strict";function n(t,e){function r(r){v.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(a,e)})}var n=t.data()[0][0],i=e._fullLayout,o=n.trace,s=d.traceIs(o,"pie"),l=o.index,u=s?n.label:o.name,h=t.selectAll("text.legendtext").data([0]);h.enter().append("text").classed("legendtext",!0),h.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?h.call(v.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(a.type)!==-1){var o=n.trace.transforms,s=o[o.length-1].direction;i=s+".legenditem.name"}else i="name";c.restyle(e,i,t,l)}):h.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,a=t.data()[0][0],o=e._fullData,s=a.trace,l=s.legendgroup,u=[];if(d.traceIs(s,"pie")){var h=a.label,f=r.indexOf(h);f===-1?r.push(h):r.splice(f,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var p=0;ptspan"),f=c[0].length||1;r=s*f,n=u.node()&&g.bBox(u.node()).width;var d=s*(.3+(1-f)/2);u.attr("y",d),c.attr("y",d)}r=Math.max(r,16)+3,i.height=r,i.width=n}function o(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=_.isGrouped(i);if(_.isVertical(i))o&&e.each(function(t,e){h.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;h.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,(t._context.editable?0:i.width)+40,r.height)});else if(o){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,f=l.length;cn.width-(n.margin.r+n.margin.l)&&(x=0,m+=v,i.height=i.height+v,v=0),h.setTranslate(this,a+x,5+a+e.height/2+m),i.width+=o+r,i.height=Math.max(i.height,e.height),x+=o+r,v=Math.max(e.height,v)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),f.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),f.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),h=t("../../lib"),f=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(h.setTranslate,0,e),S.call(g.setRect,N,t,y.scrollBarWidth,y.scrollBarHeight),k.select("rect").attr({y:v.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var v=r.legend,_=r.showlegend&&x(t.calcdata,v),M=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void f.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var T=A.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var E=A.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var S=A.selectAll("rect.scrollbar").data([0]);S.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var L=E.selectAll("g.groups").data(_);L.enter().append("g").attr("class","groups"),L.exit().remove();var z=L.selectAll("g.traces").data(h.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var C=0!==A.enter().size();C&&(o(t,L,z),s(t));var I=0,P=r.width,D=0,O=r.height;o(t,L,z),v.height>O?l(t):s(t);var R=r._size,F=R.l+R.w*v.x,j=R.t+R.h*(1-v.y);w.isRightAnchor(v)?F-=v.width:w.isCenterAnchor(v)&&(F-=v.width/2),w.isBottomAnchor(v)?j-=v.height:w.isMiddleAnchor(v)&&(j-=v.height/2);var N=v.width,B=R.w;N>B?(F=R.l,N=B):(F+N>P&&(F=P-N),FV?(j=R.t,U=V):(j+U>O&&(j=O-U),jr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),f=d.hasLines(o);if(s||u||f){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),f&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var m=l.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(s?n:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(h.pointStyle,i),s&&(n[0].mrc=3);var y=m.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(h.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(f.fill,t.mc||r.color),e&&i.call(f.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(f.fill,t.fc||e.fillcolor),r&&n.call(f.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),h=t("../drawing"),f=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":633,"../../registry":739,"../../traces/pie/style_one":840,"../../traces/scatter/subtypes":866,"../color":533,"../drawing":556,d3:95}],578:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,f=(1+c)/2,d=(1-c)/2,p=h.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(m,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=i(s),y=[];return((u||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||v||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(m,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var m=c("bgcolor");c("activecolor",o.contrast(m,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":633,"../color":533,"./attributes":582,"./button_attributes":583,"./constants":584}],586:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=f)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)f(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,L)},i=L.line.width?L.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",L.opacity).call(_.stroke,i).call(_.fill,L.fillcolor).call(w.dashLine,L.line.dash,L.line.width);z&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&h(t,a,L,e)}var a,o;f(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:x.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>Y&&!t.shiftKey?M.getCursor(i/r,1-a/n):"move";A(e,o),G=o.split("-")[0]}function a(e){N=b.getFromId(t,r.xref),B=b.getFromId(t,r.yref),U=T.getDataToPixel(t,N),V=T.getDataToPixel(t,B,!0),q=T.getPixelToData(t,N),H=T.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(F=r.path,j=a+".path"):(c=U(r.x0),h=V(r.y0),f=U(r.x1),d=V(r.y1),g=a+".x0",v=a+".y0",x=a+".x1",_=a+".y1"),cY&&(u[L]=r[P]=H(s),u[z]=r[D]=H(l)),h-c>X&&(u[C]=r[O]=q(c),u[I]=r[R]=q(h))}e.attr("d",p(t,r))}var u,c,h,f,d,g,v,x,_,w,k,E,S,L,z,C,I,P,D,O,R,F,j,N,B,U,V,q,H,G,X=10,Y=10,W={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=W.element.getBoundingClientRect();M.init(W)}function f(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=b.getFromId(t,r.id,"x")._id,i=b.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=b.getFromId(t,e.xref),l=b.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),h=n(e.x1),f=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+f+"L"+h+","+d;if("rect"===o)return"M"+c+","+f+"H"+h+"V"+d+"H"+c+"Z";var p=(c+h)/2,m=(f+d)/2,v=Math.abs(p-c),y=Math.abs(m-f),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),i+l})}function m(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),M=t("../dragelement"),A=t("../../lib/setcursor"),k=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),S=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":633,"../../lib/setcursor":643,"../../plotly":659,"../../plots/cartesian/axes":664,"../color":533,"../dragelement":554,"../drawing":556,"./constants":596,"./defaults":597,"./helpers":599,"./shape_defaults":601,"fast-isnumeric":104}],599:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],600:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":594,"./calc_autorange":595,"./defaults":597,"./draw":598}],601:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var h=t.path?"path":"rect",f=u("type",h),d=["x","y"],p=0;p<2;p++){var g=d[p],m={_fullLayout:r},v=i.coerceRef(t,e,m,g,"","paper");if("path"!==f){var y,x,b,_=.25,w=.75;"paper"!==v?(y=i.getFromId(m,v),b=o.rangeToShapePosition(y),x=o.shapePositionToRange(y)):x=b=n.identity;var M=g+"0",A=g+"1",k=t[M],T=t[A];t[M]=x(t[M],!0),t[A]=x(t[A],!0),i.coercePosition(e,m,u,v,M,_),i.coercePosition(e,m,u,v,A,w),e[M]=b(e[M]),e[A]=b(e[A]),t[M]=k,t[A]=T}}return"path"===f?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":633,"../../plots/cartesian/axes":664,"./attributes":594,"./helpers":599}],602:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":626,"../../plots/animation_attributes":660,"../../plots/font_attributes":684,"../../plots/pad_attributes":723,"./constants":603}],603:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],604:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*L.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+L.stepInset+(t.inputAreaLength-2*L.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-L.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*L.stepInset-2*t.inputAreaStart)))}function x(t,e,r){var n=t.selectAll("rect."+L.railTouchRectClass).data([0]);n.enter().append("rect").classed(L.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,L.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),A.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+L.railRectClass).data([0]);r.enter().append("rect").classed(L.railRectClass,!0);var n=e.inputAreaLength-2*L.railInset;r.attr({width:n,height:L.railWidth,rx:L.railRadius,ry:L.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(r,L.railInset,.5*(e.inputAreaWidth-L.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(L.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+L.groupClassName).data(r,i);l.enter().append("g").classed(L.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,L.autoMarginIdRoot+e._index)});for(var u=0;u0||f<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,S=!0,L=C,M._infolayer.select("."+e).attr({"data-unformatted":L}).text(L).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var g=r.propContainer,m=r.propName,v=r.traceIndex,y=r.dfltName,x=r.avoid||{},b=r.attributes,_=r.transform,w=r.containerGroup,M=t._fullLayout,A=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,S=!1,L=g.title.trim(); -""===L&&(E=0),L.match(/Click to enter .+ title/)&&(E=.2,S=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(L).attr("class",e),z.attr({"data-unformatted":L}).call(h);var C="Click to enter "+y+" title";t._context.editable?(L||p(),z.call(c.makeEditable).on("edit",function(e){void 0!==v?a.restyle(t,m,e,v):a.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):L&&!L.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",S)}},{"../../lib":633,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/plots":724,"../color":533,"../drawing":556,d3:95,"fast-isnumeric":104}],608:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":626,"../../plots/font_attributes":684,"../../plots/pad_attributes":723,"../color/attributes":532}],609:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],610:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var h=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);h.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&h.call(v).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){x.select(this).remove(),h.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],618:[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}},{}],619:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":531,"./components/images":568,"./components/legend":576,"./components/rangeselector":588,"./components/rangeslider":593,"./components/shapes":600,"./components/sliders":606,"./components/updatemenus":612,"./fonts/mathjax_config":620,"./lib/queue":641,"./plot_api/plot_schema":653,"./plot_api/register":654,"./plot_api/set_plot_config":655,"./plot_api/to_image":657,"./plot_api/validate":658,"./plotly":659,"./snapshot":744,"./snapshot/download":741,"./traces/scatter":856,d3:95,"es6-promise":101}],620:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],621:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],622:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":616,"fast-isnumeric":104}],623:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var m=(new Date).getFullYear();e=((Number(u[0])-m+70)%100+200)%100+m-70}if(!a(e))return l;var v=new Date(0,0,1);if(v.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(v.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(v.setDate(i),v.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(v.setHours(o),v.getHours()!==o)return l;if(u.length>1)return i=v.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=h*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*f:l)):l}}}return v.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,m=3*c,v=5*h;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e0&&(n.push(i),i=[])}return n.push(i),n},r.makeLine=function(t,e){var r={};return r=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(r.trace=e),r},r.makePolygon=function(t,e){var r={};if(1===t.length)r={type:"Polygon",coordinates:t};else{for(var n=new Array(t.length),i=0;i",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":622, -"./coerce":623,"./dates":624,"./extend":626,"./filter_unique":627,"./filter_visible":628,"./is_array":634,"./is_plain_object":635,"./loggers":636,"./matrix":637,"./nested_property":638,"./notifier":639,"./search":642,"./stats":645,d3:95}],634:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],635:[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}},{}],636:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,f(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(f(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric"),f=t("./is_array");e.exports=function(t,e){if(h(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,h,f,d,p=n.length,g=n[0][0],m=n[0][1],v=0;for(u=1;uMath.max(c,g)||l>Math.max(h,m)))if(lc||Math.abs(n(o,f))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":637}],641:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,h=0,f=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;h90&&l.log("Long binary search..."),h-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":104}],646:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:33,tinycolor2:489}],647:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+f.randstr([],64),a=h.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=h.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())f.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,m.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var h=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var h=t("d3"),f=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");h.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(f.log(r.querySelector("parsererror div").textContent),null):h.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=h.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=h.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var m=f.getPlotDiv(s.node());(m&&m._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var h=n(l,"width"),f=n(l,"height"),g=+s.attr("x")-h*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],m=parseInt(s.style("font-size"),10)||n(s,"height"),v=-m/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-h/2,v-f/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:v-f/2}):"a"===p[0]?l.attr({x:0,y:v}):l.attr({x:g,y:+s.attr("y")+v-f/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(v," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=h.select(f.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=h.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;h.select(this).transition().duration(0).remove(),h.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;h.select(document).on("mouseup",function(){return h.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===h.event.which?(o.style({opacity:1}),h.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),h.select(this).call(c(o,e,r)))}).on("keydown",function(){13===h.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=h.dispatch("edit","input","cancel"),l=h.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),h.rebind(this,s,"on")}},{"../constants/string_mappings":617,"../constants/xmlns_namespaces":618,"../lib":633,d3:95}],648:[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":686,"topojson-client":491}],649:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0&&u.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);var i=h.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lC.range[0]?[1,2]:[2,1]);else{var I=C.range[0],P=C.range[1];"log"===b?(I<=0&&P<=0&&r(E+".autorange",!0),I<=0?I=P/1e6:P<=0&&(P=I/1e6),r(E+".range[0]",Math.log(I)/Math.LN10),r(E+".range[1]",Math.log(P)/Math.LN10)):(r(E+".range[0]",Math.pow(10,I)),r(E+".range[1]",Math.pow(10,P)))}else r(E+".autorange",!0)}if("reverse"===k)S.range?S.range.reverse():(r(E+".autorange",!0),S.range=[1,0]),L.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var D=v.parts[1],O=v.parts[0],R=a[O]||[],F=R[D]||{};2===v.parts.length&&(null===b&&(e[m]="remove"),"add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?D===-1?(g[O]=R,delete g[m]):g[m]=F:x.log("???",e)),!n(F,"x")&&!n(F,"y")||x.containsAny(m,["color","opacity","align","dash"])||(d.docalc=!0);var j=w.getComponentMethod(O,"drawOne");j(t,D,v.parts.slice(2).join("."),e[m]),delete e[m]}else if(M.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])z.manageArrayContainers(v,b,g),d.doplot=!0;else{var N=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?d.doplot=!0:0===v.parts[0].indexOf("geo")?d.doplot=!0:0===v.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===m?d.doplot=!0:!o._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?d.docalc=!0:v.parts[0].indexOf("legend")!==-1?d.dolegend=!0:m.indexOf("title")!==-1?d.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(N,["tick","exponent","grid","zeroline"])?d.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:v.parts.length>1&&N.indexOf("line")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&"mirror"===N?d.doticks=d.dolayoutstyle=!0:"margin.pad"===m?d.doticks=d.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(d.doplot=!0):d.doplot=!0,v.set(b)}}}var B=t._fullLayout.width,U=t._fullLayout.height;M.supplyDefaults(t),t.layout.autosize&&M.plotAutoSize(t,t.layout,t._fullLayout);var V=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==U;return V&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];m.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=x.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(S.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),M=t("../plots/plots"),A=t("../plots/cartesian/graph_interact"),k=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),S=t("../constants/xmlns_namespaces"),L=t("../lib/svg_text_utils"),z=t("./helpers"),C=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=I._basePlotModules,r=0;r=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=z.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=M.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function h(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function g(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var m,v,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),A=!_&&!w&&x.isPlainObject(e);if(A)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&EE)&&S.push(v);b=S}}b.length>0?h(b):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=z.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:M.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=M.modifyFrames,l=M.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),M.modifyFrames(t,a)},y.purge=function(t){t=z.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return M.cleanPlot([],{},r,e),M.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":556,"../components/errorbars":562,"../constants/xmlns_namespaces":618,"../lib":633,"../lib/events":625,"../lib/queue":641,"../lib/svg_text_utils":647,"../plotly":659,"../plots/cartesian/graph_interact":671,"../plots/plots":724,"../plots/polar":727,"../registry":739,"./helpers":650,"./subroutines":656,d3:95,"fast-isnumeric":104}],652:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],653:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=f.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};_(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return _(t,g),Object.keys(f.subplotsRegistry).forEach(function(e){var r=f.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)c(t,r,"xaxis"),c(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;c(t,r,n)}}),t=u(t),Object.keys(f.componentsRegistry).forEach(function(e){var r=f.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){h(t,r,e+r.name)}):h(t,r,r.name))}),{layoutAttributes:o(t)}}function a(t){var e=f.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):t.arrayOk===!0&&(i[n+"src"]=e(n)):d.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function l(t){function e(t,e,r){if(t){var n=t[M];n&&(delete t[M],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function c(t,e,r){var n=d.nestedProperty(t,r),i=_({},e.layoutAttributes);i[w]=!0,n.set(i)}function h(t,e,r){var n=d.nestedProperty(t,r),i=_(n.get()||{},e.layoutAttributes);n.set(i)}var f=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=d.extendFlat,_=d.extendDeep,w="_isSubplotObj",M="_isLinkedToArray",A="_deprecated",k=[w,M,A];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=M,r.DEPRECATED=A,r.UNDERSCORE_ATTRS=k,r.get=function(){var t={};f.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(f.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:k.concat.role},traces:t,layout:i(),transforms:e,frames:o(m),animation:o(v)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];k.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||d.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){a=a.slice(0,s).concat([r]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=n(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};f(e.width)&&f(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(h).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":633,"../plotly":659,"../snapshot/cloneplot":740,"../snapshot/helpers":743,"../snapshot/svgtoimg":745,"../snapshot/tosvg":747,"fast-isnumeric":104}],658:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),f=0;f1&&l.push(o("object","layout"))),f.supplyDefaults(u);for(var c=u._fullData,m=r.length,v=0;vc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=z&&i<=10||e>=15*z)t._tickround="d";else if(e>=I&&i<=16||e>=C)t._tickround="M";else if(e>=P&&i<=19||e>=I)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(x(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(W),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(W,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(x(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=V(c):"m"===l?a=q(c):"d"===l?(r||(i="
"+V(c)),a=H(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=Y(c),"S"!==l&&(a+=f(y.round(v(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=H(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=f(Math.pow(10,o),t,i,n);else if(x(a)||"D"===a.charAt(0)&&v(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=f(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,v(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function h(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=f(e.x,t,i,n)}function f(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var h={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(h),o=(Number(h._tickround)||0)+4,l=h._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},D.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&h/c>f&&(l=o,u=s,f=h/c);if(n===i){var g=n-1,m=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else f&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-f*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),f=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-f*l.pad,u.val+f*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r.map(t.l2r||Number)},D.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=D.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},D.saveRangeInitial=function(t,e){for(var r=D.list(t,"",!0),n=!1,i=0;i=f?d=!1:s.val>=u&&s.pad<=f&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:f})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=h?d=!1:s.val<=c&&s.pad<=h&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:h})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,h,f,d,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=m-1;a>5;a--)i(a)}},D.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/h.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var h;h="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},D.autoTicks(h,s);var f,d=D.tickIncrement(D.tickFirst(h),h.dtick,"reverse");if("number"==typeof h.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||i(a)||i(o))){var w=h.dtick/2;d+=d+w0&&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),a(t),t._tmin=D.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=D.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),h=0;hS?(e/=S,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,R)):n>L?(e/=L,t.dtick="M"+i(e,1,F)):n>z?(t.dtick=i(e,z,N),t.tick0="2000-01-02"):n>C?t.dtick=i(e,C,F):n>I?t.dtick=i(e,I,j):n>P?t.dtick=i(e,P,j):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,R))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,R)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,R));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},D.tickIncrement=function(t,e,r){var n=r?-1:1;if(x(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?U:B,l=t+.01*n,u=_.roundUp(v(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},D.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]a:h1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],666:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),h=[],f=0;f0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],669:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],670:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),h=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,r,s,_,w,M,A){function k(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+mt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+mt+")").attr("d","M0,0Z"),S()}function S(){pt.selectAll(".select-outline").remove()}function L(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(q,e+at)),i=Math.max(0,Math.min(H,r+ot)),a=Math.abs(n-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,X)/2);st.l=Math.min(at,n),st.r=Math.max(at,n),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!J||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function z(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),b=!1)))}function I(e,r){var i=1===(M+A).length;if(e)F();else if(2!==r||i){if(1===r&&i){var a=M?V[0]:U[0],o="s"===M||"w"===A?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",h="middle";if(a.fixedrange)return;M?(h="n"===M?"top":"bottom","right"===a.side&&(c="right")):"e"===A&&(c="right"),rt.call(f.makeEditable,null,{immediate:!0,background:N.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:h}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&u.relayout(t,s,r)})}}else R()}function P(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||N._enablescrollzoom){if(t._transitioningWithDuration)return h.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void h.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=vt[0]+vt[2]*l,c=(s.bottom-e.clientY)/s.height,f=vt[1]+vt[3]*(1-c);if(A){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,r){for(var n,a,o=1-e,s=0;s0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nW.width||Y<0||Y>W.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:A[0]._length/2,Y="ypx"in e?e.ypx:k[0]._length/2;if(C="xval"in e?n(a,e.xval):i(A,X),I="yval"in e?n(a,e.yval):i(k,Y),!g(C[0])||!g(I[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(D=0;D1||R.hoverinfo.indexOf("name")!==-1?R.name:void 0,index:!1,distance:Math.min(Z,M.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[F]&&(V.subplot=o[F]._subplot),q=H.length,"array"===N){var Q=e[D];"pointNumber"in Q?(V.index=Q.pointNumber,N="closest"):(N="","xval"in Q&&(B=Q.xval,N="x"),"yval"in Q&&(U=Q.yval,N=N?"closest":"y"))}else B=C[j],U=I[j];if(R._module&&R._module.hoverPoints){var K=R._module.hoverPoints(V,B,U,N);if(K)for(var $,J=0;Jq&&(H.splice(0,q),Z=H[0].distance)}if(0===H.length)return _.unhoverRaw(t,e);var tt="y"===z&&G.length>1;H.sort(function(t,e){return t.distance-e.distance});var et=x.combine(o.plot_bgcolor||x.background,o.paper_bgcolor),rt={hovermode:z,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(H,rt);c(H,tt?"xa":"ya"),h(nt,tt);var it=t._hoverdata,at=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):k&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var h=e.select("text.nums").style("fill",u).call(b.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);h.selectAll("tspan.line").call(b.setPosition,0,0);var f=e.select("text.name"),m=0;r&&r!==n?(f.style("fill",l).text(r).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),f.selectAll("tspan.line").call(b.setPosition,0,0),m=f.node().getBoundingClientRect().width+2*P):(f.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var v,M,T=h.node().getBoundingClientRect(),S=t.xa._offset+(t.x0+t.x1)/2,L=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),C=Math.abs(t.y1-t.y0),D=T.width+I+P+m;t.ty0=_-T.top,t.bx=T.width+2*P,t.by=T.height+2*P,t.anchor="start",t.txwidth=T.width,t.tx2width=m,t.offset=0,a?(t.pos=S,v=L+C/2+D<=A,M=L-C/2-D>=0,"top"!==t.idealAlign&&v||!M?v?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")):(t.pos=L,v=S+z/2+D<=w,M=S-z/2-D>=0,"left"!==t.idealAlign&&v||!M?v?(S+=z/2,t.anchor="start"):t.anchor="middle":(S-=z/2,t.anchor="end")),h.attr("text-anchor",t.anchor),m&&f.attr("text-anchor",t.anchor),e.attr("transform","translate("+S+","+L+")"+(a?"rotate("+E+")":""))}),L}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,h=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?L:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(f.push.apply(f,d),h.splice(o+1,1),u=0,s=f.length-1;s>=0;s--)u+=f[s].dp;for(a=u/f.length,s=f.length-1;s>=0;s--)f[s].dp-=a;n=!1}else o++}h.forEach(r)}for(o=h.length-1;o>=0;o--){var m=h[o];for(s=m.length-1;s>=0;s--){var v=m[s],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function h(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(I+P),s=o+a*(t.txwidth+P),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-C,l=t.offset*z),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*I+l)+","+(I+u)+"v"+(t.by/2-I)+"h"+n*t.bx+"v-"+t.by+"H"+(n*I+l)+"V"+(u-I)+"Z"),i.call(b.setPosition,o+l,u+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(b.setPosition,s+a*P+l,u+t.ty0-t.by/2+P),r.select("rect").call(b.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function f(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),A=t("./dragbox"),k=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){function n(r,n){return m.coerce(t,e,k,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=T.isHoriz(r);i=a?"y":"x"}else i="closest"; -n("hovermode",i)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+M.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexh[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":633,"fast-isnumeric":104}],677:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,h){function f(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,m=i.element.getBoundingClientRect(),v=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,x=e-m.left,b=r-m.top,_=x,w=b,M="M"+x+","+b,A=i.xaxes[0]._length,k=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),S=i.xaxes.concat(i.yaxes);"lasso"===h&&(p=l([[x,b]],s.BENDPX));var L=g.selectAll("path.select-outline").data([1,2]);L.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",M+"Z");var z,C,I,P,D,O=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),R=[],F=i.gd,j=[];for(z=0;z0)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*h*Math.abs(n-i))}return l}function r(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var h=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?r:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,o=t[e],l=(t._id||"x").charAt(0);if(n="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,n=n.slice(),!o||2!==o.length)return void(t[e]=n);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),r=0;r<2;r++)if("date"===t.type){if(!a.isDateTime(o[r])){t[e]=n;break}if(o[r]a.MAX_MS&&(o[r]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[r])){if(!i(o[1-r])){t[e]=n;break}o[r]=o[1-r]*(r?10:.1)}if(o[r]<-s?o[r]=-s:o[r]>s&&(o[r]=s),o[0]===o[1]){var h=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=h,o[1]+=h}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?l:r},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var h=c.charAt(0),f=c.substr(1);f=n(f)?Number(f):0,(f<=0||!("date"===o&&"M"===h&&f===Math.round(f)||"log"===o&&"L"===h||"log"===o&&"D"===h&&(1===f||2===f)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],682:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(t){var e,r,n,i,a,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,x.push(s),o[s]=a}return o}function h(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=l.yaxis._id,h=l.xaxis.range,f=l.yaxis.range;l.xaxis._r=l.xaxis.range.slice(),l.yaxis._r=l.yaxis.range.slice(),i=r[u]?r[u].to:h,a=r[c]?r[c].to:f,h[0]===i[0]&&h[1]===i[1]&&f[0]===a[0]&&f[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function f(e,r){function n(e,r){for(i=0;ir.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=c(e),_=Object.keys(b),w=h(y,_,b);if(!w.length)return!1;var M;u&&(M=u());var A,k,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),A=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":633,"../../plotly":659,"../../registry":739,"./axes":664,d3:95}],683:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],h=0;hi},M.render=function(){function t(t){var e=r.projection(t.lonlat);return e?"translate("+e[0]+","+e[1]+")":null}function e(t){return r.isLonLatOverEdges(t.lonlat)?"0":"1.0"}var r=this,n=r.framework,i=n.select("g.choroplethlayer"),a=n.select("g.scattergeolayer"),o=r.path;n.selectAll("path.basepath").attr("d",o),n.selectAll("path.graticulepath").attr("d",o),i.selectAll("path.choroplethlocation").attr("d",o),i.selectAll("path.basepath").attr("d",o),a.selectAll("path.js-line").attr("d",o),null!==r.clipAngle?(a.selectAll("path.point").style("opacity",e).attr("transform",t),a.selectAll("text").style("opacity",e).attr("transform",t)):(a.selectAll("path.point").attr("transform",t),a.selectAll("text").attr("transform",t))}},{"../../components/color":533,"../../components/drawing":556,"../../constants/xmlns_namespaces":618,"../../lib/topojson_utils":648,"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"./constants":686,"./projections":694,"./set_scale":695,"./zoom":696,"./zoom_reset":697,d3:95,"topojson-client":491}],688:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;nn^d>n&&r<(f-u)*(n-c)/(d-c)+u&&(i=!i)}return i}function o(t){return t?t/Math.sin(t):1}function s(t){return t>1?I:t<-1?-I:Math.asin(t)}function l(t){return t>1?0:t<-1?C:Math.acos(t)}function u(t,e){var r=(2+I)*Math.sin(e);e/=2;for(var n=0,i=1/0;n<10&&Math.abs(i)>L;n++){var a=Math.cos(e);e-=i=(e+Math.sin(e)*(a+2)-r)/(2*a*(1+a))}return[2/Math.sqrt(C*(4+C))*t*(1+Math.cos(e)),2*Math.sqrt(C/(4+C))*Math.sin(e)]}function c(t,e){function r(r,n){var i=F(r/e,n);return i[0]*=t,i}return arguments.length<2&&(e=t),1===e?F:e===1/0?f:(r.invert=function(r,n){var i=F.invert(r/t,n);return i[0]*=e,i},r)}function h(){var t=2,e=R(c),r=e(t);return r.coefficient=function(r){return arguments.length?e(t=+r):t},r}function f(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function d(t,e){return[3*t/(2*C)*Math.sqrt(C*C/3-e*e),e]}function p(t,e){return[t,1.25*Math.log(Math.tan(C/4+.4*e))]}function g(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)>L&&--i>0);return e/2}}function m(t,e,r){function n(r,n){return[t*r*Math.cos(n=i(n)),e*Math.sin(n)]}var i=g(r);return n.invert=function(n,i){var a=s(i/e);return[n/(t*Math.cos(a)),s((2*a+Math.sin(2*a))/r)]},n}function v(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(-.013791+n*(.003971*r-.001529*n))),e*(1.007226+r*(.015085+n*(-.044475+.028874*r-.005916*n)))]}function y(t,e){var r,n=Math.min(18,36*Math.abs(e)/C),i=Math.floor(n),a=n-i,o=(r=N[i])[0],s=r[1],l=(r=N[++i])[0],u=r[1],c=(r=N[Math.min(19,++i)])[0],h=r[1];return[t*(l+a*(c-o)/2+a*a*(c-2*l+o)/2),(e>0?I:-I)*(u+a*(h-s)/2+a*a*(h-2*u+s)/2)]}function x(t,e){return[t*Math.cos(e),e]}function b(t,e){var r=Math.cos(e),n=o(l(r*Math.cos(t/=2)));return[2*r*Math.sin(t)*n,Math.sin(e)*n]}function _(t,e){var r=b(t,e);return[(r[0]+t/I)/2,(r[1]+e)/2]}t.geo.project=function(t,e){var n=e.stream;if(!n)throw new Error("not yet supported");return(t&&w.hasOwnProperty(t.type)?w[t.type]:r)(t,n)};var w={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,r)})}}},M=[],A=[],k={point:function(t,e){M.push([t,e])},result:function(){var t=M.length?M.length<2?{type:"Point",coordinates:M[0]}:{type:"MultiPoint",coordinates:M}:null;return M=[],t}},T={lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){M.length&&(A.push(M),M=[])},result:function(){var t=A.length?A.length<2?{type:"LineString",coordinates:A[0]}:{type:"MultiLineString",coordinates:A}:null;return A=[],t}},E={polygonStart:n,lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){var t=M.length;if(t){do M.push(M[0].slice());while(++t<4);A.push(M),M=[]}},polygonEnd:n,result:function(){if(!A.length)return null;var t=[],e=[];return A.forEach(function(r){i(r)?t.push([r]):e.push(r)}),e.forEach(function(e){var r=e[0];t.some(function(t){if(a(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}},S={Point:k,MultiPoint:k,LineString:T,MultiLineString:T,Polygon:E,MultiPolygon:E,Sphere:E},L=1e-6,z=L*L,C=Math.PI,I=C/2,P=(Math.sqrt(C),C/180),D=180/C,O=t.geo.projection,R=t.geo.projectionMutator;t.geo.interrupt=function(e){function r(t,r){for(var n=r<0?-1:1,i=l[+(r<0)],a=0,o=i.length-1;ai[a][2][0];++a);var s=e(t-i[a][1][0],r);return s[0]+=e(i[a][1][0],n*r>n*i[a][0][1]?i[a][0][1]:r)[0],s}function n(){s=l.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]]})})}function i(){for(var e=1e-6,r=[],n=0,i=l[0].length;n=0;--n){var o=l[1][n],s=180*o[0][0]/C,u=180*o[0][1]/C,c=180*o[1][1]/C,h=180*o[2][0]/C,f=180*o[2][1]/C;r.push(a([[h-e,f-e],[h-e,c+e],[s+e,c+e],[s+e,u-e]],30))}return{type:"Polygon",coordinates:[t.merge(r)]}}function a(t,e){for(var r,n,i,a=-1,o=t.length,s=t[0],l=[];++aL&&--i>0);return[t/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]},(t.geo.naturalEarth=function(){return O(v)}).raw=v;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}),y.invert=function(t,e){var r=e/I,n=90*r,i=Math.min(18,Math.abs(n/5)),a=Math.max(0,Math.floor(i));do{var o=N[a][1],s=N[a+1][1],l=N[Math.min(19,a+2)][1],u=l-o,c=l-2*s+o,h=2*(Math.abs(r)-s)/u,f=c/u,d=h*(1-f*h*(1-2*f*h));if(d>=0||1===a){n=(e>=0?5:-5)*(d+i);var p,g=50;do i=Math.min(18,Math.abs(n)/5),a=Math.floor(i),d=i-a,o=N[a][1],s=N[a+1][1],l=N[Math.min(19,a+2)][1],n-=(p=(e>=0?I:-I)*(s+d*(l-o)/2+d*d*(l-2*s+o)/2)-e)*D;while(Math.abs(p)>z&&--g>0);break}}while(--a>=0);var m=N[a][0],v=N[a+1][0],y=N[Math.min(19,a+2)][0];return[t/(v+d*(y-m)/2+d*d*(y-2*v+m)/2),n*P]},(t.geo.robinson=function(){return O(y)}).raw=y,x.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return O(x)}).raw=x,b.invert=function(t,e){if(!(t*t+4*e*e>C*C+L)){var r=t,n=e,i=25;do{var a,o=Math.sin(r),s=Math.sin(r/2),u=Math.cos(r/2),c=Math.sin(n),h=Math.cos(n),f=Math.sin(2*n),d=c*c,p=h*h,g=s*s,m=1-p*u*u,v=m?l(h*u)*Math.sqrt(a=1/m):a=0,y=2*v*h*s-t,x=v*c-e,b=a*(p*g+v*h*u*d),_=a*(.5*o*f-2*v*c*s),w=.25*a*(f*s-v*c*p*o),M=a*(d*u+v*g*h),A=_*w-M*b;if(!A)break;var k=(x*_-y*M)/A,T=(y*w-x*b)/A;r-=k,n-=T}while((Math.abs(k)>L||Math.abs(T)>L)&&--i>0);return[r,n]}},(t.geo.aitoff=function(){return O(b)}).raw=b,_.invert=function(t,e){var r=t,n=e,i=25;do{var a,o=Math.cos(n),s=Math.sin(n),u=Math.sin(2*n),c=s*s,h=o*o,f=Math.sin(r),d=Math.cos(r/2),p=Math.sin(r/2),g=p*p,m=1-h*d*d,v=m?l(o*d)*Math.sqrt(a=1/m):a=0,y=.5*(2*v*o*p+r/I)-t,x=.5*(v*s+n)-e,b=.5*a*(h*g+v*o*d*c)+.5/I,_=a*(f*u/4-v*s*p),w=.125*a*(u*p-v*s*h*f),M=.5*a*(c*d+v*g*o)+.5,A=_*w-M*b,k=(x*_-y*M)/A,T=(y*w-x*b)/A;r-=k,n-=T}while((Math.abs(k)>L||Math.abs(T)>L)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return O(_)}).raw=_}e.exports=n},{}],695:[function(t,e,r){"use strict";function n(t,e){var r=t.projection,n=t.lonaxis,o=t.lataxis,l=t.domain,u=t.framewidth||0,c=e.w*(l.x[1]-l.x[0]),h=e.h*(l.y[1]-l.y[0]),f=n.range[0]+s,d=n.range[1]-s,p=o.range[0]+s,g=o.range[1]-s,m=n._fullRange[0]+s,v=n._fullRange[1]-s,y=o._fullRange[0]+s,x=o._fullRange[1]-s;r._translate0=[e.l+c/2,e.t+h/2];var b=d-f,_=g-p,w=[f+b/2,p+_/2],M=r._rotate;r._center=[w[0]+M[0],w[1]+M[1]];var A=function(e){function n(t){return Math.min(_*c/(t[1][0]-t[0][0]),_*h/(t[1][1]-t[0][1]))}var o,s,l,b,_=e.scale(),w=r._translate0,M=i(f,p,d,g),A=i(m,y,v,x);l=a(e,M),o=n(l),b=a(e,A),r._fullScale=n(b),e.scale(o),l=a(e,M),s=[w[0]-l[0][0]+u,w[1]-l[0][1]+u],r._translate=s,e.translate(s),l=a(e,M),t._isAlbersUsa||e.clipExtent(l),o=r.scale*o,r._scale=o,t._width=Math.round(l[1][0])+u,t._height=Math.round(l[1][1])+u,t._marginX=(c-Math.round(l[1][0]))/2,t._marginY=(h-Math.round(l[1][1]))/2};return A}function i(t,e,r,n){var i=(r-t)/4;return{type:"Polygon",coordinates:[[[t,e],[t,n],[t+i,n],[t+2*i,n],[t+3*i,n],[r,n],[r,e],[r-i,e],[r-2*i,e],[r-3*i,e],[t,e]]]}}function a(t,e){return o.geo.path().projection(t).bounds(e)}var o=t("d3"),s=t("./constants").clipPad;e.exports=n},{"./constants":686,d3:95}],696:[function(t,e,r){"use strict";function n(t,e){var r;return(r=e._isScoped?a:e._clipAngle?s:o)(t,e.projection)}function i(t,e){var r=e._fullScale;return _.behavior.zoom().translate(t.translate()).scale(t.scale()).scaleExtent([.5*r,100*r])}function a(t,e){function r(){_.select(this).style(A)}function n(){o.scale(_.event.scale).translate(_.event.translate),t.render()}function a(){_.select(this).style(k)}var o=t.projection,s=i(o,e);return s.on("zoomstart",r).on("zoom",n).on("zoomend",a),s}function o(t,e){function r(t){return m.invert(t)}function n(t){var e=m(r(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function a(){_.select(this).style(A),l=_.mouse(this),u=m.rotate(),c=m.translate(),h=u,f=r(l)}function o(){return d=_.mouse(this),n(l)?(v.scale(m.scale()),void v.translate(m.translate())):(m.scale(_.event.scale),m.translate([c[0],_.event.translate[1]]),f?r(d)&&(g=r(d),p=[h[0]+(g[0]-f[0]),u[1],u[2]],m.rotate(p),h=p):(l=d,f=r(l)),void t.render())}function s(){_.select(this).style(k)}var l,u,c,h,f,d,p,g,m=t.projection,v=i(m,e),y=2;return v.on("zoomstart",a).on("zoom",o).on("zoomend",s),v}function s(t,e){function r(t){v++||t({type:"zoomstart"})}function n(t){t({type:"zoom"})}function a(t){--v||t({type:"zoomend"})}var o,s=t.projection,d={r:s.rotate(),k:s.scale()},p=i(s,e),g=b(p,"zoomstart","zoom","zoomend"),v=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(A);var t=_.mouse(this),e=s.rotate(),i=e,a=s.translate(),v=u(e);o=l(s,t),y.call(p,"zoom",function(){var r=_.mouse(this);if(s.scale(d.k=_.event.scale),o){if(l(s,r)){s.rotate(e).translate(a);var u=l(s,r),p=h(o,u),y=m(c(v,p)),x=d.r=f(y,o,i);isFinite(x[0])&&isFinite(x[1])&&isFinite(x[2])||(x=i),s.rotate(x),i=x}}else t=r,o=l(s,t);n(g.of(this,arguments))}),r(g.of(this,arguments))}).on("zoomend",function(){_.select(this).style(k),y.call(p,"zoom",null),a(g.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,g,"on")}function l(t,e){var r=t.invert(e);return r&&isFinite(r[0])&&isFinite(r[1])&&v(r)}function u(t){var e=.5*t[0]*w,r=.5*t[1]*w,n=.5*t[2]*w,i=Math.sin(e),a=Math.cos(e),o=Math.sin(r),s=Math.cos(r),l=Math.sin(n),u=Math.cos(n);return[a*s*u+i*o*l,i*s*u-a*o*l,a*o*u+i*s*l,a*s*l-i*o*u]}function c(t,e){var r=t[0],n=t[1],i=t[2],a=t[3],o=e[0],s=e[1],l=e[2],u=e[3];return[r*o-n*s-i*l-a*u,r*s+n*o+i*u-a*l,r*l-n*u+i*o+a*s,r*u+n*l-i*s+a*o]}function h(t,e){if(t&&e){var r=x(t,e),n=Math.sqrt(y(r,r)),i=.5*Math.acos(Math.max(-1,Math.min(1,y(t,e)))),a=Math.sin(i)/n;return n&&[Math.cos(i),r[2]*a,-r[1]*a,r[0]*a]}}function f(t,e,r){var n=g(e,2,t[0]);n=g(n,1,t[1]),n=g(n,0,t[2]-r[2]);var i,a,o=e[0],s=e[1],l=e[2],u=n[0],c=n[1],h=n[2],f=Math.atan2(s,o)*M,p=Math.sqrt(o*o+s*s);Math.abs(c)>p?(a=(c>0?90:-90)-f,i=0):(a=Math.asin(c/p)*M-f,i=Math.sqrt(p*p-c*c));var m=180-a-2*f,v=(Math.atan2(h,u)-Math.atan2(l,i))*M,y=(Math.atan2(h,u)-Math.atan2(l,-i))*M,x=d(r[0],r[1],a,v),b=d(r[0],r[1],m,y);return x<=b?[a,v,r[2]]:[m,y,r[2]]}function d(t,e,r,n){var i=p(r-t),a=p(n-e);return Math.sqrt(i*i+a*a)}function p(t){return(t%360+540)%360-180}function g(t,e,r){var n=r*w,i=t.slice(),a=0===e?1:0,o=2===e?1:2,s=Math.cos(n),l=Math.sin(n);return i[a]=t[a]*s-t[o]*l,i[o]=t[o]*s+t[a]*l,i}function m(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*M,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*M,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*M]}function v(t){var e=t[0]*w,r=t[1]*w,n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function y(t,e){for(var r=0,n=0,i=t.length;nh[d+2]&&(h[d]=-1,h[d+2]=1),f=this[v[d]],f._length=o.viewBox[d+2]-o.viewBox[d],s.doAutoRange(f);o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},y.calcDataBox=function(){var t=this.xaxis,e=this.yaxis,r=t.range,n=e.range,i=t.r2l,a=e.r2l;return[i(r[0]),a(n[0]),i(r[1]),a(n[1])]},y.setRanges=function(t){var e=this.xaxis,r=this.yaxis,n=e.l2r,i=r.l2r;e.range=[n(t[0]),n(t[2])],r.range=[i(t[1]),i(t[3])]},y.updateTraces=function(t,e){var r,n,i,a=Object.keys(this.traces);this.fullData=t;t:for(r=0;rMath.abs(e))n.rotate(o,0,0,-t*r*Math.PI*f.rotateSpeed/window.innerWidth);else{var s=-f.zoomSpeed*a*e/window.innerHeight*(o-n.lastT())/100;n.pan(o,0,0,u*(Math.exp(s)-1))}},!0),f}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":27,"mouse-change":413,"mouse-wheel":415,"right-now":459}],703:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<3;++r){var n=s[r];e[n]._gd=t}}var i=t("./scene"),a=t("../plots"),o=t("../../constants/xmlns_namespaces"),s=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,o=a.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var s=0;sf[1][o]?d[o]=1:f[1][o]===f[0][o]?d[o]=1:d[o]=1/(f[1][o]-f[0][o]);for(this.dataScale=d,a=0;ag[1][a])g[0][a]=-1,g[1][a]=1;else{var b=g[1][a]-g[0][a];g[0][a]-=b/32,g[1][a]+=b/32}}else{var w=c[T[a]].range;g[0][a]=w[0],g[1][a]=w[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]*d[a],this.glplot.bounds[1][a]=g[1][a]*d[a]}var M=[1,1,1];for(a=0;a<3;++a){l=c[T[a]],u=l.type;var A=y[u];M[a]=Math.pow(A.acc,1/A.count)/d[a]}var k,E=4;if("auto"===c.aspectmode)k=Math.max.apply(null,M)/Math.min.apply(null,M)<=E?M:[1,1,1];else if("cube"===c.aspectmode)k=[1,1,1];else if("data"===c.aspectmode)k=M;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var S=c.aspectratio;k=[S.x,S.y,S.z]}c.aspectratio.x=h.aspectratio.x=k[0],c.aspectratio.y=h.aspectratio.y=k[1],c.aspectratio.z=h.aspectratio.z=k[2],this.glplot.aspect=k;var L=c.domain||null,z=e._size||null;if(L&&z){var C=this.container.style;C.position="absolute",C.left=z.l+L.x[0]*z.w+"px",C.top=z.t+(1-L.y[1])*z.h+"px",C.width=z.w*(L.x[1]-L.x[0])+"px",C.height=z.h*(L.y[1]-L.y[0])+"px"}this.glplot.redraw()}},k.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},k.setCameraToDefault=function(){this.setCamera({eye:{x:1.25,y:1.25,z:1.25},center:{x:0,y:0,z:0},up:{x:0,y:0,z:1}})},k.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},k.setCamera=function(t){var e={};e[this.id]=t,this.glplot.camera.lookAt.apply(this,l(t)),this.graphDiv.emit("plotly_relayout",e)},k.saveCamera=function(t){function e(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]]}var r=this.getCamera(),n=p.nestedProperty(t,this.id+".camera"),i=n.get(),a=!1;if(void 0===i)a=!0;else for(var o=0;o<3;o++)for(var s=0;s<3;s++)if(!e(r,i,o,s)){a=!0;break}return a&&n.set(r),a},k.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},k.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(c),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var a=0,o=n-1;a0}function a(t){var e={},r={};switch(t.type){case"circle":s.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":s.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":s.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var n=t.symbol,i=l(n.textposition,n.iconsize);s.extendFlat(e,{"icon-image":n.icon+"-15","icon-size":n.iconsize/10,"text-field":n.text,"text-size":n.textfont.size,"text-anchor":i.anchor,"text-offset":i.offset}),s.extendFlat(r,{"icon-color":t.color,"text-color":n.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:r}}function o(t){var e,r=t.sourcetype,n=t.source,i={type:r},a="string"==typeof n;return"geojson"===r?e="data":"vector"===r&&(e=a?"url":"tiles"),i[e]=n,i}var s=t("../../lib"),l=t("./convert_text_opts"),u=n.prototype;u.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)&&this.updateLayer(t):(this.updateSource(t),this.updateLayer(t)),this.updateStyle(t),this.visible=i(t)},u.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},u.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},u.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,i(t)){var r=o(t);e.addSource(this.idSource,r)}},u.updateLayer=function(t){var e=this.map;if(e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,i(t)){e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type},t.below);var r={visibility:"visible"};this.mapbox.setOptions(this.idLayer,"setLayoutProperty",r)}},u.updateStyle=function(t){var e=a(t);i(t)&&(this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint))},u.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)},e.exports=function(t,e,r){var i=new n(t,e);return i.update(r),i}},{"../../lib":633,"./convert_text_opts":717}],720:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color").defaultLine,a=t("../font_attributes"),o=t("../../traces/scatter/attributes").textposition;e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},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:n.extendDeep({},a,{family:{dflt:"Open Sans Regular, Arial Unicode MS Regular"}}),textposition:n.extendFlat({},o,{arrayOk:!1})}}}},{"../../components/color":533,"../../lib":633,"../../traces/scatter/attributes":846,"../font_attributes":684}],721:[function(t,e,r){"use strict";function n(t,e,r){r("accesstoken"),r("style"),r("center.lon"),r("center.lat"),r("zoom"),r("bearing"),r("pitch"),i(t,e),e._input=t}function i(t,e){function r(t,e){return a.coerce(n,i,s.layers,t,e)}for(var n,i,o=t.layers||[],l=e.layers=[],u=0;u=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"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,h=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=h)}else{p.supplyLayoutGlobalDefaults(a,n);var f=!a.width||!a.height,d=n.autosize,g=t._context&&t._context.autosizable,m=f&&(d||g);m?p.plotAutoSize(t,a,n):f&&p.sanitizeMargins(t),!d&&f&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,n),n._has=p._hasPlotType.bind(n);var v=n._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),h=c.left+c.right,d=c.bottom+c.top,g=1-2*o,m=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(m.width-h)),i=Math.round(g*(m.height-d))}else{var v=l?window.getComputedStyle(t):{};n=parseFloat(v.width)||r.width,i=parseFloat(v.height)||r.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-i)>1;(_||b)&&(b&&(r.width=n),_&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a;c.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(i=0;i.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t); -}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,h=r.size,f=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(h)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(h*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(h-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var m=l[t].t.val,v=l[t].t.size;if(m>f){var y=(d*m+(v-e.height)*f)/(m-f),x=(v*(1-f)+(d-e.height)*(1-m))/(m-f);y>=0&&x>=0&&y+x>s+o&&(s=y,o=x)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):f.isJSDate(t)?f.ms2DateTime(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)},p.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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,L=S?h.angularAxis.domain:n.extent(A),z=Math.abs(A[1]-A[0]);T&&!k&&(z=0);var C=L.slice();E&&k&&(C[1]+=z);var I=h.angularAxis.ticksCount||4;I>8&&(I=I/(I/8)+I%8),h.angularAxis.ticksStep&&(I=(C[1]-C[0])/I);var P=h.angularAxis.ticksStep||(C[1]-C[0])/(I*(h.minorTicks+1));M&&(P=Math.max(Math.round(P),1)),C[2]||(C[2]=P);var D=n.range.apply(this,C);if(D=D.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]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?z:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var O="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",R=(new DOMParser).parseFromString(O,"application/xml"),F=this.appendChild(this.ownerDocument.importNode(R.documentElement,!0));e=n.select(F)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var j,N=e.select(".chart-group"),B={fill:"none",stroke:h.tickColor},U={"font-size":h.font.size,"font-family":h.font.family,fill:h.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+h.font.outlineColor}).join(",")};if(h.showLegend){j=e.select(".legend-group").attr({transform:"translate("+[x,h.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:j,elements:V,reverseOrder:h.legend.reverseOrder})})();var q=j.node().getBBox();x=Math.min(h.width-q.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,x=Math.max(10,x),_=[h.margin.left+x,h.margin.top+x],i.range([0,x]),c.layout.radialAxis.domain=i.domain(),j.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else j=e.select(".legend-group").style({display:"none"});e.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),N.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(h.width-(h.margin.left+h.margin.right+2*x+(q?q.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*x))/2];if(H[0]=Math.max(0,H[0]),H[1]=Math.max(0,H[1]),e.select(".outer-group").attr("transform","translate("+H+")"),h.title){var G=e.select("g.title-group text").style(U).text(h.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-x-20})}var Y=e.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(i.ticks(5));W.enter().append("circle").attr({class:"grid-circle"}).style(B),W.attr("r",i),W.exit().remove()}Y.select("circle.outside-circle").attr({r:x}).style(B);var Z=e.select("circle.background-circle").attr({r:x}).style({fill:h.backgroundColor,stroke:h.stroke});if(h.radialAxis.visible){var Q=n.svg.axis().scale(i).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+h.radialAxis.orientation+")"}),Y.selectAll(".domain").style(B),Y.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===h.radialAxis.tickOrientation?"rotate("+-h.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var K=e.select(".angular.axis-group").selectAll("g.angular-tick").data(D),$=K.enter().append("g").classed("angular-tick",!0);K.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),K.exit().remove(),$.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(h.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(h.minorTicks+1)==0)}).style(B),$.selectAll(".minor").style({stroke:h.minorTickColor}),K.select("line.grid-line").attr({x1:h.tickLength?x-h.tickLength:0,x2:x}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(U);var J=K.select("text.axis-text").attr({x:x+h.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=x+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?"":M?M[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(U);h.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(N.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[x+tt,h.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=h.orientation,r.direction=h.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!k){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});N.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;ot=s.invert(n);var i=o.util.convertToCartesian(x+12,r+180);ct.text(o.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});N.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=i.invert(o.util.getMousePos(Z).radius);var n=o.util.convertToCartesian(r,h.radialAxis.orientation);ht.text(o.util.round(st)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ft.hide(),ct.hide(),ht.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var i=n.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(u.t=M[t[0]]);var c="t: "+u.t+", r: "+u.r,h=this.getBoundingClientRect(),f=e.node().getBoundingClientRect(),d=[h.left+h.width/2-H[0]-f.left,h.top+h.height/2-H[1]-f.top];ft.config({color:s}).text(c),ft.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&ft.show())}).on("mouseout.tooltip",function(t,e){ft.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")})})}),f}var e,r,i,s,l={data:[],layout:{}},u={},c={},h=n.dispatch("hover"),f={};return f.render=function(e){return t(e),this},f.config=function(t){if(!arguments.length)return l;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},f.getLiveConfig=function(){return c},f.getinputConfig=function(){return u},f.radialScale=function(t){return i},f.angularScale=function(t){return s},f.svg=function(){return e},n.rebind(f,h,"on"),f},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,i=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return i},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("undefined"==typeof 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 r===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=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 s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:f(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return m.stroke(r,i,a)},"stroke-width":function(t,e){return m["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](r,i,a)},opacity:function(t,e){return m.opacity(r,i,a)},display:function(t,e){return m.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});h.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var m={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},v=n.select(this).selectAll("g.layer").data(l);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(m).each(h[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],i=n.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=n.merge(i);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,h=c?r.height:u*o.length,f=s.classed("legend-group",!0),d=f.selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:h+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(o.length),m=n.scale[c?"linear":"ordinal"]().domain(g).range(l),v=n.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,h]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(c){var x=d.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}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var b=d.select(".legend-marks").selectAll("path.legend-mark").data(o);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[u/2,v(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=n.svg.axis().scale(v).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var n=t.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",h=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(h);var f=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=d.width+2*f+l,m=d.height+2*f;return r.attr({d:"M"+[[l,-m/2],[l,-m/4],[i.hasTick?0:l,0],[l,m/4],[l,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-m/2+2*f]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId, -e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=i.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],h={};n.entries(s.margin).forEach(function(t,e){h[c[u.indexOf(t.key)]]=t.value}),s.margin=h}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../lib":633,d3:95}],729:[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,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(h=i),n.select(n.select(h).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(r),a.config(c).render(h),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,i,a,c,h,f=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){f.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){f.undo()},e.redo=function(){f.redo()},e},u.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":533,"../../lib":633,"./micropolar":728,"./undo_manager":730,d3:95}],730:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n=o&&(d.min=0,p.min=0,g.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var i=t("../../../components/color"),a=t("../../subplot_defaults"),o=t("./layout_attributes"),s=t("./axis_defaults"),l=["aaxis","baxis","caxis"];e.exports=function(t,e,r){a(t,e,r,{type:"ternary",attributes:o,handleDefaults:n,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":533,"../../subplot_defaults":731,"./axis_defaults":735,"./layout_attributes":737}],737:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:i,baxis:i,caxis:i}},{"../../../components/color/attributes":532,"./axis_attributes":734}],738:[function(t,e,r){"use strict";function n(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework()}function i(t){a.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var a=t("d3"),o=t("tinycolor2"),s=t("../../plotly"),l=t("../../lib"),u=t("../../components/color"),c=t("../../components/drawing"),h=t("../cartesian/set_convert"),f=t("../../lib/extend").extendFlat,d=t("../cartesian/axes"),p=t("../../components/dragelement"),g=t("../../components/titles"),m=t("../cartesian/select"),v=t("../cartesian/constants"),y=t("../cartesian/graph_interact");e.exports=n;var x=n.prototype;x.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={}},x.plot=function(t,e){var r,n=this,i=e[n.id],a=e._size;l.getPlotDiv(n.plotContainer.node())!==n.graphDiv&&(n.init(n.graphDiv._fullLayout),n.makeFramework()),n.adjustLayout(i,a);var o=n.traceHash,s={};for(r=0;rb*y?(a=y,i=a*b):(i=v,a=i/b),o=g*i/v,s=m*a/y,r=e.l+e.w*d-i/2,n=e.t+e.h*(1-p)-a/2,l.x0=r,l.y0=n,l.w=i,l.h=a,l.sum=x,l.xaxis={type:"linear",range:[_+2*M-x,x-_-2*w],domain:[d-o/2,d+o/2],_id:"x",_gd:l.graphDiv},h(l.xaxis),l.xaxis.setScale(),l.yaxis={type:"linear",range:[_,x-w-M],domain:[p-s/2,p+s/2],_id:"y",_gd:l.graphDiv},h(l.yaxis),l.yaxis.setScale();var A=l.yaxis.domain[0],k=l.aaxis=f({},t.aaxis,{range:[_,x-w-M],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[A,A+s*b],_axislayer:l.layers.aaxis,_gridlayer:l.layers.agrid,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l"+a+",-"+i/2});h(k);var T=l.baxis=f({},t.baxis,{range:[x-_-M,w],side:"bottom",_counterangle:30,domain:l.xaxis.domain,_axislayer:l.layers.baxis,_gridlayer:l.layers.bgrid,_counteraxis:l.aaxis,_pos:0,_gd:l.graphDiv,_id:"x",_length:i,_gridpath:"M0,0l-"+i/2+",-"+a});h(T),k._counteraxis=T;var E=l.caxis=f({},t.caxis,{range:[x-_-w,M],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[A,A+s*b],_axislayer:l.layers.caxis,_gridlayer:l.layers.cgrid,_counteraxis:l.baxis,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l-"+a+","+i/2});h(E);var S="M"+r+","+(n+a)+"h"+i+"l-"+i/2+",-"+a+"Z";l.clipDef.select("path").attr("d",S),l.layers.plotbg.select("path").attr("d",S);var L="translate("+r+","+n+")";l.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",L);var z="translate("+r+","+(n+a)+")";l.layers.baxis.attr("transform",z),l.layers.bgrid.attr("transform",z);var C="translate("+(r+i/2)+","+n+")rotate(30)";l.layers.aaxis.attr("transform",C),l.layers.agrid.attr("transform",C);var I="translate("+(r+i/2)+","+n+")rotate(-30)";l.layers.caxis.attr("transform",I),l.layers.cgrid.attr("transform",I),l.drawAxes(!0),l.plotContainer.selectAll(".crisp").classed("crisp",!1);var P=l.layers.axlines;P.select(".aline").attr("d",k.showline?"M"+r+","+(n+a)+"l"+i/2+",-"+a:"M0,0").call(u.stroke,k.linecolor||"#000").style("stroke-width",(k.linewidth||0)+"px"),P.select(".bline").attr("d",T.showline?"M"+r+","+(n+a)+"h"+i:"M0,0").call(u.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),P.select(".cline").attr("d",E.showline?"M"+(r+i/2)+","+n+"l"+i/2+","+a:"M0,0").call(u.stroke,E.linecolor||"#000").style("stroke-width",(E.linewidth||0)+"px")},x.drawAxes=function(t){var e=this,r=e.graphDiv,n=e.id.substr(7)+"title",i=e.aaxis,a=e.baxis,o=e.caxis;if(d.doTicks(r,i,!0),d.doTicks(r,a,!0),d.doTicks(r,o,!0),t){var s=Math.max(i.showticklabels?i.tickfont.size/2:0,(o.showticklabels?.75*o.tickfont.size:0)+("outside"===o.ticks?.87*o.ticklen:0));g.draw(r,"a"+n,{propContainer:i,propName:e.id+".aaxis.title",dfltName:"Component A",attributes:{x:e.x0+e.w/2,y:e.y0-i.titlefont.size/3-s,"text-anchor":"middle"}});var l=(a.showticklabels?a.tickfont.size:0)+("outside"===a.ticks?a.ticklen:0)+3;g.draw(r,"b"+n,{propContainer:a,propName:e.id+".baxis.title",dfltName:"Component B",attributes:{x:e.x0-l,y:e.y0+e.h+.83*a.titlefont.size+l,"text-anchor":"middle"}}),g.draw(r,"c"+n,{propContainer:o,propName:e.id+".caxis.title",dfltName:"Component C",attributes:{x:e.x0+e.w+l,y:e.y0+e.h+.83*o.titlefont.size+l,"text-anchor":"middle"}})}};var _=v.MINZOOM/2+.87,w="m-0.87,.5h"+_+"v3h-"+(_+5.2)+"l"+(_/2+2.6)+",-"+(.87*_+4.5)+"l2.6,1.5l-"+_/2+","+.87*_+"Z",M="m0.87,.5h-"+_+"v3h"+(_+5.2)+"l-"+(_/2+2.6)+",-"+(.87*_+4.5)+"l-2.6,1.5l"+_/2+","+.87*_+"Z",A="m0,1l"+_/2+","+.87*_+"l2.6,-1.5l-"+(_/2+2.6)+",-"+(.87*_+4.5)+"l-"+(_/2+2.6)+","+(.87*_+4.5)+"l2.6,1.5l"+_/2+",-"+.87*_+"Z",k="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",T=!0;x.initInteractions=function(){function t(t,e,r){var n=F.getBoundingClientRect();_=e-n.left,E=r-n.top,S={a:R.aaxis.range[0],b:R.baxis.range[1],c:R.caxis.range[1]},z=S,L=R.aaxis.range[1]-S.a,C=o(R.graphDiv._fullLayout[R.id].bgcolor).getLuminance(),I="M0,"+R.h+"L"+R.w/2+", 0L"+R.w+","+R.h+"Z",P=!1,D=N.append("path").attr("class","zoombox").style({fill:C>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",I),O=N.append("path").attr("class","zoombox-corners").style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),g()}function e(t,e){return 1-e/R.h}function r(t,e){return 1-(t+(R.h-e)/Math.sqrt(3))/R.w}function n(t,e){return(t-(R.h-e)/Math.sqrt(3))/R.w}function a(t,i){var a=_+t,o=E+i,s=Math.max(0,Math.min(1,e(_,E),e(a,o))),l=Math.max(0,Math.min(1,r(_,E),r(a,o))),u=Math.max(0,Math.min(1,n(_,E),n(a,o))),c=(s/2+u)*R.w,h=(1-s/2-l)*R.w,f=(c+h)/2,d=h-c,p=(1-s)*R.h,g=p-d/b;d.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),O.transition().style("opacity",1).duration(200),P=!0)}function c(t,e){if(z===S)return 2===e&&x(),i(j);i(j);var r={};r[R.id+".aaxis.min"]=z.a,r[R.id+".baxis.min"]=z.b,r[R.id+".caxis.min"]=z.c,s.relayout(j,r),T&&j.data&&j._context.showTips&&(l.notifier("Double-click to
zoom back out","long"),T=!1)}function h(){S={a:R.aaxis.range[0],b:R.baxis.range[1],c:R.caxis.range[1]},z=S}function f(t,e){var r=t/R.xaxis._m,n=e/R.yaxis._m;z={a:S.a-n,b:S.b+(r+n)/2,c:S.c-(r-n)/2};var i=[z.a,z.b,z.c].sort(),a={a:i.indexOf(z.a),b:i.indexOf(z.b),c:i.indexOf(z.c)};i[0]<0&&(i[1]+i[0]/2<0?(i[2]+=i[0]+i[1],i[0]=i[1]=0):(i[2]+=i[0]/2,i[1]+=i[0]/2,i[0]=0),z={a:i[a.a],b:i[a.b],c:i[a.c]},e=(S.a-z.a)*R.yaxis._m,t=(S.c-z.c-S.b+z.b)*R.xaxis._m);var o="translate("+(R.x0+t)+","+(R.y0+e)+")";R.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",o),R.aaxis.range=[z.a,R.sum-z.b-z.c],R.baxis.range=[R.sum-z.a-z.c,z.b],R.caxis.range=[R.sum-z.a-z.b,z.c],R.drawAxes(!1),R.plotContainer.selectAll(".crisp").classed("crisp",!1)}function d(t,e){if(t){var r={};r[R.id+".aaxis.min"]=z.a,r[R.id+".baxis.min"]=z.b,r[R.id+".caxis.min"]=z.c,s.relayout(j,r)}else 2===e&&x()}function g(){R.plotContainer.selectAll(".select-outline").remove()}function x(){var t={};t[R.id+".aaxis.min"]=0,t[R.id+".baxis.min"]=0,t[R.id+".caxis.min"]=0,j.emit("plotly_doubleclick",null),s.relayout(j,t)}var _,E,S,L,z,C,I,P,D,O,R=this,F=R.layers.plotbg.select("path").node(),j=R.graphDiv,N=R.layers.zoom,B={element:F,gd:j,plotinfo:{plot:N},doubleclick:x,subplot:R.id,prepFn:function(e,r,n){B.xaxes=[R.xaxis],B.yaxes=[R.yaxis];var i=j._fullLayout.dragmode;e.shiftKey&&(i="pan"===i?"zoom":"pan"),"lasso"===i?B.minDrag=1:B.minDrag=void 0,"zoom"===i?(B.moveFn=a,B.doneFn=c,t(e,r,n)):"pan"===i?(B.moveFn=f,B.doneFn=d,h(),g()):"select"!==i&&"lasso"!==i||m(e,r,n,B,i)}};F.onmousemove=function(t){y.hover(j,t,R.id),j._fullLayout._lasthover=F,j._fullLayout._hoversubplot=R.id},F.onmouseout=function(t){j._dragging||p.unhover(j,t)},F.onclick=function(t){y.click(j,t)},p.init(B)}},{"../../components/color":533,"../../components/dragelement":554,"../../components/drawing":556,"../../components/titles":607,"../../lib":633,"../../lib/extend":626,"../../plotly":659,"../cartesian/axes":664,"../cartesian/constants":669,"../cartesian/graph_interact":671,"../cartesian/select":677,"../cartesian/set_convert":678,d3:95,tinycolor2:489}],739:[function(t,e,r){"use strict";function n(t){return"object"==typeof t&&(t=t.type),t}var i=t("./lib"),a=t("./plots/attributes");r.modules={},r.allCategories={},r.allTypes=[],r.subplotsRegistry={},r.transformsRegistry={},r.componentsRegistry={},r.layoutArrayContainers=[],r.register=function(t,e,n,a){if(r.modules[e])return void i.log("Type "+e+" already registered");for(var o={},s=0;s-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,u=t.layout,c=l([],a),h=l({},u,n(e.tileClass));if(e.width&&(h.width=e.width),e.height&&(h.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){h.annotations=[];var f=Object.keys(h);for(r=0;r=2?a(t):t>e?Math.ceil(t):Math.floor(t)}var m,v,y,x,b=e.p+(d?f[r]:f),_=b+(g?p[r]:p),w=e.b,M=w+e.s;if("h"===s.orientation?(y=c.c2p(b,!0),x=c.c2p(_,!0),m=u.c2p(w,!0),v=u.c2p(M,!0)):(m=u.c2p(b,!0),v=u.c2p(_,!0),y=c.c2p(w,!0),x=c.c2p(M,!0)),!(i(m)&&i(v)&&i(y)&&i(x)&&m!==v&&y!==x))return void n.select(this).remove();var A=(e.mlw+1||s.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,k=n.round(A/2%1,2);if(!t._context.staticPlot){var T=o.opacity(e.mc||s.marker.color),E=T<1||A>.01?a:l;m=E(m,v),v=E(v,m),y=E(y,x),x=E(x,y)}n.select(this).attr("d","M"+m+","+y+"V"+x+"H"+v+"V"+y+"Z")})}),f.call(s.plot,e)}},{"../../components/color":533,"../../components/errorbars":562,"../../lib":633,"./arrays_to_calcdata":748,d3:95,"fast-isnumeric":104}],757:[function(t,e,r){"use strict";function n(t,e,r,n){if(n.length){var s,l,u,c,h,f=t._fullLayout.barmode,d="overlay"===f,p="group"===f;if(d)i(t,e,r,n);else if(p){for(s=[],l=[],u=0;ul+o&&(u=!0,l=y)),v(e.c2l(g))&&(gl+o&&(u=!0,l=g))}}x.expand(e,[s,l],{tozero:!0,padded:u})}function m(t){return t._id.charAt(0)}var v=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var r,i=e.xaxis,a=e.yaxis,o=t._fullData,s=t.calcdata,l=[],u=[];for(r=0;r1||0===s.bargap&&0===s.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,r=e.marker,o=r.line,s=a.tryColorscale(r,""),l=a.tryColorscale(r,"line");n.select(this).selectAll("path").each(function(t){var e,a,u=(t.mlw+1||o.width+1)-1,c=n.select(this);e="mc"in t?t.mcc=s(t.mc):Array.isArray(r.color)?i.defaultLine:r.color,c.style("stroke-width",u+"px").call(i.fill,e),u&&(a="mlc"in t?t.mlcc=l(t.mlc):Array.isArray(o.color)?i.defaultLine:o.color,c.call(i.stroke,a))})}),e.call(o.style)}},{"../../components/color":533,"../../components/drawing":556,"../../components/errorbars":562,d3:95}],760:[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")}},{"../../components/color":533,"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546}],761:[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"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:a({},o.symbol,{arrayOk:!1}),opacity:a({},o.opacity,{arrayOk:!1,dflt:1}),size:a({},o.size,{arrayOk:!1}),color:a({},o.color,{arrayOk:!1}),line:{color:a({},s.color,{arrayOk:!1,dflt:i.defaultLine}),width:a({},s.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:n.fillcolor}},{"../../components/color/attributes":532,"../../lib/extend":626,"../scatter/attributes":846}],762:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(t,e,r,a,o){var s;return r in e?p=a.makeCalcdata(e,r):(s=r+"0"in e?e[r+"0"]:"name"in e&&("category"===a.type||n(e.name)&&["linear","log"].indexOf(a.type)!==-1||i.isDateTime(e.name)&&"date"===a.type)?e.name:t.numboxes,s=a.d2c(s),p=o.map(function(){return s})),p}function o(t,e,r,a,o){var s,l,u,c,h=a.length,f=e.length,d=[],p=[];for(s=0;s=0&&u1,v=r.dPos*(1-f.boxgap)*(1-f.boxgroupgap)/(m?t.numboxes:1),y=m?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-f.boxgap):0,x=v*g.whiskerwidth;return g.visible!==!0||r.emptybox?void a.select(this).remove():("h"===g.orientation?(l=p,h=d):(l=d,h=p),r.bPos=y,r.bdPos=v,n(),a.select(this).selectAll("path.box").data(o.identity).enter().append("path").attr("class","box").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-v,!0),n=l.c2p(t.pos+y+v,!0),i=l.c2p(t.pos+y-x,!0),s=l.c2p(t.pos+y+x,!0),u=h.c2p(t.q1,!0),c=h.c2p(t.q3,!0),f=o.constrain(h.c2p(t.med,!0),Math.min(u,c)+1,Math.max(u,c)-1),d=h.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=h.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?a.select(this).attr("d","M"+f+","+r+"V"+n+"M"+u+","+r+"V"+n+"H"+c+"V"+r+"ZM"+u+","+e+"H"+d+"M"+c+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+d+","+i+"V"+s+"M"+p+","+i+"V"+s)):a.select(this).attr("d","M"+r+","+f+"H"+n+"M"+r+","+u+"H"+n+"V"+c+"H"+r+"ZM"+e+","+u+"V"+d+"M"+e+","+c+"V"+p+(0===g.whiskerwidth?"":"M"+i+","+d+"H"+s+"M"+i+","+p+"H"+s))}),g.boxpoints&&a.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,a,s,l,h,f="all"===g.boxpoints?t.val:t.val.filter(function(e){return et.uf}),d=Math.max((t.max-t.min)/10,t.q3-t.q1),p=1e-9*d,m=d*c,x=[],b=0;if(g.jitter){if(0===d)for(b=1,x=new Array(f.length),e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(s.translatePoints,d,p),void(g.boxmean&&a.select(this).selectAll("path.mean").data(o.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-v,!0),n=l.c2p(t.pos+y+v,!0),i=h.c2p(t.mean,!0),o=h.c2p(t.mean-t.sd,!0),s=h.c2p(t.mean+t.sd,!0);"h"===g.orientation?a.select(this).attr("d","M"+i+","+r+"V"+n+("sd"!==g.boxmean?"":"m0,0L"+o+","+e+"L"+i+","+r+"L"+s+","+e+"Z")):a.select(this).attr("d","M"+r+","+i+"H"+n+("sd"!==g.boxmean?"":"m0,0L"+e+","+o+"L"+r+","+i+"L"+e+","+s+"Z"))})))})}},{"../../components/drawing":556,"../../lib":633,d3:95}],769:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../plots/cartesian/axes"),a=t("../../lib");e.exports=function(t,e){var r,o,s,l,u=t._fullLayout,c=e.xaxis,h=e.yaxis,f=["v","h"];for(o=0;ol&&(e.z=c.slice(0,l)),s("locationmode"),s("text"),s("marker.line.color"),s("marker.line.width"),i(t,e,o,s,{prefix:"",cLetter:"z"}),void s("hoverinfo",1===o._dataLength?"location+z+text":void 0)):void(e.visible=!1)}},{"../../components/colorscale/defaults":542,"../../lib":633,"./attributes":775}],778:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("./calc"),n.plot=t("./plot").plot,n.hoverPoints=function(){},n.moduleType="trace",n.name="choropleth",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","noOpacity"],n.meta={},e.exports=n},{"../../plots/geo":688,"../heatmap/colorbar":792,"./attributes":775,"./calc":776,"./defaults":777,"./plot":779}],779:[function(t,e,r){"use strict";function n(t,e){function r(e){var r=t.mockAxis;return o.tickText(r,r.c2l(e),"hover").text}var n=e.hoverinfo;if("none"===n||"skip"===n)return function(t){delete t.nameLabel,delete t.textLabel};var i="all"===n?g.hoverinfo.flags:n.split("+"),a=i.indexOf("name")!==-1,s=i.indexOf("location")!==-1,l=i.indexOf("z")!==-1,u=i.indexOf("text")!==-1,c=!a&&s;return function(t){var n=[];c?t.nameLabel=t.id:(a&&(t.nameLabel=e.name),s&&n.push(t.id)),l&&n.push(r(t.z)),u&&n.push(t.tx),t.textLabel=n.join("
")}}function i(t){return function(e,r){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:r,location:e.id,z:e.z}]}}}var a=t("d3"),o=t("../../plots/cartesian/axes"),s=t("../../plots/cartesian/graph_interact"),l=t("../../components/color"),u=t("../../components/drawing"),c=t("../../components/colorscale"),h=t("../../lib/topojson_utils").getTopojsonFeatures,f=t("../../lib/geo_location_utils").locationToFeature,d=t("../../lib/array_to_calc_item"),p=t("../../plots/geo/constants"),g=t("./attributes"),m=e.exports={};m.calcGeoJSON=function(t,e){for(var r,n=[],i=t.locations,a=i.length,o=h(t,e),s=(t.marker||{}).line||{},l=0;l0&&(n[0].trace=t),n},m.plot=function(t,e,r){function o(t){return t[0].trace.uid}var l,u=t.framework,c=u.select("g.choroplethlayer"),h=u.select("g.baselayer"),f=u.select("g.baselayeroverchoropleth"),d=p.baseLayersOverChoropleth,g=c.selectAll("g.trace.choropleth").data(e,o);g.enter().append("g").attr("class","trace choropleth"),g.exit().remove(),g.each(function(e){function r(e,r){if(t.showHover){var n=t.projection(e.properties.ct);c(e),s.loneHover({x:n[0],y:n[1],name:e.nameLabel,text:e.textLabel},{container:t.hoverContainer.node()}),f=h(e,r),t.graphDiv.emit("plotly_hover",f)}}function o(e,r){t.graphDiv.emit("plotly_click",h(e,r))}var l=e[0].trace,u=m.calcGeoJSON(l,t.topojson),c=n(t,l),h=i(l),f=null,d=a.select(this).selectAll("path.choroplethlocation").data(u);d.enter().append("path").classed("choroplethlocation",!0).on("mouseover",r).on("click",o).on("mouseout",function(){s.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",f)}).on("mousedown",function(){s.loneUnhover(t.hoverContainer)}).on("mouseup",r),d.exit().remove()}),f.selectAll("*").remove();for(var v=0;vt?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===r||10===r){var n=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;return t>n?5===r?713:1114:5===r?104:208}return 15===r?0:r}function o(t){var e,r,n,i,o,s,l,u,c,h=t[0].z,f=h.length,d=h[0].length,p=2===f||2===d;for(r=0;r20?(s=L[s][(l[0]||l[1])<0?0:1],t.crossings[o]=z[s]):delete t.crossings[o],l=S[s],!l){_.log("Found bad marching index:",s,e,t.level);break}if(d.push(f(t,e,l)),e[0]+=l[0],e[1]+=l[1],c(d[d.length-1],d[d.length-2])&&d.pop(),o=e.join(","),o===a&&l.join(",")===p||r&&(l[0]&&(e[0]<0||e[0]>m-2)||l[1]&&(e[1]<0||e[1]>g-2)))break;s=t.crossings[o]}1e4===i&&_.log("Infinite loop in contour?");var v,y,x,b,w,M,A,k=c(d[0],d[d.length-1]),T=0,E=.2*t.smoothing,C=[],I=0;for(i=1;i=I;i--)if(v=C[i],v=I&&v+C[y]20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:A.indexOf(t)!==-1?i=1:T.indexOf(t)!==-1?n=1:k.indexOf(t)!==-1?i=-1:n=-1,[n,i]}function c(t,e){return Math.abs(t[0]-e[0])<.01&&Math.abs(t[1]-e[1])<.01}function h(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function f(t,e,r){var n=e[0]+Math.max(r[0],0),i=e[1]+Math.max(r[1],0),a=t.z[i][n],o=t.xaxis,s=t.yaxis;if(r[1]){var l=(t.level-a)/(t.z[i][n+1]-a);return[o.c2p((1-l)*t.x[n]+l*t.x[n+1],!0),s.c2p(t.y[i],!0)]}var u=(t.level-a)/(t.z[i+1][n]-a);return[o.c2p(t.x[n],!0),s.c2p((1-u)*t.y[i]+u*t.y[i+1],!0)]}function d(t,e,r){var n=t.plot.select(".maplayer").selectAll("g.contour."+r).data(e);return n.enter().append("g").classed("contour",!0).classed(r,!0),n.exit().remove(),n}function p(t,e,r){var n=t.selectAll("g.contourbg").data([0]);n.enter().append("g").classed("contourbg",!0);var i=n.selectAll("path").data("fill"===r.coloring?[0]:[]);i.enter().append("path"),i.exit().remove(),i.attr("d","M"+e.join("L")+"Z").style("stroke","none")}function g(t,e,r,n){var i=t.selectAll("g.contourfill").data([0]);i.enter().append("g").classed("contourfill",!0);var a=i.selectAll("path").data("fill"===n.coloring?e:[]);a.enter().append("path"),a.exit().remove(),a.each(function(t){var e=m(t,r);e?b.select(this).attr("d",e).style("stroke","none"):b.select(this).remove()})}function m(t,e){function r(t){return Math.abs(t[1]-e[0][1])<.01}function n(t){return Math.abs(t[1]-e[2][1])<.01}function i(t){return Math.abs(t[0]-e[0][0])<.01}function a(t){return Math.abs(t[0]-e[2][0])<.01}for(var o,s,l,u,c,h,f=t.edgepaths.length||t.z[0][0]=0&&(s=m,u=c):Math.abs(o[1]-s[1])<.01?Math.abs(o[1]-m[1])<.01&&(m[0]-o[0])*(s[0]-m[0])>=0&&(s=m,u=c):_.log("endpt to newendpt is not vert. or horz.",o,s,m)}if(o=s,u>=0)break;f+="L"+s}if(u===t.edgepaths.length){_.log("unclosed perimeter path");break}d=u,g=p.indexOf(d)===-1,g&&(d=p[0],f+="Z")}for(d=0;d1;if(p&&!f&&"category"!==a.type){var g=e.length;if(!(g<=i))return h?e.slice(0,i):e.slice(0,i+1);if(h||d)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;ly;n++)o=l(t,e,a(o));return o>y&&h.log("interp2d didn't converge quickly",o),t}function s(t){var e,r,n,i,a,o,s,l,u=[],c={},h=[],f=t[0],d=[],p=[0,0,0],g=v(t);for(r=0;r=0;a--)i=h[a],r=i[0],n=i[1],o=((c[[r-1,n]]||p)[2]+(c[[r+1,n]]||p)[2]+(c[[r,n-1]]||p)[2]+(c[[r,n+1]]||p)[2])/20,o&&(s[i]=[r,n,o],h.splice(a,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,a,o,s,l,u,c,h,f,d,p,g,m=0;for(o=0;op&&(m=Math.max(m,Math.abs(t[i][a]-d)/(g-p))))}return m}var u=t("fast-isnumeric"),c=t("../../registry"),h=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),m=t("./convert_column_xyz"),v=t("./max_row_length");e.exports=function(t,e){function r(t){S=e._input.zsmooth=e.zsmooth=!1,h.notifier("cannot fast-zsmooth: "+t)}var a,l,u,y,x,b,_,w,M=f.getFromId(t,e.xaxis||"x"),A=f.getFromId(t,e.yaxis||"y"),k=c.traceIs(e,"contour"),T=c.traceIs(e,"histogram"),E=c.traceIs(e,"gl2d"),S=k?"best":e.zsmooth;if(M._minDtick=0,A._minDtick=0,T){var L=d(t,e);a=L.x,l=L.x0,u=L.dx,y=L.y,x=L.y0,b=L.dy,_=L.z}else g(e)&&m(e,M,A),a=e.x?M.makeCalcdata(e,"x"):[],y=e.y?A.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,x=e.y0||0,b=e.dy||1,_=n(e),(k||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=o(_,e._emptypoints,e._interpz));if("fast"===S)if("log"===M.type||"log"===A.type)r("log axis found");else if(!T){if(a.length){var z=(a[a.length-1]-a[0])/(a.length-1),C=Math.abs(z/100);for(w=0;wC){r("x scale is not linear");break}}if(y.length&&"fast"===S){var I=(y[y.length-1]-y[0])/(y.length-1),P=Math.abs(I/100);for(w=0;wP){r("y scale is not linear");break}}}var D=v(_),O="scaled"===e.xtype?"":a,R=i(e,O,l,u,D,M),F="scaled"===e.ytype?"":y,j=i(e,F,x,b,_.length,A);E||(f.expand(M,R),f.expand(A,j));var N={x:R,y:j,z:_};if(p(e,_,"","z"),k&&e.contours&&"heatmap"===e.contours.coloring){var B="contour"===e.type?"heatmap":"histogram2d";N.xfill=i(B,O,l,u,D,M),N.yfill=i(B,F,x,b,_.length,A)}return[N]};var y=.01,x=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":539,"../../lib":633,"../../plots/cartesian/axes":664,"../../registry":739,"../histogram2d/calc":812,"./convert_column_xyz":793,"./has_columns":795,"./max_row_length":798,"fast-isnumeric":104}],792:[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="cb"+r.uid,u=r.zmin,c=r.zmax;if(n(u)||(u=i.aggNums(Math.min,null,r.z)),n(c)||(c=i.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void a.autoMargin(t,l);var h=e[0].t.cb=s(t,l),f=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});h.fillcolor(f).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":536,"../../components/colorscale":547,"../../lib":633,"../../plots/plots":724,"fast-isnumeric":104}],793:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a=t.x.slice(),o=t.y.slice(),s=t.z,l=t.text,u=Math.min(a.length,o.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(u=y[0].length||h<0||h>y.length)return}else{if(n.inbox(e-m[0],e-m[m.length-1])>a||n.inbox(r-v[0],r-v[v.length-1])>a)return;if(s){var w;for(b=[2*m[0]-m[1]],w=1;w0&&a0&&s0;)_=m.c2p(E[k]),k--;for(_0;)A=v.c2p(S[k]),k--;if(A0&&(n=!0);for(var s=0;sa)return r[t]=a,a-r[t]}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]=0&&yF;r--)if(h[r]){j=r;break}for(r=F;r<=j;r++)n(c[r])&&n(h[r])&&R.push({p:c[r],s:h[r],b:0});return R}}},{"../../lib":633,"../../plots/cartesian/axes":664,"./average":803,"./bin_functions":805,"./clean_bins":807,"./norm_functions":810,"fast-isnumeric":104}],807:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib").cleanDate,a=t("../../constants/numerical").ONEDAY;e.exports=function(t,e,r){var o=e.type,s=r+"bins",l=t[s];l||(l=t[s]={});var u="date"===o?function(t){return t||0===t?i(t):null}:function(t){return n(t)?Number(t):null};l.start=u(l.start),l.end=u(l.end);var c="date"===o?a:1,h=l.size;if(n(h))l.size=h>0?Number(h):c;else if("string"!=typeof h)l.size=c;else{var f=h.charAt(0),d=h.substr(1);d=n(d)?Number(d):0,(d<=0||"date"!==o||"M"!==f||d!==Math.round(d))&&(l.size=c)}var p="autobin"+r;"boolean"!=typeof t[p]&&(t[p]=!((l.start||0===l.start)&&(l.end||0===l.end))),t[p]||delete t["nbins"+r]}},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],808:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),a=t("./bin_defaults"),o=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,i){return n.coerce(t,e,l,r,i)}var h=c("x"),f=c("y");c("text");var d=c("orientation",f&&!h?"h":"v"),p=e["v"===d?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===d?"x":"y"];g&&c("histfunc");var m="h"===d?["y"]:["x"];a(t,e,c,m),o(t,e,c,r,u),s(t,e,i.defaultLine,{axis:"y"}),s(t,e,i.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":533,"../../components/errorbars/defaults":561,"../../lib":633,"../bar/style_defaults":760,"./attributes":802,"./bin_defaults":804}],809:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("../bar/layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("../bar/layout_defaults"),n.calc=t("./calc"),n.setPositions=t("../bar/set_positions"),n.plot=t("../bar/plot"),n.style=t("../bar/style"),n.colorbar=t("../scatter/colorbar"),n.hoverPoints=t("../bar/hover"),n.moduleType="trace",n.name="histogram",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":672,"../bar/hover":752,"../bar/layout_attributes":754,"../bar/layout_defaults":755,"../bar/plot":756,"../bar/set_positions":757,"../bar/style":759,"../scatter/colorbar":849,"./attributes":802,"./calc":806,"./defaults":808}],810:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;iy&&g.splice(y,g.length-y),v.length>y&&v.splice(y,v.length-y),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(g,p,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start=p.c2r(i.tickIncrement(p.r2c(e.xbins.start),e.xbins.size,!0)),e.xbins.end=p.c2r(i.tickIncrement(p.r2c(e.xbins.end),e.xbins.size))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(v,m,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start=m.c2r(i.tickIncrement(m.r2c(e.ybins.start),e.ybins.size,!0)),e.ybins.end=m.c2r(i.tickIncrement(m.r2c(e.ybins.end),e.ybins.size))),e._input.ybins=e.ybins),f=[];var x,b,_=[],w=[],M="string"==typeof e.xbins.size?[]:e.xbins,A="string"==typeof e.xbins.size?[]:e.ybins,k=0,T=[],E=e.histnorm,S=e.histfunc,L=E.indexOf("density")!==-1,z="max"===S||"min"===S,C=z?null:0,I=a.count,P=o[E],D=!1,O=[],R=[],F="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";F&&"count"!==S&&(D="avg"===S,I=a[S]);var j=e.xbins,N=p.r2c(j.start),B=p.r2c(j.end)+(N-i.tickIncrement(N,j.size))/1e6;for(d=N;d=0&&x=0&&b0)s=h(t.alphahull,l);else{var u=["x","y","z"].indexOf(t.delaunayaxis);s=c(l.map(function(t){return[t[(u+1)%3],t[(u+2)%3]]}))}var p={positions:l,cells:s,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:d(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",p.vertexIntensity=t.intensity,p.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolors[0],p.vertexColors=a(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],p.cellColors=a(t.facecolor)):(this.color=t.color,p.meshColor=d(t.color)),this.mesh.update(p)},p.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=s},{"../../lib/str2rgbarray":646,"alpha-shape":32,"convex-hull":84,"delaunay-triangulate":96,"gl-mesh3d":173,tinycolor2:489}],821:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorbar/defaults"),a=t("./attributes");e.exports=function(t,e,r,o){function s(r,i){return n.coerce(t,e,a,r,i)}function l(t){var e=t.map(function(t){var e=s(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=l(["x","y","z"]),c=l(["i","j","k"]);return u?(c&&c.forEach(function(t){for(var e=0;ee}}},r.addRangeSlider=function(t){t.xaxis||(t.xaxis={}),t.xaxis.rangeslider||(t.xaxis.rangeslider={})}},{"../../lib":633}],827:[function(t,e,r){"use strict";var n=t("../../plot_api/register");e.exports={moduleType:"trace",name:"ohlc",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","showLegend"],meta:{},attributes:t("./attributes"),supplyDefaults:t("./defaults")},n(t("../scatter")),n(t("./transform"))},{"../../plot_api/register":654,"../../plots/cartesian":672,"../scatter":856,"./attributes":823,"./defaults":824,"./transform":829}],828:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,i=r("x"),a=r("open"),o=r("high"),s=r("low"),l=r("close");return n=Math.min(a.length,o.length,s.length,l.length),i&&(n=Math.min(n,i.length),n1)){var h=o.distinctVals(c.x.map(e.d2c)).minDiff;a=Math.min(a,h)}}for(a===1/0&&(a=1),u=0;u");_.push(o,o,o,o,o,o,null)},C=0;C")}return g};var l},{"../../components/color":533,"./helpers":834,"fast-isnumeric":104,tinycolor2:489}],833:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,a){function o(r,a){return n.coerce(t,e,i,r,a)}var s=n.coerceFont,l=o("values");if(!Array.isArray(l)||!l.length)return void(e.visible=!1);var u=o("labels");Array.isArray(u)||(o("label0"),o("dlabel"));var c=o("marker.line.width");c&&o("marker.line.color");var h=o("marker.colors");Array.isArray(h)||(e.marker.colors=[]),o("scalegroup");var f=o("text"),d=o("textinfo",Array.isArray(f)?"text+percent":"percent");if(o("hoverinfo",1===a._dataLength?"label+text+value+percent":void 0),d&&"none"!==d){var p=o("textposition"),g=Array.isArray(p)||"auto"===p,m=g||"inside"===p,v=g||"outside"===p;if(m||v){var y=s(o,"textfont",a.font);m&&s(o,"insidetextfont",y),v&&s(o,"outsidetextfont",y)}}o("domain.x"),o("domain.y"),o("hole"),o("sort"),o("direction"),o("rotation"),o("pull")}},{"../../lib":633,"./attributes":830}],834:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return r.lastIndexOf(".")!==-1&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return r.lastIndexOf(".")!==-1&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":633}],835:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.layoutAttributes=t("./layout_attributes"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.styleOne=t("./style_one"),n.moduleType="trace",n.name="pie",n.basePlotModule=t("./base_plot"),n.categories=["pie","showLegend"],n.meta={},e.exports=n},{"./attributes":830,"./base_plot":831,"./calc":832,"./defaults":833,"./layout_attributes":836,"./layout_defaults":837,"./plot":838,"./style":839,"./style_one":840}],836:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],837:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e){function r(r,a){return n.coerce(t,e,i,r,a)}r("hiddenlabels")}},{"../../lib":633,"./layout_attributes":836}],838:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.sqrt(t.width*t.width+t.height*t.height),a=t.width/t.height,o=Math.PI*Math.min(e.v/r.vTotal,.5),s=1-r.trace.hole,l=i(e,r),u={scale:l*r.r*2/n,rCenter:1-l,rotate:0};if(u.scale>=1)return u;var c=a+1/(2*Math.tan(o)),h=r.r*Math.min(1/(Math.sqrt(c*c+.5)+c),s/(Math.sqrt(a*a+s/2)+a)),f={scale:2*h/t.height,rCenter:Math.cos(h/r.r)-h*a/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90},d=1/a,p=d+1/(2*Math.tan(o)),g=r.r*Math.min(1/(Math.sqrt(p*p+.5)+p),s/(Math.sqrt(d*d+s/2)+d)),m={scale:2*g/t.width,rCenter:Math.cos(g/r.r)-g/a/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>f.scale?m:f;return u.scale<1&&v.scale>u.scale?v:u}function i(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var r=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(r)),(1-e.trace.hole)/2)}function a(t,e){var r=e.pxmid[0],n=e.pxmid[1],i=t.width/2,a=t.height/2;return r<0&&(i*=-1),n<0&&(a*=-1),{scale:1,rCenter:1,rotate:0,x:i+Math.abs(a)*(i>0?1:-1)/2,y:a/(1+r*r/(n*n)),outside:!0}}function o(t,e){function r(t,e){return t.pxmid[1]-e.pxmid[1]}function n(t,e){return e.pxmid[1]-t.pxmid[1]}function i(t,r){r||(r={});var n,i,a,s,f,d,g=r.labelExtraY+(o?r.yLabelMax:r.yLabelMin),m=o?t.yLabelMin:t.yLabelMax,v=o?t.yLabelMax:t.yLabelMin,y=t.cyFinal+u(t.px0[1],t.px1[1]),x=g-m;if(x*h>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(i=0;i=e.pull[a.i]||((t.pxmid[1]-a.pxmid[1])*h>0?(s=a.cyFinal+u(a.px0[1],a.px1[1]),x=s-m-t.labelExtraY,x*h>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*h>0&&(n=3*c*Math.abs(i-p.indexOf(t)),f=a.cxFinal+l(a.px0[0],a.px1[0]),d=f+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX,d*c>0&&(t.labelExtraX+=d)))}var a,o,s,l,u,c,h,f,d,p,g,m,v;for(o=0;o<2;o++)for(s=o?r:n,u=o?Math.max:Math.min,h=o?1:-1,a=0;a<2;a++){for(l=a?Math.max:Math.min,c=a?1:-1,f=t[o][a],f.sort(s),d=t[1-o][a],p=d.concat(f),m=[],g=0;gc&&(c=s.pull[a]);o.r=Math.min(r/u(s.tilt,Math.sin(l),s.depth),n/u(s.tilt,Math.cos(l),s.depth))/(2+2*c),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&&d.indexOf(s.scalegroup)===-1&&d.push(s.scalegroup)}for(a=0;ah.vTotal/2?1:0)}function u(t,e,r){if(!t)return 1;var n=Math.sin(t*Math.PI/180);return Math.max(.01,r*n*Math.abs(e)+2*Math.sqrt(1-n*n*e*e))}var c=t("d3"),h=t("../../plots/cartesian/graph_interact"),f=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;s(e,r._size);var u=r._pielayer.selectAll("g.trace").data(e);u.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),u.exit().remove(),u.order(),u.each(function(e){var s=c.select(this),u=e[0],m=u.trace,v=0,y=(m.depth||0)*u.r*Math.sin(v)/2,x=m.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=u.r*Math.cos(v),M=s.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);M.enter().append("g").attr("class",function(t){return t+" part"}),M.exit().remove(),M.order(),l(e),s.selectAll(".top").each(function(){var s=c.select(this).selectAll("g.slice").data(e);s.enter().append("g").classed("slice",!0),s.exit().remove();var l=[[[],[]],[[],[]]],v=!1;s.each(function(o){function s(e){var n=t._fullLayout,a=t._fullData[m.index],s=a.hoverinfo;if("all"===s&&(s="label+text+value+percent+name"),!t._dragging&&n.hovermode!==!1&&"none"!==s&&"skip"!==s&&s){var l=i(o,u),c=M+o.pxmid[0]*(1-l),f=A+o.pxmid[1]*(1-l),d=r.separators,p=[];s.indexOf("label")!==-1&&p.push(o.label),a.text&&a.text[o.i]&&s.indexOf("text")!==-1&&p.push(a.text[o.i]),s.indexOf("value")!==-1&&p.push(g.formatPieValue(o.v,d)),s.indexOf("percent")!==-1&&p.push(g.formatPiePercent(o.v/u.vTotal,d)),h.loneHover({x0:c-l*u.r,x1:c+l*u.r,y:f,text:p.join("
"),name:s.indexOf("name")!==-1?a.name:void 0,color:o.color,idealAlign:o.pxmid[0]<0?"left":"right"},{container:n._hoverlayer.node(),outerContainer:n._paper.node()}),h.hover(t,e,"pie"),E=!0}}function f(e){t.emit("plotly_unhover",{points:[e]}),E&&(h.loneUnhover(r._hoverlayer.node()),E=!1)}function y(){t._hoverdata=[o],t._hoverdata.trace=e.trace,h.click(t,{target:!0})}function b(t,e,r,n){return"a"+n*u.r+","+n*w+" "+x+" "+o.largeArc+(r?" 1 ":" 0 ")+n*(e[0]-t[0])+","+n*(e[1]-t[1])}if(o.hidden)return void c.select(this).selectAll("path,g").remove();l[o.pxmid[1]<0?0:1][o.pxmid[0]<0?0:1].push(o);var M=u.cx+_[0],A=u.cy+_[1],k=c.select(this),T=k.selectAll("path.surface").data([o]),E=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),k.select("path.textline").remove(),k.on("mouseover",s).on("mouseout",f).on("click",y),m.pull){var S=+(Array.isArray(m.pull)?m.pull[o.i]:m.pull)||0;S>0&&(M+=S*o.pxmid[0],A+=S*o.pxmid[1])}o.cxFinal=M,o.cyFinal=A;var L=m.hole;if(o.v===u.vTotal){var z="M"+(M+o.px0[0])+","+(A+o.px0[1])+b(o.px0,o.pxmid,!0,1)+b(o.pxmid,o.px0,!0,1)+"Z";L?T.attr("d","M"+(M+L*o.px0[0])+","+(A+L*o.px0[1])+b(o.px0,o.pxmid,!1,L)+b(o.pxmid,o.px0,!1,L)+"Z"+z):T.attr("d",z)}else{var C=b(o.px0,o.px1,!0,1);if(L){var I=1-L;T.attr("d","M"+(M+L*o.px1[0])+","+(A+L*o.px1[1])+b(o.px1,o.px0,!1,L)+"l"+I*o.px0[0]+","+I*o.px0[1]+C+"Z")}else T.attr("d","M"+M+","+A+"l"+o.px0[0]+","+o.px0[1]+C+"Z")}var P=Array.isArray(m.textposition)?m.textposition[o.i]:m.textposition,D=k.selectAll("g.slicetext").data(o.text&&"none"!==P?[0]:[]);D.enter().append("g").classed("slicetext",!0),D.exit().remove(),D.each(function(){var t=c.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(o.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(d.font,"outside"===P?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,r=d.bBox(t.node());"outside"===P?e=a(r,o):(e=n(r,o,u),"auto"===P&&e.scale<1&&(t.call(d.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),r=d.bBox(t.node())),e=a(r,o)));var i=M+o.pxmid[0]*e.rCenter+(e.x||0),s=A+o.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(o.yLabelMin=s-r.height/2,o.yLabelMid=s,o.yLabelMax=s+r.height/2,o.labelExtraX=0,o.labelExtraY=0,v=!0),t.attr("transform","translate("+i+","+s+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(r.left+r.right)/2+","+-(r.top+r.bottom)/2+")")})}),v&&o(l,m),s.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=c.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],i=t.cyFinal+t.pxmid[1],a="M"+n+","+i,o=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var s=t.labelExtraX*t.pxmid[1]/t.pxmid[0],l=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);a+=Math.abs(s)>Math.abs(l)?"l"+l*t.pxmid[0]/t.pxmid[1]+","+l+"H"+(n+t.labelExtraX+o):"l"+t.labelExtraX+","+s+"v"+(l-s)+"h"+o}else a+="V"+(t.yLabelMid+t.labelExtraY)+"h"+o;e.append("path").classed("textline",!0).call(f.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:a,fill:"none"})}})})}),setTimeout(function(){u.selectAll("tspan").each(function(){var t=c.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":533,"../../components/drawing":556,"../../lib/svg_text_utils":647,"../../plots/cartesian/graph_interact":671,"./helpers":834,d3:95}],839:[function(t,e,r){"use strict";var n=t("d3"),i=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],r=e.trace,a=n.select(this);a.style({opacity:r.opacity}),a.selectAll(".top path.surface").each(function(t){n.select(this).call(i,t,r)})})}},{"./style_one":840,d3:95}],840:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var i=r.marker.line.color;Array.isArray(i)&&(i=i[e.i]||n.defaultLine);var a=r.marker.line.width||0;Array.isArray(a)&&(a=a[e.i]||0),t.style({"stroke-width":a,fill:e.color}).call(n.stroke,i)}},{"../../components/color":533}],841:[function(t,e,r){"use strict";var n=t("../scattergl/attributes");e.exports={x:n.x,y:n.y,xy:{valType:"data_array"},indices:{valType:"data_array"},xbounds:{valType:"data_array"},ybounds:{valType:"data_array"},text:n.text,marker:{color:{valType:"color",arrayOk:!1},opacity:{valType:"number",min:0,max:1,dflt:1,arrayOk:!1},blend:{valType:"boolean",dflt:null},sizemin:{valType:"number",min:.1,max:2,dflt:.5},sizemax:{valType:"number",min:.1,dflt:20},border:{color:{valType:"color",arrayOk:!1},arearatio:{valType:"number",min:0,max:1,dflt:0}}}}},{"../scattergl/attributes":882}],842:[function(t,e,r){"use strict";function n(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=a(t.glplot,this.pointcloudOptions),this.pointcloud._trace=this}function i(t,e){var r=new n(t,e.uid);return r.update(e),r}var a=t("gl-pointcloud2d"),o=t("../../lib/str2rgbarray"),s=t("../scatter/get_trace_color"),l=["xaxis","yaxis"],u=n.prototype;u.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}},u.update=function(t){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=s(t,{})},u.updateFast=function(t){var e,r,n,i,a,s,l=this.xData=this.pickXData=t.x,u=this.yData=this.pickYData=t.y,c=this.pickXYData=t.xy,h=t.xbounds&&t.ybounds,f=t.indices,d=this.bounds;if(c){if(n=c,e=c.length>>>1,h)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);if(f)r=f;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var p=o(t.marker.color),g=o(t.marker.border.color),m=t.opacity*t.marker.opacity;p[3]*=m,this.pointcloudOptions.color=p;var v=t.marker.blend;if(null===v){var y=100;v=l.lengthp&&f.splice(p,f.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},m={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var v={type:"linear"};i.setConvert(v),l=v.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||f[0]===f[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||f[0]===f[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,i.expand(c,f,g),i.expand(h,d,m);var b=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],849:[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,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,h=l.cmin,f=l.cmax;n(h)||(h=i.aggNums(Math.min,null,c)),n(f)||(f=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,h,f),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:h,end:f,size:(f-h)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":536,"../../components/colorscale":547,"../../lib":633,"../../plots/plots":724,"fast-isnumeric":104}],850:[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":866}],851:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],852:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),h=t("./text_defaults"),f=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var m=s(t,e,g),v=mU!=P>=U&&(z=S[T-1][0],C=S[T][0],L=z+(C-z)*(U-I)/(P-I),F=Math.min(F,L),j=Math.max(j,L));F=Math.max(F,0),j=Math.min(j,f._length);var V=l.defaultLine;return l.opacity(h.fillcolor)?V=h.fillcolor:l.opacity((h.line||{}).color)&&(V=h.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:F,x1:j,y0:U,y1:U,color:V}),delete t.index,h.text&&!Array.isArray(h.text)?t.text=String(h.text):t.text=h.name,[t]}}}},{"../../components/color":533,"../../components/errorbars":562,"../../lib":633,"../../plots/cartesian/constants":669,"../../plots/cartesian/graph_interact":671,"./get_trace_color":854}],856:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":672,"./arrays_to_calcdata":845,"./attributes":846,"./calc":847,"./clean_data":848,"./colorbar":849,"./defaults":852,"./hover":855,"./plot":863,"./select":864,"./style":865,"./subtypes":866}],857:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546}],858:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),i=M.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/w._length,r=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,h,f,d,p,g,m,v,y,x,b,_,w=e.xaxis,M=e.yaxis,A=e.simplify,k=e.connectGaps,T=e.baseTolerance,E=e.linear,S=[],L=.2,z=new Array(t.length),C=0;for(A||(T=L=-1),o=0;oi(h))break;l=h,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,u=h,d=!1):y=t.length||!h)break;z[C++]=h,s=h}}else z[C++]=u}S.push(z.slice(0,C))}return S}},{"../../constants/numerical":616}],859:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],860:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":104}],862:[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){var u,c=o.isBubble(t),h=(t.line||{}).color;h&&(r=h),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=h&&!Array.isArray(h)&&e.marker.color!==h?h:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":533,"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546,"./subtypes":866}],863:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function i(t,e,r,n,i,d,g){function m(t){return A?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,r,n=t[0].trace,i=o.select(this),a=c.hasMarkers(n),u=c.hasText(n),h=x(n),f=b,d=b;a&&(f=n.marker.maxdisplayed?v:s.identity),u&&(d=n.marker.maxdisplayed?v:s.identity),r=i.selectAll("path.point"),e=r.data(f,h);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,n).call(l.translatePoints,k,T,n),A&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=m(o.select(this));l.translatePoint(t,e,k,T),l.singlePointStyle(t,e,n)}),A?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=i.selectAll("g"),e=r.data(d,h),e.enter().append("g").append("text"),e.each(function(t){var e=m(o.select(this).select("text"));l.translatePoint(t,e,k,T)}),e.selectAll("text").call(l.textPointStyle,n).each(function(t){var e=t.xp||k.c2p(t.x),r=t.yp||T.c2p(t.y);o.select(this).selectAll("tspan").each(function(){m(o.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,M;a(t,e,r,n,i);var A=!!g&&g.duration>0,k=r.xaxis,T=r.yaxis,E=n[0].trace,S=E.line,L=o.select(d);if(L.call(u.plot,r,g),E.visible===!0){m(L).style("opacity",E.opacity);var z,C,I=E.fill.charAt(E.fill.length-1);"x"!==I&&"y"!==I&&(I=""),n[0].node3=L,h(n);var P="",D=[],O=E._prevtrace;O&&(P=O._prevRevpath||"",C=O._nextFill,D=O._polygons);var R,F,j,N,B,U,V,q,H,G="",X="",Y=[],W=[],Z=s.noop;if(z=E._ownFill,c.hasLines(E)||"none"!==E.fill){for(C&&C.datum(n),["hv","vh","hvh","vhv"].indexOf(S.shape)!==-1?(j=l.steps(S.shape),N=l.steps(S.shape.split("").reverse().join(""))):j=N="spline"===S.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),S.smoothing):l.smoothopen(t,S.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return N(t.reverse())},Y=f(n,{xaxis:k,yaxis:T,connectGaps:E.connectgaps,baseTolerance:Math.max(S.width||1,3)/4,linear:"linear"===S.shape,simplify:S.simplify}),H=E._polygons=new Array(Y.length),M=0;M1}),Z=function(t){return function(e){if(R=j(e),F=B(e),G?I?(G+="L"+R.substr(1),X=F+("L"+X.substr(1))):(G+="Z"+R,X=F+"Z"+X):(G=R,X=F),c.hasLines(E)&&e.length>1){var r=o.select(this);if(r.datum(n),t)m(r.style("opacity",0).attr("d",R).call(l.lineGroupStyle)).style("opacity",1);else{var i=m(r);i.attr("d",R),l.singleLineStyle(n,i)}}}}}var Q=L.selectAll(".js-line").data(W);m(Q.exit()).style("opacity",0).remove(),Q.each(Z(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Z(!0)),Y.length&&(z?U&&q&&(I?("y"===I?U[1]=q[1]=T.c2p(0,!0):"x"===I&&(U[0]=q[0]=k.c2p(0,!0)),m(z).attr("d","M"+q+"L"+U+"L"+G.substr(1))):m(z).attr("d",G+"Z")):"tonext"===E.fill.substr(0,6)&&G&&P&&("tonext"===E.fill?m(C).attr("d",G+"Z"+P+"Z"):m(C).attr("d",G+"L"+P.substr(1)+"Z"),E._polygons=E._polygons.concat(D)),E._prevRevpath=X,E._prevPolygons=H);var K=L.selectAll(".points");w=K.data([n]),K.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,s=r.yaxis,l=o.extent(a.range.map(a.r2l).map(a.l2c)),u=o.extent(s.range.map(s.r2l).map(s.l2c)),h=n[0].trace;if(c.hasMarkers(h)){var f=h.marker.maxdisplayed;if(0!==f){var d=n.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/f),g=0;i.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),h=c.data(r,function(t){return t[0].trace.uid}),h.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,r),n(t,p),l=0,u=[];ln?1:-1}),m){s&&(f=s());var v=o.transition().duration(a.duration).ease(a.easing).each("end",function(){f&&f()}).each("interrupt",function(){f&&f()});v.each(function(){p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)})})}else p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)});g&&h.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":556,"../../components/errorbars":562,"../../lib":633,"../../lib/polygon":640,"./arrays_to_calcdata":845,"./line_points":858,"./link_traces":860,"./subtypes":866,d3:95}],864:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,h=[],f=l[0].trace,d=f.index,p=f.marker,g=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return M[t]}function u(t,e,r,n,i){var a=null;if(Array.isArray(t)){a=[];for(var o=0;o=0){var f=i(l.position,l.delaunayColor,l.delaunayAxis);f.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(f):(f.gl=o,this.delaunayMesh=m(f),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},k.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=f},{"../../constants/gl3d_dashes":614,"../../constants/gl_markers":615,"../../lib":633,"../../lib/gl_format_color":631,"../../lib/str2rgbarray":646,"../scatter/make_bubble_size_func":861,"./calc_errors":871,"delaunay-triangulate":96,"gl-error3d":133,"gl-line3d":140,"gl-mesh3d":173,"gl-scatter3d":216}],873:[function(t,e,r){"use strict";function n(t,e,r){var n=0,i=r("x"),a=r("y"),o=r("z");return i&&a&&o&&(n=Math.min(i.length,a.length,o.length),n=0&&f("surfacecolor",p||g);for(var m=["x","y","z"],v=0;v<3;++v){var y="projection."+m[v];f(y+".show")&&(f(y+".opacity"),f(y+".scale"))}u(t,e,r,{axis:"z"}),u(t,e,r,{axis:"y",inherit:"z"}),u(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":561,"../../lib":633,"../scatter/line_defaults":857,"../scatter/marker_defaults":862,"../scatter/subtypes":866,"../scatter/text_defaults":867,"./attributes":869}],874:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl_markers":615,"../../plots/gl3d":703,"../scatter/colorbar":849,"./attributes":869,"./calc":870,"./convert":872,"./defaults":873}],875:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),a=t("../../components/colorscale/color_attributes"),o=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={lon:{valType:"data_array"},lat:{valType:"data_array"},locations:{valType:"data_array"},locationmode:{valType:"enumerated",values:["ISO-3","USA-states","country names"],dflt:"ISO-3"},mode:o({},n.mode,{dflt:"markers"}),text:o({},n.text,{}),textfont:n.textfont,textposition:n.textposition,line:{color:l.color,width:l.width,dash:l.dash},connectgaps:n.connectgaps,marker:o({},{symbol:s.symbol,opacity:s.opacity,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,colorbar:s.colorbar,line:o({},{width:u.width},a("marker.line"))},a("marker")),fill:{valType:"enumerated",values:["none","toself"],dflt:"none"},fillcolor:n.fillcolor,hoverinfo:o({},i.hoverinfo,{flags:["lon","lat","location","text","name"]})}},{"../../components/colorscale/color_attributes":540,"../../lib/extend":626,"../../plots/attributes":662,"../scatter/attributes":846}],876:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../scatter/colorscale_calc");e.exports=function(t,e){for(var r=Array.isArray(e.locations),a=r?e.locations.length:e.lon.length,o=[],s=0,l=0;l0&&(o[s-1].gapAfter=!0):(s++,o.push(c))}return i(e),o}},{"../scatter/colorscale_calc":850,"fast-isnumeric":104}],877:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=0,o=r("locations");return o?(r("locationmode"),a=o.length):(n=r("lon")||[],i=r("lat")||[],a=Math.min(n.length,i.length),a")}var i=t("../../plots/cartesian/graph_interact"),a=t("../../plots/cartesian/axes"),o=t("../scatter/get_trace_color"),s=t("./attributes");e.exports=function(t){function e(t){return c.projection(t)}function r(t){var r=t.lonlat;if(null===r[0]||null===r[1])return 1/0;if(c.isLonLatOverEdges(r))return 1/0;var n=e(r),i=l.c2p(),a=u.c2p(),o=Math.abs(i-n[0]),s=Math.abs(a-n[1]),h=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(o*o+s*s)-h,1-3/h)}var a=t.cd,s=a[0].trace,l=t.xa,u=t.ya,c=t.subplot;if(!a[0].placeholder&&(i.getClosest(a,r,t),t.index!==!1)){var h=a[t.index],f=h.lonlat,d=e(f),p=h.mrc||1;return t.x0=d[0]-p,t.x1=d[0]+p,t.y0=d[1]-p,t.y1=d[1]+p,t.loc=h.loc,t.lat=f[0],t.lon=f[1],t.color=o(s,h),t.extraText=n(s,h,c.mockAxis),[t]}}},{"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"../scatter/get_trace_color":854,"./attributes":875}],880:[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.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.moduleType="trace",n.name="scattergeo",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/geo":688,"../scatter/colorbar":849,"./attributes":875,"./calc":876,"./defaults":877,"./event_data":878,"./hover":879,"./plot":881}],881:[function(t,e,r){"use strict";function n(t,e){if(!Array.isArray(t.locations))return u.identity;var r=c(t,e),n=t.locationmode;return function(t){var e=h(n,t.loc,r);return e?(t.lonlat=e.properties.ct,t):(t.lonlat=[null,null],!1)}}function i(t,e,r){function n(t,n){d(t,e,n,r)}var i=t.marker;if(n(t.text,"tx"),n(t.textposition,"tp"),t.textfont&&(n(t.textfont.size,"ts"),n(t.textfont.color,"tc"),n(t.textfont.family,"tf")),i&&i.line){var a=i.line;n(i.opacity,"mo"),n(i.symbol,"mx"),n(i.color,"mc"),n(i.size,"ms"),n(a.color,"mlc"),n(a.width,"mlw")}}function a(t){var e=t.framework.selectAll("g.trace.scattergeo");e.style("opacity",function(t){return t[0].trace.opacity}),e.each(function(t){var e=t[0].trace,r=o.select(this);r.selectAll("path.point").call(s.pointStyle,e),r.selectAll("text").call(s.textPointStyle,e)}),e.selectAll("path.js-line").style("fill","none").each(function(t){var e=o.select(this),r=t.trace,n=r.line||{};e.call(l.stroke,n.color).call(s.dashLine,n.dash||"",n.width||0),"none"!==r.fill&&e.call(l.fill,r.fillcolor)})}var o=t("d3"),s=t("../../components/drawing"),l=t("../../components/color"),u=t("../../lib"),c=t("../../lib/topojson_utils").getTopojsonFeatures,h=t("../../lib/geo_location_utils").locationToFeature,f=t("../../lib/geojson_utils"),d=t("../../lib/array_to_calc_item"),p=t("../scatter/subtypes");e.exports=function(t,e){function r(t){return t[0].trace.uid}var s=t.framework.select(".scattergeolayer").selectAll("g.trace.scattergeo").data(e,r);s.enter().append("g").attr("class","trace scattergeo"),s.exit().remove(),s.selectAll("*").remove(),s.each(function(e){var r=o.select(this),a=e[0].trace,s=n(a,t.topojson);e[0].placeholder&&r.remove();for(var l=[],u=0;u=e.length?i:e[a]);return n}function o(t,e,r){return l(C(t,r),z(e,r),r)}function s(t,e,r,n){var i=w(t,e,n);return i=Array.isArray(i[0])?i:a(m.identity,[i],n),l(i,z(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;i0&&(v[y-1].gapAfter=!0)}return v}},{"../../components/colorscale":547,"../../lib":633,"../scatter/colorscale_calc":850,"../scatter/make_bubble_size_func":861,"../scatter/subtypes":866,"fast-isnumeric":104}],888:[function(t,e,r){"use strict";function n(){return{geojson:h.makeBlank(),layout:{visibility:"none"},paint:{}}}function i(t,e){function r(t,r,n,i){void 0===e[r][n]&&(e[r][n]=i),t[r]=e[r][n]}for(var n=t[0].trace,i=n.marker,a=Array.isArray(i.color),o=Array.isArray(i.size),s=[],l=0;l")}var i=t("../../plots/cartesian/graph_interact"),a=t("../scatter/get_trace_color");e.exports=function(t,e,r){function o(t){var e=t.lonlat,n=Math.abs(u.c2p(e)-u.c2p([d,e[1]])),i=Math.abs(c.c2p(e)-c.c2p([e[0],r])),a=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(n*n+i*i)-a,1-3/a)}var s=t.cd,l=s[0].trace,u=t.xa,c=t.ya;if(!s[0].placeholder){var h=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),f=360*h,d=e-f;if(i.getClosest(s,o,t),t.index!==!1){var p=s[t.index],g=p.lonlat,m=[g[0]+f,g[1]],v=u.c2p(m),y=c.c2p(m),x=p.mrc||1;return t.x0=v-x,t.x1=v+x,t.y0=y-x,t.y1=y+x,t.color=a(l,p),t.extraText=n(l,p),[t]}}}},{"../../plots/cartesian/graph_interact":671,"../scatter/get_trace_color":854}],892:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.plot=t("./plot"),n.moduleType="trace",n.name="scattermapbox",n.basePlotModule=t("../../plots/mapbox"),n.categories=["mapbox","gl","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/mapbox":718,"../scatter/colorbar":849,"./attributes":886,"./calc":887,"./defaults":889,"./event_data":890,"./hover":891,"./plot":893}],893:[function(t,e,r){"use strict";function n(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.mapbox.initSource(this.idSourceFill),this.mapbox.initSource(this.idSourceLine),this.mapbox.initSource(this.idSourceCircle),this.mapbox.initSource(this.idSourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle,source:this.idSourceCircle,type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var a=t("./convert"),o=n.prototype;o.update=function(t){var e=this.mapbox,r=a(t);e.setOptions(this.idLayerFill,"setLayoutProperty",r.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",r.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",r.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",r.symbol.layout),i(r.fill)&&(e.setSourceData(this.idSourceFill,r.fill.geojson), -e.setOptions(this.idLayerFill,"setPaintProperty",r.fill.paint)),i(r.line)&&(e.setSourceData(this.idSourceLine,r.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",r.line.paint)),i(r.circle)&&(e.setSourceData(this.idSourceCircle,r.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",r.circle.paint)),i(r.symbol)&&(e.setSourceData(this.idSourceSymbol,r.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",r.symbol.paint))},o.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var r=e[0].trace,i=new n(t,r.uid);return i.update(e),i}},{"./convert":888}],894:[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,u=n.line,c=l.line;e.exports={a:{valType:"data_array"},b:{valType:"data_array"},c:{valType:"data_array"},sum:{valType:"number",dflt:0,min:0},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},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},a("marker".line))},a("marker"),{showscale:l.showscale,colorbar:o}),textfont:n.textfont,textposition:n.textposition,hoverinfo:s({},i.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron}},{"../../components/colorbar/attributes":534,"../../components/colorscale/color_attributes":540,"../../lib/extend":626,"../../plots/attributes":662,"../scatter/attributes":846}],895:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=t("../scatter/subtypes"),s=t("../scatter/colorscale_calc"),l=["a","b","c"],u={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,c,h,f,d,p,g=t._fullLayout[e.subplot],m=g.sum,v=e.sum||m;for(r=0;rA&&E.splice(A,E.length-A)}return s(e),"undefined"!=typeof E&&a.mergeArray(E,k,"ms"),k}},{"../../lib":633,"../../plots/cartesian/axes":664,"../scatter/colorscale_calc":850,"../scatter/subtypes":866,"fast-isnumeric":104}],896:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),a=t("../scatter/subtypes"),o=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/line_shape_defaults"),u=t("../scatter/text_defaults"),c=t("../scatter/fillcolor_defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function d(r,i){return n.coerce(t,e,h,r,i)}var p,g=d("a"),m=d("b"),v=d("c");if(g?(p=g.length,m?(p=Math.min(p,m.length),v&&(p=Math.min(p,v.length))):p=v?Math.min(p,v.length):0):m&&v&&(p=Math.min(m.length,v.length)),!p)return void(e.visible=!1);g&&p"),s}}},{"../../plots/cartesian/axes":664,"../scatter/hover":855}],898:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/ternary":732,"../scatter/colorbar":849,"./attributes":894,"./calc":895,"./defaults":896,"./hover":897,"./plot":899,"./select":900,"./style":901}],899:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e){var r=t.plotContainer;r.select(".scatterlayer").selectAll("*").remove();for(var i={xaxis:t.xaxis,yaxis:t.yaxis,plot:r},a=new Array(e.length),o=t.graphDiv.calcdata,s=0;s":return function(t){return e(t)>n};case">=":return function(t){return e(t)>=n};case"[]":return function(t){var r=e(t);return r>=n[0]&&r<=n[1]};case"()":return function(t){var r=e(t);return r>n[0]&&r=n[0]&&rn[0]&&r<=n[1]};case"][":return function(t){var r=e(t);return r<=n[0]||r>=n[1]};case")(":return function(t){var r=e(t);return rn[1]};case"](":return function(t){var r=e(t);return r<=n[0]||r>n[1]};case")[":return function(t){var r=e(t);return r=n[1]};case"{}":return function(t){return n.indexOf(e(t))!==-1};case"}{":return function(t){return n.indexOf(e(t))===-1}}}var o=t("../lib"),s=t("../plot_api/plot_schema"),l=t("../plots/cartesian/axis_ids"),u=t("../plots/cartesian/axis_autotype"),c=t("../plots/cartesian/set_convert"),h=["=","<",">=",">","<="],f=["[]","()","[)","(]","][",")(","](",")["],d=["{}","}{"];r.moduleType="transform",r.name="filter",r.attributes={enabled:{valType:"boolean",dflt:!0},target:{valType:"string",strict:!0,noBlank:!0,arrayOk:!0,dflt:"x"},operation:{valType:"enumerated",values:[].concat(h).concat(f).concat(d),dflt:"="},value:{valType:"any",dflt:0}},r.supplyDefaults=function(t){function e(e,i){return o.coerce(t,n,r.attributes,e,i)}var n={},i=e("enabled");return i&&(e("operation"),e("value"),e("target")),n},r.calcTransform=function(t,e,r){function l(t,r){var n=g[t],i=o.nestedProperty(e,t).get();i.push(n[r])}if(r.enabled){var u=r.target,c=n(e,u),h=c.length;if(h){for(var f=i(t,e,u),d=a(r,f),p=s.findArrayAttributes(e),g={},m=0;mn.width-(n.margin.r+n.margin.l)&&(x=0,m+=v,i.height=i.height+v,v=0),h.setTranslate(this,a+x,5+a+e.height/2+m),i.width+=o+r,i.height=Math.max(i.height,e.height),x+=o+r,v=Math.max(e.height,v)}),i.width+=2*a,i.height+=10+2*a,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0],n=u.select(this).select(".legendtoggle");n.call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center");var i="top";w.isBottomAnchor(r)?i="bottom":w.isMiddleAnchor(r)&&(i="middle"),f.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";w.isRightAnchor(r)?n="right":w.isCenterAnchor(r)&&(n="center"),f.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),h=t("../../lib"),f=t("../../plots/plots"),d=t("../../registry"),p=t("../dragelement"),g=t("../drawing"),m=t("../color"),v=t("../../lib/svg_text_utils"),y=t("./constants"),x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils");e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(h.setTranslate,0,e),S.call(g.setRect,N,t,y.scrollBarWidth,y.scrollBarHeight),k.select("rect").attr({y:v.borderwidth-e})}var r=t._fullLayout,a="legend"+r._uid;if(r._infolayer&&t.calcdata){var v=r.legend,_=r.showlegend&&x(t.calcdata,v),M=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+a).remove(),void f.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var k=r._topdefs.selectAll("#"+a).data([0]);k.enter().append("clipPath").attr("id",a).append("rect");var T=A.selectAll("rect.bg").data([0]);T.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),T.call(m.stroke,v.bordercolor),T.call(m.fill,v.bgcolor),T.style("stroke-width",v.borderwidth+"px");var E=A.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var S=A.selectAll("rect.scrollbar").data([0]);S.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var L=E.selectAll("g.groups").data(_);L.enter().append("g").attr("class","groups"),L.exit().remove();var z=L.selectAll("g.traces").data(h.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(b).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var C=0!==A.enter().size();C&&(o(t,L,z),s(t));var I=0,P=r.width,D=0,O=r.height;o(t,L,z),v.height>O?l(t):s(t);var R=r._size,F=R.l+R.w*v.x,j=R.t+R.h*(1-v.y);w.isRightAnchor(v)?F-=v.width:w.isCenterAnchor(v)&&(F-=v.width/2),w.isBottomAnchor(v)?j-=v.height:w.isMiddleAnchor(v)&&(j-=v.height/2);var N=v.width,B=R.w;N>B?(F=R.l,N=B):(F+N>P&&(F=P-N),FV?(j=R.t,U=V):(j+U>O&&(j=O-U),jr[1])return r[1]}return i}function r(t){return t[0]}var n,i,a=t[0],o=a.trace,s=d.hasMarkers(o),u=d.hasText(o),f=d.hasLines(o);if(s||u||f){var p={},g={};s&&(p.mc=e("marker.color",r),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",r),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),f&&(g.line={width:e("line.width",r,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",r),p.ts=10,p.tc=e("textfont.color",r),p.tf=e("textfont.family",r)),n=[c.minExtend(a,p)],i=c.minExtend(o,g)}var m=l.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(s?n:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(h.pointStyle,i),s&&(n[0].mrc=3);var y=m.selectAll("g.pointtext").data(u?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(h.textPointStyle,i)}function a(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(f.fill,t.mc||r.color),e&&i.call(f.stroke,t.mlc||n.color)})}function o(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(f.fill,t.fc||e.fillcolor),r&&n.call(f.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(p,t[0],e)}var l=t("d3"),u=t("../../registry"),c=t("../../lib"),h=t("../drawing"),f=t("../color"),d=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":633,"../../registry":739,"../../traces/pie/style_one":840,"../../traces/scatter/subtypes":866,"../color":533,"../drawing":556,d3:95}],578:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,f=(1+c)/2,d=(1-c)/2,p=h.list(t,null,!0),g=0;g1)return n(["resetViews","toggleHover"]),o(m,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=i(s),y=[];return((u||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(u||g)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||v||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(m,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(p){var g=i(e,r,l);c("x",g[0]),c("y",g[1]),a.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),a.coerceFont(c,"font",r.font);var m=c("bgcolor");c("activecolor",o.contrast(m,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":633,"../color":533,"./attributes":582,"./button_attributes":583,"./constants":584}],586:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=f)));return p>=d?[d,p]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;se;a--)f(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),i(t,a)}function c(t,e,r,n){function i(r){var n={"data-index":e,"fill-rule":"evenodd",d:p(t,L)},i=L.line.width?L.line.color:"rgba(0,0,0,0)",a=r.append("path").attr(n).style("opacity",L.opacity).call(_.stroke,i).call(_.fill,L.fillcolor).call(w.dashLine,L.line.dash,L.line.width);z&&a.call(w.setClipUrl,"clip"+t._fullLayout._uid+z),t._context.editable&&h(t,a,L,e)}var a,o;f(t,e).selectAll('[data-index="'+e+'"]').remove();var s=t.layout.shapes[e];if(s){var l={};"string"==typeof r&&r?l[r]=n:x.isPlainObject(r)&&(l=r);var u=Object.keys(l);for(a=0;aX&&n>Y&&!t.shiftKey?M.getCursor(i/r,1-a/n):"move";A(e,o),G=o.split("-")[0]}function a(e){N=b.getFromId(t,r.xref),B=b.getFromId(t,r.yref),U=T.getDataToPixel(t,N),V=T.getDataToPixel(t,B,!0),q=T.getPixelToData(t,N),H=T.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(F=r.path,j=a+".path"):(c=U(r.x0),h=V(r.y0),f=U(r.x1),d=V(r.y1),g=a+".x0",v=a+".y0",x=a+".x1",_=a+".y1"),cY&&(u[L]=r[P]=H(s),u[z]=r[D]=H(l)),h-c>X&&(u[C]=r[O]=q(c),u[I]=r[R]=q(h))}e.attr("d",p(t,r))}var u,c,h,f,d,g,v,x,_,w,k,E,S,L,z,C,I,P,D,O,R,F,j,N,B,U,V,q,H,G,X=10,Y=10,W={setCursor:i,element:e.node(),prepFn:a,doneFn:o},Z=W.element.getBoundingClientRect();M.init(W)}function f(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):x.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=b.getFromId(t,r.id,"x")._id,i=b.getFromId(t,r.id,"y")._id,a="below"===e.layer,o=n===e.xref||i===e.yref,s=!!r.shapelayer;return a&&o&&s}function p(t,e){var r,n,i,a,o=e.type,s=b.getFromId(t,e.xref),l=b.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=T.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=T.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=T.decodeDate(n)),l&&"date"===l.type&&(a=T.decodeDate(a)),g(e.path,n,a);var c=n(e.x0),h=n(e.x1),f=a(e.y0),d=a(e.y1);if("line"===o)return"M"+c+","+f+"L"+h+","+d;if("rect"===o)return"M"+c+","+f+"H"+h+"V"+d+"H"+c+"Z";var p=(c+h)/2,m=(f+d)/2,v=Math.abs(p-c),y=Math.abs(m-f),x="A"+v+","+y,_=p+v+","+m,w=p+","+(m-y);return"M"+_+x+" 0 1,1 "+w+x+" 0 0,1 "+_+"Z"}function g(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),x.log("Ignoring extra params in segment "+t)),i+l})}function m(t,e,r){return t.replace(k.segmentRE,function(t){var n=0,i=t.charAt(0),a=k.paramIsX[i],o=k.paramIsY[i],s=k.numParams[i],l=t.substr(1).replace(k.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)});return i+l})}var v=t("fast-isnumeric"),y=t("../../plotly"),x=t("../../lib"),b=t("../../plots/cartesian/axes"),_=t("../color"),w=t("../drawing"),M=t("../dragelement"),A=t("../../lib/setcursor"),k=t("./constants"),T=t("./helpers"),E=t("./shape_defaults"),S=t("./defaults");e.exports={draw:n,drawOne:i}},{"../../lib":633,"../../lib/setcursor":643,"../../plotly":659,"../../plots/cartesian/axes":664,"../color":533,"../dragelement":554,"../drawing":556,"./constants":596,"./defaults":597,"./helpers":599,"./shape_defaults":601,"fast-isnumeric":104}],599:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],600:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"./attributes":594,"./calc_autorange":595,"./defaults":597,"./draw":598}],601:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,a,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject);if(!c)return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var h=t.path?"path":"rect",f=u("type",h),d=["x","y"],p=0;p<2;p++){var g=d[p],m={_fullLayout:r},v=i.coerceRef(t,e,m,g,"","paper");if("path"!==f){var y,x,b,_=.25,w=.75;"paper"!==v?(y=i.getFromId(m,v),b=o.rangeToShapePosition(y),x=o.shapePositionToRange(y)):x=b=n.identity;var M=g+"0",A=g+"1",k=t[M],T=t[A];t[M]=x(t[M],!0),t[A]=x(t[A],!0),i.coercePosition(e,m,u,v,M,_),i.coercePosition(e,m,u,v,A,w),e[M]=b(e[M]),e[A]=b(e[A]),t[M]=k,t[A]=T}}return"path"===f?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":633,"../../plots/cartesian/axes":664,"./attributes":594,"./helpers":599}],602:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../lib/extend").extendDeep,s=t("../../plots/animation_attributes"),l=t("./constants"),u={_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"}};e.exports={_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:u,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:o({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:a({},n,{})},font:a({},n,{}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}}},{"../../lib/extend":626,"../../plots/animation_attributes":660,"../../plots/font_attributes":684,"../../plots/pad_attributes":723,"./constants":603}],603:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],604:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);if(l){n("active"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font);var u=n("currentvalue.visible");u&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),a.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.steps||[],s=e.steps=[],l=0;l0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*L.gripWidth)+","+e.currentValueTotalHeight+")")}}function v(t,e){return t.inputAreaStart+L.stepInset+(t.inputAreaLength-2*L.stepInset)*Math.min(1,Math.max(0,e))}function y(t,e){return Math.min(1,Math.max(0,(e-L.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*L.stepInset-2*t.inputAreaStart)))}function x(t,e,r){var n=t.selectAll("rect."+L.railTouchRectClass).data([0]);n.enter().append("rect").classed(L.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,L.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),A.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+L.railRectClass).data([0]);r.enter().append("rect").classed(L.railRectClass,!0);var n=e.inputAreaLength-2*L.railInset;r.attr({width:n,height:L.railWidth,rx:L.railRadius,ry:L.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(r,L.railInset,.5*(e.inputAreaWidth-L.railWidth)+e.currentValueTotalHeight)}function _(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(s.enter().append("g").classed(L.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+L.groupClassName).data(r,i);l.enter().append("g").classed(L.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,L.autoMarginIdRoot+e._index)});for(var u=0;u0||f<0){var d={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+d+")")}}}function p(){E=0,S=!0,L=C,M._infolayer.select("."+e).attr({"data-unformatted":L}).text(L).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0); +})}var g=r.propContainer,m=r.propName,v=r.traceIndex,y=r.dfltName,x=r.avoid||{},b=r.attributes,_=r.transform,w=r.containerGroup,M=t._fullLayout,A=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,S=!1,L=g.title.trim();""===L&&(E=0),L.match(/Click to enter .+ title/)&&(E=.2,S=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(L).attr("class",e),z.attr({"data-unformatted":L}).call(h);var C="Click to enter "+y+" title";t._context.editable?(L||p(),z.call(c.makeEditable).on("edit",function(e){void 0!==v?a.restyle(t,m,e,v):a.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):L&&!L.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",S)}},{"../../lib":633,"../../lib/svg_text_utils":647,"../../plotly":659,"../../plots/plots":724,"../color":533,"../drawing":556,d3:95,"fast-isnumeric":104}],608:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:"updatemenu",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:s,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({},o,{}),font:a({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":626,"../../plots/font_attributes":684,"../../plots/pad_attributes":723,"../color/attributes":532}],609:[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,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],610:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}var o=i(t,e),l=n("visible",o.length>0);l&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),a.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),a.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return a.coerce(n,i,c,t,e)}for(var n,i,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(u.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),u.exit().remove(),u.exit().size()&&y(t),0!==r.length){var c=u.selectAll("g."+T.headerGroupClassName).data(r,i);c.enter().append("g").classed(T.headerGroupClassName,!0);var h=u.selectAll("g."+T.dropdownButtonGroupClassName).data([0]);h.enter().append("g").classed(T.dropdownButtonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&h.call(v).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){x.select(this).remove(),h.call(v).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],618:[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}},{}],619:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.20.2",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/legend"),t("./components/annotations"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":531,"./components/images":568,"./components/legend":576,"./components/rangeselector":588,"./components/rangeslider":593,"./components/shapes":600,"./components/sliders":606,"./components/updatemenus":612,"./fonts/mathjax_config":620,"./lib/queue":641,"./plot_api/plot_schema":653,"./plot_api/register":654,"./plot_api/set_plot_config":655,"./plot_api/to_image":657,"./plot_api/validate":658,"./plotly":659,"./snapshot":744,"./snapshot/download":741,"./traces/scatter":856,d3:95,"es6-promise":101}],620:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],621:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],622:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+/,o=/['"%,$#\s']+$/;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"").replace(o,"")),n(t)?Number(t):i}},{"../constants/numerical":616,"fast-isnumeric":104}],623:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../components/colorscale/get_scale"),o=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),s=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),n.values.indexOf(t)===-1?e.set(r):e.set(t)}},boolean:{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r||"string"==typeof t&&!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if((n.extras||[]).indexOf(t)!==-1)return void e.set(t);for(var i=t.split("+"),a=0;a=d&&t<=p?t:l;if("string"!=typeof t&&"number"!=typeof t)return l;var e,n,i,o,s=String(t).trim().split(" ");if(s.length>2)return l;var u=s[0].split("-"),c=!0;""===u[0]&&(c=!1,u.splice(0,1));var g=u.length;if(g>3||3!==g&&s[1]||!g)return l;if(4===u[0].length)e=Number(u[0]);else{if(2!==u[0].length)return l;if(!c)return l;var m=(new Date).getFullYear();e=((Number(u[0])-m+70)%100+200)%100+m-70}if(!a(e))return l;var v=new Date(0,0,1);if(v.setFullYear(c?e:-e),u.length>1){if(n=Number(u[1])-1,u[1].length>2||!(n>=0&&n<=11))return l;if(v.setMonth(n),u.length>2){if(i=Number(u[2]),u[2].length>2||!(i>=1&&i<=31))return l;if(v.setDate(i),v.getDate()!==i)return l;if(s[1]){if(u=s[1].split(":"),u.length>3)return l;if(o=Number(u[0]),u[0].length>2||!u[0].length||!(o>=0&&o<=23))return l;if(v.setHours(o),v.getHours()!==o)return l;if(u.length>1)return i=v.getTime(),n=Number(u[1]),2===u[1].length&&n>=0&&n<=59?(i+=h*n,2===u.length?i:2!==u[2].split(".")[0].length?l:(t=Number(u[2]),t>=0&&t<60?i+t*f:l)):l}}}return v.getTime()},d=r.MIN_MS=r.dateTime2ms("-9999"),p=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t){return r.dateTime2ms(t)!==l};var g=90*u,m=3*c,v=5*h;r.ms2DateTime=function(t,e){if("number"!=typeof t||!(t>=d&&t<=p))return l;e||(e=0);var r=new Date(Math.floor(t)),a=i.time.format("%Y-%m-%d")(r),o=e0&&(n.push(i),i=[])}return n.push(i),n},r.makeLine=function(t,e){var r={};return r=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t},e&&(r.trace=e),r},r.makePolygon=function(t,e){var r={};if(1===t.length)r={type:"Polygon",coordinates:t};else{for(var n=new Array(t.length),i=0;i",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function a(t){return t.replace(/\<.*\>/g,"")}function o(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.noop=function(){},i.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o,s=Math.log(Math.pow(2,r))/Math.log(n),l="";for(i=2;s===1/0;i*=2)s=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var u=s-Math.floor(s);for(i=0;i-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,e<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=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]*u[n];c[r]=a}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],a=o(e),a&&a.then)return a.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,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}},{"./clean_number":622,"./coerce":623,"./dates":624,"./extend":626,"./filter_unique":627,"./filter_visible":628,"./is_array":634,"./is_plain_object":635,"./loggers":636,"./matrix":637,"./nested_property":638,"./notifier":639,"./search":642,"./stats":645,d3:95}],634:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)}},{}],635:[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}},{}],636:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e],o=!1,f(n))for(r=n.length-1;r>=0;r--)u(n[r])?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)u(n[a[r]])&&!i(n[a[r]],a[r])?delete n[a[r]]:o=!0;if(o)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(f(t)?!t.length:!Object.keys(t).length)}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric"),f=t("./is_array");e.exports=function(t,e){if(h(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,l=e.split(".");sa||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],l=t[1];if(ra||ls)return!1;var u,c,h,f,d,p=n.length,g=n[0][0],m=n[0][1],v=0;for(u=1;uMath.max(c,g)||l>Math.max(h,m)))if(lc||Math.abs(n(o,f))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(o+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":637}],641:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],a=0;aa.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,h=0,f=e.length,d=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?o:a;h90&&l.log("Long binary search..."),h-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,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,u=r?Math.ceil:Math.floor;it.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":104}],646:[function(t,e,r){"use strict";function n(t){return t=i(t),a.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),a=t("arraytools");e.exports=n},{arraytools:33,tinycolor2:489}],647:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function a(t,e,r){var n="math-output-"+f.randstr([],64),a=h.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var e=h.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())f.log("There was an error in the tex syntax.",t),r();else{var n=a.select("svg").node().getBoundingClientRect();r(a.select(".MathJax_SVG"),e,n)}a.remove()})}function o(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=g[n];if(void 0!==i){var a=e[1],o=e[3],s=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(a)return"
";if("href"!==o.substr(0,4).toLowerCase())return"";var u=o.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,m.indexOf(c.protocol)===-1?"":''}if("br"===n)return"
";if(a)return"sup"===n?'':"sub"===n?'':"";var h=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var a=0;n.forEach(function(t){for(var r=t+a,n=e.slice(0,r),i="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(i=n[o]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),a+=2)});var o=e.join(""),u=o.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},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()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}var h=t("d3"),f=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");h.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(f.log(r.querySelector("parsererror div").textContent),null):h.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=h.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){d.empty()||(p=s.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),o=u(i),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,d=h.select(s.node().parentNode);if(!d.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(l){var m=f.getPlotDiv(s.node());(m&&m._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};a(l[2],i,function(i,a,o){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:p,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var h=n(l,"width"),f=n(l,"height"),g=+s.attr("x")-h*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],m=parseInt(s.style("font-size"),10)||n(s,"height"),v=-m/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-h/2,v-f/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:v-f/2}):"a"===p[0]?l.attr({x:0,y:v}):l.attr({x:g,y:+s.attr("y")+v-f/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(v," ")},r.makeEditable=function(t,e,r){function n(){a(),o.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(o.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function a(){var t=h.select(f.getPlotDiv(o.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":o.style("font-family")||"Arial","font-size":o.style("font-size")||12,color:r.fill||o.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(o.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||o.attr("data-unformatted")).call(c(o,e,r)).on("blur",function(){o.text(this.textContent).style({opacity:1});var t,e=h.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(o.node().parentNode).select(t).style({opacity:0});var r=this.textContent;h.select(this).transition().duration(0).remove(),h.select(document).on("mouseup",null),s.edit.call(o,r)}).on("focus",function(){var t=this;h.select(document).on("mouseup",function(){return h.event.target!==t&&void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===h.event.which?(o.style({opacity:1}),h.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(o,this.textContent)):(s.input.call(o,this.textContent),h.select(this).call(c(o,e,r)))}).on("keydown",function(){13===h.event.which&&this.blur()}).call(i)}r||(r={});var o=this,s=h.dispatch("edit","input","cancel"),l=h.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),h.rebind(this,s,"on")}},{"../constants/string_mappings":617,"../constants/xmlns_namespaces":618,"../lib":633,d3:95}],648:[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":686,"topojson-client":491}],649:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0&&u.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);var i=h.list({_fullLayout:t});for(e=0;e3?(m.x=1.02,m.xanchor="left"):m.x<-2&&(m.x=-.02,m.xanchor="right"),m.y>3?(m.y=1.02,m.yanchor="bottom"):m.y<-2&&(m.y=-.02,m.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var v=c.getSubplotIds(t,"gl3d");for(e=0;e=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&s(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lC.range[0]?[1,2]:[2,1]);else{var I=C.range[0],P=C.range[1];"log"===b?(I<=0&&P<=0&&r(E+".autorange",!0),I<=0?I=P/1e6:P<=0&&(P=I/1e6),r(E+".range[0]",Math.log(I)/Math.LN10),r(E+".range[1]",Math.log(P)/Math.LN10)):(r(E+".range[0]",Math.pow(10,I)),r(E+".range[1]",Math.pow(10,P)))}else r(E+".autorange",!0)}if("reverse"===k)S.range?S.range.reverse():(r(E+".autorange",!0),S.range=[1,0]),L.autorange?d.docalc=!0:d.doplot=!0;else if("annotations"===v.parts[0]||"shapes"===v.parts[0]){var D=v.parts[1],O=v.parts[0],R=a[O]||[],F=R[D]||{};2===v.parts.length&&(null===b&&(e[m]="remove"),"add"===e[m]||x.isPlainObject(e[m])?g[m]="remove":"remove"===e[m]?D===-1?(g[O]=R,delete g[m]):g[m]=F:x.log("???",e)),!n(F,"x")&&!n(F,"y")||x.containsAny(m,["color","opacity","align","dash"])||(d.docalc=!0);var j=w.getComponentMethod(O,"drawOne");j(t,D,v.parts.slice(2).join("."),e[m]),delete e[m]}else if(M.layoutArrayContainers.indexOf(v.parts[0])!==-1||"mapbox"===v.parts[0]&&"layers"===v.parts[1])z.manageArrayContainers(v,b,g),d.doplot=!0;else{var N=String(v.parts[1]||"");0===v.parts[0].indexOf("scene")?d.doplot=!0:0===v.parts[0].indexOf("geo")?d.doplot=!0:0===v.parts[0].indexOf("ternary")?d.doplot=!0:"paper_bgcolor"===m?d.doplot=!0:!o._has("gl2d")||m.indexOf("axis")===-1&&"plot_bgcolor"!==v.parts[0]?"hiddenlabels"===m?d.docalc=!0:v.parts[0].indexOf("legend")!==-1?d.dolegend=!0:m.indexOf("title")!==-1?d.doticks=!0:v.parts[0].indexOf("bgcolor")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&x.containsAny(N,["tick","exponent","grid","zeroline"])?d.doticks=!0:m.indexOf(".linewidth")!==-1&&m.indexOf("axis")!==-1?d.doticks=d.dolayoutstyle=!0:v.parts.length>1&&N.indexOf("line")!==-1?d.dolayoutstyle=!0:v.parts.length>1&&"mirror"===N?d.doticks=d.dolayoutstyle=!0:"margin.pad"===m?d.doticks=d.dolayoutstyle=!0:"margin"===v.parts[0]||"autorange"===v.parts[1]||"rangemode"===v.parts[1]||"type"===v.parts[1]||"domain"===v.parts[1]||m.match(/^(bar|box|font)/)?d.docalc=!0:["hovermode","dragmode"].indexOf(m)!==-1?d.domodebar=!0:["hovermode","dragmode","height","width","autosize"].indexOf(m)===-1&&(d.doplot=!0):d.doplot=!0,v.set(b)}}}var B=t._fullLayout.width,U=t._fullLayout.height;M.supplyDefaults(t),t.layout.autosize&&M.plotAutoSize(t,t.layout,t._fullLayout);var V=e.height||e.width||t._fullLayout.width!==B||t._fullLayout.height!==U;return V&&(d.docalc=!0),(d.doplot||d.docalc)&&(d.layoutReplot=!0),{flags:d,undoit:g,redoit:p,eventData:x.extendDeep({},p)}}function g(t){var e=m.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];m.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=x.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(S.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var m=t("d3"),v=t("fast-isnumeric"),y=t("../plotly"),x=t("../lib"),b=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),M=t("../plots/plots"),A=t("../plots/cartesian/graph_interact"),k=t("../plots/polar"),T=t("../components/drawing"),E=t("../components/errorbars"),S=t("../constants/xmlns_namespaces"),L=t("../lib/svg_text_utils"),z=t("./helpers"),C=t("./subroutines");y.plot=function(t,e,r,n){function o(){if(_)return y.addFrames(t,_)}function s(){for(var e=I._basePlotModules,r=0;r=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=z.getGraphDiv(t),!x.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 animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]),r=M.supplyAnimationDefaults(r);var s=r.transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,u){function c(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}function h(e){if(0!==e.length){for(var s=0;so._timeToNext&&d()};e()}function g(t){return Array.isArray(s)?y>=s.length?t.transitionOpts=s[y]:t.transitionOpts=s[0]:t.transitionOpts=s,y++,t}var m,v,y=0,b=[],_=void 0===e||null===e,w=Array.isArray(e),A=!_&&!w&&x.isPlainObject(e);if(A)b.push({type:"object",data:g(x.extendFlat({},e))});else if(_||"string"==typeof e)for(m=0;m0&&EE)&&S.push(v);b=S}}b.length>0?h(b):(t.emit("plotly_animated"),l())})},y.addFrames=function(t,e,r){if(t=z.getGraphDiv(t),null===e||void 0===e)return Promise.resolve();if(!x.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,i,a,o,s=t._transitionData._frames,l=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=s.length+2*e.length,c=[];for(n=e.length-1;n>=0;n--)c.push({frame:M.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n});c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if(i=c[n].frame,!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=M.modifyFrames,l=M.modifyFrames,u=[t,o],c=[t,a];return _&&_.add(t,s,u,l,c),M.modifyFrames(t,a)},y.purge=function(t){t=z.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return M.cleanPlot([],{},r,e),M.purge(t),b.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":556,"../components/errorbars":562,"../constants/xmlns_namespaces":618,"../lib":633,"../lib/events":625,"../lib/queue":641,"../lib/svg_text_utils":647,"../plotly":659,"../plots/cartesian/graph_interact":671,"../plots/plots":724,"../plots/polar":727,"../registry":739,"./helpers":650,"./subroutines":656,d3:95,"fast-isnumeric":104}],652:[function(t,e,r){"use strict";function n(t,r){try{t._fullLayout._paper.style("background",r)}catch(t){e.exports.logging>0&&console.error(t)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:!1,globalTransforms:[]}},{}],653:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:y},r={}):(e=f.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,_(n,p),_(n,e.attributes),r.attributes&&_(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};_(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}function i(){var t={};return _(t,g),Object.keys(f.subplotsRegistry).forEach(function(e){var r=f.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)c(t,r,"xaxis"),c(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;c(t,r,n)}}),t=u(t),Object.keys(f.componentsRegistry).forEach(function(e){var r=f.componentsRegistry[e];r.layoutAttributes&&(Array.isArray(r.layoutNodes)?r.layoutNodes.forEach(function(e){h(t,r,e+r.name)}):h(t,r,r.name))}),{layoutAttributes:o(t)}}function a(t){var e=f.transformsRegistry[t];return{attributes:o(e.attributes)}}function o(t){return s(t),l(t),t}function s(t){function e(t){return{valType:"string"}}function n(t,n,i){r.isValObject(t)?"data_array"===t.valType?(t.role="data",i[n+"src"]=e(n)):t.arrayOk===!0&&(i[n+"src"]=e(n)):d.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function l(t){function e(t,e,r){if(t){var n=t[M];n&&(delete t[M],r[e]={items:{}},r[e].items[n]=t,r[e].role="object")}}r.crawl(t,e)}function u(t){return b(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),b(t,x.layout),t}function c(t,e,r){var n=d.nestedProperty(t,r),i=_({},e.layoutAttributes);i[w]=!0,n.set(i)}function h(t,e,r){var n=d.nestedProperty(t,r),i=_(n.get()||{},e.layoutAttributes);n.set(i)}var f=t("../registry"),d=t("../lib"),p=t("../plots/attributes"),g=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),v=t("../plots/animation_attributes"),y=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),b=d.extendFlat,_=d.extendDeep,w="_isSubplotObj",M="_isLinkedToArray",A="_deprecated",k=[w,M,A];r.IS_SUBPLOT_OBJ=w,r.IS_LINKED_TO_ARRAY=M,r.DEPRECATED=A,r.UNDERSCORE_ATTRS=k,r.get=function(){var t={};f.allTypes.concat("area").forEach(function(e){t[e]=n(e)});var e={};return Object.keys(f.transformsRegistry).forEach(function(t){e[t]=a(t)}),{defs:{valObjects:d.valObjects,metaKeys:k.concat.role},traces:t,layout:i(),transforms:e,frames:o(m),animation:o(v)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];k.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||d.isPlainObject(a)&&r.crawl(a,e,i+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){a=a.slice(0,s).concat([r]);var l="data_array"===e.valType||e.arrayOk===!0;if(l){var u=n(a),c=d.nestedProperty(t,u).get();Array.isArray(c)&&i.push(u)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s1)};f(e.width)&&f(e.height)||n(new Error("Height and width should be pixel values."));var d=l(t,{format:"png",height:e.height,width:e.width}),p=d.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);a.plot(p,d.data,d.layout,d.config).then(g).then(h).then(function(t){r(t)}).catch(function(t){n(t)})});return r}var i=t("fast-isnumeric"),a=t("../plotly"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/cloneplot"),u=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg");e.exports=n},{"../lib":633,"../plotly":659,"../snapshot/cloneplot":740,"../snapshot/helpers":743,"../snapshot/svgtoimg":745,"../snapshot/tosvg":747,"fast-isnumeric":104}],658:[function(t,e,r){"use strict";function n(t,e,r,i,a,u){u=u||[];for(var c=Object.keys(t),f=0;f1&&l.push(o("object","layout"))),f.supplyDefaults(u);for(var c=u._fullData,m=r.length,v=0;vc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12===0?"y":"m";else if(e>=z&&i<=10||e>=15*z)t._tickround="d";else if(e>=I&&i<=16||e>=C)t._tickround="M";else if(e>=P&&i<=19||e>=I)t._tickround="S";else{var a=_.ms2DateTime(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(x(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);x(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}else t._tickround=null}function o(t,e){var r=t.match(W),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),a=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(W,a))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,a,s=e.x,l=t._tickround,u=l,c=new Date(s);r&&t.hoverformat?a=o(t.hoverformat,s):t.tickformat?a=o(t.tickformat,s):(n&&(x(l)?l+=2:l={y:"m",m:"d",d:"M",M:"S",S:2}[l]),"y"===l?a=V(c):"m"===l?a=q(c):"d"===l?(r||(i="
"+V(c)),a=H(c)):(r||(i="
"+G(c)),a=X(c),"M"!==l?(a+=Y(c),"S"!==l&&(a+=f(y.round(v(s/1e3,1),4),t,"none",r).substr(1))):"d"===u&&(a=H(c)+" "+a))),!i||t._inCalcTicks&&i===t._prevSuffix||(a+=i,t._prevSuffix=i),e.text=a}function u(t,e,r,n,i){var a=t.dtick,o=e.x;if(!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),t.tickformat||"string"==typeof a&&"L"===a.charAt(0))e.text=f(Math.pow(10,o),t,i,n);else if(x(a)||"D"===a.charAt(0)&&v(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=f(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,v(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function h(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=f(e.x,t,i,n)}function f(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat,c=e.separatethousands;if(n){var h={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};a(h),o=(Number(h._tickround)||0)+4,l=h._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-o)/2;if("none"===s&&(l=0),t=Math.abs(t),t12||l<-15)?t+="e"+g:"E"===s?t+="E"+g:"power"===s?t+="\xd710"+g+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=Z[l/3+5])}return i?"\u2212"+t:t}function d(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},D.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&h/c>f&&(l=o,u=s,f=h/c);if(n===i){var g=n-1,m=n+1;r="tozero"===t.rangemode?n<0?[g,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,g),Math.max(0,m)]:[g,m]}else f&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-f*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),f=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-f*l.pad,u.val+f*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),r.map(t.l2r||Number)},D.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=D.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},D.saveRangeInitial=function(t,e){for(var r=D.list(t,"",!0),n=!1,i=0;i=f?d=!1:s.val>=u&&s.pad<=f&&(t._min.splice(o,1),o--);d&&t._min.push({val:u,pad:y&&0===u?0:f})}if(n(c)){for(d=!0,o=0;o=c&&s.pad>=h?d=!1:s.val<=c&&s.pad<=h&&(t._max.splice(o,1),o--);d&&t._max.push({val:c,pad:y&&0===c?0:h})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,u,c,h,f,d,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=m-1;a>5;a--)i(a)}},D.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/h.dtick)%100<2}var a=_.aggNums(Math.min,null,t),o=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:a-.5,end:o+.5,size:1};var s;if(r)s=(o-a)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var h;h="log"===e.type?{type:"linear",range:[a,o],r2l:Number}:{type:e.type,range:[a,o].map(e.l2r),r2l:e.r2l},D.autoTicks(h,s);var f,d=D.tickIncrement(D.tickFirst(h),h.dtick,"reverse");if("number"==typeof h.dtick){for(var p=0,g=0,m=0,v=0,y=0;y.3*b||i(a)||i(o))){var w=h.dtick/2;d+=d+w0&&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),a(t),t._tmin=D.tickFirst(t);var o=e[1]=l:u<=l)&&(s.push(u),!(s.length>1e3));u=D.tickIncrement(u,t.dtick,o));t._tmax=s[s.length-1],t._prevSuffix="",t._inCalcTicks=!0;for(var c=new Array(s.length),h=0;hS?(e/=S,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,R)):n>L?(e/=L,t.dtick="M"+i(e,1,F)):n>z?(t.dtick=i(e,z,N),t.tick0="2000-01-02"):n>C?t.dtick=i(e,C,F):n>I?t.dtick=i(e,I,j):n>P?t.dtick=i(e,P,j):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,R))}else if("log"===t.type){t.tick0=0;var a=t.range.map(t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var o=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,R)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,R));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},D.tickIncrement=function(t,e,r){var n=r?-1:1;if(x(e))return t+n*e;var i=e.charAt(0),a=n*Number(e.substr(1));if("M"===i){var o=new Date(t);return o.setMonth(o.getMonth()+a)}if("L"===i)return Math.log(Math.pow(10,t)+a)/Math.LN10;if("D"===i){var s="D2"===e?U:B,l=t+.01*n,u=_.roundUp(v(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},D.tickFirst=function(t){var e=t.r2l||Number,r=t.range.map(e),n=r[1]a:h1&&e2*n}function a(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t){return i(t)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],666:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);r.indexOf("scene")!==-1&&(r=n);var s=o(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(a(s,n)){for(var l,c=i(s),h=[],f=0;f0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],669:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],DFLTRANGEDATE:["2000-01-01","2001-01-01"]}},{}],670:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function a(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function o(t){var e=["lasso","select"];return e.indexOf(t)!==-1}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../registry"),h=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),g=t("../../lib/setcursor"),m=t("../../components/dragelement"),v=t("./axes"),y=t("./select"),x=t("./constants"),b=!0;e.exports=function(t,e,r,s,_,w,M,A){function k(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+gt+", "+mt+")").attr("d",ut+"Z"),dt=pt.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+gt+", "+mt+")").attr("d","M0,0Z"),S()}function S(){pt.selectAll(".select-outline").remove()}function L(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(q,e+at)),i=Math.max(0,Math.min(H,r+ot)),a=Math.abs(n-at),o=Math.abs(i-ot),s=Math.floor(Math.min(o,a,X)/2);st.l=Math.min(at,n),st.r=Math.max(at,n),st.t=Math.min(ot,i),st.b=Math.max(ot,i),!J||o.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),dt.transition().style("opacity",1).duration(200),ct=!0)}function z(t,e,r){var n,i,a;for(n=0;nzoom back out","long"),b=!1)))}function I(e,r){var i=1===(M+A).length;if(e)F();else if(2!==r||i){if(1===r&&i){var a=M?V[0]:U[0],o="s"===M||"w"===A?0:1,s=a._name+".range["+o+"]",l=n(a,o),c="left",h="middle";if(a.fixedrange)return;M?(h="n"===M?"top":"bottom","right"===a.side&&(c="right")):"e"===A&&(c="right"),rt.call(f.makeEditable,null,{immediate:!0,background:N.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:h}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&u.relayout(t,s,r)})}}else R()}function P(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=t.range.map(t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||N._enablescrollzoom){if(t._transitioningWithDuration)return h.pauseEvent(e);var n=t.querySelector(".plotly");if(T(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(yt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void h.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=bt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=vt[0]+vt[2]*l,c=(s.bottom-e.clientY)/s.height,f=vt[1]+vt[3]*(1-c);if(A){for(a=0;a=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function a(t,e,r){for(var n,a,o=1-e,s=0;s0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;nW.width||Y<0||Y>W.height)return _.unhoverRaw(t,e)}else X="xpx"in e?e.xpx:A[0]._length/2,Y="ypx"in e?e.ypx:k[0]._length/2;if(C="xval"in e?n(a,e.xval):i(A,X),I="yval"in e?n(a,e.yval):i(k,Y),!g(C[0])||!g(I[0]))return m.warn("Fx.hover failed",e,t),_.unhoverRaw(t,e)}var Z=1/0;for(D=0;D1||R.hoverinfo.indexOf("name")!==-1?R.name:void 0,index:!1,distance:Math.min(Z,M.MAXDIST),color:x.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},o[F]&&(V.subplot=o[F]._subplot),q=H.length,"array"===N){var Q=e[D];"pointNumber"in Q?(V.index=Q.pointNumber,N="closest"):(N="","xval"in Q&&(B=Q.xval,N="x"),"yval"in Q&&(U=Q.yval,N=N?"closest":"y"))}else B=C[j],U=I[j];if(R._module&&R._module.hoverPoints){var K=R._module.hoverPoints(V,B,U,N);if(K)for(var $,J=0;Jq&&(H.splice(0,q),Z=H[0].distance)}if(0===H.length)return _.unhoverRaw(t,e);var tt="y"===z&&G.length>1;H.sort(function(t,e){return t.distance-e.distance});var et=x.combine(o.plot_bgcolor||x.background,o.paper_bgcolor),rt={hovermode:z,rotateLabels:tt,bgColor:et,container:o._hoverlayer,outerContainer:o._paperdiv},nt=u(H,rt);c(H,tt?"xa":"ya"),h(nt,tt);var it=t._hoverdata,at=[];for(P=0;P128?"#000":x.background;if(t.name&&void 0===t.zLabelVal){var c=document.createElement("p");c.innerHTML=t.name,r=c.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.extraText&&(n+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"
"),n+=(n?"z: ":"")+t.zLabel):k&&t[i+"Label"]===g?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(n+=(n?"
":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var h=e.select("text.nums").style("fill",u).call(b.setPosition,0,0).text(n).attr("data-notex",1).call(y.convertToTspans);h.selectAll("tspan.line").call(b.setPosition,0,0);var f=e.select("text.name"),m=0;r&&r!==n?(f.style("fill",l).text(r).call(b.setPosition,0,0).attr("data-notex",1).call(y.convertToTspans),f.selectAll("tspan.line").call(b.setPosition,0,0),m=f.node().getBoundingClientRect().width+2*P):(f.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var v,M,T=h.node().getBoundingClientRect(),S=t.xa._offset+(t.x0+t.x1)/2,L=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),C=Math.abs(t.y1-t.y0),D=T.width+I+P+m;t.ty0=_-T.top,t.bx=T.width+2*P,t.by=T.height+2*P,t.anchor="start",t.txwidth=T.width,t.tx2width=m,t.offset=0,a?(t.pos=S,v=L+C/2+D<=A,M=L-C/2-D>=0,"top"!==t.idealAlign&&v||!M?v?(L+=C/2,t.anchor="start"):t.anchor="middle":(L-=C/2,t.anchor="end")):(t.pos=L,v=S+z/2+D<=w,M=S-z/2-D>=0,"left"!==t.idealAlign&&v||!M?v?(S+=z/2,t.anchor="start"):t.anchor="middle":(S-=z/2,t.anchor="end")),h.attr("text-anchor",t.anchor),m&&f.attr("text-anchor",t.anchor),e.attr("transform","translate("+S+","+L+")"+(a?"rotate("+E+")":""))}),L}function c(t,e){function r(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 u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)l=t[o],l.pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(var n,i,a,o,s,l,u,c=0,h=t.map(function(t,r){var n=t[e];return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===n._id.charAt(0)?L:1)/2,pmin:n._offset,pmax:n._offset+n._length}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&p.pmin===g.pmin&&p.pmax===g.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(f.push.apply(f,d),h.splice(o+1,1),u=0,s=f.length-1;s>=0;s--)u+=f[s].dp;for(a=u/f.length,s=f.length-1;s>=0;s--)f[s].dp-=a;n=!1}else o++}h.forEach(r)}for(o=h.length-1;o>=0;o--){var m=h[o];for(s=m.length-1;s>=0;s--){var v=m[s],y=t[v.i];y.offset=v.dp,y.del=v.del}}}function h(t,e){t.each(function(t){var r=d.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(I+P),s=o+a*(t.txwidth+P),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-C,l=t.offset*z),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*I+l)+","+(I+u)+"v"+(t.by/2-I)+"h"+n*t.bx+"v-"+t.by+"H"+(n*I+l)+"V"+(u-I)+"Z"),i.call(b.setPosition,o+l,u+t.ty0-t.by/2+P).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(b.setPosition,s+a*P+l,u+t.ty0-t.by/2+P),r.select("rect").call(b.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function f(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var d=t("d3"),p=t("tinycolor2"),g=t("fast-isnumeric"),m=t("../../lib"),v=t("../../lib/events"),y=t("../../lib/svg_text_utils"),x=t("../../components/color"),b=t("../../components/drawing"),_=t("../../components/dragelement"),w=t("./axes"),M=t("./constants"),A=t("./dragbox"),k=t("../layout_attributes"),T=e.exports={};T.unhover=_.unhover,T.layoutAttributes={},T.supplyLayoutDefaults=function(t,e,r){ +function n(r,n){return m.coerce(t,e,k,r,n)}n("dragmode");var i;if(e._has("cartesian")){var a=e._isHoriz=T.isHoriz(r);i=a?"y":"x"}else i="closest";n("hovermode",i)},T.isHoriz=function(t){for(var e=!0,r=0;rt._lastHoverTime+M.HOVERMINTIME?(o(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){o(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME))},T.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||a(e,r):"x"===t?e:r},T.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.indexh[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":633,"fast-isnumeric":104}],677:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),a=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=i.filter,u=i.tester,c=s.MINSELECT;e.exports=function(t,e,r,i,h){function f(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.gd._fullLayout._zoomlayer,m=i.element.getBoundingClientRect(),v=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,x=e-m.left,b=r-m.top,_=x,w=b,M="M"+x+","+b,A=i.xaxes[0]._length,k=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),S=i.xaxes.concat(i.yaxes);"lasso"===h&&(p=l([[x,b]],s.BENDPX));var L=g.selectAll("path.select-outline").data([1,2]);L.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+v+", "+y+")").attr("d",M+"Z");var z,C,I,P,D,O=g.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),R=[],F=i.gd,j=[];for(z=0;z0)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*h*Math.abs(n-i))}return l}function r(t){return Math.pow(10,t)}function o(t){return i(t)?(t=Number(t),t<-s||t>s?l:i(t)?Number(t):l):l}var h=10;t.c2l="log"===t.type?e:o,t.l2c="log"===t.type?r:o,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.cleanRange=function(e){e||(e="range");var r,n,o=t[e],l=(t._id||"x").charAt(0);if(n="date"===t.type?u.DFLTRANGEDATE:"y"===l?u.DFLTRANGEY:u.DFLTRANGEX,n=n.slice(),!o||2!==o.length)return void(t[e]=n);for("date"===t.type&&(o[0]=a.cleanDate(o[0]),o[1]=a.cleanDate(o[1])),r=0;r<2;r++)if("date"===t.type){if(!a.isDateTime(o[r])){t[e]=n;break}if(o[r]a.MAX_MS&&(o[r]=a.MAX_MS),t.r2l(o[0])===t.r2l(o[1])){var c=a.constrain(t.r2l(o[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);o[0]=t.l2r(c-1e3),o[1]=t.l2r(c+1e3);break}}else{if(!i(o[r])){if(!i(o[1-r])){t[e]=n;break}o[r]=o[1-r]*(r?10:.1)}if(o[r]<-s?o[r]=-s:o[r]>s&&(o[r]=s),o[0]===o[1]){var h=Math.max(1,Math.abs(1e-6*o[0]));o[0]-=h,o[1]+=h}}},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.setScale=function(e){var r=t._gd._fullLayout._size,n=t._id.charAt(0);if(t._categories||(t._categories=[]),t.overlaying){var i=c.getFromId(t._gd,t.overlaying);t.domain=i.domain}var o=e&&t._r?"_r":"range";t.cleanRange(o);var s=t.r2l(t[o][0]),l=t.r2l(t[o][1]);if("y"===n?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b))throw a.notifier("Something went wrong with axis scaling","long"),t._gd._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return i(e)?n.round(t._b+t._m*e,2):l},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},t.r2p=function(e,r){return t.l2p(t.r2l(e,r))},t.p2r=function(e){return t.l2r(t.p2l(e))},t.r2c=function(e){return t.l2c(t.r2l(e))},t.c2r=function(e){return t.l2r(t.c2l(e))},["linear","log","-"].indexOf(t.type)!==-1?(t.c2d=o,t.d2c=a.cleanNumber,"log"===t.type?(t.d2l=function(e,r){return t.c2l(t.d2c(e),r)},t.d2r=t.d2l,t.r2d=t.l2d):(t.d2l=a.cleanNumber,t.d2r=a.cleanNumber,t.r2d=o),t.r2l=o,t.l2r=o):"date"===t.type?(t.c2d=a.ms2DateTime,t.d2c=function(t){var e=a.dateTime2ms(t);if(e===l){if(!i(t))return l;e=Number(t)}return a.constrain(e,a.MIN_MS,a.MAX_MS)},t.d2l=t.d2c,t.r2l=t.d2c,t.l2r=t.c2d,t.d2r=a.identity,t.r2d=a.identity,t.cleanr=function(e){return t.c2d(t.d2c(e))}):"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){null!==e&&void 0!==e&&t._categories.indexOf(e)===-1&&t._categories.push(e);var r=t._categories.indexOf(e);return r===-1?l:r},t.d2l=t.d2c,t.r2l=o,t.l2r=o,t.d2r=t.d2c,t.r2d=t.c2d),t.makeCalcdata=function(e,r){var n,i,a;if(r in e)for(n=e[r],i=new Array(n.length),a=0;a0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var h=c.charAt(0),f=c.substr(1);f=n(f)?Number(f):0,(f<=0||!("date"===o&&"M"===h&&f===Math.round(f)||"log"===o&&"L"===h||"log"===o&&"D"===h&&(1===f||2===f)))&&(e.dtick=u)}var d="date"===o?"2000-01-01":0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{var g=r("tickvals");void 0===g?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],682:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../lib"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(t){var e,r,n,i,a,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(i=y[u],a={},Array.isArray(t[e])?a.to=t[e].slice(0):Array.isArray(t[e].range)&&(a.to=t[e].range.slice(0)),!a.to)continue;a.axisName=u,a.length=i._length,x.push(s),o[s]=a}return o}function h(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(s.indexOf(l)===-1){var u=l.xaxis._id,c=l.yaxis._id,h=l.xaxis.range,f=l.yaxis.range;l.xaxis._r=l.xaxis.range.slice(),l.yaxis._r=l.yaxis.range.slice(),i=r[u]?r[u].to:h,a=r[c]?r[c].to:f,h[0]===i[0]&&h[1]===i[1]&&f[0]===a[0]&&f[1]===a[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}function f(e,r){function n(e,r){for(i=0;ir.duration?(g(),T=window.cancelAnimationFrame(v)):T=window.requestAnimationFrame(v)}var y=t._fullLayout,x=[],b=c(e),_=Object.keys(b),w=h(y,_,b);if(!w.length)return!1;var M;u&&(M=u());var A,k,T,E=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(T),T=null,m()}),A=Date.now(),T=window.requestAnimationFrame(v),Promise.resolve()}},{"../../lib":633,"../../plotly":659,"../../registry":739,"./axes":664,d3:95}],683:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=u.nestedProperty(n,e.prop).get(),a=r[e.type]=r[e.type]||{},a.hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){return Array.isArray(e[0])&&1===e[0].length&&"string"==typeof e[0][0]?[{type:"layout",prop:"_currentFrame",value:e[0][0]}]:[]}function a(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!u.isPlainObject(n))return r;i=n}return s(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function o(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!u.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),s(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;u.isPlainObject(a)?s(a,e,o,n+1):e(o,i,a)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(l)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(l){n(t,l,o.cache),o.check=function(){if(s){var e=n(t,l,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:l.type,prop:l.prop,traces:l.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],h=0;hi},M.render=function(){function t(t){var e=r.projection(t.lonlat);return e?"translate("+e[0]+","+e[1]+")":null}function e(t){return r.isLonLatOverEdges(t.lonlat)?"0":"1.0"}var r=this,n=r.framework,i=n.select("g.choroplethlayer"),a=n.select("g.scattergeolayer"),o=r.path;n.selectAll("path.basepath").attr("d",o),n.selectAll("path.graticulepath").attr("d",o),i.selectAll("path.choroplethlocation").attr("d",o),i.selectAll("path.basepath").attr("d",o),a.selectAll("path.js-line").attr("d",o),null!==r.clipAngle?(a.selectAll("path.point").style("opacity",e).attr("transform",t),a.selectAll("text").style("opacity",e).attr("transform",t)):(a.selectAll("path.point").attr("transform",t),a.selectAll("text").attr("transform",t))}},{"../../components/color":533,"../../components/drawing":556,"../../constants/xmlns_namespaces":618,"../../lib/topojson_utils":648,"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"./constants":686,"./projections":694,"./set_scale":695,"./zoom":696,"./zoom_reset":697,d3:95,"topojson-client":491}],688:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;nn^d>n&&r<(f-u)*(n-c)/(d-c)+u&&(i=!i)}return i}function o(t){return t?t/Math.sin(t):1}function s(t){return t>1?I:t<-1?-I:Math.asin(t)}function l(t){return t>1?0:t<-1?C:Math.acos(t)}function u(t,e){var r=(2+I)*Math.sin(e);e/=2;for(var n=0,i=1/0;n<10&&Math.abs(i)>L;n++){var a=Math.cos(e);e-=i=(e+Math.sin(e)*(a+2)-r)/(2*a*(1+a))}return[2/Math.sqrt(C*(4+C))*t*(1+Math.cos(e)),2*Math.sqrt(C/(4+C))*Math.sin(e)]}function c(t,e){function r(r,n){var i=F(r/e,n);return i[0]*=t,i}return arguments.length<2&&(e=t),1===e?F:e===1/0?f:(r.invert=function(r,n){var i=F.invert(r/t,n);return i[0]*=e,i},r)}function h(){var t=2,e=R(c),r=e(t);return r.coefficient=function(r){return arguments.length?e(t=+r):t},r}function f(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function d(t,e){return[3*t/(2*C)*Math.sqrt(C*C/3-e*e),e]}function p(t,e){return[t,1.25*Math.log(Math.tan(C/4+.4*e))]}function g(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)>L&&--i>0);return e/2}}function m(t,e,r){function n(r,n){return[t*r*Math.cos(n=i(n)),e*Math.sin(n)]}var i=g(r);return n.invert=function(n,i){var a=s(i/e);return[n/(t*Math.cos(a)),s((2*a+Math.sin(2*a))/r)]},n}function v(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(-.013791+n*(.003971*r-.001529*n))),e*(1.007226+r*(.015085+n*(-.044475+.028874*r-.005916*n)))]}function y(t,e){var r,n=Math.min(18,36*Math.abs(e)/C),i=Math.floor(n),a=n-i,o=(r=N[i])[0],s=r[1],l=(r=N[++i])[0],u=r[1],c=(r=N[Math.min(19,++i)])[0],h=r[1];return[t*(l+a*(c-o)/2+a*a*(c-2*l+o)/2),(e>0?I:-I)*(u+a*(h-s)/2+a*a*(h-2*u+s)/2)]}function x(t,e){return[t*Math.cos(e),e]}function b(t,e){var r=Math.cos(e),n=o(l(r*Math.cos(t/=2)));return[2*r*Math.sin(t)*n,Math.sin(e)*n]}function _(t,e){var r=b(t,e);return[(r[0]+t/I)/2,(r[1]+e)/2]}t.geo.project=function(t,e){var n=e.stream;if(!n)throw new Error("not yet supported");return(t&&w.hasOwnProperty(t.type)?w[t.type]:r)(t,n)};var w={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,r)})}}},M=[],A=[],k={point:function(t,e){M.push([t,e])},result:function(){var t=M.length?M.length<2?{type:"Point",coordinates:M[0]}:{type:"MultiPoint",coordinates:M}:null;return M=[],t}},T={lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){M.length&&(A.push(M),M=[])},result:function(){var t=A.length?A.length<2?{type:"LineString",coordinates:A[0]}:{type:"MultiLineString",coordinates:A}:null;return A=[],t}},E={polygonStart:n,lineStart:n,point:function(t,e){M.push([t,e])},lineEnd:function(){var t=M.length;if(t){do M.push(M[0].slice());while(++t<4);A.push(M),M=[]}},polygonEnd:n,result:function(){if(!A.length)return null;var t=[],e=[];return A.forEach(function(r){i(r)?t.push([r]):e.push(r)}),e.forEach(function(e){var r=e[0];t.some(function(t){if(a(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}},S={Point:k,MultiPoint:k,LineString:T,MultiLineString:T,Polygon:E,MultiPolygon:E,Sphere:E},L=1e-6,z=L*L,C=Math.PI,I=C/2,P=(Math.sqrt(C),C/180),D=180/C,O=t.geo.projection,R=t.geo.projectionMutator;t.geo.interrupt=function(e){function r(t,r){for(var n=r<0?-1:1,i=l[+(r<0)],a=0,o=i.length-1;ai[a][2][0];++a);var s=e(t-i[a][1][0],r);return s[0]+=e(i[a][1][0],n*r>n*i[a][0][1]?i[a][0][1]:r)[0],s}function n(){s=l.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]]})})}function i(){for(var e=1e-6,r=[],n=0,i=l[0].length;n=0;--n){var o=l[1][n],s=180*o[0][0]/C,u=180*o[0][1]/C,c=180*o[1][1]/C,h=180*o[2][0]/C,f=180*o[2][1]/C;r.push(a([[h-e,f-e],[h-e,c+e],[s+e,c+e],[s+e,u-e]],30))}return{type:"Polygon",coordinates:[t.merge(r)]}}function a(t,e){for(var r,n,i,a=-1,o=t.length,s=t[0],l=[];++aL&&--i>0);return[t/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]},(t.geo.naturalEarth=function(){return O(v)}).raw=v;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}),y.invert=function(t,e){var r=e/I,n=90*r,i=Math.min(18,Math.abs(n/5)),a=Math.max(0,Math.floor(i));do{var o=N[a][1],s=N[a+1][1],l=N[Math.min(19,a+2)][1],u=l-o,c=l-2*s+o,h=2*(Math.abs(r)-s)/u,f=c/u,d=h*(1-f*h*(1-2*f*h));if(d>=0||1===a){n=(e>=0?5:-5)*(d+i);var p,g=50;do i=Math.min(18,Math.abs(n)/5),a=Math.floor(i),d=i-a,o=N[a][1],s=N[a+1][1],l=N[Math.min(19,a+2)][1],n-=(p=(e>=0?I:-I)*(s+d*(l-o)/2+d*d*(l-2*s+o)/2)-e)*D;while(Math.abs(p)>z&&--g>0);break}}while(--a>=0);var m=N[a][0],v=N[a+1][0],y=N[Math.min(19,a+2)][0];return[t/(v+d*(y-m)/2+d*d*(y-2*v+m)/2),n*P]},(t.geo.robinson=function(){return O(y)}).raw=y,x.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return O(x)}).raw=x,b.invert=function(t,e){if(!(t*t+4*e*e>C*C+L)){var r=t,n=e,i=25;do{var a,o=Math.sin(r),s=Math.sin(r/2),u=Math.cos(r/2),c=Math.sin(n),h=Math.cos(n),f=Math.sin(2*n),d=c*c,p=h*h,g=s*s,m=1-p*u*u,v=m?l(h*u)*Math.sqrt(a=1/m):a=0,y=2*v*h*s-t,x=v*c-e,b=a*(p*g+v*h*u*d),_=a*(.5*o*f-2*v*c*s),w=.25*a*(f*s-v*c*p*o),M=a*(d*u+v*g*h),A=_*w-M*b;if(!A)break;var k=(x*_-y*M)/A,T=(y*w-x*b)/A;r-=k,n-=T}while((Math.abs(k)>L||Math.abs(T)>L)&&--i>0);return[r,n]}},(t.geo.aitoff=function(){return O(b)}).raw=b,_.invert=function(t,e){var r=t,n=e,i=25;do{var a,o=Math.cos(n),s=Math.sin(n),u=Math.sin(2*n),c=s*s,h=o*o,f=Math.sin(r),d=Math.cos(r/2),p=Math.sin(r/2),g=p*p,m=1-h*d*d,v=m?l(o*d)*Math.sqrt(a=1/m):a=0,y=.5*(2*v*o*p+r/I)-t,x=.5*(v*s+n)-e,b=.5*a*(h*g+v*o*d*c)+.5/I,_=a*(f*u/4-v*s*p),w=.125*a*(u*p-v*s*h*f),M=.5*a*(c*d+v*g*o)+.5,A=_*w-M*b,k=(x*_-y*M)/A,T=(y*w-x*b)/A;r-=k,n-=T}while((Math.abs(k)>L||Math.abs(T)>L)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return O(_)}).raw=_}e.exports=n},{}],695:[function(t,e,r){"use strict";function n(t,e){var r=t.projection,n=t.lonaxis,o=t.lataxis,l=t.domain,u=t.framewidth||0,c=e.w*(l.x[1]-l.x[0]),h=e.h*(l.y[1]-l.y[0]),f=n.range[0]+s,d=n.range[1]-s,p=o.range[0]+s,g=o.range[1]-s,m=n._fullRange[0]+s,v=n._fullRange[1]-s,y=o._fullRange[0]+s,x=o._fullRange[1]-s;r._translate0=[e.l+c/2,e.t+h/2];var b=d-f,_=g-p,w=[f+b/2,p+_/2],M=r._rotate;r._center=[w[0]+M[0],w[1]+M[1]];var A=function(e){function n(t){return Math.min(_*c/(t[1][0]-t[0][0]),_*h/(t[1][1]-t[0][1]))}var o,s,l,b,_=e.scale(),w=r._translate0,M=i(f,p,d,g),A=i(m,y,v,x);l=a(e,M),o=n(l),b=a(e,A),r._fullScale=n(b),e.scale(o),l=a(e,M),s=[w[0]-l[0][0]+u,w[1]-l[0][1]+u],r._translate=s,e.translate(s),l=a(e,M),t._isAlbersUsa||e.clipExtent(l),o=r.scale*o,r._scale=o,t._width=Math.round(l[1][0])+u,t._height=Math.round(l[1][1])+u,t._marginX=(c-Math.round(l[1][0]))/2,t._marginY=(h-Math.round(l[1][1]))/2};return A}function i(t,e,r,n){var i=(r-t)/4;return{type:"Polygon",coordinates:[[[t,e],[t,n],[t+i,n],[t+2*i,n],[t+3*i,n],[r,n],[r,e],[r-i,e],[r-2*i,e],[r-3*i,e],[t,e]]]}}function a(t,e){return o.geo.path().projection(t).bounds(e)}var o=t("d3"),s=t("./constants").clipPad;e.exports=n},{"./constants":686,d3:95}],696:[function(t,e,r){"use strict";function n(t,e){var r;return(r=e._isScoped?a:e._clipAngle?s:o)(t,e.projection)}function i(t,e){var r=e._fullScale;return _.behavior.zoom().translate(t.translate()).scale(t.scale()).scaleExtent([.5*r,100*r])}function a(t,e){function r(){_.select(this).style(A)}function n(){o.scale(_.event.scale).translate(_.event.translate),t.render()}function a(){_.select(this).style(k)}var o=t.projection,s=i(o,e);return s.on("zoomstart",r).on("zoom",n).on("zoomend",a),s}function o(t,e){function r(t){return m.invert(t)}function n(t){var e=m(r(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function a(){_.select(this).style(A),l=_.mouse(this),u=m.rotate(),c=m.translate(),h=u,f=r(l)}function o(){return d=_.mouse(this),n(l)?(v.scale(m.scale()),void v.translate(m.translate())):(m.scale(_.event.scale),m.translate([c[0],_.event.translate[1]]),f?r(d)&&(g=r(d),p=[h[0]+(g[0]-f[0]),u[1],u[2]],m.rotate(p),h=p):(l=d,f=r(l)),void t.render())}function s(){_.select(this).style(k)}var l,u,c,h,f,d,p,g,m=t.projection,v=i(m,e),y=2;return v.on("zoomstart",a).on("zoom",o).on("zoomend",s),v}function s(t,e){function r(t){v++||t({type:"zoomstart"})}function n(t){t({type:"zoom"})}function a(t){--v||t({type:"zoomend"})}var o,s=t.projection,d={r:s.rotate(),k:s.scale()},p=i(s,e),g=b(p,"zoomstart","zoom","zoomend"),v=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(A);var t=_.mouse(this),e=s.rotate(),i=e,a=s.translate(),v=u(e);o=l(s,t),y.call(p,"zoom",function(){var r=_.mouse(this);if(s.scale(d.k=_.event.scale),o){if(l(s,r)){s.rotate(e).translate(a);var u=l(s,r),p=h(o,u),y=m(c(v,p)),x=d.r=f(y,o,i);isFinite(x[0])&&isFinite(x[1])&&isFinite(x[2])||(x=i),s.rotate(x),i=x}}else t=r,o=l(s,t);n(g.of(this,arguments))}),r(g.of(this,arguments))}).on("zoomend",function(){_.select(this).style(k),y.call(p,"zoom",null),a(g.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,g,"on")}function l(t,e){var r=t.invert(e);return r&&isFinite(r[0])&&isFinite(r[1])&&v(r)}function u(t){var e=.5*t[0]*w,r=.5*t[1]*w,n=.5*t[2]*w,i=Math.sin(e),a=Math.cos(e),o=Math.sin(r),s=Math.cos(r),l=Math.sin(n),u=Math.cos(n);return[a*s*u+i*o*l,i*s*u-a*o*l,a*o*u+i*s*l,a*s*l-i*o*u]}function c(t,e){var r=t[0],n=t[1],i=t[2],a=t[3],o=e[0],s=e[1],l=e[2],u=e[3];return[r*o-n*s-i*l-a*u,r*s+n*o+i*u-a*l,r*l-n*u+i*o+a*s,r*u+n*l-i*s+a*o]}function h(t,e){if(t&&e){var r=x(t,e),n=Math.sqrt(y(r,r)),i=.5*Math.acos(Math.max(-1,Math.min(1,y(t,e)))),a=Math.sin(i)/n;return n&&[Math.cos(i),r[2]*a,-r[1]*a,r[0]*a]}}function f(t,e,r){var n=g(e,2,t[0]);n=g(n,1,t[1]),n=g(n,0,t[2]-r[2]);var i,a,o=e[0],s=e[1],l=e[2],u=n[0],c=n[1],h=n[2],f=Math.atan2(s,o)*M,p=Math.sqrt(o*o+s*s);Math.abs(c)>p?(a=(c>0?90:-90)-f,i=0):(a=Math.asin(c/p)*M-f,i=Math.sqrt(p*p-c*c));var m=180-a-2*f,v=(Math.atan2(h,u)-Math.atan2(l,i))*M,y=(Math.atan2(h,u)-Math.atan2(l,-i))*M,x=d(r[0],r[1],a,v),b=d(r[0],r[1],m,y);return x<=b?[a,v,r[2]]:[m,y,r[2]]}function d(t,e,r,n){var i=p(r-t),a=p(n-e);return Math.sqrt(i*i+a*a)}function p(t){return(t%360+540)%360-180}function g(t,e,r){var n=r*w,i=t.slice(),a=0===e?1:0,o=2===e?1:2,s=Math.cos(n),l=Math.sin(n);return i[a]=t[a]*s-t[o]*l,i[o]=t[o]*s+t[a]*l,i}function m(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*M,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*M,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*M]}function v(t){var e=t[0]*w,r=t[1]*w,n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function y(t,e){for(var r=0,n=0,i=t.length;nh[d+2]&&(h[d]=-1,h[d+2]=1),f=this[v[d]],f._length=o.viewBox[d+2]-o.viewBox[d],s.doAutoRange(f);o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},y.calcDataBox=function(){var t=this.xaxis,e=this.yaxis,r=t.range,n=e.range,i=t.r2l,a=e.r2l;return[i(r[0]),a(n[0]),i(r[1]),a(n[1])]},y.setRanges=function(t){var e=this.xaxis,r=this.yaxis,n=e.l2r,i=r.l2r;e.range=[n(t[0]),n(t[2])],r.range=[i(t[1]),i(t[3])]},y.updateTraces=function(t,e){var r,n,i,a=Object.keys(this.traces);this.fullData=t;t:for(r=0;rMath.abs(e))n.rotate(o,0,0,-t*r*Math.PI*f.rotateSpeed/window.innerWidth);else{var s=-f.zoomSpeed*a*e/window.innerHeight*(o-n.lastT())/100;n.pan(o,0,0,u*(Math.exp(s)-1))}},!0),f}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":27,"mouse-change":413,"mouse-wheel":415,"right-now":459}],703:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<3;++r){var n=s[r];e[n]._gd=t}}var i=t("./scene"),a=t("../plots"),o=t("../../constants/xmlns_namespaces"),s=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,o=a.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var s=0;sf[1][o]?d[o]=1:f[1][o]===f[0][o]?d[o]=1:d[o]=1/(f[1][o]-f[0][o]);for(this.dataScale=d,a=0;ag[1][a])g[0][a]=-1,g[1][a]=1;else{var b=g[1][a]-g[0][a];g[0][a]-=b/32,g[1][a]+=b/32}}else{var w=c[T[a]].range;g[0][a]=w[0],g[1][a]=w[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]*d[a],this.glplot.bounds[1][a]=g[1][a]*d[a]}var M=[1,1,1];for(a=0;a<3;++a){l=c[T[a]],u=l.type;var A=y[u];M[a]=Math.pow(A.acc,1/A.count)/d[a]}var k,E=4;if("auto"===c.aspectmode)k=Math.max.apply(null,M)/Math.min.apply(null,M)<=E?M:[1,1,1];else if("cube"===c.aspectmode)k=[1,1,1];else if("data"===c.aspectmode)k=M;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var S=c.aspectratio;k=[S.x,S.y,S.z]}c.aspectratio.x=h.aspectratio.x=k[0],c.aspectratio.y=h.aspectratio.y=k[1],c.aspectratio.z=h.aspectratio.z=k[2],this.glplot.aspect=k;var L=c.domain||null,z=e._size||null;if(L&&z){var C=this.container.style;C.position="absolute",C.left=z.l+L.x[0]*z.w+"px",C.top=z.t+(1-L.y[1])*z.h+"px",C.width=z.w*(L.x[1]-L.x[0])+"px",C.height=z.h*(L.y[1]-L.y[0])+"px"}this.glplot.redraw()}},k.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},k.setCameraToDefault=function(){this.setCamera({eye:{x:1.25,y:1.25,z:1.25},center:{x:0,y:0,z:0},up:{x:0,y:0,z:1}})},k.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},k.setCamera=function(t){var e={};e[this.id]=t,this.glplot.camera.lookAt.apply(this,l(t)),this.graphDiv.emit("plotly_relayout",e)},k.saveCamera=function(t){function e(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]]}var r=this.getCamera(),n=p.nestedProperty(t,this.id+".camera"),i=n.get(),a=!1;if(void 0===i)a=!0;else for(var o=0;o<3;o++)for(var s=0;s<3;s++)if(!e(r,i,o,s)){a=!0;break}return a&&n.set(r),a},k.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},k.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(c),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var a=0,o=n-1;a0}function a(t){var e={},r={};switch(t.type){case"circle":s.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":s.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":s.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var n=t.symbol,i=l(n.textposition,n.iconsize);s.extendFlat(e,{"icon-image":n.icon+"-15","icon-size":n.iconsize/10,"text-field":n.text,"text-size":n.textfont.size,"text-anchor":i.anchor,"text-offset":i.offset}),s.extendFlat(r,{"icon-color":t.color,"text-color":n.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:r}}function o(t){var e,r=t.sourcetype,n=t.source,i={type:r},a="string"==typeof n;return"geojson"===r?e="data":"vector"===r&&(e=a?"url":"tiles"),i[e]=n,i}var s=t("../../lib"),l=t("./convert_text_opts"),u=n.prototype;u.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)&&this.updateLayer(t):(this.updateSource(t),this.updateLayer(t)),this.updateStyle(t),this.visible=i(t)},u.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},u.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},u.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,i(t)){var r=o(t);e.addSource(this.idSource,r)}},u.updateLayer=function(t){var e=this.map;if(e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,i(t)){e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type},t.below);var r={visibility:"visible"};this.mapbox.setOptions(this.idLayer,"setLayoutProperty",r)}},u.updateStyle=function(t){var e=a(t);i(t)&&(this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint))},u.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)},e.exports=function(t,e,r){var i=new n(t,e);return i.update(r),i}},{"../../lib":633,"./convert_text_opts":717}],720:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color").defaultLine,a=t("../font_attributes"),o=t("../../traces/scatter/attributes").textposition;e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},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:n.extendDeep({},a,{family:{dflt:"Open Sans Regular, Arial Unicode MS Regular"}}),textposition:n.extendFlat({},o,{arrayOk:!1})}}}},{"../../components/color":533,"../../lib":633,"../../traces/scatter/attributes":846,"../font_attributes":684}],721:[function(t,e,r){"use strict";function n(t,e,r){r("accesstoken"),r("style"),r("center.lon"),r("center.lat"),r("zoom"),r("bearing"),r("pitch"),i(t,e),e._input=t}function i(t,e){function r(t,e){return a.coerce(n,i,s.layers,t,e)}for(var n,i,o=t.layers||[],l=e.layers=[],u=0;u=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"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,h=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=h)}else{p.supplyLayoutGlobalDefaults(a,n);var f=!a.width||!a.height,d=n.autosize,g=t._context&&t._context.autosizable,m=f&&(d||g);m?p.plotAutoSize(t,a,n):f&&p.sanitizeMargins(t),!d&&f&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,s,a,n),n._has=p._hasPlotType.bind(n);var v=n._modules;for(e=0;e0){var c=s(t._boundingBoxMargins),h=c.left+c.right,d=c.bottom+c.top,g=1-2*o,m=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(m.width-h)),i=Math.round(g*(m.height-d))}else{var v=l?window.getComputedStyle(t):{};n=parseFloat(v.width)||r.width,i=parseFloat(v.height)||r.height}var y=p.layoutAttributes.width.min,x=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-i)>1;(_||b)&&(b&&(r.width=n),_&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a;c.Axes.supplyLayoutDefaults(t,e,r);var o=e._basePlotModules;for(i=0;i.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{ +val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),a=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),l=e._pushmargin;if(e.margin.autoexpand!==!1&&(l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}},Object.keys(l).forEach(function(t){var r=l[t].l||{},n=l[t].b||{},c=r.val,h=r.size,f=n.val,d=n.size;Object.keys(l).forEach(function(t){if(u(h)&&l[t].r){var r=l[t].r.val,n=l[t].r.size;if(r>c){var p=(h*r+(n-e.width)*c)/(r-c),g=(n*(1-c)+(h-e.width)*(1-r))/(r-c);p>=0&&g>=0&&p+g>i+a&&(i=p,a=g)}}if(u(d)&&l[t].t){var m=l[t].t.val,v=l[t].t.size;if(m>f){var y=(d*m+(v-e.height)*f)/(m-f),x=(v*(1-f)+(d-e.height)*(1-m))/(m-f);y>=0&&x>=0&&y+x>s+o&&(s=y,o=x)}}})})),r.l=Math.round(i),r.r=Math.round(a),r.t=Math.round(o),r.b=Math.round(s),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!t._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):f.isJSDate(t)?f.ms2DateTime(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(l.layout=a(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)},p.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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,u=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,L=S?h.angularAxis.domain:n.extent(A),z=Math.abs(A[1]-A[0]);T&&!k&&(z=0);var C=L.slice();E&&k&&(C[1]+=z);var I=h.angularAxis.ticksCount||4;I>8&&(I=I/(I/8)+I%8),h.angularAxis.ticksStep&&(I=(C[1]-C[0])/I);var P=h.angularAxis.ticksStep||(C[1]-C[0])/(I*(h.minorTicks+1));M&&(P=Math.max(Math.round(P),1)),C[2]||(C[2]=P);var D=n.range.apply(this,C);if(D=D.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]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=E?z:0,e=n.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var O="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",R=(new DOMParser).parseFromString(O,"application/xml"),F=this.appendChild(this.ownerDocument.importNode(R.documentElement,!0));e=n.select(F)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var j,N=e.select(".chart-group"),B={fill:"none",stroke:h.tickColor},U={"font-size":h.font.size,"font-family":h.font.family,fill:h.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+h.font.outlineColor}).join(",")};if(h.showLegend){j=e.select(".legend-group").attr({transform:"translate("+[x,h.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:j,elements:V,reverseOrder:h.legend.reverseOrder})})();var q=j.node().getBBox();x=Math.min(h.width-q.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,x=Math.max(10,x),_=[h.margin.left+x,h.margin.top+x],i.range([0,x]),c.layout.radialAxis.domain=i.domain(),j.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else j=e.select(".legend-group").style({display:"none"});e.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),N.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(h.width-(h.margin.left+h.margin.right+2*x+(q?q.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*x))/2];if(H[0]=Math.max(0,H[0]),H[1]=Math.max(0,H[1]),e.select(".outer-group").attr("transform","translate("+H+")"),h.title){var G=e.select("g.title-group text").style(U).text(h.title),X=G.node().getBBox();G.attr({x:_[0]-X.width/2,y:_[1]-x-20})}var Y=e.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var W=Y.selectAll("circle.grid-circle").data(i.ticks(5));W.enter().append("circle").attr({class:"grid-circle"}).style(B),W.attr("r",i),W.exit().remove()}Y.select("circle.outside-circle").attr({r:x}).style(B);var Z=e.select("circle.background-circle").attr({r:x}).style({fill:h.backgroundColor,stroke:h.stroke});if(h.radialAxis.visible){var Q=n.svg.axis().scale(i).ticks(5).tickSize(5);Y.call(Q).attr({transform:"rotate("+h.radialAxis.orientation+")"}),Y.selectAll(".domain").style(B),Y.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===h.radialAxis.tickOrientation?"rotate("+-h.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),Y.selectAll("g>line").style({stroke:"black"})}var K=e.select(".angular.axis-group").selectAll("g.angular-tick").data(D),$=K.enter().append("g").classed("angular-tick",!0);K.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),K.exit().remove(),$.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(h.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(h.minorTicks+1)==0)}).style(B),$.selectAll(".minor").style({stroke:h.minorTickColor}),K.select("line.grid-line").attr({x1:h.tickLength?x-h.tickLength:0,x2:x}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(U);var J=K.select("text.axis-text").attr({x:x+h.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=x+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?"":M?M[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(U);h.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var tt=n.max(N.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[x+tt,h.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=h.orientation,r.direction=h.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),at=[];it.forEach(function(t,e){"unstacked"===t.key?at=at.concat(t.values.map(function(t,e){return[t]})):at.push(t.values)}),at.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var ot,st,lt=e.select(".guides-group"),ut=e.select(".tooltips-group"),ct=o.tooltipPanel().config({container:ut,fontSize:8})(),ht=o.tooltipPanel().config({container:ut,fontSize:8})(),ft=o.tooltipPanel().config({container:ut,hasTick:!0})();if(!k){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});N.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;ot=s.invert(n);var i=o.util.convertToCartesian(x+12,r+180);ct.text(o.util.round(ot)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});N.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=i.invert(o.util.getMousePos(Z).radius);var n=o.util.convertToCartesian(r,h.radialAxis.orientation);ht.text(o.util.round(st)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ft.hide(),ct.hide(),ht.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var i=n.select(this),a=i.style("fill"),s="black",l=i.style("opacity")||1;if(i.attr({"data-opacity":l}),"none"!=a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(u.t=M[t[0]]);var c="t: "+u.t+", r: "+u.r,h=this.getBoundingClientRect(),f=e.node().getBoundingClientRect(),d=[h.left+h.width/2-H[0]-f.left,h.top+h.height/2-H[1]-f.top];ft.config({color:s}).text(c),ft.move(d)}else a=i.style("stroke"),i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0==n.event.which&&void(n.select(this).attr("data-fill")&&ft.show())}).on("mouseout.tooltip",function(t,e){ft.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")})})}),f}var e,r,i,s,l={data:[],layout:{}},u={},c={},h=n.dispatch("hover"),f={};return f.render=function(e){return t(e),this},f.config=function(t){if(!arguments.length)return l;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},f.getLiveConfig=function(){return c},f.getinputConfig=function(){return u},f.radialScale=function(t){return i},f.angularScale=function(t){return s},f.svg=function(){return e},n.rebind(f,h,"on"),f},o.Axis.defaultConfig=function(t,e){var r={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}};return r},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,i=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return i},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("undefined"==typeof 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 r===-2},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=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 s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:f(o),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return m.stroke(r,i,a)},"stroke-width":function(t,e){return m["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](r,i,a)},opacity:function(t,e){return m.opacity(r,i,a)},display:function(t,e){return m.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=n.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(c+(e[2]||0))}).outerRadius(function(e){return t.radialScale(c+(e[2]||0))+t.radialScale(e[1])});h.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var m={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},v=n.select(this).selectAll("g.layer").data(l);v.enter().append("g").attr({class:"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(m).each(h[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],i=n.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},n.rebind(t,i,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var r=e.legendConfig,i=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=n.merge(i);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=r.fontSize,c=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,h=c?r.height:u*o.length,f=s.classed("legend-group",!0),d=f.selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:h+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=n.range(o.length),m=n.scale[c?"linear":"ordinal"]().domain(g).range(l),v=n.scale[c?"linear":"ordinal"]().domain(g)[c?"range":"rangePoints"]([0,h]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":n.svg.symbolTypes.indexOf(t)!=-1?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()};if(c){var x=d.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}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var b=d.select(".legend-marks").selectAll("path.legend-mark").data(o);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[u/2,v(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=n.svg.axis().scale(v).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?r.colorBandWidth:u,u/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:c?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return r},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){t=i.container.selectAll("g."+s).data([0]);var n=t.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",h=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(h);var f=i.padding,d=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=d.width+2*f+l,m=d.height+2*f;return r.attr({d:"M"+[[l,-m/2],[l,-m/4],[i.hasTick?0:l,0],[l,m/4],[l,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-m/2+2*f]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return a(i,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){ +o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var i=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=i.indexOf(t.geometry);n!=-1&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var u=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],h={};n.entries(s.margin).forEach(function(t,e){h[c[u.indexOf(t.key)]]=t.value}),s.margin=h}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../lib":633,d3:95}],729:[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,u=e.exports={};u.framework=function(t){function e(e,i){return i&&(h=i),n.select(n.select(h).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),c=o.adapter.plotly().convert(r),a.config(c).render(h),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,i,a,c,h,f=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){f.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){f.undo()},e.redo=function(){f.redo()},e},u.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":533,"../../lib":633,"./micropolar":728,"./undo_manager":730,d3:95}],730:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return n!==-1},hasRedo:function(){return n=o&&(d.min=0,p.min=0,g.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var i=t("../../../components/color"),a=t("../../subplot_defaults"),o=t("./layout_attributes"),s=t("./axis_defaults"),l=["aaxis","baxis","caxis"];e.exports=function(t,e,r){a(t,e,r,{type:"ternary",attributes:o,handleDefaults:n,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":533,"../../subplot_defaults":731,"./axis_defaults":735,"./layout_attributes":737}],737:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:i,baxis:i,caxis:i}},{"../../../components/color/attributes":532,"./axis_attributes":734}],738:[function(t,e,r){"use strict";function n(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework()}function i(t){a.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var a=t("d3"),o=t("tinycolor2"),s=t("../../plotly"),l=t("../../lib"),u=t("../../components/color"),c=t("../../components/drawing"),h=t("../cartesian/set_convert"),f=t("../../lib/extend").extendFlat,d=t("../cartesian/axes"),p=t("../../components/dragelement"),g=t("../../components/titles"),m=t("../cartesian/select"),v=t("../cartesian/constants"),y=t("../cartesian/graph_interact");e.exports=n;var x=n.prototype;x.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={}},x.plot=function(t,e){var r,n=this,i=e[n.id],a=e._size;l.getPlotDiv(n.plotContainer.node())!==n.graphDiv&&(n.init(n.graphDiv._fullLayout),n.makeFramework()),n.adjustLayout(i,a);var o=n.traceHash,s={};for(r=0;rb*y?(a=y,i=a*b):(i=v,a=i/b),o=g*i/v,s=m*a/y,r=e.l+e.w*d-i/2,n=e.t+e.h*(1-p)-a/2,l.x0=r,l.y0=n,l.w=i,l.h=a,l.sum=x,l.xaxis={type:"linear",range:[_+2*M-x,x-_-2*w],domain:[d-o/2,d+o/2],_id:"x",_gd:l.graphDiv},h(l.xaxis),l.xaxis.setScale(),l.yaxis={type:"linear",range:[_,x-w-M],domain:[p-s/2,p+s/2],_id:"y",_gd:l.graphDiv},h(l.yaxis),l.yaxis.setScale();var A=l.yaxis.domain[0],k=l.aaxis=f({},t.aaxis,{range:[_,x-w-M],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[A,A+s*b],_axislayer:l.layers.aaxis,_gridlayer:l.layers.agrid,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l"+a+",-"+i/2});h(k);var T=l.baxis=f({},t.baxis,{range:[x-_-M,w],side:"bottom",_counterangle:30,domain:l.xaxis.domain,_axislayer:l.layers.baxis,_gridlayer:l.layers.bgrid,_counteraxis:l.aaxis,_pos:0,_gd:l.graphDiv,_id:"x",_length:i,_gridpath:"M0,0l-"+i/2+",-"+a});h(T),k._counteraxis=T;var E=l.caxis=f({},t.caxis,{range:[x-_-w,M],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[A,A+s*b],_axislayer:l.layers.caxis,_gridlayer:l.layers.cgrid,_counteraxis:l.baxis,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l-"+a+","+i/2});h(E);var S="M"+r+","+(n+a)+"h"+i+"l-"+i/2+",-"+a+"Z";l.clipDef.select("path").attr("d",S),l.layers.plotbg.select("path").attr("d",S);var L="translate("+r+","+n+")";l.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",L);var z="translate("+r+","+(n+a)+")";l.layers.baxis.attr("transform",z),l.layers.bgrid.attr("transform",z);var C="translate("+(r+i/2)+","+n+")rotate(30)";l.layers.aaxis.attr("transform",C),l.layers.agrid.attr("transform",C);var I="translate("+(r+i/2)+","+n+")rotate(-30)";l.layers.caxis.attr("transform",I),l.layers.cgrid.attr("transform",I),l.drawAxes(!0),l.plotContainer.selectAll(".crisp").classed("crisp",!1);var P=l.layers.axlines;P.select(".aline").attr("d",k.showline?"M"+r+","+(n+a)+"l"+i/2+",-"+a:"M0,0").call(u.stroke,k.linecolor||"#000").style("stroke-width",(k.linewidth||0)+"px"),P.select(".bline").attr("d",T.showline?"M"+r+","+(n+a)+"h"+i:"M0,0").call(u.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),P.select(".cline").attr("d",E.showline?"M"+(r+i/2)+","+n+"l"+i/2+","+a:"M0,0").call(u.stroke,E.linecolor||"#000").style("stroke-width",(E.linewidth||0)+"px")},x.drawAxes=function(t){var e=this,r=e.graphDiv,n=e.id.substr(7)+"title",i=e.aaxis,a=e.baxis,o=e.caxis;if(d.doTicks(r,i,!0),d.doTicks(r,a,!0),d.doTicks(r,o,!0),t){var s=Math.max(i.showticklabels?i.tickfont.size/2:0,(o.showticklabels?.75*o.tickfont.size:0)+("outside"===o.ticks?.87*o.ticklen:0));g.draw(r,"a"+n,{propContainer:i,propName:e.id+".aaxis.title",dfltName:"Component A",attributes:{x:e.x0+e.w/2,y:e.y0-i.titlefont.size/3-s,"text-anchor":"middle"}});var l=(a.showticklabels?a.tickfont.size:0)+("outside"===a.ticks?a.ticklen:0)+3;g.draw(r,"b"+n,{propContainer:a,propName:e.id+".baxis.title",dfltName:"Component B",attributes:{x:e.x0-l,y:e.y0+e.h+.83*a.titlefont.size+l,"text-anchor":"middle"}}),g.draw(r,"c"+n,{propContainer:o,propName:e.id+".caxis.title",dfltName:"Component C",attributes:{x:e.x0+e.w+l,y:e.y0+e.h+.83*o.titlefont.size+l,"text-anchor":"middle"}})}};var _=v.MINZOOM/2+.87,w="m-0.87,.5h"+_+"v3h-"+(_+5.2)+"l"+(_/2+2.6)+",-"+(.87*_+4.5)+"l2.6,1.5l-"+_/2+","+.87*_+"Z",M="m0.87,.5h-"+_+"v3h"+(_+5.2)+"l-"+(_/2+2.6)+",-"+(.87*_+4.5)+"l-2.6,1.5l"+_/2+","+.87*_+"Z",A="m0,1l"+_/2+","+.87*_+"l2.6,-1.5l-"+(_/2+2.6)+",-"+(.87*_+4.5)+"l-"+(_/2+2.6)+","+(.87*_+4.5)+"l2.6,1.5l"+_/2+",-"+.87*_+"Z",k="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",T=!0;x.initInteractions=function(){function t(t,e,r){var n=F.getBoundingClientRect();_=e-n.left,E=r-n.top,S={a:R.aaxis.range[0],b:R.baxis.range[1],c:R.caxis.range[1]},z=S,L=R.aaxis.range[1]-S.a,C=o(R.graphDiv._fullLayout[R.id].bgcolor).getLuminance(),I="M0,"+R.h+"L"+R.w/2+", 0L"+R.w+","+R.h+"Z",P=!1,D=N.append("path").attr("class","zoombox").style({fill:C>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",I),O=N.append("path").attr("class","zoombox-corners").style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),g()}function e(t,e){return 1-e/R.h}function r(t,e){return 1-(t+(R.h-e)/Math.sqrt(3))/R.w}function n(t,e){return(t-(R.h-e)/Math.sqrt(3))/R.w}function a(t,i){var a=_+t,o=E+i,s=Math.max(0,Math.min(1,e(_,E),e(a,o))),l=Math.max(0,Math.min(1,r(_,E),r(a,o))),u=Math.max(0,Math.min(1,n(_,E),n(a,o))),c=(s/2+u)*R.w,h=(1-s/2-l)*R.w,f=(c+h)/2,d=h-c,p=(1-s)*R.h,g=p-d/b;d.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),O.transition().style("opacity",1).duration(200),P=!0)}function c(t,e){if(z===S)return 2===e&&x(),i(j);i(j);var r={};r[R.id+".aaxis.min"]=z.a,r[R.id+".baxis.min"]=z.b,r[R.id+".caxis.min"]=z.c,s.relayout(j,r),T&&j.data&&j._context.showTips&&(l.notifier("Double-click to
zoom back out","long"),T=!1)}function h(){S={a:R.aaxis.range[0],b:R.baxis.range[1],c:R.caxis.range[1]},z=S}function f(t,e){var r=t/R.xaxis._m,n=e/R.yaxis._m;z={a:S.a-n,b:S.b+(r+n)/2,c:S.c-(r-n)/2};var i=[z.a,z.b,z.c].sort(),a={a:i.indexOf(z.a),b:i.indexOf(z.b),c:i.indexOf(z.c)};i[0]<0&&(i[1]+i[0]/2<0?(i[2]+=i[0]+i[1],i[0]=i[1]=0):(i[2]+=i[0]/2,i[1]+=i[0]/2,i[0]=0),z={a:i[a.a],b:i[a.b],c:i[a.c]},e=(S.a-z.a)*R.yaxis._m,t=(S.c-z.c-S.b+z.b)*R.xaxis._m);var o="translate("+(R.x0+t)+","+(R.y0+e)+")";R.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",o),R.aaxis.range=[z.a,R.sum-z.b-z.c],R.baxis.range=[R.sum-z.a-z.c,z.b],R.caxis.range=[R.sum-z.a-z.b,z.c],R.drawAxes(!1),R.plotContainer.selectAll(".crisp").classed("crisp",!1)}function d(t,e){if(t){var r={};r[R.id+".aaxis.min"]=z.a,r[R.id+".baxis.min"]=z.b,r[R.id+".caxis.min"]=z.c,s.relayout(j,r)}else 2===e&&x()}function g(){R.plotContainer.selectAll(".select-outline").remove()}function x(){var t={};t[R.id+".aaxis.min"]=0,t[R.id+".baxis.min"]=0,t[R.id+".caxis.min"]=0,j.emit("plotly_doubleclick",null),s.relayout(j,t)}var _,E,S,L,z,C,I,P,D,O,R=this,F=R.layers.plotbg.select("path").node(),j=R.graphDiv,N=R.layers.zoom,B={element:F,gd:j,plotinfo:{plot:N},doubleclick:x,subplot:R.id,prepFn:function(e,r,n){B.xaxes=[R.xaxis],B.yaxes=[R.yaxis];var i=j._fullLayout.dragmode;e.shiftKey&&(i="pan"===i?"zoom":"pan"),"lasso"===i?B.minDrag=1:B.minDrag=void 0,"zoom"===i?(B.moveFn=a,B.doneFn=c,t(e,r,n)):"pan"===i?(B.moveFn=f,B.doneFn=d,h(),g()):"select"!==i&&"lasso"!==i||m(e,r,n,B,i)}};F.onmousemove=function(t){y.hover(j,t,R.id),j._fullLayout._lasthover=F,j._fullLayout._hoversubplot=R.id},F.onmouseout=function(t){j._dragging||p.unhover(j,t)},F.onclick=function(t){y.click(j,t)},p.init(B)}},{"../../components/color":533,"../../components/dragelement":554,"../../components/drawing":556,"../../components/titles":607,"../../lib":633,"../../lib/extend":626,"../../plotly":659,"../cartesian/axes":664,"../cartesian/constants":669,"../cartesian/graph_interact":671,"../cartesian/select":677,"../cartesian/set_convert":678,d3:95,tinycolor2:489}],739:[function(t,e,r){"use strict";function n(t){return"object"==typeof t&&(t=t.type),t}var i=t("./lib"),a=t("./plots/attributes");r.modules={},r.allCategories={},r.allTypes=[],r.subplotsRegistry={},r.transformsRegistry={},r.componentsRegistry={},r.layoutArrayContainers=[],r.register=function(t,e,n,a){if(r.modules[e])return void i.log("Type "+e+" already registered");for(var o={},s=0;s-1}var a=t("../lib"),o=t("../plots/plots"),s=a.extendFlat,l=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,u=t.layout,c=l([],a),h=l({},u,n(e.tileClass));if(e.width&&(h.width=e.width),e.height&&(h.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){h.annotations=[];var f=Object.keys(h);for(r=0;r=2?a(t):t>e?Math.ceil(t):Math.floor(t)}var m,v,y,x,b=e.p+(d?f[r]:f),_=b+(g?p[r]:p),w=e.b,M=w+e.s;if("h"===s.orientation?(y=c.c2p(b,!0),x=c.c2p(_,!0),m=u.c2p(w,!0),v=u.c2p(M,!0)):(m=u.c2p(b,!0),v=u.c2p(_,!0),y=c.c2p(w,!0),x=c.c2p(M,!0)),!(i(m)&&i(v)&&i(y)&&i(x)&&m!==v&&y!==x))return void n.select(this).remove();var A=(e.mlw+1||s.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,k=n.round(A/2%1,2);if(!t._context.staticPlot){var T=o.opacity(e.mc||s.marker.color),E=T<1||A>.01?a:l;m=E(m,v),v=E(v,m),y=E(y,x),x=E(x,y)}n.select(this).attr("d","M"+m+","+y+"V"+x+"H"+v+"V"+y+"Z")})}),f.call(s.plot,e)}},{"../../components/color":533,"../../components/errorbars":562,"../../lib":633,"./arrays_to_calcdata":748,d3:95,"fast-isnumeric":104}],757:[function(t,e,r){"use strict";function n(t,e,r,n){if(n.length){var s,l,u,c,h,f=t._fullLayout.barmode,d="overlay"===f,p="group"===f;if(d)i(t,e,r,n);else if(p){for(s=[],l=[],u=0;ul+o&&(u=!0,l=y)),v(e.c2l(g))&&(gl+o&&(u=!0,l=g))}}x.expand(e,[s,l],{tozero:!0,padded:u})}function m(t){return t._id.charAt(0)}var v=t("fast-isnumeric"),y=t("../../registry"),x=t("../../plots/cartesian/axes"),b=t("./sieve.js");e.exports=function(t,e){var r,i=e.xaxis,a=e.yaxis,o=t._fullData,s=t.calcdata,l=[],u=[];for(r=0;r1||0===s.bargap&&0===s.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,r=e.marker,o=r.line,s=a.tryColorscale(r,""),l=a.tryColorscale(r,"line");n.select(this).selectAll("path").each(function(t){var e,a,u=(t.mlw+1||o.width+1)-1,c=n.select(this);e="mc"in t?t.mcc=s(t.mc):Array.isArray(r.color)?i.defaultLine:r.color,c.style("stroke-width",u+"px").call(i.fill,e),u&&(a="mlc"in t?t.mlcc=l(t.mlc):Array.isArray(o.color)?i.defaultLine:o.color,c.call(i.stroke,a))})}),e.call(o.style)}},{"../../components/color":533,"../../components/drawing":556,"../../components/errorbars":562,d3:95}],760:[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")}},{"../../components/color":533,"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546}],761:[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"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:a({},o.symbol,{arrayOk:!1}),opacity:a({},o.opacity,{arrayOk:!1,dflt:1}),size:a({},o.size,{arrayOk:!1}),color:a({},o.color,{arrayOk:!1}),line:{color:a({},s.color,{arrayOk:!1,dflt:i.defaultLine}),width:a({},s.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:n.fillcolor}},{"../../components/color/attributes":532,"../../lib/extend":626,"../scatter/attributes":846}],762:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(t,e,r,a,o){var s;return r in e?p=a.makeCalcdata(e,r):(s=r+"0"in e?e[r+"0"]:"name"in e&&("category"===a.type||n(e.name)&&["linear","log"].indexOf(a.type)!==-1||i.isDateTime(e.name)&&"date"===a.type)?e.name:t.numboxes,s=a.d2c(s),p=o.map(function(){return s})),p}function o(t,e,r,a,o){var s,l,u,c,h=a.length,f=e.length,d=[],p=[];for(s=0;s=0&&u1,v=r.dPos*(1-f.boxgap)*(1-f.boxgroupgap)/(m?t.numboxes:1),y=m?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-f.boxgap):0,x=v*g.whiskerwidth;return g.visible!==!0||r.emptybox?void a.select(this).remove():("h"===g.orientation?(l=p,h=d):(l=d,h=p),r.bPos=y,r.bdPos=v,n(),a.select(this).selectAll("path.box").data(o.identity).enter().append("path").attr("class","box").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-v,!0),n=l.c2p(t.pos+y+v,!0),i=l.c2p(t.pos+y-x,!0),s=l.c2p(t.pos+y+x,!0),u=h.c2p(t.q1,!0),c=h.c2p(t.q3,!0),f=o.constrain(h.c2p(t.med,!0),Math.min(u,c)+1,Math.max(u,c)-1),d=h.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=h.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?a.select(this).attr("d","M"+f+","+r+"V"+n+"M"+u+","+r+"V"+n+"H"+c+"V"+r+"ZM"+u+","+e+"H"+d+"M"+c+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+d+","+i+"V"+s+"M"+p+","+i+"V"+s)):a.select(this).attr("d","M"+r+","+f+"H"+n+"M"+r+","+u+"H"+n+"V"+c+"H"+r+"ZM"+e+","+u+"V"+d+"M"+e+","+c+"V"+p+(0===g.whiskerwidth?"":"M"+i+","+d+"H"+s+"M"+i+","+p+"H"+s))}),g.boxpoints&&a.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,a,s,l,h,f="all"===g.boxpoints?t.val:t.val.filter(function(e){return et.uf}),d=Math.max((t.max-t.min)/10,t.q3-t.q1),p=1e-9*d,m=d*c,x=[],b=0;if(g.jitter){if(0===d)for(b=1,x=new Array(f.length),e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(s.translatePoints,d,p),void(g.boxmean&&a.select(this).selectAll("path.mean").data(o.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-v,!0),n=l.c2p(t.pos+y+v,!0),i=h.c2p(t.mean,!0),o=h.c2p(t.mean-t.sd,!0),s=h.c2p(t.mean+t.sd,!0);"h"===g.orientation?a.select(this).attr("d","M"+i+","+r+"V"+n+("sd"!==g.boxmean?"":"m0,0L"+o+","+e+"L"+i+","+r+"L"+s+","+e+"Z")):a.select(this).attr("d","M"+r+","+i+"H"+n+("sd"!==g.boxmean?"":"m0,0L"+e+","+o+"L"+r+","+i+"L"+e+","+s+"Z"))})))})}},{"../../components/drawing":556,"../../lib":633,d3:95}],769:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../plots/cartesian/axes"),a=t("../../lib");e.exports=function(t,e){var r,o,s,l,u=t._fullLayout,c=e.xaxis,h=e.yaxis,f=["v","h"];for(o=0;ol&&(e.z=c.slice(0,l)),s("locationmode"),s("text"),s("marker.line.color"),s("marker.line.width"),i(t,e,o,s,{prefix:"",cLetter:"z"}),void s("hoverinfo",1===o._dataLength?"location+z+text":void 0)):void(e.visible=!1)}},{"../../components/colorscale/defaults":542,"../../lib":633,"./attributes":775}],778:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("./calc"),n.plot=t("./plot").plot,n.hoverPoints=function(){},n.moduleType="trace",n.name="choropleth",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","noOpacity"],n.meta={},e.exports=n},{"../../plots/geo":688,"../heatmap/colorbar":792,"./attributes":775,"./calc":776,"./defaults":777,"./plot":779}],779:[function(t,e,r){"use strict";function n(t,e){function r(e){var r=t.mockAxis;return o.tickText(r,r.c2l(e),"hover").text}var n=e.hoverinfo;if("none"===n||"skip"===n)return function(t){delete t.nameLabel,delete t.textLabel};var i="all"===n?g.hoverinfo.flags:n.split("+"),a=i.indexOf("name")!==-1,s=i.indexOf("location")!==-1,l=i.indexOf("z")!==-1,u=i.indexOf("text")!==-1,c=!a&&s;return function(t){var n=[];c?t.nameLabel=t.id:(a&&(t.nameLabel=e.name),s&&n.push(t.id)),l&&n.push(r(t.z)),u&&n.push(t.tx),t.textLabel=n.join("
")}}function i(t){return function(e,r){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:r,location:e.id,z:e.z}]}}}var a=t("d3"),o=t("../../plots/cartesian/axes"),s=t("../../plots/cartesian/graph_interact"),l=t("../../components/color"),u=t("../../components/drawing"),c=t("../../components/colorscale"),h=t("../../lib/topojson_utils").getTopojsonFeatures,f=t("../../lib/geo_location_utils").locationToFeature,d=t("../../lib/array_to_calc_item"),p=t("../../plots/geo/constants"),g=t("./attributes"),m=e.exports={};m.calcGeoJSON=function(t,e){for(var r,n=[],i=t.locations,a=i.length,o=h(t,e),s=(t.marker||{}).line||{},l=0;l0&&(n[0].trace=t),n},m.plot=function(t,e,r){function o(t){return t[0].trace.uid}var l,u=t.framework,c=u.select("g.choroplethlayer"),h=u.select("g.baselayer"),f=u.select("g.baselayeroverchoropleth"),d=p.baseLayersOverChoropleth,g=c.selectAll("g.trace.choropleth").data(e,o);g.enter().append("g").attr("class","trace choropleth"),g.exit().remove(),g.each(function(e){function r(e,r){if(t.showHover){var n=t.projection(e.properties.ct);c(e),s.loneHover({x:n[0],y:n[1],name:e.nameLabel,text:e.textLabel},{container:t.hoverContainer.node()}),f=h(e,r),t.graphDiv.emit("plotly_hover",f)}}function o(e,r){t.graphDiv.emit("plotly_click",h(e,r))}var l=e[0].trace,u=m.calcGeoJSON(l,t.topojson),c=n(t,l),h=i(l),f=null,d=a.select(this).selectAll("path.choroplethlocation").data(u);d.enter().append("path").classed("choroplethlocation",!0).on("mouseover",r).on("click",o).on("mouseout",function(){s.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",f)}).on("mousedown",function(){s.loneUnhover(t.hoverContainer)}).on("mouseup",r),d.exit().remove()}),f.selectAll("*").remove();for(var v=0;vt?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===r||10===r){var n=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;return t>n?5===r?713:1114:5===r?104:208}return 15===r?0:r}function o(t){var e,r,n,i,o,s,l,u,c,h=t[0].z,f=h.length,d=h[0].length,p=2===f||2===d;for(r=0;r20?(s=L[s][(l[0]||l[1])<0?0:1],t.crossings[o]=z[s]):delete t.crossings[o],l=S[s],!l){_.log("Found bad marching index:",s,e,t.level);break}if(d.push(f(t,e,l)),e[0]+=l[0],e[1]+=l[1],c(d[d.length-1],d[d.length-2])&&d.pop(),o=e.join(","),o===a&&l.join(",")===p||r&&(l[0]&&(e[0]<0||e[0]>m-2)||l[1]&&(e[1]<0||e[1]>g-2)))break;s=t.crossings[o]}1e4===i&&_.log("Infinite loop in contour?");var v,y,x,b,w,M,A,k=c(d[0],d[d.length-1]),T=0,E=.2*t.smoothing,C=[],I=0;for(i=1;i=I;i--)if(v=C[i],v=I&&v+C[y]20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:A.indexOf(t)!==-1?i=1:T.indexOf(t)!==-1?n=1:k.indexOf(t)!==-1?i=-1:n=-1,[n,i]}function c(t,e){return Math.abs(t[0]-e[0])<.01&&Math.abs(t[1]-e[1])<.01}function h(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function f(t,e,r){var n=e[0]+Math.max(r[0],0),i=e[1]+Math.max(r[1],0),a=t.z[i][n],o=t.xaxis,s=t.yaxis;if(r[1]){var l=(t.level-a)/(t.z[i][n+1]-a);return[o.c2p((1-l)*t.x[n]+l*t.x[n+1],!0),s.c2p(t.y[i],!0)]}var u=(t.level-a)/(t.z[i+1][n]-a);return[o.c2p(t.x[n],!0),s.c2p((1-u)*t.y[i]+u*t.y[i+1],!0)]}function d(t,e,r){var n=t.plot.select(".maplayer").selectAll("g.contour."+r).data(e);return n.enter().append("g").classed("contour",!0).classed(r,!0),n.exit().remove(),n}function p(t,e,r){var n=t.selectAll("g.contourbg").data([0]);n.enter().append("g").classed("contourbg",!0);var i=n.selectAll("path").data("fill"===r.coloring?[0]:[]);i.enter().append("path"),i.exit().remove(),i.attr("d","M"+e.join("L")+"Z").style("stroke","none")}function g(t,e,r,n){var i=t.selectAll("g.contourfill").data([0]);i.enter().append("g").classed("contourfill",!0);var a=i.selectAll("path").data("fill"===n.coloring?e:[]);a.enter().append("path"),a.exit().remove(),a.each(function(t){var e=m(t,r);e?b.select(this).attr("d",e).style("stroke","none"):b.select(this).remove()})}function m(t,e){function r(t){return Math.abs(t[1]-e[0][1])<.01}function n(t){return Math.abs(t[1]-e[2][1])<.01}function i(t){return Math.abs(t[0]-e[0][0])<.01}function a(t){return Math.abs(t[0]-e[2][0])<.01}for(var o,s,l,u,c,h,f=t.edgepaths.length||t.z[0][0]=0&&(s=m,u=c):Math.abs(o[1]-s[1])<.01?Math.abs(o[1]-m[1])<.01&&(m[0]-o[0])*(s[0]-m[0])>=0&&(s=m,u=c):_.log("endpt to newendpt is not vert. or horz.",o,s,m)}if(o=s,u>=0)break;f+="L"+s}if(u===t.edgepaths.length){_.log("unclosed perimeter path");break}d=u,g=p.indexOf(d)===-1,g&&(d=p[0],f+="Z")}for(d=0;d1;if(p&&!f&&"category"!==a.type){var g=e.length;if(!(g<=i))return h?e.slice(0,i):e.slice(0,i+1);if(h||d)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;ly;n++)o=l(t,e,a(o));return o>y&&h.log("interp2d didn't converge quickly",o),t}function s(t){var e,r,n,i,a,o,s,l,u=[],c={},h=[],f=t[0],d=[],p=[0,0,0],g=v(t);for(r=0;r=0;a--)i=h[a],r=i[0],n=i[1],o=((c[[r-1,n]]||p)[2]+(c[[r+1,n]]||p)[2]+(c[[r,n-1]]||p)[2]+(c[[r,n+1]]||p)[2])/20,o&&(s[i]=[r,n,o],h.splice(a,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,a,o,s,l,u,c,h,f,d,p,g,m=0;for(o=0;op&&(m=Math.max(m,Math.abs(t[i][a]-d)/(g-p))))}return m}var u=t("fast-isnumeric"),c=t("../../registry"),h=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),m=t("./convert_column_xyz"),v=t("./max_row_length");e.exports=function(t,e){function r(t){S=e._input.zsmooth=e.zsmooth=!1,h.notifier("cannot fast-zsmooth: "+t)}var a,l,u,y,x,b,_,w,M=f.getFromId(t,e.xaxis||"x"),A=f.getFromId(t,e.yaxis||"y"),k=c.traceIs(e,"contour"),T=c.traceIs(e,"histogram"),E=c.traceIs(e,"gl2d"),S=k?"best":e.zsmooth;if(M._minDtick=0,A._minDtick=0,T){var L=d(t,e);a=L.x,l=L.x0,u=L.dx,y=L.y,x=L.y0,b=L.dy,_=L.z}else g(e)&&m(e,M,A),a=e.x?M.makeCalcdata(e,"x"):[],y=e.y?A.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,x=e.y0||0,b=e.dy||1,_=n(e),(k||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=o(_,e._emptypoints,e._interpz));if("fast"===S)if("log"===M.type||"log"===A.type)r("log axis found");else if(!T){if(a.length){var z=(a[a.length-1]-a[0])/(a.length-1),C=Math.abs(z/100);for(w=0;wC){r("x scale is not linear");break}}if(y.length&&"fast"===S){var I=(y[y.length-1]-y[0])/(y.length-1),P=Math.abs(I/100);for(w=0;wP){r("y scale is not linear");break}}}var D=v(_),O="scaled"===e.xtype?"":a,R=i(e,O,l,u,D,M),F="scaled"===e.ytype?"":y,j=i(e,F,x,b,_.length,A);E||(f.expand(M,R),f.expand(A,j));var N={x:R,y:j,z:_};if(p(e,_,"","z"),k&&e.contours&&"heatmap"===e.contours.coloring){var B="contour"===e.type?"heatmap":"histogram2d";N.xfill=i(B,O,l,u,D,M),N.yfill=i(B,F,x,b,_.length,A)}return[N]};var y=.01,x=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":539,"../../lib":633,"../../plots/cartesian/axes":664,"../../registry":739,"../histogram2d/calc":812,"./convert_column_xyz":793,"./has_columns":795,"./max_row_length":798,"fast-isnumeric":104}],792:[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="cb"+r.uid,u=r.zmin,c=r.zmax;if(n(u)||(u=i.aggNums(Math.min,null,r.z)),n(c)||(c=i.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void a.autoMargin(t,l);var h=e[0].t.cb=s(t,l),f=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});h.fillcolor(f).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":536,"../../components/colorscale":547,"../../lib":633,"../../plots/plots":724,"fast-isnumeric":104}],793:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a=t.x.slice(),o=t.y.slice(),s=t.z,l=t.text,u=Math.min(a.length,o.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(u=y[0].length||h<0||h>y.length)return}else{if(n.inbox(e-m[0],e-m[m.length-1])>a||n.inbox(r-v[0],r-v[v.length-1])>a)return;if(s){var w;for(b=[2*m[0]-m[1]],w=1;w0&&a0&&s0;)_=m.c2p(E[k]),k--;for(_0;)A=v.c2p(S[k]),k--;if(A0&&(n=!0);for(var s=0;sa)return r[t]=a,a-r[t]}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]=0&&yF;r--)if(h[r]){j=r;break}for(r=F;r<=j;r++)n(c[r])&&n(h[r])&&R.push({p:c[r],s:h[r],b:0});return R}}},{"../../lib":633,"../../plots/cartesian/axes":664,"./average":803,"./bin_functions":805,"./clean_bins":807,"./norm_functions":810,"fast-isnumeric":104}],807:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib").cleanDate,a=t("../../constants/numerical").ONEDAY;e.exports=function(t,e,r){var o=e.type,s=r+"bins",l=t[s];l||(l=t[s]={});var u="date"===o?function(t){return t||0===t?i(t):null}:function(t){return n(t)?Number(t):null};l.start=u(l.start),l.end=u(l.end);var c="date"===o?a:1,h=l.size;if(n(h))l.size=h>0?Number(h):c;else if("string"!=typeof h)l.size=c;else{var f=h.charAt(0),d=h.substr(1);d=n(d)?Number(d):0,(d<=0||"date"!==o||"M"!==f||d!==Math.round(d))&&(l.size=c)}var p="autobin"+r;"boolean"!=typeof t[p]&&(t[p]=!((l.start||0===l.start)&&(l.end||0===l.end))),t[p]||delete t["nbins"+r]}},{"../../constants/numerical":616,"../../lib":633,"fast-isnumeric":104}],808:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),a=t("./bin_defaults"),o=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,i){return n.coerce(t,e,l,r,i)}var h=c("x"),f=c("y");c("text");var d=c("orientation",f&&!h?"h":"v"),p=e["v"===d?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===d?"x":"y"];g&&c("histfunc");var m="h"===d?["y"]:["x"];a(t,e,c,m),o(t,e,c,r,u),s(t,e,i.defaultLine,{axis:"y"}),s(t,e,i.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":533,"../../components/errorbars/defaults":561,"../../lib":633,"../bar/style_defaults":760,"./attributes":802,"./bin_defaults":804}],809:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("../bar/layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("../bar/layout_defaults"),n.calc=t("./calc"),n.setPositions=t("../bar/set_positions"),n.plot=t("../bar/plot"),n.style=t("../bar/style"),n.colorbar=t("../scatter/colorbar"),n.hoverPoints=t("../bar/hover"),n.moduleType="trace",n.name="histogram",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":672,"../bar/hover":752,"../bar/layout_attributes":754,"../bar/layout_defaults":755,"../bar/plot":756,"../bar/set_positions":757,"../bar/style":759,"../scatter/colorbar":849,"./attributes":802,"./calc":806,"./defaults":808}],810:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;iy&&g.splice(y,g.length-y),v.length>y&&v.splice(y,v.length-y),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(g,p,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start=p.c2r(i.tickIncrement(p.r2c(e.xbins.start),e.xbins.size,!0)),e.xbins.end=p.c2r(i.tickIncrement(p.r2c(e.xbins.end),e.xbins.size))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(v,m,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start=m.c2r(i.tickIncrement(m.r2c(e.ybins.start),e.ybins.size,!0)),e.ybins.end=m.c2r(i.tickIncrement(m.r2c(e.ybins.end),e.ybins.size))),e._input.ybins=e.ybins),f=[];var x,b,_=[],w=[],M="string"==typeof e.xbins.size?[]:e.xbins,A="string"==typeof e.xbins.size?[]:e.ybins,k=0,T=[],E=e.histnorm,S=e.histfunc,L=E.indexOf("density")!==-1,z="max"===S||"min"===S,C=z?null:0,I=a.count,P=o[E],D=!1,O=[],R=[],F="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";F&&"count"!==S&&(D="avg"===S,I=a[S]);var j=e.xbins,N=p.r2c(j.start),B=p.r2c(j.end)+(N-i.tickIncrement(N,j.size))/1e6;for(d=N;d=0&&x=0&&b0)s=h(t.alphahull,l);else{var u=["x","y","z"].indexOf(t.delaunayaxis);s=c(l.map(function(t){return[t[(u+1)%3],t[(u+2)%3]]}))}var p={positions:l,cells:s,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:d(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",p.vertexIntensity=t.intensity,p.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolors[0],p.vertexColors=a(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],p.cellColors=a(t.facecolor)):(this.color=t.color,p.meshColor=d(t.color)),this.mesh.update(p)},p.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=s},{"../../lib/str2rgbarray":646,"alpha-shape":32,"convex-hull":84,"delaunay-triangulate":96,"gl-mesh3d":173,tinycolor2:489}],821:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorbar/defaults"),a=t("./attributes");e.exports=function(t,e,r,o){function s(r,i){return n.coerce(t,e,a,r,i)}function l(t){var e=t.map(function(t){var e=s(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=l(["x","y","z"]),c=l(["i","j","k"]);return u?(c&&c.forEach(function(t){for(var e=0;ee}}},r.addRangeSlider=function(t){t.xaxis||(t.xaxis={}),t.xaxis.rangeslider||(t.xaxis.rangeslider={})}},{"../../lib":633}],827:[function(t,e,r){"use strict";var n=t("../../plot_api/register");e.exports={moduleType:"trace",name:"ohlc",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","showLegend"],meta:{},attributes:t("./attributes"),supplyDefaults:t("./defaults")},n(t("../scatter")),n(t("./transform"))},{"../../plot_api/register":654,"../../plots/cartesian":672,"../scatter":856,"./attributes":823,"./defaults":824,"./transform":829}],828:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,i=r("x"),a=r("open"),o=r("high"),s=r("low"),l=r("close");return n=Math.min(a.length,o.length,s.length,l.length),i&&(n=Math.min(n,i.length),n1)){var h=o.distinctVals(c.x.map(e.d2c)).minDiff;a=Math.min(a,h)}}for(a===1/0&&(a=1),u=0;u");_.push(o,o,o,o,o,o,null)},C=0;C")}return g};var l},{"../../components/color":533,"./helpers":834,"fast-isnumeric":104,tinycolor2:489}],833:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,a){function o(r,a){return n.coerce(t,e,i,r,a)}var s=n.coerceFont,l=o("values");if(!Array.isArray(l)||!l.length)return void(e.visible=!1);var u=o("labels");Array.isArray(u)||(o("label0"),o("dlabel"));var c=o("marker.line.width");c&&o("marker.line.color");var h=o("marker.colors");Array.isArray(h)||(e.marker.colors=[]),o("scalegroup");var f=o("text"),d=o("textinfo",Array.isArray(f)?"text+percent":"percent");if(o("hoverinfo",1===a._dataLength?"label+text+value+percent":void 0),d&&"none"!==d){var p=o("textposition"),g=Array.isArray(p)||"auto"===p,m=g||"inside"===p,v=g||"outside"===p;if(m||v){var y=s(o,"textfont",a.font);m&&s(o,"insidetextfont",y),v&&s(o,"outsidetextfont",y)}}o("domain.x"),o("domain.y"),o("hole"),o("sort"),o("direction"),o("rotation"),o("pull")}},{"../../lib":633,"./attributes":830}],834:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return r.lastIndexOf(".")!==-1&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return r.lastIndexOf(".")!==-1&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":633}],835:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.layoutAttributes=t("./layout_attributes"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.styleOne=t("./style_one"),n.moduleType="trace",n.name="pie",n.basePlotModule=t("./base_plot"),n.categories=["pie","showLegend"],n.meta={},e.exports=n},{"./attributes":830,"./base_plot":831,"./calc":832,"./defaults":833,"./layout_attributes":836,"./layout_defaults":837,"./plot":838,"./style":839,"./style_one":840}],836:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],837:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e){function r(r,a){return n.coerce(t,e,i,r,a)}r("hiddenlabels")}},{"../../lib":633,"./layout_attributes":836}],838:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.sqrt(t.width*t.width+t.height*t.height),a=t.width/t.height,o=Math.PI*Math.min(e.v/r.vTotal,.5),s=1-r.trace.hole,l=i(e,r),u={scale:l*r.r*2/n,rCenter:1-l,rotate:0};if(u.scale>=1)return u;var c=a+1/(2*Math.tan(o)),h=r.r*Math.min(1/(Math.sqrt(c*c+.5)+c),s/(Math.sqrt(a*a+s/2)+a)),f={scale:2*h/t.height,rCenter:Math.cos(h/r.r)-h*a/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90},d=1/a,p=d+1/(2*Math.tan(o)),g=r.r*Math.min(1/(Math.sqrt(p*p+.5)+p),s/(Math.sqrt(d*d+s/2)+d)),m={scale:2*g/t.width,rCenter:Math.cos(g/r.r)-g/a/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>f.scale?m:f;return u.scale<1&&v.scale>u.scale?v:u}function i(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var r=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(r)),(1-e.trace.hole)/2)}function a(t,e){var r=e.pxmid[0],n=e.pxmid[1],i=t.width/2,a=t.height/2;return r<0&&(i*=-1),n<0&&(a*=-1),{scale:1,rCenter:1,rotate:0,x:i+Math.abs(a)*(i>0?1:-1)/2,y:a/(1+r*r/(n*n)),outside:!0}}function o(t,e){function r(t,e){return t.pxmid[1]-e.pxmid[1]}function n(t,e){return e.pxmid[1]-t.pxmid[1]}function i(t,r){r||(r={});var n,i,a,s,f,d,g=r.labelExtraY+(o?r.yLabelMax:r.yLabelMin),m=o?t.yLabelMin:t.yLabelMax,v=o?t.yLabelMax:t.yLabelMin,y=t.cyFinal+u(t.px0[1],t.px1[1]),x=g-m;if(x*h>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(i=0;i=e.pull[a.i]||((t.pxmid[1]-a.pxmid[1])*h>0?(s=a.cyFinal+u(a.px0[1],a.px1[1]),x=s-m-t.labelExtraY,x*h>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*h>0&&(n=3*c*Math.abs(i-p.indexOf(t)),f=a.cxFinal+l(a.px0[0],a.px1[0]),d=f+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX,d*c>0&&(t.labelExtraX+=d)))}var a,o,s,l,u,c,h,f,d,p,g,m,v;for(o=0;o<2;o++)for(s=o?r:n,u=o?Math.max:Math.min,h=o?1:-1,a=0;a<2;a++){for(l=a?Math.max:Math.min,c=a?1:-1,f=t[o][a],f.sort(s),d=t[1-o][a],p=d.concat(f),m=[],g=0;gc&&(c=s.pull[a]);o.r=Math.min(r/u(s.tilt,Math.sin(l),s.depth),n/u(s.tilt,Math.cos(l),s.depth))/(2+2*c),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&&d.indexOf(s.scalegroup)===-1&&d.push(s.scalegroup)}for(a=0;ah.vTotal/2?1:0)}function u(t,e,r){if(!t)return 1;var n=Math.sin(t*Math.PI/180);return Math.max(.01,r*n*Math.abs(e)+2*Math.sqrt(1-n*n*e*e))}var c=t("d3"),h=t("../../plots/cartesian/graph_interact"),f=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;s(e,r._size);var u=r._pielayer.selectAll("g.trace").data(e);u.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),u.exit().remove(),u.order(),u.each(function(e){var s=c.select(this),u=e[0],m=u.trace,v=0,y=(m.depth||0)*u.r*Math.sin(v)/2,x=m.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=u.r*Math.cos(v),M=s.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);M.enter().append("g").attr("class",function(t){return t+" part"}),M.exit().remove(),M.order(),l(e),s.selectAll(".top").each(function(){var s=c.select(this).selectAll("g.slice").data(e);s.enter().append("g").classed("slice",!0),s.exit().remove();var l=[[[],[]],[[],[]]],v=!1;s.each(function(o){function s(e){var n=t._fullLayout,a=t._fullData[m.index],s=a.hoverinfo;if("all"===s&&(s="label+text+value+percent+name"),!t._dragging&&n.hovermode!==!1&&"none"!==s&&"skip"!==s&&s){var l=i(o,u),c=M+o.pxmid[0]*(1-l),f=A+o.pxmid[1]*(1-l),d=r.separators,p=[];s.indexOf("label")!==-1&&p.push(o.label),a.text&&a.text[o.i]&&s.indexOf("text")!==-1&&p.push(a.text[o.i]),s.indexOf("value")!==-1&&p.push(g.formatPieValue(o.v,d)),s.indexOf("percent")!==-1&&p.push(g.formatPiePercent(o.v/u.vTotal,d)),h.loneHover({x0:c-l*u.r,x1:c+l*u.r,y:f,text:p.join("
"),name:s.indexOf("name")!==-1?a.name:void 0,color:o.color,idealAlign:o.pxmid[0]<0?"left":"right"},{container:n._hoverlayer.node(),outerContainer:n._paper.node()}),h.hover(t,e,"pie"),E=!0}}function f(e){t.emit("plotly_unhover",{points:[e]}),E&&(h.loneUnhover(r._hoverlayer.node()),E=!1)}function y(){t._hoverdata=[o],t._hoverdata.trace=e.trace,h.click(t,{target:!0})}function b(t,e,r,n){return"a"+n*u.r+","+n*w+" "+x+" "+o.largeArc+(r?" 1 ":" 0 ")+n*(e[0]-t[0])+","+n*(e[1]-t[1])}if(o.hidden)return void c.select(this).selectAll("path,g").remove();l[o.pxmid[1]<0?0:1][o.pxmid[0]<0?0:1].push(o);var M=u.cx+_[0],A=u.cy+_[1],k=c.select(this),T=k.selectAll("path.surface").data([o]),E=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),k.select("path.textline").remove(),k.on("mouseover",s).on("mouseout",f).on("click",y),m.pull){var S=+(Array.isArray(m.pull)?m.pull[o.i]:m.pull)||0;S>0&&(M+=S*o.pxmid[0],A+=S*o.pxmid[1])}o.cxFinal=M,o.cyFinal=A;var L=m.hole;if(o.v===u.vTotal){var z="M"+(M+o.px0[0])+","+(A+o.px0[1])+b(o.px0,o.pxmid,!0,1)+b(o.pxmid,o.px0,!0,1)+"Z";L?T.attr("d","M"+(M+L*o.px0[0])+","+(A+L*o.px0[1])+b(o.px0,o.pxmid,!1,L)+b(o.pxmid,o.px0,!1,L)+"Z"+z):T.attr("d",z)}else{var C=b(o.px0,o.px1,!0,1);if(L){var I=1-L;T.attr("d","M"+(M+L*o.px1[0])+","+(A+L*o.px1[1])+b(o.px1,o.px0,!1,L)+"l"+I*o.px0[0]+","+I*o.px0[1]+C+"Z")}else T.attr("d","M"+M+","+A+"l"+o.px0[0]+","+o.px0[1]+C+"Z")}var P=Array.isArray(m.textposition)?m.textposition[o.i]:m.textposition,D=k.selectAll("g.slicetext").data(o.text&&"none"!==P?[0]:[]);D.enter().append("g").classed("slicetext",!0),D.exit().remove(),D.each(function(){var t=c.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(o.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(d.font,"outside"===P?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,r=d.bBox(t.node());"outside"===P?e=a(r,o):(e=n(r,o,u),"auto"===P&&e.scale<1&&(t.call(d.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),r=d.bBox(t.node())),e=a(r,o)));var i=M+o.pxmid[0]*e.rCenter+(e.x||0),s=A+o.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(o.yLabelMin=s-r.height/2,o.yLabelMid=s,o.yLabelMax=s+r.height/2,o.labelExtraX=0,o.labelExtraY=0,v=!0),t.attr("transform","translate("+i+","+s+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(r.left+r.right)/2+","+-(r.top+r.bottom)/2+")")})}),v&&o(l,m),s.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=c.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],i=t.cyFinal+t.pxmid[1],a="M"+n+","+i,o=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var s=t.labelExtraX*t.pxmid[1]/t.pxmid[0],l=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);a+=Math.abs(s)>Math.abs(l)?"l"+l*t.pxmid[0]/t.pxmid[1]+","+l+"H"+(n+t.labelExtraX+o):"l"+t.labelExtraX+","+s+"v"+(l-s)+"h"+o}else a+="V"+(t.yLabelMid+t.labelExtraY)+"h"+o;e.append("path").classed("textline",!0).call(f.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:a,fill:"none"})}})})}),setTimeout(function(){u.selectAll("tspan").each(function(){var t=c.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":533,"../../components/drawing":556,"../../lib/svg_text_utils":647,"../../plots/cartesian/graph_interact":671,"./helpers":834,d3:95}],839:[function(t,e,r){"use strict";var n=t("d3"),i=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],r=e.trace,a=n.select(this);a.style({opacity:r.opacity}),a.selectAll(".top path.surface").each(function(t){n.select(this).call(i,t,r)})})}},{"./style_one":840,d3:95}],840:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var i=r.marker.line.color;Array.isArray(i)&&(i=i[e.i]||n.defaultLine);var a=r.marker.line.width||0;Array.isArray(a)&&(a=a[e.i]||0),t.style({"stroke-width":a,fill:e.color}).call(n.stroke,i)}},{"../../components/color":533}],841:[function(t,e,r){"use strict";var n=t("../scattergl/attributes");e.exports={x:n.x,y:n.y,xy:{valType:"data_array"},indices:{valType:"data_array"},xbounds:{valType:"data_array"},ybounds:{valType:"data_array"},text:n.text,marker:{color:{valType:"color",arrayOk:!1},opacity:{valType:"number",min:0,max:1,dflt:1,arrayOk:!1},blend:{valType:"boolean",dflt:null},sizemin:{valType:"number",min:.1,max:2,dflt:.5},sizemax:{valType:"number",min:.1,dflt:20},border:{color:{valType:"color",arrayOk:!1},arearatio:{valType:"number",min:0,max:1,dflt:0}}}}},{"../scattergl/attributes":882}],842:[function(t,e,r){"use strict"; +function n(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=a(t.glplot,this.pointcloudOptions),this.pointcloud._trace=this}function i(t,e){var r=new n(t,e.uid);return r.update(e),r}var a=t("gl-pointcloud2d"),o=t("../../lib/str2rgbarray"),s=t("../scatter/get_trace_color"),l=["xaxis","yaxis"],u=n.prototype;u.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}},u.update=function(t){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=s(t,{})},u.updateFast=function(t){var e,r,n,i,a,s,l=this.xData=this.pickXData=t.x,u=this.yData=this.pickYData=t.y,c=this.pickXYData=t.xy,h=t.xbounds&&t.ybounds,f=t.indices,d=this.bounds;if(c){if(n=c,e=c.length>>>1,h)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);if(f)r=f;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=i),ad[3]&&(d[3]=a);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var p=o(t.marker.color),g=o(t.marker.border.color),m=t.opacity*t.marker.opacity;p[3]*=m,this.pointcloudOptions.color=p;var v=t.marker.blend;if(null===v){var y=100;v=l.lengthp&&f.splice(p,f.length-p),d.length>p&&d.splice(p,d.length-p);var g={padded:!0},m={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var v={type:"linear"};i.setConvert(v),l=v.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||f[0]===f[p-1]&&d[0]===d[p-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||f[0]===f[p-1]&&d[0]===d[p-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,i.expand(c,f,g),i.expand(h,d,m);var b=new Array(p);for(u=0;u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],849:[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,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void a.autoMargin(t,u);var c=l.color,h=l.cmin,f=l.cmax;n(h)||(h=i.aggNums(Math.min,null,c)),n(f)||(f=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,h,f),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:h,end:f,size:(f-h)/254}).options(l.colorbar)()}},{"../../components/colorbar/draw":536,"../../components/colorscale":547,"../../lib":633,"../../plots/plots":724,"fast-isnumeric":104}],850:[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":866}],851:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],852:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),h=t("./text_defaults"),f=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,i,r,a)}var m=s(t,e,g),v=mU!=P>=U&&(z=S[T-1][0],C=S[T][0],L=z+(C-z)*(U-I)/(P-I),F=Math.min(F,L),j=Math.max(j,L));F=Math.max(F,0),j=Math.min(j,f._length);var V=l.defaultLine;return l.opacity(h.fillcolor)?V=h.fillcolor:l.opacity((h.line||{}).color)&&(V=h.line.color),n.extendFlat(t,{distance:a.MAXDIST+10,x0:F,x1:j,y0:U,y1:U,color:V}),delete t.index,h.text&&!Array.isArray(h.text)?t.text=String(h.text):t.text=h.name,[t]}}}},{"../../components/color":533,"../../components/errorbars":562,"../../lib":633,"../../plots/cartesian/constants":669,"../../plots/cartesian/graph_interact":671,"./get_trace_color":854}],856:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":672,"./arrays_to_calcdata":845,"./attributes":846,"./calc":847,"./clean_data":848,"./colorbar":849,"./defaults":852,"./hover":855,"./plot":863,"./select":864,"./style":865,"./subtypes":866}],857:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o){var s=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{var l=!Array.isArray(s)&&s||r;o("line.color",l)}o("line.width"),o("line.dash")}},{"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546}],858:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),i=M.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/w._length,r=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*T}function a(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var o,s,l,u,c,h,f,d,p,g,m,v,y,x,b,_,w=e.xaxis,M=e.yaxis,A=e.simplify,k=e.connectGaps,T=e.baseTolerance,E=e.linear,S=[],L=.2,z=new Array(t.length),C=0;for(A||(T=L=-1),o=0;oi(h))break;l=h,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,u=h,d=!1):y=t.length||!h)break;z[C++]=h,s=h}}else z[C++]=u}S.push(z.slice(0,C))}return S}},{"../../constants/numerical":616}],859:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],860:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i,a=null,o=0;o0?Math.max(e,i):0}}},{"fast-isnumeric":104}],862:[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){var u,c=o.isBubble(t),h=(t.line||{}).color;h&&(r=h),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=h&&!Array.isArray(h)&&e.marker.color!==h?h:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":533,"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546,"./subtypes":866}],863:[function(t,e,r){"use strict";function n(t,e){var r;e.selectAll("g.trace").each(function(t){var e=o.select(this);if(r=t[0].trace,r._nexttrace){if(r._nextFill=e.select(".js-fill.js-tonext"),!r._nextFill.size()){var n=":first-child";e.select(".js-fill.js-tozero").size()&&(n+=" + *"),r._nextFill=e.insert("path",n).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),r._nextFill=null;r.fill&&("tozero"===r.fill.substr(0,6)||"toself"===r.fill||"to"===r.fill.substr(0,2)&&!r._prevtrace)?(r._ownFill=e.select(".js-fill.js-tozero"),r._ownFill.size()||(r._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),r._ownFill=null)})}function i(t,e,r,n,i,d,g){function m(t){return A?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function y(t){return t.id}function x(t){if(t.ids)return y}function b(){return!1}function _(t){var e,r,n=t[0].trace,i=o.select(this),a=c.hasMarkers(n),u=c.hasText(n),h=x(n),f=b,d=b;a&&(f=n.marker.maxdisplayed?v:s.identity),u&&(d=n.marker.maxdisplayed?v:s.identity),r=i.selectAll("path.point"),e=r.data(f,h);var p=e.enter().append("path").classed("point",!0);p.call(l.pointStyle,n).call(l.translatePoints,k,T,n),A&&p.style("opacity",0).transition().style("opacity",1),e.each(function(t){var e=m(o.select(this));l.translatePoint(t,e,k,T),l.singlePointStyle(t,e,n)}),A?e.exit().transition().style("opacity",0).remove():e.exit().remove(),r=i.selectAll("g"),e=r.data(d,h),e.enter().append("g").append("text"),e.each(function(t){var e=m(o.select(this).select("text"));l.translatePoint(t,e,k,T)}),e.selectAll("text").call(l.textPointStyle,n).each(function(t){var e=t.xp||k.c2p(t.x),r=t.yp||T.c2p(t.y);o.select(this).selectAll("tspan").each(function(){m(o.select(this)).attr({x:e,y:r})})}),e.exit().remove()}var w,M;a(t,e,r,n,i);var A=!!g&&g.duration>0,k=r.xaxis,T=r.yaxis,E=n[0].trace,S=E.line,L=o.select(d);if(L.call(u.plot,r,g),E.visible===!0){m(L).style("opacity",E.opacity);var z,C,I=E.fill.charAt(E.fill.length-1);"x"!==I&&"y"!==I&&(I=""),n[0].node3=L,h(n);var P="",D=[],O=E._prevtrace;O&&(P=O._prevRevpath||"",C=O._nextFill,D=O._polygons);var R,F,j,N,B,U,V,q,H,G="",X="",Y=[],W=[],Z=s.noop;if(z=E._ownFill,c.hasLines(E)||"none"!==E.fill){for(C&&C.datum(n),["hv","vh","hvh","vhv"].indexOf(S.shape)!==-1?(j=l.steps(S.shape),N=l.steps(S.shape.split("").reverse().join(""))):j=N="spline"===S.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),S.smoothing):l.smoothopen(t,S.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return N(t.reverse())},Y=f(n,{xaxis:k,yaxis:T,connectGaps:E.connectgaps,baseTolerance:Math.max(S.width||1,3)/4,linear:"linear"===S.shape,simplify:S.simplify}),H=E._polygons=new Array(Y.length),M=0;M1}),Z=function(t){return function(e){if(R=j(e),F=B(e),G?I?(G+="L"+R.substr(1),X=F+("L"+X.substr(1))):(G+="Z"+R,X=F+"Z"+X):(G=R,X=F),c.hasLines(E)&&e.length>1){var r=o.select(this);if(r.datum(n),t)m(r.style("opacity",0).attr("d",R).call(l.lineGroupStyle)).style("opacity",1);else{var i=m(r);i.attr("d",R),l.singleLineStyle(n,i)}}}}}var Q=L.selectAll(".js-line").data(W);m(Q.exit()).style("opacity",0).remove(),Q.each(Z(!1)),Q.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Z(!0)),Y.length&&(z?U&&q&&(I?("y"===I?U[1]=q[1]=T.c2p(0,!0):"x"===I&&(U[0]=q[0]=k.c2p(0,!0)),m(z).attr("d","M"+q+"L"+U+"L"+G.substr(1))):m(z).attr("d",G+"Z")):"tonext"===E.fill.substr(0,6)&&G&&P&&("tonext"===E.fill?m(C).attr("d",G+"Z"+P+"Z"):m(C).attr("d",G+"L"+P.substr(1)+"Z"),E._polygons=E._polygons.concat(D)),E._prevRevpath=X,E._prevPolygons=H);var K=L.selectAll(".points");w=K.data([n]),K.each(_),w.enter().append("g").classed("points",!0).each(_),w.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,s=r.yaxis,l=o.extent(a.range.map(a.r2l).map(a.l2c)),u=o.extent(s.range.map(s.r2l).map(s.l2c)),h=n[0].trace;if(c.hasMarkers(h)){var f=h.marker.maxdisplayed;if(0!==f){var d=n.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(d.length/f),g=0;i.forEach(function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;for(c=p.selectAll("g.trace"),h=c.data(r,function(t){return t[0].trace.uid}),h.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),d(t,e,r),n(t,p),l=0,u=[];ln?1:-1}),m){s&&(f=s());var v=o.transition().duration(a.duration).ease(a.easing).each("end",function(){f&&f()}).each("interrupt",function(){f&&f()});v.each(function(){p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)})})}else p.selectAll("g.trace").each(function(n,o){i(t,o,e,n,r,this,a)});g&&h.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":556,"../../components/errorbars":562,"../../lib":633,"../../lib/polygon":640,"./arrays_to_calcdata":845,"./line_points":858,"./link_traces":860,"./subtypes":866,d3:95}],864:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,a,o,s,l=t.cd,u=t.xaxis,c=t.yaxis,h=[],f=l[0].trace,d=f.index,p=f.marker,g=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return M[t]}function u(t,e,r,n,i){var a=null;if(Array.isArray(t)){a=[];for(var o=0;o=0){var f=i(l.position,l.delaunayColor,l.delaunayAxis);f.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(f):(f.gl=o,this.delaunayMesh=m(f),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},k.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=f},{"../../constants/gl3d_dashes":614,"../../constants/gl_markers":615,"../../lib":633,"../../lib/gl_format_color":631,"../../lib/str2rgbarray":646,"../scatter/make_bubble_size_func":861,"./calc_errors":871,"delaunay-triangulate":96,"gl-error3d":133,"gl-line3d":140,"gl-mesh3d":173,"gl-scatter3d":216}],873:[function(t,e,r){"use strict";function n(t,e,r){var n=0,i=r("x"),a=r("y"),o=r("z");return i&&a&&o&&(n=Math.min(i.length,a.length,o.length),n=0&&f("surfacecolor",p||g);for(var m=["x","y","z"],v=0;v<3;++v){var y="projection."+m[v];f(y+".show")&&(f(y+".opacity"),f(y+".scale"))}u(t,e,r,{axis:"z"}),u(t,e,r,{axis:"y",inherit:"z"}),u(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":561,"../../lib":633,"../scatter/line_defaults":857,"../scatter/marker_defaults":862,"../scatter/subtypes":866,"../scatter/text_defaults":867,"./attributes":869}],874:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl_markers":615,"../../plots/gl3d":703,"../scatter/colorbar":849,"./attributes":869,"./calc":870,"./convert":872,"./defaults":873}],875:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),a=t("../../components/colorscale/color_attributes"),o=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={lon:{valType:"data_array"},lat:{valType:"data_array"},locations:{valType:"data_array"},locationmode:{valType:"enumerated",values:["ISO-3","USA-states","country names"],dflt:"ISO-3"},mode:o({},n.mode,{dflt:"markers"}),text:o({},n.text,{}),textfont:n.textfont,textposition:n.textposition,line:{color:l.color,width:l.width,dash:l.dash},connectgaps:n.connectgaps,marker:o({},{symbol:s.symbol,opacity:s.opacity,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,colorbar:s.colorbar,line:o({},{width:u.width},a("marker.line"))},a("marker")),fill:{valType:"enumerated",values:["none","toself"],dflt:"none"},fillcolor:n.fillcolor,hoverinfo:o({},i.hoverinfo,{flags:["lon","lat","location","text","name"]})}},{"../../components/colorscale/color_attributes":540,"../../lib/extend":626,"../../plots/attributes":662,"../scatter/attributes":846}],876:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../scatter/colorscale_calc");e.exports=function(t,e){for(var r=Array.isArray(e.locations),a=r?e.locations.length:e.lon.length,o=[],s=0,l=0;l0&&(o[s-1].gapAfter=!0):(s++,o.push(c))}return i(e),o}},{"../scatter/colorscale_calc":850,"fast-isnumeric":104}],877:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=0,o=r("locations");return o?(r("locationmode"),a=o.length):(n=r("lon")||[],i=r("lat")||[],a=Math.min(n.length,i.length),a")}var i=t("../../plots/cartesian/graph_interact"),a=t("../../plots/cartesian/axes"),o=t("../scatter/get_trace_color"),s=t("./attributes");e.exports=function(t){function e(t){return c.projection(t)}function r(t){var r=t.lonlat;if(null===r[0]||null===r[1])return 1/0;if(c.isLonLatOverEdges(r))return 1/0;var n=e(r),i=l.c2p(),a=u.c2p(),o=Math.abs(i-n[0]),s=Math.abs(a-n[1]),h=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(o*o+s*s)-h,1-3/h)}var a=t.cd,s=a[0].trace,l=t.xa,u=t.ya,c=t.subplot;if(!a[0].placeholder&&(i.getClosest(a,r,t),t.index!==!1)){var h=a[t.index],f=h.lonlat,d=e(f),p=h.mrc||1;return t.x0=d[0]-p,t.x1=d[0]+p,t.y0=d[1]-p,t.y1=d[1]+p,t.loc=h.loc,t.lat=f[0],t.lon=f[1],t.color=o(s,h),t.extraText=n(s,h,c.mockAxis),[t]}}},{"../../plots/cartesian/axes":664,"../../plots/cartesian/graph_interact":671,"../scatter/get_trace_color":854,"./attributes":875}],880:[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.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.moduleType="trace",n.name="scattergeo",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/geo":688,"../scatter/colorbar":849,"./attributes":875,"./calc":876,"./defaults":877,"./event_data":878,"./hover":879,"./plot":881}],881:[function(t,e,r){"use strict";function n(t,e){if(!Array.isArray(t.locations))return u.identity;var r=c(t,e),n=t.locationmode;return function(t){var e=h(n,t.loc,r);return e?(t.lonlat=e.properties.ct,t):(t.lonlat=[null,null],!1)}}function i(t,e,r){function n(t,n){d(t,e,n,r)}var i=t.marker;if(n(t.text,"tx"),n(t.textposition,"tp"),t.textfont&&(n(t.textfont.size,"ts"),n(t.textfont.color,"tc"),n(t.textfont.family,"tf")),i&&i.line){var a=i.line;n(i.opacity,"mo"),n(i.symbol,"mx"),n(i.color,"mc"),n(i.size,"ms"),n(a.color,"mlc"),n(a.width,"mlw")}}function a(t){var e=t.framework.selectAll("g.trace.scattergeo");e.style("opacity",function(t){return t[0].trace.opacity}),e.each(function(t){var e=t[0].trace,r=o.select(this);r.selectAll("path.point").call(s.pointStyle,e),r.selectAll("text").call(s.textPointStyle,e)}),e.selectAll("path.js-line").style("fill","none").each(function(t){var e=o.select(this),r=t.trace,n=r.line||{};e.call(l.stroke,n.color).call(s.dashLine,n.dash||"",n.width||0),"none"!==r.fill&&e.call(l.fill,r.fillcolor)})}var o=t("d3"),s=t("../../components/drawing"),l=t("../../components/color"),u=t("../../lib"),c=t("../../lib/topojson_utils").getTopojsonFeatures,h=t("../../lib/geo_location_utils").locationToFeature,f=t("../../lib/geojson_utils"),d=t("../../lib/array_to_calc_item"),p=t("../scatter/subtypes");e.exports=function(t,e){function r(t){return t[0].trace.uid}var s=t.framework.select(".scattergeolayer").selectAll("g.trace.scattergeo").data(e,r);s.enter().append("g").attr("class","trace scattergeo"),s.exit().remove(),s.selectAll("*").remove(),s.each(function(e){var r=o.select(this),a=e[0].trace,s=n(a,t.topojson);e[0].placeholder&&r.remove();for(var l=[],u=0;u=e.length?i:e[a]);return n}function o(t,e,r){return l(C(t,r),z(e,r),r)}function s(t,e,r,n){var i=w(t,e,n);return i=Array.isArray(i[0])?i:a(m.identity,[i],n),l(i,z(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;i0&&(v[y-1].gapAfter=!0)}return v}},{"../../components/colorscale":547,"../../lib":633,"../scatter/colorscale_calc":850,"../scatter/make_bubble_size_func":861,"../scatter/subtypes":866,"fast-isnumeric":104}],888:[function(t,e,r){"use strict";function n(){return{geojson:h.makeBlank(),layout:{visibility:"none"},paint:{}}}function i(t,e){function r(t,r,n,i){void 0===e[r][n]&&(e[r][n]=i),t[r]=e[r][n]}for(var n=t[0].trace,i=n.marker,a=Array.isArray(i.color),o=Array.isArray(i.size),s=[],l=0;l")}var i=t("../../plots/cartesian/graph_interact"),a=t("../scatter/get_trace_color");e.exports=function(t,e,r){function o(t){var e=t.lonlat,n=Math.abs(u.c2p(e)-u.c2p([d,e[1]])),i=Math.abs(c.c2p(e)-c.c2p([e[0],r])),a=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(n*n+i*i)-a,1-3/a)}var s=t.cd,l=s[0].trace,u=t.xa,c=t.ya;if(!s[0].placeholder){var h=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),f=360*h,d=e-f;if(i.getClosest(s,o,t),t.index!==!1){var p=s[t.index],g=p.lonlat,m=[g[0]+f,g[1]],v=u.c2p(m),y=c.c2p(m),x=p.mrc||1;return t.x0=v-x,t.x1=v+x,t.y0=y-x,t.y1=y+x,t.color=a(l,p),t.extraText=n(l,p),[t]}}}},{"../../plots/cartesian/graph_interact":671,"../scatter/get_trace_color":854}],892:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.plot=t("./plot"),n.moduleType="trace",n.name="scattermapbox",n.basePlotModule=t("../../plots/mapbox"),n.categories=["mapbox","gl","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/mapbox":718,"../scatter/colorbar":849,"./attributes":886,"./calc":887,"./defaults":889,"./event_data":890,"./hover":891,"./plot":893}],893:[function(t,e,r){"use strict";function n(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.mapbox.initSource(this.idSourceFill),this.mapbox.initSource(this.idSourceLine),this.mapbox.initSource(this.idSourceCircle),this.mapbox.initSource(this.idSourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle,source:this.idSourceCircle,type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var a=t("./convert"),o=n.prototype;o.update=function(t){var e=this.mapbox,r=a(t);e.setOptions(this.idLayerFill,"setLayoutProperty",r.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",r.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",r.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",r.symbol.layout), +i(r.fill)&&(e.setSourceData(this.idSourceFill,r.fill.geojson),e.setOptions(this.idLayerFill,"setPaintProperty",r.fill.paint)),i(r.line)&&(e.setSourceData(this.idSourceLine,r.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",r.line.paint)),i(r.circle)&&(e.setSourceData(this.idSourceCircle,r.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",r.circle.paint)),i(r.symbol)&&(e.setSourceData(this.idSourceSymbol,r.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",r.symbol.paint))},o.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var r=e[0].trace,i=new n(t,r.uid);return i.update(e),i}},{"./convert":888}],894:[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,u=n.line,c=l.line;e.exports={a:{valType:"data_array"},b:{valType:"data_array"},c:{valType:"data_array"},sum:{valType:"number",dflt:0,min:0},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},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},a("marker".line))},a("marker"),{showscale:l.showscale,colorbar:o}),textfont:n.textfont,textposition:n.textposition,hoverinfo:s({},i.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron}},{"../../components/colorbar/attributes":534,"../../components/colorscale/color_attributes":540,"../../lib/extend":626,"../../plots/attributes":662,"../scatter/attributes":846}],895:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=t("../scatter/subtypes"),s=t("../scatter/colorscale_calc"),l=["a","b","c"],u={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,c,h,f,d,p,g=t._fullLayout[e.subplot],m=g.sum,v=e.sum||m;for(r=0;rA&&E.splice(A,E.length-A)}return s(e),"undefined"!=typeof E&&a.mergeArray(E,k,"ms"),k}},{"../../lib":633,"../../plots/cartesian/axes":664,"../scatter/colorscale_calc":850,"../scatter/subtypes":866,"fast-isnumeric":104}],896:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),a=t("../scatter/subtypes"),o=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/line_shape_defaults"),u=t("../scatter/text_defaults"),c=t("../scatter/fillcolor_defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function d(r,i){return n.coerce(t,e,h,r,i)}var p,g=d("a"),m=d("b"),v=d("c");if(g?(p=g.length,m?(p=Math.min(p,m.length),v&&(p=Math.min(p,v.length))):p=v?Math.min(p,v.length):0):m&&v&&(p=Math.min(m.length,v.length)),!p)return void(e.visible=!1);g&&p"),s}}},{"../../plots/cartesian/axes":664,"../scatter/hover":855}],898:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/ternary":732,"../scatter/colorbar":849,"./attributes":894,"./calc":895,"./defaults":896,"./hover":897,"./plot":899,"./select":900,"./style":901}],899:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e){var r=t.plotContainer;r.select(".scatterlayer").selectAll("*").remove();for(var i={xaxis:t.xaxis,yaxis:t.yaxis,plot:r},a=new Array(e.length),o=t.graphDiv.calcdata,s=0;s":return function(t){return e(t)>n};case">=":return function(t){return e(t)>=n};case"[]":return function(t){var r=e(t);return r>=n[0]&&r<=n[1]};case"()":return function(t){var r=e(t);return r>n[0]&&r=n[0]&&rn[0]&&r<=n[1]};case"][":return function(t){var r=e(t);return r<=n[0]||r>=n[1]};case")(":return function(t){var r=e(t);return rn[1]};case"](":return function(t){var r=e(t);return r<=n[0]||r>n[1]};case")[":return function(t){var r=e(t);return r=n[1]};case"{}":return function(t){return n.indexOf(e(t))!==-1};case"}{":return function(t){return n.indexOf(e(t))===-1}}}var o=t("../lib"),s=t("../plot_api/plot_schema"),l=t("../plots/cartesian/axis_ids"),u=t("../plots/cartesian/axis_autotype"),c=t("../plots/cartesian/set_convert"),h=["=","<",">=",">","<="],f=["[]","()","[)","(]","][",")(","](",")["],d=["{}","}{"];r.moduleType="transform",r.name="filter",r.attributes={enabled:{valType:"boolean",dflt:!0},target:{valType:"string",strict:!0,noBlank:!0,arrayOk:!0,dflt:"x"},operation:{valType:"enumerated",values:[].concat(h).concat(f).concat(d),dflt:"="},value:{valType:"any",dflt:0}},r.supplyDefaults=function(t){function e(e,i){return o.coerce(t,n,r.attributes,e,i)}var n={},i=e("enabled");return i&&(e("operation"),e("value"),e("target")),n},r.calcTransform=function(t,e,r){function l(t,r){var n=g[t],i=o.nestedProperty(e,t).get();i.push(n[r])}if(r.enabled){var u=r.target,c=n(e,u),h=c.length;if(h){for(var f=i(t,e,u),d=a(r,f),p=s.findArrayAttributes(e),g={},m=0;m Date: Fri, 18 Nov 2016 11:45:46 -0500 Subject: [PATCH 17/51] tasks: fixup main bundle URLs --- dist/README.md | 4 ++-- tasks/stats.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/README.md b/dist/README.md index 44e9170e85e..c37d928e3f7 100644 --- a/dist/README.md +++ b/dist/README.md @@ -37,11 +37,11 @@ The main plotly.js bundle includes all the official (non-beta) trace modules. It be can imported as minified javascript - using dist file `dist/plotly.min.js` -- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.min.js OR https://cdn.plot.ly/plotly-plotly-1.20.2.min.js +- using CDN URL https://cdn.plot.ly/plotly-latest.min.js OR https://cdn.plot.ly/plotly-1.20.2.min.js or as raw javascript: - using dist file `dist/plotly.js` -- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.js OR https://cdn.plot.ly/plotly-plotly-1.20.2.js +- using CDN URL https://cdn.plot.ly/plotly-latest.js OR https://cdn.plot.ly/plotly-1.20.2.js - using CommonJS with `require('plotly.js')` If you would like to have access to the attribute meta information (including attribute descriptions as on the [schema reference page](https://plot.ly/javascript/reference/)), use dist file `dist/plotly-with-meta.js` diff --git a/tasks/stats.js b/tasks/stats.js index 8d4de5d754a..6478db4a47a 100644 --- a/tasks/stats.js +++ b/tasks/stats.js @@ -95,11 +95,11 @@ function getMainBundleInfo() { '', 'It be can imported as minified javascript', '- using dist file `dist/plotly.min.js`', - '- using CDN URL ' + cdnRoot + 'plotly-latest.min.js OR ' + cdnRoot + 'plotly-' + pkg.version + MINJS, + '- using CDN URL ' + cdnRoot + 'latest' + MINJS + ' OR ' + cdnRoot + pkg.version + MINJS, '', 'or as raw javascript:', '- using dist file `dist/plotly.js`', - '- using CDN URL ' + cdnRoot + 'plotly-latest.js OR ' + cdnRoot + 'plotly-' + pkg.version + JS, + '- using CDN URL ' + cdnRoot + 'latest' + JS + ' OR ' + cdnRoot + pkg.version + JS, '- using CommonJS with `require(\'plotly.js\')`', '', 'If you would like to have access to the attribute meta information ' + From fb44aeeddc177bca608dac61d6999e436945ba5c Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Fri, 18 Nov 2016 21:47:39 +0100 Subject: [PATCH 18/51] fixing the non-fancy scattergl 'single data point' infinite loop --- src/traces/scattergl/convert.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/traces/scattergl/convert.js b/src/traces/scattergl/convert.js index 1b4c361897d..60725bb1aa8 100644 --- a/src/traces/scattergl/convert.js +++ b/src/traces/scattergl/convert.js @@ -272,7 +272,7 @@ proto.update = function(options) { // also, there are quite a few differences function allFastTypesLikely(a) { var len = a.length, - inc = Math.max(0, (len - 1) / Math.min(Math.max(len, 1), 1000)), + inc = Math.max(1, (len - 1) / Math.min(Math.max(len, 1), 1000)), ai; for(var i = 0; i < len; i += inc) { From bd34ec2b6eff3ad2e315df326651c52cb23f45ea Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Fri, 18 Nov 2016 21:46:57 -0500 Subject: [PATCH 19/51] use UTC milliseconds for internal representation of dates We still interpret JS date objects according to the date and hour they have in the local timezone, and for backward compatibility we shift milliseconds (in ranges etc) by the local/UTC offset. --- src/lib/dates.js | 55 +++++++++++++++++-------- src/plots/cartesian/axes.js | 25 +++++------ src/plots/cartesian/dragbox.js | 10 +++-- src/plots/plots.js | 2 +- test/jasmine/tests/lib_date_test.js | 64 +++++++++++++++++++++-------- 5 files changed, 107 insertions(+), 49 deletions(-) diff --git a/src/lib/dates.js b/src/lib/dates.js index 43de12f5719..a486bc797ee 100644 --- a/src/lib/dates.js +++ b/src/lib/dates.js @@ -87,7 +87,9 @@ var MIN_MS, MAX_MS; exports.dateTime2ms = function(s) { // first check if s is a date object if(exports.isJSDate(s)) { - s = Number(s); + // Convert to the UTC milliseconds that give the same + // hours as this date has in the local timezone + s = Number(s) - s.getTimezoneOffset() * ONEMIN; if(s >= MIN_MS && s <= MAX_MS) return s; return BADNUM; } @@ -109,14 +111,10 @@ exports.dateTime2ms = function(s) { // javascript takes new Date(0..99,m,d) to mean 1900-1999, so // to support years 0-99 we need to use setFullYear explicitly - var date = new Date(2000, m - 1, d, H, M); - date.setFullYear(y); + var date = new Date(Date.UTC(2000, m - 1, d, H, M)); + date.setUTCFullYear(y); - if(date.getDate() !== d) return BADNUM; - - // does that hour exist in this day? (Daylight time!) - // (TODO: remove this check when we move to UTC) - if(date.getHours() !== H) return BADNUM; + if(date.getUTCDate() !== d) return BADNUM; return date.getTime() + S * ONESEC; }; @@ -150,16 +148,41 @@ exports.ms2DateTime = function(ms, r) { if(!r) r = 0; - var d = new Date(Math.floor(ms)), - dateStr = d3.time.format('%Y-%m-%d')(d), + var msecTenths = Math.round(((ms % 1) + 1) * 10) % 10, + d = new Date(Math.round(ms - msecTenths / 10)), + dateStr = d3.time.format.utc('%Y-%m-%d')(d), // <90 days: add hours and minutes - never *only* add hours - h = (r < NINETYDAYS) ? d.getHours() : 0, - m = (r < NINETYDAYS) ? d.getMinutes() : 0, + h = (r < NINETYDAYS) ? d.getUTCHours() : 0, + m = (r < NINETYDAYS) ? d.getUTCMinutes() : 0, // <3 hours: add seconds - s = (r < THREEHOURS) ? d.getSeconds() : 0, + s = (r < THREEHOURS) ? d.getUTCSeconds() : 0, // <5 minutes: add ms (plus one extra digit, this is msec*10) - msec10 = (r < FIVEMIN) ? Math.round((d.getMilliseconds() + (((ms % 1) + 1) % 1)) * 10) : 0; + msec10 = (r < FIVEMIN) ? d.getUTCMilliseconds() * 10 + msecTenths : 0; + + return includeTime(dateStr, h, m, s, msec10); +}; + +// For converting old-style milliseconds to date strings, +// we use the local timezone rather than UTC like we use +// everywhere else, both for backward compatibility and +// because that's how people mostly use javasript date objects. +// Clip one extra day off our date range though so we can't get +// thrown beyond the range by the timezone shift. +exports.ms2DateTimeLocal = function(ms) { + if(!(ms >= MIN_MS + ONEDAY && ms <= MAX_MS - ONEDAY)) return BADNUM; + + var msecTenths = Math.round(((ms % 1) + 1) * 10) % 10, + d = new Date(Math.round(ms - msecTenths / 10)), + dateStr = d3.time.format('%Y-%m-%d')(d), + h = d.getHours(), + m = d.getMinutes(), + s = d.getSeconds(), + msec10 = d.getUTCMilliseconds() * 10 + msecTenths; + + return includeTime(dateStr, h, m, s, msec10); +}; +function includeTime(dateStr, h, m, s, msec10) { // include each part that has nonzero data in or after it if(h || m || s || msec10) { dateStr += ' ' + lpad(h, 2) + ':' + lpad(m, 2); @@ -176,7 +199,7 @@ exports.ms2DateTime = function(ms, r) { } } return dateStr; -}; +} // normalize date format to date string, in case it starts as // a Date object or milliseconds @@ -186,7 +209,7 @@ exports.cleanDate = function(v, dflt) { // NOTE: if someone puts in a year as a number rather than a string, // this will mistakenly convert it thinking it's milliseconds from 1970 // that is: '2012' -> Jan. 1, 2012, but 2012 -> 2012 epoch milliseconds - v = exports.ms2DateTime(+v); + v = exports.ms2DateTimeLocal(+v); if(!v && dflt !== undefined) return dflt; } else if(!exports.isDateTime(v)) { diff --git a/src/plots/cartesian/axes.js b/src/plots/cartesian/axes.js index 27359e06df9..4026a806b55 100644 --- a/src/plots/cartesian/axes.js +++ b/src/plots/cartesian/axes.js @@ -917,7 +917,7 @@ axes.tickIncrement = function(x, dtick, axrev) { var y = new Date(x); // is this browser consistent? setMonth edits a date but // returns that date's milliseconds - return y.setMonth(y.getMonth() + dtSigned); + return y.setMonth(y.getUTCMonth() + dtSigned); } // Log scales: Linear, Digits @@ -968,9 +968,9 @@ axes.tickFirst = function(ax) { if(tType === 'M') { t0 = new Date(tick0); r0 = new Date(r0); - mdif = (r0.getFullYear() - t0.getFullYear()) * 12 + - r0.getMonth() - t0.getMonth(); - t1 = t0.setMonth(t0.getMonth() + + mdif = (r0.getUTCFullYear() - t0.getUTCFullYear()) * 12 + + r0.getUTCMonth() - t0.getUTCMonth(); + t1 = t0.setMonth(t0.getUTCMonth() + (Math.round(mdif / dtNum) + (axrev ? 1 : -1)) * dtNum); while(axrev ? t1 > r0 : t1 < r0) { @@ -994,12 +994,13 @@ axes.tickFirst = function(ax) { else throw 'unrecognized dtick ' + String(dtick); }; -var yearFormat = d3.time.format('%Y'), - monthFormat = d3.time.format('%b %Y'), - dayFormat = d3.time.format('%b %-d'), - yearMonthDayFormat = d3.time.format('%b %-d, %Y'), - minuteFormat = d3.time.format('%H:%M'), - secondFormat = d3.time.format(':%S'); +var utcFormat = d3.time.format.utc, + yearFormat = utcFormat('%Y'), + monthFormat = utcFormat('%b %Y'), + dayFormat = utcFormat('%b %-d'), + yearMonthDayFormat = utcFormat('%b %-d, %Y'), + minuteFormat = utcFormat('%H:%M'), + secondFormat = utcFormat(':%S'); // add one item to d3's vocabulary: // %{n}f where n is the max number of digits @@ -1012,10 +1013,10 @@ function modDateFormat(fmt, x) { var digits = Math.min(+fm[1] || 6, 6), fracSecs = String((x / 1000 % 1) + 2.0000005) .substr(2, digits).replace(/0+$/, '') || '0'; - return d3.time.format(fmt.replace(fracMatch, fracSecs))(d); + return utcFormat(fmt.replace(fracMatch, fracSecs))(d); } else { - return d3.time.format(fmt)(d); + return utcFormat(fmt)(d); } } diff --git a/src/plots/cartesian/dragbox.js b/src/plots/cartesian/dragbox.js index 0df91d1ec77..2927becef5a 100644 --- a/src/plots/cartesian/dragbox.js +++ b/src/plots/cartesian/dragbox.js @@ -298,16 +298,18 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function zoomAxRanges(axList, r0Fraction, r1Fraction) { var i, axi, - axRangeLinear; + axRangeLinear0, + axRangeLinearSpan; for(i = 0; i < axList.length; i++) { axi = axList[i]; if(axi.fixedrange) continue; - axRangeLinear = axi.range.map(axi.r2l); + axRangeLinear0 = axi._rl[0]; + axRangeLinearSpan = axi._rl[1] - axRangeLinear0; axi.range = [ - axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r0Fraction), - axi.l2r(axRangeLinear[0] + (axRangeLinear[1] - axRangeLinear[0]) * r1Fraction) + axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction), + axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction) ]; } } diff --git a/src/plots/plots.js b/src/plots/plots.js index b8003c66c81..3ad048addd5 100644 --- a/src/plots/plots.js +++ b/src/plots/plots.js @@ -1390,7 +1390,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { // convert native dates to date strings... // mostly for external users exporting to plotly - if(Lib.isJSDate(d)) return Lib.ms2DateTime(+d); + if(Lib.isJSDate(d)) return Lib.ms2DateTimeLocal(+d); return d; } diff --git a/test/jasmine/tests/lib_date_test.js b/test/jasmine/tests/lib_date_test.js index d0d5c46bb54..43cd2670e88 100644 --- a/test/jasmine/tests/lib_date_test.js +++ b/test/jasmine/tests/lib_date_test.js @@ -18,6 +18,7 @@ describe('dates', function() { describe('dateTime2ms', function() { it('should accept valid date strings', function() { + var tzOffset; [ ['2016', new Date(2016, 0, 1)], @@ -34,10 +35,11 @@ describe('dates', function() { // first century, also allow month, day, and hour to be 1-digit, and not all // three digits of milliseconds ['0013-1-1 1:00:00.6', d1c], - // we support more than 4 digits too, though Date objects don't. More than that + // we support tenths of msec too, though Date objects don't. Smaller than that // and we hit the precision limit of js numbers unless we're close to the epoch. // It won't break though. ['0013-1-1 1:00:00.6001', +d1c + 0.1], + ['0013-1-1 1:00:00.60011111111', +d1c + 0.11111111], // 2-digit years get mapped to now-70 -> now+29 [thisYear_2 + '-05', new Date(thisYear, 4, 1)], @@ -50,11 +52,16 @@ describe('dates', function() { ['2014-03-04 08:15:34+1200', new Date(2014, 2, 4, 8, 15, 34)], ['2014-03-04 08:15:34.567-05:45', new Date(2014, 2, 4, 8, 15, 34, 567)], ].forEach(function(v) { - expect(Lib.dateTime2ms(v[0])).toBe(+v[1], v[0]); + // just for sub-millisecond precision tests, use timezoneoffset + // from the previous date object + if(v[1].getTimezoneOffset) tzOffset = v[1].getTimezoneOffset(); + + var expected = +v[1] - (tzOffset * 60000); + expect(Lib.dateTime2ms(v[0])).toBe(expected, v[0]); // ISO-8601: all the same stuff with t or T as the separator - expect(Lib.dateTime2ms(v[0].trim().replace(' ', 't'))).toBe(+v[1], v[0].trim().replace(' ', 't')); - expect(Lib.dateTime2ms('\r\n\t ' + v[0].trim().replace(' ', 'T') + '\r\n\t ')).toBe(+v[1], v[0].trim().replace(' ', 'T')); + expect(Lib.dateTime2ms(v[0].trim().replace(' ', 't'))).toBe(expected, v[0].trim().replace(' ', 't')); + expect(Lib.dateTime2ms('\r\n\t ' + v[0].trim().replace(' ', 'T') + '\r\n\t ')).toBe(expected, v[0].trim().replace(' ', 'T')); }); }); @@ -69,7 +76,7 @@ describe('dates', function() { [ 1000, 9999, -1000, -9999 ].forEach(function(v) { - expect(Lib.dateTime2ms(v)).toBe(+(new Date(v, 0, 1)), v); + expect(Lib.dateTime2ms(v)).toBe(Date.UTC(v, 0, 1), v); }); [ @@ -78,7 +85,7 @@ describe('dates', function() { [nowMinus70_2, nowMinus70], [99, 1999] ].forEach(function(v) { - expect(Lib.dateTime2ms(v[0])).toBe(+(new Date(v[1], 0, 1)), v[0]); + expect(Lib.dateTime2ms(v[0])).toBe(Date.UTC(v[1], 0, 1), v[0]); }); }); @@ -93,7 +100,7 @@ describe('dates', function() { d1c, new Date(2015, 8, 7, 23, 34, 45, 567) ].forEach(function(v) { - expect(Lib.dateTime2ms(v)).toBe(+v); + expect(Lib.dateTime2ms(v)).toBe(+v - v.getTimezoneOffset() * 60000); }); }); @@ -124,6 +131,30 @@ describe('dates', function() { expect(Lib.dateTime2ms(v)).toBeUndefined(v); }); }); + + var JULY1MS = 181 * 24 * 3600 * 1000; + + it('should use UTC with no timezone offset or daylight saving time', function() { + expect(Lib.dateTime2ms('1970-01-01')).toBe(0); + + // 181 days (and no DST hours) between jan 1 and july 1 in a non-leap-year + // 31 + 28 + 31 + 30 + 31 + 30 + expect(Lib.dateTime2ms('1970-07-01')).toBe(JULY1MS); + }); + + it('should interpret JS dates by local time, not by its getTime()', function() { + // not really part of the test, just to make sure the test is meaningful + // the test should NOT be run in a UTC environment + expect([ + Number(new Date(1970, 0, 1)), + Number(new Date(1970, 6, 1)) + ]).not.toEqual([0, JULY1MS]); + + // now repeat the previous test and show that we throw away + // timezone info from js dates + expect(Lib.dateTime2ms(new Date(1970, 0, 1))).toBe(0); + expect(Lib.dateTime2ms(new Date(1970, 6, 1))).toBe(JULY1MS); + }); }); describe('ms2DateTime', function() { @@ -159,8 +190,8 @@ describe('dates', function() { it('should not accept Date objects beyond our limits or other objects', function() { [ - +(new Date(10000, 0, 1)), - +(new Date(-10000, 11, 31, 23, 59, 59, 999)), + Date.UTC(10000, 0, 1), + Date.UTC(-10000, 11, 31, 23, 59, 59, 999), '', '2016-01-01', '0', @@ -191,19 +222,20 @@ describe('dates', function() { }); describe('cleanDate', function() { - it('should convert any number or js Date within range to a date string', function() { + it('should convert numbers or js Dates to strings based on local TZ', function() { [ new Date(0), new Date(2000), new Date(2000, 0, 1), new Date(), - new Date(-9999, 0, 1), - new Date(9999, 11, 31, 23, 59, 59, 999) + new Date(-9999, 0, 3), // we lose one day of range +/- tzoffset this way + new Date(9999, 11, 29, 23, 59, 59, 999) ].forEach(function(v) { - expect(typeof Lib.ms2DateTime(+v)).toBe('string'); - expect(Lib.cleanDate(v)).toBe(Lib.ms2DateTime(+v)); - expect(Lib.cleanDate(+v)).toBe(Lib.ms2DateTime(+v)); - expect(Lib.cleanDate(v, '2000-01-01')).toBe(Lib.ms2DateTime(+v)); + var expected = Lib.ms2DateTime(Lib.dateTime2ms(v)); + expect(typeof expected).toBe('string'); + expect(Lib.cleanDate(v)).toBe(expected); + expect(Lib.cleanDate(+v)).toBe(expected); + expect(Lib.cleanDate(v, '2000-01-01')).toBe(expected); }); }); From 9c645e7b61058a908cc37b769fc9b12a01946461 Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Fri, 18 Nov 2016 22:19:56 -0500 Subject: [PATCH 20/51] if it works in Alaska it'll work anywhere. --- circle.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/circle.yml b/circle.yml index 085c303b25c..584761eefcb 100644 --- a/circle.yml +++ b/circle.yml @@ -6,6 +6,8 @@ general: machine: node: version: 6.1.0 + timezone: + America/Anchorage services: - docker From 6d83c7bad91db900078be05d3ee7d81e91bca053 Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Fri, 18 Nov 2016 22:24:45 -0500 Subject: [PATCH 21/51] verify our test environment has DST --- test/jasmine/tests/lib_date_test.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/jasmine/tests/lib_date_test.js b/test/jasmine/tests/lib_date_test.js index 43cd2670e88..a73f79c7b25 100644 --- a/test/jasmine/tests/lib_date_test.js +++ b/test/jasmine/tests/lib_date_test.js @@ -145,10 +145,13 @@ describe('dates', function() { it('should interpret JS dates by local time, not by its getTime()', function() { // not really part of the test, just to make sure the test is meaningful // the test should NOT be run in a UTC environment - expect([ - Number(new Date(1970, 0, 1)), - Number(new Date(1970, 6, 1)) - ]).not.toEqual([0, JULY1MS]); + var local0 = Number(new Date(1970, 0, 1)), + localjuly1 = Number(new Date(1970, 6, 1)); + expect([local0, localjuly1]).not.toEqual([0, JULY1MS], + 'test must not run in UTC'); + // verify that there *is* daylight saving time in the test environment + expect(localjuly1 - local0).not.toEqual(JULY1MS - 0, + 'test must run in a timezone with DST'); // now repeat the previous test and show that we throw away // timezone info from js dates From 02e98a9380d32a00836f0d749a1f9cf14815f48f Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Sat, 19 Nov 2016 00:13:10 -0500 Subject: [PATCH 22/51] fix range selectors for UTC, and tests to run in arbitrary timezone --- src/components/rangeselector/get_update_object.js | 6 +++--- src/lib/index.js | 1 + test/jasmine/tests/annotations_test.js | 5 ++++- test/jasmine/tests/axes_test.js | 2 +- test/jasmine/tests/shapes_test.js | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/rangeselector/get_update_object.js b/src/components/rangeselector/get_update_object.js index fe6eacaa454..71978d0a310 100644 --- a/src/components/rangeselector/get_update_object.js +++ b/src/components/rangeselector/get_update_object.js @@ -42,13 +42,13 @@ function getXRange(axisLayout, buttonLayout) { switch(buttonLayout.stepmode) { case 'backward': - range0 = Lib.ms2DateTime(+d3.time[step].offset(base, -count)); + range0 = Lib.ms2DateTime(+d3.time[step].utc.offset(base, -count)); break; case 'todate': - var base2 = d3.time[step].offset(base, -count); + var base2 = d3.time[step].utc.offset(base, -count); - range0 = Lib.ms2DateTime(+d3.time[step].ceil(base2)); + range0 = Lib.ms2DateTime(+d3.time[step].utc.ceil(base2)); break; } diff --git a/src/lib/index.js b/src/lib/index.js index 3239693a4d7..023896b0e80 100644 --- a/src/lib/index.js +++ b/src/lib/index.js @@ -28,6 +28,7 @@ var datesModule = require('./dates'); lib.dateTime2ms = datesModule.dateTime2ms; lib.isDateTime = datesModule.isDateTime; lib.ms2DateTime = datesModule.ms2DateTime; +lib.ms2DateTimeLocal = datesModule.ms2DateTimeLocal; lib.cleanDate = datesModule.cleanDate; lib.isJSDate = datesModule.isJSDate; lib.MIN_MS = datesModule.MIN_MS; diff --git a/test/jasmine/tests/annotations_test.js b/test/jasmine/tests/annotations_test.js index f771fdcca6c..da3e6a04cb0 100644 --- a/test/jasmine/tests/annotations_test.js +++ b/test/jasmine/tests/annotations_test.js @@ -71,7 +71,10 @@ describe('Test annotations', function() { axref: 'x', ayref: 'y', x: '2008-07-01', - ax: Dates.dateTime2ms('2004-07-01'), + // note this is not portable: this generates ms in the local + // timezone, so will work correctly where it was created but + // not if the milliseconds number is moved to another TZ + ax: +(new Date(2004, 6, 1)), y: 0, ay: 50 }] diff --git a/test/jasmine/tests/axes_test.js b/test/jasmine/tests/axes_test.js index 90433bd53af..442e3781782 100644 --- a/test/jasmine/tests/axes_test.js +++ b/test/jasmine/tests/axes_test.js @@ -678,7 +678,7 @@ describe('Test axes', function() { it('should handle tick0 and dtick for date axes', function() { var someMs = 123456789, - someMsDate = Lib.ms2DateTime(someMs), + someMsDate = Lib.ms2DateTimeLocal(someMs), oneDay = 24 * 3600 * 1000, axIn = {tick0: someMs, dtick: String(3 * oneDay)}, axOut = {}; diff --git a/test/jasmine/tests/shapes_test.js b/test/jasmine/tests/shapes_test.js index 006675bd490..43714ebd8df 100644 --- a/test/jasmine/tests/shapes_test.js +++ b/test/jasmine/tests/shapes_test.js @@ -489,7 +489,7 @@ describe('Test shapes', function() { title: 'linked to date and category axes', xaxis: { type: 'date', - range: ['2000-01-01', (new Date(2000, 1, 2)).getTime()] + range: ['2000-01-01', '2000-02-02'] }, yaxis: { type: 'category', range: ['a', 'b'] } } From c41a0b45790a6af99bd4b7d3b3997fbaebf662c0 Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Sat, 19 Nov 2016 00:35:35 -0500 Subject: [PATCH 23/51] lint --- test/jasmine/tests/annotations_test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/jasmine/tests/annotations_test.js b/test/jasmine/tests/annotations_test.js index da3e6a04cb0..640614133e8 100644 --- a/test/jasmine/tests/annotations_test.js +++ b/test/jasmine/tests/annotations_test.js @@ -3,7 +3,6 @@ var Annotations = require('@src/components/annotations'); var Plotly = require('@lib/index'); var Plots = require('@src/plots/plots'); var Lib = require('@src/lib'); -var Dates = require('@src/lib/dates'); var Axes = require('@src/plots/cartesian/axes'); var d3 = require('d3'); From 94f4d5fdf7132748c56066fbaf0f31a633561a51 Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Sat, 19 Nov 2016 23:58:28 +0100 Subject: [PATCH 24/51] test case for scattergl single data point --- .../gl2d_scatter-colorscale-colorbar.png | Bin 45613 -> 45879 bytes .../gl2d_scatter-colorscale-colorbar.json | 11 ++++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/test/image/baselines/gl2d_scatter-colorscale-colorbar.png b/test/image/baselines/gl2d_scatter-colorscale-colorbar.png index b16a9b65429d7373863fb6876c6c21336c4d3750..20fe6f7d35b7d6de18e0a266f9a97414c0e756e3 100644 GIT binary patch literal 45879 zcmeFZRX|kz_C5|HT?z=&jYum3LwBRnprnFGN!QRI0wN`nf`lL~44ngvpnxDCIpi>? zgw)Ut^V_5EdyXf*=e!sHi~q&B#l83J&x&U~&su96t$RnEoP>b{2M32-Q$s}`2L}Yh z!NJ`nA^`p}ckg@-2Zs$uQ$^7bV!4(@n0)!;eph=xed=q^0ZENZh6>!g1cu3P({*E) zsXGmFbk5}{If=%>fK@-np}`!D2XmEp8|fd!ZW^0YAABOJ`dBs{SAA87A{Db zIqZ*%e%`_MmWFLJver*h5_{j@9s&{$`tw=;y9{fI{~6@}PZ6RUO7hOKm0?gGBhz-g z!hc!VQf5v~%>@#4-?PhZ`%v!1SZZVWsU(MsWqpkS6lZM2}( z0s~?9B0sqU*>ax)p9pqUgdj=@|6L)x*?Vp4??y{cD z$y!b0d?cf8dvMSm=L0mdl}Md2FMuni@f>ki~P` zzSQ}GG)w)op3k3E?%quwS!g@ikd9@Rrrk!Tr_*spcE|z0bnOGlB?xKNmV_7I{bbM; zVapFiIl<56&kvPx9rX37Rz^$030VU#(eN4SrpbD*T$VdoyZO$vj$~;d%OJ6yMbDuAh)KOuki&BnU(CAzNH0Wes^0s2=Bj8yq^6kefWk$2y z+Ns3|OcVvP{I(`CjhNnF}8hZz$qlRMffIG|;hu__+$?Y$?^-4sJyH9X)W2T8Z ziASevyxib(+tQFk0hol7R>=HWIN?RUvr@y7C-1`v^Zj-fah)i%{30Sg649Hi_@kFS?GtvJbR{qIX}~@e|+zB4`D?D%Mf=i?P9O2 z55WZ2Iw2@jpI_F)$U9Go!nV2??T7LrdRvoMH4>SOc|qbP73N!qeh`R6@Zmfm>|~>5 zC1V(hg9Q8-8qX}v2lvE7?ypaO%LzGu4+Lq&wiG_{?L{kYFr5E7|4~(chL|$cvh_uJ zda-4BgYz^kXngyCCmW)4){ay7+4*RDfnYYZ56RS&3Cnz;?L~Nf|XYF$;B@~LN9Xrg35C+12p-%ot@v8h|E)ik*JpcW*SFQ)R(s>|5Hm}P-L5dfYq~?3!N-`6IIU~`+ zca){McbyC8>LypBnXIa%GU;_vdvYcTT`|9-g|xAD3r~n_kPv0NG#X~0s*X=r$H6A+ zziW?gCqhd;z(pm)2i-g zUrB{wxp}B>U2&d{nE5DH>#eUJ`8;@SJn=1~8RU!;RW;#SMyHbmp3h;8>PI-3g{wc4;sP?8RPhtm#^ZYN{!$M zNz$m9=&jO7zUP(3DoDk=Z-^)Nai1zW#gK{|vS**cALUjopdh@TvP(YctQb6D@4%OR zoZLY1Qi~I#!DXgzf|qRTa?7EojAkO9q^|(KmFEo7*v>G|)sK`^)k*;%QAQ6HNQ3>7{S9MBStITKSqiGizF0=y%p`L3pv{}Nr~eB z!M820@R+Y{5lXb%`?`)*?tEnj4bZQ<+PENS-CF;oewaBw8>Ma-6xx1ns!Ge9qYpPg zeeVa)?M~#VJXXVyRf?I5tzkKcw|(jGSPz_hTKt zKULhWAy{yMzCFsj64ddL4gAlB#3HQFS}! zTv|n0u!Em+eSNy2ti0`m_{&G^F{dtVM~gDJQ2WHRWC9a%?mS^$ifUzLAOXf8wI4&X zcWFbCi)#q$OA!{tBrf_5*P1`_r+9HHi-wa=~M5Qxq?oYca z?@Oi*7W7omzszR$8S9NCXWaaJbMQMo#9K0XK&!el3f><3BLs7jgD^HNeYPw_y7!AD z<5?bKDXkpM3nu-^$Xm2Z!~(>RH3mu)(p4t$cDY_&m8^KV!j`BK#vgWDlk?K0RH8f> zC=Ib#9UhL83X4yB2Bn=(>8Tn`3AW`IxOe^Pw2R+KAW-J`8t$^)MwxLmS6|n@ufDB~ zFK_`DInx+n?s>R5Pg22Eu2}oRx%FYyYZWcqc?4&IOkNl7x0H{jFIhOGG%89J3NP!l zi1ysMT)h)|+VeujYBJ-NJ~P)gA5MAJ)y0bt?lI+U2zT0D4;$O6j0xjhuZatNz7E|r#m_{pL{>hk0lMiU?ktsH}S}{H6igEVe?GtsSwyr`snvHsyeEs zeO6-I!=fJWXs#PSoXB;)o>g53pG;4I&CrMHQhKtgKFEDLqft9eXc95P_IQ1&j^qQ^ zFn^-@SM9M)DC+& zP8j%Yf8Qs)zx@gLci^%M|GVr@8~x89|BI0S?^32F@cu~Q?Q|JG5pkE9V!3;@_LQyR zzdhcN4G&;|pfC4*;i0(pGmY*<=_v-k^)_&5zF_}7UBs3oL)1ZOVj)QJ?~RMFONOCv z(p)D*1)Z$Fmygtic`%-AmI1&k|44d)G9cecA^0A1{;PruM4eF=qma9i(bPO&0r^q= z_Cmqiw`}6#<1amRw6zU(;-5dS{(f5iIDmgJD|pb3CC4vJe*4?kuOReO+3%*fAXnN= zDIxu&%Y?jVCkF@o#R6W`67|-SLC2!cY4{&~Ecv#*(C3IW4syFUxo?~;eU?2aBex@P zlyZeC>FTEcvt=sC-jR6wAu;S&hP&2r2>s*W&BD;}qfS=o@w2M@LFLa@G4Rz&?eMpv z-+j6X)FAZpVi@Oa3}>y#?mfSar!1>V7oA-#rk5~ajrY46sQzJ#3l^Ui`up?5K*C`S z_g!Y6w3ep48SM4s*}Z$k-#%bqq2*yxLm z#qyi=a;Jcu5Y8Wr?3}P;uWi#9;3D!b5hS*r{K`2gOLvy5gm%B|kJkmgIelsU6pZOt zLve2|wwt_aSO3QgT94WjcjI1AS_Vno=vY<64c_vUAI5RbQJQ=mtkW)>9M6c#{o@Vc znbeRAqPU!}*iC|ErHJaLe>$~pu;z^d_P_R11!278cSttpU1y`@!_s)kaf6*N_bvu5 zzB+gXw*Ek54$!^jnWmcUa^)zBd1L_kV>fF^tm9Z|$zZ+9>~r6_pexi@Z|P#>eK*WM zXUj5n$1^Jj2Fgq|xF(#S+pW$H0Bt+Agl$sPLy_*?%#EuREp9vg;IhHT;*7_;Kf;CE z4ne9hw1SuAZUc6^6}u_Y!I(=*)4TYmjV+gN94jhKXCn5kg7#?QS>@v&bVl-m4;M3C zN99}n_nw57COeE2DrQ>%Z}{=^tD9S$7v)i}?6MVsQtrO^nLcoT(oVwTI}tMY#CZ)6 z=&r4Mv~ow^smFYPt_B2UgU7H9S%2&5jcjf-dPdN=V3$BHxaOCW*O;S5g)nYYkJa{gU z8X&a2KAE3C-)WJwj^G*?~* zxrU~4{Byv5CY4o_*RT)RnUdq=RK{IN<~6t+yN{k@H7L4cgh{*;FTU(A)}O@)w-w`vNl7v6EcP4l66LGKDU}(Q>$U~@rL>=5 zB_zP5FI6(j2g5S^Bo;SFX0m1csKN=zJ5cY#jkG=hEse^c6CauV37g5#tn_sI+SLU! z43KmM|B{`b$z|2#ZrKNTPM@zr+l_e%^!W^nbMv48P5aoJ!mpRFMvf1?D0j#Pvpf$3O-w&Ik2U!&#K|G>L_JZhj*GJECW6@pI-DI7y6d{WwC3x(Dy$(ljA7@+6G_`~A}2?kE8`7coBshp5_ zk$MVwTAv1+t+wqeEv_);I`9Fy9fzp!i?3(C0oiJDvf1nN2xy2bPgHS6lF`2;|EPbj zUfitF?TtYjy54!3?UJB#fyDzpz+>gA|8go;|5*QAEY!8?$& z`O%32Z>ml8&psKCV3|TT*9#|G>Ej_!!Hi*P@Jx)Q?K#Vz8QAL3o(6c3aE zi~{{DM*UF-TCMawG$NSH+0~g$pq3WQ58g4~ebaD}bCnWu!7%OrC=9LH!X>e>WMmAY zL6Sg12`{{zN#Jdc6ar>8|M6L*QKz0O zqChv=ww6(1Pu>-Ia4nH$-lF;;v2nR+#8P&EP|E;-^|3%jV)9-cCtqnKf)RYW4a6M7 zchka+@jnXvPu#qY#Z60Gw0zN!Y!6)8DzxFLY{7$rjakT2mhUD2U3@0Dbac9%8)gaU z&GhwO4sDc_g{VQiKYeed`j4jL!AQn2wh)3lPC8G~dLpC{+r+7$gW0Gz%2AKd!FK3v3XOqmg_aM`gcPWB`qN!s7nbEtb$}SCWogSA94be?A?Ilpf_GKIE1%RV&F{{ zd3OTv4BZS7Izc`#VYt8}6ewdiVUj?~MbppQKK;LnT7)tl1lrEt2ya2DgP=nPStZ9j zKq0!l@IsLx_79qYEeOEK0c%i+?-N@$mwl97e|kJZJ~&FGfPS95bQ$0829}huok4Re zoc}~y;GjA9zYeysBtYWNy%7jQESn9=oKXWvu(;KQiu>@JPsjR7PF?!*^GHhllx zZxy{<2TL&UEQ64PL{Pab*!X{_zQCcE=j_}qUU0%JL)8qm(ezAcxIW(kLb=e~PSdGFbcRt{`8EaEJ4! z*tVn3!#{0AYelvw@w<)Ae%h#moiO3G^3v)P#`!bbt%hRrFu2oSIKA6bCgB% zcQZqF;2^87ihdqM21y4?{QV#;KMz8)$s!k325p_R2fM9c5Zs=+1st3(MVeMNVJv~B zeT$(Pt^2bgU^!V$=r26nXO)YJN8nw7gq-+MlwzH}_j%;!fmmG0kQ%=qX!ef-g|P6^ zp~{V;DJ}ESvLm}X!1FV@=))y0{pOOOlac+!I@vIjoP!0@-Fn)T zmxkVWx*0H}o{12S@pHSIiR8P=)%<$+$1CBI6u&{D~7OTkg?Dyn5`;~kT(eHQc5hV#jE~rt=c0r9^IGoY2pLEw63(#Rw_i-)$6gxjL zkmM%@N<174dxDG1Fru3mJ4W8T{WC%wUf+0j;U6MI{#S&o$+@wZSTF-P^4!WUpZ33} zD%5*7K;X|^fKXoyel5Ak<~cjuOe`^G{4YdT%f6LDX8ilO&5BcJaYyRE;y-B&EL5EN z2^p;KQT`n|KW1!eG7$EiUzuMf;(qW(|z(4W1dX{qunPk zIshKbUYwigBI3 zNOmo4?#zFvkfc$M=K^pAfvj^1#t`f|9wuyN%ZIQ4?RPG$D#@Q6wZl^41uX3TgJAtT z|3|LD1D3zA!!YM3bilA>$VCe!rvCs73mO;^r@7yi(>+BjuywFc?^~+$`MkgFaJS}^ zaTJ<}@-?frXz`h!w98Qi=01tp+1LRx3J`dzj~~Aqa_LKsJT*+m3SONMK7pWnzafns z;jhqmJnKm*2w2@IEhL;kY#lD`G%g@u-uR`TTs?s$?!yNa^JXvNt*xy_xA`Z}_h|)9 zFDJ-sKO1tvJ~IMKP)~P@I)>90a?xqv(6e^jlQhZ9;vJ$~$ADbN?hfnb&@Rno01fdT z-er#a8SfX6izfKsjusbHip>?bH*0)R7g-|(OixaC20cdvP|es{p!By|Ab0@=YHmNx z31Ku^$MFgl`u;xci;d;-7W!@2*dOpJ*dm-aY1BaQ=(~BnWxF*k!}xa2FluTY=*M68 z_^yFff=w{%`(wngupfkfe=sgA$-hzE>+GJ>mzfulmP!c#{^mFl9Q*!4`bh!!v^bE( z-2$S+xUd#qw3>&<&vATm^5r^6IWP@u1h@;xyU)CiXLC_Y=%Dv+(Gn%Ixrpy0rX6{G zm&*U|{+&5f{(FwtA^BJ38#it&kCspqP%tgm3PXp^`GG=u z!SL0eY;)%Y0aD?S9V&(f3ZYFGQ!&!p zE0?f2xIG$zsIbVI`ee)i^ovY#Zod*yUHB%I3aI^~Rtn(Zs|Zb{N~InUR6sW=!tqE? z>3Xj=*5lu!`i@t^f5Ex<+9gzLKeh;jjFdu$YK6kU#d)i(={QjEGa6J%9&RO44qJCy z+o-hmlxQJVycr>nURp3doUXpa_ml-&>|E4-rNFAMxl+FIdwgVnS-aXz0ACv{kpR9f z-UhptE7AIU^?ZnG_hUVm`n=Ri5{4)W+&#Ip7r+cA$3{Cf#9N|rjJBM3Q;Q)y`ReVA zT=#EXlYE*_eF4S0vNNON&vWPXvzCo!?VKrgW9|AY#QQ^`j}pH;swsJ+qNbK%tD(rO zer-x_ds9p0b}R3k*DWV`rh1CbopSk`UMlTNHxmY7aP)`9#zwfb`?4Y~dSBa~?mH2h zHhOd1MoYPk;byzk$T00&`7kqHpns8id;pN>YWXD06~f`9PN3toac|;ifi!HtQ~3PL z$=3uK7)a0H1aF05a(!euz-EAT@V6ty)P0eu)F*s;$p~-+^Ki^U;qskprSy5i?~P3 zS!Bz>0I`U_=70Ew)gJVCQup9M%zK98Zx>)}ZOLNrm4>{*x^4m0MN{JHwv>}Q#F>scvJ(`)c^3-j%6er2zU+6&ovszr{)2g5)~ z@D9;E6b+@^Dh1P_EZCzFLH=Hu=iy6iDC*p&SZx>k1)lGw^smFGn}Md`IXe4Ni6Za@ zk{hJ?SC6GeGzv6$tt%%-55|5lk+$xiNK}+L?h85`HvmmW#lWT+&fo(&ewI zM_)01T$Q^a=SHcoEhN<>R5)8QaDL`b2oL!?f?qFvTE&ZB2Oxe6__NA%7akJ6@lI(p z13(%_YX+2T4vR_n^p`IjhjA0C7e>onILGB39OPJSblgUv$l#~5ZGV1+McX%YIR zivBOKUolkq)OA3*g^&U~?PS34r=%+M=wT!8`dv~T{~@VXoB4~W9-?F`7x>L*U;lUZ z3uO7QcS-Ru8<49P%-WTT7KhAhAMN(rrT&yYHHX&MyMK2H`VZ-IWb4ewhqx%T$uhG~ zBh`R4z<-f3G@BKgss(Hp(CoO#)Zu_wj|08X3s+q)A_T+1NN@3*+P-E=s(J8k6oHopM{t6&zX0EMc z#1KLXrf1mRvTbj&o{+$O0fkdw+is~v8>sxr$$wVa2Ib6L5MU;v1DCe{!j>{;2K0y*Ia(5vp)Y!v^{I6D7@ zaw0mR4gNs9W7bZnWU=S+kc;%U2o#SMzjf~B`(qt zP+$^!JbwkAMH)gw8+bVX`y1oK+9!1ddMJ@2A;Hnv%zvR9HAsLgeJ^WzxO?t^XPNIR za}$_#0X>gTtl?s`e}8qlAoL%6=YVQn5C^sXkqF?-*?vEJ68+!e-ZMu3-jg`_snKxJ zP;o9oddT2fPNb#DU+|C)YHaCjCdwq|j^)3Z&-|@5nnMmVdXm{0u!w`Th;QM_Pamcz z6F6M|-G}2peK`LD%~kLQC$s@<0MMiV(*GfWq|sj5^s%P+?+up=$h?&B%we~El<4l& zzf#8AEF6^;anQH1R+ioQ)%@vZ3rLP%p18PZ zv0DyA`<}({3UwfKY14OTP!avu*Q5mo^KhrfPr(b%nQ1vWJ#xQf%JW~kJ*c7rp&Pbf z)0_Ix^<71(u6f$`b@zVOz>DI&xk^P!(NZhCSFaQt9SQ2!B?wE}JrD5LraWk7dH;jk7zZ zyo-!Zo<1ewx~i5J*d*~ZV)BitPKkju@!rbS`S@vmUO0Fs2yngrM?j*zmX{$1+_cwd zU_Z(Z5FX{uBu_BuP5Dz#aMBE-etV{z1ZGmLAj)~u;C+@c-gvEj!Tu{_-vJrB%`!87 zN^d8g633yTd6Fqnc-GB>;^V;c4x5!ZgqJ`Gj$Ut^MIT?~2bS>c)+@8GTaDxJW*|ZL#vZL7-@Mx}Pv)~O znGhZag0Me*z&;GS}eo0P5o$?6f+?&(tBUaX*#2KUQC(s-G}8zye4jLmU%@GeZhvtLMvNhrerdo_LM)@|og!z&pe?|I4xhb~B~ z7inAa0@Vm_L9n?A1HzZLTrOL5FBF6nTV2=F(9!E=Y)*a;H~}^CiO?|1mjBMzWh-6{ zjb|#8B2){X!}M@xSrBQ8d!^Co5`OaI&NAWTnFEh5va`!6)g>(#t31W`3h)+=GAJ6^ z{PgzhZu`*9yCiI>ywowN{V#`h01Jl=jD5+| zVg)cHD(uAPZ}a$-8R*+b3VEXXqK&$`Kju?vLyJ{}uVDO#DZD5Z)TF-TJJIi97-Aj$ zUg;kc74WznX%PgUd}B2#vYDoO7DKGQS4v#0Cx*M_PRSRw)1k^3Z0SRlW+1Y;N)lkv zt>5Y>)9fu2F(pPdM%RYfawXanJYIO(9Z;?|2JvbwtZnXE8lm8OaXMdQ!*|i}-2JH@ zE;1WoqR`-^Z8O_dGf}%BAeZwf!ApzRLd3LAQ|tNXag7VJgKZL_ng$pBnUsI%50O|e zn8xSwJHu#R8I17}Ll(C(iuD93bAsDgsf!>`=-y3-K+n;4iBAu@Hs0?-*PCkEdRs4) z=4y84`Mf})SOqf0c%N6H#XDOszI)%*Z#R}eVI{y(vZ1MqD4mx3XBH9< z_g@11R}OJZXgTy?Z)MDWvYH#aegkafKh(YnEbqLQ^dvZ#@l2Ta0EX4c*v{{-Ev7Q1 z96IgA?ANbfmkFD2#tE?Tee`~xz(Y5-a(=kOo8av4#ruXMw1dHP_DFt`Ggbad zC~*HiMyuG8+p;xJJ_H$A(1&@y!2jcJ{V=lKscB>7FRpsq3S*_~&d4SS#h3F-~T3`h^q^X53juD1Y2dyOB!kJ>I~Z2+0D4sT5wC zB<8UZ1(PmWzhlM6Q;t@xXwy=oXcNRs(J=K$LzCQ-qclPzt*{3DJji9KI^pPUmeLBg zQO0GddRIgt9l@LdO`l122hTmWr9oHZnHA^6u*lYT&&(jDg7LusS8-##A@+oK2KODJ z^w5bzH(bGrrltf0vX!(7g~vneyiCZc8E_>ZgP6dR8{hV=_ZR|prTF-671%+VW8oW7 zXs|j)U}CI`w~e1N7_mjX7A(@neT>{AG_LSDxZyy}_$??fdv`Q*5k)tP7-q^4*BmhN ze<~laxQAxgylPD3LV=Fp9Lc=`v2}S#>$zIqAcczt^rX=TFtC49RaLb-S;OOhu#siL z8wikcf@}PLYu6eRAb~X*cA-18@WbE;z9Ef!OPoh(^gdVng(xZai<6Bj-cE5A#iUy3 zV&aJihb^Xd8@sYGyrd})xlcN*)}il0Ea&|whjXX3bB)I&yw8qebV@>mk7jqumP=Et z-EOx$Oy*;WK+`g-ucVN@oAojdE3kQLVAg0@W6H77R4(JQ-uf)XN$1-%>v~fWcZ}2Z z6(;8qg@YLAMVl3YgW^1b{HeNTFTRKhlQexGUu0;)grkc|Vv*BOk(IGK9}YE7W)%>1 z<>spcax{k7YwhYT2PDn$>r?f7k(k)xgre-ZHEORq@i<1>_tQ}Dhx|@(DKq}*kycWq z>gE7r+>P%;dwevCmYF9W(89RqN+|EqmX^(ryUM+4J_?s7c1|^h?)z>kgP{9)c_o%O zTj4{u?^90%>6W=33_W}1mQX3PKU+u=Pl#;j`iApeUGLrVnJJ9SLtP_Lm*m)sax?iH zE!od!I6-goa^M?>7fo~LLQ_~Cm^eYFK16YvGs#_19aiGPOqjXjS(Xnxvs=ycF8kWl z`22=ZKMo93j#b;4sO6#j#B_Td@HQTdo}OOg_HCoe0N|@T*y(m3orD`3@UhMdv^6#n z|EA`5Iw)Wz4*SCBGj$Q&x+gnVYz!X`@CV?R)5CM3Mz)p`$;>tJIXXuuSrVyLOO4r? z>dMrnOnU7=0Tgc^%spVFV5*x(>7DfYbn7>n<4M)UEB5mZ-Q6r>HV!ch`c%ehJ}bq- zY{q@RZ=i3Y3XHFvnxhj4O#8X0DcYdrgz$sWwsjmnXew#E2LLj6Vchop(&Vm*f%9}R|z*ZFrqGnek+iO(| zY!0>00vDQ^pT$3iOS5jgKMzm4ymkb-8#X%x#6Wlgw0nx&ZuBA}&21xuN0DCGYy$>* zV}rHcQjlrnIZht4T2@iP`;DNB(2ophsumuC(S=gy8V*y9*O07Zc;T$(F=O|nuQZZy zPpPX;qQe0yu{qHx=Dv7~k0r=4U)iWT?$ZmJ^}0caHEAm1fe&!@><1>RDi{UcafmNm^<0o`$sWUN5{!xO?gg5MtiviQya^dAYV8MSeVreDMHs(o$<@^g*+M+jX z9IyuSBH;qXS|9`}D6YFAWw5)6I95@MD_F+aS(IHPEI9&D84rok9y7B(Lq zVu#wC8+c=U^fe~7w*8JPLIAX$sXCvjnpT5@hM1_MD*@a_c_&YSFqjqxN0zWV% z(mUz;_l@4WRg0o+pQr4`tTGb^5eAfNS1jk|uc#D2!Iq^_qGkk zeVf;ua~C#BVqc@94nAgG-#iy{1QRWNC4=<}f92TRN`KUR-(+<)G0HL5yU&_0PEp5UteUPc zaGXJG_3TAKTeh)Z-)c&Bt0EMPN)g8=Zv{X-`J#(f=g0h!7jy8FS>L(&&G}9`DX(HV z<)u8@Fz^*?ztTT<1q+*0t}l$i0uxEn9rd`5Lc;XAms1Gxk??B$$?JxKu0=}Gxh$vJ zC=qJ)cw1DD`@u-kTg#kP4!r_%37?HY_?E$|315i|Ja_ym%&KnDO^L=UL=4X#&Vw0K z%eB=X*9IyESW*gqYic#)@;QAKh7P{-vEt09N6?syjQeHhYaHXY!&0N?U0Gl?n|&SL zL!YXhaoynx>sM}E9~M+D;`^XCQbG}3*`En4Ogc&7#(a!#*lyi#2+4T}+uqOvfAMxU z;gAHCXHf7i^ZvOD@PU6K$YB)s@$`bM>AO1TAqm_;S$%q8SXG~3>FOtT#!*eU)8Kf= zrb&H?C_#uGkim!?XiT@&L~Q@`KpB%&H#4<4lzndwQYFX2Tt&|)KJ95^^wdDrU{-y! z*plj87A9UeDECCCz2_d$BI$jawL;skiFQo+srzl~IIDqgz*f#UnSzAC#wGzw(%B<; zl4z}$|BNuFva_n_D^V-eWNV8n_l*4KfS@1B;mAjE>keeTWOobd8Fq};oH@2S*L>*q zN7bN-76`ekI`&~SA+I|o5)S;9k<1V?F&$&Ga6fGuxAnJ1G1lp)4*a9V7-gS|#&$x~ z61CZUmalI~PsJG_^n8|XyE^@L*EeGSAY5oIug0?AXE?vK=xB)nAuuYJ@L8i%i=_(# zzGDT&F@pD(7@E$d!@!7_l3=!9eeFOeA*cg$Oz4v$nq7uQmVqaIm2PY|`Jdf;fD;Qs^I$4Vvu|cGHbiRTn#;0DbMCC9yVTSaHNaY zP75n=az0$D6^PtAcf8j%y3~B_@l0Yoan11Po{dfDcNN^b0fwWL&+&X**BK(vAyp5~ zq2fHZUnYf82~h&@JKe1IVAL+HMiDV~Z9!YpGWSesLF-Yj)u06I#=MNr`Hz`)o0dkp zle!heGnMvi;zM*4@&TgCqGhoPa=7sovL}nFMIi~XqG**jmLcT#0DXxo0>wB4A= zGPsl^JJ_4YXRYl;9nU*ouwmuNEkT(hwDUye-aBTvb*s86&02gh5G6CQ;$QdU{kZB=a1us2rEvVbVYX!BGjc0ci$@$!PVS<`UXgv2d zRBD}4t>$boor{O_=Qt!~m&=@TUT*i>AnOZmX48%2nKXimBjAe+6ZZmjl|xgF#h-L2WU+_9ke zwdhvH7bwd5L{z+zFe#etaEF+1~X9xn@7?b5H?l z#)>=pIu}=%Qi$pW#Mrb)Zk5Bj8%>x;Y@y?xv2zt-x^m=bEa25wg(m%Z`!P5L8I|hU z>cguPrzz1P1OD-`sr>YjkGwnFe~?r@4ku63e+bn%pmc)sZ%(bQTobsP9iMYv$u325 z%~+Id>qa)N@q72BYk`MG4Erp-^iUP6q?jIltAMw6FEEA8W>!RZoER8XE#>y{3E`+x zhkaG`ykkK%(ORH=8Tsn<^I5`~Ri~T0JUEP3BKP|_*eR4O{Eph>qw_jTc_B z?0DY}Q*Isau2FvZ!bQ8A@f&7~G;jFPhfePM+S=VQ`3W52Y8-uSXA9$uF>j1huAMr) z4GJi1q+4pWn{7*W`Z&MH_}u1nDXP-0U6x7!HSbK*%DLt;<4^I5uZ!33GtvYZBHfho zd`+suMSRUK6mb3_q&IA>r(!kT!hnV=?!j2|NcysEjIbC_lwpM2Y+s&jjrF7h8FHJ;K$wn75a+G!*b$U@*=e7LZ7+|s^)&I$ZN#&43-rB1!>vtz;nYv9We z)9gA+s2GXx7tG-PmW2^h%)BGNigfbXDHU1{nd3|8Wg{J#iMhEMyst;0rV zR3;}d_KrS1p5+PoXHDD9lqY!wB8KH+a}L+`S#O``n@Qu*QDYVaf~Z?nrmGy$6IU8r(-hvIoG7> z`OQSg!d>D!7B1i4zPn*`d0DoP9VLVHDIl@WX_jA1`nH4e0 zdnE8a^jUtcKF+uapTg|Q(6YC)Og5|SU;<71OHo2s#1Kadc;DCZ-2$n%ievSTt-d`IR`MP~SAGVfi551p7du01xI5tvRiZ5_)P-dx+dNk2DK=iWr`rgiX z@mCOZJ7D03@SMAxDPOqLhP$Gw-yRNBB?5Ee7@n){7opr{3E&EjrJwX78b#a=c6z~g z33B0b2HXr1WY;wq?Q85~aEfO|V9EFE z$+sw!CtuEAGvHu~O0ctDMS9^kxAoSQbGS)zlQH@feY-^)atO++DDQMX(xSUMcw6~a zvI=+|XeQKUsrb6uvqneH6+XZWy>=&plNe6niW9HU$YK5RB-Z|!K#2W}@^spM+f)-uZtr5a}oxKEo&y=2uY!90#jnU%E6&x++ z+u8-~PE#tmmV0ieb5Hx8#q781xBHB_&3s`8LE{sz@mylWSCLp-L`ii?jd5&2*)#jbv%c>ED4s4mx()P}ld*UTX3T&1_ zHUwc~U3WHdaiq0K1hVpQrnrlbVU0iKebsExSy}GA{D%#O1m*Gko8qqemxtBzTF&#f zhNE8h?l16^UxzH4dOr&XD|j)Dbfdu^(-ZbfWX$&>)$fl+SyOk3c20WMuQAisiX$`Z zOUN!nz8k2pcKyZx{7)3>E908IcWm8eNfBnrCi?VUvD4vmvP_r1^7gJ~^rEEppFG=M z!L_8fQ&jOIhBdRWvu&=7d~y;5LEYhHc_sJWT}{MswYtX8xG{sKQ2!Vcng6i5-e3Aw zISvBHcL^7Ll(wFsl7DN9=<$?u=f3=`m4!42Dxu!em8ek{@u1&_aUgrpFi{UNqp!}> zTv)*D(|$NaF<`yV(b1CWxbXo&mtvo_RGdX5Z zYC_ftN9sW~vJ4Yim>c)?^7ZK=XPLv_3!6uVHs#Z1SC~{irpsoe3dh8^$F83YuP2Va zn`MT*-&Tiy_?B|RuF5$d&3>VCD75MDz3{&&PoqLeiQ&bXI|H@x~uFhdRtP zRm2`J{qVkR>y}mYL@P>Ghuamfab$b*ND=XxnIx_$UuRvz`MlvA4P+s~y=oudp-rFO zT$q8GCVmJizWJ&bHMMw_NM7YKLZ4GY7VmtFG-p{iOM~YRx{U6D%xNRyg35SJk2Nm1 z;UiOGq#yKDdh?QZ2BqR{mpl?M2C7a0kjB=L7 zOgz~vLmZVYX)7fcw^#6yKzIP3at79f!pn57qU(rYz=j6OsD3q(FlFCW2Zvw5f90{% zoh?mw8GF^qRYZmZ*YvKv@F7AWTOJZlS5~X;=WaS=a9Eh_(z%d_i{gv z%y-VG`+P2mza;eVk?WNOBIS7abctWG)|Ep?J&GBwE?iZrnJb2$#PEE4*9Jehveb9I z3>?MVW0;o9u+~%;TLu;%`(6`s$i!3{dGPuVq$Wt_*y%NBZv{)yz$ zHTsHp{<4DOBa8c^aQo9XIdXZSzAZ-FA$ws;GfmrxN=|$$jQw1kVrE^SUfFA#G#Rs$ zUfmmH!tI$ggcbP}@h#wd7KlI|Q&UqQfK<=s zL8U05rlDg8nY}1TxuUPJQWAmcS)qu%bB4G8$YE!K2vb5fTwQ(s-Y+`2# z-@*aMMop~iQ0KsIJ!@6c_9G<(&3czc+>D@0r?%5+pv-5`H!-!>4gKY{U|(PXu7>bx zszts&JyQ(y8dSx1ja=qh#THuAbWh`hEX=>*;}L z9SZoU)W1zqIX9jr%p}~T`?kN#!h=uaMs@?!ZpW|5?S$Wcn~8X>;gI-&=<@AYg}vwd zJKqWhEeH*&FwZb16M`$3k(w7M{soS2v zmT@`S$ZUAD0?#xNrY{{hIqe7!a4x$Go*0`VQb`eTOn7OJXs$Qns>i&Vr}U}wdCBso zfX~Z`x&j6HVTvJr+nWaR_lf;*ob~F^CJA%w(fYnM-|#phwPqEa8i-1@H^QWe{bwNm6d;*_5&17HYXUC_lMEUQ0N-;t3&Z zgDd4C`6cEslf0JO(gN-;2ThU>@_jR{KX;#0KFacRscgW;h%E){9k)4-&p^fS@Ld(N z`aUEqqv~fO@FO;g)rt_YTrnQznGB{*kkM6+(=;ny{Gk+oNqA`L%|%0B)8fUdIAtMp zd_SVo`%OlX`1|ws4jds98UCTLzS9fZ{X*rC^IU2E_VK|P}p4-Irr7GjCapy9mk*M>1U0k!t8M)Kd! zmO+FVnpOmO@3sgLA&Y2^ zi}dwKhc9h;z~>B21aVVBKACTUfU()AaN^X_Lq=_s72bKlc#>Eo>ov=6>ESyUQbufA z?;GiZa9UW-iY|9*If~tIbQXJ-<`wB>Mu22=n)~$LB=MT-s_{oQ=UV5U(>mfu$zXQ& zTj0&!#&G(Du~2aREnuOCx4SS5zB;I_yo`Q?XNh|UpH4`cP@-4pMZj(&^ICkC7eS;5 zw@qU5rRcn9y_G(z){Xe$eI~=a>i~kLRL`|X-M2}AN zP6UY_!l)yO=w)=H6TJ&TqDGH8h;H;w5JYE;-p%Np-;v+<^E~(7=l(bIIL_>{_Bv~? zv)B7|3Jp>0Il*kKF7Etr-W@6G!$Yg^^rY=*g>jtY6%#9mYFnA^r{b~|=3%eTH6`?c zGO_ul^F*gV9Y;DH3c^Z{CTrf3`Wjm}N9;7j`ng4`-j;H&o*$2XSoyH=Ozon`h@A4T1hr{?!D6S??R7FchNO$3 zprXbbok9Z4u$#(7upcwS*3<;7`6oR--WCPB8*EQ3}4Bo=%Ont8E0mC1ctZr%4V9%W$by0GsnN;bNs!i(B=7pSY z5NBvnlMh=*5=kX*&eXr`J{z(jv!s}w7i*Xb{jWv8b^o7pxe5U zJ?AP^Q+3PP5%3GIlg*{_1$TWgS;HRTX&S9dSZV+c2cPMZvW%gVfZ~enLY*Ym^=HIDjkgGCGi@G&6ZB1FR}}< z8k9`e+X%Rf3wXzoHQS7iM^IMZaeb5Q#zLzPdhi!gHf?F^UkTNi!uP;$@H;-Qp6n~B zAc|vsmSHxuh41%6%}y>3x_JMPud*n#2{oi%Vo$A3oXt9WKWF54x4MJI-9>e#fiM@GbzwLBzK_+oIG~PJ+=&Yp zrk)DmtGF8ZnX80dPlyuT&$7Kscf@JBVX-T8p|z+kUz;7UlNhY2#%mnoO@g83xJw_8 zNb(9)cS7oDiPc-)OA;@X+00kru;_8(zIv)yQ)A$8;A)*p;9Y^}3p}WRfLY6=YMOWg z$zW7u^vjptRkP8aHy=4p=-qJTdgMSnnL&)5XQJXh0dc=Qcs@- zh_K5YI4)Np-7h(u13>4$XXW!g42q_;d@amwjA7wXjQQm1Ckx~hin!TD-TDPezH*q$ zNPszkeLZB_?8=qZPTv>^@oj`s?H|<)r;CqoWv$c6!WOVcpt6zwjrP zNDR~FqYS!i1&_QI1D*Ci)yDS~eRuqZjk)_T_lx&8E<0uHI~=jWh0oq1hHpVnd7GTu z?JRI0y3oC>B_M`n0j6NI$G9o7Ey=ti*;#$#AV<-4*>O^h1-&vLktnml9zW!8JjnS@ zN8|BZz?QD9rM$(D-=BnA+_-T#s9OB#Uf!;*s?oFiIpEj|JdMgW31(b(-YT7@wmVj& z6f2gYIcoe`0X4A};Thde8KYEbJxPa=V`CqMCbxU9OSy-Rk^x_%YrA5_`NHIeL58oU zY`2ILa5wAWN;Zu1Nrk}Y8OfX1YJZDUgD&Y$2zSete-DtGwP7M)`87IhRMf_T$Y^%j zxvwFdJp}>4Y5G!|>>Fo%IA*1mcYv0sCr-?j4>>z%uI0+ql<{q$x0BnYGliBTG7K^` zzEWgTeBW(X1|?F-dCXGE!0`gprZ!#Mqu!B!Z{ZuT3o4R(eAT>|);~WU@yf&Ol0icu zyHS9m9PERn66HSxnRTed$1a}O!A)o$82Dw?gzmdCNe&iXuw1~gFc1W%NbDRA- zKwjU&`#fThyMc3Z|2{n0T4`y*o*(+5YCWAwG8!^5b+94z%0xV{>K27|`X+fuS+jTG zOD_sm8l_sHyY}vWYkU`v1g!L!RG}J+aiP^NIJ*sQ(Bm8b4E`*Z3=cC-x81?>tZjU- z@fcNAhEMgmY1_EvM4yKtkJUOMR4Pwk#i++aq7!}(g4$cvtb|rgy5L-%2ISWoOG>qJ z9`6)BlC=*2LBs>|<;(p+pCxbHEF6w`1h61{OmLIyZ$K6eAz}YsIS^1GeR%uAte^Bj z-CePpB+SK?wi%2Z?CouxcBXIy&LtK_Fn0kGs?>`-Y-7EIyyaeET@v0_e>ksqB%tKU zT30Q)y!u>36ucJ5BeCgk3x4k^9n(K?IZZLcEwe8Hp9H%yJTb?4) zvn#w!#fj(!{^YIhPAYsDDROx#ow4ZL$hAxDzVIj*oAVRR3kid13N4RNFn7A#J$=rT zt`8Zrb@>7--i6bP#f&M#gbz3Y_1kKJuncnkhpaDQI`UNFrs>F1cdEx>#;jz#OIwY7?8Z9l1}y2`_9hW zx(%`6!9b*5tUu-Eoa}=j2kn9;DbNjT`#@rf@Rg9sBo)~V8MkA z#bd5k>CVGrB7pOCUFknIJ7p*wE=q2B5Ae()i+n7J>Bf^&fr<{ttA@3@h&nvJOOA*8 zU!LnSD=N5G0~xbo4A{<}XM9b|8mEpFhjEK%Rw_sKCmV3(Y3$ojrt^7gH5 z_(A{HsXd4VnILvCDtzA_=S1~y`p`2|pR*cKxRg*Ak&n2qq~tg+&h5<^AjEY(L$5m~ zr()4N0mcQ?99SN2A+cb}!4A{Y&nR0j+YT!z`Py%NvJaw|qHz(k_F>wQ9Y<>@avY>i z`FcDiGG!D=y(lDr_MB~*0LHDoI59wklAX{41Kc>g%3~+1PWqLp%vrntYm8!^^22(o z h?JwGsXoX1&t6NBaRZ#DT^z1E|FvbipE?1}Ez$VAc*Q#N%AB{yR>{i07Vmds8) zWmk9hreUZ=%l#G6snHIHrLVWVKAVPE;B!=N&~sNQNIB~!0R@lQ`-R1{=4%X8eI(VC zPpc1C#mHiqdtcvi;?R#x5-w!o_Po3HUcl*KAN$ElYU$(pa>szngU(|vGR z2oFko2t8JW4idnfyAzdSy^ae6?>||r&V09V`M8){Z;TOcjsv!1NGzc8h(ueXw>(uI zL9hLem8<+_#eEFpt(v67REgqxjfsE?#1?MJ@wJM`Er_bt^r zvm4|ech~wT_(A{<$j|3=<`pjj$WyM@B>ZxmjcsVh`H$} z4X=w+m5`lQq6$!-)f+eK#{utXD%~yrTqHKRnoVL)W@}MveQA;p++G;BG9{vStLJzE zDr)8dtv26c{3qsplr7fN#BN^vcNPG>Mh3l>JBZf@ z6>|4gF&-OhWH|q|UkPhC+c?CUYT{k5PsD=l&2AFzfu^lgUi37>x#J8gevqWNAHZu% zeB5!@w@dVN&dXfVPn=qB>c8iogw!sUYT9Mu=hZZhzF?2G)pF8Z3shKAGY>O}q2 zoR8gsD6#$l{2owGpX(3eT$1#3h8~hYO+S7tcZNwLxiixIqkh8yw=scyP*zqJZwP2> zv+82J2$(!nJN=3S|4@0I%-@=7j^B|j<3v{kELl4Y13v%BW=n1t|5~L2z0OzD1lWjr z5}O|b>4twHTz=0ugaw(Q;66Y6S5KqiU%g zsgn;NzU%1znonh|smTg9V(2Yj6QCaAv^GFH$laTV5x#v$y*Q3LUdc_RO?~B);C0jJ z&|7tG_51;{saOISWOJc}s(uY*BD-;eH#VDk1Eh_tH@kYNZ$B(1X0(Y#e}1d0!hV)L zclyN@j{&DXm*RLIARY)|C+vIk#U5AlH4!RXW@!1h2deS;ea=u&tAi$NZXKOsHAS}} zf0eXn_J}6^dy`7wV=?$SHr!)6bdsoV&r4Atbn=!0_Nv?6ej}vF^*B9+Rf@x3Z8EdN z>yn#{!3wK>J}D}4;)mP!C&*~7$8!&0yO~zc&=)O!syg!bKm)UhM?CqYj(JE36bp0+v*}|r-sTF>apv)qUB6muB~4PJ)NoHf1YC5`~ae; zNX@D~R!fW`oc#J~KYLMZHlF>p+fX!tOLEBP`v~|>N3mSx8qEw3VP*6CogkSeUzru5 zP*8^>=UzuD2st<)4Sy5}V zsjmvQsf4N#?f=ybgiqf&GQ92qtl)PQBq@jr|CnC#ZHp&Cv%!WBzOY!m z3enFvEqK_iX>hd%Gh0Y;AX@~pB68N`ieCBIuEBV+-E2F*g;h$KUEd1wVd3rI@CCVQ zUmMAbP~NrK0~d5q)Ced@q!w4>UGbxsMo3iqFVqTG?x8!nlSZR+Y4O%m49Z9l7U?Ga z<5}$`I%O9bPMyf~2d2bzb6wVKtlOyw7?JzNp;!5Bc{9nSQzJ2q2Hnr_glB>2#(#35 zjil`!f(&0g+oQl_t{LMH6MpVEYG6-Zij5DwJmQJfV#(%Lv{04@6KBL72SB!sg2+{o zgcEOU+9aV%10L8Ui@TG7K=Gb~#C_{ka_F(T{*Tk8ymz^uXx}lUr5Q1+b2m6(YXl%# zG>nd@HcPd#!e(N)gt+Btxl3?8SJC0e5<{EP26eBT1aGD+L$&;r@Vz1rSi6IZ6XuQ9 zH&B*~+2N1FzF>dQ&olG64b|wa`PdaX6)TgJ6Wn3|#bz6ZE;PN|Zq(DFyqKr7X~+p) zxO_pVr16R4^+^rOcj3^0CPsdUzW51U<*>*%CH#Sx9!iFN$JfBG(~^{2uWik7V7eBC zEDnY@YxIn%8w?DNv_ByuUpPA(zdx^pud>w{G#T+>r7oc%mi%Uzgr)rByoYyf?=2B? z_LryJX&L4ne~q4Udt0EEpj(N?4eAC7HY+EVi?t@Du@6mldP2BQ=GhM}EfW8dS8v)Wj0s1iOdKGfN{ ziZ1}fOItTdLi89J{hSWiE*@!*$sz|E=kbhHa{NVVU%sxqtw>0A*mN>D>9g6d_!1Ty z`Ev7#qdE*?yIE)+4fUv`uoDb!FTg)aGlaNIgN=gH9VCn*z=cs5=iFjA``zF3a%;rV4m zwMHB-*4KbC=%ckQ{2{)0yJaf3U8{+Sw#_#q?!G^-RCeuc+UAUf%6M$a!n<9W@B#U( zs?u`L<~q2a6@75>?W%KI*CO}*?Ird19pYa$##wOW*~k{uco}Lo+)Ax!+Kj+`Bqs}1 z%Xw_ed~4&XR~Lr+t0lSWyDIhvC?&6+_ia7;Qs%lH8<0^?LzGl|N}Zf(fF-4f&G%B`@jWkGD?vNh$0 zf%Rq0hgBiV33L5kJ+0*E)JsoXu1gfd@AMY7PgG{jQgf7pDa@v=9X1_6=Pt|!jxGPJ zESC=_lc*$&YSPgn{CKKyp{UK5p|!6tw$~EUG2ulaO9aIO@Qa$Halhv)Ypctxi!MM8 zOq;-)C7prgP4imp+a&noZxexFKV+h`(NxjrgBK~eB0=KJ(MWiAINlMR)EAmZZsVRa z8L2=ZB*}H#Ty8IvD2I9h+xg~i#`(gfmU5!K%-}XUxqCT~_k|R(OLx7!mO-Mf7UU4EaPJ7?3<^$?D=@Z+mSTGj|u&)aIfqLW*_}J zijLCc_v$e&7`tTHw~^1wh-FUP((mUV&{NmVg)rPPKFA_!s*c;`>6<(s`{JmhBipOP zzy6>E;l~}Bvvd>ZrG~lh4+PZqlMQuAXU)_&&_Jl2*=KKaO{X7e;+8pq zt$Z6|a&hT#b}-8Xb>9#8F^gBcdNFTYJ7oZGdsc5;9P#bU7T?HMe(|D}gAzMpUzWG* zTw=nSWB7>O4m}MD-5);np5?P4mP)=1XeRtq_u)y1WQCmj)2jfG?0&i!ZD3i~HcHR$ z*A*}2(S|{ZK@RcwXgN6)_ZYHa7%B3~AaE<+eJ3s=;8f(*uy66p?s!kBN;gQy+G5iN zYo-F&uUcvXB1(4>X%lQH6WZWK=BA%yqN*N2WYufQ`$Ag!$-1zLSYwHC?*Ol8TmM%a z3`DQ;ggD$oX#pcZHeod zeAA=>X4N4ag^$10^Wpcil8s33V@g?ft|tBsEIjnN==G33t^c{VwINhQ6YeXbw7lr3 zAVa!Q-)K$c=y4g%Llk+lSLS)sxmfY-g^2d#>Ucw=wGqKKO(<%@9JvgOSmU*U8O|B& z1f`a#%j%kwBhEF@+${>Y7&+TK8ZWo=`9IXd`T1pkh3rFb_Gdmc!ZGPGe?tOpIz$#J z(xX2dnGfY!q|Y@IJ1MC4p_r@aK}4HxPJ)cT~po16Vb zcOj!S*F^AjqT*tJbEIg@qJjEcH}<)B0^-{Q`R(-*-&#u!toSy91PdjB8%@KqyqFbi z(|;+lwovO}glH$GIRAEeasEww*P_IT)_eIG8I+!S>h*c~K`cm~SBurG`{6NdF zYOh?fM2}+-kMN=LjM2kdvNF0*1EJ+dELBg}K8)A2kJ2ta!h~!DEUMUK3E_E$%m&m7 zCTFIm!u+#k%kg+UP00E^LSxOBkG>o2Na>N{v4n!QEHyd79vg3rXZ;4-_pY;O2Tuk` z;!^Ri%K4eN*t8EkYIpnEx=kwIvgcWr!ETT7kHCKo(hyOY1)wzJ01Gm=yr_GyrW*$nlKZs_pH|O86DBY$PV7X0`&*2AdSe@CXuf9C!y0*KC-uf zBHXsmUYjVq;yHffNhom2)~rX0G}a3LMaAh4BiD^(NZ=Cs;!=OAfm7o=j-kGyP0JVu z@iZKN)=H3 zjlU1A3VH^0fT9@kwOa}J-|&-Ctv`n~DU>gYpj$z7=zbyZ>N7^8nd+Z8)Li17tLb8X z#1jy_n>N`}c~=iW^+!VwG8s8ATdO2R@bn@E`;--Q&1br}3t$4h|cf(PvhZ zn?C1iWpi-!z%D8n=4faL{2KmuS{x?d`0fZbd+!>DTtoZ8eY8zWBlY0yc1Jc{Yl~zd zp|HI;-JezNi$zBICRAB0Cr@#N*F`CTD73D2YF96Cj$6VLFj z`WZyz`4h37j)~6aYow$@QB&b_pQ}A-{>JF|Ch77kpEHRprOkQU&ZY;`ddW-VPa1y> zTe#`%C{oJ`FmQ6=wdPib;1Jz@Dc~AkK`9pjr_Im0+UztX@bIO%cS3Xd-@QJ-h`2pO z6~(+2O?VtoE5nX}IJ#Yf_#SOYxxK(dS#M2Rvpv%QNe-XCl$WorgA>ouMS^Y;smOywN=O2v=RcyiKHIXm zG9n;CxVPU5jR~O#&7zW0rF_YtXBvk$8WntAW-gM7%`P}zM5Hg9Ma!Ds#Vt9q^PpOi zGTPT@n~7<+bRwDZY>Ri2Da7k6UexTW64yNp7Hyv~x33q*-rUrOTD*BbsX8H~n_jaP zz3jN{O2+SPi!`gq&8&>BzWP#wNOj~Xt9N$otuM+oV1D&sCn0)&?Mg~-efAtgT)?)8`$0S*qQ7+FN0CmM%o0f?xQ2fr_Sahotp+52R*;5Yb^ zldch+n@10@KUIg;#bY+c+mzPm6k`6VFaz`@P3&cROSB%w4bra!=>Af^Z(j!(kFvGg zan}OcsJ%^l&iG_9}C!cR|o{D%d z=t!LE!s@6`3H74sKi9!^>l=4x@;Ug*PKT6#;8UNk)Neq2SId|FMkNHvcP;`2fFK~5 zhLaQBYUtK#<6!xjoC2M=jLxh-yZ%W$)A^-Td%jjV$W7s%W5J}|DaJtnlZU9=iq zY1Z5Dj)o$NFdO$3FqDH4-|0VXzAS7lGs?6!*Dd}UX;`M*YJ;bM&HopA%}RKgVmri@JZbNnktc~NWEP+#v9<8Py?x`Qt`&e=I5f;`-AL5PSc}5taW=aWDLU~jkATG zl@phG9;?hx^i1GLFKRX`P@Of zFx!_S7Oh*D|1%7l-yTFO2js(vJgRHcRrvzcwO1`4<8d(0YR%JQ3wa?u#KjTv)f4kN zoZe7PQ$f45AY7d5pAxo!CA@j_)^b8nfoj$vpjLnEQ`GgWhr*hcXobbf)5W-RmHW^} zn!@}}v%^?!S(ts6HucIZ@{ail6!ZfrPDKE|!4E~hUqu~cUjy8YeSiYN$<72|Cqw`~ zfx%L95FngK6Qe9Q#DH!ffvQOCL~N(6Um6$&jCn8M^GA#nWa*q6yd?_I7bCj<9=c=u z9CE{H!@;I<fl=#t$c$M8|qwG>lwB)#HmIoaP<=LWH;eJ&TJgvI1DQbil9ls*+!*uqS4$H%A4xaH%LpD@ zmhf7V1$#lF+wgyl;yZ-|b_L@#4G)V3(6)qtW7L0~?qA09ujMgKHFK);DNPKxf@VoK zX!-dFnM{u4V0Bgd;^oB|^bb5)^5lsf3s40 zSj%5>SaSu5%_KeVNp=cYfA@)5)_YKY=Byw#>UYzRXUQO5_sN!YvP_eJfY>WNn6!2WU2I|@xPB}dXSEN{EztW>G&OW(10W5#?RmI|0D#s2B)FTYJv=-p z1po!GKXe z-`s3A?tJp(NqYpXK8||K`$DP%FS4(vw|iLch1Son)|w?h?y8tL?e#}X|B!|<)8pPg z7f+lOJPt4|(0!|H-5b;7F;&N;p&!Ea=Zh{sCPfBCxWM<;TAA}_`WBm`n6>iHYPMJT z^-hd=ZZ4aMF}1ZBH49%p`#BK`J})xqXX&Ic?#gnjelX{)LvXWSBYhNMWAMwG0Xbes z_n7=hnW`_Z6eNII>mJh<>HJb2wlV^q6Q*`IrVo7hOa0?)*`GhNRdS??#3lag`Lt~l z=~;(8*q%z#-$F(bh~D?md9Vwd6$cn>%vW6#EPXus0HTFRZIDe)*G{YK{}e3%V_vwz zjN^ujF=3q*D;Hadk2mJskp$f>MpvAuGg10F>sZY{#XzcKE!e`~87HU6^P}$WBATgt zB)1co)A}9^Ss;IIc7AHRp<@5N+KG|iyNt>U3X`~yzTwPJT)KzEo?WXx*LiLmx9C{C zoL|$yh`FnaTb>T4*xTGju@J<$fQc1x{ra4QgPPvZFRr%}&2|bb$&<-9Kave}9>51v z^WN__Qe?H&2dl&cI~5-rA!N%rCz*L5>Tci)mVRZtMlI0CkIWxecbA_$jizSF(kepD zKVC(orPChdRkMW%Y3rtxUugQDcBp#!pXS%awF1mv0P^C1M#|msEC4=Cduc5q0^kro zFYrOP;fi{n@!=3qzHf-S4-WjNvV$Yv`*rESfn;6ZYoj#mhZHK5u**4t*LKzG`PoyO z_rnm6DfiyfAG1Esh?Qc_Z_1j^-7V?DW4Loj*UuVV>-Bz#omE<5_R$U>mg?>wr#yWs zmI4#)4FC(0YyhuFVw?Nh*cL9Hjp6nlj6?S+u&_NLEy6en>*Vg9T^{5=lgWtx=GaF+ zm~*rvU>zbNXj&34$h&yfY@R52w3FmdVV=$f{h|hWv>GhTKAG((=;@}`J_WjMoiKSR zkIGx`S#I;PPw#GNnLcZa%)Fw`O-9CKgvA+3BB@mmq zV?6`i)Oj+tM$#|J!lsDJ{p?R_dU~W%=80IX7OQZ+=uT1M{mMXbmpyJd1B-`uCp;#K+Fm#Cj($<&cQMO*c?g0+YLaA+V>Re*q%T;bU0c)?xcO& z9yzHwj{77LsaS_z9K&VwEX*$HqP&RLKHM&PueK#QCk5#ATrAbR?FXGW^~PJa&>bb} z7h)|I$;Rh!nl`ni4Ya)u^VH4(cWkooE zulS+Pb%D@*n8Su5e%Pe77lEJP=yzH~$^St_IJDx%HInsVU5gUo?{Bx9!glx&3gG}m zM~ekAZ_+*Zw+A^lYm|LV)NdmKFLRP7n00LigRIhHFQ@g^zC3PDq{)qHnD~WYe!M~U zGwIlST)zLl6CtF&f^`Uz8W9>oVO*dKem&}3jP2PYIsLRl3Gxn{lpqhJ>!a#=<6BDT zIF5)YD|J1>)lhM6-q(?`sk&tQ2b~ier^r}22Hj1Q>|wRr9{kdZt3!FHM5i@n^NSIv zhnCICr}b?fyZp(P^Itg&_Bi;&%*IA> zW#sR6a|I-aT#G8p907z2ziBr?Zhk(;dWlI3o%8xo7eK~RUZ}VS0Nrr@sg)9j#BoL@ ze|pmpZ}ekJtJtB`b@Njm=CNj$xD*q;P3;={-pRi9`Rh0FWSl>89UdGB7p`N)&q*SS zb);XDKT38DI*yTmMZWB4_@YdNj>vTSnm2GYui%018z9H5NUn)hoTq-PS0zciP;ydV zf!W|`U!CT6e!eg2Do%l)oX+Log{{YlzrlK@JE$3ZQEmEXJLw&~@#s0Zuhx|rJv*q{ zsVY8&f%u48$Mnx>496KVfeGrj`NhAoKqo@6T5w@v_Ij@vnc}>B~Z4aw9A{VK)P2CkJRbh=`OZ&MPANV}D{({pMdKXtJdQAdvO}Vc#4871ZAXD$xr7xL%`+LUvzO zOTzBtKl#&)v~~0`V2?3A2}R3pOW155+offfEvJQ=6XF?*FHDvIp^2D=tbWX}U$1Uj z{rsi#+h5Akj5(jWA|7D-mu-^fRB=9Pwt>N0*Hs$N%&TvNN0Za(LyN_`Ogm~+uTH## zn{OD-lHkcEaX|y(tRDwM1kQ#ndK}JP*TnZP8ir@p&9eM4Y;ofv_dfG_j2{17rb`@v zNGPb>A6i;)nFpKH>#b6oi8bSTPIP=fGJ;>DuBRy9bL$2)TI+mF!3`=S*rBCi=MBtsIiXJj~hP;r><>0Uzbn3gq3X4 zJa8L#yUGHoRm4F@Bt8u+7Lpj4ZiEpkxbckz8dt+*VJrNnesvq_5aqo}qSltHk2I^^ zQX4w=5Rl?|itda8u3!+UCw>43zjw6Y#7;Xgug7ztQQ6%?pnAbcExv<$pj6GTUaE7G z5W8tA*zLO1L3|DZs4&+05`>trIOE{4Qt@-&b5^5f%d=6;e;doL=>zgf4${*l51J6PADf zpuVz>Bw!Mc0sFInz*u53nY@o$O5&>5rsj?1Ve#sR670j@T=cKg)Q3CVZH^{$?euub z2Wh(4IjMUqc5D`s>KjkZKb|%(d9*E^NdGNJ!CbvP4Tkg-@q#w|26O^%g z7KoE++smXjAD!~B^B27~89y$7HD*(n!37DoMbcYa$jLrK68rg;sW6O74d>4fis}wV zIlkTAfZ>O7`z$T@U5Y`8rG`G5qU9P`fQQ_6KsPIQ)?-4X)# zmez^kl~+@CwSOyIn&xFGcCip+y(-Pz0HEyRvR4~_WIZW2uC>u(n69hKXYIR%W~19K zqtDsSuiB`SK)Bs)XGk|f-(ka%>Khfa;M1}t;T?tXXEaTeKK_<4v+a!Dc(rmTq zYVG$N-Qo$k+3oAcpJ5Uhz#Wiq%QNlSTk_~hHr9Jg7VpEGQ&=3~eYDUK5!qxjOto_% z)YN-1R{6ODt7(hfqo!p?JbG|egW(0<+0J(BCMn0+jq{@P&YUxK3vIvVQ*9}W<`37e zjJy=88Ihd#m~GCAG)uWBb3Z&OYlh>gXZ)VPUMRAvP_D;gZ-!mcq$dRVN^N}@I3f8~ z`yPgg@(lf24CW>pq%L@mY+6UolKCM^-F>@w8!;i@7_Q+vOB|H@dL+M7YH<${4x9ZVz)?}Xa9^O8Byed{%pnx~naaakijlzW+^Eo`Ms?+(ooDa%zFjr*% zY^zkn5zBUs6W(vaCUUafPb9nVdAcJV-J?WmlA;dQJS@eh_051q+3n6Km}rhgVsWGK zc4DaJwfY3y+Zmp|aQ|`-Rhs0+cJP<+s7Xi=_@nRfI7oS@%(Jt*n}fHYj~^hnV0)U) z*|%J~&3RZ%!@ZS|LX>p>3%tx6F<}D!lSRlcgJfR^4Fs*y;+NjKu<@8cRuqK9YHppV zXWhwt7|K*E7E-4$)v#SL&!FcFua70%GrNbRf}gSfnLX##8OheiUQMj9lTiOKJFP>K zTS$)UOglvY!@jT`pQqeiTT_eItu)do9D&wOw-O?wK z)Z<-?F`Z0UG+A$QnBn{uB5OF)I_lt0Bzj(Jea>X=SA!m2=;j!&J>K}85>|RVgtv{z zL>d0BJ^oRQUk!GMR5iGMLX(gEk%Xy%#N50W%Y>b12y`{CqV>xbaT7K>x#u=RMycWt z5eWg}(<9@;t5>4Rj&Uj#M|xd&!KP%k(uJ+Fr7GM<@J6s6Jzq&mrZiG2c#hd7KxC`x z9>nQ&=p+a2%W5D$oTnMKaHod}Y={!O9>NirV4>G44L2@t0uAxow1gkMD}K+tjgcvx zQ0!lx``D5=!1`E|!FzU?Ez$Wn#<1b9mOt3_x6IX4t?68haRJ_(QR%=b`g;9&ql4YN z?}6b*WgNUp(8y|7{1(;&&r;INr)(qLDL~WN9maQlcr_fM( z=cW1A?Q~D9!h{kJErt+ePrl~y4olBt7K3iXMa)s{u^0d>v`23Ap}DFJtfZ6A=7h)g zR_v&s0ki46{(Qp+)&EPAwz-(o;2m*1teArS#fhn6?aNu=!kEv-o5c>jX~Aq?QlTnu z3evI;bB4VAeQWa`K?w^tvfJ-WHL`uYs_ag=H6J^ngY(G)5Q8YM4E@O4Fa4F?@#>2x z2a62X+A)EH@|~8@2&3<^`8%IktuU72iyk$b&Az$18eq?h)<~jAsz0dYu$+5NRcfgF zZcasvoLlV2m5h`Wg~>*4%unQOk(mPgq+6XOc)7KWAkVicc`Zdyy_;|n?`-Y4=Ebsx z64`r-ALJHBY5LV^D-aR8v?zO#iSBTc>2FdHjV}~`JMEHk%n1Xm>Al^WvRLim%{UV` zE(EZq{YaiOWif1|_D2WpNrSq5m{5hX?D=5&8Gmm|ht^(JK(ymBp%DM|u?hO(cRB;p z8zZkxlVCn$zKYmq` zY;XK1Y*#{kX`Qwpas}dkZbRtOn3Z3-*ty2dR_=KC5Zh_ePBfoJYkF2-~%P1*12ch#1y#{sAA<2PSixOX{% zh^vj9lm*+>OyVlz3ua5Kuw7bymBkkuPMAWN1<8=twW4s5e>u>cAuh$1*-dnko@g!k zojTS$b)(|N?n-LQmur5usGxDvc6RF{!H&vOYZ#rJ($nF4e>adSpu_tVVOi~~G&g~UB} zd|JIQ#U6?TH>hg+(Wl=qT+D+3=yHD17P9{VfG)xfwfOEj*e7!PqH*IF841*kqAI8| zY5L2tm)KtV$pEl<#Z!o@4%ubZb#6+izi&6`za_H%D{f)p^rvpfV($fT8r$k9-MyO>&JAtMJ7{y?s}-@_Rkqp*I!v z5bahi=<@N!P2lAoGunWoAwBvrG~EO1`Sv&D;6lB~Z6%!-V0g79roY3F4>Q*1yfTQP zv5XRBk$G7p3H79>^ZMaLu)Lz#sXN7g8`HDt2|-$L+30&i^z>AD@^VJ&wgb}VRO6FA z0lWee?ykd%o`GsqR$1Ly^Qgb`Yg4c`~u(n{n3dsRUU_xG&-GjJd!lF-^RZ>}jwsRATh6=9zukA$NLz3JA z@22N^T`pJ2*v3kgdBryZcMpIVRljqk`MCXQBSr4&ClJ9(1;*OD z?@(X(9fSO8kAZO!XQkxc3HxU&w#fAT6O6R*y6*Prd(3OM6j)vW!t?(WYiuiws+UD+rFe%$m*jTQ?GwF-IcSH$Aw=Z3p#*V z3SqbKO1KXW#X=c+Ida@8t1L5%E#XT}71+NH1?>UvfQCAO9NJ@A+UOWsiH~SxTmOQH z-AoV=V>7U_=Knwez!O;jYr8r5JcsIw2hP z5WQyn!Ag@=$v0f?!#&j6U}^7PPvHWz@myWo4tJyB*{e9u9j z9?0k7{XfE&`(O}GS(`fG!Tt?&eaq4(gb9Hnv@fFIm2a?|&vvj2^xDR_%JMN0on)9? zAkK%)(Y!nLL(h{P{mO0?N8x~4(rl~9NB>1cO;<<@Wh`xKBQYyNx0Kdx7vy|kLOrk; zzutpfKfyvxRhT;Vu_Pmlip$yolyxjX@MaViCI>VXH%9X!m#&h!3>h&x@7t* z7r{$vyRIM!shC&M_YsF_Uc)5IyW`Ws z7^tR23>07r=yrTw+zNZ>tUkHD~G;7qj*MffZItStRs=C4&%I|0Tq-^b1ek{25} zmh%nOZDHKtv{oBUt^fKBI9)M#8G%t?`iavV2{fGu-sr$MyYw~W8w8DRS`SjSdNg&t zRSf%@W_%o%{Fj^;OrY-!y5Ut)R>s?F*yb^E9u&f{DDnk1AaeS5DE4Z+tKsjI5ffgSvrWKJ z37HbrmlFN+JA=mMU5ib;F3N%0AJd6oZC~!9i+?%9J8#_Z!hz6j=KuQmE%CcXxsy?l z-BEjtNz3wG$N%Ss)ly&c6os{J1D=VM2$EFITdEUvjT86~&XdxG(|D)z`fuRbfS-0X zLsIWl{qtiuNFhJ>%Jt!A88p zKwN(B*e(jU&HZ)fPrsZw+UR5Q(t>Nd%f9&jTZBCK5UP;@A~CHtE51t&m3LQdf1U^; z`p+po)b4fFxm#^Fa;d<>V_s7D??0fZ=Dm90#5&-pROBZ$Ynz^)-UnM?p#}up7rzk_ zp_r}#+RR4&QvSaHJauWjq}lU-URM9GSM3;ZC`A9Ky(|BRdi(#3H9{(6C(%W=>@+CJ zMN!$esZf$F31cgAGcA^~7NL@e4A(ZQ!AQ9FB4li17h)o0|DH3ATis9h5BNSFcYd6C z&v~Eq`Fy^f=e*x9yrw&%FI*JI?Q8hJTM!i{26Ns0s_h6;Q@$ETb=~$rYZ}3oTr!wC z2&)$J+-Y_>K%x-GY9AUBRI6An^b_L}vWK{WR<#V55}Zq6fDp%>4D5PAF|i`$KKvroR> z07NI{;Z1?`CeiaobM!y}l+dR(MFvpOv9o%hm=?_>pHVs59plpkVYEXp+1qAzHY|-D zjN(}1;mH8-8gni3x{CtYf*S)stane*D{)xU>0L$X!EmfK2b-r=C^hAwnc;O6?5n>C za_`L;oGI>q;q83Z?+&Ugfa`&rcAL<8MQ0A>1^?2d`Yr?NaTQ*%OQGp6%f_oN zbYv|N;z;z#oS=>`)e%vEtXI9H2) zH>^sh?<4QM8}H0AbxTYWq#bKa(>~=w6h@0j9`w0ti}MgH2rP7NIT9^|Jd|oFWCF79 z>I4M^`QwZ3bjHQTra#yrC@47FGmE~KSc}3UWo6kpIXOqX&WE9P45cm}=$nf$0XbIa zhvLs)*oO6Ysge6SR8*{vcQK$xnKHFD*6)cw7-FGg!GUg1Ge{mptYjV-pT7=9SXuE% z?@1njDw7FT%7tmDsFkTHH@*6M_jW0Y`y8`B7X{Q)>Y3=jT3T9gnJ%uj^GtR~()`R_ z{2Okm>QHrj<3O=WOv<~YM3_925Xb1;c*r%dGL8|GsdN-qHxPVB9pBOXM&4$JpJno^ z9PTY8+rhKSrTM6Ep}y6Wz&VZ~-_zq1HlZxX8UN<8v74V&+9gQA5roNA-drE_$V^PR z2qp<99U@?CNC!1$bF}YV;P?oKChXiL#rh>>fKW8}OxY5pJFPJlx@sVWVZRp0D8Mu; z6#wK6vn>+9c>SwwF;4Qq%a?=Jm&WR6rps46E`K5xAH`NFO0um_+$2kpz@bI<{G?aX z6>a5jxqk;!FBEt5+|w#)aq=bW{TR&o`lNV z=;Bis-#B1!x76@qhN)Groa(ku5sO)M!?#vuok+h3QYA>q@2h1J4hjJi*O3rHd+xf& zK_r0F%^hcGuv|vl^OiDdeuA=kJ9;hC#3ckAd??$c>LCD9>E0-D?|y8OrgcxvYj?I~ z9@eblLc7#H6y8d`b}9@|+;_`)vvyQ!?;>dG3G~HwjFK%3me_S$H1Obs|8Jm<*jF!M zk{U5Q>?E%5M=Wwt3tm>5E*)b3GTCWjU5jevJJ)zG^!gCyG^Ibj<*BMRi~bsYZdF3VRfkR+${ za}EDHAp0_w7yAOiPP{IE@Qi^SMcQ?ol^ETUDI;=1rgvYEfD{GRFnQYcuD)HIN z>m8ff4OgMC*#Ke&95fKQO7AP~i35qO>!r5FbW7Jhw=Uc{9(m&i;S;VuN^=I^_T_6l z3(z=m@o+jpciET(Vn*nKxWJeP#K<-zWwlTL&<#DCcciLKK;o>uv7%1;f%log$m z-^vDfnJn)6a4#Hh=k$`mpqMP5D%h&M?)@ zwa<^aWF@>rR59blOT$W6%^;<^3D+R|0E6kytB=>40Sa5)=59jzJ=c%MNcP=LI!fqJRa#&B1 zEllh~2Oyg}q$6Q|$;g^J{0)@(q~H;`&_xNrXvspwDi~aVI7rhPcq^wKb`+MyDpq5X z+5r;B#4OEWD%oWwuqkhD`T^|>Z##5ixSS70=e<0|HGz~k8oGovGon~*D5P&6n#6*+ zO&Y9s8JcjQh@9ISUwJW6z6DA(*_O*f(H!6zf`nTh&J-d~`Rr`j4Y|*^IyL1Jg~)-z z(gvCYB=gps(NDm^;kFUF%zl1z_6o`~$jl%@JC_K7ZyiXvAXp9(A`(TQRQ;tvv6zu| zhLx-Zo{zEhG_+7LhUM{k8oM-5=Vr=&j@&7r;z2OcD?xIvPw9C6;D&Drq-G-TRo~)c zV4}NPPIYx*HzVY)t-b=QRYZY4K9~NXoBCVuzJ0O#+>=2UP~uULJBSjcXgKlN5Mesw zPHhs?*332 zfesbpvC%NUV6hYmtfE`pJrp;`o0-^(r&g7?|D&4+Opzip3MP$vYCN|pv|elkE=8S> zf?AL>^t{(zJXN)_nwAWy@(c9s#q7s)4tC!OZh|(;f?is%%%%(uR%|IxfRhFZMOOcV zBK%p{5wj1yb;96qvoq^9ydqJp7>-pBcXrR*Y;6$%QZLR^c(n0;*!*Otn1lqQJF%!T zJzDD)cqM=vv1kh*LDMT(q0JzCPII@mws!v)8>E>igtJE%(^T6Uz~ z{4;d>6&2q-(q$SR9d%g!`uTk8lPxd(W}-YR*0^0evDKu?u!bNTPQVdILA!sYs=*N9 z*}xk{s*>W-t^*+cI}MVu@7nLgoFHp|%ds}fq?eDJ&c8*E6X1IuD1c1D3_)ugbu;nif{bi@PRpxcb$kzh z{~7i(5CX>$Vd-`SgT*;{TN?&|B`!VDnHLQd>G1F{sY$i}j~@Lrz=~(Dhl5(o8tD2ShHNVSrsAyVbVJo?>%=7$i7P3`^05! zaidZQ&zt7nUbGOFst0T*uzwTv-l*HG+aXa8y%|8BRv>rSTt5L+?tvVm4?f^(+#jN* zvc}MFkl_indwrV>B><>vTZSz7&2L*`8l~k2{xE6}-c%^cozSK1(~(REX}!@{>NCpcbU;CH3N|6e4dfbg^>{ zXycBYGM02^JobK7xF$v1vhU`xfZQ_qI$ycxEY*#E#jrr*>Fpuo_O*F1h6T={#6Pm1 z^?sp_xarI`oDgVwyF`9g$HodC*64_BxF2eA2TVU9cO%U2F9&Ayv9gH>|K zq6;D~1-Hkw8`|%=k!sFGoA!J2z3Uwdprvl4cyqqzTC;Psh`e^NjUoi+H)R_I*3-Sx z*|CahZFbhURQjMl?d-2Ffs6JV!BSls)6qxqYa(O~9&~O5ohpv&ZkpUvrRY{E9nhQv z72h5^3X3*G-$0T{H^E&z8Y zOc&mWf@6!+QMEL-2}^;k28P=wfF2sUZ-IR=l3NAri|Ya+;HIihcjBscKtb1V#tMVq z^9`5zFI`hxrAOrT)36C^*)16)tGF}cMXx2QUe&N?uc(MOSR99T1B`kk;d~}$=?mC)^Cdy}4CL!}Snh7Q%9zR!WBs4)ZS?2faX}Fjl(S#<79%9I%mJI%K91A0y z$$^pT6O_7Af7yoSrTeLxBQ~@M&lf@{l)#TI1H~zT2L7YCBzb&+#|++oE-ndQVy!pU zoO1g&tJJ(x2|2M|z=vWBn4d6rs)_-|eB#R4so`Y|8-MsnLt>Tm5EfO)H%#>E@USvP z)t(CUj4e%5a*5e}ou{UMgV>%sHnQBX@*!tY!$()*Q*iIqsgWzkQ5>I;CS^6VS_>mS z`$k>@8ql{aQ^?{#+}}#%Pp_O1JZ0x`Wn?KllRZSEdDhdPoP!C;W1$(bX1eLBK1`d1 z@boW7`2;ZpyjSSZS{)t(ufR-QT%Wvav^7h30WUu@vfN($VXYQ5s5^LwFK5x=+dhXZt22%QlJw-KUC$5rP{b z``;e)v1{j0mHHa!-p7CEt(P7+VS+i_@@~GhN(XE1L38N_|6?C*Hp9uk22l(sANe9e zW>hgxjlB=<>?*^TGG^pDd!FTJncC9+X{m8EC>Hy4d2v>2v0WkY1(qQwFS1Nb_%)-3 z9!Xgwb!U5+tsHIMf@yxwp7(iWTk9u2fHi)K<@QEtplGE2%0P!Jht`HC7QcVSoDj<& z(-~q}V>kVA);&Q5W2w0?`)c-H1$K?`HevEZt=CP>BP5wWo%C48gHuMtN%M($_*0sp zICQhGf0N_;nvxAwbrb@X+s!rZYuz_i*3m<5{g5*x_?vtBfv4oU;#*$nqn-^F?Vf+) z)fN~z>rMbDVZ>Bz93fo~!k&(aUt~(tC@1nH9OlT22z>Zirez45Sn_1?`1{diUVN_F zQ*^10X=?4M>y#VH8=Xqj#~6WyGC6lu^%1@$*nJ{l!Y#WY z-~a5iYnt~2CUD8xKW!1bo=U))4V*2gdTspEI=`1e6WX~?+?wOZRUIM*FhS#z)dxw4 zUVks{!kr@Iq>Me2j}Si~!^I~EdXzpptES!$S4y2u0N)nIIU#?z@*yJ1EQB!m*O@b! z-^&CyXgnE0a7~DLj-jF@<$i>_05S#D_f75msbbdP+oqE-^8mQM*G%msz&bI^^^_m5 zk%mj&2z+a8SRnMnmB(rI0XO;#=jWULRIziCIwWNygAUyv+d%pq0DF`Gx9_c=Dz*=N zdrq=0;HNeSJOkbMU+4bUxd^lWW-eSr|LbQ+BOqJ)DXQUqSuJtiC#irR*KMt9UFAH_buHl!G?fYQXz(yFFbGvu6m&2! zKrjpp%spHj;FH;h=vfSmn;5DJa(WQ(dg|49vi5_H#$IZQcPVat4`t=B39#A&BHobQ zh#>JLZq-fKy5M{yd;Pj176}%Ko&u(vHWteg!JD|7V%+tW^%rjTHJ)r*TYU!(TYH8} zkl~5a)uJuL>T&OeiN57S;Kw2pq!)nq0FzS|y8wec19YoMmMTz0fv3k(`+q(I9$?4D zg+0gm$3vGR0%HvVnrOfMSVaCD_m7w0!uEb2_ut3uXPN7wn&jcM+tE%B zpLWILF3?)nK&HHQu>p@H`sh3MXx>Ab$ui3;Px?~Ac}!}M-*VO2&FTcjJ=R~?ol3-C7MmalZo<4HX6Z#1Y*QPpdbLtsJIvDOd%7Qu%0V{$Y5H+Bn=|#< z&a(}xTRW4-YtY7yXnF~kA782WCy(=zo$hTR;3KoSB~m^IqJ(k*PgaKu8Dtt)i;9P< zBPsa|pclk+q8TS6)%J!2bfVYe;^J1f?Ck7{7}I?Zl3wOKtb8Izt2I$!?W^|A5INJ} zE5WLj_PRG&r1eQKRL86A-k#J4?3sDanax7YcuZccizMkfHVrS~J zQ9YnTla-yFKp(>>Q+ndr!&94K2nB13pB;UVF)FjbJlL9r?iCwXbK(%v1XJ)BV|}#q z^VJhPTFFn3Cjynt8>Wi8?@UfFrTa%y3p^YsW=MG(Q4+25D z$o(<%&gP)2nWI_BrwBUhbCNJy5)pp4xKTw%ABquEhUM?WU5 zhBZwh;68&5zCL7J1{&uVRdz$D4qE37>z;Re+6;%%}5%DSdE$Q*zZ@@d7pk`w5Fojo0pv z<%vo*(i=BMiuXM>Cgqxp(df1tS_K!BP4VSG6lgTpz3^)#6e%c$fDjkwTmEWWz(TS$ zQ^iHS_Xz68ckO?Z%E6nnH@nyEgaVl?sKdaR$iT7Uu8yLOK#S`h=`1V#zaif*2UcFmBV!t$Wr3A>B~jQp5CL-DDU+3iD8 z3`z)(d4uH1-b&DDiHVP+mS1caF>UzQo|pm#DQ~iINeg+P{sc#Zun+^~EXwz=@iYQY zw;Ijm3S~?3neaogny}KCU5oR-*xO=0!7RbNf>XfB2j6>hQfp5H&F^QK_gqT#ELtwW z$Tq;rQI4i7L~5L5H76-#VJ~E5Wx+hOvOa*m8mr#FuWwPLh>NWjMnFAZj>hMMWytPj z$4Ku`X}>@pFX@xLSRXIf+?P2+$#WZ5sVMU1I+r$aX@6H{^wqOtdH^N2Q zB%c^%c#M^r6%i+J8G6*koZSyFe@^mhB;vK_@y_DWd?X)il}W~9LHf4R>jyFxJ6VN- zoL)7Eh%<|wDp9R<37bB;eS-|k)=<3XEG(@iB+32hGUmA=xbZzPS2mP`8T=Q70D~B* zV}hX7>%D_Im}Yn?3^@v<*f*IU{lH@Y`GCTl8_#P>52_-WE7&Ej+76DxFrW$=*wPnU z7ii)V7d8vicBMrLsw~1^G;MUFR%2t47S{asg&dm0-BHQxg}7#WDY_L5DHJ-HVg4Ml#sbxMzdf zOto3z_Hm7>IS(BcjhMT+>w01+!iju1LFtct!rRn1!*O8Vg1v9$MNPS7`3@5H2qzrn z{KjqVIMXKMYl+^d-M&y^HqkM}inn&qu=@ffH;TavF1_@CY93`JY>CbMQOM)^@^-o7Q2^giPIY7lThDei}IbsuxclBPiI0AK zIK(kuG7{G~QlNcBOZqrR8TpP3pjIUFz#T;V8VBMT>wG%NnD(NBCB4HTUfV!$bvbz~{9RJ#M#$!;E}@5HP>KyonZ z2BODDZ&hDoiHSQ8fp4>X6xb;U^1mseX?_15*+cr$8Pf(0hDDSvN9 zNZD{LF(5~QV{t1QI?hs2#M8YK-&*fHE1eL-Nz={5U-ByLjr6UHSJ66Wn9%jFH|r@y z^Kf9heG;+0(Ti>z751SyHm}U8E1YJ;C3n9H9OHn^h;nzCCg$Xk<|lhUlAXOva&seI zZB{&p3HgbTk-5YVFgcOBm|eFL9KSri72ouxDRdzPFIYAHzN{9L-J9>6g+!#PWS>aK z;{`#Omf<(Mxm>&)c_l<~ExOhq;YUwNz~OW~)!#}TLRj!S9#8Q&r}w8y7%o!a=UjWC zu3$*<cUx7^#1g zSGd}xPyQu--YyYmBK)2QLo6fpnY+AZ={epi4A2Eqb*GQq1~;a< zN3C~SY!Mt^7cCsw}N)x7^OeEYx2!0u7uHeEy zfBY=%D06*o-B~31Y&y{$*irULygMx>RU4fMT}*kh>$nN2SXivqaq+S#FxE`~GxePd z;+nv{t3mwXduj{XHOMz5?acjp7+OsApuUQm4&OVXo|Y%$z+6)?y3_s9g-wcCd88wI z2cM@+!Cm+oJ)2k+pMct-gXhN#6@A~tBbyK_$sUD8w+P^X}q3w?409B49u&_wfO@Cqkxj6b#)UxA*L{US)8IAxK!TEOoA zL6ZPS4z2={O{_5ARpnpI3Ha#p`(IA--^Vik!7Kl3kpFtfrLyq<9x}ZLfrPZe7CQ@F zMvZ>(lgD!{A$vr>MdX9P>kk5&@MVK$(C4Sws&83uSr`xn{w8kd$?5{%TXe^B*iKe) zSSIei{O!wI1sH*pvH&RKcU}0B@*Jnd8P{7pOyPfm+sFVD9Gc7Hxw1b|U+`4PqWa7YpLE=2EUs8G(rMIom+GK-@pQ_igV4#SsIw=Hru2^j%rdz@<5<>{UZ%RrMY5K2dvDNGdD`?eRlnCudLm=4Lf=MNbQO)O$r&Z zb+(S!AH=6i13H^ze=~CYRbWfN`3N=lX|rx^;Io^}qRCYvx+eG`A~Ht$1b3v^&@kN* z0i)i6A2P6Nyw5=UZ%%)HFXbZ~%^($VbOd?6Jb-yP>)&{?wK9}n+|THLwoPXa{~j&j z0_XyB08TMTpKuV~+nk{V3aJ>tb-~OpJ~Yv0BvH*-2mh=2U;|crLBTa5(2d5k9d$Yh z4+8lxB7G+mz)Xw%y${x}Vd`@X<=qdGtPdriewid-Gatt2*Cfy{86@t$iriZnI@%l3 zdbT`p>k>wd0}LJEck1}!Y`e2)6A%Wrzp3+O0;~XXzCY%M;XPcSO(o+88!R=n*th|? z68{FU;J=udpKp)q{AT7xul=dxRE_1rmpHLOlkg+8HjnN3c07yRFE&!%d$Irld3L%{ z`@N(Vac^U?+HIPZiwhs%Ba94wN0wE#gP_`JSNvdSW^XPM^W)PLF}GnGet!Pd%C~G< zoB_O?A%G=vFMS%rtU$$}_U_(8uk~Pt-Fq>E#H5o5SWW-euX+LE*4<>-+2<$wt;2=7 zBaJK}a^J|D;QI#qo~rtg&Cg3WwJpc)daN7in}55N=8yK8hJ260O9>;S&HF~re0Mrm zowCY)O!FM>bGT_c+W`L?OLjb^1ViL7pFV#s*l>aNNqBkZQ5$ZR(+mwcr{06(dPcva zTcc2OV$7*$-#b2ker>f`+O!dVgYAwBQkH;5P$gG^+w{|Q0429u#YnxoG9Dftu2c^W ztkyyjK2ZBp)JzXpEwlpLUc1qFvdWe4=w|Mt_6W|Cy2o9lXU9wF1rICpUXERgK0XKQ z+AD-;CYXfhre5rHqrd-8A{(+e!RFP%*LYT;mT*0QSMAcK)qk?7n|w?h@r_BubPc6! zLV=@_Qs~Q}yVl*vv*TS(HbaU$_qEaci(B2Bc)lll+G4Qkrz5W2a|u-;VGQ250OQmV zt9MNuE;cBksq@$n`jU=BMe@^L^nZc+J^tUBYk=_x>ynF}J8c5#gX^gGRsR<5a}_V)IwnFu4C42J z;Ch1v1|H7EN1-Q(G!GG^9{4Hy8n10*YUmSZ#GwPT0YJZlo|CtZ|s!w*=)GZ+M zV*cMUFC4+gA(nHGs5JI=wEb{FX7rs=qK^Ypp>bm*kSltL|Cc$!)A$O%e$}|t7h|Lj z-iv=QBFZzWd_oBJ-Pe~I334R_tetf2-_ya`Jz_^^@DzR+*^`yoMwv^oD*C41#rdJW z;X=W8Y2TBA>{mBPN%1Ou#12`3N#pz}#QvFCL*zBnB(1CPAr6f|d|gMHRoTWxEK36n zQ*4ZoUYrcb`RstmYQpa82Il}~BXIpsdmqA(&B$B@_i}_{I>#_bz4o}0f3Vb-icbhx z>P-$atM@33$0;G86(#^=Y~l|>_7uZ@UiH*}@h(2Po&GM}WduBb&GxdZ~-AvWMD~aVp3A!e7 zEdh0yivLmYU}<5!F9_;XC~2R&%cF2nU{7C{Ku>fG z7C3t;wQ!ORFzEfoSh>~Le}JdU38$T08kCRDb#L76d3{6T&nP}qYaG?YksR?{h-SlMoDyR5^z{|^UBtlvvzco{ob&E)+vw*pk6S3h*bG+&sU~j z7XJ|WXgaB&QaKz%$Zn(JaYefuMG5srP+(0z9Rh=#`A_K%UrI?v1xR<3;428;nU}P4 z=XRKZW6NGPMS$h7z`A0OW5un0bB}!K%e7x(Q<+O#wBt?wANM@$LORGkh;GiT3TdLp z-WiXRy_9D6%TC{4%dNlq-A?E~?4%Mp2mjYk@Cksfaql?@8tui#D@?9 z-6WmH-RhSifkdTw<~>aZvW`%KJWip&Z}0bB9s1>Lfvq-!Vqcn0d$eXVTtgmBzx%q} zW%KT*i7JmC-8r@V%|uHwzuaS8<~csbG}4s6)f{`n$%C*euL zl*tSCZ92V@HeBZiihN&_FAGn|ihqc^^B)D_Cn)32xLp2REF2iuT^xiDYdn{{I)V#R z(vsS((gGsxLnm#}*p1(YNS)eU`iJNO^h(GT*a(+Ei~ZiT!2O?IXqUqOivD*m9Qx^n z*I*~GbY=Xtp{_N6tNdHt`aOi!#axK!C9aC(TCVW9J;-(?tz{AL-bu>!1+wrMcLUW| zKchdY-Q}obt;^lUgB+&IhXE0>1%l}V6YrNA`Ze(m>Y#Cw-zR?lYvPX&(QdZ0g|$B; zuY#pg`)w1gUN8Rslgp`Pid)>8nf`4nWbl55gXrV2h89eOu|D;jkoRU%-p?5c_EEJ( z|30IYpEGK?C2^SAN^XcP(o%mmHc@aNDdfGHl>c*xB!UW-_WO{D%ORTJv>*TI1-M*L znsPm`AVv^ug!Hp*@89sPaUTXp=w&YLpM8=|1Vn71P1;X)+=W=7ydVAMjy8X|qr=6T zRNctmTGiA+igI#vE!75&<_6U0L}+#7=3i&5v4C3lFeGTJdv+hw*}&lE z$((|c(vMFoz!6mpa0ErYQKPxBn^TRkcv*n{6@C3P9f>|(+uXG!e~dKSKOHMDAMy`A z1XO*xYn(x~gRj=C%79=4(O)BUmJdhJM>55%%Sb$^AKmb6@1E+A8dcdGl zPkiW0z4t)o;8F4Ch&fG`%!Lgqq3%6Lf|wi zysb^a6b2yyj-EyR(XfaE3O+DhjO5O%L8r@ihFqeVmwWkH-`@R}DE&NsRzMsWPbscb zuxIa%DY7^6f?g7Gy~1{*vR}GKy*dDDO$3y$KQZ;61^y@e;G?UsTf!D>oHxjxX(~Lg z?yZ+p@;&i4+YZ$P$uT@*=qb5X75V^*c$qM2&?;INY%!EccCTxUoP}<#)Blv`iwCpw`%o>pcv2`eib`F82cb-_a^&|0%Qzo4wdd#&+(jZ3;(oM zTEACF|H!cGfT>xUW`LV?(m{A6;ma45%I6#f=ViaCRM_YOo@Lo^5Tb-~ko^k@;y&qI zNq>B3lT=FpMO78HoiWm&d&;@71PuocFjM*$F4_b47JwiR@}a1~bc%zr9=AKs@cD6F zaRv_FKJaO4Yaf3QQG}B^YE4lF6VqbC>}$aHS`B~z9EYuPRTVIHn$h63aJ+WPzNtg^ zzO{!AoP9q0dc)+nx*?&nZ*201Z;9ic+sj{eHgM*kLpn|b03d0aD;C)3z^*TRem_t+ zKjaiEg)hY+K`D_k@C`^WA*{H@^j^?Az&V^Ao|78`tRvY-Y4}|{Hit1{v&^z}_(Hv} z^z1eV(IgR}>&B3lObJ(RAPHCr5`{9XthM_syQWkBLM;_fcUgv=z3P9~n9&h|!6HC6 zk|Q_k@2#RUVaqh!fmay~TO~5MqN9F})zk{oE{y$#k3cSpo#1uJG z^Muv-1^`gJf7ty5C@~^9P`2MPm-oRR043r+P@5fT`2V^#hsdL+<0I;NgJ|bw8a!Ah zg(DV$(9n{u{8dETDT5}6e=njJKZ_{lR)^lO9R)C@awlL6>t7?RxmX$DoGg#nK+mPR zB-^pz%We73s3AoD9X?8U!>Wo_w7SvloWN8LNm%qF#9IK!*|iVo%VM4Wp*a4`W7wC* z(n5|bo&RiiJK8(h+pAyx@vcNmvE-&Q#Iqzl@Zf&ZH;ccTj}WqC zg835%VZF%pzk?CC)_Aj(faUgwQZEm1hfckrmOB3W?I#GOFei8-^ZT66euB5T*jx}S z>T)A0pW%p;{+)exw&%@70f57OWCLmwq>%{%eR-Ox z5kPm5<-z)d*d}Ls47~&e(2t~~r$=^juo0OiW&SMZhpB^@6%adrnGfc6*UrI-qE=>&XyD*Wq>2b1>Lo8SI-sq1&J zHP|hv_mL7HM4665&m4tOY9Cr&V&hLwy8zOyiiU<>x(^5;u?4#U9PY}yx>nRZX$>WO zFK9=K@LEd!Yl}bwJQc+`v8W-$_^6ujZ*ZO@HYB~MOGfur$%D+7u5*h$iB^Cze#zT1 zcYpGoWX490RrlXRMj+%@82cH=Men!+K_gY+D_)0%3*&1zVyg4piUy!12W1++6^>?# zXy7gRP_j?z0xh%|IscJ>aGzDW1k~D3H8H^=DR^1{LDS8{4g$#D+khON4JfpK%X-b} zE9{0#yg#8-qo;;^Ek>Xr&1I7r`Ce#9$Q+=R$fryD5>Q_Sgq;86iH1$5%HrKP)Q}iF zRLv0MoY185IZ)~M^JCK+|0EIq4(9G&5Yu)K69If+ywC1asaejZqP@~-K_gHF(PT_0 zZ~XxCGg(tp(*OoN!Qx*>SDBrcZ20ZZBLi%Rzp0aak}(kUWekT<9e-MhZvag}vfDzy8^X5Vi{uuI80{P#m{m)dbVKQFtKWr=rbT+?K^B7Yzo#|n! zpH?H^n`l~#{A)1QtB73Tcmmhp!yE;O#NFImO@;c;i+*ZIgWIDo*9!j$;_;k3e4N5B z9a=xwFre1kMVCest@wA6vm5?3h|e9M%>RWDM20w^p~0q;I5DaWS(HkgbX44Z^SV6&)?1&tHaf0T_xk~bV{G{zksI<-beMY)`6)O!s55EzFoemwDM z#c3ZXuzZ$pFEuj4duJC$NtCo3Nf?3&6ZsPeed2dSTkj;8AD&+cl&lLq86AD0W6=h)K-^tZcbL=F;z=z3mH=F*a<;W%WFRM zS#W-yY2f^12T!5X7j`xL8i~=~?z8=i(%jCd#akCD$BSd%#~aSMYpkz09lMs};^Vs& zjaB-1?Ja{bxeQa=>h|-uJJZ?9y?Z(IWp3R9g@?x#Jdh@`wDc$#)mY zHy)~2a!Uw#zldx)KGf}M{@fD~l))1(%KkFH4xkobQ7vDIFJMv3TZSfH>jv0}o{5_u zk`i)}np_}z<0_rY&F?$xLmEOom{vzrbrKbo!?xXe4Kr5a6VN&T$B_rDRe`-SP4WU#GV)6J{9dY{`pkWW1|82 zW4+p*6&bqLT_|2Wme%pXJ-^&)Ol)1og`}%%&_nhs0~EtK)i`{40uJJQ7uh;YeO1qg z(Z9~{yxt*+s;xb=*qf%Udw<56J*?8k(FlG(#;S4FQ$nnx6;NfQL*~5?bafbFj%_n; zHGinihig746j^BgfcM<+qh$E@je`Z*(poi8W3@d?-Ne^1UD>9?8WYYexpPQcXXlUe zK$2h@MNCL#Ma3QWRlTntgz$m$!#-{6-5la+iDa`J@T3E)&bE;jZ7vU}Th?oVfh zSFb?$%=`4*m{>c|lT(I+r85m{lB=U?&+CSXvOl{N1uoahpf{?!ro8nZ_`k)?k9V%f zPLSah&qK>dNl7h59@p7-7x>@}hbRZnO>M=^KHJ-cz^dG%@ZdB$fox9bB5 z1*OY{wJH$`$2-p$vU?Dd1^NO+(6jt&^WSIOg7*<)1#9a~$0fFX+oxj5<%AVzhaXHV>a}>A79kGt;`1@LBYcvYDH8Jy~0OaJEu4 z*6_!70Y{&36I#8{F9~J%qyp6olaAa!pBs1TWE)G?x${Pe3*FFXY&hL^#zpa*Eq?0! zY)}b&0X9>b`Ce&vO0I%N4QVG_<-8DWDZp@!S>w!_60$CPa!&0q{v0R$exb!v+T0xJz~L2jNHj0Jkk7HLY;8pk1Z!rHp4MQ z=G>fR5*~W^(*m|35yKq{VYgXF888p^j0Lqirkn+vPZ`%++WOZAt+&}!p(5-%#BRm2Xyt=B2yq^K1^odCUIn3UvAM@=Vp!5j>#Np#x~OaLq}Q z@VvaK66Le`xzpt{E(}vm<9`n1^fR?yvsh_qYW58!7RM<8yE0#g?7Z>%=@|NGS2f1H z&Qn#JMAnjUW711z;`Te4^Me>&hWr-?7LDBn+CpG>mW*d#C`%8zIk$(}=p-NRJLbBf zpF6PF{S8l{5siMey1Tlc4+nJyNN{G$r7~+IJ-bfHJ9)uOkW@`Rpt!BB6R|0>#aWzz~M zL>)dCk}HKGz0Le}&|EP=`wuDkd$|4wU$K$Lg@q5-`j(Z>Manfss`~J3WFe z*eGrckqOj;47J2{pOzeG9T#jyDvuTEVR<=j_P{>~@d8ICBwHIzOGCu$v=f-x7X7=o z6@zBvh_AsWBO~&>G24ihghTFI9LjBY*T*O+1p5Rp0zs(jB8hC!XOOrl6Y)rYVHCa8 ze5E*3_50%&s5xHpiG97t(YUb@exUmA(zf9Z=NEgp^~S#XY|?ad^C&O&Hxx|Aors9r zsHbBD{xuAfRlG@I^;B+!)B%PW?#(Z;ovzS{xiXX9*jQ0Y3lI?yxB*zShtTp&LhQ7C30}`0yS( z*~bu^mfNn`DkEH>*_zcVr)tOC7Gn+1*TrmG8(M|eWgN^WHjRqnV`TG%`3v-gXm_GI%3mYwt z*f%;%q}Dnq=7T*;L7VK65sQyd-=^xzyz1#cRg*H(Mt|eb7K27E;;*57ijXbs1TXm4 zt_wTv5=?;-K-r*2uICeO)Kut6iu8t3%=NNc)h_6JIBCA^hx^7>*|WAEvl{zhRS(BZ zz1MPaRBEj)$0L*V#6ug0`x7tBhzGSvAcw7HexXL7Us+Az9?P??VX4Q#h zc2?mkcvFzG?6mJfsQFxetSH3Fm_)X!wP3eQa2&ohH)6C{QJ}ubGN{+d$kF?Oth0dR zKL2v_h*1*UEwK1OmaksCFT-$YLO>@&X~jh@$i`aQwKAo%os2aGEY$xT4D zPVG^xBp5(1QY5x;XgcfXe^Q+^9CwD`n#{ErUN)1q9NU)my8kS;t|4O#=x0w|0;XPK zOu@T{7xn_qP9H)t2VXSySp!JNLJlN6z+T8XV6@zOHK2be@$2(SJ~$TMJ37z#I$J=^{0AWef~( z>U_tKM`6<|6XsYyG_1H?ZpofR7u^Q2xml!h3-8=nwWGr^5j8@bU*>LDq?`S$+_J#< zmdHif(_CAEIyhOL|967AQmI1ITQsWI<_f?p6o-h14CXI zg|8mY(l=L49GGFhNKo2;bLVK2)2LyUtl)64ft&BPgI#JEzU zL2y2%gzb&SIOt8JDKI>VA*c*WIeOcaCbCSwJsYZ`b(O*IX=)ufR!dT2lRN>Q`0@LD zrH0W5j%)6-+4j?+Mc|E2QRRlyS$*uNRW{4%Hn?V4vA)5%+p7b-^@hVIHwYN!iRz8% z1I-?0uv&eyFw~(!8_kJD6pajJ93CpB-a(@EpNilv%@e@7`R18WgUdhaEDY_};=-P0 z-7hBPjFQu`n<>J|dohVqy?PN_(vW6++_RSO4lV~3K_-ZY5W;Ctta`XkYONuyLk|X; zfNsdyd7z_=>h9xL((+4loFHe0ww>o3e;ijOt&%p!8}9BXass#2;ubEjmFTk#XFHiq2nU&*7 zHS5-a8dWULch@?J8z;)1-^Y2By@)@#8v$AA-nBCbbG$mGr^EB2YltHOad#a&ONl_DF5*V}-=^lnU7pPLc#VVHb24Ssni zaK;b*c6-MsY({ph8m#7uWh@e9Sav%9%6Gh?)u+m+c&b7bgg#dxm%Qj8sx2sG3v)0M z!Gubi(6)jRS>LG66cw>O%za8382tTi3px9<}KCkAOmr4{T1gmims>jcbx4AN~5Zr9)jM=*hPIH z^!w69et3v+=J3cKc8VY(pQye-jx^HB`%zS?`fI(D9Q;QwfTSFh@6s=>!4;_?)?uM_ z?rTia(hSNm4DEpYybWC3%mA9-(WbZi{n=1I9^PHT`$OHd7+Dl5u_AeZs(J~&G8Q!9 zLQO&R*!n6z*Sl-FWvuRtjF{6`lm(ulY$=Es``hNeANYt$pY&byG|mW0Zm1 zJ(wwQ#-v_puHM|?{b6yh>e~h8o9!$ht}-8!G4|I-dpbnRbu_v6?7Hx)X7gVZYV2*0 zgo&`Gv>r63OnH8!q_k=@4EhkaJarrM;&eb_9jNECOccbkW~5Nq7NbWl_}sW0^32u? zCi;l4W}|L_Qi*mrx>a3EzkLYm&{>nZRCyS@zZr_>kzN?Zc2SAFCY)Y=#pvT&BJT1e}!n1u< z_o%It7iS00^ps?5E4sVDJl{z3v7!AG31m@#=Np$Dfvch1hv6F6;45@zxmh2qBb*Xg3!YK< zdNPkUE#-o3P$CxY;uU+u@s_o!#fNdds@49}h5XHhVZoKL)WdOI#)aPS8KsVU&;`Pt z7Qr!kak|3@clx4~zJqRm8nSLC;knp{GP&7zm|(RY*SK@#4yH#u997iRTIfBe19{Er zj@)uzoToM=^G&#NUA6;xo2p1$Q_UDKA8c}8d}nIwV8CXom_e6aIO)zMJOMSSojD%y znRp|6{B6#5W`Kx*R8h*63I8UzpGIJWR;r+bWnV-!Q#;xMl` z`_9v+G#(qC58JUbAWRP`Ae)8ip!(Y9;Vt!Vhsxa2PxmKPy78MjLNeudadELEl-%JH z$~RBTeI8j>S|cMrQ=D53?A&=|#ayvI zW$pye#CmEN)zS#Ab?zsl{0=+(IF;zSAv*oSSM~MjI)=wawem}BNmxmiXYkB^azB%L zyC_S{#A)}bGi$9uoSE`?Z=e+M0I>Ot_a_o>Ot^1U+84dd;s0plhIa$*u$|kn5L+~G z+Tm(D0#neW2@*Md>dw3)KHnHM_~V25G_N~0IM>S*>)nf465_{8>nF*xJBKkcw$U<% zX)QL?Z?`v-?+?}t_17JKnE8~2e=<{hFZb@37QsWH z&ZI{>7itR9?$7boYkk@6Qr==tkV95)1x)MVm~*fjbIMmw?xxf|x)@xz5L-1;r7(Xg z){U+jMQ_q9?o-Ysc!!WLjs%D_yZ|I;UWTMl;Bqi{BdRVMXxyv-Zlq#DKSn1O|2rFAld2Z$PCwGO?oUnJ4Qv$EJ6Uupr~v zH74?5+=bHFxpVPnYozS~!ck0QRp^TDQ2at!(<*@n;&qKpn^E+)w`blwKWjh`x#3xm zzY@RlQSz+V;FZ#0bR3n4E`^=gAqy)F`&-gHriaGbF4G)%RyLxorB;ks7K?sa>d75* z>~Un#UX2ryEu~g)*W8vns2}X6YS>De6-yl_Tv~fE2KDr>&xXZBMor-PS38)@ko(z{ zv1Sx!C9uYoNzvf~;Qw}@W$-w$Eqrr9!^I>~X=82QKa(7s8Etc^x}iK6c`AJ5WtQ5F z8!|jQK6yh{7dOVs+K&@Hi7cOQ2?%X>4PUuF4zz7R1ETW9FKEG(#iOYmIV+!ihUx$q zwzA=)&hq8j;~2u(g&|Yp?!cV8)6d+nB~PGH=&!}H&}Tu+FOCd!CC~Q6Ke~&)YBsSh z6nLU=In5nm}oPU3(4x6S1 zt$LjLUDX-UQSLEOy_}vJR@`aG7VVhn`a(Hos^kM1{q#BSVc}S#v-R_a3W80KFRl8W z1U?hgayry`exo@0W=MU%ez6~m64A=))-JtLydT-249J86)CJg%YL6Z2^2HE;NSmsO z%enK6UUJT}0%rvT@Q!;oAd$SN?s+PXWX~z{x9WBeS{tak_{n7{KGU7E0q{a~)0Q8y2Io}r8=gtz)0WULjN4vB*jby~}uY;ZJfcEk8?u1>Pj zCGv(@?o2;#Q&4?AM3kjtx~BU4@PsJt{n35#1BSkhFpQ6~x%3upm>L#`CkJuw??~L| z8F%FYmE9HQK@DXnQHTphHGfL7b1GXis)guKsZqRTcf``+3$xr4^u2SU*T^np5Wc?3 zA@cmSLT~pRXT=&{quykFog>!j7;fjq{ZGN4Y%jR>*Yxl^_vvq=x^2TAH{Kf{YjkB#t+BsL-Rg946E7kqsG#A<8|L-(EMCKTG!MD`i{u zUFqsJszwv!y;$^We)v4z*Pg3n`kAiSa0x?9KDc{^r%g#v(LVleW0shTkx! z-$BMmc`eYeYieWsyQdVZ!Bouoof#j_pnRo{Xxpr;<^~;Vy0w`xDCY+eO%HYJfzoH# z2#WiW@~bM($IJ!6ld-xJ4M(4Za0nlk5IsZTyo&ZcvDFiJ&Csa4I9DVh3CflxOTJSl z)|XPfxL%eqvTdNKZoMo6vF>9z5HHmRpStCMXL3^XaK_*+a78bc1k1f~v!j_-xm#&j zu+l<;QeVE;Kb^#nLMcA6sd$Y91f0^O!oa|>6%j;VP$+qXnH0H!uXtr_!)Io$;PJLg zyxORNb66ock_PECyCii{;X7m-&qEzZDB(DMl6YEduZ$#LvYllnwX3=Faq?+vlG{Vh zyQ?2eR+kkFYb#nemt-a_O=?;=-{CU1)itVd>w|(bGA8`gfT(q#-s;ZsvHJBpp2ICe=bQ=nt&LYZ zk^bL#E!WZre3*rNJg+*JNun1aFv$~wn)QlBg+pICXwF@YR5!e2Pw~^7aj_0-wreZj z@ndoJ7uJ6_3-5!s*&|y4QzcK*$(XNZHqF1$E zsIcMrI&(Ud9r~`jjOjE3wXPuot#k+F-3hg6LGYs2w%V zR?4?iS*}rA@RO&!ZEISNU;079ou*)TlL?hJ&<2<0OmQ8u-?ebg33vyR9Fnl%y&#u+ zK6RrBFE&l`ZQxrQ0T*Mmm`zwOX*<&cNe&Q8q#}DjLY-@g>}Khe2068+%?Q?K669y`8nG$QJhMD&Gw1ihhkHTVlA<^Q65i8a=&3Wn7+ps34bPAj&+Ew?@Amv z19FgaqbQ_q-k0vxqoN#Equaf$y@W`Gc3gERlT6zcj3=&Y@j}z7R~H(f77Af zq<>Ryodgxcu(R&{R;oGx!R5~pO z&pWEX`EZf~?Jhq*Sk-4Mf0_e^oeR8r>mbo;vw`$vo%4nUigCx8J49}Y;Fj>AB$e0r zVF3YTT1b8PJ<$j@#YgRV&#Sot4VayvK)vNI1<$;4~E4K8%K;fuP^o?MWe8cKNPjW{07pl~vE^dyr_1o6qKsMAR1-oO`gns4+C8 z2~hC7I%7soEbTPQ^p*CeI0&lXne1-*GfiwA9e%LfQ}!u)8s+9xR?7~2Wlg}S=>j}y z5^w10xmIhmJjf@h=#|K~`8tfz{L0vJ>1cpkya+(QAL#C@niTw4QHs9KH#m8Vc-Y0b z;7571JnvRb)L657=7)Uo=IEU#kH?Yri8!6oI1=4lba&n4#PO~`oVS#a`=>XF67cU~ zLaYN5ngS0LH|^LkF?9mRDwiBZeVRkvDDS4!4sSbdAYu| z!r+@=svExUCpttQx_|)nAA~4d;sMuki&^BRTUZ7B^;it|jv3dTCg@ zl-$-vNOkM|t7JZi+R#&k;^M9Ax$Xp}Z zep4^8x{+r)(o8*Rwv|xqNg)i~{2@?RJTh_<{EhmqLlVUQwJ+OMbHyx}qj6%u@L6_+KAxbJ2OpO=R{B94X+@^D}avPJcd*p5LAYbFtZWp8p0MOxA?S9hh(pp-JG-X zD3kDRp{DA77on(gk2!)(sgTd#&UvVG7tfVGGT%_rk%qjr&`sC@u}DorzlOg)T1XRS zy~c+eo**D|8^1dAHc}5t74^R04tBk9TuI%Vw~|}eCX3_<(Bdh9LQ~V(9ql(-Q<-YM zf$KZ8kKChrIRJ$y#+Bp1N>M;Sz{O__qG2AJcTl*m&kVmM#zE)l5!tceWw#oD?Vqdm z`OdVPJel-|giX)wqb+K-VqjxIn;;|vl6!ljc zB6jL>$wBau{#`(!f-(qhhikHd~$IUJ=Q8DGl}d5T#72*AL)sa@&Q zZiv5P$KHtmIgD3tSMOpIksD{JK1M&|s3SviIBiU%1+N;(mVv0*83`8Ciys&j*)QR( ze6NQJw*_;Yj+9>8^vc@IrW&rTc$pVd>85l(LUNt{xuL#fys!9&1Ma=*ar=pvnzk!% z4p%w4i!rytZYMulXY-NV3}55uK5dfqsWRx9ai`CClH|U3R5f)(*_`DG*p^@m zberURfS43yQ(4|?gXdzYcQ2{V)RMRo#Jx^ou<~pEQP(aU1c@3^qeen>B6$+G6ZM$|h+-*hOBz4lI(Iw-hai8-}-#E;;w-bBi zXK-OAOBiF^sRb$n=Wr=~j!rf!1FBgrt2QO0GpkPI0+*CiLJC1h>{^wrpUVe6$2+m~ zk=%o^p!#U}oJz|6*JemGvObM7J)Mx7^tZUqldlh`qi3WqREyqxPVBN=YABYc@M7%k zKyMw%Yh5hTMD1J%RKAaD)ee~}kNUY}p?|8gcJy#TMVYiSM_QnY`j?OD%&=hG`tIuC z^Is-bXlTu!mh)+m>sjGg0xGDU9Rl2XiaVPF&tq>;@OE#_s>+3zw=$0yVnqg6DI)oE&${u#~7>-4S)7)y>ym47H7sjrcZ+@IrRo>p( zAALc=U6!sJWu8{YJa!;>dAyS1vhe8_sKqCq?uTQqu+zj;VPL(E%%|U<-kLDh6fQRi z?h?Rp&b2@AJS8VbOrwQ}+bY8iCRX`+=nbN1 zPxwE{tkKv5&^!Q-IP{blB9$*-a|E~^%gWhr_jhkUMDOi@NgPBO^*Ax>mmareZPH-c z>@uDHOpEB3>eg@gBb*9%rZK%ZLgR3#cLI9epsf7@PrGv>UFkx_+GV?Kw`^)l$=c;O z6pkJ+gntVV$$%&P{T<;qlR53jHC9j~?@$`}W>6VQ4+9`Ow4$2@*KhmX6o9U$r0tWG z(D*|4-0!ZH8gD+wc%}YW zbprRo_=hY^B8&&nde{qUNa7G&N}F~fqO&nlpR;L8Z`u6M8{HH9k9jXjrxPM_*`zv^ zHXa^Vuhc#%B3k5Y`S_F#-Wf$7{Wyy|VB6J_yZaZ0DKY7owcl^6mY;@S-tF^|lwfA7 z1Qjg6S3h~zZNweN;<^9f>NaQ_xPX>J&0GYpk6IZfabNE=Rw12FMnjI*%e}t9{K?KE z_DNdBXcu|k4$Y8)E|!z0wmIe7S9P!a5C%(V*Q>%(mTU{&VshXHS%5#a*>l|@| zE)%~8Ch{|$?fX|zTdn~BOkil(MEk6%sT3svbS}toPChI5(M0OjK?0;TukRi z@5XnyR;H9Flw&ySplz0wDG2dd-S-)zkJ2uZE+WUq%!Q^ddM_ubtk0FLT}rux_iHG> z^WA)9qDcjLPb3az)gJuJt^H~?Fq$~{*pm^ON3}Vn+;K&E@yTl{@UL}bl_?fFS!=E+ zo+yf!7So+@A9&+gwHRx=2OF6b(zx)!1!L)Rw90TieM%m7{W4^HVAtfjl0Wu`5wlp~ z^~{0ow0Ez_ww;^MkMs`=enV$b+xtymeQ1 z?Eu$Ub@jFI$;iTY!UYkpWP7a$iJSAJb*DznSiRG*i@;oixo8b!O5zhTI`Z9H-x|;E ze6<-X>d8yQC2}!Tmgwt9J6r$Qu&%v;5CXHI4<4_1&b|19ugTA{`kv>Vt`6xJ<1Y)b z{aR7AD!DG>r4+zjdZsoR=79^F>A`8;0)%0LG@Ens~W}cYo40A z>Ww9(+PJ1>w3vh7*f69Ao=TW07VNIi<<1~#)7T0RX{rE0T=Fvj^^@L4LkW0jHA(Vo zO8}zifr}?MA+;}fV{-;UsCL!ch45Zv35B$bitSgwJzqs*Q7P)95gp!kNhpDW+9lZJclabwXnmR1gYq5Shv zYV(%O2{=8c(jfrvnCbU;{_4(@g4t385xr#6hI=#j4x_gTQ|Q@%CEW`NgBfZ~pD-{_ z`l~zoT*qBz8Cwkn0)GOFW|k&ufuDL81F)Qvy<*>}4D8b^Ow4*o`HI5YF0K(4{1~4b zGM^FEtjq3_C$8%@cuA%E(x81Dc)baqL|ERIs`UegeFFI6yC30OyU4tYAJdmW`mt-zqE#YrP043;RcvrfVPXreDJMPqTf}hfr z()3v8;qp_B9KA0QyLMe#Ks*Yb$$n+(J7=;v#BF*Jm?f_^1 zUwf#Y3O-Ldv!WkEo8NZc>mMPca8Ak&OY0ERJ81l&uACc}n}gS@j}&Q1;q}H$g;Zf1 zzZZE3+Dc4^SaI8g^4o;SMc_fJb^UCw{R(Z_qk(y zxHaE<^R<^Jtv?mQo+4S*&=ri}ku-jVnkb~BF2e$_JrIFXDZ-A$ z+5gRXfn#bH0+j~znjPt&uC4l%_3Gl zu_ww&3tV^zK?m75h>!2VZbZlo46D1fe`%4x@Bn*hCXQ|3eZm_b-PUZv^LJJ zV;PGuLi_Hg<$A$LVPSijJDr14jYDNd5YI(bXZ1x+Rl_*3x>d*E`Teu>;hgxj7R#Mx z3DHICvk!w#hH;I^p2|<#?Obztwrr(7`@}u1tE~C2?Cp0(?fsqJ78n=SJ(8ngq%|^j z^!w{b3hsFs5ycpw4xInb^~&==m$$Rw4*Y+&J_>;t80j<#^}l1o&%Hb$m$9>)>jxQw z#*gU(cqKcaDH#?wEFE-PX2uaPA8@$?5vT4K_jBHZ6QlJ2E&2H|&~ds~;O@_^uCtPq zLZEHus81e+3pADD;ld5b)<#l04ZpV0k&}n)Gy@IteShx0w^}8ISk~hyx_Ek0fv$oAx{4i=5hFEaYyw zIT^X700m@CwKSa9+es5qc^Uj;diYD5#QI>rsD~(}JM}cwAHdT7+`kB@yYiZG=;Txb zpF#XF0U=}{F}fWeO!CnMyMCMEVM|*Hcr6T=7VEveYnvN<**7=9(~sw+od;$FDAzwA zf{UCyM3p7DzbKqc(`cj9;RL!cHrNV+If&0q=W0N!tX=IUBrqjgQ7?kzF-bmILYDkj zj}_N``dx`HU(5?fenMq&-mg9vJ;Z zW%mr-!94aCco+{lDX071nJQiKJx}))HjHRvIe$Pjup@x5T!yMF@m;i{heyILPv7PQ zd$^FH>XU_}4et?yqKEvODR6FsgQU@~X%rh?cS8SQcrRDzRWlD-BV{YxAh<;M$G`kY zU^7%@jo2`RG3}^8$Gj%Rb`Nf|nyg8);G3F}47b>3YUh$qWSp?6F-Ew-R{Lx|vz{2- z3Lm`Z4&C@$Kd(nsIifGtEJzdEX{g?oni&Au`MTX|E$9vys6D0k{ufP7KXla=i)=@8 zu&0Tx#NhRdn)l;`zfL*!HP{f_C39dQdlP_;OUIjcIKfjlm;4iy*bN5A@;njAtHUuG zpp+13_Fk^fynX^Vz^SU=opGmj;SeI`AJO<68Fk#mGt>UGP-?fmq&DAC`B_m`^Kp9j zs^HC>^Qxy|Rl!kQrT>C$TCj&0sujaYqm>;ps#ElD2fXL8tbXKb%Vs3mfezMl2KyVRw8@oxYV(tfrp z3zBp81pfW|#y3%w#h36Y6Jr9_$gnjh<$}jEVj?ewfu?VA$U!wJ46iT6*#vXROx#n}Kn=WM(tMQB+g=QXm9)o;IYwqdh>G*IlxFyTG; zImLSt=i?lqSY^Y8XOUBfZRO)5gm5v^cMSMyZ)ktEKg~EOE2pN6^